diff options
Diffstat (limited to 'src/lib/libcrypto')
570 files changed, 21771 insertions, 53852 deletions
diff --git a/src/lib/libcrypto/Makefile.ssl b/src/lib/libcrypto/Makefile.ssl deleted file mode 100644 index b9951a4600..0000000000 --- a/src/lib/libcrypto/Makefile.ssl +++ /dev/null | |||
| @@ -1,218 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= crypto | ||
| 6 | TOP= .. | ||
| 7 | CC= cc | ||
| 8 | INCLUDE= -I. -I$(TOP) -I../include | ||
| 9 | INCLUDES= -I.. -I../.. -I../../include | ||
| 10 | CFLAG= -g | ||
| 11 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP= /usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | RM= rm -f | ||
| 19 | AR= ar r | ||
| 20 | |||
| 21 | PEX_LIBS= | ||
| 22 | EX_LIBS= | ||
| 23 | |||
| 24 | CFLAGS= $(INCLUDE) $(CFLAG) | ||
| 25 | |||
| 26 | |||
| 27 | LIBS= | ||
| 28 | |||
| 29 | SDIRS= md2 md5 sha mdc2 hmac ripemd \ | ||
| 30 | des rc2 rc4 rc5 idea bf cast \ | ||
| 31 | bn ec rsa dsa dh dso engine aes \ | ||
| 32 | buffer bio stack lhash rand err objects \ | ||
| 33 | evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 | ||
| 34 | |||
| 35 | GENERAL=Makefile README crypto-lib.com install.com | ||
| 36 | |||
| 37 | LIB= $(TOP)/libcrypto.a | ||
| 38 | SHARED_LIB= libcrypto$(SHLIB_EXT) | ||
| 39 | LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c | ||
| 40 | LIBOBJ= cryptlib.o mem.o mem_clr.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o | ||
| 41 | |||
| 42 | SRC= $(LIBSRC) | ||
| 43 | |||
| 44 | EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h \ | ||
| 45 | ossl_typ.h | ||
| 46 | HEADER= cryptlib.h buildinf.h md32_common.h o_time.h $(EXHEADER) | ||
| 47 | |||
| 48 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 49 | |||
| 50 | top: | ||
| 51 | @(cd ..; $(MAKE) DIRS=$(DIR) all) | ||
| 52 | |||
| 53 | all: shared | ||
| 54 | |||
| 55 | buildinf.h: ../Makefile.ssl | ||
| 56 | ( echo "#ifndef MK1MF_BUILD"; \ | ||
| 57 | echo ' /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */'; \ | ||
| 58 | echo ' #define CFLAGS "$(CC) $(CFLAG)"'; \ | ||
| 59 | echo ' #define PLATFORM "$(PLATFORM)"'; \ | ||
| 60 | echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \ | ||
| 61 | echo '#endif' ) >buildinf.h | ||
| 62 | |||
| 63 | testapps: | ||
| 64 | if echo ${SDIRS} | fgrep ' des '; \ | ||
| 65 | then cd des && $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' des; fi | ||
| 66 | cd pkcs7 && $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' testapps | ||
| 67 | |||
| 68 | subdirs: | ||
| 69 | @for i in $(SDIRS) ;\ | ||
| 70 | do \ | ||
| 71 | (cd $$i && echo "making all in crypto/$$i..." && \ | ||
| 72 | $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \ | ||
| 73 | done; | ||
| 74 | |||
| 75 | files: | ||
| 76 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 77 | @for i in $(SDIRS) ;\ | ||
| 78 | do \ | ||
| 79 | (cd $$i && echo "making 'files' in crypto/$$i..." && \ | ||
| 80 | $(MAKE) PERL='${PERL}' files ); \ | ||
| 81 | done; | ||
| 82 | |||
| 83 | links: | ||
| 84 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 85 | @$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER) | ||
| 86 | @$(PERL) $(TOP)/util/mklink.pl ../test $(TEST) | ||
| 87 | @$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS) | ||
| 88 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 89 | @for i in $(SDIRS); do \ | ||
| 90 | (cd $$i && echo "making links in crypto/$$i..." && \ | ||
| 91 | $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PERL='${PERL}' links ); \ | ||
| 92 | done; | ||
| 93 | |||
| 94 | lib: $(LIBOBJ) | ||
| 95 | $(AR) $(LIB) $(LIBOBJ) | ||
| 96 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 97 | @touch lib | ||
| 98 | |||
| 99 | shared: buildinf.h lib subdirs | ||
| 100 | if [ -n "$(SHARED_LIBS)" ]; then \ | ||
| 101 | (cd ..; $(MAKE) $(SHARED_LIB)); \ | ||
| 102 | fi | ||
| 103 | |||
| 104 | libs: | ||
| 105 | @for i in $(SDIRS) ;\ | ||
| 106 | do \ | ||
| 107 | (cd $$i && echo "making libs in crypto/$$i..." && \ | ||
| 108 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' lib ); \ | ||
| 109 | done; | ||
| 110 | |||
| 111 | tests: | ||
| 112 | @for i in $(SDIRS) ;\ | ||
| 113 | do \ | ||
| 114 | (cd $$i && echo "making tests in crypto/$$i..." && \ | ||
| 115 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' tests ); \ | ||
| 116 | done; | ||
| 117 | |||
| 118 | install: | ||
| 119 | @for i in $(EXHEADER) ;\ | ||
| 120 | do \ | ||
| 121 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 122 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 123 | done; | ||
| 124 | @for i in $(SDIRS) ;\ | ||
| 125 | do \ | ||
| 126 | (cd $$i && echo "making install in crypto/$$i..." && \ | ||
| 127 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' install ); \ | ||
| 128 | done; | ||
| 129 | |||
| 130 | lint: | ||
| 131 | @for i in $(SDIRS) ;\ | ||
| 132 | do \ | ||
| 133 | (cd $$i && echo "making lint in crypto/$$i..." && \ | ||
| 134 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' lint ); \ | ||
| 135 | done; | ||
| 136 | |||
| 137 | depend: | ||
| 138 | if [ ! -f buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist | ||
| 139 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 140 | if [ ! -s buildinf.h ]; then rm buildinf.h; fi | ||
| 141 | @for i in $(SDIRS) ;\ | ||
| 142 | do \ | ||
| 143 | (cd $$i && echo "making depend in crypto/$$i..." && \ | ||
| 144 | $(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ); \ | ||
| 145 | done; | ||
| 146 | |||
| 147 | clean: | ||
| 148 | rm -f buildinf.h *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 149 | @for i in $(SDIRS) ;\ | ||
| 150 | do \ | ||
| 151 | (cd $$i && echo "making clean in crypto/$$i..." && \ | ||
| 152 | $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' clean ); \ | ||
| 153 | done; | ||
| 154 | |||
| 155 | dclean: | ||
| 156 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 157 | mv -f Makefile.new $(MAKEFILE) | ||
| 158 | @for i in $(SDIRS) ;\ | ||
| 159 | do \ | ||
| 160 | (cd $$i && echo "making dclean in crypto/$$i..." && \ | ||
| 161 | $(MAKE) PERL='${PERL}' CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' dclean ); \ | ||
| 162 | done; | ||
| 163 | |||
| 164 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 165 | |||
| 166 | cpt_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h | ||
| 167 | cpt_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h | ||
| 168 | cpt_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h | ||
| 169 | cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h | ||
| 170 | cpt_err.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cpt_err.c | ||
| 171 | cryptlib.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 172 | cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 173 | cryptlib.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 174 | cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 175 | cryptlib.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
| 176 | cryptlib.o: ../include/openssl/symhacks.h cryptlib.c cryptlib.h | ||
| 177 | cversion.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 178 | cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 179 | cversion.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 180 | cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 181 | cversion.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
| 182 | cversion.o: ../include/openssl/symhacks.h buildinf.h cryptlib.h cversion.c | ||
| 183 | ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c | ||
| 184 | ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 185 | ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 186 | ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 187 | ex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 188 | ex_data.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
| 189 | ex_data.o: ../include/openssl/symhacks.h cryptlib.h ex_data.c | ||
| 190 | mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 191 | mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 192 | mem.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 193 | mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 194 | mem.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
| 195 | mem.o: ../include/openssl/symhacks.h cryptlib.h mem.c | ||
| 196 | mem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 197 | mem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 198 | mem_clr.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
| 199 | mem_clr.o: ../include/openssl/symhacks.h mem_clr.c | ||
| 200 | mem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 201 | mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 202 | mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 203 | mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 204 | mem_dbg.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
| 205 | mem_dbg.o: ../include/openssl/symhacks.h cryptlib.h mem_dbg.c | ||
| 206 | o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c | ||
| 207 | o_time.o: o_time.h | ||
| 208 | tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 209 | tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 210 | tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 211 | tmdiff.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 212 | tmdiff.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
| 213 | tmdiff.o: ../include/openssl/symhacks.h ../include/openssl/tmdiff.h cryptlib.h | ||
| 214 | tmdiff.o: tmdiff.c | ||
| 215 | uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 216 | uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 217 | uid.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
| 218 | uid.o: ../include/openssl/symhacks.h uid.c | ||
diff --git a/src/lib/libcrypto/aes/Makefile.ssl b/src/lib/libcrypto/aes/Makefile.ssl deleted file mode 100644 index f353aeb697..0000000000 --- a/src/lib/libcrypto/aes/Makefile.ssl +++ /dev/null | |||
| @@ -1,103 +0,0 @@ | |||
| 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 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP= /usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | # CFLAGS= -mpentiumpro $(INCLUDES) $(CFLAG) -O3 -fexpensive-optimizations -funroll-loops -fforce-addr | ||
| 21 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 22 | |||
| 23 | GENERAL=Makefile | ||
| 24 | #TEST=aestest.c | ||
| 25 | TEST= | ||
| 26 | APPS= | ||
| 27 | |||
| 28 | LIB=$(TOP)/libcrypto.a | ||
| 29 | LIBSRC=aes_core.c aes_misc.c aes_ecb.c aes_cbc.c aes_cfb.c aes_ofb.c aes_ctr.c | ||
| 30 | LIBOBJ=aes_core.o aes_misc.o aes_ecb.o aes_cbc.o aes_cfb.o aes_ofb.o aes_ctr.o | ||
| 31 | |||
| 32 | SRC= $(LIBSRC) | ||
| 33 | |||
| 34 | EXHEADER= aes.h | ||
| 35 | HEADER= aes_locl.h $(EXHEADER) | ||
| 36 | |||
| 37 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 38 | |||
| 39 | top: | ||
| 40 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 41 | |||
| 42 | all: lib | ||
| 43 | |||
| 44 | lib: $(LIBOBJ) | ||
| 45 | $(AR) $(LIB) $(LIBOBJ) | ||
| 46 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 47 | @touch lib | ||
| 48 | |||
| 49 | $(LIBOBJ): $(LIBSRC) | ||
| 50 | |||
| 51 | files: | ||
| 52 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 53 | |||
| 54 | links: | ||
| 55 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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: installs | ||
| 61 | |||
| 62 | installs: | ||
| 63 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 | aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h | ||
| 90 | aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c aes_locl.h | ||
| 91 | aes_cfb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h | ||
| 92 | aes_cfb.o: ../../include/openssl/opensslconf.h aes_cfb.c aes_locl.h | ||
| 93 | aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h | ||
| 94 | aes_core.o: ../../include/openssl/opensslconf.h aes_core.c aes_locl.h | ||
| 95 | aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h | ||
| 96 | aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c aes_locl.h | ||
| 97 | aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h | ||
| 98 | aes_ecb.o: ../../include/openssl/opensslconf.h aes_ecb.c aes_locl.h | ||
| 99 | aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h | ||
| 100 | aes_misc.o: ../../include/openssl/opensslconf.h | ||
| 101 | aes_misc.o: ../../include/openssl/opensslv.h aes_locl.h aes_misc.c | ||
| 102 | aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h | ||
| 103 | aes_ofb.o: ../../include/openssl/opensslconf.h aes_locl.h aes_ofb.c | ||
diff --git a/src/lib/libcrypto/aes/aes.h b/src/lib/libcrypto/aes/aes.h index 450f2b4051..d2c99730fe 100644 --- a/src/lib/libcrypto/aes/aes.h +++ b/src/lib/libcrypto/aes/aes.h | |||
| @@ -58,6 +58,8 @@ | |||
| 58 | #error AES is disabled. | 58 | #error AES is disabled. |
| 59 | #endif | 59 | #endif |
| 60 | 60 | ||
| 61 | #include <stddef.h> | ||
| 62 | |||
| 61 | #define AES_ENCRYPT 1 | 63 | #define AES_ENCRYPT 1 |
| 62 | #define AES_DECRYPT 0 | 64 | #define AES_DECRYPT 0 |
| 63 | 65 | ||
| @@ -66,10 +68,6 @@ | |||
| 66 | #define AES_MAXNR 14 | 68 | #define AES_MAXNR 14 |
| 67 | #define AES_BLOCK_SIZE 16 | 69 | #define AES_BLOCK_SIZE 16 |
| 68 | 70 | ||
| 69 | #ifdef OPENSSL_FIPS | ||
| 70 | #define FIPS_AES_SIZE_T int | ||
| 71 | #endif | ||
| 72 | |||
| 73 | #ifdef __cplusplus | 71 | #ifdef __cplusplus |
| 74 | extern "C" { | 72 | extern "C" { |
| 75 | #endif | 73 | #endif |
| @@ -100,37 +98,32 @@ void AES_decrypt(const unsigned char *in, unsigned char *out, | |||
| 100 | void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, | 98 | void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, |
| 101 | const AES_KEY *key, const int enc); | 99 | const AES_KEY *key, const int enc); |
| 102 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | 100 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, |
| 103 | const unsigned long length, const AES_KEY *key, | 101 | size_t length, const AES_KEY *key, |
| 104 | unsigned char *ivec, const int enc); | 102 | unsigned char *ivec, const int enc); |
| 105 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, | 103 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, |
| 106 | const unsigned long length, const AES_KEY *key, | 104 | size_t length, const AES_KEY *key, |
| 107 | unsigned char *ivec, int *num, const int enc); | 105 | unsigned char *ivec, int *num, const int enc); |
| 108 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, | 106 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, |
| 109 | const unsigned long length, const AES_KEY *key, | 107 | size_t length, const AES_KEY *key, |
| 110 | unsigned char *ivec, int *num, const int enc); | 108 | unsigned char *ivec, int *num, const int enc); |
| 111 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, | 109 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, |
| 112 | const unsigned long length, const AES_KEY *key, | 110 | size_t length, const AES_KEY *key, |
| 113 | unsigned char *ivec, int *num, const int enc); | 111 | unsigned char *ivec, int *num, const int enc); |
| 114 | void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out, | ||
| 115 | const int nbits,const AES_KEY *key, | ||
| 116 | unsigned char *ivec,const int enc); | ||
| 117 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, | 112 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, |
| 118 | const unsigned long length, const AES_KEY *key, | 113 | size_t length, const AES_KEY *key, |
| 119 | unsigned char *ivec, int *num); | 114 | unsigned char *ivec, int *num); |
| 120 | void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, | 115 | void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, |
| 121 | const unsigned long length, const AES_KEY *key, | 116 | size_t length, const AES_KEY *key, |
| 122 | unsigned char ivec[AES_BLOCK_SIZE], | 117 | unsigned char ivec[AES_BLOCK_SIZE], |
| 123 | unsigned char ecount_buf[AES_BLOCK_SIZE], | 118 | unsigned char ecount_buf[AES_BLOCK_SIZE], |
| 124 | unsigned int *num); | 119 | unsigned int *num); |
| 125 | |||
| 126 | /* For IGE, see also http://www.links.org/files/openssl-ige.pdf */ | ||
| 127 | /* NB: the IV is _two_ blocks long */ | 120 | /* NB: the IV is _two_ blocks long */ |
| 128 | void AES_ige_encrypt(const unsigned char *in, unsigned char *out, | 121 | void AES_ige_encrypt(const unsigned char *in, unsigned char *out, |
| 129 | const unsigned long length, const AES_KEY *key, | 122 | size_t length, const AES_KEY *key, |
| 130 | unsigned char *ivec, const int enc); | 123 | unsigned char *ivec, const int enc); |
| 131 | /* NB: the IV is _four_ blocks long */ | 124 | /* NB: the IV is _four_ blocks long */ |
| 132 | void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, | 125 | void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, |
| 133 | const unsigned long length, const AES_KEY *key, | 126 | size_t length, const AES_KEY *key, |
| 134 | const AES_KEY *key2, const unsigned char *ivec, | 127 | const AES_KEY *key2, const unsigned char *ivec, |
| 135 | const int enc); | 128 | const int enc); |
| 136 | 129 | ||
| @@ -141,6 +134,7 @@ int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, | |||
| 141 | unsigned char *out, | 134 | unsigned char *out, |
| 142 | const unsigned char *in, unsigned int inlen); | 135 | const unsigned char *in, unsigned int inlen); |
| 143 | 136 | ||
| 137 | |||
| 144 | #ifdef __cplusplus | 138 | #ifdef __cplusplus |
| 145 | } | 139 | } |
| 146 | #endif | 140 | #endif |
diff --git a/src/lib/libcrypto/aes/aes_cbc.c b/src/lib/libcrypto/aes/aes_cbc.c index 373864cd4b..227f75625d 100644 --- a/src/lib/libcrypto/aes/aes_cbc.c +++ b/src/lib/libcrypto/aes/aes_cbc.c | |||
| @@ -49,85 +49,15 @@ | |||
| 49 | * | 49 | * |
| 50 | */ | 50 | */ |
| 51 | 51 | ||
| 52 | #ifndef AES_DEBUG | ||
| 53 | # ifndef NDEBUG | ||
| 54 | # define NDEBUG | ||
| 55 | # endif | ||
| 56 | #endif | ||
| 57 | #include <assert.h> | ||
| 58 | |||
| 59 | #include <openssl/aes.h> | 52 | #include <openssl/aes.h> |
| 60 | #include "aes_locl.h" | 53 | #include <openssl/modes.h> |
| 61 | 54 | ||
| 62 | #if !defined(OPENSSL_FIPS_AES_ASM) | ||
| 63 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | 55 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, |
| 64 | const unsigned long length, const AES_KEY *key, | 56 | size_t len, const AES_KEY *key, |
| 65 | unsigned char *ivec, const int enc) { | 57 | unsigned char *ivec, const int enc) { |
| 66 | 58 | ||
| 67 | unsigned long n; | 59 | if (enc) |
| 68 | unsigned long len = length; | 60 | CRYPTO_cbc128_encrypt(in,out,len,key,ivec,(block128_f)AES_encrypt); |
| 69 | unsigned char tmp[AES_BLOCK_SIZE]; | 61 | else |
| 70 | const unsigned char *iv = ivec; | 62 | CRYPTO_cbc128_decrypt(in,out,len,key,ivec,(block128_f)AES_decrypt); |
| 71 | |||
| 72 | assert(in && out && key && ivec); | ||
| 73 | assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc)); | ||
| 74 | |||
| 75 | if (AES_ENCRYPT == enc) { | ||
| 76 | while (len >= AES_BLOCK_SIZE) { | ||
| 77 | for(n=0; n < AES_BLOCK_SIZE; ++n) | ||
| 78 | out[n] = in[n] ^ iv[n]; | ||
| 79 | AES_encrypt(out, out, key); | ||
| 80 | iv = out; | ||
| 81 | len -= AES_BLOCK_SIZE; | ||
| 82 | in += AES_BLOCK_SIZE; | ||
| 83 | out += AES_BLOCK_SIZE; | ||
| 84 | } | ||
| 85 | if (len) { | ||
| 86 | for(n=0; n < len; ++n) | ||
| 87 | out[n] = in[n] ^ iv[n]; | ||
| 88 | for(n=len; n < AES_BLOCK_SIZE; ++n) | ||
| 89 | out[n] = iv[n]; | ||
| 90 | AES_encrypt(out, out, key); | ||
| 91 | iv = out; | ||
| 92 | } | ||
| 93 | memcpy(ivec,iv,AES_BLOCK_SIZE); | ||
| 94 | } else if (in != out) { | ||
| 95 | while (len >= AES_BLOCK_SIZE) { | ||
| 96 | AES_decrypt(in, out, key); | ||
| 97 | for(n=0; n < AES_BLOCK_SIZE; ++n) | ||
| 98 | out[n] ^= iv[n]; | ||
| 99 | iv = in; | ||
| 100 | len -= AES_BLOCK_SIZE; | ||
| 101 | in += AES_BLOCK_SIZE; | ||
| 102 | out += AES_BLOCK_SIZE; | ||
| 103 | } | ||
| 104 | if (len) { | ||
| 105 | AES_decrypt(in,tmp,key); | ||
| 106 | for(n=0; n < len; ++n) | ||
| 107 | out[n] = tmp[n] ^ iv[n]; | ||
| 108 | iv = in; | ||
| 109 | } | ||
| 110 | memcpy(ivec,iv,AES_BLOCK_SIZE); | ||
| 111 | } else { | ||
| 112 | while (len >= AES_BLOCK_SIZE) { | ||
| 113 | memcpy(tmp, in, AES_BLOCK_SIZE); | ||
| 114 | AES_decrypt(in, out, key); | ||
| 115 | for(n=0; n < AES_BLOCK_SIZE; ++n) | ||
| 116 | out[n] ^= ivec[n]; | ||
| 117 | memcpy(ivec, tmp, AES_BLOCK_SIZE); | ||
| 118 | len -= AES_BLOCK_SIZE; | ||
| 119 | in += AES_BLOCK_SIZE; | ||
| 120 | out += AES_BLOCK_SIZE; | ||
| 121 | } | ||
| 122 | if (len) { | ||
| 123 | memcpy(tmp, in, AES_BLOCK_SIZE); | ||
| 124 | AES_decrypt(tmp, out, key); | ||
| 125 | for(n=0; n < len; ++n) | ||
| 126 | out[n] ^= ivec[n]; | ||
| 127 | for(n=len; n < AES_BLOCK_SIZE; ++n) | ||
| 128 | out[n] = tmp[n]; | ||
| 129 | memcpy(ivec, tmp, AES_BLOCK_SIZE); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | } | 63 | } |
| 133 | #endif | ||
diff --git a/src/lib/libcrypto/aes/aes_cfb.c b/src/lib/libcrypto/aes/aes_cfb.c index 49f0411010..0c6d058ce7 100644 --- a/src/lib/libcrypto/aes/aes_cfb.c +++ b/src/lib/libcrypto/aes/aes_cfb.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/aes/aes_cfb.c -*- mode:C; c-file-style: "eay" -*- */ | 1 | /* crypto/aes/aes_cfb.c -*- mode:C; c-file-style: "eay" -*- */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -48,73 +48,9 @@ | |||
| 48 | * ==================================================================== | 48 | * ==================================================================== |
| 49 | * | 49 | * |
| 50 | */ | 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 | #ifndef AES_DEBUG | ||
| 109 | # ifndef NDEBUG | ||
| 110 | # define NDEBUG | ||
| 111 | # endif | ||
| 112 | #endif | ||
| 113 | #include <assert.h> | ||
| 114 | 51 | ||
| 115 | #include <openssl/aes.h> | 52 | #include <openssl/aes.h> |
| 116 | #include "aes_locl.h" | 53 | #include <openssl/modes.h> |
| 117 | #include "e_os.h" | ||
| 118 | 54 | ||
| 119 | /* The input and output encrypted as though 128bit cfb mode is being | 55 | /* The input and output encrypted as though 128bit cfb mode is being |
| 120 | * used. The extra state information to record how much of the | 56 | * used. The extra state information to record how much of the |
| @@ -122,104 +58,24 @@ | |||
| 122 | */ | 58 | */ |
| 123 | 59 | ||
| 124 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, | 60 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, |
| 125 | const unsigned long length, const AES_KEY *key, | 61 | size_t length, const AES_KEY *key, |
| 126 | unsigned char *ivec, int *num, const int enc) { | 62 | unsigned char *ivec, int *num, const int enc) { |
| 127 | 63 | ||
| 128 | unsigned int n; | 64 | CRYPTO_cfb128_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES_encrypt); |
| 129 | unsigned long l = length; | ||
| 130 | unsigned char c; | ||
| 131 | |||
| 132 | assert(in && out && key && ivec && num); | ||
| 133 | |||
| 134 | n = *num; | ||
| 135 | |||
| 136 | if (enc) { | ||
| 137 | while (l--) { | ||
| 138 | if (n == 0) { | ||
| 139 | AES_encrypt(ivec, ivec, key); | ||
| 140 | } | ||
| 141 | ivec[n] = *(out++) = *(in++) ^ ivec[n]; | ||
| 142 | n = (n+1) % AES_BLOCK_SIZE; | ||
| 143 | } | ||
| 144 | } else { | ||
| 145 | while (l--) { | ||
| 146 | if (n == 0) { | ||
| 147 | AES_encrypt(ivec, ivec, key); | ||
| 148 | } | ||
| 149 | c = *(in); | ||
| 150 | *(out++) = *(in++) ^ ivec[n]; | ||
| 151 | ivec[n] = c; | ||
| 152 | n = (n+1) % AES_BLOCK_SIZE; | ||
| 153 | } | ||
| 154 | } | ||
| 155 | |||
| 156 | *num=n; | ||
| 157 | } | 65 | } |
| 158 | 66 | ||
| 159 | /* This expects a single block of size nbits for both in and out. Note that | ||
| 160 | it corrupts any extra bits in the last byte of out */ | ||
| 161 | void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out, | ||
| 162 | const int nbits,const AES_KEY *key, | ||
| 163 | unsigned char *ivec,const int enc) | ||
| 164 | { | ||
| 165 | int n,rem,num; | ||
| 166 | unsigned char ovec[AES_BLOCK_SIZE*2]; | ||
| 167 | |||
| 168 | if (nbits<=0 || nbits>128) return; | ||
| 169 | |||
| 170 | /* fill in the first half of the new IV with the current IV */ | ||
| 171 | memcpy(ovec,ivec,AES_BLOCK_SIZE); | ||
| 172 | /* construct the new IV */ | ||
| 173 | AES_encrypt(ivec,ivec,key); | ||
| 174 | num = (nbits+7)/8; | ||
| 175 | if (enc) /* encrypt the input */ | ||
| 176 | for(n=0 ; n < num ; ++n) | ||
| 177 | out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n] ^ ivec[n]); | ||
| 178 | else /* decrypt the input */ | ||
| 179 | for(n=0 ; n < num ; ++n) | ||
| 180 | out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n]) ^ ivec[n]; | ||
| 181 | /* shift ovec left... */ | ||
| 182 | rem = nbits%8; | ||
| 183 | num = nbits/8; | ||
| 184 | if(rem==0) | ||
| 185 | memcpy(ivec,ovec+num,AES_BLOCK_SIZE); | ||
| 186 | else | ||
| 187 | for(n=0 ; n < AES_BLOCK_SIZE ; ++n) | ||
| 188 | ivec[n] = ovec[n+num]<<rem | ovec[n+num+1]>>(8-rem); | ||
| 189 | |||
| 190 | /* it is not necessary to cleanse ovec, since the IV is not secret */ | ||
| 191 | } | ||
| 192 | |||
| 193 | /* N.B. This expects the input to be packed, MS bit first */ | 67 | /* N.B. This expects the input to be packed, MS bit first */ |
| 194 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, | 68 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, |
| 195 | const unsigned long length, const AES_KEY *key, | 69 | size_t length, const AES_KEY *key, |
| 196 | unsigned char *ivec, int *num, const int enc) | 70 | unsigned char *ivec, int *num, const int enc) |
| 197 | { | 71 | { |
| 198 | unsigned int n; | 72 | CRYPTO_cfb128_1_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES_encrypt); |
| 199 | unsigned char c[1],d[1]; | ||
| 200 | |||
| 201 | assert(in && out && key && ivec && num); | ||
| 202 | assert(*num == 0); | ||
| 203 | |||
| 204 | memset(out,0,(length+7)/8); | ||
| 205 | for(n=0 ; n < length ; ++n) | ||
| 206 | { | ||
| 207 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | ||
| 208 | AES_cfbr_encrypt_block(c,d,1,key,ivec,enc); | ||
| 209 | out[n/8]=(out[n/8]&~(1 << (7-n%8)))|((d[0]&0x80) >> (n%8)); | ||
| 210 | } | ||
| 211 | } | 73 | } |
| 212 | 74 | ||
| 213 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, | 75 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, |
| 214 | const unsigned long length, const AES_KEY *key, | 76 | size_t length, const AES_KEY *key, |
| 215 | unsigned char *ivec, int *num, const int enc) | 77 | unsigned char *ivec, int *num, const int enc) |
| 216 | { | 78 | { |
| 217 | unsigned int n; | 79 | CRYPTO_cfb128_8_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES_encrypt); |
| 218 | |||
| 219 | assert(in && out && key && ivec && num); | ||
| 220 | assert(*num == 0); | ||
| 221 | |||
| 222 | for(n=0 ; n < length ; ++n) | ||
| 223 | AES_cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc); | ||
| 224 | } | 80 | } |
| 225 | 81 | ||
diff --git a/src/lib/libcrypto/aes/aes_core.c b/src/lib/libcrypto/aes/aes_core.c index cffdd4daec..a7ec54f4da 100644 --- a/src/lib/libcrypto/aes/aes_core.c +++ b/src/lib/libcrypto/aes/aes_core.c | |||
| @@ -37,12 +37,9 @@ | |||
| 37 | 37 | ||
| 38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
| 39 | #include <openssl/aes.h> | 39 | #include <openssl/aes.h> |
| 40 | #ifdef OPENSSL_FIPS | ||
| 41 | #include <openssl/fips.h> | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #include "aes_locl.h" | 40 | #include "aes_locl.h" |
| 45 | 41 | ||
| 42 | #ifndef AES_ASM | ||
| 46 | /* | 43 | /* |
| 47 | Te0[x] = S [x].[02, 01, 01, 03]; | 44 | Te0[x] = S [x].[02, 01, 01, 03]; |
| 48 | Te1[x] = S [x].[03, 02, 01, 01]; | 45 | Te1[x] = S [x].[03, 02, 01, 01]; |
| @@ -635,10 +632,6 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits, | |||
| 635 | int i = 0; | 632 | int i = 0; |
| 636 | u32 temp; | 633 | u32 temp; |
| 637 | 634 | ||
| 638 | #ifdef OPENSSL_FIPS | ||
| 639 | FIPS_selftest_check(); | ||
| 640 | #endif | ||
| 641 | |||
| 642 | if (!userKey || !key) | 635 | if (!userKey || !key) |
| 643 | return -1; | 636 | return -1; |
| 644 | if (bits != 128 && bits != 192 && bits != 256) | 637 | if (bits != 128 && bits != 192 && bits != 256) |
| @@ -781,7 +774,6 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits, | |||
| 781 | return 0; | 774 | return 0; |
| 782 | } | 775 | } |
| 783 | 776 | ||
| 784 | #ifndef AES_ASM | ||
| 785 | /* | 777 | /* |
| 786 | * Encrypt a single block | 778 | * Encrypt a single block |
| 787 | * in and out can overlap | 779 | * in and out can overlap |
| @@ -1164,4 +1156,203 @@ void AES_decrypt(const unsigned char *in, unsigned char *out, | |||
| 1164 | PUTU32(out + 12, s3); | 1156 | PUTU32(out + 12, s3); |
| 1165 | } | 1157 | } |
| 1166 | 1158 | ||
| 1159 | #else /* AES_ASM */ | ||
| 1160 | |||
| 1161 | static const u8 Te4[256] = { | ||
| 1162 | 0x63U, 0x7cU, 0x77U, 0x7bU, 0xf2U, 0x6bU, 0x6fU, 0xc5U, | ||
| 1163 | 0x30U, 0x01U, 0x67U, 0x2bU, 0xfeU, 0xd7U, 0xabU, 0x76U, | ||
| 1164 | 0xcaU, 0x82U, 0xc9U, 0x7dU, 0xfaU, 0x59U, 0x47U, 0xf0U, | ||
| 1165 | 0xadU, 0xd4U, 0xa2U, 0xafU, 0x9cU, 0xa4U, 0x72U, 0xc0U, | ||
| 1166 | 0xb7U, 0xfdU, 0x93U, 0x26U, 0x36U, 0x3fU, 0xf7U, 0xccU, | ||
| 1167 | 0x34U, 0xa5U, 0xe5U, 0xf1U, 0x71U, 0xd8U, 0x31U, 0x15U, | ||
| 1168 | 0x04U, 0xc7U, 0x23U, 0xc3U, 0x18U, 0x96U, 0x05U, 0x9aU, | ||
| 1169 | 0x07U, 0x12U, 0x80U, 0xe2U, 0xebU, 0x27U, 0xb2U, 0x75U, | ||
| 1170 | 0x09U, 0x83U, 0x2cU, 0x1aU, 0x1bU, 0x6eU, 0x5aU, 0xa0U, | ||
| 1171 | 0x52U, 0x3bU, 0xd6U, 0xb3U, 0x29U, 0xe3U, 0x2fU, 0x84U, | ||
| 1172 | 0x53U, 0xd1U, 0x00U, 0xedU, 0x20U, 0xfcU, 0xb1U, 0x5bU, | ||
| 1173 | 0x6aU, 0xcbU, 0xbeU, 0x39U, 0x4aU, 0x4cU, 0x58U, 0xcfU, | ||
| 1174 | 0xd0U, 0xefU, 0xaaU, 0xfbU, 0x43U, 0x4dU, 0x33U, 0x85U, | ||
| 1175 | 0x45U, 0xf9U, 0x02U, 0x7fU, 0x50U, 0x3cU, 0x9fU, 0xa8U, | ||
| 1176 | 0x51U, 0xa3U, 0x40U, 0x8fU, 0x92U, 0x9dU, 0x38U, 0xf5U, | ||
| 1177 | 0xbcU, 0xb6U, 0xdaU, 0x21U, 0x10U, 0xffU, 0xf3U, 0xd2U, | ||
| 1178 | 0xcdU, 0x0cU, 0x13U, 0xecU, 0x5fU, 0x97U, 0x44U, 0x17U, | ||
| 1179 | 0xc4U, 0xa7U, 0x7eU, 0x3dU, 0x64U, 0x5dU, 0x19U, 0x73U, | ||
| 1180 | 0x60U, 0x81U, 0x4fU, 0xdcU, 0x22U, 0x2aU, 0x90U, 0x88U, | ||
| 1181 | 0x46U, 0xeeU, 0xb8U, 0x14U, 0xdeU, 0x5eU, 0x0bU, 0xdbU, | ||
| 1182 | 0xe0U, 0x32U, 0x3aU, 0x0aU, 0x49U, 0x06U, 0x24U, 0x5cU, | ||
| 1183 | 0xc2U, 0xd3U, 0xacU, 0x62U, 0x91U, 0x95U, 0xe4U, 0x79U, | ||
| 1184 | 0xe7U, 0xc8U, 0x37U, 0x6dU, 0x8dU, 0xd5U, 0x4eU, 0xa9U, | ||
| 1185 | 0x6cU, 0x56U, 0xf4U, 0xeaU, 0x65U, 0x7aU, 0xaeU, 0x08U, | ||
| 1186 | 0xbaU, 0x78U, 0x25U, 0x2eU, 0x1cU, 0xa6U, 0xb4U, 0xc6U, | ||
| 1187 | 0xe8U, 0xddU, 0x74U, 0x1fU, 0x4bU, 0xbdU, 0x8bU, 0x8aU, | ||
| 1188 | 0x70U, 0x3eU, 0xb5U, 0x66U, 0x48U, 0x03U, 0xf6U, 0x0eU, | ||
| 1189 | 0x61U, 0x35U, 0x57U, 0xb9U, 0x86U, 0xc1U, 0x1dU, 0x9eU, | ||
| 1190 | 0xe1U, 0xf8U, 0x98U, 0x11U, 0x69U, 0xd9U, 0x8eU, 0x94U, | ||
| 1191 | 0x9bU, 0x1eU, 0x87U, 0xe9U, 0xceU, 0x55U, 0x28U, 0xdfU, | ||
| 1192 | 0x8cU, 0xa1U, 0x89U, 0x0dU, 0xbfU, 0xe6U, 0x42U, 0x68U, | ||
| 1193 | 0x41U, 0x99U, 0x2dU, 0x0fU, 0xb0U, 0x54U, 0xbbU, 0x16U | ||
| 1194 | }; | ||
| 1195 | static const u32 rcon[] = { | ||
| 1196 | 0x01000000, 0x02000000, 0x04000000, 0x08000000, | ||
| 1197 | 0x10000000, 0x20000000, 0x40000000, 0x80000000, | ||
| 1198 | 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ | ||
| 1199 | }; | ||
| 1200 | |||
| 1201 | /** | ||
| 1202 | * Expand the cipher key into the encryption key schedule. | ||
| 1203 | */ | ||
| 1204 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits, | ||
| 1205 | AES_KEY *key) { | ||
| 1206 | u32 *rk; | ||
| 1207 | int i = 0; | ||
| 1208 | u32 temp; | ||
| 1209 | |||
| 1210 | if (!userKey || !key) | ||
| 1211 | return -1; | ||
| 1212 | if (bits != 128 && bits != 192 && bits != 256) | ||
| 1213 | return -2; | ||
| 1214 | |||
| 1215 | rk = key->rd_key; | ||
| 1216 | |||
| 1217 | if (bits==128) | ||
| 1218 | key->rounds = 10; | ||
| 1219 | else if (bits==192) | ||
| 1220 | key->rounds = 12; | ||
| 1221 | else | ||
| 1222 | key->rounds = 14; | ||
| 1223 | |||
| 1224 | rk[0] = GETU32(userKey ); | ||
| 1225 | rk[1] = GETU32(userKey + 4); | ||
| 1226 | rk[2] = GETU32(userKey + 8); | ||
| 1227 | rk[3] = GETU32(userKey + 12); | ||
| 1228 | if (bits == 128) { | ||
| 1229 | while (1) { | ||
| 1230 | temp = rk[3]; | ||
| 1231 | rk[4] = rk[0] ^ | ||
| 1232 | (Te4[(temp >> 16) & 0xff] << 24) ^ | ||
| 1233 | (Te4[(temp >> 8) & 0xff] << 16) ^ | ||
| 1234 | (Te4[(temp ) & 0xff] << 8) ^ | ||
| 1235 | (Te4[(temp >> 24) ]) ^ | ||
| 1236 | rcon[i]; | ||
| 1237 | rk[5] = rk[1] ^ rk[4]; | ||
| 1238 | rk[6] = rk[2] ^ rk[5]; | ||
| 1239 | rk[7] = rk[3] ^ rk[6]; | ||
| 1240 | if (++i == 10) { | ||
| 1241 | return 0; | ||
| 1242 | } | ||
| 1243 | rk += 4; | ||
| 1244 | } | ||
| 1245 | } | ||
| 1246 | rk[4] = GETU32(userKey + 16); | ||
| 1247 | rk[5] = GETU32(userKey + 20); | ||
| 1248 | if (bits == 192) { | ||
| 1249 | while (1) { | ||
| 1250 | temp = rk[ 5]; | ||
| 1251 | rk[ 6] = rk[ 0] ^ | ||
| 1252 | (Te4[(temp >> 16) & 0xff] << 24) ^ | ||
| 1253 | (Te4[(temp >> 8) & 0xff] << 16) ^ | ||
| 1254 | (Te4[(temp ) & 0xff] << 8) ^ | ||
| 1255 | (Te4[(temp >> 24) ]) ^ | ||
| 1256 | rcon[i]; | ||
| 1257 | rk[ 7] = rk[ 1] ^ rk[ 6]; | ||
| 1258 | rk[ 8] = rk[ 2] ^ rk[ 7]; | ||
| 1259 | rk[ 9] = rk[ 3] ^ rk[ 8]; | ||
| 1260 | if (++i == 8) { | ||
| 1261 | return 0; | ||
| 1262 | } | ||
| 1263 | rk[10] = rk[ 4] ^ rk[ 9]; | ||
| 1264 | rk[11] = rk[ 5] ^ rk[10]; | ||
| 1265 | rk += 6; | ||
| 1266 | } | ||
| 1267 | } | ||
| 1268 | rk[6] = GETU32(userKey + 24); | ||
| 1269 | rk[7] = GETU32(userKey + 28); | ||
| 1270 | if (bits == 256) { | ||
| 1271 | while (1) { | ||
| 1272 | temp = rk[ 7]; | ||
| 1273 | rk[ 8] = rk[ 0] ^ | ||
| 1274 | (Te4[(temp >> 16) & 0xff] << 24) ^ | ||
| 1275 | (Te4[(temp >> 8) & 0xff] << 16) ^ | ||
| 1276 | (Te4[(temp ) & 0xff] << 8) ^ | ||
| 1277 | (Te4[(temp >> 24) ]) ^ | ||
| 1278 | rcon[i]; | ||
| 1279 | rk[ 9] = rk[ 1] ^ rk[ 8]; | ||
| 1280 | rk[10] = rk[ 2] ^ rk[ 9]; | ||
| 1281 | rk[11] = rk[ 3] ^ rk[10]; | ||
| 1282 | if (++i == 7) { | ||
| 1283 | return 0; | ||
| 1284 | } | ||
| 1285 | temp = rk[11]; | ||
| 1286 | rk[12] = rk[ 4] ^ | ||
| 1287 | (Te4[(temp >> 24) ] << 24) ^ | ||
| 1288 | (Te4[(temp >> 16) & 0xff] << 16) ^ | ||
| 1289 | (Te4[(temp >> 8) & 0xff] << 8) ^ | ||
| 1290 | (Te4[(temp ) & 0xff]); | ||
| 1291 | rk[13] = rk[ 5] ^ rk[12]; | ||
| 1292 | rk[14] = rk[ 6] ^ rk[13]; | ||
| 1293 | rk[15] = rk[ 7] ^ rk[14]; | ||
| 1294 | |||
| 1295 | rk += 8; | ||
| 1296 | } | ||
| 1297 | } | ||
| 1298 | return 0; | ||
| 1299 | } | ||
| 1300 | |||
| 1301 | /** | ||
| 1302 | * Expand the cipher key into the decryption key schedule. | ||
| 1303 | */ | ||
| 1304 | int AES_set_decrypt_key(const unsigned char *userKey, const int bits, | ||
| 1305 | AES_KEY *key) { | ||
| 1306 | |||
| 1307 | u32 *rk; | ||
| 1308 | int i, j, status; | ||
| 1309 | u32 temp; | ||
| 1310 | |||
| 1311 | /* first, start with an encryption schedule */ | ||
| 1312 | status = AES_set_encrypt_key(userKey, bits, key); | ||
| 1313 | if (status < 0) | ||
| 1314 | return status; | ||
| 1315 | |||
| 1316 | rk = key->rd_key; | ||
| 1317 | |||
| 1318 | /* invert the order of the round keys: */ | ||
| 1319 | for (i = 0, j = 4*(key->rounds); i < j; i += 4, j -= 4) { | ||
| 1320 | temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; | ||
| 1321 | temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; | ||
| 1322 | temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; | ||
| 1323 | temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; | ||
| 1324 | } | ||
| 1325 | /* apply the inverse MixColumn transform to all round keys but the first and the last: */ | ||
| 1326 | for (i = 1; i < (key->rounds); i++) { | ||
| 1327 | rk += 4; | ||
| 1328 | for (j = 0; j < 4; j++) { | ||
| 1329 | u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m; | ||
| 1330 | |||
| 1331 | tp1 = rk[j]; | ||
| 1332 | m = tp1 & 0x80808080; | ||
| 1333 | tp2 = ((tp1 & 0x7f7f7f7f) << 1) ^ | ||
| 1334 | ((m - (m >> 7)) & 0x1b1b1b1b); | ||
| 1335 | m = tp2 & 0x80808080; | ||
| 1336 | tp4 = ((tp2 & 0x7f7f7f7f) << 1) ^ | ||
| 1337 | ((m - (m >> 7)) & 0x1b1b1b1b); | ||
| 1338 | m = tp4 & 0x80808080; | ||
| 1339 | tp8 = ((tp4 & 0x7f7f7f7f) << 1) ^ | ||
| 1340 | ((m - (m >> 7)) & 0x1b1b1b1b); | ||
| 1341 | tp9 = tp8 ^ tp1; | ||
| 1342 | tpb = tp9 ^ tp2; | ||
| 1343 | tpd = tp9 ^ tp4; | ||
| 1344 | tpe = tp8 ^ tp4 ^ tp2; | ||
| 1345 | #if defined(ROTATE) | ||
| 1346 | rk[j] = tpe ^ ROTATE(tpd,16) ^ | ||
| 1347 | ROTATE(tp9,24) ^ ROTATE(tpb,8); | ||
| 1348 | #else | ||
| 1349 | rk[j] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^ | ||
| 1350 | (tp9 >> 8) ^ (tp9 << 24) ^ | ||
| 1351 | (tpb >> 24) ^ (tpb << 8); | ||
| 1352 | #endif | ||
| 1353 | } | ||
| 1354 | } | ||
| 1355 | return 0; | ||
| 1356 | } | ||
| 1357 | |||
| 1167 | #endif /* AES_ASM */ | 1358 | #endif /* AES_ASM */ |
diff --git a/src/lib/libcrypto/aes/aes_ctr.c b/src/lib/libcrypto/aes/aes_ctr.c index f36982be1e..7c9d165d8a 100644 --- a/src/lib/libcrypto/aes/aes_ctr.c +++ b/src/lib/libcrypto/aes/aes_ctr.c | |||
| @@ -49,91 +49,13 @@ | |||
| 49 | * | 49 | * |
| 50 | */ | 50 | */ |
| 51 | 51 | ||
| 52 | #ifndef AES_DEBUG | ||
| 53 | # ifndef NDEBUG | ||
| 54 | # define NDEBUG | ||
| 55 | # endif | ||
| 56 | #endif | ||
| 57 | #include <assert.h> | ||
| 58 | |||
| 59 | #include <openssl/aes.h> | 52 | #include <openssl/aes.h> |
| 60 | #include "aes_locl.h" | 53 | #include <openssl/modes.h> |
| 61 | |||
| 62 | /* NOTE: the IV/counter CTR mode is big-endian. The rest of the AES code | ||
| 63 | * is endian-neutral. */ | ||
| 64 | |||
| 65 | /* increment counter (128-bit int) by 1 */ | ||
| 66 | static void AES_ctr128_inc(unsigned char *counter) { | ||
| 67 | unsigned long c; | ||
| 68 | |||
| 69 | /* Grab bottom dword of counter and increment */ | ||
| 70 | c = GETU32(counter + 12); | ||
| 71 | c++; c &= 0xFFFFFFFF; | ||
| 72 | PUTU32(counter + 12, c); | ||
| 73 | |||
| 74 | /* if no overflow, we're done */ | ||
| 75 | if (c) | ||
| 76 | return; | ||
| 77 | |||
| 78 | /* Grab 1st dword of counter and increment */ | ||
| 79 | c = GETU32(counter + 8); | ||
| 80 | c++; c &= 0xFFFFFFFF; | ||
| 81 | PUTU32(counter + 8, c); | ||
| 82 | |||
| 83 | /* if no overflow, we're done */ | ||
| 84 | if (c) | ||
| 85 | return; | ||
| 86 | |||
| 87 | /* Grab 2nd dword of counter and increment */ | ||
| 88 | c = GETU32(counter + 4); | ||
| 89 | c++; c &= 0xFFFFFFFF; | ||
| 90 | PUTU32(counter + 4, c); | ||
| 91 | |||
| 92 | /* if no overflow, we're done */ | ||
| 93 | if (c) | ||
| 94 | return; | ||
| 95 | 54 | ||
| 96 | /* Grab top dword of counter and increment */ | ||
| 97 | c = GETU32(counter + 0); | ||
| 98 | c++; c &= 0xFFFFFFFF; | ||
| 99 | PUTU32(counter + 0, c); | ||
| 100 | } | ||
| 101 | |||
| 102 | /* The input encrypted as though 128bit counter mode is being | ||
| 103 | * used. The extra state information to record how much of the | ||
| 104 | * 128bit block we have used is contained in *num, and the | ||
| 105 | * encrypted counter is kept in ecount_buf. Both *num and | ||
| 106 | * ecount_buf must be initialised with zeros before the first | ||
| 107 | * call to AES_ctr128_encrypt(). | ||
| 108 | * | ||
| 109 | * This algorithm assumes that the counter is in the x lower bits | ||
| 110 | * of the IV (ivec), and that the application has full control over | ||
| 111 | * overflow and the rest of the IV. This implementation takes NO | ||
| 112 | * responsability for checking that the counter doesn't overflow | ||
| 113 | * into the rest of the IV when incremented. | ||
| 114 | */ | ||
| 115 | void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, | 55 | void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, |
| 116 | const unsigned long length, const AES_KEY *key, | 56 | size_t length, const AES_KEY *key, |
| 117 | unsigned char ivec[AES_BLOCK_SIZE], | 57 | unsigned char ivec[AES_BLOCK_SIZE], |
| 118 | unsigned char ecount_buf[AES_BLOCK_SIZE], | 58 | unsigned char ecount_buf[AES_BLOCK_SIZE], |
| 119 | unsigned int *num) { | 59 | unsigned int *num) { |
| 120 | 60 | CRYPTO_ctr128_encrypt(in,out,length,key,ivec,ecount_buf,num,(block128_f)AES_encrypt); | |
| 121 | unsigned int n; | ||
| 122 | unsigned long l=length; | ||
| 123 | |||
| 124 | assert(in && out && key && counter && num); | ||
| 125 | assert(*num < AES_BLOCK_SIZE); | ||
| 126 | |||
| 127 | n = *num; | ||
| 128 | |||
| 129 | while (l--) { | ||
| 130 | if (n == 0) { | ||
| 131 | AES_encrypt(ivec, ecount_buf, key); | ||
| 132 | AES_ctr128_inc(ivec); | ||
| 133 | } | ||
| 134 | *(out++) = *(in++) ^ ecount_buf[n]; | ||
| 135 | n = (n+1) % AES_BLOCK_SIZE; | ||
| 136 | } | ||
| 137 | |||
| 138 | *num=n; | ||
| 139 | } | 61 | } |
diff --git a/src/lib/libcrypto/aes/aes_ofb.c b/src/lib/libcrypto/aes/aes_ofb.c index f358bb39e2..50bf0b8325 100644 --- a/src/lib/libcrypto/aes/aes_ofb.c +++ b/src/lib/libcrypto/aes/aes_ofb.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/aes/aes_ofb.c -*- mode:C; c-file-style: "eay" -*- */ | 1 | /* crypto/aes/aes_ofb.c -*- mode:C; c-file-style: "eay" -*- */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -48,95 +48,13 @@ | |||
| 48 | * ==================================================================== | 48 | * ==================================================================== |
| 49 | * | 49 | * |
| 50 | */ | 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 | #ifndef AES_DEBUG | ||
| 109 | # ifndef NDEBUG | ||
| 110 | # define NDEBUG | ||
| 111 | # endif | ||
| 112 | #endif | ||
| 113 | #include <assert.h> | ||
| 114 | 51 | ||
| 115 | #include <openssl/aes.h> | 52 | #include <openssl/aes.h> |
| 116 | #include "aes_locl.h" | 53 | #include <openssl/modes.h> |
| 117 | 54 | ||
| 118 | /* The input and output encrypted as though 128bit ofb mode is being | ||
| 119 | * used. The extra state information to record how much of the | ||
| 120 | * 128bit block we have used is contained in *num; | ||
| 121 | */ | ||
| 122 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, | 55 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, |
| 123 | const unsigned long length, const AES_KEY *key, | 56 | size_t length, const AES_KEY *key, |
| 124 | unsigned char *ivec, int *num) { | 57 | unsigned char *ivec, int *num) |
| 125 | 58 | { | |
| 126 | unsigned int n; | 59 | CRYPTO_ofb128_encrypt(in,out,length,key,ivec,num,(block128_f)AES_encrypt); |
| 127 | unsigned long l=length; | ||
| 128 | |||
| 129 | assert(in && out && key && ivec && num); | ||
| 130 | |||
| 131 | n = *num; | ||
| 132 | |||
| 133 | while (l--) { | ||
| 134 | if (n == 0) { | ||
| 135 | AES_encrypt(ivec, ivec, key); | ||
| 136 | } | ||
| 137 | *(out++) = *(in++) ^ ivec[n]; | ||
| 138 | n = (n+1) % AES_BLOCK_SIZE; | ||
| 139 | } | ||
| 140 | |||
| 141 | *num=n; | ||
| 142 | } | 60 | } |
diff --git a/src/lib/libcrypto/aes/asm/aes-586.pl b/src/lib/libcrypto/aes/asm/aes-586.pl index e771e83953..aab40e6f1c 100644 --- a/src/lib/libcrypto/aes/asm/aes-586.pl +++ b/src/lib/libcrypto/aes/asm/aes-586.pl | |||
| @@ -2,11 +2,12 @@ | |||
| 2 | # | 2 | # |
| 3 | # ==================================================================== | 3 | # ==================================================================== |
| 4 | # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL | 4 | # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL |
| 5 | # project. Rights for redistribution and usage in source and binary | 5 | # project. The module is, however, dual licensed under OpenSSL and |
| 6 | # forms are granted according to the OpenSSL license. | 6 | # CRYPTOGAMS licenses depending on where you obtain it. For further |
| 7 | # details see http://www.openssl.org/~appro/cryptogams/. | ||
| 7 | # ==================================================================== | 8 | # ==================================================================== |
| 8 | # | 9 | # |
| 9 | # Version 3.6. | 10 | # Version 4.3. |
| 10 | # | 11 | # |
| 11 | # You might fail to appreciate this module performance from the first | 12 | # You might fail to appreciate this module performance from the first |
| 12 | # try. If compared to "vanilla" linux-ia32-icc target, i.e. considered | 13 | # try. If compared to "vanilla" linux-ia32-icc target, i.e. considered |
| @@ -81,11 +82,117 @@ | |||
| 81 | # AMD K8 20 19 | 82 | # AMD K8 20 19 |
| 82 | # PIII 25 23 | 83 | # PIII 25 23 |
| 83 | # Pentium 81 78 | 84 | # Pentium 81 78 |
| 84 | 85 | # | |
| 85 | push(@INC,"perlasm","../../perlasm"); | 86 | # Version 3.7 reimplements outer rounds as "compact." Meaning that |
| 87 | # first and last rounds reference compact 256 bytes S-box. This means | ||
| 88 | # that first round consumes a lot more CPU cycles and that encrypt | ||
| 89 | # and decrypt performance becomes asymmetric. Encrypt performance | ||
| 90 | # drops by 10-12%, while decrypt - by 20-25%:-( 256 bytes S-box is | ||
| 91 | # aggressively pre-fetched. | ||
| 92 | # | ||
| 93 | # Version 4.0 effectively rolls back to 3.6 and instead implements | ||
| 94 | # additional set of functions, _[x86|sse]_AES_[en|de]crypt_compact, | ||
| 95 | # which use exclusively 256 byte S-box. These functions are to be | ||
| 96 | # called in modes not concealing plain text, such as ECB, or when | ||
| 97 | # we're asked to process smaller amount of data [or unconditionally | ||
| 98 | # on hyper-threading CPU]. Currently it's called unconditionally from | ||
| 99 | # AES_[en|de]crypt, which affects all modes, but CBC. CBC routine | ||
| 100 | # still needs to be modified to switch between slower and faster | ||
| 101 | # mode when appropriate... But in either case benchmark landscape | ||
| 102 | # changes dramatically and below numbers are CPU cycles per processed | ||
| 103 | # byte for 128-bit key. | ||
| 104 | # | ||
| 105 | # ECB encrypt ECB decrypt CBC large chunk | ||
| 106 | # P4 56[60] 84[100] 23 | ||
| 107 | # AMD K8 48[44] 70[79] 18 | ||
| 108 | # PIII 41[50] 61[91] 24 | ||
| 109 | # Core 2 32[38] 45[70] 18.5 | ||
| 110 | # Pentium 120 160 77 | ||
| 111 | # | ||
| 112 | # Version 4.1 switches to compact S-box even in key schedule setup. | ||
| 113 | # | ||
| 114 | # Version 4.2 prefetches compact S-box in every SSE round or in other | ||
| 115 | # words every cache-line is *guaranteed* to be accessed within ~50 | ||
| 116 | # cycles window. Why just SSE? Because it's needed on hyper-threading | ||
| 117 | # CPU! Which is also why it's prefetched with 64 byte stride. Best | ||
| 118 | # part is that it has no negative effect on performance:-) | ||
| 119 | # | ||
| 120 | # Version 4.3 implements switch between compact and non-compact block | ||
| 121 | # functions in AES_cbc_encrypt depending on how much data was asked | ||
| 122 | # to be processed in one stroke. | ||
| 123 | # | ||
| 124 | ###################################################################### | ||
| 125 | # Timing attacks are classified in two classes: synchronous when | ||
| 126 | # attacker consciously initiates cryptographic operation and collects | ||
| 127 | # timing data of various character afterwards, and asynchronous when | ||
| 128 | # malicious code is executed on same CPU simultaneously with AES, | ||
| 129 | # instruments itself and performs statistical analysis of this data. | ||
| 130 | # | ||
| 131 | # As far as synchronous attacks go the root to the AES timing | ||
| 132 | # vulnerability is twofold. Firstly, of 256 S-box elements at most 160 | ||
| 133 | # are referred to in single 128-bit block operation. Well, in C | ||
| 134 | # implementation with 4 distinct tables it's actually as little as 40 | ||
| 135 | # references per 256 elements table, but anyway... Secondly, even | ||
| 136 | # though S-box elements are clustered into smaller amount of cache- | ||
| 137 | # lines, smaller than 160 and even 40, it turned out that for certain | ||
| 138 | # plain-text pattern[s] or simply put chosen plain-text and given key | ||
| 139 | # few cache-lines remain unaccessed during block operation. Now, if | ||
| 140 | # attacker can figure out this access pattern, he can deduct the key | ||
| 141 | # [or at least part of it]. The natural way to mitigate this kind of | ||
| 142 | # attacks is to minimize the amount of cache-lines in S-box and/or | ||
| 143 | # prefetch them to ensure that every one is accessed for more uniform | ||
| 144 | # timing. But note that *if* plain-text was concealed in such way that | ||
| 145 | # input to block function is distributed *uniformly*, then attack | ||
| 146 | # wouldn't apply. Now note that some encryption modes, most notably | ||
| 147 | # CBC, do mask the plain-text in this exact way [secure cipher output | ||
| 148 | # is distributed uniformly]. Yes, one still might find input that | ||
| 149 | # would reveal the information about given key, but if amount of | ||
| 150 | # candidate inputs to be tried is larger than amount of possible key | ||
| 151 | # combinations then attack becomes infeasible. This is why revised | ||
| 152 | # AES_cbc_encrypt "dares" to switch to larger S-box when larger chunk | ||
| 153 | # of data is to be processed in one stroke. The current size limit of | ||
| 154 | # 512 bytes is chosen to provide same [diminishigly low] probability | ||
| 155 | # for cache-line to remain untouched in large chunk operation with | ||
| 156 | # large S-box as for single block operation with compact S-box and | ||
| 157 | # surely needs more careful consideration... | ||
| 158 | # | ||
| 159 | # As for asynchronous attacks. There are two flavours: attacker code | ||
| 160 | # being interleaved with AES on hyper-threading CPU at *instruction* | ||
| 161 | # level, and two processes time sharing single core. As for latter. | ||
| 162 | # Two vectors. 1. Given that attacker process has higher priority, | ||
| 163 | # yield execution to process performing AES just before timer fires | ||
| 164 | # off the scheduler, immediately regain control of CPU and analyze the | ||
| 165 | # cache state. For this attack to be efficient attacker would have to | ||
| 166 | # effectively slow down the operation by several *orders* of magnitute, | ||
| 167 | # by ratio of time slice to duration of handful of AES rounds, which | ||
| 168 | # unlikely to remain unnoticed. Not to mention that this also means | ||
| 169 | # that he would spend correspondigly more time to collect enough | ||
| 170 | # statistical data to mount the attack. It's probably appropriate to | ||
| 171 | # say that if adeversary reckons that this attack is beneficial and | ||
| 172 | # risks to be noticed, you probably have larger problems having him | ||
| 173 | # mere opportunity. In other words suggested code design expects you | ||
| 174 | # to preclude/mitigate this attack by overall system security design. | ||
| 175 | # 2. Attacker manages to make his code interrupt driven. In order for | ||
| 176 | # this kind of attack to be feasible, interrupt rate has to be high | ||
| 177 | # enough, again comparable to duration of handful of AES rounds. But | ||
| 178 | # is there interrupt source of such rate? Hardly, not even 1Gbps NIC | ||
| 179 | # generates interrupts at such raging rate... | ||
| 180 | # | ||
| 181 | # And now back to the former, hyper-threading CPU or more specifically | ||
| 182 | # Intel P4. Recall that asynchronous attack implies that malicious | ||
| 183 | # code instruments itself. And naturally instrumentation granularity | ||
| 184 | # has be noticeably lower than duration of codepath accessing S-box. | ||
| 185 | # Given that all cache-lines are accessed during that time that is. | ||
| 186 | # Current implementation accesses *all* cache-lines within ~50 cycles | ||
| 187 | # window, which is actually *less* than RDTSC latency on Intel P4! | ||
| 188 | |||
| 189 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | ||
| 190 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 86 | require "x86asm.pl"; | 191 | require "x86asm.pl"; |
| 87 | 192 | ||
| 88 | &asm_init($ARGV[0],"aes-586.pl",$ARGV[$#ARGV] eq "386"); | 193 | &asm_init($ARGV[0],"aes-586.pl",$x86only = $ARGV[$#ARGV] eq "386"); |
| 194 | &static_label("AES_Te"); | ||
| 195 | &static_label("AES_Td"); | ||
| 89 | 196 | ||
| 90 | $s0="eax"; | 197 | $s0="eax"; |
| 91 | $s1="ebx"; | 198 | $s1="ebx"; |
| @@ -93,21 +200,36 @@ $s2="ecx"; | |||
| 93 | $s3="edx"; | 200 | $s3="edx"; |
| 94 | $key="edi"; | 201 | $key="edi"; |
| 95 | $acc="esi"; | 202 | $acc="esi"; |
| 203 | $tbl="ebp"; | ||
| 204 | |||
| 205 | # stack frame layout in _[x86|sse]_AES_* routines, frame is allocated | ||
| 206 | # by caller | ||
| 207 | $__ra=&DWP(0,"esp"); # return address | ||
| 208 | $__s0=&DWP(4,"esp"); # s0 backing store | ||
| 209 | $__s1=&DWP(8,"esp"); # s1 backing store | ||
| 210 | $__s2=&DWP(12,"esp"); # s2 backing store | ||
| 211 | $__s3=&DWP(16,"esp"); # s3 backing store | ||
| 212 | $__key=&DWP(20,"esp"); # pointer to key schedule | ||
| 213 | $__end=&DWP(24,"esp"); # pointer to end of key schedule | ||
| 214 | $__tbl=&DWP(28,"esp"); # %ebp backing store | ||
| 215 | |||
| 216 | # stack frame layout in AES_[en|crypt] routines, which differs from | ||
| 217 | # above by 4 and overlaps by %ebp backing store | ||
| 218 | $_tbl=&DWP(24,"esp"); | ||
| 219 | $_esp=&DWP(28,"esp"); | ||
| 96 | 220 | ||
| 97 | $compromise=0; # $compromise=128 abstains from copying key | 221 | sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } } |
| 98 | # schedule to stack when encrypting inputs | 222 | |
| 99 | # shorter than 128 bytes at the cost of | 223 | $speed_limit=512; # chunks smaller than $speed_limit are |
| 100 | # risksing aliasing with S-boxes. In return | 224 | # processed with compact routine in CBC mode |
| 101 | # you get way better, up to +70%, small block | ||
| 102 | # performance. | ||
| 103 | $small_footprint=1; # $small_footprint=1 code is ~5% slower [on | 225 | $small_footprint=1; # $small_footprint=1 code is ~5% slower [on |
| 104 | # recent µ-archs], but ~5 times smaller! | 226 | # recent µ-archs], but ~5 times smaller! |
| 105 | # I favor compact code to minimize cache | 227 | # I favor compact code to minimize cache |
| 106 | # contention and in hope to "collect" 5% back | 228 | # contention and in hope to "collect" 5% back |
| 107 | # in real-life applications... | 229 | # in real-life applications... |
| 230 | |||
| 108 | $vertical_spin=0; # shift "verticaly" defaults to 0, because of | 231 | $vertical_spin=0; # shift "verticaly" defaults to 0, because of |
| 109 | # its proof-of-concept status... | 232 | # its proof-of-concept status... |
| 110 | |||
| 111 | # Note that there is no decvert(), as well as last encryption round is | 233 | # Note that there is no decvert(), as well as last encryption round is |
| 112 | # performed with "horizontal" shifts. This is because this "vertical" | 234 | # performed with "horizontal" shifts. This is because this "vertical" |
| 113 | # implementation [one which groups shifts on a given $s[i] to form a | 235 | # implementation [one which groups shifts on a given $s[i] to form a |
| @@ -170,17 +292,484 @@ sub encvert() | |||
| 170 | &movz ($v0,&HB($v1)); | 292 | &movz ($v0,&HB($v1)); |
| 171 | &and ($v1,0xFF); | 293 | &and ($v1,0xFF); |
| 172 | &xor ($s[3],&DWP(2,$te,$v1,8)); # s1>>16 | 294 | &xor ($s[3],&DWP(2,$te,$v1,8)); # s1>>16 |
| 173 | &mov ($key,&DWP(12,"esp")); # reincarnate v1 as key | 295 | &mov ($key,$__key); # reincarnate v1 as key |
| 174 | &xor ($s[2],&DWP(1,$te,$v0,8)); # s1>>24 | 296 | &xor ($s[2],&DWP(1,$te,$v0,8)); # s1>>24 |
| 175 | } | 297 | } |
| 176 | 298 | ||
| 299 | # Another experimental routine, which features "horizontal spin," but | ||
| 300 | # eliminates one reference to stack. Strangely enough runs slower... | ||
| 301 | sub enchoriz() | ||
| 302 | { my $v0 = $key, $v1 = $acc; | ||
| 303 | |||
| 304 | &movz ($v0,&LB($s0)); # 3, 2, 1, 0* | ||
| 305 | &rotr ($s2,8); # 8,11,10, 9 | ||
| 306 | &mov ($v1,&DWP(0,$te,$v0,8)); # 0 | ||
| 307 | &movz ($v0,&HB($s1)); # 7, 6, 5*, 4 | ||
| 308 | &rotr ($s3,16); # 13,12,15,14 | ||
| 309 | &xor ($v1,&DWP(3,$te,$v0,8)); # 5 | ||
| 310 | &movz ($v0,&HB($s2)); # 8,11,10*, 9 | ||
| 311 | &rotr ($s0,16); # 1, 0, 3, 2 | ||
| 312 | &xor ($v1,&DWP(2,$te,$v0,8)); # 10 | ||
| 313 | &movz ($v0,&HB($s3)); # 13,12,15*,14 | ||
| 314 | &xor ($v1,&DWP(1,$te,$v0,8)); # 15, t[0] collected | ||
| 315 | &mov ($__s0,$v1); # t[0] saved | ||
| 316 | |||
| 317 | &movz ($v0,&LB($s1)); # 7, 6, 5, 4* | ||
| 318 | &shr ($s1,16); # -, -, 7, 6 | ||
| 319 | &mov ($v1,&DWP(0,$te,$v0,8)); # 4 | ||
| 320 | &movz ($v0,&LB($s3)); # 13,12,15,14* | ||
| 321 | &xor ($v1,&DWP(2,$te,$v0,8)); # 14 | ||
| 322 | &movz ($v0,&HB($s0)); # 1, 0, 3*, 2 | ||
| 323 | &and ($s3,0xffff0000); # 13,12, -, - | ||
| 324 | &xor ($v1,&DWP(1,$te,$v0,8)); # 3 | ||
| 325 | &movz ($v0,&LB($s2)); # 8,11,10, 9* | ||
| 326 | &or ($s3,$s1); # 13,12, 7, 6 | ||
| 327 | &xor ($v1,&DWP(3,$te,$v0,8)); # 9, t[1] collected | ||
| 328 | &mov ($s1,$v1); # s[1]=t[1] | ||
| 329 | |||
| 330 | &movz ($v0,&LB($s0)); # 1, 0, 3, 2* | ||
| 331 | &shr ($s2,16); # -, -, 8,11 | ||
| 332 | &mov ($v1,&DWP(2,$te,$v0,8)); # 2 | ||
| 333 | &movz ($v0,&HB($s3)); # 13,12, 7*, 6 | ||
| 334 | &xor ($v1,&DWP(1,$te,$v0,8)); # 7 | ||
| 335 | &movz ($v0,&HB($s2)); # -, -, 8*,11 | ||
| 336 | &xor ($v1,&DWP(0,$te,$v0,8)); # 8 | ||
| 337 | &mov ($v0,$s3); | ||
| 338 | &shr ($v0,24); # 13 | ||
| 339 | &xor ($v1,&DWP(3,$te,$v0,8)); # 13, t[2] collected | ||
| 340 | |||
| 341 | &movz ($v0,&LB($s2)); # -, -, 8,11* | ||
| 342 | &shr ($s0,24); # 1* | ||
| 343 | &mov ($s2,&DWP(1,$te,$v0,8)); # 11 | ||
| 344 | &xor ($s2,&DWP(3,$te,$s0,8)); # 1 | ||
| 345 | &mov ($s0,$__s0); # s[0]=t[0] | ||
| 346 | &movz ($v0,&LB($s3)); # 13,12, 7, 6* | ||
| 347 | &shr ($s3,16); # , ,13,12 | ||
| 348 | &xor ($s2,&DWP(2,$te,$v0,8)); # 6 | ||
| 349 | &mov ($key,$__key); # reincarnate v0 as key | ||
| 350 | &and ($s3,0xff); # , ,13,12* | ||
| 351 | &mov ($s3,&DWP(0,$te,$s3,8)); # 12 | ||
| 352 | &xor ($s3,$s2); # s[2]=t[3] collected | ||
| 353 | &mov ($s2,$v1); # s[2]=t[2] | ||
| 354 | } | ||
| 355 | |||
| 356 | # More experimental code... SSE one... Even though this one eliminates | ||
| 357 | # *all* references to stack, it's not faster... | ||
| 358 | sub sse_encbody() | ||
| 359 | { | ||
| 360 | &movz ($acc,&LB("eax")); # 0 | ||
| 361 | &mov ("ecx",&DWP(0,$tbl,$acc,8)); # 0 | ||
| 362 | &pshufw ("mm2","mm0",0x0d); # 7, 6, 3, 2 | ||
| 363 | &movz ("edx",&HB("eax")); # 1 | ||
| 364 | &mov ("edx",&DWP(3,$tbl,"edx",8)); # 1 | ||
| 365 | &shr ("eax",16); # 5, 4 | ||
| 366 | |||
| 367 | &movz ($acc,&LB("ebx")); # 10 | ||
| 368 | &xor ("ecx",&DWP(2,$tbl,$acc,8)); # 10 | ||
| 369 | &pshufw ("mm6","mm4",0x08); # 13,12, 9, 8 | ||
| 370 | &movz ($acc,&HB("ebx")); # 11 | ||
| 371 | &xor ("edx",&DWP(1,$tbl,$acc,8)); # 11 | ||
| 372 | &shr ("ebx",16); # 15,14 | ||
| 373 | |||
| 374 | &movz ($acc,&HB("eax")); # 5 | ||
| 375 | &xor ("ecx",&DWP(3,$tbl,$acc,8)); # 5 | ||
| 376 | &movq ("mm3",QWP(16,$key)); | ||
| 377 | &movz ($acc,&HB("ebx")); # 15 | ||
| 378 | &xor ("ecx",&DWP(1,$tbl,$acc,8)); # 15 | ||
| 379 | &movd ("mm0","ecx"); # t[0] collected | ||
| 380 | |||
| 381 | &movz ($acc,&LB("eax")); # 4 | ||
| 382 | &mov ("ecx",&DWP(0,$tbl,$acc,8)); # 4 | ||
| 383 | &movd ("eax","mm2"); # 7, 6, 3, 2 | ||
| 384 | &movz ($acc,&LB("ebx")); # 14 | ||
| 385 | &xor ("ecx",&DWP(2,$tbl,$acc,8)); # 14 | ||
| 386 | &movd ("ebx","mm6"); # 13,12, 9, 8 | ||
| 387 | |||
| 388 | &movz ($acc,&HB("eax")); # 3 | ||
| 389 | &xor ("ecx",&DWP(1,$tbl,$acc,8)); # 3 | ||
| 390 | &movz ($acc,&HB("ebx")); # 9 | ||
| 391 | &xor ("ecx",&DWP(3,$tbl,$acc,8)); # 9 | ||
| 392 | &movd ("mm1","ecx"); # t[1] collected | ||
| 393 | |||
| 394 | &movz ($acc,&LB("eax")); # 2 | ||
| 395 | &mov ("ecx",&DWP(2,$tbl,$acc,8)); # 2 | ||
| 396 | &shr ("eax",16); # 7, 6 | ||
| 397 | &punpckldq ("mm0","mm1"); # t[0,1] collected | ||
| 398 | &movz ($acc,&LB("ebx")); # 8 | ||
| 399 | &xor ("ecx",&DWP(0,$tbl,$acc,8)); # 8 | ||
| 400 | &shr ("ebx",16); # 13,12 | ||
| 401 | |||
| 402 | &movz ($acc,&HB("eax")); # 7 | ||
| 403 | &xor ("ecx",&DWP(1,$tbl,$acc,8)); # 7 | ||
| 404 | &pxor ("mm0","mm3"); | ||
| 405 | &movz ("eax",&LB("eax")); # 6 | ||
| 406 | &xor ("edx",&DWP(2,$tbl,"eax",8)); # 6 | ||
| 407 | &pshufw ("mm1","mm0",0x08); # 5, 4, 1, 0 | ||
| 408 | &movz ($acc,&HB("ebx")); # 13 | ||
| 409 | &xor ("ecx",&DWP(3,$tbl,$acc,8)); # 13 | ||
| 410 | &xor ("ecx",&DWP(24,$key)); # t[2] | ||
| 411 | &movd ("mm4","ecx"); # t[2] collected | ||
| 412 | &movz ("ebx",&LB("ebx")); # 12 | ||
| 413 | &xor ("edx",&DWP(0,$tbl,"ebx",8)); # 12 | ||
| 414 | &shr ("ecx",16); | ||
| 415 | &movd ("eax","mm1"); # 5, 4, 1, 0 | ||
| 416 | &mov ("ebx",&DWP(28,$key)); # t[3] | ||
| 417 | &xor ("ebx","edx"); | ||
| 418 | &movd ("mm5","ebx"); # t[3] collected | ||
| 419 | &and ("ebx",0xffff0000); | ||
| 420 | &or ("ebx","ecx"); | ||
| 421 | |||
| 422 | &punpckldq ("mm4","mm5"); # t[2,3] collected | ||
| 423 | } | ||
| 424 | |||
| 425 | ###################################################################### | ||
| 426 | # "Compact" block function | ||
| 427 | ###################################################################### | ||
| 428 | |||
| 429 | sub enccompact() | ||
| 430 | { my $Fn = mov; | ||
| 431 | while ($#_>5) { pop(@_); $Fn=sub{}; } | ||
| 432 | my ($i,$te,@s)=@_; | ||
| 433 | my $tmp = $key; | ||
| 434 | my $out = $i==3?$s[0]:$acc; | ||
| 435 | |||
| 436 | # $Fn is used in first compact round and its purpose is to | ||
| 437 | # void restoration of some values from stack, so that after | ||
| 438 | # 4xenccompact with extra argument $key value is left there... | ||
| 439 | if ($i==3) { &$Fn ($key,$__key); }##%edx | ||
| 440 | else { &mov ($out,$s[0]); } | ||
| 441 | &and ($out,0xFF); | ||
| 442 | if ($i==1) { &shr ($s[0],16); }#%ebx[1] | ||
| 443 | if ($i==2) { &shr ($s[0],24); }#%ecx[2] | ||
| 444 | &movz ($out,&BP(-128,$te,$out,1)); | ||
| 445 | |||
| 446 | if ($i==3) { $tmp=$s[1]; }##%eax | ||
| 447 | &movz ($tmp,&HB($s[1])); | ||
| 448 | &movz ($tmp,&BP(-128,$te,$tmp,1)); | ||
| 449 | &shl ($tmp,8); | ||
| 450 | &xor ($out,$tmp); | ||
| 451 | |||
| 452 | if ($i==3) { $tmp=$s[2]; &mov ($s[1],$__s0); }##%ebx | ||
| 453 | else { &mov ($tmp,$s[2]); | ||
| 454 | &shr ($tmp,16); } | ||
| 455 | if ($i==2) { &and ($s[1],0xFF); }#%edx[2] | ||
| 456 | &and ($tmp,0xFF); | ||
| 457 | &movz ($tmp,&BP(-128,$te,$tmp,1)); | ||
| 458 | &shl ($tmp,16); | ||
| 459 | &xor ($out,$tmp); | ||
| 460 | |||
| 461 | if ($i==3) { $tmp=$s[3]; &mov ($s[2],$__s1); }##%ecx | ||
| 462 | elsif($i==2){ &movz ($tmp,&HB($s[3])); }#%ebx[2] | ||
| 463 | else { &mov ($tmp,$s[3]); | ||
| 464 | &shr ($tmp,24); } | ||
| 465 | &movz ($tmp,&BP(-128,$te,$tmp,1)); | ||
| 466 | &shl ($tmp,24); | ||
| 467 | &xor ($out,$tmp); | ||
| 468 | if ($i<2) { &mov (&DWP(4+4*$i,"esp"),$out); } | ||
| 469 | if ($i==3) { &mov ($s[3],$acc); } | ||
| 470 | &comment(); | ||
| 471 | } | ||
| 472 | |||
| 473 | sub enctransform() | ||
| 474 | { my @s = ($s0,$s1,$s2,$s3); | ||
| 475 | my $i = shift; | ||
| 476 | my $tmp = $tbl; | ||
| 477 | my $r2 = $key ; | ||
| 478 | |||
| 479 | &mov ($acc,$s[$i]); | ||
| 480 | &and ($acc,0x80808080); | ||
| 481 | &mov ($tmp,$acc); | ||
| 482 | &shr ($tmp,7); | ||
| 483 | &lea ($r2,&DWP(0,$s[$i],$s[$i])); | ||
| 484 | &sub ($acc,$tmp); | ||
| 485 | &and ($r2,0xfefefefe); | ||
| 486 | &and ($acc,0x1b1b1b1b); | ||
| 487 | &mov ($tmp,$s[$i]); | ||
| 488 | &xor ($acc,$r2); # r2 | ||
| 489 | |||
| 490 | &xor ($s[$i],$acc); # r0 ^ r2 | ||
| 491 | &rotl ($s[$i],24); | ||
| 492 | &xor ($s[$i],$acc) # ROTATE(r2^r0,24) ^ r2 | ||
| 493 | &rotr ($tmp,16); | ||
| 494 | &xor ($s[$i],$tmp); | ||
| 495 | &rotr ($tmp,8); | ||
| 496 | &xor ($s[$i],$tmp); | ||
| 497 | } | ||
| 498 | |||
| 499 | &function_begin_B("_x86_AES_encrypt_compact"); | ||
| 500 | # note that caller is expected to allocate stack frame for me! | ||
| 501 | &mov ($__key,$key); # save key | ||
| 502 | |||
| 503 | &xor ($s0,&DWP(0,$key)); # xor with key | ||
| 504 | &xor ($s1,&DWP(4,$key)); | ||
| 505 | &xor ($s2,&DWP(8,$key)); | ||
| 506 | &xor ($s3,&DWP(12,$key)); | ||
| 507 | |||
| 508 | &mov ($acc,&DWP(240,$key)); # load key->rounds | ||
| 509 | &lea ($acc,&DWP(-2,$acc,$acc)); | ||
| 510 | &lea ($acc,&DWP(0,$key,$acc,8)); | ||
| 511 | &mov ($__end,$acc); # end of key schedule | ||
| 512 | |||
| 513 | # prefetch Te4 | ||
| 514 | &mov ($key,&DWP(0-128,$tbl)); | ||
| 515 | &mov ($acc,&DWP(32-128,$tbl)); | ||
| 516 | &mov ($key,&DWP(64-128,$tbl)); | ||
| 517 | &mov ($acc,&DWP(96-128,$tbl)); | ||
| 518 | &mov ($key,&DWP(128-128,$tbl)); | ||
| 519 | &mov ($acc,&DWP(160-128,$tbl)); | ||
| 520 | &mov ($key,&DWP(192-128,$tbl)); | ||
| 521 | &mov ($acc,&DWP(224-128,$tbl)); | ||
| 522 | |||
| 523 | &set_label("loop",16); | ||
| 524 | |||
| 525 | &enccompact(0,$tbl,$s0,$s1,$s2,$s3,1); | ||
| 526 | &enccompact(1,$tbl,$s1,$s2,$s3,$s0,1); | ||
| 527 | &enccompact(2,$tbl,$s2,$s3,$s0,$s1,1); | ||
| 528 | &enccompact(3,$tbl,$s3,$s0,$s1,$s2,1); | ||
| 529 | &enctransform(2); | ||
| 530 | &enctransform(3); | ||
| 531 | &enctransform(0); | ||
| 532 | &enctransform(1); | ||
| 533 | &mov ($key,$__key); | ||
| 534 | &mov ($tbl,$__tbl); | ||
| 535 | &add ($key,16); # advance rd_key | ||
| 536 | &xor ($s0,&DWP(0,$key)); | ||
| 537 | &xor ($s1,&DWP(4,$key)); | ||
| 538 | &xor ($s2,&DWP(8,$key)); | ||
| 539 | &xor ($s3,&DWP(12,$key)); | ||
| 540 | |||
| 541 | &cmp ($key,$__end); | ||
| 542 | &mov ($__key,$key); | ||
| 543 | &jb (&label("loop")); | ||
| 544 | |||
| 545 | &enccompact(0,$tbl,$s0,$s1,$s2,$s3); | ||
| 546 | &enccompact(1,$tbl,$s1,$s2,$s3,$s0); | ||
| 547 | &enccompact(2,$tbl,$s2,$s3,$s0,$s1); | ||
| 548 | &enccompact(3,$tbl,$s3,$s0,$s1,$s2); | ||
| 549 | |||
| 550 | &xor ($s0,&DWP(16,$key)); | ||
| 551 | &xor ($s1,&DWP(20,$key)); | ||
| 552 | &xor ($s2,&DWP(24,$key)); | ||
| 553 | &xor ($s3,&DWP(28,$key)); | ||
| 554 | |||
| 555 | &ret (); | ||
| 556 | &function_end_B("_x86_AES_encrypt_compact"); | ||
| 557 | |||
| 558 | ###################################################################### | ||
| 559 | # "Compact" SSE block function. | ||
| 560 | ###################################################################### | ||
| 561 | # | ||
| 562 | # Performance is not actually extraordinary in comparison to pure | ||
| 563 | # x86 code. In particular encrypt performance is virtually the same. | ||
| 564 | # Decrypt performance on the other hand is 15-20% better on newer | ||
| 565 | # µ-archs [but we're thankful for *any* improvement here], and ~50% | ||
| 566 | # better on PIII:-) And additionally on the pros side this code | ||
| 567 | # eliminates redundant references to stack and thus relieves/ | ||
| 568 | # minimizes the pressure on the memory bus. | ||
| 569 | # | ||
| 570 | # MMX register layout lsb | ||
| 571 | # +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ||
| 572 | # | mm4 | mm0 | | ||
| 573 | # +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ||
| 574 | # | s3 | s2 | s1 | s0 | | ||
| 575 | # +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ||
| 576 | # |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| | ||
| 577 | # +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ||
| 578 | # | ||
| 579 | # Indexes translate as s[N/4]>>(8*(N%4)), e.g. 5 means s1>>8. | ||
| 580 | # In this terms encryption and decryption "compact" permutation | ||
| 581 | # matrices can be depicted as following: | ||
| 582 | # | ||
| 583 | # encryption lsb # decryption lsb | ||
| 584 | # +----++----+----+----+----+ # +----++----+----+----+----+ | ||
| 585 | # | t0 || 15 | 10 | 5 | 0 | # | t0 || 7 | 10 | 13 | 0 | | ||
| 586 | # +----++----+----+----+----+ # +----++----+----+----+----+ | ||
| 587 | # | t1 || 3 | 14 | 9 | 4 | # | t1 || 11 | 14 | 1 | 4 | | ||
| 588 | # +----++----+----+----+----+ # +----++----+----+----+----+ | ||
| 589 | # | t2 || 7 | 2 | 13 | 8 | # | t2 || 15 | 2 | 5 | 8 | | ||
| 590 | # +----++----+----+----+----+ # +----++----+----+----+----+ | ||
| 591 | # | t3 || 11 | 6 | 1 | 12 | # | t3 || 3 | 6 | 9 | 12 | | ||
| 592 | # +----++----+----+----+----+ # +----++----+----+----+----+ | ||
| 593 | # | ||
| 594 | ###################################################################### | ||
| 595 | # Why not xmm registers? Short answer. It was actually tested and | ||
| 596 | # was not any faster, but *contrary*, most notably on Intel CPUs. | ||
| 597 | # Longer answer. Main advantage of using mm registers is that movd | ||
| 598 | # latency is lower, especially on Intel P4. While arithmetic | ||
| 599 | # instructions are twice as many, they can be scheduled every cycle | ||
| 600 | # and not every second one when they are operating on xmm register, | ||
| 601 | # so that "arithmetic throughput" remains virtually the same. And | ||
| 602 | # finally the code can be executed even on elder SSE-only CPUs:-) | ||
| 603 | |||
| 604 | sub sse_enccompact() | ||
| 605 | { | ||
| 606 | &pshufw ("mm1","mm0",0x08); # 5, 4, 1, 0 | ||
| 607 | &pshufw ("mm5","mm4",0x0d); # 15,14,11,10 | ||
| 608 | &movd ("eax","mm1"); # 5, 4, 1, 0 | ||
| 609 | &movd ("ebx","mm5"); # 15,14,11,10 | ||
| 610 | |||
| 611 | &movz ($acc,&LB("eax")); # 0 | ||
| 612 | &movz ("ecx",&BP(-128,$tbl,$acc,1)); # 0 | ||
| 613 | &pshufw ("mm2","mm0",0x0d); # 7, 6, 3, 2 | ||
| 614 | &movz ("edx",&HB("eax")); # 1 | ||
| 615 | &movz ("edx",&BP(-128,$tbl,"edx",1)); # 1 | ||
| 616 | &shl ("edx",8); # 1 | ||
| 617 | &shr ("eax",16); # 5, 4 | ||
| 618 | |||
| 619 | &movz ($acc,&LB("ebx")); # 10 | ||
| 620 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 10 | ||
| 621 | &shl ($acc,16); # 10 | ||
| 622 | &or ("ecx",$acc); # 10 | ||
| 623 | &pshufw ("mm6","mm4",0x08); # 13,12, 9, 8 | ||
| 624 | &movz ($acc,&HB("ebx")); # 11 | ||
| 625 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 11 | ||
| 626 | &shl ($acc,24); # 11 | ||
| 627 | &or ("edx",$acc); # 11 | ||
| 628 | &shr ("ebx",16); # 15,14 | ||
| 629 | |||
| 630 | &movz ($acc,&HB("eax")); # 5 | ||
| 631 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 5 | ||
| 632 | &shl ($acc,8); # 5 | ||
| 633 | &or ("ecx",$acc); # 5 | ||
| 634 | &movz ($acc,&HB("ebx")); # 15 | ||
| 635 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 15 | ||
| 636 | &shl ($acc,24); # 15 | ||
| 637 | &or ("ecx",$acc); # 15 | ||
| 638 | &movd ("mm0","ecx"); # t[0] collected | ||
| 639 | |||
| 640 | &movz ($acc,&LB("eax")); # 4 | ||
| 641 | &movz ("ecx",&BP(-128,$tbl,$acc,1)); # 4 | ||
| 642 | &movd ("eax","mm2"); # 7, 6, 3, 2 | ||
| 643 | &movz ($acc,&LB("ebx")); # 14 | ||
| 644 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 14 | ||
| 645 | &shl ($acc,16); # 14 | ||
| 646 | &or ("ecx",$acc); # 14 | ||
| 647 | |||
| 648 | &movd ("ebx","mm6"); # 13,12, 9, 8 | ||
| 649 | &movz ($acc,&HB("eax")); # 3 | ||
| 650 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 3 | ||
| 651 | &shl ($acc,24); # 3 | ||
| 652 | &or ("ecx",$acc); # 3 | ||
| 653 | &movz ($acc,&HB("ebx")); # 9 | ||
| 654 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 9 | ||
| 655 | &shl ($acc,8); # 9 | ||
| 656 | &or ("ecx",$acc); # 9 | ||
| 657 | &movd ("mm1","ecx"); # t[1] collected | ||
| 658 | |||
| 659 | &movz ($acc,&LB("ebx")); # 8 | ||
| 660 | &movz ("ecx",&BP(-128,$tbl,$acc,1)); # 8 | ||
| 661 | &shr ("ebx",16); # 13,12 | ||
| 662 | &movz ($acc,&LB("eax")); # 2 | ||
| 663 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 2 | ||
| 664 | &shl ($acc,16); # 2 | ||
| 665 | &or ("ecx",$acc); # 2 | ||
| 666 | &shr ("eax",16); # 7, 6 | ||
| 667 | |||
| 668 | &punpckldq ("mm0","mm1"); # t[0,1] collected | ||
| 669 | |||
| 670 | &movz ($acc,&HB("eax")); # 7 | ||
| 671 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 7 | ||
| 672 | &shl ($acc,24); # 7 | ||
| 673 | &or ("ecx",$acc); # 7 | ||
| 674 | &and ("eax",0xff); # 6 | ||
| 675 | &movz ("eax",&BP(-128,$tbl,"eax",1)); # 6 | ||
| 676 | &shl ("eax",16); # 6 | ||
| 677 | &or ("edx","eax"); # 6 | ||
| 678 | &movz ($acc,&HB("ebx")); # 13 | ||
| 679 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 13 | ||
| 680 | &shl ($acc,8); # 13 | ||
| 681 | &or ("ecx",$acc); # 13 | ||
| 682 | &movd ("mm4","ecx"); # t[2] collected | ||
| 683 | &and ("ebx",0xff); # 12 | ||
| 684 | &movz ("ebx",&BP(-128,$tbl,"ebx",1)); # 12 | ||
| 685 | &or ("edx","ebx"); # 12 | ||
| 686 | &movd ("mm5","edx"); # t[3] collected | ||
| 687 | |||
| 688 | &punpckldq ("mm4","mm5"); # t[2,3] collected | ||
| 689 | } | ||
| 690 | |||
| 691 | if (!$x86only) { | ||
| 692 | &function_begin_B("_sse_AES_encrypt_compact"); | ||
| 693 | &pxor ("mm0",&QWP(0,$key)); # 7, 6, 5, 4, 3, 2, 1, 0 | ||
| 694 | &pxor ("mm4",&QWP(8,$key)); # 15,14,13,12,11,10, 9, 8 | ||
| 695 | |||
| 696 | # note that caller is expected to allocate stack frame for me! | ||
| 697 | &mov ($acc,&DWP(240,$key)); # load key->rounds | ||
| 698 | &lea ($acc,&DWP(-2,$acc,$acc)); | ||
| 699 | &lea ($acc,&DWP(0,$key,$acc,8)); | ||
| 700 | &mov ($__end,$acc); # end of key schedule | ||
| 701 | |||
| 702 | &mov ($s0,0x1b1b1b1b); # magic constant | ||
| 703 | &mov (&DWP(8,"esp"),$s0); | ||
| 704 | &mov (&DWP(12,"esp"),$s0); | ||
| 705 | |||
| 706 | # prefetch Te4 | ||
| 707 | &mov ($s0,&DWP(0-128,$tbl)); | ||
| 708 | &mov ($s1,&DWP(32-128,$tbl)); | ||
| 709 | &mov ($s2,&DWP(64-128,$tbl)); | ||
| 710 | &mov ($s3,&DWP(96-128,$tbl)); | ||
| 711 | &mov ($s0,&DWP(128-128,$tbl)); | ||
| 712 | &mov ($s1,&DWP(160-128,$tbl)); | ||
| 713 | &mov ($s2,&DWP(192-128,$tbl)); | ||
| 714 | &mov ($s3,&DWP(224-128,$tbl)); | ||
| 715 | |||
| 716 | &set_label("loop",16); | ||
| 717 | &sse_enccompact(); | ||
| 718 | &add ($key,16); | ||
| 719 | &cmp ($key,$__end); | ||
| 720 | &ja (&label("out")); | ||
| 721 | |||
| 722 | &movq ("mm2",&QWP(8,"esp")); | ||
| 723 | &pxor ("mm3","mm3"); &pxor ("mm7","mm7"); | ||
| 724 | &movq ("mm1","mm0"); &movq ("mm5","mm4"); # r0 | ||
| 725 | &pcmpgtb("mm3","mm0"); &pcmpgtb("mm7","mm4"); | ||
| 726 | &pand ("mm3","mm2"); &pand ("mm7","mm2"); | ||
| 727 | &pshufw ("mm2","mm0",0xb1); &pshufw ("mm6","mm4",0xb1);# ROTATE(r0,16) | ||
| 728 | &paddb ("mm0","mm0"); &paddb ("mm4","mm4"); | ||
| 729 | &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # = r2 | ||
| 730 | &pshufw ("mm3","mm2",0xb1); &pshufw ("mm7","mm6",0xb1);# r0 | ||
| 731 | &pxor ("mm1","mm0"); &pxor ("mm5","mm4"); # r0^r2 | ||
| 732 | &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^= ROTATE(r0,16) | ||
| 733 | |||
| 734 | &movq ("mm2","mm3"); &movq ("mm6","mm7"); | ||
| 735 | &pslld ("mm3",8); &pslld ("mm7",8); | ||
| 736 | &psrld ("mm2",24); &psrld ("mm6",24); | ||
| 737 | &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^= r0<<8 | ||
| 738 | &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^= r0>>24 | ||
| 739 | |||
| 740 | &movq ("mm3","mm1"); &movq ("mm7","mm5"); | ||
| 741 | &movq ("mm2",&QWP(0,$key)); &movq ("mm6",&QWP(8,$key)); | ||
| 742 | &psrld ("mm1",8); &psrld ("mm5",8); | ||
| 743 | &mov ($s0,&DWP(0-128,$tbl)); | ||
| 744 | &pslld ("mm3",24); &pslld ("mm7",24); | ||
| 745 | &mov ($s1,&DWP(64-128,$tbl)); | ||
| 746 | &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^= (r2^r0)<<8 | ||
| 747 | &mov ($s2,&DWP(128-128,$tbl)); | ||
| 748 | &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^= (r2^r0)>>24 | ||
| 749 | &mov ($s3,&DWP(192-128,$tbl)); | ||
| 750 | |||
| 751 | &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); | ||
| 752 | &jmp (&label("loop")); | ||
| 753 | |||
| 754 | &set_label("out",16); | ||
| 755 | &pxor ("mm0",&QWP(0,$key)); | ||
| 756 | &pxor ("mm4",&QWP(8,$key)); | ||
| 757 | |||
| 758 | &ret (); | ||
| 759 | &function_end_B("_sse_AES_encrypt_compact"); | ||
| 760 | } | ||
| 761 | |||
| 762 | ###################################################################### | ||
| 763 | # Vanilla block function. | ||
| 764 | ###################################################################### | ||
| 765 | |||
| 177 | sub encstep() | 766 | sub encstep() |
| 178 | { my ($i,$te,@s) = @_; | 767 | { my ($i,$te,@s) = @_; |
| 179 | my $tmp = $key; | 768 | my $tmp = $key; |
| 180 | my $out = $i==3?$s[0]:$acc; | 769 | my $out = $i==3?$s[0]:$acc; |
| 181 | 770 | ||
| 182 | # lines marked with #%e?x[i] denote "reordered" instructions... | 771 | # lines marked with #%e?x[i] denote "reordered" instructions... |
| 183 | if ($i==3) { &mov ($key,&DWP(12,"esp")); }##%edx | 772 | if ($i==3) { &mov ($key,$__key); }##%edx |
| 184 | else { &mov ($out,$s[0]); | 773 | else { &mov ($out,$s[0]); |
| 185 | &and ($out,0xFF); } | 774 | &and ($out,0xFF); } |
| 186 | if ($i==1) { &shr ($s[0],16); }#%ebx[1] | 775 | if ($i==1) { &shr ($s[0],16); }#%ebx[1] |
| @@ -191,14 +780,14 @@ sub encstep() | |||
| 191 | &movz ($tmp,&HB($s[1])); | 780 | &movz ($tmp,&HB($s[1])); |
| 192 | &xor ($out,&DWP(3,$te,$tmp,8)); | 781 | &xor ($out,&DWP(3,$te,$tmp,8)); |
| 193 | 782 | ||
| 194 | if ($i==3) { $tmp=$s[2]; &mov ($s[1],&DWP(4,"esp")); }##%ebx | 783 | if ($i==3) { $tmp=$s[2]; &mov ($s[1],$__s0); }##%ebx |
| 195 | else { &mov ($tmp,$s[2]); | 784 | else { &mov ($tmp,$s[2]); |
| 196 | &shr ($tmp,16); } | 785 | &shr ($tmp,16); } |
| 197 | if ($i==2) { &and ($s[1],0xFF); }#%edx[2] | 786 | if ($i==2) { &and ($s[1],0xFF); }#%edx[2] |
| 198 | &and ($tmp,0xFF); | 787 | &and ($tmp,0xFF); |
| 199 | &xor ($out,&DWP(2,$te,$tmp,8)); | 788 | &xor ($out,&DWP(2,$te,$tmp,8)); |
| 200 | 789 | ||
| 201 | if ($i==3) { $tmp=$s[3]; &mov ($s[2],&DWP(8,"esp")); }##%ecx | 790 | if ($i==3) { $tmp=$s[3]; &mov ($s[2],$__s1); }##%ecx |
| 202 | elsif($i==2){ &movz ($tmp,&HB($s[3])); }#%ebx[2] | 791 | elsif($i==2){ &movz ($tmp,&HB($s[3])); }#%ebx[2] |
| 203 | else { &mov ($tmp,$s[3]); | 792 | else { &mov ($tmp,$s[3]); |
| 204 | &shr ($tmp,24) } | 793 | &shr ($tmp,24) } |
| @@ -213,7 +802,7 @@ sub enclast() | |||
| 213 | my $tmp = $key; | 802 | my $tmp = $key; |
| 214 | my $out = $i==3?$s[0]:$acc; | 803 | my $out = $i==3?$s[0]:$acc; |
| 215 | 804 | ||
| 216 | if ($i==3) { &mov ($key,&DWP(12,"esp")); }##%edx | 805 | if ($i==3) { &mov ($key,$__key); }##%edx |
| 217 | else { &mov ($out,$s[0]); } | 806 | else { &mov ($out,$s[0]); } |
| 218 | &and ($out,0xFF); | 807 | &and ($out,0xFF); |
| 219 | if ($i==1) { &shr ($s[0],16); }#%ebx[1] | 808 | if ($i==1) { &shr ($s[0],16); }#%ebx[1] |
| @@ -227,8 +816,8 @@ sub enclast() | |||
| 227 | &and ($tmp,0x0000ff00); | 816 | &and ($tmp,0x0000ff00); |
| 228 | &xor ($out,$tmp); | 817 | &xor ($out,$tmp); |
| 229 | 818 | ||
| 230 | if ($i==3) { $tmp=$s[2]; &mov ($s[1],&DWP(4,"esp")); }##%ebx | 819 | if ($i==3) { $tmp=$s[2]; &mov ($s[1],$__s0); }##%ebx |
| 231 | else { mov ($tmp,$s[2]); | 820 | else { &mov ($tmp,$s[2]); |
| 232 | &shr ($tmp,16); } | 821 | &shr ($tmp,16); } |
| 233 | if ($i==2) { &and ($s[1],0xFF); }#%edx[2] | 822 | if ($i==2) { &and ($s[1],0xFF); }#%edx[2] |
| 234 | &and ($tmp,0xFF); | 823 | &and ($tmp,0xFF); |
| @@ -236,7 +825,7 @@ sub enclast() | |||
| 236 | &and ($tmp,0x00ff0000); | 825 | &and ($tmp,0x00ff0000); |
| 237 | &xor ($out,$tmp); | 826 | &xor ($out,$tmp); |
| 238 | 827 | ||
| 239 | if ($i==3) { $tmp=$s[3]; &mov ($s[2],&DWP(8,"esp")); }##%ecx | 828 | if ($i==3) { $tmp=$s[3]; &mov ($s[2],$__s1); }##%ecx |
| 240 | elsif($i==2){ &movz ($tmp,&HB($s[3])); }#%ebx[2] | 829 | elsif($i==2){ &movz ($tmp,&HB($s[3])); }#%ebx[2] |
| 241 | else { &mov ($tmp,$s[3]); | 830 | else { &mov ($tmp,$s[3]); |
| 242 | &shr ($tmp,24); } | 831 | &shr ($tmp,24); } |
| @@ -247,10 +836,7 @@ sub enclast() | |||
| 247 | if ($i==3) { &mov ($s[3],$acc); } | 836 | if ($i==3) { &mov ($s[3],$acc); } |
| 248 | } | 837 | } |
| 249 | 838 | ||
| 250 | sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } } | 839 | &function_begin_B("_x86_AES_encrypt"); |
| 251 | |||
| 252 | &public_label("AES_Te"); | ||
| 253 | &function_begin_C("_x86_AES_encrypt"); | ||
| 254 | if ($vertical_spin) { | 840 | if ($vertical_spin) { |
| 255 | # I need high parts of volatile registers to be accessible... | 841 | # I need high parts of volatile registers to be accessible... |
| 256 | &exch ($s1="edi",$key="ebx"); | 842 | &exch ($s1="edi",$key="ebx"); |
| @@ -258,7 +844,7 @@ sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } } | |||
| 258 | } | 844 | } |
| 259 | 845 | ||
| 260 | # note that caller is expected to allocate stack frame for me! | 846 | # note that caller is expected to allocate stack frame for me! |
| 261 | &mov (&DWP(12,"esp"),$key); # save key | 847 | &mov ($__key,$key); # save key |
| 262 | 848 | ||
| 263 | &xor ($s0,&DWP(0,$key)); # xor with key | 849 | &xor ($s0,&DWP(0,$key)); # xor with key |
| 264 | &xor ($s1,&DWP(4,$key)); | 850 | &xor ($s1,&DWP(4,$key)); |
| @@ -270,24 +856,24 @@ sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } } | |||
| 270 | if ($small_footprint) { | 856 | if ($small_footprint) { |
| 271 | &lea ($acc,&DWP(-2,$acc,$acc)); | 857 | &lea ($acc,&DWP(-2,$acc,$acc)); |
| 272 | &lea ($acc,&DWP(0,$key,$acc,8)); | 858 | &lea ($acc,&DWP(0,$key,$acc,8)); |
| 273 | &mov (&DWP(16,"esp"),$acc); # end of key schedule | 859 | &mov ($__end,$acc); # end of key schedule |
| 274 | &align (4); | 860 | |
| 275 | &set_label("loop"); | 861 | &set_label("loop",16); |
| 276 | if ($vertical_spin) { | 862 | if ($vertical_spin) { |
| 277 | &encvert("ebp",$s0,$s1,$s2,$s3); | 863 | &encvert($tbl,$s0,$s1,$s2,$s3); |
| 278 | } else { | 864 | } else { |
| 279 | &encstep(0,"ebp",$s0,$s1,$s2,$s3); | 865 | &encstep(0,$tbl,$s0,$s1,$s2,$s3); |
| 280 | &encstep(1,"ebp",$s1,$s2,$s3,$s0); | 866 | &encstep(1,$tbl,$s1,$s2,$s3,$s0); |
| 281 | &encstep(2,"ebp",$s2,$s3,$s0,$s1); | 867 | &encstep(2,$tbl,$s2,$s3,$s0,$s1); |
| 282 | &encstep(3,"ebp",$s3,$s0,$s1,$s2); | 868 | &encstep(3,$tbl,$s3,$s0,$s1,$s2); |
| 283 | } | 869 | } |
| 284 | &add ($key,16); # advance rd_key | 870 | &add ($key,16); # advance rd_key |
| 285 | &xor ($s0,&DWP(0,$key)); | 871 | &xor ($s0,&DWP(0,$key)); |
| 286 | &xor ($s1,&DWP(4,$key)); | 872 | &xor ($s1,&DWP(4,$key)); |
| 287 | &xor ($s2,&DWP(8,$key)); | 873 | &xor ($s2,&DWP(8,$key)); |
| 288 | &xor ($s3,&DWP(12,$key)); | 874 | &xor ($s3,&DWP(12,$key)); |
| 289 | &cmp ($key,&DWP(16,"esp")); | 875 | &cmp ($key,$__end); |
| 290 | &mov (&DWP(12,"esp"),$key); | 876 | &mov ($__key,$key); |
| 291 | &jb (&label("loop")); | 877 | &jb (&label("loop")); |
| 292 | } | 878 | } |
| 293 | else { | 879 | else { |
| @@ -296,15 +882,15 @@ sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } } | |||
| 296 | &cmp ($acc,12); | 882 | &cmp ($acc,12); |
| 297 | &jle (&label("12rounds")); | 883 | &jle (&label("12rounds")); |
| 298 | 884 | ||
| 299 | &set_label("14rounds"); | 885 | &set_label("14rounds",4); |
| 300 | for ($i=1;$i<3;$i++) { | 886 | for ($i=1;$i<3;$i++) { |
| 301 | if ($vertical_spin) { | 887 | if ($vertical_spin) { |
| 302 | &encvert("ebp",$s0,$s1,$s2,$s3); | 888 | &encvert($tbl,$s0,$s1,$s2,$s3); |
| 303 | } else { | 889 | } else { |
| 304 | &encstep(0,"ebp",$s0,$s1,$s2,$s3); | 890 | &encstep(0,$tbl,$s0,$s1,$s2,$s3); |
| 305 | &encstep(1,"ebp",$s1,$s2,$s3,$s0); | 891 | &encstep(1,$tbl,$s1,$s2,$s3,$s0); |
| 306 | &encstep(2,"ebp",$s2,$s3,$s0,$s1); | 892 | &encstep(2,$tbl,$s2,$s3,$s0,$s1); |
| 307 | &encstep(3,"ebp",$s3,$s0,$s1,$s2); | 893 | &encstep(3,$tbl,$s3,$s0,$s1,$s2); |
| 308 | } | 894 | } |
| 309 | &xor ($s0,&DWP(16*$i+0,$key)); | 895 | &xor ($s0,&DWP(16*$i+0,$key)); |
| 310 | &xor ($s1,&DWP(16*$i+4,$key)); | 896 | &xor ($s1,&DWP(16*$i+4,$key)); |
| @@ -312,16 +898,16 @@ sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } } | |||
| 312 | &xor ($s3,&DWP(16*$i+12,$key)); | 898 | &xor ($s3,&DWP(16*$i+12,$key)); |
| 313 | } | 899 | } |
| 314 | &add ($key,32); | 900 | &add ($key,32); |
| 315 | &mov (&DWP(12,"esp"),$key); # advance rd_key | 901 | &mov ($__key,$key); # advance rd_key |
| 316 | &set_label("12rounds"); | 902 | &set_label("12rounds",4); |
| 317 | for ($i=1;$i<3;$i++) { | 903 | for ($i=1;$i<3;$i++) { |
| 318 | if ($vertical_spin) { | 904 | if ($vertical_spin) { |
| 319 | &encvert("ebp",$s0,$s1,$s2,$s3); | 905 | &encvert($tbl,$s0,$s1,$s2,$s3); |
| 320 | } else { | 906 | } else { |
| 321 | &encstep(0,"ebp",$s0,$s1,$s2,$s3); | 907 | &encstep(0,$tbl,$s0,$s1,$s2,$s3); |
| 322 | &encstep(1,"ebp",$s1,$s2,$s3,$s0); | 908 | &encstep(1,$tbl,$s1,$s2,$s3,$s0); |
| 323 | &encstep(2,"ebp",$s2,$s3,$s0,$s1); | 909 | &encstep(2,$tbl,$s2,$s3,$s0,$s1); |
| 324 | &encstep(3,"ebp",$s3,$s0,$s1,$s2); | 910 | &encstep(3,$tbl,$s3,$s0,$s1,$s2); |
| 325 | } | 911 | } |
| 326 | &xor ($s0,&DWP(16*$i+0,$key)); | 912 | &xor ($s0,&DWP(16*$i+0,$key)); |
| 327 | &xor ($s1,&DWP(16*$i+4,$key)); | 913 | &xor ($s1,&DWP(16*$i+4,$key)); |
| @@ -329,16 +915,16 @@ sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } } | |||
| 329 | &xor ($s3,&DWP(16*$i+12,$key)); | 915 | &xor ($s3,&DWP(16*$i+12,$key)); |
| 330 | } | 916 | } |
| 331 | &add ($key,32); | 917 | &add ($key,32); |
| 332 | &mov (&DWP(12,"esp"),$key); # advance rd_key | 918 | &mov ($__key,$key); # advance rd_key |
| 333 | &set_label("10rounds"); | 919 | &set_label("10rounds",4); |
| 334 | for ($i=1;$i<10;$i++) { | 920 | for ($i=1;$i<10;$i++) { |
| 335 | if ($vertical_spin) { | 921 | if ($vertical_spin) { |
| 336 | &encvert("ebp",$s0,$s1,$s2,$s3); | 922 | &encvert($tbl,$s0,$s1,$s2,$s3); |
| 337 | } else { | 923 | } else { |
| 338 | &encstep(0,"ebp",$s0,$s1,$s2,$s3); | 924 | &encstep(0,$tbl,$s0,$s1,$s2,$s3); |
| 339 | &encstep(1,"ebp",$s1,$s2,$s3,$s0); | 925 | &encstep(1,$tbl,$s1,$s2,$s3,$s0); |
| 340 | &encstep(2,"ebp",$s2,$s3,$s0,$s1); | 926 | &encstep(2,$tbl,$s2,$s3,$s0,$s1); |
| 341 | &encstep(3,"ebp",$s3,$s0,$s1,$s2); | 927 | &encstep(3,$tbl,$s3,$s0,$s1,$s2); |
| 342 | } | 928 | } |
| 343 | &xor ($s0,&DWP(16*$i+0,$key)); | 929 | &xor ($s0,&DWP(16*$i+0,$key)); |
| 344 | &xor ($s1,&DWP(16*$i+4,$key)); | 930 | &xor ($s1,&DWP(16*$i+4,$key)); |
| @@ -352,10 +938,10 @@ sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } } | |||
| 352 | &mov ($s1="ebx",$key="edi"); | 938 | &mov ($s1="ebx",$key="edi"); |
| 353 | &mov ($s2="ecx",$acc="esi"); | 939 | &mov ($s2="ecx",$acc="esi"); |
| 354 | } | 940 | } |
| 355 | &enclast(0,"ebp",$s0,$s1,$s2,$s3); | 941 | &enclast(0,$tbl,$s0,$s1,$s2,$s3); |
| 356 | &enclast(1,"ebp",$s1,$s2,$s3,$s0); | 942 | &enclast(1,$tbl,$s1,$s2,$s3,$s0); |
| 357 | &enclast(2,"ebp",$s2,$s3,$s0,$s1); | 943 | &enclast(2,$tbl,$s2,$s3,$s0,$s1); |
| 358 | &enclast(3,"ebp",$s3,$s0,$s1,$s2); | 944 | &enclast(3,$tbl,$s3,$s0,$s1,$s2); |
| 359 | 945 | ||
| 360 | &add ($key,$small_footprint?16:160); | 946 | &add ($key,$small_footprint?16:160); |
| 361 | &xor ($s0,&DWP(0,$key)); | 947 | &xor ($s0,&DWP(0,$key)); |
| @@ -430,38 +1016,198 @@ sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } } | |||
| 430 | &_data_word(0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0); | 1016 | &_data_word(0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0); |
| 431 | &_data_word(0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e); | 1017 | &_data_word(0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e); |
| 432 | &_data_word(0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c); | 1018 | &_data_word(0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c); |
| 1019 | |||
| 1020 | #Te4 # four copies of Te4 to choose from to avoid L1 aliasing | ||
| 1021 | &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5); | ||
| 1022 | &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76); | ||
| 1023 | &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0); | ||
| 1024 | &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0); | ||
| 1025 | &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc); | ||
| 1026 | &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15); | ||
| 1027 | &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a); | ||
| 1028 | &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75); | ||
| 1029 | &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0); | ||
| 1030 | &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84); | ||
| 1031 | &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b); | ||
| 1032 | &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf); | ||
| 1033 | &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85); | ||
| 1034 | &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8); | ||
| 1035 | &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5); | ||
| 1036 | &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2); | ||
| 1037 | &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17); | ||
| 1038 | &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73); | ||
| 1039 | &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88); | ||
| 1040 | &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb); | ||
| 1041 | &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c); | ||
| 1042 | &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79); | ||
| 1043 | &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9); | ||
| 1044 | &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08); | ||
| 1045 | &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6); | ||
| 1046 | &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a); | ||
| 1047 | &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e); | ||
| 1048 | &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e); | ||
| 1049 | &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94); | ||
| 1050 | &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf); | ||
| 1051 | &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68); | ||
| 1052 | &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16); | ||
| 1053 | |||
| 1054 | &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5); | ||
| 1055 | &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76); | ||
| 1056 | &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0); | ||
| 1057 | &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0); | ||
| 1058 | &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc); | ||
| 1059 | &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15); | ||
| 1060 | &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a); | ||
| 1061 | &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75); | ||
| 1062 | &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0); | ||
| 1063 | &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84); | ||
| 1064 | &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b); | ||
| 1065 | &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf); | ||
| 1066 | &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85); | ||
| 1067 | &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8); | ||
| 1068 | &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5); | ||
| 1069 | &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2); | ||
| 1070 | &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17); | ||
| 1071 | &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73); | ||
| 1072 | &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88); | ||
| 1073 | &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb); | ||
| 1074 | &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c); | ||
| 1075 | &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79); | ||
| 1076 | &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9); | ||
| 1077 | &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08); | ||
| 1078 | &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6); | ||
| 1079 | &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a); | ||
| 1080 | &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e); | ||
| 1081 | &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e); | ||
| 1082 | &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94); | ||
| 1083 | &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf); | ||
| 1084 | &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68); | ||
| 1085 | &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16); | ||
| 1086 | |||
| 1087 | &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5); | ||
| 1088 | &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76); | ||
| 1089 | &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0); | ||
| 1090 | &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0); | ||
| 1091 | &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc); | ||
| 1092 | &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15); | ||
| 1093 | &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a); | ||
| 1094 | &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75); | ||
| 1095 | &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0); | ||
| 1096 | &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84); | ||
| 1097 | &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b); | ||
| 1098 | &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf); | ||
| 1099 | &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85); | ||
| 1100 | &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8); | ||
| 1101 | &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5); | ||
| 1102 | &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2); | ||
| 1103 | &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17); | ||
| 1104 | &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73); | ||
| 1105 | &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88); | ||
| 1106 | &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb); | ||
| 1107 | &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c); | ||
| 1108 | &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79); | ||
| 1109 | &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9); | ||
| 1110 | &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08); | ||
| 1111 | &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6); | ||
| 1112 | &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a); | ||
| 1113 | &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e); | ||
| 1114 | &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e); | ||
| 1115 | &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94); | ||
| 1116 | &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf); | ||
| 1117 | &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68); | ||
| 1118 | &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16); | ||
| 1119 | |||
| 1120 | &data_byte(0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5); | ||
| 1121 | &data_byte(0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76); | ||
| 1122 | &data_byte(0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0); | ||
| 1123 | &data_byte(0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0); | ||
| 1124 | &data_byte(0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc); | ||
| 1125 | &data_byte(0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15); | ||
| 1126 | &data_byte(0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a); | ||
| 1127 | &data_byte(0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75); | ||
| 1128 | &data_byte(0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0); | ||
| 1129 | &data_byte(0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84); | ||
| 1130 | &data_byte(0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b); | ||
| 1131 | &data_byte(0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf); | ||
| 1132 | &data_byte(0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85); | ||
| 1133 | &data_byte(0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8); | ||
| 1134 | &data_byte(0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5); | ||
| 1135 | &data_byte(0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2); | ||
| 1136 | &data_byte(0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17); | ||
| 1137 | &data_byte(0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73); | ||
| 1138 | &data_byte(0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88); | ||
| 1139 | &data_byte(0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb); | ||
| 1140 | &data_byte(0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c); | ||
| 1141 | &data_byte(0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79); | ||
| 1142 | &data_byte(0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9); | ||
| 1143 | &data_byte(0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08); | ||
| 1144 | &data_byte(0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6); | ||
| 1145 | &data_byte(0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a); | ||
| 1146 | &data_byte(0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e); | ||
| 1147 | &data_byte(0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e); | ||
| 1148 | &data_byte(0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94); | ||
| 1149 | &data_byte(0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf); | ||
| 1150 | &data_byte(0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68); | ||
| 1151 | &data_byte(0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16); | ||
| 433 | #rcon: | 1152 | #rcon: |
| 434 | &data_word(0x00000001, 0x00000002, 0x00000004, 0x00000008); | 1153 | &data_word(0x00000001, 0x00000002, 0x00000004, 0x00000008); |
| 435 | &data_word(0x00000010, 0x00000020, 0x00000040, 0x00000080); | 1154 | &data_word(0x00000010, 0x00000020, 0x00000040, 0x00000080); |
| 436 | &data_word(0x0000001b, 0x00000036, 0, 0, 0, 0, 0, 0); | 1155 | &data_word(0x0000001b, 0x00000036, 0x00000000, 0x00000000); |
| 1156 | &data_word(0x00000000, 0x00000000, 0x00000000, 0x00000000); | ||
| 437 | &function_end_B("_x86_AES_encrypt"); | 1157 | &function_end_B("_x86_AES_encrypt"); |
| 438 | 1158 | ||
| 439 | # void AES_encrypt (const void *inp,void *out,const AES_KEY *key); | 1159 | # void AES_encrypt (const void *inp,void *out,const AES_KEY *key); |
| 440 | &public_label("AES_Te"); | ||
| 441 | &function_begin("AES_encrypt"); | 1160 | &function_begin("AES_encrypt"); |
| 442 | &mov ($acc,&wparam(0)); # load inp | 1161 | &mov ($acc,&wparam(0)); # load inp |
| 443 | &mov ($key,&wparam(2)); # load key | 1162 | &mov ($key,&wparam(2)); # load key |
| 444 | 1163 | ||
| 445 | &mov ($s0,"esp"); | 1164 | &mov ($s0,"esp"); |
| 446 | &sub ("esp",24); | 1165 | &sub ("esp",36); |
| 447 | &and ("esp",-64); | 1166 | &and ("esp",-64); # align to cache-line |
| 448 | &add ("esp",4); | 1167 | |
| 449 | &mov (&DWP(16,"esp"),$s0); | 1168 | # place stack frame just "above" the key schedule |
| 1169 | &lea ($s1,&DWP(-64-63,$key)); | ||
| 1170 | &sub ($s1,"esp"); | ||
| 1171 | &neg ($s1); | ||
| 1172 | &and ($s1,0x3C0); # modulo 1024, but aligned to cache-line | ||
| 1173 | &sub ("esp",$s1); | ||
| 1174 | &add ("esp",4); # 4 is reserved for caller's return address | ||
| 1175 | &mov ($_esp,$s0); # save stack pointer | ||
| 450 | 1176 | ||
| 451 | &call (&label("pic_point")); # make it PIC! | 1177 | &call (&label("pic_point")); # make it PIC! |
| 452 | &set_label("pic_point"); | 1178 | &set_label("pic_point"); |
| 453 | &blindpop("ebp"); | 1179 | &blindpop($tbl); |
| 454 | &lea ("ebp",&DWP(&label("AES_Te")."-".&label("pic_point"),"ebp")); | 1180 | &picmeup($s0,"OPENSSL_ia32cap_P",$tbl,&label("pic_point")) if (!$x86only); |
| 455 | 1181 | &lea ($tbl,&DWP(&label("AES_Te")."-".&label("pic_point"),$tbl)); | |
| 1182 | |||
| 1183 | # pick Te4 copy which can't "overlap" with stack frame or key schedule | ||
| 1184 | &lea ($s1,&DWP(768-4,"esp")); | ||
| 1185 | &sub ($s1,$tbl); | ||
| 1186 | &and ($s1,0x300); | ||
| 1187 | &lea ($tbl,&DWP(2048+128,$tbl,$s1)); | ||
| 1188 | |||
| 1189 | if (!$x86only) { | ||
| 1190 | &bt (&DWP(0,$s0),25); # check for SSE bit | ||
| 1191 | &jnc (&label("x86")); | ||
| 1192 | |||
| 1193 | &movq ("mm0",&QWP(0,$acc)); | ||
| 1194 | &movq ("mm4",&QWP(8,$acc)); | ||
| 1195 | &call ("_sse_AES_encrypt_compact"); | ||
| 1196 | &mov ("esp",$_esp); # restore stack pointer | ||
| 1197 | &mov ($acc,&wparam(1)); # load out | ||
| 1198 | &movq (&QWP(0,$acc),"mm0"); # write output data | ||
| 1199 | &movq (&QWP(8,$acc),"mm4"); | ||
| 1200 | &emms (); | ||
| 1201 | &function_end_A(); | ||
| 1202 | } | ||
| 1203 | &set_label("x86",16); | ||
| 1204 | &mov ($_tbl,$tbl); | ||
| 456 | &mov ($s0,&DWP(0,$acc)); # load input data | 1205 | &mov ($s0,&DWP(0,$acc)); # load input data |
| 457 | &mov ($s1,&DWP(4,$acc)); | 1206 | &mov ($s1,&DWP(4,$acc)); |
| 458 | &mov ($s2,&DWP(8,$acc)); | 1207 | &mov ($s2,&DWP(8,$acc)); |
| 459 | &mov ($s3,&DWP(12,$acc)); | 1208 | &mov ($s3,&DWP(12,$acc)); |
| 460 | 1209 | &call ("_x86_AES_encrypt_compact"); | |
| 461 | &call ("_x86_AES_encrypt"); | 1210 | &mov ("esp",$_esp); # restore stack pointer |
| 462 | |||
| 463 | &mov ("esp",&DWP(16,"esp")); | ||
| 464 | |||
| 465 | &mov ($acc,&wparam(1)); # load out | 1211 | &mov ($acc,&wparam(1)); # load out |
| 466 | &mov (&DWP(0,$acc),$s0); # write output data | 1212 | &mov (&DWP(0,$acc),$s0); # write output data |
| 467 | &mov (&DWP(4,$acc),$s1); | 1213 | &mov (&DWP(4,$acc),$s1); |
| @@ -469,7 +1215,370 @@ sub _data_word() { my $i; while(defined($i=shift)) { &data_word($i,$i); } } | |||
| 469 | &mov (&DWP(12,$acc),$s3); | 1215 | &mov (&DWP(12,$acc),$s3); |
| 470 | &function_end("AES_encrypt"); | 1216 | &function_end("AES_encrypt"); |
| 471 | 1217 | ||
| 472 | #------------------------------------------------------------------# | 1218 | #--------------------------------------------------------------------# |
| 1219 | |||
| 1220 | ###################################################################### | ||
| 1221 | # "Compact" block function | ||
| 1222 | ###################################################################### | ||
| 1223 | |||
| 1224 | sub deccompact() | ||
| 1225 | { my $Fn = mov; | ||
| 1226 | while ($#_>5) { pop(@_); $Fn=sub{}; } | ||
| 1227 | my ($i,$td,@s)=@_; | ||
| 1228 | my $tmp = $key; | ||
| 1229 | my $out = $i==3?$s[0]:$acc; | ||
| 1230 | |||
| 1231 | # $Fn is used in first compact round and its purpose is to | ||
| 1232 | # void restoration of some values from stack, so that after | ||
| 1233 | # 4xdeccompact with extra argument $key, $s0 and $s1 values | ||
| 1234 | # are left there... | ||
| 1235 | if($i==3) { &$Fn ($key,$__key); } | ||
| 1236 | else { &mov ($out,$s[0]); } | ||
| 1237 | &and ($out,0xFF); | ||
| 1238 | &movz ($out,&BP(-128,$td,$out,1)); | ||
| 1239 | |||
| 1240 | if ($i==3) { $tmp=$s[1]; } | ||
| 1241 | &movz ($tmp,&HB($s[1])); | ||
| 1242 | &movz ($tmp,&BP(-128,$td,$tmp,1)); | ||
| 1243 | &shl ($tmp,8); | ||
| 1244 | &xor ($out,$tmp); | ||
| 1245 | |||
| 1246 | if ($i==3) { $tmp=$s[2]; &mov ($s[1],$acc); } | ||
| 1247 | else { mov ($tmp,$s[2]); } | ||
| 1248 | &shr ($tmp,16); | ||
| 1249 | &and ($tmp,0xFF); | ||
| 1250 | &movz ($tmp,&BP(-128,$td,$tmp,1)); | ||
| 1251 | &shl ($tmp,16); | ||
| 1252 | &xor ($out,$tmp); | ||
| 1253 | |||
| 1254 | if ($i==3) { $tmp=$s[3]; &$Fn ($s[2],$__s1); } | ||
| 1255 | else { &mov ($tmp,$s[3]); } | ||
| 1256 | &shr ($tmp,24); | ||
| 1257 | &movz ($tmp,&BP(-128,$td,$tmp,1)); | ||
| 1258 | &shl ($tmp,24); | ||
| 1259 | &xor ($out,$tmp); | ||
| 1260 | if ($i<2) { &mov (&DWP(4+4*$i,"esp"),$out); } | ||
| 1261 | if ($i==3) { &$Fn ($s[3],$__s0); } | ||
| 1262 | } | ||
| 1263 | |||
| 1264 | # must be called with 2,3,0,1 as argument sequence!!! | ||
| 1265 | sub dectransform() | ||
| 1266 | { my @s = ($s0,$s1,$s2,$s3); | ||
| 1267 | my $i = shift; | ||
| 1268 | my $tmp = $key; | ||
| 1269 | my $tp2 = @s[($i+2)%4]; $tp2 = @s[2] if ($i==1); | ||
| 1270 | my $tp4 = @s[($i+3)%4]; $tp4 = @s[3] if ($i==1); | ||
| 1271 | my $tp8 = $tbl; | ||
| 1272 | |||
| 1273 | &mov ($acc,$s[$i]); | ||
| 1274 | &and ($acc,0x80808080); | ||
| 1275 | &mov ($tmp,$acc); | ||
| 1276 | &shr ($tmp,7); | ||
| 1277 | &lea ($tp2,&DWP(0,$s[$i],$s[$i])); | ||
| 1278 | &sub ($acc,$tmp); | ||
| 1279 | &and ($tp2,0xfefefefe); | ||
| 1280 | &and ($acc,0x1b1b1b1b); | ||
| 1281 | &xor ($acc,$tp2); | ||
| 1282 | &mov ($tp2,$acc); | ||
| 1283 | |||
| 1284 | &and ($acc,0x80808080); | ||
| 1285 | &mov ($tmp,$acc); | ||
| 1286 | &shr ($tmp,7); | ||
| 1287 | &lea ($tp4,&DWP(0,$tp2,$tp2)); | ||
| 1288 | &sub ($acc,$tmp); | ||
| 1289 | &and ($tp4,0xfefefefe); | ||
| 1290 | &and ($acc,0x1b1b1b1b); | ||
| 1291 | &xor ($tp2,$s[$i]); # tp2^tp1 | ||
| 1292 | &xor ($acc,$tp4); | ||
| 1293 | &mov ($tp4,$acc); | ||
| 1294 | |||
| 1295 | &and ($acc,0x80808080); | ||
| 1296 | &mov ($tmp,$acc); | ||
| 1297 | &shr ($tmp,7); | ||
| 1298 | &lea ($tp8,&DWP(0,$tp4,$tp4)); | ||
| 1299 | &sub ($acc,$tmp); | ||
| 1300 | &and ($tp8,0xfefefefe); | ||
| 1301 | &and ($acc,0x1b1b1b1b); | ||
| 1302 | &xor ($tp4,$s[$i]); # tp4^tp1 | ||
| 1303 | &rotl ($s[$i],8); # = ROTATE(tp1,8) | ||
| 1304 | &xor ($tp8,$acc); | ||
| 1305 | |||
| 1306 | &xor ($s[$i],$tp2); | ||
| 1307 | &xor ($tp2,$tp8); | ||
| 1308 | &rotl ($tp2,24); | ||
| 1309 | &xor ($s[$i],$tp4); | ||
| 1310 | &xor ($tp4,$tp8); | ||
| 1311 | &rotl ($tp4,16); | ||
| 1312 | &xor ($s[$i],$tp8); # ^= tp8^(tp4^tp1)^(tp2^tp1) | ||
| 1313 | &rotl ($tp8,8); | ||
| 1314 | &xor ($s[$i],$tp2); # ^= ROTATE(tp8^tp2^tp1,24) | ||
| 1315 | &xor ($s[$i],$tp4); # ^= ROTATE(tp8^tp4^tp1,16) | ||
| 1316 | &mov ($s[0],$__s0) if($i==2); #prefetch $s0 | ||
| 1317 | &mov ($s[1],$__s1) if($i==3); #prefetch $s1 | ||
| 1318 | &mov ($s[2],$__s2) if($i==1); | ||
| 1319 | &xor ($s[$i],$tp8); # ^= ROTATE(tp8,8) | ||
| 1320 | |||
| 1321 | &mov ($s[3],$__s3) if($i==1); | ||
| 1322 | &mov (&DWP(4+4*$i,"esp"),$s[$i]) if($i>=2); | ||
| 1323 | } | ||
| 1324 | |||
| 1325 | &function_begin_B("_x86_AES_decrypt_compact"); | ||
| 1326 | # note that caller is expected to allocate stack frame for me! | ||
| 1327 | &mov ($__key,$key); # save key | ||
| 1328 | |||
| 1329 | &xor ($s0,&DWP(0,$key)); # xor with key | ||
| 1330 | &xor ($s1,&DWP(4,$key)); | ||
| 1331 | &xor ($s2,&DWP(8,$key)); | ||
| 1332 | &xor ($s3,&DWP(12,$key)); | ||
| 1333 | |||
| 1334 | &mov ($acc,&DWP(240,$key)); # load key->rounds | ||
| 1335 | |||
| 1336 | &lea ($acc,&DWP(-2,$acc,$acc)); | ||
| 1337 | &lea ($acc,&DWP(0,$key,$acc,8)); | ||
| 1338 | &mov ($__end,$acc); # end of key schedule | ||
| 1339 | |||
| 1340 | # prefetch Td4 | ||
| 1341 | &mov ($key,&DWP(0-128,$tbl)); | ||
| 1342 | &mov ($acc,&DWP(32-128,$tbl)); | ||
| 1343 | &mov ($key,&DWP(64-128,$tbl)); | ||
| 1344 | &mov ($acc,&DWP(96-128,$tbl)); | ||
| 1345 | &mov ($key,&DWP(128-128,$tbl)); | ||
| 1346 | &mov ($acc,&DWP(160-128,$tbl)); | ||
| 1347 | &mov ($key,&DWP(192-128,$tbl)); | ||
| 1348 | &mov ($acc,&DWP(224-128,$tbl)); | ||
| 1349 | |||
| 1350 | &set_label("loop",16); | ||
| 1351 | |||
| 1352 | &deccompact(0,$tbl,$s0,$s3,$s2,$s1,1); | ||
| 1353 | &deccompact(1,$tbl,$s1,$s0,$s3,$s2,1); | ||
| 1354 | &deccompact(2,$tbl,$s2,$s1,$s0,$s3,1); | ||
| 1355 | &deccompact(3,$tbl,$s3,$s2,$s1,$s0,1); | ||
| 1356 | &dectransform(2); | ||
| 1357 | &dectransform(3); | ||
| 1358 | &dectransform(0); | ||
| 1359 | &dectransform(1); | ||
| 1360 | &mov ($key,$__key); | ||
| 1361 | &mov ($tbl,$__tbl); | ||
| 1362 | &add ($key,16); # advance rd_key | ||
| 1363 | &xor ($s0,&DWP(0,$key)); | ||
| 1364 | &xor ($s1,&DWP(4,$key)); | ||
| 1365 | &xor ($s2,&DWP(8,$key)); | ||
| 1366 | &xor ($s3,&DWP(12,$key)); | ||
| 1367 | |||
| 1368 | &cmp ($key,$__end); | ||
| 1369 | &mov ($__key,$key); | ||
| 1370 | &jb (&label("loop")); | ||
| 1371 | |||
| 1372 | &deccompact(0,$tbl,$s0,$s3,$s2,$s1); | ||
| 1373 | &deccompact(1,$tbl,$s1,$s0,$s3,$s2); | ||
| 1374 | &deccompact(2,$tbl,$s2,$s1,$s0,$s3); | ||
| 1375 | &deccompact(3,$tbl,$s3,$s2,$s1,$s0); | ||
| 1376 | |||
| 1377 | &xor ($s0,&DWP(16,$key)); | ||
| 1378 | &xor ($s1,&DWP(20,$key)); | ||
| 1379 | &xor ($s2,&DWP(24,$key)); | ||
| 1380 | &xor ($s3,&DWP(28,$key)); | ||
| 1381 | |||
| 1382 | &ret (); | ||
| 1383 | &function_end_B("_x86_AES_decrypt_compact"); | ||
| 1384 | |||
| 1385 | ###################################################################### | ||
| 1386 | # "Compact" SSE block function. | ||
| 1387 | ###################################################################### | ||
| 1388 | |||
| 1389 | sub sse_deccompact() | ||
| 1390 | { | ||
| 1391 | &pshufw ("mm1","mm0",0x0c); # 7, 6, 1, 0 | ||
| 1392 | &movd ("eax","mm1"); # 7, 6, 1, 0 | ||
| 1393 | |||
| 1394 | &pshufw ("mm5","mm4",0x09); # 13,12,11,10 | ||
| 1395 | &movz ($acc,&LB("eax")); # 0 | ||
| 1396 | &movz ("ecx",&BP(-128,$tbl,$acc,1)); # 0 | ||
| 1397 | &movd ("ebx","mm5"); # 13,12,11,10 | ||
| 1398 | &movz ("edx",&HB("eax")); # 1 | ||
| 1399 | &movz ("edx",&BP(-128,$tbl,"edx",1)); # 1 | ||
| 1400 | &shl ("edx",8); # 1 | ||
| 1401 | |||
| 1402 | &pshufw ("mm2","mm0",0x06); # 3, 2, 5, 4 | ||
| 1403 | &movz ($acc,&LB("ebx")); # 10 | ||
| 1404 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 10 | ||
| 1405 | &shl ($acc,16); # 10 | ||
| 1406 | &or ("ecx",$acc); # 10 | ||
| 1407 | &shr ("eax",16); # 7, 6 | ||
| 1408 | &movz ($acc,&HB("ebx")); # 11 | ||
| 1409 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 11 | ||
| 1410 | &shl ($acc,24); # 11 | ||
| 1411 | &or ("edx",$acc); # 11 | ||
| 1412 | &shr ("ebx",16); # 13,12 | ||
| 1413 | |||
| 1414 | &pshufw ("mm6","mm4",0x03); # 9, 8,15,14 | ||
| 1415 | &movz ($acc,&HB("eax")); # 7 | ||
| 1416 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 7 | ||
| 1417 | &shl ($acc,24); # 7 | ||
| 1418 | &or ("ecx",$acc); # 7 | ||
| 1419 | &movz ($acc,&HB("ebx")); # 13 | ||
| 1420 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 13 | ||
| 1421 | &shl ($acc,8); # 13 | ||
| 1422 | &or ("ecx",$acc); # 13 | ||
| 1423 | &movd ("mm0","ecx"); # t[0] collected | ||
| 1424 | |||
| 1425 | &movz ($acc,&LB("eax")); # 6 | ||
| 1426 | &movd ("eax","mm2"); # 3, 2, 5, 4 | ||
| 1427 | &movz ("ecx",&BP(-128,$tbl,$acc,1)); # 6 | ||
| 1428 | &shl ("ecx",16); # 6 | ||
| 1429 | &movz ($acc,&LB("ebx")); # 12 | ||
| 1430 | &movd ("ebx","mm6"); # 9, 8,15,14 | ||
| 1431 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 12 | ||
| 1432 | &or ("ecx",$acc); # 12 | ||
| 1433 | |||
| 1434 | &movz ($acc,&LB("eax")); # 4 | ||
| 1435 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 4 | ||
| 1436 | &or ("edx",$acc); # 4 | ||
| 1437 | &movz ($acc,&LB("ebx")); # 14 | ||
| 1438 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 14 | ||
| 1439 | &shl ($acc,16); # 14 | ||
| 1440 | &or ("edx",$acc); # 14 | ||
| 1441 | &movd ("mm1","edx"); # t[1] collected | ||
| 1442 | |||
| 1443 | &movz ($acc,&HB("eax")); # 5 | ||
| 1444 | &movz ("edx",&BP(-128,$tbl,$acc,1)); # 5 | ||
| 1445 | &shl ("edx",8); # 5 | ||
| 1446 | &movz ($acc,&HB("ebx")); # 15 | ||
| 1447 | &shr ("eax",16); # 3, 2 | ||
| 1448 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 15 | ||
| 1449 | &shl ($acc,24); # 15 | ||
| 1450 | &or ("edx",$acc); # 15 | ||
| 1451 | &shr ("ebx",16); # 9, 8 | ||
| 1452 | |||
| 1453 | &punpckldq ("mm0","mm1"); # t[0,1] collected | ||
| 1454 | |||
| 1455 | &movz ($acc,&HB("ebx")); # 9 | ||
| 1456 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 9 | ||
| 1457 | &shl ($acc,8); # 9 | ||
| 1458 | &or ("ecx",$acc); # 9 | ||
| 1459 | &and ("ebx",0xff); # 8 | ||
| 1460 | &movz ("ebx",&BP(-128,$tbl,"ebx",1)); # 8 | ||
| 1461 | &or ("edx","ebx"); # 8 | ||
| 1462 | &movz ($acc,&LB("eax")); # 2 | ||
| 1463 | &movz ($acc,&BP(-128,$tbl,$acc,1)); # 2 | ||
| 1464 | &shl ($acc,16); # 2 | ||
| 1465 | &or ("edx",$acc); # 2 | ||
| 1466 | &movd ("mm4","edx"); # t[2] collected | ||
| 1467 | &movz ("eax",&HB("eax")); # 3 | ||
| 1468 | &movz ("eax",&BP(-128,$tbl,"eax",1)); # 3 | ||
| 1469 | &shl ("eax",24); # 3 | ||
| 1470 | &or ("ecx","eax"); # 3 | ||
| 1471 | &movd ("mm5","ecx"); # t[3] collected | ||
| 1472 | |||
| 1473 | &punpckldq ("mm4","mm5"); # t[2,3] collected | ||
| 1474 | } | ||
| 1475 | |||
| 1476 | if (!$x86only) { | ||
| 1477 | &function_begin_B("_sse_AES_decrypt_compact"); | ||
| 1478 | &pxor ("mm0",&QWP(0,$key)); # 7, 6, 5, 4, 3, 2, 1, 0 | ||
| 1479 | &pxor ("mm4",&QWP(8,$key)); # 15,14,13,12,11,10, 9, 8 | ||
| 1480 | |||
| 1481 | # note that caller is expected to allocate stack frame for me! | ||
| 1482 | &mov ($acc,&DWP(240,$key)); # load key->rounds | ||
| 1483 | &lea ($acc,&DWP(-2,$acc,$acc)); | ||
| 1484 | &lea ($acc,&DWP(0,$key,$acc,8)); | ||
| 1485 | &mov ($__end,$acc); # end of key schedule | ||
| 1486 | |||
| 1487 | &mov ($s0,0x1b1b1b1b); # magic constant | ||
| 1488 | &mov (&DWP(8,"esp"),$s0); | ||
| 1489 | &mov (&DWP(12,"esp"),$s0); | ||
| 1490 | |||
| 1491 | # prefetch Td4 | ||
| 1492 | &mov ($s0,&DWP(0-128,$tbl)); | ||
| 1493 | &mov ($s1,&DWP(32-128,$tbl)); | ||
| 1494 | &mov ($s2,&DWP(64-128,$tbl)); | ||
| 1495 | &mov ($s3,&DWP(96-128,$tbl)); | ||
| 1496 | &mov ($s0,&DWP(128-128,$tbl)); | ||
| 1497 | &mov ($s1,&DWP(160-128,$tbl)); | ||
| 1498 | &mov ($s2,&DWP(192-128,$tbl)); | ||
| 1499 | &mov ($s3,&DWP(224-128,$tbl)); | ||
| 1500 | |||
| 1501 | &set_label("loop",16); | ||
| 1502 | &sse_deccompact(); | ||
| 1503 | &add ($key,16); | ||
| 1504 | &cmp ($key,$__end); | ||
| 1505 | &ja (&label("out")); | ||
| 1506 | |||
| 1507 | # ROTATE(x^y,N) == ROTATE(x,N)^ROTATE(y,N) | ||
| 1508 | &movq ("mm3","mm0"); &movq ("mm7","mm4"); | ||
| 1509 | &movq ("mm2","mm0",1); &movq ("mm6","mm4",1); | ||
| 1510 | &movq ("mm1","mm0"); &movq ("mm5","mm4"); | ||
| 1511 | &pshufw ("mm0","mm0",0xb1); &pshufw ("mm4","mm4",0xb1);# = ROTATE(tp0,16) | ||
| 1512 | &pslld ("mm2",8); &pslld ("mm6",8); | ||
| 1513 | &psrld ("mm3",8); &psrld ("mm7",8); | ||
| 1514 | &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^= tp0<<8 | ||
| 1515 | &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^= tp0>>8 | ||
| 1516 | &pslld ("mm2",16); &pslld ("mm6",16); | ||
| 1517 | &psrld ("mm3",16); &psrld ("mm7",16); | ||
| 1518 | &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^= tp0<<24 | ||
| 1519 | &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^= tp0>>24 | ||
| 1520 | |||
| 1521 | &movq ("mm3",&QWP(8,"esp")); | ||
| 1522 | &pxor ("mm2","mm2"); &pxor ("mm6","mm6"); | ||
| 1523 | &pcmpgtb("mm2","mm1"); &pcmpgtb("mm6","mm5"); | ||
| 1524 | &pand ("mm2","mm3"); &pand ("mm6","mm3"); | ||
| 1525 | &paddb ("mm1","mm1"); &paddb ("mm5","mm5"); | ||
| 1526 | &pxor ("mm1","mm2"); &pxor ("mm5","mm6"); # tp2 | ||
| 1527 | &movq ("mm3","mm1"); &movq ("mm7","mm5"); | ||
| 1528 | &movq ("mm2","mm1"); &movq ("mm6","mm5"); | ||
| 1529 | &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^= tp2 | ||
| 1530 | &pslld ("mm3",24); &pslld ("mm7",24); | ||
| 1531 | &psrld ("mm2",8); &psrld ("mm6",8); | ||
| 1532 | &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^= tp2<<24 | ||
| 1533 | &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^= tp2>>8 | ||
| 1534 | |||
| 1535 | &movq ("mm2",&QWP(8,"esp")); | ||
| 1536 | &pxor ("mm3","mm3"); &pxor ("mm7","mm7"); | ||
| 1537 | &pcmpgtb("mm3","mm1"); &pcmpgtb("mm7","mm5"); | ||
| 1538 | &pand ("mm3","mm2"); &pand ("mm7","mm2"); | ||
| 1539 | &paddb ("mm1","mm1"); &paddb ("mm5","mm5"); | ||
| 1540 | &pxor ("mm1","mm3"); &pxor ("mm5","mm7"); # tp4 | ||
| 1541 | &pshufw ("mm3","mm1",0xb1); &pshufw ("mm7","mm5",0xb1); | ||
| 1542 | &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^= tp4 | ||
| 1543 | &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^= ROTATE(tp4,16) | ||
| 1544 | |||
| 1545 | &pxor ("mm3","mm3"); &pxor ("mm7","mm7"); | ||
| 1546 | &pcmpgtb("mm3","mm1"); &pcmpgtb("mm7","mm5"); | ||
| 1547 | &pand ("mm3","mm2"); &pand ("mm7","mm2"); | ||
| 1548 | &paddb ("mm1","mm1"); &paddb ("mm5","mm5"); | ||
| 1549 | &pxor ("mm1","mm3"); &pxor ("mm5","mm7"); # tp8 | ||
| 1550 | &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^= tp8 | ||
| 1551 | &movq ("mm3","mm1"); &movq ("mm7","mm5"); | ||
| 1552 | &pshufw ("mm2","mm1",0xb1); &pshufw ("mm6","mm5",0xb1); | ||
| 1553 | &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); # ^= ROTATE(tp8,16) | ||
| 1554 | &pslld ("mm1",8); &pslld ("mm5",8); | ||
| 1555 | &psrld ("mm3",8); &psrld ("mm7",8); | ||
| 1556 | &movq ("mm2",&QWP(0,$key)); &movq ("mm6",&QWP(8,$key)); | ||
| 1557 | &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^= tp8<<8 | ||
| 1558 | &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^= tp8>>8 | ||
| 1559 | &mov ($s0,&DWP(0-128,$tbl)); | ||
| 1560 | &pslld ("mm1",16); &pslld ("mm5",16); | ||
| 1561 | &mov ($s1,&DWP(64-128,$tbl)); | ||
| 1562 | &psrld ("mm3",16); &psrld ("mm7",16); | ||
| 1563 | &mov ($s2,&DWP(128-128,$tbl)); | ||
| 1564 | &pxor ("mm0","mm1"); &pxor ("mm4","mm5"); # ^= tp8<<24 | ||
| 1565 | &mov ($s3,&DWP(192-128,$tbl)); | ||
| 1566 | &pxor ("mm0","mm3"); &pxor ("mm4","mm7"); # ^= tp8>>24 | ||
| 1567 | |||
| 1568 | &pxor ("mm0","mm2"); &pxor ("mm4","mm6"); | ||
| 1569 | &jmp (&label("loop")); | ||
| 1570 | |||
| 1571 | &set_label("out",16); | ||
| 1572 | &pxor ("mm0",&QWP(0,$key)); | ||
| 1573 | &pxor ("mm4",&QWP(8,$key)); | ||
| 1574 | |||
| 1575 | &ret (); | ||
| 1576 | &function_end_B("_sse_AES_decrypt_compact"); | ||
| 1577 | } | ||
| 1578 | |||
| 1579 | ###################################################################### | ||
| 1580 | # Vanilla block function. | ||
| 1581 | ###################################################################### | ||
| 473 | 1582 | ||
| 474 | sub decstep() | 1583 | sub decstep() |
| 475 | { my ($i,$td,@s) = @_; | 1584 | { my ($i,$td,@s) = @_; |
| @@ -480,7 +1589,7 @@ sub decstep() | |||
| 480 | # optimal... or rather that all attempts to reorder didn't | 1589 | # optimal... or rather that all attempts to reorder didn't |
| 481 | # result in better performance [which by the way is not a | 1590 | # result in better performance [which by the way is not a |
| 482 | # bit lower than ecryption]. | 1591 | # bit lower than ecryption]. |
| 483 | if($i==3) { &mov ($key,&DWP(12,"esp")); } | 1592 | if($i==3) { &mov ($key,$__key); } |
| 484 | else { &mov ($out,$s[0]); } | 1593 | else { &mov ($out,$s[0]); } |
| 485 | &and ($out,0xFF); | 1594 | &and ($out,0xFF); |
| 486 | &mov ($out,&DWP(0,$td,$out,8)); | 1595 | &mov ($out,&DWP(0,$td,$out,8)); |
| @@ -495,12 +1604,12 @@ sub decstep() | |||
| 495 | &and ($tmp,0xFF); | 1604 | &and ($tmp,0xFF); |
| 496 | &xor ($out,&DWP(2,$td,$tmp,8)); | 1605 | &xor ($out,&DWP(2,$td,$tmp,8)); |
| 497 | 1606 | ||
| 498 | if ($i==3) { $tmp=$s[3]; &mov ($s[2],&DWP(8,"esp")); } | 1607 | if ($i==3) { $tmp=$s[3]; &mov ($s[2],$__s1); } |
| 499 | else { &mov ($tmp,$s[3]); } | 1608 | else { &mov ($tmp,$s[3]); } |
| 500 | &shr ($tmp,24); | 1609 | &shr ($tmp,24); |
| 501 | &xor ($out,&DWP(1,$td,$tmp,8)); | 1610 | &xor ($out,&DWP(1,$td,$tmp,8)); |
| 502 | if ($i<2) { &mov (&DWP(4+4*$i,"esp"),$out); } | 1611 | if ($i<2) { &mov (&DWP(4+4*$i,"esp"),$out); } |
| 503 | if ($i==3) { &mov ($s[3],&DWP(4,"esp")); } | 1612 | if ($i==3) { &mov ($s[3],$__s0); } |
| 504 | &comment(); | 1613 | &comment(); |
| 505 | } | 1614 | } |
| 506 | 1615 | ||
| @@ -509,14 +1618,24 @@ sub declast() | |||
| 509 | my $tmp = $key; | 1618 | my $tmp = $key; |
| 510 | my $out = $i==3?$s[0]:$acc; | 1619 | my $out = $i==3?$s[0]:$acc; |
| 511 | 1620 | ||
| 512 | if($i==3) { &mov ($key,&DWP(12,"esp")); } | 1621 | if($i==0) { &lea ($td,&DWP(2048+128,$td)); |
| 1622 | &mov ($tmp,&DWP(0-128,$td)); | ||
| 1623 | &mov ($acc,&DWP(32-128,$td)); | ||
| 1624 | &mov ($tmp,&DWP(64-128,$td)); | ||
| 1625 | &mov ($acc,&DWP(96-128,$td)); | ||
| 1626 | &mov ($tmp,&DWP(128-128,$td)); | ||
| 1627 | &mov ($acc,&DWP(160-128,$td)); | ||
| 1628 | &mov ($tmp,&DWP(192-128,$td)); | ||
| 1629 | &mov ($acc,&DWP(224-128,$td)); | ||
| 1630 | &lea ($td,&DWP(-128,$td)); } | ||
| 1631 | if($i==3) { &mov ($key,$__key); } | ||
| 513 | else { &mov ($out,$s[0]); } | 1632 | else { &mov ($out,$s[0]); } |
| 514 | &and ($out,0xFF); | 1633 | &and ($out,0xFF); |
| 515 | &movz ($out,&BP(2048,$td,$out,1)); | 1634 | &movz ($out,&BP(0,$td,$out,1)); |
| 516 | 1635 | ||
| 517 | if ($i==3) { $tmp=$s[1]; } | 1636 | if ($i==3) { $tmp=$s[1]; } |
| 518 | &movz ($tmp,&HB($s[1])); | 1637 | &movz ($tmp,&HB($s[1])); |
| 519 | &movz ($tmp,&BP(2048,$td,$tmp,1)); | 1638 | &movz ($tmp,&BP(0,$td,$tmp,1)); |
| 520 | &shl ($tmp,8); | 1639 | &shl ($tmp,8); |
| 521 | &xor ($out,$tmp); | 1640 | &xor ($out,$tmp); |
| 522 | 1641 | ||
| @@ -524,24 +1643,24 @@ sub declast() | |||
| 524 | else { mov ($tmp,$s[2]); } | 1643 | else { mov ($tmp,$s[2]); } |
| 525 | &shr ($tmp,16); | 1644 | &shr ($tmp,16); |
| 526 | &and ($tmp,0xFF); | 1645 | &and ($tmp,0xFF); |
| 527 | &movz ($tmp,&BP(2048,$td,$tmp,1)); | 1646 | &movz ($tmp,&BP(0,$td,$tmp,1)); |
| 528 | &shl ($tmp,16); | 1647 | &shl ($tmp,16); |
| 529 | &xor ($out,$tmp); | 1648 | &xor ($out,$tmp); |
| 530 | 1649 | ||
| 531 | if ($i==3) { $tmp=$s[3]; &mov ($s[2],&DWP(8,"esp")); } | 1650 | if ($i==3) { $tmp=$s[3]; &mov ($s[2],$__s1); } |
| 532 | else { &mov ($tmp,$s[3]); } | 1651 | else { &mov ($tmp,$s[3]); } |
| 533 | &shr ($tmp,24); | 1652 | &shr ($tmp,24); |
| 534 | &movz ($tmp,&BP(2048,$td,$tmp,1)); | 1653 | &movz ($tmp,&BP(0,$td,$tmp,1)); |
| 535 | &shl ($tmp,24); | 1654 | &shl ($tmp,24); |
| 536 | &xor ($out,$tmp); | 1655 | &xor ($out,$tmp); |
| 537 | if ($i<2) { &mov (&DWP(4+4*$i,"esp"),$out); } | 1656 | if ($i<2) { &mov (&DWP(4+4*$i,"esp"),$out); } |
| 538 | if ($i==3) { &mov ($s[3],&DWP(4,"esp")); } | 1657 | if ($i==3) { &mov ($s[3],$__s0); |
| 1658 | &lea ($td,&DWP(-2048,$td)); } | ||
| 539 | } | 1659 | } |
| 540 | 1660 | ||
| 541 | &public_label("AES_Td"); | 1661 | &function_begin_B("_x86_AES_decrypt"); |
| 542 | &function_begin_C("_x86_AES_decrypt"); | ||
| 543 | # note that caller is expected to allocate stack frame for me! | 1662 | # note that caller is expected to allocate stack frame for me! |
| 544 | &mov (&DWP(12,"esp"),$key); # save key | 1663 | &mov ($__key,$key); # save key |
| 545 | 1664 | ||
| 546 | &xor ($s0,&DWP(0,$key)); # xor with key | 1665 | &xor ($s0,&DWP(0,$key)); # xor with key |
| 547 | &xor ($s1,&DWP(4,$key)); | 1666 | &xor ($s1,&DWP(4,$key)); |
| @@ -553,20 +1672,19 @@ sub declast() | |||
| 553 | if ($small_footprint) { | 1672 | if ($small_footprint) { |
| 554 | &lea ($acc,&DWP(-2,$acc,$acc)); | 1673 | &lea ($acc,&DWP(-2,$acc,$acc)); |
| 555 | &lea ($acc,&DWP(0,$key,$acc,8)); | 1674 | &lea ($acc,&DWP(0,$key,$acc,8)); |
| 556 | &mov (&DWP(16,"esp"),$acc); # end of key schedule | 1675 | &mov ($__end,$acc); # end of key schedule |
| 557 | &align (4); | 1676 | &set_label("loop",16); |
| 558 | &set_label("loop"); | 1677 | &decstep(0,$tbl,$s0,$s3,$s2,$s1); |
| 559 | &decstep(0,"ebp",$s0,$s3,$s2,$s1); | 1678 | &decstep(1,$tbl,$s1,$s0,$s3,$s2); |
| 560 | &decstep(1,"ebp",$s1,$s0,$s3,$s2); | 1679 | &decstep(2,$tbl,$s2,$s1,$s0,$s3); |
| 561 | &decstep(2,"ebp",$s2,$s1,$s0,$s3); | 1680 | &decstep(3,$tbl,$s3,$s2,$s1,$s0); |
| 562 | &decstep(3,"ebp",$s3,$s2,$s1,$s0); | ||
| 563 | &add ($key,16); # advance rd_key | 1681 | &add ($key,16); # advance rd_key |
| 564 | &xor ($s0,&DWP(0,$key)); | 1682 | &xor ($s0,&DWP(0,$key)); |
| 565 | &xor ($s1,&DWP(4,$key)); | 1683 | &xor ($s1,&DWP(4,$key)); |
| 566 | &xor ($s2,&DWP(8,$key)); | 1684 | &xor ($s2,&DWP(8,$key)); |
| 567 | &xor ($s3,&DWP(12,$key)); | 1685 | &xor ($s3,&DWP(12,$key)); |
| 568 | &cmp ($key,&DWP(16,"esp")); | 1686 | &cmp ($key,$__end); |
| 569 | &mov (&DWP(12,"esp"),$key); | 1687 | &mov ($__key,$key); |
| 570 | &jb (&label("loop")); | 1688 | &jb (&label("loop")); |
| 571 | } | 1689 | } |
| 572 | else { | 1690 | else { |
| @@ -575,38 +1693,38 @@ sub declast() | |||
| 575 | &cmp ($acc,12); | 1693 | &cmp ($acc,12); |
| 576 | &jle (&label("12rounds")); | 1694 | &jle (&label("12rounds")); |
| 577 | 1695 | ||
| 578 | &set_label("14rounds"); | 1696 | &set_label("14rounds",4); |
| 579 | for ($i=1;$i<3;$i++) { | 1697 | for ($i=1;$i<3;$i++) { |
| 580 | &decstep(0,"ebp",$s0,$s3,$s2,$s1); | 1698 | &decstep(0,$tbl,$s0,$s3,$s2,$s1); |
| 581 | &decstep(1,"ebp",$s1,$s0,$s3,$s2); | 1699 | &decstep(1,$tbl,$s1,$s0,$s3,$s2); |
| 582 | &decstep(2,"ebp",$s2,$s1,$s0,$s3); | 1700 | &decstep(2,$tbl,$s2,$s1,$s0,$s3); |
| 583 | &decstep(3,"ebp",$s3,$s2,$s1,$s0); | 1701 | &decstep(3,$tbl,$s3,$s2,$s1,$s0); |
| 584 | &xor ($s0,&DWP(16*$i+0,$key)); | 1702 | &xor ($s0,&DWP(16*$i+0,$key)); |
| 585 | &xor ($s1,&DWP(16*$i+4,$key)); | 1703 | &xor ($s1,&DWP(16*$i+4,$key)); |
| 586 | &xor ($s2,&DWP(16*$i+8,$key)); | 1704 | &xor ($s2,&DWP(16*$i+8,$key)); |
| 587 | &xor ($s3,&DWP(16*$i+12,$key)); | 1705 | &xor ($s3,&DWP(16*$i+12,$key)); |
| 588 | } | 1706 | } |
| 589 | &add ($key,32); | 1707 | &add ($key,32); |
| 590 | &mov (&DWP(12,"esp"),$key); # advance rd_key | 1708 | &mov ($__key,$key); # advance rd_key |
| 591 | &set_label("12rounds"); | 1709 | &set_label("12rounds",4); |
| 592 | for ($i=1;$i<3;$i++) { | 1710 | for ($i=1;$i<3;$i++) { |
| 593 | &decstep(0,"ebp",$s0,$s3,$s2,$s1); | 1711 | &decstep(0,$tbl,$s0,$s3,$s2,$s1); |
| 594 | &decstep(1,"ebp",$s1,$s0,$s3,$s2); | 1712 | &decstep(1,$tbl,$s1,$s0,$s3,$s2); |
| 595 | &decstep(2,"ebp",$s2,$s1,$s0,$s3); | 1713 | &decstep(2,$tbl,$s2,$s1,$s0,$s3); |
| 596 | &decstep(3,"ebp",$s3,$s2,$s1,$s0); | 1714 | &decstep(3,$tbl,$s3,$s2,$s1,$s0); |
| 597 | &xor ($s0,&DWP(16*$i+0,$key)); | 1715 | &xor ($s0,&DWP(16*$i+0,$key)); |
| 598 | &xor ($s1,&DWP(16*$i+4,$key)); | 1716 | &xor ($s1,&DWP(16*$i+4,$key)); |
| 599 | &xor ($s2,&DWP(16*$i+8,$key)); | 1717 | &xor ($s2,&DWP(16*$i+8,$key)); |
| 600 | &xor ($s3,&DWP(16*$i+12,$key)); | 1718 | &xor ($s3,&DWP(16*$i+12,$key)); |
| 601 | } | 1719 | } |
| 602 | &add ($key,32); | 1720 | &add ($key,32); |
| 603 | &mov (&DWP(12,"esp"),$key); # advance rd_key | 1721 | &mov ($__key,$key); # advance rd_key |
| 604 | &set_label("10rounds"); | 1722 | &set_label("10rounds",4); |
| 605 | for ($i=1;$i<10;$i++) { | 1723 | for ($i=1;$i<10;$i++) { |
| 606 | &decstep(0,"ebp",$s0,$s3,$s2,$s1); | 1724 | &decstep(0,$tbl,$s0,$s3,$s2,$s1); |
| 607 | &decstep(1,"ebp",$s1,$s0,$s3,$s2); | 1725 | &decstep(1,$tbl,$s1,$s0,$s3,$s2); |
| 608 | &decstep(2,"ebp",$s2,$s1,$s0,$s3); | 1726 | &decstep(2,$tbl,$s2,$s1,$s0,$s3); |
| 609 | &decstep(3,"ebp",$s3,$s2,$s1,$s0); | 1727 | &decstep(3,$tbl,$s3,$s2,$s1,$s0); |
| 610 | &xor ($s0,&DWP(16*$i+0,$key)); | 1728 | &xor ($s0,&DWP(16*$i+0,$key)); |
| 611 | &xor ($s1,&DWP(16*$i+4,$key)); | 1729 | &xor ($s1,&DWP(16*$i+4,$key)); |
| 612 | &xor ($s2,&DWP(16*$i+8,$key)); | 1730 | &xor ($s2,&DWP(16*$i+8,$key)); |
| @@ -614,10 +1732,10 @@ sub declast() | |||
| 614 | } | 1732 | } |
| 615 | } | 1733 | } |
| 616 | 1734 | ||
| 617 | &declast(0,"ebp",$s0,$s3,$s2,$s1); | 1735 | &declast(0,$tbl,$s0,$s3,$s2,$s1); |
| 618 | &declast(1,"ebp",$s1,$s0,$s3,$s2); | 1736 | &declast(1,$tbl,$s1,$s0,$s3,$s2); |
| 619 | &declast(2,"ebp",$s2,$s1,$s0,$s3); | 1737 | &declast(2,$tbl,$s2,$s1,$s0,$s3); |
| 620 | &declast(3,"ebp",$s3,$s2,$s1,$s0); | 1738 | &declast(3,$tbl,$s3,$s2,$s1,$s0); |
| 621 | 1739 | ||
| 622 | &add ($key,$small_footprint?16:160); | 1740 | &add ($key,$small_footprint?16:160); |
| 623 | &xor ($s0,&DWP(0,$key)); | 1741 | &xor ($s0,&DWP(0,$key)); |
| @@ -692,7 +1810,107 @@ sub declast() | |||
| 692 | &_data_word(0x72c31d16, 0x0c25e2bc, 0x8b493c28, 0x41950dff); | 1810 | &_data_word(0x72c31d16, 0x0c25e2bc, 0x8b493c28, 0x41950dff); |
| 693 | &_data_word(0x7101a839, 0xdeb30c08, 0x9ce4b4d8, 0x90c15664); | 1811 | &_data_word(0x7101a839, 0xdeb30c08, 0x9ce4b4d8, 0x90c15664); |
| 694 | &_data_word(0x6184cb7b, 0x70b632d5, 0x745c6c48, 0x4257b8d0); | 1812 | &_data_word(0x6184cb7b, 0x70b632d5, 0x745c6c48, 0x4257b8d0); |
| 695 | #Td4: | 1813 | |
| 1814 | #Td4: # four copies of Td4 to choose from to avoid L1 aliasing | ||
| 1815 | &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38); | ||
| 1816 | &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb); | ||
| 1817 | &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87); | ||
| 1818 | &data_byte(0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb); | ||
| 1819 | &data_byte(0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d); | ||
| 1820 | &data_byte(0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e); | ||
| 1821 | &data_byte(0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2); | ||
| 1822 | &data_byte(0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25); | ||
| 1823 | &data_byte(0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16); | ||
| 1824 | &data_byte(0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92); | ||
| 1825 | &data_byte(0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda); | ||
| 1826 | &data_byte(0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84); | ||
| 1827 | &data_byte(0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a); | ||
| 1828 | &data_byte(0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06); | ||
| 1829 | &data_byte(0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02); | ||
| 1830 | &data_byte(0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b); | ||
| 1831 | &data_byte(0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea); | ||
| 1832 | &data_byte(0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73); | ||
| 1833 | &data_byte(0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85); | ||
| 1834 | &data_byte(0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e); | ||
| 1835 | &data_byte(0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89); | ||
| 1836 | &data_byte(0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b); | ||
| 1837 | &data_byte(0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20); | ||
| 1838 | &data_byte(0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4); | ||
| 1839 | &data_byte(0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31); | ||
| 1840 | &data_byte(0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f); | ||
| 1841 | &data_byte(0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d); | ||
| 1842 | &data_byte(0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef); | ||
| 1843 | &data_byte(0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0); | ||
| 1844 | &data_byte(0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61); | ||
| 1845 | &data_byte(0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26); | ||
| 1846 | &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d); | ||
| 1847 | |||
| 1848 | &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38); | ||
| 1849 | &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb); | ||
| 1850 | &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87); | ||
| 1851 | &data_byte(0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb); | ||
| 1852 | &data_byte(0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d); | ||
| 1853 | &data_byte(0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e); | ||
| 1854 | &data_byte(0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2); | ||
| 1855 | &data_byte(0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25); | ||
| 1856 | &data_byte(0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16); | ||
| 1857 | &data_byte(0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92); | ||
| 1858 | &data_byte(0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda); | ||
| 1859 | &data_byte(0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84); | ||
| 1860 | &data_byte(0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a); | ||
| 1861 | &data_byte(0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06); | ||
| 1862 | &data_byte(0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02); | ||
| 1863 | &data_byte(0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b); | ||
| 1864 | &data_byte(0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea); | ||
| 1865 | &data_byte(0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73); | ||
| 1866 | &data_byte(0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85); | ||
| 1867 | &data_byte(0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e); | ||
| 1868 | &data_byte(0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89); | ||
| 1869 | &data_byte(0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b); | ||
| 1870 | &data_byte(0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20); | ||
| 1871 | &data_byte(0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4); | ||
| 1872 | &data_byte(0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31); | ||
| 1873 | &data_byte(0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f); | ||
| 1874 | &data_byte(0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d); | ||
| 1875 | &data_byte(0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef); | ||
| 1876 | &data_byte(0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0); | ||
| 1877 | &data_byte(0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61); | ||
| 1878 | &data_byte(0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26); | ||
| 1879 | &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d); | ||
| 1880 | |||
| 1881 | &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38); | ||
| 1882 | &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb); | ||
| 1883 | &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87); | ||
| 1884 | &data_byte(0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb); | ||
| 1885 | &data_byte(0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d); | ||
| 1886 | &data_byte(0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e); | ||
| 1887 | &data_byte(0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2); | ||
| 1888 | &data_byte(0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25); | ||
| 1889 | &data_byte(0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16); | ||
| 1890 | &data_byte(0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92); | ||
| 1891 | &data_byte(0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda); | ||
| 1892 | &data_byte(0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84); | ||
| 1893 | &data_byte(0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a); | ||
| 1894 | &data_byte(0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06); | ||
| 1895 | &data_byte(0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02); | ||
| 1896 | &data_byte(0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b); | ||
| 1897 | &data_byte(0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea); | ||
| 1898 | &data_byte(0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73); | ||
| 1899 | &data_byte(0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85); | ||
| 1900 | &data_byte(0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e); | ||
| 1901 | &data_byte(0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89); | ||
| 1902 | &data_byte(0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b); | ||
| 1903 | &data_byte(0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20); | ||
| 1904 | &data_byte(0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4); | ||
| 1905 | &data_byte(0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31); | ||
| 1906 | &data_byte(0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f); | ||
| 1907 | &data_byte(0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d); | ||
| 1908 | &data_byte(0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef); | ||
| 1909 | &data_byte(0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0); | ||
| 1910 | &data_byte(0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61); | ||
| 1911 | &data_byte(0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26); | ||
| 1912 | &data_byte(0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d); | ||
| 1913 | |||
| 696 | &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38); | 1914 | &data_byte(0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38); |
| 697 | &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb); | 1915 | &data_byte(0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb); |
| 698 | &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87); | 1916 | &data_byte(0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87); |
| @@ -728,43 +1946,57 @@ sub declast() | |||
| 728 | &function_end_B("_x86_AES_decrypt"); | 1946 | &function_end_B("_x86_AES_decrypt"); |
| 729 | 1947 | ||
| 730 | # void AES_decrypt (const void *inp,void *out,const AES_KEY *key); | 1948 | # void AES_decrypt (const void *inp,void *out,const AES_KEY *key); |
| 731 | &public_label("AES_Td"); | ||
| 732 | &function_begin("AES_decrypt"); | 1949 | &function_begin("AES_decrypt"); |
| 733 | &mov ($acc,&wparam(0)); # load inp | 1950 | &mov ($acc,&wparam(0)); # load inp |
| 734 | &mov ($key,&wparam(2)); # load key | 1951 | &mov ($key,&wparam(2)); # load key |
| 735 | 1952 | ||
| 736 | &mov ($s0,"esp"); | 1953 | &mov ($s0,"esp"); |
| 737 | &sub ("esp",24); | 1954 | &sub ("esp",36); |
| 738 | &and ("esp",-64); | 1955 | &and ("esp",-64); # align to cache-line |
| 739 | &add ("esp",4); | 1956 | |
| 740 | &mov (&DWP(16,"esp"),$s0); | 1957 | # place stack frame just "above" the key schedule |
| 1958 | &lea ($s1,&DWP(-64-63,$key)); | ||
| 1959 | &sub ($s1,"esp"); | ||
| 1960 | &neg ($s1); | ||
| 1961 | &and ($s1,0x3C0); # modulo 1024, but aligned to cache-line | ||
| 1962 | &sub ("esp",$s1); | ||
| 1963 | &add ("esp",4); # 4 is reserved for caller's return address | ||
| 1964 | &mov ($_esp,$s0); # save stack pointer | ||
| 741 | 1965 | ||
| 742 | &call (&label("pic_point")); # make it PIC! | 1966 | &call (&label("pic_point")); # make it PIC! |
| 743 | &set_label("pic_point"); | 1967 | &set_label("pic_point"); |
| 744 | &blindpop("ebp"); | 1968 | &blindpop($tbl); |
| 745 | &lea ("ebp",&DWP(&label("AES_Td")."-".&label("pic_point"),"ebp")); | 1969 | &picmeup($s0,"OPENSSL_ia32cap_P",$tbl,&label("pic_point")) if(!$x86only); |
| 746 | 1970 | &lea ($tbl,&DWP(&label("AES_Td")."-".&label("pic_point"),$tbl)); | |
| 747 | # prefetch Td4 | 1971 | |
| 748 | &lea ("ebp",&DWP(2048+128,"ebp")); | 1972 | # pick Td4 copy which can't "overlap" with stack frame or key schedule |
| 749 | &mov ($s0,&DWP(0-128,"ebp")); | 1973 | &lea ($s1,&DWP(768-4,"esp")); |
| 750 | &mov ($s1,&DWP(32-128,"ebp")); | 1974 | &sub ($s1,$tbl); |
| 751 | &mov ($s2,&DWP(64-128,"ebp")); | 1975 | &and ($s1,0x300); |
| 752 | &mov ($s3,&DWP(96-128,"ebp")); | 1976 | &lea ($tbl,&DWP(2048+128,$tbl,$s1)); |
| 753 | &mov ($s0,&DWP(128-128,"ebp")); | 1977 | |
| 754 | &mov ($s1,&DWP(160-128,"ebp")); | 1978 | if (!$x86only) { |
| 755 | &mov ($s2,&DWP(192-128,"ebp")); | 1979 | &bt (&DWP(0,$s0),25); # check for SSE bit |
| 756 | &mov ($s3,&DWP(224-128,"ebp")); | 1980 | &jnc (&label("x86")); |
| 757 | &lea ("ebp",&DWP(-2048-128,"ebp")); | 1981 | |
| 758 | 1982 | &movq ("mm0",&QWP(0,$acc)); | |
| 1983 | &movq ("mm4",&QWP(8,$acc)); | ||
| 1984 | &call ("_sse_AES_decrypt_compact"); | ||
| 1985 | &mov ("esp",$_esp); # restore stack pointer | ||
| 1986 | &mov ($acc,&wparam(1)); # load out | ||
| 1987 | &movq (&QWP(0,$acc),"mm0"); # write output data | ||
| 1988 | &movq (&QWP(8,$acc),"mm4"); | ||
| 1989 | &emms (); | ||
| 1990 | &function_end_A(); | ||
| 1991 | } | ||
| 1992 | &set_label("x86",16); | ||
| 1993 | &mov ($_tbl,$tbl); | ||
| 759 | &mov ($s0,&DWP(0,$acc)); # load input data | 1994 | &mov ($s0,&DWP(0,$acc)); # load input data |
| 760 | &mov ($s1,&DWP(4,$acc)); | 1995 | &mov ($s1,&DWP(4,$acc)); |
| 761 | &mov ($s2,&DWP(8,$acc)); | 1996 | &mov ($s2,&DWP(8,$acc)); |
| 762 | &mov ($s3,&DWP(12,$acc)); | 1997 | &mov ($s3,&DWP(12,$acc)); |
| 763 | 1998 | &call ("_x86_AES_decrypt_compact"); | |
| 764 | &call ("_x86_AES_decrypt"); | 1999 | &mov ("esp",$_esp); # restore stack pointer |
| 765 | |||
| 766 | &mov ("esp",&DWP(16,"esp")); | ||
| 767 | |||
| 768 | &mov ($acc,&wparam(1)); # load out | 2000 | &mov ($acc,&wparam(1)); # load out |
| 769 | &mov (&DWP(0,$acc),$s0); # write output data | 2001 | &mov (&DWP(0,$acc),$s0); # write output data |
| 770 | &mov (&DWP(4,$acc),$s1); | 2002 | &mov (&DWP(4,$acc),$s1); |
| @@ -777,126 +2009,136 @@ sub declast() | |||
| 777 | # unsigned char *ivp,const int enc); | 2009 | # unsigned char *ivp,const int enc); |
| 778 | { | 2010 | { |
| 779 | # stack frame layout | 2011 | # stack frame layout |
| 780 | # -4(%esp) 0(%esp) return address | 2012 | # -4(%esp) # return address 0(%esp) |
| 781 | # 0(%esp) 4(%esp) tmp1 | 2013 | # 0(%esp) # s0 backing store 4(%esp) |
| 782 | # 4(%esp) 8(%esp) tmp2 | 2014 | # 4(%esp) # s1 backing store 8(%esp) |
| 783 | # 8(%esp) 12(%esp) key | 2015 | # 8(%esp) # s2 backing store 12(%esp) |
| 784 | # 12(%esp) 16(%esp) end of key schedule | 2016 | # 12(%esp) # s3 backing store 16(%esp) |
| 785 | my $_esp=&DWP(16,"esp"); #saved %esp | 2017 | # 16(%esp) # key backup 20(%esp) |
| 786 | my $_inp=&DWP(20,"esp"); #copy of wparam(0) | 2018 | # 20(%esp) # end of key schedule 24(%esp) |
| 787 | my $_out=&DWP(24,"esp"); #copy of wparam(1) | 2019 | # 24(%esp) # %ebp backup 28(%esp) |
| 788 | my $_len=&DWP(28,"esp"); #copy of wparam(2) | 2020 | # 28(%esp) # %esp backup |
| 789 | my $_key=&DWP(32,"esp"); #copy of wparam(3) | 2021 | my $_inp=&DWP(32,"esp"); # copy of wparam(0) |
| 790 | my $_ivp=&DWP(36,"esp"); #copy of wparam(4) | 2022 | my $_out=&DWP(36,"esp"); # copy of wparam(1) |
| 791 | my $_tmp=&DWP(40,"esp"); #volatile variable | 2023 | my $_len=&DWP(40,"esp"); # copy of wparam(2) |
| 792 | my $ivec=&DWP(44,"esp"); #ivec[16] | 2024 | my $_key=&DWP(44,"esp"); # copy of wparam(3) |
| 793 | my $aes_key=&DWP(60,"esp"); #copy of aes_key | 2025 | my $_ivp=&DWP(48,"esp"); # copy of wparam(4) |
| 794 | my $mark=&DWP(60+240,"esp"); #copy of aes_key->rounds | 2026 | my $_tmp=&DWP(52,"esp"); # volatile variable |
| 795 | 2027 | # | |
| 796 | &public_label("AES_Te"); | 2028 | my $ivec=&DWP(60,"esp"); # ivec[16] |
| 797 | &public_label("AES_Td"); | 2029 | my $aes_key=&DWP(76,"esp"); # copy of aes_key |
| 2030 | my $mark=&DWP(76+240,"esp"); # copy of aes_key->rounds | ||
| 2031 | |||
| 798 | &function_begin("AES_cbc_encrypt"); | 2032 | &function_begin("AES_cbc_encrypt"); |
| 799 | &mov ($s2 eq "ecx"? $s2 : "",&wparam(2)); # load len | 2033 | &mov ($s2 eq "ecx"? $s2 : "",&wparam(2)); # load len |
| 800 | &cmp ($s2,0); | 2034 | &cmp ($s2,0); |
| 801 | &je (&label("enc_out")); | 2035 | &je (&label("drop_out")); |
| 802 | 2036 | ||
| 803 | &call (&label("pic_point")); # make it PIC! | 2037 | &call (&label("pic_point")); # make it PIC! |
| 804 | &set_label("pic_point"); | 2038 | &set_label("pic_point"); |
| 805 | &blindpop("ebp"); | 2039 | &blindpop($tbl); |
| 806 | 2040 | &picmeup($s0,"OPENSSL_ia32cap_P",$tbl,&label("pic_point")) if(!$x86only); | |
| 807 | &pushf (); | ||
| 808 | &cld (); | ||
| 809 | 2041 | ||
| 810 | &cmp (&wparam(5),0); | 2042 | &cmp (&wparam(5),0); |
| 811 | &je (&label("DECRYPT")); | 2043 | &lea ($tbl,&DWP(&label("AES_Te")."-".&label("pic_point"),$tbl)); |
| 2044 | &jne (&label("picked_te")); | ||
| 2045 | &lea ($tbl,&DWP(&label("AES_Td")."-".&label("AES_Te"),$tbl)); | ||
| 2046 | &set_label("picked_te"); | ||
| 812 | 2047 | ||
| 813 | &lea ("ebp",&DWP(&label("AES_Te")."-".&label("pic_point"),"ebp")); | 2048 | # one can argue if this is required |
| 814 | 2049 | &pushf (); | |
| 815 | # allocate aligned stack frame... | 2050 | &cld (); |
| 816 | &lea ($key,&DWP(-64-244,"esp")); | ||
| 817 | &and ($key,-64); | ||
| 818 | 2051 | ||
| 819 | # ... and make sure it doesn't alias with AES_Te modulo 4096 | 2052 | &cmp ($s2,$speed_limit); |
| 820 | &mov ($s0,"ebp"); | 2053 | &jb (&label("slow_way")); |
| 821 | &lea ($s1,&DWP(2048,"ebp")); | 2054 | &test ($s2,15); |
| 822 | &mov ($s3,$key); | 2055 | &jnz (&label("slow_way")); |
| 2056 | if (!$x86only) { | ||
| 2057 | &bt (&DWP(0,$s0),28); # check for hyper-threading bit | ||
| 2058 | &jc (&label("slow_way")); | ||
| 2059 | } | ||
| 2060 | # pre-allocate aligned stack frame... | ||
| 2061 | &lea ($acc,&DWP(-80-244,"esp")); | ||
| 2062 | &and ($acc,-64); | ||
| 2063 | |||
| 2064 | # ... and make sure it doesn't alias with $tbl modulo 4096 | ||
| 2065 | &mov ($s0,$tbl); | ||
| 2066 | &lea ($s1,&DWP(2048+256,$tbl)); | ||
| 2067 | &mov ($s3,$acc); | ||
| 823 | &and ($s0,0xfff); # s = %ebp&0xfff | 2068 | &and ($s0,0xfff); # s = %ebp&0xfff |
| 824 | &and ($s1,0xfff); # e = (%ebp+2048)&0xfff | 2069 | &and ($s1,0xfff); # e = (%ebp+2048+256)&0xfff |
| 825 | &and ($s3,0xfff); # p = %esp&0xfff | 2070 | &and ($s3,0xfff); # p = %esp&0xfff |
| 826 | 2071 | ||
| 827 | &cmp ($s3,$s1); # if (p>=e) %esp =- (p-e); | 2072 | &cmp ($s3,$s1); # if (p>=e) %esp =- (p-e); |
| 828 | &jb (&label("te_break_out")); | 2073 | &jb (&label("tbl_break_out")); |
| 829 | &sub ($s3,$s1); | 2074 | &sub ($s3,$s1); |
| 830 | &sub ($key,$s3); | 2075 | &sub ($acc,$s3); |
| 831 | &jmp (&label("te_ok")); | 2076 | &jmp (&label("tbl_ok")); |
| 832 | &set_label("te_break_out"); # else %esp -= (p-s)&0xfff + framesz; | 2077 | &set_label("tbl_break_out",4); # else %esp -= (p-s)&0xfff + framesz; |
| 833 | &sub ($s3,$s0); | 2078 | &sub ($s3,$s0); |
| 834 | &and ($s3,0xfff); | 2079 | &and ($s3,0xfff); |
| 835 | &add ($s3,64+256); | 2080 | &add ($s3,384); |
| 836 | &sub ($key,$s3); | 2081 | &sub ($acc,$s3); |
| 837 | &align (4); | 2082 | &set_label("tbl_ok",4); |
| 838 | &set_label("te_ok"); | ||
| 839 | 2083 | ||
| 840 | &mov ($s0,&wparam(0)); # load inp | 2084 | &lea ($s3,&wparam(0)); # obtain pointer to parameter block |
| 841 | &mov ($s1,&wparam(1)); # load out | 2085 | &exch ("esp",$acc); # allocate stack frame |
| 842 | &mov ($s3,&wparam(3)); # load key | ||
| 843 | &mov ($acc,&wparam(4)); # load ivp | ||
| 844 | |||
| 845 | &exch ("esp",$key); | ||
| 846 | &add ("esp",4); # reserve for return address! | 2086 | &add ("esp",4); # reserve for return address! |
| 847 | &mov ($_esp,$key); # save %esp | 2087 | &mov ($_tbl,$tbl); # save %ebp |
| 2088 | &mov ($_esp,$acc); # save %esp | ||
| 2089 | |||
| 2090 | &mov ($s0,&DWP(0,$s3)); # load inp | ||
| 2091 | &mov ($s1,&DWP(4,$s3)); # load out | ||
| 2092 | #&mov ($s2,&DWP(8,$s3)); # load len | ||
| 2093 | &mov ($key,&DWP(12,$s3)); # load key | ||
| 2094 | &mov ($acc,&DWP(16,$s3)); # load ivp | ||
| 2095 | &mov ($s3,&DWP(20,$s3)); # load enc flag | ||
| 848 | 2096 | ||
| 849 | &mov ($_inp,$s0); # save copy of inp | 2097 | &mov ($_inp,$s0); # save copy of inp |
| 850 | &mov ($_out,$s1); # save copy of out | 2098 | &mov ($_out,$s1); # save copy of out |
| 851 | &mov ($_len,$s2); # save copy of len | 2099 | &mov ($_len,$s2); # save copy of len |
| 852 | &mov ($_key,$s3); # save copy of key | 2100 | &mov ($_key,$key); # save copy of key |
| 853 | &mov ($_ivp,$acc); # save copy of ivp | 2101 | &mov ($_ivp,$acc); # save copy of ivp |
| 854 | 2102 | ||
| 855 | &mov ($mark,0); # copy of aes_key->rounds = 0; | 2103 | &mov ($mark,0); # copy of aes_key->rounds = 0; |
| 856 | if ($compromise) { | ||
| 857 | &cmp ($s2,$compromise); | ||
| 858 | &jb (&label("skip_ecopy")); | ||
| 859 | } | ||
| 860 | # do we copy key schedule to stack? | 2104 | # do we copy key schedule to stack? |
| 861 | &mov ($s1 eq "ebx" ? $s1 : "",$s3); | 2105 | &mov ($s1 eq "ebx" ? $s1 : "",$key); |
| 862 | &mov ($s2 eq "ecx" ? $s2 : "",244/4); | 2106 | &mov ($s2 eq "ecx" ? $s2 : "",244/4); |
| 863 | &sub ($s1,"ebp"); | 2107 | &sub ($s1,$tbl); |
| 864 | &mov ("esi",$s3); | 2108 | &mov ("esi",$key); |
| 865 | &and ($s1,0xfff); | 2109 | &and ($s1,0xfff); |
| 866 | &lea ("edi",$aes_key); | 2110 | &lea ("edi",$aes_key); |
| 867 | &cmp ($s1,2048); | 2111 | &cmp ($s1,2048+256); |
| 868 | &jb (&label("do_ecopy")); | 2112 | &jb (&label("do_copy")); |
| 869 | &cmp ($s1,4096-244); | 2113 | &cmp ($s1,4096-244); |
| 870 | &jb (&label("skip_ecopy")); | 2114 | &jb (&label("skip_copy")); |
| 871 | &align (4); | 2115 | &set_label("do_copy",4); |
| 872 | &set_label("do_ecopy"); | ||
| 873 | &mov ($_key,"edi"); | 2116 | &mov ($_key,"edi"); |
| 874 | &data_word(0xA5F3F689); # rep movsd | 2117 | &data_word(0xA5F3F689); # rep movsd |
| 875 | &set_label("skip_ecopy"); | 2118 | &set_label("skip_copy"); |
| 876 | 2119 | ||
| 877 | &mov ($acc,$s0); | ||
| 878 | &mov ($key,16); | 2120 | &mov ($key,16); |
| 879 | &align (4); | 2121 | &set_label("prefetch_tbl",4); |
| 880 | &set_label("prefetch_te"); | 2122 | &mov ($s0,&DWP(0,$tbl)); |
| 881 | &mov ($s0,&DWP(0,"ebp")); | 2123 | &mov ($s1,&DWP(32,$tbl)); |
| 882 | &mov ($s1,&DWP(32,"ebp")); | 2124 | &mov ($s2,&DWP(64,$tbl)); |
| 883 | &mov ($s2,&DWP(64,"ebp")); | 2125 | &mov ($acc,&DWP(96,$tbl)); |
| 884 | &mov ($s3,&DWP(96,"ebp")); | 2126 | &lea ($tbl,&DWP(128,$tbl)); |
| 885 | &lea ("ebp",&DWP(128,"ebp")); | 2127 | &sub ($key,1); |
| 886 | &dec ($key); | 2128 | &jnz (&label("prefetch_tbl")); |
| 887 | &jnz (&label("prefetch_te")); | 2129 | &sub ($tbl,2048); |
| 888 | &sub ("ebp",2048); | 2130 | |
| 889 | 2131 | &mov ($acc,$_inp); | |
| 890 | &mov ($s2,$_len); | ||
| 891 | &mov ($key,$_ivp); | 2132 | &mov ($key,$_ivp); |
| 892 | &test ($s2,0xFFFFFFF0); | ||
| 893 | &jz (&label("enc_tail")); # short input... | ||
| 894 | 2133 | ||
| 2134 | &cmp ($s3,0); | ||
| 2135 | &je (&label("fast_decrypt")); | ||
| 2136 | |||
| 2137 | #----------------------------- ENCRYPT -----------------------------# | ||
| 895 | &mov ($s0,&DWP(0,$key)); # load iv | 2138 | &mov ($s0,&DWP(0,$key)); # load iv |
| 896 | &mov ($s1,&DWP(4,$key)); | 2139 | &mov ($s1,&DWP(4,$key)); |
| 897 | 2140 | ||
| 898 | &align (4); | 2141 | &set_label("fast_enc_loop",16); |
| 899 | &set_label("enc_loop"); | ||
| 900 | &mov ($s2,&DWP(8,$key)); | 2142 | &mov ($s2,&DWP(8,$key)); |
| 901 | &mov ($s3,&DWP(12,$key)); | 2143 | &mov ($s3,&DWP(12,$key)); |
| 902 | 2144 | ||
| @@ -916,22 +2158,16 @@ my $mark=&DWP(60+240,"esp"); #copy of aes_key->rounds | |||
| 916 | &mov (&DWP(8,$key),$s2); | 2158 | &mov (&DWP(8,$key),$s2); |
| 917 | &mov (&DWP(12,$key),$s3); | 2159 | &mov (&DWP(12,$key),$s3); |
| 918 | 2160 | ||
| 2161 | &lea ($acc,&DWP(16,$acc)); # advance inp | ||
| 919 | &mov ($s2,$_len); # load len | 2162 | &mov ($s2,$_len); # load len |
| 920 | |||
| 921 | &lea ($acc,&DWP(16,$acc)); | ||
| 922 | &mov ($_inp,$acc); # save inp | 2163 | &mov ($_inp,$acc); # save inp |
| 923 | 2164 | &lea ($s3,&DWP(16,$key)); # advance out | |
| 924 | &lea ($s3,&DWP(16,$key)); | ||
| 925 | &mov ($_out,$s3); # save out | 2165 | &mov ($_out,$s3); # save out |
| 926 | 2166 | &sub ($s2,16); # decrease len | |
| 927 | &sub ($s2,16); | ||
| 928 | &test ($s2,0xFFFFFFF0); | ||
| 929 | &mov ($_len,$s2); # save len | 2167 | &mov ($_len,$s2); # save len |
| 930 | &jnz (&label("enc_loop")); | 2168 | &jnz (&label("fast_enc_loop")); |
| 931 | &test ($s2,15); | ||
| 932 | &jnz (&label("enc_tail")); | ||
| 933 | &mov ($acc,$_ivp); # load ivp | 2169 | &mov ($acc,$_ivp); # load ivp |
| 934 | &mov ($s2,&DWP(8,$key)); # restore last dwords | 2170 | &mov ($s2,&DWP(8,$key)); # restore last 2 dwords |
| 935 | &mov ($s3,&DWP(12,$key)); | 2171 | &mov ($s3,&DWP(12,$key)); |
| 936 | &mov (&DWP(0,$acc),$s0); # save ivec | 2172 | &mov (&DWP(0,$acc),$s0); # save ivec |
| 937 | &mov (&DWP(4,$acc),$s1); | 2173 | &mov (&DWP(4,$acc),$s1); |
| @@ -949,125 +2185,20 @@ my $mark=&DWP(60+240,"esp"); #copy of aes_key->rounds | |||
| 949 | &set_label("skip_ezero") | 2185 | &set_label("skip_ezero") |
| 950 | &mov ("esp",$_esp); | 2186 | &mov ("esp",$_esp); |
| 951 | &popf (); | 2187 | &popf (); |
| 952 | &set_label("enc_out"); | 2188 | &set_label("drop_out"); |
| 953 | &function_end_A(); | 2189 | &function_end_A(); |
| 954 | &pushf (); # kludge, never executed | 2190 | &pushf (); # kludge, never executed |
| 955 | 2191 | ||
| 956 | &align (4); | ||
| 957 | &set_label("enc_tail"); | ||
| 958 | &mov ($s0,$key eq "edi" ? $key : ""); | ||
| 959 | &mov ($key,$_out); # load out | ||
| 960 | &push ($s0); # push ivp | ||
| 961 | &mov ($s1,16); | ||
| 962 | &sub ($s1,$s2); | ||
| 963 | &cmp ($key,$acc); # compare with inp | ||
| 964 | &je (&label("enc_in_place")); | ||
| 965 | &align (4); | ||
| 966 | &data_word(0xA4F3F689); # rep movsb # copy input | ||
| 967 | &jmp (&label("enc_skip_in_place")); | ||
| 968 | &set_label("enc_in_place"); | ||
| 969 | &lea ($key,&DWP(0,$key,$s2)); | ||
| 970 | &set_label("enc_skip_in_place"); | ||
| 971 | &mov ($s2,$s1); | ||
| 972 | &xor ($s0,$s0); | ||
| 973 | &align (4); | ||
| 974 | &data_word(0xAAF3F689); # rep stosb # zero tail | ||
| 975 | &pop ($key); # pop ivp | ||
| 976 | |||
| 977 | &mov ($acc,$_out); # output as input | ||
| 978 | &mov ($s0,&DWP(0,$key)); | ||
| 979 | &mov ($s1,&DWP(4,$key)); | ||
| 980 | &mov ($_len,16); # len=16 | ||
| 981 | &jmp (&label("enc_loop")); # one more spin... | ||
| 982 | |||
| 983 | #----------------------------- DECRYPT -----------------------------# | 2192 | #----------------------------- DECRYPT -----------------------------# |
| 984 | &align (4); | 2193 | &set_label("fast_decrypt",16); |
| 985 | &set_label("DECRYPT"); | ||
| 986 | &lea ("ebp",&DWP(&label("AES_Td")."-".&label("pic_point"),"ebp")); | ||
| 987 | |||
| 988 | # allocate aligned stack frame... | ||
| 989 | &lea ($key,&DWP(-64-244,"esp")); | ||
| 990 | &and ($key,-64); | ||
| 991 | |||
| 992 | # ... and make sure it doesn't alias with AES_Td modulo 4096 | ||
| 993 | &mov ($s0,"ebp"); | ||
| 994 | &lea ($s1,&DWP(2048+256,"ebp")); | ||
| 995 | &mov ($s3,$key); | ||
| 996 | &and ($s0,0xfff); # s = %ebp&0xfff | ||
| 997 | &and ($s1,0xfff); # e = (%ebp+2048+256)&0xfff | ||
| 998 | &and ($s3,0xfff); # p = %esp&0xfff | ||
| 999 | |||
| 1000 | &cmp ($s3,$s1); # if (p>=e) %esp =- (p-e); | ||
| 1001 | &jb (&label("td_break_out")); | ||
| 1002 | &sub ($s3,$s1); | ||
| 1003 | &sub ($key,$s3); | ||
| 1004 | &jmp (&label("td_ok")); | ||
| 1005 | &set_label("td_break_out"); # else %esp -= (p-s)&0xfff + framesz; | ||
| 1006 | &sub ($s3,$s0); | ||
| 1007 | &and ($s3,0xfff); | ||
| 1008 | &add ($s3,64+256); | ||
| 1009 | &sub ($key,$s3); | ||
| 1010 | &align (4); | ||
| 1011 | &set_label("td_ok"); | ||
| 1012 | |||
| 1013 | &mov ($s0,&wparam(0)); # load inp | ||
| 1014 | &mov ($s1,&wparam(1)); # load out | ||
| 1015 | &mov ($s3,&wparam(3)); # load key | ||
| 1016 | &mov ($acc,&wparam(4)); # load ivp | ||
| 1017 | |||
| 1018 | &exch ("esp",$key); | ||
| 1019 | &add ("esp",4); # reserve for return address! | ||
| 1020 | &mov ($_esp,$key); # save %esp | ||
| 1021 | |||
| 1022 | &mov ($_inp,$s0); # save copy of inp | ||
| 1023 | &mov ($_out,$s1); # save copy of out | ||
| 1024 | &mov ($_len,$s2); # save copy of len | ||
| 1025 | &mov ($_key,$s3); # save copy of key | ||
| 1026 | &mov ($_ivp,$acc); # save copy of ivp | ||
| 1027 | |||
| 1028 | &mov ($mark,0); # copy of aes_key->rounds = 0; | ||
| 1029 | if ($compromise) { | ||
| 1030 | &cmp ($s2,$compromise); | ||
| 1031 | &jb (&label("skip_dcopy")); | ||
| 1032 | } | ||
| 1033 | # do we copy key schedule to stack? | ||
| 1034 | &mov ($s1 eq "ebx" ? $s1 : "",$s3); | ||
| 1035 | &mov ($s2 eq "ecx" ? $s2 : "",244/4); | ||
| 1036 | &sub ($s1,"ebp"); | ||
| 1037 | &mov ("esi",$s3); | ||
| 1038 | &and ($s1,0xfff); | ||
| 1039 | &lea ("edi",$aes_key); | ||
| 1040 | &cmp ($s1,2048+256); | ||
| 1041 | &jb (&label("do_dcopy")); | ||
| 1042 | &cmp ($s1,4096-244); | ||
| 1043 | &jb (&label("skip_dcopy")); | ||
| 1044 | &align (4); | ||
| 1045 | &set_label("do_dcopy"); | ||
| 1046 | &mov ($_key,"edi"); | ||
| 1047 | &data_word(0xA5F3F689); # rep movsd | ||
| 1048 | &set_label("skip_dcopy"); | ||
| 1049 | |||
| 1050 | &mov ($acc,$s0); | ||
| 1051 | &mov ($key,18); | ||
| 1052 | &align (4); | ||
| 1053 | &set_label("prefetch_td"); | ||
| 1054 | &mov ($s0,&DWP(0,"ebp")); | ||
| 1055 | &mov ($s1,&DWP(32,"ebp")); | ||
| 1056 | &mov ($s2,&DWP(64,"ebp")); | ||
| 1057 | &mov ($s3,&DWP(96,"ebp")); | ||
| 1058 | &lea ("ebp",&DWP(128,"ebp")); | ||
| 1059 | &dec ($key); | ||
| 1060 | &jnz (&label("prefetch_td")); | ||
| 1061 | &sub ("ebp",2048+256); | ||
| 1062 | 2194 | ||
| 1063 | &cmp ($acc,$_out); | 2195 | &cmp ($acc,$_out); |
| 1064 | &je (&label("dec_in_place")); # in-place processing... | 2196 | &je (&label("fast_dec_in_place")); # in-place processing... |
| 1065 | 2197 | ||
| 1066 | &mov ($key,$_ivp); # load ivp | ||
| 1067 | &mov ($_tmp,$key); | 2198 | &mov ($_tmp,$key); |
| 1068 | 2199 | ||
| 1069 | &align (4); | 2200 | &align (4); |
| 1070 | &set_label("dec_loop"); | 2201 | &set_label("fast_dec_loop",16); |
| 1071 | &mov ($s0,&DWP(0,$acc)); # read input | 2202 | &mov ($s0,&DWP(0,$acc)); # read input |
| 1072 | &mov ($s1,&DWP(4,$acc)); | 2203 | &mov ($s1,&DWP(4,$acc)); |
| 1073 | &mov ($s2,&DWP(8,$acc)); | 2204 | &mov ($s2,&DWP(8,$acc)); |
| @@ -1083,27 +2214,24 @@ my $mark=&DWP(60+240,"esp"); #copy of aes_key->rounds | |||
| 1083 | &xor ($s2,&DWP(8,$key)); | 2214 | &xor ($s2,&DWP(8,$key)); |
| 1084 | &xor ($s3,&DWP(12,$key)); | 2215 | &xor ($s3,&DWP(12,$key)); |
| 1085 | 2216 | ||
| 1086 | &sub ($acc,16); | ||
| 1087 | &jc (&label("dec_partial")); | ||
| 1088 | &mov ($_len,$acc); # save len | ||
| 1089 | &mov ($acc,$_inp); # load inp | ||
| 1090 | &mov ($key,$_out); # load out | 2217 | &mov ($key,$_out); # load out |
| 2218 | &mov ($acc,$_inp); # load inp | ||
| 1091 | 2219 | ||
| 1092 | &mov (&DWP(0,$key),$s0); # write output | 2220 | &mov (&DWP(0,$key),$s0); # write output |
| 1093 | &mov (&DWP(4,$key),$s1); | 2221 | &mov (&DWP(4,$key),$s1); |
| 1094 | &mov (&DWP(8,$key),$s2); | 2222 | &mov (&DWP(8,$key),$s2); |
| 1095 | &mov (&DWP(12,$key),$s3); | 2223 | &mov (&DWP(12,$key),$s3); |
| 1096 | 2224 | ||
| 2225 | &mov ($s2,$_len); # load len | ||
| 1097 | &mov ($_tmp,$acc); # save ivp | 2226 | &mov ($_tmp,$acc); # save ivp |
| 1098 | &lea ($acc,&DWP(16,$acc)); | 2227 | &lea ($acc,&DWP(16,$acc)); # advance inp |
| 1099 | &mov ($_inp,$acc); # save inp | 2228 | &mov ($_inp,$acc); # save inp |
| 1100 | 2229 | &lea ($key,&DWP(16,$key)); # advance out | |
| 1101 | &lea ($key,&DWP(16,$key)); | ||
| 1102 | &mov ($_out,$key); # save out | 2230 | &mov ($_out,$key); # save out |
| 1103 | 2231 | &sub ($s2,16); # decrease len | |
| 1104 | &jnz (&label("dec_loop")); | 2232 | &mov ($_len,$s2); # save len |
| 2233 | &jnz (&label("fast_dec_loop")); | ||
| 1105 | &mov ($key,$_tmp); # load temp ivp | 2234 | &mov ($key,$_tmp); # load temp ivp |
| 1106 | &set_label("dec_end"); | ||
| 1107 | &mov ($acc,$_ivp); # load user ivp | 2235 | &mov ($acc,$_ivp); # load user ivp |
| 1108 | &mov ($s0,&DWP(0,$key)); # load iv | 2236 | &mov ($s0,&DWP(0,$key)); # load iv |
| 1109 | &mov ($s1,&DWP(4,$key)); | 2237 | &mov ($s1,&DWP(4,$key)); |
| @@ -1113,31 +2241,16 @@ my $mark=&DWP(60+240,"esp"); #copy of aes_key->rounds | |||
| 1113 | &mov (&DWP(4,$acc),$s1); | 2241 | &mov (&DWP(4,$acc),$s1); |
| 1114 | &mov (&DWP(8,$acc),$s2); | 2242 | &mov (&DWP(8,$acc),$s2); |
| 1115 | &mov (&DWP(12,$acc),$s3); | 2243 | &mov (&DWP(12,$acc),$s3); |
| 1116 | &jmp (&label("dec_out")); | 2244 | &jmp (&label("fast_dec_out")); |
| 1117 | 2245 | ||
| 1118 | &align (4); | 2246 | &set_label("fast_dec_in_place",16); |
| 1119 | &set_label("dec_partial"); | 2247 | &set_label("fast_dec_in_place_loop"); |
| 1120 | &lea ($key,$ivec); | ||
| 1121 | &mov (&DWP(0,$key),$s0); # dump output to stack | ||
| 1122 | &mov (&DWP(4,$key),$s1); | ||
| 1123 | &mov (&DWP(8,$key),$s2); | ||
| 1124 | &mov (&DWP(12,$key),$s3); | ||
| 1125 | &lea ($s2 eq "ecx" ? $s2 : "",&DWP(16,$acc)); | ||
| 1126 | &mov ($acc eq "esi" ? $acc : "",$key); | ||
| 1127 | &mov ($key eq "edi" ? $key : "",$_out); # load out | ||
| 1128 | &data_word(0xA4F3F689); # rep movsb # copy output | ||
| 1129 | &mov ($key,$_inp); # use inp as temp ivp | ||
| 1130 | &jmp (&label("dec_end")); | ||
| 1131 | |||
| 1132 | &align (4); | ||
| 1133 | &set_label("dec_in_place"); | ||
| 1134 | &set_label("dec_in_place_loop"); | ||
| 1135 | &lea ($key,$ivec); | ||
| 1136 | &mov ($s0,&DWP(0,$acc)); # read input | 2248 | &mov ($s0,&DWP(0,$acc)); # read input |
| 1137 | &mov ($s1,&DWP(4,$acc)); | 2249 | &mov ($s1,&DWP(4,$acc)); |
| 1138 | &mov ($s2,&DWP(8,$acc)); | 2250 | &mov ($s2,&DWP(8,$acc)); |
| 1139 | &mov ($s3,&DWP(12,$acc)); | 2251 | &mov ($s3,&DWP(12,$acc)); |
| 1140 | 2252 | ||
| 2253 | &lea ($key,$ivec); | ||
| 1141 | &mov (&DWP(0,$key),$s0); # copy to temp | 2254 | &mov (&DWP(0,$key),$s0); # copy to temp |
| 1142 | &mov (&DWP(4,$key),$s1); | 2255 | &mov (&DWP(4,$key),$s1); |
| 1143 | &mov (&DWP(8,$key),$s2); | 2256 | &mov (&DWP(8,$key),$s2); |
| @@ -1158,7 +2271,7 @@ my $mark=&DWP(60+240,"esp"); #copy of aes_key->rounds | |||
| 1158 | &mov (&DWP(8,$acc),$s2); | 2271 | &mov (&DWP(8,$acc),$s2); |
| 1159 | &mov (&DWP(12,$acc),$s3); | 2272 | &mov (&DWP(12,$acc),$s3); |
| 1160 | 2273 | ||
| 1161 | &lea ($acc,&DWP(16,$acc)); | 2274 | &lea ($acc,&DWP(16,$acc)); # advance out |
| 1162 | &mov ($_out,$acc); # save out | 2275 | &mov ($_out,$acc); # save out |
| 1163 | 2276 | ||
| 1164 | &lea ($acc,$ivec); | 2277 | &lea ($acc,$ivec); |
| @@ -1173,40 +2286,340 @@ my $mark=&DWP(60+240,"esp"); #copy of aes_key->rounds | |||
| 1173 | &mov (&DWP(12,$key),$s3); | 2286 | &mov (&DWP(12,$key),$s3); |
| 1174 | 2287 | ||
| 1175 | &mov ($acc,$_inp); # load inp | 2288 | &mov ($acc,$_inp); # load inp |
| 2289 | &mov ($s2,$_len); # load len | ||
| 2290 | &lea ($acc,&DWP(16,$acc)); # advance inp | ||
| 2291 | &mov ($_inp,$acc); # save inp | ||
| 2292 | &sub ($s2,16); # decrease len | ||
| 2293 | &mov ($_len,$s2); # save len | ||
| 2294 | &jnz (&label("fast_dec_in_place_loop")); | ||
| 2295 | |||
| 2296 | &set_label("fast_dec_out",4); | ||
| 2297 | &cmp ($mark,0); # was the key schedule copied? | ||
| 2298 | &mov ("edi",$_key); | ||
| 2299 | &je (&label("skip_dzero")); | ||
| 2300 | # zero copy of key schedule | ||
| 2301 | &mov ("ecx",240/4); | ||
| 2302 | &xor ("eax","eax"); | ||
| 2303 | &align (4); | ||
| 2304 | &data_word(0xABF3F689); # rep stosd | ||
| 2305 | &set_label("skip_dzero") | ||
| 2306 | &mov ("esp",$_esp); | ||
| 2307 | &popf (); | ||
| 2308 | &function_end_A(); | ||
| 2309 | &pushf (); # kludge, never executed | ||
| 2310 | |||
| 2311 | #--------------------------- SLOW ROUTINE ---------------------------# | ||
| 2312 | &set_label("slow_way",16); | ||
| 2313 | |||
| 2314 | &mov ($s0,&DWP(0,$s0)) if (!$x86only);# load OPENSSL_ia32cap | ||
| 2315 | &mov ($key,&wparam(3)); # load key | ||
| 2316 | |||
| 2317 | # pre-allocate aligned stack frame... | ||
| 2318 | &lea ($acc,&DWP(-80,"esp")); | ||
| 2319 | &and ($acc,-64); | ||
| 2320 | |||
| 2321 | # ... and make sure it doesn't alias with $key modulo 1024 | ||
| 2322 | &lea ($s1,&DWP(-80-63,$key)); | ||
| 2323 | &sub ($s1,$acc); | ||
| 2324 | &neg ($s1); | ||
| 2325 | &and ($s1,0x3C0); # modulo 1024, but aligned to cache-line | ||
| 2326 | &sub ($acc,$s1); | ||
| 2327 | |||
| 2328 | # pick S-box copy which can't overlap with stack frame or $key | ||
| 2329 | &lea ($s1,&DWP(768,$acc)); | ||
| 2330 | &sub ($s1,$tbl); | ||
| 2331 | &and ($s1,0x300); | ||
| 2332 | &lea ($tbl,&DWP(2048+128,$tbl,$s1)); | ||
| 2333 | |||
| 2334 | &lea ($s3,&wparam(0)); # pointer to parameter block | ||
| 2335 | |||
| 2336 | &exch ("esp",$acc); | ||
| 2337 | &add ("esp",4); # reserve for return address! | ||
| 2338 | &mov ($_tbl,$tbl); # save %ebp | ||
| 2339 | &mov ($_esp,$acc); # save %esp | ||
| 2340 | &mov ($_tmp,$s0); # save OPENSSL_ia32cap | ||
| 2341 | |||
| 2342 | &mov ($s0,&DWP(0,$s3)); # load inp | ||
| 2343 | &mov ($s1,&DWP(4,$s3)); # load out | ||
| 2344 | #&mov ($s2,&DWP(8,$s3)); # load len | ||
| 2345 | #&mov ($key,&DWP(12,$s3)); # load key | ||
| 2346 | &mov ($acc,&DWP(16,$s3)); # load ivp | ||
| 2347 | &mov ($s3,&DWP(20,$s3)); # load enc flag | ||
| 2348 | |||
| 2349 | &mov ($_inp,$s0); # save copy of inp | ||
| 2350 | &mov ($_out,$s1); # save copy of out | ||
| 2351 | &mov ($_len,$s2); # save copy of len | ||
| 2352 | &mov ($_key,$key); # save copy of key | ||
| 2353 | &mov ($_ivp,$acc); # save copy of ivp | ||
| 2354 | |||
| 2355 | &mov ($key,$acc); | ||
| 2356 | &mov ($acc,$s0); | ||
| 2357 | |||
| 2358 | &cmp ($s3,0); | ||
| 2359 | &je (&label("slow_decrypt")); | ||
| 2360 | |||
| 2361 | #--------------------------- SLOW ENCRYPT ---------------------------# | ||
| 2362 | &cmp ($s2,16); | ||
| 2363 | &mov ($s3,$s1); | ||
| 2364 | &jb (&label("slow_enc_tail")); | ||
| 2365 | |||
| 2366 | if (!$x86only) { | ||
| 2367 | &bt ($_tmp,25); # check for SSE bit | ||
| 2368 | &jnc (&label("slow_enc_x86")); | ||
| 2369 | |||
| 2370 | &movq ("mm0",&QWP(0,$key)); # load iv | ||
| 2371 | &movq ("mm4",&QWP(8,$key)); | ||
| 1176 | 2372 | ||
| 1177 | &lea ($acc,&DWP(16,$acc)); | 2373 | &set_label("slow_enc_loop_sse",16); |
| 2374 | &pxor ("mm0",&QWP(0,$acc)); # xor input data | ||
| 2375 | &pxor ("mm4",&QWP(8,$acc)); | ||
| 2376 | |||
| 2377 | &mov ($key,$_key); | ||
| 2378 | &call ("_sse_AES_encrypt_compact"); | ||
| 2379 | |||
| 2380 | &mov ($acc,$_inp); # load inp | ||
| 2381 | &mov ($key,$_out); # load out | ||
| 2382 | &mov ($s2,$_len); # load len | ||
| 2383 | |||
| 2384 | &movq (&QWP(0,$key),"mm0"); # save output data | ||
| 2385 | &movq (&QWP(8,$key),"mm4"); | ||
| 2386 | |||
| 2387 | &lea ($acc,&DWP(16,$acc)); # advance inp | ||
| 1178 | &mov ($_inp,$acc); # save inp | 2388 | &mov ($_inp,$acc); # save inp |
| 2389 | &lea ($s3,&DWP(16,$key)); # advance out | ||
| 2390 | &mov ($_out,$s3); # save out | ||
| 2391 | &sub ($s2,16); # decrease len | ||
| 2392 | &cmp ($s2,16); | ||
| 2393 | &mov ($_len,$s2); # save len | ||
| 2394 | &jae (&label("slow_enc_loop_sse")); | ||
| 2395 | &test ($s2,15); | ||
| 2396 | &jnz (&label("slow_enc_tail")); | ||
| 2397 | &mov ($acc,$_ivp); # load ivp | ||
| 2398 | &movq (&QWP(0,$acc),"mm0"); # save ivec | ||
| 2399 | &movq (&QWP(8,$acc),"mm4"); | ||
| 2400 | &emms (); | ||
| 2401 | &mov ("esp",$_esp); | ||
| 2402 | &popf (); | ||
| 2403 | &function_end_A(); | ||
| 2404 | &pushf (); # kludge, never executed | ||
| 2405 | } | ||
| 2406 | &set_label("slow_enc_x86",16); | ||
| 2407 | &mov ($s0,&DWP(0,$key)); # load iv | ||
| 2408 | &mov ($s1,&DWP(4,$key)); | ||
| 2409 | |||
| 2410 | &set_label("slow_enc_loop_x86",4); | ||
| 2411 | &mov ($s2,&DWP(8,$key)); | ||
| 2412 | &mov ($s3,&DWP(12,$key)); | ||
| 2413 | |||
| 2414 | &xor ($s0,&DWP(0,$acc)); # xor input data | ||
| 2415 | &xor ($s1,&DWP(4,$acc)); | ||
| 2416 | &xor ($s2,&DWP(8,$acc)); | ||
| 2417 | &xor ($s3,&DWP(12,$acc)); | ||
| 2418 | |||
| 2419 | &mov ($key,$_key); # load key | ||
| 2420 | &call ("_x86_AES_encrypt_compact"); | ||
| 2421 | |||
| 2422 | &mov ($acc,$_inp); # load inp | ||
| 2423 | &mov ($key,$_out); # load out | ||
| 2424 | |||
| 2425 | &mov (&DWP(0,$key),$s0); # save output data | ||
| 2426 | &mov (&DWP(4,$key),$s1); | ||
| 2427 | &mov (&DWP(8,$key),$s2); | ||
| 2428 | &mov (&DWP(12,$key),$s3); | ||
| 1179 | 2429 | ||
| 1180 | &mov ($s2,$_len); # load len | 2430 | &mov ($s2,$_len); # load len |
| 1181 | &sub ($s2,16); | 2431 | &lea ($acc,&DWP(16,$acc)); # advance inp |
| 1182 | &jc (&label("dec_in_place_partial")); | 2432 | &mov ($_inp,$acc); # save inp |
| 2433 | &lea ($s3,&DWP(16,$key)); # advance out | ||
| 2434 | &mov ($_out,$s3); # save out | ||
| 2435 | &sub ($s2,16); # decrease len | ||
| 2436 | &cmp ($s2,16); | ||
| 1183 | &mov ($_len,$s2); # save len | 2437 | &mov ($_len,$s2); # save len |
| 1184 | &jnz (&label("dec_in_place_loop")); | 2438 | &jae (&label("slow_enc_loop_x86")); |
| 1185 | &jmp (&label("dec_out")); | 2439 | &test ($s2,15); |
| 1186 | 2440 | &jnz (&label("slow_enc_tail")); | |
| 1187 | &align (4); | 2441 | &mov ($acc,$_ivp); # load ivp |
| 1188 | &set_label("dec_in_place_partial"); | 2442 | &mov ($s2,&DWP(8,$key)); # restore last dwords |
| 1189 | # one can argue if this is actually required... | 2443 | &mov ($s3,&DWP(12,$key)); |
| 1190 | &mov ($key eq "edi" ? $key : "",$_out); | 2444 | &mov (&DWP(0,$acc),$s0); # save ivec |
| 1191 | &lea ($acc eq "esi" ? $acc : "",$ivec); | 2445 | &mov (&DWP(4,$acc),$s1); |
| 2446 | &mov (&DWP(8,$acc),$s2); | ||
| 2447 | &mov (&DWP(12,$acc),$s3); | ||
| 2448 | |||
| 2449 | &mov ("esp",$_esp); | ||
| 2450 | &popf (); | ||
| 2451 | &function_end_A(); | ||
| 2452 | &pushf (); # kludge, never executed | ||
| 2453 | |||
| 2454 | &set_label("slow_enc_tail",16); | ||
| 2455 | &emms () if (!$x86only); | ||
| 2456 | &mov ($key eq "edi"? $key:"",$s3); # load out to edi | ||
| 2457 | &mov ($s1,16); | ||
| 2458 | &sub ($s1,$s2); | ||
| 2459 | &cmp ($key,$acc eq "esi"? $acc:""); # compare with inp | ||
| 2460 | &je (&label("enc_in_place")); | ||
| 2461 | &align (4); | ||
| 2462 | &data_word(0xA4F3F689); # rep movsb # copy input | ||
| 2463 | &jmp (&label("enc_skip_in_place")); | ||
| 2464 | &set_label("enc_in_place"); | ||
| 1192 | &lea ($key,&DWP(0,$key,$s2)); | 2465 | &lea ($key,&DWP(0,$key,$s2)); |
| 1193 | &lea ($acc,&DWP(16,$acc,$s2)); | 2466 | &set_label("enc_skip_in_place"); |
| 1194 | &neg ($s2 eq "ecx" ? $s2 : ""); | 2467 | &mov ($s2,$s1); |
| 1195 | &data_word(0xA4F3F689); # rep movsb # restore tail | 2468 | &xor ($s0,$s0); |
| 1196 | 2469 | &align (4); | |
| 1197 | &align (4); | 2470 | &data_word(0xAAF3F689); # rep stosb # zero tail |
| 1198 | &set_label("dec_out"); | 2471 | |
| 1199 | &cmp ($mark,0); # was the key schedule copied? | 2472 | &mov ($key,$_ivp); # restore ivp |
| 1200 | &mov ("edi",$_key); | 2473 | &mov ($acc,$s3); # output as input |
| 1201 | &je (&label("skip_dzero")); | 2474 | &mov ($s0,&DWP(0,$key)); |
| 1202 | # zero copy of key schedule | 2475 | &mov ($s1,&DWP(4,$key)); |
| 1203 | &mov ("ecx",240/4); | 2476 | &mov ($_len,16); # len=16 |
| 1204 | &xor ("eax","eax"); | 2477 | &jmp (&label("slow_enc_loop_x86")); # one more spin... |
| 1205 | &align (4); | 2478 | |
| 1206 | &data_word(0xABF3F689); # rep stosd | 2479 | #--------------------------- SLOW DECRYPT ---------------------------# |
| 1207 | &set_label("skip_dzero") | 2480 | &set_label("slow_decrypt",16); |
| 1208 | &mov ("esp",$_esp); | 2481 | if (!$x86only) { |
| 1209 | &popf (); | 2482 | &bt ($_tmp,25); # check for SSE bit |
| 2483 | &jnc (&label("slow_dec_loop_x86")); | ||
| 2484 | |||
| 2485 | &set_label("slow_dec_loop_sse",4); | ||
| 2486 | &movq ("mm0",&QWP(0,$acc)); # read input | ||
| 2487 | &movq ("mm4",&QWP(8,$acc)); | ||
| 2488 | |||
| 2489 | &mov ($key,$_key); | ||
| 2490 | &call ("_sse_AES_decrypt_compact"); | ||
| 2491 | |||
| 2492 | &mov ($acc,$_inp); # load inp | ||
| 2493 | &lea ($s0,$ivec); | ||
| 2494 | &mov ($s1,$_out); # load out | ||
| 2495 | &mov ($s2,$_len); # load len | ||
| 2496 | &mov ($key,$_ivp); # load ivp | ||
| 2497 | |||
| 2498 | &movq ("mm1",&QWP(0,$acc)); # re-read input | ||
| 2499 | &movq ("mm5",&QWP(8,$acc)); | ||
| 2500 | |||
| 2501 | &pxor ("mm0",&QWP(0,$key)); # xor iv | ||
| 2502 | &pxor ("mm4",&QWP(8,$key)); | ||
| 2503 | |||
| 2504 | &movq (&QWP(0,$key),"mm1"); # copy input to iv | ||
| 2505 | &movq (&QWP(8,$key),"mm5"); | ||
| 2506 | |||
| 2507 | &sub ($s2,16); # decrease len | ||
| 2508 | &jc (&label("slow_dec_partial_sse")); | ||
| 2509 | |||
| 2510 | &movq (&QWP(0,$s1),"mm0"); # write output | ||
| 2511 | &movq (&QWP(8,$s1),"mm4"); | ||
| 2512 | |||
| 2513 | &lea ($s1,&DWP(16,$s1)); # advance out | ||
| 2514 | &mov ($_out,$s1); # save out | ||
| 2515 | &lea ($acc,&DWP(16,$acc)); # advance inp | ||
| 2516 | &mov ($_inp,$acc); # save inp | ||
| 2517 | &mov ($_len,$s2); # save len | ||
| 2518 | &jnz (&label("slow_dec_loop_sse")); | ||
| 2519 | &emms (); | ||
| 2520 | &mov ("esp",$_esp); | ||
| 2521 | &popf (); | ||
| 2522 | &function_end_A(); | ||
| 2523 | &pushf (); # kludge, never executed | ||
| 2524 | |||
| 2525 | &set_label("slow_dec_partial_sse",16); | ||
| 2526 | &movq (&QWP(0,$s0),"mm0"); # save output to temp | ||
| 2527 | &movq (&QWP(8,$s0),"mm4"); | ||
| 2528 | &emms (); | ||
| 2529 | |||
| 2530 | &add ($s2 eq "ecx" ? "ecx":"",16); | ||
| 2531 | &mov ("edi",$s1); # out | ||
| 2532 | &mov ("esi",$s0); # temp | ||
| 2533 | &align (4); | ||
| 2534 | &data_word(0xA4F3F689); # rep movsb # copy partial output | ||
| 2535 | |||
| 2536 | &mov ("esp",$_esp); | ||
| 2537 | &popf (); | ||
| 2538 | &function_end_A(); | ||
| 2539 | &pushf (); # kludge, never executed | ||
| 2540 | } | ||
| 2541 | &set_label("slow_dec_loop_x86",16); | ||
| 2542 | &mov ($s0,&DWP(0,$acc)); # read input | ||
| 2543 | &mov ($s1,&DWP(4,$acc)); | ||
| 2544 | &mov ($s2,&DWP(8,$acc)); | ||
| 2545 | &mov ($s3,&DWP(12,$acc)); | ||
| 2546 | |||
| 2547 | &lea ($key,$ivec); | ||
| 2548 | &mov (&DWP(0,$key),$s0); # copy to temp | ||
| 2549 | &mov (&DWP(4,$key),$s1); | ||
| 2550 | &mov (&DWP(8,$key),$s2); | ||
| 2551 | &mov (&DWP(12,$key),$s3); | ||
| 2552 | |||
| 2553 | &mov ($key,$_key); # load key | ||
| 2554 | &call ("_x86_AES_decrypt_compact"); | ||
| 2555 | |||
| 2556 | &mov ($key,$_ivp); # load ivp | ||
| 2557 | &mov ($acc,$_len); # load len | ||
| 2558 | &xor ($s0,&DWP(0,$key)); # xor iv | ||
| 2559 | &xor ($s1,&DWP(4,$key)); | ||
| 2560 | &xor ($s2,&DWP(8,$key)); | ||
| 2561 | &xor ($s3,&DWP(12,$key)); | ||
| 2562 | |||
| 2563 | &sub ($acc,16); | ||
| 2564 | &jc (&label("slow_dec_partial_x86")); | ||
| 2565 | |||
| 2566 | &mov ($_len,$acc); # save len | ||
| 2567 | &mov ($acc,$_out); # load out | ||
| 2568 | |||
| 2569 | &mov (&DWP(0,$acc),$s0); # write output | ||
| 2570 | &mov (&DWP(4,$acc),$s1); | ||
| 2571 | &mov (&DWP(8,$acc),$s2); | ||
| 2572 | &mov (&DWP(12,$acc),$s3); | ||
| 2573 | |||
| 2574 | &lea ($acc,&DWP(16,$acc)); # advance out | ||
| 2575 | &mov ($_out,$acc); # save out | ||
| 2576 | |||
| 2577 | &lea ($acc,$ivec); | ||
| 2578 | &mov ($s0,&DWP(0,$acc)); # read temp | ||
| 2579 | &mov ($s1,&DWP(4,$acc)); | ||
| 2580 | &mov ($s2,&DWP(8,$acc)); | ||
| 2581 | &mov ($s3,&DWP(12,$acc)); | ||
| 2582 | |||
| 2583 | &mov (&DWP(0,$key),$s0); # copy it to iv | ||
| 2584 | &mov (&DWP(4,$key),$s1); | ||
| 2585 | &mov (&DWP(8,$key),$s2); | ||
| 2586 | &mov (&DWP(12,$key),$s3); | ||
| 2587 | |||
| 2588 | &mov ($acc,$_inp); # load inp | ||
| 2589 | &lea ($acc,&DWP(16,$acc)); # advance inp | ||
| 2590 | &mov ($_inp,$acc); # save inp | ||
| 2591 | &jnz (&label("slow_dec_loop_x86")); | ||
| 2592 | &mov ("esp",$_esp); | ||
| 2593 | &popf (); | ||
| 2594 | &function_end_A(); | ||
| 2595 | &pushf (); # kludge, never executed | ||
| 2596 | |||
| 2597 | &set_label("slow_dec_partial_x86",16); | ||
| 2598 | &lea ($acc,$ivec); | ||
| 2599 | &mov (&DWP(0,$acc),$s0); # save output to temp | ||
| 2600 | &mov (&DWP(4,$acc),$s1); | ||
| 2601 | &mov (&DWP(8,$acc),$s2); | ||
| 2602 | &mov (&DWP(12,$acc),$s3); | ||
| 2603 | |||
| 2604 | &mov ($acc,$_inp); | ||
| 2605 | &mov ($s0,&DWP(0,$acc)); # re-read input | ||
| 2606 | &mov ($s1,&DWP(4,$acc)); | ||
| 2607 | &mov ($s2,&DWP(8,$acc)); | ||
| 2608 | &mov ($s3,&DWP(12,$acc)); | ||
| 2609 | |||
| 2610 | &mov (&DWP(0,$key),$s0); # copy it to iv | ||
| 2611 | &mov (&DWP(4,$key),$s1); | ||
| 2612 | &mov (&DWP(8,$key),$s2); | ||
| 2613 | &mov (&DWP(12,$key),$s3); | ||
| 2614 | |||
| 2615 | &mov ("ecx",$_len); | ||
| 2616 | &mov ("edi",$_out); | ||
| 2617 | &lea ("esi",$ivec); | ||
| 2618 | &align (4); | ||
| 2619 | &data_word(0xA4F3F689); # rep movsb # copy partial output | ||
| 2620 | |||
| 2621 | &mov ("esp",$_esp); | ||
| 2622 | &popf (); | ||
| 1210 | &function_end("AES_cbc_encrypt"); | 2623 | &function_end("AES_cbc_encrypt"); |
| 1211 | } | 2624 | } |
| 1212 | 2625 | ||
| @@ -1215,35 +2628,31 @@ my $mark=&DWP(60+240,"esp"); #copy of aes_key->rounds | |||
| 1215 | sub enckey() | 2628 | sub enckey() |
| 1216 | { | 2629 | { |
| 1217 | &movz ("esi",&LB("edx")); # rk[i]>>0 | 2630 | &movz ("esi",&LB("edx")); # rk[i]>>0 |
| 1218 | &mov ("ebx",&DWP(2,"ebp","esi",8)); | 2631 | &movz ("ebx",&BP(-128,$tbl,"esi",1)); |
| 1219 | &movz ("esi",&HB("edx")); # rk[i]>>8 | 2632 | &movz ("esi",&HB("edx")); # rk[i]>>8 |
| 1220 | &and ("ebx",0xFF000000); | 2633 | &shl ("ebx",24); |
| 1221 | &xor ("eax","ebx"); | 2634 | &xor ("eax","ebx"); |
| 1222 | 2635 | ||
| 1223 | &mov ("ebx",&DWP(2,"ebp","esi",8)); | 2636 | &movz ("ebx",&BP(-128,$tbl,"esi",1)); |
| 1224 | &shr ("edx",16); | 2637 | &shr ("edx",16); |
| 1225 | &and ("ebx",0x000000FF); | ||
| 1226 | &movz ("esi",&LB("edx")); # rk[i]>>16 | 2638 | &movz ("esi",&LB("edx")); # rk[i]>>16 |
| 1227 | &xor ("eax","ebx"); | 2639 | &xor ("eax","ebx"); |
| 1228 | 2640 | ||
| 1229 | &mov ("ebx",&DWP(0,"ebp","esi",8)); | 2641 | &movz ("ebx",&BP(-128,$tbl,"esi",1)); |
| 1230 | &movz ("esi",&HB("edx")); # rk[i]>>24 | 2642 | &movz ("esi",&HB("edx")); # rk[i]>>24 |
| 1231 | &and ("ebx",0x0000FF00); | 2643 | &shl ("ebx",8); |
| 1232 | &xor ("eax","ebx"); | 2644 | &xor ("eax","ebx"); |
| 1233 | 2645 | ||
| 1234 | &mov ("ebx",&DWP(0,"ebp","esi",8)); | 2646 | &movz ("ebx",&BP(-128,$tbl,"esi",1)); |
| 1235 | &and ("ebx",0x00FF0000); | 2647 | &shl ("ebx",16); |
| 1236 | &xor ("eax","ebx"); | 2648 | &xor ("eax","ebx"); |
| 1237 | 2649 | ||
| 1238 | &xor ("eax",&DWP(2048,"ebp","ecx",4)); # rcon | 2650 | &xor ("eax",&DWP(1024-128,$tbl,"ecx",4)); # rcon |
| 1239 | } | 2651 | } |
| 1240 | 2652 | ||
| 1241 | # int AES_set_encrypt_key(const unsigned char *userKey, const int bits, | 2653 | &function_begin("_x86_AES_set_encrypt_key"); |
| 1242 | # AES_KEY *key) | 2654 | &mov ("esi",&wparam(1)); # user supplied key |
| 1243 | &public_label("AES_Te"); | 2655 | &mov ("edi",&wparam(3)); # private key schedule |
| 1244 | &function_begin("AES_set_encrypt_key", "", "_x86_AES_set_encrypt_key"); | ||
| 1245 | &mov ("esi",&wparam(0)); # user supplied key | ||
| 1246 | &mov ("edi",&wparam(2)); # private key schedule | ||
| 1247 | 2656 | ||
| 1248 | &test ("esi",-1); | 2657 | &test ("esi",-1); |
| 1249 | &jz (&label("badpointer")); | 2658 | &jz (&label("badpointer")); |
| @@ -1252,10 +2661,21 @@ sub enckey() | |||
| 1252 | 2661 | ||
| 1253 | &call (&label("pic_point")); | 2662 | &call (&label("pic_point")); |
| 1254 | &set_label("pic_point"); | 2663 | &set_label("pic_point"); |
| 1255 | &blindpop("ebp"); | 2664 | &blindpop($tbl); |
| 1256 | &lea ("ebp",&DWP(&label("AES_Te")."-".&label("pic_point"),"ebp")); | 2665 | &lea ($tbl,&DWP(&label("AES_Te")."-".&label("pic_point"),$tbl)); |
| 1257 | 2666 | &lea ($tbl,&DWP(2048+128,$tbl)); | |
| 1258 | &mov ("ecx",&wparam(1)); # number of bits in key | 2667 | |
| 2668 | # prefetch Te4 | ||
| 2669 | &mov ("eax",&DWP(0-128,$tbl)); | ||
| 2670 | &mov ("ebx",&DWP(32-128,$tbl)); | ||
| 2671 | &mov ("ecx",&DWP(64-128,$tbl)); | ||
| 2672 | &mov ("edx",&DWP(96-128,$tbl)); | ||
| 2673 | &mov ("eax",&DWP(128-128,$tbl)); | ||
| 2674 | &mov ("ebx",&DWP(160-128,$tbl)); | ||
| 2675 | &mov ("ecx",&DWP(192-128,$tbl)); | ||
| 2676 | &mov ("edx",&DWP(224-128,$tbl)); | ||
| 2677 | |||
| 2678 | &mov ("ecx",&wparam(2)); # number of bits in key | ||
| 1259 | &cmp ("ecx",128); | 2679 | &cmp ("ecx",128); |
| 1260 | &je (&label("10rounds")); | 2680 | &je (&label("10rounds")); |
| 1261 | &cmp ("ecx",192); | 2681 | &cmp ("ecx",192); |
| @@ -1394,24 +2814,23 @@ sub enckey() | |||
| 1394 | &mov ("edx","eax"); | 2814 | &mov ("edx","eax"); |
| 1395 | &mov ("eax",&DWP(16,"edi")); # rk[4] | 2815 | &mov ("eax",&DWP(16,"edi")); # rk[4] |
| 1396 | &movz ("esi",&LB("edx")); # rk[11]>>0 | 2816 | &movz ("esi",&LB("edx")); # rk[11]>>0 |
| 1397 | &mov ("ebx",&DWP(2,"ebp","esi",8)); | 2817 | &movz ("ebx",&BP(-128,$tbl,"esi",1)); |
| 1398 | &movz ("esi",&HB("edx")); # rk[11]>>8 | 2818 | &movz ("esi",&HB("edx")); # rk[11]>>8 |
| 1399 | &and ("ebx",0x000000FF); | ||
| 1400 | &xor ("eax","ebx"); | 2819 | &xor ("eax","ebx"); |
| 1401 | 2820 | ||
| 1402 | &mov ("ebx",&DWP(0,"ebp","esi",8)); | 2821 | &movz ("ebx",&BP(-128,$tbl,"esi",1)); |
| 1403 | &shr ("edx",16); | 2822 | &shr ("edx",16); |
| 1404 | &and ("ebx",0x0000FF00); | 2823 | &shl ("ebx",8); |
| 1405 | &movz ("esi",&LB("edx")); # rk[11]>>16 | 2824 | &movz ("esi",&LB("edx")); # rk[11]>>16 |
| 1406 | &xor ("eax","ebx"); | 2825 | &xor ("eax","ebx"); |
| 1407 | 2826 | ||
| 1408 | &mov ("ebx",&DWP(0,"ebp","esi",8)); | 2827 | &movz ("ebx",&BP(-128,$tbl,"esi",1)); |
| 1409 | &movz ("esi",&HB("edx")); # rk[11]>>24 | 2828 | &movz ("esi",&HB("edx")); # rk[11]>>24 |
| 1410 | &and ("ebx",0x00FF0000); | 2829 | &shl ("ebx",16); |
| 1411 | &xor ("eax","ebx"); | 2830 | &xor ("eax","ebx"); |
| 1412 | 2831 | ||
| 1413 | &mov ("ebx",&DWP(2,"ebp","esi",8)); | 2832 | &movz ("ebx",&BP(-128,$tbl,"esi",1)); |
| 1414 | &and ("ebx",0xFF000000); | 2833 | &shl ("ebx",24); |
| 1415 | &xor ("eax","ebx"); | 2834 | &xor ("eax","ebx"); |
| 1416 | 2835 | ||
| 1417 | &mov (&DWP(48,"edi"),"eax"); # rk[12] | 2836 | &mov (&DWP(48,"edi"),"eax"); # rk[12] |
| @@ -1433,43 +2852,74 @@ sub enckey() | |||
| 1433 | &set_label("badpointer"); | 2852 | &set_label("badpointer"); |
| 1434 | &mov ("eax",-1); | 2853 | &mov ("eax",-1); |
| 1435 | &set_label("exit"); | 2854 | &set_label("exit"); |
| 1436 | &function_end("AES_set_encrypt_key"); | 2855 | &function_end("_x86_AES_set_encrypt_key"); |
| 1437 | 2856 | ||
| 1438 | sub deckey() | 2857 | # int AES_set_encrypt_key(const unsigned char *userKey, const int bits, |
| 1439 | { my ($i,$ptr,$te,$td) = @_; | 2858 | # AES_KEY *key) |
| 2859 | &function_begin_B("AES_set_encrypt_key"); | ||
| 2860 | &call ("_x86_AES_set_encrypt_key"); | ||
| 2861 | &ret (); | ||
| 2862 | &function_end_B("AES_set_encrypt_key"); | ||
| 1440 | 2863 | ||
| 1441 | &mov ("eax",&DWP($i,$ptr)); | 2864 | sub deckey() |
| 1442 | &mov ("edx","eax"); | 2865 | { my ($i,$key,$tp1,$tp2,$tp4,$tp8) = @_; |
| 1443 | &movz ("ebx",&HB("eax")); | 2866 | my $tmp = $tbl; |
| 1444 | &shr ("edx",16); | 2867 | |
| 1445 | &and ("eax",0xFF); | 2868 | &mov ($acc,$tp1); |
| 1446 | &movz ("eax",&BP(2,$te,"eax",8)); | 2869 | &and ($acc,0x80808080); |
| 1447 | &movz ("ebx",&BP(2,$te,"ebx",8)); | 2870 | &mov ($tmp,$acc); |
| 1448 | &mov ("eax",&DWP(0,$td,"eax",8)); | 2871 | &shr ($tmp,7); |
| 1449 | &xor ("eax",&DWP(3,$td,"ebx",8)); | 2872 | &lea ($tp2,&DWP(0,$tp1,$tp1)); |
| 1450 | &movz ("ebx",&HB("edx")); | 2873 | &sub ($acc,$tmp); |
| 1451 | &and ("edx",0xFF); | 2874 | &and ($tp2,0xfefefefe); |
| 1452 | &movz ("edx",&BP(2,$te,"edx",8)); | 2875 | &and ($acc,0x1b1b1b1b); |
| 1453 | &movz ("ebx",&BP(2,$te,"ebx",8)); | 2876 | &xor ($acc,$tp2); |
| 1454 | &xor ("eax",&DWP(2,$td,"edx",8)); | 2877 | &mov ($tp2,$acc); |
| 1455 | &xor ("eax",&DWP(1,$td,"ebx",8)); | 2878 | |
| 1456 | &mov (&DWP($i,$ptr),"eax"); | 2879 | &and ($acc,0x80808080); |
| 2880 | &mov ($tmp,$acc); | ||
| 2881 | &shr ($tmp,7); | ||
| 2882 | &lea ($tp4,&DWP(0,$tp2,$tp2)); | ||
| 2883 | &sub ($acc,$tmp); | ||
| 2884 | &and ($tp4,0xfefefefe); | ||
| 2885 | &and ($acc,0x1b1b1b1b); | ||
| 2886 | &xor ($tp2,$tp1); # tp2^tp1 | ||
| 2887 | &xor ($acc,$tp4); | ||
| 2888 | &mov ($tp4,$acc); | ||
| 2889 | |||
| 2890 | &and ($acc,0x80808080); | ||
| 2891 | &mov ($tmp,$acc); | ||
| 2892 | &shr ($tmp,7); | ||
| 2893 | &lea ($tp8,&DWP(0,$tp4,$tp4)); | ||
| 2894 | &xor ($tp4,$tp1); # tp4^tp1 | ||
| 2895 | &sub ($acc,$tmp); | ||
| 2896 | &and ($tp8,0xfefefefe); | ||
| 2897 | &and ($acc,0x1b1b1b1b); | ||
| 2898 | &rotl ($tp1,8); # = ROTATE(tp1,8) | ||
| 2899 | &xor ($tp8,$acc); | ||
| 2900 | |||
| 2901 | &mov ($tmp,&DWP(4*($i+1),$key)); # modulo-scheduled load | ||
| 2902 | |||
| 2903 | &xor ($tp1,$tp2); | ||
| 2904 | &xor ($tp2,$tp8); | ||
| 2905 | &xor ($tp1,$tp4); | ||
| 2906 | &rotl ($tp2,24); | ||
| 2907 | &xor ($tp4,$tp8); | ||
| 2908 | &xor ($tp1,$tp8); # ^= tp8^(tp4^tp1)^(tp2^tp1) | ||
| 2909 | &rotl ($tp4,16); | ||
| 2910 | &xor ($tp1,$tp2); # ^= ROTATE(tp8^tp2^tp1,24) | ||
| 2911 | &rotl ($tp8,8); | ||
| 2912 | &xor ($tp1,$tp4); # ^= ROTATE(tp8^tp4^tp1,16) | ||
| 2913 | &mov ($tp2,$tmp); | ||
| 2914 | &xor ($tp1,$tp8); # ^= ROTATE(tp8,8) | ||
| 2915 | |||
| 2916 | &mov (&DWP(4*$i,$key),$tp1); | ||
| 1457 | } | 2917 | } |
| 1458 | 2918 | ||
| 1459 | # int AES_set_decrypt_key(const unsigned char *userKey, const int bits, | 2919 | # int AES_set_decrypt_key(const unsigned char *userKey, const int bits, |
| 1460 | # AES_KEY *key) | 2920 | # AES_KEY *key) |
| 1461 | &public_label("AES_Td"); | ||
| 1462 | &public_label("AES_Te"); | ||
| 1463 | &function_begin_B("AES_set_decrypt_key"); | 2921 | &function_begin_B("AES_set_decrypt_key"); |
| 1464 | &mov ("eax",&wparam(0)); | ||
| 1465 | &mov ("ecx",&wparam(1)); | ||
| 1466 | &mov ("edx",&wparam(2)); | ||
| 1467 | &sub ("esp",12); | ||
| 1468 | &mov (&DWP(0,"esp"),"eax"); | ||
| 1469 | &mov (&DWP(4,"esp"),"ecx"); | ||
| 1470 | &mov (&DWP(8,"esp"),"edx"); | ||
| 1471 | &call ("_x86_AES_set_encrypt_key"); | 2922 | &call ("_x86_AES_set_encrypt_key"); |
| 1472 | &add ("esp",12); | ||
| 1473 | &cmp ("eax",0); | 2923 | &cmp ("eax",0); |
| 1474 | &je (&label("proceed")); | 2924 | &je (&label("proceed")); |
| 1475 | &ret (); | 2925 | &ret (); |
| @@ -1485,8 +2935,7 @@ sub deckey() | |||
| 1485 | &lea ("ecx",&DWP(0,"","ecx",4)); | 2935 | &lea ("ecx",&DWP(0,"","ecx",4)); |
| 1486 | &lea ("edi",&DWP(0,"esi","ecx",4)); # pointer to last chunk | 2936 | &lea ("edi",&DWP(0,"esi","ecx",4)); # pointer to last chunk |
| 1487 | 2937 | ||
| 1488 | &align (4); | 2938 | &set_label("invert",4); # invert order of chunks |
| 1489 | &set_label("invert"); # invert order of chunks | ||
| 1490 | &mov ("eax",&DWP(0,"esi")); | 2939 | &mov ("eax",&DWP(0,"esi")); |
| 1491 | &mov ("ebx",&DWP(4,"esi")); | 2940 | &mov ("ebx",&DWP(4,"esi")); |
| 1492 | &mov ("ecx",&DWP(0,"edi")); | 2941 | &mov ("ecx",&DWP(0,"edi")); |
| @@ -1508,26 +2957,24 @@ sub deckey() | |||
| 1508 | &cmp ("esi","edi"); | 2957 | &cmp ("esi","edi"); |
| 1509 | &jne (&label("invert")); | 2958 | &jne (&label("invert")); |
| 1510 | 2959 | ||
| 1511 | &call (&label("pic_point")); | 2960 | &mov ($key,&wparam(2)); |
| 1512 | &set_label("pic_point"); | 2961 | &mov ($acc,&DWP(240,$key)); # pull number of rounds |
| 1513 | blindpop("ebp"); | 2962 | &lea ($acc,&DWP(-2,$acc,$acc)); |
| 1514 | &lea ("edi",&DWP(&label("AES_Td")."-".&label("pic_point"),"ebp")); | 2963 | &lea ($acc,&DWP(0,$key,$acc,8)); |
| 1515 | &lea ("ebp",&DWP(&label("AES_Te")."-".&label("pic_point"),"ebp")); | 2964 | &mov (&wparam(2),$acc); |
| 1516 | 2965 | ||
| 1517 | &mov ("esi",&wparam(2)); | 2966 | &mov ($s0,&DWP(16,$key)); # modulo-scheduled load |
| 1518 | &mov ("ecx",&DWP(240,"esi")); # pull number of rounds | 2967 | &set_label("permute",4); # permute the key schedule |
| 1519 | &dec ("ecx"); | 2968 | &add ($key,16); |
| 1520 | &align (4); | 2969 | &deckey (0,$key,$s0,$s1,$s2,$s3); |
| 1521 | &set_label("permute"); # permute the key schedule | 2970 | &deckey (1,$key,$s1,$s2,$s3,$s0); |
| 1522 | &add ("esi",16); | 2971 | &deckey (2,$key,$s2,$s3,$s0,$s1); |
| 1523 | &deckey (0,"esi","ebp","edi"); | 2972 | &deckey (3,$key,$s3,$s0,$s1,$s2); |
| 1524 | &deckey (4,"esi","ebp","edi"); | 2973 | &cmp ($key,&wparam(2)); |
| 1525 | &deckey (8,"esi","ebp","edi"); | 2974 | &jb (&label("permute")); |
| 1526 | &deckey (12,"esi","ebp","edi"); | ||
| 1527 | &dec ("ecx"); | ||
| 1528 | &jnz (&label("permute")); | ||
| 1529 | 2975 | ||
| 1530 | &xor ("eax","eax"); # return success | 2976 | &xor ("eax","eax"); # return success |
| 1531 | &function_end("AES_set_decrypt_key"); | 2977 | &function_end("AES_set_decrypt_key"); |
| 2978 | &asciz("AES for x86, CRYPTOGAMS by <appro\@openssl.org>"); | ||
| 1532 | 2979 | ||
| 1533 | &asm_finish(); | 2980 | &asm_finish(); |
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.ssl b/src/lib/libcrypto/asn1/Makefile.ssl deleted file mode 100644 index cb45194d48..0000000000 --- a/src/lib/libcrypto/asn1/Makefile.ssl +++ /dev/null | |||
| @@ -1,1152 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/asn1/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= asn1 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile README | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \ | ||
| 27 | a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \ | ||
| 28 | a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \ | ||
| 29 | x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c \ | ||
| 30 | x_long.c x_name.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c \ | ||
| 31 | d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\ | ||
| 32 | t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \ | ||
| 33 | tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \ | ||
| 34 | f_int.c f_string.c n_pkey.c \ | ||
| 35 | f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c \ | ||
| 36 | asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c a_strnid.c \ | ||
| 37 | evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c | ||
| 38 | LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \ | ||
| 39 | a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \ | ||
| 40 | a_enum.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \ | ||
| 41 | x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_bignum.o \ | ||
| 42 | x_long.o x_name.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.o \ | ||
| 43 | d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \ | ||
| 44 | t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \ | ||
| 45 | tasn_new.o tasn_fre.o tasn_enc.o tasn_dec.o tasn_utl.o tasn_typ.o \ | ||
| 46 | f_int.o f_string.o n_pkey.o \ | ||
| 47 | f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o \ | ||
| 48 | asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o a_strnid.o \ | ||
| 49 | evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o asn_moid.o | ||
| 50 | |||
| 51 | SRC= $(LIBSRC) | ||
| 52 | |||
| 53 | EXHEADER= asn1.h asn1_mac.h asn1t.h | ||
| 54 | HEADER= $(EXHEADER) | ||
| 55 | |||
| 56 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 57 | |||
| 58 | top: | ||
| 59 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 60 | |||
| 61 | test: test.c | ||
| 62 | cc -g -I../../include -c test.c | ||
| 63 | cc -g -I../../include -o test test.o -L../.. -lcrypto | ||
| 64 | |||
| 65 | pk: pk.c | ||
| 66 | cc -g -I../../include -c pk.c | ||
| 67 | cc -g -I../../include -o pk pk.o -L../.. -lcrypto | ||
| 68 | |||
| 69 | all: lib | ||
| 70 | |||
| 71 | lib: $(LIBOBJ) | ||
| 72 | $(AR) $(LIB) $(LIBOBJ) | ||
| 73 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 74 | @touch lib | ||
| 75 | |||
| 76 | files: | ||
| 77 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 78 | |||
| 79 | links: | ||
| 80 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 81 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 82 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 83 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 84 | |||
| 85 | install: | ||
| 86 | @for i in $(EXHEADER) ; \ | ||
| 87 | do \ | ||
| 88 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 89 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 90 | done; | ||
| 91 | |||
| 92 | tags: | ||
| 93 | ctags $(SRC) | ||
| 94 | |||
| 95 | tests: | ||
| 96 | |||
| 97 | lint: | ||
| 98 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 99 | |||
| 100 | depend: | ||
| 101 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 102 | |||
| 103 | dclean: | ||
| 104 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 105 | mv -f Makefile.new $(MAKEFILE) | ||
| 106 | |||
| 107 | clean: | ||
| 108 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 109 | |||
| 110 | |||
| 111 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 112 | |||
| 113 | a_bitstr.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 114 | a_bitstr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 115 | a_bitstr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 116 | a_bitstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 117 | a_bitstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 118 | a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 119 | a_bitstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 120 | a_bitstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bitstr.c | ||
| 121 | a_bool.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 122 | a_bool.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 123 | a_bool.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 124 | a_bool.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 125 | a_bool.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 126 | a_bool.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 127 | a_bool.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 128 | a_bool.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 129 | a_bool.o: ../cryptlib.h a_bool.c | ||
| 130 | a_bytes.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 131 | a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 132 | a_bytes.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 133 | a_bytes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 134 | a_bytes.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 135 | a_bytes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 136 | a_bytes.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 137 | a_bytes.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bytes.c | ||
| 138 | a_d2i_fp.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 139 | a_d2i_fp.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 140 | a_d2i_fp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 141 | a_d2i_fp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 142 | a_d2i_fp.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 143 | a_d2i_fp.o: ../../include/openssl/opensslconf.h | ||
| 144 | a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 145 | a_d2i_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 146 | a_d2i_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_d2i_fp.c | ||
| 147 | a_digest.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 148 | a_digest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 149 | a_digest.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 150 | a_digest.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 151 | a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 152 | a_digest.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 153 | a_digest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 154 | a_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 155 | a_digest.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 156 | a_digest.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 157 | a_digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 158 | a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 159 | a_digest.o: ../../include/openssl/opensslconf.h | ||
| 160 | a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 161 | a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 162 | a_digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 163 | a_digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 164 | a_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 165 | a_digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 166 | a_digest.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 167 | a_digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 168 | a_digest.o: ../cryptlib.h a_digest.c | ||
| 169 | a_dup.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 170 | a_dup.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 171 | a_dup.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 172 | a_dup.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 173 | a_dup.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 174 | a_dup.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 175 | a_dup.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 176 | a_dup.o: ../cryptlib.h a_dup.c | ||
| 177 | a_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 178 | a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 179 | a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 180 | a_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 181 | a_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 182 | a_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 183 | a_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 184 | a_enum.o: ../cryptlib.h a_enum.c | ||
| 185 | a_gentm.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 186 | a_gentm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 187 | a_gentm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 188 | a_gentm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 189 | a_gentm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 190 | a_gentm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 191 | a_gentm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 192 | a_gentm.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_gentm.c | ||
| 193 | a_hdr.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 194 | a_hdr.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 195 | a_hdr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 196 | a_hdr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 197 | a_hdr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 198 | a_hdr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 199 | a_hdr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 200 | a_hdr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 201 | a_hdr.o: ../cryptlib.h a_hdr.c | ||
| 202 | a_i2d_fp.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 203 | a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 204 | a_i2d_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 205 | a_i2d_fp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 206 | a_i2d_fp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 207 | a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 208 | a_i2d_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 209 | a_i2d_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_i2d_fp.c | ||
| 210 | a_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 211 | a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 212 | a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 213 | a_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 214 | a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 215 | a_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 216 | a_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 217 | a_int.o: ../cryptlib.h a_int.c | ||
| 218 | a_mbstr.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 219 | a_mbstr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 220 | a_mbstr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 221 | a_mbstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 222 | a_mbstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 223 | a_mbstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 224 | a_mbstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 225 | a_mbstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_mbstr.c | ||
| 226 | a_meth.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 227 | a_meth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 228 | a_meth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 229 | a_meth.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 230 | a_meth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 231 | a_meth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 232 | a_meth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 233 | a_meth.o: ../cryptlib.h a_meth.c | ||
| 234 | a_object.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 235 | a_object.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 236 | a_object.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 237 | a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 238 | a_object.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 239 | a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 240 | a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 241 | a_object.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 242 | a_object.o: ../../include/openssl/symhacks.h ../cryptlib.h a_object.c | ||
| 243 | a_octet.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 244 | a_octet.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 245 | a_octet.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 246 | a_octet.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 247 | a_octet.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 248 | a_octet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 249 | a_octet.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 250 | a_octet.o: ../../include/openssl/symhacks.h ../cryptlib.h a_octet.c | ||
| 251 | a_print.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 252 | a_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 253 | a_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 254 | a_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 255 | a_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 256 | a_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 257 | a_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 258 | a_print.o: ../../include/openssl/symhacks.h ../cryptlib.h a_print.c | ||
| 259 | a_set.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 260 | a_set.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 261 | a_set.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 262 | a_set.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 263 | a_set.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 264 | a_set.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 265 | a_set.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 266 | a_set.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 267 | a_set.o: ../cryptlib.h a_set.c | ||
| 268 | a_sign.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 269 | a_sign.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 270 | a_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 271 | a_sign.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 272 | a_sign.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 273 | a_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 274 | a_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 275 | a_sign.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 276 | a_sign.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 277 | a_sign.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 278 | a_sign.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 279 | a_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 280 | a_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 281 | a_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 282 | a_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 283 | a_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 284 | a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 285 | a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 286 | a_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 287 | a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 288 | a_sign.o: ../cryptlib.h a_sign.c | ||
| 289 | a_strex.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 290 | a_strex.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 291 | a_strex.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 292 | a_strex.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 293 | a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 294 | a_strex.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 295 | a_strex.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 296 | a_strex.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 297 | a_strex.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 298 | a_strex.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 299 | a_strex.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 300 | a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 301 | a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 302 | a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 303 | a_strex.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 304 | a_strex.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 305 | a_strex.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 306 | a_strex.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 307 | a_strex.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 308 | a_strex.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 309 | a_strex.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_strex.c charmap.h | ||
| 310 | a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 311 | a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 312 | a_strnid.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 313 | a_strnid.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 314 | a_strnid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 315 | a_strnid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 316 | a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 317 | a_strnid.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 318 | a_strnid.o: ../../include/openssl/symhacks.h ../cryptlib.h a_strnid.c | ||
| 319 | a_time.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 320 | a_time.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 321 | a_time.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 322 | a_time.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 323 | a_time.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 324 | a_time.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 325 | a_time.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 326 | a_time.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 327 | a_time.o: ../cryptlib.h ../o_time.h a_time.c | ||
| 328 | a_type.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 329 | a_type.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 330 | a_type.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 331 | a_type.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 332 | a_type.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 333 | a_type.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 334 | a_type.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 335 | a_type.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 336 | a_type.o: ../cryptlib.h a_type.c | ||
| 337 | a_utctm.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 338 | a_utctm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 339 | a_utctm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 340 | a_utctm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 341 | a_utctm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 342 | a_utctm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 343 | a_utctm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 344 | a_utctm.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_utctm.c | ||
| 345 | a_utf8.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 346 | a_utf8.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 347 | a_utf8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 348 | a_utf8.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 349 | a_utf8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 350 | a_utf8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 351 | a_utf8.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 352 | a_utf8.o: ../cryptlib.h a_utf8.c | ||
| 353 | a_verify.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 354 | a_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 355 | a_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 356 | a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 357 | a_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 358 | a_verify.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 359 | a_verify.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 360 | a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 361 | a_verify.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 362 | a_verify.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 363 | a_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 364 | a_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 365 | a_verify.o: ../../include/openssl/opensslconf.h | ||
| 366 | a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 367 | a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 368 | a_verify.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 369 | a_verify.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 370 | a_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 371 | a_verify.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 372 | a_verify.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 373 | a_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 374 | a_verify.o: ../cryptlib.h a_verify.c | ||
| 375 | asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 376 | asn1_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 377 | asn1_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 378 | asn1_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 379 | asn1_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 380 | asn1_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 381 | asn1_err.o: ../../include/openssl/symhacks.h asn1_err.c | ||
| 382 | asn1_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 383 | asn1_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 384 | asn1_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 385 | asn1_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 386 | asn1_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 387 | asn1_lib.o: ../../include/openssl/opensslconf.h | ||
| 388 | asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 389 | asn1_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 390 | asn1_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_lib.c | ||
| 391 | asn1_par.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 392 | asn1_par.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 393 | asn1_par.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 394 | asn1_par.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 395 | asn1_par.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 396 | asn1_par.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 397 | asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 398 | asn1_par.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 399 | asn1_par.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_par.c | ||
| 400 | asn_moid.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 401 | asn_moid.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 402 | asn_moid.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 403 | asn_moid.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 404 | asn_moid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 405 | asn_moid.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 406 | asn_moid.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 407 | asn_moid.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 408 | asn_moid.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 409 | asn_moid.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 410 | asn_moid.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 411 | asn_moid.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 412 | asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 413 | asn_moid.o: ../../include/openssl/opensslconf.h | ||
| 414 | asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 415 | asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 416 | asn_moid.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 417 | asn_moid.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 418 | asn_moid.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 419 | asn_moid.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 420 | asn_moid.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 421 | asn_moid.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 422 | asn_moid.o: ../cryptlib.h asn_moid.c | ||
| 423 | asn_pack.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 424 | asn_pack.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 425 | asn_pack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 426 | asn_pack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 427 | asn_pack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 428 | asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 429 | asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 430 | asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c | ||
| 431 | d2i_pr.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 432 | d2i_pr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 433 | d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 434 | d2i_pr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 435 | d2i_pr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 436 | d2i_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 437 | d2i_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 438 | d2i_pr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 439 | d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 440 | d2i_pr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 441 | d2i_pr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 442 | d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 443 | d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 444 | d2i_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 445 | d2i_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 446 | d2i_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 447 | d2i_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 448 | d2i_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 449 | d2i_pr.o: ../../include/openssl/ui_compat.h ../cryptlib.h d2i_pr.c | ||
| 450 | d2i_pu.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 451 | d2i_pu.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 452 | d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 453 | d2i_pu.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 454 | d2i_pu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 455 | d2i_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 456 | d2i_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 457 | d2i_pu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 458 | d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 459 | d2i_pu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 460 | d2i_pu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 461 | d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 462 | d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 463 | d2i_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 464 | d2i_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 465 | d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 466 | d2i_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 467 | d2i_pu.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 468 | d2i_pu.o: ../../include/openssl/ui_compat.h ../cryptlib.h d2i_pu.c | ||
| 469 | evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 470 | evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 471 | evp_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 472 | evp_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 473 | evp_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 474 | evp_asn1.o: ../../include/openssl/opensslconf.h | ||
| 475 | evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 476 | evp_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 477 | evp_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_asn1.c | ||
| 478 | f_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 479 | f_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 480 | f_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 481 | f_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 482 | f_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 483 | f_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 484 | f_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 485 | f_enum.o: ../cryptlib.h f_enum.c | ||
| 486 | f_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 487 | f_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 488 | f_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 489 | f_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 490 | f_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 491 | f_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 492 | f_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 493 | f_int.o: ../cryptlib.h f_int.c | ||
| 494 | f_string.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 495 | f_string.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 496 | f_string.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 497 | f_string.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 498 | f_string.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 499 | f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 500 | f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 501 | f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c | ||
| 502 | i2d_pr.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 503 | i2d_pr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 504 | i2d_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 505 | i2d_pr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 506 | i2d_pr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 507 | i2d_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 508 | i2d_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 509 | i2d_pr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 510 | i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 511 | i2d_pr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 512 | i2d_pr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 513 | i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 514 | i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 515 | i2d_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 516 | i2d_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 517 | i2d_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 518 | i2d_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 519 | i2d_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 520 | i2d_pr.o: ../../include/openssl/ui_compat.h ../cryptlib.h i2d_pr.c | ||
| 521 | i2d_pu.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 522 | i2d_pu.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 523 | i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 524 | i2d_pu.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 525 | i2d_pu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 526 | i2d_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 527 | i2d_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 528 | i2d_pu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 529 | i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 530 | i2d_pu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 531 | i2d_pu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 532 | i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 533 | i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 534 | i2d_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 535 | i2d_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 536 | i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 537 | i2d_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 538 | i2d_pu.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 539 | i2d_pu.o: ../../include/openssl/ui_compat.h ../cryptlib.h i2d_pu.c | ||
| 540 | n_pkey.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 541 | n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h | ||
| 542 | n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 543 | n_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 544 | n_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 545 | n_pkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 546 | n_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 547 | n_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 548 | n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 549 | n_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 550 | n_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 551 | n_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 552 | n_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 553 | n_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 554 | n_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 555 | n_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 556 | n_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 557 | n_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 558 | n_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 559 | n_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 560 | n_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 561 | n_pkey.o: ../cryptlib.h n_pkey.c | ||
| 562 | nsseq.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 563 | nsseq.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 564 | nsseq.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 565 | nsseq.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 566 | nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 567 | nsseq.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 568 | nsseq.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 569 | nsseq.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 570 | nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 571 | nsseq.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 572 | nsseq.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 573 | nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 574 | nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 575 | nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 576 | nsseq.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 577 | nsseq.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 578 | nsseq.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 579 | nsseq.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 580 | nsseq.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 581 | nsseq.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h nsseq.c | ||
| 582 | p5_pbe.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 583 | p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 584 | p5_pbe.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 585 | p5_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 586 | p5_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 587 | p5_pbe.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 588 | p5_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 589 | p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 590 | p5_pbe.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 591 | p5_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 592 | p5_pbe.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 593 | p5_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 594 | p5_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 595 | p5_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 596 | p5_pbe.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 597 | p5_pbe.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 598 | p5_pbe.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 599 | p5_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 600 | p5_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 601 | p5_pbe.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 602 | p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 603 | p5_pbe.o: ../cryptlib.h p5_pbe.c | ||
| 604 | p5_pbev2.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 605 | p5_pbev2.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 606 | p5_pbev2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 607 | p5_pbev2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 608 | p5_pbev2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 609 | p5_pbev2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 610 | p5_pbev2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 611 | p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 612 | p5_pbev2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 613 | p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 614 | p5_pbev2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 615 | p5_pbev2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 616 | p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 617 | p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 618 | p5_pbev2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 619 | p5_pbev2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 620 | p5_pbev2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 621 | p5_pbev2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 622 | p5_pbev2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 623 | p5_pbev2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 624 | p5_pbev2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 625 | p5_pbev2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_pbev2.c | ||
| 626 | p8_pkey.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 627 | p8_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 628 | p8_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 629 | p8_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 630 | p8_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 631 | p8_pkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 632 | p8_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 633 | p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 634 | p8_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 635 | p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 636 | p8_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 637 | p8_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 638 | p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 639 | p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 640 | p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 641 | p8_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 642 | p8_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 643 | p8_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 644 | p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 645 | p8_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 646 | p8_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 647 | p8_pkey.o: ../cryptlib.h p8_pkey.c | ||
| 648 | t_bitst.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 649 | t_bitst.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 650 | t_bitst.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 651 | t_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 652 | t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 653 | t_bitst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 654 | t_bitst.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 655 | t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 656 | t_bitst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 657 | t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 658 | t_bitst.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 659 | t_bitst.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 660 | t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 661 | t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 662 | t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 663 | t_bitst.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 664 | t_bitst.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 665 | t_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 666 | t_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 667 | t_bitst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 668 | t_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 669 | t_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h t_bitst.c | ||
| 670 | t_crl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 671 | t_crl.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 672 | t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 673 | t_crl.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 674 | t_crl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 675 | t_crl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 676 | t_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 677 | t_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 678 | t_crl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 679 | t_crl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 680 | t_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 681 | t_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 682 | t_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 683 | t_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 684 | t_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 685 | t_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 686 | t_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 687 | t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 688 | t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 689 | t_crl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 690 | t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 691 | t_crl.o: ../cryptlib.h t_crl.c | ||
| 692 | t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 693 | t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 694 | t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 695 | t_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 696 | t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 697 | t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 698 | t_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h | ||
| 699 | t_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 700 | t_pkey.o: ../../include/openssl/symhacks.h ../cryptlib.h t_pkey.c | ||
| 701 | t_req.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 702 | t_req.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 703 | t_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 704 | t_req.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 705 | t_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 706 | t_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 707 | t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 708 | t_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 709 | t_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 710 | t_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 711 | t_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 712 | t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 713 | t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 714 | t_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 715 | t_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 716 | t_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 717 | t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 718 | t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 719 | t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 720 | t_req.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 721 | t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 722 | t_req.o: ../cryptlib.h t_req.c | ||
| 723 | t_spki.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 724 | t_spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 725 | t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 726 | t_spki.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 727 | t_spki.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 728 | t_spki.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 729 | t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 730 | t_spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 731 | t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 732 | t_spki.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 733 | t_spki.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 734 | t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 735 | t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 736 | t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 737 | t_spki.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 738 | t_spki.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 739 | t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 740 | t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 741 | t_spki.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 742 | t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 743 | t_spki.o: ../cryptlib.h t_spki.c | ||
| 744 | t_x509.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 745 | t_x509.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 746 | t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 747 | t_x509.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 748 | t_x509.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 749 | t_x509.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 750 | t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 751 | t_x509.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 752 | t_x509.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 753 | t_x509.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 754 | t_x509.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 755 | t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 756 | t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 757 | t_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 758 | t_x509.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 759 | t_x509.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 760 | t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 761 | t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 762 | t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 763 | t_x509.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 764 | t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 765 | t_x509.o: ../cryptlib.h t_x509.c | ||
| 766 | t_x509a.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 767 | t_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 768 | t_x509a.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 769 | t_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 770 | t_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 771 | t_x509a.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 772 | t_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 773 | t_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 774 | t_x509a.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 775 | t_x509a.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 776 | t_x509a.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 777 | t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 778 | t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 779 | t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 780 | t_x509a.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 781 | t_x509a.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 782 | t_x509a.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 783 | t_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 784 | t_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 785 | t_x509a.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 786 | t_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h t_x509a.c | ||
| 787 | tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 788 | tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 789 | tasn_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 790 | tasn_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 791 | tasn_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 792 | tasn_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 793 | tasn_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 794 | tasn_dec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 795 | tasn_dec.o: ../../include/openssl/symhacks.h tasn_dec.c | ||
| 796 | tasn_enc.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 797 | tasn_enc.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 798 | tasn_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 799 | tasn_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 800 | tasn_enc.o: ../../include/openssl/opensslconf.h | ||
| 801 | tasn_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 802 | tasn_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 803 | tasn_enc.o: ../../include/openssl/symhacks.h tasn_enc.c | ||
| 804 | tasn_fre.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 805 | tasn_fre.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 806 | tasn_fre.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 807 | tasn_fre.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 808 | tasn_fre.o: ../../include/openssl/opensslconf.h | ||
| 809 | tasn_fre.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 810 | tasn_fre.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 811 | tasn_fre.o: ../../include/openssl/symhacks.h tasn_fre.c | ||
| 812 | tasn_new.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 813 | tasn_new.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 814 | tasn_new.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 815 | tasn_new.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 816 | tasn_new.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 817 | tasn_new.o: ../../include/openssl/opensslconf.h | ||
| 818 | tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 819 | tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 820 | tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c | ||
| 821 | tasn_typ.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 822 | tasn_typ.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 823 | tasn_typ.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 824 | tasn_typ.o: ../../include/openssl/opensslconf.h | ||
| 825 | tasn_typ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 826 | tasn_typ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 827 | tasn_typ.o: ../../include/openssl/symhacks.h tasn_typ.c | ||
| 828 | tasn_utl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 829 | tasn_utl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 830 | tasn_utl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 831 | tasn_utl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 832 | tasn_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 833 | tasn_utl.o: ../../include/openssl/opensslconf.h | ||
| 834 | tasn_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 835 | tasn_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 836 | tasn_utl.o: ../../include/openssl/symhacks.h tasn_utl.c | ||
| 837 | x_algor.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 838 | x_algor.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 839 | x_algor.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 840 | x_algor.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 841 | x_algor.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 842 | x_algor.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 843 | x_algor.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 844 | x_algor.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 845 | x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 846 | x_algor.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 847 | x_algor.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 848 | x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 849 | x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 850 | x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 851 | x_algor.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 852 | x_algor.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 853 | x_algor.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 854 | x_algor.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 855 | x_algor.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 856 | x_algor.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 857 | x_algor.o: x_algor.c | ||
| 858 | x_attrib.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 859 | x_attrib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 860 | x_attrib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 861 | x_attrib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 862 | x_attrib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 863 | x_attrib.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 864 | x_attrib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 865 | x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 866 | x_attrib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 867 | x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 868 | x_attrib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 869 | x_attrib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 870 | x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 871 | x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 872 | x_attrib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 873 | x_attrib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 874 | x_attrib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 875 | x_attrib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 876 | x_attrib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 877 | x_attrib.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 878 | x_attrib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 879 | x_attrib.o: ../cryptlib.h x_attrib.c | ||
| 880 | x_bignum.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 881 | x_bignum.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 882 | x_bignum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 883 | x_bignum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 884 | x_bignum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 885 | x_bignum.o: ../../include/openssl/opensslconf.h | ||
| 886 | x_bignum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 887 | x_bignum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 888 | x_bignum.o: ../../include/openssl/symhacks.h ../cryptlib.h x_bignum.c | ||
| 889 | x_crl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 890 | x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 891 | x_crl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 892 | x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 893 | x_crl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 894 | x_crl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 895 | x_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 896 | x_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 897 | x_crl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 898 | x_crl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 899 | x_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 900 | x_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 901 | x_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 902 | x_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 903 | x_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 904 | x_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 905 | x_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 906 | x_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 907 | x_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 908 | x_crl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 909 | x_crl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_crl.c | ||
| 910 | x_exten.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 911 | x_exten.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 912 | x_exten.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 913 | x_exten.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 914 | x_exten.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 915 | x_exten.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 916 | x_exten.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 917 | x_exten.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 918 | x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 919 | x_exten.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 920 | x_exten.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 921 | x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 922 | x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 923 | x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 924 | x_exten.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 925 | x_exten.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 926 | x_exten.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 927 | x_exten.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 928 | x_exten.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 929 | x_exten.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 930 | x_exten.o: x_exten.c | ||
| 931 | x_info.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 932 | x_info.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 933 | x_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 934 | x_info.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 935 | x_info.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 936 | x_info.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 937 | x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 938 | x_info.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 939 | x_info.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 940 | x_info.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 941 | x_info.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 942 | x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 943 | x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 944 | x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 945 | x_info.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 946 | x_info.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 947 | x_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 948 | x_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 949 | x_info.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 950 | x_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 951 | x_info.o: ../cryptlib.h x_info.c | ||
| 952 | x_long.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 953 | x_long.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 954 | x_long.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 955 | x_long.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 956 | x_long.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 957 | x_long.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 958 | x_long.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 959 | x_long.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 960 | x_long.o: ../cryptlib.h x_long.c | ||
| 961 | x_name.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 962 | x_name.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 963 | x_name.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 964 | x_name.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 965 | x_name.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 966 | x_name.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 967 | x_name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 968 | x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 969 | x_name.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 970 | x_name.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 971 | x_name.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 972 | x_name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 973 | x_name.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 974 | x_name.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 975 | x_name.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 976 | x_name.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 977 | x_name.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 978 | x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 979 | x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 980 | x_name.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 981 | x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_name.c | ||
| 982 | x_pkey.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 983 | x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 984 | x_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 985 | x_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 986 | x_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 987 | x_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 988 | x_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 989 | x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 990 | x_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 991 | x_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 992 | x_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 993 | x_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 994 | x_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 995 | x_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 996 | x_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 997 | x_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 998 | x_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 999 | x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 1000 | x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 1001 | x_pkey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 1002 | x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_pkey.c | ||
| 1003 | x_pubkey.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 1004 | x_pubkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 1005 | x_pubkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 1006 | x_pubkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 1007 | x_pubkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 1008 | x_pubkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 1009 | x_pubkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 1010 | x_pubkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 1011 | x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 1012 | x_pubkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 1013 | x_pubkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 1014 | x_pubkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 1015 | x_pubkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 1016 | x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 1017 | x_pubkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 1018 | x_pubkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 1019 | x_pubkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 1020 | x_pubkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 1021 | x_pubkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 1022 | x_pubkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 1023 | x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 1024 | x_pubkey.o: ../cryptlib.h x_pubkey.c | ||
| 1025 | x_req.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 1026 | x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 1027 | x_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 1028 | x_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 1029 | x_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 1030 | x_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 1031 | x_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 1032 | x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 1033 | x_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 1034 | x_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 1035 | x_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 1036 | x_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 1037 | x_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 1038 | x_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 1039 | x_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 1040 | x_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 1041 | x_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 1042 | x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 1043 | x_req.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 1044 | x_req.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 1045 | x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_req.c | ||
| 1046 | x_sig.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 1047 | x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 1048 | x_sig.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 1049 | x_sig.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 1050 | x_sig.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 1051 | x_sig.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 1052 | x_sig.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 1053 | x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 1054 | x_sig.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 1055 | x_sig.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 1056 | x_sig.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 1057 | x_sig.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 1058 | x_sig.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 1059 | x_sig.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 1060 | x_sig.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 1061 | x_sig.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 1062 | x_sig.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 1063 | x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 1064 | x_sig.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 1065 | x_sig.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 1066 | x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_sig.c | ||
| 1067 | x_spki.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 1068 | x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 1069 | x_spki.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 1070 | x_spki.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 1071 | x_spki.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 1072 | x_spki.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 1073 | x_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 1074 | x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 1075 | x_spki.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 1076 | x_spki.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 1077 | x_spki.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 1078 | x_spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 1079 | x_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 1080 | x_spki.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 1081 | x_spki.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 1082 | x_spki.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 1083 | x_spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 1084 | x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 1085 | x_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 1086 | x_spki.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 1087 | x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_spki.c | ||
| 1088 | x_val.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 1089 | x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 1090 | x_val.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 1091 | x_val.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 1092 | x_val.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 1093 | x_val.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 1094 | x_val.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 1095 | x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 1096 | x_val.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 1097 | x_val.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 1098 | x_val.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 1099 | x_val.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 1100 | x_val.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 1101 | x_val.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 1102 | x_val.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 1103 | x_val.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 1104 | x_val.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 1105 | x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 1106 | x_val.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 1107 | x_val.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 1108 | x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_val.c | ||
| 1109 | x_x509.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 1110 | x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 1111 | x_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 1112 | x_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 1113 | x_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 1114 | x_x509.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 1115 | x_x509.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 1116 | x_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 1117 | x_x509.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 1118 | x_x509.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 1119 | x_x509.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 1120 | x_x509.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 1121 | x_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 1122 | x_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 1123 | x_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 1124 | x_x509.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 1125 | x_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 1126 | x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 1127 | x_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 1128 | x_x509.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 1129 | x_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 1130 | x_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h x_x509.c | ||
| 1131 | x_x509a.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 1132 | x_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 1133 | x_x509a.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 1134 | x_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 1135 | x_x509a.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 1136 | x_x509a.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 1137 | x_x509a.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 1138 | x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 1139 | x_x509a.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 1140 | x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 1141 | x_x509a.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 1142 | x_x509a.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 1143 | x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 1144 | x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 1145 | x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 1146 | x_x509a.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 1147 | x_x509a.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 1148 | x_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 1149 | x_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 1150 | x_x509a.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 1151 | x_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 1152 | x_x509a.o: ../cryptlib.h x_x509a.c | ||
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index 0fb9ce0c2a..34179960b8 100644 --- a/src/lib/libcrypto/asn1/a_bitstr.c +++ b/src/lib/libcrypto/asn1/a_bitstr.c | |||
| @@ -223,3 +223,26 @@ int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n) | |||
| 223 | return((a->data[w]&v) != 0); | 223 | return((a->data[w]&v) != 0); |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | /* | ||
| 227 | * Checks if the given bit string contains only bits specified by | ||
| 228 | * the flags vector. Returns 0 if there is at least one bit set in 'a' | ||
| 229 | * which is not specified in 'flags', 1 otherwise. | ||
| 230 | * 'len' is the length of 'flags'. | ||
| 231 | */ | ||
| 232 | int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, | ||
| 233 | unsigned char *flags, int flags_len) | ||
| 234 | { | ||
| 235 | int i, ok; | ||
| 236 | /* Check if there is one bit set at all. */ | ||
| 237 | if (!a || !a->data) return 1; | ||
| 238 | |||
| 239 | /* Check each byte of the internal representation of the bit string. */ | ||
| 240 | ok = 1; | ||
| 241 | for (i = 0; i < a->length && ok; ++i) | ||
| 242 | { | ||
| 243 | unsigned char mask = i < flags_len ? ~flags[i] : 0xff; | ||
| 244 | /* We are done if there is an unneeded bit set. */ | ||
| 245 | ok = (a->data[i] & mask) == 0; | ||
| 246 | } | ||
| 247 | return ok; | ||
| 248 | } | ||
diff --git a/src/lib/libcrypto/asn1/a_dup.c b/src/lib/libcrypto/asn1/a_dup.c index 199d50f521..d98992548a 100644 --- a/src/lib/libcrypto/asn1/a_dup.c +++ b/src/lib/libcrypto/asn1/a_dup.c | |||
| @@ -62,7 +62,7 @@ | |||
| 62 | 62 | ||
| 63 | #ifndef NO_OLD_ASN1 | 63 | #ifndef NO_OLD_ASN1 |
| 64 | 64 | ||
| 65 | void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x) | 65 | void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x) |
| 66 | { | 66 | { |
| 67 | unsigned char *b,*p; | 67 | unsigned char *b,*p; |
| 68 | const unsigned char *p2; | 68 | const unsigned char *p2; |
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c index def79062a5..c79c6f538c 100644 --- a/src/lib/libcrypto/asn1/a_gentm.c +++ b/src/lib/libcrypto/asn1/a_gentm.c | |||
| @@ -117,8 +117,8 @@ err: | |||
| 117 | 117 | ||
| 118 | int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) | 118 | int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) |
| 119 | { | 119 | { |
| 120 | static int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0}; | 120 | static const int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0}; |
| 121 | static int max[9]={99, 99,12,31,23,59,59,12,59}; | 121 | static const int max[9]={99, 99,12,31,23,59,59,12,59}; |
| 122 | char *a; | 122 | char *a; |
| 123 | int n,i,l,o; | 123 | int n,i,l,o; |
| 124 | 124 | ||
| @@ -176,6 +176,11 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) | |||
| 176 | o++; | 176 | o++; |
| 177 | } | 177 | } |
| 178 | } | 178 | } |
| 179 | else | ||
| 180 | { | ||
| 181 | /* Missing time zone information. */ | ||
| 182 | goto err; | ||
| 183 | } | ||
| 179 | return(o == l); | 184 | return(o == l); |
| 180 | err: | 185 | err: |
| 181 | return(0); | 186 | return(0); |
| @@ -206,6 +211,12 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) | |||
| 206 | ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, | 211 | ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, |
| 207 | time_t t) | 212 | time_t t) |
| 208 | { | 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 | { | ||
| 209 | char *p; | 220 | char *p; |
| 210 | struct tm *ts; | 221 | struct tm *ts; |
| 211 | struct tm data; | 222 | struct tm data; |
| @@ -220,13 +231,19 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, | |||
| 220 | if (ts == NULL) | 231 | if (ts == NULL) |
| 221 | return(NULL); | 232 | return(NULL); |
| 222 | 233 | ||
| 234 | if (offset_day || offset_sec) | ||
| 235 | { | ||
| 236 | if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) | ||
| 237 | return NULL; | ||
| 238 | } | ||
| 239 | |||
| 223 | p=(char *)s->data; | 240 | p=(char *)s->data; |
| 224 | if ((p == NULL) || ((size_t)s->length < len)) | 241 | if ((p == NULL) || ((size_t)s->length < len)) |
| 225 | { | 242 | { |
| 226 | p=OPENSSL_malloc(len); | 243 | p=OPENSSL_malloc(len); |
| 227 | if (p == NULL) | 244 | if (p == NULL) |
| 228 | { | 245 | { |
| 229 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_SET, | 246 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ, |
| 230 | ERR_R_MALLOC_FAILURE); | 247 | ERR_R_MALLOC_FAILURE); |
| 231 | return(NULL); | 248 | return(NULL); |
| 232 | } | 249 | } |
diff --git a/src/lib/libcrypto/asn1/a_hdr.c b/src/lib/libcrypto/asn1/a_hdr.c deleted file mode 100644 index d1c2a7b9e3..0000000000 --- a/src/lib/libcrypto/asn1/a_hdr.c +++ /dev/null | |||
| @@ -1,119 +0,0 @@ | |||
| 1 | /* crypto/asn1/a_hdr.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/asn1_mac.h> | ||
| 62 | #include <openssl/asn1.h> | ||
| 63 | |||
| 64 | int i2d_ASN1_HEADER(ASN1_HEADER *a, unsigned char **pp) | ||
| 65 | { | ||
| 66 | M_ASN1_I2D_vars(a); | ||
| 67 | |||
| 68 | M_ASN1_I2D_len(a->header, i2d_ASN1_OCTET_STRING); | ||
| 69 | M_ASN1_I2D_len(a->data, a->meth->i2d); | ||
| 70 | |||
| 71 | M_ASN1_I2D_seq_total(); | ||
| 72 | |||
| 73 | M_ASN1_I2D_put(a->header, i2d_ASN1_OCTET_STRING); | ||
| 74 | M_ASN1_I2D_put(a->data, a->meth->i2d); | ||
| 75 | |||
| 76 | M_ASN1_I2D_finish(); | ||
| 77 | } | ||
| 78 | |||
| 79 | ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a, const unsigned char **pp, | ||
| 80 | long length) | ||
| 81 | { | ||
| 82 | M_ASN1_D2I_vars(a,ASN1_HEADER *,ASN1_HEADER_new); | ||
| 83 | |||
| 84 | M_ASN1_D2I_Init(); | ||
| 85 | M_ASN1_D2I_start_sequence(); | ||
| 86 | M_ASN1_D2I_get_x(ASN1_OCTET_STRING,ret->header,d2i_ASN1_OCTET_STRING); | ||
| 87 | if (ret->meth != NULL) | ||
| 88 | { | ||
| 89 | M_ASN1_D2I_get_x(void,ret->data,ret->meth->d2i); | ||
| 90 | } | ||
| 91 | else | ||
| 92 | { | ||
| 93 | if (a != NULL) (*a)=ret; | ||
| 94 | return(ret); | ||
| 95 | } | ||
| 96 | M_ASN1_D2I_Finish(a,ASN1_HEADER_free,ASN1_F_D2I_ASN1_HEADER); | ||
| 97 | } | ||
| 98 | |||
| 99 | ASN1_HEADER *ASN1_HEADER_new(void) | ||
| 100 | { | ||
| 101 | ASN1_HEADER *ret=NULL; | ||
| 102 | ASN1_CTX c; | ||
| 103 | |||
| 104 | M_ASN1_New_Malloc(ret,ASN1_HEADER); | ||
| 105 | M_ASN1_New(ret->header,M_ASN1_OCTET_STRING_new); | ||
| 106 | ret->meth=NULL; | ||
| 107 | ret->data=NULL; | ||
| 108 | return(ret); | ||
| 109 | M_ASN1_New_Error(ASN1_F_ASN1_HEADER_NEW); | ||
| 110 | } | ||
| 111 | |||
| 112 | void ASN1_HEADER_free(ASN1_HEADER *a) | ||
| 113 | { | ||
| 114 | if (a == NULL) return; | ||
| 115 | M_ASN1_OCTET_STRING_free(a->header); | ||
| 116 | if (a->meth != NULL) | ||
| 117 | a->meth->destroy(a->data); | ||
| 118 | OPENSSL_free(a); | ||
| 119 | } | ||
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c index f8d198efb1..c6fd204ae3 100644 --- a/src/lib/libcrypto/asn1/a_int.c +++ b/src/lib/libcrypto/asn1/a_int.c | |||
| @@ -61,10 +61,10 @@ | |||
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | #include <openssl/bn.h> | 62 | #include <openssl/bn.h> |
| 63 | 63 | ||
| 64 | ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x) | 64 | ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x) |
| 65 | { return M_ASN1_INTEGER_dup(x);} | 65 | { return M_ASN1_INTEGER_dup(x);} |
| 66 | 66 | ||
| 67 | int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y) | 67 | int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y) |
| 68 | { | 68 | { |
| 69 | int neg, ret; | 69 | int neg, ret; |
| 70 | /* Compare signs */ | 70 | /* Compare signs */ |
| @@ -373,7 +373,7 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v) | |||
| 373 | return(1); | 373 | return(1); |
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | long ASN1_INTEGER_get(ASN1_INTEGER *a) | 376 | long ASN1_INTEGER_get(const ASN1_INTEGER *a) |
| 377 | { | 377 | { |
| 378 | int neg=0,i; | 378 | int neg=0,i; |
| 379 | long r=0; | 379 | long r=0; |
| @@ -402,7 +402,7 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a) | |||
| 402 | return(r); | 402 | return(r); |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai) | 405 | ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) |
| 406 | { | 406 | { |
| 407 | ASN1_INTEGER *ret; | 407 | ASN1_INTEGER *ret; |
| 408 | int len,j; | 408 | int len,j; |
| @@ -444,7 +444,7 @@ err: | |||
| 444 | return(NULL); | 444 | return(NULL); |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai, BIGNUM *bn) | 447 | BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn) |
| 448 | { | 448 | { |
| 449 | BIGNUM *ret; | 449 | BIGNUM *ret; |
| 450 | 450 | ||
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c index 1bcd046893..1538e0a4fc 100644 --- a/src/lib/libcrypto/asn1/a_mbstr.c +++ b/src/lib/libcrypto/asn1/a_mbstr.c | |||
| @@ -93,7 +93,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, | |||
| 93 | int str_type; | 93 | int str_type; |
| 94 | int ret; | 94 | int ret; |
| 95 | char free_out; | 95 | char free_out; |
| 96 | int outform, outlen; | 96 | int outform, outlen = 0; |
| 97 | ASN1_STRING *dest; | 97 | ASN1_STRING *dest; |
| 98 | unsigned char *p; | 98 | unsigned char *p; |
| 99 | int nchar; | 99 | int nchar; |
diff --git a/src/lib/libcrypto/asn1/a_meth.c b/src/lib/libcrypto/asn1/a_meth.c deleted file mode 100644 index 50bea917e3..0000000000 --- a/src/lib/libcrypto/asn1/a_meth.c +++ /dev/null | |||
| @@ -1,84 +0,0 @@ | |||
| 1 | /* crypto/asn1/a_meth.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/buffer.h> | ||
| 62 | #include <openssl/asn1.h> | ||
| 63 | |||
| 64 | static ASN1_METHOD ia5string_meth={ | ||
| 65 | (I2D_OF(void)) i2d_ASN1_IA5STRING, | ||
| 66 | (D2I_OF(void)) d2i_ASN1_IA5STRING, | ||
| 67 | (void *(*)(void))ASN1_STRING_new, | ||
| 68 | (void (*)(void *))ASN1_STRING_free}; | ||
| 69 | |||
| 70 | static ASN1_METHOD bit_string_meth={ | ||
| 71 | (I2D_OF(void)) i2d_ASN1_BIT_STRING, | ||
| 72 | (D2I_OF(void)) d2i_ASN1_BIT_STRING, | ||
| 73 | (void *(*)(void))ASN1_STRING_new, | ||
| 74 | (void (*)(void *))ASN1_STRING_free}; | ||
| 75 | |||
| 76 | ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void) | ||
| 77 | { | ||
| 78 | return(&ia5string_meth); | ||
| 79 | } | ||
| 80 | |||
| 81 | ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void) | ||
| 82 | { | ||
| 83 | return(&bit_string_meth); | ||
| 84 | } | ||
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c index dc980421d0..e5fbe7cbb1 100644 --- a/src/lib/libcrypto/asn1/a_object.c +++ b/src/lib/libcrypto/asn1/a_object.c | |||
| @@ -281,8 +281,6 @@ ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, | |||
| 281 | return ret; | 281 | return ret; |
| 282 | err: | 282 | err: |
| 283 | ASN1err(ASN1_F_D2I_ASN1_OBJECT,i); | 283 | ASN1err(ASN1_F_D2I_ASN1_OBJECT,i); |
| 284 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) | ||
| 285 | ASN1_OBJECT_free(ret); | ||
| 286 | return(NULL); | 284 | return(NULL); |
| 287 | } | 285 | } |
| 288 | ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, | 286 | ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, |
| @@ -290,7 +288,19 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, | |||
| 290 | { | 288 | { |
| 291 | ASN1_OBJECT *ret=NULL; | 289 | ASN1_OBJECT *ret=NULL; |
| 292 | const unsigned char *p; | 290 | const unsigned char *p; |
| 291 | unsigned char *data; | ||
| 293 | int i; | 292 | int i; |
| 293 | /* Sanity check OID encoding: can't have leading 0x80 in | ||
| 294 | * subidentifiers, see: X.690 8.19.2 | ||
| 295 | */ | ||
| 296 | for (i = 0, p = *pp + 1; i < len - 1; i++, p++) | ||
| 297 | { | ||
| 298 | if (*p == 0x80 && (!i || !(p[-1] & 0x80))) | ||
| 299 | { | ||
| 300 | ASN1err(ASN1_F_C2I_ASN1_OBJECT,ASN1_R_INVALID_OBJECT_ENCODING); | ||
| 301 | return NULL; | ||
| 302 | } | ||
| 303 | } | ||
| 294 | 304 | ||
| 295 | /* only the ASN1_OBJECTs from the 'table' will have values | 305 | /* only the ASN1_OBJECTs from the 'table' will have values |
| 296 | * for ->sn or ->ln */ | 306 | * for ->sn or ->ln */ |
| @@ -302,15 +312,22 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, | |||
| 302 | else ret=(*a); | 312 | else ret=(*a); |
| 303 | 313 | ||
| 304 | p= *pp; | 314 | p= *pp; |
| 305 | if ((ret->data == NULL) || (ret->length < len)) | 315 | /* detach data from object */ |
| 316 | data = (unsigned char *)ret->data; | ||
| 317 | ret->data = NULL; | ||
| 318 | /* once detached we can change it */ | ||
| 319 | if ((data == NULL) || (ret->length < len)) | ||
| 306 | { | 320 | { |
| 307 | if (ret->data != NULL) OPENSSL_free(ret->data); | 321 | ret->length=0; |
| 308 | ret->data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1); | 322 | if (data != NULL) OPENSSL_free(data); |
| 309 | ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA; | 323 | data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1); |
| 310 | if (ret->data == NULL) | 324 | if (data == NULL) |
| 311 | { i=ERR_R_MALLOC_FAILURE; goto err; } | 325 | { i=ERR_R_MALLOC_FAILURE; goto err; } |
| 326 | ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA; | ||
| 312 | } | 327 | } |
| 313 | memcpy(ret->data,p,(int)len); | 328 | memcpy(data,p,(int)len); |
| 329 | /* reattach data to object, after which it remains const */ | ||
| 330 | ret->data =data; | ||
| 314 | ret->length=(int)len; | 331 | ret->length=(int)len; |
| 315 | ret->sn=NULL; | 332 | ret->sn=NULL; |
| 316 | ret->ln=NULL; | 333 | ret->ln=NULL; |
| @@ -359,7 +376,7 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a) | |||
| 359 | } | 376 | } |
| 360 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) | 377 | if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) |
| 361 | { | 378 | { |
| 362 | if (a->data != NULL) OPENSSL_free(a->data); | 379 | if (a->data != NULL) OPENSSL_free((void *)a->data); |
| 363 | a->data=NULL; | 380 | a->data=NULL; |
| 364 | a->length=0; | 381 | a->length=0; |
| 365 | } | 382 | } |
diff --git a/src/lib/libcrypto/asn1/a_octet.c b/src/lib/libcrypto/asn1/a_octet.c index 24fd0f8e5a..e8725e44f1 100644 --- a/src/lib/libcrypto/asn1/a_octet.c +++ b/src/lib/libcrypto/asn1/a_octet.c | |||
| @@ -60,10 +60,10 @@ | |||
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
| 62 | 62 | ||
| 63 | ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *x) | 63 | ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x) |
| 64 | { return M_ASN1_OCTET_STRING_dup(x); } | 64 | { return M_ASN1_OCTET_STRING_dup(x); } |
| 65 | 65 | ||
| 66 | int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b) | 66 | int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b) |
| 67 | { return M_ASN1_OCTET_STRING_cmp(a, b); } | 67 | { return M_ASN1_OCTET_STRING_cmp(a, b); } |
| 68 | 68 | ||
| 69 | int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len) | 69 | int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len) |
diff --git a/src/lib/libcrypto/asn1/a_set.c b/src/lib/libcrypto/asn1/a_set.c index 958558c204..d726c8d3a8 100644 --- a/src/lib/libcrypto/asn1/a_set.c +++ b/src/lib/libcrypto/asn1/a_set.c | |||
| @@ -85,8 +85,9 @@ static int SetBlobCmp(const void *elem1, const void *elem2 ) | |||
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | /* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */ | 87 | /* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */ |
| 88 | int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag, | 88 | int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp, |
| 89 | int ex_class, int is_set) | 89 | i2d_of_void *i2d, int ex_tag, int ex_class, |
| 90 | int is_set) | ||
| 90 | { | 91 | { |
| 91 | int ret=0,r; | 92 | int ret=0,r; |
| 92 | int i; | 93 | int i; |
| @@ -96,8 +97,8 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag, | |||
| 96 | int totSize; | 97 | int totSize; |
| 97 | 98 | ||
| 98 | if (a == NULL) return(0); | 99 | if (a == NULL) return(0); |
| 99 | for (i=sk_num(a)-1; i>=0; i--) | 100 | for (i=sk_OPENSSL_BLOCK_num(a)-1; i>=0; i--) |
| 100 | ret+=i2d(sk_value(a,i),NULL); | 101 | ret+=i2d(sk_OPENSSL_BLOCK_value(a,i),NULL); |
| 101 | r=ASN1_object_size(1,ret,ex_tag); | 102 | r=ASN1_object_size(1,ret,ex_tag); |
| 102 | if (pp == NULL) return(r); | 103 | if (pp == NULL) return(r); |
| 103 | 104 | ||
| @@ -108,10 +109,10 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag, | |||
| 108 | /* And then again by Ben */ | 109 | /* And then again by Ben */ |
| 109 | /* And again by Steve */ | 110 | /* And again by Steve */ |
| 110 | 111 | ||
| 111 | if(!is_set || (sk_num(a) < 2)) | 112 | if(!is_set || (sk_OPENSSL_BLOCK_num(a) < 2)) |
| 112 | { | 113 | { |
| 113 | for (i=0; i<sk_num(a); i++) | 114 | for (i=0; i<sk_OPENSSL_BLOCK_num(a); i++) |
| 114 | i2d(sk_value(a,i),&p); | 115 | i2d(sk_OPENSSL_BLOCK_value(a,i),&p); |
| 115 | 116 | ||
| 116 | *pp=p; | 117 | *pp=p; |
| 117 | return(r); | 118 | return(r); |
| @@ -119,17 +120,17 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag, | |||
| 119 | 120 | ||
| 120 | pStart = p; /* Catch the beg of Setblobs*/ | 121 | pStart = p; /* Catch the beg of Setblobs*/ |
| 121 | /* In this array we will store the SET blobs */ | 122 | /* In this array we will store the SET blobs */ |
| 122 | rgSetBlob = (MYBLOB *)OPENSSL_malloc(sk_num(a) * sizeof(MYBLOB)); | 123 | rgSetBlob = OPENSSL_malloc(sk_OPENSSL_BLOCK_num(a) * sizeof(MYBLOB)); |
| 123 | if (rgSetBlob == NULL) | 124 | if (rgSetBlob == NULL) |
| 124 | { | 125 | { |
| 125 | ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE); | 126 | ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE); |
| 126 | return(0); | 127 | return(0); |
| 127 | } | 128 | } |
| 128 | 129 | ||
| 129 | for (i=0; i<sk_num(a); i++) | 130 | for (i=0; i<sk_OPENSSL_BLOCK_num(a); i++) |
| 130 | { | 131 | { |
| 131 | rgSetBlob[i].pbData = p; /* catch each set encode blob */ | 132 | rgSetBlob[i].pbData = p; /* catch each set encode blob */ |
| 132 | i2d(sk_value(a,i),&p); | 133 | i2d(sk_OPENSSL_BLOCK_value(a,i),&p); |
| 133 | rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this | 134 | rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this |
| 134 | SetBlob | 135 | SetBlob |
| 135 | */ | 136 | */ |
| @@ -139,7 +140,7 @@ SetBlob | |||
| 139 | 140 | ||
| 140 | /* Now we have to sort the blobs. I am using a simple algo. | 141 | /* Now we have to sort the blobs. I am using a simple algo. |
| 141 | *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ | 142 | *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ |
| 142 | qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); | 143 | qsort( rgSetBlob, sk_OPENSSL_BLOCK_num(a), sizeof(MYBLOB), SetBlobCmp); |
| 143 | if (!(pTempMem = OPENSSL_malloc(totSize))) | 144 | if (!(pTempMem = OPENSSL_malloc(totSize))) |
| 144 | { | 145 | { |
| 145 | ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE); | 146 | ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE); |
| @@ -148,7 +149,7 @@ SetBlob | |||
| 148 | 149 | ||
| 149 | /* Copy to temp mem */ | 150 | /* Copy to temp mem */ |
| 150 | p = pTempMem; | 151 | p = pTempMem; |
| 151 | for(i=0; i<sk_num(a); ++i) | 152 | for(i=0; i<sk_OPENSSL_BLOCK_num(a); ++i) |
| 152 | { | 153 | { |
| 153 | memcpy(p, rgSetBlob[i].pbData, rgSetBlob[i].cbData); | 154 | memcpy(p, rgSetBlob[i].pbData, rgSetBlob[i].cbData); |
| 154 | p += rgSetBlob[i].cbData; | 155 | p += rgSetBlob[i].cbData; |
| @@ -162,16 +163,18 @@ SetBlob | |||
| 162 | return(r); | 163 | return(r); |
| 163 | } | 164 | } |
| 164 | 165 | ||
| 165 | STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length, | 166 | STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a, |
| 166 | d2i_of_void *d2i, void (*free_func)(void *), int ex_tag, | 167 | const unsigned char **pp, |
| 167 | int ex_class) | 168 | long length, d2i_of_void *d2i, |
| 169 | void (*free_func)(OPENSSL_BLOCK), int ex_tag, | ||
| 170 | int ex_class) | ||
| 168 | { | 171 | { |
| 169 | ASN1_const_CTX c; | 172 | ASN1_const_CTX c; |
| 170 | STACK *ret=NULL; | 173 | STACK_OF(OPENSSL_BLOCK) *ret=NULL; |
| 171 | 174 | ||
| 172 | if ((a == NULL) || ((*a) == NULL)) | 175 | if ((a == NULL) || ((*a) == NULL)) |
| 173 | { | 176 | { |
| 174 | if ((ret=sk_new_null()) == NULL) | 177 | if ((ret=sk_OPENSSL_BLOCK_new_null()) == NULL) |
| 175 | { | 178 | { |
| 176 | ASN1err(ASN1_F_D2I_ASN1_SET,ERR_R_MALLOC_FAILURE); | 179 | ASN1err(ASN1_F_D2I_ASN1_SET,ERR_R_MALLOC_FAILURE); |
| 177 | goto err; | 180 | goto err; |
| @@ -216,10 +219,10 @@ STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length, | |||
| 216 | if ((s=d2i(NULL,&c.p,c.slen)) == NULL) | 219 | if ((s=d2i(NULL,&c.p,c.slen)) == NULL) |
| 217 | { | 220 | { |
| 218 | ASN1err(ASN1_F_D2I_ASN1_SET,ASN1_R_ERROR_PARSING_SET_ELEMENT); | 221 | ASN1err(ASN1_F_D2I_ASN1_SET,ASN1_R_ERROR_PARSING_SET_ELEMENT); |
| 219 | asn1_add_error(*pp,(int)(c.q- *pp)); | 222 | asn1_add_error(*pp,(int)(c.p- *pp)); |
| 220 | goto err; | 223 | goto err; |
| 221 | } | 224 | } |
| 222 | if (!sk_push(ret,s)) goto err; | 225 | if (!sk_OPENSSL_BLOCK_push(ret,s)) goto err; |
| 223 | } | 226 | } |
| 224 | if (a != NULL) (*a)=ret; | 227 | if (a != NULL) (*a)=ret; |
| 225 | *pp=c.p; | 228 | *pp=c.p; |
| @@ -228,9 +231,9 @@ err: | |||
| 228 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) | 231 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) |
| 229 | { | 232 | { |
| 230 | if (free_func != NULL) | 233 | if (free_func != NULL) |
| 231 | sk_pop_free(ret,free_func); | 234 | sk_OPENSSL_BLOCK_pop_free(ret,free_func); |
| 232 | else | 235 | else |
| 233 | sk_free(ret); | 236 | sk_OPENSSL_BLOCK_free(ret); |
| 234 | } | 237 | } |
| 235 | return(NULL); | 238 | return(NULL); |
| 236 | } | 239 | } |
diff --git a/src/lib/libcrypto/asn1/a_sign.c b/src/lib/libcrypto/asn1/a_sign.c index 4dee45fbb8..ff63bfc7be 100644 --- a/src/lib/libcrypto/asn1/a_sign.c +++ b/src/lib/libcrypto/asn1/a_sign.c | |||
| @@ -123,6 +123,7 @@ | |||
| 123 | #include <openssl/x509.h> | 123 | #include <openssl/x509.h> |
| 124 | #include <openssl/objects.h> | 124 | #include <openssl/objects.h> |
| 125 | #include <openssl/buffer.h> | 125 | #include <openssl/buffer.h> |
| 126 | #include "asn1_locl.h" | ||
| 126 | 127 | ||
| 127 | #ifndef NO_ASN1_OLD | 128 | #ifndef NO_ASN1_OLD |
| 128 | 129 | ||
| @@ -218,45 +219,47 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, | |||
| 218 | { | 219 | { |
| 219 | EVP_MD_CTX ctx; | 220 | EVP_MD_CTX ctx; |
| 220 | unsigned char *buf_in=NULL,*buf_out=NULL; | 221 | unsigned char *buf_in=NULL,*buf_out=NULL; |
| 221 | int i,inl=0,outl=0,outll=0; | 222 | int inl=0,outl=0,outll=0; |
| 222 | X509_ALGOR *a; | 223 | int signid, paramtype; |
| 223 | 224 | ||
| 224 | EVP_MD_CTX_init(&ctx); | 225 | if (type == NULL) |
| 225 | for (i=0; i<2; i++) | ||
| 226 | { | 226 | { |
| 227 | if (i == 0) | 227 | int def_nid; |
| 228 | a=algor1; | 228 | if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) > 0) |
| 229 | else | 229 | type = EVP_get_digestbynid(def_nid); |
| 230 | a=algor2; | 230 | } |
| 231 | if (a == NULL) continue; | 231 | |
| 232 | if (type->pkey_type == NID_dsaWithSHA1 || | 232 | if (type == NULL) |
| 233 | type->pkey_type == NID_ecdsa_with_SHA1) | 233 | { |
| 234 | { | 234 | ASN1err(ASN1_F_ASN1_ITEM_SIGN, ASN1_R_NO_DEFAULT_DIGEST); |
| 235 | /* special case: RFC 3279 tells us to omit 'parameters' | 235 | return 0; |
| 236 | * with id-dsa-with-sha1 and ecdsa-with-SHA1 */ | 236 | } |
| 237 | ASN1_TYPE_free(a->parameter); | 237 | |
| 238 | a->parameter = NULL; | 238 | if (type->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) |
| 239 | } | 239 | { |
| 240 | else if ((a->parameter == NULL) || | 240 | if (!pkey->ameth || |
| 241 | (a->parameter->type != V_ASN1_NULL)) | 241 | !OBJ_find_sigid_by_algs(&signid, EVP_MD_nid(type), |
| 242 | { | 242 | pkey->ameth->pkey_id)) |
| 243 | ASN1_TYPE_free(a->parameter); | ||
| 244 | if ((a->parameter=ASN1_TYPE_new()) == NULL) goto err; | ||
| 245 | a->parameter->type=V_ASN1_NULL; | ||
| 246 | } | ||
| 247 | ASN1_OBJECT_free(a->algorithm); | ||
| 248 | a->algorithm=OBJ_nid2obj(type->pkey_type); | ||
| 249 | if (a->algorithm == NULL) | ||
| 250 | { | ||
| 251 | ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE); | ||
| 252 | goto err; | ||
| 253 | } | ||
| 254 | if (a->algorithm->length == 0) | ||
| 255 | { | 243 | { |
| 256 | ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD); | 244 | ASN1err(ASN1_F_ASN1_ITEM_SIGN, |
| 257 | goto err; | 245 | ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED); |
| 246 | return 0; | ||
| 258 | } | 247 | } |
| 259 | } | 248 | } |
| 249 | else | ||
| 250 | signid = type->pkey_type; | ||
| 251 | |||
| 252 | if (pkey->ameth->pkey_flags & ASN1_PKEY_SIGPARAM_NULL) | ||
| 253 | paramtype = V_ASN1_NULL; | ||
| 254 | else | ||
| 255 | paramtype = V_ASN1_UNDEF; | ||
| 256 | |||
| 257 | if (algor1) | ||
| 258 | X509_ALGOR_set0(algor1, OBJ_nid2obj(signid), paramtype, NULL); | ||
| 259 | if (algor2) | ||
| 260 | X509_ALGOR_set0(algor2, OBJ_nid2obj(signid), paramtype, NULL); | ||
| 261 | |||
| 262 | EVP_MD_CTX_init(&ctx); | ||
| 260 | inl=ASN1_item_i2d(asn,&buf_in, it); | 263 | inl=ASN1_item_i2d(asn,&buf_in, it); |
| 261 | outll=outl=EVP_PKEY_size(pkey); | 264 | outll=outl=EVP_PKEY_size(pkey); |
| 262 | buf_out=(unsigned char *)OPENSSL_malloc((unsigned int)outl); | 265 | buf_out=(unsigned char *)OPENSSL_malloc((unsigned int)outl); |
| @@ -267,12 +270,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, | |||
| 267 | goto err; | 270 | goto err; |
| 268 | } | 271 | } |
| 269 | 272 | ||
| 270 | if (!EVP_SignInit_ex(&ctx,type, NULL)) | 273 | EVP_SignInit_ex(&ctx,type, NULL); |
| 271 | { | ||
| 272 | outl=0; | ||
| 273 | ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_EVP_LIB); | ||
| 274 | goto err; | ||
| 275 | } | ||
| 276 | EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl); | 274 | EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl); |
| 277 | if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out, | 275 | if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out, |
| 278 | (unsigned int *)&outl,pkey)) | 276 | (unsigned int *)&outl,pkey)) |
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c index fe515b52ba..753021a7a2 100644 --- a/src/lib/libcrypto/asn1/a_strnid.c +++ b/src/lib/libcrypto/asn1/a_strnid.c | |||
| @@ -67,7 +67,6 @@ static STACK_OF(ASN1_STRING_TABLE) *stable = NULL; | |||
| 67 | static void st_free(ASN1_STRING_TABLE *tbl); | 67 | static void st_free(ASN1_STRING_TABLE *tbl); |
| 68 | static int sk_table_cmp(const ASN1_STRING_TABLE * const *a, | 68 | static int sk_table_cmp(const ASN1_STRING_TABLE * const *a, |
| 69 | const ASN1_STRING_TABLE * const *b); | 69 | const ASN1_STRING_TABLE * const *b); |
| 70 | static int table_cmp(const void *a, const void *b); | ||
| 71 | 70 | ||
| 72 | 71 | ||
| 73 | /* This is the global mask for the mbstring functions: this is use to | 72 | /* This is the global mask for the mbstring functions: this is use to |
| @@ -158,7 +157,7 @@ ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in, | |||
| 158 | 157 | ||
| 159 | /* This table must be kept in NID order */ | 158 | /* This table must be kept in NID order */ |
| 160 | 159 | ||
| 161 | static ASN1_STRING_TABLE tbl_standard[] = { | 160 | static const ASN1_STRING_TABLE tbl_standard[] = { |
| 162 | {NID_commonName, 1, ub_common_name, DIRSTRING_TYPE, 0}, | 161 | {NID_commonName, 1, ub_common_name, DIRSTRING_TYPE, 0}, |
| 163 | {NID_countryName, 2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}, | 162 | {NID_countryName, 2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}, |
| 164 | {NID_localityName, 1, ub_locality_name, DIRSTRING_TYPE, 0}, | 163 | {NID_localityName, 1, ub_locality_name, DIRSTRING_TYPE, 0}, |
| @@ -186,22 +185,23 @@ static int sk_table_cmp(const ASN1_STRING_TABLE * const *a, | |||
| 186 | return (*a)->nid - (*b)->nid; | 185 | return (*a)->nid - (*b)->nid; |
| 187 | } | 186 | } |
| 188 | 187 | ||
| 189 | static int table_cmp(const void *a, const void *b) | 188 | DECLARE_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table); |
| 189 | |||
| 190 | static int table_cmp(const ASN1_STRING_TABLE *a, const ASN1_STRING_TABLE *b) | ||
| 190 | { | 191 | { |
| 191 | const ASN1_STRING_TABLE *sa = a, *sb = b; | 192 | return a->nid - b->nid; |
| 192 | return sa->nid - sb->nid; | ||
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table); | ||
| 196 | |||
| 195 | ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid) | 197 | ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid) |
| 196 | { | 198 | { |
| 197 | int idx; | 199 | int idx; |
| 198 | ASN1_STRING_TABLE *ttmp; | 200 | ASN1_STRING_TABLE *ttmp; |
| 199 | ASN1_STRING_TABLE fnd; | 201 | ASN1_STRING_TABLE fnd; |
| 200 | fnd.nid = nid; | 202 | fnd.nid = nid; |
| 201 | ttmp = (ASN1_STRING_TABLE *) OBJ_bsearch((char *)&fnd, | 203 | ttmp = OBJ_bsearch_table(&fnd, tbl_standard, |
| 202 | (char *)tbl_standard, | 204 | sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE)); |
| 203 | sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE), | ||
| 204 | sizeof(ASN1_STRING_TABLE), table_cmp); | ||
| 205 | if(ttmp) return ttmp; | 205 | if(ttmp) return ttmp; |
| 206 | if(!stable) return NULL; | 206 | if(!stable) return NULL; |
| 207 | idx = sk_ASN1_STRING_TABLE_find(stable, &fnd); | 207 | idx = sk_ASN1_STRING_TABLE_find(stable, &fnd); |
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c index 159681fbcb..e2eb9b243e 100644 --- a/src/lib/libcrypto/asn1/a_time.c +++ b/src/lib/libcrypto/asn1/a_time.c | |||
| @@ -100,18 +100,29 @@ int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp) | |||
| 100 | 100 | ||
| 101 | ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t) | 101 | ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t) |
| 102 | { | 102 | { |
| 103 | return ASN1_TIME_adj(s, t, 0, 0); | ||
| 104 | } | ||
| 105 | |||
| 106 | ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, | ||
| 107 | int offset_day, long offset_sec) | ||
| 108 | { | ||
| 103 | struct tm *ts; | 109 | struct tm *ts; |
| 104 | struct tm data; | 110 | struct tm data; |
| 105 | 111 | ||
| 106 | ts=OPENSSL_gmtime(&t,&data); | 112 | ts=OPENSSL_gmtime(&t,&data); |
| 107 | if (ts == NULL) | 113 | if (ts == NULL) |
| 108 | { | 114 | { |
| 109 | ASN1err(ASN1_F_ASN1_TIME_SET, ASN1_R_ERROR_GETTING_TIME); | 115 | ASN1err(ASN1_F_ASN1_TIME_ADJ, ASN1_R_ERROR_GETTING_TIME); |
| 110 | return NULL; | 116 | return NULL; |
| 111 | } | 117 | } |
| 118 | if (offset_day || offset_sec) | ||
| 119 | { | ||
| 120 | if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) | ||
| 121 | return NULL; | ||
| 122 | } | ||
| 112 | if((ts->tm_year >= 50) && (ts->tm_year < 150)) | 123 | if((ts->tm_year >= 50) && (ts->tm_year < 150)) |
| 113 | return ASN1_UTCTIME_set(s, t); | 124 | return ASN1_UTCTIME_adj(s, t, offset_day, offset_sec); |
| 114 | return ASN1_GENERALIZEDTIME_set(s,t); | 125 | return ASN1_GENERALIZEDTIME_adj(s, t, offset_day, offset_sec); |
| 115 | } | 126 | } |
| 116 | 127 | ||
| 117 | int ASN1_TIME_check(ASN1_TIME *t) | 128 | int ASN1_TIME_check(ASN1_TIME *t) |
| @@ -162,3 +173,26 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE | |||
| 162 | 173 | ||
| 163 | return ret; | 174 | return ret; |
| 164 | } | 175 | } |
| 176 | |||
| 177 | int ASN1_TIME_set_string(ASN1_TIME *s, const char *str) | ||
| 178 | { | ||
| 179 | ASN1_TIME t; | ||
| 180 | |||
| 181 | t.length = strlen(str); | ||
| 182 | t.data = (unsigned char *)str; | ||
| 183 | t.flags = 0; | ||
| 184 | |||
| 185 | t.type = V_ASN1_UTCTIME; | ||
| 186 | |||
| 187 | if (!ASN1_TIME_check(&t)) | ||
| 188 | { | ||
| 189 | t.type = V_ASN1_GENERALIZEDTIME; | ||
| 190 | if (!ASN1_TIME_check(&t)) | ||
| 191 | return 0; | ||
| 192 | } | ||
| 193 | |||
| 194 | if (s && !ASN1_STRING_copy((ASN1_STRING *)s, (ASN1_STRING *)&t)) | ||
| 195 | return 0; | ||
| 196 | |||
| 197 | return 1; | ||
| 198 | } | ||
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c index 36beceacdb..a45d2f9d12 100644 --- a/src/lib/libcrypto/asn1/a_type.c +++ b/src/lib/libcrypto/asn1/a_type.c | |||
| @@ -77,7 +77,10 @@ void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) | |||
| 77 | ASN1_primitive_free((ASN1_VALUE **)tmp_a, NULL); | 77 | ASN1_primitive_free((ASN1_VALUE **)tmp_a, NULL); |
| 78 | } | 78 | } |
| 79 | a->type=type; | 79 | a->type=type; |
| 80 | a->value.ptr=value; | 80 | if (type == V_ASN1_BOOLEAN) |
| 81 | a->value.boolean = value ? 0xff : 0; | ||
| 82 | else | ||
| 83 | a->value.ptr=value; | ||
| 81 | } | 84 | } |
| 82 | 85 | ||
| 83 | int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value) | 86 | int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value) |
| @@ -98,7 +101,7 @@ int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value) | |||
| 98 | else | 101 | else |
| 99 | { | 102 | { |
| 100 | ASN1_STRING *sdup; | 103 | ASN1_STRING *sdup; |
| 101 | sdup = ASN1_STRING_dup((ASN1_STRING *)value); | 104 | sdup = ASN1_STRING_dup(value); |
| 102 | if (!sdup) | 105 | if (!sdup) |
| 103 | return 0; | 106 | return 0; |
| 104 | ASN1_TYPE_set(a, type, sdup); | 107 | ASN1_TYPE_set(a, type, sdup); |
| @@ -108,3 +111,49 @@ int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value) | |||
| 108 | 111 | ||
| 109 | IMPLEMENT_STACK_OF(ASN1_TYPE) | 112 | IMPLEMENT_STACK_OF(ASN1_TYPE) |
| 110 | IMPLEMENT_ASN1_SET_OF(ASN1_TYPE) | 113 | IMPLEMENT_ASN1_SET_OF(ASN1_TYPE) |
| 114 | |||
| 115 | /* Returns 0 if they are equal, != 0 otherwise. */ | ||
| 116 | int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b) | ||
| 117 | { | ||
| 118 | int result = -1; | ||
| 119 | |||
| 120 | if (!a || !b || a->type != b->type) return -1; | ||
| 121 | |||
| 122 | switch (a->type) | ||
| 123 | { | ||
| 124 | case V_ASN1_OBJECT: | ||
| 125 | result = OBJ_cmp(a->value.object, b->value.object); | ||
| 126 | break; | ||
| 127 | case V_ASN1_NULL: | ||
| 128 | result = 0; /* They do not have content. */ | ||
| 129 | break; | ||
| 130 | case V_ASN1_INTEGER: | ||
| 131 | case V_ASN1_NEG_INTEGER: | ||
| 132 | case V_ASN1_ENUMERATED: | ||
| 133 | case V_ASN1_NEG_ENUMERATED: | ||
| 134 | case V_ASN1_BIT_STRING: | ||
| 135 | case V_ASN1_OCTET_STRING: | ||
| 136 | case V_ASN1_SEQUENCE: | ||
| 137 | case V_ASN1_SET: | ||
| 138 | case V_ASN1_NUMERICSTRING: | ||
| 139 | case V_ASN1_PRINTABLESTRING: | ||
| 140 | case V_ASN1_T61STRING: | ||
| 141 | case V_ASN1_VIDEOTEXSTRING: | ||
| 142 | case V_ASN1_IA5STRING: | ||
| 143 | case V_ASN1_UTCTIME: | ||
| 144 | case V_ASN1_GENERALIZEDTIME: | ||
| 145 | case V_ASN1_GRAPHICSTRING: | ||
| 146 | case V_ASN1_VISIBLESTRING: | ||
| 147 | case V_ASN1_GENERALSTRING: | ||
| 148 | case V_ASN1_UNIVERSALSTRING: | ||
| 149 | case V_ASN1_BMPSTRING: | ||
| 150 | case V_ASN1_UTF8STRING: | ||
| 151 | case V_ASN1_OTHER: | ||
| 152 | default: | ||
| 153 | result = ASN1_STRING_cmp((ASN1_STRING *) a->value.ptr, | ||
| 154 | (ASN1_STRING *) b->value.ptr); | ||
| 155 | break; | ||
| 156 | } | ||
| 157 | |||
| 158 | return result; | ||
| 159 | } | ||
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c index d31c028193..072e236592 100644 --- a/src/lib/libcrypto/asn1/a_utctm.c +++ b/src/lib/libcrypto/asn1/a_utctm.c | |||
| @@ -114,8 +114,8 @@ err: | |||
| 114 | 114 | ||
| 115 | int ASN1_UTCTIME_check(ASN1_UTCTIME *d) | 115 | int ASN1_UTCTIME_check(ASN1_UTCTIME *d) |
| 116 | { | 116 | { |
| 117 | static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0}; | 117 | static const int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0}; |
| 118 | static int max[8]={99,12,31,23,59,59,12,59}; | 118 | static const int max[8]={99,12,31,23,59,59,12,59}; |
| 119 | char *a; | 119 | char *a; |
| 120 | int n,i,l,o; | 120 | int n,i,l,o; |
| 121 | 121 | ||
| @@ -186,6 +186,12 @@ int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str) | |||
| 186 | 186 | ||
| 187 | ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) | 187 | ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) |
| 188 | { | 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 | { | ||
| 189 | char *p; | 195 | char *p; |
| 190 | struct tm *ts; | 196 | struct tm *ts; |
| 191 | struct tm data; | 197 | struct tm data; |
| @@ -200,13 +206,22 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) | |||
| 200 | if (ts == NULL) | 206 | if (ts == NULL) |
| 201 | return(NULL); | 207 | return(NULL); |
| 202 | 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 | |||
| 203 | p=(char *)s->data; | 218 | p=(char *)s->data; |
| 204 | if ((p == NULL) || ((size_t)s->length < len)) | 219 | if ((p == NULL) || ((size_t)s->length < len)) |
| 205 | { | 220 | { |
| 206 | p=OPENSSL_malloc(len); | 221 | p=OPENSSL_malloc(len); |
| 207 | if (p == NULL) | 222 | if (p == NULL) |
| 208 | { | 223 | { |
| 209 | ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE); | 224 | ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE); |
| 210 | return(NULL); | 225 | return(NULL); |
| 211 | } | 226 | } |
| 212 | if (s->data != NULL) | 227 | if (s->data != NULL) |
diff --git a/src/lib/libcrypto/asn1/a_verify.c b/src/lib/libcrypto/asn1/a_verify.c index da3efaaf8d..cecdb13c70 100644 --- a/src/lib/libcrypto/asn1/a_verify.c +++ b/src/lib/libcrypto/asn1/a_verify.c | |||
| @@ -60,6 +60,7 @@ | |||
| 60 | #include <time.h> | 60 | #include <time.h> |
| 61 | 61 | ||
| 62 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
| 63 | #include "asn1_locl.h" | ||
| 63 | 64 | ||
| 64 | #ifndef NO_SYS_TYPES_H | 65 | #ifndef NO_SYS_TYPES_H |
| 65 | # include <sys/types.h> | 66 | # include <sys/types.h> |
| @@ -100,12 +101,7 @@ int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *a, ASN1_BIT_STRING *signature, | |||
| 100 | p=buf_in; | 101 | p=buf_in; |
| 101 | 102 | ||
| 102 | i2d(data,&p); | 103 | i2d(data,&p); |
| 103 | if (!EVP_VerifyInit_ex(&ctx,type, NULL)) | 104 | EVP_VerifyInit_ex(&ctx,type, NULL); |
| 104 | { | ||
| 105 | ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB); | ||
| 106 | ret=0; | ||
| 107 | goto err; | ||
| 108 | } | ||
| 109 | EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl); | 105 | EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl); |
| 110 | 106 | ||
| 111 | OPENSSL_cleanse(buf_in,(unsigned int)inl); | 107 | OPENSSL_cleanse(buf_in,(unsigned int)inl); |
| @@ -134,19 +130,34 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat | |||
| 134 | void *asn, EVP_PKEY *pkey) | 130 | void *asn, EVP_PKEY *pkey) |
| 135 | { | 131 | { |
| 136 | EVP_MD_CTX ctx; | 132 | EVP_MD_CTX ctx; |
| 137 | const EVP_MD *type; | 133 | const EVP_MD *type = NULL; |
| 138 | unsigned char *buf_in=NULL; | 134 | unsigned char *buf_in=NULL; |
| 139 | int ret= -1,i,inl; | 135 | int ret= -1,inl; |
| 136 | |||
| 137 | int mdnid, pknid; | ||
| 140 | 138 | ||
| 141 | EVP_MD_CTX_init(&ctx); | 139 | EVP_MD_CTX_init(&ctx); |
| 142 | i=OBJ_obj2nid(a->algorithm); | 140 | |
| 143 | type=EVP_get_digestbyname(OBJ_nid2sn(i)); | 141 | /* Convert signature OID into digest and public key OIDs */ |
| 142 | if (!OBJ_find_sigid_algs(OBJ_obj2nid(a->algorithm), &mdnid, &pknid)) | ||
| 143 | { | ||
| 144 | ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM); | ||
| 145 | goto err; | ||
| 146 | } | ||
| 147 | type=EVP_get_digestbynid(mdnid); | ||
| 144 | if (type == NULL) | 148 | if (type == NULL) |
| 145 | { | 149 | { |
| 146 | ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM); | 150 | ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM); |
| 147 | goto err; | 151 | goto err; |
| 148 | } | 152 | } |
| 149 | 153 | ||
| 154 | /* Check public key OID matches public key type */ | ||
| 155 | if (EVP_PKEY_type(pknid) != pkey->ameth->pkey_id) | ||
| 156 | { | ||
| 157 | ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_WRONG_PUBLIC_KEY_TYPE); | ||
| 158 | goto err; | ||
| 159 | } | ||
| 160 | |||
| 150 | if (!EVP_VerifyInit_ex(&ctx,type, NULL)) | 161 | if (!EVP_VerifyInit_ex(&ctx,type, NULL)) |
| 151 | { | 162 | { |
| 152 | ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB); | 163 | ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB); |
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index e3385226d4..f7718b5a94 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
| @@ -213,7 +213,7 @@ typedef struct asn1_object_st | |||
| 213 | const char *sn,*ln; | 213 | const char *sn,*ln; |
| 214 | int nid; | 214 | int nid; |
| 215 | int length; | 215 | int length; |
| 216 | unsigned char *data; | 216 | const unsigned char *data; /* data remains const after init */ |
| 217 | int flags; /* Should we free this one */ | 217 | int flags; /* Should we free this one */ |
| 218 | } ASN1_OBJECT; | 218 | } ASN1_OBJECT; |
| 219 | 219 | ||
| @@ -228,8 +228,12 @@ typedef struct asn1_object_st | |||
| 228 | * complete and is a place holder for content when it had all been | 228 | * complete and is a place holder for content when it had all been |
| 229 | * accessed. The flag will be reset when content has been written to it. | 229 | * accessed. The flag will be reset when content has been written to it. |
| 230 | */ | 230 | */ |
| 231 | #define ASN1_STRING_FLAG_CONT 0x020 | ||
| 232 | 231 | ||
| 232 | #define ASN1_STRING_FLAG_CONT 0x020 | ||
| 233 | /* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING | ||
| 234 | * type. | ||
| 235 | */ | ||
| 236 | #define ASN1_STRING_FLAG_MSTRING 0x040 | ||
| 233 | /* This is the base type that holds just about everything :-) */ | 237 | /* This is the base type that holds just about everything :-) */ |
| 234 | typedef struct asn1_string_st | 238 | typedef struct asn1_string_st |
| 235 | { | 239 | { |
| @@ -330,6 +334,13 @@ typedef struct ASN1_VALUE_st ASN1_VALUE; | |||
| 330 | type *name##_new(void); \ | 334 | type *name##_new(void); \ |
| 331 | void name##_free(type *a); | 335 | void name##_free(type *a); |
| 332 | 336 | ||
| 337 | #define DECLARE_ASN1_PRINT_FUNCTION(stname) \ | ||
| 338 | DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) | ||
| 339 | |||
| 340 | #define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ | ||
| 341 | int fname##_print_ctx(BIO *out, stname *x, int indent, \ | ||
| 342 | const ASN1_PCTX *pctx); | ||
| 343 | |||
| 333 | #define D2I_OF(type) type *(*)(type **,const unsigned char **,long) | 344 | #define D2I_OF(type) type *(*)(type **,const unsigned char **,long) |
| 334 | #define I2D_OF(type) int (*)(type *,unsigned char **) | 345 | #define I2D_OF(type) int (*)(type *,unsigned char **) |
| 335 | #define I2D_OF_const(type) int (*)(const type *,unsigned char **) | 346 | #define I2D_OF_const(type) int (*)(const type *,unsigned char **) |
| @@ -534,28 +545,23 @@ typedef struct asn1_type_st | |||
| 534 | * contain the set or sequence bytes */ | 545 | * contain the set or sequence bytes */ |
| 535 | ASN1_STRING * set; | 546 | ASN1_STRING * set; |
| 536 | ASN1_STRING * sequence; | 547 | ASN1_STRING * sequence; |
| 537 | ASN1_VALUE * asn1_value; | 548 | ASN1_VALUE * asn1_value; |
| 538 | } value; | 549 | } value; |
| 539 | } ASN1_TYPE; | 550 | } ASN1_TYPE; |
| 540 | 551 | ||
| 541 | DECLARE_STACK_OF(ASN1_TYPE) | 552 | DECLARE_STACK_OF(ASN1_TYPE) |
| 542 | DECLARE_ASN1_SET_OF(ASN1_TYPE) | 553 | DECLARE_ASN1_SET_OF(ASN1_TYPE) |
| 543 | 554 | ||
| 544 | typedef struct asn1_method_st | 555 | typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; |
| 545 | { | 556 | |
| 546 | i2d_of_void *i2d; | 557 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) |
| 547 | d2i_of_void *d2i; | 558 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) |
| 548 | void *(*create)(void); | 559 | |
| 549 | void (*destroy)(void *); | 560 | typedef struct NETSCAPE_X509_st |
| 550 | } ASN1_METHOD; | ||
| 551 | |||
| 552 | /* This is used when parsing some Netscape objects */ | ||
| 553 | typedef struct asn1_header_st | ||
| 554 | { | 561 | { |
| 555 | ASN1_OCTET_STRING *header; | 562 | ASN1_OCTET_STRING *header; |
| 556 | void *data; | 563 | X509 *cert; |
| 557 | ASN1_METHOD *meth; | 564 | } NETSCAPE_X509; |
| 558 | } ASN1_HEADER; | ||
| 559 | 565 | ||
| 560 | /* This is used to contain a list of bit names */ | 566 | /* This is used to contain a list of bit names */ |
| 561 | typedef struct BIT_STRING_BITNAME_st { | 567 | typedef struct BIT_STRING_BITNAME_st { |
| @@ -575,32 +581,34 @@ typedef struct BIT_STRING_BITNAME_st { | |||
| 575 | ASN1_STRING_type_new(V_ASN1_BIT_STRING) | 581 | ASN1_STRING_type_new(V_ASN1_BIT_STRING) |
| 576 | #define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 582 | #define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 577 | #define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ | 583 | #define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ |
| 578 | ASN1_STRING_dup((ASN1_STRING *)a) | 584 | ASN1_STRING_dup((const ASN1_STRING *)a) |
| 579 | #define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ | 585 | #define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ |
| 580 | (ASN1_STRING *)a,(ASN1_STRING *)b) | 586 | (const ASN1_STRING *)a,(const ASN1_STRING *)b) |
| 581 | #define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) | 587 | #define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) |
| 582 | 588 | ||
| 583 | #define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\ | 589 | #define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\ |
| 584 | ASN1_STRING_type_new(V_ASN1_INTEGER) | 590 | ASN1_STRING_type_new(V_ASN1_INTEGER) |
| 585 | #define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 591 | #define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 586 | #define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a) | 592 | #define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)\ |
| 593 | ASN1_STRING_dup((const ASN1_STRING *)a) | ||
| 587 | #define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ | 594 | #define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ |
| 588 | (ASN1_STRING *)a,(ASN1_STRING *)b) | 595 | (const ASN1_STRING *)a,(const ASN1_STRING *)b) |
| 589 | 596 | ||
| 590 | #define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ | 597 | #define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ |
| 591 | ASN1_STRING_type_new(V_ASN1_ENUMERATED) | 598 | ASN1_STRING_type_new(V_ASN1_ENUMERATED) |
| 592 | #define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 599 | #define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 593 | #define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a) | 600 | #define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)\ |
| 601 | ASN1_STRING_dup((const ASN1_STRING *)a) | ||
| 594 | #define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ | 602 | #define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ |
| 595 | (ASN1_STRING *)a,(ASN1_STRING *)b) | 603 | (const ASN1_STRING *)a,(const ASN1_STRING *)b) |
| 596 | 604 | ||
| 597 | #define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ | 605 | #define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ |
| 598 | ASN1_STRING_type_new(V_ASN1_OCTET_STRING) | 606 | ASN1_STRING_type_new(V_ASN1_OCTET_STRING) |
| 599 | #define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 607 | #define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 600 | #define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ | 608 | #define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ |
| 601 | ASN1_STRING_dup((ASN1_STRING *)a) | 609 | ASN1_STRING_dup((const ASN1_STRING *)a) |
| 602 | #define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ | 610 | #define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ |
| 603 | (ASN1_STRING *)a,(ASN1_STRING *)b) | 611 | (const ASN1_STRING *)a,(const ASN1_STRING *)b) |
| 604 | #define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) | 612 | #define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) |
| 605 | #define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b) | 613 | #define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b) |
| 606 | #define M_i2d_ASN1_OCTET_STRING(a,pp) \ | 614 | #define M_i2d_ASN1_OCTET_STRING(a,pp) \ |
| @@ -684,7 +692,7 @@ typedef struct BIT_STRING_BITNAME_st { | |||
| 684 | ASN1_STRING_type_new(V_ASN1_IA5STRING) | 692 | ASN1_STRING_type_new(V_ASN1_IA5STRING) |
| 685 | #define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 693 | #define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 686 | #define M_ASN1_IA5STRING_dup(a) \ | 694 | #define M_ASN1_IA5STRING_dup(a) \ |
| 687 | (ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a) | 695 | (ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a) |
| 688 | #define M_i2d_ASN1_IA5STRING(a,pp) \ | 696 | #define M_i2d_ASN1_IA5STRING(a,pp) \ |
| 689 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ | 697 | i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ |
| 690 | V_ASN1_UNIVERSAL) | 698 | V_ASN1_UNIVERSAL) |
| @@ -695,18 +703,20 @@ typedef struct BIT_STRING_BITNAME_st { | |||
| 695 | #define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\ | 703 | #define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\ |
| 696 | ASN1_STRING_type_new(V_ASN1_UTCTIME) | 704 | ASN1_STRING_type_new(V_ASN1_UTCTIME) |
| 697 | #define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 705 | #define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 698 | #define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a) | 706 | #define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)\ |
| 707 | ASN1_STRING_dup((const ASN1_STRING *)a) | ||
| 699 | 708 | ||
| 700 | #define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ | 709 | #define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ |
| 701 | ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) | 710 | ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) |
| 702 | #define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 711 | #define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 703 | #define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\ | 712 | #define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\ |
| 704 | (ASN1_STRING *)a) | 713 | (const ASN1_STRING *)a) |
| 705 | 714 | ||
| 706 | #define M_ASN1_TIME_new() (ASN1_TIME *)\ | 715 | #define M_ASN1_TIME_new() (ASN1_TIME *)\ |
| 707 | ASN1_STRING_type_new(V_ASN1_UTCTIME) | 716 | ASN1_STRING_type_new(V_ASN1_UTCTIME) |
| 708 | #define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) | 717 | #define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) |
| 709 | #define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a) | 718 | #define M_ASN1_TIME_dup(a) (ASN1_TIME *)\ |
| 719 | ASN1_STRING_dup((const ASN1_STRING *)a) | ||
| 710 | 720 | ||
| 711 | #define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ | 721 | #define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ |
| 712 | ASN1_STRING_type_new(V_ASN1_GENERALSTRING) | 722 | ASN1_STRING_type_new(V_ASN1_GENERALSTRING) |
| @@ -767,6 +777,7 @@ DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) | |||
| 767 | int ASN1_TYPE_get(ASN1_TYPE *a); | 777 | int ASN1_TYPE_get(ASN1_TYPE *a); |
| 768 | void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); | 778 | void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); |
| 769 | int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); | 779 | int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); |
| 780 | int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b); | ||
| 770 | 781 | ||
| 771 | ASN1_OBJECT * ASN1_OBJECT_new(void ); | 782 | ASN1_OBJECT * ASN1_OBJECT_new(void ); |
| 772 | void ASN1_OBJECT_free(ASN1_OBJECT *a); | 783 | void ASN1_OBJECT_free(ASN1_OBJECT *a); |
| @@ -783,14 +794,15 @@ DECLARE_ASN1_SET_OF(ASN1_OBJECT) | |||
| 783 | 794 | ||
| 784 | ASN1_STRING * ASN1_STRING_new(void); | 795 | ASN1_STRING * ASN1_STRING_new(void); |
| 785 | void ASN1_STRING_free(ASN1_STRING *a); | 796 | void ASN1_STRING_free(ASN1_STRING *a); |
| 786 | ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); | 797 | int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); |
| 798 | ASN1_STRING * ASN1_STRING_dup(const ASN1_STRING *a); | ||
| 787 | ASN1_STRING * ASN1_STRING_type_new(int type ); | 799 | ASN1_STRING * ASN1_STRING_type_new(int type ); |
| 788 | int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); | 800 | int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); |
| 789 | /* Since this is used to store all sorts of things, via macros, for now, make | 801 | /* Since this is used to store all sorts of things, via macros, for now, make |
| 790 | its data void * */ | 802 | its data void * */ |
| 791 | int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); | 803 | int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); |
| 792 | void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); | 804 | void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); |
| 793 | int ASN1_STRING_length(ASN1_STRING *x); | 805 | int ASN1_STRING_length(const ASN1_STRING *x); |
| 794 | void ASN1_STRING_length_set(ASN1_STRING *x, int n); | 806 | void ASN1_STRING_length_set(ASN1_STRING *x, int n); |
| 795 | int ASN1_STRING_type(ASN1_STRING *x); | 807 | int ASN1_STRING_type(ASN1_STRING *x); |
| 796 | unsigned char * ASN1_STRING_data(ASN1_STRING *x); | 808 | unsigned char * ASN1_STRING_data(ASN1_STRING *x); |
| @@ -803,6 +815,8 @@ int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, | |||
| 803 | int length ); | 815 | int length ); |
| 804 | int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); | 816 | int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); |
| 805 | int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); | 817 | int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); |
| 818 | int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, | ||
| 819 | unsigned char *flags, int flags_len); | ||
| 806 | 820 | ||
| 807 | #ifndef OPENSSL_NO_BIO | 821 | #ifndef OPENSSL_NO_BIO |
| 808 | int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, | 822 | int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, |
| @@ -821,13 +835,15 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp, | |||
| 821 | long length); | 835 | long length); |
| 822 | ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, | 836 | ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, |
| 823 | long length); | 837 | long length); |
| 824 | ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x); | 838 | ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x); |
| 825 | int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y); | 839 | int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); |
| 826 | 840 | ||
| 827 | DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) | 841 | DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) |
| 828 | 842 | ||
| 829 | int ASN1_UTCTIME_check(ASN1_UTCTIME *a); | 843 | int ASN1_UTCTIME_check(ASN1_UTCTIME *a); |
| 830 | ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); | 844 | ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); |
| 845 | ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, | ||
| 846 | int offset_day, long offset_sec); | ||
| 831 | int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); | 847 | int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); |
| 832 | int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); | 848 | int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); |
| 833 | #if 0 | 849 | #if 0 |
| @@ -836,11 +852,13 @@ time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s); | |||
| 836 | 852 | ||
| 837 | int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); | 853 | int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); |
| 838 | ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); | 854 | ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); |
| 855 | ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, | ||
| 856 | time_t t, int offset_day, long offset_sec); | ||
| 839 | int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); | 857 | int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); |
| 840 | 858 | ||
| 841 | DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) | 859 | DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) |
| 842 | ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a); | 860 | ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); |
| 843 | int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b); | 861 | int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b); |
| 844 | int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); | 862 | int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); |
| 845 | 863 | ||
| 846 | DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) | 864 | DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) |
| @@ -867,14 +885,20 @@ DECLARE_ASN1_FUNCTIONS(ASN1_TIME) | |||
| 867 | DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) | 885 | DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) |
| 868 | 886 | ||
| 869 | ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); | 887 | ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); |
| 888 | ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t, | ||
| 889 | int offset_day, long offset_sec); | ||
| 870 | int ASN1_TIME_check(ASN1_TIME *t); | 890 | int ASN1_TIME_check(ASN1_TIME *t); |
| 871 | ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); | 891 | ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); |
| 892 | int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); | ||
| 872 | 893 | ||
| 873 | int i2d_ASN1_SET(STACK *a, unsigned char **pp, | 894 | int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp, |
| 874 | i2d_of_void *i2d, int ex_tag, int ex_class, int is_set); | 895 | i2d_of_void *i2d, int ex_tag, int ex_class, |
| 875 | STACK * d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length, | 896 | int is_set); |
| 876 | d2i_of_void *d2i, void (*free_func)(void *), | 897 | STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a, |
| 877 | int ex_tag, int ex_class); | 898 | const unsigned char **pp, |
| 899 | long length, d2i_of_void *d2i, | ||
| 900 | void (*free_func)(OPENSSL_BLOCK), int ex_tag, | ||
| 901 | int ex_class); | ||
| 878 | 902 | ||
| 879 | #ifndef OPENSSL_NO_BIO | 903 | #ifndef OPENSSL_NO_BIO |
| 880 | int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); | 904 | int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); |
| @@ -892,9 +916,9 @@ ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, | |||
| 892 | const char *sn, const char *ln); | 916 | const char *sn, const char *ln); |
| 893 | 917 | ||
| 894 | int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); | 918 | int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); |
| 895 | long ASN1_INTEGER_get(ASN1_INTEGER *a); | 919 | long ASN1_INTEGER_get(const ASN1_INTEGER *a); |
| 896 | ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); | 920 | ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); |
| 897 | BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); | 921 | BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai,BIGNUM *bn); |
| 898 | 922 | ||
| 899 | int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); | 923 | int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); |
| 900 | long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); | 924 | long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); |
| @@ -928,7 +952,7 @@ int ASN1_put_eoc(unsigned char **pp); | |||
| 928 | int ASN1_object_size(int constructed, int length, int tag); | 952 | int ASN1_object_size(int constructed, int length, int tag); |
| 929 | 953 | ||
| 930 | /* Used to implement other functions */ | 954 | /* Used to implement other functions */ |
| 931 | void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x); | 955 | void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); |
| 932 | 956 | ||
| 933 | #define ASN1_dup_of(type,i2d,d2i,x) \ | 957 | #define ASN1_dup_of(type,i2d,d2i,x) \ |
| 934 | ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ | 958 | ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ |
| @@ -999,29 +1023,23 @@ int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x); | |||
| 999 | CHECKED_PTR_OF(const type, x))) | 1023 | CHECKED_PTR_OF(const type, x))) |
| 1000 | 1024 | ||
| 1001 | int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); | 1025 | int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); |
| 1002 | int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); | 1026 | int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); |
| 1003 | int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); | 1027 | int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); |
| 1004 | int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); | 1028 | int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); |
| 1005 | int ASN1_STRING_print(BIO *bp,ASN1_STRING *v); | 1029 | int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); |
| 1006 | int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); | 1030 | int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); |
| 1031 | int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, | ||
| 1032 | unsigned char *buf, int off); | ||
| 1007 | int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); | 1033 | int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); |
| 1008 | int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); | 1034 | int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); |
| 1009 | #endif | 1035 | #endif |
| 1010 | const char *ASN1_tag2str(int tag); | 1036 | const char *ASN1_tag2str(int tag); |
| 1011 | 1037 | ||
| 1012 | /* Used to load and write netscape format cert/key */ | 1038 | /* Used to load and write netscape format cert */ |
| 1013 | int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp); | ||
| 1014 | ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, long length); | ||
| 1015 | ASN1_HEADER *ASN1_HEADER_new(void ); | ||
| 1016 | void ASN1_HEADER_free(ASN1_HEADER *a); | ||
| 1017 | 1039 | ||
| 1018 | int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); | 1040 | DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509) |
| 1019 | 1041 | ||
| 1020 | /* Not used that much at this point, except for the first two */ | 1042 | int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); |
| 1021 | ASN1_METHOD *X509_asn1_meth(void); | ||
| 1022 | ASN1_METHOD *RSAPrivateKey_asn1_meth(void); | ||
| 1023 | ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void); | ||
| 1024 | ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void); | ||
| 1025 | 1043 | ||
| 1026 | int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, | 1044 | int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, |
| 1027 | unsigned char *data, int len); | 1045 | unsigned char *data, int len); |
| @@ -1032,9 +1050,9 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, | |||
| 1032 | int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, | 1050 | int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, |
| 1033 | unsigned char *data, int max_len); | 1051 | unsigned char *data, int max_len); |
| 1034 | 1052 | ||
| 1035 | STACK *ASN1_seq_unpack(const unsigned char *buf, int len, | 1053 | STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len, |
| 1036 | d2i_of_void *d2i, void (*free_func)(void *)); | 1054 | d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK)); |
| 1037 | unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d, | 1055 | unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d, |
| 1038 | unsigned char **buf, int *len ); | 1056 | unsigned char **buf, int *len ); |
| 1039 | void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); | 1057 | void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); |
| 1040 | void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); | 1058 | void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); |
| @@ -1077,15 +1095,58 @@ void ASN1_add_oid_module(void); | |||
| 1077 | ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); | 1095 | ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); |
| 1078 | ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); | 1096 | ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); |
| 1079 | 1097 | ||
| 1080 | typedef int asn1_output_data_fn(BIO *out, BIO *data, ASN1_VALUE *val, int flags, | 1098 | /* ASN1 Print flags */ |
| 1081 | const ASN1_ITEM *it); | 1099 | |
| 1082 | 1100 | /* Indicate missing OPTIONAL fields */ | |
| 1083 | int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, | 1101 | #define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 |
| 1102 | /* Mark start and end of SEQUENCE */ | ||
| 1103 | #define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 | ||
| 1104 | /* Mark start and end of SEQUENCE/SET OF */ | ||
| 1105 | #define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 | ||
| 1106 | /* Show the ASN1 type of primitives */ | ||
| 1107 | #define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 | ||
| 1108 | /* Don't show ASN1 type of ANY */ | ||
| 1109 | #define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 | ||
| 1110 | /* Don't show ASN1 type of MSTRINGs */ | ||
| 1111 | #define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 | ||
| 1112 | /* Don't show field names in SEQUENCE */ | ||
| 1113 | #define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 | ||
| 1114 | /* Show structure names of each SEQUENCE field */ | ||
| 1115 | #define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 | ||
| 1116 | /* Don't show structure name even at top level */ | ||
| 1117 | #define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 | ||
| 1118 | |||
| 1119 | int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, | ||
| 1120 | const ASN1_ITEM *it, const ASN1_PCTX *pctx); | ||
| 1121 | ASN1_PCTX *ASN1_PCTX_new(void); | ||
| 1122 | void ASN1_PCTX_free(ASN1_PCTX *p); | ||
| 1123 | unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p); | ||
| 1124 | void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); | ||
| 1125 | unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p); | ||
| 1126 | void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); | ||
| 1127 | unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p); | ||
| 1128 | void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); | ||
| 1129 | unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p); | ||
| 1130 | void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); | ||
| 1131 | unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p); | ||
| 1132 | void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); | ||
| 1133 | |||
| 1134 | BIO_METHOD *BIO_f_asn1(void); | ||
| 1135 | |||
| 1136 | BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); | ||
| 1137 | |||
| 1138 | int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, | ||
| 1139 | const ASN1_ITEM *it); | ||
| 1140 | int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, | ||
| 1141 | const char *hdr, | ||
| 1142 | const ASN1_ITEM *it); | ||
| 1143 | int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, | ||
| 1084 | int ctype_nid, int econt_nid, | 1144 | int ctype_nid, int econt_nid, |
| 1085 | STACK_OF(X509_ALGOR) *mdalgs, | 1145 | STACK_OF(X509_ALGOR) *mdalgs, |
| 1086 | asn1_output_data_fn *data_fn, | ||
| 1087 | const ASN1_ITEM *it); | 1146 | const ASN1_ITEM *it); |
| 1088 | ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); | 1147 | ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); |
| 1148 | int SMIME_crlf_copy(BIO *in, BIO *out, int flags); | ||
| 1149 | int SMIME_text(BIO *in, BIO *out); | ||
| 1089 | 1150 | ||
| 1090 | /* BEGIN ERROR CODES */ | 1151 | /* BEGIN ERROR CODES */ |
| 1091 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 1152 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| @@ -1116,6 +1177,7 @@ void ERR_load_ASN1_strings(void); | |||
| 1116 | #define ASN1_F_ASN1_ENUMERATED_TO_BN 113 | 1177 | #define ASN1_F_ASN1_ENUMERATED_TO_BN 113 |
| 1117 | #define ASN1_F_ASN1_EX_C2I 204 | 1178 | #define ASN1_F_ASN1_EX_C2I 204 |
| 1118 | #define ASN1_F_ASN1_FIND_END 190 | 1179 | #define ASN1_F_ASN1_FIND_END 190 |
| 1180 | #define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216 | ||
| 1119 | #define ASN1_F_ASN1_GENERALIZEDTIME_SET 185 | 1181 | #define ASN1_F_ASN1_GENERALIZEDTIME_SET 185 |
| 1120 | #define ASN1_F_ASN1_GENERATE_V3 178 | 1182 | #define ASN1_F_ASN1_GENERATE_V3 178 |
| 1121 | #define ASN1_F_ASN1_GET_OBJECT 114 | 1183 | #define ASN1_F_ASN1_GET_OBJECT 114 |
| @@ -1136,7 +1198,7 @@ void ERR_load_ASN1_strings(void); | |||
| 1136 | #define ASN1_F_ASN1_ITEM_VERIFY 197 | 1198 | #define ASN1_F_ASN1_ITEM_VERIFY 197 |
| 1137 | #define ASN1_F_ASN1_MBSTRING_NCOPY 122 | 1199 | #define ASN1_F_ASN1_MBSTRING_NCOPY 122 |
| 1138 | #define ASN1_F_ASN1_OBJECT_NEW 123 | 1200 | #define ASN1_F_ASN1_OBJECT_NEW 123 |
| 1139 | #define ASN1_F_ASN1_OUTPUT_DATA 207 | 1201 | #define ASN1_F_ASN1_OUTPUT_DATA 214 |
| 1140 | #define ASN1_F_ASN1_PACK_STRING 124 | 1202 | #define ASN1_F_ASN1_PACK_STRING 124 |
| 1141 | #define ASN1_F_ASN1_PCTX_NEW 205 | 1203 | #define ASN1_F_ASN1_PCTX_NEW 205 |
| 1142 | #define ASN1_F_ASN1_PKCS5_PBE_SET 125 | 1204 | #define ASN1_F_ASN1_PKCS5_PBE_SET 125 |
| @@ -1150,14 +1212,17 @@ void ERR_load_ASN1_strings(void); | |||
| 1150 | #define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 | 1212 | #define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 |
| 1151 | #define ASN1_F_ASN1_TEMPLATE_NEW 133 | 1213 | #define ASN1_F_ASN1_TEMPLATE_NEW 133 |
| 1152 | #define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 | 1214 | #define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 |
| 1215 | #define ASN1_F_ASN1_TIME_ADJ 217 | ||
| 1153 | #define ASN1_F_ASN1_TIME_SET 175 | 1216 | #define ASN1_F_ASN1_TIME_SET 175 |
| 1154 | #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 | 1217 | #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 |
| 1155 | #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 | 1218 | #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 |
| 1156 | #define ASN1_F_ASN1_UNPACK_STRING 136 | 1219 | #define ASN1_F_ASN1_UNPACK_STRING 136 |
| 1220 | #define ASN1_F_ASN1_UTCTIME_ADJ 218 | ||
| 1157 | #define ASN1_F_ASN1_UTCTIME_SET 187 | 1221 | #define ASN1_F_ASN1_UTCTIME_SET 187 |
| 1158 | #define ASN1_F_ASN1_VERIFY 137 | 1222 | #define ASN1_F_ASN1_VERIFY 137 |
| 1159 | #define ASN1_F_B64_READ_ASN1 208 | 1223 | #define ASN1_F_B64_READ_ASN1 209 |
| 1160 | #define ASN1_F_B64_WRITE_ASN1 209 | 1224 | #define ASN1_F_B64_WRITE_ASN1 210 |
| 1225 | #define ASN1_F_BIO_NEW_NDEF 208 | ||
| 1161 | #define ASN1_F_BITSTR_CB 180 | 1226 | #define ASN1_F_BITSTR_CB 180 |
| 1162 | #define ASN1_F_BN_TO_ASN1_ENUMERATED 138 | 1227 | #define ASN1_F_BN_TO_ASN1_ENUMERATED 138 |
| 1163 | #define ASN1_F_BN_TO_ASN1_INTEGER 139 | 1228 | #define ASN1_F_BN_TO_ASN1_INTEGER 139 |
| @@ -1176,6 +1241,7 @@ void ERR_load_ASN1_strings(void); | |||
| 1176 | #define ASN1_F_D2I_ASN1_TYPE_BYTES 149 | 1241 | #define ASN1_F_D2I_ASN1_TYPE_BYTES 149 |
| 1177 | #define ASN1_F_D2I_ASN1_UINTEGER 150 | 1242 | #define ASN1_F_D2I_ASN1_UINTEGER 150 |
| 1178 | #define ASN1_F_D2I_ASN1_UTCTIME 151 | 1243 | #define ASN1_F_D2I_ASN1_UTCTIME 151 |
| 1244 | #define ASN1_F_D2I_AUTOPRIVATEKEY 207 | ||
| 1179 | #define ASN1_F_D2I_NETSCAPE_RSA 152 | 1245 | #define ASN1_F_D2I_NETSCAPE_RSA 152 |
| 1180 | #define ASN1_F_D2I_NETSCAPE_RSA_2 153 | 1246 | #define ASN1_F_D2I_NETSCAPE_RSA_2 153 |
| 1181 | #define ASN1_F_D2I_PRIVATEKEY 154 | 1247 | #define ASN1_F_D2I_PRIVATEKEY 154 |
| @@ -1185,6 +1251,7 @@ void ERR_load_ASN1_strings(void); | |||
| 1185 | #define ASN1_F_D2I_X509 156 | 1251 | #define ASN1_F_D2I_X509 156 |
| 1186 | #define ASN1_F_D2I_X509_CINF 157 | 1252 | #define ASN1_F_D2I_X509_CINF 157 |
| 1187 | #define ASN1_F_D2I_X509_PKEY 159 | 1253 | #define ASN1_F_D2I_X509_PKEY 159 |
| 1254 | #define ASN1_F_I2D_ASN1_BIO_STREAM 211 | ||
| 1188 | #define ASN1_F_I2D_ASN1_SET 188 | 1255 | #define ASN1_F_I2D_ASN1_SET 188 |
| 1189 | #define ASN1_F_I2D_ASN1_TIME 160 | 1256 | #define ASN1_F_I2D_ASN1_TIME 160 |
| 1190 | #define ASN1_F_I2D_DSA_PUBKEY 161 | 1257 | #define ASN1_F_I2D_DSA_PUBKEY 161 |
| @@ -1196,10 +1263,11 @@ void ERR_load_ASN1_strings(void); | |||
| 1196 | #define ASN1_F_LONG_C2I 166 | 1263 | #define ASN1_F_LONG_C2I 166 |
| 1197 | #define ASN1_F_OID_MODULE_INIT 174 | 1264 | #define ASN1_F_OID_MODULE_INIT 174 |
| 1198 | #define ASN1_F_PARSE_TAGGING 182 | 1265 | #define ASN1_F_PARSE_TAGGING 182 |
| 1199 | #define ASN1_F_PKCS5_PBE2_SET 167 | 1266 | #define ASN1_F_PKCS5_PBE2_SET_IV 167 |
| 1200 | #define ASN1_F_PKCS5_PBE_SET 202 | 1267 | #define ASN1_F_PKCS5_PBE_SET 202 |
| 1201 | #define ASN1_F_SMIME_READ_ASN1 210 | 1268 | #define ASN1_F_PKCS5_PBE_SET0_ALGOR 215 |
| 1202 | #define ASN1_F_SMIME_TEXT 211 | 1269 | #define ASN1_F_SMIME_READ_ASN1 212 |
| 1270 | #define ASN1_F_SMIME_TEXT 213 | ||
| 1203 | #define ASN1_F_X509_CINF_NEW 168 | 1271 | #define ASN1_F_X509_CINF_NEW 168 |
| 1204 | #define ASN1_F_X509_CRL_ADD0_REVOKED 169 | 1272 | #define ASN1_F_X509_CRL_ADD0_REVOKED 169 |
| 1205 | #define ASN1_F_X509_INFO_NEW 170 | 1273 | #define ASN1_F_X509_INFO_NEW 170 |
| @@ -1211,14 +1279,14 @@ void ERR_load_ASN1_strings(void); | |||
| 1211 | 1279 | ||
| 1212 | /* Reason codes. */ | 1280 | /* Reason codes. */ |
| 1213 | #define ASN1_R_ADDING_OBJECT 171 | 1281 | #define ASN1_R_ADDING_OBJECT 171 |
| 1214 | #define ASN1_R_ASN1_PARSE_ERROR 198 | 1282 | #define ASN1_R_ASN1_PARSE_ERROR 203 |
| 1215 | #define ASN1_R_ASN1_SIG_PARSE_ERROR 199 | 1283 | #define ASN1_R_ASN1_SIG_PARSE_ERROR 204 |
| 1216 | #define ASN1_R_AUX_ERROR 100 | 1284 | #define ASN1_R_AUX_ERROR 100 |
| 1217 | #define ASN1_R_BAD_CLASS 101 | 1285 | #define ASN1_R_BAD_CLASS 101 |
| 1218 | #define ASN1_R_BAD_OBJECT_HEADER 102 | 1286 | #define ASN1_R_BAD_OBJECT_HEADER 102 |
| 1219 | #define ASN1_R_BAD_PASSWORD_READ 103 | 1287 | #define ASN1_R_BAD_PASSWORD_READ 103 |
| 1220 | #define ASN1_R_BAD_TAG 104 | 1288 | #define ASN1_R_BAD_TAG 104 |
| 1221 | #define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 210 | 1289 | #define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214 |
| 1222 | #define ASN1_R_BN_LIB 105 | 1290 | #define ASN1_R_BN_LIB 105 |
| 1223 | #define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 | 1291 | #define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 |
| 1224 | #define ASN1_R_BUFFER_TOO_SMALL 107 | 1292 | #define ASN1_R_BUFFER_TOO_SMALL 107 |
| @@ -1227,6 +1295,7 @@ void ERR_load_ASN1_strings(void); | |||
| 1227 | #define ASN1_R_DECODE_ERROR 110 | 1295 | #define ASN1_R_DECODE_ERROR 110 |
| 1228 | #define ASN1_R_DECODING_ERROR 111 | 1296 | #define ASN1_R_DECODING_ERROR 111 |
| 1229 | #define ASN1_R_DEPTH_EXCEEDED 174 | 1297 | #define ASN1_R_DEPTH_EXCEEDED 174 |
| 1298 | #define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198 | ||
| 1230 | #define ASN1_R_ENCODE_ERROR 112 | 1299 | #define ASN1_R_ENCODE_ERROR 112 |
| 1231 | #define ASN1_R_ERROR_GETTING_TIME 173 | 1300 | #define ASN1_R_ERROR_GETTING_TIME 173 |
| 1232 | #define ASN1_R_ERROR_LOADING_SECTION 172 | 1301 | #define ASN1_R_ERROR_LOADING_SECTION 172 |
| @@ -1260,9 +1329,10 @@ void ERR_load_ASN1_strings(void); | |||
| 1260 | #define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 | 1329 | #define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 |
| 1261 | #define ASN1_R_INVALID_BMPSTRING_LENGTH 129 | 1330 | #define ASN1_R_INVALID_BMPSTRING_LENGTH 129 |
| 1262 | #define ASN1_R_INVALID_DIGIT 130 | 1331 | #define ASN1_R_INVALID_DIGIT 130 |
| 1263 | #define ASN1_R_INVALID_MIME_TYPE 200 | 1332 | #define ASN1_R_INVALID_MIME_TYPE 205 |
| 1264 | #define ASN1_R_INVALID_MODIFIER 186 | 1333 | #define ASN1_R_INVALID_MODIFIER 186 |
| 1265 | #define ASN1_R_INVALID_NUMBER 187 | 1334 | #define ASN1_R_INVALID_NUMBER 187 |
| 1335 | #define ASN1_R_INVALID_OBJECT_ENCODING 216 | ||
| 1266 | #define ASN1_R_INVALID_SEPARATOR 131 | 1336 | #define ASN1_R_INVALID_SEPARATOR 131 |
| 1267 | #define ASN1_R_INVALID_TIME_FORMAT 132 | 1337 | #define ASN1_R_INVALID_TIME_FORMAT 132 |
| 1268 | #define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 | 1338 | #define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 |
| @@ -1270,9 +1340,9 @@ void ERR_load_ASN1_strings(void); | |||
| 1270 | #define ASN1_R_IV_TOO_LARGE 135 | 1340 | #define ASN1_R_IV_TOO_LARGE 135 |
| 1271 | #define ASN1_R_LENGTH_ERROR 136 | 1341 | #define ASN1_R_LENGTH_ERROR 136 |
| 1272 | #define ASN1_R_LIST_ERROR 188 | 1342 | #define ASN1_R_LIST_ERROR 188 |
| 1273 | #define ASN1_R_MIME_NO_CONTENT_TYPE 201 | 1343 | #define ASN1_R_MIME_NO_CONTENT_TYPE 206 |
| 1274 | #define ASN1_R_MIME_PARSE_ERROR 202 | 1344 | #define ASN1_R_MIME_PARSE_ERROR 207 |
| 1275 | #define ASN1_R_MIME_SIG_PARSE_ERROR 203 | 1345 | #define ASN1_R_MIME_SIG_PARSE_ERROR 208 |
| 1276 | #define ASN1_R_MISSING_EOC 137 | 1346 | #define ASN1_R_MISSING_EOC 137 |
| 1277 | #define ASN1_R_MISSING_SECOND_NUMBER 138 | 1347 | #define ASN1_R_MISSING_SECOND_NUMBER 138 |
| 1278 | #define ASN1_R_MISSING_VALUE 189 | 1348 | #define ASN1_R_MISSING_VALUE 189 |
| @@ -1282,11 +1352,12 @@ void ERR_load_ASN1_strings(void); | |||
| 1282 | #define ASN1_R_NON_HEX_CHARACTERS 141 | 1352 | #define ASN1_R_NON_HEX_CHARACTERS 141 |
| 1283 | #define ASN1_R_NOT_ASCII_FORMAT 190 | 1353 | #define ASN1_R_NOT_ASCII_FORMAT 190 |
| 1284 | #define ASN1_R_NOT_ENOUGH_DATA 142 | 1354 | #define ASN1_R_NOT_ENOUGH_DATA 142 |
| 1285 | #define ASN1_R_NO_CONTENT_TYPE 204 | 1355 | #define ASN1_R_NO_CONTENT_TYPE 209 |
| 1356 | #define ASN1_R_NO_DEFAULT_DIGEST 201 | ||
| 1286 | #define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 | 1357 | #define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 |
| 1287 | #define ASN1_R_NO_MULTIPART_BODY_FAILURE 205 | 1358 | #define ASN1_R_NO_MULTIPART_BODY_FAILURE 210 |
| 1288 | #define ASN1_R_NO_MULTIPART_BOUNDARY 206 | 1359 | #define ASN1_R_NO_MULTIPART_BOUNDARY 211 |
| 1289 | #define ASN1_R_NO_SIG_CONTENT_TYPE 207 | 1360 | #define ASN1_R_NO_SIG_CONTENT_TYPE 212 |
| 1290 | #define ASN1_R_NULL_IS_WRONG_LENGTH 144 | 1361 | #define ASN1_R_NULL_IS_WRONG_LENGTH 144 |
| 1291 | #define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 | 1362 | #define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 |
| 1292 | #define ASN1_R_ODD_NUMBER_OF_CHARS 145 | 1363 | #define ASN1_R_ODD_NUMBER_OF_CHARS 145 |
| @@ -1296,8 +1367,8 @@ void ERR_load_ASN1_strings(void); | |||
| 1296 | #define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 | 1367 | #define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 |
| 1297 | #define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 | 1368 | #define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 |
| 1298 | #define ASN1_R_SHORT_LINE 150 | 1369 | #define ASN1_R_SHORT_LINE 150 |
| 1299 | #define ASN1_R_SIG_INVALID_MIME_TYPE 208 | 1370 | #define ASN1_R_SIG_INVALID_MIME_TYPE 213 |
| 1300 | #define ASN1_R_STREAMING_NOT_SUPPORTED 209 | 1371 | #define ASN1_R_STREAMING_NOT_SUPPORTED 202 |
| 1301 | #define ASN1_R_STRING_TOO_LONG 151 | 1372 | #define ASN1_R_STRING_TOO_LONG 151 |
| 1302 | #define ASN1_R_STRING_TOO_SHORT 152 | 1373 | #define ASN1_R_STRING_TOO_SHORT 152 |
| 1303 | #define ASN1_R_TAG_VALUE_TOO_HIGH 153 | 1374 | #define ASN1_R_TAG_VALUE_TOO_HIGH 153 |
| @@ -1308,11 +1379,12 @@ void ERR_load_ASN1_strings(void); | |||
| 1308 | #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 | 1379 | #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 |
| 1309 | #define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158 | 1380 | #define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158 |
| 1310 | #define ASN1_R_UNEXPECTED_EOC 159 | 1381 | #define ASN1_R_UNEXPECTED_EOC 159 |
| 1311 | #define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 211 | 1382 | #define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215 |
| 1312 | #define ASN1_R_UNKNOWN_FORMAT 160 | 1383 | #define ASN1_R_UNKNOWN_FORMAT 160 |
| 1313 | #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 | 1384 | #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 |
| 1314 | #define ASN1_R_UNKNOWN_OBJECT_TYPE 162 | 1385 | #define ASN1_R_UNKNOWN_OBJECT_TYPE 162 |
| 1315 | #define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 | 1386 | #define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 |
| 1387 | #define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199 | ||
| 1316 | #define ASN1_R_UNKNOWN_TAG 194 | 1388 | #define ASN1_R_UNKNOWN_TAG 194 |
| 1317 | #define ASN1_R_UNKOWN_FORMAT 195 | 1389 | #define ASN1_R_UNKOWN_FORMAT 195 |
| 1318 | #define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 | 1390 | #define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 |
| @@ -1320,6 +1392,7 @@ void ERR_load_ASN1_strings(void); | |||
| 1320 | #define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166 | 1392 | #define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166 |
| 1321 | #define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 | 1393 | #define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 |
| 1322 | #define ASN1_R_UNSUPPORTED_TYPE 196 | 1394 | #define ASN1_R_UNSUPPORTED_TYPE 196 |
| 1395 | #define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200 | ||
| 1323 | #define ASN1_R_WRONG_TAG 168 | 1396 | #define ASN1_R_WRONG_TAG 168 |
| 1324 | #define ASN1_R_WRONG_TYPE 169 | 1397 | #define ASN1_R_WRONG_TYPE 169 |
| 1325 | 1398 | ||
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c index 5f5de98eed..6e04d08f31 100644 --- a/src/lib/libcrypto/asn1/asn1_err.c +++ b/src/lib/libcrypto/asn1/asn1_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/asn1/asn1_err.c */ | 1 | /* crypto/asn1/asn1_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2009 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -90,10 +90,11 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
| 90 | {ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"}, | 90 | {ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"}, |
| 91 | {ERR_FUNC(ASN1_F_ASN1_EX_C2I), "ASN1_EX_C2I"}, | 91 | {ERR_FUNC(ASN1_F_ASN1_EX_C2I), "ASN1_EX_C2I"}, |
| 92 | {ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"}, | 92 | {ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"}, |
| 93 | {ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_ADJ), "ASN1_GENERALIZEDTIME_adj"}, | ||
| 93 | {ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET), "ASN1_GENERALIZEDTIME_set"}, | 94 | {ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET), "ASN1_GENERALIZEDTIME_set"}, |
| 94 | {ERR_FUNC(ASN1_F_ASN1_GENERATE_V3), "ASN1_generate_v3"}, | 95 | {ERR_FUNC(ASN1_F_ASN1_GENERATE_V3), "ASN1_generate_v3"}, |
| 95 | {ERR_FUNC(ASN1_F_ASN1_GET_OBJECT), "ASN1_get_object"}, | 96 | {ERR_FUNC(ASN1_F_ASN1_GET_OBJECT), "ASN1_get_object"}, |
| 96 | {ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_new"}, | 97 | {ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_NEW"}, |
| 97 | {ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"}, | 98 | {ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"}, |
| 98 | {ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"}, | 99 | {ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"}, |
| 99 | {ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"}, | 100 | {ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"}, |
| @@ -112,7 +113,7 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
| 112 | {ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW), "ASN1_OBJECT_new"}, | 113 | {ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW), "ASN1_OBJECT_new"}, |
| 113 | {ERR_FUNC(ASN1_F_ASN1_OUTPUT_DATA), "ASN1_OUTPUT_DATA"}, | 114 | {ERR_FUNC(ASN1_F_ASN1_OUTPUT_DATA), "ASN1_OUTPUT_DATA"}, |
| 114 | {ERR_FUNC(ASN1_F_ASN1_PACK_STRING), "ASN1_pack_string"}, | 115 | {ERR_FUNC(ASN1_F_ASN1_PACK_STRING), "ASN1_pack_string"}, |
| 115 | {ERR_FUNC(ASN1_F_ASN1_PCTX_NEW), "ASN1_PCTX_NEW"}, | 116 | {ERR_FUNC(ASN1_F_ASN1_PCTX_NEW), "ASN1_PCTX_new"}, |
| 116 | {ERR_FUNC(ASN1_F_ASN1_PKCS5_PBE_SET), "ASN1_PKCS5_PBE_SET"}, | 117 | {ERR_FUNC(ASN1_F_ASN1_PKCS5_PBE_SET), "ASN1_PKCS5_PBE_SET"}, |
| 117 | {ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"}, | 118 | {ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"}, |
| 118 | {ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"}, | 119 | {ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"}, |
| @@ -124,14 +125,17 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
| 124 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"}, | 125 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"}, |
| 125 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NEW), "ASN1_TEMPLATE_NEW"}, | 126 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NEW), "ASN1_TEMPLATE_NEW"}, |
| 126 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I), "ASN1_TEMPLATE_NOEXP_D2I"}, | 127 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I), "ASN1_TEMPLATE_NOEXP_D2I"}, |
| 128 | {ERR_FUNC(ASN1_F_ASN1_TIME_ADJ), "ASN1_TIME_adj"}, | ||
| 127 | {ERR_FUNC(ASN1_F_ASN1_TIME_SET), "ASN1_TIME_set"}, | 129 | {ERR_FUNC(ASN1_F_ASN1_TIME_SET), "ASN1_TIME_set"}, |
| 128 | {ERR_FUNC(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING), "ASN1_TYPE_get_int_octetstring"}, | 130 | {ERR_FUNC(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING), "ASN1_TYPE_get_int_octetstring"}, |
| 129 | {ERR_FUNC(ASN1_F_ASN1_TYPE_GET_OCTETSTRING), "ASN1_TYPE_get_octetstring"}, | 131 | {ERR_FUNC(ASN1_F_ASN1_TYPE_GET_OCTETSTRING), "ASN1_TYPE_get_octetstring"}, |
| 130 | {ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"}, | 132 | {ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"}, |
| 133 | {ERR_FUNC(ASN1_F_ASN1_UTCTIME_ADJ), "ASN1_UTCTIME_adj"}, | ||
| 131 | {ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"}, | 134 | {ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"}, |
| 132 | {ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"}, | 135 | {ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"}, |
| 133 | {ERR_FUNC(ASN1_F_B64_READ_ASN1), "B64_READ_ASN1"}, | 136 | {ERR_FUNC(ASN1_F_B64_READ_ASN1), "B64_READ_ASN1"}, |
| 134 | {ERR_FUNC(ASN1_F_B64_WRITE_ASN1), "B64_WRITE_ASN1"}, | 137 | {ERR_FUNC(ASN1_F_B64_WRITE_ASN1), "B64_WRITE_ASN1"}, |
| 138 | {ERR_FUNC(ASN1_F_BIO_NEW_NDEF), "BIO_new_NDEF"}, | ||
| 135 | {ERR_FUNC(ASN1_F_BITSTR_CB), "BITSTR_CB"}, | 139 | {ERR_FUNC(ASN1_F_BITSTR_CB), "BITSTR_CB"}, |
| 136 | {ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"}, | 140 | {ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"}, |
| 137 | {ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER), "BN_to_ASN1_INTEGER"}, | 141 | {ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER), "BN_to_ASN1_INTEGER"}, |
| @@ -143,13 +147,14 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
| 143 | {ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"}, | 147 | {ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"}, |
| 144 | {ERR_FUNC(ASN1_F_D2I_ASN1_BYTES), "d2i_ASN1_bytes"}, | 148 | {ERR_FUNC(ASN1_F_D2I_ASN1_BYTES), "d2i_ASN1_bytes"}, |
| 145 | {ERR_FUNC(ASN1_F_D2I_ASN1_GENERALIZEDTIME), "D2I_ASN1_GENERALIZEDTIME"}, | 149 | {ERR_FUNC(ASN1_F_D2I_ASN1_GENERALIZEDTIME), "D2I_ASN1_GENERALIZEDTIME"}, |
| 146 | {ERR_FUNC(ASN1_F_D2I_ASN1_HEADER), "d2i_ASN1_HEADER"}, | 150 | {ERR_FUNC(ASN1_F_D2I_ASN1_HEADER), "D2I_ASN1_HEADER"}, |
| 147 | {ERR_FUNC(ASN1_F_D2I_ASN1_INTEGER), "D2I_ASN1_INTEGER"}, | 151 | {ERR_FUNC(ASN1_F_D2I_ASN1_INTEGER), "D2I_ASN1_INTEGER"}, |
| 148 | {ERR_FUNC(ASN1_F_D2I_ASN1_OBJECT), "d2i_ASN1_OBJECT"}, | 152 | {ERR_FUNC(ASN1_F_D2I_ASN1_OBJECT), "d2i_ASN1_OBJECT"}, |
| 149 | {ERR_FUNC(ASN1_F_D2I_ASN1_SET), "d2i_ASN1_SET"}, | 153 | {ERR_FUNC(ASN1_F_D2I_ASN1_SET), "d2i_ASN1_SET"}, |
| 150 | {ERR_FUNC(ASN1_F_D2I_ASN1_TYPE_BYTES), "d2i_ASN1_type_bytes"}, | 154 | {ERR_FUNC(ASN1_F_D2I_ASN1_TYPE_BYTES), "d2i_ASN1_type_bytes"}, |
| 151 | {ERR_FUNC(ASN1_F_D2I_ASN1_UINTEGER), "d2i_ASN1_UINTEGER"}, | 155 | {ERR_FUNC(ASN1_F_D2I_ASN1_UINTEGER), "d2i_ASN1_UINTEGER"}, |
| 152 | {ERR_FUNC(ASN1_F_D2I_ASN1_UTCTIME), "D2I_ASN1_UTCTIME"}, | 156 | {ERR_FUNC(ASN1_F_D2I_ASN1_UTCTIME), "D2I_ASN1_UTCTIME"}, |
| 157 | {ERR_FUNC(ASN1_F_D2I_AUTOPRIVATEKEY), "d2i_AutoPrivateKey"}, | ||
| 153 | {ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA), "d2i_Netscape_RSA"}, | 158 | {ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA), "d2i_Netscape_RSA"}, |
| 154 | {ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"}, | 159 | {ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"}, |
| 155 | {ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"}, | 160 | {ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"}, |
| @@ -159,6 +164,7 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
| 159 | {ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"}, | 164 | {ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"}, |
| 160 | {ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"}, | 165 | {ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"}, |
| 161 | {ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"}, | 166 | {ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"}, |
| 167 | {ERR_FUNC(ASN1_F_I2D_ASN1_BIO_STREAM), "i2d_ASN1_bio_stream"}, | ||
| 162 | {ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"}, | 168 | {ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"}, |
| 163 | {ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"}, | 169 | {ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"}, |
| 164 | {ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"}, | 170 | {ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"}, |
| @@ -170,8 +176,9 @@ static ERR_STRING_DATA ASN1_str_functs[]= | |||
| 170 | {ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"}, | 176 | {ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"}, |
| 171 | {ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"}, | 177 | {ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"}, |
| 172 | {ERR_FUNC(ASN1_F_PARSE_TAGGING), "PARSE_TAGGING"}, | 178 | {ERR_FUNC(ASN1_F_PARSE_TAGGING), "PARSE_TAGGING"}, |
| 173 | {ERR_FUNC(ASN1_F_PKCS5_PBE2_SET), "PKCS5_pbe2_set"}, | 179 | {ERR_FUNC(ASN1_F_PKCS5_PBE2_SET_IV), "PKCS5_pbe2_set_iv"}, |
| 174 | {ERR_FUNC(ASN1_F_PKCS5_PBE_SET), "PKCS5_pbe_set"}, | 180 | {ERR_FUNC(ASN1_F_PKCS5_PBE_SET), "PKCS5_pbe_set"}, |
| 181 | {ERR_FUNC(ASN1_F_PKCS5_PBE_SET0_ALGOR), "PKCS5_pbe_set0_algor"}, | ||
| 175 | {ERR_FUNC(ASN1_F_SMIME_READ_ASN1), "SMIME_read_ASN1"}, | 182 | {ERR_FUNC(ASN1_F_SMIME_READ_ASN1), "SMIME_read_ASN1"}, |
| 176 | {ERR_FUNC(ASN1_F_SMIME_TEXT), "SMIME_text"}, | 183 | {ERR_FUNC(ASN1_F_SMIME_TEXT), "SMIME_text"}, |
| 177 | {ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"}, | 184 | {ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"}, |
| @@ -204,6 +211,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]= | |||
| 204 | {ERR_REASON(ASN1_R_DECODE_ERROR) ,"decode error"}, | 211 | {ERR_REASON(ASN1_R_DECODE_ERROR) ,"decode error"}, |
| 205 | {ERR_REASON(ASN1_R_DECODING_ERROR) ,"decoding error"}, | 212 | {ERR_REASON(ASN1_R_DECODING_ERROR) ,"decoding error"}, |
| 206 | {ERR_REASON(ASN1_R_DEPTH_EXCEEDED) ,"depth exceeded"}, | 213 | {ERR_REASON(ASN1_R_DEPTH_EXCEEDED) ,"depth exceeded"}, |
| 214 | {ERR_REASON(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED),"digest and key type not supported"}, | ||
| 207 | {ERR_REASON(ASN1_R_ENCODE_ERROR) ,"encode error"}, | 215 | {ERR_REASON(ASN1_R_ENCODE_ERROR) ,"encode error"}, |
| 208 | {ERR_REASON(ASN1_R_ERROR_GETTING_TIME) ,"error getting time"}, | 216 | {ERR_REASON(ASN1_R_ERROR_GETTING_TIME) ,"error getting time"}, |
| 209 | {ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"}, | 217 | {ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"}, |
| @@ -240,6 +248,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]= | |||
| 240 | {ERR_REASON(ASN1_R_INVALID_MIME_TYPE) ,"invalid mime type"}, | 248 | {ERR_REASON(ASN1_R_INVALID_MIME_TYPE) ,"invalid mime type"}, |
| 241 | {ERR_REASON(ASN1_R_INVALID_MODIFIER) ,"invalid modifier"}, | 249 | {ERR_REASON(ASN1_R_INVALID_MODIFIER) ,"invalid modifier"}, |
| 242 | {ERR_REASON(ASN1_R_INVALID_NUMBER) ,"invalid number"}, | 250 | {ERR_REASON(ASN1_R_INVALID_NUMBER) ,"invalid number"}, |
| 251 | {ERR_REASON(ASN1_R_INVALID_OBJECT_ENCODING),"invalid object encoding"}, | ||
| 243 | {ERR_REASON(ASN1_R_INVALID_SEPARATOR) ,"invalid separator"}, | 252 | {ERR_REASON(ASN1_R_INVALID_SEPARATOR) ,"invalid separator"}, |
| 244 | {ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) ,"invalid time format"}, | 253 | {ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) ,"invalid time format"}, |
| 245 | {ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH),"invalid universalstring length"}, | 254 | {ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH),"invalid universalstring length"}, |
| @@ -260,6 +269,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]= | |||
| 260 | {ERR_REASON(ASN1_R_NOT_ASCII_FORMAT) ,"not ascii format"}, | 269 | {ERR_REASON(ASN1_R_NOT_ASCII_FORMAT) ,"not ascii format"}, |
| 261 | {ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) ,"not enough data"}, | 270 | {ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) ,"not enough data"}, |
| 262 | {ERR_REASON(ASN1_R_NO_CONTENT_TYPE) ,"no content type"}, | 271 | {ERR_REASON(ASN1_R_NO_CONTENT_TYPE) ,"no content type"}, |
| 272 | {ERR_REASON(ASN1_R_NO_DEFAULT_DIGEST) ,"no default digest"}, | ||
| 263 | {ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"}, | 273 | {ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"}, |
| 264 | {ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"}, | 274 | {ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"}, |
| 265 | {ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"}, | 275 | {ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"}, |
| @@ -290,6 +300,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]= | |||
| 290 | {ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"}, | 300 | {ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"}, |
| 291 | {ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"}, | 301 | {ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"}, |
| 292 | {ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, | 302 | {ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, |
| 303 | {ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorithm"}, | ||
| 293 | {ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"}, | 304 | {ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"}, |
| 294 | {ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unkown format"}, | 305 | {ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unkown format"}, |
| 295 | {ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, | 306 | {ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, |
| @@ -297,6 +308,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]= | |||
| 297 | {ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, | 308 | {ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, |
| 298 | {ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key type"}, | 309 | {ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key type"}, |
| 299 | {ERR_REASON(ASN1_R_UNSUPPORTED_TYPE) ,"unsupported type"}, | 310 | {ERR_REASON(ASN1_R_UNSUPPORTED_TYPE) ,"unsupported type"}, |
| 311 | {ERR_REASON(ASN1_R_WRONG_PUBLIC_KEY_TYPE),"wrong public key type"}, | ||
| 300 | {ERR_REASON(ASN1_R_WRONG_TAG) ,"wrong tag"}, | 312 | {ERR_REASON(ASN1_R_WRONG_TAG) ,"wrong tag"}, |
| 301 | {ERR_REASON(ASN1_R_WRONG_TYPE) ,"wrong type"}, | 313 | {ERR_REASON(ASN1_R_WRONG_TYPE) ,"wrong type"}, |
| 302 | {0,NULL} | 314 | {0,NULL} |
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 5af559ef8d..1bcb44aee2 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
| @@ -340,20 +340,31 @@ int asn1_GetSequence(ASN1_const_CTX *c, long *length) | |||
| 340 | return(1); | 340 | return(1); |
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | ASN1_STRING *ASN1_STRING_dup(ASN1_STRING *str) | 343 | int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str) |
| 344 | { | 344 | { |
| 345 | ASN1_STRING *ret; | 345 | if (str == NULL) |
| 346 | return 0; | ||
| 347 | dst->type = str->type; | ||
| 348 | if (!ASN1_STRING_set(dst,str->data,str->length)) | ||
| 349 | return 0; | ||
| 350 | dst->flags = str->flags; | ||
| 351 | return 1; | ||
| 352 | } | ||
| 346 | 353 | ||
| 347 | if (str == NULL) return(NULL); | 354 | ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str) |
| 348 | if ((ret=ASN1_STRING_type_new(str->type)) == NULL) | 355 | { |
| 349 | return(NULL); | 356 | ASN1_STRING *ret; |
| 350 | if (!ASN1_STRING_set(ret,str->data,str->length)) | 357 | if (!str) |
| 358 | return NULL; | ||
| 359 | ret=ASN1_STRING_new(); | ||
| 360 | if (!ret) | ||
| 361 | return NULL; | ||
| 362 | if (!ASN1_STRING_copy(ret,str)) | ||
| 351 | { | 363 | { |
| 352 | ASN1_STRING_free(ret); | 364 | ASN1_STRING_free(ret); |
| 353 | return(NULL); | 365 | return NULL; |
| 354 | } | 366 | } |
| 355 | ret->flags = str->flags; | 367 | return ret; |
| 356 | return(ret); | ||
| 357 | } | 368 | } |
| 358 | 369 | ||
| 359 | int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | 370 | int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) |
| @@ -427,11 +438,12 @@ ASN1_STRING *ASN1_STRING_type_new(int type) | |||
| 427 | void ASN1_STRING_free(ASN1_STRING *a) | 438 | void ASN1_STRING_free(ASN1_STRING *a) |
| 428 | { | 439 | { |
| 429 | if (a == NULL) return; | 440 | if (a == NULL) return; |
| 430 | if (a->data != NULL) OPENSSL_free(a->data); | 441 | if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF)) |
| 442 | OPENSSL_free(a->data); | ||
| 431 | OPENSSL_free(a); | 443 | OPENSSL_free(a); |
| 432 | } | 444 | } |
| 433 | 445 | ||
| 434 | int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b) | 446 | int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) |
| 435 | { | 447 | { |
| 436 | int i; | 448 | int i; |
| 437 | 449 | ||
| @@ -457,7 +469,7 @@ void asn1_add_error(const unsigned char *address, int offset) | |||
| 457 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); | 469 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); |
| 458 | } | 470 | } |
| 459 | 471 | ||
| 460 | int ASN1_STRING_length(ASN1_STRING *x) | 472 | int ASN1_STRING_length(const ASN1_STRING *x) |
| 461 | { return M_ASN1_STRING_length(x); } | 473 | { return M_ASN1_STRING_length(x); } |
| 462 | 474 | ||
| 463 | void ASN1_STRING_length_set(ASN1_STRING *x, int len) | 475 | void ASN1_STRING_length_set(ASN1_STRING *x, int len) |
diff --git a/src/lib/libcrypto/asn1/asn1_mac.h b/src/lib/libcrypto/asn1/asn1_mac.h index d958ca60d9..87bd0e9e1d 100644 --- a/src/lib/libcrypto/asn1/asn1_mac.h +++ b/src/lib/libcrypto/asn1/asn1_mac.h | |||
| @@ -153,6 +153,13 @@ err:\ | |||
| 153 | M_ASN1_D2I_get(b,func); \ | 153 | M_ASN1_D2I_get(b,func); \ |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | #define M_ASN1_D2I_get_int_opt(b,func,type) \ | ||
| 157 | if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \ | ||
| 158 | == (V_ASN1_UNIVERSAL|(type)))) \ | ||
| 159 | { \ | ||
| 160 | M_ASN1_D2I_get_int(b,func); \ | ||
| 161 | } | ||
| 162 | |||
| 156 | #define M_ASN1_D2I_get_imp(b,func, type) \ | 163 | #define M_ASN1_D2I_get_imp(b,func, type) \ |
| 157 | M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \ | 164 | M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \ |
| 158 | c.q=c.p; \ | 165 | c.q=c.p; \ |
diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c index 8657f73d66..aaca69aebd 100644 --- a/src/lib/libcrypto/asn1/asn1_par.c +++ b/src/lib/libcrypto/asn1/asn1_par.c | |||
| @@ -70,9 +70,8 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, | |||
| 70 | int indent) | 70 | int indent) |
| 71 | { | 71 | { |
| 72 | static const char fmt[]="%-18s"; | 72 | static const char fmt[]="%-18s"; |
| 73 | static const char fmt2[]="%2d %-15s"; | ||
| 74 | char str[128]; | 73 | char str[128]; |
| 75 | const char *p,*p2=NULL; | 74 | const char *p; |
| 76 | 75 | ||
| 77 | if (constructed & V_ASN1_CONSTRUCTED) | 76 | if (constructed & V_ASN1_CONSTRUCTED) |
| 78 | p="cons: "; | 77 | p="cons: "; |
| @@ -93,14 +92,8 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, | |||
| 93 | else | 92 | else |
| 94 | p = ASN1_tag2str(tag); | 93 | p = ASN1_tag2str(tag); |
| 95 | 94 | ||
| 96 | if (p2 != NULL) | 95 | if (BIO_printf(bp,fmt,p) <= 0) |
| 97 | { | 96 | goto err; |
| 98 | if (BIO_printf(bp,fmt2,tag,p2) <= 0) goto err; | ||
| 99 | } | ||
| 100 | else | ||
| 101 | { | ||
| 102 | if (BIO_printf(bp,fmt,p) <= 0) goto err; | ||
| 103 | } | ||
| 104 | return(1); | 97 | return(1); |
| 105 | err: | 98 | err: |
| 106 | return(0); | 99 | return(0); |
| @@ -246,7 +239,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offse | |||
| 246 | ii=d2i_ASN1_BOOLEAN(NULL,&opp,len+hl); | 239 | ii=d2i_ASN1_BOOLEAN(NULL,&opp,len+hl); |
| 247 | if (ii < 0) | 240 | if (ii < 0) |
| 248 | { | 241 | { |
| 249 | if (BIO_write(bp,"Bad boolean\n",12)) | 242 | if (BIO_write(bp,"Bad boolean\n",12) <= 0) |
| 250 | goto end; | 243 | goto end; |
| 251 | } | 244 | } |
| 252 | BIO_printf(bp,":%d",ii); | 245 | BIO_printf(bp,":%d",ii); |
| @@ -424,7 +417,7 @@ end: | |||
| 424 | 417 | ||
| 425 | const char *ASN1_tag2str(int tag) | 418 | const char *ASN1_tag2str(int tag) |
| 426 | { | 419 | { |
| 427 | static const char *tag2str[] = { | 420 | static const char * const tag2str[] = { |
| 428 | "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */ | 421 | "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */ |
| 429 | "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */ | 422 | "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */ |
| 430 | "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */ | 423 | "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */ |
diff --git a/src/lib/libcrypto/asn1/asn1t.h b/src/lib/libcrypto/asn1/asn1t.h index ac14f9415b..d230e4bf70 100644 --- a/src/lib/libcrypto/asn1/asn1t.h +++ b/src/lib/libcrypto/asn1/asn1t.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -218,6 +218,18 @@ extern "C" { | |||
| 218 | #stname \ | 218 | #stname \ |
| 219 | ASN1_ITEM_end(tname) | 219 | ASN1_ITEM_end(tname) |
| 220 | 220 | ||
| 221 | #define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ | ||
| 222 | ;\ | ||
| 223 | ASN1_ITEM_start(tname) \ | ||
| 224 | ASN1_ITYPE_NDEF_SEQUENCE,\ | ||
| 225 | V_ASN1_SEQUENCE,\ | ||
| 226 | tname##_seq_tt,\ | ||
| 227 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | ||
| 228 | &tname##_aux,\ | ||
| 229 | sizeof(stname),\ | ||
| 230 | #stname \ | ||
| 231 | ASN1_ITEM_end(tname) | ||
| 232 | |||
| 221 | 233 | ||
| 222 | /* This pair helps declare a CHOICE type. We can do: | 234 | /* This pair helps declare a CHOICE type. We can do: |
| 223 | * | 235 | * |
| @@ -651,8 +663,13 @@ typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM | |||
| 651 | typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); | 663 | typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 652 | typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); | 664 | typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 653 | 665 | ||
| 666 | typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, | ||
| 667 | int indent, const char *fname, | ||
| 668 | const ASN1_PCTX *pctx); | ||
| 669 | |||
| 654 | typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); | 670 | typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); |
| 655 | typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); | 671 | typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); |
| 672 | typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx); | ||
| 656 | 673 | ||
| 657 | typedef struct ASN1_COMPAT_FUNCS_st { | 674 | typedef struct ASN1_COMPAT_FUNCS_st { |
| 658 | ASN1_new_func *asn1_new; | 675 | ASN1_new_func *asn1_new; |
| @@ -668,6 +685,7 @@ typedef struct ASN1_EXTERN_FUNCS_st { | |||
| 668 | ASN1_ex_free_func *asn1_ex_clear; | 685 | ASN1_ex_free_func *asn1_ex_clear; |
| 669 | ASN1_ex_d2i *asn1_ex_d2i; | 686 | ASN1_ex_d2i *asn1_ex_d2i; |
| 670 | ASN1_ex_i2d *asn1_ex_i2d; | 687 | ASN1_ex_i2d *asn1_ex_i2d; |
| 688 | ASN1_ex_print_func *asn1_ex_print; | ||
| 671 | } ASN1_EXTERN_FUNCS; | 689 | } ASN1_EXTERN_FUNCS; |
| 672 | 690 | ||
| 673 | typedef struct ASN1_PRIMITIVE_FUNCS_st { | 691 | typedef struct ASN1_PRIMITIVE_FUNCS_st { |
| @@ -678,6 +696,7 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st { | |||
| 678 | ASN1_ex_free_func *prim_clear; | 696 | ASN1_ex_free_func *prim_clear; |
| 679 | ASN1_primitive_c2i *prim_c2i; | 697 | ASN1_primitive_c2i *prim_c2i; |
| 680 | ASN1_primitive_i2c *prim_i2c; | 698 | ASN1_primitive_i2c *prim_i2c; |
| 699 | ASN1_primitive_print *prim_print; | ||
| 681 | } ASN1_PRIMITIVE_FUNCS; | 700 | } ASN1_PRIMITIVE_FUNCS; |
| 682 | 701 | ||
| 683 | /* This is the ASN1_AUX structure: it handles various | 702 | /* This is the ASN1_AUX structure: it handles various |
| @@ -697,7 +716,8 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st { | |||
| 697 | * then an external type is more appropriate. | 716 | * then an external type is more appropriate. |
| 698 | */ | 717 | */ |
| 699 | 718 | ||
| 700 | typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it); | 719 | typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, |
| 720 | void *exarg); | ||
| 701 | 721 | ||
| 702 | typedef struct ASN1_AUX_st { | 722 | typedef struct ASN1_AUX_st { |
| 703 | void *app_data; | 723 | void *app_data; |
| @@ -708,6 +728,23 @@ typedef struct ASN1_AUX_st { | |||
| 708 | int enc_offset; /* Offset of ASN1_ENCODING structure */ | 728 | int enc_offset; /* Offset of ASN1_ENCODING structure */ |
| 709 | } ASN1_AUX; | 729 | } ASN1_AUX; |
| 710 | 730 | ||
| 731 | /* For print related callbacks exarg points to this structure */ | ||
| 732 | typedef struct ASN1_PRINT_ARG_st { | ||
| 733 | BIO *out; | ||
| 734 | int indent; | ||
| 735 | const ASN1_PCTX *pctx; | ||
| 736 | } ASN1_PRINT_ARG; | ||
| 737 | |||
| 738 | /* For streaming related callbacks exarg points to this structure */ | ||
| 739 | typedef struct ASN1_STREAM_ARG_st { | ||
| 740 | /* BIO to stream through */ | ||
| 741 | BIO *out; | ||
| 742 | /* BIO with filters appended */ | ||
| 743 | BIO *ndef_bio; | ||
| 744 | /* Streaming I/O boundary */ | ||
| 745 | unsigned char **boundary; | ||
| 746 | } ASN1_STREAM_ARG; | ||
| 747 | |||
| 711 | /* Flags in ASN1_AUX */ | 748 | /* Flags in ASN1_AUX */ |
| 712 | 749 | ||
| 713 | /* Use a reference count */ | 750 | /* Use a reference count */ |
| @@ -727,6 +764,12 @@ typedef struct ASN1_AUX_st { | |||
| 727 | #define ASN1_OP_D2I_POST 5 | 764 | #define ASN1_OP_D2I_POST 5 |
| 728 | #define ASN1_OP_I2D_PRE 6 | 765 | #define ASN1_OP_I2D_PRE 6 |
| 729 | #define ASN1_OP_I2D_POST 7 | 766 | #define ASN1_OP_I2D_POST 7 |
| 767 | #define ASN1_OP_PRINT_PRE 8 | ||
| 768 | #define ASN1_OP_PRINT_POST 9 | ||
| 769 | #define ASN1_OP_STREAM_PRE 10 | ||
| 770 | #define ASN1_OP_STREAM_POST 11 | ||
| 771 | #define ASN1_OP_DETACHED_PRE 12 | ||
| 772 | #define ASN1_OP_DETACHED_POST 13 | ||
| 730 | 773 | ||
| 731 | /* Macro to implement a primitive type */ | 774 | /* Macro to implement a primitive type */ |
| 732 | #define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) | 775 | #define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) |
| @@ -782,9 +825,22 @@ typedef struct ASN1_AUX_st { | |||
| 782 | #define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ | 825 | #define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ |
| 783 | IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) | 826 | IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) |
| 784 | 827 | ||
| 828 | #define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ | ||
| 829 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) | ||
| 830 | |||
| 785 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ | 831 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ |
| 786 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) | 832 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) |
| 787 | 833 | ||
| 834 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ | ||
| 835 | pre stname *fname##_new(void) \ | ||
| 836 | { \ | ||
| 837 | return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ | ||
| 838 | } \ | ||
| 839 | pre void fname##_free(stname *a) \ | ||
| 840 | { \ | ||
| 841 | ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ | ||
| 842 | } | ||
| 843 | |||
| 788 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ | 844 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ |
| 789 | stname *fname##_new(void) \ | 845 | stname *fname##_new(void) \ |
| 790 | { \ | 846 | { \ |
| @@ -834,6 +890,17 @@ typedef struct ASN1_AUX_st { | |||
| 834 | return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ | 890 | return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ |
| 835 | } | 891 | } |
| 836 | 892 | ||
| 893 | #define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ | ||
| 894 | IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) | ||
| 895 | |||
| 896 | #define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ | ||
| 897 | int fname##_print_ctx(BIO *out, stname *x, int indent, \ | ||
| 898 | const ASN1_PCTX *pctx) \ | ||
| 899 | { \ | ||
| 900 | return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ | ||
| 901 | ASN1_ITEM_rptr(itname), pctx); \ | ||
| 902 | } | ||
| 903 | |||
| 837 | #define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ | 904 | #define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ |
| 838 | IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) | 905 | IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) |
| 839 | 906 | ||
diff --git a/src/lib/libcrypto/asn1/asn_mime.c b/src/lib/libcrypto/asn1/asn_mime.c index d8d9e76cc0..c1d1b12291 100644 --- a/src/lib/libcrypto/asn1/asn_mime.c +++ b/src/lib/libcrypto/asn1/asn_mime.c | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | #include <openssl/x509.h> | 59 | #include <openssl/x509.h> |
| 60 | #include <openssl/asn1.h> | 60 | #include <openssl/asn1.h> |
| 61 | #include <openssl/asn1t.h> | 61 | #include <openssl/asn1t.h> |
| 62 | #include "asn1_locl.h" | ||
| 62 | 63 | ||
| 63 | /* Generalised MIME like utilities for streaming ASN1. Although many | 64 | /* Generalised MIME like utilities for streaming ASN1. Although many |
| 64 | * have a PKCS7/CMS like flavour others are more general purpose. | 65 | * have a PKCS7/CMS like flavour others are more general purpose. |
| @@ -86,6 +87,8 @@ STACK_OF(MIME_PARAM) *params; /* Zero or more parameters */ | |||
| 86 | DECLARE_STACK_OF(MIME_HEADER) | 87 | DECLARE_STACK_OF(MIME_HEADER) |
| 87 | IMPLEMENT_STACK_OF(MIME_HEADER) | 88 | IMPLEMENT_STACK_OF(MIME_HEADER) |
| 88 | 89 | ||
| 90 | static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags, | ||
| 91 | const ASN1_ITEM *it); | ||
| 89 | static char * strip_ends(char *name); | 92 | static char * strip_ends(char *name); |
| 90 | static char * strip_start(char *name); | 93 | static char * strip_start(char *name); |
| 91 | static char * strip_end(char *name); | 94 | static char * strip_end(char *name); |
| @@ -107,6 +110,39 @@ static void mime_hdr_free(MIME_HEADER *hdr); | |||
| 107 | #define MAX_SMLEN 1024 | 110 | #define MAX_SMLEN 1024 |
| 108 | #define mime_debug(x) /* x */ | 111 | #define mime_debug(x) /* x */ |
| 109 | 112 | ||
| 113 | /* Output an ASN1 structure in BER format streaming if necessary */ | ||
| 114 | |||
| 115 | int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, | ||
| 116 | const ASN1_ITEM *it) | ||
| 117 | { | ||
| 118 | /* If streaming create stream BIO and copy all content through it */ | ||
| 119 | if (flags & SMIME_STREAM) | ||
| 120 | { | ||
| 121 | BIO *bio, *tbio; | ||
| 122 | bio = BIO_new_NDEF(out, val, it); | ||
| 123 | if (!bio) | ||
| 124 | { | ||
| 125 | ASN1err(ASN1_F_I2D_ASN1_BIO_STREAM,ERR_R_MALLOC_FAILURE); | ||
| 126 | return 0; | ||
| 127 | } | ||
| 128 | SMIME_crlf_copy(in, bio, flags); | ||
| 129 | (void)BIO_flush(bio); | ||
| 130 | /* Free up successive BIOs until we hit the old output BIO */ | ||
| 131 | do | ||
| 132 | { | ||
| 133 | tbio = BIO_pop(bio); | ||
| 134 | BIO_free(bio); | ||
| 135 | bio = tbio; | ||
| 136 | } while (bio != out); | ||
| 137 | } | ||
| 138 | /* else just write out ASN1 structure which will have all content | ||
| 139 | * stored internally | ||
| 140 | */ | ||
| 141 | else | ||
| 142 | ASN1_item_i2d_bio(it, out, val); | ||
| 143 | return 1; | ||
| 144 | } | ||
| 145 | |||
| 110 | /* Base 64 read and write of ASN1 structure */ | 146 | /* Base 64 read and write of ASN1 structure */ |
| 111 | 147 | ||
| 112 | static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags, | 148 | static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags, |
| @@ -123,13 +159,26 @@ static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags, | |||
| 123 | /* prepend the b64 BIO so all data is base64 encoded. | 159 | /* prepend the b64 BIO so all data is base64 encoded. |
| 124 | */ | 160 | */ |
| 125 | out = BIO_push(b64, out); | 161 | out = BIO_push(b64, out); |
| 126 | r = ASN1_item_i2d_bio(it, out, val); | 162 | r = i2d_ASN1_bio_stream(out, val, in, flags, it); |
| 127 | (void)BIO_flush(out); | 163 | (void)BIO_flush(out); |
| 128 | BIO_pop(out); | 164 | BIO_pop(out); |
| 129 | BIO_free(b64); | 165 | BIO_free(b64); |
| 130 | return r; | 166 | return r; |
| 131 | } | 167 | } |
| 132 | 168 | ||
| 169 | /* Streaming ASN1 PEM write */ | ||
| 170 | |||
| 171 | int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, | ||
| 172 | const char *hdr, | ||
| 173 | const ASN1_ITEM *it) | ||
| 174 | { | ||
| 175 | int r; | ||
| 176 | BIO_printf(out, "-----BEGIN %s-----\n", hdr); | ||
| 177 | r = B64_write_ASN1(out, val, in, flags, it); | ||
| 178 | BIO_printf(out, "-----END %s-----\n", hdr); | ||
| 179 | return r; | ||
| 180 | } | ||
| 181 | |||
| 133 | static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it) | 182 | static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it) |
| 134 | { | 183 | { |
| 135 | BIO *b64; | 184 | BIO *b64; |
| @@ -152,7 +201,8 @@ static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it) | |||
| 152 | 201 | ||
| 153 | static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs) | 202 | static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs) |
| 154 | { | 203 | { |
| 155 | int i, have_unknown = 0, write_comma, md_nid; | 204 | const EVP_MD *md; |
| 205 | int i, have_unknown = 0, write_comma, ret = 0, md_nid; | ||
| 156 | have_unknown = 0; | 206 | have_unknown = 0; |
| 157 | write_comma = 0; | 207 | write_comma = 0; |
| 158 | for (i = 0; i < sk_X509_ALGOR_num(mdalgs); i++) | 208 | for (i = 0; i < sk_X509_ALGOR_num(mdalgs); i++) |
| @@ -161,6 +211,21 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs) | |||
| 161 | BIO_write(out, ",", 1); | 211 | BIO_write(out, ",", 1); |
| 162 | write_comma = 1; | 212 | write_comma = 1; |
| 163 | md_nid = OBJ_obj2nid(sk_X509_ALGOR_value(mdalgs, i)->algorithm); | 213 | md_nid = OBJ_obj2nid(sk_X509_ALGOR_value(mdalgs, i)->algorithm); |
| 214 | md = EVP_get_digestbynid(md_nid); | ||
| 215 | if (md && md->md_ctrl) | ||
| 216 | { | ||
| 217 | int rv; | ||
| 218 | char *micstr; | ||
| 219 | rv = md->md_ctrl(NULL, EVP_MD_CTRL_MICALG, 0, &micstr); | ||
| 220 | if (rv > 0) | ||
| 221 | { | ||
| 222 | BIO_puts(out, micstr); | ||
| 223 | OPENSSL_free(micstr); | ||
| 224 | continue; | ||
| 225 | } | ||
| 226 | if (rv != -2) | ||
| 227 | goto err; | ||
| 228 | } | ||
| 164 | switch(md_nid) | 229 | switch(md_nid) |
| 165 | { | 230 | { |
| 166 | case NID_sha1: | 231 | case NID_sha1: |
| @@ -183,6 +248,11 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs) | |||
| 183 | BIO_puts(out, "sha-512"); | 248 | BIO_puts(out, "sha-512"); |
| 184 | break; | 249 | break; |
| 185 | 250 | ||
| 251 | case NID_id_GostR3411_94: | ||
| 252 | BIO_puts(out, "gostr3411-94"); | ||
| 253 | goto err; | ||
| 254 | break; | ||
| 255 | |||
| 186 | default: | 256 | default: |
| 187 | if (have_unknown) | 257 | if (have_unknown) |
| 188 | write_comma = 0; | 258 | write_comma = 0; |
| @@ -196,16 +266,18 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs) | |||
| 196 | } | 266 | } |
| 197 | } | 267 | } |
| 198 | 268 | ||
| 199 | return 1; | 269 | ret = 1; |
| 270 | err: | ||
| 271 | |||
| 272 | return ret; | ||
| 200 | 273 | ||
| 201 | } | 274 | } |
| 202 | 275 | ||
| 203 | /* SMIME sender */ | 276 | /* SMIME sender */ |
| 204 | 277 | ||
| 205 | int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, | 278 | int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, |
| 206 | int ctype_nid, int econt_nid, | 279 | int ctype_nid, int econt_nid, |
| 207 | STACK_OF(X509_ALGOR) *mdalgs, | 280 | STACK_OF(X509_ALGOR) *mdalgs, |
| 208 | asn1_output_data_fn *data_fn, | ||
| 209 | const ASN1_ITEM *it) | 281 | const ASN1_ITEM *it) |
| 210 | { | 282 | { |
| 211 | char bound[33], c; | 283 | char bound[33], c; |
| @@ -243,7 +315,7 @@ int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, | |||
| 243 | mime_eol, mime_eol); | 315 | mime_eol, mime_eol); |
| 244 | /* Now write out the first part */ | 316 | /* Now write out the first part */ |
| 245 | BIO_printf(bio, "------%s%s", bound, mime_eol); | 317 | BIO_printf(bio, "------%s%s", bound, mime_eol); |
| 246 | if (!data_fn(bio, data, val, flags, it)) | 318 | if (!asn1_output_data(bio, data, val, flags, it)) |
| 247 | return 0; | 319 | return 0; |
| 248 | BIO_printf(bio, "%s------%s%s", mime_eol, bound, mime_eol); | 320 | BIO_printf(bio, "%s------%s%s", mime_eol, bound, mime_eol); |
| 249 | 321 | ||
| @@ -296,8 +368,6 @@ int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, | |||
| 296 | return 1; | 368 | return 1; |
| 297 | } | 369 | } |
| 298 | 370 | ||
| 299 | #if 0 | ||
| 300 | |||
| 301 | /* Handle output of ASN1 data */ | 371 | /* Handle output of ASN1 data */ |
| 302 | 372 | ||
| 303 | 373 | ||
| @@ -350,8 +420,6 @@ static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags, | |||
| 350 | 420 | ||
| 351 | } | 421 | } |
| 352 | 422 | ||
| 353 | #endif | ||
| 354 | |||
| 355 | /* SMIME reader: handle multipart/signed and opaque signing. | 423 | /* SMIME reader: handle multipart/signed and opaque signing. |
| 356 | * in multipart case the content is placed in a memory BIO | 424 | * in multipart case the content is placed in a memory BIO |
| 357 | * pointed to by "bcont". In opaque this is set to NULL | 425 | * pointed to by "bcont". In opaque this is set to NULL |
diff --git a/src/lib/libcrypto/asn1/asn_pack.c b/src/lib/libcrypto/asn1/asn_pack.c index f1a5a05632..ad738217d7 100644 --- a/src/lib/libcrypto/asn1/asn_pack.c +++ b/src/lib/libcrypto/asn1/asn_pack.c | |||
| @@ -66,10 +66,10 @@ | |||
| 66 | 66 | ||
| 67 | /* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */ | 67 | /* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */ |
| 68 | 68 | ||
| 69 | STACK *ASN1_seq_unpack(const unsigned char *buf, int len, | 69 | STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len, |
| 70 | d2i_of_void *d2i,void (*free_func)(void *)) | 70 | d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK)) |
| 71 | { | 71 | { |
| 72 | STACK *sk; | 72 | STACK_OF(OPENSSL_BLOCK) *sk; |
| 73 | const unsigned char *pbuf; | 73 | const unsigned char *pbuf; |
| 74 | pbuf = buf; | 74 | pbuf = buf; |
| 75 | if (!(sk = d2i_ASN1_SET(NULL, &pbuf, len, d2i, free_func, | 75 | if (!(sk = d2i_ASN1_SET(NULL, &pbuf, len, d2i, free_func, |
| @@ -82,7 +82,7 @@ STACK *ASN1_seq_unpack(const unsigned char *buf, int len, | |||
| 82 | * OPENSSL_malloc'ed buffer | 82 | * OPENSSL_malloc'ed buffer |
| 83 | */ | 83 | */ |
| 84 | 84 | ||
| 85 | unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d, | 85 | unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d, |
| 86 | unsigned char **buf, int *len) | 86 | unsigned char **buf, int *len) |
| 87 | { | 87 | { |
| 88 | int safelen; | 88 | int safelen; |
diff --git a/src/lib/libcrypto/asn1/charmap.h b/src/lib/libcrypto/asn1/charmap.h index bd020a9562..b55e638725 100644 --- a/src/lib/libcrypto/asn1/charmap.h +++ b/src/lib/libcrypto/asn1/charmap.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Mask of various character properties | 2 | * Mask of various character properties |
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | static unsigned char char_type[] = { | 5 | static const unsigned char char_type[] = { |
| 6 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 6 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 7 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 7 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 8 | 120, 0, 1,40, 0, 0, 0,16,16,16, 0,25,25,16,16,16, | 8 | 120, 0, 1,40, 0, 0, 0,16,16,16, 0,25,25,16,16,16, |
diff --git a/src/lib/libcrypto/asn1/d2i_pr.c b/src/lib/libcrypto/asn1/d2i_pr.c index 207ccda5ac..2828944777 100644 --- a/src/lib/libcrypto/asn1/d2i_pr.c +++ b/src/lib/libcrypto/asn1/d2i_pr.c | |||
| @@ -61,16 +61,12 @@ | |||
| 61 | #include <openssl/bn.h> | 61 | #include <openssl/bn.h> |
| 62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 63 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 64 | #include <openssl/asn1.h> | 64 | #ifndef OPENSSL_NO_ENGINE |
| 65 | #ifndef OPENSSL_NO_RSA | 65 | #include <openssl/engine.h> |
| 66 | #include <openssl/rsa.h> | ||
| 67 | #endif | ||
| 68 | #ifndef OPENSSL_NO_DSA | ||
| 69 | #include <openssl/dsa.h> | ||
| 70 | #endif | ||
| 71 | #ifndef OPENSSL_NO_EC | ||
| 72 | #include <openssl/ec.h> | ||
| 73 | #endif | 66 | #endif |
| 67 | #include <openssl/x509.h> | ||
| 68 | #include <openssl/asn1.h> | ||
| 69 | #include "asn1_locl.h" | ||
| 74 | 70 | ||
| 75 | EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, | 71 | EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, |
| 76 | long length) | 72 | long length) |
| @@ -85,47 +81,43 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, | |||
| 85 | return(NULL); | 81 | return(NULL); |
| 86 | } | 82 | } |
| 87 | } | 83 | } |
| 88 | else ret= *a; | 84 | else |
| 89 | |||
| 90 | ret->save_type=type; | ||
| 91 | ret->type=EVP_PKEY_type(type); | ||
| 92 | switch (ret->type) | ||
| 93 | { | 85 | { |
| 94 | #ifndef OPENSSL_NO_RSA | 86 | ret= *a; |
| 95 | case EVP_PKEY_RSA: | 87 | #ifndef OPENSSL_NO_ENGINE |
| 96 | if ((ret->pkey.rsa=d2i_RSAPrivateKey(NULL, | 88 | if (ret->engine) |
| 97 | (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */ | ||
| 98 | { | 89 | { |
| 99 | ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB); | 90 | ENGINE_finish(ret->engine); |
| 100 | goto err; | 91 | ret->engine = NULL; |
| 101 | } | 92 | } |
| 102 | break; | ||
| 103 | #endif | 93 | #endif |
| 104 | #ifndef OPENSSL_NO_DSA | 94 | } |
| 105 | case EVP_PKEY_DSA: | 95 | |
| 106 | if ((ret->pkey.dsa=d2i_DSAPrivateKey(NULL, | 96 | if (!EVP_PKEY_set_type(ret, type)) |
| 107 | (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */ | 97 | { |
| 98 | ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); | ||
| 99 | goto err; | ||
| 100 | } | ||
| 101 | |||
| 102 | if (!ret->ameth->old_priv_decode || | ||
| 103 | !ret->ameth->old_priv_decode(ret, pp, length)) | ||
| 104 | { | ||
| 105 | if (ret->ameth->priv_decode) | ||
| 108 | { | 106 | { |
| 109 | ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB); | 107 | PKCS8_PRIV_KEY_INFO *p8=NULL; |
| 110 | goto err; | 108 | p8=d2i_PKCS8_PRIV_KEY_INFO(NULL,pp,length); |
| 111 | } | 109 | if (!p8) goto err; |
| 112 | break; | 110 | EVP_PKEY_free(ret); |
| 113 | #endif | 111 | ret = EVP_PKCS82PKEY(p8); |
| 114 | #ifndef OPENSSL_NO_EC | 112 | PKCS8_PRIV_KEY_INFO_free(p8); |
| 115 | case EVP_PKEY_EC: | 113 | |
| 116 | if ((ret->pkey.ec = d2i_ECPrivateKey(NULL, | 114 | } |
| 117 | (const unsigned char **)pp, length)) == NULL) | 115 | else |
| 118 | { | 116 | { |
| 119 | ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB); | 117 | ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB); |
| 120 | goto err; | 118 | goto err; |
| 121 | } | 119 | } |
| 122 | break; | 120 | } |
| 123 | #endif | ||
| 124 | default: | ||
| 125 | ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); | ||
| 126 | goto err; | ||
| 127 | /* break; */ | ||
| 128 | } | ||
| 129 | if (a != NULL) (*a)=ret; | 121 | if (a != NULL) (*a)=ret; |
| 130 | return(ret); | 122 | return(ret); |
| 131 | err: | 123 | err: |
| @@ -146,8 +138,7 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, | |||
| 146 | * by analyzing it we can determine the passed structure: this | 138 | * by analyzing it we can determine the passed structure: this |
| 147 | * assumes the input is surrounded by an ASN1 SEQUENCE. | 139 | * assumes the input is surrounded by an ASN1 SEQUENCE. |
| 148 | */ | 140 | */ |
| 149 | inkey = d2i_ASN1_SET_OF_ASN1_TYPE(NULL, &p, length, d2i_ASN1_TYPE, | 141 | inkey = d2i_ASN1_SEQUENCE_ANY(NULL, &p, length); |
| 150 | ASN1_TYPE_free, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); | ||
| 151 | /* Since we only need to discern "traditional format" RSA and DSA | 142 | /* Since we only need to discern "traditional format" RSA and DSA |
| 152 | * keys we can just count the elements. | 143 | * keys we can just count the elements. |
| 153 | */ | 144 | */ |
| @@ -155,6 +146,24 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, | |||
| 155 | keytype = EVP_PKEY_DSA; | 146 | keytype = EVP_PKEY_DSA; |
| 156 | else if (sk_ASN1_TYPE_num(inkey) == 4) | 147 | else if (sk_ASN1_TYPE_num(inkey) == 4) |
| 157 | keytype = EVP_PKEY_EC; | 148 | keytype = EVP_PKEY_EC; |
| 149 | else if (sk_ASN1_TYPE_num(inkey) == 3) | ||
| 150 | { /* This seems to be PKCS8, not traditional format */ | ||
| 151 | PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL,pp,length); | ||
| 152 | EVP_PKEY *ret; | ||
| 153 | |||
| 154 | sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free); | ||
| 155 | if (!p8) | ||
| 156 | { | ||
| 157 | ASN1err(ASN1_F_D2I_AUTOPRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); | ||
| 158 | return NULL; | ||
| 159 | } | ||
| 160 | ret = EVP_PKCS82PKEY(p8); | ||
| 161 | PKCS8_PRIV_KEY_INFO_free(p8); | ||
| 162 | if (a) { | ||
| 163 | *a = ret; | ||
| 164 | } | ||
| 165 | return ret; | ||
| 166 | } | ||
| 158 | else keytype = EVP_PKEY_RSA; | 167 | else keytype = EVP_PKEY_RSA; |
| 159 | sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free); | 168 | sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free); |
| 160 | return d2i_PrivateKey(keytype, a, pp, length); | 169 | return d2i_PrivateKey(keytype, a, pp, length); |
diff --git a/src/lib/libcrypto/asn1/d2i_pu.c b/src/lib/libcrypto/asn1/d2i_pu.c index 3694f51a8c..c8f39ceb03 100644 --- a/src/lib/libcrypto/asn1/d2i_pu.c +++ b/src/lib/libcrypto/asn1/d2i_pu.c | |||
| @@ -87,9 +87,13 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, | |||
| 87 | } | 87 | } |
| 88 | else ret= *a; | 88 | else ret= *a; |
| 89 | 89 | ||
| 90 | ret->save_type=type; | 90 | if (!EVP_PKEY_set_type(ret, type)) |
| 91 | ret->type=EVP_PKEY_type(type); | 91 | { |
| 92 | switch (ret->type) | 92 | ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB); |
| 93 | goto err; | ||
| 94 | } | ||
| 95 | |||
| 96 | switch (EVP_PKEY_id(ret)) | ||
| 93 | { | 97 | { |
| 94 | #ifndef OPENSSL_NO_RSA | 98 | #ifndef OPENSSL_NO_RSA |
| 95 | case EVP_PKEY_RSA: | 99 | case EVP_PKEY_RSA: |
diff --git a/src/lib/libcrypto/asn1/f.c b/src/lib/libcrypto/asn1/f.c deleted file mode 100644 index 82bccdfd51..0000000000 --- a/src/lib/libcrypto/asn1/f.c +++ /dev/null | |||
| @@ -1,80 +0,0 @@ | |||
| 1 | /* crypto/asn1/f.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 <openssl/asn1.h> | ||
| 60 | #include <openssl/err.h> | ||
| 61 | |||
| 62 | main() | ||
| 63 | { | ||
| 64 | ASN1_TYPE *at; | ||
| 65 | char buf[512]; | ||
| 66 | int n; | ||
| 67 | long l; | ||
| 68 | |||
| 69 | at=ASN1_TYPE_new(); | ||
| 70 | |||
| 71 | n=ASN1_TYPE_set_int_octetstring(at,98736,"01234567",8); | ||
| 72 | printf("%d\n",n); | ||
| 73 | n=ASN1_TYPE_get_int_octetstring(at,&l,buf,8); | ||
| 74 | buf[8]='\0'; | ||
| 75 | printf("%ld %d %d\n",l,n,buf[8]); | ||
| 76 | buf[8]='\0'; | ||
| 77 | printf("%s\n",buf); | ||
| 78 | ERR_load_crypto_strings(); | ||
| 79 | ERR_print_errors_fp(stderr); | ||
| 80 | } | ||
diff --git a/src/lib/libcrypto/asn1/i2d_pr.c b/src/lib/libcrypto/asn1/i2d_pr.c index 0be52c5b76..e398b62666 100644 --- a/src/lib/libcrypto/asn1/i2d_pr.c +++ b/src/lib/libcrypto/asn1/i2d_pr.c | |||
| @@ -58,41 +58,22 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/bn.h> | ||
| 62 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 63 | #include <openssl/objects.h> | 62 | #include <openssl/x509.h> |
| 64 | #ifndef OPENSSL_NO_RSA | 63 | #include "asn1_locl.h" |
| 65 | #include <openssl/rsa.h> | ||
| 66 | #endif | ||
| 67 | #ifndef OPENSSL_NO_DSA | ||
| 68 | #include <openssl/dsa.h> | ||
| 69 | #endif | ||
| 70 | #ifndef OPENSSL_NO_EC | ||
| 71 | #include <openssl/ec.h> | ||
| 72 | #endif | ||
| 73 | 64 | ||
| 74 | int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp) | 65 | int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp) |
| 75 | { | 66 | { |
| 76 | #ifndef OPENSSL_NO_RSA | 67 | if (a->ameth && a->ameth->old_priv_encode) |
| 77 | if (a->type == EVP_PKEY_RSA) | ||
| 78 | { | 68 | { |
| 79 | return(i2d_RSAPrivateKey(a->pkey.rsa,pp)); | 69 | return a->ameth->old_priv_encode(a, pp); |
| 80 | } | 70 | } |
| 81 | else | 71 | if (a->ameth && a->ameth->priv_encode) { |
| 82 | #endif | 72 | PKCS8_PRIV_KEY_INFO *p8 = EVP_PKEY2PKCS8(a); |
| 83 | #ifndef OPENSSL_NO_DSA | 73 | int ret = i2d_PKCS8_PRIV_KEY_INFO(p8,pp); |
| 84 | if (a->type == EVP_PKEY_DSA) | 74 | PKCS8_PRIV_KEY_INFO_free(p8); |
| 85 | { | 75 | return ret; |
| 86 | return(i2d_DSAPrivateKey(a->pkey.dsa,pp)); | 76 | } |
| 87 | } | ||
| 88 | #endif | ||
| 89 | #ifndef OPENSSL_NO_EC | ||
| 90 | if (a->type == EVP_PKEY_EC) | ||
| 91 | { | ||
| 92 | return(i2d_ECPrivateKey(a->pkey.ec, pp)); | ||
| 93 | } | ||
| 94 | #endif | ||
| 95 | |||
| 96 | ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); | 77 | ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); |
| 97 | return(-1); | 78 | return(-1); |
| 98 | } | 79 | } |
diff --git a/src/lib/libcrypto/asn1/nsseq.c b/src/lib/libcrypto/asn1/nsseq.c index e551c57d59..b8c4202230 100644 --- a/src/lib/libcrypto/asn1/nsseq.c +++ b/src/lib/libcrypto/asn1/nsseq.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -62,7 +62,8 @@ | |||
| 62 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 63 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 64 | 64 | ||
| 65 | static int nsseq_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 65 | static int nsseq_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 66 | void *exarg) | ||
| 66 | { | 67 | { |
| 67 | if(operation == ASN1_OP_NEW_POST) { | 68 | if(operation == ASN1_OP_NEW_POST) { |
| 68 | NETSCAPE_CERT_SEQUENCE *nsseq; | 69 | NETSCAPE_CERT_SEQUENCE *nsseq; |
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c index c4582f8041..94bc38b99f 100644 --- a/src/lib/libcrypto/asn1/p5_pbe.c +++ b/src/lib/libcrypto/asn1/p5_pbe.c | |||
| @@ -71,61 +71,78 @@ ASN1_SEQUENCE(PBEPARAM) = { | |||
| 71 | 71 | ||
| 72 | IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM) | 72 | IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM) |
| 73 | 73 | ||
| 74 | /* Return an algorithm identifier for a PKCS#5 PBE algorithm */ | ||
| 75 | 74 | ||
| 76 | X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, | 75 | /* Set an algorithm identifier for a PKCS#5 PBE algorithm */ |
| 77 | int saltlen) | 76 | |
| 78 | { | 77 | int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, |
| 78 | const unsigned char *salt, int saltlen) | ||
| 79 | { | ||
| 79 | PBEPARAM *pbe=NULL; | 80 | PBEPARAM *pbe=NULL; |
| 80 | ASN1_OBJECT *al; | 81 | ASN1_STRING *pbe_str=NULL; |
| 81 | X509_ALGOR *algor; | 82 | unsigned char *sstr; |
| 82 | ASN1_TYPE *astype=NULL; | ||
| 83 | 83 | ||
| 84 | if (!(pbe = PBEPARAM_new ())) { | 84 | pbe = PBEPARAM_new(); |
| 85 | ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); | 85 | if (!pbe) |
| 86 | { | ||
| 87 | ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE); | ||
| 86 | goto err; | 88 | goto err; |
| 87 | } | 89 | } |
| 88 | if(iter <= 0) iter = PKCS5_DEFAULT_ITER; | 90 | if(iter <= 0) |
| 89 | if (!ASN1_INTEGER_set(pbe->iter, iter)) { | 91 | iter = PKCS5_DEFAULT_ITER; |
| 90 | ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); | 92 | if (!ASN1_INTEGER_set(pbe->iter, iter)) |
| 93 | { | ||
| 94 | ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE); | ||
| 91 | goto err; | 95 | goto err; |
| 92 | } | 96 | } |
| 93 | if (!saltlen) saltlen = PKCS5_SALT_LEN; | 97 | if (!saltlen) |
| 94 | if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) { | 98 | saltlen = PKCS5_SALT_LEN; |
| 95 | ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); | 99 | if (!ASN1_STRING_set(pbe->salt, NULL, saltlen)) |
| 100 | { | ||
| 101 | ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE); | ||
| 96 | goto err; | 102 | goto err; |
| 97 | } | 103 | } |
| 98 | pbe->salt->length = saltlen; | 104 | sstr = ASN1_STRING_data(pbe->salt); |
| 99 | if (salt) memcpy (pbe->salt->data, salt, saltlen); | 105 | if (salt) |
| 100 | else if (RAND_pseudo_bytes (pbe->salt->data, saltlen) < 0) | 106 | memcpy(sstr, salt, saltlen); |
| 107 | else if (RAND_pseudo_bytes(sstr, saltlen) < 0) | ||
| 101 | goto err; | 108 | goto err; |
| 102 | 109 | ||
| 103 | if (!(astype = ASN1_TYPE_new())) { | 110 | if(!ASN1_item_pack(pbe, ASN1_ITEM_rptr(PBEPARAM), &pbe_str)) |
| 104 | ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); | 111 | { |
| 112 | ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE); | ||
| 105 | goto err; | 113 | goto err; |
| 106 | } | 114 | } |
| 107 | 115 | ||
| 108 | astype->type = V_ASN1_SEQUENCE; | 116 | PBEPARAM_free(pbe); |
| 109 | if(!ASN1_pack_string_of(PBEPARAM, pbe, i2d_PBEPARAM, | ||
| 110 | &astype->value.sequence)) { | ||
| 111 | ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); | ||
| 112 | goto err; | ||
| 113 | } | ||
| 114 | PBEPARAM_free (pbe); | ||
| 115 | pbe = NULL; | 117 | pbe = NULL; |
| 116 | |||
| 117 | al = OBJ_nid2obj(alg); /* never need to free al */ | ||
| 118 | if (!(algor = X509_ALGOR_new())) { | ||
| 119 | ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); | ||
| 120 | goto err; | ||
| 121 | } | ||
| 122 | ASN1_OBJECT_free(algor->algorithm); | ||
| 123 | algor->algorithm = al; | ||
| 124 | algor->parameter = astype; | ||
| 125 | 118 | ||
| 126 | return (algor); | 119 | if (X509_ALGOR_set0(algor, OBJ_nid2obj(alg), V_ASN1_SEQUENCE, pbe_str)) |
| 120 | return 1; | ||
| 121 | |||
| 127 | err: | 122 | err: |
| 128 | if (pbe != NULL) PBEPARAM_free(pbe); | 123 | if (pbe != NULL) |
| 129 | if (astype != NULL) ASN1_TYPE_free(astype); | 124 | PBEPARAM_free(pbe); |
| 125 | if (pbe_str != NULL) | ||
| 126 | ASN1_STRING_free(pbe_str); | ||
| 127 | return 0; | ||
| 128 | } | ||
| 129 | |||
| 130 | /* Return an algorithm identifier for a PKCS#5 PBE algorithm */ | ||
| 131 | |||
| 132 | X509_ALGOR *PKCS5_pbe_set(int alg, int iter, | ||
| 133 | const unsigned char *salt, int saltlen) | ||
| 134 | { | ||
| 135 | X509_ALGOR *ret; | ||
| 136 | ret = X509_ALGOR_new(); | ||
| 137 | if (!ret) | ||
| 138 | { | ||
| 139 | ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); | ||
| 140 | return NULL; | ||
| 141 | } | ||
| 142 | |||
| 143 | if (PKCS5_pbe_set0_algor(ret, alg, iter, salt, saltlen)) | ||
| 144 | return ret; | ||
| 145 | |||
| 146 | X509_ALGOR_free(ret); | ||
| 130 | return NULL; | 147 | return NULL; |
| 131 | } | 148 | } |
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c index 2b0516afee..cb49b6651d 100644 --- a/src/lib/libcrypto/asn1/p5_pbev2.c +++ b/src/lib/libcrypto/asn1/p5_pbev2.c | |||
| @@ -82,10 +82,13 @@ IMPLEMENT_ASN1_FUNCTIONS(PBKDF2PARAM) | |||
| 82 | 82 | ||
| 83 | /* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm: | 83 | /* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm: |
| 84 | * yes I know this is horrible! | 84 | * yes I know this is horrible! |
| 85 | * | ||
| 86 | * Extended version to allow application supplied PRF NID and IV. | ||
| 85 | */ | 87 | */ |
| 86 | 88 | ||
| 87 | X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | 89 | X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, |
| 88 | unsigned char *salt, int saltlen) | 90 | unsigned char *salt, int saltlen, |
| 91 | unsigned char *aiv, int prf_nid) | ||
| 89 | { | 92 | { |
| 90 | X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; | 93 | X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; |
| 91 | int alg_nid; | 94 | int alg_nid; |
| @@ -98,7 +101,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
| 98 | 101 | ||
| 99 | alg_nid = EVP_CIPHER_type(cipher); | 102 | alg_nid = EVP_CIPHER_type(cipher); |
| 100 | if(alg_nid == NID_undef) { | 103 | if(alg_nid == NID_undef) { |
| 101 | ASN1err(ASN1_F_PKCS5_PBE2_SET, | 104 | ASN1err(ASN1_F_PKCS5_PBE2_SET_IV, |
| 102 | ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); | 105 | ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); |
| 103 | goto err; | 106 | goto err; |
| 104 | } | 107 | } |
| @@ -113,20 +116,33 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
| 113 | if(!(scheme->parameter = ASN1_TYPE_new())) goto merr; | 116 | if(!(scheme->parameter = ASN1_TYPE_new())) goto merr; |
| 114 | 117 | ||
| 115 | /* Create random IV */ | 118 | /* Create random IV */ |
| 116 | if (EVP_CIPHER_iv_length(cipher) && | 119 | if (EVP_CIPHER_iv_length(cipher)) |
| 117 | RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) | 120 | { |
| 118 | goto err; | 121 | if (aiv) |
| 122 | memcpy(iv, aiv, EVP_CIPHER_iv_length(cipher)); | ||
| 123 | else if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) | ||
| 124 | goto err; | ||
| 125 | } | ||
| 119 | 126 | ||
| 120 | EVP_CIPHER_CTX_init(&ctx); | 127 | EVP_CIPHER_CTX_init(&ctx); |
| 121 | 128 | ||
| 122 | /* Dummy cipherinit to just setup the IV */ | 129 | /* Dummy cipherinit to just setup the IV, and PRF */ |
| 123 | EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0); | 130 | EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0); |
| 124 | if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { | 131 | if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { |
| 125 | ASN1err(ASN1_F_PKCS5_PBE2_SET, | 132 | ASN1err(ASN1_F_PKCS5_PBE2_SET_IV, |
| 126 | ASN1_R_ERROR_SETTING_CIPHER_PARAMS); | 133 | ASN1_R_ERROR_SETTING_CIPHER_PARAMS); |
| 127 | EVP_CIPHER_CTX_cleanup(&ctx); | 134 | EVP_CIPHER_CTX_cleanup(&ctx); |
| 128 | goto err; | 135 | goto err; |
| 129 | } | 136 | } |
| 137 | /* If prf NID unspecified see if cipher has a preference. | ||
| 138 | * An error is OK here: just means use default PRF. | ||
| 139 | */ | ||
| 140 | if ((prf_nid == -1) && | ||
| 141 | EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_PBE_PRF_NID, 0, &prf_nid) <= 0) | ||
| 142 | { | ||
| 143 | ERR_clear_error(); | ||
| 144 | prf_nid = NID_hmacWithSHA1; | ||
| 145 | } | ||
| 130 | EVP_CIPHER_CTX_cleanup(&ctx); | 146 | EVP_CIPHER_CTX_cleanup(&ctx); |
| 131 | 147 | ||
| 132 | if(!(kdf = PBKDF2PARAM_new())) goto merr; | 148 | if(!(kdf = PBKDF2PARAM_new())) goto merr; |
| @@ -154,7 +170,15 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
| 154 | EVP_CIPHER_key_length(cipher))) goto merr; | 170 | EVP_CIPHER_key_length(cipher))) goto merr; |
| 155 | } | 171 | } |
| 156 | 172 | ||
| 157 | /* prf can stay NULL because we are using hmacWithSHA1 */ | 173 | /* prf can stay NULL if we are using hmacWithSHA1 */ |
| 174 | if (prf_nid != NID_hmacWithSHA1) | ||
| 175 | { | ||
| 176 | kdf->prf = X509_ALGOR_new(); | ||
| 177 | if (!kdf->prf) | ||
| 178 | goto merr; | ||
| 179 | X509_ALGOR_set0(kdf->prf, OBJ_nid2obj(prf_nid), | ||
| 180 | V_ASN1_NULL, NULL); | ||
| 181 | } | ||
| 158 | 182 | ||
| 159 | /* Now setup the PBE2PARAM keyfunc structure */ | 183 | /* Now setup the PBE2PARAM keyfunc structure */ |
| 160 | 184 | ||
| @@ -164,7 +188,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
| 164 | 188 | ||
| 165 | if(!(pbe2->keyfunc->parameter = ASN1_TYPE_new())) goto merr; | 189 | if(!(pbe2->keyfunc->parameter = ASN1_TYPE_new())) goto merr; |
| 166 | 190 | ||
| 167 | if(!ASN1_pack_string_of(PBKDF2PARAM, kdf, i2d_PBKDF2PARAM, | 191 | if(!ASN1_item_pack(kdf, ASN1_ITEM_rptr(PBKDF2PARAM), |
| 168 | &pbe2->keyfunc->parameter->value.sequence)) goto merr; | 192 | &pbe2->keyfunc->parameter->value.sequence)) goto merr; |
| 169 | pbe2->keyfunc->parameter->type = V_ASN1_SEQUENCE; | 193 | pbe2->keyfunc->parameter->type = V_ASN1_SEQUENCE; |
| 170 | 194 | ||
| @@ -180,7 +204,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
| 180 | 204 | ||
| 181 | /* Encode PBE2PARAM into parameter */ | 205 | /* Encode PBE2PARAM into parameter */ |
| 182 | 206 | ||
| 183 | if(!ASN1_pack_string_of(PBE2PARAM, pbe2, i2d_PBE2PARAM, | 207 | if(!ASN1_item_pack(pbe2, ASN1_ITEM_rptr(PBE2PARAM), |
| 184 | &ret->parameter->value.sequence)) goto merr; | 208 | &ret->parameter->value.sequence)) goto merr; |
| 185 | ret->parameter->type = V_ASN1_SEQUENCE; | 209 | ret->parameter->type = V_ASN1_SEQUENCE; |
| 186 | 210 | ||
| @@ -190,7 +214,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
| 190 | return ret; | 214 | return ret; |
| 191 | 215 | ||
| 192 | merr: | 216 | merr: |
| 193 | ASN1err(ASN1_F_PKCS5_PBE2_SET,ERR_R_MALLOC_FAILURE); | 217 | ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,ERR_R_MALLOC_FAILURE); |
| 194 | 218 | ||
| 195 | err: | 219 | err: |
| 196 | PBE2PARAM_free(pbe2); | 220 | PBE2PARAM_free(pbe2); |
| @@ -203,3 +227,9 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
| 203 | return NULL; | 227 | return NULL; |
| 204 | 228 | ||
| 205 | } | 229 | } |
| 230 | |||
| 231 | X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | ||
| 232 | unsigned char *salt, int saltlen) | ||
| 233 | { | ||
| 234 | return PKCS5_pbe2_set_iv(cipher, iter, salt, saltlen, NULL, -1); | ||
| 235 | } | ||
diff --git a/src/lib/libcrypto/asn1/p8_key.c b/src/lib/libcrypto/asn1/p8_key.c deleted file mode 100644 index 3a31248e14..0000000000 --- a/src/lib/libcrypto/asn1/p8_key.c +++ /dev/null | |||
| @@ -1,131 +0,0 @@ | |||
| 1 | /* crypto/asn1/p8_key.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/asn1_mac.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | |||
| 64 | int i2d_X509_KEY(X509 *a, unsigned char **pp) | ||
| 65 | { | ||
| 66 | M_ASN1_I2D_vars(a); | ||
| 67 | |||
| 68 | M_ASN1_I2D_len(a->cert_info, i2d_X509_CINF); | ||
| 69 | M_ASN1_I2D_len(a->sig_alg, i2d_X509_ALGOR); | ||
| 70 | M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING); | ||
| 71 | |||
| 72 | M_ASN1_I2D_seq_total(); | ||
| 73 | |||
| 74 | M_ASN1_I2D_put(a->cert_info, i2d_X509_CINF); | ||
| 75 | M_ASN1_I2D_put(a->sig_alg, i2d_X509_ALGOR); | ||
| 76 | M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING); | ||
| 77 | |||
| 78 | M_ASN1_I2D_finish(); | ||
| 79 | } | ||
| 80 | |||
| 81 | X509 *d2i_X509_KEY(X509 **a, unsigned char **pp, long length) | ||
| 82 | { | ||
| 83 | M_ASN1_D2I_vars(a,X509 *,X509_new); | ||
| 84 | |||
| 85 | M_ASN1_D2I_Init(); | ||
| 86 | M_ASN1_D2I_start_sequence(); | ||
| 87 | M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF); | ||
| 88 | M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR); | ||
| 89 | M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING); | ||
| 90 | M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509); | ||
| 91 | } | ||
| 92 | |||
| 93 | X509 *X509_KEY_new(void) | ||
| 94 | { | ||
| 95 | X509_KEY *ret=NULL; | ||
| 96 | |||
| 97 | M_ASN1_New_OPENSSL_malloc(ret,X509_KEY); | ||
| 98 | ret->references=1; | ||
| 99 | ret->type=NID | ||
| 100 | M_ASN1_New(ret->cert_info,X509_CINF_new); | ||
| 101 | M_ASN1_New(ret->sig_alg,X509_ALGOR_new); | ||
| 102 | M_ASN1_New(ret->signature,ASN1_BIT_STRING_new); | ||
| 103 | return(ret); | ||
| 104 | M_ASN1_New_Error(ASN1_F_X509_NEW); | ||
| 105 | } | ||
| 106 | |||
| 107 | void X509_KEY_free(X509 *a) | ||
| 108 | { | ||
| 109 | int i; | ||
| 110 | |||
| 111 | if (a == NULL) return; | ||
| 112 | |||
| 113 | i=CRYPTO_add_lock(&a->references,-1,CRYPTO_LOCK_X509_KEY); | ||
| 114 | #ifdef REF_PRINT | ||
| 115 | REF_PRINT("X509_KEY",a); | ||
| 116 | #endif | ||
| 117 | if (i > 0) return; | ||
| 118 | #ifdef REF_CHECK | ||
| 119 | if (i < 0) | ||
| 120 | { | ||
| 121 | fprintf(stderr,"X509_KEY_free, bad reference count\n"); | ||
| 122 | abort(); | ||
| 123 | } | ||
| 124 | #endif | ||
| 125 | |||
| 126 | X509_CINF_free(a->cert_info); | ||
| 127 | X509_ALGOR_free(a->sig_alg); | ||
| 128 | ASN1_BIT_STRING_free(a->signature); | ||
| 129 | OPENSSL_free(a); | ||
| 130 | } | ||
| 131 | |||
diff --git a/src/lib/libcrypto/asn1/p8_pkey.c b/src/lib/libcrypto/asn1/p8_pkey.c index 0a1957556e..17b68d386d 100644 --- a/src/lib/libcrypto/asn1/p8_pkey.c +++ b/src/lib/libcrypto/asn1/p8_pkey.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -62,7 +62,8 @@ | |||
| 62 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 63 | 63 | ||
| 64 | /* Minor tweak to operation: zero private key data */ | 64 | /* Minor tweak to operation: zero private key data */ |
| 65 | static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 65 | static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 66 | void *exarg) | ||
| 66 | { | 67 | { |
| 67 | /* Since the structure must still be valid use ASN1_OP_FREE_PRE */ | 68 | /* Since the structure must still be valid use ASN1_OP_FREE_PRE */ |
| 68 | if(operation == ASN1_OP_FREE_PRE) { | 69 | if(operation == ASN1_OP_FREE_PRE) { |
| @@ -82,3 +83,73 @@ ASN1_SEQUENCE_cb(PKCS8_PRIV_KEY_INFO, pkey_cb) = { | |||
| 82 | } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) | 83 | } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) |
| 83 | 84 | ||
| 84 | IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) | 85 | IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) |
| 86 | |||
| 87 | int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, | ||
| 88 | int version, | ||
| 89 | int ptype, void *pval, | ||
| 90 | unsigned char *penc, int penclen) | ||
| 91 | { | ||
| 92 | unsigned char **ppenc = NULL; | ||
| 93 | if (version >= 0) | ||
| 94 | { | ||
| 95 | if (!ASN1_INTEGER_set(priv->version, version)) | ||
| 96 | return 0; | ||
| 97 | } | ||
| 98 | if (penc) | ||
| 99 | { | ||
| 100 | int pmtype; | ||
| 101 | ASN1_OCTET_STRING *oct; | ||
| 102 | oct = ASN1_OCTET_STRING_new(); | ||
| 103 | if (!oct) | ||
| 104 | return 0; | ||
| 105 | oct->data = penc; | ||
| 106 | ppenc = &oct->data; | ||
| 107 | oct->length = penclen; | ||
| 108 | if (priv->broken == PKCS8_NO_OCTET) | ||
| 109 | pmtype = V_ASN1_SEQUENCE; | ||
| 110 | else | ||
| 111 | pmtype = V_ASN1_OCTET_STRING; | ||
| 112 | ASN1_TYPE_set(priv->pkey, pmtype, oct); | ||
| 113 | } | ||
| 114 | if (!X509_ALGOR_set0(priv->pkeyalg, aobj, ptype, pval)) | ||
| 115 | { | ||
| 116 | /* If call fails do not swallow 'enc' */ | ||
| 117 | if (ppenc) | ||
| 118 | *ppenc = NULL; | ||
| 119 | return 0; | ||
| 120 | } | ||
| 121 | return 1; | ||
| 122 | } | ||
| 123 | |||
| 124 | int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg, | ||
| 125 | const unsigned char **pk, int *ppklen, | ||
| 126 | X509_ALGOR **pa, | ||
| 127 | PKCS8_PRIV_KEY_INFO *p8) | ||
| 128 | { | ||
| 129 | if (ppkalg) | ||
| 130 | *ppkalg = p8->pkeyalg->algorithm; | ||
| 131 | if(p8->pkey->type == V_ASN1_OCTET_STRING) | ||
| 132 | { | ||
| 133 | p8->broken = PKCS8_OK; | ||
| 134 | if (pk) | ||
| 135 | { | ||
| 136 | *pk = p8->pkey->value.octet_string->data; | ||
| 137 | *ppklen = p8->pkey->value.octet_string->length; | ||
| 138 | } | ||
| 139 | } | ||
| 140 | else if (p8->pkey->type == V_ASN1_SEQUENCE) | ||
| 141 | { | ||
| 142 | p8->broken = PKCS8_NO_OCTET; | ||
| 143 | if (pk) | ||
| 144 | { | ||
| 145 | *pk = p8->pkey->value.sequence->data; | ||
| 146 | *ppklen = p8->pkey->value.sequence->length; | ||
| 147 | } | ||
| 148 | } | ||
| 149 | else | ||
| 150 | return 0; | ||
| 151 | if (pa) | ||
| 152 | *pa = p8->pkeyalg; | ||
| 153 | return 1; | ||
| 154 | } | ||
| 155 | |||
diff --git a/src/lib/libcrypto/asn1/t_pkey.c b/src/lib/libcrypto/asn1/t_pkey.c index afb95d6712..9dd18f6579 100644 --- a/src/lib/libcrypto/asn1/t_pkey.c +++ b/src/lib/libcrypto/asn1/t_pkey.c | |||
| @@ -55,520 +55,15 @@ | |||
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | /* ==================================================================== | ||
| 59 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
| 60 | * Binary polynomial ECC support in OpenSSL originally developed by | ||
| 61 | * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. | ||
| 62 | */ | ||
| 63 | 58 | ||
| 64 | #include <stdio.h> | 59 | #include <stdio.h> |
| 65 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 66 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
| 67 | #include <openssl/buffer.h> | 62 | #include <openssl/buffer.h> |
| 68 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
| 69 | #ifndef OPENSSL_NO_RSA | ||
| 70 | #include <openssl/rsa.h> | ||
| 71 | #endif | ||
| 72 | #ifndef OPENSSL_NO_DH | ||
| 73 | #include <openssl/dh.h> | ||
| 74 | #endif | ||
| 75 | #ifndef OPENSSL_NO_DSA | ||
| 76 | #include <openssl/dsa.h> | ||
| 77 | #endif | ||
| 78 | #ifndef OPENSSL_NO_EC | ||
| 79 | #include <openssl/ec.h> | ||
| 80 | #endif | ||
| 81 | |||
| 82 | static int print(BIO *fp,const char *str, const BIGNUM *num, | ||
| 83 | unsigned char *buf,int off); | ||
| 84 | #ifndef OPENSSL_NO_EC | ||
| 85 | static int print_bin(BIO *fp, const char *str, const unsigned char *num, | ||
| 86 | size_t len, int off); | ||
| 87 | #endif | ||
| 88 | #ifndef OPENSSL_NO_RSA | ||
| 89 | #ifndef OPENSSL_NO_FP_API | ||
| 90 | int RSA_print_fp(FILE *fp, const RSA *x, int off) | ||
| 91 | { | ||
| 92 | BIO *b; | ||
| 93 | int ret; | ||
| 94 | |||
| 95 | if ((b=BIO_new(BIO_s_file())) == NULL) | ||
| 96 | { | ||
| 97 | RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB); | ||
| 98 | return(0); | ||
| 99 | } | ||
| 100 | BIO_set_fp(b,fp,BIO_NOCLOSE); | ||
| 101 | ret=RSA_print(b,x,off); | ||
| 102 | BIO_free(b); | ||
| 103 | return(ret); | ||
| 104 | } | ||
| 105 | #endif | ||
| 106 | |||
| 107 | int RSA_print(BIO *bp, const RSA *x, int off) | ||
| 108 | { | ||
| 109 | char str[128]; | ||
| 110 | const char *s; | ||
| 111 | unsigned char *m=NULL; | ||
| 112 | int ret=0, mod_len = 0; | ||
| 113 | size_t buf_len=0, i; | ||
| 114 | |||
| 115 | if (x->n) | ||
| 116 | buf_len = (size_t)BN_num_bytes(x->n); | ||
| 117 | if (x->e) | ||
| 118 | if (buf_len < (i = (size_t)BN_num_bytes(x->e))) | ||
| 119 | buf_len = i; | ||
| 120 | if (x->d) | ||
| 121 | if (buf_len < (i = (size_t)BN_num_bytes(x->d))) | ||
| 122 | buf_len = i; | ||
| 123 | if (x->p) | ||
| 124 | if (buf_len < (i = (size_t)BN_num_bytes(x->p))) | ||
| 125 | buf_len = i; | ||
| 126 | if (x->q) | ||
| 127 | if (buf_len < (i = (size_t)BN_num_bytes(x->q))) | ||
| 128 | buf_len = i; | ||
| 129 | if (x->dmp1) | ||
| 130 | if (buf_len < (i = (size_t)BN_num_bytes(x->dmp1))) | ||
| 131 | buf_len = i; | ||
| 132 | if (x->dmq1) | ||
| 133 | if (buf_len < (i = (size_t)BN_num_bytes(x->dmq1))) | ||
| 134 | buf_len = i; | ||
| 135 | if (x->iqmp) | ||
| 136 | if (buf_len < (i = (size_t)BN_num_bytes(x->iqmp))) | ||
| 137 | buf_len = i; | ||
| 138 | |||
| 139 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | ||
| 140 | if (m == NULL) | ||
| 141 | { | ||
| 142 | RSAerr(RSA_F_RSA_PRINT,ERR_R_MALLOC_FAILURE); | ||
| 143 | goto err; | ||
| 144 | } | ||
| 145 | |||
| 146 | if (x->n != NULL) | ||
| 147 | mod_len = BN_num_bits(x->n); | ||
| 148 | |||
| 149 | if (x->d != NULL) | ||
| 150 | { | ||
| 151 | if(!BIO_indent(bp,off,128)) | ||
| 152 | goto err; | ||
| 153 | if (BIO_printf(bp,"Private-Key: (%d bit)\n", mod_len) | ||
| 154 | <= 0) goto err; | ||
| 155 | } | ||
| 156 | |||
| 157 | if (x->d == NULL) | ||
| 158 | BIO_snprintf(str,sizeof str,"Modulus (%d bit):", mod_len); | ||
| 159 | else | ||
| 160 | BUF_strlcpy(str,"modulus:",sizeof str); | ||
| 161 | if (!print(bp,str,x->n,m,off)) goto err; | ||
| 162 | s=(x->d == NULL)?"Exponent:":"publicExponent:"; | ||
| 163 | if ((x->e != NULL) && !print(bp,s,x->e,m,off)) | ||
| 164 | goto err; | ||
| 165 | if ((x->d != NULL) && !print(bp,"privateExponent:",x->d,m,off)) | ||
| 166 | goto err; | ||
| 167 | if ((x->p != NULL) && !print(bp,"prime1:",x->p,m,off)) | ||
| 168 | goto err; | ||
| 169 | if ((x->q != NULL) && !print(bp,"prime2:",x->q,m,off)) | ||
| 170 | goto err; | ||
| 171 | if ((x->dmp1 != NULL) && !print(bp,"exponent1:",x->dmp1,m,off)) | ||
| 172 | goto err; | ||
| 173 | if ((x->dmq1 != NULL) && !print(bp,"exponent2:",x->dmq1,m,off)) | ||
| 174 | goto err; | ||
| 175 | if ((x->iqmp != NULL) && !print(bp,"coefficient:",x->iqmp,m,off)) | ||
| 176 | goto err; | ||
| 177 | ret=1; | ||
| 178 | err: | ||
| 179 | if (m != NULL) OPENSSL_free(m); | ||
| 180 | return(ret); | ||
| 181 | } | ||
| 182 | #endif /* OPENSSL_NO_RSA */ | ||
| 183 | |||
| 184 | #ifndef OPENSSL_NO_DSA | ||
| 185 | #ifndef OPENSSL_NO_FP_API | ||
| 186 | int DSA_print_fp(FILE *fp, const DSA *x, int off) | ||
| 187 | { | ||
| 188 | BIO *b; | ||
| 189 | int ret; | ||
| 190 | |||
| 191 | if ((b=BIO_new(BIO_s_file())) == NULL) | ||
| 192 | { | ||
| 193 | DSAerr(DSA_F_DSA_PRINT_FP,ERR_R_BUF_LIB); | ||
| 194 | return(0); | ||
| 195 | } | ||
| 196 | BIO_set_fp(b,fp,BIO_NOCLOSE); | ||
| 197 | ret=DSA_print(b,x,off); | ||
| 198 | BIO_free(b); | ||
| 199 | return(ret); | ||
| 200 | } | ||
| 201 | #endif | ||
| 202 | |||
| 203 | int DSA_print(BIO *bp, const DSA *x, int off) | ||
| 204 | { | ||
| 205 | unsigned char *m=NULL; | ||
| 206 | int ret=0; | ||
| 207 | size_t buf_len=0,i; | ||
| 208 | |||
| 209 | if (x->p) | ||
| 210 | buf_len = (size_t)BN_num_bytes(x->p); | ||
| 211 | else | ||
| 212 | { | ||
| 213 | DSAerr(DSA_F_DSA_PRINT,DSA_R_MISSING_PARAMETERS); | ||
| 214 | goto err; | ||
| 215 | } | ||
| 216 | if (x->q) | ||
| 217 | if (buf_len < (i = (size_t)BN_num_bytes(x->q))) | ||
| 218 | buf_len = i; | ||
| 219 | if (x->g) | ||
| 220 | if (buf_len < (i = (size_t)BN_num_bytes(x->g))) | ||
| 221 | buf_len = i; | ||
| 222 | if (x->priv_key) | ||
| 223 | if (buf_len < (i = (size_t)BN_num_bytes(x->priv_key))) | ||
| 224 | buf_len = i; | ||
| 225 | if (x->pub_key) | ||
| 226 | if (buf_len < (i = (size_t)BN_num_bytes(x->pub_key))) | ||
| 227 | buf_len = i; | ||
| 228 | |||
| 229 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | ||
| 230 | if (m == NULL) | ||
| 231 | { | ||
| 232 | DSAerr(DSA_F_DSA_PRINT,ERR_R_MALLOC_FAILURE); | ||
| 233 | goto err; | ||
| 234 | } | ||
| 235 | |||
| 236 | if (x->priv_key != NULL) | ||
| 237 | { | ||
| 238 | if(!BIO_indent(bp,off,128)) | ||
| 239 | goto err; | ||
| 240 | if (BIO_printf(bp,"Private-Key: (%d bit)\n",BN_num_bits(x->p)) | ||
| 241 | <= 0) goto err; | ||
| 242 | } | ||
| 243 | |||
| 244 | if ((x->priv_key != NULL) && !print(bp,"priv:",x->priv_key,m,off)) | ||
| 245 | goto err; | ||
| 246 | if ((x->pub_key != NULL) && !print(bp,"pub: ",x->pub_key,m,off)) | ||
| 247 | goto err; | ||
| 248 | if ((x->p != NULL) && !print(bp,"P: ",x->p,m,off)) goto err; | ||
| 249 | if ((x->q != NULL) && !print(bp,"Q: ",x->q,m,off)) goto err; | ||
| 250 | if ((x->g != NULL) && !print(bp,"G: ",x->g,m,off)) goto err; | ||
| 251 | ret=1; | ||
| 252 | err: | ||
| 253 | if (m != NULL) OPENSSL_free(m); | ||
| 254 | return(ret); | ||
| 255 | } | ||
| 256 | #endif /* !OPENSSL_NO_DSA */ | ||
| 257 | |||
| 258 | #ifndef OPENSSL_NO_EC | ||
| 259 | #ifndef OPENSSL_NO_FP_API | ||
| 260 | int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off) | ||
| 261 | { | ||
| 262 | BIO *b; | ||
| 263 | int ret; | ||
| 264 | |||
| 265 | if ((b=BIO_new(BIO_s_file())) == NULL) | ||
| 266 | { | ||
| 267 | ECerr(EC_F_ECPKPARAMETERS_PRINT_FP,ERR_R_BUF_LIB); | ||
| 268 | return(0); | ||
| 269 | } | ||
| 270 | BIO_set_fp(b, fp, BIO_NOCLOSE); | ||
| 271 | ret = ECPKParameters_print(b, x, off); | ||
| 272 | BIO_free(b); | ||
| 273 | return(ret); | ||
| 274 | } | ||
| 275 | |||
| 276 | int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off) | ||
| 277 | { | ||
| 278 | BIO *b; | ||
| 279 | int ret; | ||
| 280 | |||
| 281 | if ((b=BIO_new(BIO_s_file())) == NULL) | ||
| 282 | { | ||
| 283 | ECerr(EC_F_EC_KEY_PRINT_FP, ERR_R_BIO_LIB); | ||
| 284 | return(0); | ||
| 285 | } | ||
| 286 | BIO_set_fp(b, fp, BIO_NOCLOSE); | ||
| 287 | ret = EC_KEY_print(b, x, off); | ||
| 288 | BIO_free(b); | ||
| 289 | return(ret); | ||
| 290 | } | ||
| 291 | #endif | ||
| 292 | |||
| 293 | int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) | ||
| 294 | { | ||
| 295 | unsigned char *buffer=NULL; | ||
| 296 | size_t buf_len=0, i; | ||
| 297 | int ret=0, reason=ERR_R_BIO_LIB; | ||
| 298 | BN_CTX *ctx=NULL; | ||
| 299 | const EC_POINT *point=NULL; | ||
| 300 | BIGNUM *p=NULL, *a=NULL, *b=NULL, *gen=NULL, | ||
| 301 | *order=NULL, *cofactor=NULL; | ||
| 302 | const unsigned char *seed; | ||
| 303 | size_t seed_len=0; | ||
| 304 | |||
| 305 | static const char *gen_compressed = "Generator (compressed):"; | ||
| 306 | static const char *gen_uncompressed = "Generator (uncompressed):"; | ||
| 307 | static const char *gen_hybrid = "Generator (hybrid):"; | ||
| 308 | |||
| 309 | if (!x) | ||
| 310 | { | ||
| 311 | reason = ERR_R_PASSED_NULL_PARAMETER; | ||
| 312 | goto err; | ||
| 313 | } | ||
| 314 | |||
| 315 | if (EC_GROUP_get_asn1_flag(x)) | ||
| 316 | { | ||
| 317 | /* the curve parameter are given by an asn1 OID */ | ||
| 318 | int nid; | ||
| 319 | |||
| 320 | if (!BIO_indent(bp, off, 128)) | ||
| 321 | goto err; | ||
| 322 | |||
| 323 | nid = EC_GROUP_get_curve_name(x); | ||
| 324 | if (nid == 0) | ||
| 325 | goto err; | ||
| 326 | |||
| 327 | if (BIO_printf(bp, "ASN1 OID: %s", OBJ_nid2sn(nid)) <= 0) | ||
| 328 | goto err; | ||
| 329 | if (BIO_printf(bp, "\n") <= 0) | ||
| 330 | goto err; | ||
| 331 | } | ||
| 332 | else | ||
| 333 | { | ||
| 334 | /* explicit parameters */ | ||
| 335 | int is_char_two = 0; | ||
| 336 | point_conversion_form_t form; | ||
| 337 | int tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x)); | ||
| 338 | |||
| 339 | if (tmp_nid == NID_X9_62_characteristic_two_field) | ||
| 340 | is_char_two = 1; | ||
| 341 | |||
| 342 | if ((p = BN_new()) == NULL || (a = BN_new()) == NULL || | ||
| 343 | (b = BN_new()) == NULL || (order = BN_new()) == NULL || | ||
| 344 | (cofactor = BN_new()) == NULL) | ||
| 345 | { | ||
| 346 | reason = ERR_R_MALLOC_FAILURE; | ||
| 347 | goto err; | ||
| 348 | } | ||
| 349 | |||
| 350 | if (is_char_two) | ||
| 351 | { | ||
| 352 | if (!EC_GROUP_get_curve_GF2m(x, p, a, b, ctx)) | ||
| 353 | { | ||
| 354 | reason = ERR_R_EC_LIB; | ||
| 355 | goto err; | ||
| 356 | } | ||
| 357 | } | ||
| 358 | else /* prime field */ | ||
| 359 | { | ||
| 360 | if (!EC_GROUP_get_curve_GFp(x, p, a, b, ctx)) | ||
| 361 | { | ||
| 362 | reason = ERR_R_EC_LIB; | ||
| 363 | goto err; | ||
| 364 | } | ||
| 365 | } | ||
| 366 | |||
| 367 | if ((point = EC_GROUP_get0_generator(x)) == NULL) | ||
| 368 | { | ||
| 369 | reason = ERR_R_EC_LIB; | ||
| 370 | goto err; | ||
| 371 | } | ||
| 372 | if (!EC_GROUP_get_order(x, order, NULL) || | ||
| 373 | !EC_GROUP_get_cofactor(x, cofactor, NULL)) | ||
| 374 | { | ||
| 375 | reason = ERR_R_EC_LIB; | ||
| 376 | goto err; | ||
| 377 | } | ||
| 378 | |||
| 379 | form = EC_GROUP_get_point_conversion_form(x); | ||
| 380 | |||
| 381 | if ((gen = EC_POINT_point2bn(x, point, | ||
| 382 | form, NULL, ctx)) == NULL) | ||
| 383 | { | ||
| 384 | reason = ERR_R_EC_LIB; | ||
| 385 | goto err; | ||
| 386 | } | ||
| 387 | |||
| 388 | buf_len = (size_t)BN_num_bytes(p); | ||
| 389 | if (buf_len < (i = (size_t)BN_num_bytes(a))) | ||
| 390 | buf_len = i; | ||
| 391 | if (buf_len < (i = (size_t)BN_num_bytes(b))) | ||
| 392 | buf_len = i; | ||
| 393 | if (buf_len < (i = (size_t)BN_num_bytes(gen))) | ||
| 394 | buf_len = i; | ||
| 395 | if (buf_len < (i = (size_t)BN_num_bytes(order))) | ||
| 396 | buf_len = i; | ||
| 397 | if (buf_len < (i = (size_t)BN_num_bytes(cofactor))) | ||
| 398 | buf_len = i; | ||
| 399 | |||
| 400 | if ((seed = EC_GROUP_get0_seed(x)) != NULL) | ||
| 401 | seed_len = EC_GROUP_get_seed_len(x); | ||
| 402 | |||
| 403 | buf_len += 10; | ||
| 404 | if ((buffer = OPENSSL_malloc(buf_len)) == NULL) | ||
| 405 | { | ||
| 406 | reason = ERR_R_MALLOC_FAILURE; | ||
| 407 | goto err; | ||
| 408 | } | ||
| 409 | |||
| 410 | if (!BIO_indent(bp, off, 128)) | ||
| 411 | goto err; | ||
| 412 | |||
| 413 | /* print the 'short name' of the field type */ | ||
| 414 | if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid)) | ||
| 415 | <= 0) | ||
| 416 | goto err; | ||
| 417 | |||
| 418 | if (is_char_two) | ||
| 419 | { | ||
| 420 | /* print the 'short name' of the base type OID */ | ||
| 421 | int basis_type = EC_GROUP_get_basis_type(x); | ||
| 422 | if (basis_type == 0) | ||
| 423 | goto err; | ||
| 424 | |||
| 425 | if (!BIO_indent(bp, off, 128)) | ||
| 426 | goto err; | ||
| 427 | |||
| 428 | if (BIO_printf(bp, "Basis Type: %s\n", | ||
| 429 | OBJ_nid2sn(basis_type)) <= 0) | ||
| 430 | goto err; | ||
| 431 | |||
| 432 | /* print the polynomial */ | ||
| 433 | if ((p != NULL) && !print(bp, "Polynomial:", p, buffer, | ||
| 434 | off)) | ||
| 435 | goto err; | ||
| 436 | } | ||
| 437 | else | ||
| 438 | { | ||
| 439 | if ((p != NULL) && !print(bp, "Prime:", p, buffer,off)) | ||
| 440 | goto err; | ||
| 441 | } | ||
| 442 | if ((a != NULL) && !print(bp, "A: ", a, buffer, off)) | ||
| 443 | goto err; | ||
| 444 | if ((b != NULL) && !print(bp, "B: ", b, buffer, off)) | ||
| 445 | goto err; | ||
| 446 | if (form == POINT_CONVERSION_COMPRESSED) | ||
| 447 | { | ||
| 448 | if ((gen != NULL) && !print(bp, gen_compressed, gen, | ||
| 449 | buffer, off)) | ||
| 450 | goto err; | ||
| 451 | } | ||
| 452 | else if (form == POINT_CONVERSION_UNCOMPRESSED) | ||
| 453 | { | ||
| 454 | if ((gen != NULL) && !print(bp, gen_uncompressed, gen, | ||
| 455 | buffer, off)) | ||
| 456 | goto err; | ||
| 457 | } | ||
| 458 | else /* form == POINT_CONVERSION_HYBRID */ | ||
| 459 | { | ||
| 460 | if ((gen != NULL) && !print(bp, gen_hybrid, gen, | ||
| 461 | buffer, off)) | ||
| 462 | goto err; | ||
| 463 | } | ||
| 464 | if ((order != NULL) && !print(bp, "Order: ", order, | ||
| 465 | buffer, off)) goto err; | ||
| 466 | if ((cofactor != NULL) && !print(bp, "Cofactor: ", cofactor, | ||
| 467 | buffer, off)) goto err; | ||
| 468 | if (seed && !print_bin(bp, "Seed:", seed, seed_len, off)) | ||
| 469 | goto err; | ||
| 470 | } | ||
| 471 | ret=1; | ||
| 472 | err: | ||
| 473 | if (!ret) | ||
| 474 | ECerr(EC_F_ECPKPARAMETERS_PRINT, reason); | ||
| 475 | if (p) | ||
| 476 | BN_free(p); | ||
| 477 | if (a) | ||
| 478 | BN_free(a); | ||
| 479 | if (b) | ||
| 480 | BN_free(b); | ||
| 481 | if (gen) | ||
| 482 | BN_free(gen); | ||
| 483 | if (order) | ||
| 484 | BN_free(order); | ||
| 485 | if (cofactor) | ||
| 486 | BN_free(cofactor); | ||
| 487 | if (ctx) | ||
| 488 | BN_CTX_free(ctx); | ||
| 489 | if (buffer != NULL) | ||
| 490 | OPENSSL_free(buffer); | ||
| 491 | return(ret); | ||
| 492 | } | ||
| 493 | 64 | ||
| 494 | int EC_KEY_print(BIO *bp, const EC_KEY *x, int off) | 65 | int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, |
| 495 | { | 66 | unsigned char *buf, int off) |
| 496 | unsigned char *buffer=NULL; | ||
| 497 | size_t buf_len=0, i; | ||
| 498 | int ret=0, reason=ERR_R_BIO_LIB; | ||
| 499 | BIGNUM *pub_key=NULL, *order=NULL; | ||
| 500 | BN_CTX *ctx=NULL; | ||
| 501 | const EC_GROUP *group; | ||
| 502 | const EC_POINT *public_key; | ||
| 503 | const BIGNUM *priv_key; | ||
| 504 | |||
| 505 | if (x == NULL || (group = EC_KEY_get0_group(x)) == NULL) | ||
| 506 | { | ||
| 507 | reason = ERR_R_PASSED_NULL_PARAMETER; | ||
| 508 | goto err; | ||
| 509 | } | ||
| 510 | |||
| 511 | public_key = EC_KEY_get0_public_key(x); | ||
| 512 | if ((pub_key = EC_POINT_point2bn(group, public_key, | ||
| 513 | EC_KEY_get_conv_form(x), NULL, ctx)) == NULL) | ||
| 514 | { | ||
| 515 | reason = ERR_R_EC_LIB; | ||
| 516 | goto err; | ||
| 517 | } | ||
| 518 | |||
| 519 | buf_len = (size_t)BN_num_bytes(pub_key); | ||
| 520 | priv_key = EC_KEY_get0_private_key(x); | ||
| 521 | if (priv_key != NULL) | ||
| 522 | { | ||
| 523 | if ((i = (size_t)BN_num_bytes(priv_key)) > buf_len) | ||
| 524 | buf_len = i; | ||
| 525 | } | ||
| 526 | |||
| 527 | buf_len += 10; | ||
| 528 | if ((buffer = OPENSSL_malloc(buf_len)) == NULL) | ||
| 529 | { | ||
| 530 | reason = ERR_R_MALLOC_FAILURE; | ||
| 531 | goto err; | ||
| 532 | } | ||
| 533 | |||
| 534 | if (priv_key != NULL) | ||
| 535 | { | ||
| 536 | if (!BIO_indent(bp, off, 128)) | ||
| 537 | goto err; | ||
| 538 | if ((order = BN_new()) == NULL) | ||
| 539 | goto err; | ||
| 540 | if (!EC_GROUP_get_order(group, order, NULL)) | ||
| 541 | goto err; | ||
| 542 | if (BIO_printf(bp, "Private-Key: (%d bit)\n", | ||
| 543 | BN_num_bits(order)) <= 0) goto err; | ||
| 544 | } | ||
| 545 | |||
| 546 | if ((priv_key != NULL) && !print(bp, "priv:", priv_key, | ||
| 547 | buffer, off)) | ||
| 548 | goto err; | ||
| 549 | if ((pub_key != NULL) && !print(bp, "pub: ", pub_key, | ||
| 550 | buffer, off)) | ||
| 551 | goto err; | ||
| 552 | if (!ECPKParameters_print(bp, group, off)) | ||
| 553 | goto err; | ||
| 554 | ret=1; | ||
| 555 | err: | ||
| 556 | if (!ret) | ||
| 557 | ECerr(EC_F_EC_KEY_PRINT, reason); | ||
| 558 | if (pub_key) | ||
| 559 | BN_free(pub_key); | ||
| 560 | if (order) | ||
| 561 | BN_free(order); | ||
| 562 | if (ctx) | ||
| 563 | BN_CTX_free(ctx); | ||
| 564 | if (buffer != NULL) | ||
| 565 | OPENSSL_free(buffer); | ||
| 566 | return(ret); | ||
| 567 | } | ||
| 568 | #endif /* OPENSSL_NO_EC */ | ||
| 569 | |||
| 570 | static int print(BIO *bp, const char *number, const BIGNUM *num, unsigned char *buf, | ||
| 571 | int off) | ||
| 572 | { | 67 | { |
| 573 | int n,i; | 68 | int n,i; |
| 574 | const char *neg; | 69 | const char *neg; |
| @@ -617,223 +112,3 @@ static int print(BIO *bp, const char *number, const BIGNUM *num, unsigned char * | |||
| 617 | } | 112 | } |
| 618 | return(1); | 113 | return(1); |
| 619 | } | 114 | } |
| 620 | |||
| 621 | #ifndef OPENSSL_NO_EC | ||
| 622 | static int print_bin(BIO *fp, const char *name, const unsigned char *buf, | ||
| 623 | size_t len, int off) | ||
| 624 | { | ||
| 625 | size_t i; | ||
| 626 | char str[128]; | ||
| 627 | |||
| 628 | if (buf == NULL) | ||
| 629 | return 1; | ||
| 630 | if (off) | ||
| 631 | { | ||
| 632 | if (off > 128) | ||
| 633 | off=128; | ||
| 634 | memset(str,' ',off); | ||
| 635 | if (BIO_write(fp, str, off) <= 0) | ||
| 636 | return 0; | ||
| 637 | } | ||
| 638 | |||
| 639 | if (BIO_printf(fp,"%s", name) <= 0) | ||
| 640 | return 0; | ||
| 641 | |||
| 642 | for (i=0; i<len; i++) | ||
| 643 | { | ||
| 644 | if ((i%15) == 0) | ||
| 645 | { | ||
| 646 | str[0]='\n'; | ||
| 647 | memset(&(str[1]),' ',off+4); | ||
| 648 | if (BIO_write(fp, str, off+1+4) <= 0) | ||
| 649 | return 0; | ||
| 650 | } | ||
| 651 | if (BIO_printf(fp,"%02x%s",buf[i],((i+1) == len)?"":":") <= 0) | ||
| 652 | return 0; | ||
| 653 | } | ||
| 654 | if (BIO_write(fp,"\n",1) <= 0) | ||
| 655 | return 0; | ||
| 656 | |||
| 657 | return 1; | ||
| 658 | } | ||
| 659 | #endif | ||
| 660 | |||
| 661 | #ifndef OPENSSL_NO_DH | ||
| 662 | #ifndef OPENSSL_NO_FP_API | ||
| 663 | int DHparams_print_fp(FILE *fp, const DH *x) | ||
| 664 | { | ||
| 665 | BIO *b; | ||
| 666 | int ret; | ||
| 667 | |||
| 668 | if ((b=BIO_new(BIO_s_file())) == NULL) | ||
| 669 | { | ||
| 670 | DHerr(DH_F_DHPARAMS_PRINT_FP,ERR_R_BUF_LIB); | ||
| 671 | return(0); | ||
| 672 | } | ||
| 673 | BIO_set_fp(b,fp,BIO_NOCLOSE); | ||
| 674 | ret=DHparams_print(b, x); | ||
| 675 | BIO_free(b); | ||
| 676 | return(ret); | ||
| 677 | } | ||
| 678 | #endif | ||
| 679 | |||
| 680 | int DHparams_print(BIO *bp, const DH *x) | ||
| 681 | { | ||
| 682 | unsigned char *m=NULL; | ||
| 683 | int reason=ERR_R_BUF_LIB,ret=0; | ||
| 684 | size_t buf_len=0, i; | ||
| 685 | |||
| 686 | if (x->p) | ||
| 687 | buf_len = (size_t)BN_num_bytes(x->p); | ||
| 688 | else | ||
| 689 | { | ||
| 690 | reason = ERR_R_PASSED_NULL_PARAMETER; | ||
| 691 | goto err; | ||
| 692 | } | ||
| 693 | if (x->g) | ||
| 694 | if (buf_len < (i = (size_t)BN_num_bytes(x->g))) | ||
| 695 | buf_len = i; | ||
| 696 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | ||
| 697 | if (m == NULL) | ||
| 698 | { | ||
| 699 | reason=ERR_R_MALLOC_FAILURE; | ||
| 700 | goto err; | ||
| 701 | } | ||
| 702 | |||
| 703 | if (BIO_printf(bp,"Diffie-Hellman-Parameters: (%d bit)\n", | ||
| 704 | BN_num_bits(x->p)) <= 0) | ||
| 705 | goto err; | ||
| 706 | if (!print(bp,"prime:",x->p,m,4)) goto err; | ||
| 707 | if (!print(bp,"generator:",x->g,m,4)) goto err; | ||
| 708 | if (x->length != 0) | ||
| 709 | { | ||
| 710 | if (BIO_printf(bp," recommended-private-length: %d bits\n", | ||
| 711 | (int)x->length) <= 0) goto err; | ||
| 712 | } | ||
| 713 | ret=1; | ||
| 714 | if (0) | ||
| 715 | { | ||
| 716 | err: | ||
| 717 | DHerr(DH_F_DHPARAMS_PRINT,reason); | ||
| 718 | } | ||
| 719 | if (m != NULL) OPENSSL_free(m); | ||
| 720 | return(ret); | ||
| 721 | } | ||
| 722 | #endif | ||
| 723 | |||
| 724 | #ifndef OPENSSL_NO_DSA | ||
| 725 | #ifndef OPENSSL_NO_FP_API | ||
| 726 | int DSAparams_print_fp(FILE *fp, const DSA *x) | ||
| 727 | { | ||
| 728 | BIO *b; | ||
| 729 | int ret; | ||
| 730 | |||
| 731 | if ((b=BIO_new(BIO_s_file())) == NULL) | ||
| 732 | { | ||
| 733 | DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB); | ||
| 734 | return(0); | ||
| 735 | } | ||
| 736 | BIO_set_fp(b,fp,BIO_NOCLOSE); | ||
| 737 | ret=DSAparams_print(b, x); | ||
| 738 | BIO_free(b); | ||
| 739 | return(ret); | ||
| 740 | } | ||
| 741 | #endif | ||
| 742 | |||
| 743 | int DSAparams_print(BIO *bp, const DSA *x) | ||
| 744 | { | ||
| 745 | unsigned char *m=NULL; | ||
| 746 | int ret=0; | ||
| 747 | size_t buf_len=0,i; | ||
| 748 | |||
| 749 | if (x->p) | ||
| 750 | buf_len = (size_t)BN_num_bytes(x->p); | ||
| 751 | else | ||
| 752 | { | ||
| 753 | DSAerr(DSA_F_DSAPARAMS_PRINT,DSA_R_MISSING_PARAMETERS); | ||
| 754 | goto err; | ||
| 755 | } | ||
| 756 | if (x->q) | ||
| 757 | if (buf_len < (i = (size_t)BN_num_bytes(x->q))) | ||
| 758 | buf_len = i; | ||
| 759 | if (x->g) | ||
| 760 | if (buf_len < (i = (size_t)BN_num_bytes(x->g))) | ||
| 761 | buf_len = i; | ||
| 762 | m=(unsigned char *)OPENSSL_malloc(buf_len+10); | ||
| 763 | if (m == NULL) | ||
| 764 | { | ||
| 765 | DSAerr(DSA_F_DSAPARAMS_PRINT,ERR_R_MALLOC_FAILURE); | ||
| 766 | goto err; | ||
| 767 | } | ||
| 768 | |||
| 769 | if (BIO_printf(bp,"DSA-Parameters: (%d bit)\n", | ||
| 770 | BN_num_bits(x->p)) <= 0) | ||
| 771 | goto err; | ||
| 772 | if (!print(bp,"p:",x->p,m,4)) goto err; | ||
| 773 | if ((x->q != NULL) && !print(bp,"q:",x->q,m,4)) goto err; | ||
| 774 | if ((x->g != NULL) && !print(bp,"g:",x->g,m,4)) goto err; | ||
| 775 | ret=1; | ||
| 776 | err: | ||
| 777 | if (m != NULL) OPENSSL_free(m); | ||
| 778 | return(ret); | ||
| 779 | } | ||
| 780 | |||
| 781 | #endif /* !OPENSSL_NO_DSA */ | ||
| 782 | |||
| 783 | #ifndef OPENSSL_NO_EC | ||
| 784 | #ifndef OPENSSL_NO_FP_API | ||
| 785 | int ECParameters_print_fp(FILE *fp, const EC_KEY *x) | ||
| 786 | { | ||
| 787 | BIO *b; | ||
| 788 | int ret; | ||
| 789 | |||
| 790 | if ((b=BIO_new(BIO_s_file())) == NULL) | ||
| 791 | { | ||
| 792 | ECerr(EC_F_ECPARAMETERS_PRINT_FP, ERR_R_BIO_LIB); | ||
| 793 | return(0); | ||
| 794 | } | ||
| 795 | BIO_set_fp(b, fp, BIO_NOCLOSE); | ||
| 796 | ret = ECParameters_print(b, x); | ||
| 797 | BIO_free(b); | ||
| 798 | return(ret); | ||
| 799 | } | ||
| 800 | #endif | ||
| 801 | |||
| 802 | int ECParameters_print(BIO *bp, const EC_KEY *x) | ||
| 803 | { | ||
| 804 | int reason=ERR_R_EC_LIB, ret=0; | ||
| 805 | BIGNUM *order=NULL; | ||
| 806 | const EC_GROUP *group; | ||
| 807 | |||
| 808 | if (x == NULL || (group = EC_KEY_get0_group(x)) == NULL) | ||
| 809 | { | ||
| 810 | reason = ERR_R_PASSED_NULL_PARAMETER;; | ||
| 811 | goto err; | ||
| 812 | } | ||
| 813 | |||
| 814 | if ((order = BN_new()) == NULL) | ||
| 815 | { | ||
| 816 | reason = ERR_R_MALLOC_FAILURE; | ||
| 817 | goto err; | ||
| 818 | } | ||
| 819 | |||
| 820 | if (!EC_GROUP_get_order(group, order, NULL)) | ||
| 821 | { | ||
| 822 | reason = ERR_R_EC_LIB; | ||
| 823 | goto err; | ||
| 824 | } | ||
| 825 | |||
| 826 | if (BIO_printf(bp, "ECDSA-Parameters: (%d bit)\n", | ||
| 827 | BN_num_bits(order)) <= 0) | ||
| 828 | goto err; | ||
| 829 | if (!ECPKParameters_print(bp, group, 4)) | ||
| 830 | goto err; | ||
| 831 | ret=1; | ||
| 832 | err: | ||
| 833 | if (order) | ||
| 834 | BN_free(order); | ||
| 835 | ECerr(EC_F_ECPARAMETERS_PRINT, reason); | ||
| 836 | return(ret); | ||
| 837 | } | ||
| 838 | |||
| 839 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c index 5557e06584..ea1794e3e0 100644 --- a/src/lib/libcrypto/asn1/t_req.c +++ b/src/lib/libcrypto/asn1/t_req.c | |||
| @@ -149,34 +149,10 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
| 149 | ERR_print_errors(bp); | 149 | ERR_print_errors(bp); |
| 150 | } | 150 | } |
| 151 | else | 151 | else |
| 152 | #ifndef OPENSSL_NO_RSA | ||
| 153 | if (pkey->type == EVP_PKEY_RSA) | ||
| 154 | { | ||
| 155 | BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","", | ||
| 156 | BN_num_bits(pkey->pkey.rsa->n)); | ||
| 157 | RSA_print(bp,pkey->pkey.rsa,16); | ||
| 158 | } | ||
| 159 | else | ||
| 160 | #endif | ||
| 161 | #ifndef OPENSSL_NO_DSA | ||
| 162 | if (pkey->type == EVP_PKEY_DSA) | ||
| 163 | { | 152 | { |
| 164 | BIO_printf(bp,"%12sDSA Public Key:\n",""); | 153 | EVP_PKEY_print_public(bp, pkey, 16, NULL); |
| 165 | DSA_print(bp,pkey->pkey.dsa,16); | 154 | EVP_PKEY_free(pkey); |
| 166 | } | 155 | } |
| 167 | else | ||
| 168 | #endif | ||
| 169 | #ifndef OPENSSL_NO_EC | ||
| 170 | if (pkey->type == EVP_PKEY_EC) | ||
| 171 | { | ||
| 172 | BIO_printf(bp, "%12sEC Public Key: \n",""); | ||
| 173 | EC_KEY_print(bp, pkey->pkey.ec, 16); | ||
| 174 | } | ||
| 175 | else | ||
| 176 | #endif | ||
| 177 | BIO_printf(bp,"%12sUnknown Public Key:\n",""); | ||
| 178 | |||
| 179 | EVP_PKEY_free(pkey); | ||
| 180 | } | 156 | } |
| 181 | 157 | ||
| 182 | if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) | 158 | if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) |
diff --git a/src/lib/libcrypto/asn1/t_spki.c b/src/lib/libcrypto/asn1/t_spki.c index a73369b949..079c081a81 100644 --- a/src/lib/libcrypto/asn1/t_spki.c +++ b/src/lib/libcrypto/asn1/t_spki.c | |||
| @@ -82,36 +82,11 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki) | |||
| 82 | (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)); | 82 | (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)); |
| 83 | pkey = X509_PUBKEY_get(spki->spkac->pubkey); | 83 | pkey = X509_PUBKEY_get(spki->spkac->pubkey); |
| 84 | if(!pkey) BIO_printf(out, " Unable to load public key\n"); | 84 | if(!pkey) BIO_printf(out, " Unable to load public key\n"); |
| 85 | else { | 85 | else |
| 86 | #ifndef OPENSSL_NO_RSA | ||
| 87 | if (pkey->type == EVP_PKEY_RSA) | ||
| 88 | { | ||
| 89 | BIO_printf(out," RSA Public Key: (%d bit)\n", | ||
| 90 | BN_num_bits(pkey->pkey.rsa->n)); | ||
| 91 | RSA_print(out,pkey->pkey.rsa,2); | ||
| 92 | } | ||
| 93 | else | ||
| 94 | #endif | ||
| 95 | #ifndef OPENSSL_NO_DSA | ||
| 96 | if (pkey->type == EVP_PKEY_DSA) | ||
| 97 | { | ||
| 98 | BIO_printf(out," DSA Public Key:\n"); | ||
| 99 | DSA_print(out,pkey->pkey.dsa,2); | ||
| 100 | } | ||
| 101 | else | ||
| 102 | #endif | ||
| 103 | #ifndef OPENSSL_NO_EC | ||
| 104 | if (pkey->type == EVP_PKEY_EC) | ||
| 105 | { | 86 | { |
| 106 | BIO_printf(out, " EC Public Key:\n"); | 87 | EVP_PKEY_print_public(out, pkey, 4, NULL); |
| 107 | EC_KEY_print(out, pkey->pkey.ec,2); | ||
| 108 | } | ||
| 109 | else | ||
| 110 | #endif | ||
| 111 | |||
| 112 | BIO_printf(out," Unknown Public Key:\n"); | ||
| 113 | EVP_PKEY_free(pkey); | 88 | EVP_PKEY_free(pkey); |
| 114 | } | 89 | } |
| 115 | chal = spki->spkac->challenge; | 90 | chal = spki->spkac->challenge; |
| 116 | if(chal->length) | 91 | if(chal->length) |
| 117 | BIO_printf(out, " Challenge String: %s\n", chal->data); | 92 | BIO_printf(out, " Challenge String: %s\n", chal->data); |
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c index 8f746f9c05..e061f2ffad 100644 --- a/src/lib/libcrypto/asn1/t_x509.c +++ b/src/lib/libcrypto/asn1/t_x509.c | |||
| @@ -111,7 +111,6 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
| 111 | ASN1_INTEGER *bs; | 111 | ASN1_INTEGER *bs; |
| 112 | EVP_PKEY *pkey=NULL; | 112 | EVP_PKEY *pkey=NULL; |
| 113 | const char *neg; | 113 | const char *neg; |
| 114 | ASN1_STRING *str=NULL; | ||
| 115 | 114 | ||
| 116 | if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) { | 115 | if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) { |
| 117 | mlch = '\n'; | 116 | mlch = '\n'; |
| @@ -215,34 +214,10 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
| 215 | ERR_print_errors(bp); | 214 | ERR_print_errors(bp); |
| 216 | } | 215 | } |
| 217 | else | 216 | else |
| 218 | #ifndef OPENSSL_NO_RSA | ||
| 219 | if (pkey->type == EVP_PKEY_RSA) | ||
| 220 | { | ||
| 221 | BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","", | ||
| 222 | BN_num_bits(pkey->pkey.rsa->n)); | ||
| 223 | RSA_print(bp,pkey->pkey.rsa,16); | ||
| 224 | } | ||
| 225 | else | ||
| 226 | #endif | ||
| 227 | #ifndef OPENSSL_NO_DSA | ||
| 228 | if (pkey->type == EVP_PKEY_DSA) | ||
| 229 | { | ||
| 230 | BIO_printf(bp,"%12sDSA Public Key:\n",""); | ||
| 231 | DSA_print(bp,pkey->pkey.dsa,16); | ||
| 232 | } | ||
| 233 | else | ||
| 234 | #endif | ||
| 235 | #ifndef OPENSSL_NO_EC | ||
| 236 | if (pkey->type == EVP_PKEY_EC) | ||
| 237 | { | 217 | { |
| 238 | BIO_printf(bp, "%12sEC Public Key:\n",""); | 218 | EVP_PKEY_print_public(bp, pkey, 16, NULL); |
| 239 | EC_KEY_print(bp, pkey->pkey.ec, 16); | 219 | EVP_PKEY_free(pkey); |
| 240 | } | 220 | } |
| 241 | else | ||
| 242 | #endif | ||
| 243 | BIO_printf(bp,"%12sUnknown Public Key:\n",""); | ||
| 244 | |||
| 245 | EVP_PKEY_free(pkey); | ||
| 246 | } | 221 | } |
| 247 | 222 | ||
| 248 | if (!(cflag & X509_FLAG_NO_EXTENSIONS)) | 223 | if (!(cflag & X509_FLAG_NO_EXTENSIONS)) |
| @@ -259,7 +234,6 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) | |||
| 259 | } | 234 | } |
| 260 | ret=1; | 235 | ret=1; |
| 261 | err: | 236 | err: |
| 262 | if (str != NULL) ASN1_STRING_free(str); | ||
| 263 | if (m != NULL) OPENSSL_free(m); | 237 | if (m != NULL) OPENSSL_free(m); |
| 264 | return(ret); | 238 | return(ret); |
| 265 | } | 239 | } |
| @@ -329,14 +303,15 @@ int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig) | |||
| 329 | return 1; | 303 | return 1; |
| 330 | } | 304 | } |
| 331 | 305 | ||
| 332 | int ASN1_STRING_print(BIO *bp, ASN1_STRING *v) | 306 | int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v) |
| 333 | { | 307 | { |
| 334 | int i,n; | 308 | int i,n; |
| 335 | char buf[80],*p; | 309 | char buf[80]; |
| 310 | const char *p; | ||
| 336 | 311 | ||
| 337 | if (v == NULL) return(0); | 312 | if (v == NULL) return(0); |
| 338 | n=0; | 313 | n=0; |
| 339 | p=(char *)v->data; | 314 | p=(const char *)v->data; |
| 340 | for (i=0; i<v->length; i++) | 315 | for (i=0; i<v->length; i++) |
| 341 | { | 316 | { |
| 342 | if ((p[i] > '~') || ((p[i] < ' ') && | 317 | if ((p[i] > '~') || ((p[i] < ' ') && |
| @@ -358,7 +333,7 @@ int ASN1_STRING_print(BIO *bp, ASN1_STRING *v) | |||
| 358 | return(1); | 333 | return(1); |
| 359 | } | 334 | } |
| 360 | 335 | ||
| 361 | int ASN1_TIME_print(BIO *bp, ASN1_TIME *tm) | 336 | int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) |
| 362 | { | 337 | { |
| 363 | if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm); | 338 | if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm); |
| 364 | if(tm->type == V_ASN1_GENERALIZEDTIME) | 339 | if(tm->type == V_ASN1_GENERALIZEDTIME) |
| @@ -373,12 +348,14 @@ static const char *mon[12]= | |||
| 373 | "Jul","Aug","Sep","Oct","Nov","Dec" | 348 | "Jul","Aug","Sep","Oct","Nov","Dec" |
| 374 | }; | 349 | }; |
| 375 | 350 | ||
| 376 | int ASN1_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm) | 351 | int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) |
| 377 | { | 352 | { |
| 378 | char *v; | 353 | char *v; |
| 379 | int gmt=0; | 354 | int gmt=0; |
| 380 | int i; | 355 | int i; |
| 381 | int y=0,M=0,d=0,h=0,m=0,s=0; | 356 | int y=0,M=0,d=0,h=0,m=0,s=0; |
| 357 | char *f = NULL; | ||
| 358 | int f_len = 0; | ||
| 382 | 359 | ||
| 383 | i=tm->length; | 360 | i=tm->length; |
| 384 | v=(char *)tm->data; | 361 | v=(char *)tm->data; |
| @@ -396,10 +373,21 @@ int ASN1_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm) | |||
| 396 | if (tm->length >= 14 && | 373 | if (tm->length >= 14 && |
| 397 | (v[12] >= '0') && (v[12] <= '9') && | 374 | (v[12] >= '0') && (v[12] <= '9') && |
| 398 | (v[13] >= '0') && (v[13] <= '9')) | 375 | (v[13] >= '0') && (v[13] <= '9')) |
| 376 | { | ||
| 399 | s= (v[12]-'0')*10+(v[13]-'0'); | 377 | s= (v[12]-'0')*10+(v[13]-'0'); |
| 378 | /* Check for fractions of seconds. */ | ||
| 379 | if (tm->length >= 15 && v[14] == '.') | ||
| 380 | { | ||
| 381 | int l = tm->length; | ||
| 382 | f = &v[14]; /* The decimal point. */ | ||
| 383 | f_len = 1; | ||
| 384 | while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') | ||
| 385 | ++f_len; | ||
| 386 | } | ||
| 387 | } | ||
| 400 | 388 | ||
| 401 | if (BIO_printf(bp,"%s %2d %02d:%02d:%02d %d%s", | 389 | if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s", |
| 402 | mon[M-1],d,h,m,s,y,(gmt)?" GMT":"") <= 0) | 390 | mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0) |
| 403 | return(0); | 391 | return(0); |
| 404 | else | 392 | else |
| 405 | return(1); | 393 | return(1); |
| @@ -408,15 +396,15 @@ err: | |||
| 408 | return(0); | 396 | return(0); |
| 409 | } | 397 | } |
| 410 | 398 | ||
| 411 | int ASN1_UTCTIME_print(BIO *bp, ASN1_UTCTIME *tm) | 399 | int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm) |
| 412 | { | 400 | { |
| 413 | char *v; | 401 | const char *v; |
| 414 | int gmt=0; | 402 | int gmt=0; |
| 415 | int i; | 403 | int i; |
| 416 | int y=0,M=0,d=0,h=0,m=0,s=0; | 404 | int y=0,M=0,d=0,h=0,m=0,s=0; |
| 417 | 405 | ||
| 418 | i=tm->length; | 406 | i=tm->length; |
| 419 | v=(char *)tm->data; | 407 | v=(const char *)tm->data; |
| 420 | 408 | ||
| 421 | if (i < 10) goto err; | 409 | if (i < 10) goto err; |
| 422 | if (v[i-1] == 'Z') gmt=1; | 410 | if (v[i-1] == 'Z') gmt=1; |
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 48bc1c0d4d..3bee439968 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
| @@ -114,6 +114,8 @@ unsigned long ASN1_tag2bit(int tag) | |||
| 114 | /* Macro to initialize and invalidate the cache */ | 114 | /* Macro to initialize and invalidate the cache */ |
| 115 | 115 | ||
| 116 | #define asn1_tlc_clear(c) if (c) (c)->valid = 0 | 116 | #define asn1_tlc_clear(c) if (c) (c)->valid = 0 |
| 117 | /* Version to avoid compiler warning about 'c' always non-NULL */ | ||
| 118 | #define asn1_tlc_clear_nc(c) (c)->valid = 0 | ||
| 117 | 119 | ||
| 118 | /* Decode an ASN1 item, this currently behaves just | 120 | /* Decode an ASN1 item, this currently behaves just |
| 119 | * like a standard 'd2i' function. 'in' points to | 121 | * like a standard 'd2i' function. 'in' points to |
| @@ -130,7 +132,7 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, | |||
| 130 | ASN1_VALUE *ptmpval = NULL; | 132 | ASN1_VALUE *ptmpval = NULL; |
| 131 | if (!pval) | 133 | if (!pval) |
| 132 | pval = &ptmpval; | 134 | pval = &ptmpval; |
| 133 | c.valid = 0; | 135 | asn1_tlc_clear_nc(&c); |
| 134 | if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) | 136 | if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) |
| 135 | return *pval; | 137 | return *pval; |
| 136 | return NULL; | 138 | return NULL; |
| @@ -140,7 +142,7 @@ int ASN1_template_d2i(ASN1_VALUE **pval, | |||
| 140 | const unsigned char **in, long len, const ASN1_TEMPLATE *tt) | 142 | const unsigned char **in, long len, const ASN1_TEMPLATE *tt) |
| 141 | { | 143 | { |
| 142 | ASN1_TLC c; | 144 | ASN1_TLC c; |
| 143 | c.valid = 0; | 145 | asn1_tlc_clear_nc(&c); |
| 144 | return asn1_template_ex_d2i(pval, in, len, tt, 0, &c); | 146 | return asn1_template_ex_d2i(pval, in, len, tt, 0, &c); |
| 145 | } | 147 | } |
| 146 | 148 | ||
| @@ -306,7 +308,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
| 306 | 308 | ||
| 307 | 309 | ||
| 308 | case ASN1_ITYPE_CHOICE: | 310 | case ASN1_ITYPE_CHOICE: |
| 309 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it)) | 311 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) |
| 310 | goto auxerr; | 312 | goto auxerr; |
| 311 | 313 | ||
| 312 | /* Allocate structure */ | 314 | /* Allocate structure */ |
| @@ -356,7 +358,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
| 356 | 358 | ||
| 357 | asn1_set_choice_selector(pval, i, it); | 359 | asn1_set_choice_selector(pval, i, it); |
| 358 | *in = p; | 360 | *in = p; |
| 359 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it)) | 361 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) |
| 360 | goto auxerr; | 362 | goto auxerr; |
| 361 | return 1; | 363 | return 1; |
| 362 | 364 | ||
| @@ -403,7 +405,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
| 403 | goto err; | 405 | goto err; |
| 404 | } | 406 | } |
| 405 | 407 | ||
| 406 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it)) | 408 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) |
| 407 | goto auxerr; | 409 | goto auxerr; |
| 408 | 410 | ||
| 409 | /* Get each field entry */ | 411 | /* Get each field entry */ |
| @@ -505,7 +507,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
| 505 | if (!asn1_enc_save(pval, *in, p - *in, it)) | 507 | if (!asn1_enc_save(pval, *in, p - *in, it)) |
| 506 | goto auxerr; | 508 | goto auxerr; |
| 507 | *in = p; | 509 | *in = p; |
| 508 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it)) | 510 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) |
| 509 | goto auxerr; | 511 | goto auxerr; |
| 510 | return 1; | 512 | return 1; |
| 511 | 513 | ||
| @@ -665,11 +667,12 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val, | |||
| 665 | else | 667 | else |
| 666 | { | 668 | { |
| 667 | /* We've got a valid STACK: free up any items present */ | 669 | /* We've got a valid STACK: free up any items present */ |
| 668 | STACK *sktmp = (STACK *)*val; | 670 | STACK_OF(ASN1_VALUE) *sktmp |
| 671 | = (STACK_OF(ASN1_VALUE) *)*val; | ||
| 669 | ASN1_VALUE *vtmp; | 672 | ASN1_VALUE *vtmp; |
| 670 | while(sk_num(sktmp) > 0) | 673 | while(sk_ASN1_VALUE_num(sktmp) > 0) |
| 671 | { | 674 | { |
| 672 | vtmp = (ASN1_VALUE *)sk_pop(sktmp); | 675 | vtmp = sk_ASN1_VALUE_pop(sktmp); |
| 673 | ASN1_item_ex_free(&vtmp, | 676 | ASN1_item_ex_free(&vtmp, |
| 674 | ASN1_ITEM_ptr(tt->item)); | 677 | ASN1_ITEM_ptr(tt->item)); |
| 675 | } | 678 | } |
| @@ -710,7 +713,8 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val, | |||
| 710 | goto err; | 713 | goto err; |
| 711 | } | 714 | } |
| 712 | len -= p - q; | 715 | len -= p - q; |
| 713 | if (!sk_push((STACK *)*val, (char *)skfield)) | 716 | if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val, |
| 717 | skfield)) | ||
| 714 | { | 718 | { |
| 715 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, | 719 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, |
| 716 | ERR_R_MALLOC_FAILURE); | 720 | ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c index 2721f904a6..936ad1f767 100644 --- a/src/lib/libcrypto/asn1/tasn_enc.c +++ b/src/lib/libcrypto/asn1/tasn_enc.c | |||
| @@ -158,7 +158,7 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, | |||
| 158 | return asn1_i2d_ex_primitive(pval, out, it, -1, aclass); | 158 | return asn1_i2d_ex_primitive(pval, out, it, -1, aclass); |
| 159 | 159 | ||
| 160 | case ASN1_ITYPE_CHOICE: | 160 | case ASN1_ITYPE_CHOICE: |
| 161 | if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it)) | 161 | if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL)) |
| 162 | return 0; | 162 | return 0; |
| 163 | i = asn1_get_choice_selector(pval, it); | 163 | i = asn1_get_choice_selector(pval, it); |
| 164 | if ((i >= 0) && (i < it->tcount)) | 164 | if ((i >= 0) && (i < it->tcount)) |
| @@ -171,7 +171,7 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, | |||
| 171 | -1, aclass); | 171 | -1, aclass); |
| 172 | } | 172 | } |
| 173 | /* Fixme: error condition if selector out of range */ | 173 | /* Fixme: error condition if selector out of range */ |
| 174 | if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it)) | 174 | if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL)) |
| 175 | return 0; | 175 | return 0; |
| 176 | break; | 176 | break; |
| 177 | 177 | ||
| @@ -216,7 +216,7 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, | |||
| 216 | aclass = (aclass & ~ASN1_TFLG_TAG_CLASS) | 216 | aclass = (aclass & ~ASN1_TFLG_TAG_CLASS) |
| 217 | | V_ASN1_UNIVERSAL; | 217 | | V_ASN1_UNIVERSAL; |
| 218 | } | 218 | } |
| 219 | if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it)) | 219 | if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL)) |
| 220 | return 0; | 220 | return 0; |
| 221 | /* First work out sequence content length */ | 221 | /* First work out sequence content length */ |
| 222 | for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) | 222 | for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) |
| @@ -250,7 +250,7 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, | |||
| 250 | } | 250 | } |
| 251 | if (ndef == 2) | 251 | if (ndef == 2) |
| 252 | ASN1_put_eoc(out); | 252 | ASN1_put_eoc(out); |
| 253 | if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it)) | 253 | if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL)) |
| 254 | return 0; | 254 | return 0; |
| 255 | return seqlen; | 255 | return seqlen; |
| 256 | 256 | ||
| @@ -569,7 +569,8 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype, | |||
| 569 | ASN1_STRING *strtmp; | 569 | ASN1_STRING *strtmp; |
| 570 | ASN1_OBJECT *otmp; | 570 | ASN1_OBJECT *otmp; |
| 571 | int utype; | 571 | int utype; |
| 572 | unsigned char *cont, c; | 572 | const unsigned char *cont; |
| 573 | unsigned char c; | ||
| 573 | int len; | 574 | int len; |
| 574 | const ASN1_PRIMITIVE_FUNCS *pf; | 575 | const ASN1_PRIMITIVE_FUNCS *pf; |
| 575 | pf = it->funcs; | 576 | pf = it->funcs; |
diff --git a/src/lib/libcrypto/asn1/tasn_fre.c b/src/lib/libcrypto/asn1/tasn_fre.c index d7c017fa1d..77d3092d31 100644 --- a/src/lib/libcrypto/asn1/tasn_fre.c +++ b/src/lib/libcrypto/asn1/tasn_fre.c | |||
| @@ -110,7 +110,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c | |||
| 110 | case ASN1_ITYPE_CHOICE: | 110 | case ASN1_ITYPE_CHOICE: |
| 111 | if (asn1_cb) | 111 | if (asn1_cb) |
| 112 | { | 112 | { |
| 113 | i = asn1_cb(ASN1_OP_FREE_PRE, pval, it); | 113 | i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL); |
| 114 | if (i == 2) | 114 | if (i == 2) |
| 115 | return; | 115 | return; |
| 116 | } | 116 | } |
| @@ -123,7 +123,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c | |||
| 123 | ASN1_template_free(pchval, tt); | 123 | ASN1_template_free(pchval, tt); |
| 124 | } | 124 | } |
| 125 | if (asn1_cb) | 125 | if (asn1_cb) |
| 126 | asn1_cb(ASN1_OP_FREE_POST, pval, it); | 126 | asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); |
| 127 | if (!combine) | 127 | if (!combine) |
| 128 | { | 128 | { |
| 129 | OPENSSL_free(*pval); | 129 | OPENSSL_free(*pval); |
| @@ -149,7 +149,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c | |||
| 149 | return; | 149 | return; |
| 150 | if (asn1_cb) | 150 | if (asn1_cb) |
| 151 | { | 151 | { |
| 152 | i = asn1_cb(ASN1_OP_FREE_PRE, pval, it); | 152 | i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL); |
| 153 | if (i == 2) | 153 | if (i == 2) |
| 154 | return; | 154 | return; |
| 155 | } | 155 | } |
| @@ -170,7 +170,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c | |||
| 170 | ASN1_template_free(pseqval, seqtt); | 170 | ASN1_template_free(pseqval, seqtt); |
| 171 | } | 171 | } |
| 172 | if (asn1_cb) | 172 | if (asn1_cb) |
| 173 | asn1_cb(ASN1_OP_FREE_POST, pval, it); | 173 | asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); |
| 174 | if (!combine) | 174 | if (!combine) |
| 175 | { | 175 | { |
| 176 | OPENSSL_free(*pval); | 176 | OPENSSL_free(*pval); |
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c index 5c6a2ebd4d..0d9e78cc7c 100644 --- a/src/lib/libcrypto/asn1/tasn_new.c +++ b/src/lib/libcrypto/asn1/tasn_new.c | |||
| @@ -68,7 +68,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
| 68 | int combine); | 68 | int combine); |
| 69 | static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); | 69 | static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 70 | static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); | 70 | static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); |
| 71 | void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); | 71 | static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); |
| 72 | 72 | ||
| 73 | ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it) | 73 | ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it) |
| 74 | { | 74 | { |
| @@ -146,7 +146,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
| 146 | case ASN1_ITYPE_CHOICE: | 146 | case ASN1_ITYPE_CHOICE: |
| 147 | if (asn1_cb) | 147 | if (asn1_cb) |
| 148 | { | 148 | { |
| 149 | i = asn1_cb(ASN1_OP_NEW_PRE, pval, it); | 149 | i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL); |
| 150 | if (!i) | 150 | if (!i) |
| 151 | goto auxerr; | 151 | goto auxerr; |
| 152 | if (i==2) | 152 | if (i==2) |
| @@ -166,7 +166,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
| 166 | memset(*pval, 0, it->size); | 166 | memset(*pval, 0, it->size); |
| 167 | } | 167 | } |
| 168 | asn1_set_choice_selector(pval, -1, it); | 168 | asn1_set_choice_selector(pval, -1, it); |
| 169 | if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it)) | 169 | if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL)) |
| 170 | goto auxerr; | 170 | goto auxerr; |
| 171 | break; | 171 | break; |
| 172 | 172 | ||
| @@ -174,7 +174,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
| 174 | case ASN1_ITYPE_SEQUENCE: | 174 | case ASN1_ITYPE_SEQUENCE: |
| 175 | if (asn1_cb) | 175 | if (asn1_cb) |
| 176 | { | 176 | { |
| 177 | i = asn1_cb(ASN1_OP_NEW_PRE, pval, it); | 177 | i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL); |
| 178 | if (!i) | 178 | if (!i) |
| 179 | goto auxerr; | 179 | goto auxerr; |
| 180 | if (i==2) | 180 | if (i==2) |
| @@ -201,7 +201,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
| 201 | if (!ASN1_template_new(pseqval, tt)) | 201 | if (!ASN1_template_new(pseqval, tt)) |
| 202 | goto memerr; | 202 | goto memerr; |
| 203 | } | 203 | } |
| 204 | if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it)) | 204 | if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL)) |
| 205 | goto auxerr; | 205 | goto auxerr; |
| 206 | break; | 206 | break; |
| 207 | } | 207 | } |
| @@ -325,6 +325,7 @@ static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) | |||
| 325 | int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) | 325 | int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) |
| 326 | { | 326 | { |
| 327 | ASN1_TYPE *typ; | 327 | ASN1_TYPE *typ; |
| 328 | ASN1_STRING *str; | ||
| 328 | int utype; | 329 | int utype; |
| 329 | 330 | ||
| 330 | if (it && it->funcs) | 331 | if (it && it->funcs) |
| @@ -345,10 +346,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
| 345 | return 1; | 346 | return 1; |
| 346 | 347 | ||
| 347 | case V_ASN1_BOOLEAN: | 348 | case V_ASN1_BOOLEAN: |
| 348 | if (it) | 349 | *(ASN1_BOOLEAN *)pval = it->size; |
| 349 | *(ASN1_BOOLEAN *)pval = it->size; | ||
| 350 | else | ||
| 351 | *(ASN1_BOOLEAN *)pval = -1; | ||
| 352 | return 1; | 350 | return 1; |
| 353 | 351 | ||
| 354 | case V_ASN1_NULL: | 352 | case V_ASN1_NULL: |
| @@ -365,7 +363,10 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
| 365 | break; | 363 | break; |
| 366 | 364 | ||
| 367 | default: | 365 | default: |
| 368 | *pval = (ASN1_VALUE *)ASN1_STRING_type_new(utype); | 366 | str = ASN1_STRING_type_new(utype); |
| 367 | if (it->itype == ASN1_ITYPE_MSTRING && str) | ||
| 368 | str->flags |= ASN1_STRING_FLAG_MSTRING; | ||
| 369 | *pval = (ASN1_VALUE *)str; | ||
| 369 | break; | 370 | break; |
| 370 | } | 371 | } |
| 371 | if (*pval) | 372 | if (*pval) |
| @@ -373,7 +374,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
| 373 | return 0; | 374 | return 0; |
| 374 | } | 375 | } |
| 375 | 376 | ||
| 376 | void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) | 377 | static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) |
| 377 | { | 378 | { |
| 378 | int utype; | 379 | int utype; |
| 379 | if (it && it->funcs) | 380 | if (it && it->funcs) |
diff --git a/src/lib/libcrypto/asn1/tasn_prn.c b/src/lib/libcrypto/asn1/tasn_prn.c index b9c96a6dbe..453698012d 100644 --- a/src/lib/libcrypto/asn1/tasn_prn.c +++ b/src/lib/libcrypto/asn1/tasn_prn.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2000,2005 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -58,141 +58,570 @@ | |||
| 58 | 58 | ||
| 59 | 59 | ||
| 60 | #include <stddef.h> | 60 | #include <stddef.h> |
| 61 | #include "cryptlib.h" | ||
| 61 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1t.h> | ||
| 62 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
| 63 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
| 64 | #include <openssl/err.h> | 66 | #include <openssl/err.h> |
| 65 | #include <openssl/nasn.h> | 67 | #include <openssl/x509v3.h> |
| 68 | #include "asn1_locl.h" | ||
| 66 | 69 | ||
| 67 | /* Print routines. Print out a whole structure from a template. | 70 | /* Print routines. |
| 68 | */ | 71 | */ |
| 69 | 72 | ||
| 70 | static int asn1_item_print_nm(BIO *out, void *fld, int indent, const ASN1_ITEM *it, const char *name); | 73 | /* ASN1_PCTX routines */ |
| 71 | 74 | ||
| 72 | int ASN1_item_print(BIO *out, void *fld, int indent, const ASN1_ITEM *it) | 75 | ASN1_PCTX default_pctx = |
| 73 | { | 76 | { |
| 74 | return asn1_item_print_nm(out, fld, indent, it, it->sname); | 77 | ASN1_PCTX_FLAGS_SHOW_ABSENT, /* flags */ |
| 75 | } | 78 | 0, /* nm_flags */ |
| 79 | 0, /* cert_flags */ | ||
| 80 | 0, /* oid_flags */ | ||
| 81 | 0 /* str_flags */ | ||
| 82 | }; | ||
| 83 | |||
| 76 | 84 | ||
| 77 | static int asn1_item_print_nm(BIO *out, void *fld, int indent, const ASN1_ITEM *it, const char *name) | 85 | ASN1_PCTX *ASN1_PCTX_new(void) |
| 78 | { | 86 | { |
| 79 | ASN1_STRING *str; | 87 | ASN1_PCTX *ret; |
| 88 | ret = OPENSSL_malloc(sizeof(ASN1_PCTX)); | ||
| 89 | if (ret == NULL) | ||
| 90 | { | ||
| 91 | ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE); | ||
| 92 | return NULL; | ||
| 93 | } | ||
| 94 | ret->flags = 0; | ||
| 95 | ret->nm_flags = 0; | ||
| 96 | ret->cert_flags = 0; | ||
| 97 | ret->oid_flags = 0; | ||
| 98 | ret->str_flags = 0; | ||
| 99 | return ret; | ||
| 100 | } | ||
| 101 | |||
| 102 | void ASN1_PCTX_free(ASN1_PCTX *p) | ||
| 103 | { | ||
| 104 | OPENSSL_free(p); | ||
| 105 | } | ||
| 106 | |||
| 107 | unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p) | ||
| 108 | { | ||
| 109 | return p->flags; | ||
| 110 | } | ||
| 111 | |||
| 112 | void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags) | ||
| 113 | { | ||
| 114 | p->flags = flags; | ||
| 115 | } | ||
| 116 | |||
| 117 | unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p) | ||
| 118 | { | ||
| 119 | return p->nm_flags; | ||
| 120 | } | ||
| 121 | |||
| 122 | void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags) | ||
| 123 | { | ||
| 124 | p->nm_flags = flags; | ||
| 125 | } | ||
| 126 | |||
| 127 | unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p) | ||
| 128 | { | ||
| 129 | return p->cert_flags; | ||
| 130 | } | ||
| 131 | |||
| 132 | void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags) | ||
| 133 | { | ||
| 134 | p->cert_flags = flags; | ||
| 135 | } | ||
| 136 | |||
| 137 | unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p) | ||
| 138 | { | ||
| 139 | return p->oid_flags; | ||
| 140 | } | ||
| 141 | |||
| 142 | void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags) | ||
| 143 | { | ||
| 144 | p->oid_flags = flags; | ||
| 145 | } | ||
| 146 | |||
| 147 | unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p) | ||
| 148 | { | ||
| 149 | return p->str_flags; | ||
| 150 | } | ||
| 151 | |||
| 152 | void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags) | ||
| 153 | { | ||
| 154 | p->str_flags = flags; | ||
| 155 | } | ||
| 156 | |||
| 157 | /* Main print routines */ | ||
| 158 | |||
| 159 | static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent, | ||
| 160 | const ASN1_ITEM *it, | ||
| 161 | const char *fname, const char *sname, | ||
| 162 | int nohdr, const ASN1_PCTX *pctx); | ||
| 163 | |||
| 164 | int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent, | ||
| 165 | const ASN1_TEMPLATE *tt, const ASN1_PCTX *pctx); | ||
| 166 | |||
| 167 | static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld, | ||
| 168 | const ASN1_ITEM *it, int indent, | ||
| 169 | const char *fname, const char *sname, | ||
| 170 | const ASN1_PCTX *pctx); | ||
| 171 | |||
| 172 | static int asn1_print_fsname(BIO *out, int indent, | ||
| 173 | const char *fname, const char *sname, | ||
| 174 | const ASN1_PCTX *pctx); | ||
| 175 | |||
| 176 | int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, | ||
| 177 | const ASN1_ITEM *it, const ASN1_PCTX *pctx) | ||
| 178 | { | ||
| 179 | const char *sname; | ||
| 180 | if (pctx == NULL) | ||
| 181 | pctx = &default_pctx; | ||
| 182 | if (pctx->flags & ASN1_PCTX_FLAGS_NO_STRUCT_NAME) | ||
| 183 | sname = NULL; | ||
| 184 | else | ||
| 185 | sname = it->sname; | ||
| 186 | return asn1_item_print_ctx(out, &ifld, indent, it, | ||
| 187 | NULL, sname, 0, pctx); | ||
| 188 | } | ||
| 189 | |||
| 190 | static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent, | ||
| 191 | const ASN1_ITEM *it, | ||
| 192 | const char *fname, const char *sname, | ||
| 193 | int nohdr, const ASN1_PCTX *pctx) | ||
| 194 | { | ||
| 80 | const ASN1_TEMPLATE *tt; | 195 | const ASN1_TEMPLATE *tt; |
| 81 | void *tmpfld; | 196 | const ASN1_EXTERN_FUNCS *ef; |
| 197 | ASN1_VALUE **tmpfld; | ||
| 198 | const ASN1_AUX *aux = it->funcs; | ||
| 199 | ASN1_aux_cb *asn1_cb; | ||
| 200 | ASN1_PRINT_ARG parg; | ||
| 82 | int i; | 201 | int i; |
| 83 | if(!fld) { | 202 | if (aux && aux->asn1_cb) |
| 84 | BIO_printf(out, "%*s%s ABSENT\n", indent, "", name); | 203 | { |
| 204 | parg.out = out; | ||
| 205 | parg.indent = indent; | ||
| 206 | parg.pctx = pctx; | ||
| 207 | asn1_cb = aux->asn1_cb; | ||
| 208 | } | ||
| 209 | else asn1_cb = 0; | ||
| 210 | |||
| 211 | if(*fld == NULL) | ||
| 212 | { | ||
| 213 | if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_ABSENT) | ||
| 214 | { | ||
| 215 | if (!nohdr && !asn1_print_fsname(out, indent, | ||
| 216 | fname, sname, pctx)) | ||
| 217 | return 0; | ||
| 218 | if (BIO_puts(out, "<ABSENT>\n") <= 0) | ||
| 219 | return 0; | ||
| 220 | } | ||
| 85 | return 1; | 221 | return 1; |
| 86 | } | 222 | } |
| 87 | switch(it->itype) { | ||
| 88 | 223 | ||
| 224 | switch(it->itype) | ||
| 225 | { | ||
| 89 | case ASN1_ITYPE_PRIMITIVE: | 226 | case ASN1_ITYPE_PRIMITIVE: |
| 90 | if(it->templates) | 227 | if(it->templates) |
| 91 | return ASN1_template_print(out, fld, indent, it->templates); | 228 | { |
| 92 | return asn1_primitive_print(out, fld, it->utype, indent, name); | 229 | if (!asn1_template_print_ctx(out, fld, indent, |
| 93 | break; | 230 | it->templates, pctx)) |
| 94 | 231 | return 0; | |
| 232 | } | ||
| 233 | /* fall thru */ | ||
| 95 | case ASN1_ITYPE_MSTRING: | 234 | case ASN1_ITYPE_MSTRING: |
| 96 | str = fld; | 235 | if (!asn1_primitive_print(out, fld, it, |
| 97 | return asn1_primitive_print(out, fld, str->type, indent, name); | 236 | indent, fname, sname,pctx)) |
| 237 | return 0; | ||
| 238 | break; | ||
| 98 | 239 | ||
| 99 | case ASN1_ITYPE_EXTERN: | 240 | case ASN1_ITYPE_EXTERN: |
| 100 | BIO_printf(out, "%*s%s:EXTERNAL TYPE %s %s\n", indent, "", name, it->sname, fld ? "" : "ABSENT"); | 241 | if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx)) |
| 101 | return 1; | 242 | return 0; |
| 102 | case ASN1_ITYPE_COMPAT: | 243 | /* Use new style print routine if possible */ |
| 103 | BIO_printf(out, "%*s%s:COMPATIBLE TYPE %s %s\n", indent, "", name, it->sname, fld ? "" : "ABSENT"); | 244 | ef = it->funcs; |
| 104 | return 1; | 245 | if (ef && ef->asn1_ex_print) |
| 105 | 246 | { | |
| 247 | i = ef->asn1_ex_print(out, fld, indent, "", pctx); | ||
| 248 | if (!i) | ||
| 249 | return 0; | ||
| 250 | if ((i == 2) && (BIO_puts(out, "\n") <= 0)) | ||
| 251 | return 0; | ||
| 252 | return 1; | ||
| 253 | } | ||
| 254 | else if (sname && | ||
| 255 | BIO_printf(out, ":EXTERNAL TYPE %s\n", sname) <= 0) | ||
| 256 | return 0; | ||
| 257 | break; | ||
| 106 | 258 | ||
| 107 | case ASN1_ITYPE_CHOICE: | 259 | case ASN1_ITYPE_CHOICE: |
| 260 | #if 0 | ||
| 261 | if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx)) | ||
| 262 | return 0; | ||
| 263 | #endif | ||
| 108 | /* CHOICE type, get selector */ | 264 | /* CHOICE type, get selector */ |
| 109 | i = asn1_get_choice_selector(fld, it); | 265 | i = asn1_get_choice_selector(fld, it); |
| 110 | /* This should never happen... */ | 266 | /* This should never happen... */ |
| 111 | if((i < 0) || (i >= it->tcount)) { | 267 | if((i < 0) || (i >= it->tcount)) |
| 112 | BIO_printf(out, "%s selector [%d] out of range\n", it->sname, i); | 268 | { |
| 269 | if (BIO_printf(out, | ||
| 270 | "ERROR: selector [%d] invalid\n", i) <= 0) | ||
| 271 | return 0; | ||
| 113 | return 1; | 272 | return 1; |
| 114 | } | 273 | } |
| 115 | tt = it->templates + i; | 274 | tt = it->templates + i; |
| 116 | tmpfld = asn1_get_field(fld, tt); | 275 | tmpfld = asn1_get_field_ptr(fld, tt); |
| 117 | return ASN1_template_print(out, tmpfld, indent, tt); | 276 | if (!asn1_template_print_ctx(out, tmpfld, indent, tt, pctx)) |
| 277 | return 0; | ||
| 278 | break; | ||
| 118 | 279 | ||
| 119 | case ASN1_ITYPE_SEQUENCE: | 280 | case ASN1_ITYPE_SEQUENCE: |
| 120 | BIO_printf(out, "%*s%s {\n", indent, "", name); | 281 | case ASN1_ITYPE_NDEF_SEQUENCE: |
| 121 | /* Get each field entry */ | 282 | if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx)) |
| 122 | for(i = 0, tt = it->templates; i < it->tcount; i++, tt++) { | 283 | return 0; |
| 123 | tmpfld = asn1_get_field(fld, tt); | 284 | if (fname || sname) |
| 124 | ASN1_template_print(out, tmpfld, indent + 2, tt); | 285 | { |
| 125 | } | 286 | if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE) |
| 126 | BIO_printf(out, "%*s}\n", indent, ""); | 287 | { |
| 127 | return 1; | 288 | if (BIO_puts(out, " {\n") <= 0) |
| 289 | return 0; | ||
| 290 | } | ||
| 291 | else | ||
| 292 | { | ||
| 293 | if (BIO_puts(out, "\n") <= 0) | ||
| 294 | return 0; | ||
| 295 | } | ||
| 296 | } | ||
| 297 | |||
| 298 | if (asn1_cb) | ||
| 299 | { | ||
| 300 | i = asn1_cb(ASN1_OP_PRINT_PRE, fld, it, &parg); | ||
| 301 | if (i == 0) | ||
| 302 | return 0; | ||
| 303 | if (i == 2) | ||
| 304 | return 1; | ||
| 305 | } | ||
| 306 | |||
| 307 | /* Print each field entry */ | ||
| 308 | for(i = 0, tt = it->templates; i < it->tcount; i++, tt++) | ||
| 309 | { | ||
| 310 | const ASN1_TEMPLATE *seqtt; | ||
| 311 | seqtt = asn1_do_adb(fld, tt, 1); | ||
| 312 | tmpfld = asn1_get_field_ptr(fld, seqtt); | ||
| 313 | if (!asn1_template_print_ctx(out, tmpfld, | ||
| 314 | indent + 2, seqtt, pctx)) | ||
| 315 | return 0; | ||
| 316 | } | ||
| 317 | if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE) | ||
| 318 | { | ||
| 319 | if (BIO_printf(out, "%*s}\n", indent, "") < 0) | ||
| 320 | return 0; | ||
| 321 | } | ||
| 322 | |||
| 323 | if (asn1_cb) | ||
| 324 | { | ||
| 325 | i = asn1_cb(ASN1_OP_PRINT_POST, fld, it, &parg); | ||
| 326 | if (i == 0) | ||
| 327 | return 0; | ||
| 328 | } | ||
| 329 | break; | ||
| 128 | 330 | ||
| 129 | default: | 331 | default: |
| 332 | BIO_printf(out, "Unprocessed type %d\n", it->itype); | ||
| 130 | return 0; | 333 | return 0; |
| 334 | } | ||
| 335 | |||
| 336 | return 1; | ||
| 131 | } | 337 | } |
| 132 | } | ||
| 133 | 338 | ||
| 134 | int ASN1_template_print(BIO *out, void *fld, int indent, const ASN1_TEMPLATE *tt) | 339 | int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent, |
| 135 | { | 340 | const ASN1_TEMPLATE *tt, const ASN1_PCTX *pctx) |
| 341 | { | ||
| 136 | int i, flags; | 342 | int i, flags; |
| 137 | #if 0 | 343 | const char *sname, *fname; |
| 138 | if(!fld) return 0; | ||
| 139 | #endif | ||
| 140 | flags = tt->flags; | 344 | flags = tt->flags; |
| 141 | if(flags & ASN1_TFLG_SK_MASK) { | 345 | if(pctx->flags & ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME) |
| 346 | sname = ASN1_ITEM_ptr(tt->item)->sname; | ||
| 347 | else | ||
| 348 | sname = NULL; | ||
| 349 | if(pctx->flags & ASN1_PCTX_FLAGS_NO_FIELD_NAME) | ||
| 350 | fname = NULL; | ||
| 351 | else | ||
| 352 | fname = tt->field_name; | ||
| 353 | if(flags & ASN1_TFLG_SK_MASK) | ||
| 354 | { | ||
| 142 | char *tname; | 355 | char *tname; |
| 143 | void *skitem; | 356 | ASN1_VALUE *skitem; |
| 357 | STACK_OF(ASN1_VALUE) *stack; | ||
| 358 | |||
| 144 | /* SET OF, SEQUENCE OF */ | 359 | /* SET OF, SEQUENCE OF */ |
| 145 | if(flags & ASN1_TFLG_SET_OF) tname = "SET"; | 360 | if (fname) |
| 146 | else tname = "SEQUENCE"; | 361 | { |
| 147 | if(fld) { | 362 | if(pctx->flags & ASN1_PCTX_FLAGS_SHOW_SSOF) |
| 148 | BIO_printf(out, "%*s%s OF %s {\n", indent, "", tname, tt->field_name); | 363 | { |
| 149 | for(i = 0; i < sk_num(fld); i++) { | 364 | if(flags & ASN1_TFLG_SET_OF) |
| 150 | skitem = sk_value(fld, i); | 365 | tname = "SET"; |
| 151 | asn1_item_print_nm(out, skitem, indent + 2, tt->item, ""); | 366 | else |
| 367 | tname = "SEQUENCE"; | ||
| 368 | if (BIO_printf(out, "%*s%s OF %s {\n", | ||
| 369 | indent, "", tname, tt->field_name) <= 0) | ||
| 370 | return 0; | ||
| 371 | } | ||
| 372 | else if (BIO_printf(out, "%*s%s:\n", indent, "", | ||
| 373 | fname) <= 0) | ||
| 374 | return 0; | ||
| 375 | } | ||
| 376 | stack = (STACK_OF(ASN1_VALUE) *)*fld; | ||
| 377 | for(i = 0; i < sk_ASN1_VALUE_num(stack); i++) | ||
| 378 | { | ||
| 379 | if ((i > 0) && (BIO_puts(out, "\n") <= 0)) | ||
| 380 | return 0; | ||
| 381 | |||
| 382 | skitem = sk_ASN1_VALUE_value(stack, i); | ||
| 383 | if (!asn1_item_print_ctx(out, &skitem, indent + 2, | ||
| 384 | ASN1_ITEM_ptr(tt->item), NULL, NULL, 1, pctx)) | ||
| 385 | return 0; | ||
| 386 | } | ||
| 387 | if (!i && BIO_printf(out, "%*s<EMPTY>\n", indent + 2, "") <= 0) | ||
| 388 | return 0; | ||
| 389 | if(pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE) | ||
| 390 | { | ||
| 391 | if (BIO_printf(out, "%*s}\n", indent, "") <= 0) | ||
| 392 | return 0; | ||
| 152 | } | 393 | } |
| 153 | BIO_printf(out, "%*s}\n", indent, ""); | ||
| 154 | } else | ||
| 155 | BIO_printf(out, "%*s%s OF %s ABSENT\n", indent, "", tname, tt->field_name); | ||
| 156 | return 1; | 394 | return 1; |
| 395 | } | ||
| 396 | return asn1_item_print_ctx(out, fld, indent, ASN1_ITEM_ptr(tt->item), | ||
| 397 | fname, sname, 0, pctx); | ||
| 157 | } | 398 | } |
| 158 | return asn1_item_print_nm(out, fld, indent, tt->item, tt->field_name); | 399 | |
| 159 | } | 400 | static int asn1_print_fsname(BIO *out, int indent, |
| 160 | 401 | const char *fname, const char *sname, | |
| 161 | static int asn1_primitive_print(BIO *out, void *fld, long utype, int indent, const char *name) | 402 | const ASN1_PCTX *pctx) |
| 162 | { | 403 | { |
| 163 | ASN1_STRING *str = fld; | 404 | static char spaces[] = " "; |
| 164 | if(fld) { | 405 | const int nspaces = sizeof(spaces) - 1; |
| 165 | if(utype == V_ASN1_BOOLEAN) { | 406 | |
| 166 | int *bool = fld; | 407 | #if 0 |
| 167 | if(*bool == -1) printf("BOOL MISSING\n"); | 408 | if (!sname && !fname) |
| 168 | BIO_printf(out, "%*s%s:%s", indent, "", "BOOLEAN", *bool ? "TRUE" : "FALSE"); | 409 | return 1; |
| 169 | } else if((utype == V_ASN1_INTEGER) | 410 | #endif |
| 170 | || (utype == V_ASN1_ENUMERATED)) { | 411 | |
| 171 | char *s, *nm; | 412 | while (indent > nspaces) |
| 172 | s = i2s_ASN1_INTEGER(NULL, fld); | 413 | { |
| 173 | if(utype == V_ASN1_INTEGER) nm = "INTEGER"; | 414 | if (BIO_write(out, spaces, nspaces) != nspaces) |
| 174 | else nm = "ENUMERATED"; | 415 | return 0; |
| 175 | BIO_printf(out, "%*s%s:%s", indent, "", nm, s); | 416 | indent -= nspaces; |
| 176 | OPENSSL_free(s); | 417 | } |
| 177 | } else if(utype == V_ASN1_NULL) { | 418 | if (BIO_write(out, spaces, indent) != indent) |
| 178 | BIO_printf(out, "%*s%s", indent, "", "NULL"); | 419 | return 0; |
| 179 | } else if(utype == V_ASN1_UTCTIME) { | 420 | if (pctx->flags & ASN1_PCTX_FLAGS_NO_STRUCT_NAME) |
| 180 | BIO_printf(out, "%*s%s:%s:", indent, "", name, "UTCTIME"); | 421 | sname = NULL; |
| 181 | ASN1_UTCTIME_print(out, str); | 422 | if (pctx->flags & ASN1_PCTX_FLAGS_NO_FIELD_NAME) |
| 182 | } else if(utype == V_ASN1_GENERALIZEDTIME) { | 423 | fname = NULL; |
| 183 | BIO_printf(out, "%*s%s:%s:", indent, "", name, "GENERALIZEDTIME"); | 424 | if (!sname && !fname) |
| 184 | ASN1_GENERALIZEDTIME_print(out, str); | 425 | return 1; |
| 185 | } else if(utype == V_ASN1_OBJECT) { | 426 | if (fname) |
| 186 | char objbuf[80], *ln; | 427 | { |
| 187 | ln = OBJ_nid2ln(OBJ_obj2nid(fld)); | 428 | if (BIO_puts(out, fname) <= 0) |
| 188 | if(!ln) ln = ""; | 429 | return 0; |
| 189 | OBJ_obj2txt(objbuf, sizeof objbuf, fld, 1); | ||
| 190 | BIO_printf(out, "%*s%s:%s (%s)", indent, "", "OBJECT", ln, objbuf); | ||
| 191 | } else { | ||
| 192 | BIO_printf(out, "%*s%s:", indent, "", name); | ||
| 193 | ASN1_STRING_print_ex(out, str, ASN1_STRFLGS_DUMP_UNKNOWN|ASN1_STRFLGS_SHOW_TYPE); | ||
| 194 | } | 430 | } |
| 195 | BIO_printf(out, "\n"); | 431 | if (sname) |
| 196 | } else BIO_printf(out, "%*s%s [ABSENT]\n", indent, "", name); | 432 | { |
| 433 | if (fname) | ||
| 434 | { | ||
| 435 | if (BIO_printf(out, " (%s)", sname) <= 0) | ||
| 436 | return 0; | ||
| 437 | } | ||
| 438 | else | ||
| 439 | { | ||
| 440 | if (BIO_puts(out, sname) <= 0) | ||
| 441 | return 0; | ||
| 442 | } | ||
| 443 | } | ||
| 444 | if (BIO_write(out, ": ", 2) != 2) | ||
| 445 | return 0; | ||
| 197 | return 1; | 446 | return 1; |
| 198 | } | 447 | } |
| 448 | |||
| 449 | static int asn1_print_boolean_ctx(BIO *out, const int bool, | ||
| 450 | const ASN1_PCTX *pctx) | ||
| 451 | { | ||
| 452 | const char *str; | ||
| 453 | switch (bool) | ||
| 454 | { | ||
| 455 | case -1: | ||
| 456 | str = "BOOL ABSENT"; | ||
| 457 | break; | ||
| 458 | |||
| 459 | case 0: | ||
| 460 | str = "FALSE"; | ||
| 461 | break; | ||
| 462 | |||
| 463 | default: | ||
| 464 | str = "TRUE"; | ||
| 465 | break; | ||
| 466 | |||
| 467 | } | ||
| 468 | |||
| 469 | if (BIO_puts(out, str) <= 0) | ||
| 470 | return 0; | ||
| 471 | return 1; | ||
| 472 | |||
| 473 | } | ||
| 474 | |||
| 475 | static int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str, | ||
| 476 | const ASN1_PCTX *pctx) | ||
| 477 | { | ||
| 478 | char *s; | ||
| 479 | int ret = 1; | ||
| 480 | s = i2s_ASN1_INTEGER(NULL, str); | ||
| 481 | if (BIO_puts(out, s) <= 0) | ||
| 482 | ret = 0; | ||
| 483 | OPENSSL_free(s); | ||
| 484 | return ret; | ||
| 485 | } | ||
| 486 | |||
| 487 | static int asn1_print_oid_ctx(BIO *out, const ASN1_OBJECT *oid, | ||
| 488 | const ASN1_PCTX *pctx) | ||
| 489 | { | ||
| 490 | char objbuf[80]; | ||
| 491 | const char *ln; | ||
| 492 | ln = OBJ_nid2ln(OBJ_obj2nid(oid)); | ||
| 493 | if(!ln) | ||
| 494 | ln = ""; | ||
| 495 | OBJ_obj2txt(objbuf, sizeof objbuf, oid, 1); | ||
| 496 | if (BIO_printf(out, "%s (%s)", ln, objbuf) <= 0) | ||
| 497 | return 0; | ||
| 498 | return 1; | ||
| 499 | } | ||
| 500 | |||
| 501 | static int asn1_print_obstring_ctx(BIO *out, ASN1_STRING *str, int indent, | ||
| 502 | const ASN1_PCTX *pctx) | ||
| 503 | { | ||
| 504 | if (str->type == V_ASN1_BIT_STRING) | ||
| 505 | { | ||
| 506 | if (BIO_printf(out, " (%ld unused bits)\n", | ||
| 507 | str->flags & 0x7) <= 0) | ||
| 508 | return 0; | ||
| 509 | } | ||
| 510 | else if (BIO_puts(out, "\n") <= 0) | ||
| 511 | return 0; | ||
| 512 | if ((str->length > 0) | ||
| 513 | && BIO_dump_indent(out, (char *)str->data, str->length, | ||
| 514 | indent + 2) <= 0) | ||
| 515 | return 0; | ||
| 516 | return 1; | ||
| 517 | } | ||
| 518 | |||
| 519 | static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld, | ||
| 520 | const ASN1_ITEM *it, int indent, | ||
| 521 | const char *fname, const char *sname, | ||
| 522 | const ASN1_PCTX *pctx) | ||
| 523 | { | ||
| 524 | long utype; | ||
| 525 | ASN1_STRING *str; | ||
| 526 | int ret = 1, needlf = 1; | ||
| 527 | const char *pname; | ||
| 528 | const ASN1_PRIMITIVE_FUNCS *pf; | ||
| 529 | pf = it->funcs; | ||
| 530 | if (!asn1_print_fsname(out, indent, fname, sname, pctx)) | ||
| 531 | return 0; | ||
| 532 | if (pf && pf->prim_print) | ||
| 533 | return pf->prim_print(out, fld, it, indent, pctx); | ||
| 534 | str = (ASN1_STRING *)*fld; | ||
| 535 | if (it->itype == ASN1_ITYPE_MSTRING) | ||
| 536 | utype = str->type & ~V_ASN1_NEG; | ||
| 537 | else | ||
| 538 | utype = it->utype; | ||
| 539 | if (utype == V_ASN1_ANY) | ||
| 540 | { | ||
| 541 | ASN1_TYPE *atype = (ASN1_TYPE *)*fld; | ||
| 542 | utype = atype->type; | ||
| 543 | fld = &atype->value.asn1_value; | ||
| 544 | str = (ASN1_STRING *)*fld; | ||
| 545 | if (pctx->flags & ASN1_PCTX_FLAGS_NO_ANY_TYPE) | ||
| 546 | pname = NULL; | ||
| 547 | else | ||
| 548 | pname = ASN1_tag2str(utype); | ||
| 549 | } | ||
| 550 | else | ||
| 551 | { | ||
| 552 | if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_TYPE) | ||
| 553 | pname = ASN1_tag2str(utype); | ||
| 554 | else | ||
| 555 | pname = NULL; | ||
| 556 | } | ||
| 557 | |||
| 558 | if (utype == V_ASN1_NULL) | ||
| 559 | { | ||
| 560 | if (BIO_puts(out, "NULL\n") <= 0) | ||
| 561 | return 0; | ||
| 562 | return 1; | ||
| 563 | } | ||
| 564 | |||
| 565 | if (pname) | ||
| 566 | { | ||
| 567 | if (BIO_puts(out, pname) <= 0) | ||
| 568 | return 0; | ||
| 569 | if (BIO_puts(out, ":") <= 0) | ||
| 570 | return 0; | ||
| 571 | } | ||
| 572 | |||
| 573 | switch (utype) | ||
| 574 | { | ||
| 575 | case V_ASN1_BOOLEAN: | ||
| 576 | { | ||
| 577 | int bool = *(int *)fld; | ||
| 578 | if (bool == -1) | ||
| 579 | bool = it->size; | ||
| 580 | ret = asn1_print_boolean_ctx(out, bool, pctx); | ||
| 581 | } | ||
| 582 | break; | ||
| 583 | |||
| 584 | case V_ASN1_INTEGER: | ||
| 585 | case V_ASN1_ENUMERATED: | ||
| 586 | ret = asn1_print_integer_ctx(out, str, pctx); | ||
| 587 | break; | ||
| 588 | |||
| 589 | case V_ASN1_UTCTIME: | ||
| 590 | ret = ASN1_UTCTIME_print(out, str); | ||
| 591 | break; | ||
| 592 | |||
| 593 | case V_ASN1_GENERALIZEDTIME: | ||
| 594 | ret = ASN1_GENERALIZEDTIME_print(out, str); | ||
| 595 | break; | ||
| 596 | |||
| 597 | case V_ASN1_OBJECT: | ||
| 598 | ret = asn1_print_oid_ctx(out, (const ASN1_OBJECT *)*fld, pctx); | ||
| 599 | break; | ||
| 600 | |||
| 601 | case V_ASN1_OCTET_STRING: | ||
| 602 | case V_ASN1_BIT_STRING: | ||
| 603 | ret = asn1_print_obstring_ctx(out, str, indent, pctx); | ||
| 604 | needlf = 0; | ||
| 605 | break; | ||
| 606 | |||
| 607 | case V_ASN1_SEQUENCE: | ||
| 608 | case V_ASN1_SET: | ||
| 609 | case V_ASN1_OTHER: | ||
| 610 | if (BIO_puts(out, "\n") <= 0) | ||
| 611 | return 0; | ||
| 612 | if (ASN1_parse_dump(out, str->data, str->length, | ||
| 613 | indent, 0) <= 0) | ||
| 614 | ret = 0; | ||
| 615 | needlf = 0; | ||
| 616 | break; | ||
| 617 | |||
| 618 | default: | ||
| 619 | ret = ASN1_STRING_print_ex(out, str, pctx->str_flags); | ||
| 620 | |||
| 621 | } | ||
| 622 | if (!ret) | ||
| 623 | return 0; | ||
| 624 | if (needlf && BIO_puts(out, "\n") <= 0) | ||
| 625 | return 0; | ||
| 626 | return 1; | ||
| 627 | } | ||
diff --git a/src/lib/libcrypto/asn1/tasn_typ.c b/src/lib/libcrypto/asn1/tasn_typ.c index 6252213d15..6fb1c372da 100644 --- a/src/lib/libcrypto/asn1/tasn_typ.c +++ b/src/lib/libcrypto/asn1/tasn_typ.c | |||
| @@ -135,3 +135,14 @@ IMPLEMENT_ASN1_TYPE_ex(ASN1_FBOOLEAN, ASN1_BOOLEAN, 0) | |||
| 135 | /* Special, OCTET STRING with indefinite length constructed support */ | 135 | /* Special, OCTET STRING with indefinite length constructed support */ |
| 136 | 136 | ||
| 137 | IMPLEMENT_ASN1_TYPE_ex(ASN1_OCTET_STRING_NDEF, ASN1_OCTET_STRING, ASN1_TFLG_NDEF) | 137 | IMPLEMENT_ASN1_TYPE_ex(ASN1_OCTET_STRING_NDEF, ASN1_OCTET_STRING, ASN1_TFLG_NDEF) |
| 138 | |||
| 139 | ASN1_ITEM_TEMPLATE(ASN1_SEQUENCE_ANY) = | ||
| 140 | ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, ASN1_SEQUENCE_ANY, ASN1_ANY) | ||
| 141 | ASN1_ITEM_TEMPLATE_END(ASN1_SEQUENCE_ANY) | ||
| 142 | |||
| 143 | ASN1_ITEM_TEMPLATE(ASN1_SET_ANY) = | ||
| 144 | ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SET_OF, 0, ASN1_SET_ANY, ASN1_ANY) | ||
| 145 | ASN1_ITEM_TEMPLATE_END(ASN1_SET_ANY) | ||
| 146 | |||
| 147 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) | ||
| 148 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(ASN1_SEQUENCE_ANY, ASN1_SET_ANY, ASN1_SET_ANY) | ||
diff --git a/src/lib/libcrypto/asn1/x_cinf.c b/src/lib/libcrypto/asn1/x_cinf.c deleted file mode 100644 index 339a110eef..0000000000 --- a/src/lib/libcrypto/asn1/x_cinf.c +++ /dev/null | |||
| @@ -1,201 +0,0 @@ | |||
| 1 | /* crypto/asn1/x_cinf.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/asn1_mac.h> | ||
| 62 | #include <openssl/x509.h> | ||
| 63 | |||
| 64 | int i2d_X509_CINF(X509_CINF *a, unsigned char **pp) | ||
| 65 | { | ||
| 66 | int v1=0,v2=0; | ||
| 67 | M_ASN1_I2D_vars(a); | ||
| 68 | |||
| 69 | M_ASN1_I2D_len_EXP_opt(a->version,i2d_ASN1_INTEGER,0,v1); | ||
| 70 | M_ASN1_I2D_len(a->serialNumber, i2d_ASN1_INTEGER); | ||
| 71 | M_ASN1_I2D_len(a->signature, i2d_X509_ALGOR); | ||
| 72 | M_ASN1_I2D_len(a->issuer, i2d_X509_NAME); | ||
| 73 | M_ASN1_I2D_len(a->validity, i2d_X509_VAL); | ||
| 74 | M_ASN1_I2D_len(a->subject, i2d_X509_NAME); | ||
| 75 | M_ASN1_I2D_len(a->key, i2d_X509_PUBKEY); | ||
| 76 | M_ASN1_I2D_len_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING); | ||
| 77 | M_ASN1_I2D_len_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING); | ||
| 78 | M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, | ||
| 79 | i2d_X509_EXTENSION,3, | ||
| 80 | V_ASN1_SEQUENCE,v2); | ||
| 81 | |||
| 82 | M_ASN1_I2D_seq_total(); | ||
| 83 | |||
| 84 | M_ASN1_I2D_put_EXP_opt(a->version,i2d_ASN1_INTEGER,0,v1); | ||
| 85 | M_ASN1_I2D_put(a->serialNumber, i2d_ASN1_INTEGER); | ||
| 86 | M_ASN1_I2D_put(a->signature, i2d_X509_ALGOR); | ||
| 87 | M_ASN1_I2D_put(a->issuer, i2d_X509_NAME); | ||
| 88 | M_ASN1_I2D_put(a->validity, i2d_X509_VAL); | ||
| 89 | M_ASN1_I2D_put(a->subject, i2d_X509_NAME); | ||
| 90 | M_ASN1_I2D_put(a->key, i2d_X509_PUBKEY); | ||
| 91 | M_ASN1_I2D_put_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING,1); | ||
| 92 | M_ASN1_I2D_put_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING,2); | ||
| 93 | M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, | ||
| 94 | i2d_X509_EXTENSION,3, | ||
| 95 | V_ASN1_SEQUENCE,v2); | ||
| 96 | |||
| 97 | M_ASN1_I2D_finish(); | ||
| 98 | } | ||
| 99 | |||
| 100 | X509_CINF *d2i_X509_CINF(X509_CINF **a, unsigned char **pp, long length) | ||
| 101 | { | ||
| 102 | int ver=0; | ||
| 103 | M_ASN1_D2I_vars(a,X509_CINF *,X509_CINF_new); | ||
| 104 | |||
| 105 | M_ASN1_D2I_Init(); | ||
| 106 | M_ASN1_D2I_start_sequence(); | ||
| 107 | /* we have the optional version field */ | ||
| 108 | if (M_ASN1_next == (V_ASN1_CONTEXT_SPECIFIC | V_ASN1_CONSTRUCTED | 0)) | ||
| 109 | { | ||
| 110 | M_ASN1_D2I_get_EXP_opt(ret->version,d2i_ASN1_INTEGER,0); | ||
| 111 | if (ret->version->data != NULL) | ||
| 112 | ver=ret->version->data[0]; | ||
| 113 | } | ||
| 114 | else | ||
| 115 | { | ||
| 116 | if (ret->version != NULL) | ||
| 117 | { | ||
| 118 | M_ASN1_INTEGER_free(ret->version); | ||
| 119 | ret->version=NULL; | ||
| 120 | } | ||
| 121 | } | ||
| 122 | M_ASN1_D2I_get(ret->serialNumber,d2i_ASN1_INTEGER); | ||
| 123 | M_ASN1_D2I_get(ret->signature,d2i_X509_ALGOR); | ||
| 124 | M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME); | ||
| 125 | M_ASN1_D2I_get(ret->validity,d2i_X509_VAL); | ||
| 126 | M_ASN1_D2I_get(ret->subject,d2i_X509_NAME); | ||
| 127 | M_ASN1_D2I_get(ret->key,d2i_X509_PUBKEY); | ||
| 128 | if (ver >= 1) /* version 2 extensions */ | ||
| 129 | { | ||
| 130 | if (ret->issuerUID != NULL) | ||
| 131 | { | ||
| 132 | M_ASN1_BIT_STRING_free(ret->issuerUID); | ||
| 133 | ret->issuerUID=NULL; | ||
| 134 | } | ||
| 135 | if (ret->subjectUID != NULL) | ||
| 136 | { | ||
| 137 | M_ASN1_BIT_STRING_free(ret->subjectUID); | ||
| 138 | ret->subjectUID=NULL; | ||
| 139 | } | ||
| 140 | M_ASN1_D2I_get_IMP_opt(ret->issuerUID,d2i_ASN1_BIT_STRING, 1, | ||
| 141 | V_ASN1_BIT_STRING); | ||
| 142 | M_ASN1_D2I_get_IMP_opt(ret->subjectUID,d2i_ASN1_BIT_STRING, 2, | ||
| 143 | V_ASN1_BIT_STRING); | ||
| 144 | } | ||
| 145 | /* Note: some broken certificates include extensions but don't set | ||
| 146 | * the version number properly. By bypassing this check they can | ||
| 147 | * be parsed. | ||
| 148 | */ | ||
| 149 | |||
| 150 | #ifdef VERSION_EXT_CHECK | ||
| 151 | if (ver >= 2) /* version 3 extensions */ | ||
| 152 | #endif | ||
| 153 | { | ||
| 154 | if (ret->extensions != NULL) | ||
| 155 | while (sk_X509_EXTENSION_num(ret->extensions)) | ||
| 156 | X509_EXTENSION_free( | ||
| 157 | sk_X509_EXTENSION_pop(ret->extensions)); | ||
| 158 | M_ASN1_D2I_get_EXP_set_opt_type(X509_EXTENSION,ret->extensions, | ||
| 159 | d2i_X509_EXTENSION, | ||
| 160 | X509_EXTENSION_free,3, | ||
| 161 | V_ASN1_SEQUENCE); | ||
| 162 | } | ||
| 163 | M_ASN1_D2I_Finish(a,X509_CINF_free,ASN1_F_D2I_X509_CINF); | ||
| 164 | } | ||
| 165 | |||
| 166 | X509_CINF *X509_CINF_new(void) | ||
| 167 | { | ||
| 168 | X509_CINF *ret=NULL; | ||
| 169 | ASN1_CTX c; | ||
| 170 | |||
| 171 | M_ASN1_New_Malloc(ret,X509_CINF); | ||
| 172 | ret->version=NULL; | ||
| 173 | M_ASN1_New(ret->serialNumber,M_ASN1_INTEGER_new); | ||
| 174 | M_ASN1_New(ret->signature,X509_ALGOR_new); | ||
| 175 | M_ASN1_New(ret->issuer,X509_NAME_new); | ||
| 176 | M_ASN1_New(ret->validity,X509_VAL_new); | ||
| 177 | M_ASN1_New(ret->subject,X509_NAME_new); | ||
| 178 | M_ASN1_New(ret->key,X509_PUBKEY_new); | ||
| 179 | ret->issuerUID=NULL; | ||
| 180 | ret->subjectUID=NULL; | ||
| 181 | ret->extensions=NULL; | ||
| 182 | return(ret); | ||
| 183 | M_ASN1_New_Error(ASN1_F_X509_CINF_NEW); | ||
| 184 | } | ||
| 185 | |||
| 186 | void X509_CINF_free(X509_CINF *a) | ||
| 187 | { | ||
| 188 | if (a == NULL) return; | ||
| 189 | M_ASN1_INTEGER_free(a->version); | ||
| 190 | M_ASN1_INTEGER_free(a->serialNumber); | ||
| 191 | X509_ALGOR_free(a->signature); | ||
| 192 | X509_NAME_free(a->issuer); | ||
| 193 | X509_VAL_free(a->validity); | ||
| 194 | X509_NAME_free(a->subject); | ||
| 195 | X509_PUBKEY_free(a->key); | ||
| 196 | M_ASN1_BIT_STRING_free(a->issuerUID); | ||
| 197 | M_ASN1_BIT_STRING_free(a->subjectUID); | ||
| 198 | sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free); | ||
| 199 | OPENSSL_free(a); | ||
| 200 | } | ||
| 201 | |||
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c index 70d56a67f2..c51c690ba9 100644 --- a/src/lib/libcrypto/asn1/x_crl.c +++ b/src/lib/libcrypto/asn1/x_crl.c | |||
| @@ -58,11 +58,14 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include "asn1_locl.h" | ||
| 61 | #include <openssl/asn1t.h> | 62 | #include <openssl/asn1t.h> |
| 62 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 64 | #include <openssl/x509v3.h> | ||
| 63 | 65 | ||
| 64 | static int X509_REVOKED_cmp(const X509_REVOKED * const *a, | 66 | static int X509_REVOKED_cmp(const X509_REVOKED * const *a, |
| 65 | const X509_REVOKED * const *b); | 67 | const X509_REVOKED * const *b); |
| 68 | static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp); | ||
| 66 | 69 | ||
| 67 | ASN1_SEQUENCE(X509_REVOKED) = { | 70 | ASN1_SEQUENCE(X509_REVOKED) = { |
| 68 | ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER), | 71 | ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER), |
| @@ -70,11 +73,26 @@ ASN1_SEQUENCE(X509_REVOKED) = { | |||
| 70 | ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION) | 73 | ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION) |
| 71 | } ASN1_SEQUENCE_END(X509_REVOKED) | 74 | } ASN1_SEQUENCE_END(X509_REVOKED) |
| 72 | 75 | ||
| 76 | static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r); | ||
| 77 | static int def_crl_lookup(X509_CRL *crl, | ||
| 78 | X509_REVOKED **ret, ASN1_INTEGER *serial, X509_NAME *issuer); | ||
| 79 | |||
| 80 | static X509_CRL_METHOD int_crl_meth = | ||
| 81 | { | ||
| 82 | 0, | ||
| 83 | 0,0, | ||
| 84 | def_crl_lookup, | ||
| 85 | def_crl_verify | ||
| 86 | }; | ||
| 87 | |||
| 88 | static const X509_CRL_METHOD *default_crl_method = &int_crl_meth; | ||
| 89 | |||
| 73 | /* The X509_CRL_INFO structure needs a bit of customisation. | 90 | /* The X509_CRL_INFO structure needs a bit of customisation. |
| 74 | * Since we cache the original encoding the signature wont be affected by | 91 | * Since we cache the original encoding the signature wont be affected by |
| 75 | * reordering of the revoked field. | 92 | * reordering of the revoked field. |
| 76 | */ | 93 | */ |
| 77 | static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 94 | static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 95 | void *exarg) | ||
| 78 | { | 96 | { |
| 79 | X509_CRL_INFO *a = (X509_CRL_INFO *)*pval; | 97 | X509_CRL_INFO *a = (X509_CRL_INFO *)*pval; |
| 80 | 98 | ||
| @@ -101,7 +119,237 @@ ASN1_SEQUENCE_enc(X509_CRL_INFO, enc, crl_inf_cb) = { | |||
| 101 | ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0) | 119 | ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0) |
| 102 | } ASN1_SEQUENCE_END_enc(X509_CRL_INFO, X509_CRL_INFO) | 120 | } ASN1_SEQUENCE_END_enc(X509_CRL_INFO, X509_CRL_INFO) |
| 103 | 121 | ||
| 104 | ASN1_SEQUENCE_ref(X509_CRL, 0, CRYPTO_LOCK_X509_CRL) = { | 122 | /* Set CRL entry issuer according to CRL certificate issuer extension. |
| 123 | * Check for unhandled critical CRL entry extensions. | ||
| 124 | */ | ||
| 125 | |||
| 126 | static int crl_set_issuers(X509_CRL *crl) | ||
| 127 | { | ||
| 128 | |||
| 129 | int i, j; | ||
| 130 | GENERAL_NAMES *gens, *gtmp; | ||
| 131 | STACK_OF(X509_REVOKED) *revoked; | ||
| 132 | |||
| 133 | revoked = X509_CRL_get_REVOKED(crl); | ||
| 134 | |||
| 135 | gens = NULL; | ||
| 136 | for (i = 0; i < sk_X509_REVOKED_num(revoked); i++) | ||
| 137 | { | ||
| 138 | X509_REVOKED *rev = sk_X509_REVOKED_value(revoked, i); | ||
| 139 | STACK_OF(X509_EXTENSION) *exts; | ||
| 140 | ASN1_ENUMERATED *reason; | ||
| 141 | X509_EXTENSION *ext; | ||
| 142 | gtmp = X509_REVOKED_get_ext_d2i(rev, | ||
| 143 | NID_certificate_issuer, | ||
| 144 | &j, NULL); | ||
| 145 | if (!gtmp && (j != -1)) | ||
| 146 | { | ||
| 147 | crl->flags |= EXFLAG_INVALID; | ||
| 148 | return 1; | ||
| 149 | } | ||
| 150 | |||
| 151 | if (gtmp) | ||
| 152 | { | ||
| 153 | gens = gtmp; | ||
| 154 | if (!crl->issuers) | ||
| 155 | { | ||
| 156 | crl->issuers = sk_GENERAL_NAMES_new_null(); | ||
| 157 | if (!crl->issuers) | ||
| 158 | return 0; | ||
| 159 | } | ||
| 160 | if (!sk_GENERAL_NAMES_push(crl->issuers, gtmp)) | ||
| 161 | return 0; | ||
| 162 | } | ||
| 163 | rev->issuer = gens; | ||
| 164 | |||
| 165 | reason = X509_REVOKED_get_ext_d2i(rev, NID_crl_reason, | ||
| 166 | &j, NULL); | ||
| 167 | if (!reason && (j != -1)) | ||
| 168 | { | ||
| 169 | crl->flags |= EXFLAG_INVALID; | ||
| 170 | return 1; | ||
| 171 | } | ||
| 172 | |||
| 173 | if (reason) | ||
| 174 | { | ||
| 175 | rev->reason = ASN1_ENUMERATED_get(reason); | ||
| 176 | ASN1_ENUMERATED_free(reason); | ||
| 177 | } | ||
| 178 | else | ||
| 179 | rev->reason = CRL_REASON_NONE; | ||
| 180 | |||
| 181 | /* Check for critical CRL entry extensions */ | ||
| 182 | |||
| 183 | exts = rev->extensions; | ||
| 184 | |||
| 185 | for (j = 0; j < sk_X509_EXTENSION_num(exts); j++) | ||
| 186 | { | ||
| 187 | ext = sk_X509_EXTENSION_value(exts, j); | ||
| 188 | if (ext->critical > 0) | ||
| 189 | { | ||
| 190 | if (OBJ_obj2nid(ext->object) == | ||
| 191 | NID_certificate_issuer) | ||
| 192 | continue; | ||
| 193 | crl->flags |= EXFLAG_CRITICAL; | ||
| 194 | break; | ||
| 195 | } | ||
| 196 | } | ||
| 197 | |||
| 198 | |||
| 199 | } | ||
| 200 | |||
| 201 | return 1; | ||
| 202 | |||
| 203 | } | ||
| 204 | |||
| 205 | /* The X509_CRL structure needs a bit of customisation. Cache some extensions | ||
| 206 | * and hash of the whole CRL. | ||
| 207 | */ | ||
| 208 | static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | ||
| 209 | void *exarg) | ||
| 210 | { | ||
| 211 | X509_CRL *crl = (X509_CRL *)*pval; | ||
| 212 | STACK_OF(X509_EXTENSION) *exts; | ||
| 213 | X509_EXTENSION *ext; | ||
| 214 | int idx; | ||
| 215 | |||
| 216 | switch(operation) | ||
| 217 | { | ||
| 218 | case ASN1_OP_NEW_POST: | ||
| 219 | crl->idp = NULL; | ||
| 220 | crl->akid = NULL; | ||
| 221 | crl->flags = 0; | ||
| 222 | crl->idp_flags = 0; | ||
| 223 | crl->idp_reasons = CRLDP_ALL_REASONS; | ||
| 224 | crl->meth = default_crl_method; | ||
| 225 | crl->meth_data = NULL; | ||
| 226 | crl->issuers = NULL; | ||
| 227 | crl->crl_number = NULL; | ||
| 228 | crl->base_crl_number = NULL; | ||
| 229 | break; | ||
| 230 | |||
| 231 | case ASN1_OP_D2I_POST: | ||
| 232 | #ifndef OPENSSL_NO_SHA | ||
| 233 | X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL); | ||
| 234 | #endif | ||
| 235 | crl->idp = X509_CRL_get_ext_d2i(crl, | ||
| 236 | NID_issuing_distribution_point, NULL, NULL); | ||
| 237 | if (crl->idp) | ||
| 238 | setup_idp(crl, crl->idp); | ||
| 239 | |||
| 240 | crl->akid = X509_CRL_get_ext_d2i(crl, | ||
| 241 | NID_authority_key_identifier, NULL, NULL); | ||
| 242 | |||
| 243 | crl->crl_number = X509_CRL_get_ext_d2i(crl, | ||
| 244 | NID_crl_number, NULL, NULL); | ||
| 245 | |||
| 246 | crl->base_crl_number = X509_CRL_get_ext_d2i(crl, | ||
| 247 | NID_delta_crl, NULL, NULL); | ||
| 248 | /* Delta CRLs must have CRL number */ | ||
| 249 | if (crl->base_crl_number && !crl->crl_number) | ||
| 250 | crl->flags |= EXFLAG_INVALID; | ||
| 251 | |||
| 252 | /* See if we have any unhandled critical CRL extensions and | ||
| 253 | * indicate this in a flag. We only currently handle IDP so | ||
| 254 | * anything else critical sets the flag. | ||
| 255 | * | ||
| 256 | * This code accesses the X509_CRL structure directly: | ||
| 257 | * applications shouldn't do this. | ||
| 258 | */ | ||
| 259 | |||
| 260 | exts = crl->crl->extensions; | ||
| 261 | |||
| 262 | for (idx = 0; idx < sk_X509_EXTENSION_num(exts); idx++) | ||
| 263 | { | ||
| 264 | int nid; | ||
| 265 | ext = sk_X509_EXTENSION_value(exts, idx); | ||
| 266 | nid = OBJ_obj2nid(ext->object); | ||
| 267 | if (nid == NID_freshest_crl) | ||
| 268 | crl->flags |= EXFLAG_FRESHEST; | ||
| 269 | if (ext->critical > 0) | ||
| 270 | { | ||
| 271 | /* We handle IDP and deltas */ | ||
| 272 | if ((nid == NID_issuing_distribution_point) | ||
| 273 | || (nid == NID_delta_crl)) | ||
| 274 | break;; | ||
| 275 | crl->flags |= EXFLAG_CRITICAL; | ||
| 276 | break; | ||
| 277 | } | ||
| 278 | } | ||
| 279 | |||
| 280 | |||
| 281 | if (!crl_set_issuers(crl)) | ||
| 282 | return 0; | ||
| 283 | |||
| 284 | if (crl->meth->crl_init) | ||
| 285 | { | ||
| 286 | if (crl->meth->crl_init(crl) == 0) | ||
| 287 | return 0; | ||
| 288 | } | ||
| 289 | break; | ||
| 290 | |||
| 291 | case ASN1_OP_FREE_POST: | ||
| 292 | if (crl->meth->crl_free) | ||
| 293 | { | ||
| 294 | if (!crl->meth->crl_free(crl)) | ||
| 295 | return 0; | ||
| 296 | } | ||
| 297 | if (crl->akid) | ||
| 298 | AUTHORITY_KEYID_free(crl->akid); | ||
| 299 | if (crl->idp) | ||
| 300 | ISSUING_DIST_POINT_free(crl->idp); | ||
| 301 | ASN1_INTEGER_free(crl->crl_number); | ||
| 302 | ASN1_INTEGER_free(crl->base_crl_number); | ||
| 303 | sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free); | ||
| 304 | break; | ||
| 305 | } | ||
| 306 | return 1; | ||
| 307 | } | ||
| 308 | |||
| 309 | /* Convert IDP into a more convenient form */ | ||
| 310 | |||
| 311 | static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp) | ||
| 312 | { | ||
| 313 | int idp_only = 0; | ||
| 314 | /* Set various flags according to IDP */ | ||
| 315 | crl->idp_flags |= IDP_PRESENT; | ||
| 316 | if (idp->onlyuser > 0) | ||
| 317 | { | ||
| 318 | idp_only++; | ||
| 319 | crl->idp_flags |= IDP_ONLYUSER; | ||
| 320 | } | ||
| 321 | if (idp->onlyCA > 0) | ||
| 322 | { | ||
| 323 | idp_only++; | ||
| 324 | crl->idp_flags |= IDP_ONLYCA; | ||
| 325 | } | ||
| 326 | if (idp->onlyattr > 0) | ||
| 327 | { | ||
| 328 | idp_only++; | ||
| 329 | crl->idp_flags |= IDP_ONLYATTR; | ||
| 330 | } | ||
| 331 | |||
| 332 | if (idp_only > 1) | ||
| 333 | crl->idp_flags |= IDP_INVALID; | ||
| 334 | |||
| 335 | if (idp->indirectCRL > 0) | ||
| 336 | crl->idp_flags |= IDP_INDIRECT; | ||
| 337 | |||
| 338 | if (idp->onlysomereasons) | ||
| 339 | { | ||
| 340 | crl->idp_flags |= IDP_REASONS; | ||
| 341 | if (idp->onlysomereasons->length > 0) | ||
| 342 | crl->idp_reasons = idp->onlysomereasons->data[0]; | ||
| 343 | if (idp->onlysomereasons->length > 1) | ||
| 344 | crl->idp_reasons |= | ||
| 345 | (idp->onlysomereasons->data[1] << 8); | ||
| 346 | crl->idp_reasons &= CRLDP_ALL_REASONS; | ||
| 347 | } | ||
| 348 | |||
| 349 | DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl)); | ||
| 350 | } | ||
| 351 | |||
| 352 | ASN1_SEQUENCE_ref(X509_CRL, crl_cb, CRYPTO_LOCK_X509_CRL) = { | ||
| 105 | ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO), | 353 | ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO), |
| 106 | ASN1_SIMPLE(X509_CRL, sig_alg, X509_ALGOR), | 354 | ASN1_SIMPLE(X509_CRL, sig_alg, X509_ALGOR), |
| 107 | ASN1_SIMPLE(X509_CRL, signature, ASN1_BIT_STRING) | 355 | ASN1_SIMPLE(X509_CRL, signature, ASN1_BIT_STRING) |
| @@ -134,6 +382,145 @@ int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) | |||
| 134 | return 1; | 382 | return 1; |
| 135 | } | 383 | } |
| 136 | 384 | ||
| 385 | int X509_CRL_verify(X509_CRL *crl, EVP_PKEY *r) | ||
| 386 | { | ||
| 387 | if (crl->meth->crl_verify) | ||
| 388 | return crl->meth->crl_verify(crl, r); | ||
| 389 | return 0; | ||
| 390 | } | ||
| 391 | |||
| 392 | int X509_CRL_get0_by_serial(X509_CRL *crl, | ||
| 393 | X509_REVOKED **ret, ASN1_INTEGER *serial) | ||
| 394 | { | ||
| 395 | if (crl->meth->crl_lookup) | ||
| 396 | return crl->meth->crl_lookup(crl, ret, serial, NULL); | ||
| 397 | return 0; | ||
| 398 | } | ||
| 399 | |||
| 400 | int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x) | ||
| 401 | { | ||
| 402 | if (crl->meth->crl_lookup) | ||
| 403 | return crl->meth->crl_lookup(crl, ret, | ||
| 404 | X509_get_serialNumber(x), | ||
| 405 | X509_get_issuer_name(x)); | ||
| 406 | return 0; | ||
| 407 | } | ||
| 408 | |||
| 409 | static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r) | ||
| 410 | { | ||
| 411 | return(ASN1_item_verify(ASN1_ITEM_rptr(X509_CRL_INFO), | ||
| 412 | crl->sig_alg, crl->signature,crl->crl,r)); | ||
| 413 | } | ||
| 414 | |||
| 415 | static int crl_revoked_issuer_match(X509_CRL *crl, X509_NAME *nm, | ||
| 416 | X509_REVOKED *rev) | ||
| 417 | { | ||
| 418 | int i; | ||
| 419 | |||
| 420 | if (!rev->issuer) | ||
| 421 | { | ||
| 422 | if (!nm) | ||
| 423 | return 1; | ||
| 424 | if (!X509_NAME_cmp(nm, X509_CRL_get_issuer(crl))) | ||
| 425 | return 1; | ||
| 426 | return 0; | ||
| 427 | } | ||
| 428 | |||
| 429 | if (!nm) | ||
| 430 | nm = X509_CRL_get_issuer(crl); | ||
| 431 | |||
| 432 | for (i = 0; i < sk_GENERAL_NAME_num(rev->issuer); i++) | ||
| 433 | { | ||
| 434 | GENERAL_NAME *gen = sk_GENERAL_NAME_value(rev->issuer, i); | ||
| 435 | if (gen->type != GEN_DIRNAME) | ||
| 436 | continue; | ||
| 437 | if (!X509_NAME_cmp(nm, gen->d.directoryName)) | ||
| 438 | return 1; | ||
| 439 | } | ||
| 440 | return 0; | ||
| 441 | |||
| 442 | } | ||
| 443 | |||
| 444 | static int def_crl_lookup(X509_CRL *crl, | ||
| 445 | X509_REVOKED **ret, ASN1_INTEGER *serial, X509_NAME *issuer) | ||
| 446 | { | ||
| 447 | X509_REVOKED rtmp, *rev; | ||
| 448 | int idx; | ||
| 449 | rtmp.serialNumber = serial; | ||
| 450 | /* Sort revoked into serial number order if not already sorted. | ||
| 451 | * Do this under a lock to avoid race condition. | ||
| 452 | */ | ||
| 453 | if (!sk_X509_REVOKED_is_sorted(crl->crl->revoked)) | ||
| 454 | { | ||
| 455 | CRYPTO_w_lock(CRYPTO_LOCK_X509_CRL); | ||
| 456 | sk_X509_REVOKED_sort(crl->crl->revoked); | ||
| 457 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_CRL); | ||
| 458 | } | ||
| 459 | idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp); | ||
| 460 | if(idx < 0) | ||
| 461 | return 0; | ||
| 462 | /* Need to look for matching name */ | ||
| 463 | for(;idx < sk_X509_REVOKED_num(crl->crl->revoked); idx++) | ||
| 464 | { | ||
| 465 | rev = sk_X509_REVOKED_value(crl->crl->revoked, idx); | ||
| 466 | if (ASN1_INTEGER_cmp(rev->serialNumber, serial)) | ||
| 467 | return 0; | ||
| 468 | if (crl_revoked_issuer_match(crl, issuer, rev)) | ||
| 469 | { | ||
| 470 | if (ret) | ||
| 471 | *ret = rev; | ||
| 472 | if (rev->reason == CRL_REASON_REMOVE_FROM_CRL) | ||
| 473 | return 2; | ||
| 474 | return 1; | ||
| 475 | } | ||
| 476 | } | ||
| 477 | return 0; | ||
| 478 | } | ||
| 479 | |||
| 480 | void X509_CRL_set_default_method(const X509_CRL_METHOD *meth) | ||
| 481 | { | ||
| 482 | if (meth == NULL) | ||
| 483 | default_crl_method = &int_crl_meth; | ||
| 484 | else | ||
| 485 | default_crl_method = meth; | ||
| 486 | } | ||
| 487 | |||
| 488 | X509_CRL_METHOD *X509_CRL_METHOD_new( | ||
| 489 | int (*crl_init)(X509_CRL *crl), | ||
| 490 | int (*crl_free)(X509_CRL *crl), | ||
| 491 | int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret, | ||
| 492 | ASN1_INTEGER *ser, X509_NAME *issuer), | ||
| 493 | int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk)) | ||
| 494 | { | ||
| 495 | X509_CRL_METHOD *m; | ||
| 496 | m = OPENSSL_malloc(sizeof(X509_CRL_METHOD)); | ||
| 497 | if (!m) | ||
| 498 | return NULL; | ||
| 499 | m->crl_init = crl_init; | ||
| 500 | m->crl_free = crl_free; | ||
| 501 | m->crl_lookup = crl_lookup; | ||
| 502 | m->crl_verify = crl_verify; | ||
| 503 | m->flags = X509_CRL_METHOD_DYNAMIC; | ||
| 504 | return m; | ||
| 505 | } | ||
| 506 | |||
| 507 | void X509_CRL_METHOD_free(X509_CRL_METHOD *m) | ||
| 508 | { | ||
| 509 | if (!(m->flags & X509_CRL_METHOD_DYNAMIC)) | ||
| 510 | return; | ||
| 511 | OPENSSL_free(m); | ||
| 512 | } | ||
| 513 | |||
| 514 | void X509_CRL_set_meth_data(X509_CRL *crl, void *dat) | ||
| 515 | { | ||
| 516 | crl->meth_data = dat; | ||
| 517 | } | ||
| 518 | |||
| 519 | void *X509_CRL_get_meth_data(X509_CRL *crl) | ||
| 520 | { | ||
| 521 | return crl->meth_data; | ||
| 522 | } | ||
| 523 | |||
| 137 | IMPLEMENT_STACK_OF(X509_REVOKED) | 524 | IMPLEMENT_STACK_OF(X509_REVOKED) |
| 138 | IMPLEMENT_ASN1_SET_OF(X509_REVOKED) | 525 | IMPLEMENT_ASN1_SET_OF(X509_REVOKED) |
| 139 | IMPLEMENT_STACK_OF(X509_CRL) | 526 | IMPLEMENT_STACK_OF(X509_CRL) |
diff --git a/src/lib/libcrypto/asn1/x_long.c b/src/lib/libcrypto/asn1/x_long.c index bf35457c1f..75317418e1 100644 --- a/src/lib/libcrypto/asn1/x_long.c +++ b/src/lib/libcrypto/asn1/x_long.c | |||
| @@ -71,6 +71,7 @@ static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it); | |||
| 71 | 71 | ||
| 72 | static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); | 72 | static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); |
| 73 | static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); | 73 | static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); |
| 74 | static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx); | ||
| 74 | 75 | ||
| 75 | static ASN1_PRIMITIVE_FUNCS long_pf = { | 76 | static ASN1_PRIMITIVE_FUNCS long_pf = { |
| 76 | NULL, 0, | 77 | NULL, 0, |
| @@ -78,7 +79,8 @@ static ASN1_PRIMITIVE_FUNCS long_pf = { | |||
| 78 | long_free, | 79 | long_free, |
| 79 | long_free, /* Clear should set to initial value */ | 80 | long_free, /* Clear should set to initial value */ |
| 80 | long_c2i, | 81 | long_c2i, |
| 81 | long_i2c | 82 | long_i2c, |
| 83 | long_print | ||
| 82 | }; | 84 | }; |
| 83 | 85 | ||
| 84 | ASN1_ITEM_start(LONG) | 86 | ASN1_ITEM_start(LONG) |
| @@ -169,3 +171,9 @@ static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, | |||
| 169 | memcpy(cp, <mp, sizeof(long)); | 171 | memcpy(cp, <mp, sizeof(long)); |
| 170 | return 1; | 172 | return 1; |
| 171 | } | 173 | } |
| 174 | |||
| 175 | static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, | ||
| 176 | int indent, const ASN1_PCTX *pctx) | ||
| 177 | { | ||
| 178 | return BIO_printf(out, "%ld\n", *(long *)pval); | ||
| 179 | } | ||
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c index 04380abc3f..caa4409feb 100644 --- a/src/lib/libcrypto/asn1/x_name.c +++ b/src/lib/libcrypto/asn1/x_name.c | |||
| @@ -57,18 +57,36 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <ctype.h> | ||
| 60 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 61 | #include <openssl/asn1t.h> | 62 | #include <openssl/asn1t.h> |
| 62 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 64 | #include "asn1_locl.h" | ||
| 63 | 65 | ||
| 64 | static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it, | 66 | typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; |
| 65 | int tag, int aclass, char opt, ASN1_TLC *ctx); | 67 | DECLARE_STACK_OF(STACK_OF_X509_NAME_ENTRY) |
| 66 | 68 | ||
| 67 | static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); | 69 | static int x509_name_ex_d2i(ASN1_VALUE **val, |
| 70 | const unsigned char **in, long len, | ||
| 71 | const ASN1_ITEM *it, | ||
| 72 | int tag, int aclass, char opt, ASN1_TLC *ctx); | ||
| 73 | |||
| 74 | static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, | ||
| 75 | const ASN1_ITEM *it, int tag, int aclass); | ||
| 68 | static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it); | 76 | static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it); |
| 69 | static void x509_name_ex_free(ASN1_VALUE **val, const ASN1_ITEM *it); | 77 | static void x509_name_ex_free(ASN1_VALUE **val, const ASN1_ITEM *it); |
| 70 | 78 | ||
| 71 | static int x509_name_encode(X509_NAME *a); | 79 | static int x509_name_encode(X509_NAME *a); |
| 80 | static int x509_name_canon(X509_NAME *a); | ||
| 81 | static int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in); | ||
| 82 | static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname, | ||
| 83 | unsigned char **in); | ||
| 84 | |||
| 85 | |||
| 86 | static int x509_name_ex_print(BIO *out, ASN1_VALUE **pval, | ||
| 87 | int indent, | ||
| 88 | const char *fname, | ||
| 89 | const ASN1_PCTX *pctx); | ||
| 72 | 90 | ||
| 73 | ASN1_SEQUENCE(X509_NAME_ENTRY) = { | 91 | ASN1_SEQUENCE(X509_NAME_ENTRY) = { |
| 74 | ASN1_SIMPLE(X509_NAME_ENTRY, object, ASN1_OBJECT), | 92 | ASN1_SIMPLE(X509_NAME_ENTRY, object, ASN1_OBJECT), |
| @@ -102,7 +120,8 @@ const ASN1_EXTERN_FUNCS x509_name_ff = { | |||
| 102 | x509_name_ex_free, | 120 | x509_name_ex_free, |
| 103 | 0, /* Default clear behaviour is OK */ | 121 | 0, /* Default clear behaviour is OK */ |
| 104 | x509_name_ex_d2i, | 122 | x509_name_ex_d2i, |
| 105 | x509_name_ex_i2d | 123 | x509_name_ex_i2d, |
| 124 | x509_name_ex_print | ||
| 106 | }; | 125 | }; |
| 107 | 126 | ||
| 108 | IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff) | 127 | IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff) |
| @@ -118,6 +137,8 @@ static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it) | |||
| 118 | if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL) | 137 | if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL) |
| 119 | goto memerr; | 138 | goto memerr; |
| 120 | if((ret->bytes = BUF_MEM_new()) == NULL) goto memerr; | 139 | if((ret->bytes = BUF_MEM_new()) == NULL) goto memerr; |
| 140 | ret->canon_enc = NULL; | ||
| 141 | ret->canon_enclen = 0; | ||
| 121 | ret->modified=1; | 142 | ret->modified=1; |
| 122 | *val = (ASN1_VALUE *)ret; | 143 | *val = (ASN1_VALUE *)ret; |
| 123 | return 1; | 144 | return 1; |
| @@ -142,25 +163,19 @@ static void x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
| 142 | 163 | ||
| 143 | BUF_MEM_free(a->bytes); | 164 | BUF_MEM_free(a->bytes); |
| 144 | sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free); | 165 | sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free); |
| 166 | if (a->canon_enc) | ||
| 167 | OPENSSL_free(a->canon_enc); | ||
| 145 | OPENSSL_free(a); | 168 | OPENSSL_free(a); |
| 146 | *pval = NULL; | 169 | *pval = NULL; |
| 147 | } | 170 | } |
| 148 | 171 | ||
| 149 | /* Used with sk_pop_free() to free up the internal representation. | 172 | static int x509_name_ex_d2i(ASN1_VALUE **val, |
| 150 | * NB: we only free the STACK and not its contents because it is | 173 | const unsigned char **in, long len, const ASN1_ITEM *it, |
| 151 | * already present in the X509_NAME structure. | 174 | int tag, int aclass, char opt, ASN1_TLC *ctx) |
| 152 | */ | ||
| 153 | |||
| 154 | static void sk_internal_free(void *a) | ||
| 155 | { | ||
| 156 | sk_free(a); | ||
| 157 | } | ||
| 158 | |||
| 159 | static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it, | ||
| 160 | int tag, int aclass, char opt, ASN1_TLC *ctx) | ||
| 161 | { | 175 | { |
| 162 | const unsigned char *p = *in, *q; | 176 | const unsigned char *p = *in, *q; |
| 163 | union { STACK *s; ASN1_VALUE *a; } intname = {NULL}; | 177 | union { STACK_OF(STACK_OF_X509_NAME_ENTRY) *s; |
| 178 | ASN1_VALUE *a; } intname = {NULL}; | ||
| 164 | union { X509_NAME *x; ASN1_VALUE *a; } nm = {NULL}; | 179 | union { X509_NAME *x; ASN1_VALUE *a; } nm = {NULL}; |
| 165 | int i, j, ret; | 180 | int i, j, ret; |
| 166 | STACK_OF(X509_NAME_ENTRY) *entries; | 181 | STACK_OF(X509_NAME_ENTRY) *entries; |
| @@ -181,8 +196,8 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len | |||
| 181 | memcpy(nm.x->bytes->data, q, p - q); | 196 | memcpy(nm.x->bytes->data, q, p - q); |
| 182 | 197 | ||
| 183 | /* Convert internal representation to X509_NAME structure */ | 198 | /* Convert internal representation to X509_NAME structure */ |
| 184 | for(i = 0; i < sk_num(intname.s); i++) { | 199 | for(i = 0; i < sk_STACK_OF_X509_NAME_ENTRY_num(intname.s); i++) { |
| 185 | entries = (STACK_OF(X509_NAME_ENTRY) *)sk_value(intname.s, i); | 200 | entries = sk_STACK_OF_X509_NAME_ENTRY_value(intname.s, i); |
| 186 | for(j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) { | 201 | for(j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) { |
| 187 | entry = sk_X509_NAME_ENTRY_value(entries, j); | 202 | entry = sk_X509_NAME_ENTRY_value(entries, j); |
| 188 | entry->set = i; | 203 | entry->set = i; |
| @@ -191,7 +206,10 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len | |||
| 191 | } | 206 | } |
| 192 | sk_X509_NAME_ENTRY_free(entries); | 207 | sk_X509_NAME_ENTRY_free(entries); |
| 193 | } | 208 | } |
| 194 | sk_free(intname.s); | 209 | sk_STACK_OF_X509_NAME_ENTRY_free(intname.s); |
| 210 | ret = x509_name_canon(nm.x); | ||
| 211 | if (!ret) | ||
| 212 | goto err; | ||
| 195 | nm.x->modified = 0; | 213 | nm.x->modified = 0; |
| 196 | *val = nm.a; | 214 | *val = nm.a; |
| 197 | *in = p; | 215 | *in = p; |
| @@ -206,8 +224,12 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_IT | |||
| 206 | int ret; | 224 | int ret; |
| 207 | X509_NAME *a = (X509_NAME *)*val; | 225 | X509_NAME *a = (X509_NAME *)*val; |
| 208 | if(a->modified) { | 226 | if(a->modified) { |
| 209 | ret = x509_name_encode((X509_NAME *)a); | 227 | ret = x509_name_encode(a); |
| 210 | if(ret < 0) return ret; | 228 | if(ret < 0) |
| 229 | return ret; | ||
| 230 | ret = x509_name_canon(a); | ||
| 231 | if(ret < 0) | ||
| 232 | return ret; | ||
| 211 | } | 233 | } |
| 212 | ret = a->bytes->length; | 234 | ret = a->bytes->length; |
| 213 | if(out != NULL) { | 235 | if(out != NULL) { |
| @@ -217,22 +239,35 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_IT | |||
| 217 | return ret; | 239 | return ret; |
| 218 | } | 240 | } |
| 219 | 241 | ||
| 242 | static void local_sk_X509_NAME_ENTRY_free(STACK_OF(X509_NAME_ENTRY) *ne) | ||
| 243 | { | ||
| 244 | sk_X509_NAME_ENTRY_free(ne); | ||
| 245 | } | ||
| 246 | |||
| 247 | static void local_sk_X509_NAME_ENTRY_pop_free(STACK_OF(X509_NAME_ENTRY) *ne) | ||
| 248 | { | ||
| 249 | sk_X509_NAME_ENTRY_pop_free(ne, X509_NAME_ENTRY_free); | ||
| 250 | } | ||
| 251 | |||
| 220 | static int x509_name_encode(X509_NAME *a) | 252 | static int x509_name_encode(X509_NAME *a) |
| 221 | { | 253 | { |
| 222 | union { STACK *s; ASN1_VALUE *a; } intname = {NULL}; | 254 | union { STACK_OF(STACK_OF_X509_NAME_ENTRY) *s; |
| 255 | ASN1_VALUE *a; } intname = {NULL}; | ||
| 223 | int len; | 256 | int len; |
| 224 | unsigned char *p; | 257 | unsigned char *p; |
| 225 | STACK_OF(X509_NAME_ENTRY) *entries = NULL; | 258 | STACK_OF(X509_NAME_ENTRY) *entries = NULL; |
| 226 | X509_NAME_ENTRY *entry; | 259 | X509_NAME_ENTRY *entry; |
| 227 | int i, set = -1; | 260 | int i, set = -1; |
| 228 | intname.s = sk_new_null(); | 261 | intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null(); |
| 229 | if(!intname.s) goto memerr; | 262 | if(!intname.s) goto memerr; |
| 230 | for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { | 263 | for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { |
| 231 | entry = sk_X509_NAME_ENTRY_value(a->entries, i); | 264 | entry = sk_X509_NAME_ENTRY_value(a->entries, i); |
| 232 | if(entry->set != set) { | 265 | if(entry->set != set) { |
| 233 | entries = sk_X509_NAME_ENTRY_new_null(); | 266 | entries = sk_X509_NAME_ENTRY_new_null(); |
| 234 | if(!entries) goto memerr; | 267 | if(!entries) goto memerr; |
| 235 | if(!sk_push(intname.s, (char *)entries)) goto memerr; | 268 | if(!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s, |
| 269 | entries)) | ||
| 270 | goto memerr; | ||
| 236 | set = entry->set; | 271 | set = entry->set; |
| 237 | } | 272 | } |
| 238 | if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr; | 273 | if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr; |
| @@ -243,15 +278,222 @@ static int x509_name_encode(X509_NAME *a) | |||
| 243 | p=(unsigned char *)a->bytes->data; | 278 | p=(unsigned char *)a->bytes->data; |
| 244 | ASN1_item_ex_i2d(&intname.a, | 279 | ASN1_item_ex_i2d(&intname.a, |
| 245 | &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); | 280 | &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); |
| 246 | sk_pop_free(intname.s, sk_internal_free); | 281 | sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s, |
| 282 | local_sk_X509_NAME_ENTRY_free); | ||
| 247 | a->modified = 0; | 283 | a->modified = 0; |
| 248 | return len; | 284 | return len; |
| 249 | memerr: | 285 | memerr: |
| 250 | sk_pop_free(intname.s, sk_internal_free); | 286 | sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s, |
| 287 | local_sk_X509_NAME_ENTRY_free); | ||
| 251 | ASN1err(ASN1_F_X509_NAME_ENCODE, ERR_R_MALLOC_FAILURE); | 288 | ASN1err(ASN1_F_X509_NAME_ENCODE, ERR_R_MALLOC_FAILURE); |
| 252 | return -1; | 289 | return -1; |
| 253 | } | 290 | } |
| 254 | 291 | ||
| 292 | static int x509_name_ex_print(BIO *out, ASN1_VALUE **pval, | ||
| 293 | int indent, | ||
| 294 | const char *fname, | ||
| 295 | const ASN1_PCTX *pctx) | ||
| 296 | { | ||
| 297 | if (X509_NAME_print_ex(out, (X509_NAME *)*pval, | ||
| 298 | indent, pctx->nm_flags) <= 0) | ||
| 299 | return 0; | ||
| 300 | return 2; | ||
| 301 | } | ||
| 302 | |||
| 303 | /* This function generates the canonical encoding of the Name structure. | ||
| 304 | * In it all strings are converted to UTF8, leading, trailing and | ||
| 305 | * multiple spaces collapsed, converted to lower case and the leading | ||
| 306 | * SEQUENCE header removed. | ||
| 307 | * | ||
| 308 | * In future we could also normalize the UTF8 too. | ||
| 309 | * | ||
| 310 | * By doing this comparison of Name structures can be rapidly | ||
| 311 | * perfomed by just using memcmp() of the canonical encoding. | ||
| 312 | * By omitting the leading SEQUENCE name constraints of type | ||
| 313 | * dirName can also be checked with a simple memcmp(). | ||
| 314 | */ | ||
| 315 | |||
| 316 | static int x509_name_canon(X509_NAME *a) | ||
| 317 | { | ||
| 318 | unsigned char *p; | ||
| 319 | STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname = NULL; | ||
| 320 | STACK_OF(X509_NAME_ENTRY) *entries = NULL; | ||
| 321 | X509_NAME_ENTRY *entry, *tmpentry = NULL; | ||
| 322 | int i, set = -1, ret = 0; | ||
| 323 | |||
| 324 | if (a->canon_enc) | ||
| 325 | { | ||
| 326 | OPENSSL_free(a->canon_enc); | ||
| 327 | a->canon_enc = NULL; | ||
| 328 | } | ||
| 329 | /* Special case: empty X509_NAME => null encoding */ | ||
| 330 | if (sk_X509_NAME_ENTRY_num(a->entries) == 0) | ||
| 331 | { | ||
| 332 | a->canon_enclen = 0; | ||
| 333 | return 1; | ||
| 334 | } | ||
| 335 | intname = sk_STACK_OF_X509_NAME_ENTRY_new_null(); | ||
| 336 | if(!intname) | ||
| 337 | goto err; | ||
| 338 | for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) | ||
| 339 | { | ||
| 340 | entry = sk_X509_NAME_ENTRY_value(a->entries, i); | ||
| 341 | if(entry->set != set) | ||
| 342 | { | ||
| 343 | entries = sk_X509_NAME_ENTRY_new_null(); | ||
| 344 | if(!entries) | ||
| 345 | goto err; | ||
| 346 | if(!sk_STACK_OF_X509_NAME_ENTRY_push(intname, entries)) | ||
| 347 | goto err; | ||
| 348 | set = entry->set; | ||
| 349 | } | ||
| 350 | tmpentry = X509_NAME_ENTRY_new(); | ||
| 351 | tmpentry->object = OBJ_dup(entry->object); | ||
| 352 | if (!asn1_string_canon(tmpentry->value, entry->value)) | ||
| 353 | goto err; | ||
| 354 | if(!sk_X509_NAME_ENTRY_push(entries, tmpentry)) | ||
| 355 | goto err; | ||
| 356 | tmpentry = NULL; | ||
| 357 | } | ||
| 358 | |||
| 359 | /* Finally generate encoding */ | ||
| 360 | |||
| 361 | a->canon_enclen = i2d_name_canon(intname, NULL); | ||
| 362 | |||
| 363 | p = OPENSSL_malloc(a->canon_enclen); | ||
| 364 | |||
| 365 | if (!p) | ||
| 366 | goto err; | ||
| 367 | |||
| 368 | a->canon_enc = p; | ||
| 369 | |||
| 370 | i2d_name_canon(intname, &p); | ||
| 371 | |||
| 372 | ret = 1; | ||
| 373 | |||
| 374 | err: | ||
| 375 | |||
| 376 | if (tmpentry) | ||
| 377 | X509_NAME_ENTRY_free(tmpentry); | ||
| 378 | if (intname) | ||
| 379 | sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname, | ||
| 380 | local_sk_X509_NAME_ENTRY_pop_free); | ||
| 381 | return ret; | ||
| 382 | } | ||
| 383 | |||
| 384 | /* Bitmap of all the types of string that will be canonicalized. */ | ||
| 385 | |||
| 386 | #define ASN1_MASK_CANON \ | ||
| 387 | (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING \ | ||
| 388 | | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING \ | ||
| 389 | | B_ASN1_VISIBLESTRING) | ||
| 390 | |||
| 391 | |||
| 392 | static int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in) | ||
| 393 | { | ||
| 394 | unsigned char *to, *from; | ||
| 395 | int len, i; | ||
| 396 | |||
| 397 | /* If type not in bitmask just copy string across */ | ||
| 398 | if (!(ASN1_tag2bit(in->type) & ASN1_MASK_CANON)) | ||
| 399 | { | ||
| 400 | out->type = in->type; | ||
| 401 | if (!ASN1_STRING_set(out, in->data, in->length)) | ||
| 402 | return 0; | ||
| 403 | return 1; | ||
| 404 | } | ||
| 405 | |||
| 406 | out->type = V_ASN1_UTF8STRING; | ||
| 407 | out->length = ASN1_STRING_to_UTF8(&out->data, in); | ||
| 408 | if (out->length == -1) | ||
| 409 | return 0; | ||
| 410 | |||
| 411 | to = out->data; | ||
| 412 | from = to; | ||
| 413 | |||
| 414 | len = out->length; | ||
| 415 | |||
| 416 | /* Convert string in place to canonical form. | ||
| 417 | * Ultimately we may need to handle a wider range of characters | ||
| 418 | * but for now ignore anything with MSB set and rely on the | ||
| 419 | * isspace() and tolower() functions. | ||
| 420 | */ | ||
| 421 | |||
| 422 | /* Ignore leading spaces */ | ||
| 423 | while((len > 0) && !(*from & 0x80) && isspace(*from)) | ||
| 424 | { | ||
| 425 | from++; | ||
| 426 | len--; | ||
| 427 | } | ||
| 428 | |||
| 429 | to = from + len - 1; | ||
| 430 | |||
| 431 | /* Ignore trailing spaces */ | ||
| 432 | while ((len > 0) && !(*to & 0x80) && isspace(*to)) | ||
| 433 | { | ||
| 434 | to--; | ||
| 435 | len--; | ||
| 436 | } | ||
| 437 | |||
| 438 | to = out->data; | ||
| 439 | |||
| 440 | i = 0; | ||
| 441 | while(i < len) | ||
| 442 | { | ||
| 443 | /* If MSB set just copy across */ | ||
| 444 | if (*from & 0x80) | ||
| 445 | { | ||
| 446 | *to++ = *from++; | ||
| 447 | i++; | ||
| 448 | } | ||
| 449 | /* Collapse multiple spaces */ | ||
| 450 | else if (isspace(*from)) | ||
| 451 | { | ||
| 452 | /* Copy one space across */ | ||
| 453 | *to++ = ' '; | ||
| 454 | /* Ignore subsequent spaces. Note: don't need to | ||
| 455 | * check len here because we know the last | ||
| 456 | * character is a non-space so we can't overflow. | ||
| 457 | */ | ||
| 458 | do | ||
| 459 | { | ||
| 460 | from++; | ||
| 461 | i++; | ||
| 462 | } | ||
| 463 | while(!(*from & 0x80) && isspace(*from)); | ||
| 464 | } | ||
| 465 | else | ||
| 466 | { | ||
| 467 | *to++ = tolower(*from++); | ||
| 468 | i++; | ||
| 469 | } | ||
| 470 | } | ||
| 471 | |||
| 472 | out->length = to - out->data; | ||
| 473 | |||
| 474 | return 1; | ||
| 475 | |||
| 476 | } | ||
| 477 | |||
| 478 | static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) *_intname, | ||
| 479 | unsigned char **in) | ||
| 480 | { | ||
| 481 | int i, len, ltmp; | ||
| 482 | ASN1_VALUE *v; | ||
| 483 | STACK_OF(ASN1_VALUE) *intname = (STACK_OF(ASN1_VALUE) *)_intname; | ||
| 484 | |||
| 485 | len = 0; | ||
| 486 | for (i = 0; i < sk_ASN1_VALUE_num(intname); i++) | ||
| 487 | { | ||
| 488 | v = sk_ASN1_VALUE_value(intname, i); | ||
| 489 | ltmp = ASN1_item_ex_i2d(&v, in, | ||
| 490 | ASN1_ITEM_rptr(X509_NAME_ENTRIES), -1, -1); | ||
| 491 | if (ltmp < 0) | ||
| 492 | return ltmp; | ||
| 493 | len += ltmp; | ||
| 494 | } | ||
| 495 | return len; | ||
| 496 | } | ||
| 255 | 497 | ||
| 256 | int X509_NAME_set(X509_NAME **xn, X509_NAME *name) | 498 | int X509_NAME_set(X509_NAME **xn, X509_NAME *name) |
| 257 | { | 499 | { |
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index 91c2756116..d42b6a2c54 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c | |||
| @@ -60,6 +60,7 @@ | |||
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/asn1t.h> | 61 | #include <openssl/asn1t.h> |
| 62 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 63 | #include "asn1_locl.h" | ||
| 63 | #ifndef OPENSSL_NO_RSA | 64 | #ifndef OPENSSL_NO_RSA |
| 64 | #include <openssl/rsa.h> | 65 | #include <openssl/rsa.h> |
| 65 | #endif | 66 | #endif |
| @@ -68,7 +69,8 @@ | |||
| 68 | #endif | 69 | #endif |
| 69 | 70 | ||
| 70 | /* Minor tweak to operation: free up EVP_PKEY */ | 71 | /* Minor tweak to operation: free up EVP_PKEY */ |
| 71 | static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 72 | static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 73 | void *exarg) | ||
| 72 | { | 74 | { |
| 73 | if (operation == ASN1_OP_FREE_POST) | 75 | if (operation == ASN1_OP_FREE_POST) |
| 74 | { | 76 | { |
| @@ -88,169 +90,42 @@ IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) | |||
| 88 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) | 90 | int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) |
| 89 | { | 91 | { |
| 90 | X509_PUBKEY *pk=NULL; | 92 | X509_PUBKEY *pk=NULL; |
| 91 | X509_ALGOR *a; | ||
| 92 | ASN1_OBJECT *o; | ||
| 93 | unsigned char *s,*p = NULL; | ||
| 94 | int i; | ||
| 95 | 93 | ||
| 96 | if (x == NULL) return(0); | 94 | if (x == NULL) return(0); |
| 97 | 95 | ||
| 98 | if ((pk=X509_PUBKEY_new()) == NULL) goto err; | 96 | if ((pk=X509_PUBKEY_new()) == NULL) goto error; |
| 99 | a=pk->algor; | ||
| 100 | 97 | ||
| 101 | /* set the algorithm id */ | 98 | if (pkey->ameth) |
| 102 | if ((o=OBJ_nid2obj(pkey->type)) == NULL) goto err; | ||
| 103 | ASN1_OBJECT_free(a->algorithm); | ||
| 104 | a->algorithm=o; | ||
| 105 | |||
| 106 | /* Set the parameter list */ | ||
| 107 | if (!pkey->save_parameters || (pkey->type == EVP_PKEY_RSA)) | ||
| 108 | { | 99 | { |
| 109 | if ((a->parameter == NULL) || | 100 | if (pkey->ameth->pub_encode) |
| 110 | (a->parameter->type != V_ASN1_NULL)) | ||
| 111 | { | 101 | { |
| 112 | ASN1_TYPE_free(a->parameter); | 102 | if (!pkey->ameth->pub_encode(pk, pkey)) |
| 113 | if (!(a->parameter=ASN1_TYPE_new())) | ||
| 114 | { | 103 | { |
| 115 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | 104 | X509err(X509_F_X509_PUBKEY_SET, |
| 116 | goto err; | 105 | X509_R_PUBLIC_KEY_ENCODE_ERROR); |
| 106 | goto error; | ||
| 117 | } | 107 | } |
| 118 | a->parameter->type=V_ASN1_NULL; | ||
| 119 | } | ||
| 120 | } | ||
| 121 | #ifndef OPENSSL_NO_DSA | ||
| 122 | else if (pkey->type == EVP_PKEY_DSA) | ||
| 123 | { | ||
| 124 | unsigned char *pp; | ||
| 125 | DSA *dsa; | ||
| 126 | |||
| 127 | dsa=pkey->pkey.dsa; | ||
| 128 | dsa->write_params=0; | ||
| 129 | ASN1_TYPE_free(a->parameter); | ||
| 130 | if ((i=i2d_DSAparams(dsa,NULL)) <= 0) | ||
| 131 | goto err; | ||
| 132 | if (!(p=(unsigned char *)OPENSSL_malloc(i))) | ||
| 133 | { | ||
| 134 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
| 135 | goto err; | ||
| 136 | } | ||
| 137 | pp=p; | ||
| 138 | i2d_DSAparams(dsa,&pp); | ||
| 139 | if (!(a->parameter=ASN1_TYPE_new())) | ||
| 140 | { | ||
| 141 | OPENSSL_free(p); | ||
| 142 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
| 143 | goto err; | ||
| 144 | } | ||
| 145 | a->parameter->type=V_ASN1_SEQUENCE; | ||
| 146 | if (!(a->parameter->value.sequence=ASN1_STRING_new())) | ||
| 147 | { | ||
| 148 | OPENSSL_free(p); | ||
| 149 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
| 150 | goto err; | ||
| 151 | } | 108 | } |
| 152 | if (!ASN1_STRING_set(a->parameter->value.sequence,p,i)) | 109 | else |
| 153 | { | 110 | { |
| 154 | OPENSSL_free(p); | 111 | X509err(X509_F_X509_PUBKEY_SET, |
| 155 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | 112 | X509_R_METHOD_NOT_SUPPORTED); |
| 156 | goto err; | 113 | goto error; |
| 157 | } | 114 | } |
| 158 | OPENSSL_free(p); | ||
| 159 | } | 115 | } |
| 160 | #endif | 116 | else |
| 161 | #ifndef OPENSSL_NO_EC | ||
| 162 | else if (pkey->type == EVP_PKEY_EC) | ||
| 163 | { | ||
| 164 | int nid=0; | ||
| 165 | unsigned char *pp; | ||
| 166 | EC_KEY *ec_key; | ||
| 167 | const EC_GROUP *group; | ||
| 168 | |||
| 169 | ec_key = pkey->pkey.ec; | ||
| 170 | ASN1_TYPE_free(a->parameter); | ||
| 171 | |||
| 172 | if ((a->parameter = ASN1_TYPE_new()) == NULL) | ||
| 173 | { | ||
| 174 | X509err(X509_F_X509_PUBKEY_SET, ERR_R_ASN1_LIB); | ||
| 175 | goto err; | ||
| 176 | } | ||
| 177 | |||
| 178 | group = EC_KEY_get0_group(ec_key); | ||
| 179 | if (EC_GROUP_get_asn1_flag(group) | ||
| 180 | && (nid = EC_GROUP_get_curve_name(group))) | ||
| 181 | { | ||
| 182 | /* just set the OID */ | ||
| 183 | a->parameter->type = V_ASN1_OBJECT; | ||
| 184 | a->parameter->value.object = OBJ_nid2obj(nid); | ||
| 185 | } | ||
| 186 | else /* explicit parameters */ | ||
| 187 | { | ||
| 188 | if ((i = i2d_ECParameters(ec_key, NULL)) == 0) | ||
| 189 | { | ||
| 190 | X509err(X509_F_X509_PUBKEY_SET, ERR_R_EC_LIB); | ||
| 191 | goto err; | ||
| 192 | } | ||
| 193 | if ((p = (unsigned char *) OPENSSL_malloc(i)) == NULL) | ||
| 194 | { | ||
| 195 | X509err(X509_F_X509_PUBKEY_SET, ERR_R_MALLOC_FAILURE); | ||
| 196 | goto err; | ||
| 197 | } | ||
| 198 | pp = p; | ||
| 199 | if (!i2d_ECParameters(ec_key, &pp)) | ||
| 200 | { | ||
| 201 | X509err(X509_F_X509_PUBKEY_SET, ERR_R_EC_LIB); | ||
| 202 | OPENSSL_free(p); | ||
| 203 | goto err; | ||
| 204 | } | ||
| 205 | a->parameter->type = V_ASN1_SEQUENCE; | ||
| 206 | if ((a->parameter->value.sequence = ASN1_STRING_new()) == NULL) | ||
| 207 | { | ||
| 208 | X509err(X509_F_X509_PUBKEY_SET, ERR_R_ASN1_LIB); | ||
| 209 | OPENSSL_free(p); | ||
| 210 | goto err; | ||
| 211 | } | ||
| 212 | ASN1_STRING_set(a->parameter->value.sequence, p, i); | ||
| 213 | OPENSSL_free(p); | ||
| 214 | } | ||
| 215 | } | ||
| 216 | #endif | ||
| 217 | else if (1) | ||
| 218 | { | 117 | { |
| 219 | X509err(X509_F_X509_PUBKEY_SET,X509_R_UNSUPPORTED_ALGORITHM); | 118 | X509err(X509_F_X509_PUBKEY_SET,X509_R_UNSUPPORTED_ALGORITHM); |
| 220 | goto err; | 119 | goto error; |
| 221 | } | 120 | } |
| 222 | 121 | ||
| 223 | if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err; | ||
| 224 | if ((s=(unsigned char *)OPENSSL_malloc(i+1)) == NULL) | ||
| 225 | { | ||
| 226 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
| 227 | goto err; | ||
| 228 | } | ||
| 229 | p=s; | ||
| 230 | i2d_PublicKey(pkey,&p); | ||
| 231 | if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) | ||
| 232 | { | ||
| 233 | X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); | ||
| 234 | goto err; | ||
| 235 | } | ||
| 236 | /* Set number of unused bits to zero */ | ||
| 237 | pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); | ||
| 238 | pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT; | ||
| 239 | |||
| 240 | OPENSSL_free(s); | ||
| 241 | |||
| 242 | #if 0 | ||
| 243 | CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); | ||
| 244 | pk->pkey=pkey; | ||
| 245 | #endif | ||
| 246 | |||
| 247 | if (*x != NULL) | 122 | if (*x != NULL) |
| 248 | X509_PUBKEY_free(*x); | 123 | X509_PUBKEY_free(*x); |
| 249 | 124 | ||
| 250 | *x=pk; | 125 | *x=pk; |
| 251 | 126 | ||
| 252 | return 1; | 127 | return 1; |
| 253 | err: | 128 | error: |
| 254 | if (pk != NULL) X509_PUBKEY_free(pk); | 129 | if (pk != NULL) X509_PUBKEY_free(pk); |
| 255 | return 0; | 130 | return 0; |
| 256 | } | 131 | } |
| @@ -258,119 +133,50 @@ err: | |||
| 258 | EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) | 133 | EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) |
| 259 | { | 134 | { |
| 260 | EVP_PKEY *ret=NULL; | 135 | EVP_PKEY *ret=NULL; |
| 261 | long j; | ||
| 262 | int type; | ||
| 263 | const unsigned char *p; | ||
| 264 | #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA) | ||
| 265 | const unsigned char *cp; | ||
| 266 | X509_ALGOR *a; | ||
| 267 | #endif | ||
| 268 | 136 | ||
| 269 | if (key == NULL) goto err; | 137 | if (key == NULL) goto error; |
| 270 | 138 | ||
| 271 | if (key->pkey != NULL) | 139 | if (key->pkey != NULL) |
| 272 | { | 140 | { |
| 273 | CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY); | 141 | CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY); |
| 274 | return(key->pkey); | 142 | return key->pkey; |
| 275 | } | 143 | } |
| 276 | 144 | ||
| 277 | if (key->public_key == NULL) goto err; | 145 | if (key->public_key == NULL) goto error; |
| 278 | 146 | ||
| 279 | type=OBJ_obj2nid(key->algor->algorithm); | ||
| 280 | if ((ret = EVP_PKEY_new()) == NULL) | 147 | if ((ret = EVP_PKEY_new()) == NULL) |
| 281 | { | 148 | { |
| 282 | X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE); | 149 | X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE); |
| 283 | goto err; | 150 | goto error; |
| 284 | } | 151 | } |
| 285 | ret->type = EVP_PKEY_type(type); | ||
| 286 | |||
| 287 | /* the parameters must be extracted before the public key (ECDSA!) */ | ||
| 288 | |||
| 289 | #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA) | ||
| 290 | a=key->algor; | ||
| 291 | #endif | ||
| 292 | 152 | ||
| 293 | if (0) | 153 | if (!EVP_PKEY_set_type(ret, OBJ_obj2nid(key->algor->algorithm))) |
| 294 | ; | ||
| 295 | #ifndef OPENSSL_NO_DSA | ||
| 296 | else if (ret->type == EVP_PKEY_DSA) | ||
| 297 | { | 154 | { |
| 298 | if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE)) | 155 | X509err(X509_F_X509_PUBKEY_GET,X509_R_UNSUPPORTED_ALGORITHM); |
| 299 | { | 156 | goto error; |
| 300 | if ((ret->pkey.dsa = DSA_new()) == NULL) | ||
| 301 | { | ||
| 302 | X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE); | ||
| 303 | goto err; | ||
| 304 | } | ||
| 305 | ret->pkey.dsa->write_params=0; | ||
| 306 | cp=p=a->parameter->value.sequence->data; | ||
| 307 | j=a->parameter->value.sequence->length; | ||
| 308 | if (!d2i_DSAparams(&ret->pkey.dsa, &cp, (long)j)) | ||
| 309 | goto err; | ||
| 310 | } | ||
| 311 | ret->save_parameters=1; | ||
| 312 | } | 157 | } |
| 313 | #endif | 158 | |
| 314 | #ifndef OPENSSL_NO_EC | 159 | if (ret->ameth->pub_decode) |
| 315 | else if (ret->type == EVP_PKEY_EC) | ||
| 316 | { | 160 | { |
| 317 | if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE)) | 161 | if (!ret->ameth->pub_decode(ret, key)) |
| 318 | { | 162 | { |
| 319 | /* type == V_ASN1_SEQUENCE => we have explicit parameters | 163 | X509err(X509_F_X509_PUBKEY_GET, |
| 320 | * (e.g. parameters in the X9_62_EC_PARAMETERS-structure ) | 164 | X509_R_PUBLIC_KEY_DECODE_ERROR); |
| 321 | */ | 165 | goto error; |
| 322 | if ((ret->pkey.ec= EC_KEY_new()) == NULL) | ||
| 323 | { | ||
| 324 | X509err(X509_F_X509_PUBKEY_GET, | ||
| 325 | ERR_R_MALLOC_FAILURE); | ||
| 326 | goto err; | ||
| 327 | } | ||
| 328 | cp = p = a->parameter->value.sequence->data; | ||
| 329 | j = a->parameter->value.sequence->length; | ||
| 330 | if (!d2i_ECParameters(&ret->pkey.ec, &cp, (long)j)) | ||
| 331 | { | ||
| 332 | X509err(X509_F_X509_PUBKEY_GET, ERR_R_EC_LIB); | ||
| 333 | goto err; | ||
| 334 | } | ||
| 335 | } | ||
| 336 | else if (a->parameter && (a->parameter->type == V_ASN1_OBJECT)) | ||
| 337 | { | ||
| 338 | /* type == V_ASN1_OBJECT => the parameters are given | ||
| 339 | * by an asn1 OID | ||
| 340 | */ | ||
| 341 | EC_KEY *ec_key; | ||
| 342 | EC_GROUP *group; | ||
| 343 | |||
| 344 | if (ret->pkey.ec == NULL) | ||
| 345 | ret->pkey.ec = EC_KEY_new(); | ||
| 346 | ec_key = ret->pkey.ec; | ||
| 347 | if (ec_key == NULL) | ||
| 348 | goto err; | ||
| 349 | group = EC_GROUP_new_by_curve_name(OBJ_obj2nid(a->parameter->value.object)); | ||
| 350 | if (group == NULL) | ||
| 351 | goto err; | ||
| 352 | EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE); | ||
| 353 | if (EC_KEY_set_group(ec_key, group) == 0) | ||
| 354 | goto err; | ||
| 355 | EC_GROUP_free(group); | ||
| 356 | } | 166 | } |
| 357 | /* the case implicitlyCA is currently not implemented */ | ||
| 358 | ret->save_parameters = 1; | ||
| 359 | } | 167 | } |
| 360 | #endif | 168 | else |
| 361 | |||
| 362 | p=key->public_key->data; | ||
| 363 | j=key->public_key->length; | ||
| 364 | if (!d2i_PublicKey(type, &ret, &p, (long)j)) | ||
| 365 | { | 169 | { |
| 366 | X509err(X509_F_X509_PUBKEY_GET, X509_R_ERR_ASN1_LIB); | 170 | X509err(X509_F_X509_PUBKEY_GET, X509_R_METHOD_NOT_SUPPORTED); |
| 367 | goto err; | 171 | goto error; |
| 368 | } | 172 | } |
| 369 | 173 | ||
| 370 | key->pkey = ret; | 174 | key->pkey = ret; |
| 371 | CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY); | 175 | CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY); |
| 372 | return(ret); | 176 | |
| 373 | err: | 177 | return ret; |
| 178 | |||
| 179 | error: | ||
| 374 | if (ret != NULL) | 180 | if (ret != NULL) |
| 375 | EVP_PKEY_free(ret); | 181 | EVP_PKEY_free(ret); |
| 376 | return(NULL); | 182 | return(NULL); |
| @@ -529,3 +335,39 @@ int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp) | |||
| 529 | return(ret); | 335 | return(ret); |
| 530 | } | 336 | } |
| 531 | #endif | 337 | #endif |
| 338 | |||
| 339 | int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, | ||
| 340 | int ptype, void *pval, | ||
| 341 | unsigned char *penc, int penclen) | ||
| 342 | { | ||
| 343 | if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval)) | ||
| 344 | return 0; | ||
| 345 | if (penc) | ||
| 346 | { | ||
| 347 | if (pub->public_key->data) | ||
| 348 | OPENSSL_free(pub->public_key->data); | ||
| 349 | pub->public_key->data = penc; | ||
| 350 | pub->public_key->length = penclen; | ||
| 351 | /* Set number of unused bits to zero */ | ||
| 352 | pub->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); | ||
| 353 | pub->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT; | ||
| 354 | } | ||
| 355 | return 1; | ||
| 356 | } | ||
| 357 | |||
| 358 | int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, | ||
| 359 | const unsigned char **pk, int *ppklen, | ||
| 360 | X509_ALGOR **pa, | ||
| 361 | X509_PUBKEY *pub) | ||
| 362 | { | ||
| 363 | if (ppkalg) | ||
| 364 | *ppkalg = pub->algor->algorithm; | ||
| 365 | if (pk) | ||
| 366 | { | ||
| 367 | *pk = pub->public_key->data; | ||
| 368 | *ppklen = pub->public_key->length; | ||
| 369 | } | ||
| 370 | if (pa) | ||
| 371 | *pa = pub->algor; | ||
| 372 | return 1; | ||
| 373 | } | ||
diff --git a/src/lib/libcrypto/asn1/x_req.c b/src/lib/libcrypto/asn1/x_req.c index 59ca8ce329..d57555827c 100644 --- a/src/lib/libcrypto/asn1/x_req.c +++ b/src/lib/libcrypto/asn1/x_req.c | |||
| @@ -79,7 +79,8 @@ | |||
| 79 | * | 79 | * |
| 80 | */ | 80 | */ |
| 81 | 81 | ||
| 82 | static int rinf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 82 | static int rinf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 83 | void *exarg) | ||
| 83 | { | 84 | { |
| 84 | X509_REQ_INFO *rinf = (X509_REQ_INFO *)*pval; | 85 | X509_REQ_INFO *rinf = (X509_REQ_INFO *)*pval; |
| 85 | 86 | ||
diff --git a/src/lib/libcrypto/asn1/x_x509.c b/src/lib/libcrypto/asn1/x_x509.c index e118696625..dafd3cc921 100644 --- a/src/lib/libcrypto/asn1/x_x509.c +++ b/src/lib/libcrypto/asn1/x_x509.c | |||
| @@ -81,7 +81,8 @@ IMPLEMENT_ASN1_FUNCTIONS(X509_CINF) | |||
| 81 | 81 | ||
| 82 | extern void policy_cache_free(X509_POLICY_CACHE *cache); | 82 | extern void policy_cache_free(X509_POLICY_CACHE *cache); |
| 83 | 83 | ||
| 84 | static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 84 | static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 85 | void *exarg) | ||
| 85 | { | 86 | { |
| 86 | X509 *ret = (X509 *)*pval; | 87 | X509 *ret = (X509 *)*pval; |
| 87 | 88 | ||
| @@ -99,6 +100,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
| 99 | ret->rfc3779_asid = NULL; | 100 | ret->rfc3779_asid = NULL; |
| 100 | #endif | 101 | #endif |
| 101 | ret->aux = NULL; | 102 | ret->aux = NULL; |
| 103 | ret->crldp = NULL; | ||
| 102 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data); | 104 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data); |
| 103 | break; | 105 | break; |
| 104 | 106 | ||
| @@ -112,7 +114,10 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
| 112 | X509_CERT_AUX_free(ret->aux); | 114 | X509_CERT_AUX_free(ret->aux); |
| 113 | ASN1_OCTET_STRING_free(ret->skid); | 115 | ASN1_OCTET_STRING_free(ret->skid); |
| 114 | AUTHORITY_KEYID_free(ret->akid); | 116 | AUTHORITY_KEYID_free(ret->akid); |
| 117 | CRL_DIST_POINTS_free(ret->crldp); | ||
| 115 | policy_cache_free(ret->policy_cache); | 118 | policy_cache_free(ret->policy_cache); |
| 119 | GENERAL_NAMES_free(ret->altname); | ||
| 120 | NAME_CONSTRAINTS_free(ret->nc); | ||
| 116 | #ifndef OPENSSL_NO_RFC3779 | 121 | #ifndef OPENSSL_NO_RFC3779 |
| 117 | sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free); | 122 | sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free); |
| 118 | ASIdentifiers_free(ret->rfc3779_asid); | 123 | ASIdentifiers_free(ret->rfc3779_asid); |
| @@ -136,19 +141,6 @@ ASN1_SEQUENCE_ref(X509, x509_cb, CRYPTO_LOCK_X509) = { | |||
| 136 | IMPLEMENT_ASN1_FUNCTIONS(X509) | 141 | IMPLEMENT_ASN1_FUNCTIONS(X509) |
| 137 | IMPLEMENT_ASN1_DUP_FUNCTION(X509) | 142 | IMPLEMENT_ASN1_DUP_FUNCTION(X509) |
| 138 | 143 | ||
| 139 | static ASN1_METHOD meth= | ||
| 140 | { | ||
| 141 | (I2D_OF(void)) i2d_X509, | ||
| 142 | (D2I_OF(void)) d2i_X509, | ||
| 143 | (void *(*)(void))X509_new, | ||
| 144 | (void (*)(void *)) X509_free | ||
| 145 | }; | ||
| 146 | |||
| 147 | ASN1_METHOD *X509_asn1_meth(void) | ||
| 148 | { | ||
| 149 | return(&meth); | ||
| 150 | } | ||
| 151 | |||
| 152 | int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 144 | int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
| 153 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | 145 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) |
| 154 | { | 146 | { |
diff --git a/src/lib/libcrypto/bf/Makefile.ssl b/src/lib/libcrypto/bf/Makefile.ssl deleted file mode 100644 index be3ad77a05..0000000000 --- a/src/lib/libcrypto/bf/Makefile.ssl +++ /dev/null | |||
| @@ -1,115 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/blowfish/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= bf | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | BF_ENC= bf_enc.o | ||
| 21 | # or use | ||
| 22 | #DES_ENC= bx86-elf.o | ||
| 23 | |||
| 24 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 25 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 26 | |||
| 27 | GENERAL=Makefile | ||
| 28 | TEST=bftest.c | ||
| 29 | APPS= | ||
| 30 | |||
| 31 | LIB=$(TOP)/libcrypto.a | ||
| 32 | LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c | ||
| 33 | LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o | ||
| 34 | |||
| 35 | SRC= $(LIBSRC) | ||
| 36 | |||
| 37 | EXHEADER= blowfish.h | ||
| 38 | HEADER= bf_pi.h bf_locl.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 | # elf | ||
| 53 | asm/bx86-elf.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 54 | (cd asm; $(PERL) bf-586.pl elf $(CFLAGS) $(PROCESSOR) > bx86-elf.s) | ||
| 55 | |||
| 56 | # a.out | ||
| 57 | asm/bx86-out.o: asm/bx86unix.cpp | ||
| 58 | $(CPP) -DOUT asm/bx86unix.cpp | as -o asm/bx86-out.o | ||
| 59 | |||
| 60 | # bsdi | ||
| 61 | asm/bx86bsdi.o: asm/bx86unix.cpp | ||
| 62 | $(CPP) -DBSDI asm/bx86unix.cpp | sed 's/ :/:/' | as -o asm/bx86bsdi.o | ||
| 63 | |||
| 64 | asm/bx86unix.cpp: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 65 | (cd asm; $(PERL) bf-586.pl cpp $(PROCESSOR) >bx86unix.cpp) | ||
| 66 | |||
| 67 | files: | ||
| 68 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 69 | |||
| 70 | links: | ||
| 71 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 72 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 73 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 74 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 75 | |||
| 76 | install: installs | ||
| 77 | |||
| 78 | installs: | ||
| 79 | @for i in $(EXHEADER) ; \ | ||
| 80 | do \ | ||
| 81 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 82 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 83 | done; | ||
| 84 | |||
| 85 | tags: | ||
| 86 | ctags $(SRC) | ||
| 87 | |||
| 88 | tests: | ||
| 89 | |||
| 90 | lint: | ||
| 91 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 92 | |||
| 93 | depend: | ||
| 94 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 95 | |||
| 96 | dclean: | ||
| 97 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 98 | mv -f Makefile.new $(MAKEFILE) | ||
| 99 | |||
| 100 | clean: | ||
| 101 | rm -f asm/bx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 102 | |||
| 103 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 104 | |||
| 105 | bf_cfb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h | ||
| 106 | bf_cfb64.o: ../../include/openssl/opensslconf.h bf_cfb64.c bf_locl.h | ||
| 107 | bf_ecb.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h | ||
| 108 | bf_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 109 | bf_ecb.o: bf_ecb.c bf_locl.h | ||
| 110 | bf_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h | ||
| 111 | bf_enc.o: ../../include/openssl/opensslconf.h bf_enc.c bf_locl.h | ||
| 112 | bf_ofb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h | ||
| 113 | bf_ofb64.o: ../../include/openssl/opensslconf.h bf_locl.h bf_ofb64.c | ||
| 114 | bf_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h | ||
| 115 | 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 b5a4760d09..1f9b345aee 100644 --- a/src/lib/libcrypto/bf/asm/bf-586.pl +++ b/src/lib/libcrypto/bf/asm/bf-586.pl | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #!/usr/local/bin/perl | 1 | #!/usr/local/bin/perl |
| 2 | 2 | ||
| 3 | push(@INC,"perlasm","../../perlasm"); | 3 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 4 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 4 | require "x86asm.pl"; | 5 | require "x86asm.pl"; |
| 5 | require "cbc.pl"; | 6 | require "cbc.pl"; |
| 6 | 7 | ||
diff --git a/src/lib/libcrypto/bf/bf_skey.c b/src/lib/libcrypto/bf/bf_skey.c index 6ac2aeb279..3673cdee6e 100644 --- a/src/lib/libcrypto/bf/bf_skey.c +++ b/src/lib/libcrypto/bf/bf_skey.c | |||
| @@ -59,15 +59,10 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | #include <openssl/blowfish.h> | 61 | #include <openssl/blowfish.h> |
| 62 | #include <openssl/crypto.h> | ||
| 63 | #ifdef OPENSSL_FIPS | ||
| 64 | #include <openssl/fips.h> | ||
| 65 | #endif | ||
| 66 | |||
| 67 | #include "bf_locl.h" | 62 | #include "bf_locl.h" |
| 68 | #include "bf_pi.h" | 63 | #include "bf_pi.h" |
| 69 | 64 | ||
| 70 | FIPS_NON_FIPS_VCIPHER_Init(BF) | 65 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data) |
| 71 | { | 66 | { |
| 72 | int i; | 67 | int i; |
| 73 | BF_LONG *p,ri,in[2]; | 68 | BF_LONG *p,ri,in[2]; |
diff --git a/src/lib/libcrypto/bf/blowfish.h b/src/lib/libcrypto/bf/blowfish.h index d24ffccb65..b97e76f9a3 100644 --- a/src/lib/libcrypto/bf/blowfish.h +++ b/src/lib/libcrypto/bf/blowfish.h | |||
| @@ -79,7 +79,7 @@ extern "C" { | |||
| 79 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 79 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 80 | */ | 80 | */ |
| 81 | 81 | ||
| 82 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | 82 | #if defined(__LP32__) |
| 83 | #define BF_LONG unsigned long | 83 | #define BF_LONG unsigned long |
| 84 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | 84 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) |
| 85 | #define BF_LONG unsigned long | 85 | #define BF_LONG unsigned long |
| @@ -104,9 +104,7 @@ typedef struct bf_key_st | |||
| 104 | BF_LONG S[4*256]; | 104 | BF_LONG S[4*256]; |
| 105 | } BF_KEY; | 105 | } BF_KEY; |
| 106 | 106 | ||
| 107 | #ifdef OPENSSL_FIPS | 107 | |
| 108 | void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data); | ||
| 109 | #endif | ||
| 110 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); | 108 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); |
| 111 | 109 | ||
| 112 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); | 110 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); |
diff --git a/src/lib/libcrypto/bio/Makefile.ssl b/src/lib/libcrypto/bio/Makefile.ssl deleted file mode 100644 index d0b9e297b0..0000000000 --- a/src/lib/libcrypto/bio/Makefile.ssl +++ /dev/null | |||
| @@ -1,216 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/bio/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= bio | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= bio_lib.c bio_cb.c bio_err.c \ | ||
| 27 | bss_mem.c bss_null.c bss_fd.c \ | ||
| 28 | bss_file.c bss_sock.c bss_conn.c \ | ||
| 29 | bf_null.c bf_buff.c b_print.c b_dump.c \ | ||
| 30 | b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c | ||
| 31 | # bf_lbuf.c | ||
| 32 | LIBOBJ= bio_lib.o bio_cb.o bio_err.o \ | ||
| 33 | bss_mem.o bss_null.o bss_fd.o \ | ||
| 34 | bss_file.o bss_sock.o bss_conn.o \ | ||
| 35 | bf_null.o bf_buff.o b_print.o b_dump.o \ | ||
| 36 | b_sock.o bss_acpt.o bf_nbio.o bss_log.o bss_bio.o | ||
| 37 | # bf_lbuf.o | ||
| 38 | |||
| 39 | SRC= $(LIBSRC) | ||
| 40 | |||
| 41 | EXHEADER= bio.h | ||
| 42 | HEADER= bss_file.c $(EXHEADER) | ||
| 43 | |||
| 44 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 45 | |||
| 46 | top: | ||
| 47 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 48 | |||
| 49 | all: lib | ||
| 50 | |||
| 51 | lib: $(LIBOBJ) | ||
| 52 | $(AR) $(LIB) $(LIBOBJ) | ||
| 53 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 54 | @touch lib | ||
| 55 | |||
| 56 | files: | ||
| 57 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 58 | |||
| 59 | links: | ||
| 60 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 61 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 62 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 63 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 64 | |||
| 65 | install: | ||
| 66 | @for i in $(EXHEADER); \ | ||
| 67 | do \ | ||
| 68 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 69 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 70 | done; | ||
| 71 | |||
| 72 | tags: | ||
| 73 | ctags $(SRC) | ||
| 74 | |||
| 75 | tests: | ||
| 76 | |||
| 77 | lint: | ||
| 78 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 79 | |||
| 80 | depend: | ||
| 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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 89 | |||
| 90 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 91 | |||
| 92 | b_dump.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 93 | b_dump.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 94 | b_dump.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 95 | b_dump.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 96 | b_dump.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 97 | b_dump.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 98 | b_dump.o: ../cryptlib.h b_dump.c | ||
| 99 | b_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 100 | b_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 101 | b_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 102 | b_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 103 | b_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 104 | b_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 105 | b_print.o: ../cryptlib.h b_print.c | ||
| 106 | b_sock.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 107 | b_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 108 | b_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 109 | b_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 110 | b_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 111 | b_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 112 | b_sock.o: ../cryptlib.h b_sock.c | ||
| 113 | bf_buff.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 114 | bf_buff.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 115 | bf_buff.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 116 | bf_buff.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 117 | bf_buff.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 118 | bf_buff.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 119 | bf_buff.o: ../cryptlib.h bf_buff.c | ||
| 120 | bf_nbio.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 121 | bf_nbio.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 122 | bf_nbio.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 123 | bf_nbio.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 124 | bf_nbio.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 125 | bf_nbio.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 126 | bf_nbio.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 127 | bf_nbio.o: ../cryptlib.h bf_nbio.c | ||
| 128 | bf_null.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 129 | bf_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 130 | bf_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 131 | bf_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 132 | bf_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 133 | bf_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 134 | bf_null.o: ../cryptlib.h bf_null.c | ||
| 135 | bio_cb.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 136 | bio_cb.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 137 | bio_cb.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 138 | bio_cb.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 139 | bio_cb.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 140 | bio_cb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 141 | bio_cb.o: ../cryptlib.h bio_cb.c | ||
| 142 | bio_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 143 | bio_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 144 | bio_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 145 | bio_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 146 | bio_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 147 | bio_err.o: bio_err.c | ||
| 148 | bio_lib.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 149 | bio_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 150 | bio_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 151 | bio_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 152 | bio_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 153 | bio_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 154 | bio_lib.o: ../cryptlib.h bio_lib.c | ||
| 155 | bss_acpt.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 156 | bss_acpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 157 | bss_acpt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 158 | bss_acpt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 159 | bss_acpt.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 160 | bss_acpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 161 | bss_acpt.o: ../cryptlib.h bss_acpt.c | ||
| 162 | bss_bio.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 163 | bss_bio.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 164 | bss_bio.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 165 | bss_bio.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 166 | bss_bio.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 167 | bss_bio.o: ../../include/openssl/symhacks.h bss_bio.c | ||
| 168 | bss_conn.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 169 | bss_conn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 170 | bss_conn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 171 | bss_conn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 172 | bss_conn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 173 | bss_conn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 174 | bss_conn.o: ../cryptlib.h bss_conn.c | ||
| 175 | bss_fd.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 176 | bss_fd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 177 | bss_fd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 178 | bss_fd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 179 | bss_fd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 180 | bss_fd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 181 | bss_fd.o: ../cryptlib.h bss_fd.c | ||
| 182 | bss_file.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 183 | bss_file.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 184 | bss_file.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 185 | bss_file.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 186 | bss_file.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 187 | bss_file.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 188 | bss_file.o: ../cryptlib.h bss_file.c | ||
| 189 | bss_log.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 190 | bss_log.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 191 | bss_log.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 192 | bss_log.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 193 | bss_log.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 194 | bss_log.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 195 | bss_log.o: ../cryptlib.h bss_log.c | ||
| 196 | bss_mem.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 197 | bss_mem.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 198 | bss_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 199 | bss_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 200 | bss_mem.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 201 | bss_mem.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 202 | bss_mem.o: ../cryptlib.h bss_mem.c | ||
| 203 | bss_null.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 204 | bss_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 205 | bss_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 206 | bss_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 207 | bss_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 208 | bss_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 209 | bss_null.o: ../cryptlib.h bss_null.c | ||
| 210 | bss_sock.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 211 | bss_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 212 | bss_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 213 | bss_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 214 | bss_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 215 | bss_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 216 | bss_sock.o: ../cryptlib.h bss_sock.c | ||
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index 2fffcfc025..143a7cfefa 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c | |||
| @@ -115,8 +115,8 @@ | |||
| 115 | #define LDOUBLE double | 115 | #define LDOUBLE double |
| 116 | #endif | 116 | #endif |
| 117 | 117 | ||
| 118 | #if HAVE_LONG_LONG | 118 | #ifdef HAVE_LONG_LONG |
| 119 | # if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__) | 119 | # if defined(_WIN32) && !defined(__GNUC__) |
| 120 | # define LLONG __int64 | 120 | # define LLONG __int64 |
| 121 | # else | 121 | # else |
| 122 | # define LLONG long long | 122 | # define LLONG long long |
| @@ -808,7 +808,6 @@ int BIO_vprintf (BIO *bio, const char *format, va_list args) | |||
| 808 | } | 808 | } |
| 809 | 809 | ||
| 810 | /* As snprintf is not available everywhere, we provide our own implementation. | 810 | /* As snprintf is not available everywhere, we provide our own implementation. |
| 811 | * In case of overflow or error, this returns -1. | ||
| 812 | * This function has nothing to do with BIOs, but it's closely related | 811 | * This function has nothing to do with BIOs, but it's closely related |
| 813 | * to BIO_printf, and we need *some* name prefix ... | 812 | * to BIO_printf, and we need *some* name prefix ... |
| 814 | * (XXX the function should be renamed, but to what?) */ | 813 | * (XXX the function should be renamed, but to what?) */ |
| @@ -833,10 +832,10 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) | |||
| 833 | _dopr(&buf, NULL, &n, &retlen, &truncated, format, args); | 832 | _dopr(&buf, NULL, &n, &retlen, &truncated, format, args); |
| 834 | 833 | ||
| 835 | if (truncated) | 834 | if (truncated) |
| 836 | /* In case of truncation, return -1 unlike traditional snprintf. | 835 | /* In case of truncation, return -1 like traditional snprintf. |
| 837 | * (Current drafts for ISO/IEC 9899 say snprintf should return | 836 | * (Current drafts for ISO/IEC 9899 say snprintf should return |
| 838 | * the number of characters that would have been written, | 837 | * the number of characters that would have been written, |
| 839 | * had the buffer been large enough, as it did historically.) */ | 838 | * had the buffer been large enough.) */ |
| 840 | return -1; | 839 | return -1; |
| 841 | else | 840 | else |
| 842 | return (retlen <= INT_MAX) ? (int)retlen : -1; | 841 | return (retlen <= INT_MAX) ? (int)retlen : -1; |
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index ead477d8a2..12b0a53a81 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
| @@ -72,11 +72,9 @@ NETDB_DEFINE_CONTEXT | |||
| 72 | 72 | ||
| 73 | #ifndef OPENSSL_NO_SOCK | 73 | #ifndef OPENSSL_NO_SOCK |
| 74 | 74 | ||
| 75 | #ifdef OPENSSL_SYS_WIN16 | 75 | #include <openssl/dso.h> |
| 76 | #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ | 76 | |
| 77 | #else | ||
| 78 | #define SOCKET_PROTOCOL IPPROTO_TCP | 77 | #define SOCKET_PROTOCOL IPPROTO_TCP |
| 79 | #endif | ||
| 80 | 78 | ||
| 81 | #ifdef SO_MAXCONN | 79 | #ifdef SO_MAXCONN |
| 82 | #define MAX_LISTEN SO_MAXCONN | 80 | #define MAX_LISTEN SO_MAXCONN |
| @@ -90,6 +88,17 @@ NETDB_DEFINE_CONTEXT | |||
| 90 | static int wsa_init_done=0; | 88 | static int wsa_init_done=0; |
| 91 | #endif | 89 | #endif |
| 92 | 90 | ||
| 91 | /* | ||
| 92 | * WSAAPI specifier is required to make indirect calls to run-time | ||
| 93 | * linked WinSock 2 functions used in this module, to be specific | ||
| 94 | * [get|free]addrinfo and getnameinfo. This is because WinSock uses | ||
| 95 | * uses non-C calling convention, __stdcall vs. __cdecl, on x86 | ||
| 96 | * Windows. On non-WinSock platforms WSAAPI needs to be void. | ||
| 97 | */ | ||
| 98 | #ifndef WSAAPI | ||
| 99 | #define WSAAPI | ||
| 100 | #endif | ||
| 101 | |||
| 93 | #if 0 | 102 | #if 0 |
| 94 | static unsigned long BIO_ghbn_hits=0L; | 103 | static unsigned long BIO_ghbn_hits=0L; |
| 95 | static unsigned long BIO_ghbn_miss=0L; | 104 | static unsigned long BIO_ghbn_miss=0L; |
| @@ -226,6 +235,10 @@ int BIO_sock_error(int sock) | |||
| 226 | int j,i; | 235 | int j,i; |
| 227 | int size; | 236 | int size; |
| 228 | 237 | ||
| 238 | #if defined(OPENSSL_SYS_BEOS_R5) | ||
| 239 | return 0; | ||
| 240 | #endif | ||
| 241 | |||
| 229 | size=sizeof(int); | 242 | size=sizeof(int); |
| 230 | /* Note: under Windows the third parameter is of type (char *) | 243 | /* Note: under Windows the third parameter is of type (char *) |
| 231 | * whereas under other systems it is (void *) if you don't have | 244 | * whereas under other systems it is (void *) if you don't have |
| @@ -466,7 +479,12 @@ int BIO_sock_init(void) | |||
| 466 | 479 | ||
| 467 | wsa_init_done=1; | 480 | wsa_init_done=1; |
| 468 | memset(&wsa_state,0,sizeof(wsa_state)); | 481 | memset(&wsa_state,0,sizeof(wsa_state)); |
| 469 | if (WSAStartup(0x0101,&wsa_state)!=0) | 482 | /* Not making wsa_state available to the rest of the |
| 483 | * code is formally wrong. But the structures we use | ||
| 484 | * are [beleived to be] invariable among Winsock DLLs, | ||
| 485 | * while API availability is [expected to be] probed | ||
| 486 | * at run-time with DSO_global_lookup. */ | ||
| 487 | if (WSAStartup(0x0202,&wsa_state)!=0) | ||
| 470 | { | 488 | { |
| 471 | err=WSAGetLastError(); | 489 | err=WSAGetLastError(); |
| 472 | SYSerr(SYS_F_WSASTARTUP,err); | 490 | SYSerr(SYS_F_WSASTARTUP,err); |
| @@ -510,8 +528,8 @@ void BIO_sock_cleanup(void) | |||
| 510 | if (wsa_init_done) | 528 | if (wsa_init_done) |
| 511 | { | 529 | { |
| 512 | wsa_init_done=0; | 530 | wsa_init_done=0; |
| 513 | #ifndef OPENSSL_SYS_WINCE | 531 | #if 0 /* this call is claimed to be non-present in Winsock2 */ |
| 514 | WSACancelBlockingCall(); /* Winsock 1.1 specific */ | 532 | WSACancelBlockingCall(); |
| 515 | #endif | 533 | #endif |
| 516 | WSACleanup(); | 534 | WSACleanup(); |
| 517 | } | 535 | } |
| @@ -581,12 +599,18 @@ static int get_ip(const char *str, unsigned char ip[4]) | |||
| 581 | int BIO_get_accept_socket(char *host, int bind_mode) | 599 | int BIO_get_accept_socket(char *host, int bind_mode) |
| 582 | { | 600 | { |
| 583 | int ret=0; | 601 | int ret=0; |
| 584 | struct sockaddr_in server,client; | 602 | union { |
| 585 | int s=INVALID_SOCKET,cs; | 603 | struct sockaddr sa; |
| 604 | struct sockaddr_in sa_in; | ||
| 605 | #if OPENSSL_USE_IPV6 | ||
| 606 | struct sockaddr_in6 sa_in6; | ||
| 607 | #endif | ||
| 608 | } server,client; | ||
| 609 | int s=INVALID_SOCKET,cs,addrlen; | ||
| 586 | unsigned char ip[4]; | 610 | unsigned char ip[4]; |
| 587 | unsigned short port; | 611 | unsigned short port; |
| 588 | char *str=NULL,*e; | 612 | char *str=NULL,*e; |
| 589 | const char *h,*p; | 613 | char *h,*p; |
| 590 | unsigned long l; | 614 | unsigned long l; |
| 591 | int err_num; | 615 | int err_num; |
| 592 | 616 | ||
| @@ -600,8 +624,7 @@ int BIO_get_accept_socket(char *host, int bind_mode) | |||
| 600 | { | 624 | { |
| 601 | if (*e == ':') | 625 | if (*e == ':') |
| 602 | { | 626 | { |
| 603 | p= &(e[1]); | 627 | p=e; |
| 604 | *e='\0'; | ||
| 605 | } | 628 | } |
| 606 | else if (*e == '/') | 629 | else if (*e == '/') |
| 607 | { | 630 | { |
| @@ -609,21 +632,70 @@ int BIO_get_accept_socket(char *host, int bind_mode) | |||
| 609 | break; | 632 | break; |
| 610 | } | 633 | } |
| 611 | } | 634 | } |
| 612 | 635 | if (p) *p++='\0'; /* points at last ':', '::port' is special [see below] */ | |
| 613 | if (p == NULL) | 636 | else p=h,h=NULL; |
| 637 | |||
| 638 | #ifdef EAI_FAMILY | ||
| 639 | do { | ||
| 640 | static union { void *p; | ||
| 641 | int (WSAAPI *f)(const char *,const char *, | ||
| 642 | const struct addrinfo *, | ||
| 643 | struct addrinfo **); | ||
| 644 | } p_getaddrinfo = {NULL}; | ||
| 645 | static union { void *p; | ||
| 646 | void (WSAAPI *f)(struct addrinfo *); | ||
| 647 | } p_freeaddrinfo = {NULL}; | ||
| 648 | struct addrinfo *res,hint; | ||
| 649 | |||
| 650 | if (p_getaddrinfo.p==NULL) | ||
| 651 | { | ||
| 652 | if ((p_getaddrinfo.p=DSO_global_lookup("getaddrinfo"))==NULL || | ||
| 653 | (p_freeaddrinfo.p=DSO_global_lookup("freeaddrinfo"))==NULL) | ||
| 654 | p_getaddrinfo.p=(void*)-1; | ||
| 655 | } | ||
| 656 | if (p_getaddrinfo.p==(void *)-1) break; | ||
| 657 | |||
| 658 | /* '::port' enforces IPv6 wildcard listener. Some OSes, | ||
| 659 | * e.g. Solaris, default to IPv6 without any hint. Also | ||
| 660 | * note that commonly IPv6 wildchard socket can service | ||
| 661 | * IPv4 connections just as well... */ | ||
| 662 | memset(&hint,0,sizeof(hint)); | ||
| 663 | if (h) | ||
| 614 | { | 664 | { |
| 615 | p=h; | 665 | if (strchr(h,':')) |
| 616 | h="*"; | 666 | { |
| 667 | if (h[1]=='\0') h=NULL; | ||
| 668 | #if OPENSSL_USE_IPV6 | ||
| 669 | hint.ai_family = AF_INET6; | ||
| 670 | #else | ||
| 671 | h=NULL; | ||
| 672 | #endif | ||
| 673 | } | ||
| 674 | else if (h[0]=='*' && h[1]=='\0') | ||
| 675 | h=NULL; | ||
| 617 | } | 676 | } |
| 618 | 677 | ||
| 678 | if ((*p_getaddrinfo.f)(h,p,&hint,&res)) break; | ||
| 679 | |||
| 680 | addrlen = res->ai_addrlen<=sizeof(server) ? | ||
| 681 | res->ai_addrlen : | ||
| 682 | sizeof(server); | ||
| 683 | memcpy(&server, res->ai_addr, addrlen); | ||
| 684 | |||
| 685 | (*p_freeaddrinfo.f)(res); | ||
| 686 | goto again; | ||
| 687 | } while (0); | ||
| 688 | #endif | ||
| 689 | |||
| 619 | if (!BIO_get_port(p,&port)) goto err; | 690 | if (!BIO_get_port(p,&port)) goto err; |
| 620 | 691 | ||
| 621 | memset((char *)&server,0,sizeof(server)); | 692 | memset((char *)&server,0,sizeof(server)); |
| 622 | server.sin_family=AF_INET; | 693 | server.sa_in.sin_family=AF_INET; |
| 623 | server.sin_port=htons(port); | 694 | server.sa_in.sin_port=htons(port); |
| 695 | addrlen = sizeof(server.sa_in); | ||
| 624 | 696 | ||
| 625 | if (strcmp(h,"*") == 0) | 697 | if (h == NULL || strcmp(h,"*") == 0) |
| 626 | server.sin_addr.s_addr=INADDR_ANY; | 698 | server.sa_in.sin_addr.s_addr=INADDR_ANY; |
| 627 | else | 699 | else |
| 628 | { | 700 | { |
| 629 | if (!BIO_get_host_ip(h,&(ip[0]))) goto err; | 701 | if (!BIO_get_host_ip(h,&(ip[0]))) goto err; |
| @@ -632,11 +704,11 @@ int BIO_get_accept_socket(char *host, int bind_mode) | |||
| 632 | ((unsigned long)ip[1]<<16L)| | 704 | ((unsigned long)ip[1]<<16L)| |
| 633 | ((unsigned long)ip[2]<< 8L)| | 705 | ((unsigned long)ip[2]<< 8L)| |
| 634 | ((unsigned long)ip[3]); | 706 | ((unsigned long)ip[3]); |
| 635 | server.sin_addr.s_addr=htonl(l); | 707 | server.sa_in.sin_addr.s_addr=htonl(l); |
| 636 | } | 708 | } |
| 637 | 709 | ||
| 638 | again: | 710 | again: |
| 639 | s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); | 711 | s=socket(server.sa.sa_family,SOCK_STREAM,SOCKET_PROTOCOL); |
| 640 | if (s == INVALID_SOCKET) | 712 | if (s == INVALID_SOCKET) |
| 641 | { | 713 | { |
| 642 | SYSerr(SYS_F_SOCKET,get_last_socket_error()); | 714 | SYSerr(SYS_F_SOCKET,get_last_socket_error()); |
| @@ -654,22 +726,42 @@ again: | |||
| 654 | bind_mode=BIO_BIND_NORMAL; | 726 | bind_mode=BIO_BIND_NORMAL; |
| 655 | } | 727 | } |
| 656 | #endif | 728 | #endif |
| 657 | if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1) | 729 | if (bind(s,&server.sa,addrlen) == -1) |
| 658 | { | 730 | { |
| 659 | #ifdef SO_REUSEADDR | 731 | #ifdef SO_REUSEADDR |
| 660 | err_num=get_last_socket_error(); | 732 | err_num=get_last_socket_error(); |
| 661 | if ((bind_mode == BIO_BIND_REUSEADDR_IF_UNUSED) && | 733 | if ((bind_mode == BIO_BIND_REUSEADDR_IF_UNUSED) && |
| 734 | #ifdef OPENSSL_SYS_WINDOWS | ||
| 735 | /* Some versions of Windows define EADDRINUSE to | ||
| 736 | * a dummy value. | ||
| 737 | */ | ||
| 738 | (err_num == WSAEADDRINUSE)) | ||
| 739 | #else | ||
| 662 | (err_num == EADDRINUSE)) | 740 | (err_num == EADDRINUSE)) |
| 741 | #endif | ||
| 663 | { | 742 | { |
| 664 | memcpy((char *)&client,(char *)&server,sizeof(server)); | 743 | client = server; |
| 665 | if (strcmp(h,"*") == 0) | 744 | if (h == NULL || strcmp(h,"*") == 0) |
| 666 | client.sin_addr.s_addr=htonl(0x7F000001); | 745 | { |
| 667 | cs=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); | 746 | #if OPENSSL_USE_IPV6 |
| 747 | if (client.sa.sa_family == AF_INET6) | ||
| 748 | { | ||
| 749 | memset(&client.sa_in6.sin6_addr,0,sizeof(client.sa_in6.sin6_addr)); | ||
| 750 | client.sa_in6.sin6_addr.s6_addr[15]=1; | ||
| 751 | } | ||
| 752 | else | ||
| 753 | #endif | ||
| 754 | if (client.sa.sa_family == AF_INET) | ||
| 755 | { | ||
| 756 | client.sa_in.sin_addr.s_addr=htonl(0x7F000001); | ||
| 757 | } | ||
| 758 | else goto err; | ||
| 759 | } | ||
| 760 | cs=socket(client.sa.sa_family,SOCK_STREAM,SOCKET_PROTOCOL); | ||
| 668 | if (cs != INVALID_SOCKET) | 761 | if (cs != INVALID_SOCKET) |
| 669 | { | 762 | { |
| 670 | int ii; | 763 | int ii; |
| 671 | ii=connect(cs,(struct sockaddr *)&client, | 764 | ii=connect(cs,&client.sa,addrlen); |
| 672 | sizeof(client)); | ||
| 673 | closesocket(cs); | 765 | closesocket(cs); |
| 674 | if (ii == INVALID_SOCKET) | 766 | if (ii == INVALID_SOCKET) |
| 675 | { | 767 | { |
| @@ -708,20 +800,52 @@ err: | |||
| 708 | int BIO_accept(int sock, char **addr) | 800 | int BIO_accept(int sock, char **addr) |
| 709 | { | 801 | { |
| 710 | int ret=INVALID_SOCKET; | 802 | int ret=INVALID_SOCKET; |
| 711 | static struct sockaddr_in from; | ||
| 712 | unsigned long l; | 803 | unsigned long l; |
| 713 | unsigned short port; | 804 | unsigned short port; |
| 714 | int len; | ||
| 715 | char *p; | 805 | char *p; |
| 716 | 806 | ||
| 717 | memset((char *)&from,0,sizeof(from)); | 807 | struct { |
| 718 | len=sizeof(from); | 808 | /* |
| 719 | /* Note: under VMS with SOCKETSHR the fourth parameter is currently | 809 | * As for following union. Trouble is that there are platforms |
| 720 | * of type (int *) whereas under other systems it is (void *) if | 810 | * that have socklen_t and there are platforms that don't, on |
| 721 | * you don't have a cast it will choke the compiler: if you do | 811 | * some platforms socklen_t is int and on some size_t. So what |
| 722 | * have a cast then you can either go for (int *) or (void *). | 812 | * one can do? One can cook #ifdef spaghetti, which is nothing |
| 813 | * but masochistic. Or one can do union between int and size_t. | ||
| 814 | * One naturally does it primarily for 64-bit platforms where | ||
| 815 | * sizeof(int) != sizeof(size_t). But would it work? Note that | ||
| 816 | * if size_t member is initialized to 0, then later int member | ||
| 817 | * assignment naturally does the job on little-endian platforms | ||
| 818 | * regardless accept's expectations! What about big-endians? | ||
| 819 | * If accept expects int*, then it works, and if size_t*, then | ||
| 820 | * length value would appear as unreasonably large. But this | ||
| 821 | * won't prevent it from filling in the address structure. The | ||
| 822 | * trouble of course would be if accept returns more data than | ||
| 823 | * actual buffer can accomodate and overwrite stack... That's | ||
| 824 | * where early OPENSSL_assert comes into picture. Besides, the | ||
| 825 | * only 64-bit big-endian platform found so far that expects | ||
| 826 | * size_t* is HP-UX, where stack grows towards higher address. | ||
| 827 | * <appro> | ||
| 723 | */ | 828 | */ |
| 724 | ret=accept(sock,(struct sockaddr *)&from,(void *)&len); | 829 | union { size_t s; int i; } len; |
| 830 | union { | ||
| 831 | struct sockaddr sa; | ||
| 832 | struct sockaddr_in sa_in; | ||
| 833 | #if OPENSSL_USE_IPV6 | ||
| 834 | struct sockaddr_in6 sa_in6; | ||
| 835 | #endif | ||
| 836 | } from; | ||
| 837 | } sa; | ||
| 838 | |||
| 839 | sa.len.s=0; | ||
| 840 | sa.len.i=sizeof(sa.from); | ||
| 841 | memset(&sa.from,0,sizeof(sa.from)); | ||
| 842 | ret=accept(sock,&sa.from.sa,(void *)&sa.len); | ||
| 843 | if (sizeof(sa.len.i)!=sizeof(sa.len.s) && sa.len.i==0) | ||
| 844 | { | ||
| 845 | OPENSSL_assert(sa.len.s<=sizeof(sa.from)); | ||
| 846 | sa.len.i = (int)sa.len.s; | ||
| 847 | /* use sa.len.i from this point */ | ||
| 848 | } | ||
| 725 | if (ret == INVALID_SOCKET) | 849 | if (ret == INVALID_SOCKET) |
| 726 | { | 850 | { |
| 727 | if(BIO_sock_should_retry(ret)) return -2; | 851 | if(BIO_sock_should_retry(ret)) return -2; |
| @@ -732,8 +856,46 @@ int BIO_accept(int sock, char **addr) | |||
| 732 | 856 | ||
| 733 | if (addr == NULL) goto end; | 857 | if (addr == NULL) goto end; |
| 734 | 858 | ||
| 735 | l=ntohl(from.sin_addr.s_addr); | 859 | #ifdef EAI_FAMILY |
| 736 | port=ntohs(from.sin_port); | 860 | do { |
| 861 | char h[NI_MAXHOST],s[NI_MAXSERV]; | ||
| 862 | size_t nl; | ||
| 863 | static union { void *p; | ||
| 864 | int (WSAAPI *f)(const struct sockaddr *,size_t/*socklen_t*/, | ||
| 865 | char *,size_t,char *,size_t,int); | ||
| 866 | } p_getnameinfo = {NULL}; | ||
| 867 | /* 2nd argument to getnameinfo is specified to | ||
| 868 | * be socklen_t. Unfortunately there is a number | ||
| 869 | * of environments where socklen_t is not defined. | ||
| 870 | * As it's passed by value, it's safe to pass it | ||
| 871 | * as size_t... <appro> */ | ||
| 872 | |||
| 873 | if (p_getnameinfo.p==NULL) | ||
| 874 | { | ||
| 875 | if ((p_getnameinfo.p=DSO_global_lookup("getnameinfo"))==NULL) | ||
| 876 | p_getnameinfo.p=(void*)-1; | ||
| 877 | } | ||
| 878 | if (p_getnameinfo.p==(void *)-1) break; | ||
| 879 | |||
| 880 | if ((*p_getnameinfo.f)(&sa.from.sa,sa.len.i,h,sizeof(h),s,sizeof(s), | ||
| 881 | NI_NUMERICHOST|NI_NUMERICSERV)) break; | ||
| 882 | nl = strlen(h)+strlen(s)+2; | ||
| 883 | p = *addr; | ||
| 884 | if (p) { *p = '\0'; p = OPENSSL_realloc(p,nl); } | ||
| 885 | else { p = OPENSSL_malloc(nl); } | ||
| 886 | if (p==NULL) | ||
| 887 | { | ||
| 888 | BIOerr(BIO_F_BIO_ACCEPT,ERR_R_MALLOC_FAILURE); | ||
| 889 | goto end; | ||
| 890 | } | ||
| 891 | *addr = p; | ||
| 892 | BIO_snprintf(*addr,nl,"%s:%s",h,s); | ||
| 893 | goto end; | ||
| 894 | } while(0); | ||
| 895 | #endif | ||
| 896 | if (sa.from.sa.sa_family != AF_INET) goto end; | ||
| 897 | l=ntohl(sa.from.sa_in.sin_addr.s_addr); | ||
| 898 | port=ntohs(sa.from.sa_in.sin_port); | ||
| 737 | if (*addr == NULL) | 899 | if (*addr == NULL) |
| 738 | { | 900 | { |
| 739 | if ((p=OPENSSL_malloc(24)) == NULL) | 901 | if ((p=OPENSSL_malloc(24)) == NULL) |
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index cecb6a7207..152802fbdf 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
| @@ -95,6 +95,7 @@ extern "C" { | |||
| 95 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ | 95 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ |
| 96 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ | 96 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ |
| 97 | #define BIO_TYPE_DGRAM (21|0x0400|0x0100) | 97 | #define BIO_TYPE_DGRAM (21|0x0400|0x0100) |
| 98 | #define BIO_TYPE_ASN1 (22|0x0200) /* filter */ | ||
| 98 | #define BIO_TYPE_COMP (23|0x0200) /* filter */ | 99 | #define BIO_TYPE_COMP (23|0x0200) /* filter */ |
| 99 | 100 | ||
| 100 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ | 101 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ |
| @@ -156,8 +157,11 @@ extern "C" { | |||
| 156 | * previous write | 157 | * previous write |
| 157 | * operation */ | 158 | * operation */ |
| 158 | 159 | ||
| 160 | #define BIO_CTRL_DGRAM_GET_PEER 46 | ||
| 159 | #define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */ | 161 | #define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */ |
| 160 | 162 | ||
| 163 | #define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45 /* Next DTLS handshake timeout to | ||
| 164 | * adjust socket timeouts */ | ||
| 161 | 165 | ||
| 162 | /* modifiers */ | 166 | /* modifiers */ |
| 163 | #define BIO_FP_READ 0x02 | 167 | #define BIO_FP_READ 0x02 |
| @@ -262,7 +266,6 @@ int BIO_method_type(const BIO *b); | |||
| 262 | 266 | ||
| 263 | typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); | 267 | typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); |
| 264 | 268 | ||
| 265 | #ifndef OPENSSL_SYS_WIN16 | ||
| 266 | typedef struct bio_method_st | 269 | typedef struct bio_method_st |
| 267 | { | 270 | { |
| 268 | int type; | 271 | int type; |
| @@ -276,21 +279,6 @@ typedef struct bio_method_st | |||
| 276 | int (*destroy)(BIO *); | 279 | int (*destroy)(BIO *); |
| 277 | long (*callback_ctrl)(BIO *, int, bio_info_cb *); | 280 | long (*callback_ctrl)(BIO *, int, bio_info_cb *); |
| 278 | } BIO_METHOD; | 281 | } BIO_METHOD; |
| 279 | #else | ||
| 280 | typedef struct bio_method_st | ||
| 281 | { | ||
| 282 | int type; | ||
| 283 | const char *name; | ||
| 284 | int (_far *bwrite)(); | ||
| 285 | int (_far *bread)(); | ||
| 286 | int (_far *bputs)(); | ||
| 287 | int (_far *bgets)(); | ||
| 288 | long (_far *ctrl)(); | ||
| 289 | int (_far *create)(); | ||
| 290 | int (_far *destroy)(); | ||
| 291 | long (_far *callback_ctrl)(); | ||
| 292 | } BIO_METHOD; | ||
| 293 | #endif | ||
| 294 | 282 | ||
| 295 | struct bio_st | 283 | struct bio_st |
| 296 | { | 284 | { |
| @@ -331,6 +319,9 @@ typedef struct bio_f_buffer_ctx_struct | |||
| 331 | int obuf_off; /* write/read offset */ | 319 | int obuf_off; /* write/read offset */ |
| 332 | } BIO_F_BUFFER_CTX; | 320 | } BIO_F_BUFFER_CTX; |
| 333 | 321 | ||
| 322 | /* Prefix and suffix callback in ASN1 BIO */ | ||
| 323 | typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg); | ||
| 324 | |||
| 334 | /* connect BIO stuff */ | 325 | /* connect BIO stuff */ |
| 335 | #define BIO_CONN_S_BEFORE 1 | 326 | #define BIO_CONN_S_BEFORE 1 |
| 336 | #define BIO_CONN_S_GET_IP 2 | 327 | #define BIO_CONN_S_GET_IP 2 |
| @@ -393,6 +384,13 @@ typedef struct bio_f_buffer_ctx_struct | |||
| 393 | #define BIO_C_RESET_READ_REQUEST 147 | 384 | #define BIO_C_RESET_READ_REQUEST 147 |
| 394 | #define BIO_C_SET_MD_CTX 148 | 385 | #define BIO_C_SET_MD_CTX 148 |
| 395 | 386 | ||
| 387 | #define BIO_C_SET_PREFIX 149 | ||
| 388 | #define BIO_C_GET_PREFIX 150 | ||
| 389 | #define BIO_C_SET_SUFFIX 151 | ||
| 390 | #define BIO_C_GET_SUFFIX 152 | ||
| 391 | |||
| 392 | #define BIO_C_SET_EX_ARG 153 | ||
| 393 | #define BIO_C_GET_EX_ARG 154 | ||
| 396 | 394 | ||
| 397 | #define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) | 395 | #define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) |
| 398 | #define BIO_get_app_data(s) BIO_get_ex_data(s,0) | 396 | #define BIO_get_app_data(s) BIO_get_ex_data(s,0) |
| @@ -405,7 +403,7 @@ typedef struct bio_f_buffer_ctx_struct | |||
| 405 | #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) | 403 | #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) |
| 406 | #define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) | 404 | #define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) |
| 407 | #define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) | 405 | #define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) |
| 408 | #define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3) | 406 | #define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0) |
| 409 | 407 | ||
| 410 | 408 | ||
| 411 | #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) | 409 | #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) |
| @@ -414,7 +412,7 @@ typedef struct bio_f_buffer_ctx_struct | |||
| 414 | #define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) | 412 | #define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) |
| 415 | #define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) | 413 | #define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) |
| 416 | /* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ | 414 | /* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ |
| 417 | #define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL) | 415 | #define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?(void *)"a":NULL) |
| 418 | #define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) | 416 | #define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) |
| 419 | 417 | ||
| 420 | #define BIO_BIND_NORMAL 0 | 418 | #define BIO_BIND_NORMAL 0 |
| @@ -541,6 +539,8 @@ int BIO_ctrl_reset_read_request(BIO *b); | |||
| 541 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) | 539 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) |
| 542 | #define BIO_dgram_send_timedout(b) \ | 540 | #define BIO_dgram_send_timedout(b) \ |
| 543 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) | 541 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) |
| 542 | #define BIO_dgram_get_peer(b,peer) \ | ||
| 543 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)peer) | ||
| 544 | #define BIO_dgram_set_peer(b,peer) \ | 544 | #define BIO_dgram_set_peer(b,peer) \ |
| 545 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer) | 545 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer) |
| 546 | 546 | ||
| @@ -554,22 +554,21 @@ int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | |||
| 554 | unsigned long BIO_number_read(BIO *bio); | 554 | unsigned long BIO_number_read(BIO *bio); |
| 555 | unsigned long BIO_number_written(BIO *bio); | 555 | unsigned long BIO_number_written(BIO *bio); |
| 556 | 556 | ||
| 557 | /* For BIO_f_asn1() */ | ||
| 558 | int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, | ||
| 559 | asn1_ps_func *prefix_free); | ||
| 560 | int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, | ||
| 561 | asn1_ps_func **pprefix_free); | ||
| 562 | int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, | ||
| 563 | asn1_ps_func *suffix_free); | ||
| 564 | int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, | ||
| 565 | asn1_ps_func **psuffix_free); | ||
| 566 | |||
| 557 | # ifndef OPENSSL_NO_FP_API | 567 | # ifndef OPENSSL_NO_FP_API |
| 558 | # if defined(OPENSSL_SYS_WIN16) && defined(_WINDLL) | ||
| 559 | BIO_METHOD *BIO_s_file_internal(void); | ||
| 560 | BIO *BIO_new_file_internal(char *filename, char *mode); | ||
| 561 | BIO *BIO_new_fp_internal(FILE *stream, int close_flag); | ||
| 562 | # define BIO_s_file BIO_s_file_internal | ||
| 563 | # define BIO_new_file BIO_new_file_internal | ||
| 564 | # define BIO_new_fp BIO_new_fp_internal | ||
| 565 | # else /* FP_API */ | ||
| 566 | BIO_METHOD *BIO_s_file(void ); | 568 | BIO_METHOD *BIO_s_file(void ); |
| 567 | BIO *BIO_new_file(const char *filename, const char *mode); | 569 | BIO *BIO_new_file(const char *filename, const char *mode); |
| 568 | BIO *BIO_new_fp(FILE *stream, int close_flag); | 570 | BIO *BIO_new_fp(FILE *stream, int close_flag); |
| 569 | # define BIO_s_file_internal BIO_s_file | 571 | # define BIO_s_file_internal BIO_s_file |
| 570 | # define BIO_new_file_internal BIO_new_file | ||
| 571 | # define BIO_new_fp_internal BIO_s_file | ||
| 572 | # endif /* FP_API */ | ||
| 573 | # endif | 572 | # endif |
| 574 | BIO * BIO_new(BIO_METHOD *type); | 573 | BIO * BIO_new(BIO_METHOD *type); |
| 575 | int BIO_set(BIO *a,BIO_METHOD *type); | 574 | int BIO_set(BIO *a,BIO_METHOD *type); |
| @@ -598,13 +597,8 @@ int BIO_nread(BIO *bio, char **buf, int num); | |||
| 598 | int BIO_nwrite0(BIO *bio, char **buf); | 597 | int BIO_nwrite0(BIO *bio, char **buf); |
| 599 | int BIO_nwrite(BIO *bio, char **buf, int num); | 598 | int BIO_nwrite(BIO *bio, char **buf, int num); |
| 600 | 599 | ||
| 601 | #ifndef OPENSSL_SYS_WIN16 | ||
| 602 | long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, | 600 | long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, |
| 603 | long argl,long ret); | 601 | long argl,long ret); |
| 604 | #else | ||
| 605 | long _far _loadds BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, | ||
| 606 | long argl,long ret); | ||
| 607 | #endif | ||
| 608 | 602 | ||
| 609 | BIO_METHOD *BIO_s_mem(void); | 603 | BIO_METHOD *BIO_s_mem(void); |
| 610 | BIO *BIO_new_mem_buf(void *buf, int len); | 604 | BIO *BIO_new_mem_buf(void *buf, int len); |
diff --git a/src/lib/libcrypto/bio/bio_cb.c b/src/lib/libcrypto/bio/bio_cb.c index 6f4254a114..9bcbc321d9 100644 --- a/src/lib/libcrypto/bio/bio_cb.c +++ b/src/lib/libcrypto/bio/bio_cb.c | |||
| @@ -85,28 +85,32 @@ long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp, | |||
| 85 | break; | 85 | break; |
| 86 | case BIO_CB_READ: | 86 | case BIO_CB_READ: |
| 87 | if (bio->method->type & BIO_TYPE_DESCRIPTOR) | 87 | if (bio->method->type & BIO_TYPE_DESCRIPTOR) |
| 88 | BIO_snprintf(p,p_maxlen,"read(%d,%d) - %s fd=%d\n", | 88 | BIO_snprintf(p,p_maxlen,"read(%d,%lu) - %s fd=%d\n", |
| 89 | bio->num,argi,bio->method->name,bio->num); | 89 | bio->num,(unsigned long)argi, |
| 90 | bio->method->name,bio->num); | ||
| 90 | else | 91 | else |
| 91 | BIO_snprintf(p,p_maxlen,"read(%d,%d) - %s\n", | 92 | BIO_snprintf(p,p_maxlen,"read(%d,%lu) - %s\n", |
| 92 | bio->num,argi,bio->method->name); | 93 | bio->num,(unsigned long)argi, |
| 94 | bio->method->name); | ||
| 93 | break; | 95 | break; |
| 94 | case BIO_CB_WRITE: | 96 | case BIO_CB_WRITE: |
| 95 | if (bio->method->type & BIO_TYPE_DESCRIPTOR) | 97 | if (bio->method->type & BIO_TYPE_DESCRIPTOR) |
| 96 | BIO_snprintf(p,p_maxlen,"write(%d,%d) - %s fd=%d\n", | 98 | BIO_snprintf(p,p_maxlen,"write(%d,%lu) - %s fd=%d\n", |
| 97 | bio->num,argi,bio->method->name,bio->num); | 99 | bio->num,(unsigned long)argi, |
| 100 | bio->method->name,bio->num); | ||
| 98 | else | 101 | else |
| 99 | BIO_snprintf(p,p_maxlen,"write(%d,%d) - %s\n", | 102 | BIO_snprintf(p,p_maxlen,"write(%d,%lu) - %s\n", |
| 100 | bio->num,argi,bio->method->name); | 103 | bio->num,(unsigned long)argi, |
| 104 | bio->method->name); | ||
| 101 | break; | 105 | break; |
| 102 | case BIO_CB_PUTS: | 106 | case BIO_CB_PUTS: |
| 103 | BIO_snprintf(p,p_maxlen,"puts() - %s\n",bio->method->name); | 107 | BIO_snprintf(p,p_maxlen,"puts() - %s\n",bio->method->name); |
| 104 | break; | 108 | break; |
| 105 | case BIO_CB_GETS: | 109 | case BIO_CB_GETS: |
| 106 | BIO_snprintf(p,p_maxlen,"gets(%d) - %s\n",argi,bio->method->name); | 110 | BIO_snprintf(p,p_maxlen,"gets(%lu) - %s\n",(unsigned long)argi,bio->method->name); |
| 107 | break; | 111 | break; |
| 108 | case BIO_CB_CTRL: | 112 | case BIO_CB_CTRL: |
| 109 | BIO_snprintf(p,p_maxlen,"ctrl(%d) - %s\n",argi,bio->method->name); | 113 | BIO_snprintf(p,p_maxlen,"ctrl(%lu) - %s\n",(unsigned long)argi,bio->method->name); |
| 110 | break; | 114 | break; |
| 111 | case BIO_CB_RETURN|BIO_CB_READ: | 115 | case BIO_CB_RETURN|BIO_CB_READ: |
| 112 | BIO_snprintf(p,p_maxlen,"read return %ld\n",ret); | 116 | BIO_snprintf(p,p_maxlen,"read return %ld\n",ret); |
diff --git a/src/lib/libcrypto/bio/bio_err.c b/src/lib/libcrypto/bio/bio_err.c index 6603f1c74d..a224edd5a0 100644 --- a/src/lib/libcrypto/bio/bio_err.c +++ b/src/lib/libcrypto/bio/bio_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/bio/bio_err.c */ | 1 | /* crypto/bio/bio_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 3f52ae953c..77f4de9c32 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
| @@ -429,7 +429,7 @@ BIO *BIO_push(BIO *b, BIO *bio) | |||
| 429 | if (bio != NULL) | 429 | if (bio != NULL) |
| 430 | bio->prev_bio=lb; | 430 | bio->prev_bio=lb; |
| 431 | /* called to do internal processing */ | 431 | /* called to do internal processing */ |
| 432 | BIO_ctrl(b,BIO_CTRL_PUSH,0,NULL); | 432 | BIO_ctrl(b,BIO_CTRL_PUSH,0,lb); |
| 433 | return(b); | 433 | return(b); |
| 434 | } | 434 | } |
| 435 | 435 | ||
| @@ -441,7 +441,7 @@ BIO *BIO_pop(BIO *b) | |||
| 441 | if (b == NULL) return(NULL); | 441 | if (b == NULL) return(NULL); |
| 442 | ret=b->next_bio; | 442 | ret=b->next_bio; |
| 443 | 443 | ||
| 444 | BIO_ctrl(b,BIO_CTRL_POP,0,NULL); | 444 | BIO_ctrl(b,BIO_CTRL_POP,0,b); |
| 445 | 445 | ||
| 446 | if (b->prev_bio != NULL) | 446 | if (b->prev_bio != NULL) |
| 447 | b->prev_bio->next_bio=b->next_bio; | 447 | b->prev_bio->next_bio=b->next_bio; |
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c index d090b7272f..826f761143 100644 --- a/src/lib/libcrypto/bio/bss_acpt.c +++ b/src/lib/libcrypto/bio/bss_acpt.c | |||
| @@ -100,8 +100,8 @@ static int acpt_new(BIO *h); | |||
| 100 | static int acpt_free(BIO *data); | 100 | static int acpt_free(BIO *data); |
| 101 | static int acpt_state(BIO *b, BIO_ACCEPT *c); | 101 | static int acpt_state(BIO *b, BIO_ACCEPT *c); |
| 102 | static void acpt_close_socket(BIO *data); | 102 | static void acpt_close_socket(BIO *data); |
| 103 | BIO_ACCEPT *BIO_ACCEPT_new(void ); | 103 | static BIO_ACCEPT *BIO_ACCEPT_new(void ); |
| 104 | void BIO_ACCEPT_free(BIO_ACCEPT *a); | 104 | static void BIO_ACCEPT_free(BIO_ACCEPT *a); |
| 105 | 105 | ||
| 106 | #define ACPT_S_BEFORE 1 | 106 | #define ACPT_S_BEFORE 1 |
| 107 | #define ACPT_S_GET_ACCEPT_SOCKET 2 | 107 | #define ACPT_S_GET_ACCEPT_SOCKET 2 |
| @@ -141,7 +141,7 @@ static int acpt_new(BIO *bi) | |||
| 141 | return(1); | 141 | return(1); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | BIO_ACCEPT *BIO_ACCEPT_new(void) | 144 | static BIO_ACCEPT *BIO_ACCEPT_new(void) |
| 145 | { | 145 | { |
| 146 | BIO_ACCEPT *ret; | 146 | BIO_ACCEPT *ret; |
| 147 | 147 | ||
| @@ -154,7 +154,7 @@ BIO_ACCEPT *BIO_ACCEPT_new(void) | |||
| 154 | return(ret); | 154 | return(ret); |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | void BIO_ACCEPT_free(BIO_ACCEPT *a) | 157 | static void BIO_ACCEPT_free(BIO_ACCEPT *a) |
| 158 | { | 158 | { |
| 159 | if(a == NULL) | 159 | if(a == NULL) |
| 160 | return; | 160 | return; |
diff --git a/src/lib/libcrypto/bio/bss_dgram.c b/src/lib/libcrypto/bio/bss_dgram.c index c3da6dc82f..eb7e365467 100644 --- a/src/lib/libcrypto/bio/bss_dgram.c +++ b/src/lib/libcrypto/bio/bss_dgram.c | |||
| @@ -66,7 +66,13 @@ | |||
| 66 | 66 | ||
| 67 | #include <openssl/bio.h> | 67 | #include <openssl/bio.h> |
| 68 | 68 | ||
| 69 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) | ||
| 70 | #include <sys/timeb.h> | ||
| 71 | #endif | ||
| 72 | |||
| 73 | #ifdef OPENSSL_SYS_LINUX | ||
| 69 | #define IP_MTU 14 /* linux is lame */ | 74 | #define IP_MTU 14 /* linux is lame */ |
| 75 | #endif | ||
| 70 | 76 | ||
| 71 | #ifdef WATT32 | 77 | #ifdef WATT32 |
| 72 | #define sock_write SockWrite /* Watt-32 uses same names */ | 78 | #define sock_write SockWrite /* Watt-32 uses same names */ |
| @@ -84,6 +90,8 @@ static int dgram_clear(BIO *bio); | |||
| 84 | 90 | ||
| 85 | static int BIO_dgram_should_retry(int s); | 91 | static int BIO_dgram_should_retry(int s); |
| 86 | 92 | ||
| 93 | static void get_current_time(struct timeval *t); | ||
| 94 | |||
| 87 | static BIO_METHOD methods_dgramp= | 95 | static BIO_METHOD methods_dgramp= |
| 88 | { | 96 | { |
| 89 | BIO_TYPE_DGRAM, | 97 | BIO_TYPE_DGRAM, |
| @@ -100,10 +108,18 @@ static BIO_METHOD methods_dgramp= | |||
| 100 | 108 | ||
| 101 | typedef struct bio_dgram_data_st | 109 | typedef struct bio_dgram_data_st |
| 102 | { | 110 | { |
| 103 | struct sockaddr peer; | 111 | union { |
| 112 | struct sockaddr sa; | ||
| 113 | struct sockaddr_in sa_in; | ||
| 114 | #if OPENSSL_USE_IPV6 | ||
| 115 | struct sockaddr_in6 sa_in6; | ||
| 116 | #endif | ||
| 117 | } peer; | ||
| 104 | unsigned int connected; | 118 | unsigned int connected; |
| 105 | unsigned int _errno; | 119 | unsigned int _errno; |
| 106 | unsigned int mtu; | 120 | unsigned int mtu; |
| 121 | struct timeval next_timeout; | ||
| 122 | struct timeval socket_timeout; | ||
| 107 | } bio_dgram_data; | 123 | } bio_dgram_data; |
| 108 | 124 | ||
| 109 | BIO_METHOD *BIO_s_datagram(void) | 125 | BIO_METHOD *BIO_s_datagram(void) |
| @@ -165,31 +181,140 @@ static int dgram_clear(BIO *a) | |||
| 165 | } | 181 | } |
| 166 | return(1); | 182 | return(1); |
| 167 | } | 183 | } |
| 168 | 184 | ||
| 185 | static void dgram_adjust_rcv_timeout(BIO *b) | ||
| 186 | { | ||
| 187 | #if defined(SO_RCVTIMEO) | ||
| 188 | bio_dgram_data *data = (bio_dgram_data *)b->ptr; | ||
| 189 | int sz = sizeof(int); | ||
| 190 | |||
| 191 | /* Is a timer active? */ | ||
| 192 | if (data->next_timeout.tv_sec > 0 || data->next_timeout.tv_usec > 0) | ||
| 193 | { | ||
| 194 | struct timeval timenow, timeleft; | ||
| 195 | |||
| 196 | /* Read current socket timeout */ | ||
| 197 | #ifdef OPENSSL_SYS_WINDOWS | ||
| 198 | int timeout; | ||
| 199 | if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, | ||
| 200 | (void*)&timeout, &sz) < 0) | ||
| 201 | { perror("getsockopt"); } | ||
| 202 | else | ||
| 203 | { | ||
| 204 | data->socket_timeout.tv_sec = timeout / 1000; | ||
| 205 | data->socket_timeout.tv_usec = (timeout % 1000) * 1000; | ||
| 206 | } | ||
| 207 | #else | ||
| 208 | if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, | ||
| 209 | &(data->socket_timeout), (void *)&sz) < 0) | ||
| 210 | { perror("getsockopt"); } | ||
| 211 | #endif | ||
| 212 | |||
| 213 | /* Get current time */ | ||
| 214 | get_current_time(&timenow); | ||
| 215 | |||
| 216 | /* Calculate time left until timer expires */ | ||
| 217 | memcpy(&timeleft, &(data->next_timeout), sizeof(struct timeval)); | ||
| 218 | timeleft.tv_sec -= timenow.tv_sec; | ||
| 219 | timeleft.tv_usec -= timenow.tv_usec; | ||
| 220 | if (timeleft.tv_usec < 0) | ||
| 221 | { | ||
| 222 | timeleft.tv_sec--; | ||
| 223 | timeleft.tv_usec += 1000000; | ||
| 224 | } | ||
| 225 | |||
| 226 | if (timeleft.tv_sec < 0) | ||
| 227 | { | ||
| 228 | timeleft.tv_sec = 0; | ||
| 229 | timeleft.tv_usec = 1; | ||
| 230 | } | ||
| 231 | |||
| 232 | /* Adjust socket timeout if next handhake message timer | ||
| 233 | * will expire earlier. | ||
| 234 | */ | ||
| 235 | if ((data->socket_timeout.tv_sec == 0 && data->socket_timeout.tv_usec == 0) || | ||
| 236 | (data->socket_timeout.tv_sec > timeleft.tv_sec) || | ||
| 237 | (data->socket_timeout.tv_sec == timeleft.tv_sec && | ||
| 238 | data->socket_timeout.tv_usec >= timeleft.tv_usec)) | ||
| 239 | { | ||
| 240 | #ifdef OPENSSL_SYS_WINDOWS | ||
| 241 | timeout = timeleft.tv_sec * 1000 + timeleft.tv_usec / 1000; | ||
| 242 | if (setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, | ||
| 243 | (void*)&timeout, sizeof(timeout)) < 0) | ||
| 244 | { perror("setsockopt"); } | ||
| 245 | #else | ||
| 246 | if ( setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, &timeleft, | ||
| 247 | sizeof(struct timeval)) < 0) | ||
| 248 | { perror("setsockopt"); } | ||
| 249 | #endif | ||
| 250 | } | ||
| 251 | } | ||
| 252 | #endif | ||
| 253 | } | ||
| 254 | |||
| 255 | static void dgram_reset_rcv_timeout(BIO *b) | ||
| 256 | { | ||
| 257 | #if defined(SO_RCVTIMEO) | ||
| 258 | bio_dgram_data *data = (bio_dgram_data *)b->ptr; | ||
| 259 | |||
| 260 | /* Is a timer active? */ | ||
| 261 | if (data->next_timeout.tv_sec > 0 || data->next_timeout.tv_usec > 0) | ||
| 262 | { | ||
| 263 | #ifdef OPENSSL_SYS_WINDOWS | ||
| 264 | int timeout = data->socket_timeout.tv_sec * 1000 + | ||
| 265 | data->socket_timeout.tv_usec / 1000; | ||
| 266 | if (setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, | ||
| 267 | (void*)&timeout, sizeof(timeout)) < 0) | ||
| 268 | { perror("setsockopt"); } | ||
| 269 | #else | ||
| 270 | if ( setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, &(data->socket_timeout), | ||
| 271 | sizeof(struct timeval)) < 0) | ||
| 272 | { perror("setsockopt"); } | ||
| 273 | #endif | ||
| 274 | } | ||
| 275 | #endif | ||
| 276 | } | ||
| 277 | |||
| 169 | static int dgram_read(BIO *b, char *out, int outl) | 278 | static int dgram_read(BIO *b, char *out, int outl) |
| 170 | { | 279 | { |
| 171 | int ret=0; | 280 | int ret=0; |
| 172 | bio_dgram_data *data = (bio_dgram_data *)b->ptr; | 281 | bio_dgram_data *data = (bio_dgram_data *)b->ptr; |
| 173 | 282 | ||
| 174 | struct sockaddr peer; | 283 | struct { |
| 175 | int peerlen = sizeof(peer); | 284 | /* |
| 285 | * See commentary in b_sock.c. <appro> | ||
| 286 | */ | ||
| 287 | union { size_t s; int i; } len; | ||
| 288 | union { | ||
| 289 | struct sockaddr sa; | ||
| 290 | struct sockaddr_in sa_in; | ||
| 291 | #if OPENSSL_USE_IPV6 | ||
| 292 | struct sockaddr_in6 sa_in6; | ||
| 293 | #endif | ||
| 294 | } peer; | ||
| 295 | } sa; | ||
| 296 | |||
| 297 | sa.len.s=0; | ||
| 298 | sa.len.i=sizeof(sa.peer); | ||
| 176 | 299 | ||
| 177 | if (out != NULL) | 300 | if (out != NULL) |
| 178 | { | 301 | { |
| 179 | clear_socket_error(); | 302 | clear_socket_error(); |
| 180 | memset(&peer, 0x00, peerlen); | 303 | memset(&sa.peer, 0x00, sizeof(sa.peer)); |
| 181 | /* Last arg in recvfrom is signed on some platforms and | 304 | dgram_adjust_rcv_timeout(b); |
| 182 | * unsigned on others. It is of type socklen_t on some | 305 | ret=recvfrom(b->num,out,outl,0,&sa.peer.sa,(void *)&sa.len); |
| 183 | * but this is not universal. Cast to (void *) to avoid | 306 | if (sizeof(sa.len.i)!=sizeof(sa.len.s) && sa.len.i==0) |
| 184 | * compiler warnings. | 307 | { |
| 185 | */ | 308 | OPENSSL_assert(sa.len.s<=sizeof(sa.peer)); |
| 186 | ret=recvfrom(b->num,out,outl,0,&peer,(void *)&peerlen); | 309 | sa.len.i = (int)sa.len.s; |
| 310 | } | ||
| 311 | dgram_reset_rcv_timeout(b); | ||
| 187 | 312 | ||
| 188 | if ( ! data->connected && ret > 0) | 313 | if ( ! data->connected && ret >= 0) |
| 189 | BIO_ctrl(b, BIO_CTRL_DGRAM_CONNECT, 0, &peer); | 314 | BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, &sa.peer); |
| 190 | 315 | ||
| 191 | BIO_clear_retry_flags(b); | 316 | BIO_clear_retry_flags(b); |
| 192 | if (ret <= 0) | 317 | if (ret < 0) |
| 193 | { | 318 | { |
| 194 | if (BIO_dgram_should_retry(ret)) | 319 | if (BIO_dgram_should_retry(ret)) |
| 195 | { | 320 | { |
| @@ -207,19 +332,29 @@ static int dgram_write(BIO *b, const char *in, int inl) | |||
| 207 | bio_dgram_data *data = (bio_dgram_data *)b->ptr; | 332 | bio_dgram_data *data = (bio_dgram_data *)b->ptr; |
| 208 | clear_socket_error(); | 333 | clear_socket_error(); |
| 209 | 334 | ||
| 210 | if ( data->connected ) | 335 | if ( data->connected ) |
| 211 | ret=writesocket(b->num,in,inl); | 336 | ret=writesocket(b->num,in,inl); |
| 212 | else | 337 | else |
| 338 | { | ||
| 339 | int peerlen = sizeof(data->peer); | ||
| 340 | |||
| 341 | if (data->peer.sa.sa_family == AF_INET) | ||
| 342 | peerlen = sizeof(data->peer.sa_in); | ||
| 343 | #if OPENSSL_USE_IVP6 | ||
| 344 | else if (data->peer.sa.sa_family == AF_INET6) | ||
| 345 | peerlen = sizeof(data->peer.sa_in6); | ||
| 346 | #endif | ||
| 213 | #if defined(NETWARE_CLIB) && defined(NETWARE_BSDSOCK) | 347 | #if defined(NETWARE_CLIB) && defined(NETWARE_BSDSOCK) |
| 214 | ret=sendto(b->num, (char *)in, inl, 0, &data->peer, sizeof(data->peer)); | 348 | ret=sendto(b->num, (char *)in, inl, 0, &data->peer.sa, peerlen); |
| 215 | #else | 349 | #else |
| 216 | ret=sendto(b->num, in, inl, 0, &data->peer, sizeof(data->peer)); | 350 | ret=sendto(b->num, in, inl, 0, &data->peer.sa, peerlen); |
| 217 | #endif | 351 | #endif |
| 352 | } | ||
| 218 | 353 | ||
| 219 | BIO_clear_retry_flags(b); | 354 | BIO_clear_retry_flags(b); |
| 220 | if (ret <= 0) | 355 | if (ret <= 0) |
| 221 | { | 356 | { |
| 222 | if (BIO_sock_should_retry(ret)) | 357 | if (BIO_dgram_should_retry(ret)) |
| 223 | { | 358 | { |
| 224 | BIO_set_retry_write(b); | 359 | BIO_set_retry_write(b); |
| 225 | data->_errno = get_last_socket_error(); | 360 | data->_errno = get_last_socket_error(); |
| @@ -240,8 +375,20 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 240 | int *ip; | 375 | int *ip; |
| 241 | struct sockaddr *to = NULL; | 376 | struct sockaddr *to = NULL; |
| 242 | bio_dgram_data *data = NULL; | 377 | bio_dgram_data *data = NULL; |
| 378 | #if defined(IP_MTU_DISCOVER) || defined(IP_MTU) | ||
| 243 | long sockopt_val = 0; | 379 | long sockopt_val = 0; |
| 244 | unsigned int sockopt_len = 0; | 380 | unsigned int sockopt_len = 0; |
| 381 | #endif | ||
| 382 | #ifdef OPENSSL_SYS_LINUX | ||
| 383 | socklen_t addr_len; | ||
| 384 | union { | ||
| 385 | struct sockaddr sa; | ||
| 386 | struct sockaddr_in s4; | ||
| 387 | #if OPENSSL_USE_IPV6 | ||
| 388 | struct sockaddr_in6 s6; | ||
| 389 | #endif | ||
| 390 | } addr; | ||
| 391 | #endif | ||
| 245 | 392 | ||
| 246 | data = (bio_dgram_data *)b->ptr; | 393 | data = (bio_dgram_data *)b->ptr; |
| 247 | 394 | ||
| @@ -294,30 +441,110 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 294 | else | 441 | else |
| 295 | { | 442 | { |
| 296 | #endif | 443 | #endif |
| 297 | memcpy(&(data->peer),to, sizeof(struct sockaddr)); | 444 | switch (to->sa_family) |
| 445 | { | ||
| 446 | case AF_INET: | ||
| 447 | memcpy(&data->peer,to,sizeof(data->peer.sa_in)); | ||
| 448 | break; | ||
| 449 | #if OPENSSL_USE_IPV6 | ||
| 450 | case AF_INET6: | ||
| 451 | memcpy(&data->peer,to,sizeof(data->peer.sa_in6)); | ||
| 452 | break; | ||
| 453 | #endif | ||
| 454 | default: | ||
| 455 | memcpy(&data->peer,to,sizeof(data->peer.sa)); | ||
| 456 | break; | ||
| 457 | } | ||
| 298 | #if 0 | 458 | #if 0 |
| 299 | } | 459 | } |
| 300 | #endif | 460 | #endif |
| 301 | break; | 461 | break; |
| 302 | /* (Linux)kernel sets DF bit on outgoing IP packets */ | 462 | /* (Linux)kernel sets DF bit on outgoing IP packets */ |
| 303 | #ifdef IP_MTU_DISCOVER | ||
| 304 | case BIO_CTRL_DGRAM_MTU_DISCOVER: | 463 | case BIO_CTRL_DGRAM_MTU_DISCOVER: |
| 305 | sockopt_val = IP_PMTUDISC_DO; | 464 | #ifdef OPENSSL_SYS_LINUX |
| 306 | if ((ret = setsockopt(b->num, IPPROTO_IP, IP_MTU_DISCOVER, | 465 | addr_len = (socklen_t)sizeof(addr); |
| 307 | &sockopt_val, sizeof(sockopt_val))) < 0) | 466 | memset((void *)&addr, 0, sizeof(addr)); |
| 308 | perror("setsockopt"); | 467 | if (getsockname(b->num, &addr.sa, &addr_len) < 0) |
| 468 | { | ||
| 469 | ret = 0; | ||
| 470 | break; | ||
| 471 | } | ||
| 472 | sockopt_len = sizeof(sockopt_val); | ||
| 473 | switch (addr.sa.sa_family) | ||
| 474 | { | ||
| 475 | case AF_INET: | ||
| 476 | sockopt_val = IP_PMTUDISC_DO; | ||
| 477 | if ((ret = setsockopt(b->num, IPPROTO_IP, IP_MTU_DISCOVER, | ||
| 478 | &sockopt_val, sizeof(sockopt_val))) < 0) | ||
| 479 | perror("setsockopt"); | ||
| 480 | break; | ||
| 481 | #if OPENSSL_USE_IPV6 && defined(IPV6_MTU_DISCOVER) | ||
| 482 | case AF_INET6: | ||
| 483 | sockopt_val = IPV6_PMTUDISC_DO; | ||
| 484 | if ((ret = setsockopt(b->num, IPPROTO_IPV6, IPV6_MTU_DISCOVER, | ||
| 485 | &sockopt_val, sizeof(sockopt_val))) < 0) | ||
| 486 | perror("setsockopt"); | ||
| 487 | break; | ||
| 488 | #endif | ||
| 489 | default: | ||
| 490 | ret = -1; | ||
| 491 | break; | ||
| 492 | } | ||
| 493 | ret = -1; | ||
| 494 | #else | ||
| 309 | break; | 495 | break; |
| 310 | #endif | 496 | #endif |
| 311 | case BIO_CTRL_DGRAM_QUERY_MTU: | 497 | case BIO_CTRL_DGRAM_QUERY_MTU: |
| 312 | sockopt_len = sizeof(sockopt_val); | 498 | #ifdef OPENSSL_SYS_LINUX |
| 313 | if ((ret = getsockopt(b->num, IPPROTO_IP, IP_MTU, (void *)&sockopt_val, | 499 | addr_len = (socklen_t)sizeof(addr); |
| 314 | &sockopt_len)) < 0 || sockopt_val < 0) | 500 | memset((void *)&addr, 0, sizeof(addr)); |
| 315 | { ret = 0; } | 501 | if (getsockname(b->num, &addr.sa, &addr_len) < 0) |
| 316 | else | 502 | { |
| 503 | ret = 0; | ||
| 504 | break; | ||
| 505 | } | ||
| 506 | sockopt_len = sizeof(sockopt_val); | ||
| 507 | switch (addr.sa.sa_family) | ||
| 317 | { | 508 | { |
| 318 | data->mtu = sockopt_val; | 509 | case AF_INET: |
| 319 | ret = data->mtu; | 510 | if ((ret = getsockopt(b->num, IPPROTO_IP, IP_MTU, (void *)&sockopt_val, |
| 511 | &sockopt_len)) < 0 || sockopt_val < 0) | ||
| 512 | { | ||
| 513 | ret = 0; | ||
| 514 | } | ||
| 515 | else | ||
| 516 | { | ||
| 517 | /* we assume that the transport protocol is UDP and no | ||
| 518 | * IP options are used. | ||
| 519 | */ | ||
| 520 | data->mtu = sockopt_val - 8 - 20; | ||
| 521 | ret = data->mtu; | ||
| 522 | } | ||
| 523 | break; | ||
| 524 | #if OPENSSL_USE_IPV6 && defined(IPV6_MTU) | ||
| 525 | case AF_INET6: | ||
| 526 | if ((ret = getsockopt(b->num, IPPROTO_IPV6, IPV6_MTU, (void *)&sockopt_val, | ||
| 527 | &sockopt_len)) < 0 || sockopt_val < 0) | ||
| 528 | { | ||
| 529 | ret = 0; | ||
| 530 | } | ||
| 531 | else | ||
| 532 | { | ||
| 533 | /* we assume that the transport protocol is UDP and no | ||
| 534 | * IPV6 options are used. | ||
| 535 | */ | ||
| 536 | data->mtu = sockopt_val - 8 - 40; | ||
| 537 | ret = data->mtu; | ||
| 538 | } | ||
| 539 | break; | ||
| 540 | #endif | ||
| 541 | default: | ||
| 542 | ret = 0; | ||
| 543 | break; | ||
| 320 | } | 544 | } |
| 545 | #else | ||
| 546 | ret = 0; | ||
| 547 | #endif | ||
| 321 | break; | 548 | break; |
| 322 | case BIO_CTRL_DGRAM_GET_MTU: | 549 | case BIO_CTRL_DGRAM_GET_MTU: |
| 323 | return data->mtu; | 550 | return data->mtu; |
| @@ -332,19 +559,66 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 332 | if ( to != NULL) | 559 | if ( to != NULL) |
| 333 | { | 560 | { |
| 334 | data->connected = 1; | 561 | data->connected = 1; |
| 335 | memcpy(&(data->peer),to, sizeof(struct sockaddr)); | 562 | switch (to->sa_family) |
| 563 | { | ||
| 564 | case AF_INET: | ||
| 565 | memcpy(&data->peer,to,sizeof(data->peer.sa_in)); | ||
| 566 | break; | ||
| 567 | #if OPENSSL_USE_IPV6 | ||
| 568 | case AF_INET6: | ||
| 569 | memcpy(&data->peer,to,sizeof(data->peer.sa_in6)); | ||
| 570 | break; | ||
| 571 | #endif | ||
| 572 | default: | ||
| 573 | memcpy(&data->peer,to,sizeof(data->peer.sa)); | ||
| 574 | break; | ||
| 575 | } | ||
| 336 | } | 576 | } |
| 337 | else | 577 | else |
| 338 | { | 578 | { |
| 339 | data->connected = 0; | 579 | data->connected = 0; |
| 340 | memset(&(data->peer), 0x00, sizeof(struct sockaddr)); | 580 | memset(&(data->peer), 0x00, sizeof(data->peer)); |
| 341 | } | 581 | } |
| 342 | break; | 582 | break; |
| 343 | case BIO_CTRL_DGRAM_SET_PEER: | 583 | case BIO_CTRL_DGRAM_GET_PEER: |
| 344 | to = (struct sockaddr *) ptr; | 584 | switch (data->peer.sa.sa_family) |
| 345 | 585 | { | |
| 346 | memcpy(&(data->peer), to, sizeof(struct sockaddr)); | 586 | case AF_INET: |
| 347 | break; | 587 | ret=sizeof(data->peer.sa_in); |
| 588 | break; | ||
| 589 | #if OPENSSL_USE_IPV6 | ||
| 590 | case AF_INET6: | ||
| 591 | ret=sizeof(data->peer.sa_in6); | ||
| 592 | break; | ||
| 593 | #endif | ||
| 594 | default: | ||
| 595 | ret=sizeof(data->peer.sa); | ||
| 596 | break; | ||
| 597 | } | ||
| 598 | if (num==0 || num>ret) | ||
| 599 | num=ret; | ||
| 600 | memcpy(ptr,&data->peer,(ret=num)); | ||
| 601 | break; | ||
| 602 | case BIO_CTRL_DGRAM_SET_PEER: | ||
| 603 | to = (struct sockaddr *) ptr; | ||
| 604 | switch (to->sa_family) | ||
| 605 | { | ||
| 606 | case AF_INET: | ||
| 607 | memcpy(&data->peer,to,sizeof(data->peer.sa_in)); | ||
| 608 | break; | ||
| 609 | #if OPENSSL_USE_IPV6 | ||
| 610 | case AF_INET6: | ||
| 611 | memcpy(&data->peer,to,sizeof(data->peer.sa_in6)); | ||
| 612 | break; | ||
| 613 | #endif | ||
| 614 | default: | ||
| 615 | memcpy(&data->peer,to,sizeof(data->peer.sa)); | ||
| 616 | break; | ||
| 617 | } | ||
| 618 | break; | ||
| 619 | case BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT: | ||
| 620 | memcpy(&(data->next_timeout), ptr, sizeof(struct timeval)); | ||
| 621 | break; | ||
| 348 | #if defined(SO_RCVTIMEO) | 622 | #if defined(SO_RCVTIMEO) |
| 349 | case BIO_CTRL_DGRAM_SET_RECV_TIMEOUT: | 623 | case BIO_CTRL_DGRAM_SET_RECV_TIMEOUT: |
| 350 | #ifdef OPENSSL_SYS_WINDOWS | 624 | #ifdef OPENSSL_SYS_WINDOWS |
| @@ -507,10 +781,6 @@ int BIO_dgram_non_fatal_error(int err) | |||
| 507 | # endif | 781 | # endif |
| 508 | #endif | 782 | #endif |
| 509 | 783 | ||
| 510 | #if defined(ENOTCONN) | ||
| 511 | case ENOTCONN: | ||
| 512 | #endif | ||
| 513 | |||
| 514 | #ifdef EINTR | 784 | #ifdef EINTR |
| 515 | case EINTR: | 785 | case EINTR: |
| 516 | #endif | 786 | #endif |
| @@ -533,11 +803,6 @@ int BIO_dgram_non_fatal_error(int err) | |||
| 533 | case EALREADY: | 803 | case EALREADY: |
| 534 | #endif | 804 | #endif |
| 535 | 805 | ||
| 536 | /* DF bit set, and packet larger than MTU */ | ||
| 537 | #ifdef EMSGSIZE | ||
| 538 | case EMSGSIZE: | ||
| 539 | #endif | ||
| 540 | |||
| 541 | return(1); | 806 | return(1); |
| 542 | /* break; */ | 807 | /* break; */ |
| 543 | default: | 808 | default: |
| @@ -546,3 +811,20 @@ int BIO_dgram_non_fatal_error(int err) | |||
| 546 | return(0); | 811 | return(0); |
| 547 | } | 812 | } |
| 548 | #endif | 813 | #endif |
| 814 | |||
| 815 | static void get_current_time(struct timeval *t) | ||
| 816 | { | ||
| 817 | #ifdef OPENSSL_SYS_WIN32 | ||
| 818 | struct _timeb tb; | ||
| 819 | _ftime(&tb); | ||
| 820 | t->tv_sec = (long)tb.time; | ||
| 821 | t->tv_usec = (long)tb.millitm * 1000; | ||
| 822 | #elif defined(OPENSSL_SYS_VMS) | ||
| 823 | struct timeb tb; | ||
| 824 | ftime(&tb); | ||
| 825 | t->tv_sec = (long)tb.time; | ||
| 826 | t->tv_usec = (long)tb.millitm * 1000; | ||
| 827 | #else | ||
| 828 | gettimeofday(t, NULL); | ||
| 829 | #endif | ||
| 830 | } | ||
diff --git a/src/lib/libcrypto/bio/bss_fd.c b/src/lib/libcrypto/bio/bss_fd.c index 4c229bf641..d1bf85aae1 100644 --- a/src/lib/libcrypto/bio/bss_fd.c +++ b/src/lib/libcrypto/bio/bss_fd.c | |||
| @@ -60,6 +60,13 @@ | |||
| 60 | #include <errno.h> | 60 | #include <errno.h> |
| 61 | #define USE_SOCKETS | 61 | #define USE_SOCKETS |
| 62 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
| 63 | |||
| 64 | #if defined(OPENSSL_NO_POSIX_IO) | ||
| 65 | /* | ||
| 66 | * One can argue that one should implement dummy placeholder for | ||
| 67 | * BIO_s_fd here... | ||
| 68 | */ | ||
| 69 | #else | ||
| 63 | /* | 70 | /* |
| 64 | * As for unconditional usage of "UPLINK" interface in this module. | 71 | * As for unconditional usage of "UPLINK" interface in this module. |
| 65 | * Trouble is that unlike Unix file descriptors [which are indexes | 72 | * Trouble is that unlike Unix file descriptors [which are indexes |
| @@ -77,6 +84,7 @@ | |||
| 77 | static int fd_write(BIO *h, const char *buf, int num); | 84 | static int fd_write(BIO *h, const char *buf, int num); |
| 78 | static int fd_read(BIO *h, char *buf, int size); | 85 | static int fd_read(BIO *h, char *buf, int size); |
| 79 | static int fd_puts(BIO *h, const char *str); | 86 | static int fd_puts(BIO *h, const char *str); |
| 87 | static int fd_gets(BIO *h, char *buf, int size); | ||
| 80 | static long fd_ctrl(BIO *h, int cmd, long arg1, void *arg2); | 88 | static long fd_ctrl(BIO *h, int cmd, long arg1, void *arg2); |
| 81 | static int fd_new(BIO *h); | 89 | static int fd_new(BIO *h); |
| 82 | static int fd_free(BIO *data); | 90 | static int fd_free(BIO *data); |
| @@ -88,7 +96,7 @@ static BIO_METHOD methods_fdp= | |||
| 88 | fd_write, | 96 | fd_write, |
| 89 | fd_read, | 97 | fd_read, |
| 90 | fd_puts, | 98 | fd_puts, |
| 91 | NULL, /* fd_gets, */ | 99 | fd_gets, |
| 92 | fd_ctrl, | 100 | fd_ctrl, |
| 93 | fd_new, | 101 | fd_new, |
| 94 | fd_free, | 102 | fd_free, |
| @@ -227,6 +235,22 @@ static int fd_puts(BIO *bp, const char *str) | |||
| 227 | return(ret); | 235 | return(ret); |
| 228 | } | 236 | } |
| 229 | 237 | ||
| 238 | static int fd_gets(BIO *bp, char *buf, int size) | ||
| 239 | { | ||
| 240 | int ret=0; | ||
| 241 | char *ptr=buf; | ||
| 242 | char *end=buf+size-1; | ||
| 243 | |||
| 244 | while ( (ptr < end) && (fd_read(bp, ptr, 1) > 0) && (ptr[0] != '\n') ) | ||
| 245 | ptr++; | ||
| 246 | |||
| 247 | ptr[0]='\0'; | ||
| 248 | |||
| 249 | if (buf[0] != '\0') | ||
| 250 | ret=strlen(buf); | ||
| 251 | return(ret); | ||
| 252 | } | ||
| 253 | |||
| 230 | int BIO_fd_should_retry(int i) | 254 | int BIO_fd_should_retry(int i) |
| 231 | { | 255 | { |
| 232 | int err; | 256 | int err; |
| @@ -292,3 +316,4 @@ int BIO_fd_non_fatal_error(int err) | |||
| 292 | } | 316 | } |
| 293 | return(0); | 317 | return(0); |
| 294 | } | 318 | } |
| 319 | #endif | ||
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index e692a08e58..8bfa0bcd97 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
| @@ -118,10 +118,47 @@ static BIO_METHOD methods_filep= | |||
| 118 | 118 | ||
| 119 | BIO *BIO_new_file(const char *filename, const char *mode) | 119 | BIO *BIO_new_file(const char *filename, const char *mode) |
| 120 | { | 120 | { |
| 121 | BIO *ret; | 121 | BIO *ret; |
| 122 | FILE *file; | 122 | FILE *file=NULL; |
| 123 | |||
| 124 | #if defined(_WIN32) && defined(CP_UTF8) | ||
| 125 | int sz, len_0 = (int)strlen(filename)+1; | ||
| 123 | 126 | ||
| 124 | if ((file=fopen(filename,mode)) == NULL) | 127 | /* |
| 128 | * Basically there are three cases to cover: a) filename is | ||
| 129 | * pure ASCII string; b) actual UTF-8 encoded string and | ||
| 130 | * c) locale-ized string, i.e. one containing 8-bit | ||
| 131 | * characters that are meaningful in current system locale. | ||
| 132 | * If filename is pure ASCII or real UTF-8 encoded string, | ||
| 133 | * MultiByteToWideChar succeeds and _wfopen works. If | ||
| 134 | * filename is locale-ized string, chances are that | ||
| 135 | * MultiByteToWideChar fails reporting | ||
| 136 | * ERROR_NO_UNICODE_TRANSLATION, in which case we fall | ||
| 137 | * back to fopen... | ||
| 138 | */ | ||
| 139 | if ((sz=MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS, | ||
| 140 | filename,len_0,NULL,0))>0) | ||
| 141 | { | ||
| 142 | WCHAR wmode[8]; | ||
| 143 | WCHAR *wfilename = _alloca(sz*sizeof(WCHAR)); | ||
| 144 | |||
| 145 | if (MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS, | ||
| 146 | filename,len_0,wfilename,sz) && | ||
| 147 | MultiByteToWideChar(CP_UTF8,0,mode,strlen(mode)+1, | ||
| 148 | wmode,sizeof(wmode)/sizeof(wmode[0])) && | ||
| 149 | (file=_wfopen(wfilename,wmode))==NULL && errno==ENOENT | ||
| 150 | ) /* UTF-8 decode succeeded, but no file, filename | ||
| 151 | * could still have been locale-ized... */ | ||
| 152 | file = fopen(filename,mode); | ||
| 153 | } | ||
| 154 | else if (GetLastError()==ERROR_NO_UNICODE_TRANSLATION) | ||
| 155 | { | ||
| 156 | file = fopen(filename,mode); | ||
| 157 | } | ||
| 158 | #else | ||
| 159 | file=fopen(filename,mode); | ||
| 160 | #endif | ||
| 161 | if (file == NULL) | ||
| 125 | { | 162 | { |
| 126 | SYSerr(SYS_F_FOPEN,get_last_sys_error()); | 163 | SYSerr(SYS_F_FOPEN,get_last_sys_error()); |
| 127 | ERR_add_error_data(5,"fopen('",filename,"','",mode,"')"); | 164 | ERR_add_error_data(5,"fopen('",filename,"','",mode,"')"); |
| @@ -131,7 +168,7 @@ BIO *BIO_new_file(const char *filename, const char *mode) | |||
| 131 | BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB); | 168 | BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB); |
| 132 | return(NULL); | 169 | return(NULL); |
| 133 | } | 170 | } |
| 134 | if ((ret=BIO_new(BIO_s_file_internal())) == NULL) | 171 | if ((ret=BIO_new(BIO_s_file())) == NULL) |
| 135 | { | 172 | { |
| 136 | fclose(file); | 173 | fclose(file); |
| 137 | return(NULL); | 174 | return(NULL); |
| @@ -241,7 +278,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 241 | if (b->flags&BIO_FLAGS_UPLINK) | 278 | if (b->flags&BIO_FLAGS_UPLINK) |
| 242 | ret=(long)UP_fseek(b->ptr,num,0); | 279 | ret=(long)UP_fseek(b->ptr,num,0); |
| 243 | else | 280 | else |
| 244 | ret=(long)fseek(fp,num,SEEK_SET); | 281 | ret=(long)fseek(fp,num,0); |
| 245 | break; | 282 | break; |
| 246 | case BIO_CTRL_EOF: | 283 | case BIO_CTRL_EOF: |
| 247 | if (b->flags&BIO_FLAGS_UPLINK) | 284 | if (b->flags&BIO_FLAGS_UPLINK) |
| @@ -272,9 +309,9 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 272 | BIO_clear_flags(b,BIO_FLAGS_UPLINK); | 309 | BIO_clear_flags(b,BIO_FLAGS_UPLINK); |
| 273 | #endif | 310 | #endif |
| 274 | #endif | 311 | #endif |
| 275 | #ifdef UP_fsetmode | 312 | #ifdef UP_fsetmod |
| 276 | if (b->flags&BIO_FLAGS_UPLINK) | 313 | if (b->flags&BIO_FLAGS_UPLINK) |
| 277 | UP_fsetmode(b->ptr,num&BIO_FP_TEXT?'t':'b'); | 314 | UP_fsetmod(b->ptr,(char)((num&BIO_FP_TEXT)?'t':'b')); |
| 278 | else | 315 | else |
| 279 | #endif | 316 | #endif |
| 280 | { | 317 | { |
| @@ -286,8 +323,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 286 | _setmode(fd,_O_BINARY); | 323 | _setmode(fd,_O_BINARY); |
| 287 | #elif defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) | 324 | #elif defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) |
| 288 | int fd = fileno((FILE*)ptr); | 325 | int fd = fileno((FILE*)ptr); |
| 289 | /* Under CLib there are differences in file modes | 326 | /* Under CLib there are differences in file modes */ |
| 290 | */ | ||
| 291 | if (num & BIO_FP_TEXT) | 327 | if (num & BIO_FP_TEXT) |
| 292 | setmode(fd,O_TEXT); | 328 | setmode(fd,O_TEXT); |
| 293 | else | 329 | else |
| @@ -308,7 +344,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 308 | else | 344 | else |
| 309 | _setmode(fd,_O_BINARY); | 345 | _setmode(fd,_O_BINARY); |
| 310 | } | 346 | } |
| 311 | #elif defined(OPENSSL_SYS_OS2) | 347 | #elif defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) |
| 312 | int fd = fileno((FILE*)ptr); | 348 | int fd = fileno((FILE*)ptr); |
| 313 | if (num & BIO_FP_TEXT) | 349 | if (num & BIO_FP_TEXT) |
| 314 | setmode(fd, O_TEXT); | 350 | setmode(fd, O_TEXT); |
| @@ -404,11 +440,18 @@ static int MS_CALLBACK file_gets(BIO *bp, char *buf, int size) | |||
| 404 | 440 | ||
| 405 | buf[0]='\0'; | 441 | buf[0]='\0'; |
| 406 | if (bp->flags&BIO_FLAGS_UPLINK) | 442 | if (bp->flags&BIO_FLAGS_UPLINK) |
| 407 | UP_fgets(buf,size,bp->ptr); | 443 | { |
| 444 | if (!UP_fgets(buf,size,bp->ptr)) | ||
| 445 | goto err; | ||
| 446 | } | ||
| 408 | else | 447 | else |
| 409 | fgets(buf,size,(FILE *)bp->ptr); | 448 | { |
| 449 | if (!fgets(buf,size,(FILE *)bp->ptr)) | ||
| 450 | goto err; | ||
| 451 | } | ||
| 410 | if (buf[0] != '\0') | 452 | if (buf[0] != '\0') |
| 411 | ret=strlen(buf); | 453 | ret=strlen(buf); |
| 454 | err: | ||
| 412 | return(ret); | 455 | return(ret); |
| 413 | } | 456 | } |
| 414 | 457 | ||
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c index 6360dbc820..7ead044b37 100644 --- a/src/lib/libcrypto/bio/bss_log.c +++ b/src/lib/libcrypto/bio/bss_log.c | |||
| @@ -70,7 +70,6 @@ | |||
| 70 | 70 | ||
| 71 | #if defined(OPENSSL_SYS_WINCE) | 71 | #if defined(OPENSSL_SYS_WINCE) |
| 72 | #elif defined(OPENSSL_SYS_WIN32) | 72 | #elif defined(OPENSSL_SYS_WIN32) |
| 73 | # include <process.h> | ||
| 74 | #elif defined(OPENSSL_SYS_VMS) | 73 | #elif defined(OPENSSL_SYS_VMS) |
| 75 | # include <opcdef.h> | 74 | # include <opcdef.h> |
| 76 | # include <descrip.h> | 75 | # include <descrip.h> |
| @@ -122,18 +121,6 @@ static int MS_CALLBACK slg_free(BIO *data); | |||
| 122 | static void xopenlog(BIO* bp, char* name, int level); | 121 | static void xopenlog(BIO* bp, char* name, int level); |
| 123 | static void xsyslog(BIO* bp, int priority, const char* string); | 122 | static void xsyslog(BIO* bp, int priority, const char* string); |
| 124 | static void xcloselog(BIO* bp); | 123 | static void xcloselog(BIO* bp); |
| 125 | #ifdef OPENSSL_SYS_WIN32 | ||
| 126 | LONG (WINAPI *go_for_advapi)() = RegOpenKeyEx; | ||
| 127 | HANDLE (WINAPI *register_event_source)() = NULL; | ||
| 128 | BOOL (WINAPI *deregister_event_source)() = NULL; | ||
| 129 | BOOL (WINAPI *report_event)() = NULL; | ||
| 130 | #define DL_PROC(m,f) (GetProcAddress( m, f )) | ||
| 131 | #ifdef UNICODE | ||
| 132 | #define DL_PROC_X(m,f) DL_PROC( m, f "W" ) | ||
| 133 | #else | ||
| 134 | #define DL_PROC_X(m,f) DL_PROC( m, f "A" ) | ||
| 135 | #endif | ||
| 136 | #endif | ||
| 137 | 124 | ||
| 138 | static BIO_METHOD methods_slg= | 125 | static BIO_METHOD methods_slg= |
| 139 | { | 126 | { |
| @@ -175,7 +162,7 @@ static int MS_CALLBACK slg_write(BIO *b, const char *in, int inl) | |||
| 175 | char* buf; | 162 | char* buf; |
| 176 | char* pp; | 163 | char* pp; |
| 177 | int priority, i; | 164 | int priority, i; |
| 178 | static struct | 165 | static const struct |
| 179 | { | 166 | { |
| 180 | int strl; | 167 | int strl; |
| 181 | char str[10]; | 168 | char str[10]; |
| @@ -249,35 +236,20 @@ static int MS_CALLBACK slg_puts(BIO *bp, const char *str) | |||
| 249 | 236 | ||
| 250 | static void xopenlog(BIO* bp, char* name, int level) | 237 | static void xopenlog(BIO* bp, char* name, int level) |
| 251 | { | 238 | { |
| 252 | if ( !register_event_source ) | 239 | if (GetVersion() < 0x80000000) |
| 253 | { | 240 | bp->ptr = RegisterEventSourceA(NULL,name); |
| 254 | HANDLE advapi; | 241 | else |
| 255 | if ( !(advapi = GetModuleHandle("advapi32")) ) | 242 | bp->ptr = NULL; |
| 256 | return; | ||
| 257 | register_event_source = (HANDLE (WINAPI *)())DL_PROC_X(advapi, | ||
| 258 | "RegisterEventSource" ); | ||
| 259 | deregister_event_source = (BOOL (WINAPI *)())DL_PROC(advapi, | ||
| 260 | "DeregisterEventSource"); | ||
| 261 | report_event = (BOOL (WINAPI *)())DL_PROC_X(advapi, | ||
| 262 | "ReportEvent" ); | ||
| 263 | if ( !(register_event_source && deregister_event_source && | ||
| 264 | report_event) ) | ||
| 265 | { | ||
| 266 | register_event_source = NULL; | ||
| 267 | deregister_event_source = NULL; | ||
| 268 | report_event = NULL; | ||
| 269 | return; | ||
| 270 | } | ||
| 271 | } | ||
| 272 | bp->ptr= (char *)register_event_source(NULL, name); | ||
| 273 | } | 243 | } |
| 274 | 244 | ||
| 275 | static void xsyslog(BIO *bp, int priority, const char *string) | 245 | static void xsyslog(BIO *bp, int priority, const char *string) |
| 276 | { | 246 | { |
| 277 | LPCSTR lpszStrings[2]; | 247 | LPCSTR lpszStrings[2]; |
| 278 | WORD evtype= EVENTLOG_ERROR_TYPE; | 248 | WORD evtype= EVENTLOG_ERROR_TYPE; |
| 279 | int pid = _getpid(); | 249 | char pidbuf[DECIMAL_SIZE(DWORD)+4]; |
| 280 | char pidbuf[DECIMAL_SIZE(pid)+4]; | 250 | |
| 251 | if (bp->ptr == NULL) | ||
| 252 | return; | ||
| 281 | 253 | ||
| 282 | switch (priority) | 254 | switch (priority) |
| 283 | { | 255 | { |
| @@ -301,19 +273,18 @@ static void xsyslog(BIO *bp, int priority, const char *string) | |||
| 301 | break; | 273 | break; |
| 302 | } | 274 | } |
| 303 | 275 | ||
| 304 | sprintf(pidbuf, "[%d] ", pid); | 276 | sprintf(pidbuf, "[%u] ", GetCurrentProcessId()); |
| 305 | lpszStrings[0] = pidbuf; | 277 | lpszStrings[0] = pidbuf; |
| 306 | lpszStrings[1] = string; | 278 | lpszStrings[1] = string; |
| 307 | 279 | ||
| 308 | if(report_event && bp->ptr) | 280 | ReportEventA(bp->ptr, evtype, 0, 1024, NULL, 2, 0, |
| 309 | report_event(bp->ptr, evtype, 0, 1024, NULL, 2, 0, | ||
| 310 | lpszStrings, NULL); | 281 | lpszStrings, NULL); |
| 311 | } | 282 | } |
| 312 | 283 | ||
| 313 | static void xcloselog(BIO* bp) | 284 | static void xcloselog(BIO* bp) |
| 314 | { | 285 | { |
| 315 | if(deregister_event_source && bp->ptr) | 286 | if(bp->ptr) |
| 316 | deregister_event_source((HANDLE)(bp->ptr)); | 287 | DeregisterEventSource((HANDLE)(bp->ptr)); |
| 317 | bp->ptr= NULL; | 288 | bp->ptr= NULL; |
| 318 | } | 289 | } |
| 319 | 290 | ||
diff --git a/src/lib/libcrypto/bio/bss_mem.c b/src/lib/libcrypto/bio/bss_mem.c index e7ab9cb3a3..37d4194e4b 100644 --- a/src/lib/libcrypto/bio/bss_mem.c +++ b/src/lib/libcrypto/bio/bss_mem.c | |||
| @@ -94,16 +94,18 @@ BIO *BIO_new_mem_buf(void *buf, int len) | |||
| 94 | { | 94 | { |
| 95 | BIO *ret; | 95 | BIO *ret; |
| 96 | BUF_MEM *b; | 96 | BUF_MEM *b; |
| 97 | size_t sz; | ||
| 98 | |||
| 97 | if (!buf) { | 99 | if (!buf) { |
| 98 | BIOerr(BIO_F_BIO_NEW_MEM_BUF,BIO_R_NULL_PARAMETER); | 100 | BIOerr(BIO_F_BIO_NEW_MEM_BUF,BIO_R_NULL_PARAMETER); |
| 99 | return NULL; | 101 | return NULL; |
| 100 | } | 102 | } |
| 101 | if(len == -1) len = strlen(buf); | 103 | sz = (len<0) ? strlen(buf) : (size_t)len; |
| 102 | if(!(ret = BIO_new(BIO_s_mem())) ) return NULL; | 104 | if(!(ret = BIO_new(BIO_s_mem())) ) return NULL; |
| 103 | b = (BUF_MEM *)ret->ptr; | 105 | b = (BUF_MEM *)ret->ptr; |
| 104 | b->data = buf; | 106 | b->data = buf; |
| 105 | b->length = len; | 107 | b->length = sz; |
| 106 | b->max = len; | 108 | b->max = sz; |
| 107 | ret->flags |= BIO_FLAGS_MEM_RDONLY; | 109 | ret->flags |= BIO_FLAGS_MEM_RDONLY; |
| 108 | /* Since this is static data retrying wont help */ | 110 | /* Since this is static data retrying wont help */ |
| 109 | ret->num = 0; | 111 | ret->num = 0; |
| @@ -144,22 +146,16 @@ static int mem_read(BIO *b, char *out, int outl) | |||
| 144 | { | 146 | { |
| 145 | int ret= -1; | 147 | int ret= -1; |
| 146 | BUF_MEM *bm; | 148 | BUF_MEM *bm; |
| 147 | int i; | ||
| 148 | char *from,*to; | ||
| 149 | 149 | ||
| 150 | bm=(BUF_MEM *)b->ptr; | 150 | bm=(BUF_MEM *)b->ptr; |
| 151 | BIO_clear_retry_flags(b); | 151 | BIO_clear_retry_flags(b); |
| 152 | ret=(outl > bm->length)?bm->length:outl; | 152 | ret=(outl >=0 && (size_t)outl > bm->length)?(int)bm->length:outl; |
| 153 | if ((out != NULL) && (ret > 0)) { | 153 | if ((out != NULL) && (ret > 0)) { |
| 154 | memcpy(out,bm->data,ret); | 154 | memcpy(out,bm->data,ret); |
| 155 | bm->length-=ret; | 155 | bm->length-=ret; |
| 156 | /* memmove(&(bm->data[0]),&(bm->data[ret]), bm->length); */ | ||
| 157 | if(b->flags & BIO_FLAGS_MEM_RDONLY) bm->data += ret; | 156 | if(b->flags & BIO_FLAGS_MEM_RDONLY) bm->data += ret; |
| 158 | else { | 157 | else { |
| 159 | from=(char *)&(bm->data[ret]); | 158 | memmove(&(bm->data[0]),&(bm->data[ret]),bm->length); |
| 160 | to=(char *)&(bm->data[0]); | ||
| 161 | for (i=0; i<bm->length; i++) | ||
| 162 | to[i]=from[i]; | ||
| 163 | } | 159 | } |
| 164 | } else if (bm->length == 0) | 160 | } else if (bm->length == 0) |
| 165 | { | 161 | { |
diff --git a/src/lib/libcrypto/bio/bss_sock.c b/src/lib/libcrypto/bio/bss_sock.c index 30c3ceab46..3df31938c1 100644 --- a/src/lib/libcrypto/bio/bss_sock.c +++ b/src/lib/libcrypto/bio/bss_sock.c | |||
| @@ -172,15 +172,6 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 172 | 172 | ||
| 173 | switch (cmd) | 173 | switch (cmd) |
| 174 | { | 174 | { |
| 175 | case BIO_CTRL_RESET: | ||
| 176 | num=0; | ||
| 177 | case BIO_C_FILE_SEEK: | ||
| 178 | ret=0; | ||
| 179 | break; | ||
| 180 | case BIO_C_FILE_TELL: | ||
| 181 | case BIO_CTRL_INFO: | ||
| 182 | ret=0; | ||
| 183 | break; | ||
| 184 | case BIO_C_SET_FD: | 175 | case BIO_C_SET_FD: |
| 185 | sock_free(b); | 176 | sock_free(b); |
| 186 | b->num= *((int *)ptr); | 177 | b->num= *((int *)ptr); |
| @@ -203,10 +194,6 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 203 | case BIO_CTRL_SET_CLOSE: | 194 | case BIO_CTRL_SET_CLOSE: |
| 204 | b->shutdown=(int)num; | 195 | b->shutdown=(int)num; |
| 205 | break; | 196 | break; |
| 206 | case BIO_CTRL_PENDING: | ||
| 207 | case BIO_CTRL_WPENDING: | ||
| 208 | ret=0; | ||
| 209 | break; | ||
| 210 | case BIO_CTRL_DUP: | 197 | case BIO_CTRL_DUP: |
| 211 | case BIO_CTRL_FLUSH: | 198 | case BIO_CTRL_FLUSH: |
| 212 | ret=1; | 199 | ret=1; |
diff --git a/src/lib/libcrypto/bn/Makefile b/src/lib/libcrypto/bn/Makefile index f5e8f65a46..aabc4f56b8 100644 --- a/src/lib/libcrypto/bn/Makefile +++ b/src/lib/libcrypto/bn/Makefile | |||
| @@ -12,8 +12,6 @@ MAKEFILE= Makefile | |||
| 12 | AR= ar r | 12 | AR= ar r |
| 13 | 13 | ||
| 14 | BN_ASM= bn_asm.o | 14 | BN_ASM= bn_asm.o |
| 15 | # or use | ||
| 16 | #BN_ASM= bn86-elf.o | ||
| 17 | 15 | ||
| 18 | CFLAGS= $(INCLUDES) $(CFLAG) | 16 | CFLAGS= $(INCLUDES) $(CFLAG) |
| 19 | ASFLAGS= $(INCLUDES) $(ASFLAG) | 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) |
| @@ -28,13 +26,13 @@ LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \ | |||
| 28 | bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \ | 26 | bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \ |
| 29 | bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \ | 27 | bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \ |
| 30 | bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \ | 28 | bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \ |
| 31 | bn_depr.c bn_x931p.c bn_const.c bn_opt.c | 29 | bn_depr.c bn_const.c |
| 32 | 30 | ||
| 33 | LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \ | 31 | LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \ |
| 34 | bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \ | 32 | bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \ |
| 35 | bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \ | 33 | bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \ |
| 36 | bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_gf2m.o bn_nist.o \ | 34 | bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_gf2m.o bn_nist.o \ |
| 37 | bn_depr.o bn_x931p.o bn_const.o bn_opt.o | 35 | bn_depr.o bn_const.o |
| 38 | 36 | ||
| 39 | SRC= $(LIBSRC) | 37 | SRC= $(LIBSRC) |
| 40 | 38 | ||
| @@ -58,36 +56,25 @@ bnbug: bnbug.c ../../libcrypto.a top | |||
| 58 | cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a | 56 | cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a |
| 59 | 57 | ||
| 60 | lib: $(LIBOBJ) | 58 | lib: $(LIBOBJ) |
| 61 | $(ARX) $(LIB) $(LIBOBJ) | 59 | $(AR) $(LIB) $(LIBOBJ) |
| 62 | $(RANLIB) $(LIB) || echo Never mind. | 60 | $(RANLIB) $(LIB) || echo Never mind. |
| 63 | @touch lib | 61 | @touch lib |
| 64 | 62 | ||
| 65 | # ELF | 63 | bn-586.s: asm/bn-586.pl ../perlasm/x86asm.pl |
| 66 | bn86-elf.s: asm/bn-586.pl ../perlasm/x86asm.pl | 64 | $(PERL) asm/bn-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ |
| 67 | (cd asm; $(PERL) bn-586.pl elf $(CFLAGS) > ../$@) | 65 | co-586.s: asm/co-586.pl ../perlasm/x86asm.pl |
| 68 | co86-elf.s: asm/co-586.pl ../perlasm/x86asm.pl | 66 | $(PERL) asm/co-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ |
| 69 | (cd asm; $(PERL) co-586.pl elf $(CFLAGS) > ../$@) | 67 | x86-mont.s: asm/x86-mont.pl ../perlasm/x86asm.pl |
| 70 | mo86-elf.s: asm/mo-586.pl ../perlasm/x86asm.pl | 68 | $(PERL) asm/x86-mont.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ |
| 71 | (cd asm; $(PERL) mo-586.pl elf $(CFLAGS) > ../$@) | ||
| 72 | # COFF | ||
| 73 | bn86-cof.s: asm/bn-586.pl ../perlasm/x86asm.pl | ||
| 74 | (cd asm; $(PERL) bn-586.pl coff $(CFLAGS) > ../$@) | ||
| 75 | co86-cof.s: asm/co-586.pl ../perlasm/x86asm.pl | ||
| 76 | (cd asm; $(PERL) co-586.pl coff $(CFLAGS) > ../$@) | ||
| 77 | mo86-cof.s: asm/mo-586.pl ../perlasm/x86asm.pl | ||
| 78 | (cd asm; $(PERL) mo-586.pl coff $(CFLAGS) > ../$@) | ||
| 79 | # a.out | ||
| 80 | bn86-out.s: asm/bn-586.pl ../perlasm/x86asm.pl | ||
| 81 | (cd asm; $(PERL) bn-586.pl a.out $(CFLAGS) > ../$@) | ||
| 82 | co86-out.s: asm/co-586.pl ../perlasm/x86asm.pl | ||
| 83 | (cd asm; $(PERL) co-586.pl a.out $(CFLAGS) > ../$@) | ||
| 84 | mo86-out.s: asm/mo-586.pl ../perlasm/x86asm.pl | ||
| 85 | (cd asm; $(PERL) mo-586.pl a.out $(CFLAGS) > ../$@) | ||
| 86 | 69 | ||
| 87 | sparcv8.o: asm/sparcv8.S | 70 | sparcv8.o: asm/sparcv8.S |
| 88 | $(CC) $(CFLAGS) -c asm/sparcv8.S | 71 | $(CC) $(CFLAGS) -c asm/sparcv8.S |
| 89 | sparcv8plus.o: asm/sparcv8plus.S | 72 | bn-sparcv9.o: asm/sparcv8plus.S |
| 90 | $(CC) $(CFLAGS) -c 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) > $@ | ||
| 91 | 78 | ||
| 92 | bn-mips3.o: asm/mips3.s | 79 | bn-mips3.o: asm/mips3.s |
| 93 | @if [ "$(CC)" = "gcc" ]; then \ | 80 | @if [ "$(CC)" = "gcc" ]; then \ |
| @@ -95,10 +82,13 @@ bn-mips3.o: asm/mips3.s | |||
| 95 | as -$$ABI -O -o $@ asm/mips3.s; \ | 82 | as -$$ABI -O -o $@ asm/mips3.s; \ |
| 96 | else $(CC) -c $(CFLAGS) -o $@ asm/mips3.s; fi | 83 | else $(CC) -c $(CFLAGS) -o $@ asm/mips3.s; fi |
| 97 | 84 | ||
| 85 | bn-s390x.o: asm/s390x.S | ||
| 86 | $(CC) $(CFLAGS) -c -o $@ asm/s390x.S | ||
| 87 | |||
| 98 | x86_64-gcc.o: asm/x86_64-gcc.c | 88 | x86_64-gcc.o: asm/x86_64-gcc.c |
| 99 | $(CC) $(CFLAGS) -c -o $@ asm/x86_64-gcc.c | 89 | $(CC) $(CFLAGS) -c -o $@ asm/x86_64-gcc.c |
| 100 | x86_64-mont.s: asm/x86_64-mont.pl | 90 | x86_64-mont.s: asm/x86_64-mont.pl |
| 101 | $(PERL) asm/x86_64-mont.pl $@ | 91 | $(PERL) asm/x86_64-mont.pl $(PERLASM_SCHEME) > $@ |
| 102 | 92 | ||
| 103 | bn-ia64.s: asm/ia64.S | 93 | bn-ia64.s: asm/ia64.S |
| 104 | $(CC) $(CFLAGS) -E asm/ia64.S > $@ | 94 | $(CC) $(CFLAGS) -E asm/ia64.S > $@ |
| @@ -111,12 +101,14 @@ pa-risc2.o: asm/pa-risc2.s | |||
| 111 | /usr/ccs/bin/as -o pa-risc2.o asm/pa-risc2.s | 101 | /usr/ccs/bin/as -o pa-risc2.o asm/pa-risc2.s |
| 112 | 102 | ||
| 113 | # ppc - AIX, Linux, MacOS X... | 103 | # ppc - AIX, Linux, MacOS X... |
| 114 | linux_ppc32.s: asm/ppc.pl; $(PERL) $< $@ | 104 | bn-ppc.s: asm/ppc.pl; $(PERL) asm/ppc.pl $(PERLASM_SCHEME) $@ |
| 115 | linux_ppc64.s: asm/ppc.pl; $(PERL) $< $@ | 105 | ppc-mont.s: asm/ppc-mont.pl;$(PERL) asm/ppc-mont.pl $(PERLASM_SCHEME) $@ |
| 116 | aix_ppc32.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@ | 106 | |
| 117 | aix_ppc64.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@ | 107 | alpha-mont.s: asm/alpha-mont.pl |
| 118 | osx_ppc32.s: asm/ppc.pl; $(PERL) $< $@ | 108 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null |
| 119 | osx_ppc64.s: asm/ppc.pl; $(PERL) $< $@ | 109 | |
| 110 | # GNU make "catch all" | ||
| 111 | %-mont.s: asm/%-mont.pl; $(PERL) $< $(CFLAGS) > $@ | ||
| 120 | 112 | ||
| 121 | files: | 113 | files: |
| 122 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | 114 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO |
| @@ -184,8 +176,11 @@ bn_blind.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | |||
| 184 | bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 176 | bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 185 | bn_blind.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 177 | bn_blind.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 186 | bn_blind.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_blind.c bn_lcl.h | 178 | bn_blind.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_blind.c bn_lcl.h |
| 187 | bn_const.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | 179 | bn_const.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 188 | bn_const.o: ../../include/openssl/ossl_typ.h bn.h bn_const.c | 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 | ||
| 189 | bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | 184 | bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 190 | bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 185 | bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 191 | bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 186 | bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| @@ -292,13 +287,6 @@ bn_nist.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | |||
| 292 | bn_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 287 | bn_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 293 | bn_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 288 | bn_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 294 | bn_nist.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_nist.c | 289 | bn_nist.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_nist.c |
| 295 | bn_opt.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 296 | bn_opt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 297 | bn_opt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 298 | bn_opt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 299 | bn_opt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 300 | bn_opt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 301 | bn_opt.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_opt.c | ||
| 302 | bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | 290 | bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 303 | bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 291 | bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 304 | bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 292 | bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| @@ -357,6 +345,3 @@ bn_word.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | |||
| 357 | bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 345 | bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 358 | bn_word.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 346 | bn_word.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 359 | bn_word.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_word.c | 347 | bn_word.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_word.c |
| 360 | bn_x931p.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h | ||
| 361 | bn_x931p.o: ../../include/openssl/opensslconf.h | ||
| 362 | bn_x931p.o: ../../include/openssl/ossl_typ.h bn_x931p.c | ||
diff --git a/src/lib/libcrypto/bn/Makefile.ssl b/src/lib/libcrypto/bn/Makefile.ssl deleted file mode 100644 index 50892ef44c..0000000000 --- a/src/lib/libcrypto/bn/Makefile.ssl +++ /dev/null | |||
| @@ -1,326 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/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 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | BN_ASM= bn_asm.o | ||
| 21 | # or use | ||
| 22 | #BN_ASM= bn86-elf.o | ||
| 23 | |||
| 24 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 25 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 26 | |||
| 27 | GENERAL=Makefile | ||
| 28 | TEST=bntest.c exptest.c | ||
| 29 | APPS= | ||
| 30 | |||
| 31 | LIB=$(TOP)/libcrypto.a | ||
| 32 | LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \ | ||
| 33 | bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \ | ||
| 34 | bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \ | ||
| 35 | bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c | ||
| 36 | |||
| 37 | LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \ | ||
| 38 | bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \ | ||
| 39 | bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \ | ||
| 40 | bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o | ||
| 41 | |||
| 42 | SRC= $(LIBSRC) | ||
| 43 | |||
| 44 | EXHEADER= bn.h | ||
| 45 | HEADER= bn_lcl.h bn_prime.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 | bn_prime.h: bn_prime.pl | ||
| 55 | $(PERL) bn_prime.pl >bn_prime.h | ||
| 56 | |||
| 57 | divtest: divtest.c ../../libcrypto.a | ||
| 58 | cc -I../../include divtest.c -o divtest ../../libcrypto.a | ||
| 59 | |||
| 60 | bnbug: bnbug.c ../../libcrypto.a top | ||
| 61 | cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a | ||
| 62 | |||
| 63 | lib: $(LIBOBJ) | ||
| 64 | $(AR) $(LIB) $(LIBOBJ) | ||
| 65 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 66 | @touch lib | ||
| 67 | |||
| 68 | # elf | ||
| 69 | asm/bn86-elf.s: asm/bn-586.pl ../perlasm/x86asm.pl | ||
| 70 | (cd asm; $(PERL) bn-586.pl elf $(CFLAGS) > bn86-elf.s) | ||
| 71 | |||
| 72 | asm/co86-elf.s: asm/co-586.pl ../perlasm/x86asm.pl | ||
| 73 | (cd asm; $(PERL) co-586.pl elf $(CFLAGS) > co86-elf.s) | ||
| 74 | |||
| 75 | # a.out | ||
| 76 | asm/bn86-out.o: asm/bn86unix.cpp | ||
| 77 | $(CPP) -DOUT asm/bn86unix.cpp | as -o asm/bn86-out.o | ||
| 78 | |||
| 79 | asm/co86-out.o: asm/co86unix.cpp | ||
| 80 | $(CPP) -DOUT asm/co86unix.cpp | as -o asm/co86-out.o | ||
| 81 | |||
| 82 | # bsdi | ||
| 83 | asm/bn86bsdi.o: asm/bn86unix.cpp | ||
| 84 | $(CPP) -DBSDI asm/bn86unix.cpp | sed 's/ :/:/' | as -o asm/bn86bsdi.o | ||
| 85 | |||
| 86 | asm/co86bsdi.o: asm/co86unix.cpp | ||
| 87 | $(CPP) -DBSDI asm/co86unix.cpp | sed 's/ :/:/' | as -o asm/co86bsdi.o | ||
| 88 | |||
| 89 | asm/bn86unix.cpp: asm/bn-586.pl ../perlasm/x86asm.pl | ||
| 90 | (cd asm; $(PERL) bn-586.pl cpp >bn86unix.cpp ) | ||
| 91 | |||
| 92 | asm/co86unix.cpp: asm/co-586.pl ../perlasm/x86asm.pl | ||
| 93 | (cd asm; $(PERL) co-586.pl cpp >co86unix.cpp ) | ||
| 94 | |||
| 95 | asm/sparcv8.o: asm/sparcv8.S | ||
| 96 | |||
| 97 | asm/sparcv8plus.o: asm/sparcv8plus.S | ||
| 98 | |||
| 99 | # Old GNU assembler doesn't understand V9 instructions, so we | ||
| 100 | # hire /usr/ccs/bin/as to do the job. Note that option is called | ||
| 101 | # *-gcc27, but even gcc 2>=8 users may experience similar problem | ||
| 102 | # if they didn't bother to upgrade GNU assembler. Such users should | ||
| 103 | # not choose this option, but be adviced to *remove* GNU assembler | ||
| 104 | # or upgrade it. | ||
| 105 | asm/sparcv8plus-gcc27.o: asm/sparcv8plus.S | ||
| 106 | $(CC) $(ASFLAGS) -E asm/sparcv8plus.S | \ | ||
| 107 | /usr/ccs/bin/as -xarch=v8plus - -o asm/sparcv8plus-gcc27.o | ||
| 108 | |||
| 109 | |||
| 110 | asm/ia64.o: asm/ia64.S | ||
| 111 | |||
| 112 | # Some compiler drivers (most notably HP-UX and Intel C++) don't | ||
| 113 | # understand .S extension:-( I wish I could pipe output from cc -E, | ||
| 114 | # but it's too compiler driver/ABI dependent to cover with a single | ||
| 115 | # rule... <appro@fy.chalmers.se> | ||
| 116 | asm/ia64-cpp.o: asm/ia64.S | ||
| 117 | $(CC) $(ASFLAGS) -E asm/ia64.S > /tmp/ia64.$$$$.s && \ | ||
| 118 | $(CC) $(ASFLAGS) -c -o asm/ia64-cpp.o /tmp/ia64.$$$$.s; \ | ||
| 119 | rm -f /tmp/ia64.$$$$.s | ||
| 120 | |||
| 121 | asm/x86_64-gcc.o: asm/x86_64-gcc.c | ||
| 122 | |||
| 123 | asm/pa-risc2W.o: asm/pa-risc2W.s | ||
| 124 | /usr/ccs/bin/as -o asm/pa-rics2W.o asm/pa-risc2W.s | ||
| 125 | |||
| 126 | files: | ||
| 127 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 128 | |||
| 129 | links: | ||
| 130 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 131 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 132 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 133 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 134 | |||
| 135 | install: | ||
| 136 | @for i in $(EXHEADER) ; \ | ||
| 137 | do \ | ||
| 138 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 139 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 140 | done; | ||
| 141 | |||
| 142 | exptest: | ||
| 143 | rm -f exptest | ||
| 144 | gcc -I../../include -g2 -ggdb -o exptest exptest.c ../../libcrypto.a | ||
| 145 | |||
| 146 | div: | ||
| 147 | rm -f a.out | ||
| 148 | gcc -I.. -g div.c ../../libcrypto.a | ||
| 149 | |||
| 150 | tags: | ||
| 151 | ctags $(SRC) | ||
| 152 | |||
| 153 | tests: | ||
| 154 | |||
| 155 | lint: | ||
| 156 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 157 | |||
| 158 | depend: | ||
| 159 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 160 | |||
| 161 | dclean: | ||
| 162 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 163 | mv -f Makefile.new $(MAKEFILE) | ||
| 164 | |||
| 165 | clean: | ||
| 166 | rm -f asm/co86unix.cpp asm/bn86unix.cpp asm/*-elf.* *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff bn_asm.s | ||
| 167 | |||
| 168 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 169 | |||
| 170 | bn_add.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 171 | bn_add.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 172 | bn_add.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 173 | bn_add.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 174 | bn_add.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 175 | bn_add.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 176 | bn_add.o: ../cryptlib.h bn_add.c bn_lcl.h | ||
| 177 | bn_asm.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 178 | bn_asm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 179 | bn_asm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 180 | bn_asm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 181 | bn_asm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 182 | bn_asm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 183 | bn_asm.o: ../cryptlib.h bn_asm.c bn_lcl.h | ||
| 184 | bn_blind.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 185 | bn_blind.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 186 | bn_blind.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 187 | bn_blind.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 188 | bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 189 | bn_blind.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 190 | bn_blind.o: ../cryptlib.h bn_blind.c bn_lcl.h | ||
| 191 | bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 192 | bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 193 | bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 194 | bn_ctx.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 195 | bn_ctx.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 196 | bn_ctx.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 197 | bn_ctx.o: ../cryptlib.h bn_ctx.c bn_lcl.h | ||
| 198 | bn_div.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 199 | bn_div.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 200 | bn_div.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 201 | bn_div.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 202 | bn_div.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 203 | bn_div.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 204 | bn_div.o: ../cryptlib.h bn_div.c bn_lcl.h | ||
| 205 | bn_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 206 | bn_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 207 | bn_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 208 | bn_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 209 | bn_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 210 | bn_err.o: ../../include/openssl/symhacks.h bn_err.c | ||
| 211 | bn_exp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 212 | bn_exp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 213 | bn_exp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 214 | bn_exp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 215 | bn_exp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 216 | bn_exp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 217 | bn_exp.o: ../cryptlib.h bn_exp.c bn_lcl.h | ||
| 218 | bn_exp2.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 219 | bn_exp2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 220 | bn_exp2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 221 | bn_exp2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 222 | bn_exp2.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 223 | bn_exp2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 224 | bn_exp2.o: ../cryptlib.h bn_exp2.c bn_lcl.h | ||
| 225 | bn_gcd.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 226 | bn_gcd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 227 | bn_gcd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 228 | bn_gcd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 229 | bn_gcd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 230 | bn_gcd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 231 | bn_gcd.o: ../cryptlib.h bn_gcd.c bn_lcl.h | ||
| 232 | bn_kron.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h | ||
| 233 | bn_kron.o: ../../include/openssl/opensslconf.h bn_kron.c bn_lcl.h | ||
| 234 | bn_lib.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 235 | bn_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 236 | bn_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 237 | bn_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 238 | bn_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 239 | bn_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 240 | bn_lib.o: ../cryptlib.h bn_lcl.h bn_lib.c | ||
| 241 | bn_mod.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 242 | bn_mod.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 243 | bn_mod.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 244 | bn_mod.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 245 | bn_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 246 | bn_mod.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 247 | bn_mod.o: ../cryptlib.h bn_lcl.h bn_mod.c | ||
| 248 | bn_mont.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 249 | bn_mont.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 250 | bn_mont.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 251 | bn_mont.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 252 | bn_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 253 | bn_mont.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 254 | bn_mont.o: ../cryptlib.h bn_lcl.h bn_mont.c | ||
| 255 | bn_mpi.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 256 | bn_mpi.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 257 | bn_mpi.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 258 | bn_mpi.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 259 | bn_mpi.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 260 | bn_mpi.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 261 | bn_mpi.o: ../cryptlib.h bn_lcl.h bn_mpi.c | ||
| 262 | bn_mul.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 263 | bn_mul.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 264 | bn_mul.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 265 | bn_mul.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 266 | bn_mul.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 267 | bn_mul.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 268 | bn_mul.o: ../cryptlib.h bn_lcl.h bn_mul.c | ||
| 269 | bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 270 | bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 271 | bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 272 | bn_prime.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 273 | bn_prime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 274 | bn_prime.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 275 | bn_prime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 276 | bn_prime.o: ../cryptlib.h bn_lcl.h bn_prime.c bn_prime.h | ||
| 277 | bn_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 278 | bn_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 279 | bn_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 280 | bn_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 281 | bn_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 282 | bn_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 283 | bn_print.o: ../cryptlib.h bn_lcl.h bn_print.c | ||
| 284 | bn_rand.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 285 | bn_rand.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 286 | bn_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 287 | bn_rand.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 288 | bn_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 289 | bn_rand.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 290 | bn_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 291 | bn_rand.o: ../cryptlib.h bn_lcl.h bn_rand.c | ||
| 292 | bn_recp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 293 | bn_recp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 294 | bn_recp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 295 | bn_recp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 296 | bn_recp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 297 | bn_recp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 298 | bn_recp.o: ../cryptlib.h bn_lcl.h bn_recp.c | ||
| 299 | bn_shift.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 300 | bn_shift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 301 | bn_shift.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 302 | bn_shift.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 303 | bn_shift.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 304 | bn_shift.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 305 | bn_shift.o: ../cryptlib.h bn_lcl.h bn_shift.c | ||
| 306 | bn_sqr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 307 | bn_sqr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 308 | bn_sqr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 309 | bn_sqr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 310 | bn_sqr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 311 | bn_sqr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 312 | bn_sqr.o: ../cryptlib.h bn_lcl.h bn_sqr.c | ||
| 313 | bn_sqrt.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 314 | bn_sqrt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 315 | bn_sqrt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 316 | bn_sqrt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 317 | bn_sqrt.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 318 | bn_sqrt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 319 | bn_sqrt.o: ../cryptlib.h bn_lcl.h bn_sqrt.c | ||
| 320 | bn_word.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 321 | bn_word.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 322 | bn_word.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 323 | bn_word.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 324 | bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 325 | bn_word.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 326 | bn_word.o: ../cryptlib.h bn_lcl.h bn_word.c | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.s b/src/lib/libcrypto/bn/asm/alpha.s deleted file mode 100644 index 555ff0b92d..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.s +++ /dev/null | |||
| @@ -1,3199 +0,0 @@ | |||
| 1 | # DEC Alpha assember | ||
| 2 | # The bn_div_words is actually gcc output but the other parts are hand done. | ||
| 3 | # Thanks to tzeruch@ceddec.com for sending me the gcc output for | ||
| 4 | # bn_div_words. | ||
| 5 | # I've gone back and re-done most of routines. | ||
| 6 | # The key thing to remeber for the 164 CPU is that while a | ||
| 7 | # multiply operation takes 8 cycles, another one can only be issued | ||
| 8 | # after 4 cycles have elapsed. I've done modification to help | ||
| 9 | # improve this. Also, normally, a ld instruction will not be available | ||
| 10 | # for about 3 cycles. | ||
| 11 | .file 1 "bn_asm.c" | ||
| 12 | .set noat | ||
| 13 | gcc2_compiled.: | ||
| 14 | __gnu_compiled_c: | ||
| 15 | .text | ||
| 16 | .align 3 | ||
| 17 | .globl bn_mul_add_words | ||
| 18 | .ent bn_mul_add_words | ||
| 19 | bn_mul_add_words: | ||
| 20 | bn_mul_add_words..ng: | ||
| 21 | .frame $30,0,$26,0 | ||
| 22 | .prologue 0 | ||
| 23 | .align 5 | ||
| 24 | subq $18,4,$18 | ||
| 25 | bis $31,$31,$0 | ||
| 26 | blt $18,$43 # if we are -1, -2, -3 or -4 goto tail code | ||
| 27 | ldq $20,0($17) # 1 1 | ||
| 28 | ldq $1,0($16) # 1 1 | ||
| 29 | .align 3 | ||
| 30 | $42: | ||
| 31 | mulq $20,$19,$5 # 1 2 1 ###### | ||
| 32 | ldq $21,8($17) # 2 1 | ||
| 33 | ldq $2,8($16) # 2 1 | ||
| 34 | umulh $20,$19,$20 # 1 2 ###### | ||
| 35 | ldq $27,16($17) # 3 1 | ||
| 36 | ldq $3,16($16) # 3 1 | ||
| 37 | mulq $21,$19,$6 # 2 2 1 ###### | ||
| 38 | ldq $28,24($17) # 4 1 | ||
| 39 | addq $1,$5,$1 # 1 2 2 | ||
| 40 | ldq $4,24($16) # 4 1 | ||
| 41 | umulh $21,$19,$21 # 2 2 ###### | ||
| 42 | cmpult $1,$5,$22 # 1 2 3 1 | ||
| 43 | addq $20,$22,$20 # 1 3 1 | ||
| 44 | addq $1,$0,$1 # 1 2 3 1 | ||
| 45 | mulq $27,$19,$7 # 3 2 1 ###### | ||
| 46 | cmpult $1,$0,$0 # 1 2 3 2 | ||
| 47 | addq $2,$6,$2 # 2 2 2 | ||
| 48 | addq $20,$0,$0 # 1 3 2 | ||
| 49 | cmpult $2,$6,$23 # 2 2 3 1 | ||
| 50 | addq $21,$23,$21 # 2 3 1 | ||
| 51 | umulh $27,$19,$27 # 3 2 ###### | ||
| 52 | addq $2,$0,$2 # 2 2 3 1 | ||
| 53 | cmpult $2,$0,$0 # 2 2 3 2 | ||
| 54 | subq $18,4,$18 | ||
| 55 | mulq $28,$19,$8 # 4 2 1 ###### | ||
| 56 | addq $21,$0,$0 # 2 3 2 | ||
| 57 | addq $3,$7,$3 # 3 2 2 | ||
| 58 | addq $16,32,$16 | ||
| 59 | cmpult $3,$7,$24 # 3 2 3 1 | ||
| 60 | stq $1,-32($16) # 1 2 4 | ||
| 61 | umulh $28,$19,$28 # 4 2 ###### | ||
| 62 | addq $27,$24,$27 # 3 3 1 | ||
| 63 | addq $3,$0,$3 # 3 2 3 1 | ||
| 64 | stq $2,-24($16) # 2 2 4 | ||
| 65 | cmpult $3,$0,$0 # 3 2 3 2 | ||
| 66 | stq $3,-16($16) # 3 2 4 | ||
| 67 | addq $4,$8,$4 # 4 2 2 | ||
| 68 | addq $27,$0,$0 # 3 3 2 | ||
| 69 | cmpult $4,$8,$25 # 4 2 3 1 | ||
| 70 | addq $17,32,$17 | ||
| 71 | addq $28,$25,$28 # 4 3 1 | ||
| 72 | addq $4,$0,$4 # 4 2 3 1 | ||
| 73 | cmpult $4,$0,$0 # 4 2 3 2 | ||
| 74 | stq $4,-8($16) # 4 2 4 | ||
| 75 | addq $28,$0,$0 # 4 3 2 | ||
| 76 | blt $18,$43 | ||
| 77 | |||
| 78 | ldq $20,0($17) # 1 1 | ||
| 79 | ldq $1,0($16) # 1 1 | ||
| 80 | |||
| 81 | br $42 | ||
| 82 | |||
| 83 | .align 4 | ||
| 84 | $45: | ||
| 85 | ldq $20,0($17) # 4 1 | ||
| 86 | ldq $1,0($16) # 4 1 | ||
| 87 | mulq $20,$19,$5 # 4 2 1 | ||
| 88 | subq $18,1,$18 | ||
| 89 | addq $16,8,$16 | ||
| 90 | addq $17,8,$17 | ||
| 91 | umulh $20,$19,$20 # 4 2 | ||
| 92 | addq $1,$5,$1 # 4 2 2 | ||
| 93 | cmpult $1,$5,$22 # 4 2 3 1 | ||
| 94 | addq $20,$22,$20 # 4 3 1 | ||
| 95 | addq $1,$0,$1 # 4 2 3 1 | ||
| 96 | cmpult $1,$0,$0 # 4 2 3 2 | ||
| 97 | addq $20,$0,$0 # 4 3 2 | ||
| 98 | stq $1,-8($16) # 4 2 4 | ||
| 99 | bgt $18,$45 | ||
| 100 | ret $31,($26),1 # else exit | ||
| 101 | |||
| 102 | .align 4 | ||
| 103 | $43: | ||
| 104 | addq $18,4,$18 | ||
| 105 | bgt $18,$45 # goto tail code | ||
| 106 | ret $31,($26),1 # else exit | ||
| 107 | |||
| 108 | .end bn_mul_add_words | ||
| 109 | .align 3 | ||
| 110 | .globl bn_mul_words | ||
| 111 | .ent bn_mul_words | ||
| 112 | bn_mul_words: | ||
| 113 | bn_mul_words..ng: | ||
| 114 | .frame $30,0,$26,0 | ||
| 115 | .prologue 0 | ||
| 116 | .align 5 | ||
| 117 | subq $18,4,$18 | ||
| 118 | bis $31,$31,$0 | ||
| 119 | blt $18,$143 # if we are -1, -2, -3 or -4 goto tail code | ||
| 120 | ldq $20,0($17) # 1 1 | ||
| 121 | .align 3 | ||
| 122 | $142: | ||
| 123 | |||
| 124 | mulq $20,$19,$5 # 1 2 1 ##### | ||
| 125 | ldq $21,8($17) # 2 1 | ||
| 126 | ldq $27,16($17) # 3 1 | ||
| 127 | umulh $20,$19,$20 # 1 2 ##### | ||
| 128 | ldq $28,24($17) # 4 1 | ||
| 129 | mulq $21,$19,$6 # 2 2 1 ##### | ||
| 130 | addq $5,$0,$5 # 1 2 3 1 | ||
| 131 | subq $18,4,$18 | ||
| 132 | cmpult $5,$0,$0 # 1 2 3 2 | ||
| 133 | umulh $21,$19,$21 # 2 2 ##### | ||
| 134 | addq $20,$0,$0 # 1 3 2 | ||
| 135 | addq $17,32,$17 | ||
| 136 | addq $6,$0,$6 # 2 2 3 1 | ||
| 137 | mulq $27,$19,$7 # 3 2 1 ##### | ||
| 138 | cmpult $6,$0,$0 # 2 2 3 2 | ||
| 139 | addq $21,$0,$0 # 2 3 2 | ||
| 140 | addq $16,32,$16 | ||
| 141 | umulh $27,$19,$27 # 3 2 ##### | ||
| 142 | stq $5,-32($16) # 1 2 4 | ||
| 143 | mulq $28,$19,$8 # 4 2 1 ##### | ||
| 144 | addq $7,$0,$7 # 3 2 3 1 | ||
| 145 | stq $6,-24($16) # 2 2 4 | ||
| 146 | cmpult $7,$0,$0 # 3 2 3 2 | ||
| 147 | umulh $28,$19,$28 # 4 2 ##### | ||
| 148 | addq $27,$0,$0 # 3 3 2 | ||
| 149 | stq $7,-16($16) # 3 2 4 | ||
| 150 | addq $8,$0,$8 # 4 2 3 1 | ||
| 151 | cmpult $8,$0,$0 # 4 2 3 2 | ||
| 152 | |||
| 153 | addq $28,$0,$0 # 4 3 2 | ||
| 154 | |||
| 155 | stq $8,-8($16) # 4 2 4 | ||
| 156 | |||
| 157 | blt $18,$143 | ||
| 158 | |||
| 159 | ldq $20,0($17) # 1 1 | ||
| 160 | |||
| 161 | br $142 | ||
| 162 | |||
| 163 | .align 4 | ||
| 164 | $145: | ||
| 165 | ldq $20,0($17) # 4 1 | ||
| 166 | mulq $20,$19,$5 # 4 2 1 | ||
| 167 | subq $18,1,$18 | ||
| 168 | umulh $20,$19,$20 # 4 2 | ||
| 169 | addq $5,$0,$5 # 4 2 3 1 | ||
| 170 | addq $16,8,$16 | ||
| 171 | cmpult $5,$0,$0 # 4 2 3 2 | ||
| 172 | addq $17,8,$17 | ||
| 173 | addq $20,$0,$0 # 4 3 2 | ||
| 174 | stq $5,-8($16) # 4 2 4 | ||
| 175 | |||
| 176 | bgt $18,$145 | ||
| 177 | ret $31,($26),1 # else exit | ||
| 178 | |||
| 179 | .align 4 | ||
| 180 | $143: | ||
| 181 | addq $18,4,$18 | ||
| 182 | bgt $18,$145 # goto tail code | ||
| 183 | ret $31,($26),1 # else exit | ||
| 184 | |||
| 185 | .end bn_mul_words | ||
| 186 | .align 3 | ||
| 187 | .globl bn_sqr_words | ||
| 188 | .ent bn_sqr_words | ||
| 189 | bn_sqr_words: | ||
| 190 | bn_sqr_words..ng: | ||
| 191 | .frame $30,0,$26,0 | ||
| 192 | .prologue 0 | ||
| 193 | |||
| 194 | subq $18,4,$18 | ||
| 195 | blt $18,$543 # if we are -1, -2, -3 or -4 goto tail code | ||
| 196 | ldq $20,0($17) # 1 1 | ||
| 197 | .align 3 | ||
| 198 | $542: | ||
| 199 | mulq $20,$20,$5 ###### | ||
| 200 | ldq $21,8($17) # 1 1 | ||
| 201 | subq $18,4 | ||
| 202 | umulh $20,$20,$1 ###### | ||
| 203 | ldq $27,16($17) # 1 1 | ||
| 204 | mulq $21,$21,$6 ###### | ||
| 205 | ldq $28,24($17) # 1 1 | ||
| 206 | stq $5,0($16) # r[0] | ||
| 207 | umulh $21,$21,$2 ###### | ||
| 208 | stq $1,8($16) # r[1] | ||
| 209 | mulq $27,$27,$7 ###### | ||
| 210 | stq $6,16($16) # r[0] | ||
| 211 | umulh $27,$27,$3 ###### | ||
| 212 | stq $2,24($16) # r[1] | ||
| 213 | mulq $28,$28,$8 ###### | ||
| 214 | stq $7,32($16) # r[0] | ||
| 215 | umulh $28,$28,$4 ###### | ||
| 216 | stq $3,40($16) # r[1] | ||
| 217 | |||
| 218 | addq $16,64,$16 | ||
| 219 | addq $17,32,$17 | ||
| 220 | stq $8,-16($16) # r[0] | ||
| 221 | stq $4,-8($16) # r[1] | ||
| 222 | |||
| 223 | blt $18,$543 | ||
| 224 | ldq $20,0($17) # 1 1 | ||
| 225 | br $542 | ||
| 226 | |||
| 227 | $442: | ||
| 228 | ldq $20,0($17) # a[0] | ||
| 229 | mulq $20,$20,$5 # a[0]*w low part r2 | ||
| 230 | addq $16,16,$16 | ||
| 231 | addq $17,8,$17 | ||
| 232 | subq $18,1,$18 | ||
| 233 | umulh $20,$20,$1 # a[0]*w high part r3 | ||
| 234 | stq $5,-16($16) # r[0] | ||
| 235 | stq $1,-8($16) # r[1] | ||
| 236 | |||
| 237 | bgt $18,$442 | ||
| 238 | ret $31,($26),1 # else exit | ||
| 239 | |||
| 240 | .align 4 | ||
| 241 | $543: | ||
| 242 | addq $18,4,$18 | ||
| 243 | bgt $18,$442 # goto tail code | ||
| 244 | ret $31,($26),1 # else exit | ||
| 245 | .end bn_sqr_words | ||
| 246 | |||
| 247 | .align 3 | ||
| 248 | .globl bn_add_words | ||
| 249 | .ent bn_add_words | ||
| 250 | bn_add_words: | ||
| 251 | bn_add_words..ng: | ||
| 252 | .frame $30,0,$26,0 | ||
| 253 | .prologue 0 | ||
| 254 | |||
| 255 | subq $19,4,$19 | ||
| 256 | bis $31,$31,$0 # carry = 0 | ||
| 257 | blt $19,$900 | ||
| 258 | ldq $5,0($17) # a[0] | ||
| 259 | ldq $1,0($18) # b[1] | ||
| 260 | .align 3 | ||
| 261 | $901: | ||
| 262 | addq $1,$5,$1 # r=a+b; | ||
| 263 | ldq $6,8($17) # a[1] | ||
| 264 | cmpult $1,$5,$22 # did we overflow? | ||
| 265 | ldq $2,8($18) # b[1] | ||
| 266 | addq $1,$0,$1 # c+= overflow | ||
| 267 | ldq $7,16($17) # a[2] | ||
| 268 | cmpult $1,$0,$0 # overflow? | ||
| 269 | ldq $3,16($18) # b[2] | ||
| 270 | addq $0,$22,$0 | ||
| 271 | ldq $8,24($17) # a[3] | ||
| 272 | addq $2,$6,$2 # r=a+b; | ||
| 273 | ldq $4,24($18) # b[3] | ||
| 274 | cmpult $2,$6,$23 # did we overflow? | ||
| 275 | addq $3,$7,$3 # r=a+b; | ||
| 276 | addq $2,$0,$2 # c+= overflow | ||
| 277 | cmpult $3,$7,$24 # did we overflow? | ||
| 278 | cmpult $2,$0,$0 # overflow? | ||
| 279 | addq $4,$8,$4 # r=a+b; | ||
| 280 | addq $0,$23,$0 | ||
| 281 | cmpult $4,$8,$25 # did we overflow? | ||
| 282 | addq $3,$0,$3 # c+= overflow | ||
| 283 | stq $1,0($16) # r[0]=c | ||
| 284 | cmpult $3,$0,$0 # overflow? | ||
| 285 | stq $2,8($16) # r[1]=c | ||
| 286 | addq $0,$24,$0 | ||
| 287 | stq $3,16($16) # r[2]=c | ||
| 288 | addq $4,$0,$4 # c+= overflow | ||
| 289 | subq $19,4,$19 # loop-- | ||
| 290 | cmpult $4,$0,$0 # overflow? | ||
| 291 | addq $17,32,$17 # a++ | ||
| 292 | addq $0,$25,$0 | ||
| 293 | stq $4,24($16) # r[3]=c | ||
| 294 | addq $18,32,$18 # b++ | ||
| 295 | addq $16,32,$16 # r++ | ||
| 296 | |||
| 297 | blt $19,$900 | ||
| 298 | ldq $5,0($17) # a[0] | ||
| 299 | ldq $1,0($18) # b[1] | ||
| 300 | br $901 | ||
| 301 | .align 4 | ||
| 302 | $945: | ||
| 303 | ldq $5,0($17) # a[0] | ||
| 304 | ldq $1,0($18) # b[1] | ||
| 305 | addq $1,$5,$1 # r=a+b; | ||
| 306 | subq $19,1,$19 # loop-- | ||
| 307 | addq $1,$0,$1 # c+= overflow | ||
| 308 | addq $17,8,$17 # a++ | ||
| 309 | cmpult $1,$5,$22 # did we overflow? | ||
| 310 | cmpult $1,$0,$0 # overflow? | ||
| 311 | addq $18,8,$18 # b++ | ||
| 312 | stq $1,0($16) # r[0]=c | ||
| 313 | addq $0,$22,$0 | ||
| 314 | addq $16,8,$16 # r++ | ||
| 315 | |||
| 316 | bgt $19,$945 | ||
| 317 | ret $31,($26),1 # else exit | ||
| 318 | |||
| 319 | $900: | ||
| 320 | addq $19,4,$19 | ||
| 321 | bgt $19,$945 # goto tail code | ||
| 322 | ret $31,($26),1 # else exit | ||
| 323 | .end bn_add_words | ||
| 324 | |||
| 325 | # | ||
| 326 | # What follows was taken directly from the C compiler with a few | ||
| 327 | # hacks to redo the lables. | ||
| 328 | # | ||
| 329 | .text | ||
| 330 | .align 3 | ||
| 331 | .globl bn_div_words | ||
| 332 | .ent bn_div_words | ||
| 333 | bn_div_words: | ||
| 334 | ldgp $29,0($27) | ||
| 335 | bn_div_words..ng: | ||
| 336 | lda $30,-48($30) | ||
| 337 | .frame $30,48,$26,0 | ||
| 338 | stq $26,0($30) | ||
| 339 | stq $9,8($30) | ||
| 340 | stq $10,16($30) | ||
| 341 | stq $11,24($30) | ||
| 342 | stq $12,32($30) | ||
| 343 | stq $13,40($30) | ||
| 344 | .mask 0x4003e00,-48 | ||
| 345 | .prologue 1 | ||
| 346 | bis $16,$16,$9 | ||
| 347 | bis $17,$17,$10 | ||
| 348 | bis $18,$18,$11 | ||
| 349 | bis $31,$31,$13 | ||
| 350 | bis $31,2,$12 | ||
| 351 | bne $11,$119 | ||
| 352 | lda $0,-1 | ||
| 353 | br $31,$136 | ||
| 354 | .align 4 | ||
| 355 | $119: | ||
| 356 | bis $11,$11,$16 | ||
| 357 | jsr $26,BN_num_bits_word | ||
| 358 | ldgp $29,0($26) | ||
| 359 | subq $0,64,$1 | ||
| 360 | beq $1,$120 | ||
| 361 | bis $31,1,$1 | ||
| 362 | sll $1,$0,$1 | ||
| 363 | cmpule $9,$1,$1 | ||
| 364 | bne $1,$120 | ||
| 365 | # lda $16,_IO_stderr_ | ||
| 366 | # lda $17,$C32 | ||
| 367 | # bis $0,$0,$18 | ||
| 368 | # jsr $26,fprintf | ||
| 369 | # ldgp $29,0($26) | ||
| 370 | jsr $26,abort | ||
| 371 | ldgp $29,0($26) | ||
| 372 | .align 4 | ||
| 373 | $120: | ||
| 374 | bis $31,64,$3 | ||
| 375 | cmpult $9,$11,$2 | ||
| 376 | subq $3,$0,$1 | ||
| 377 | addl $1,$31,$0 | ||
| 378 | subq $9,$11,$1 | ||
| 379 | cmoveq $2,$1,$9 | ||
| 380 | beq $0,$122 | ||
| 381 | zapnot $0,15,$2 | ||
| 382 | subq $3,$0,$1 | ||
| 383 | sll $11,$2,$11 | ||
| 384 | sll $9,$2,$3 | ||
| 385 | srl $10,$1,$1 | ||
| 386 | sll $10,$2,$10 | ||
| 387 | bis $3,$1,$9 | ||
| 388 | $122: | ||
| 389 | srl $11,32,$5 | ||
| 390 | zapnot $11,15,$6 | ||
| 391 | lda $7,-1 | ||
| 392 | .align 5 | ||
| 393 | $123: | ||
| 394 | srl $9,32,$1 | ||
| 395 | subq $1,$5,$1 | ||
| 396 | bne $1,$126 | ||
| 397 | zapnot $7,15,$27 | ||
| 398 | br $31,$127 | ||
| 399 | .align 4 | ||
| 400 | $126: | ||
| 401 | bis $9,$9,$24 | ||
| 402 | bis $5,$5,$25 | ||
| 403 | divqu $24,$25,$27 | ||
| 404 | $127: | ||
| 405 | srl $10,32,$4 | ||
| 406 | .align 5 | ||
| 407 | $128: | ||
| 408 | mulq $27,$5,$1 | ||
| 409 | subq $9,$1,$3 | ||
| 410 | zapnot $3,240,$1 | ||
| 411 | bne $1,$129 | ||
| 412 | mulq $6,$27,$2 | ||
| 413 | sll $3,32,$1 | ||
| 414 | addq $1,$4,$1 | ||
| 415 | cmpule $2,$1,$2 | ||
| 416 | bne $2,$129 | ||
| 417 | subq $27,1,$27 | ||
| 418 | br $31,$128 | ||
| 419 | .align 4 | ||
| 420 | $129: | ||
| 421 | mulq $27,$6,$1 | ||
| 422 | mulq $27,$5,$4 | ||
| 423 | srl $1,32,$3 | ||
| 424 | sll $1,32,$1 | ||
| 425 | addq $4,$3,$4 | ||
| 426 | cmpult $10,$1,$2 | ||
| 427 | subq $10,$1,$10 | ||
| 428 | addq $2,$4,$2 | ||
| 429 | cmpult $9,$2,$1 | ||
| 430 | bis $2,$2,$4 | ||
| 431 | beq $1,$134 | ||
| 432 | addq $9,$11,$9 | ||
| 433 | subq $27,1,$27 | ||
| 434 | $134: | ||
| 435 | subl $12,1,$12 | ||
| 436 | subq $9,$4,$9 | ||
| 437 | beq $12,$124 | ||
| 438 | sll $27,32,$13 | ||
| 439 | sll $9,32,$2 | ||
| 440 | srl $10,32,$1 | ||
| 441 | sll $10,32,$10 | ||
| 442 | bis $2,$1,$9 | ||
| 443 | br $31,$123 | ||
| 444 | .align 4 | ||
| 445 | $124: | ||
| 446 | bis $13,$27,$0 | ||
| 447 | $136: | ||
| 448 | ldq $26,0($30) | ||
| 449 | ldq $9,8($30) | ||
| 450 | ldq $10,16($30) | ||
| 451 | ldq $11,24($30) | ||
| 452 | ldq $12,32($30) | ||
| 453 | ldq $13,40($30) | ||
| 454 | addq $30,48,$30 | ||
| 455 | ret $31,($26),1 | ||
| 456 | .end bn_div_words | ||
| 457 | |||
| 458 | .set noat | ||
| 459 | .text | ||
| 460 | .align 3 | ||
| 461 | .globl bn_sub_words | ||
| 462 | .ent bn_sub_words | ||
| 463 | bn_sub_words: | ||
| 464 | bn_sub_words..ng: | ||
| 465 | .frame $30,0,$26,0 | ||
| 466 | .prologue 0 | ||
| 467 | |||
| 468 | subq $19, 4, $19 | ||
| 469 | bis $31, $31, $0 | ||
| 470 | blt $19, $100 | ||
| 471 | ldq $1, 0($17) | ||
| 472 | ldq $2, 0($18) | ||
| 473 | $101: | ||
| 474 | ldq $3, 8($17) | ||
| 475 | cmpult $1, $2, $4 | ||
| 476 | ldq $5, 8($18) | ||
| 477 | subq $1, $2, $1 | ||
| 478 | ldq $6, 16($17) | ||
| 479 | cmpult $1, $0, $2 | ||
| 480 | ldq $7, 16($18) | ||
| 481 | subq $1, $0, $23 | ||
| 482 | ldq $8, 24($17) | ||
| 483 | addq $2, $4, $0 | ||
| 484 | cmpult $3, $5, $24 | ||
| 485 | subq $3, $5, $3 | ||
| 486 | ldq $22, 24($18) | ||
| 487 | cmpult $3, $0, $5 | ||
| 488 | subq $3, $0, $25 | ||
| 489 | addq $5, $24, $0 | ||
| 490 | cmpult $6, $7, $27 | ||
| 491 | subq $6, $7, $6 | ||
| 492 | stq $23, 0($16) | ||
| 493 | cmpult $6, $0, $7 | ||
| 494 | subq $6, $0, $28 | ||
| 495 | addq $7, $27, $0 | ||
| 496 | cmpult $8, $22, $21 | ||
| 497 | subq $8, $22, $8 | ||
| 498 | stq $25, 8($16) | ||
| 499 | cmpult $8, $0, $22 | ||
| 500 | subq $8, $0, $20 | ||
| 501 | addq $22, $21, $0 | ||
| 502 | stq $28, 16($16) | ||
| 503 | subq $19, 4, $19 | ||
| 504 | stq $20, 24($16) | ||
| 505 | addq $17, 32, $17 | ||
| 506 | addq $18, 32, $18 | ||
| 507 | addq $16, 32, $16 | ||
| 508 | blt $19, $100 | ||
| 509 | ldq $1, 0($17) | ||
| 510 | ldq $2, 0($18) | ||
| 511 | br $101 | ||
| 512 | $102: | ||
| 513 | ldq $1, 0($17) | ||
| 514 | ldq $2, 0($18) | ||
| 515 | cmpult $1, $2, $27 | ||
| 516 | subq $1, $2, $1 | ||
| 517 | cmpult $1, $0, $2 | ||
| 518 | subq $1, $0, $1 | ||
| 519 | stq $1, 0($16) | ||
| 520 | addq $2, $27, $0 | ||
| 521 | addq $17, 8, $17 | ||
| 522 | addq $18, 8, $18 | ||
| 523 | addq $16, 8, $16 | ||
| 524 | subq $19, 1, $19 | ||
| 525 | bgt $19, $102 | ||
| 526 | ret $31,($26),1 | ||
| 527 | $100: | ||
| 528 | addq $19, 4, $19 | ||
| 529 | bgt $19, $102 | ||
| 530 | $103: | ||
| 531 | ret $31,($26),1 | ||
| 532 | .end bn_sub_words | ||
| 533 | .text | ||
| 534 | .align 3 | ||
| 535 | .globl bn_mul_comba4 | ||
| 536 | .ent bn_mul_comba4 | ||
| 537 | bn_mul_comba4: | ||
| 538 | bn_mul_comba4..ng: | ||
| 539 | .frame $30,0,$26,0 | ||
| 540 | .prologue 0 | ||
| 541 | |||
| 542 | ldq $0, 0($17) | ||
| 543 | ldq $1, 0($18) | ||
| 544 | ldq $2, 8($17) | ||
| 545 | ldq $3, 8($18) | ||
| 546 | ldq $4, 16($17) | ||
| 547 | ldq $5, 16($18) | ||
| 548 | ldq $6, 24($17) | ||
| 549 | ldq $7, 24($18) | ||
| 550 | bis $31, $31, $23 | ||
| 551 | mulq $0, $1, $8 | ||
| 552 | umulh $0, $1, $22 | ||
| 553 | stq $8, 0($16) | ||
| 554 | bis $31, $31, $8 | ||
| 555 | mulq $0, $3, $24 | ||
| 556 | umulh $0, $3, $25 | ||
| 557 | addq $22, $24, $22 | ||
| 558 | cmpult $22, $24, $27 | ||
| 559 | addq $27, $25, $25 | ||
| 560 | addq $23, $25, $23 | ||
| 561 | cmpult $23, $25, $28 | ||
| 562 | addq $8, $28, $8 | ||
| 563 | mulq $2, $1, $21 | ||
| 564 | umulh $2, $1, $20 | ||
| 565 | addq $22, $21, $22 | ||
| 566 | cmpult $22, $21, $19 | ||
| 567 | addq $19, $20, $20 | ||
| 568 | addq $23, $20, $23 | ||
| 569 | cmpult $23, $20, $17 | ||
| 570 | addq $8, $17, $8 | ||
| 571 | stq $22, 8($16) | ||
| 572 | bis $31, $31, $22 | ||
| 573 | mulq $2, $3, $18 | ||
| 574 | umulh $2, $3, $24 | ||
| 575 | addq $23, $18, $23 | ||
| 576 | cmpult $23, $18, $27 | ||
| 577 | addq $27, $24, $24 | ||
| 578 | addq $8, $24, $8 | ||
| 579 | cmpult $8, $24, $25 | ||
| 580 | addq $22, $25, $22 | ||
| 581 | mulq $0, $5, $28 | ||
| 582 | umulh $0, $5, $21 | ||
| 583 | addq $23, $28, $23 | ||
| 584 | cmpult $23, $28, $19 | ||
| 585 | addq $19, $21, $21 | ||
| 586 | addq $8, $21, $8 | ||
| 587 | cmpult $8, $21, $20 | ||
| 588 | addq $22, $20, $22 | ||
| 589 | mulq $4, $1, $17 | ||
| 590 | umulh $4, $1, $18 | ||
| 591 | addq $23, $17, $23 | ||
| 592 | cmpult $23, $17, $27 | ||
| 593 | addq $27, $18, $18 | ||
| 594 | addq $8, $18, $8 | ||
| 595 | cmpult $8, $18, $24 | ||
| 596 | addq $22, $24, $22 | ||
| 597 | stq $23, 16($16) | ||
| 598 | bis $31, $31, $23 | ||
| 599 | mulq $0, $7, $25 | ||
| 600 | umulh $0, $7, $28 | ||
| 601 | addq $8, $25, $8 | ||
| 602 | cmpult $8, $25, $19 | ||
| 603 | addq $19, $28, $28 | ||
| 604 | addq $22, $28, $22 | ||
| 605 | cmpult $22, $28, $21 | ||
| 606 | addq $23, $21, $23 | ||
| 607 | mulq $2, $5, $20 | ||
| 608 | umulh $2, $5, $17 | ||
| 609 | addq $8, $20, $8 | ||
| 610 | cmpult $8, $20, $27 | ||
| 611 | addq $27, $17, $17 | ||
| 612 | addq $22, $17, $22 | ||
| 613 | cmpult $22, $17, $18 | ||
| 614 | addq $23, $18, $23 | ||
| 615 | mulq $4, $3, $24 | ||
| 616 | umulh $4, $3, $25 | ||
| 617 | addq $8, $24, $8 | ||
| 618 | cmpult $8, $24, $19 | ||
| 619 | addq $19, $25, $25 | ||
| 620 | addq $22, $25, $22 | ||
| 621 | cmpult $22, $25, $28 | ||
| 622 | addq $23, $28, $23 | ||
| 623 | mulq $6, $1, $21 | ||
| 624 | umulh $6, $1, $0 | ||
| 625 | addq $8, $21, $8 | ||
| 626 | cmpult $8, $21, $20 | ||
| 627 | addq $20, $0, $0 | ||
| 628 | addq $22, $0, $22 | ||
| 629 | cmpult $22, $0, $27 | ||
| 630 | addq $23, $27, $23 | ||
| 631 | stq $8, 24($16) | ||
| 632 | bis $31, $31, $8 | ||
| 633 | mulq $2, $7, $17 | ||
| 634 | umulh $2, $7, $18 | ||
| 635 | addq $22, $17, $22 | ||
| 636 | cmpult $22, $17, $24 | ||
| 637 | addq $24, $18, $18 | ||
| 638 | addq $23, $18, $23 | ||
| 639 | cmpult $23, $18, $19 | ||
| 640 | addq $8, $19, $8 | ||
| 641 | mulq $4, $5, $25 | ||
| 642 | umulh $4, $5, $28 | ||
| 643 | addq $22, $25, $22 | ||
| 644 | cmpult $22, $25, $21 | ||
| 645 | addq $21, $28, $28 | ||
| 646 | addq $23, $28, $23 | ||
| 647 | cmpult $23, $28, $20 | ||
| 648 | addq $8, $20, $8 | ||
| 649 | mulq $6, $3, $0 | ||
| 650 | umulh $6, $3, $27 | ||
| 651 | addq $22, $0, $22 | ||
| 652 | cmpult $22, $0, $1 | ||
| 653 | addq $1, $27, $27 | ||
| 654 | addq $23, $27, $23 | ||
| 655 | cmpult $23, $27, $17 | ||
| 656 | addq $8, $17, $8 | ||
| 657 | stq $22, 32($16) | ||
| 658 | bis $31, $31, $22 | ||
| 659 | mulq $4, $7, $24 | ||
| 660 | umulh $4, $7, $18 | ||
| 661 | addq $23, $24, $23 | ||
| 662 | cmpult $23, $24, $19 | ||
| 663 | addq $19, $18, $18 | ||
| 664 | addq $8, $18, $8 | ||
| 665 | cmpult $8, $18, $2 | ||
| 666 | addq $22, $2, $22 | ||
| 667 | mulq $6, $5, $25 | ||
| 668 | umulh $6, $5, $21 | ||
| 669 | addq $23, $25, $23 | ||
| 670 | cmpult $23, $25, $28 | ||
| 671 | addq $28, $21, $21 | ||
| 672 | addq $8, $21, $8 | ||
| 673 | cmpult $8, $21, $20 | ||
| 674 | addq $22, $20, $22 | ||
| 675 | stq $23, 40($16) | ||
| 676 | bis $31, $31, $23 | ||
| 677 | mulq $6, $7, $0 | ||
| 678 | umulh $6, $7, $1 | ||
| 679 | addq $8, $0, $8 | ||
| 680 | cmpult $8, $0, $27 | ||
| 681 | addq $27, $1, $1 | ||
| 682 | addq $22, $1, $22 | ||
| 683 | cmpult $22, $1, $17 | ||
| 684 | addq $23, $17, $23 | ||
| 685 | stq $8, 48($16) | ||
| 686 | stq $22, 56($16) | ||
| 687 | ret $31,($26),1 | ||
| 688 | .end bn_mul_comba4 | ||
| 689 | .text | ||
| 690 | .align 3 | ||
| 691 | .globl bn_mul_comba8 | ||
| 692 | .ent bn_mul_comba8 | ||
| 693 | bn_mul_comba8: | ||
| 694 | bn_mul_comba8..ng: | ||
| 695 | .frame $30,0,$26,0 | ||
| 696 | .prologue 0 | ||
| 697 | ldq $1, 0($17) | ||
| 698 | ldq $2, 0($18) | ||
| 699 | zapnot $1, 15, $7 | ||
| 700 | srl $2, 32, $8 | ||
| 701 | mulq $8, $7, $22 | ||
| 702 | srl $1, 32, $6 | ||
| 703 | zapnot $2, 15, $5 | ||
| 704 | mulq $5, $6, $4 | ||
| 705 | mulq $7, $5, $24 | ||
| 706 | addq $22, $4, $22 | ||
| 707 | cmpult $22, $4, $1 | ||
| 708 | mulq $6, $8, $3 | ||
| 709 | beq $1, $173 | ||
| 710 | bis $31, 1, $1 | ||
| 711 | sll $1, 32, $1 | ||
| 712 | addq $3, $1, $3 | ||
| 713 | $173: | ||
| 714 | sll $22, 32, $4 | ||
| 715 | addq $24, $4, $24 | ||
| 716 | stq $24, 0($16) | ||
| 717 | ldq $2, 0($17) | ||
| 718 | ldq $1, 8($18) | ||
| 719 | zapnot $2, 15, $7 | ||
| 720 | srl $1, 32, $8 | ||
| 721 | mulq $8, $7, $25 | ||
| 722 | zapnot $1, 15, $5 | ||
| 723 | mulq $7, $5, $0 | ||
| 724 | srl $2, 32, $6 | ||
| 725 | mulq $5, $6, $23 | ||
| 726 | mulq $6, $8, $6 | ||
| 727 | srl $22, 32, $1 | ||
| 728 | cmpult $24, $4, $2 | ||
| 729 | addq $3, $1, $3 | ||
| 730 | addq $2, $3, $22 | ||
| 731 | addq $25, $23, $25 | ||
| 732 | cmpult $25, $23, $1 | ||
| 733 | bis $31, 1, $2 | ||
| 734 | beq $1, $177 | ||
| 735 | sll $2, 32, $1 | ||
| 736 | addq $6, $1, $6 | ||
| 737 | $177: | ||
| 738 | sll $25, 32, $23 | ||
| 739 | ldq $1, 0($18) | ||
| 740 | addq $0, $23, $0 | ||
| 741 | bis $0, $0, $7 | ||
| 742 | ldq $3, 8($17) | ||
| 743 | addq $22, $7, $22 | ||
| 744 | srl $1, 32, $8 | ||
| 745 | cmpult $22, $7, $4 | ||
| 746 | zapnot $3, 15, $7 | ||
| 747 | mulq $8, $7, $28 | ||
| 748 | zapnot $1, 15, $5 | ||
| 749 | mulq $7, $5, $21 | ||
| 750 | srl $25, 32, $1 | ||
| 751 | cmpult $0, $23, $2 | ||
| 752 | addq $6, $1, $6 | ||
| 753 | addq $2, $6, $6 | ||
| 754 | addq $4, $6, $24 | ||
| 755 | srl $3, 32, $6 | ||
| 756 | mulq $5, $6, $2 | ||
| 757 | mulq $6, $8, $6 | ||
| 758 | addq $28, $2, $28 | ||
| 759 | cmpult $28, $2, $1 | ||
| 760 | bis $31, 1, $2 | ||
| 761 | beq $1, $181 | ||
| 762 | sll $2, 32, $1 | ||
| 763 | addq $6, $1, $6 | ||
| 764 | $181: | ||
| 765 | sll $28, 32, $2 | ||
| 766 | addq $21, $2, $21 | ||
| 767 | bis $21, $21, $7 | ||
| 768 | addq $22, $7, $22 | ||
| 769 | stq $22, 8($16) | ||
| 770 | ldq $3, 16($17) | ||
| 771 | ldq $1, 0($18) | ||
| 772 | cmpult $22, $7, $4 | ||
| 773 | zapnot $3, 15, $7 | ||
| 774 | srl $1, 32, $8 | ||
| 775 | mulq $8, $7, $22 | ||
| 776 | zapnot $1, 15, $5 | ||
| 777 | mulq $7, $5, $20 | ||
| 778 | srl $28, 32, $1 | ||
| 779 | cmpult $21, $2, $2 | ||
| 780 | addq $6, $1, $6 | ||
| 781 | addq $2, $6, $6 | ||
| 782 | addq $4, $6, $6 | ||
| 783 | addq $24, $6, $24 | ||
| 784 | cmpult $24, $6, $23 | ||
| 785 | srl $3, 32, $6 | ||
| 786 | mulq $5, $6, $2 | ||
| 787 | mulq $6, $8, $6 | ||
| 788 | addq $22, $2, $22 | ||
| 789 | cmpult $22, $2, $1 | ||
| 790 | bis $31, 1, $2 | ||
| 791 | beq $1, $185 | ||
| 792 | sll $2, 32, $1 | ||
| 793 | addq $6, $1, $6 | ||
| 794 | $185: | ||
| 795 | sll $22, 32, $2 | ||
| 796 | ldq $1, 8($18) | ||
| 797 | addq $20, $2, $20 | ||
| 798 | bis $20, $20, $7 | ||
| 799 | ldq $4, 8($17) | ||
| 800 | addq $24, $7, $24 | ||
| 801 | srl $1, 32, $8 | ||
| 802 | cmpult $24, $7, $3 | ||
| 803 | zapnot $4, 15, $7 | ||
| 804 | mulq $8, $7, $25 | ||
| 805 | zapnot $1, 15, $5 | ||
| 806 | mulq $7, $5, $0 | ||
| 807 | srl $22, 32, $1 | ||
| 808 | cmpult $20, $2, $2 | ||
| 809 | addq $6, $1, $6 | ||
| 810 | addq $2, $6, $6 | ||
| 811 | addq $3, $6, $6 | ||
| 812 | addq $23, $6, $23 | ||
| 813 | cmpult $23, $6, $22 | ||
| 814 | srl $4, 32, $6 | ||
| 815 | mulq $5, $6, $5 | ||
| 816 | bis $31, 1, $21 | ||
| 817 | addq $25, $5, $25 | ||
| 818 | cmpult $25, $5, $1 | ||
| 819 | mulq $6, $8, $6 | ||
| 820 | beq $1, $189 | ||
| 821 | sll $21, 32, $1 | ||
| 822 | addq $6, $1, $6 | ||
| 823 | $189: | ||
| 824 | sll $25, 32, $5 | ||
| 825 | ldq $2, 16($18) | ||
| 826 | addq $0, $5, $0 | ||
| 827 | bis $0, $0, $7 | ||
| 828 | ldq $4, 0($17) | ||
| 829 | addq $24, $7, $24 | ||
| 830 | srl $2, 32, $8 | ||
| 831 | cmpult $24, $7, $3 | ||
| 832 | zapnot $4, 15, $7 | ||
| 833 | mulq $8, $7, $28 | ||
| 834 | srl $25, 32, $1 | ||
| 835 | addq $6, $1, $6 | ||
| 836 | cmpult $0, $5, $1 | ||
| 837 | zapnot $2, 15, $5 | ||
| 838 | addq $1, $6, $6 | ||
| 839 | addq $3, $6, $6 | ||
| 840 | addq $23, $6, $23 | ||
| 841 | cmpult $23, $6, $1 | ||
| 842 | srl $4, 32, $6 | ||
| 843 | mulq $5, $6, $25 | ||
| 844 | mulq $7, $5, $2 | ||
| 845 | addq $1, $22, $22 | ||
| 846 | addq $28, $25, $28 | ||
| 847 | cmpult $28, $25, $1 | ||
| 848 | mulq $6, $8, $6 | ||
| 849 | beq $1, $193 | ||
| 850 | sll $21, 32, $1 | ||
| 851 | addq $6, $1, $6 | ||
| 852 | $193: | ||
| 853 | sll $28, 32, $25 | ||
| 854 | addq $2, $25, $2 | ||
| 855 | bis $2, $2, $7 | ||
| 856 | addq $24, $7, $24 | ||
| 857 | stq $24, 16($16) | ||
| 858 | ldq $4, 0($17) | ||
| 859 | ldq $5, 24($18) | ||
| 860 | cmpult $24, $7, $3 | ||
| 861 | zapnot $4, 15, $7 | ||
| 862 | srl $5, 32, $8 | ||
| 863 | mulq $8, $7, $0 | ||
| 864 | srl $28, 32, $1 | ||
| 865 | cmpult $2, $25, $2 | ||
| 866 | addq $6, $1, $6 | ||
| 867 | addq $2, $6, $6 | ||
| 868 | addq $3, $6, $6 | ||
| 869 | addq $23, $6, $23 | ||
| 870 | cmpult $23, $6, $1 | ||
| 871 | srl $4, 32, $6 | ||
| 872 | zapnot $5, 15, $5 | ||
| 873 | mulq $5, $6, $24 | ||
| 874 | mulq $7, $5, $2 | ||
| 875 | addq $1, $22, $22 | ||
| 876 | addq $0, $24, $0 | ||
| 877 | cmpult $0, $24, $1 | ||
| 878 | mulq $6, $8, $6 | ||
| 879 | beq $1, $197 | ||
| 880 | sll $21, 32, $1 | ||
| 881 | addq $6, $1, $6 | ||
| 882 | $197: | ||
| 883 | sll $0, 32, $24 | ||
| 884 | ldq $1, 16($18) | ||
| 885 | addq $2, $24, $2 | ||
| 886 | bis $2, $2, $7 | ||
| 887 | ldq $4, 8($17) | ||
| 888 | addq $23, $7, $23 | ||
| 889 | srl $1, 32, $8 | ||
| 890 | cmpult $23, $7, $3 | ||
| 891 | zapnot $4, 15, $7 | ||
| 892 | mulq $8, $7, $25 | ||
| 893 | zapnot $1, 15, $5 | ||
| 894 | mulq $7, $5, $21 | ||
| 895 | srl $0, 32, $1 | ||
| 896 | cmpult $2, $24, $2 | ||
| 897 | addq $6, $1, $6 | ||
| 898 | addq $2, $6, $6 | ||
| 899 | addq $3, $6, $6 | ||
| 900 | addq $22, $6, $22 | ||
| 901 | cmpult $22, $6, $24 | ||
| 902 | srl $4, 32, $6 | ||
| 903 | mulq $5, $6, $5 | ||
| 904 | bis $31, 1, $20 | ||
| 905 | addq $25, $5, $25 | ||
| 906 | cmpult $25, $5, $1 | ||
| 907 | mulq $6, $8, $6 | ||
| 908 | beq $1, $201 | ||
| 909 | sll $20, 32, $1 | ||
| 910 | addq $6, $1, $6 | ||
| 911 | $201: | ||
| 912 | sll $25, 32, $5 | ||
| 913 | ldq $2, 8($18) | ||
| 914 | addq $21, $5, $21 | ||
| 915 | bis $21, $21, $7 | ||
| 916 | ldq $4, 16($17) | ||
| 917 | addq $23, $7, $23 | ||
| 918 | srl $2, 32, $8 | ||
| 919 | cmpult $23, $7, $3 | ||
| 920 | zapnot $4, 15, $7 | ||
| 921 | mulq $8, $7, $28 | ||
| 922 | srl $25, 32, $1 | ||
| 923 | addq $6, $1, $6 | ||
| 924 | cmpult $21, $5, $1 | ||
| 925 | zapnot $2, 15, $5 | ||
| 926 | addq $1, $6, $6 | ||
| 927 | addq $3, $6, $6 | ||
| 928 | addq $22, $6, $22 | ||
| 929 | cmpult $22, $6, $1 | ||
| 930 | srl $4, 32, $6 | ||
| 931 | mulq $5, $6, $25 | ||
| 932 | mulq $7, $5, $5 | ||
| 933 | addq $1, $24, $24 | ||
| 934 | addq $28, $25, $28 | ||
| 935 | cmpult $28, $25, $1 | ||
| 936 | mulq $6, $8, $6 | ||
| 937 | beq $1, $205 | ||
| 938 | sll $20, 32, $1 | ||
| 939 | addq $6, $1, $6 | ||
| 940 | $205: | ||
| 941 | sll $28, 32, $25 | ||
| 942 | ldq $2, 0($18) | ||
| 943 | addq $5, $25, $5 | ||
| 944 | bis $5, $5, $7 | ||
| 945 | ldq $4, 24($17) | ||
| 946 | addq $23, $7, $23 | ||
| 947 | srl $2, 32, $8 | ||
| 948 | cmpult $23, $7, $3 | ||
| 949 | zapnot $4, 15, $7 | ||
| 950 | mulq $8, $7, $0 | ||
| 951 | srl $28, 32, $1 | ||
| 952 | addq $6, $1, $6 | ||
| 953 | cmpult $5, $25, $1 | ||
| 954 | zapnot $2, 15, $5 | ||
| 955 | addq $1, $6, $6 | ||
| 956 | addq $3, $6, $6 | ||
| 957 | addq $22, $6, $22 | ||
| 958 | cmpult $22, $6, $1 | ||
| 959 | srl $4, 32, $6 | ||
| 960 | mulq $5, $6, $25 | ||
| 961 | mulq $7, $5, $2 | ||
| 962 | addq $1, $24, $24 | ||
| 963 | addq $0, $25, $0 | ||
| 964 | cmpult $0, $25, $1 | ||
| 965 | mulq $6, $8, $6 | ||
| 966 | beq $1, $209 | ||
| 967 | sll $20, 32, $1 | ||
| 968 | addq $6, $1, $6 | ||
| 969 | $209: | ||
| 970 | sll $0, 32, $25 | ||
| 971 | addq $2, $25, $2 | ||
| 972 | bis $2, $2, $7 | ||
| 973 | addq $23, $7, $23 | ||
| 974 | stq $23, 24($16) | ||
| 975 | ldq $4, 32($17) | ||
| 976 | ldq $5, 0($18) | ||
| 977 | cmpult $23, $7, $3 | ||
| 978 | zapnot $4, 15, $7 | ||
| 979 | srl $5, 32, $8 | ||
| 980 | mulq $8, $7, $28 | ||
| 981 | srl $0, 32, $1 | ||
| 982 | cmpult $2, $25, $2 | ||
| 983 | addq $6, $1, $6 | ||
| 984 | addq $2, $6, $6 | ||
| 985 | addq $3, $6, $6 | ||
| 986 | addq $22, $6, $22 | ||
| 987 | cmpult $22, $6, $1 | ||
| 988 | srl $4, 32, $6 | ||
| 989 | zapnot $5, 15, $5 | ||
| 990 | mulq $5, $6, $23 | ||
| 991 | mulq $7, $5, $2 | ||
| 992 | addq $1, $24, $24 | ||
| 993 | addq $28, $23, $28 | ||
| 994 | cmpult $28, $23, $1 | ||
| 995 | mulq $6, $8, $6 | ||
| 996 | beq $1, $213 | ||
| 997 | sll $20, 32, $1 | ||
| 998 | addq $6, $1, $6 | ||
| 999 | $213: | ||
| 1000 | sll $28, 32, $23 | ||
| 1001 | ldq $1, 8($18) | ||
| 1002 | addq $2, $23, $2 | ||
| 1003 | bis $2, $2, $7 | ||
| 1004 | ldq $4, 24($17) | ||
| 1005 | addq $22, $7, $22 | ||
| 1006 | srl $1, 32, $8 | ||
| 1007 | cmpult $22, $7, $3 | ||
| 1008 | zapnot $4, 15, $7 | ||
| 1009 | mulq $8, $7, $25 | ||
| 1010 | zapnot $1, 15, $5 | ||
| 1011 | mulq $7, $5, $0 | ||
| 1012 | srl $28, 32, $1 | ||
| 1013 | cmpult $2, $23, $2 | ||
| 1014 | addq $6, $1, $6 | ||
| 1015 | addq $2, $6, $6 | ||
| 1016 | addq $3, $6, $6 | ||
| 1017 | addq $24, $6, $24 | ||
| 1018 | cmpult $24, $6, $23 | ||
| 1019 | srl $4, 32, $6 | ||
| 1020 | mulq $5, $6, $5 | ||
| 1021 | bis $31, 1, $21 | ||
| 1022 | addq $25, $5, $25 | ||
| 1023 | cmpult $25, $5, $1 | ||
| 1024 | mulq $6, $8, $6 | ||
| 1025 | beq $1, $217 | ||
| 1026 | sll $21, 32, $1 | ||
| 1027 | addq $6, $1, $6 | ||
| 1028 | $217: | ||
| 1029 | sll $25, 32, $5 | ||
| 1030 | ldq $2, 16($18) | ||
| 1031 | addq $0, $5, $0 | ||
| 1032 | bis $0, $0, $7 | ||
| 1033 | ldq $4, 16($17) | ||
| 1034 | addq $22, $7, $22 | ||
| 1035 | srl $2, 32, $8 | ||
| 1036 | cmpult $22, $7, $3 | ||
| 1037 | zapnot $4, 15, $7 | ||
| 1038 | mulq $8, $7, $28 | ||
| 1039 | srl $25, 32, $1 | ||
| 1040 | addq $6, $1, $6 | ||
| 1041 | cmpult $0, $5, $1 | ||
| 1042 | zapnot $2, 15, $5 | ||
| 1043 | addq $1, $6, $6 | ||
| 1044 | addq $3, $6, $6 | ||
| 1045 | addq $24, $6, $24 | ||
| 1046 | cmpult $24, $6, $1 | ||
| 1047 | srl $4, 32, $6 | ||
| 1048 | mulq $5, $6, $25 | ||
| 1049 | mulq $7, $5, $5 | ||
| 1050 | addq $1, $23, $23 | ||
| 1051 | addq $28, $25, $28 | ||
| 1052 | cmpult $28, $25, $1 | ||
| 1053 | mulq $6, $8, $6 | ||
| 1054 | beq $1, $221 | ||
| 1055 | sll $21, 32, $1 | ||
| 1056 | addq $6, $1, $6 | ||
| 1057 | $221: | ||
| 1058 | sll $28, 32, $25 | ||
| 1059 | ldq $2, 24($18) | ||
| 1060 | addq $5, $25, $5 | ||
| 1061 | bis $5, $5, $7 | ||
| 1062 | ldq $4, 8($17) | ||
| 1063 | addq $22, $7, $22 | ||
| 1064 | srl $2, 32, $8 | ||
| 1065 | cmpult $22, $7, $3 | ||
| 1066 | zapnot $4, 15, $7 | ||
| 1067 | mulq $8, $7, $0 | ||
| 1068 | srl $28, 32, $1 | ||
| 1069 | addq $6, $1, $6 | ||
| 1070 | cmpult $5, $25, $1 | ||
| 1071 | zapnot $2, 15, $5 | ||
| 1072 | addq $1, $6, $6 | ||
| 1073 | addq $3, $6, $6 | ||
| 1074 | addq $24, $6, $24 | ||
| 1075 | cmpult $24, $6, $1 | ||
| 1076 | srl $4, 32, $6 | ||
| 1077 | mulq $5, $6, $25 | ||
| 1078 | mulq $7, $5, $5 | ||
| 1079 | addq $1, $23, $23 | ||
| 1080 | addq $0, $25, $0 | ||
| 1081 | cmpult $0, $25, $1 | ||
| 1082 | mulq $6, $8, $6 | ||
| 1083 | beq $1, $225 | ||
| 1084 | sll $21, 32, $1 | ||
| 1085 | addq $6, $1, $6 | ||
| 1086 | $225: | ||
| 1087 | sll $0, 32, $25 | ||
| 1088 | ldq $2, 32($18) | ||
| 1089 | addq $5, $25, $5 | ||
| 1090 | bis $5, $5, $7 | ||
| 1091 | ldq $4, 0($17) | ||
| 1092 | addq $22, $7, $22 | ||
| 1093 | srl $2, 32, $8 | ||
| 1094 | cmpult $22, $7, $3 | ||
| 1095 | zapnot $4, 15, $7 | ||
| 1096 | mulq $8, $7, $28 | ||
| 1097 | srl $0, 32, $1 | ||
| 1098 | addq $6, $1, $6 | ||
| 1099 | cmpult $5, $25, $1 | ||
| 1100 | zapnot $2, 15, $5 | ||
| 1101 | addq $1, $6, $6 | ||
| 1102 | addq $3, $6, $6 | ||
| 1103 | addq $24, $6, $24 | ||
| 1104 | cmpult $24, $6, $1 | ||
| 1105 | srl $4, 32, $6 | ||
| 1106 | mulq $5, $6, $25 | ||
| 1107 | mulq $7, $5, $2 | ||
| 1108 | addq $1, $23, $23 | ||
| 1109 | addq $28, $25, $28 | ||
| 1110 | cmpult $28, $25, $1 | ||
| 1111 | mulq $6, $8, $6 | ||
| 1112 | beq $1, $229 | ||
| 1113 | sll $21, 32, $1 | ||
| 1114 | addq $6, $1, $6 | ||
| 1115 | $229: | ||
| 1116 | sll $28, 32, $25 | ||
| 1117 | addq $2, $25, $2 | ||
| 1118 | bis $2, $2, $7 | ||
| 1119 | addq $22, $7, $22 | ||
| 1120 | stq $22, 32($16) | ||
| 1121 | ldq $4, 0($17) | ||
| 1122 | ldq $5, 40($18) | ||
| 1123 | cmpult $22, $7, $3 | ||
| 1124 | zapnot $4, 15, $7 | ||
| 1125 | srl $5, 32, $8 | ||
| 1126 | mulq $8, $7, $0 | ||
| 1127 | srl $28, 32, $1 | ||
| 1128 | cmpult $2, $25, $2 | ||
| 1129 | addq $6, $1, $6 | ||
| 1130 | addq $2, $6, $6 | ||
| 1131 | addq $3, $6, $6 | ||
| 1132 | addq $24, $6, $24 | ||
| 1133 | cmpult $24, $6, $1 | ||
| 1134 | srl $4, 32, $6 | ||
| 1135 | zapnot $5, 15, $5 | ||
| 1136 | mulq $5, $6, $22 | ||
| 1137 | mulq $7, $5, $2 | ||
| 1138 | addq $1, $23, $23 | ||
| 1139 | addq $0, $22, $0 | ||
| 1140 | cmpult $0, $22, $1 | ||
| 1141 | mulq $6, $8, $6 | ||
| 1142 | beq $1, $233 | ||
| 1143 | sll $21, 32, $1 | ||
| 1144 | addq $6, $1, $6 | ||
| 1145 | $233: | ||
| 1146 | sll $0, 32, $22 | ||
| 1147 | ldq $1, 32($18) | ||
| 1148 | addq $2, $22, $2 | ||
| 1149 | bis $2, $2, $7 | ||
| 1150 | ldq $4, 8($17) | ||
| 1151 | addq $24, $7, $24 | ||
| 1152 | srl $1, 32, $8 | ||
| 1153 | cmpult $24, $7, $3 | ||
| 1154 | zapnot $4, 15, $7 | ||
| 1155 | mulq $8, $7, $25 | ||
| 1156 | zapnot $1, 15, $5 | ||
| 1157 | mulq $7, $5, $21 | ||
| 1158 | srl $0, 32, $1 | ||
| 1159 | cmpult $2, $22, $2 | ||
| 1160 | addq $6, $1, $6 | ||
| 1161 | addq $2, $6, $6 | ||
| 1162 | addq $3, $6, $6 | ||
| 1163 | addq $23, $6, $23 | ||
| 1164 | cmpult $23, $6, $22 | ||
| 1165 | srl $4, 32, $6 | ||
| 1166 | mulq $5, $6, $5 | ||
| 1167 | bis $31, 1, $20 | ||
| 1168 | addq $25, $5, $25 | ||
| 1169 | cmpult $25, $5, $1 | ||
| 1170 | mulq $6, $8, $6 | ||
| 1171 | beq $1, $237 | ||
| 1172 | sll $20, 32, $1 | ||
| 1173 | addq $6, $1, $6 | ||
| 1174 | $237: | ||
| 1175 | sll $25, 32, $5 | ||
| 1176 | ldq $2, 24($18) | ||
| 1177 | addq $21, $5, $21 | ||
| 1178 | bis $21, $21, $7 | ||
| 1179 | ldq $4, 16($17) | ||
| 1180 | addq $24, $7, $24 | ||
| 1181 | srl $2, 32, $8 | ||
| 1182 | cmpult $24, $7, $3 | ||
| 1183 | zapnot $4, 15, $7 | ||
| 1184 | mulq $8, $7, $28 | ||
| 1185 | srl $25, 32, $1 | ||
| 1186 | addq $6, $1, $6 | ||
| 1187 | cmpult $21, $5, $1 | ||
| 1188 | zapnot $2, 15, $5 | ||
| 1189 | addq $1, $6, $6 | ||
| 1190 | addq $3, $6, $6 | ||
| 1191 | addq $23, $6, $23 | ||
| 1192 | cmpult $23, $6, $1 | ||
| 1193 | srl $4, 32, $6 | ||
| 1194 | mulq $5, $6, $25 | ||
| 1195 | mulq $7, $5, $5 | ||
| 1196 | addq $1, $22, $22 | ||
| 1197 | addq $28, $25, $28 | ||
| 1198 | cmpult $28, $25, $1 | ||
| 1199 | mulq $6, $8, $6 | ||
| 1200 | beq $1, $241 | ||
| 1201 | sll $20, 32, $1 | ||
| 1202 | addq $6, $1, $6 | ||
| 1203 | $241: | ||
| 1204 | sll $28, 32, $25 | ||
| 1205 | ldq $2, 16($18) | ||
| 1206 | addq $5, $25, $5 | ||
| 1207 | bis $5, $5, $7 | ||
| 1208 | ldq $4, 24($17) | ||
| 1209 | addq $24, $7, $24 | ||
| 1210 | srl $2, 32, $8 | ||
| 1211 | cmpult $24, $7, $3 | ||
| 1212 | zapnot $4, 15, $7 | ||
| 1213 | mulq $8, $7, $0 | ||
| 1214 | srl $28, 32, $1 | ||
| 1215 | addq $6, $1, $6 | ||
| 1216 | cmpult $5, $25, $1 | ||
| 1217 | zapnot $2, 15, $5 | ||
| 1218 | addq $1, $6, $6 | ||
| 1219 | addq $3, $6, $6 | ||
| 1220 | addq $23, $6, $23 | ||
| 1221 | cmpult $23, $6, $1 | ||
| 1222 | srl $4, 32, $6 | ||
| 1223 | mulq $5, $6, $25 | ||
| 1224 | mulq $7, $5, $5 | ||
| 1225 | addq $1, $22, $22 | ||
| 1226 | addq $0, $25, $0 | ||
| 1227 | cmpult $0, $25, $1 | ||
| 1228 | mulq $6, $8, $6 | ||
| 1229 | beq $1, $245 | ||
| 1230 | sll $20, 32, $1 | ||
| 1231 | addq $6, $1, $6 | ||
| 1232 | $245: | ||
| 1233 | sll $0, 32, $25 | ||
| 1234 | ldq $2, 8($18) | ||
| 1235 | addq $5, $25, $5 | ||
| 1236 | bis $5, $5, $7 | ||
| 1237 | ldq $4, 32($17) | ||
| 1238 | addq $24, $7, $24 | ||
| 1239 | srl $2, 32, $8 | ||
| 1240 | cmpult $24, $7, $3 | ||
| 1241 | zapnot $4, 15, $7 | ||
| 1242 | mulq $8, $7, $28 | ||
| 1243 | srl $0, 32, $1 | ||
| 1244 | addq $6, $1, $6 | ||
| 1245 | cmpult $5, $25, $1 | ||
| 1246 | zapnot $2, 15, $5 | ||
| 1247 | addq $1, $6, $6 | ||
| 1248 | addq $3, $6, $6 | ||
| 1249 | addq $23, $6, $23 | ||
| 1250 | cmpult $23, $6, $1 | ||
| 1251 | srl $4, 32, $6 | ||
| 1252 | mulq $5, $6, $25 | ||
| 1253 | mulq $7, $5, $5 | ||
| 1254 | addq $1, $22, $22 | ||
| 1255 | addq $28, $25, $28 | ||
| 1256 | cmpult $28, $25, $1 | ||
| 1257 | mulq $6, $8, $6 | ||
| 1258 | beq $1, $249 | ||
| 1259 | sll $20, 32, $1 | ||
| 1260 | addq $6, $1, $6 | ||
| 1261 | $249: | ||
| 1262 | sll $28, 32, $25 | ||
| 1263 | ldq $2, 0($18) | ||
| 1264 | addq $5, $25, $5 | ||
| 1265 | bis $5, $5, $7 | ||
| 1266 | ldq $4, 40($17) | ||
| 1267 | addq $24, $7, $24 | ||
| 1268 | srl $2, 32, $8 | ||
| 1269 | cmpult $24, $7, $3 | ||
| 1270 | zapnot $4, 15, $7 | ||
| 1271 | mulq $8, $7, $0 | ||
| 1272 | srl $28, 32, $1 | ||
| 1273 | addq $6, $1, $6 | ||
| 1274 | cmpult $5, $25, $1 | ||
| 1275 | zapnot $2, 15, $5 | ||
| 1276 | addq $1, $6, $6 | ||
| 1277 | addq $3, $6, $6 | ||
| 1278 | addq $23, $6, $23 | ||
| 1279 | cmpult $23, $6, $1 | ||
| 1280 | srl $4, 32, $6 | ||
| 1281 | mulq $5, $6, $25 | ||
| 1282 | mulq $7, $5, $2 | ||
| 1283 | addq $1, $22, $22 | ||
| 1284 | addq $0, $25, $0 | ||
| 1285 | cmpult $0, $25, $1 | ||
| 1286 | mulq $6, $8, $6 | ||
| 1287 | beq $1, $253 | ||
| 1288 | sll $20, 32, $1 | ||
| 1289 | addq $6, $1, $6 | ||
| 1290 | $253: | ||
| 1291 | sll $0, 32, $25 | ||
| 1292 | addq $2, $25, $2 | ||
| 1293 | bis $2, $2, $7 | ||
| 1294 | addq $24, $7, $24 | ||
| 1295 | stq $24, 40($16) | ||
| 1296 | ldq $4, 48($17) | ||
| 1297 | ldq $5, 0($18) | ||
| 1298 | cmpult $24, $7, $3 | ||
| 1299 | zapnot $4, 15, $7 | ||
| 1300 | srl $5, 32, $8 | ||
| 1301 | mulq $8, $7, $28 | ||
| 1302 | srl $0, 32, $1 | ||
| 1303 | cmpult $2, $25, $2 | ||
| 1304 | addq $6, $1, $6 | ||
| 1305 | addq $2, $6, $6 | ||
| 1306 | addq $3, $6, $6 | ||
| 1307 | addq $23, $6, $23 | ||
| 1308 | cmpult $23, $6, $1 | ||
| 1309 | srl $4, 32, $6 | ||
| 1310 | zapnot $5, 15, $5 | ||
| 1311 | mulq $5, $6, $24 | ||
| 1312 | mulq $7, $5, $2 | ||
| 1313 | addq $1, $22, $22 | ||
| 1314 | addq $28, $24, $28 | ||
| 1315 | cmpult $28, $24, $1 | ||
| 1316 | mulq $6, $8, $6 | ||
| 1317 | beq $1, $257 | ||
| 1318 | sll $20, 32, $1 | ||
| 1319 | addq $6, $1, $6 | ||
| 1320 | $257: | ||
| 1321 | sll $28, 32, $24 | ||
| 1322 | ldq $1, 8($18) | ||
| 1323 | addq $2, $24, $2 | ||
| 1324 | bis $2, $2, $7 | ||
| 1325 | ldq $4, 40($17) | ||
| 1326 | addq $23, $7, $23 | ||
| 1327 | srl $1, 32, $8 | ||
| 1328 | cmpult $23, $7, $3 | ||
| 1329 | zapnot $4, 15, $7 | ||
| 1330 | mulq $8, $7, $25 | ||
| 1331 | zapnot $1, 15, $5 | ||
| 1332 | mulq $7, $5, $0 | ||
| 1333 | srl $28, 32, $1 | ||
| 1334 | cmpult $2, $24, $2 | ||
| 1335 | addq $6, $1, $6 | ||
| 1336 | addq $2, $6, $6 | ||
| 1337 | addq $3, $6, $6 | ||
| 1338 | addq $22, $6, $22 | ||
| 1339 | cmpult $22, $6, $24 | ||
| 1340 | srl $4, 32, $6 | ||
| 1341 | mulq $5, $6, $5 | ||
| 1342 | bis $31, 1, $21 | ||
| 1343 | addq $25, $5, $25 | ||
| 1344 | cmpult $25, $5, $1 | ||
| 1345 | mulq $6, $8, $6 | ||
| 1346 | beq $1, $261 | ||
| 1347 | sll $21, 32, $1 | ||
| 1348 | addq $6, $1, $6 | ||
| 1349 | $261: | ||
| 1350 | sll $25, 32, $5 | ||
| 1351 | ldq $2, 16($18) | ||
| 1352 | addq $0, $5, $0 | ||
| 1353 | bis $0, $0, $7 | ||
| 1354 | ldq $4, 32($17) | ||
| 1355 | addq $23, $7, $23 | ||
| 1356 | srl $2, 32, $8 | ||
| 1357 | cmpult $23, $7, $3 | ||
| 1358 | zapnot $4, 15, $7 | ||
| 1359 | mulq $8, $7, $28 | ||
| 1360 | srl $25, 32, $1 | ||
| 1361 | addq $6, $1, $6 | ||
| 1362 | cmpult $0, $5, $1 | ||
| 1363 | zapnot $2, 15, $5 | ||
| 1364 | addq $1, $6, $6 | ||
| 1365 | addq $3, $6, $6 | ||
| 1366 | addq $22, $6, $22 | ||
| 1367 | cmpult $22, $6, $1 | ||
| 1368 | srl $4, 32, $6 | ||
| 1369 | mulq $5, $6, $25 | ||
| 1370 | mulq $7, $5, $5 | ||
| 1371 | addq $1, $24, $24 | ||
| 1372 | addq $28, $25, $28 | ||
| 1373 | cmpult $28, $25, $1 | ||
| 1374 | mulq $6, $8, $6 | ||
| 1375 | beq $1, $265 | ||
| 1376 | sll $21, 32, $1 | ||
| 1377 | addq $6, $1, $6 | ||
| 1378 | $265: | ||
| 1379 | sll $28, 32, $25 | ||
| 1380 | ldq $2, 24($18) | ||
| 1381 | addq $5, $25, $5 | ||
| 1382 | bis $5, $5, $7 | ||
| 1383 | ldq $4, 24($17) | ||
| 1384 | addq $23, $7, $23 | ||
| 1385 | srl $2, 32, $8 | ||
| 1386 | cmpult $23, $7, $3 | ||
| 1387 | zapnot $4, 15, $7 | ||
| 1388 | mulq $8, $7, $0 | ||
| 1389 | srl $28, 32, $1 | ||
| 1390 | addq $6, $1, $6 | ||
| 1391 | cmpult $5, $25, $1 | ||
| 1392 | zapnot $2, 15, $5 | ||
| 1393 | addq $1, $6, $6 | ||
| 1394 | addq $3, $6, $6 | ||
| 1395 | addq $22, $6, $22 | ||
| 1396 | cmpult $22, $6, $1 | ||
| 1397 | srl $4, 32, $6 | ||
| 1398 | mulq $5, $6, $25 | ||
| 1399 | mulq $7, $5, $5 | ||
| 1400 | addq $1, $24, $24 | ||
| 1401 | addq $0, $25, $0 | ||
| 1402 | cmpult $0, $25, $1 | ||
| 1403 | mulq $6, $8, $6 | ||
| 1404 | beq $1, $269 | ||
| 1405 | sll $21, 32, $1 | ||
| 1406 | addq $6, $1, $6 | ||
| 1407 | $269: | ||
| 1408 | sll $0, 32, $25 | ||
| 1409 | ldq $2, 32($18) | ||
| 1410 | addq $5, $25, $5 | ||
| 1411 | bis $5, $5, $7 | ||
| 1412 | ldq $4, 16($17) | ||
| 1413 | addq $23, $7, $23 | ||
| 1414 | srl $2, 32, $8 | ||
| 1415 | cmpult $23, $7, $3 | ||
| 1416 | zapnot $4, 15, $7 | ||
| 1417 | mulq $8, $7, $28 | ||
| 1418 | srl $0, 32, $1 | ||
| 1419 | addq $6, $1, $6 | ||
| 1420 | cmpult $5, $25, $1 | ||
| 1421 | zapnot $2, 15, $5 | ||
| 1422 | addq $1, $6, $6 | ||
| 1423 | addq $3, $6, $6 | ||
| 1424 | addq $22, $6, $22 | ||
| 1425 | cmpult $22, $6, $1 | ||
| 1426 | srl $4, 32, $6 | ||
| 1427 | mulq $5, $6, $25 | ||
| 1428 | mulq $7, $5, $5 | ||
| 1429 | addq $1, $24, $24 | ||
| 1430 | addq $28, $25, $28 | ||
| 1431 | cmpult $28, $25, $1 | ||
| 1432 | mulq $6, $8, $6 | ||
| 1433 | beq $1, $273 | ||
| 1434 | sll $21, 32, $1 | ||
| 1435 | addq $6, $1, $6 | ||
| 1436 | $273: | ||
| 1437 | sll $28, 32, $25 | ||
| 1438 | ldq $2, 40($18) | ||
| 1439 | addq $5, $25, $5 | ||
| 1440 | bis $5, $5, $7 | ||
| 1441 | ldq $4, 8($17) | ||
| 1442 | addq $23, $7, $23 | ||
| 1443 | srl $2, 32, $8 | ||
| 1444 | cmpult $23, $7, $3 | ||
| 1445 | zapnot $4, 15, $7 | ||
| 1446 | mulq $8, $7, $0 | ||
| 1447 | srl $28, 32, $1 | ||
| 1448 | addq $6, $1, $6 | ||
| 1449 | cmpult $5, $25, $1 | ||
| 1450 | zapnot $2, 15, $5 | ||
| 1451 | addq $1, $6, $6 | ||
| 1452 | addq $3, $6, $6 | ||
| 1453 | addq $22, $6, $22 | ||
| 1454 | cmpult $22, $6, $1 | ||
| 1455 | srl $4, 32, $6 | ||
| 1456 | mulq $5, $6, $25 | ||
| 1457 | mulq $7, $5, $5 | ||
| 1458 | addq $1, $24, $24 | ||
| 1459 | addq $0, $25, $0 | ||
| 1460 | cmpult $0, $25, $1 | ||
| 1461 | mulq $6, $8, $6 | ||
| 1462 | beq $1, $277 | ||
| 1463 | sll $21, 32, $1 | ||
| 1464 | addq $6, $1, $6 | ||
| 1465 | $277: | ||
| 1466 | sll $0, 32, $25 | ||
| 1467 | ldq $2, 48($18) | ||
| 1468 | addq $5, $25, $5 | ||
| 1469 | bis $5, $5, $7 | ||
| 1470 | ldq $4, 0($17) | ||
| 1471 | addq $23, $7, $23 | ||
| 1472 | srl $2, 32, $8 | ||
| 1473 | cmpult $23, $7, $3 | ||
| 1474 | zapnot $4, 15, $7 | ||
| 1475 | mulq $8, $7, $28 | ||
| 1476 | srl $0, 32, $1 | ||
| 1477 | addq $6, $1, $6 | ||
| 1478 | cmpult $5, $25, $1 | ||
| 1479 | zapnot $2, 15, $5 | ||
| 1480 | addq $1, $6, $6 | ||
| 1481 | addq $3, $6, $6 | ||
| 1482 | addq $22, $6, $22 | ||
| 1483 | cmpult $22, $6, $1 | ||
| 1484 | srl $4, 32, $6 | ||
| 1485 | mulq $5, $6, $25 | ||
| 1486 | mulq $7, $5, $2 | ||
| 1487 | addq $1, $24, $24 | ||
| 1488 | addq $28, $25, $28 | ||
| 1489 | cmpult $28, $25, $1 | ||
| 1490 | mulq $6, $8, $6 | ||
| 1491 | beq $1, $281 | ||
| 1492 | sll $21, 32, $1 | ||
| 1493 | addq $6, $1, $6 | ||
| 1494 | $281: | ||
| 1495 | sll $28, 32, $25 | ||
| 1496 | addq $2, $25, $2 | ||
| 1497 | bis $2, $2, $7 | ||
| 1498 | addq $23, $7, $23 | ||
| 1499 | stq $23, 48($16) | ||
| 1500 | ldq $4, 0($17) | ||
| 1501 | ldq $5, 56($18) | ||
| 1502 | cmpult $23, $7, $3 | ||
| 1503 | zapnot $4, 15, $7 | ||
| 1504 | srl $5, 32, $8 | ||
| 1505 | mulq $8, $7, $0 | ||
| 1506 | srl $28, 32, $1 | ||
| 1507 | cmpult $2, $25, $2 | ||
| 1508 | addq $6, $1, $6 | ||
| 1509 | addq $2, $6, $6 | ||
| 1510 | addq $3, $6, $6 | ||
| 1511 | addq $22, $6, $22 | ||
| 1512 | cmpult $22, $6, $1 | ||
| 1513 | srl $4, 32, $6 | ||
| 1514 | zapnot $5, 15, $5 | ||
| 1515 | mulq $5, $6, $23 | ||
| 1516 | mulq $7, $5, $2 | ||
| 1517 | addq $1, $24, $24 | ||
| 1518 | addq $0, $23, $0 | ||
| 1519 | cmpult $0, $23, $1 | ||
| 1520 | mulq $6, $8, $6 | ||
| 1521 | beq $1, $285 | ||
| 1522 | sll $21, 32, $1 | ||
| 1523 | addq $6, $1, $6 | ||
| 1524 | $285: | ||
| 1525 | sll $0, 32, $23 | ||
| 1526 | ldq $1, 48($18) | ||
| 1527 | addq $2, $23, $2 | ||
| 1528 | bis $2, $2, $7 | ||
| 1529 | ldq $4, 8($17) | ||
| 1530 | addq $22, $7, $22 | ||
| 1531 | srl $1, 32, $8 | ||
| 1532 | cmpult $22, $7, $3 | ||
| 1533 | zapnot $4, 15, $7 | ||
| 1534 | mulq $8, $7, $25 | ||
| 1535 | zapnot $1, 15, $5 | ||
| 1536 | mulq $7, $5, $21 | ||
| 1537 | srl $0, 32, $1 | ||
| 1538 | cmpult $2, $23, $2 | ||
| 1539 | addq $6, $1, $6 | ||
| 1540 | addq $2, $6, $6 | ||
| 1541 | addq $3, $6, $6 | ||
| 1542 | addq $24, $6, $24 | ||
| 1543 | cmpult $24, $6, $23 | ||
| 1544 | srl $4, 32, $6 | ||
| 1545 | mulq $5, $6, $5 | ||
| 1546 | bis $31, 1, $20 | ||
| 1547 | addq $25, $5, $25 | ||
| 1548 | cmpult $25, $5, $1 | ||
| 1549 | mulq $6, $8, $6 | ||
| 1550 | beq $1, $289 | ||
| 1551 | sll $20, 32, $1 | ||
| 1552 | addq $6, $1, $6 | ||
| 1553 | $289: | ||
| 1554 | sll $25, 32, $5 | ||
| 1555 | ldq $2, 40($18) | ||
| 1556 | addq $21, $5, $21 | ||
| 1557 | bis $21, $21, $7 | ||
| 1558 | ldq $4, 16($17) | ||
| 1559 | addq $22, $7, $22 | ||
| 1560 | srl $2, 32, $8 | ||
| 1561 | cmpult $22, $7, $3 | ||
| 1562 | zapnot $4, 15, $7 | ||
| 1563 | mulq $8, $7, $28 | ||
| 1564 | srl $25, 32, $1 | ||
| 1565 | addq $6, $1, $6 | ||
| 1566 | cmpult $21, $5, $1 | ||
| 1567 | zapnot $2, 15, $5 | ||
| 1568 | addq $1, $6, $6 | ||
| 1569 | addq $3, $6, $6 | ||
| 1570 | addq $24, $6, $24 | ||
| 1571 | cmpult $24, $6, $1 | ||
| 1572 | srl $4, 32, $6 | ||
| 1573 | mulq $5, $6, $25 | ||
| 1574 | mulq $7, $5, $5 | ||
| 1575 | addq $1, $23, $23 | ||
| 1576 | addq $28, $25, $28 | ||
| 1577 | cmpult $28, $25, $1 | ||
| 1578 | mulq $6, $8, $6 | ||
| 1579 | beq $1, $293 | ||
| 1580 | sll $20, 32, $1 | ||
| 1581 | addq $6, $1, $6 | ||
| 1582 | $293: | ||
| 1583 | sll $28, 32, $25 | ||
| 1584 | ldq $2, 32($18) | ||
| 1585 | addq $5, $25, $5 | ||
| 1586 | bis $5, $5, $7 | ||
| 1587 | ldq $4, 24($17) | ||
| 1588 | addq $22, $7, $22 | ||
| 1589 | srl $2, 32, $8 | ||
| 1590 | cmpult $22, $7, $3 | ||
| 1591 | zapnot $4, 15, $7 | ||
| 1592 | mulq $8, $7, $0 | ||
| 1593 | srl $28, 32, $1 | ||
| 1594 | addq $6, $1, $6 | ||
| 1595 | cmpult $5, $25, $1 | ||
| 1596 | zapnot $2, 15, $5 | ||
| 1597 | addq $1, $6, $6 | ||
| 1598 | addq $3, $6, $6 | ||
| 1599 | addq $24, $6, $24 | ||
| 1600 | cmpult $24, $6, $1 | ||
| 1601 | srl $4, 32, $6 | ||
| 1602 | mulq $5, $6, $25 | ||
| 1603 | mulq $7, $5, $5 | ||
| 1604 | addq $1, $23, $23 | ||
| 1605 | addq $0, $25, $0 | ||
| 1606 | cmpult $0, $25, $1 | ||
| 1607 | mulq $6, $8, $6 | ||
| 1608 | beq $1, $297 | ||
| 1609 | sll $20, 32, $1 | ||
| 1610 | addq $6, $1, $6 | ||
| 1611 | $297: | ||
| 1612 | sll $0, 32, $25 | ||
| 1613 | ldq $2, 24($18) | ||
| 1614 | addq $5, $25, $5 | ||
| 1615 | bis $5, $5, $7 | ||
| 1616 | ldq $4, 32($17) | ||
| 1617 | addq $22, $7, $22 | ||
| 1618 | srl $2, 32, $8 | ||
| 1619 | cmpult $22, $7, $3 | ||
| 1620 | zapnot $4, 15, $7 | ||
| 1621 | mulq $8, $7, $28 | ||
| 1622 | srl $0, 32, $1 | ||
| 1623 | addq $6, $1, $6 | ||
| 1624 | cmpult $5, $25, $1 | ||
| 1625 | zapnot $2, 15, $5 | ||
| 1626 | addq $1, $6, $6 | ||
| 1627 | addq $3, $6, $6 | ||
| 1628 | addq $24, $6, $24 | ||
| 1629 | cmpult $24, $6, $1 | ||
| 1630 | srl $4, 32, $6 | ||
| 1631 | mulq $5, $6, $25 | ||
| 1632 | mulq $7, $5, $5 | ||
| 1633 | addq $1, $23, $23 | ||
| 1634 | addq $28, $25, $28 | ||
| 1635 | cmpult $28, $25, $1 | ||
| 1636 | mulq $6, $8, $6 | ||
| 1637 | beq $1, $301 | ||
| 1638 | sll $20, 32, $1 | ||
| 1639 | addq $6, $1, $6 | ||
| 1640 | $301: | ||
| 1641 | sll $28, 32, $25 | ||
| 1642 | ldq $2, 16($18) | ||
| 1643 | addq $5, $25, $5 | ||
| 1644 | bis $5, $5, $7 | ||
| 1645 | ldq $4, 40($17) | ||
| 1646 | addq $22, $7, $22 | ||
| 1647 | srl $2, 32, $8 | ||
| 1648 | cmpult $22, $7, $3 | ||
| 1649 | zapnot $4, 15, $7 | ||
| 1650 | mulq $8, $7, $0 | ||
| 1651 | srl $28, 32, $1 | ||
| 1652 | addq $6, $1, $6 | ||
| 1653 | cmpult $5, $25, $1 | ||
| 1654 | zapnot $2, 15, $5 | ||
| 1655 | addq $1, $6, $6 | ||
| 1656 | addq $3, $6, $6 | ||
| 1657 | addq $24, $6, $24 | ||
| 1658 | cmpult $24, $6, $1 | ||
| 1659 | srl $4, 32, $6 | ||
| 1660 | mulq $5, $6, $25 | ||
| 1661 | mulq $7, $5, $5 | ||
| 1662 | addq $1, $23, $23 | ||
| 1663 | addq $0, $25, $0 | ||
| 1664 | cmpult $0, $25, $1 | ||
| 1665 | mulq $6, $8, $6 | ||
| 1666 | beq $1, $305 | ||
| 1667 | sll $20, 32, $1 | ||
| 1668 | addq $6, $1, $6 | ||
| 1669 | $305: | ||
| 1670 | sll $0, 32, $25 | ||
| 1671 | ldq $2, 8($18) | ||
| 1672 | addq $5, $25, $5 | ||
| 1673 | bis $5, $5, $7 | ||
| 1674 | ldq $4, 48($17) | ||
| 1675 | addq $22, $7, $22 | ||
| 1676 | srl $2, 32, $8 | ||
| 1677 | cmpult $22, $7, $3 | ||
| 1678 | zapnot $4, 15, $7 | ||
| 1679 | mulq $8, $7, $28 | ||
| 1680 | srl $0, 32, $1 | ||
| 1681 | addq $6, $1, $6 | ||
| 1682 | cmpult $5, $25, $1 | ||
| 1683 | zapnot $2, 15, $5 | ||
| 1684 | addq $1, $6, $6 | ||
| 1685 | addq $3, $6, $6 | ||
| 1686 | addq $24, $6, $24 | ||
| 1687 | cmpult $24, $6, $1 | ||
| 1688 | srl $4, 32, $6 | ||
| 1689 | mulq $5, $6, $25 | ||
| 1690 | mulq $7, $5, $5 | ||
| 1691 | addq $1, $23, $23 | ||
| 1692 | addq $28, $25, $28 | ||
| 1693 | cmpult $28, $25, $1 | ||
| 1694 | mulq $6, $8, $6 | ||
| 1695 | beq $1, $309 | ||
| 1696 | sll $20, 32, $1 | ||
| 1697 | addq $6, $1, $6 | ||
| 1698 | $309: | ||
| 1699 | sll $28, 32, $25 | ||
| 1700 | ldq $2, 0($18) | ||
| 1701 | addq $5, $25, $5 | ||
| 1702 | bis $5, $5, $7 | ||
| 1703 | ldq $4, 56($17) | ||
| 1704 | addq $22, $7, $22 | ||
| 1705 | srl $2, 32, $8 | ||
| 1706 | cmpult $22, $7, $3 | ||
| 1707 | zapnot $4, 15, $7 | ||
| 1708 | mulq $8, $7, $0 | ||
| 1709 | srl $28, 32, $1 | ||
| 1710 | addq $6, $1, $6 | ||
| 1711 | cmpult $5, $25, $1 | ||
| 1712 | zapnot $2, 15, $5 | ||
| 1713 | addq $1, $6, $6 | ||
| 1714 | addq $3, $6, $6 | ||
| 1715 | addq $24, $6, $24 | ||
| 1716 | cmpult $24, $6, $1 | ||
| 1717 | srl $4, 32, $6 | ||
| 1718 | mulq $5, $6, $25 | ||
| 1719 | mulq $7, $5, $2 | ||
| 1720 | addq $1, $23, $23 | ||
| 1721 | addq $0, $25, $0 | ||
| 1722 | cmpult $0, $25, $1 | ||
| 1723 | mulq $6, $8, $6 | ||
| 1724 | beq $1, $313 | ||
| 1725 | sll $20, 32, $1 | ||
| 1726 | addq $6, $1, $6 | ||
| 1727 | $313: | ||
| 1728 | sll $0, 32, $25 | ||
| 1729 | addq $2, $25, $2 | ||
| 1730 | bis $2, $2, $7 | ||
| 1731 | addq $22, $7, $22 | ||
| 1732 | stq $22, 56($16) | ||
| 1733 | ldq $4, 56($17) | ||
| 1734 | ldq $5, 8($18) | ||
| 1735 | cmpult $22, $7, $3 | ||
| 1736 | zapnot $4, 15, $7 | ||
| 1737 | srl $5, 32, $8 | ||
| 1738 | mulq $8, $7, $28 | ||
| 1739 | srl $0, 32, $1 | ||
| 1740 | cmpult $2, $25, $2 | ||
| 1741 | addq $6, $1, $6 | ||
| 1742 | addq $2, $6, $6 | ||
| 1743 | addq $3, $6, $6 | ||
| 1744 | addq $24, $6, $24 | ||
| 1745 | cmpult $24, $6, $1 | ||
| 1746 | srl $4, 32, $6 | ||
| 1747 | zapnot $5, 15, $5 | ||
| 1748 | mulq $5, $6, $22 | ||
| 1749 | mulq $7, $5, $2 | ||
| 1750 | addq $1, $23, $23 | ||
| 1751 | addq $28, $22, $28 | ||
| 1752 | cmpult $28, $22, $1 | ||
| 1753 | mulq $6, $8, $6 | ||
| 1754 | beq $1, $317 | ||
| 1755 | sll $20, 32, $1 | ||
| 1756 | addq $6, $1, $6 | ||
| 1757 | $317: | ||
| 1758 | sll $28, 32, $22 | ||
| 1759 | ldq $1, 16($18) | ||
| 1760 | addq $2, $22, $2 | ||
| 1761 | bis $2, $2, $7 | ||
| 1762 | ldq $4, 48($17) | ||
| 1763 | addq $24, $7, $24 | ||
| 1764 | srl $1, 32, $8 | ||
| 1765 | cmpult $24, $7, $3 | ||
| 1766 | zapnot $4, 15, $7 | ||
| 1767 | mulq $8, $7, $25 | ||
| 1768 | zapnot $1, 15, $5 | ||
| 1769 | mulq $7, $5, $0 | ||
| 1770 | srl $28, 32, $1 | ||
| 1771 | cmpult $2, $22, $2 | ||
| 1772 | addq $6, $1, $6 | ||
| 1773 | addq $2, $6, $6 | ||
| 1774 | addq $3, $6, $6 | ||
| 1775 | addq $23, $6, $23 | ||
| 1776 | cmpult $23, $6, $22 | ||
| 1777 | srl $4, 32, $6 | ||
| 1778 | mulq $5, $6, $5 | ||
| 1779 | bis $31, 1, $21 | ||
| 1780 | addq $25, $5, $25 | ||
| 1781 | cmpult $25, $5, $1 | ||
| 1782 | mulq $6, $8, $6 | ||
| 1783 | beq $1, $321 | ||
| 1784 | sll $21, 32, $1 | ||
| 1785 | addq $6, $1, $6 | ||
| 1786 | $321: | ||
| 1787 | sll $25, 32, $5 | ||
| 1788 | ldq $2, 24($18) | ||
| 1789 | addq $0, $5, $0 | ||
| 1790 | bis $0, $0, $7 | ||
| 1791 | ldq $4, 40($17) | ||
| 1792 | addq $24, $7, $24 | ||
| 1793 | srl $2, 32, $8 | ||
| 1794 | cmpult $24, $7, $3 | ||
| 1795 | zapnot $4, 15, $7 | ||
| 1796 | mulq $8, $7, $28 | ||
| 1797 | srl $25, 32, $1 | ||
| 1798 | addq $6, $1, $6 | ||
| 1799 | cmpult $0, $5, $1 | ||
| 1800 | zapnot $2, 15, $5 | ||
| 1801 | addq $1, $6, $6 | ||
| 1802 | addq $3, $6, $6 | ||
| 1803 | addq $23, $6, $23 | ||
| 1804 | cmpult $23, $6, $1 | ||
| 1805 | srl $4, 32, $6 | ||
| 1806 | mulq $5, $6, $25 | ||
| 1807 | mulq $7, $5, $5 | ||
| 1808 | addq $1, $22, $22 | ||
| 1809 | addq $28, $25, $28 | ||
| 1810 | cmpult $28, $25, $1 | ||
| 1811 | mulq $6, $8, $6 | ||
| 1812 | beq $1, $325 | ||
| 1813 | sll $21, 32, $1 | ||
| 1814 | addq $6, $1, $6 | ||
| 1815 | $325: | ||
| 1816 | sll $28, 32, $25 | ||
| 1817 | ldq $2, 32($18) | ||
| 1818 | addq $5, $25, $5 | ||
| 1819 | bis $5, $5, $7 | ||
| 1820 | ldq $4, 32($17) | ||
| 1821 | addq $24, $7, $24 | ||
| 1822 | srl $2, 32, $8 | ||
| 1823 | cmpult $24, $7, $3 | ||
| 1824 | zapnot $4, 15, $7 | ||
| 1825 | mulq $8, $7, $0 | ||
| 1826 | srl $28, 32, $1 | ||
| 1827 | addq $6, $1, $6 | ||
| 1828 | cmpult $5, $25, $1 | ||
| 1829 | zapnot $2, 15, $5 | ||
| 1830 | addq $1, $6, $6 | ||
| 1831 | addq $3, $6, $6 | ||
| 1832 | addq $23, $6, $23 | ||
| 1833 | cmpult $23, $6, $1 | ||
| 1834 | srl $4, 32, $6 | ||
| 1835 | mulq $5, $6, $25 | ||
| 1836 | mulq $7, $5, $5 | ||
| 1837 | addq $1, $22, $22 | ||
| 1838 | addq $0, $25, $0 | ||
| 1839 | cmpult $0, $25, $1 | ||
| 1840 | mulq $6, $8, $6 | ||
| 1841 | beq $1, $329 | ||
| 1842 | sll $21, 32, $1 | ||
| 1843 | addq $6, $1, $6 | ||
| 1844 | $329: | ||
| 1845 | sll $0, 32, $25 | ||
| 1846 | ldq $2, 40($18) | ||
| 1847 | addq $5, $25, $5 | ||
| 1848 | bis $5, $5, $7 | ||
| 1849 | ldq $4, 24($17) | ||
| 1850 | addq $24, $7, $24 | ||
| 1851 | srl $2, 32, $8 | ||
| 1852 | cmpult $24, $7, $3 | ||
| 1853 | zapnot $4, 15, $7 | ||
| 1854 | mulq $8, $7, $28 | ||
| 1855 | srl $0, 32, $1 | ||
| 1856 | addq $6, $1, $6 | ||
| 1857 | cmpult $5, $25, $1 | ||
| 1858 | zapnot $2, 15, $5 | ||
| 1859 | addq $1, $6, $6 | ||
| 1860 | addq $3, $6, $6 | ||
| 1861 | addq $23, $6, $23 | ||
| 1862 | cmpult $23, $6, $1 | ||
| 1863 | srl $4, 32, $6 | ||
| 1864 | mulq $5, $6, $25 | ||
| 1865 | mulq $7, $5, $5 | ||
| 1866 | addq $1, $22, $22 | ||
| 1867 | addq $28, $25, $28 | ||
| 1868 | cmpult $28, $25, $1 | ||
| 1869 | mulq $6, $8, $6 | ||
| 1870 | beq $1, $333 | ||
| 1871 | sll $21, 32, $1 | ||
| 1872 | addq $6, $1, $6 | ||
| 1873 | $333: | ||
| 1874 | sll $28, 32, $25 | ||
| 1875 | ldq $2, 48($18) | ||
| 1876 | addq $5, $25, $5 | ||
| 1877 | bis $5, $5, $7 | ||
| 1878 | ldq $4, 16($17) | ||
| 1879 | addq $24, $7, $24 | ||
| 1880 | srl $2, 32, $8 | ||
| 1881 | cmpult $24, $7, $3 | ||
| 1882 | zapnot $4, 15, $7 | ||
| 1883 | mulq $8, $7, $0 | ||
| 1884 | srl $28, 32, $1 | ||
| 1885 | addq $6, $1, $6 | ||
| 1886 | cmpult $5, $25, $1 | ||
| 1887 | zapnot $2, 15, $5 | ||
| 1888 | addq $1, $6, $6 | ||
| 1889 | addq $3, $6, $6 | ||
| 1890 | addq $23, $6, $23 | ||
| 1891 | cmpult $23, $6, $1 | ||
| 1892 | srl $4, 32, $6 | ||
| 1893 | mulq $5, $6, $25 | ||
| 1894 | mulq $7, $5, $5 | ||
| 1895 | addq $1, $22, $22 | ||
| 1896 | addq $0, $25, $0 | ||
| 1897 | cmpult $0, $25, $1 | ||
| 1898 | mulq $6, $8, $6 | ||
| 1899 | beq $1, $337 | ||
| 1900 | sll $21, 32, $1 | ||
| 1901 | addq $6, $1, $6 | ||
| 1902 | $337: | ||
| 1903 | sll $0, 32, $25 | ||
| 1904 | ldq $2, 56($18) | ||
| 1905 | addq $5, $25, $5 | ||
| 1906 | bis $5, $5, $7 | ||
| 1907 | ldq $4, 8($17) | ||
| 1908 | addq $24, $7, $24 | ||
| 1909 | srl $2, 32, $8 | ||
| 1910 | cmpult $24, $7, $3 | ||
| 1911 | zapnot $4, 15, $7 | ||
| 1912 | mulq $8, $7, $28 | ||
| 1913 | srl $0, 32, $1 | ||
| 1914 | addq $6, $1, $6 | ||
| 1915 | cmpult $5, $25, $1 | ||
| 1916 | zapnot $2, 15, $5 | ||
| 1917 | addq $1, $6, $6 | ||
| 1918 | addq $3, $6, $6 | ||
| 1919 | addq $23, $6, $23 | ||
| 1920 | cmpult $23, $6, $1 | ||
| 1921 | srl $4, 32, $6 | ||
| 1922 | mulq $5, $6, $25 | ||
| 1923 | mulq $7, $5, $2 | ||
| 1924 | addq $1, $22, $22 | ||
| 1925 | addq $28, $25, $28 | ||
| 1926 | cmpult $28, $25, $1 | ||
| 1927 | mulq $6, $8, $6 | ||
| 1928 | beq $1, $341 | ||
| 1929 | sll $21, 32, $1 | ||
| 1930 | addq $6, $1, $6 | ||
| 1931 | $341: | ||
| 1932 | sll $28, 32, $25 | ||
| 1933 | addq $2, $25, $2 | ||
| 1934 | bis $2, $2, $7 | ||
| 1935 | addq $24, $7, $24 | ||
| 1936 | stq $24, 64($16) | ||
| 1937 | ldq $4, 16($17) | ||
| 1938 | ldq $5, 56($18) | ||
| 1939 | cmpult $24, $7, $3 | ||
| 1940 | zapnot $4, 15, $7 | ||
| 1941 | srl $5, 32, $8 | ||
| 1942 | mulq $8, $7, $0 | ||
| 1943 | srl $28, 32, $1 | ||
| 1944 | cmpult $2, $25, $2 | ||
| 1945 | addq $6, $1, $6 | ||
| 1946 | addq $2, $6, $6 | ||
| 1947 | addq $3, $6, $6 | ||
| 1948 | addq $23, $6, $23 | ||
| 1949 | cmpult $23, $6, $1 | ||
| 1950 | srl $4, 32, $6 | ||
| 1951 | zapnot $5, 15, $5 | ||
| 1952 | mulq $5, $6, $24 | ||
| 1953 | mulq $7, $5, $2 | ||
| 1954 | addq $1, $22, $22 | ||
| 1955 | addq $0, $24, $0 | ||
| 1956 | cmpult $0, $24, $1 | ||
| 1957 | mulq $6, $8, $6 | ||
| 1958 | beq $1, $345 | ||
| 1959 | sll $21, 32, $1 | ||
| 1960 | addq $6, $1, $6 | ||
| 1961 | $345: | ||
| 1962 | sll $0, 32, $24 | ||
| 1963 | ldq $1, 48($18) | ||
| 1964 | addq $2, $24, $2 | ||
| 1965 | bis $2, $2, $7 | ||
| 1966 | ldq $4, 24($17) | ||
| 1967 | addq $23, $7, $23 | ||
| 1968 | srl $1, 32, $8 | ||
| 1969 | cmpult $23, $7, $3 | ||
| 1970 | zapnot $4, 15, $7 | ||
| 1971 | mulq $8, $7, $25 | ||
| 1972 | zapnot $1, 15, $5 | ||
| 1973 | mulq $7, $5, $21 | ||
| 1974 | srl $0, 32, $1 | ||
| 1975 | cmpult $2, $24, $2 | ||
| 1976 | addq $6, $1, $6 | ||
| 1977 | addq $2, $6, $6 | ||
| 1978 | addq $3, $6, $6 | ||
| 1979 | addq $22, $6, $22 | ||
| 1980 | cmpult $22, $6, $24 | ||
| 1981 | srl $4, 32, $6 | ||
| 1982 | mulq $5, $6, $5 | ||
| 1983 | bis $31, 1, $20 | ||
| 1984 | addq $25, $5, $25 | ||
| 1985 | cmpult $25, $5, $1 | ||
| 1986 | mulq $6, $8, $6 | ||
| 1987 | beq $1, $349 | ||
| 1988 | sll $20, 32, $1 | ||
| 1989 | addq $6, $1, $6 | ||
| 1990 | $349: | ||
| 1991 | sll $25, 32, $5 | ||
| 1992 | ldq $2, 40($18) | ||
| 1993 | addq $21, $5, $21 | ||
| 1994 | bis $21, $21, $7 | ||
| 1995 | ldq $4, 32($17) | ||
| 1996 | addq $23, $7, $23 | ||
| 1997 | srl $2, 32, $8 | ||
| 1998 | cmpult $23, $7, $3 | ||
| 1999 | zapnot $4, 15, $7 | ||
| 2000 | mulq $8, $7, $28 | ||
| 2001 | srl $25, 32, $1 | ||
| 2002 | addq $6, $1, $6 | ||
| 2003 | cmpult $21, $5, $1 | ||
| 2004 | zapnot $2, 15, $5 | ||
| 2005 | addq $1, $6, $6 | ||
| 2006 | addq $3, $6, $6 | ||
| 2007 | addq $22, $6, $22 | ||
| 2008 | cmpult $22, $6, $1 | ||
| 2009 | srl $4, 32, $6 | ||
| 2010 | mulq $5, $6, $25 | ||
| 2011 | mulq $7, $5, $5 | ||
| 2012 | addq $1, $24, $24 | ||
| 2013 | addq $28, $25, $28 | ||
| 2014 | cmpult $28, $25, $1 | ||
| 2015 | mulq $6, $8, $6 | ||
| 2016 | beq $1, $353 | ||
| 2017 | sll $20, 32, $1 | ||
| 2018 | addq $6, $1, $6 | ||
| 2019 | $353: | ||
| 2020 | sll $28, 32, $25 | ||
| 2021 | ldq $2, 32($18) | ||
| 2022 | addq $5, $25, $5 | ||
| 2023 | bis $5, $5, $7 | ||
| 2024 | ldq $4, 40($17) | ||
| 2025 | addq $23, $7, $23 | ||
| 2026 | srl $2, 32, $8 | ||
| 2027 | cmpult $23, $7, $3 | ||
| 2028 | zapnot $4, 15, $7 | ||
| 2029 | mulq $8, $7, $0 | ||
| 2030 | srl $28, 32, $1 | ||
| 2031 | addq $6, $1, $6 | ||
| 2032 | cmpult $5, $25, $1 | ||
| 2033 | zapnot $2, 15, $5 | ||
| 2034 | addq $1, $6, $6 | ||
| 2035 | addq $3, $6, $6 | ||
| 2036 | addq $22, $6, $22 | ||
| 2037 | cmpult $22, $6, $1 | ||
| 2038 | srl $4, 32, $6 | ||
| 2039 | mulq $5, $6, $25 | ||
| 2040 | mulq $7, $5, $5 | ||
| 2041 | addq $1, $24, $24 | ||
| 2042 | addq $0, $25, $0 | ||
| 2043 | cmpult $0, $25, $1 | ||
| 2044 | mulq $6, $8, $6 | ||
| 2045 | beq $1, $357 | ||
| 2046 | sll $20, 32, $1 | ||
| 2047 | addq $6, $1, $6 | ||
| 2048 | $357: | ||
| 2049 | sll $0, 32, $25 | ||
| 2050 | ldq $2, 24($18) | ||
| 2051 | addq $5, $25, $5 | ||
| 2052 | bis $5, $5, $7 | ||
| 2053 | ldq $4, 48($17) | ||
| 2054 | addq $23, $7, $23 | ||
| 2055 | srl $2, 32, $8 | ||
| 2056 | cmpult $23, $7, $3 | ||
| 2057 | zapnot $4, 15, $7 | ||
| 2058 | mulq $8, $7, $28 | ||
| 2059 | srl $0, 32, $1 | ||
| 2060 | addq $6, $1, $6 | ||
| 2061 | cmpult $5, $25, $1 | ||
| 2062 | zapnot $2, 15, $5 | ||
| 2063 | addq $1, $6, $6 | ||
| 2064 | addq $3, $6, $6 | ||
| 2065 | addq $22, $6, $22 | ||
| 2066 | cmpult $22, $6, $1 | ||
| 2067 | srl $4, 32, $6 | ||
| 2068 | mulq $5, $6, $25 | ||
| 2069 | mulq $7, $5, $5 | ||
| 2070 | addq $1, $24, $24 | ||
| 2071 | addq $28, $25, $28 | ||
| 2072 | cmpult $28, $25, $1 | ||
| 2073 | mulq $6, $8, $6 | ||
| 2074 | beq $1, $361 | ||
| 2075 | sll $20, 32, $1 | ||
| 2076 | addq $6, $1, $6 | ||
| 2077 | $361: | ||
| 2078 | sll $28, 32, $25 | ||
| 2079 | ldq $2, 16($18) | ||
| 2080 | addq $5, $25, $5 | ||
| 2081 | bis $5, $5, $7 | ||
| 2082 | ldq $4, 56($17) | ||
| 2083 | addq $23, $7, $23 | ||
| 2084 | srl $2, 32, $8 | ||
| 2085 | cmpult $23, $7, $3 | ||
| 2086 | zapnot $4, 15, $7 | ||
| 2087 | mulq $8, $7, $0 | ||
| 2088 | srl $28, 32, $1 | ||
| 2089 | addq $6, $1, $6 | ||
| 2090 | cmpult $5, $25, $1 | ||
| 2091 | zapnot $2, 15, $5 | ||
| 2092 | addq $1, $6, $6 | ||
| 2093 | addq $3, $6, $6 | ||
| 2094 | addq $22, $6, $22 | ||
| 2095 | cmpult $22, $6, $1 | ||
| 2096 | srl $4, 32, $6 | ||
| 2097 | mulq $5, $6, $25 | ||
| 2098 | mulq $7, $5, $2 | ||
| 2099 | addq $1, $24, $24 | ||
| 2100 | addq $0, $25, $0 | ||
| 2101 | cmpult $0, $25, $1 | ||
| 2102 | mulq $6, $8, $6 | ||
| 2103 | beq $1, $365 | ||
| 2104 | sll $20, 32, $1 | ||
| 2105 | addq $6, $1, $6 | ||
| 2106 | $365: | ||
| 2107 | sll $0, 32, $25 | ||
| 2108 | addq $2, $25, $2 | ||
| 2109 | bis $2, $2, $7 | ||
| 2110 | addq $23, $7, $23 | ||
| 2111 | stq $23, 72($16) | ||
| 2112 | ldq $4, 56($17) | ||
| 2113 | ldq $5, 24($18) | ||
| 2114 | cmpult $23, $7, $3 | ||
| 2115 | zapnot $4, 15, $7 | ||
| 2116 | srl $5, 32, $8 | ||
| 2117 | mulq $8, $7, $28 | ||
| 2118 | srl $0, 32, $1 | ||
| 2119 | cmpult $2, $25, $2 | ||
| 2120 | addq $6, $1, $6 | ||
| 2121 | addq $2, $6, $6 | ||
| 2122 | addq $3, $6, $6 | ||
| 2123 | addq $22, $6, $22 | ||
| 2124 | cmpult $22, $6, $1 | ||
| 2125 | srl $4, 32, $6 | ||
| 2126 | zapnot $5, 15, $5 | ||
| 2127 | mulq $5, $6, $23 | ||
| 2128 | mulq $7, $5, $2 | ||
| 2129 | addq $1, $24, $24 | ||
| 2130 | addq $28, $23, $28 | ||
| 2131 | cmpult $28, $23, $1 | ||
| 2132 | mulq $6, $8, $6 | ||
| 2133 | beq $1, $369 | ||
| 2134 | sll $20, 32, $1 | ||
| 2135 | addq $6, $1, $6 | ||
| 2136 | $369: | ||
| 2137 | sll $28, 32, $23 | ||
| 2138 | ldq $1, 32($18) | ||
| 2139 | addq $2, $23, $2 | ||
| 2140 | bis $2, $2, $7 | ||
| 2141 | ldq $4, 48($17) | ||
| 2142 | addq $22, $7, $22 | ||
| 2143 | srl $1, 32, $8 | ||
| 2144 | cmpult $22, $7, $3 | ||
| 2145 | zapnot $4, 15, $7 | ||
| 2146 | mulq $8, $7, $25 | ||
| 2147 | zapnot $1, 15, $5 | ||
| 2148 | mulq $7, $5, $0 | ||
| 2149 | srl $28, 32, $1 | ||
| 2150 | cmpult $2, $23, $2 | ||
| 2151 | addq $6, $1, $6 | ||
| 2152 | addq $2, $6, $6 | ||
| 2153 | addq $3, $6, $6 | ||
| 2154 | addq $24, $6, $24 | ||
| 2155 | cmpult $24, $6, $23 | ||
| 2156 | srl $4, 32, $6 | ||
| 2157 | mulq $5, $6, $5 | ||
| 2158 | bis $31, 1, $21 | ||
| 2159 | addq $25, $5, $25 | ||
| 2160 | cmpult $25, $5, $1 | ||
| 2161 | mulq $6, $8, $6 | ||
| 2162 | beq $1, $373 | ||
| 2163 | sll $21, 32, $1 | ||
| 2164 | addq $6, $1, $6 | ||
| 2165 | $373: | ||
| 2166 | sll $25, 32, $5 | ||
| 2167 | ldq $2, 40($18) | ||
| 2168 | addq $0, $5, $0 | ||
| 2169 | bis $0, $0, $7 | ||
| 2170 | ldq $4, 40($17) | ||
| 2171 | addq $22, $7, $22 | ||
| 2172 | srl $2, 32, $8 | ||
| 2173 | cmpult $22, $7, $3 | ||
| 2174 | zapnot $4, 15, $7 | ||
| 2175 | mulq $8, $7, $28 | ||
| 2176 | srl $25, 32, $1 | ||
| 2177 | addq $6, $1, $6 | ||
| 2178 | cmpult $0, $5, $1 | ||
| 2179 | zapnot $2, 15, $5 | ||
| 2180 | addq $1, $6, $6 | ||
| 2181 | addq $3, $6, $6 | ||
| 2182 | addq $24, $6, $24 | ||
| 2183 | cmpult $24, $6, $1 | ||
| 2184 | srl $4, 32, $6 | ||
| 2185 | mulq $5, $6, $25 | ||
| 2186 | mulq $7, $5, $5 | ||
| 2187 | addq $1, $23, $23 | ||
| 2188 | addq $28, $25, $28 | ||
| 2189 | cmpult $28, $25, $1 | ||
| 2190 | mulq $6, $8, $6 | ||
| 2191 | beq $1, $377 | ||
| 2192 | sll $21, 32, $1 | ||
| 2193 | addq $6, $1, $6 | ||
| 2194 | $377: | ||
| 2195 | sll $28, 32, $25 | ||
| 2196 | ldq $2, 48($18) | ||
| 2197 | addq $5, $25, $5 | ||
| 2198 | bis $5, $5, $7 | ||
| 2199 | ldq $4, 32($17) | ||
| 2200 | addq $22, $7, $22 | ||
| 2201 | srl $2, 32, $8 | ||
| 2202 | cmpult $22, $7, $3 | ||
| 2203 | zapnot $4, 15, $7 | ||
| 2204 | mulq $8, $7, $0 | ||
| 2205 | srl $28, 32, $1 | ||
| 2206 | addq $6, $1, $6 | ||
| 2207 | cmpult $5, $25, $1 | ||
| 2208 | zapnot $2, 15, $5 | ||
| 2209 | addq $1, $6, $6 | ||
| 2210 | addq $3, $6, $6 | ||
| 2211 | addq $24, $6, $24 | ||
| 2212 | cmpult $24, $6, $1 | ||
| 2213 | srl $4, 32, $6 | ||
| 2214 | mulq $5, $6, $25 | ||
| 2215 | mulq $7, $5, $5 | ||
| 2216 | addq $1, $23, $23 | ||
| 2217 | addq $0, $25, $0 | ||
| 2218 | cmpult $0, $25, $1 | ||
| 2219 | mulq $6, $8, $6 | ||
| 2220 | beq $1, $381 | ||
| 2221 | sll $21, 32, $1 | ||
| 2222 | addq $6, $1, $6 | ||
| 2223 | $381: | ||
| 2224 | sll $0, 32, $25 | ||
| 2225 | ldq $2, 56($18) | ||
| 2226 | addq $5, $25, $5 | ||
| 2227 | bis $5, $5, $7 | ||
| 2228 | ldq $4, 24($17) | ||
| 2229 | addq $22, $7, $22 | ||
| 2230 | srl $2, 32, $8 | ||
| 2231 | cmpult $22, $7, $3 | ||
| 2232 | zapnot $4, 15, $7 | ||
| 2233 | mulq $8, $7, $28 | ||
| 2234 | srl $0, 32, $1 | ||
| 2235 | addq $6, $1, $6 | ||
| 2236 | cmpult $5, $25, $1 | ||
| 2237 | zapnot $2, 15, $5 | ||
| 2238 | addq $1, $6, $6 | ||
| 2239 | addq $3, $6, $6 | ||
| 2240 | addq $24, $6, $24 | ||
| 2241 | cmpult $24, $6, $1 | ||
| 2242 | srl $4, 32, $6 | ||
| 2243 | mulq $5, $6, $25 | ||
| 2244 | mulq $7, $5, $2 | ||
| 2245 | addq $1, $23, $23 | ||
| 2246 | addq $28, $25, $28 | ||
| 2247 | cmpult $28, $25, $1 | ||
| 2248 | mulq $6, $8, $6 | ||
| 2249 | beq $1, $385 | ||
| 2250 | sll $21, 32, $1 | ||
| 2251 | addq $6, $1, $6 | ||
| 2252 | $385: | ||
| 2253 | sll $28, 32, $25 | ||
| 2254 | addq $2, $25, $2 | ||
| 2255 | bis $2, $2, $7 | ||
| 2256 | addq $22, $7, $22 | ||
| 2257 | stq $22, 80($16) | ||
| 2258 | ldq $4, 32($17) | ||
| 2259 | ldq $5, 56($18) | ||
| 2260 | cmpult $22, $7, $3 | ||
| 2261 | zapnot $4, 15, $7 | ||
| 2262 | srl $5, 32, $8 | ||
| 2263 | mulq $8, $7, $0 | ||
| 2264 | srl $28, 32, $1 | ||
| 2265 | cmpult $2, $25, $2 | ||
| 2266 | addq $6, $1, $6 | ||
| 2267 | addq $2, $6, $6 | ||
| 2268 | addq $3, $6, $6 | ||
| 2269 | addq $24, $6, $24 | ||
| 2270 | cmpult $24, $6, $1 | ||
| 2271 | srl $4, 32, $6 | ||
| 2272 | zapnot $5, 15, $5 | ||
| 2273 | mulq $5, $6, $22 | ||
| 2274 | mulq $7, $5, $2 | ||
| 2275 | addq $1, $23, $23 | ||
| 2276 | addq $0, $22, $0 | ||
| 2277 | cmpult $0, $22, $1 | ||
| 2278 | mulq $6, $8, $6 | ||
| 2279 | beq $1, $389 | ||
| 2280 | sll $21, 32, $1 | ||
| 2281 | addq $6, $1, $6 | ||
| 2282 | $389: | ||
| 2283 | sll $0, 32, $22 | ||
| 2284 | ldq $1, 48($18) | ||
| 2285 | addq $2, $22, $2 | ||
| 2286 | bis $2, $2, $7 | ||
| 2287 | ldq $4, 40($17) | ||
| 2288 | addq $24, $7, $24 | ||
| 2289 | srl $1, 32, $8 | ||
| 2290 | cmpult $24, $7, $3 | ||
| 2291 | zapnot $4, 15, $7 | ||
| 2292 | mulq $8, $7, $25 | ||
| 2293 | zapnot $1, 15, $5 | ||
| 2294 | mulq $7, $5, $21 | ||
| 2295 | srl $0, 32, $1 | ||
| 2296 | cmpult $2, $22, $2 | ||
| 2297 | addq $6, $1, $6 | ||
| 2298 | addq $2, $6, $6 | ||
| 2299 | addq $3, $6, $6 | ||
| 2300 | addq $23, $6, $23 | ||
| 2301 | cmpult $23, $6, $22 | ||
| 2302 | srl $4, 32, $6 | ||
| 2303 | mulq $5, $6, $5 | ||
| 2304 | bis $31, 1, $20 | ||
| 2305 | addq $25, $5, $25 | ||
| 2306 | cmpult $25, $5, $1 | ||
| 2307 | mulq $6, $8, $6 | ||
| 2308 | beq $1, $393 | ||
| 2309 | sll $20, 32, $1 | ||
| 2310 | addq $6, $1, $6 | ||
| 2311 | $393: | ||
| 2312 | sll $25, 32, $5 | ||
| 2313 | ldq $2, 40($18) | ||
| 2314 | addq $21, $5, $21 | ||
| 2315 | bis $21, $21, $7 | ||
| 2316 | ldq $4, 48($17) | ||
| 2317 | addq $24, $7, $24 | ||
| 2318 | srl $2, 32, $8 | ||
| 2319 | cmpult $24, $7, $3 | ||
| 2320 | zapnot $4, 15, $7 | ||
| 2321 | mulq $8, $7, $28 | ||
| 2322 | srl $25, 32, $1 | ||
| 2323 | addq $6, $1, $6 | ||
| 2324 | cmpult $21, $5, $1 | ||
| 2325 | zapnot $2, 15, $5 | ||
| 2326 | addq $1, $6, $6 | ||
| 2327 | addq $3, $6, $6 | ||
| 2328 | addq $23, $6, $23 | ||
| 2329 | cmpult $23, $6, $1 | ||
| 2330 | srl $4, 32, $6 | ||
| 2331 | mulq $5, $6, $25 | ||
| 2332 | mulq $7, $5, $5 | ||
| 2333 | addq $1, $22, $22 | ||
| 2334 | addq $28, $25, $28 | ||
| 2335 | cmpult $28, $25, $1 | ||
| 2336 | mulq $6, $8, $6 | ||
| 2337 | beq $1, $397 | ||
| 2338 | sll $20, 32, $1 | ||
| 2339 | addq $6, $1, $6 | ||
| 2340 | $397: | ||
| 2341 | sll $28, 32, $25 | ||
| 2342 | ldq $2, 32($18) | ||
| 2343 | addq $5, $25, $5 | ||
| 2344 | bis $5, $5, $7 | ||
| 2345 | ldq $4, 56($17) | ||
| 2346 | addq $24, $7, $24 | ||
| 2347 | srl $2, 32, $8 | ||
| 2348 | cmpult $24, $7, $3 | ||
| 2349 | zapnot $4, 15, $7 | ||
| 2350 | mulq $8, $7, $21 | ||
| 2351 | srl $28, 32, $1 | ||
| 2352 | addq $6, $1, $6 | ||
| 2353 | cmpult $5, $25, $1 | ||
| 2354 | zapnot $2, 15, $5 | ||
| 2355 | addq $1, $6, $6 | ||
| 2356 | addq $3, $6, $6 | ||
| 2357 | addq $23, $6, $23 | ||
| 2358 | cmpult $23, $6, $1 | ||
| 2359 | srl $4, 32, $6 | ||
| 2360 | mulq $5, $6, $25 | ||
| 2361 | mulq $7, $5, $2 | ||
| 2362 | addq $1, $22, $22 | ||
| 2363 | addq $21, $25, $21 | ||
| 2364 | cmpult $21, $25, $1 | ||
| 2365 | mulq $6, $8, $6 | ||
| 2366 | beq $1, $401 | ||
| 2367 | sll $20, 32, $1 | ||
| 2368 | addq $6, $1, $6 | ||
| 2369 | $401: | ||
| 2370 | sll $21, 32, $25 | ||
| 2371 | addq $2, $25, $2 | ||
| 2372 | bis $2, $2, $7 | ||
| 2373 | addq $24, $7, $24 | ||
| 2374 | stq $24, 88($16) | ||
| 2375 | ldq $4, 56($17) | ||
| 2376 | ldq $5, 40($18) | ||
| 2377 | cmpult $24, $7, $3 | ||
| 2378 | zapnot $4, 15, $7 | ||
| 2379 | srl $5, 32, $8 | ||
| 2380 | mulq $8, $7, $0 | ||
| 2381 | srl $21, 32, $1 | ||
| 2382 | cmpult $2, $25, $2 | ||
| 2383 | addq $6, $1, $6 | ||
| 2384 | addq $2, $6, $6 | ||
| 2385 | addq $3, $6, $6 | ||
| 2386 | addq $23, $6, $23 | ||
| 2387 | cmpult $23, $6, $1 | ||
| 2388 | srl $4, 32, $6 | ||
| 2389 | zapnot $5, 15, $5 | ||
| 2390 | mulq $5, $6, $24 | ||
| 2391 | mulq $7, $5, $5 | ||
| 2392 | addq $1, $22, $22 | ||
| 2393 | addq $0, $24, $0 | ||
| 2394 | cmpult $0, $24, $1 | ||
| 2395 | mulq $6, $8, $6 | ||
| 2396 | beq $1, $405 | ||
| 2397 | sll $20, 32, $1 | ||
| 2398 | addq $6, $1, $6 | ||
| 2399 | $405: | ||
| 2400 | sll $0, 32, $24 | ||
| 2401 | ldq $2, 48($18) | ||
| 2402 | addq $5, $24, $5 | ||
| 2403 | bis $5, $5, $7 | ||
| 2404 | ldq $4, 48($17) | ||
| 2405 | addq $23, $7, $23 | ||
| 2406 | srl $2, 32, $8 | ||
| 2407 | cmpult $23, $7, $3 | ||
| 2408 | zapnot $4, 15, $7 | ||
| 2409 | mulq $8, $7, $28 | ||
| 2410 | srl $0, 32, $1 | ||
| 2411 | addq $6, $1, $6 | ||
| 2412 | cmpult $5, $24, $1 | ||
| 2413 | zapnot $2, 15, $5 | ||
| 2414 | addq $1, $6, $6 | ||
| 2415 | addq $3, $6, $6 | ||
| 2416 | addq $22, $6, $22 | ||
| 2417 | cmpult $22, $6, $24 | ||
| 2418 | srl $4, 32, $6 | ||
| 2419 | mulq $5, $6, $25 | ||
| 2420 | mulq $7, $5, $5 | ||
| 2421 | addq $28, $25, $28 | ||
| 2422 | cmpult $28, $25, $1 | ||
| 2423 | mulq $6, $8, $6 | ||
| 2424 | beq $1, $409 | ||
| 2425 | sll $20, 32, $1 | ||
| 2426 | addq $6, $1, $6 | ||
| 2427 | $409: | ||
| 2428 | sll $28, 32, $25 | ||
| 2429 | ldq $2, 56($18) | ||
| 2430 | addq $5, $25, $5 | ||
| 2431 | bis $5, $5, $7 | ||
| 2432 | ldq $4, 40($17) | ||
| 2433 | addq $23, $7, $23 | ||
| 2434 | srl $2, 32, $8 | ||
| 2435 | cmpult $23, $7, $3 | ||
| 2436 | zapnot $4, 15, $7 | ||
| 2437 | mulq $8, $7, $0 | ||
| 2438 | srl $28, 32, $1 | ||
| 2439 | addq $6, $1, $6 | ||
| 2440 | cmpult $5, $25, $1 | ||
| 2441 | zapnot $2, 15, $5 | ||
| 2442 | addq $1, $6, $6 | ||
| 2443 | addq $3, $6, $6 | ||
| 2444 | addq $22, $6, $22 | ||
| 2445 | cmpult $22, $6, $1 | ||
| 2446 | srl $4, 32, $6 | ||
| 2447 | mulq $5, $6, $25 | ||
| 2448 | mulq $7, $5, $2 | ||
| 2449 | addq $1, $24, $24 | ||
| 2450 | addq $0, $25, $0 | ||
| 2451 | cmpult $0, $25, $1 | ||
| 2452 | mulq $6, $8, $6 | ||
| 2453 | beq $1, $413 | ||
| 2454 | sll $20, 32, $1 | ||
| 2455 | addq $6, $1, $6 | ||
| 2456 | $413: | ||
| 2457 | sll $0, 32, $25 | ||
| 2458 | addq $2, $25, $2 | ||
| 2459 | bis $2, $2, $7 | ||
| 2460 | addq $23, $7, $23 | ||
| 2461 | stq $23, 96($16) | ||
| 2462 | ldq $4, 48($17) | ||
| 2463 | ldq $5, 56($18) | ||
| 2464 | cmpult $23, $7, $3 | ||
| 2465 | zapnot $4, 15, $7 | ||
| 2466 | srl $5, 32, $8 | ||
| 2467 | mulq $8, $7, $28 | ||
| 2468 | srl $0, 32, $1 | ||
| 2469 | cmpult $2, $25, $2 | ||
| 2470 | addq $6, $1, $6 | ||
| 2471 | addq $2, $6, $6 | ||
| 2472 | addq $3, $6, $6 | ||
| 2473 | addq $22, $6, $22 | ||
| 2474 | cmpult $22, $6, $1 | ||
| 2475 | srl $4, 32, $6 | ||
| 2476 | zapnot $5, 15, $5 | ||
| 2477 | mulq $5, $6, $23 | ||
| 2478 | mulq $7, $5, $5 | ||
| 2479 | addq $1, $24, $24 | ||
| 2480 | addq $28, $23, $28 | ||
| 2481 | cmpult $28, $23, $1 | ||
| 2482 | mulq $6, $8, $6 | ||
| 2483 | beq $1, $417 | ||
| 2484 | sll $20, 32, $1 | ||
| 2485 | addq $6, $1, $6 | ||
| 2486 | $417: | ||
| 2487 | sll $28, 32, $23 | ||
| 2488 | ldq $2, 48($18) | ||
| 2489 | addq $5, $23, $5 | ||
| 2490 | bis $5, $5, $7 | ||
| 2491 | ldq $4, 56($17) | ||
| 2492 | addq $22, $7, $22 | ||
| 2493 | srl $2, 32, $8 | ||
| 2494 | cmpult $22, $7, $3 | ||
| 2495 | zapnot $4, 15, $7 | ||
| 2496 | mulq $8, $7, $0 | ||
| 2497 | srl $28, 32, $1 | ||
| 2498 | addq $6, $1, $6 | ||
| 2499 | cmpult $5, $23, $1 | ||
| 2500 | zapnot $2, 15, $5 | ||
| 2501 | addq $1, $6, $6 | ||
| 2502 | addq $3, $6, $6 | ||
| 2503 | addq $24, $6, $24 | ||
| 2504 | cmpult $24, $6, $23 | ||
| 2505 | srl $4, 32, $6 | ||
| 2506 | mulq $5, $6, $25 | ||
| 2507 | mulq $7, $5, $2 | ||
| 2508 | addq $0, $25, $0 | ||
| 2509 | cmpult $0, $25, $1 | ||
| 2510 | mulq $6, $8, $6 | ||
| 2511 | beq $1, $421 | ||
| 2512 | sll $20, 32, $1 | ||
| 2513 | addq $6, $1, $6 | ||
| 2514 | $421: | ||
| 2515 | sll $0, 32, $25 | ||
| 2516 | addq $2, $25, $2 | ||
| 2517 | bis $2, $2, $7 | ||
| 2518 | addq $22, $7, $22 | ||
| 2519 | stq $22, 104($16) | ||
| 2520 | ldq $4, 56($17) | ||
| 2521 | ldq $5, 56($18) | ||
| 2522 | cmpult $22, $7, $3 | ||
| 2523 | zapnot $4, 15, $7 | ||
| 2524 | srl $5, 32, $8 | ||
| 2525 | mulq $8, $7, $28 | ||
| 2526 | srl $0, 32, $1 | ||
| 2527 | cmpult $2, $25, $2 | ||
| 2528 | addq $6, $1, $6 | ||
| 2529 | addq $2, $6, $6 | ||
| 2530 | addq $3, $6, $6 | ||
| 2531 | addq $24, $6, $24 | ||
| 2532 | cmpult $24, $6, $1 | ||
| 2533 | srl $4, 32, $6 | ||
| 2534 | zapnot $5, 15, $5 | ||
| 2535 | mulq $5, $6, $22 | ||
| 2536 | mulq $7, $5, $2 | ||
| 2537 | addq $1, $23, $23 | ||
| 2538 | addq $28, $22, $28 | ||
| 2539 | cmpult $28, $22, $1 | ||
| 2540 | mulq $6, $8, $3 | ||
| 2541 | beq $1, $425 | ||
| 2542 | sll $20, 32, $1 | ||
| 2543 | addq $3, $1, $3 | ||
| 2544 | $425: | ||
| 2545 | sll $28, 32, $22 | ||
| 2546 | srl $28, 32, $1 | ||
| 2547 | addq $2, $22, $2 | ||
| 2548 | addq $3, $1, $3 | ||
| 2549 | bis $2, $2, $7 | ||
| 2550 | addq $24, $7, $24 | ||
| 2551 | cmpult $7, $22, $1 | ||
| 2552 | cmpult $24, $7, $2 | ||
| 2553 | addq $1, $3, $6 | ||
| 2554 | addq $2, $6, $6 | ||
| 2555 | stq $24, 112($16) | ||
| 2556 | addq $23, $6, $23 | ||
| 2557 | stq $23, 120($16) | ||
| 2558 | ret $31, ($26), 1 | ||
| 2559 | .end bn_mul_comba8 | ||
| 2560 | .text | ||
| 2561 | .align 3 | ||
| 2562 | .globl bn_sqr_comba4 | ||
| 2563 | .ent bn_sqr_comba4 | ||
| 2564 | bn_sqr_comba4: | ||
| 2565 | bn_sqr_comba4..ng: | ||
| 2566 | .frame $30,0,$26,0 | ||
| 2567 | .prologue 0 | ||
| 2568 | |||
| 2569 | ldq $0, 0($17) | ||
| 2570 | ldq $1, 8($17) | ||
| 2571 | ldq $2, 16($17) | ||
| 2572 | ldq $3, 24($17) | ||
| 2573 | bis $31, $31, $6 | ||
| 2574 | mulq $0, $0, $4 | ||
| 2575 | umulh $0, $0, $5 | ||
| 2576 | stq $4, 0($16) | ||
| 2577 | bis $31, $31, $4 | ||
| 2578 | mulq $0, $1, $7 | ||
| 2579 | umulh $0, $1, $8 | ||
| 2580 | cmplt $7, $31, $22 | ||
| 2581 | cmplt $8, $31, $23 | ||
| 2582 | addq $7, $7, $7 | ||
| 2583 | addq $8, $8, $8 | ||
| 2584 | addq $8, $22, $8 | ||
| 2585 | addq $4, $23, $4 | ||
| 2586 | addq $5, $7, $5 | ||
| 2587 | addq $6, $8, $6 | ||
| 2588 | cmpult $5, $7, $24 | ||
| 2589 | cmpult $6, $8, $25 | ||
| 2590 | addq $6, $24, $6 | ||
| 2591 | addq $4, $25, $4 | ||
| 2592 | stq $5, 8($16) | ||
| 2593 | bis $31, $31, $5 | ||
| 2594 | mulq $1, $1, $27 | ||
| 2595 | umulh $1, $1, $28 | ||
| 2596 | addq $6, $27, $6 | ||
| 2597 | addq $4, $28, $4 | ||
| 2598 | cmpult $6, $27, $21 | ||
| 2599 | cmpult $4, $28, $20 | ||
| 2600 | addq $4, $21, $4 | ||
| 2601 | addq $5, $20, $5 | ||
| 2602 | mulq $2, $0, $19 | ||
| 2603 | umulh $2, $0, $18 | ||
| 2604 | cmplt $19, $31, $17 | ||
| 2605 | cmplt $18, $31, $22 | ||
| 2606 | addq $19, $19, $19 | ||
| 2607 | addq $18, $18, $18 | ||
| 2608 | addq $18, $17, $18 | ||
| 2609 | addq $5, $22, $5 | ||
| 2610 | addq $6, $19, $6 | ||
| 2611 | addq $4, $18, $4 | ||
| 2612 | cmpult $6, $19, $23 | ||
| 2613 | cmpult $4, $18, $7 | ||
| 2614 | addq $4, $23, $4 | ||
| 2615 | addq $5, $7, $5 | ||
| 2616 | stq $6, 16($16) | ||
| 2617 | bis $31, $31, $6 | ||
| 2618 | mulq $3, $0, $8 | ||
| 2619 | umulh $3, $0, $24 | ||
| 2620 | cmplt $8, $31, $25 | ||
| 2621 | cmplt $24, $31, $27 | ||
| 2622 | addq $8, $8, $8 | ||
| 2623 | addq $24, $24, $24 | ||
| 2624 | addq $24, $25, $24 | ||
| 2625 | addq $6, $27, $6 | ||
| 2626 | addq $4, $8, $4 | ||
| 2627 | addq $5, $24, $5 | ||
| 2628 | cmpult $4, $8, $28 | ||
| 2629 | cmpult $5, $24, $21 | ||
| 2630 | addq $5, $28, $5 | ||
| 2631 | addq $6, $21, $6 | ||
| 2632 | mulq $2, $1, $20 | ||
| 2633 | umulh $2, $1, $17 | ||
| 2634 | cmplt $20, $31, $22 | ||
| 2635 | cmplt $17, $31, $19 | ||
| 2636 | addq $20, $20, $20 | ||
| 2637 | addq $17, $17, $17 | ||
| 2638 | addq $17, $22, $17 | ||
| 2639 | addq $6, $19, $6 | ||
| 2640 | addq $4, $20, $4 | ||
| 2641 | addq $5, $17, $5 | ||
| 2642 | cmpult $4, $20, $18 | ||
| 2643 | cmpult $5, $17, $23 | ||
| 2644 | addq $5, $18, $5 | ||
| 2645 | addq $6, $23, $6 | ||
| 2646 | stq $4, 24($16) | ||
| 2647 | bis $31, $31, $4 | ||
| 2648 | mulq $2, $2, $7 | ||
| 2649 | umulh $2, $2, $25 | ||
| 2650 | addq $5, $7, $5 | ||
| 2651 | addq $6, $25, $6 | ||
| 2652 | cmpult $5, $7, $27 | ||
| 2653 | cmpult $6, $25, $8 | ||
| 2654 | addq $6, $27, $6 | ||
| 2655 | addq $4, $8, $4 | ||
| 2656 | mulq $3, $1, $24 | ||
| 2657 | umulh $3, $1, $28 | ||
| 2658 | cmplt $24, $31, $21 | ||
| 2659 | cmplt $28, $31, $22 | ||
| 2660 | addq $24, $24, $24 | ||
| 2661 | addq $28, $28, $28 | ||
| 2662 | addq $28, $21, $28 | ||
| 2663 | addq $4, $22, $4 | ||
| 2664 | addq $5, $24, $5 | ||
| 2665 | addq $6, $28, $6 | ||
| 2666 | cmpult $5, $24, $19 | ||
| 2667 | cmpult $6, $28, $20 | ||
| 2668 | addq $6, $19, $6 | ||
| 2669 | addq $4, $20, $4 | ||
| 2670 | stq $5, 32($16) | ||
| 2671 | bis $31, $31, $5 | ||
| 2672 | mulq $3, $2, $17 | ||
| 2673 | umulh $3, $2, $18 | ||
| 2674 | cmplt $17, $31, $23 | ||
| 2675 | cmplt $18, $31, $7 | ||
| 2676 | addq $17, $17, $17 | ||
| 2677 | addq $18, $18, $18 | ||
| 2678 | addq $18, $23, $18 | ||
| 2679 | addq $5, $7, $5 | ||
| 2680 | addq $6, $17, $6 | ||
| 2681 | addq $4, $18, $4 | ||
| 2682 | cmpult $6, $17, $25 | ||
| 2683 | cmpult $4, $18, $27 | ||
| 2684 | addq $4, $25, $4 | ||
| 2685 | addq $5, $27, $5 | ||
| 2686 | stq $6, 40($16) | ||
| 2687 | bis $31, $31, $6 | ||
| 2688 | mulq $3, $3, $8 | ||
| 2689 | umulh $3, $3, $21 | ||
| 2690 | addq $4, $8, $4 | ||
| 2691 | addq $5, $21, $5 | ||
| 2692 | cmpult $4, $8, $22 | ||
| 2693 | cmpult $5, $21, $24 | ||
| 2694 | addq $5, $22, $5 | ||
| 2695 | addq $6, $24, $6 | ||
| 2696 | stq $4, 48($16) | ||
| 2697 | stq $5, 56($16) | ||
| 2698 | ret $31,($26),1 | ||
| 2699 | .end bn_sqr_comba4 | ||
| 2700 | .text | ||
| 2701 | .align 3 | ||
| 2702 | .globl bn_sqr_comba8 | ||
| 2703 | .ent bn_sqr_comba8 | ||
| 2704 | bn_sqr_comba8: | ||
| 2705 | bn_sqr_comba8..ng: | ||
| 2706 | .frame $30,0,$26,0 | ||
| 2707 | .prologue 0 | ||
| 2708 | |||
| 2709 | ldq $0, 0($17) | ||
| 2710 | ldq $1, 8($17) | ||
| 2711 | ldq $2, 16($17) | ||
| 2712 | ldq $3, 24($17) | ||
| 2713 | ldq $4, 32($17) | ||
| 2714 | ldq $5, 40($17) | ||
| 2715 | ldq $6, 48($17) | ||
| 2716 | ldq $7, 56($17) | ||
| 2717 | bis $31, $31, $23 | ||
| 2718 | mulq $0, $0, $8 | ||
| 2719 | umulh $0, $0, $22 | ||
| 2720 | stq $8, 0($16) | ||
| 2721 | bis $31, $31, $8 | ||
| 2722 | mulq $1, $0, $24 | ||
| 2723 | umulh $1, $0, $25 | ||
| 2724 | cmplt $24, $31, $27 | ||
| 2725 | cmplt $25, $31, $28 | ||
| 2726 | addq $24, $24, $24 | ||
| 2727 | addq $25, $25, $25 | ||
| 2728 | addq $25, $27, $25 | ||
| 2729 | addq $8, $28, $8 | ||
| 2730 | addq $22, $24, $22 | ||
| 2731 | addq $23, $25, $23 | ||
| 2732 | cmpult $22, $24, $21 | ||
| 2733 | cmpult $23, $25, $20 | ||
| 2734 | addq $23, $21, $23 | ||
| 2735 | addq $8, $20, $8 | ||
| 2736 | stq $22, 8($16) | ||
| 2737 | bis $31, $31, $22 | ||
| 2738 | mulq $1, $1, $19 | ||
| 2739 | umulh $1, $1, $18 | ||
| 2740 | addq $23, $19, $23 | ||
| 2741 | addq $8, $18, $8 | ||
| 2742 | cmpult $23, $19, $17 | ||
| 2743 | cmpult $8, $18, $27 | ||
| 2744 | addq $8, $17, $8 | ||
| 2745 | addq $22, $27, $22 | ||
| 2746 | mulq $2, $0, $28 | ||
| 2747 | umulh $2, $0, $24 | ||
| 2748 | cmplt $28, $31, $25 | ||
| 2749 | cmplt $24, $31, $21 | ||
| 2750 | addq $28, $28, $28 | ||
| 2751 | addq $24, $24, $24 | ||
| 2752 | addq $24, $25, $24 | ||
| 2753 | addq $22, $21, $22 | ||
| 2754 | addq $23, $28, $23 | ||
| 2755 | addq $8, $24, $8 | ||
| 2756 | cmpult $23, $28, $20 | ||
| 2757 | cmpult $8, $24, $19 | ||
| 2758 | addq $8, $20, $8 | ||
| 2759 | addq $22, $19, $22 | ||
| 2760 | stq $23, 16($16) | ||
| 2761 | bis $31, $31, $23 | ||
| 2762 | mulq $2, $1, $18 | ||
| 2763 | umulh $2, $1, $17 | ||
| 2764 | cmplt $18, $31, $27 | ||
| 2765 | cmplt $17, $31, $25 | ||
| 2766 | addq $18, $18, $18 | ||
| 2767 | addq $17, $17, $17 | ||
| 2768 | addq $17, $27, $17 | ||
| 2769 | addq $23, $25, $23 | ||
| 2770 | addq $8, $18, $8 | ||
| 2771 | addq $22, $17, $22 | ||
| 2772 | cmpult $8, $18, $21 | ||
| 2773 | cmpult $22, $17, $28 | ||
| 2774 | addq $22, $21, $22 | ||
| 2775 | addq $23, $28, $23 | ||
| 2776 | mulq $3, $0, $24 | ||
| 2777 | umulh $3, $0, $20 | ||
| 2778 | cmplt $24, $31, $19 | ||
| 2779 | cmplt $20, $31, $27 | ||
| 2780 | addq $24, $24, $24 | ||
| 2781 | addq $20, $20, $20 | ||
| 2782 | addq $20, $19, $20 | ||
| 2783 | addq $23, $27, $23 | ||
| 2784 | addq $8, $24, $8 | ||
| 2785 | addq $22, $20, $22 | ||
| 2786 | cmpult $8, $24, $25 | ||
| 2787 | cmpult $22, $20, $18 | ||
| 2788 | addq $22, $25, $22 | ||
| 2789 | addq $23, $18, $23 | ||
| 2790 | stq $8, 24($16) | ||
| 2791 | bis $31, $31, $8 | ||
| 2792 | mulq $2, $2, $17 | ||
| 2793 | umulh $2, $2, $21 | ||
| 2794 | addq $22, $17, $22 | ||
| 2795 | addq $23, $21, $23 | ||
| 2796 | cmpult $22, $17, $28 | ||
| 2797 | cmpult $23, $21, $19 | ||
| 2798 | addq $23, $28, $23 | ||
| 2799 | addq $8, $19, $8 | ||
| 2800 | mulq $3, $1, $27 | ||
| 2801 | umulh $3, $1, $24 | ||
| 2802 | cmplt $27, $31, $20 | ||
| 2803 | cmplt $24, $31, $25 | ||
| 2804 | addq $27, $27, $27 | ||
| 2805 | addq $24, $24, $24 | ||
| 2806 | addq $24, $20, $24 | ||
| 2807 | addq $8, $25, $8 | ||
| 2808 | addq $22, $27, $22 | ||
| 2809 | addq $23, $24, $23 | ||
| 2810 | cmpult $22, $27, $18 | ||
| 2811 | cmpult $23, $24, $17 | ||
| 2812 | addq $23, $18, $23 | ||
| 2813 | addq $8, $17, $8 | ||
| 2814 | mulq $4, $0, $21 | ||
| 2815 | umulh $4, $0, $28 | ||
| 2816 | cmplt $21, $31, $19 | ||
| 2817 | cmplt $28, $31, $20 | ||
| 2818 | addq $21, $21, $21 | ||
| 2819 | addq $28, $28, $28 | ||
| 2820 | addq $28, $19, $28 | ||
| 2821 | addq $8, $20, $8 | ||
| 2822 | addq $22, $21, $22 | ||
| 2823 | addq $23, $28, $23 | ||
| 2824 | cmpult $22, $21, $25 | ||
| 2825 | cmpult $23, $28, $27 | ||
| 2826 | addq $23, $25, $23 | ||
| 2827 | addq $8, $27, $8 | ||
| 2828 | stq $22, 32($16) | ||
| 2829 | bis $31, $31, $22 | ||
| 2830 | mulq $3, $2, $24 | ||
| 2831 | umulh $3, $2, $18 | ||
| 2832 | cmplt $24, $31, $17 | ||
| 2833 | cmplt $18, $31, $19 | ||
| 2834 | addq $24, $24, $24 | ||
| 2835 | addq $18, $18, $18 | ||
| 2836 | addq $18, $17, $18 | ||
| 2837 | addq $22, $19, $22 | ||
| 2838 | addq $23, $24, $23 | ||
| 2839 | addq $8, $18, $8 | ||
| 2840 | cmpult $23, $24, $20 | ||
| 2841 | cmpult $8, $18, $21 | ||
| 2842 | addq $8, $20, $8 | ||
| 2843 | addq $22, $21, $22 | ||
| 2844 | mulq $4, $1, $28 | ||
| 2845 | umulh $4, $1, $25 | ||
| 2846 | cmplt $28, $31, $27 | ||
| 2847 | cmplt $25, $31, $17 | ||
| 2848 | addq $28, $28, $28 | ||
| 2849 | addq $25, $25, $25 | ||
| 2850 | addq $25, $27, $25 | ||
| 2851 | addq $22, $17, $22 | ||
| 2852 | addq $23, $28, $23 | ||
| 2853 | addq $8, $25, $8 | ||
| 2854 | cmpult $23, $28, $19 | ||
| 2855 | cmpult $8, $25, $24 | ||
| 2856 | addq $8, $19, $8 | ||
| 2857 | addq $22, $24, $22 | ||
| 2858 | mulq $5, $0, $18 | ||
| 2859 | umulh $5, $0, $20 | ||
| 2860 | cmplt $18, $31, $21 | ||
| 2861 | cmplt $20, $31, $27 | ||
| 2862 | addq $18, $18, $18 | ||
| 2863 | addq $20, $20, $20 | ||
| 2864 | addq $20, $21, $20 | ||
| 2865 | addq $22, $27, $22 | ||
| 2866 | addq $23, $18, $23 | ||
| 2867 | addq $8, $20, $8 | ||
| 2868 | cmpult $23, $18, $17 | ||
| 2869 | cmpult $8, $20, $28 | ||
| 2870 | addq $8, $17, $8 | ||
| 2871 | addq $22, $28, $22 | ||
| 2872 | stq $23, 40($16) | ||
| 2873 | bis $31, $31, $23 | ||
| 2874 | mulq $3, $3, $25 | ||
| 2875 | umulh $3, $3, $19 | ||
| 2876 | addq $8, $25, $8 | ||
| 2877 | addq $22, $19, $22 | ||
| 2878 | cmpult $8, $25, $24 | ||
| 2879 | cmpult $22, $19, $21 | ||
| 2880 | addq $22, $24, $22 | ||
| 2881 | addq $23, $21, $23 | ||
| 2882 | mulq $4, $2, $27 | ||
| 2883 | umulh $4, $2, $18 | ||
| 2884 | cmplt $27, $31, $20 | ||
| 2885 | cmplt $18, $31, $17 | ||
| 2886 | addq $27, $27, $27 | ||
| 2887 | addq $18, $18, $18 | ||
| 2888 | addq $18, $20, $18 | ||
| 2889 | addq $23, $17, $23 | ||
| 2890 | addq $8, $27, $8 | ||
| 2891 | addq $22, $18, $22 | ||
| 2892 | cmpult $8, $27, $28 | ||
| 2893 | cmpult $22, $18, $25 | ||
| 2894 | addq $22, $28, $22 | ||
| 2895 | addq $23, $25, $23 | ||
| 2896 | mulq $5, $1, $19 | ||
| 2897 | umulh $5, $1, $24 | ||
| 2898 | cmplt $19, $31, $21 | ||
| 2899 | cmplt $24, $31, $20 | ||
| 2900 | addq $19, $19, $19 | ||
| 2901 | addq $24, $24, $24 | ||
| 2902 | addq $24, $21, $24 | ||
| 2903 | addq $23, $20, $23 | ||
| 2904 | addq $8, $19, $8 | ||
| 2905 | addq $22, $24, $22 | ||
| 2906 | cmpult $8, $19, $17 | ||
| 2907 | cmpult $22, $24, $27 | ||
| 2908 | addq $22, $17, $22 | ||
| 2909 | addq $23, $27, $23 | ||
| 2910 | mulq $6, $0, $18 | ||
| 2911 | umulh $6, $0, $28 | ||
| 2912 | cmplt $18, $31, $25 | ||
| 2913 | cmplt $28, $31, $21 | ||
| 2914 | addq $18, $18, $18 | ||
| 2915 | addq $28, $28, $28 | ||
| 2916 | addq $28, $25, $28 | ||
| 2917 | addq $23, $21, $23 | ||
| 2918 | addq $8, $18, $8 | ||
| 2919 | addq $22, $28, $22 | ||
| 2920 | cmpult $8, $18, $20 | ||
| 2921 | cmpult $22, $28, $19 | ||
| 2922 | addq $22, $20, $22 | ||
| 2923 | addq $23, $19, $23 | ||
| 2924 | stq $8, 48($16) | ||
| 2925 | bis $31, $31, $8 | ||
| 2926 | mulq $4, $3, $24 | ||
| 2927 | umulh $4, $3, $17 | ||
| 2928 | cmplt $24, $31, $27 | ||
| 2929 | cmplt $17, $31, $25 | ||
| 2930 | addq $24, $24, $24 | ||
| 2931 | addq $17, $17, $17 | ||
| 2932 | addq $17, $27, $17 | ||
| 2933 | addq $8, $25, $8 | ||
| 2934 | addq $22, $24, $22 | ||
| 2935 | addq $23, $17, $23 | ||
| 2936 | cmpult $22, $24, $21 | ||
| 2937 | cmpult $23, $17, $18 | ||
| 2938 | addq $23, $21, $23 | ||
| 2939 | addq $8, $18, $8 | ||
| 2940 | mulq $5, $2, $28 | ||
| 2941 | umulh $5, $2, $20 | ||
| 2942 | cmplt $28, $31, $19 | ||
| 2943 | cmplt $20, $31, $27 | ||
| 2944 | addq $28, $28, $28 | ||
| 2945 | addq $20, $20, $20 | ||
| 2946 | addq $20, $19, $20 | ||
| 2947 | addq $8, $27, $8 | ||
| 2948 | addq $22, $28, $22 | ||
| 2949 | addq $23, $20, $23 | ||
| 2950 | cmpult $22, $28, $25 | ||
| 2951 | cmpult $23, $20, $24 | ||
| 2952 | addq $23, $25, $23 | ||
| 2953 | addq $8, $24, $8 | ||
| 2954 | mulq $6, $1, $17 | ||
| 2955 | umulh $6, $1, $21 | ||
| 2956 | cmplt $17, $31, $18 | ||
| 2957 | cmplt $21, $31, $19 | ||
| 2958 | addq $17, $17, $17 | ||
| 2959 | addq $21, $21, $21 | ||
| 2960 | addq $21, $18, $21 | ||
| 2961 | addq $8, $19, $8 | ||
| 2962 | addq $22, $17, $22 | ||
| 2963 | addq $23, $21, $23 | ||
| 2964 | cmpult $22, $17, $27 | ||
| 2965 | cmpult $23, $21, $28 | ||
| 2966 | addq $23, $27, $23 | ||
| 2967 | addq $8, $28, $8 | ||
| 2968 | mulq $7, $0, $20 | ||
| 2969 | umulh $7, $0, $25 | ||
| 2970 | cmplt $20, $31, $24 | ||
| 2971 | cmplt $25, $31, $18 | ||
| 2972 | addq $20, $20, $20 | ||
| 2973 | addq $25, $25, $25 | ||
| 2974 | addq $25, $24, $25 | ||
| 2975 | addq $8, $18, $8 | ||
| 2976 | addq $22, $20, $22 | ||
| 2977 | addq $23, $25, $23 | ||
| 2978 | cmpult $22, $20, $19 | ||
| 2979 | cmpult $23, $25, $17 | ||
| 2980 | addq $23, $19, $23 | ||
| 2981 | addq $8, $17, $8 | ||
| 2982 | stq $22, 56($16) | ||
| 2983 | bis $31, $31, $22 | ||
| 2984 | mulq $4, $4, $21 | ||
| 2985 | umulh $4, $4, $27 | ||
| 2986 | addq $23, $21, $23 | ||
| 2987 | addq $8, $27, $8 | ||
| 2988 | cmpult $23, $21, $28 | ||
| 2989 | cmpult $8, $27, $24 | ||
| 2990 | addq $8, $28, $8 | ||
| 2991 | addq $22, $24, $22 | ||
| 2992 | mulq $5, $3, $18 | ||
| 2993 | umulh $5, $3, $20 | ||
| 2994 | cmplt $18, $31, $25 | ||
| 2995 | cmplt $20, $31, $19 | ||
| 2996 | addq $18, $18, $18 | ||
| 2997 | addq $20, $20, $20 | ||
| 2998 | addq $20, $25, $20 | ||
| 2999 | addq $22, $19, $22 | ||
| 3000 | addq $23, $18, $23 | ||
| 3001 | addq $8, $20, $8 | ||
| 3002 | cmpult $23, $18, $17 | ||
| 3003 | cmpult $8, $20, $21 | ||
| 3004 | addq $8, $17, $8 | ||
| 3005 | addq $22, $21, $22 | ||
| 3006 | mulq $6, $2, $27 | ||
| 3007 | umulh $6, $2, $28 | ||
| 3008 | cmplt $27, $31, $24 | ||
| 3009 | cmplt $28, $31, $25 | ||
| 3010 | addq $27, $27, $27 | ||
| 3011 | addq $28, $28, $28 | ||
| 3012 | addq $28, $24, $28 | ||
| 3013 | addq $22, $25, $22 | ||
| 3014 | addq $23, $27, $23 | ||
| 3015 | addq $8, $28, $8 | ||
| 3016 | cmpult $23, $27, $19 | ||
| 3017 | cmpult $8, $28, $18 | ||
| 3018 | addq $8, $19, $8 | ||
| 3019 | addq $22, $18, $22 | ||
| 3020 | mulq $7, $1, $20 | ||
| 3021 | umulh $7, $1, $17 | ||
| 3022 | cmplt $20, $31, $21 | ||
| 3023 | cmplt $17, $31, $24 | ||
| 3024 | addq $20, $20, $20 | ||
| 3025 | addq $17, $17, $17 | ||
| 3026 | addq $17, $21, $17 | ||
| 3027 | addq $22, $24, $22 | ||
| 3028 | addq $23, $20, $23 | ||
| 3029 | addq $8, $17, $8 | ||
| 3030 | cmpult $23, $20, $25 | ||
| 3031 | cmpult $8, $17, $27 | ||
| 3032 | addq $8, $25, $8 | ||
| 3033 | addq $22, $27, $22 | ||
| 3034 | stq $23, 64($16) | ||
| 3035 | bis $31, $31, $23 | ||
| 3036 | mulq $5, $4, $28 | ||
| 3037 | umulh $5, $4, $19 | ||
| 3038 | cmplt $28, $31, $18 | ||
| 3039 | cmplt $19, $31, $21 | ||
| 3040 | addq $28, $28, $28 | ||
| 3041 | addq $19, $19, $19 | ||
| 3042 | addq $19, $18, $19 | ||
| 3043 | addq $23, $21, $23 | ||
| 3044 | addq $8, $28, $8 | ||
| 3045 | addq $22, $19, $22 | ||
| 3046 | cmpult $8, $28, $24 | ||
| 3047 | cmpult $22, $19, $20 | ||
| 3048 | addq $22, $24, $22 | ||
| 3049 | addq $23, $20, $23 | ||
| 3050 | mulq $6, $3, $17 | ||
| 3051 | umulh $6, $3, $25 | ||
| 3052 | cmplt $17, $31, $27 | ||
| 3053 | cmplt $25, $31, $18 | ||
| 3054 | addq $17, $17, $17 | ||
| 3055 | addq $25, $25, $25 | ||
| 3056 | addq $25, $27, $25 | ||
| 3057 | addq $23, $18, $23 | ||
| 3058 | addq $8, $17, $8 | ||
| 3059 | addq $22, $25, $22 | ||
| 3060 | cmpult $8, $17, $21 | ||
| 3061 | cmpult $22, $25, $28 | ||
| 3062 | addq $22, $21, $22 | ||
| 3063 | addq $23, $28, $23 | ||
| 3064 | mulq $7, $2, $19 | ||
| 3065 | umulh $7, $2, $24 | ||
| 3066 | cmplt $19, $31, $20 | ||
| 3067 | cmplt $24, $31, $27 | ||
| 3068 | addq $19, $19, $19 | ||
| 3069 | addq $24, $24, $24 | ||
| 3070 | addq $24, $20, $24 | ||
| 3071 | addq $23, $27, $23 | ||
| 3072 | addq $8, $19, $8 | ||
| 3073 | addq $22, $24, $22 | ||
| 3074 | cmpult $8, $19, $18 | ||
| 3075 | cmpult $22, $24, $17 | ||
| 3076 | addq $22, $18, $22 | ||
| 3077 | addq $23, $17, $23 | ||
| 3078 | stq $8, 72($16) | ||
| 3079 | bis $31, $31, $8 | ||
| 3080 | mulq $5, $5, $25 | ||
| 3081 | umulh $5, $5, $21 | ||
| 3082 | addq $22, $25, $22 | ||
| 3083 | addq $23, $21, $23 | ||
| 3084 | cmpult $22, $25, $28 | ||
| 3085 | cmpult $23, $21, $20 | ||
| 3086 | addq $23, $28, $23 | ||
| 3087 | addq $8, $20, $8 | ||
| 3088 | mulq $6, $4, $27 | ||
| 3089 | umulh $6, $4, $19 | ||
| 3090 | cmplt $27, $31, $24 | ||
| 3091 | cmplt $19, $31, $18 | ||
| 3092 | addq $27, $27, $27 | ||
| 3093 | addq $19, $19, $19 | ||
| 3094 | addq $19, $24, $19 | ||
| 3095 | addq $8, $18, $8 | ||
| 3096 | addq $22, $27, $22 | ||
| 3097 | addq $23, $19, $23 | ||
| 3098 | cmpult $22, $27, $17 | ||
| 3099 | cmpult $23, $19, $25 | ||
| 3100 | addq $23, $17, $23 | ||
| 3101 | addq $8, $25, $8 | ||
| 3102 | mulq $7, $3, $21 | ||
| 3103 | umulh $7, $3, $28 | ||
| 3104 | cmplt $21, $31, $20 | ||
| 3105 | cmplt $28, $31, $24 | ||
| 3106 | addq $21, $21, $21 | ||
| 3107 | addq $28, $28, $28 | ||
| 3108 | addq $28, $20, $28 | ||
| 3109 | addq $8, $24, $8 | ||
| 3110 | addq $22, $21, $22 | ||
| 3111 | addq $23, $28, $23 | ||
| 3112 | cmpult $22, $21, $18 | ||
| 3113 | cmpult $23, $28, $27 | ||
| 3114 | addq $23, $18, $23 | ||
| 3115 | addq $8, $27, $8 | ||
| 3116 | stq $22, 80($16) | ||
| 3117 | bis $31, $31, $22 | ||
| 3118 | mulq $6, $5, $19 | ||
| 3119 | umulh $6, $5, $17 | ||
| 3120 | cmplt $19, $31, $25 | ||
| 3121 | cmplt $17, $31, $20 | ||
| 3122 | addq $19, $19, $19 | ||
| 3123 | addq $17, $17, $17 | ||
| 3124 | addq $17, $25, $17 | ||
| 3125 | addq $22, $20, $22 | ||
| 3126 | addq $23, $19, $23 | ||
| 3127 | addq $8, $17, $8 | ||
| 3128 | cmpult $23, $19, $24 | ||
| 3129 | cmpult $8, $17, $21 | ||
| 3130 | addq $8, $24, $8 | ||
| 3131 | addq $22, $21, $22 | ||
| 3132 | mulq $7, $4, $28 | ||
| 3133 | umulh $7, $4, $18 | ||
| 3134 | cmplt $28, $31, $27 | ||
| 3135 | cmplt $18, $31, $25 | ||
| 3136 | addq $28, $28, $28 | ||
| 3137 | addq $18, $18, $18 | ||
| 3138 | addq $18, $27, $18 | ||
| 3139 | addq $22, $25, $22 | ||
| 3140 | addq $23, $28, $23 | ||
| 3141 | addq $8, $18, $8 | ||
| 3142 | cmpult $23, $28, $20 | ||
| 3143 | cmpult $8, $18, $19 | ||
| 3144 | addq $8, $20, $8 | ||
| 3145 | addq $22, $19, $22 | ||
| 3146 | stq $23, 88($16) | ||
| 3147 | bis $31, $31, $23 | ||
| 3148 | mulq $6, $6, $17 | ||
| 3149 | umulh $6, $6, $24 | ||
| 3150 | addq $8, $17, $8 | ||
| 3151 | addq $22, $24, $22 | ||
| 3152 | cmpult $8, $17, $21 | ||
| 3153 | cmpult $22, $24, $27 | ||
| 3154 | addq $22, $21, $22 | ||
| 3155 | addq $23, $27, $23 | ||
| 3156 | mulq $7, $5, $25 | ||
| 3157 | umulh $7, $5, $28 | ||
| 3158 | cmplt $25, $31, $18 | ||
| 3159 | cmplt $28, $31, $20 | ||
| 3160 | addq $25, $25, $25 | ||
| 3161 | addq $28, $28, $28 | ||
| 3162 | addq $28, $18, $28 | ||
| 3163 | addq $23, $20, $23 | ||
| 3164 | addq $8, $25, $8 | ||
| 3165 | addq $22, $28, $22 | ||
| 3166 | cmpult $8, $25, $19 | ||
| 3167 | cmpult $22, $28, $17 | ||
| 3168 | addq $22, $19, $22 | ||
| 3169 | addq $23, $17, $23 | ||
| 3170 | stq $8, 96($16) | ||
| 3171 | bis $31, $31, $8 | ||
| 3172 | mulq $7, $6, $24 | ||
| 3173 | umulh $7, $6, $21 | ||
| 3174 | cmplt $24, $31, $27 | ||
| 3175 | cmplt $21, $31, $18 | ||
| 3176 | addq $24, $24, $24 | ||
| 3177 | addq $21, $21, $21 | ||
| 3178 | addq $21, $27, $21 | ||
| 3179 | addq $8, $18, $8 | ||
| 3180 | addq $22, $24, $22 | ||
| 3181 | addq $23, $21, $23 | ||
| 3182 | cmpult $22, $24, $20 | ||
| 3183 | cmpult $23, $21, $25 | ||
| 3184 | addq $23, $20, $23 | ||
| 3185 | addq $8, $25, $8 | ||
| 3186 | stq $22, 104($16) | ||
| 3187 | bis $31, $31, $22 | ||
| 3188 | mulq $7, $7, $28 | ||
| 3189 | umulh $7, $7, $19 | ||
| 3190 | addq $23, $28, $23 | ||
| 3191 | addq $8, $19, $8 | ||
| 3192 | cmpult $23, $28, $17 | ||
| 3193 | cmpult $8, $19, $27 | ||
| 3194 | addq $8, $17, $8 | ||
| 3195 | addq $22, $27, $22 | ||
| 3196 | stq $23, 112($16) | ||
| 3197 | stq $8, 120($16) | ||
| 3198 | ret $31,($26),1 | ||
| 3199 | .end bn_sqr_comba8 | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.s.works b/src/lib/libcrypto/bn/asm/alpha.s.works deleted file mode 100644 index ee6c587809..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.s.works +++ /dev/null | |||
| @@ -1,533 +0,0 @@ | |||
| 1 | |||
| 2 | # DEC Alpha assember | ||
| 3 | # The bn_div64 is actually gcc output but the other parts are hand done. | ||
| 4 | # Thanks to tzeruch@ceddec.com for sending me the gcc output for | ||
| 5 | # bn_div64. | ||
| 6 | # I've gone back and re-done most of routines. | ||
| 7 | # The key thing to remeber for the 164 CPU is that while a | ||
| 8 | # multiply operation takes 8 cycles, another one can only be issued | ||
| 9 | # after 4 cycles have elapsed. I've done modification to help | ||
| 10 | # improve this. Also, normally, a ld instruction will not be available | ||
| 11 | # for about 3 cycles. | ||
| 12 | .file 1 "bn_asm.c" | ||
| 13 | .set noat | ||
| 14 | gcc2_compiled.: | ||
| 15 | __gnu_compiled_c: | ||
| 16 | .text | ||
| 17 | .align 3 | ||
| 18 | .globl bn_mul_add_words | ||
| 19 | .ent bn_mul_add_words | ||
| 20 | bn_mul_add_words: | ||
| 21 | bn_mul_add_words..ng: | ||
| 22 | .frame $30,0,$26,0 | ||
| 23 | .prologue 0 | ||
| 24 | .align 5 | ||
| 25 | subq $18,4,$18 | ||
| 26 | bis $31,$31,$0 | ||
| 27 | blt $18,$43 # if we are -1, -2, -3 or -4 goto tail code | ||
| 28 | ldq $20,0($17) # 1 1 | ||
| 29 | ldq $1,0($16) # 1 1 | ||
| 30 | .align 3 | ||
| 31 | $42: | ||
| 32 | mulq $20,$19,$5 # 1 2 1 ###### | ||
| 33 | ldq $21,8($17) # 2 1 | ||
| 34 | ldq $2,8($16) # 2 1 | ||
| 35 | umulh $20,$19,$20 # 1 2 ###### | ||
| 36 | ldq $27,16($17) # 3 1 | ||
| 37 | ldq $3,16($16) # 3 1 | ||
| 38 | mulq $21,$19,$6 # 2 2 1 ###### | ||
| 39 | ldq $28,24($17) # 4 1 | ||
| 40 | addq $1,$5,$1 # 1 2 2 | ||
| 41 | ldq $4,24($16) # 4 1 | ||
| 42 | umulh $21,$19,$21 # 2 2 ###### | ||
| 43 | cmpult $1,$5,$22 # 1 2 3 1 | ||
| 44 | addq $20,$22,$20 # 1 3 1 | ||
| 45 | addq $1,$0,$1 # 1 2 3 1 | ||
| 46 | mulq $27,$19,$7 # 3 2 1 ###### | ||
| 47 | cmpult $1,$0,$0 # 1 2 3 2 | ||
| 48 | addq $2,$6,$2 # 2 2 2 | ||
| 49 | addq $20,$0,$0 # 1 3 2 | ||
| 50 | cmpult $2,$6,$23 # 2 2 3 1 | ||
| 51 | addq $21,$23,$21 # 2 3 1 | ||
| 52 | umulh $27,$19,$27 # 3 2 ###### | ||
| 53 | addq $2,$0,$2 # 2 2 3 1 | ||
| 54 | cmpult $2,$0,$0 # 2 2 3 2 | ||
| 55 | subq $18,4,$18 | ||
| 56 | mulq $28,$19,$8 # 4 2 1 ###### | ||
| 57 | addq $21,$0,$0 # 2 3 2 | ||
| 58 | addq $3,$7,$3 # 3 2 2 | ||
| 59 | addq $16,32,$16 | ||
| 60 | cmpult $3,$7,$24 # 3 2 3 1 | ||
| 61 | stq $1,-32($16) # 1 2 4 | ||
| 62 | umulh $28,$19,$28 # 4 2 ###### | ||
| 63 | addq $27,$24,$27 # 3 3 1 | ||
| 64 | addq $3,$0,$3 # 3 2 3 1 | ||
| 65 | stq $2,-24($16) # 2 2 4 | ||
| 66 | cmpult $3,$0,$0 # 3 2 3 2 | ||
| 67 | stq $3,-16($16) # 3 2 4 | ||
| 68 | addq $4,$8,$4 # 4 2 2 | ||
| 69 | addq $27,$0,$0 # 3 3 2 | ||
| 70 | cmpult $4,$8,$25 # 4 2 3 1 | ||
| 71 | addq $17,32,$17 | ||
| 72 | addq $28,$25,$28 # 4 3 1 | ||
| 73 | addq $4,$0,$4 # 4 2 3 1 | ||
| 74 | cmpult $4,$0,$0 # 4 2 3 2 | ||
| 75 | stq $4,-8($16) # 4 2 4 | ||
| 76 | addq $28,$0,$0 # 4 3 2 | ||
| 77 | blt $18,$43 | ||
| 78 | |||
| 79 | ldq $20,0($17) # 1 1 | ||
| 80 | ldq $1,0($16) # 1 1 | ||
| 81 | |||
| 82 | br $42 | ||
| 83 | |||
| 84 | .align 4 | ||
| 85 | $45: | ||
| 86 | ldq $20,0($17) # 4 1 | ||
| 87 | ldq $1,0($16) # 4 1 | ||
| 88 | mulq $20,$19,$5 # 4 2 1 | ||
| 89 | subq $18,1,$18 | ||
| 90 | addq $16,8,$16 | ||
| 91 | addq $17,8,$17 | ||
| 92 | umulh $20,$19,$20 # 4 2 | ||
| 93 | addq $1,$5,$1 # 4 2 2 | ||
| 94 | cmpult $1,$5,$22 # 4 2 3 1 | ||
| 95 | addq $20,$22,$20 # 4 3 1 | ||
| 96 | addq $1,$0,$1 # 4 2 3 1 | ||
| 97 | cmpult $1,$0,$0 # 4 2 3 2 | ||
| 98 | addq $20,$0,$0 # 4 3 2 | ||
| 99 | stq $1,-8($16) # 4 2 4 | ||
| 100 | bgt $18,$45 | ||
| 101 | ret $31,($26),1 # else exit | ||
| 102 | |||
| 103 | .align 4 | ||
| 104 | $43: | ||
| 105 | addq $18,4,$18 | ||
| 106 | bgt $18,$45 # goto tail code | ||
| 107 | ret $31,($26),1 # else exit | ||
| 108 | |||
| 109 | .end bn_mul_add_words | ||
| 110 | .align 3 | ||
| 111 | .globl bn_mul_words | ||
| 112 | .ent bn_mul_words | ||
| 113 | bn_mul_words: | ||
| 114 | bn_mul_words..ng: | ||
| 115 | .frame $30,0,$26,0 | ||
| 116 | .prologue 0 | ||
| 117 | .align 5 | ||
| 118 | subq $18,4,$18 | ||
| 119 | bis $31,$31,$0 | ||
| 120 | blt $18,$143 # if we are -1, -2, -3 or -4 goto tail code | ||
| 121 | ldq $20,0($17) # 1 1 | ||
| 122 | .align 3 | ||
| 123 | $142: | ||
| 124 | |||
| 125 | mulq $20,$19,$5 # 1 2 1 ##### | ||
| 126 | ldq $21,8($17) # 2 1 | ||
| 127 | ldq $27,16($17) # 3 1 | ||
| 128 | umulh $20,$19,$20 # 1 2 ##### | ||
| 129 | ldq $28,24($17) # 4 1 | ||
| 130 | mulq $21,$19,$6 # 2 2 1 ##### | ||
| 131 | addq $5,$0,$5 # 1 2 3 1 | ||
| 132 | subq $18,4,$18 | ||
| 133 | cmpult $5,$0,$0 # 1 2 3 2 | ||
| 134 | umulh $21,$19,$21 # 2 2 ##### | ||
| 135 | addq $20,$0,$0 # 1 3 2 | ||
| 136 | addq $17,32,$17 | ||
| 137 | addq $6,$0,$6 # 2 2 3 1 | ||
| 138 | mulq $27,$19,$7 # 3 2 1 ##### | ||
| 139 | cmpult $6,$0,$0 # 2 2 3 2 | ||
| 140 | addq $21,$0,$0 # 2 3 2 | ||
| 141 | addq $16,32,$16 | ||
| 142 | umulh $27,$19,$27 # 3 2 ##### | ||
| 143 | stq $5,-32($16) # 1 2 4 | ||
| 144 | mulq $28,$19,$8 # 4 2 1 ##### | ||
| 145 | addq $7,$0,$7 # 3 2 3 1 | ||
| 146 | stq $6,-24($16) # 2 2 4 | ||
| 147 | cmpult $7,$0,$0 # 3 2 3 2 | ||
| 148 | umulh $28,$19,$28 # 4 2 ##### | ||
| 149 | addq $27,$0,$0 # 3 3 2 | ||
| 150 | stq $7,-16($16) # 3 2 4 | ||
| 151 | addq $8,$0,$8 # 4 2 3 1 | ||
| 152 | cmpult $8,$0,$0 # 4 2 3 2 | ||
| 153 | |||
| 154 | addq $28,$0,$0 # 4 3 2 | ||
| 155 | |||
| 156 | stq $8,-8($16) # 4 2 4 | ||
| 157 | |||
| 158 | blt $18,$143 | ||
| 159 | |||
| 160 | ldq $20,0($17) # 1 1 | ||
| 161 | |||
| 162 | br $142 | ||
| 163 | |||
| 164 | .align 4 | ||
| 165 | $145: | ||
| 166 | ldq $20,0($17) # 4 1 | ||
| 167 | mulq $20,$19,$5 # 4 2 1 | ||
| 168 | subq $18,1,$18 | ||
| 169 | umulh $20,$19,$20 # 4 2 | ||
| 170 | addq $5,$0,$5 # 4 2 3 1 | ||
| 171 | addq $16,8,$16 | ||
| 172 | cmpult $5,$0,$0 # 4 2 3 2 | ||
| 173 | addq $17,8,$17 | ||
| 174 | addq $20,$0,$0 # 4 3 2 | ||
| 175 | stq $5,-8($16) # 4 2 4 | ||
| 176 | |||
| 177 | bgt $18,$145 | ||
| 178 | ret $31,($26),1 # else exit | ||
| 179 | |||
| 180 | .align 4 | ||
| 181 | $143: | ||
| 182 | addq $18,4,$18 | ||
| 183 | bgt $18,$145 # goto tail code | ||
| 184 | ret $31,($26),1 # else exit | ||
| 185 | |||
| 186 | .end bn_mul_words | ||
| 187 | .align 3 | ||
| 188 | .globl bn_sqr_words | ||
| 189 | .ent bn_sqr_words | ||
| 190 | bn_sqr_words: | ||
| 191 | bn_sqr_words..ng: | ||
| 192 | .frame $30,0,$26,0 | ||
| 193 | .prologue 0 | ||
| 194 | |||
| 195 | subq $18,4,$18 | ||
| 196 | blt $18,$543 # if we are -1, -2, -3 or -4 goto tail code | ||
| 197 | ldq $20,0($17) # 1 1 | ||
| 198 | .align 3 | ||
| 199 | $542: | ||
| 200 | mulq $20,$20,$5 ###### | ||
| 201 | ldq $21,8($17) # 1 1 | ||
| 202 | subq $18,4 | ||
| 203 | umulh $20,$20,$1 ###### | ||
| 204 | ldq $27,16($17) # 1 1 | ||
| 205 | mulq $21,$21,$6 ###### | ||
| 206 | ldq $28,24($17) # 1 1 | ||
| 207 | stq $5,0($16) # r[0] | ||
| 208 | umulh $21,$21,$2 ###### | ||
| 209 | stq $1,8($16) # r[1] | ||
| 210 | mulq $27,$27,$7 ###### | ||
| 211 | stq $6,16($16) # r[0] | ||
| 212 | umulh $27,$27,$3 ###### | ||
| 213 | stq $2,24($16) # r[1] | ||
| 214 | mulq $28,$28,$8 ###### | ||
| 215 | stq $7,32($16) # r[0] | ||
| 216 | umulh $28,$28,$4 ###### | ||
| 217 | stq $3,40($16) # r[1] | ||
| 218 | |||
| 219 | addq $16,64,$16 | ||
| 220 | addq $17,32,$17 | ||
| 221 | stq $8,-16($16) # r[0] | ||
| 222 | stq $4,-8($16) # r[1] | ||
| 223 | |||
| 224 | blt $18,$543 | ||
| 225 | ldq $20,0($17) # 1 1 | ||
| 226 | br $542 | ||
| 227 | |||
| 228 | $442: | ||
| 229 | ldq $20,0($17) # a[0] | ||
| 230 | mulq $20,$20,$5 # a[0]*w low part r2 | ||
| 231 | addq $16,16,$16 | ||
| 232 | addq $17,8,$17 | ||
| 233 | subq $18,1,$18 | ||
| 234 | umulh $20,$20,$1 # a[0]*w high part r3 | ||
| 235 | stq $5,-16($16) # r[0] | ||
| 236 | stq $1,-8($16) # r[1] | ||
| 237 | |||
| 238 | bgt $18,$442 | ||
| 239 | ret $31,($26),1 # else exit | ||
| 240 | |||
| 241 | .align 4 | ||
| 242 | $543: | ||
| 243 | addq $18,4,$18 | ||
| 244 | bgt $18,$442 # goto tail code | ||
| 245 | ret $31,($26),1 # else exit | ||
| 246 | .end bn_sqr_words | ||
| 247 | |||
| 248 | .align 3 | ||
| 249 | .globl bn_add_words | ||
| 250 | .ent bn_add_words | ||
| 251 | bn_add_words: | ||
| 252 | bn_add_words..ng: | ||
| 253 | .frame $30,0,$26,0 | ||
| 254 | .prologue 0 | ||
| 255 | |||
| 256 | subq $19,4,$19 | ||
| 257 | bis $31,$31,$0 # carry = 0 | ||
| 258 | blt $19,$900 | ||
| 259 | ldq $5,0($17) # a[0] | ||
| 260 | ldq $1,0($18) # b[1] | ||
| 261 | .align 3 | ||
| 262 | $901: | ||
| 263 | addq $1,$5,$1 # r=a+b; | ||
| 264 | ldq $6,8($17) # a[1] | ||
| 265 | cmpult $1,$5,$22 # did we overflow? | ||
| 266 | ldq $2,8($18) # b[1] | ||
| 267 | addq $1,$0,$1 # c+= overflow | ||
| 268 | ldq $7,16($17) # a[2] | ||
| 269 | cmpult $1,$0,$0 # overflow? | ||
| 270 | ldq $3,16($18) # b[2] | ||
| 271 | addq $0,$22,$0 | ||
| 272 | ldq $8,24($17) # a[3] | ||
| 273 | addq $2,$6,$2 # r=a+b; | ||
| 274 | ldq $4,24($18) # b[3] | ||
| 275 | cmpult $2,$6,$23 # did we overflow? | ||
| 276 | addq $3,$7,$3 # r=a+b; | ||
| 277 | addq $2,$0,$2 # c+= overflow | ||
| 278 | cmpult $3,$7,$24 # did we overflow? | ||
| 279 | cmpult $2,$0,$0 # overflow? | ||
| 280 | addq $4,$8,$4 # r=a+b; | ||
| 281 | addq $0,$23,$0 | ||
| 282 | cmpult $4,$8,$25 # did we overflow? | ||
| 283 | addq $3,$0,$3 # c+= overflow | ||
| 284 | stq $1,0($16) # r[0]=c | ||
| 285 | cmpult $3,$0,$0 # overflow? | ||
| 286 | stq $2,8($16) # r[1]=c | ||
| 287 | addq $0,$24,$0 | ||
| 288 | stq $3,16($16) # r[2]=c | ||
| 289 | addq $4,$0,$4 # c+= overflow | ||
| 290 | subq $19,4,$19 # loop-- | ||
| 291 | cmpult $4,$0,$0 # overflow? | ||
| 292 | addq $17,32,$17 # a++ | ||
| 293 | addq $0,$25,$0 | ||
| 294 | stq $4,24($16) # r[3]=c | ||
| 295 | addq $18,32,$18 # b++ | ||
| 296 | addq $16,32,$16 # r++ | ||
| 297 | |||
| 298 | blt $19,$900 | ||
| 299 | ldq $5,0($17) # a[0] | ||
| 300 | ldq $1,0($18) # b[1] | ||
| 301 | br $901 | ||
| 302 | .align 4 | ||
| 303 | $945: | ||
| 304 | ldq $5,0($17) # a[0] | ||
| 305 | ldq $1,0($18) # b[1] | ||
| 306 | addq $1,$5,$1 # r=a+b; | ||
| 307 | subq $19,1,$19 # loop-- | ||
| 308 | addq $1,$0,$1 # c+= overflow | ||
| 309 | addq $17,8,$17 # a++ | ||
| 310 | cmpult $1,$5,$22 # did we overflow? | ||
| 311 | cmpult $1,$0,$0 # overflow? | ||
| 312 | addq $18,8,$18 # b++ | ||
| 313 | stq $1,0($16) # r[0]=c | ||
| 314 | addq $0,$22,$0 | ||
| 315 | addq $16,8,$16 # r++ | ||
| 316 | |||
| 317 | bgt $19,$945 | ||
| 318 | ret $31,($26),1 # else exit | ||
| 319 | |||
| 320 | $900: | ||
| 321 | addq $19,4,$19 | ||
| 322 | bgt $19,$945 # goto tail code | ||
| 323 | ret $31,($26),1 # else exit | ||
| 324 | .end bn_add_words | ||
| 325 | |||
| 326 | # | ||
| 327 | # What follows was taken directly from the C compiler with a few | ||
| 328 | # hacks to redo the lables. | ||
| 329 | # | ||
| 330 | .text | ||
| 331 | .align 3 | ||
| 332 | .globl bn_div64 | ||
| 333 | .ent bn_div64 | ||
| 334 | bn_div64: | ||
| 335 | ldgp $29,0($27) | ||
| 336 | bn_div64..ng: | ||
| 337 | lda $30,-48($30) | ||
| 338 | .frame $30,48,$26,0 | ||
| 339 | stq $26,0($30) | ||
| 340 | stq $9,8($30) | ||
| 341 | stq $10,16($30) | ||
| 342 | stq $11,24($30) | ||
| 343 | stq $12,32($30) | ||
| 344 | stq $13,40($30) | ||
| 345 | .mask 0x4003e00,-48 | ||
| 346 | .prologue 1 | ||
| 347 | bis $16,$16,$9 | ||
| 348 | bis $17,$17,$10 | ||
| 349 | bis $18,$18,$11 | ||
| 350 | bis $31,$31,$13 | ||
| 351 | bis $31,2,$12 | ||
| 352 | bne $11,$119 | ||
| 353 | lda $0,-1 | ||
| 354 | br $31,$136 | ||
| 355 | .align 4 | ||
| 356 | $119: | ||
| 357 | bis $11,$11,$16 | ||
| 358 | jsr $26,BN_num_bits_word | ||
| 359 | ldgp $29,0($26) | ||
| 360 | subq $0,64,$1 | ||
| 361 | beq $1,$120 | ||
| 362 | bis $31,1,$1 | ||
| 363 | sll $1,$0,$1 | ||
| 364 | cmpule $9,$1,$1 | ||
| 365 | bne $1,$120 | ||
| 366 | # lda $16,_IO_stderr_ | ||
| 367 | # lda $17,$C32 | ||
| 368 | # bis $0,$0,$18 | ||
| 369 | # jsr $26,fprintf | ||
| 370 | # ldgp $29,0($26) | ||
| 371 | jsr $26,abort | ||
| 372 | ldgp $29,0($26) | ||
| 373 | .align 4 | ||
| 374 | $120: | ||
| 375 | bis $31,64,$3 | ||
| 376 | cmpult $9,$11,$2 | ||
| 377 | subq $3,$0,$1 | ||
| 378 | addl $1,$31,$0 | ||
| 379 | subq $9,$11,$1 | ||
| 380 | cmoveq $2,$1,$9 | ||
| 381 | beq $0,$122 | ||
| 382 | zapnot $0,15,$2 | ||
| 383 | subq $3,$0,$1 | ||
| 384 | sll $11,$2,$11 | ||
| 385 | sll $9,$2,$3 | ||
| 386 | srl $10,$1,$1 | ||
| 387 | sll $10,$2,$10 | ||
| 388 | bis $3,$1,$9 | ||
| 389 | $122: | ||
| 390 | srl $11,32,$5 | ||
| 391 | zapnot $11,15,$6 | ||
| 392 | lda $7,-1 | ||
| 393 | .align 5 | ||
| 394 | $123: | ||
| 395 | srl $9,32,$1 | ||
| 396 | subq $1,$5,$1 | ||
| 397 | bne $1,$126 | ||
| 398 | zapnot $7,15,$27 | ||
| 399 | br $31,$127 | ||
| 400 | .align 4 | ||
| 401 | $126: | ||
| 402 | bis $9,$9,$24 | ||
| 403 | bis $5,$5,$25 | ||
| 404 | divqu $24,$25,$27 | ||
| 405 | $127: | ||
| 406 | srl $10,32,$4 | ||
| 407 | .align 5 | ||
| 408 | $128: | ||
| 409 | mulq $27,$5,$1 | ||
| 410 | subq $9,$1,$3 | ||
| 411 | zapnot $3,240,$1 | ||
| 412 | bne $1,$129 | ||
| 413 | mulq $6,$27,$2 | ||
| 414 | sll $3,32,$1 | ||
| 415 | addq $1,$4,$1 | ||
| 416 | cmpule $2,$1,$2 | ||
| 417 | bne $2,$129 | ||
| 418 | subq $27,1,$27 | ||
| 419 | br $31,$128 | ||
| 420 | .align 4 | ||
| 421 | $129: | ||
| 422 | mulq $27,$6,$1 | ||
| 423 | mulq $27,$5,$4 | ||
| 424 | srl $1,32,$3 | ||
| 425 | sll $1,32,$1 | ||
| 426 | addq $4,$3,$4 | ||
| 427 | cmpult $10,$1,$2 | ||
| 428 | subq $10,$1,$10 | ||
| 429 | addq $2,$4,$2 | ||
| 430 | cmpult $9,$2,$1 | ||
| 431 | bis $2,$2,$4 | ||
| 432 | beq $1,$134 | ||
| 433 | addq $9,$11,$9 | ||
| 434 | subq $27,1,$27 | ||
| 435 | $134: | ||
| 436 | subl $12,1,$12 | ||
| 437 | subq $9,$4,$9 | ||
| 438 | beq $12,$124 | ||
| 439 | sll $27,32,$13 | ||
| 440 | sll $9,32,$2 | ||
| 441 | srl $10,32,$1 | ||
| 442 | sll $10,32,$10 | ||
| 443 | bis $2,$1,$9 | ||
| 444 | br $31,$123 | ||
| 445 | .align 4 | ||
| 446 | $124: | ||
| 447 | bis $13,$27,$0 | ||
| 448 | $136: | ||
| 449 | ldq $26,0($30) | ||
| 450 | ldq $9,8($30) | ||
| 451 | ldq $10,16($30) | ||
| 452 | ldq $11,24($30) | ||
| 453 | ldq $12,32($30) | ||
| 454 | ldq $13,40($30) | ||
| 455 | addq $30,48,$30 | ||
| 456 | ret $31,($26),1 | ||
| 457 | .end bn_div64 | ||
| 458 | |||
| 459 | .set noat | ||
| 460 | .text | ||
| 461 | .align 3 | ||
| 462 | .globl bn_sub_words | ||
| 463 | .ent bn_sub_words | ||
| 464 | bn_sub_words: | ||
| 465 | bn_sub_words..ng: | ||
| 466 | .frame $30,0,$26,0 | ||
| 467 | .prologue 0 | ||
| 468 | |||
| 469 | subq $19, 4, $19 | ||
| 470 | bis $31, $31, $0 | ||
| 471 | blt $19, $100 | ||
| 472 | ldq $1, 0($17) | ||
| 473 | ldq $2, 0($18) | ||
| 474 | $101: | ||
| 475 | ldq $3, 8($17) | ||
| 476 | cmpult $1, $2, $4 | ||
| 477 | ldq $5, 8($18) | ||
| 478 | subq $1, $2, $1 | ||
| 479 | ldq $6, 16($17) | ||
| 480 | cmpult $1, $0, $2 | ||
| 481 | ldq $7, 16($18) | ||
| 482 | subq $1, $0, $23 | ||
| 483 | ldq $8, 24($17) | ||
| 484 | addq $2, $4, $0 | ||
| 485 | cmpult $3, $5, $24 | ||
| 486 | subq $3, $5, $3 | ||
| 487 | ldq $22, 24($18) | ||
| 488 | cmpult $3, $0, $5 | ||
| 489 | subq $3, $0, $25 | ||
| 490 | addq $5, $24, $0 | ||
| 491 | cmpult $6, $7, $27 | ||
| 492 | subq $6, $7, $6 | ||
| 493 | stq $23, 0($16) | ||
| 494 | cmpult $6, $0, $7 | ||
| 495 | subq $6, $0, $28 | ||
| 496 | addq $7, $27, $0 | ||
| 497 | cmpult $8, $22, $21 | ||
| 498 | subq $8, $22, $8 | ||
| 499 | stq $25, 8($16) | ||
| 500 | cmpult $8, $0, $22 | ||
| 501 | subq $8, $0, $20 | ||
| 502 | addq $22, $21, $0 | ||
| 503 | stq $28, 16($16) | ||
| 504 | subq $19, 4, $19 | ||
| 505 | stq $20, 24($16) | ||
| 506 | addq $17, 32, $17 | ||
| 507 | addq $18, 32, $18 | ||
| 508 | addq $16, 32, $16 | ||
| 509 | blt $19, $100 | ||
| 510 | ldq $1, 0($17) | ||
| 511 | ldq $2, 0($18) | ||
| 512 | br $101 | ||
| 513 | $102: | ||
| 514 | ldq $1, 0($17) | ||
| 515 | ldq $2, 0($18) | ||
| 516 | cmpult $1, $2, $27 | ||
| 517 | subq $1, $2, $1 | ||
| 518 | cmpult $1, $0, $2 | ||
| 519 | subq $1, $0, $1 | ||
| 520 | stq $1, 0($16) | ||
| 521 | addq $2, $27, $0 | ||
| 522 | addq $17, 8, $17 | ||
| 523 | addq $18, 8, $18 | ||
| 524 | addq $16, 8, $16 | ||
| 525 | subq $19, 1, $19 | ||
| 526 | bgt $19, $102 | ||
| 527 | ret $31,($26),1 | ||
| 528 | $100: | ||
| 529 | addq $19, 4, $19 | ||
| 530 | bgt $19, $102 | ||
| 531 | $103: | ||
| 532 | ret $31,($26),1 | ||
| 533 | .end bn_sub_words | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/add.pl b/src/lib/libcrypto/bn/asm/alpha.works/add.pl deleted file mode 100644 index 4dc76e6b69..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/add.pl +++ /dev/null | |||
| @@ -1,119 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_add_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | $count=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &br(&label("finish")); | ||
| 23 | &blt($count,&label("finish")); | ||
| 24 | |||
| 25 | ($a0,$b0)=&NR(2); | ||
| 26 | &ld($a0,&QWPw(0,$ap)); | ||
| 27 | &ld($b0,&QWPw(0,$bp)); | ||
| 28 | |||
| 29 | ########################################################## | ||
| 30 | &set_label("loop"); | ||
| 31 | |||
| 32 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 33 | ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp)); | ||
| 34 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 35 | ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp)); | ||
| 36 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 37 | ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp)); | ||
| 38 | |||
| 39 | ($o0,$t0)=&NR(2); | ||
| 40 | &add($a0,$b0,$o0); | ||
| 41 | &cmpult($o0,$b0,$t0); | ||
| 42 | &add($o0,$cc,$o0); | ||
| 43 | &cmpult($o0,$cc,$cc); | ||
| 44 | &add($cc,$t0,$cc); &FR($t0); | ||
| 45 | |||
| 46 | ($t1,$o1)=&NR(2); | ||
| 47 | |||
| 48 | &add($a1,$b1,$o1); &FR($a1); | ||
| 49 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 50 | &add($o1,$cc,$o1); | ||
| 51 | &cmpult($o1,$cc,$cc); | ||
| 52 | &add($cc,$t1,$cc); &FR($t1); | ||
| 53 | |||
| 54 | ($t2,$o2)=&NR(2); | ||
| 55 | |||
| 56 | &add($a2,$b2,$o2); &FR($a2); | ||
| 57 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 58 | &add($o2,$cc,$o2); | ||
| 59 | &cmpult($o2,$cc,$cc); | ||
| 60 | &add($cc,$t2,$cc); &FR($t2); | ||
| 61 | |||
| 62 | ($t3,$o3)=&NR(2); | ||
| 63 | |||
| 64 | &add($a3,$b3,$o3); &FR($a3); | ||
| 65 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 66 | &add($o3,$cc,$o3); | ||
| 67 | &cmpult($o3,$cc,$cc); | ||
| 68 | &add($cc,$t3,$cc); &FR($t3); | ||
| 69 | |||
| 70 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 71 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 72 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 73 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 74 | |||
| 75 | &sub($count,4,$count); # count-=4 | ||
| 76 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 77 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 78 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 79 | |||
| 80 | &blt($count,&label("finish")); | ||
| 81 | &ld($a0,&QWPw(0,$ap)); | ||
| 82 | &ld($b0,&QWPw(0,$bp)); | ||
| 83 | &br(&label("loop")); | ||
| 84 | ################################################## | ||
| 85 | # Do the last 0..3 words | ||
| 86 | |||
| 87 | ($t0,$o0)=&NR(2); | ||
| 88 | &set_label("last_loop"); | ||
| 89 | |||
| 90 | &ld($a0,&QWPw(0,$ap)); # get a | ||
| 91 | &ld($b0,&QWPw(0,$bp)); # get b | ||
| 92 | |||
| 93 | &add($a0,$b0,$o0); | ||
| 94 | &cmpult($o0,$b0,$t0); # will we borrow? | ||
| 95 | &add($o0,$cc,$o0); # will we borrow? | ||
| 96 | &cmpult($o0,$cc,$cc); # will we borrow? | ||
| 97 | &add($cc,$t0,$cc); # add the borrows | ||
| 98 | &st($o0,&QWPw(0,$rp)); # save | ||
| 99 | |||
| 100 | &add($ap,$QWS,$ap); | ||
| 101 | &add($bp,$QWS,$bp); | ||
| 102 | &add($rp,$QWS,$rp); | ||
| 103 | &sub($count,1,$count); | ||
| 104 | &bgt($count,&label("last_loop")); | ||
| 105 | &function_end_A($name); | ||
| 106 | |||
| 107 | ###################################################### | ||
| 108 | &set_label("finish"); | ||
| 109 | &add($count,4,$count); | ||
| 110 | &bgt($count,&label("last_loop")); | ||
| 111 | |||
| 112 | &FR($o0,$t0,$a0,$b0); | ||
| 113 | &set_label("end"); | ||
| 114 | &function_end($name); | ||
| 115 | |||
| 116 | &fin_pool; | ||
| 117 | } | ||
| 118 | |||
| 119 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/div.pl b/src/lib/libcrypto/bn/asm/alpha.works/div.pl deleted file mode 100644 index 7ec144377f..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/div.pl +++ /dev/null | |||
| @@ -1,144 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | sub bn_div64 | ||
| 4 | { | ||
| 5 | local($data)=<<'EOF'; | ||
| 6 | # | ||
| 7 | # What follows was taken directly from the C compiler with a few | ||
| 8 | # hacks to redo the lables. | ||
| 9 | # | ||
| 10 | .text | ||
| 11 | .set noreorder | ||
| 12 | .set volatile | ||
| 13 | .align 3 | ||
| 14 | .globl bn_div64 | ||
| 15 | .ent bn_div64 | ||
| 16 | bn_div64: | ||
| 17 | ldgp $29,0($27) | ||
| 18 | bn_div64..ng: | ||
| 19 | lda $30,-48($30) | ||
| 20 | .frame $30,48,$26,0 | ||
| 21 | stq $26,0($30) | ||
| 22 | stq $9,8($30) | ||
| 23 | stq $10,16($30) | ||
| 24 | stq $11,24($30) | ||
| 25 | stq $12,32($30) | ||
| 26 | stq $13,40($30) | ||
| 27 | .mask 0x4003e00,-48 | ||
| 28 | .prologue 1 | ||
| 29 | bis $16,$16,$9 | ||
| 30 | bis $17,$17,$10 | ||
| 31 | bis $18,$18,$11 | ||
| 32 | bis $31,$31,$13 | ||
| 33 | bis $31,2,$12 | ||
| 34 | bne $11,$9119 | ||
| 35 | lda $0,-1 | ||
| 36 | br $31,$9136 | ||
| 37 | .align 4 | ||
| 38 | $9119: | ||
| 39 | bis $11,$11,$16 | ||
| 40 | jsr $26,BN_num_bits_word | ||
| 41 | ldgp $29,0($26) | ||
| 42 | subq $0,64,$1 | ||
| 43 | beq $1,$9120 | ||
| 44 | bis $31,1,$1 | ||
| 45 | sll $1,$0,$1 | ||
| 46 | cmpule $9,$1,$1 | ||
| 47 | bne $1,$9120 | ||
| 48 | # lda $16,_IO_stderr_ | ||
| 49 | # lda $17,$C32 | ||
| 50 | # bis $0,$0,$18 | ||
| 51 | # jsr $26,fprintf | ||
| 52 | # ldgp $29,0($26) | ||
| 53 | jsr $26,abort | ||
| 54 | ldgp $29,0($26) | ||
| 55 | .align 4 | ||
| 56 | $9120: | ||
| 57 | bis $31,64,$3 | ||
| 58 | cmpult $9,$11,$2 | ||
| 59 | subq $3,$0,$1 | ||
| 60 | addl $1,$31,$0 | ||
| 61 | subq $9,$11,$1 | ||
| 62 | cmoveq $2,$1,$9 | ||
| 63 | beq $0,$9122 | ||
| 64 | zapnot $0,15,$2 | ||
| 65 | subq $3,$0,$1 | ||
| 66 | sll $11,$2,$11 | ||
| 67 | sll $9,$2,$3 | ||
| 68 | srl $10,$1,$1 | ||
| 69 | sll $10,$2,$10 | ||
| 70 | bis $3,$1,$9 | ||
| 71 | $9122: | ||
| 72 | srl $11,32,$5 | ||
| 73 | zapnot $11,15,$6 | ||
| 74 | lda $7,-1 | ||
| 75 | .align 5 | ||
| 76 | $9123: | ||
| 77 | srl $9,32,$1 | ||
| 78 | subq $1,$5,$1 | ||
| 79 | bne $1,$9126 | ||
| 80 | zapnot $7,15,$27 | ||
| 81 | br $31,$9127 | ||
| 82 | .align 4 | ||
| 83 | $9126: | ||
| 84 | bis $9,$9,$24 | ||
| 85 | bis $5,$5,$25 | ||
| 86 | divqu $24,$25,$27 | ||
| 87 | $9127: | ||
| 88 | srl $10,32,$4 | ||
| 89 | .align 5 | ||
| 90 | $9128: | ||
| 91 | mulq $27,$5,$1 | ||
| 92 | subq $9,$1,$3 | ||
| 93 | zapnot $3,240,$1 | ||
| 94 | bne $1,$9129 | ||
| 95 | mulq $6,$27,$2 | ||
| 96 | sll $3,32,$1 | ||
| 97 | addq $1,$4,$1 | ||
| 98 | cmpule $2,$1,$2 | ||
| 99 | bne $2,$9129 | ||
| 100 | subq $27,1,$27 | ||
| 101 | br $31,$9128 | ||
| 102 | .align 4 | ||
| 103 | $9129: | ||
| 104 | mulq $27,$6,$1 | ||
| 105 | mulq $27,$5,$4 | ||
| 106 | srl $1,32,$3 | ||
| 107 | sll $1,32,$1 | ||
| 108 | addq $4,$3,$4 | ||
| 109 | cmpult $10,$1,$2 | ||
| 110 | subq $10,$1,$10 | ||
| 111 | addq $2,$4,$2 | ||
| 112 | cmpult $9,$2,$1 | ||
| 113 | bis $2,$2,$4 | ||
| 114 | beq $1,$9134 | ||
| 115 | addq $9,$11,$9 | ||
| 116 | subq $27,1,$27 | ||
| 117 | $9134: | ||
| 118 | subl $12,1,$12 | ||
| 119 | subq $9,$4,$9 | ||
| 120 | beq $12,$9124 | ||
| 121 | sll $27,32,$13 | ||
| 122 | sll $9,32,$2 | ||
| 123 | srl $10,32,$1 | ||
| 124 | sll $10,32,$10 | ||
| 125 | bis $2,$1,$9 | ||
| 126 | br $31,$9123 | ||
| 127 | .align 4 | ||
| 128 | $9124: | ||
| 129 | bis $13,$27,$0 | ||
| 130 | $9136: | ||
| 131 | ldq $26,0($30) | ||
| 132 | ldq $9,8($30) | ||
| 133 | ldq $10,16($30) | ||
| 134 | ldq $11,24($30) | ||
| 135 | ldq $12,32($30) | ||
| 136 | ldq $13,40($30) | ||
| 137 | addq $30,48,$30 | ||
| 138 | ret $31,($26),1 | ||
| 139 | .end bn_div64 | ||
| 140 | EOF | ||
| 141 | &asm_add($data); | ||
| 142 | } | ||
| 143 | |||
| 144 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul.pl deleted file mode 100644 index b182bae452..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/mul.pl +++ /dev/null | |||
| @@ -1,116 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | $word=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &br(&label("finish")); | ||
| 23 | &blt($count,&label("finish")); | ||
| 24 | |||
| 25 | ($a0,$r0)=&NR(2); | ||
| 26 | &ld($a0,&QWPw(0,$ap)); | ||
| 27 | &ld($r0,&QWPw(0,$rp)); | ||
| 28 | |||
| 29 | $a=<<'EOF'; | ||
| 30 | ########################################################## | ||
| 31 | &set_label("loop"); | ||
| 32 | |||
| 33 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 34 | ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp)); | ||
| 35 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 36 | ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp)); | ||
| 37 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 38 | ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp)); | ||
| 39 | |||
| 40 | ($o0,$t0)=&NR(2); | ||
| 41 | &add($a0,$b0,$o0); | ||
| 42 | &cmpult($o0,$b0,$t0); | ||
| 43 | &add($o0,$cc,$o0); | ||
| 44 | &cmpult($o0,$cc,$cc); | ||
| 45 | &add($cc,$t0,$cc); &FR($t0); | ||
| 46 | |||
| 47 | ($t1,$o1)=&NR(2); | ||
| 48 | |||
| 49 | &add($a1,$b1,$o1); &FR($a1); | ||
| 50 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 51 | &add($o1,$cc,$o1); | ||
| 52 | &cmpult($o1,$cc,$cc); | ||
| 53 | &add($cc,$t1,$cc); &FR($t1); | ||
| 54 | |||
| 55 | ($t2,$o2)=&NR(2); | ||
| 56 | |||
| 57 | &add($a2,$b2,$o2); &FR($a2); | ||
| 58 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 59 | &add($o2,$cc,$o2); | ||
| 60 | &cmpult($o2,$cc,$cc); | ||
| 61 | &add($cc,$t2,$cc); &FR($t2); | ||
| 62 | |||
| 63 | ($t3,$o3)=&NR(2); | ||
| 64 | |||
| 65 | &add($a3,$b3,$o3); &FR($a3); | ||
| 66 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 67 | &add($o3,$cc,$o3); | ||
| 68 | &cmpult($o3,$cc,$cc); | ||
| 69 | &add($cc,$t3,$cc); &FR($t3); | ||
| 70 | |||
| 71 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 72 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 73 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 74 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 75 | |||
| 76 | &sub($count,4,$count); # count-=4 | ||
| 77 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 78 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 79 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 80 | |||
| 81 | &blt($count,&label("finish")); | ||
| 82 | &ld($a0,&QWPw(0,$ap)); | ||
| 83 | &ld($b0,&QWPw(0,$bp)); | ||
| 84 | &br(&label("loop")); | ||
| 85 | EOF | ||
| 86 | ################################################## | ||
| 87 | # Do the last 0..3 words | ||
| 88 | |||
| 89 | &set_label("last_loop"); | ||
| 90 | |||
| 91 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 92 | &mul($a0,$word,($l0)=&NR(1)); | ||
| 93 | &add($ap,$QWS,$ap); | ||
| 94 | &muh($a0,$word,($h0)=&NR(1)); &FR($a0); | ||
| 95 | &add($l0,$cc,$l0); | ||
| 96 | &add($rp,$QWS,$rp); | ||
| 97 | &sub($count,1,$count); | ||
| 98 | &cmpult($l0,$cc,$cc); | ||
| 99 | &st($l0,&QWPw(-1,$rp)); &FR($l0); | ||
| 100 | &add($h0,$cc,$cc); &FR($h0); | ||
| 101 | |||
| 102 | &bgt($count,&label("last_loop")); | ||
| 103 | &function_end_A($name); | ||
| 104 | |||
| 105 | ###################################################### | ||
| 106 | &set_label("finish"); | ||
| 107 | &add($count,4,$count); | ||
| 108 | &bgt($count,&label("last_loop")); | ||
| 109 | |||
| 110 | &set_label("end"); | ||
| 111 | &function_end($name); | ||
| 112 | |||
| 113 | &fin_pool; | ||
| 114 | } | ||
| 115 | |||
| 116 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_add.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_add.pl deleted file mode 100644 index e37f6315fb..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/mul_add.pl +++ /dev/null | |||
| @@ -1,120 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_add_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | $word=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &br(&label("finish")); | ||
| 23 | &blt($count,&label("finish")); | ||
| 24 | |||
| 25 | ($a0,$r0)=&NR(2); | ||
| 26 | &ld($a0,&QWPw(0,$ap)); | ||
| 27 | &ld($r0,&QWPw(0,$rp)); | ||
| 28 | |||
| 29 | $a=<<'EOF'; | ||
| 30 | ########################################################## | ||
| 31 | &set_label("loop"); | ||
| 32 | |||
| 33 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 34 | ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp)); | ||
| 35 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 36 | ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp)); | ||
| 37 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 38 | ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp)); | ||
| 39 | |||
| 40 | ($o0,$t0)=&NR(2); | ||
| 41 | &add($a0,$b0,$o0); | ||
| 42 | &cmpult($o0,$b0,$t0); | ||
| 43 | &add($o0,$cc,$o0); | ||
| 44 | &cmpult($o0,$cc,$cc); | ||
| 45 | &add($cc,$t0,$cc); &FR($t0); | ||
| 46 | |||
| 47 | ($t1,$o1)=&NR(2); | ||
| 48 | |||
| 49 | &add($a1,$b1,$o1); &FR($a1); | ||
| 50 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 51 | &add($o1,$cc,$o1); | ||
| 52 | &cmpult($o1,$cc,$cc); | ||
| 53 | &add($cc,$t1,$cc); &FR($t1); | ||
| 54 | |||
| 55 | ($t2,$o2)=&NR(2); | ||
| 56 | |||
| 57 | &add($a2,$b2,$o2); &FR($a2); | ||
| 58 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 59 | &add($o2,$cc,$o2); | ||
| 60 | &cmpult($o2,$cc,$cc); | ||
| 61 | &add($cc,$t2,$cc); &FR($t2); | ||
| 62 | |||
| 63 | ($t3,$o3)=&NR(2); | ||
| 64 | |||
| 65 | &add($a3,$b3,$o3); &FR($a3); | ||
| 66 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 67 | &add($o3,$cc,$o3); | ||
| 68 | &cmpult($o3,$cc,$cc); | ||
| 69 | &add($cc,$t3,$cc); &FR($t3); | ||
| 70 | |||
| 71 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 72 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 73 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 74 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 75 | |||
| 76 | &sub($count,4,$count); # count-=4 | ||
| 77 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 78 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 79 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 80 | |||
| 81 | &blt($count,&label("finish")); | ||
| 82 | &ld($a0,&QWPw(0,$ap)); | ||
| 83 | &ld($b0,&QWPw(0,$bp)); | ||
| 84 | &br(&label("loop")); | ||
| 85 | EOF | ||
| 86 | ################################################## | ||
| 87 | # Do the last 0..3 words | ||
| 88 | |||
| 89 | &set_label("last_loop"); | ||
| 90 | |||
| 91 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 92 | &ld(($r0)=&NR(1),&QWPw(0,$rp)); # get b | ||
| 93 | &mul($a0,$word,($l0)=&NR(1)); | ||
| 94 | &sub($count,1,$count); | ||
| 95 | &add($ap,$QWS,$ap); | ||
| 96 | &muh($a0,$word,($h0)=&NR(1)); &FR($a0); | ||
| 97 | &add($r0,$l0,$r0); | ||
| 98 | &add($rp,$QWS,$rp); | ||
| 99 | &cmpult($r0,$l0,($t0)=&NR(1)); &FR($l0); | ||
| 100 | &add($r0,$cc,$r0); | ||
| 101 | &add($h0,$t0,$h0); &FR($t0); | ||
| 102 | &cmpult($r0,$cc,$cc); | ||
| 103 | &st($r0,&QWPw(-1,$rp)); &FR($r0); | ||
| 104 | &add($h0,$cc,$cc); &FR($h0); | ||
| 105 | |||
| 106 | &bgt($count,&label("last_loop")); | ||
| 107 | &function_end_A($name); | ||
| 108 | |||
| 109 | ###################################################### | ||
| 110 | &set_label("finish"); | ||
| 111 | &add($count,4,$count); | ||
| 112 | &bgt($count,&label("last_loop")); | ||
| 113 | |||
| 114 | &set_label("end"); | ||
| 115 | &function_end($name); | ||
| 116 | |||
| 117 | &fin_pool; | ||
| 118 | } | ||
| 119 | |||
| 120 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.pl deleted file mode 100644 index 5efd201281..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.pl +++ /dev/null | |||
| @@ -1,213 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub mul_add_c | ||
| 5 | { | ||
| 6 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 7 | local($l1,$h1,$t1,$t2); | ||
| 8 | |||
| 9 | &mul($a,$b,($l1)=&NR(1)); | ||
| 10 | &muh($a,$b,($h1)=&NR(1)); | ||
| 11 | &add($c0,$l1,$c0); | ||
| 12 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 13 | &add($t1,$h1,$h1); &FR($t1); | ||
| 14 | &add($c1,$h1,$c1); | ||
| 15 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 16 | &add($c2,$t2,$c2); &FR($t2); | ||
| 17 | } | ||
| 18 | |||
| 19 | sub bn_mul_comba4 | ||
| 20 | { | ||
| 21 | local($name)=@_; | ||
| 22 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 23 | |||
| 24 | $cnt=1; | ||
| 25 | &init_pool(3); | ||
| 26 | |||
| 27 | $rp=&wparam(0); | ||
| 28 | $ap=&wparam(1); | ||
| 29 | $bp=&wparam(2); | ||
| 30 | |||
| 31 | &function_begin($name,""); | ||
| 32 | |||
| 33 | &comment(""); | ||
| 34 | |||
| 35 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 36 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 37 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 38 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 39 | &mul($a[0],$b[0],($r00)=&NR(1)); | ||
| 40 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 41 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 42 | &muh($a[0],$b[0],($r01)=&NR(1)); | ||
| 43 | &FR($ap); &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 44 | &FR($bp); &ld(($b[3])=&NR(1),&QWPw(3,$bp)); | ||
| 45 | &mul($a[0],$b[1],($r02)=&NR(1)); | ||
| 46 | |||
| 47 | ($R,$H1,$H2)=&NR(3); | ||
| 48 | |||
| 49 | &st($r00,&QWPw(0,$rp)); &FR($r00); | ||
| 50 | |||
| 51 | &mov("zero",$R); | ||
| 52 | &mul($a[1],$b[0],($r03)=&NR(1)); | ||
| 53 | |||
| 54 | &mov("zero",$H1); | ||
| 55 | &mov("zero",$H0); | ||
| 56 | &add($R,$r01,$R); | ||
| 57 | &muh($a[0],$b[1],($r04)=&NR(1)); | ||
| 58 | &cmpult($R,$r01,($t01)=&NR(1)); &FR($r01); | ||
| 59 | &add($R,$r02,$R); | ||
| 60 | &add($H1,$t01,$H1) &FR($t01); | ||
| 61 | &muh($a[1],$b[0],($r05)=&NR(1)); | ||
| 62 | &cmpult($R,$r02,($t02)=&NR(1)); &FR($r02); | ||
| 63 | &add($R,$r03,$R); | ||
| 64 | &add($H2,$t02,$H2) &FR($t02); | ||
| 65 | &mul($a[0],$b[2],($r06)=&NR(1)); | ||
| 66 | &cmpult($R,$r03,($t03)=&NR(1)); &FR($r03); | ||
| 67 | &add($H1,$t03,$H1) &FR($t03); | ||
| 68 | &st($R,&QWPw(1,$rp)); | ||
| 69 | &add($H1,$H2,$R); | ||
| 70 | |||
| 71 | &mov("zero",$H1); | ||
| 72 | &add($R,$r04,$R); | ||
| 73 | &mov("zero",$H2); | ||
| 74 | &mul($a[1],$b[1],($r07)=&NR(1)); | ||
| 75 | &cmpult($R,$r04,($t04)=&NR(1)); &FR($r04); | ||
| 76 | &add($R,$r05,$R); | ||
| 77 | &add($H1,$t04,$H1) &FR($t04); | ||
| 78 | &mul($a[2],$b[0],($r08)=&NR(1)); | ||
| 79 | &cmpult($R,$r05,($t05)=&NR(1)); &FR($r05); | ||
| 80 | &add($R,$r01,$R); | ||
| 81 | &add($H2,$t05,$H2) &FR($t05); | ||
| 82 | &muh($a[0],$b[2],($r09)=&NR(1)); | ||
| 83 | &cmpult($R,$r06,($t06)=&NR(1)); &FR($r06); | ||
| 84 | &add($R,$r07,$R); | ||
| 85 | &add($H1,$t06,$H1) &FR($t06); | ||
| 86 | &muh($a[1],$b[1],($r10)=&NR(1)); | ||
| 87 | &cmpult($R,$r07,($t07)=&NR(1)); &FR($r07); | ||
| 88 | &add($R,$r08,$R); | ||
| 89 | &add($H2,$t07,$H2) &FR($t07); | ||
| 90 | &muh($a[2],$b[0],($r11)=&NR(1)); | ||
| 91 | &cmpult($R,$r08,($t08)=&NR(1)); &FR($r08); | ||
| 92 | &add($H1,$t08,$H1) &FR($t08); | ||
| 93 | &st($R,&QWPw(2,$rp)); | ||
| 94 | &add($H1,$H2,$R); | ||
| 95 | |||
| 96 | &mov("zero",$H1); | ||
| 97 | &add($R,$r09,$R); | ||
| 98 | &mov("zero",$H2); | ||
| 99 | &mul($a[0],$b[3],($r12)=&NR(1)); | ||
| 100 | &cmpult($R,$r09,($t09)=&NR(1)); &FR($r09); | ||
| 101 | &add($R,$r10,$R); | ||
| 102 | &add($H1,$t09,$H1) &FR($t09); | ||
| 103 | &mul($a[1],$b[2],($r13)=&NR(1)); | ||
| 104 | &cmpult($R,$r10,($t10)=&NR(1)); &FR($r10); | ||
| 105 | &add($R,$r11,$R); | ||
| 106 | &add($H1,$t10,$H1) &FR($t10); | ||
| 107 | &mul($a[2],$b[1],($r14)=&NR(1)); | ||
| 108 | &cmpult($R,$r11,($t11)=&NR(1)); &FR($r11); | ||
| 109 | &add($R,$r12,$R); | ||
| 110 | &add($H1,$t11,$H1) &FR($t11); | ||
| 111 | &mul($a[3],$b[0],($r15)=&NR(1)); | ||
| 112 | &cmpult($R,$r12,($t12)=&NR(1)); &FR($r12); | ||
| 113 | &add($R,$r13,$R); | ||
| 114 | &add($H1,$t12,$H1) &FR($t12); | ||
| 115 | &muh($a[0],$b[3],($r16)=&NR(1)); | ||
| 116 | &cmpult($R,$r13,($t13)=&NR(1)); &FR($r13); | ||
| 117 | &add($R,$r14,$R); | ||
| 118 | &add($H1,$t13,$H1) &FR($t13); | ||
| 119 | &muh($a[1],$b[2],($r17)=&NR(1)); | ||
| 120 | &cmpult($R,$r14,($t14)=&NR(1)); &FR($r14); | ||
| 121 | &add($R,$r15,$R); | ||
| 122 | &add($H1,$t14,$H1) &FR($t14); | ||
| 123 | &muh($a[2],$b[1],($r18)=&NR(1)); | ||
| 124 | &cmpult($R,$r15,($t15)=&NR(1)); &FR($r15); | ||
| 125 | &add($H1,$t15,$H1) &FR($t15); | ||
| 126 | &st($R,&QWPw(3,$rp)); | ||
| 127 | &add($H1,$H2,$R); | ||
| 128 | |||
| 129 | &mov("zero",$H1); | ||
| 130 | &add($R,$r16,$R); | ||
| 131 | &mov("zero",$H2); | ||
| 132 | &muh($a[3],$b[0],($r19)=&NR(1)); | ||
| 133 | &cmpult($R,$r16,($t16)=&NR(1)); &FR($r16); | ||
| 134 | &add($R,$r17,$R); | ||
| 135 | &add($H1,$t16,$H1) &FR($t16); | ||
| 136 | &mul($a[1],$b[3],($r20)=&NR(1)); | ||
| 137 | &cmpult($R,$r17,($t17)=&NR(1)); &FR($r17); | ||
| 138 | &add($R,$r18,$R); | ||
| 139 | &add($H1,$t17,$H1) &FR($t17); | ||
| 140 | &mul($a[2],$b[2],($r21)=&NR(1)); | ||
| 141 | &cmpult($R,$r18,($t18)=&NR(1)); &FR($r18); | ||
| 142 | &add($R,$r19,$R); | ||
| 143 | &add($H1,$t18,$H1) &FR($t18); | ||
| 144 | &mul($a[3],$b[1],($r22)=&NR(1)); | ||
| 145 | &cmpult($R,$r19,($t19)=&NR(1)); &FR($r19); | ||
| 146 | &add($R,$r20,$R); | ||
| 147 | &add($H1,$t19,$H1) &FR($t19); | ||
| 148 | &muh($a[1],$b[3],($r23)=&NR(1)); | ||
| 149 | &cmpult($R,$r20,($t20)=&NR(1)); &FR($r20); | ||
| 150 | &add($R,$r21,$R); | ||
| 151 | &add($H1,$t20,$H1) &FR($t20); | ||
| 152 | &muh($a[2],$b[2],($r24)=&NR(1)); | ||
| 153 | &cmpult($R,$r21,($t21)=&NR(1)); &FR($r21); | ||
| 154 | &add($R,$r22,$R); | ||
| 155 | &add($H1,$t21,$H1) &FR($t21); | ||
| 156 | &muh($a[3],$b[1],($r25)=&NR(1)); | ||
| 157 | &cmpult($R,$r22,($t22)=&NR(1)); &FR($r22); | ||
| 158 | &add($H1,$t22,$H1) &FR($t22); | ||
| 159 | &st($R,&QWPw(4,$rp)); | ||
| 160 | &add($H1,$H2,$R); | ||
| 161 | |||
| 162 | &mov("zero",$H1); | ||
| 163 | &add($R,$r23,$R); | ||
| 164 | &mov("zero",$H2); | ||
| 165 | &mul($a[2],$b[3],($r26)=&NR(1)); | ||
| 166 | &cmpult($R,$r23,($t23)=&NR(1)); &FR($r23); | ||
| 167 | &add($R,$r24,$R); | ||
| 168 | &add($H1,$t23,$H1) &FR($t23); | ||
| 169 | &mul($a[3],$b[2],($r27)=&NR(1)); | ||
| 170 | &cmpult($R,$r24,($t24)=&NR(1)); &FR($r24); | ||
| 171 | &add($R,$r25,$R); | ||
| 172 | &add($H1,$t24,$H1) &FR($t24); | ||
| 173 | &muh($a[2],$b[3],($r28)=&NR(1)); | ||
| 174 | &cmpult($R,$r25,($t25)=&NR(1)); &FR($r25); | ||
| 175 | &add($R,$r26,$R); | ||
| 176 | &add($H1,$t25,$H1) &FR($t25); | ||
| 177 | &muh($a[3],$b[2],($r29)=&NR(1)); | ||
| 178 | &cmpult($R,$r26,($t26)=&NR(1)); &FR($r26); | ||
| 179 | &add($R,$r27,$R); | ||
| 180 | &add($H1,$t26,$H1) &FR($t26); | ||
| 181 | &mul($a[3],$b[3],($r30)=&NR(1)); | ||
| 182 | &cmpult($R,$r27,($t27)=&NR(1)); &FR($r27); | ||
| 183 | &add($H1,$t27,$H1) &FR($t27); | ||
| 184 | &st($R,&QWPw(5,$rp)); | ||
| 185 | &add($H1,$H2,$R); | ||
| 186 | |||
| 187 | &mov("zero",$H1); | ||
| 188 | &add($R,$r28,$R); | ||
| 189 | &mov("zero",$H2); | ||
| 190 | &muh($a[3],$b[3],($r31)=&NR(1)); | ||
| 191 | &cmpult($R,$r28,($t28)=&NR(1)); &FR($r28); | ||
| 192 | &add($R,$r29,$R); | ||
| 193 | &add($H1,$t28,$H1) &FR($t28); | ||
| 194 | ############ | ||
| 195 | &cmpult($R,$r29,($t29)=&NR(1)); &FR($r29); | ||
| 196 | &add($R,$r30,$R); | ||
| 197 | &add($H1,$t29,$H1) &FR($t29); | ||
| 198 | ############ | ||
| 199 | &cmpult($R,$r30,($t30)=&NR(1)); &FR($r30); | ||
| 200 | &add($H1,$t30,$H1) &FR($t30); | ||
| 201 | &st($R,&QWPw(6,$rp)); | ||
| 202 | &add($H1,$H2,$R); | ||
| 203 | |||
| 204 | &add($R,$r31,$R); &FR($r31); | ||
| 205 | &st($R,&QWPw(7,$rp)); | ||
| 206 | |||
| 207 | &FR($R,$H1,$H2); | ||
| 208 | &function_end($name); | ||
| 209 | |||
| 210 | &fin_pool; | ||
| 211 | } | ||
| 212 | |||
| 213 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.works.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.works.pl deleted file mode 100644 index 79d86dd25c..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.works.pl +++ /dev/null | |||
| @@ -1,98 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub mul_add_c | ||
| 5 | { | ||
| 6 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 7 | local($l1,$h1,$t1,$t2); | ||
| 8 | |||
| 9 | print STDERR "count=$cnt\n"; $cnt++; | ||
| 10 | &mul($a,$b,($l1)=&NR(1)); | ||
| 11 | &muh($a,$b,($h1)=&NR(1)); | ||
| 12 | &add($c0,$l1,$c0); | ||
| 13 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 14 | &add($t1,$h1,$h1); &FR($t1); | ||
| 15 | &add($c1,$h1,$c1); | ||
| 16 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 17 | &add($c2,$t2,$c2); &FR($t2); | ||
| 18 | } | ||
| 19 | |||
| 20 | sub bn_mul_comba4 | ||
| 21 | { | ||
| 22 | local($name)=@_; | ||
| 23 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 24 | |||
| 25 | $cnt=1; | ||
| 26 | &init_pool(3); | ||
| 27 | |||
| 28 | $rp=&wparam(0); | ||
| 29 | $ap=&wparam(1); | ||
| 30 | $bp=&wparam(2); | ||
| 31 | |||
| 32 | &function_begin($name,""); | ||
| 33 | |||
| 34 | &comment(""); | ||
| 35 | |||
| 36 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 37 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 38 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 39 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 40 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 41 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 42 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap); | ||
| 43 | &ld(($b[3])=&NR(1),&QWPw(3,$bp)); &FR($bp); | ||
| 44 | |||
| 45 | ($c0,$c1,$c2)=&NR(3); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | &mul($a[0],$b[0],$c0); | ||
| 48 | &muh($a[0],$b[0],$c1); | ||
| 49 | &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 50 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 51 | &mov("zero",$c2); | ||
| 52 | |||
| 53 | &mul_add_c($a[0],$b[1],$c0,$c1,$c2); | ||
| 54 | &mul_add_c($a[1],$b[0],$c0,$c1,$c2); | ||
| 55 | &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 56 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 57 | &mov("zero",$c2); | ||
| 58 | |||
| 59 | &mul_add_c($a[1],$b[1],$c0,$c1,$c2); | ||
| 60 | &mul_add_c($a[0],$b[2],$c0,$c1,$c2); | ||
| 61 | &mul_add_c($a[2],$b[0],$c0,$c1,$c2); | ||
| 62 | &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 63 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 64 | &mov("zero",$c2); | ||
| 65 | |||
| 66 | &mul_add_c($a[0],$b[3],$c0,$c1,$c2); &FR($a[0]); | ||
| 67 | &mul_add_c($a[1],$b[2],$c0,$c1,$c2); | ||
| 68 | &mul_add_c($a[2],$b[1],$c0,$c1,$c2); | ||
| 69 | &mul_add_c($a[3],$b[0],$c0,$c1,$c2); &FR($b[0]); | ||
| 70 | &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 71 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 72 | &mov("zero",$c2); | ||
| 73 | |||
| 74 | &mul_add_c($a[1],$b[3],$c0,$c1,$c2); &FR($a[1]); | ||
| 75 | &mul_add_c($a[2],$b[2],$c0,$c1,$c2); | ||
| 76 | &mul_add_c($a[3],$b[1],$c0,$c1,$c2); &FR($b[1]); | ||
| 77 | &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 78 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 79 | &mov("zero",$c2); | ||
| 80 | |||
| 81 | &mul_add_c($a[2],$b[3],$c0,$c1,$c2); &FR($a[2]); | ||
| 82 | &mul_add_c($a[3],$b[2],$c0,$c1,$c2); &FR($b[2]); | ||
| 83 | &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 84 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 85 | &mov("zero",$c2); | ||
| 86 | |||
| 87 | &mul_add_c($a[3],$b[3],$c0,$c1,$c2); &FR($a[3],$b[3]); | ||
| 88 | &st($c0,&QWPw(6,$rp)); | ||
| 89 | &st($c1,&QWPw(7,$rp)); | ||
| 90 | |||
| 91 | &FR($c0,$c1,$c2); | ||
| 92 | |||
| 93 | &function_end($name); | ||
| 94 | |||
| 95 | &fin_pool; | ||
| 96 | } | ||
| 97 | |||
| 98 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_c8.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_c8.pl deleted file mode 100644 index 525ca7494b..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/mul_c8.pl +++ /dev/null | |||
| @@ -1,177 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_comba8 | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 8 | |||
| 9 | $cnt=1; | ||
| 10 | &init_pool(3); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | |||
| 16 | &function_begin($name,""); | ||
| 17 | |||
| 18 | &comment(""); | ||
| 19 | |||
| 20 | &stack_push(2); | ||
| 21 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 22 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 23 | &st($reg_s0,&swtmp(0)); &FR($reg_s0); | ||
| 24 | &st($reg_s1,&swtmp(1)); &FR($reg_s1); | ||
| 25 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 26 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 27 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 28 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 29 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 30 | &ld(($b[3])=&NR(1),&QWPw(3,$bp)); | ||
| 31 | &ld(($a[4])=&NR(1),&QWPw(1,$ap)); | ||
| 32 | &ld(($b[4])=&NR(1),&QWPw(1,$bp)); | ||
| 33 | &ld(($a[5])=&NR(1),&QWPw(1,$ap)); | ||
| 34 | &ld(($b[5])=&NR(1),&QWPw(1,$bp)); | ||
| 35 | &ld(($a[6])=&NR(1),&QWPw(1,$ap)); | ||
| 36 | &ld(($b[6])=&NR(1),&QWPw(1,$bp)); | ||
| 37 | &ld(($a[7])=&NR(1),&QWPw(1,$ap)); &FR($ap); | ||
| 38 | &ld(($b[7])=&NR(1),&QWPw(1,$bp)); &FR($bp); | ||
| 39 | |||
| 40 | ($c0,$c1,$c2)=&NR(3); | ||
| 41 | &mov("zero",$c2); | ||
| 42 | &mul($a[0],$b[0],$c0); | ||
| 43 | &muh($a[0],$b[0],$c1); | ||
| 44 | &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 45 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | |||
| 48 | &mul_add_c($a[0],$b[1],$c0,$c1,$c2); | ||
| 49 | &mul_add_c($a[1],$b[0],$c0,$c1,$c2); | ||
| 50 | &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 51 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 52 | &mov("zero",$c2); | ||
| 53 | |||
| 54 | &mul_add_c($a[0],$b[2],$c0,$c1,$c2); | ||
| 55 | &mul_add_c($a[1],$b[1],$c0,$c1,$c2); | ||
| 56 | &mul_add_c($a[2],$b[0],$c0,$c1,$c2); | ||
| 57 | &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 58 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 59 | &mov("zero",$c2); | ||
| 60 | |||
| 61 | &mul_add_c($a[0],$b[3],$c0,$c1,$c2); | ||
| 62 | &mul_add_c($a[1],$b[2],$c0,$c1,$c2); | ||
| 63 | &mul_add_c($a[2],$b[1],$c0,$c1,$c2); | ||
| 64 | &mul_add_c($a[3],$b[0],$c0,$c1,$c2); | ||
| 65 | &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 66 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 67 | &mov("zero",$c2); | ||
| 68 | |||
| 69 | &mul_add_c($a[0],$b[4],$c0,$c1,$c2); | ||
| 70 | &mul_add_c($a[1],$b[3],$c0,$c1,$c2); | ||
| 71 | &mul_add_c($a[2],$b[2],$c0,$c1,$c2); | ||
| 72 | &mul_add_c($a[3],$b[1],$c0,$c1,$c2); | ||
| 73 | &mul_add_c($a[4],$b[0],$c0,$c1,$c2); | ||
| 74 | &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 75 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 76 | &mov("zero",$c2); | ||
| 77 | |||
| 78 | &mul_add_c($a[0],$b[5],$c0,$c1,$c2); | ||
| 79 | &mul_add_c($a[1],$b[4],$c0,$c1,$c2); | ||
| 80 | &mul_add_c($a[2],$b[3],$c0,$c1,$c2); | ||
| 81 | &mul_add_c($a[3],$b[2],$c0,$c1,$c2); | ||
| 82 | &mul_add_c($a[4],$b[1],$c0,$c1,$c2); | ||
| 83 | &mul_add_c($a[5],$b[0],$c0,$c1,$c2); | ||
| 84 | &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 85 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 86 | &mov("zero",$c2); | ||
| 87 | |||
| 88 | &mul_add_c($a[0],$b[6],$c0,$c1,$c2); | ||
| 89 | &mul_add_c($a[1],$b[5],$c0,$c1,$c2); | ||
| 90 | &mul_add_c($a[2],$b[4],$c0,$c1,$c2); | ||
| 91 | &mul_add_c($a[3],$b[3],$c0,$c1,$c2); | ||
| 92 | &mul_add_c($a[4],$b[2],$c0,$c1,$c2); | ||
| 93 | &mul_add_c($a[5],$b[1],$c0,$c1,$c2); | ||
| 94 | &mul_add_c($a[6],$b[0],$c0,$c1,$c2); | ||
| 95 | &st($c0,&QWPw(6,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 96 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 97 | &mov("zero",$c2); | ||
| 98 | |||
| 99 | &mul_add_c($a[0],$b[7],$c0,$c1,$c2); &FR($a[0]); | ||
| 100 | &mul_add_c($a[1],$b[6],$c0,$c1,$c2); | ||
| 101 | &mul_add_c($a[2],$b[5],$c0,$c1,$c2); | ||
| 102 | &mul_add_c($a[3],$b[4],$c0,$c1,$c2); | ||
| 103 | &mul_add_c($a[4],$b[3],$c0,$c1,$c2); | ||
| 104 | &mul_add_c($a[5],$b[2],$c0,$c1,$c2); | ||
| 105 | &mul_add_c($a[6],$b[1],$c0,$c1,$c2); | ||
| 106 | &mul_add_c($a[7],$b[0],$c0,$c1,$c2); &FR($b[0]); | ||
| 107 | &st($c0,&QWPw(7,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 108 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 109 | &mov("zero",$c2); | ||
| 110 | |||
| 111 | &mul_add_c($a[1],$b[7],$c0,$c1,$c2); &FR($a[1]); | ||
| 112 | &mul_add_c($a[2],$b[6],$c0,$c1,$c2); | ||
| 113 | &mul_add_c($a[3],$b[5],$c0,$c1,$c2); | ||
| 114 | &mul_add_c($a[4],$b[4],$c0,$c1,$c2); | ||
| 115 | &mul_add_c($a[5],$b[3],$c0,$c1,$c2); | ||
| 116 | &mul_add_c($a[6],$b[2],$c0,$c1,$c2); | ||
| 117 | &mul_add_c($a[7],$b[1],$c0,$c1,$c2); &FR($b[1]); | ||
| 118 | &st($c0,&QWPw(8,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 119 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 120 | &mov("zero",$c2); | ||
| 121 | |||
| 122 | &mul_add_c($a[2],$b[7],$c0,$c1,$c2); &FR($a[2]); | ||
| 123 | &mul_add_c($a[3],$b[6],$c0,$c1,$c2); | ||
| 124 | &mul_add_c($a[4],$b[5],$c0,$c1,$c2); | ||
| 125 | &mul_add_c($a[5],$b[4],$c0,$c1,$c2); | ||
| 126 | &mul_add_c($a[6],$b[3],$c0,$c1,$c2); | ||
| 127 | &mul_add_c($a[7],$b[2],$c0,$c1,$c2); &FR($b[2]); | ||
| 128 | &st($c0,&QWPw(9,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 129 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 130 | &mov("zero",$c2); | ||
| 131 | |||
| 132 | &mul_add_c($a[3],$b[7],$c0,$c1,$c2); &FR($a[3]); | ||
| 133 | &mul_add_c($a[4],$b[6],$c0,$c1,$c2); | ||
| 134 | &mul_add_c($a[5],$b[5],$c0,$c1,$c2); | ||
| 135 | &mul_add_c($a[6],$b[4],$c0,$c1,$c2); | ||
| 136 | &mul_add_c($a[7],$b[3],$c0,$c1,$c2); &FR($b[3]); | ||
| 137 | &st($c0,&QWPw(10,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 138 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 139 | &mov("zero",$c2); | ||
| 140 | |||
| 141 | &mul_add_c($a[4],$b[7],$c0,$c1,$c2); &FR($a[4]); | ||
| 142 | &mul_add_c($a[5],$b[6],$c0,$c1,$c2); | ||
| 143 | &mul_add_c($a[6],$b[5],$c0,$c1,$c2); | ||
| 144 | &mul_add_c($a[7],$b[4],$c0,$c1,$c2); &FR($b[4]); | ||
| 145 | &st($c0,&QWPw(11,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 146 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 147 | &mov("zero",$c2); | ||
| 148 | |||
| 149 | &mul_add_c($a[5],$b[7],$c0,$c1,$c2); &FR($a[5]); | ||
| 150 | &mul_add_c($a[6],$b[6],$c0,$c1,$c2); | ||
| 151 | &mul_add_c($a[7],$b[5],$c0,$c1,$c2); &FR($b[5]); | ||
| 152 | &st($c0,&QWPw(12,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 153 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 154 | &mov("zero",$c2); | ||
| 155 | |||
| 156 | &mul_add_c($a[6],$b[7],$c0,$c1,$c2); &FR($a[6]); | ||
| 157 | &mul_add_c($a[7],$b[6],$c0,$c1,$c2); &FR($b[6]); | ||
| 158 | &st($c0,&QWPw(13,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 159 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 160 | &mov("zero",$c2); | ||
| 161 | |||
| 162 | &mul_add_c($a[7],$b[7],$c0,$c1,$c2); &FR($a[7],$b[7]); | ||
| 163 | &st($c0,&QWPw(14,$rp)); | ||
| 164 | &st($c1,&QWPw(15,$rp)); | ||
| 165 | |||
| 166 | &FR($c0,$c1,$c2); | ||
| 167 | |||
| 168 | &ld($reg_s0,&swtmp(0)); | ||
| 169 | &ld($reg_s1,&swtmp(1)); | ||
| 170 | &stack_pop(2); | ||
| 171 | |||
| 172 | &function_end($name); | ||
| 173 | |||
| 174 | &fin_pool; | ||
| 175 | } | ||
| 176 | |||
| 177 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sqr.pl b/src/lib/libcrypto/bn/asm/alpha.works/sqr.pl deleted file mode 100644 index a55b696906..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/sqr.pl +++ /dev/null | |||
| @@ -1,113 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sqr_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(3); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | |||
| 16 | &function_begin($name,""); | ||
| 17 | |||
| 18 | &comment(""); | ||
| 19 | &sub($count,4,$count); | ||
| 20 | &mov("zero",$cc); | ||
| 21 | &br(&label("finish")); | ||
| 22 | &blt($count,&label("finish")); | ||
| 23 | |||
| 24 | ($a0,$r0)=&NR(2); | ||
| 25 | &ld($a0,&QWPw(0,$ap)); | ||
| 26 | &ld($r0,&QWPw(0,$rp)); | ||
| 27 | |||
| 28 | $a=<<'EOF'; | ||
| 29 | ########################################################## | ||
| 30 | &set_label("loop"); | ||
| 31 | |||
| 32 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 33 | ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp)); | ||
| 34 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 35 | ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp)); | ||
| 36 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 37 | ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp)); | ||
| 38 | |||
| 39 | ($o0,$t0)=&NR(2); | ||
| 40 | &add($a0,$b0,$o0); | ||
| 41 | &cmpult($o0,$b0,$t0); | ||
| 42 | &add($o0,$cc,$o0); | ||
| 43 | &cmpult($o0,$cc,$cc); | ||
| 44 | &add($cc,$t0,$cc); &FR($t0); | ||
| 45 | |||
| 46 | ($t1,$o1)=&NR(2); | ||
| 47 | |||
| 48 | &add($a1,$b1,$o1); &FR($a1); | ||
| 49 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 50 | &add($o1,$cc,$o1); | ||
| 51 | &cmpult($o1,$cc,$cc); | ||
| 52 | &add($cc,$t1,$cc); &FR($t1); | ||
| 53 | |||
| 54 | ($t2,$o2)=&NR(2); | ||
| 55 | |||
| 56 | &add($a2,$b2,$o2); &FR($a2); | ||
| 57 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 58 | &add($o2,$cc,$o2); | ||
| 59 | &cmpult($o2,$cc,$cc); | ||
| 60 | &add($cc,$t2,$cc); &FR($t2); | ||
| 61 | |||
| 62 | ($t3,$o3)=&NR(2); | ||
| 63 | |||
| 64 | &add($a3,$b3,$o3); &FR($a3); | ||
| 65 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 66 | &add($o3,$cc,$o3); | ||
| 67 | &cmpult($o3,$cc,$cc); | ||
| 68 | &add($cc,$t3,$cc); &FR($t3); | ||
| 69 | |||
| 70 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 71 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 72 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 73 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 74 | |||
| 75 | &sub($count,4,$count); # count-=4 | ||
| 76 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 77 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 78 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 79 | |||
| 80 | &blt($count,&label("finish")); | ||
| 81 | &ld($a0,&QWPw(0,$ap)); | ||
| 82 | &ld($b0,&QWPw(0,$bp)); | ||
| 83 | &br(&label("loop")); | ||
| 84 | EOF | ||
| 85 | ################################################## | ||
| 86 | # Do the last 0..3 words | ||
| 87 | |||
| 88 | &set_label("last_loop"); | ||
| 89 | |||
| 90 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 91 | &mul($a0,$a0,($l0)=&NR(1)); | ||
| 92 | &add($ap,$QWS,$ap); | ||
| 93 | &add($rp,2*$QWS,$rp); | ||
| 94 | &sub($count,1,$count); | ||
| 95 | &muh($a0,$a0,($h0)=&NR(1)); &FR($a0); | ||
| 96 | &st($l0,&QWPw(-2,$rp)); &FR($l0); | ||
| 97 | &st($h0,&QWPw(-1,$rp)); &FR($h0); | ||
| 98 | |||
| 99 | &bgt($count,&label("last_loop")); | ||
| 100 | &function_end_A($name); | ||
| 101 | |||
| 102 | ###################################################### | ||
| 103 | &set_label("finish"); | ||
| 104 | &add($count,4,$count); | ||
| 105 | &bgt($count,&label("last_loop")); | ||
| 106 | |||
| 107 | &set_label("end"); | ||
| 108 | &function_end($name); | ||
| 109 | |||
| 110 | &fin_pool; | ||
| 111 | } | ||
| 112 | |||
| 113 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sqr_c4.pl b/src/lib/libcrypto/bn/asm/alpha.works/sqr_c4.pl deleted file mode 100644 index bf33f5b503..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/sqr_c4.pl +++ /dev/null | |||
| @@ -1,109 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub sqr_add_c | ||
| 5 | { | ||
| 6 | local($a,$c0,$c1,$c2)=@_; | ||
| 7 | local($l1,$h1,$t1,$t2); | ||
| 8 | |||
| 9 | &mul($a,$a,($l1)=&NR(1)); | ||
| 10 | &muh($a,$a,($h1)=&NR(1)); | ||
| 11 | &add($c0,$l1,$c0); | ||
| 12 | &add($c1,$h1,$c1); | ||
| 13 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 14 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 15 | &add($c1,$t1,$c1); &FR($t1); | ||
| 16 | &add($c2,$t2,$c2); &FR($t2); | ||
| 17 | } | ||
| 18 | |||
| 19 | sub sqr_add_c2 | ||
| 20 | { | ||
| 21 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 22 | local($l1,$h1,$t1,$t2); | ||
| 23 | |||
| 24 | &mul($a,$b,($l1)=&NR(1)); | ||
| 25 | &muh($a,$b,($h1)=&NR(1)); | ||
| 26 | &cmplt($l1,"zero",($lc1)=&NR(1)); | ||
| 27 | &cmplt($h1,"zero",($hc1)=&NR(1)); | ||
| 28 | &add($l1,$l1,$l1); | ||
| 29 | &add($h1,$h1,$h1); | ||
| 30 | &add($h1,$lc1,$h1); &FR($lc1); | ||
| 31 | &add($c2,$hc1,$c2); &FR($hc1); | ||
| 32 | |||
| 33 | &add($c0,$l1,$c0); | ||
| 34 | &add($c1,$h1,$c1); | ||
| 35 | &cmpult($c0,$l1,($lc1)=&NR(1)); &FR($l1); | ||
| 36 | &cmpult($c1,$h1,($hc1)=&NR(1)); &FR($h1); | ||
| 37 | |||
| 38 | &add($c1,$lc1,$c1); &FR($lc1); | ||
| 39 | &add($c2,$hc1,$c2); &FR($hc1); | ||
| 40 | } | ||
| 41 | |||
| 42 | |||
| 43 | sub bn_sqr_comba4 | ||
| 44 | { | ||
| 45 | local($name)=@_; | ||
| 46 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 47 | |||
| 48 | $cnt=1; | ||
| 49 | &init_pool(2); | ||
| 50 | |||
| 51 | $rp=&wparam(0); | ||
| 52 | $ap=&wparam(1); | ||
| 53 | |||
| 54 | &function_begin($name,""); | ||
| 55 | |||
| 56 | &comment(""); | ||
| 57 | |||
| 58 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 59 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 60 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 61 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap); | ||
| 62 | |||
| 63 | ($c0,$c1,$c2)=&NR(3); | ||
| 64 | |||
| 65 | &mov("zero",$c2); | ||
| 66 | &mul($a[0],$a[0],$c0); | ||
| 67 | &muh($a[0],$a[0],$c1); | ||
| 68 | &st($c0,&QWPw(0,$rp)); | ||
| 69 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 70 | &mov("zero",$c2); | ||
| 71 | |||
| 72 | &sqr_add_c2($a[0],$a[1],$c0,$c1,$c2); | ||
| 73 | &st($c0,&QWPw(1,$rp)); | ||
| 74 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 75 | &mov("zero",$c2); | ||
| 76 | |||
| 77 | &sqr_add_c($a[1],$c0,$c1,$c2); | ||
| 78 | &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2); | ||
| 79 | &st($c0,&QWPw(2,$rp)); | ||
| 80 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 81 | &mov("zero",$c2); | ||
| 82 | |||
| 83 | &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2); | ||
| 84 | &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2); | ||
| 85 | &st($c0,&QWPw(3,$rp)); | ||
| 86 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 87 | &mov("zero",$c2); | ||
| 88 | |||
| 89 | &sqr_add_c($a[2],$c0,$c1,$c2); | ||
| 90 | &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2); | ||
| 91 | &st($c0,&QWPw(4,$rp)); | ||
| 92 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 93 | &mov("zero",$c2); | ||
| 94 | |||
| 95 | &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2); | ||
| 96 | &st($c0,&QWPw(5,$rp)); | ||
| 97 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 98 | &mov("zero",$c2); | ||
| 99 | |||
| 100 | &sqr_add_c($a[3],$c0,$c1,$c2); | ||
| 101 | &st($c0,&QWPw(6,$rp)); | ||
| 102 | &st($c1,&QWPw(7,$rp)); | ||
| 103 | |||
| 104 | &function_end($name); | ||
| 105 | |||
| 106 | &fin_pool; | ||
| 107 | } | ||
| 108 | |||
| 109 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sqr_c8.pl b/src/lib/libcrypto/bn/asm/alpha.works/sqr_c8.pl deleted file mode 100644 index b4afe085f1..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/sqr_c8.pl +++ /dev/null | |||
| @@ -1,132 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sqr_comba8 | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 8 | |||
| 9 | $cnt=1; | ||
| 10 | &init_pool(2); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | |||
| 15 | &function_begin($name,""); | ||
| 16 | |||
| 17 | &comment(""); | ||
| 18 | |||
| 19 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 20 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 21 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 22 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 23 | &ld(($a[4])=&NR(1),&QWPw(4,$ap)); | ||
| 24 | &ld(($a[5])=&NR(1),&QWPw(5,$ap)); | ||
| 25 | &ld(($a[6])=&NR(1),&QWPw(6,$ap)); | ||
| 26 | &ld(($a[7])=&NR(1),&QWPw(7,$ap)); &FR($ap); | ||
| 27 | |||
| 28 | ($c0,$c1,$c2)=&NR(3); | ||
| 29 | |||
| 30 | &mov("zero",$c2); | ||
| 31 | &mul($a[0],$a[0],$c0); | ||
| 32 | &muh($a[0],$a[0],$c1); | ||
| 33 | &st($c0,&QWPw(0,$rp)); | ||
| 34 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 35 | &mov("zero",$c2); | ||
| 36 | |||
| 37 | &sqr_add_c2($a[1],$a[0],$c0,$c1,$c2); | ||
| 38 | &st($c0,&QWPw(1,$rp)); | ||
| 39 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 40 | &mov("zero",$c2); | ||
| 41 | |||
| 42 | &sqr_add_c($a[1],$c0,$c1,$c2); | ||
| 43 | &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2); | ||
| 44 | &st($c0,&QWPw(2,$rp)); | ||
| 45 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | |||
| 48 | &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2); | ||
| 49 | &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2); | ||
| 50 | &st($c0,&QWPw(3,$rp)); | ||
| 51 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 52 | &mov("zero",$c2); | ||
| 53 | |||
| 54 | &sqr_add_c($a[2],$c0,$c1,$c2); | ||
| 55 | &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2); | ||
| 56 | &sqr_add_c2($a[4],$a[0],$c0,$c1,$c2); | ||
| 57 | &st($c0,&QWPw(4,$rp)); | ||
| 58 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 59 | &mov("zero",$c2); | ||
| 60 | |||
| 61 | &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2); | ||
| 62 | &sqr_add_c2($a[4],$a[1],$c0,$c1,$c2); | ||
| 63 | &sqr_add_c2($a[5],$a[0],$c0,$c1,$c2); | ||
| 64 | &st($c0,&QWPw(5,$rp)); | ||
| 65 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 66 | &mov("zero",$c2); | ||
| 67 | |||
| 68 | &sqr_add_c($a[3],$c0,$c1,$c2); | ||
| 69 | &sqr_add_c2($a[4],$a[2],$c0,$c1,$c2); | ||
| 70 | &sqr_add_c2($a[5],$a[1],$c0,$c1,$c2); | ||
| 71 | &sqr_add_c2($a[6],$a[0],$c0,$c1,$c2); | ||
| 72 | &st($c0,&QWPw(6,$rp)); | ||
| 73 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 74 | &mov("zero",$c2); | ||
| 75 | |||
| 76 | &sqr_add_c2($a[4],$a[3],$c0,$c1,$c2); | ||
| 77 | &sqr_add_c2($a[5],$a[2],$c0,$c1,$c2); | ||
| 78 | &sqr_add_c2($a[6],$a[1],$c0,$c1,$c2); | ||
| 79 | &sqr_add_c2($a[7],$a[0],$c0,$c1,$c2); | ||
| 80 | &st($c0,&QWPw(7,$rp)); | ||
| 81 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 82 | &mov("zero",$c2); | ||
| 83 | |||
| 84 | &sqr_add_c($a[4],$c0,$c1,$c2); | ||
| 85 | &sqr_add_c2($a[5],$a[3],$c0,$c1,$c2); | ||
| 86 | &sqr_add_c2($a[6],$a[2],$c0,$c1,$c2); | ||
| 87 | &sqr_add_c2($a[7],$a[1],$c0,$c1,$c2); | ||
| 88 | &st($c0,&QWPw(8,$rp)); | ||
| 89 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 90 | &mov("zero",$c2); | ||
| 91 | |||
| 92 | &sqr_add_c2($a[5],$a[4],$c0,$c1,$c2); | ||
| 93 | &sqr_add_c2($a[6],$a[3],$c0,$c1,$c2); | ||
| 94 | &sqr_add_c2($a[7],$a[2],$c0,$c1,$c2); | ||
| 95 | &st($c0,&QWPw(9,$rp)); | ||
| 96 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 97 | &mov("zero",$c2); | ||
| 98 | |||
| 99 | &sqr_add_c($a[5],$c0,$c1,$c2); | ||
| 100 | &sqr_add_c2($a[6],$a[4],$c0,$c1,$c2); | ||
| 101 | &sqr_add_c2($a[7],$a[3],$c0,$c1,$c2); | ||
| 102 | &st($c0,&QWPw(10,$rp)); | ||
| 103 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 104 | &mov("zero",$c2); | ||
| 105 | |||
| 106 | &sqr_add_c2($a[6],$a[5],$c0,$c1,$c2); | ||
| 107 | &sqr_add_c2($a[7],$a[4],$c0,$c1,$c2); | ||
| 108 | &st($c0,&QWPw(11,$rp)); | ||
| 109 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 110 | &mov("zero",$c2); | ||
| 111 | |||
| 112 | &sqr_add_c($a[6],$c0,$c1,$c2); | ||
| 113 | &sqr_add_c2($a[7],$a[5],$c0,$c1,$c2); | ||
| 114 | &st($c0,&QWPw(12,$rp)); | ||
| 115 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 116 | &mov("zero",$c2); | ||
| 117 | |||
| 118 | &sqr_add_c2($a[7],$a[6],$c0,$c1,$c2); | ||
| 119 | &st($c0,&QWPw(13,$rp)); | ||
| 120 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 121 | &mov("zero",$c2); | ||
| 122 | |||
| 123 | &sqr_add_c($a[7],$c0,$c1,$c2); | ||
| 124 | &st($c0,&QWPw(14,$rp)); | ||
| 125 | &st($c1,&QWPw(15,$rp)); | ||
| 126 | |||
| 127 | &function_end($name); | ||
| 128 | |||
| 129 | &fin_pool; | ||
| 130 | } | ||
| 131 | |||
| 132 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sub.pl b/src/lib/libcrypto/bn/asm/alpha.works/sub.pl deleted file mode 100644 index d998da5c21..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha.works/sub.pl +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sub_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | $count=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &blt($count,&label("finish")); | ||
| 23 | |||
| 24 | ($a0,$b0)=&NR(2); | ||
| 25 | &ld($a0,&QWPw(0,$ap)); | ||
| 26 | &ld($b0,&QWPw(0,$bp)); | ||
| 27 | |||
| 28 | ########################################################## | ||
| 29 | &set_label("loop"); | ||
| 30 | |||
| 31 | ($a1,$tmp,$b1,$a2,$b2,$a3,$b3,$o0)=&NR(8); | ||
| 32 | &ld($a1,&QWPw(1,$ap)); | ||
| 33 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 34 | &ld($b1,&QWPw(1,$bp)); | ||
| 35 | &sub($a0,$b0,$a0); # do the subtract | ||
| 36 | &ld($a2,&QWPw(2,$ap)); | ||
| 37 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 38 | &ld($b2,&QWPw(2,$bp)); | ||
| 39 | &sub($a0,$cc,$o0); # will we borrow? | ||
| 40 | &ld($a3,&QWPw(3,$ap)); | ||
| 41 | &add($b0,$tmp,$cc); ($t1,$o1)=&NR(2); &FR($tmp); | ||
| 42 | |||
| 43 | &cmpult($a1,$b1,$t1); # will we borrow? | ||
| 44 | &sub($a1,$b1,$a1); # do the subtract | ||
| 45 | &ld($b3,&QWPw(3,$bp)); | ||
| 46 | &cmpult($a1,$cc,$b1); # will we borrow? | ||
| 47 | &sub($a1,$cc,$o1); # will we borrow? | ||
| 48 | &add($b1,$t1,$cc); ($tmp,$o2)=&NR(2); &FR($t1,$a1,$b1); | ||
| 49 | |||
| 50 | &cmpult($a2,$b2,$tmp); # will we borrow? | ||
| 51 | &sub($a2,$b2,$a2); # do the subtract | ||
| 52 | &st($o0,&QWPw(0,$rp)); &FR($o0); # save | ||
| 53 | &cmpult($a2,$cc,$b2); # will we borrow? | ||
| 54 | &sub($a2,$cc,$o2); # will we borrow? | ||
| 55 | &add($b2,$tmp,$cc); ($t3,$o3)=&NR(2); &FR($tmp,$a2,$b2); | ||
| 56 | |||
| 57 | &cmpult($a3,$b3,$t3); # will we borrow? | ||
| 58 | &sub($a3,$b3,$a3); # do the subtract | ||
| 59 | &st($o1,&QWPw(1,$rp)); &FR($o1); | ||
| 60 | &cmpult($a3,$cc,$b3); # will we borrow? | ||
| 61 | &sub($a3,$cc,$o3); # will we borrow? | ||
| 62 | &add($b3,$t3,$cc); &FR($t3,$a3,$b3); | ||
| 63 | |||
| 64 | &st($o2,&QWPw(2,$rp)); &FR($o2); | ||
| 65 | &sub($count,4,$count); # count-=4 | ||
| 66 | &st($o3,&QWPw(3,$rp)); &FR($o3); | ||
| 67 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 68 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 69 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 70 | |||
| 71 | &blt($count,&label("finish")); | ||
| 72 | &ld($a0,&QWPw(0,$ap)); | ||
| 73 | &ld($b0,&QWPw(0,$bp)); | ||
| 74 | &br(&label("loop")); | ||
| 75 | ################################################## | ||
| 76 | # Do the last 0..3 words | ||
| 77 | |||
| 78 | &set_label("last_loop"); | ||
| 79 | |||
| 80 | &ld($a0,&QWPw(0,$ap)); # get a | ||
| 81 | &ld($b0,&QWPw(0,$bp)); # get b | ||
| 82 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 83 | &sub($a0,$b0,$a0); # do the subtract | ||
| 84 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 85 | &sub($a0,$cc,$a0); # will we borrow? | ||
| 86 | &st($a0,&QWPw(0,$rp)); # save | ||
| 87 | &add($b0,$tmp,$cc); # add the borrows | ||
| 88 | |||
| 89 | &add($ap,$QWS,$ap); | ||
| 90 | &add($bp,$QWS,$bp); | ||
| 91 | &add($rp,$QWS,$rp); | ||
| 92 | &sub($count,1,$count); | ||
| 93 | &bgt($count,&label("last_loop")); | ||
| 94 | &function_end_A($name); | ||
| 95 | |||
| 96 | ###################################################### | ||
| 97 | &set_label("finish"); | ||
| 98 | &add($count,4,$count); | ||
| 99 | &bgt($count,&label("last_loop")); | ||
| 100 | |||
| 101 | &FR($a0,$b0); | ||
| 102 | &set_label("end"); | ||
| 103 | &function_end($name); | ||
| 104 | |||
| 105 | &fin_pool; | ||
| 106 | } | ||
| 107 | |||
| 108 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/add.pl b/src/lib/libcrypto/bn/asm/alpha/add.pl deleted file mode 100644 index 13bf516428..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/add.pl +++ /dev/null | |||
| @@ -1,118 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_add_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | $count=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &blt($count,&label("finish")); | ||
| 23 | |||
| 24 | ($a0,$b0)=&NR(2); | ||
| 25 | |||
| 26 | ########################################################## | ||
| 27 | &set_label("loop"); | ||
| 28 | |||
| 29 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); | ||
| 30 | &ld(($b0)=&NR(1),&QWPw(0,$bp)); | ||
| 31 | &ld(($a1)=&NR(1),&QWPw(1,$ap)); | ||
| 32 | &ld(($b1)=&NR(1),&QWPw(1,$bp)); | ||
| 33 | |||
| 34 | ($o0,$t0)=&NR(2); | ||
| 35 | &add($a0,$b0,$o0); | ||
| 36 | &ld(($a2)=&NR(1),&QWPw(2,$ap)); | ||
| 37 | &cmpult($o0,$b0,$t0); | ||
| 38 | &add($o0,$cc,$o0); | ||
| 39 | &cmpult($o0,$cc,$cc); | ||
| 40 | &ld(($b2)=&NR(1),&QWPw(2,$bp)); | ||
| 41 | &add($cc,$t0,$cc); &FR($t0); | ||
| 42 | |||
| 43 | ($t1,$o1)=&NR(2); | ||
| 44 | |||
| 45 | &add($a1,$b1,$o1); &FR($a1); | ||
| 46 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 47 | &add($o1,$cc,$o1); | ||
| 48 | &cmpult($o1,$cc,$cc); | ||
| 49 | &ld(($a3)=&NR(1),&QWPw(3,$ap)); | ||
| 50 | &add($cc,$t1,$cc); &FR($t1); | ||
| 51 | |||
| 52 | ($t2,$o2)=&NR(2); | ||
| 53 | |||
| 54 | &add($a2,$b2,$o2); &FR($a2); | ||
| 55 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 56 | &add($o2,$cc,$o2); | ||
| 57 | &cmpult($o2,$cc,$cc); | ||
| 58 | &ld(($b3)=&NR(1),&QWPw(3,$bp)); | ||
| 59 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 60 | &add($cc,$t2,$cc); &FR($t2); | ||
| 61 | |||
| 62 | ($t3,$o3)=&NR(2); | ||
| 63 | |||
| 64 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 65 | &add($a3,$b3,$o3); &FR($a3); | ||
| 66 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 67 | &add($o3,$cc,$o3); | ||
| 68 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 69 | &cmpult($o3,$cc,$cc); | ||
| 70 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 71 | &add($cc,$t3,$cc); &FR($t3); | ||
| 72 | |||
| 73 | |||
| 74 | &sub($count,4,$count); # count-=4 | ||
| 75 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 76 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 77 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 78 | |||
| 79 | ### | ||
| 80 | &bge($count,&label("loop")); | ||
| 81 | ### | ||
| 82 | &br(&label("finish")); | ||
| 83 | ################################################## | ||
| 84 | # Do the last 0..3 words | ||
| 85 | |||
| 86 | ($t0,$o0)=&NR(2); | ||
| 87 | &set_label("last_loop"); | ||
| 88 | |||
| 89 | &ld($a0,&QWPw(0,$ap)); # get a | ||
| 90 | &ld($b0,&QWPw(0,$bp)); # get b | ||
| 91 | &add($ap,$QWS,$ap); | ||
| 92 | &add($bp,$QWS,$bp); | ||
| 93 | &add($a0,$b0,$o0); | ||
| 94 | &sub($count,1,$count); | ||
| 95 | &cmpult($o0,$b0,$t0); # will we borrow? | ||
| 96 | &add($o0,$cc,$o0); # will we borrow? | ||
| 97 | &cmpult($o0,$cc,$cc); # will we borrow? | ||
| 98 | &add($rp,$QWS,$rp); | ||
| 99 | &st($o0,&QWPw(-1,$rp)); # save | ||
| 100 | &add($cc,$t0,$cc); # add the borrows | ||
| 101 | |||
| 102 | ### | ||
| 103 | &bgt($count,&label("last_loop")); | ||
| 104 | &function_end_A($name); | ||
| 105 | |||
| 106 | ###################################################### | ||
| 107 | &set_label("finish"); | ||
| 108 | &add($count,4,$count); | ||
| 109 | &bgt($count,&label("last_loop")); | ||
| 110 | |||
| 111 | &FR($o0,$t0,$a0,$b0); | ||
| 112 | &set_label("end"); | ||
| 113 | &function_end($name); | ||
| 114 | |||
| 115 | &fin_pool; | ||
| 116 | } | ||
| 117 | |||
| 118 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/div.pl b/src/lib/libcrypto/bn/asm/alpha/div.pl deleted file mode 100644 index e9e680897a..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/div.pl +++ /dev/null | |||
| @@ -1,144 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | sub bn_div_words | ||
| 4 | { | ||
| 5 | local($data)=<<'EOF'; | ||
| 6 | # | ||
| 7 | # What follows was taken directly from the C compiler with a few | ||
| 8 | # hacks to redo the lables. | ||
| 9 | # | ||
| 10 | .text | ||
| 11 | .set noreorder | ||
| 12 | .set volatile | ||
| 13 | .align 3 | ||
| 14 | .globl bn_div_words | ||
| 15 | .ent bn_div_words | ||
| 16 | bn_div_words | ||
| 17 | ldgp $29,0($27) | ||
| 18 | bn_div_words.ng: | ||
| 19 | lda $30,-48($30) | ||
| 20 | .frame $30,48,$26,0 | ||
| 21 | stq $26,0($30) | ||
| 22 | stq $9,8($30) | ||
| 23 | stq $10,16($30) | ||
| 24 | stq $11,24($30) | ||
| 25 | stq $12,32($30) | ||
| 26 | stq $13,40($30) | ||
| 27 | .mask 0x4003e00,-48 | ||
| 28 | .prologue 1 | ||
| 29 | bis $16,$16,$9 | ||
| 30 | bis $17,$17,$10 | ||
| 31 | bis $18,$18,$11 | ||
| 32 | bis $31,$31,$13 | ||
| 33 | bis $31,2,$12 | ||
| 34 | bne $11,$9119 | ||
| 35 | lda $0,-1 | ||
| 36 | br $31,$9136 | ||
| 37 | .align 4 | ||
| 38 | $9119: | ||
| 39 | bis $11,$11,$16 | ||
| 40 | jsr $26,BN_num_bits_word | ||
| 41 | ldgp $29,0($26) | ||
| 42 | subq $0,64,$1 | ||
| 43 | beq $1,$9120 | ||
| 44 | bis $31,1,$1 | ||
| 45 | sll $1,$0,$1 | ||
| 46 | cmpule $9,$1,$1 | ||
| 47 | bne $1,$9120 | ||
| 48 | # lda $16,_IO_stderr_ | ||
| 49 | # lda $17,$C32 | ||
| 50 | # bis $0,$0,$18 | ||
| 51 | # jsr $26,fprintf | ||
| 52 | # ldgp $29,0($26) | ||
| 53 | jsr $26,abort | ||
| 54 | ldgp $29,0($26) | ||
| 55 | .align 4 | ||
| 56 | $9120: | ||
| 57 | bis $31,64,$3 | ||
| 58 | cmpult $9,$11,$2 | ||
| 59 | subq $3,$0,$1 | ||
| 60 | addl $1,$31,$0 | ||
| 61 | subq $9,$11,$1 | ||
| 62 | cmoveq $2,$1,$9 | ||
| 63 | beq $0,$9122 | ||
| 64 | zapnot $0,15,$2 | ||
| 65 | subq $3,$0,$1 | ||
| 66 | sll $11,$2,$11 | ||
| 67 | sll $9,$2,$3 | ||
| 68 | srl $10,$1,$1 | ||
| 69 | sll $10,$2,$10 | ||
| 70 | bis $3,$1,$9 | ||
| 71 | $9122: | ||
| 72 | srl $11,32,$5 | ||
| 73 | zapnot $11,15,$6 | ||
| 74 | lda $7,-1 | ||
| 75 | .align 5 | ||
| 76 | $9123: | ||
| 77 | srl $9,32,$1 | ||
| 78 | subq $1,$5,$1 | ||
| 79 | bne $1,$9126 | ||
| 80 | zapnot $7,15,$27 | ||
| 81 | br $31,$9127 | ||
| 82 | .align 4 | ||
| 83 | $9126: | ||
| 84 | bis $9,$9,$24 | ||
| 85 | bis $5,$5,$25 | ||
| 86 | divqu $24,$25,$27 | ||
| 87 | $9127: | ||
| 88 | srl $10,32,$4 | ||
| 89 | .align 5 | ||
| 90 | $9128: | ||
| 91 | mulq $27,$5,$1 | ||
| 92 | subq $9,$1,$3 | ||
| 93 | zapnot $3,240,$1 | ||
| 94 | bne $1,$9129 | ||
| 95 | mulq $6,$27,$2 | ||
| 96 | sll $3,32,$1 | ||
| 97 | addq $1,$4,$1 | ||
| 98 | cmpule $2,$1,$2 | ||
| 99 | bne $2,$9129 | ||
| 100 | subq $27,1,$27 | ||
| 101 | br $31,$9128 | ||
| 102 | .align 4 | ||
| 103 | $9129: | ||
| 104 | mulq $27,$6,$1 | ||
| 105 | mulq $27,$5,$4 | ||
| 106 | srl $1,32,$3 | ||
| 107 | sll $1,32,$1 | ||
| 108 | addq $4,$3,$4 | ||
| 109 | cmpult $10,$1,$2 | ||
| 110 | subq $10,$1,$10 | ||
| 111 | addq $2,$4,$2 | ||
| 112 | cmpult $9,$2,$1 | ||
| 113 | bis $2,$2,$4 | ||
| 114 | beq $1,$9134 | ||
| 115 | addq $9,$11,$9 | ||
| 116 | subq $27,1,$27 | ||
| 117 | $9134: | ||
| 118 | subl $12,1,$12 | ||
| 119 | subq $9,$4,$9 | ||
| 120 | beq $12,$9124 | ||
| 121 | sll $27,32,$13 | ||
| 122 | sll $9,32,$2 | ||
| 123 | srl $10,32,$1 | ||
| 124 | sll $10,32,$10 | ||
| 125 | bis $2,$1,$9 | ||
| 126 | br $31,$9123 | ||
| 127 | .align 4 | ||
| 128 | $9124: | ||
| 129 | bis $13,$27,$0 | ||
| 130 | $9136: | ||
| 131 | ldq $26,0($30) | ||
| 132 | ldq $9,8($30) | ||
| 133 | ldq $10,16($30) | ||
| 134 | ldq $11,24($30) | ||
| 135 | ldq $12,32($30) | ||
| 136 | ldq $13,40($30) | ||
| 137 | addq $30,48,$30 | ||
| 138 | ret $31,($26),1 | ||
| 139 | .end bn_div_words | ||
| 140 | EOF | ||
| 141 | &asm_add($data); | ||
| 142 | } | ||
| 143 | |||
| 144 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul.pl b/src/lib/libcrypto/bn/asm/alpha/mul.pl deleted file mode 100644 index 76c926566c..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/mul.pl +++ /dev/null | |||
| @@ -1,104 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | $word=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | ### | ||
| 23 | &blt($count,&label("finish")); | ||
| 24 | |||
| 25 | ($a0)=&NR(1); &ld($a0,&QWPw(0,$ap)); | ||
| 26 | |||
| 27 | &set_label("loop"); | ||
| 28 | |||
| 29 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 30 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 31 | |||
| 32 | &muh($a0,$word,($h0)=&NR(1)); &FR($a0); | ||
| 33 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 34 | ### wait 8 | ||
| 35 | &mul($a0,$word,($l0)=&NR(1)); &FR($a0); | ||
| 36 | ### wait 8 | ||
| 37 | &muh($a1,$word,($h1)=&NR(1)); &FR($a1); | ||
| 38 | &add($l0,$cc,$l0); ### wait 8 | ||
| 39 | &mul($a1,$word,($l1)=&NR(1)); &FR($a1); | ||
| 40 | &cmpult($l0,$cc,$cc); ### wait 8 | ||
| 41 | &muh($a2,$word,($h2)=&NR(1)); &FR($a2); | ||
| 42 | &add($h0,$cc,$cc); &FR($h0); ### wait 8 | ||
| 43 | &mul($a2,$word,($l2)=&NR(1)); &FR($a2); | ||
| 44 | &add($l1,$cc,$l1); ### wait 8 | ||
| 45 | &st($l0,&QWPw(0,$rp)); &FR($l0); | ||
| 46 | &cmpult($l1,$cc,$cc); ### wait 8 | ||
| 47 | &muh($a3,$word,($h3)=&NR(1)); &FR($a3); | ||
| 48 | &add($h1,$cc,$cc); &FR($h1); | ||
| 49 | &mul($a3,$word,($l3)=&NR(1)); &FR($a3); | ||
| 50 | &add($l2,$cc,$l2); | ||
| 51 | &st($l1,&QWPw(1,$rp)); &FR($l1); | ||
| 52 | &cmpult($l2,$cc,$cc); | ||
| 53 | &add($h2,$cc,$cc); &FR($h2); | ||
| 54 | &sub($count,4,$count); # count-=4 | ||
| 55 | &st($l2,&QWPw(2,$rp)); &FR($l2); | ||
| 56 | &add($l3,$cc,$l3); | ||
| 57 | &cmpult($l3,$cc,$cc); | ||
| 58 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 59 | &add($h3,$cc,$cc); &FR($h3); | ||
| 60 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 61 | &st($l3,&QWPw(3,$rp)); &FR($l3); | ||
| 62 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 63 | ### | ||
| 64 | &blt($count,&label("finish")); | ||
| 65 | ($a0)=&NR(1); &ld($a0,&QWPw(0,$ap)); | ||
| 66 | &br(&label("finish")); | ||
| 67 | ################################################## | ||
| 68 | |||
| 69 | ################################################## | ||
| 70 | # Do the last 0..3 words | ||
| 71 | |||
| 72 | &set_label("last_loop"); | ||
| 73 | |||
| 74 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 75 | ### | ||
| 76 | ### | ||
| 77 | ### | ||
| 78 | &muh($a0,$word,($h0)=&NR(1)); | ||
| 79 | ### Wait 8 for next mul issue | ||
| 80 | &mul($a0,$word,($l0)=&NR(1)); &FR($a0) | ||
| 81 | &add($ap,$QWS,$ap); | ||
| 82 | ### Loose 12 until result is available | ||
| 83 | &add($rp,$QWS,$rp); | ||
| 84 | &sub($count,1,$count); | ||
| 85 | &add($l0,$cc,$l0); | ||
| 86 | ### | ||
| 87 | &st($l0,&QWPw(-1,$rp)); &FR($l0); | ||
| 88 | &cmpult($l0,$cc,$cc); | ||
| 89 | &add($h0,$cc,$cc); &FR($h0); | ||
| 90 | &bgt($count,&label("last_loop")); | ||
| 91 | &function_end_A($name); | ||
| 92 | |||
| 93 | ###################################################### | ||
| 94 | &set_label("finish"); | ||
| 95 | &add($count,4,$count); | ||
| 96 | &bgt($count,&label("last_loop")); | ||
| 97 | |||
| 98 | &set_label("end"); | ||
| 99 | &function_end($name); | ||
| 100 | |||
| 101 | &fin_pool; | ||
| 102 | } | ||
| 103 | |||
| 104 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_add.pl b/src/lib/libcrypto/bn/asm/alpha/mul_add.pl deleted file mode 100644 index 0d6df69bc4..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/mul_add.pl +++ /dev/null | |||
| @@ -1,123 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_add_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | $word=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | ### | ||
| 23 | &blt($count,&label("finish")); | ||
| 24 | |||
| 25 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); | ||
| 26 | |||
| 27 | $a=<<'EOF'; | ||
| 28 | ########################################################## | ||
| 29 | &set_label("loop"); | ||
| 30 | |||
| 31 | &ld(($r0)=&NR(1),&QWPw(0,$rp)); | ||
| 32 | &ld(($a1)=&NR(1),&QWPw(1,$ap)); | ||
| 33 | &muh($a0,$word,($h0)=&NR(1)); | ||
| 34 | &ld(($r1)=&NR(1),&QWPw(1,$rp)); | ||
| 35 | &ld(($a2)=&NR(1),&QWPw(2,$ap)); | ||
| 36 | ### | ||
| 37 | &mul($a0,$word,($l0)=&NR(1)); &FR($a0); | ||
| 38 | &ld(($r2)=&NR(1),&QWPw(2,$rp)); | ||
| 39 | &muh($a1,$word,($h1)=&NR(1)); | ||
| 40 | &ld(($a3)=&NR(1),&QWPw(3,$ap)); | ||
| 41 | &mul($a1,$word,($l1)=&NR(1)); &FR($a1); | ||
| 42 | &ld(($r3)=&NR(1),&QWPw(3,$rp)); | ||
| 43 | &add($r0,$l0,$r0); | ||
| 44 | &add($r1,$l1,$r1); | ||
| 45 | &cmpult($r0,$l0,($t0)=&NR(1)); &FR($l0); | ||
| 46 | &cmpult($r1,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 47 | &muh($a2,$word,($h2)=&NR(1)); | ||
| 48 | &add($r0,$cc,$r0); | ||
| 49 | &add($h0,$t0,$h0); &FR($t0); | ||
| 50 | &cmpult($r0,$cc,$cc); | ||
| 51 | &add($h1,$t1,$h1); &FR($t1); | ||
| 52 | &add($h0,$cc,$cc); &FR($h0); | ||
| 53 | &mul($a2,$word,($l2)=&NR(1)); &FR($a2); | ||
| 54 | &add($r1,$cc,$r1); | ||
| 55 | &cmpult($r1,$cc,$cc); | ||
| 56 | &add($r2,$l2,$r2); | ||
| 57 | &add($h1,$cc,$cc); &FR($h1); | ||
| 58 | &cmpult($r2,$l2,($t2)=&NR(1)); &FR($l2); | ||
| 59 | &muh($a3,$word,($h3)=&NR(1)); | ||
| 60 | &add($r2,$cc,$r2); | ||
| 61 | &st($r0,&QWPw(0,$rp)); &FR($r0); | ||
| 62 | &add($h2,$t2,$h2); &FR($t2); | ||
| 63 | &st($r1,&QWPw(1,$rp)); &FR($r1); | ||
| 64 | &cmpult($r2,$cc,$cc); | ||
| 65 | &mul($a3,$word,($l3)=&NR(1)); &FR($a3); | ||
| 66 | &add($h2,$cc,$cc); &FR($h2); | ||
| 67 | &st($r2,&QWPw(2,$rp)); &FR($r2); | ||
| 68 | &sub($count,4,$count); # count-=4 | ||
| 69 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 70 | &add($r3,$l3,$r3); | ||
| 71 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 72 | &cmpult($r3,$l3,($t3)=&NR(1)); &FR($l3); | ||
| 73 | &add($r3,$cc,$r3); | ||
| 74 | &add($h3,$t3,$h3); &FR($t3); | ||
| 75 | &cmpult($r3,$cc,$cc); | ||
| 76 | &st($r3,&QWPw(-1,$rp)); &FR($r3); | ||
| 77 | &add($h3,$cc,$cc); &FR($h3); | ||
| 78 | |||
| 79 | ### | ||
| 80 | &blt($count,&label("finish")); | ||
| 81 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); | ||
| 82 | &br(&label("loop")); | ||
| 83 | EOF | ||
| 84 | ################################################## | ||
| 85 | # Do the last 0..3 words | ||
| 86 | |||
| 87 | &set_label("last_loop"); | ||
| 88 | |||
| 89 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 90 | &ld(($r0)=&NR(1),&QWPw(0,$rp)); # get b | ||
| 91 | ### | ||
| 92 | ### | ||
| 93 | &muh($a0,$word,($h0)=&NR(1)); &FR($a0); | ||
| 94 | ### wait 8 | ||
| 95 | &mul($a0,$word,($l0)=&NR(1)); &FR($a0); | ||
| 96 | &add($rp,$QWS,$rp); | ||
| 97 | &add($ap,$QWS,$ap); | ||
| 98 | &sub($count,1,$count); | ||
| 99 | ### wait 3 until l0 is available | ||
| 100 | &add($r0,$l0,$r0); | ||
| 101 | ### | ||
| 102 | &cmpult($r0,$l0,($t0)=&NR(1)); &FR($l0); | ||
| 103 | &add($r0,$cc,$r0); | ||
| 104 | &add($h0,$t0,$h0); &FR($t0); | ||
| 105 | &cmpult($r0,$cc,$cc); | ||
| 106 | &add($h0,$cc,$cc); &FR($h0); | ||
| 107 | |||
| 108 | &st($r0,&QWPw(-1,$rp)); &FR($r0); | ||
| 109 | &bgt($count,&label("last_loop")); | ||
| 110 | &function_end_A($name); | ||
| 111 | |||
| 112 | ###################################################### | ||
| 113 | &set_label("finish"); | ||
| 114 | &add($count,4,$count); | ||
| 115 | &bgt($count,&label("last_loop")); | ||
| 116 | |||
| 117 | &set_label("end"); | ||
| 118 | &function_end($name); | ||
| 119 | |||
| 120 | &fin_pool; | ||
| 121 | } | ||
| 122 | |||
| 123 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_c4.pl b/src/lib/libcrypto/bn/asm/alpha/mul_c4.pl deleted file mode 100644 index 9cc876ded4..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/mul_c4.pl +++ /dev/null | |||
| @@ -1,215 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | # upto | ||
| 5 | |||
| 6 | sub mul_add_c | ||
| 7 | { | ||
| 8 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 9 | local($l1,$h1,$t1,$t2); | ||
| 10 | |||
| 11 | &mul($a,$b,($l1)=&NR(1)); | ||
| 12 | &muh($a,$b,($h1)=&NR(1)); | ||
| 13 | &add($c0,$l1,$c0); | ||
| 14 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 15 | &add($t1,$h1,$h1); &FR($t1); | ||
| 16 | &add($c1,$h1,$c1); | ||
| 17 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 18 | &add($c2,$t2,$c2); &FR($t2); | ||
| 19 | } | ||
| 20 | |||
| 21 | sub bn_mul_comba4 | ||
| 22 | { | ||
| 23 | local($name)=@_; | ||
| 24 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 25 | |||
| 26 | $cnt=1; | ||
| 27 | &init_pool(3); | ||
| 28 | |||
| 29 | $rp=&wparam(0); | ||
| 30 | $ap=&wparam(1); | ||
| 31 | $bp=&wparam(2); | ||
| 32 | |||
| 33 | &function_begin($name,""); | ||
| 34 | |||
| 35 | &comment(""); | ||
| 36 | |||
| 37 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 38 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 39 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 40 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 41 | &mul($a[0],$b[0],($r00)=&NR(1)); | ||
| 42 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 43 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 44 | &muh($a[0],$b[0],($r01)=&NR(1)); | ||
| 45 | &FR($ap); &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 46 | &FR($bp); &ld(($b[3])=&NR(1),&QWPw(3,$bp)); | ||
| 47 | &mul($a[0],$b[1],($r02)=&NR(1)); | ||
| 48 | |||
| 49 | ($R,$H1,$H2)=&NR(3); | ||
| 50 | |||
| 51 | &st($r00,&QWPw(0,$rp)); &FR($r00); | ||
| 52 | |||
| 53 | &mov("zero",$R); | ||
| 54 | &mul($a[1],$b[0],($r03)=&NR(1)); | ||
| 55 | |||
| 56 | &mov("zero",$H1); | ||
| 57 | &mov("zero",$H0); | ||
| 58 | &add($R,$r01,$R); | ||
| 59 | &muh($a[0],$b[1],($r04)=&NR(1)); | ||
| 60 | &cmpult($R,$r01,($t01)=&NR(1)); &FR($r01); | ||
| 61 | &add($R,$r02,$R); | ||
| 62 | &add($H1,$t01,$H1) &FR($t01); | ||
| 63 | &muh($a[1],$b[0],($r05)=&NR(1)); | ||
| 64 | &cmpult($R,$r02,($t02)=&NR(1)); &FR($r02); | ||
| 65 | &add($R,$r03,$R); | ||
| 66 | &add($H2,$t02,$H2) &FR($t02); | ||
| 67 | &mul($a[0],$b[2],($r06)=&NR(1)); | ||
| 68 | &cmpult($R,$r03,($t03)=&NR(1)); &FR($r03); | ||
| 69 | &add($H1,$t03,$H1) &FR($t03); | ||
| 70 | &st($R,&QWPw(1,$rp)); | ||
| 71 | &add($H1,$H2,$R); | ||
| 72 | |||
| 73 | &mov("zero",$H1); | ||
| 74 | &add($R,$r04,$R); | ||
| 75 | &mov("zero",$H2); | ||
| 76 | &mul($a[1],$b[1],($r07)=&NR(1)); | ||
| 77 | &cmpult($R,$r04,($t04)=&NR(1)); &FR($r04); | ||
| 78 | &add($R,$r05,$R); | ||
| 79 | &add($H1,$t04,$H1) &FR($t04); | ||
| 80 | &mul($a[2],$b[0],($r08)=&NR(1)); | ||
| 81 | &cmpult($R,$r05,($t05)=&NR(1)); &FR($r05); | ||
| 82 | &add($R,$r01,$R); | ||
| 83 | &add($H2,$t05,$H2) &FR($t05); | ||
| 84 | &muh($a[0],$b[2],($r09)=&NR(1)); | ||
| 85 | &cmpult($R,$r06,($t06)=&NR(1)); &FR($r06); | ||
| 86 | &add($R,$r07,$R); | ||
| 87 | &add($H1,$t06,$H1) &FR($t06); | ||
| 88 | &muh($a[1],$b[1],($r10)=&NR(1)); | ||
| 89 | &cmpult($R,$r07,($t07)=&NR(1)); &FR($r07); | ||
| 90 | &add($R,$r08,$R); | ||
| 91 | &add($H2,$t07,$H2) &FR($t07); | ||
| 92 | &muh($a[2],$b[0],($r11)=&NR(1)); | ||
| 93 | &cmpult($R,$r08,($t08)=&NR(1)); &FR($r08); | ||
| 94 | &add($H1,$t08,$H1) &FR($t08); | ||
| 95 | &st($R,&QWPw(2,$rp)); | ||
| 96 | &add($H1,$H2,$R); | ||
| 97 | |||
| 98 | &mov("zero",$H1); | ||
| 99 | &add($R,$r09,$R); | ||
| 100 | &mov("zero",$H2); | ||
| 101 | &mul($a[0],$b[3],($r12)=&NR(1)); | ||
| 102 | &cmpult($R,$r09,($t09)=&NR(1)); &FR($r09); | ||
| 103 | &add($R,$r10,$R); | ||
| 104 | &add($H1,$t09,$H1) &FR($t09); | ||
| 105 | &mul($a[1],$b[2],($r13)=&NR(1)); | ||
| 106 | &cmpult($R,$r10,($t10)=&NR(1)); &FR($r10); | ||
| 107 | &add($R,$r11,$R); | ||
| 108 | &add($H1,$t10,$H1) &FR($t10); | ||
| 109 | &mul($a[2],$b[1],($r14)=&NR(1)); | ||
| 110 | &cmpult($R,$r11,($t11)=&NR(1)); &FR($r11); | ||
| 111 | &add($R,$r12,$R); | ||
| 112 | &add($H1,$t11,$H1) &FR($t11); | ||
| 113 | &mul($a[3],$b[0],($r15)=&NR(1)); | ||
| 114 | &cmpult($R,$r12,($t12)=&NR(1)); &FR($r12); | ||
| 115 | &add($R,$r13,$R); | ||
| 116 | &add($H1,$t12,$H1) &FR($t12); | ||
| 117 | &muh($a[0],$b[3],($r16)=&NR(1)); | ||
| 118 | &cmpult($R,$r13,($t13)=&NR(1)); &FR($r13); | ||
| 119 | &add($R,$r14,$R); | ||
| 120 | &add($H1,$t13,$H1) &FR($t13); | ||
| 121 | &muh($a[1],$b[2],($r17)=&NR(1)); | ||
| 122 | &cmpult($R,$r14,($t14)=&NR(1)); &FR($r14); | ||
| 123 | &add($R,$r15,$R); | ||
| 124 | &add($H1,$t14,$H1) &FR($t14); | ||
| 125 | &muh($a[2],$b[1],($r18)=&NR(1)); | ||
| 126 | &cmpult($R,$r15,($t15)=&NR(1)); &FR($r15); | ||
| 127 | &add($H1,$t15,$H1) &FR($t15); | ||
| 128 | &st($R,&QWPw(3,$rp)); | ||
| 129 | &add($H1,$H2,$R); | ||
| 130 | |||
| 131 | &mov("zero",$H1); | ||
| 132 | &add($R,$r16,$R); | ||
| 133 | &mov("zero",$H2); | ||
| 134 | &muh($a[3],$b[0],($r19)=&NR(1)); | ||
| 135 | &cmpult($R,$r16,($t16)=&NR(1)); &FR($r16); | ||
| 136 | &add($R,$r17,$R); | ||
| 137 | &add($H1,$t16,$H1) &FR($t16); | ||
| 138 | &mul($a[1],$b[3],($r20)=&NR(1)); | ||
| 139 | &cmpult($R,$r17,($t17)=&NR(1)); &FR($r17); | ||
| 140 | &add($R,$r18,$R); | ||
| 141 | &add($H1,$t17,$H1) &FR($t17); | ||
| 142 | &mul($a[2],$b[2],($r21)=&NR(1)); | ||
| 143 | &cmpult($R,$r18,($t18)=&NR(1)); &FR($r18); | ||
| 144 | &add($R,$r19,$R); | ||
| 145 | &add($H1,$t18,$H1) &FR($t18); | ||
| 146 | &mul($a[3],$b[1],($r22)=&NR(1)); | ||
| 147 | &cmpult($R,$r19,($t19)=&NR(1)); &FR($r19); | ||
| 148 | &add($R,$r20,$R); | ||
| 149 | &add($H1,$t19,$H1) &FR($t19); | ||
| 150 | &muh($a[1],$b[3],($r23)=&NR(1)); | ||
| 151 | &cmpult($R,$r20,($t20)=&NR(1)); &FR($r20); | ||
| 152 | &add($R,$r21,$R); | ||
| 153 | &add($H1,$t20,$H1) &FR($t20); | ||
| 154 | &muh($a[2],$b[2],($r24)=&NR(1)); | ||
| 155 | &cmpult($R,$r21,($t21)=&NR(1)); &FR($r21); | ||
| 156 | &add($R,$r22,$R); | ||
| 157 | &add($H1,$t21,$H1) &FR($t21); | ||
| 158 | &muh($a[3],$b[1],($r25)=&NR(1)); | ||
| 159 | &cmpult($R,$r22,($t22)=&NR(1)); &FR($r22); | ||
| 160 | &add($H1,$t22,$H1) &FR($t22); | ||
| 161 | &st($R,&QWPw(4,$rp)); | ||
| 162 | &add($H1,$H2,$R); | ||
| 163 | |||
| 164 | &mov("zero",$H1); | ||
| 165 | &add($R,$r23,$R); | ||
| 166 | &mov("zero",$H2); | ||
| 167 | &mul($a[2],$b[3],($r26)=&NR(1)); | ||
| 168 | &cmpult($R,$r23,($t23)=&NR(1)); &FR($r23); | ||
| 169 | &add($R,$r24,$R); | ||
| 170 | &add($H1,$t23,$H1) &FR($t23); | ||
| 171 | &mul($a[3],$b[2],($r27)=&NR(1)); | ||
| 172 | &cmpult($R,$r24,($t24)=&NR(1)); &FR($r24); | ||
| 173 | &add($R,$r25,$R); | ||
| 174 | &add($H1,$t24,$H1) &FR($t24); | ||
| 175 | &muh($a[2],$b[3],($r28)=&NR(1)); | ||
| 176 | &cmpult($R,$r25,($t25)=&NR(1)); &FR($r25); | ||
| 177 | &add($R,$r26,$R); | ||
| 178 | &add($H1,$t25,$H1) &FR($t25); | ||
| 179 | &muh($a[3],$b[2],($r29)=&NR(1)); | ||
| 180 | &cmpult($R,$r26,($t26)=&NR(1)); &FR($r26); | ||
| 181 | &add($R,$r27,$R); | ||
| 182 | &add($H1,$t26,$H1) &FR($t26); | ||
| 183 | &mul($a[3],$b[3],($r30)=&NR(1)); | ||
| 184 | &cmpult($R,$r27,($t27)=&NR(1)); &FR($r27); | ||
| 185 | &add($H1,$t27,$H1) &FR($t27); | ||
| 186 | &st($R,&QWPw(5,$rp)); | ||
| 187 | &add($H1,$H2,$R); | ||
| 188 | |||
| 189 | &mov("zero",$H1); | ||
| 190 | &add($R,$r28,$R); | ||
| 191 | &mov("zero",$H2); | ||
| 192 | &muh($a[3],$b[3],($r31)=&NR(1)); | ||
| 193 | &cmpult($R,$r28,($t28)=&NR(1)); &FR($r28); | ||
| 194 | &add($R,$r29,$R); | ||
| 195 | &add($H1,$t28,$H1) &FR($t28); | ||
| 196 | ############ | ||
| 197 | &cmpult($R,$r29,($t29)=&NR(1)); &FR($r29); | ||
| 198 | &add($R,$r30,$R); | ||
| 199 | &add($H1,$t29,$H1) &FR($t29); | ||
| 200 | ############ | ||
| 201 | &cmpult($R,$r30,($t30)=&NR(1)); &FR($r30); | ||
| 202 | &add($H1,$t30,$H1) &FR($t30); | ||
| 203 | &st($R,&QWPw(6,$rp)); | ||
| 204 | &add($H1,$H2,$R); | ||
| 205 | |||
| 206 | &add($R,$r31,$R); &FR($r31); | ||
| 207 | &st($R,&QWPw(7,$rp)); | ||
| 208 | |||
| 209 | &FR($R,$H1,$H2); | ||
| 210 | &function_end($name); | ||
| 211 | |||
| 212 | &fin_pool; | ||
| 213 | } | ||
| 214 | |||
| 215 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_c4.works.pl b/src/lib/libcrypto/bn/asm/alpha/mul_c4.works.pl deleted file mode 100644 index 79d86dd25c..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/mul_c4.works.pl +++ /dev/null | |||
| @@ -1,98 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub mul_add_c | ||
| 5 | { | ||
| 6 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 7 | local($l1,$h1,$t1,$t2); | ||
| 8 | |||
| 9 | print STDERR "count=$cnt\n"; $cnt++; | ||
| 10 | &mul($a,$b,($l1)=&NR(1)); | ||
| 11 | &muh($a,$b,($h1)=&NR(1)); | ||
| 12 | &add($c0,$l1,$c0); | ||
| 13 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 14 | &add($t1,$h1,$h1); &FR($t1); | ||
| 15 | &add($c1,$h1,$c1); | ||
| 16 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 17 | &add($c2,$t2,$c2); &FR($t2); | ||
| 18 | } | ||
| 19 | |||
| 20 | sub bn_mul_comba4 | ||
| 21 | { | ||
| 22 | local($name)=@_; | ||
| 23 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 24 | |||
| 25 | $cnt=1; | ||
| 26 | &init_pool(3); | ||
| 27 | |||
| 28 | $rp=&wparam(0); | ||
| 29 | $ap=&wparam(1); | ||
| 30 | $bp=&wparam(2); | ||
| 31 | |||
| 32 | &function_begin($name,""); | ||
| 33 | |||
| 34 | &comment(""); | ||
| 35 | |||
| 36 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 37 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 38 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 39 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 40 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 41 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 42 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap); | ||
| 43 | &ld(($b[3])=&NR(1),&QWPw(3,$bp)); &FR($bp); | ||
| 44 | |||
| 45 | ($c0,$c1,$c2)=&NR(3); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | &mul($a[0],$b[0],$c0); | ||
| 48 | &muh($a[0],$b[0],$c1); | ||
| 49 | &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 50 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 51 | &mov("zero",$c2); | ||
| 52 | |||
| 53 | &mul_add_c($a[0],$b[1],$c0,$c1,$c2); | ||
| 54 | &mul_add_c($a[1],$b[0],$c0,$c1,$c2); | ||
| 55 | &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 56 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 57 | &mov("zero",$c2); | ||
| 58 | |||
| 59 | &mul_add_c($a[1],$b[1],$c0,$c1,$c2); | ||
| 60 | &mul_add_c($a[0],$b[2],$c0,$c1,$c2); | ||
| 61 | &mul_add_c($a[2],$b[0],$c0,$c1,$c2); | ||
| 62 | &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 63 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 64 | &mov("zero",$c2); | ||
| 65 | |||
| 66 | &mul_add_c($a[0],$b[3],$c0,$c1,$c2); &FR($a[0]); | ||
| 67 | &mul_add_c($a[1],$b[2],$c0,$c1,$c2); | ||
| 68 | &mul_add_c($a[2],$b[1],$c0,$c1,$c2); | ||
| 69 | &mul_add_c($a[3],$b[0],$c0,$c1,$c2); &FR($b[0]); | ||
| 70 | &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 71 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 72 | &mov("zero",$c2); | ||
| 73 | |||
| 74 | &mul_add_c($a[1],$b[3],$c0,$c1,$c2); &FR($a[1]); | ||
| 75 | &mul_add_c($a[2],$b[2],$c0,$c1,$c2); | ||
| 76 | &mul_add_c($a[3],$b[1],$c0,$c1,$c2); &FR($b[1]); | ||
| 77 | &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 78 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 79 | &mov("zero",$c2); | ||
| 80 | |||
| 81 | &mul_add_c($a[2],$b[3],$c0,$c1,$c2); &FR($a[2]); | ||
| 82 | &mul_add_c($a[3],$b[2],$c0,$c1,$c2); &FR($b[2]); | ||
| 83 | &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR($c0); | ||
| 84 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 85 | &mov("zero",$c2); | ||
| 86 | |||
| 87 | &mul_add_c($a[3],$b[3],$c0,$c1,$c2); &FR($a[3],$b[3]); | ||
| 88 | &st($c0,&QWPw(6,$rp)); | ||
| 89 | &st($c1,&QWPw(7,$rp)); | ||
| 90 | |||
| 91 | &FR($c0,$c1,$c2); | ||
| 92 | |||
| 93 | &function_end($name); | ||
| 94 | |||
| 95 | &fin_pool; | ||
| 96 | } | ||
| 97 | |||
| 98 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_c8.pl b/src/lib/libcrypto/bn/asm/alpha/mul_c8.pl deleted file mode 100644 index 525ca7494b..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/mul_c8.pl +++ /dev/null | |||
| @@ -1,177 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_mul_comba8 | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 8 | |||
| 9 | $cnt=1; | ||
| 10 | &init_pool(3); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | |||
| 16 | &function_begin($name,""); | ||
| 17 | |||
| 18 | &comment(""); | ||
| 19 | |||
| 20 | &stack_push(2); | ||
| 21 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 22 | &ld(($b[0])=&NR(1),&QWPw(0,$bp)); | ||
| 23 | &st($reg_s0,&swtmp(0)); &FR($reg_s0); | ||
| 24 | &st($reg_s1,&swtmp(1)); &FR($reg_s1); | ||
| 25 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 26 | &ld(($b[1])=&NR(1),&QWPw(1,$bp)); | ||
| 27 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 28 | &ld(($b[2])=&NR(1),&QWPw(2,$bp)); | ||
| 29 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 30 | &ld(($b[3])=&NR(1),&QWPw(3,$bp)); | ||
| 31 | &ld(($a[4])=&NR(1),&QWPw(1,$ap)); | ||
| 32 | &ld(($b[4])=&NR(1),&QWPw(1,$bp)); | ||
| 33 | &ld(($a[5])=&NR(1),&QWPw(1,$ap)); | ||
| 34 | &ld(($b[5])=&NR(1),&QWPw(1,$bp)); | ||
| 35 | &ld(($a[6])=&NR(1),&QWPw(1,$ap)); | ||
| 36 | &ld(($b[6])=&NR(1),&QWPw(1,$bp)); | ||
| 37 | &ld(($a[7])=&NR(1),&QWPw(1,$ap)); &FR($ap); | ||
| 38 | &ld(($b[7])=&NR(1),&QWPw(1,$bp)); &FR($bp); | ||
| 39 | |||
| 40 | ($c0,$c1,$c2)=&NR(3); | ||
| 41 | &mov("zero",$c2); | ||
| 42 | &mul($a[0],$b[0],$c0); | ||
| 43 | &muh($a[0],$b[0],$c1); | ||
| 44 | &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 45 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | |||
| 48 | &mul_add_c($a[0],$b[1],$c0,$c1,$c2); | ||
| 49 | &mul_add_c($a[1],$b[0],$c0,$c1,$c2); | ||
| 50 | &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 51 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 52 | &mov("zero",$c2); | ||
| 53 | |||
| 54 | &mul_add_c($a[0],$b[2],$c0,$c1,$c2); | ||
| 55 | &mul_add_c($a[1],$b[1],$c0,$c1,$c2); | ||
| 56 | &mul_add_c($a[2],$b[0],$c0,$c1,$c2); | ||
| 57 | &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 58 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 59 | &mov("zero",$c2); | ||
| 60 | |||
| 61 | &mul_add_c($a[0],$b[3],$c0,$c1,$c2); | ||
| 62 | &mul_add_c($a[1],$b[2],$c0,$c1,$c2); | ||
| 63 | &mul_add_c($a[2],$b[1],$c0,$c1,$c2); | ||
| 64 | &mul_add_c($a[3],$b[0],$c0,$c1,$c2); | ||
| 65 | &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 66 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 67 | &mov("zero",$c2); | ||
| 68 | |||
| 69 | &mul_add_c($a[0],$b[4],$c0,$c1,$c2); | ||
| 70 | &mul_add_c($a[1],$b[3],$c0,$c1,$c2); | ||
| 71 | &mul_add_c($a[2],$b[2],$c0,$c1,$c2); | ||
| 72 | &mul_add_c($a[3],$b[1],$c0,$c1,$c2); | ||
| 73 | &mul_add_c($a[4],$b[0],$c0,$c1,$c2); | ||
| 74 | &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 75 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 76 | &mov("zero",$c2); | ||
| 77 | |||
| 78 | &mul_add_c($a[0],$b[5],$c0,$c1,$c2); | ||
| 79 | &mul_add_c($a[1],$b[4],$c0,$c1,$c2); | ||
| 80 | &mul_add_c($a[2],$b[3],$c0,$c1,$c2); | ||
| 81 | &mul_add_c($a[3],$b[2],$c0,$c1,$c2); | ||
| 82 | &mul_add_c($a[4],$b[1],$c0,$c1,$c2); | ||
| 83 | &mul_add_c($a[5],$b[0],$c0,$c1,$c2); | ||
| 84 | &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 85 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 86 | &mov("zero",$c2); | ||
| 87 | |||
| 88 | &mul_add_c($a[0],$b[6],$c0,$c1,$c2); | ||
| 89 | &mul_add_c($a[1],$b[5],$c0,$c1,$c2); | ||
| 90 | &mul_add_c($a[2],$b[4],$c0,$c1,$c2); | ||
| 91 | &mul_add_c($a[3],$b[3],$c0,$c1,$c2); | ||
| 92 | &mul_add_c($a[4],$b[2],$c0,$c1,$c2); | ||
| 93 | &mul_add_c($a[5],$b[1],$c0,$c1,$c2); | ||
| 94 | &mul_add_c($a[6],$b[0],$c0,$c1,$c2); | ||
| 95 | &st($c0,&QWPw(6,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 96 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 97 | &mov("zero",$c2); | ||
| 98 | |||
| 99 | &mul_add_c($a[0],$b[7],$c0,$c1,$c2); &FR($a[0]); | ||
| 100 | &mul_add_c($a[1],$b[6],$c0,$c1,$c2); | ||
| 101 | &mul_add_c($a[2],$b[5],$c0,$c1,$c2); | ||
| 102 | &mul_add_c($a[3],$b[4],$c0,$c1,$c2); | ||
| 103 | &mul_add_c($a[4],$b[3],$c0,$c1,$c2); | ||
| 104 | &mul_add_c($a[5],$b[2],$c0,$c1,$c2); | ||
| 105 | &mul_add_c($a[6],$b[1],$c0,$c1,$c2); | ||
| 106 | &mul_add_c($a[7],$b[0],$c0,$c1,$c2); &FR($b[0]); | ||
| 107 | &st($c0,&QWPw(7,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 108 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 109 | &mov("zero",$c2); | ||
| 110 | |||
| 111 | &mul_add_c($a[1],$b[7],$c0,$c1,$c2); &FR($a[1]); | ||
| 112 | &mul_add_c($a[2],$b[6],$c0,$c1,$c2); | ||
| 113 | &mul_add_c($a[3],$b[5],$c0,$c1,$c2); | ||
| 114 | &mul_add_c($a[4],$b[4],$c0,$c1,$c2); | ||
| 115 | &mul_add_c($a[5],$b[3],$c0,$c1,$c2); | ||
| 116 | &mul_add_c($a[6],$b[2],$c0,$c1,$c2); | ||
| 117 | &mul_add_c($a[7],$b[1],$c0,$c1,$c2); &FR($b[1]); | ||
| 118 | &st($c0,&QWPw(8,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 119 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 120 | &mov("zero",$c2); | ||
| 121 | |||
| 122 | &mul_add_c($a[2],$b[7],$c0,$c1,$c2); &FR($a[2]); | ||
| 123 | &mul_add_c($a[3],$b[6],$c0,$c1,$c2); | ||
| 124 | &mul_add_c($a[4],$b[5],$c0,$c1,$c2); | ||
| 125 | &mul_add_c($a[5],$b[4],$c0,$c1,$c2); | ||
| 126 | &mul_add_c($a[6],$b[3],$c0,$c1,$c2); | ||
| 127 | &mul_add_c($a[7],$b[2],$c0,$c1,$c2); &FR($b[2]); | ||
| 128 | &st($c0,&QWPw(9,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 129 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 130 | &mov("zero",$c2); | ||
| 131 | |||
| 132 | &mul_add_c($a[3],$b[7],$c0,$c1,$c2); &FR($a[3]); | ||
| 133 | &mul_add_c($a[4],$b[6],$c0,$c1,$c2); | ||
| 134 | &mul_add_c($a[5],$b[5],$c0,$c1,$c2); | ||
| 135 | &mul_add_c($a[6],$b[4],$c0,$c1,$c2); | ||
| 136 | &mul_add_c($a[7],$b[3],$c0,$c1,$c2); &FR($b[3]); | ||
| 137 | &st($c0,&QWPw(10,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 138 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 139 | &mov("zero",$c2); | ||
| 140 | |||
| 141 | &mul_add_c($a[4],$b[7],$c0,$c1,$c2); &FR($a[4]); | ||
| 142 | &mul_add_c($a[5],$b[6],$c0,$c1,$c2); | ||
| 143 | &mul_add_c($a[6],$b[5],$c0,$c1,$c2); | ||
| 144 | &mul_add_c($a[7],$b[4],$c0,$c1,$c2); &FR($b[4]); | ||
| 145 | &st($c0,&QWPw(11,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 146 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 147 | &mov("zero",$c2); | ||
| 148 | |||
| 149 | &mul_add_c($a[5],$b[7],$c0,$c1,$c2); &FR($a[5]); | ||
| 150 | &mul_add_c($a[6],$b[6],$c0,$c1,$c2); | ||
| 151 | &mul_add_c($a[7],$b[5],$c0,$c1,$c2); &FR($b[5]); | ||
| 152 | &st($c0,&QWPw(12,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 153 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 154 | &mov("zero",$c2); | ||
| 155 | |||
| 156 | &mul_add_c($a[6],$b[7],$c0,$c1,$c2); &FR($a[6]); | ||
| 157 | &mul_add_c($a[7],$b[6],$c0,$c1,$c2); &FR($b[6]); | ||
| 158 | &st($c0,&QWPw(13,$rp)); &FR($c0); ($c0)=&NR(1); | ||
| 159 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 160 | &mov("zero",$c2); | ||
| 161 | |||
| 162 | &mul_add_c($a[7],$b[7],$c0,$c1,$c2); &FR($a[7],$b[7]); | ||
| 163 | &st($c0,&QWPw(14,$rp)); | ||
| 164 | &st($c1,&QWPw(15,$rp)); | ||
| 165 | |||
| 166 | &FR($c0,$c1,$c2); | ||
| 167 | |||
| 168 | &ld($reg_s0,&swtmp(0)); | ||
| 169 | &ld($reg_s1,&swtmp(1)); | ||
| 170 | &stack_pop(2); | ||
| 171 | |||
| 172 | &function_end($name); | ||
| 173 | |||
| 174 | &fin_pool; | ||
| 175 | } | ||
| 176 | |||
| 177 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/sqr.pl b/src/lib/libcrypto/bn/asm/alpha/sqr.pl deleted file mode 100644 index a55b696906..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/sqr.pl +++ /dev/null | |||
| @@ -1,113 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sqr_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r,$couny); | ||
| 8 | |||
| 9 | &init_pool(3); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $count=&wparam(2); | ||
| 15 | |||
| 16 | &function_begin($name,""); | ||
| 17 | |||
| 18 | &comment(""); | ||
| 19 | &sub($count,4,$count); | ||
| 20 | &mov("zero",$cc); | ||
| 21 | &br(&label("finish")); | ||
| 22 | &blt($count,&label("finish")); | ||
| 23 | |||
| 24 | ($a0,$r0)=&NR(2); | ||
| 25 | &ld($a0,&QWPw(0,$ap)); | ||
| 26 | &ld($r0,&QWPw(0,$rp)); | ||
| 27 | |||
| 28 | $a=<<'EOF'; | ||
| 29 | ########################################################## | ||
| 30 | &set_label("loop"); | ||
| 31 | |||
| 32 | ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap)); | ||
| 33 | ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp)); | ||
| 34 | ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap)); | ||
| 35 | ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp)); | ||
| 36 | ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap)); | ||
| 37 | ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp)); | ||
| 38 | |||
| 39 | ($o0,$t0)=&NR(2); | ||
| 40 | &add($a0,$b0,$o0); | ||
| 41 | &cmpult($o0,$b0,$t0); | ||
| 42 | &add($o0,$cc,$o0); | ||
| 43 | &cmpult($o0,$cc,$cc); | ||
| 44 | &add($cc,$t0,$cc); &FR($t0); | ||
| 45 | |||
| 46 | ($t1,$o1)=&NR(2); | ||
| 47 | |||
| 48 | &add($a1,$b1,$o1); &FR($a1); | ||
| 49 | &cmpult($o1,$b1,$t1); &FR($b1); | ||
| 50 | &add($o1,$cc,$o1); | ||
| 51 | &cmpult($o1,$cc,$cc); | ||
| 52 | &add($cc,$t1,$cc); &FR($t1); | ||
| 53 | |||
| 54 | ($t2,$o2)=&NR(2); | ||
| 55 | |||
| 56 | &add($a2,$b2,$o2); &FR($a2); | ||
| 57 | &cmpult($o2,$b2,$t2); &FR($b2); | ||
| 58 | &add($o2,$cc,$o2); | ||
| 59 | &cmpult($o2,$cc,$cc); | ||
| 60 | &add($cc,$t2,$cc); &FR($t2); | ||
| 61 | |||
| 62 | ($t3,$o3)=&NR(2); | ||
| 63 | |||
| 64 | &add($a3,$b3,$o3); &FR($a3); | ||
| 65 | &cmpult($o3,$b3,$t3); &FR($b3); | ||
| 66 | &add($o3,$cc,$o3); | ||
| 67 | &cmpult($o3,$cc,$cc); | ||
| 68 | &add($cc,$t3,$cc); &FR($t3); | ||
| 69 | |||
| 70 | &st($o0,&QWPw(0,$rp)); &FR($o0); | ||
| 71 | &st($o1,&QWPw(0,$rp)); &FR($o1); | ||
| 72 | &st($o2,&QWPw(0,$rp)); &FR($o2); | ||
| 73 | &st($o3,&QWPw(0,$rp)); &FR($o3); | ||
| 74 | |||
| 75 | &sub($count,4,$count); # count-=4 | ||
| 76 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 77 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 78 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 79 | |||
| 80 | &blt($count,&label("finish")); | ||
| 81 | &ld($a0,&QWPw(0,$ap)); | ||
| 82 | &ld($b0,&QWPw(0,$bp)); | ||
| 83 | &br(&label("loop")); | ||
| 84 | EOF | ||
| 85 | ################################################## | ||
| 86 | # Do the last 0..3 words | ||
| 87 | |||
| 88 | &set_label("last_loop"); | ||
| 89 | |||
| 90 | &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a | ||
| 91 | &mul($a0,$a0,($l0)=&NR(1)); | ||
| 92 | &add($ap,$QWS,$ap); | ||
| 93 | &add($rp,2*$QWS,$rp); | ||
| 94 | &sub($count,1,$count); | ||
| 95 | &muh($a0,$a0,($h0)=&NR(1)); &FR($a0); | ||
| 96 | &st($l0,&QWPw(-2,$rp)); &FR($l0); | ||
| 97 | &st($h0,&QWPw(-1,$rp)); &FR($h0); | ||
| 98 | |||
| 99 | &bgt($count,&label("last_loop")); | ||
| 100 | &function_end_A($name); | ||
| 101 | |||
| 102 | ###################################################### | ||
| 103 | &set_label("finish"); | ||
| 104 | &add($count,4,$count); | ||
| 105 | &bgt($count,&label("last_loop")); | ||
| 106 | |||
| 107 | &set_label("end"); | ||
| 108 | &function_end($name); | ||
| 109 | |||
| 110 | &fin_pool; | ||
| 111 | } | ||
| 112 | |||
| 113 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/sqr_c4.pl b/src/lib/libcrypto/bn/asm/alpha/sqr_c4.pl deleted file mode 100644 index bf33f5b503..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/sqr_c4.pl +++ /dev/null | |||
| @@ -1,109 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub sqr_add_c | ||
| 5 | { | ||
| 6 | local($a,$c0,$c1,$c2)=@_; | ||
| 7 | local($l1,$h1,$t1,$t2); | ||
| 8 | |||
| 9 | &mul($a,$a,($l1)=&NR(1)); | ||
| 10 | &muh($a,$a,($h1)=&NR(1)); | ||
| 11 | &add($c0,$l1,$c0); | ||
| 12 | &add($c1,$h1,$c1); | ||
| 13 | &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1); | ||
| 14 | &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1); | ||
| 15 | &add($c1,$t1,$c1); &FR($t1); | ||
| 16 | &add($c2,$t2,$c2); &FR($t2); | ||
| 17 | } | ||
| 18 | |||
| 19 | sub sqr_add_c2 | ||
| 20 | { | ||
| 21 | local($a,$b,$c0,$c1,$c2)=@_; | ||
| 22 | local($l1,$h1,$t1,$t2); | ||
| 23 | |||
| 24 | &mul($a,$b,($l1)=&NR(1)); | ||
| 25 | &muh($a,$b,($h1)=&NR(1)); | ||
| 26 | &cmplt($l1,"zero",($lc1)=&NR(1)); | ||
| 27 | &cmplt($h1,"zero",($hc1)=&NR(1)); | ||
| 28 | &add($l1,$l1,$l1); | ||
| 29 | &add($h1,$h1,$h1); | ||
| 30 | &add($h1,$lc1,$h1); &FR($lc1); | ||
| 31 | &add($c2,$hc1,$c2); &FR($hc1); | ||
| 32 | |||
| 33 | &add($c0,$l1,$c0); | ||
| 34 | &add($c1,$h1,$c1); | ||
| 35 | &cmpult($c0,$l1,($lc1)=&NR(1)); &FR($l1); | ||
| 36 | &cmpult($c1,$h1,($hc1)=&NR(1)); &FR($h1); | ||
| 37 | |||
| 38 | &add($c1,$lc1,$c1); &FR($lc1); | ||
| 39 | &add($c2,$hc1,$c2); &FR($hc1); | ||
| 40 | } | ||
| 41 | |||
| 42 | |||
| 43 | sub bn_sqr_comba4 | ||
| 44 | { | ||
| 45 | local($name)=@_; | ||
| 46 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 47 | |||
| 48 | $cnt=1; | ||
| 49 | &init_pool(2); | ||
| 50 | |||
| 51 | $rp=&wparam(0); | ||
| 52 | $ap=&wparam(1); | ||
| 53 | |||
| 54 | &function_begin($name,""); | ||
| 55 | |||
| 56 | &comment(""); | ||
| 57 | |||
| 58 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 59 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 60 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 61 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap); | ||
| 62 | |||
| 63 | ($c0,$c1,$c2)=&NR(3); | ||
| 64 | |||
| 65 | &mov("zero",$c2); | ||
| 66 | &mul($a[0],$a[0],$c0); | ||
| 67 | &muh($a[0],$a[0],$c1); | ||
| 68 | &st($c0,&QWPw(0,$rp)); | ||
| 69 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 70 | &mov("zero",$c2); | ||
| 71 | |||
| 72 | &sqr_add_c2($a[0],$a[1],$c0,$c1,$c2); | ||
| 73 | &st($c0,&QWPw(1,$rp)); | ||
| 74 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 75 | &mov("zero",$c2); | ||
| 76 | |||
| 77 | &sqr_add_c($a[1],$c0,$c1,$c2); | ||
| 78 | &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2); | ||
| 79 | &st($c0,&QWPw(2,$rp)); | ||
| 80 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 81 | &mov("zero",$c2); | ||
| 82 | |||
| 83 | &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2); | ||
| 84 | &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2); | ||
| 85 | &st($c0,&QWPw(3,$rp)); | ||
| 86 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 87 | &mov("zero",$c2); | ||
| 88 | |||
| 89 | &sqr_add_c($a[2],$c0,$c1,$c2); | ||
| 90 | &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2); | ||
| 91 | &st($c0,&QWPw(4,$rp)); | ||
| 92 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 93 | &mov("zero",$c2); | ||
| 94 | |||
| 95 | &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2); | ||
| 96 | &st($c0,&QWPw(5,$rp)); | ||
| 97 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 98 | &mov("zero",$c2); | ||
| 99 | |||
| 100 | &sqr_add_c($a[3],$c0,$c1,$c2); | ||
| 101 | &st($c0,&QWPw(6,$rp)); | ||
| 102 | &st($c1,&QWPw(7,$rp)); | ||
| 103 | |||
| 104 | &function_end($name); | ||
| 105 | |||
| 106 | &fin_pool; | ||
| 107 | } | ||
| 108 | |||
| 109 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/sqr_c8.pl b/src/lib/libcrypto/bn/asm/alpha/sqr_c8.pl deleted file mode 100644 index b4afe085f1..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/sqr_c8.pl +++ /dev/null | |||
| @@ -1,132 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sqr_comba8 | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local(@a,@b,$r,$c0,$c1,$c2); | ||
| 8 | |||
| 9 | $cnt=1; | ||
| 10 | &init_pool(2); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | |||
| 15 | &function_begin($name,""); | ||
| 16 | |||
| 17 | &comment(""); | ||
| 18 | |||
| 19 | &ld(($a[0])=&NR(1),&QWPw(0,$ap)); | ||
| 20 | &ld(($a[1])=&NR(1),&QWPw(1,$ap)); | ||
| 21 | &ld(($a[2])=&NR(1),&QWPw(2,$ap)); | ||
| 22 | &ld(($a[3])=&NR(1),&QWPw(3,$ap)); | ||
| 23 | &ld(($a[4])=&NR(1),&QWPw(4,$ap)); | ||
| 24 | &ld(($a[5])=&NR(1),&QWPw(5,$ap)); | ||
| 25 | &ld(($a[6])=&NR(1),&QWPw(6,$ap)); | ||
| 26 | &ld(($a[7])=&NR(1),&QWPw(7,$ap)); &FR($ap); | ||
| 27 | |||
| 28 | ($c0,$c1,$c2)=&NR(3); | ||
| 29 | |||
| 30 | &mov("zero",$c2); | ||
| 31 | &mul($a[0],$a[0],$c0); | ||
| 32 | &muh($a[0],$a[0],$c1); | ||
| 33 | &st($c0,&QWPw(0,$rp)); | ||
| 34 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 35 | &mov("zero",$c2); | ||
| 36 | |||
| 37 | &sqr_add_c2($a[1],$a[0],$c0,$c1,$c2); | ||
| 38 | &st($c0,&QWPw(1,$rp)); | ||
| 39 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 40 | &mov("zero",$c2); | ||
| 41 | |||
| 42 | &sqr_add_c($a[1],$c0,$c1,$c2); | ||
| 43 | &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2); | ||
| 44 | &st($c0,&QWPw(2,$rp)); | ||
| 45 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 46 | &mov("zero",$c2); | ||
| 47 | |||
| 48 | &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2); | ||
| 49 | &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2); | ||
| 50 | &st($c0,&QWPw(3,$rp)); | ||
| 51 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 52 | &mov("zero",$c2); | ||
| 53 | |||
| 54 | &sqr_add_c($a[2],$c0,$c1,$c2); | ||
| 55 | &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2); | ||
| 56 | &sqr_add_c2($a[4],$a[0],$c0,$c1,$c2); | ||
| 57 | &st($c0,&QWPw(4,$rp)); | ||
| 58 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 59 | &mov("zero",$c2); | ||
| 60 | |||
| 61 | &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2); | ||
| 62 | &sqr_add_c2($a[4],$a[1],$c0,$c1,$c2); | ||
| 63 | &sqr_add_c2($a[5],$a[0],$c0,$c1,$c2); | ||
| 64 | &st($c0,&QWPw(5,$rp)); | ||
| 65 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 66 | &mov("zero",$c2); | ||
| 67 | |||
| 68 | &sqr_add_c($a[3],$c0,$c1,$c2); | ||
| 69 | &sqr_add_c2($a[4],$a[2],$c0,$c1,$c2); | ||
| 70 | &sqr_add_c2($a[5],$a[1],$c0,$c1,$c2); | ||
| 71 | &sqr_add_c2($a[6],$a[0],$c0,$c1,$c2); | ||
| 72 | &st($c0,&QWPw(6,$rp)); | ||
| 73 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 74 | &mov("zero",$c2); | ||
| 75 | |||
| 76 | &sqr_add_c2($a[4],$a[3],$c0,$c1,$c2); | ||
| 77 | &sqr_add_c2($a[5],$a[2],$c0,$c1,$c2); | ||
| 78 | &sqr_add_c2($a[6],$a[1],$c0,$c1,$c2); | ||
| 79 | &sqr_add_c2($a[7],$a[0],$c0,$c1,$c2); | ||
| 80 | &st($c0,&QWPw(7,$rp)); | ||
| 81 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 82 | &mov("zero",$c2); | ||
| 83 | |||
| 84 | &sqr_add_c($a[4],$c0,$c1,$c2); | ||
| 85 | &sqr_add_c2($a[5],$a[3],$c0,$c1,$c2); | ||
| 86 | &sqr_add_c2($a[6],$a[2],$c0,$c1,$c2); | ||
| 87 | &sqr_add_c2($a[7],$a[1],$c0,$c1,$c2); | ||
| 88 | &st($c0,&QWPw(8,$rp)); | ||
| 89 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 90 | &mov("zero",$c2); | ||
| 91 | |||
| 92 | &sqr_add_c2($a[5],$a[4],$c0,$c1,$c2); | ||
| 93 | &sqr_add_c2($a[6],$a[3],$c0,$c1,$c2); | ||
| 94 | &sqr_add_c2($a[7],$a[2],$c0,$c1,$c2); | ||
| 95 | &st($c0,&QWPw(9,$rp)); | ||
| 96 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 97 | &mov("zero",$c2); | ||
| 98 | |||
| 99 | &sqr_add_c($a[5],$c0,$c1,$c2); | ||
| 100 | &sqr_add_c2($a[6],$a[4],$c0,$c1,$c2); | ||
| 101 | &sqr_add_c2($a[7],$a[3],$c0,$c1,$c2); | ||
| 102 | &st($c0,&QWPw(10,$rp)); | ||
| 103 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 104 | &mov("zero",$c2); | ||
| 105 | |||
| 106 | &sqr_add_c2($a[6],$a[5],$c0,$c1,$c2); | ||
| 107 | &sqr_add_c2($a[7],$a[4],$c0,$c1,$c2); | ||
| 108 | &st($c0,&QWPw(11,$rp)); | ||
| 109 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 110 | &mov("zero",$c2); | ||
| 111 | |||
| 112 | &sqr_add_c($a[6],$c0,$c1,$c2); | ||
| 113 | &sqr_add_c2($a[7],$a[5],$c0,$c1,$c2); | ||
| 114 | &st($c0,&QWPw(12,$rp)); | ||
| 115 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 116 | &mov("zero",$c2); | ||
| 117 | |||
| 118 | &sqr_add_c2($a[7],$a[6],$c0,$c1,$c2); | ||
| 119 | &st($c0,&QWPw(13,$rp)); | ||
| 120 | ($c0,$c1,$c2)=($c1,$c2,$c0); | ||
| 121 | &mov("zero",$c2); | ||
| 122 | |||
| 123 | &sqr_add_c($a[7],$c0,$c1,$c2); | ||
| 124 | &st($c0,&QWPw(14,$rp)); | ||
| 125 | &st($c1,&QWPw(15,$rp)); | ||
| 126 | |||
| 127 | &function_end($name); | ||
| 128 | |||
| 129 | &fin_pool; | ||
| 130 | } | ||
| 131 | |||
| 132 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/alpha/sub.pl b/src/lib/libcrypto/bn/asm/alpha/sub.pl deleted file mode 100644 index d998da5c21..0000000000 --- a/src/lib/libcrypto/bn/asm/alpha/sub.pl +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # alpha assember | ||
| 3 | |||
| 4 | sub bn_sub_words | ||
| 5 | { | ||
| 6 | local($name)=@_; | ||
| 7 | local($cc,$a,$b,$r); | ||
| 8 | |||
| 9 | &init_pool(4); | ||
| 10 | ($cc)=GR("r0"); | ||
| 11 | |||
| 12 | $rp=&wparam(0); | ||
| 13 | $ap=&wparam(1); | ||
| 14 | $bp=&wparam(2); | ||
| 15 | $count=&wparam(3); | ||
| 16 | |||
| 17 | &function_begin($name,""); | ||
| 18 | |||
| 19 | &comment(""); | ||
| 20 | &sub($count,4,$count); | ||
| 21 | &mov("zero",$cc); | ||
| 22 | &blt($count,&label("finish")); | ||
| 23 | |||
| 24 | ($a0,$b0)=&NR(2); | ||
| 25 | &ld($a0,&QWPw(0,$ap)); | ||
| 26 | &ld($b0,&QWPw(0,$bp)); | ||
| 27 | |||
| 28 | ########################################################## | ||
| 29 | &set_label("loop"); | ||
| 30 | |||
| 31 | ($a1,$tmp,$b1,$a2,$b2,$a3,$b3,$o0)=&NR(8); | ||
| 32 | &ld($a1,&QWPw(1,$ap)); | ||
| 33 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 34 | &ld($b1,&QWPw(1,$bp)); | ||
| 35 | &sub($a0,$b0,$a0); # do the subtract | ||
| 36 | &ld($a2,&QWPw(2,$ap)); | ||
| 37 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 38 | &ld($b2,&QWPw(2,$bp)); | ||
| 39 | &sub($a0,$cc,$o0); # will we borrow? | ||
| 40 | &ld($a3,&QWPw(3,$ap)); | ||
| 41 | &add($b0,$tmp,$cc); ($t1,$o1)=&NR(2); &FR($tmp); | ||
| 42 | |||
| 43 | &cmpult($a1,$b1,$t1); # will we borrow? | ||
| 44 | &sub($a1,$b1,$a1); # do the subtract | ||
| 45 | &ld($b3,&QWPw(3,$bp)); | ||
| 46 | &cmpult($a1,$cc,$b1); # will we borrow? | ||
| 47 | &sub($a1,$cc,$o1); # will we borrow? | ||
| 48 | &add($b1,$t1,$cc); ($tmp,$o2)=&NR(2); &FR($t1,$a1,$b1); | ||
| 49 | |||
| 50 | &cmpult($a2,$b2,$tmp); # will we borrow? | ||
| 51 | &sub($a2,$b2,$a2); # do the subtract | ||
| 52 | &st($o0,&QWPw(0,$rp)); &FR($o0); # save | ||
| 53 | &cmpult($a2,$cc,$b2); # will we borrow? | ||
| 54 | &sub($a2,$cc,$o2); # will we borrow? | ||
| 55 | &add($b2,$tmp,$cc); ($t3,$o3)=&NR(2); &FR($tmp,$a2,$b2); | ||
| 56 | |||
| 57 | &cmpult($a3,$b3,$t3); # will we borrow? | ||
| 58 | &sub($a3,$b3,$a3); # do the subtract | ||
| 59 | &st($o1,&QWPw(1,$rp)); &FR($o1); | ||
| 60 | &cmpult($a3,$cc,$b3); # will we borrow? | ||
| 61 | &sub($a3,$cc,$o3); # will we borrow? | ||
| 62 | &add($b3,$t3,$cc); &FR($t3,$a3,$b3); | ||
| 63 | |||
| 64 | &st($o2,&QWPw(2,$rp)); &FR($o2); | ||
| 65 | &sub($count,4,$count); # count-=4 | ||
| 66 | &st($o3,&QWPw(3,$rp)); &FR($o3); | ||
| 67 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 68 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 69 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 70 | |||
| 71 | &blt($count,&label("finish")); | ||
| 72 | &ld($a0,&QWPw(0,$ap)); | ||
| 73 | &ld($b0,&QWPw(0,$bp)); | ||
| 74 | &br(&label("loop")); | ||
| 75 | ################################################## | ||
| 76 | # Do the last 0..3 words | ||
| 77 | |||
| 78 | &set_label("last_loop"); | ||
| 79 | |||
| 80 | &ld($a0,&QWPw(0,$ap)); # get a | ||
| 81 | &ld($b0,&QWPw(0,$bp)); # get b | ||
| 82 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 83 | &sub($a0,$b0,$a0); # do the subtract | ||
| 84 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 85 | &sub($a0,$cc,$a0); # will we borrow? | ||
| 86 | &st($a0,&QWPw(0,$rp)); # save | ||
| 87 | &add($b0,$tmp,$cc); # add the borrows | ||
| 88 | |||
| 89 | &add($ap,$QWS,$ap); | ||
| 90 | &add($bp,$QWS,$bp); | ||
| 91 | &add($rp,$QWS,$rp); | ||
| 92 | &sub($count,1,$count); | ||
| 93 | &bgt($count,&label("last_loop")); | ||
| 94 | &function_end_A($name); | ||
| 95 | |||
| 96 | ###################################################### | ||
| 97 | &set_label("finish"); | ||
| 98 | &add($count,4,$count); | ||
| 99 | &bgt($count,&label("last_loop")); | ||
| 100 | |||
| 101 | &FR($a0,$b0); | ||
| 102 | &set_label("end"); | ||
| 103 | &function_end($name); | ||
| 104 | |||
| 105 | &fin_pool; | ||
| 106 | } | ||
| 107 | |||
| 108 | 1; | ||
diff --git a/src/lib/libcrypto/bn/asm/bn-586.pl b/src/lib/libcrypto/bn/asm/bn-586.pl index 26c2685a72..332ef3e91d 100644 --- a/src/lib/libcrypto/bn/asm/bn-586.pl +++ b/src/lib/libcrypto/bn/asm/bn-586.pl | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #!/usr/local/bin/perl | 1 | #!/usr/local/bin/perl |
| 2 | 2 | ||
| 3 | push(@INC,"perlasm","../../perlasm"); | 3 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 4 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 4 | require "x86asm.pl"; | 5 | require "x86asm.pl"; |
| 5 | 6 | ||
| 6 | &asm_init($ARGV[0],$0); | 7 | &asm_init($ARGV[0],$0); |
| @@ -24,38 +25,25 @@ sub bn_mul_add_words | |||
| 24 | { | 25 | { |
| 25 | local($name)=@_; | 26 | local($name)=@_; |
| 26 | 27 | ||
| 27 | &function_begin($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":""); | 28 | &function_begin_B($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":""); |
| 28 | 29 | ||
| 29 | &comment(""); | 30 | $r="eax"; |
| 30 | $Low="eax"; | 31 | $a="edx"; |
| 31 | $High="edx"; | 32 | $c="ecx"; |
| 32 | $a="ebx"; | ||
| 33 | $w="ebp"; | ||
| 34 | $r="edi"; | ||
| 35 | $c="esi"; | ||
| 36 | |||
| 37 | &xor($c,$c); # clear carry | ||
| 38 | &mov($r,&wparam(0)); # | ||
| 39 | |||
| 40 | &mov("ecx",&wparam(2)); # | ||
| 41 | &mov($a,&wparam(1)); # | ||
| 42 | |||
| 43 | &and("ecx",0xfffffff8); # num / 8 | ||
| 44 | &mov($w,&wparam(3)); # | ||
| 45 | |||
| 46 | &push("ecx"); # Up the stack for a tmp variable | ||
| 47 | |||
| 48 | &jz(&label("maw_finish")); | ||
| 49 | 33 | ||
| 50 | if ($sse2) { | 34 | if ($sse2) { |
| 51 | &picmeup("eax","OPENSSL_ia32cap_P"); | 35 | &picmeup("eax","OPENSSL_ia32cap_P"); |
| 52 | &bt(&DWP(0,"eax"),26); | 36 | &bt(&DWP(0,"eax"),26); |
| 53 | &jnc(&label("maw_loop")); | 37 | &jnc(&label("maw_non_sse2")); |
| 54 | 38 | ||
| 55 | &movd("mm0",$w); # mm0 = w | 39 | &mov($r,&wparam(0)); |
| 40 | &mov($a,&wparam(1)); | ||
| 41 | &mov($c,&wparam(2)); | ||
| 42 | &movd("mm0",&wparam(3)); # mm0 = w | ||
| 56 | &pxor("mm1","mm1"); # mm1 = carry_in | 43 | &pxor("mm1","mm1"); # mm1 = carry_in |
| 57 | 44 | &jmp(&label("maw_sse2_entry")); | |
| 58 | &set_label("maw_sse2_loop",0); | 45 | |
| 46 | &set_label("maw_sse2_unrolled",16); | ||
| 59 | &movd("mm3",&DWP(0,$r,"",0)); # mm3 = r[0] | 47 | &movd("mm3",&DWP(0,$r,"",0)); # mm3 = r[0] |
| 60 | &paddq("mm1","mm3"); # mm1 = carry_in + r[0] | 48 | &paddq("mm1","mm3"); # mm1 = carry_in + r[0] |
| 61 | &movd("mm2",&DWP(0,$a,"",0)); # mm2 = a[0] | 49 | &movd("mm2",&DWP(0,$a,"",0)); # mm2 = a[0] |
| @@ -112,42 +100,82 @@ sub bn_mul_add_words | |||
| 112 | &psrlq("mm1",32); # mm1 = carry6 | 100 | &psrlq("mm1",32); # mm1 = carry6 |
| 113 | &paddq("mm1","mm3"); # mm1 = carry6 + r[7] + w*a[7] | 101 | &paddq("mm1","mm3"); # mm1 = carry6 + r[7] + w*a[7] |
| 114 | &movd(&DWP(28,$r,"",0),"mm1"); | 102 | &movd(&DWP(28,$r,"",0),"mm1"); |
| 115 | &add($r,32); | 103 | &lea($r,&DWP(32,$r)); |
| 116 | &psrlq("mm1",32); # mm1 = carry_out | 104 | &psrlq("mm1",32); # mm1 = carry_out |
| 117 | 105 | ||
| 118 | &sub("ecx",8); | 106 | &sub($c,8); |
| 107 | &jz(&label("maw_sse2_exit")); | ||
| 108 | &set_label("maw_sse2_entry"); | ||
| 109 | &test($c,0xfffffff8); | ||
| 110 | &jnz(&label("maw_sse2_unrolled")); | ||
| 111 | |||
| 112 | &set_label("maw_sse2_loop",4); | ||
| 113 | &movd("mm2",&DWP(0,$a)); # mm2 = a[i] | ||
| 114 | &movd("mm3",&DWP(0,$r)); # mm3 = r[i] | ||
| 115 | &pmuludq("mm2","mm0"); # a[i] *= w | ||
| 116 | &lea($a,&DWP(4,$a)); | ||
| 117 | &paddq("mm1","mm3"); # carry += r[i] | ||
| 118 | &paddq("mm1","mm2"); # carry += a[i]*w | ||
| 119 | &movd(&DWP(0,$r),"mm1"); # r[i] = carry_low | ||
| 120 | &sub($c,1); | ||
| 121 | &psrlq("mm1",32); # carry = carry_high | ||
| 122 | &lea($r,&DWP(4,$r)); | ||
| 119 | &jnz(&label("maw_sse2_loop")); | 123 | &jnz(&label("maw_sse2_loop")); |
| 120 | 124 | &set_label("maw_sse2_exit"); | |
| 121 | &movd($c,"mm1"); # c = carry_out | 125 | &movd("eax","mm1"); # c = carry_out |
| 122 | &emms(); | 126 | &emms(); |
| 127 | &ret(); | ||
| 123 | 128 | ||
| 124 | &jmp(&label("maw_finish")); | 129 | &set_label("maw_non_sse2",16); |
| 125 | } | 130 | } |
| 126 | 131 | ||
| 127 | &set_label("maw_loop",0); | 132 | # function_begin prologue |
| 133 | &push("ebp"); | ||
| 134 | &push("ebx"); | ||
| 135 | &push("esi"); | ||
| 136 | &push("edi"); | ||
| 137 | |||
| 138 | &comment(""); | ||
| 139 | $Low="eax"; | ||
| 140 | $High="edx"; | ||
| 141 | $a="ebx"; | ||
| 142 | $w="ebp"; | ||
| 143 | $r="edi"; | ||
| 144 | $c="esi"; | ||
| 145 | |||
| 146 | &xor($c,$c); # clear carry | ||
| 147 | &mov($r,&wparam(0)); # | ||
| 148 | |||
| 149 | &mov("ecx",&wparam(2)); # | ||
| 150 | &mov($a,&wparam(1)); # | ||
| 151 | |||
| 152 | &and("ecx",0xfffffff8); # num / 8 | ||
| 153 | &mov($w,&wparam(3)); # | ||
| 128 | 154 | ||
| 129 | &mov(&swtmp(0),"ecx"); # | 155 | &push("ecx"); # Up the stack for a tmp variable |
| 156 | |||
| 157 | &jz(&label("maw_finish")); | ||
| 158 | |||
| 159 | &set_label("maw_loop",16); | ||
| 130 | 160 | ||
| 131 | for ($i=0; $i<32; $i+=4) | 161 | for ($i=0; $i<32; $i+=4) |
| 132 | { | 162 | { |
| 133 | &comment("Round $i"); | 163 | &comment("Round $i"); |
| 134 | 164 | ||
| 135 | &mov("eax",&DWP($i,$a,"",0)); # *a | 165 | &mov("eax",&DWP($i,$a)); # *a |
| 136 | &mul($w); # *a * w | 166 | &mul($w); # *a * w |
| 137 | &add("eax",$c); # L(t)+= *r | 167 | &add("eax",$c); # L(t)+= c |
| 138 | &mov($c,&DWP($i,$r,"",0)); # L(t)+= *r | ||
| 139 | &adc("edx",0); # H(t)+=carry | 168 | &adc("edx",0); # H(t)+=carry |
| 140 | &add("eax",$c); # L(t)+=c | 169 | &add("eax",&DWP($i,$r)); # L(t)+= *r |
| 141 | &adc("edx",0); # H(t)+=carry | 170 | &adc("edx",0); # H(t)+=carry |
| 142 | &mov(&DWP($i,$r,"",0),"eax"); # *r= L(t); | 171 | &mov(&DWP($i,$r),"eax"); # *r= L(t); |
| 143 | &mov($c,"edx"); # c= H(t); | 172 | &mov($c,"edx"); # c= H(t); |
| 144 | } | 173 | } |
| 145 | 174 | ||
| 146 | &comment(""); | 175 | &comment(""); |
| 147 | &mov("ecx",&swtmp(0)); # | ||
| 148 | &add($a,32); | ||
| 149 | &add($r,32); | ||
| 150 | &sub("ecx",8); | 176 | &sub("ecx",8); |
| 177 | &lea($a,&DWP(32,$a)); | ||
| 178 | &lea($r,&DWP(32,$r)); | ||
| 151 | &jnz(&label("maw_loop")); | 179 | &jnz(&label("maw_loop")); |
| 152 | 180 | ||
| 153 | &set_label("maw_finish",0); | 181 | &set_label("maw_finish",0); |
| @@ -160,16 +188,15 @@ sub bn_mul_add_words | |||
| 160 | for ($i=0; $i<7; $i++) | 188 | for ($i=0; $i<7; $i++) |
| 161 | { | 189 | { |
| 162 | &comment("Tail Round $i"); | 190 | &comment("Tail Round $i"); |
| 163 | &mov("eax",&DWP($i*4,$a,"",0));# *a | 191 | &mov("eax",&DWP($i*4,$a)); # *a |
| 164 | &mul($w); # *a * w | 192 | &mul($w); # *a * w |
| 165 | &add("eax",$c); # L(t)+=c | 193 | &add("eax",$c); # L(t)+=c |
| 166 | &mov($c,&DWP($i*4,$r,"",0)); # L(t)+= *r | ||
| 167 | &adc("edx",0); # H(t)+=carry | 194 | &adc("edx",0); # H(t)+=carry |
| 168 | &add("eax",$c); | 195 | &add("eax",&DWP($i*4,$r)); # L(t)+= *r |
| 169 | &adc("edx",0); # H(t)+=carry | 196 | &adc("edx",0); # H(t)+=carry |
| 170 | &dec("ecx") if ($i != 7-1); | 197 | &dec("ecx") if ($i != 7-1); |
| 171 | &mov(&DWP($i*4,$r,"",0),"eax"); # *r= L(t); | 198 | &mov(&DWP($i*4,$r),"eax"); # *r= L(t); |
| 172 | &mov($c,"edx"); # c= H(t); | 199 | &mov($c,"edx"); # c= H(t); |
| 173 | &jz(&label("maw_end")) if ($i != 7-1); | 200 | &jz(&label("maw_end")) if ($i != 7-1); |
| 174 | } | 201 | } |
| 175 | &set_label("maw_end",0); | 202 | &set_label("maw_end",0); |
| @@ -184,7 +211,45 @@ sub bn_mul_words | |||
| 184 | { | 211 | { |
| 185 | local($name)=@_; | 212 | local($name)=@_; |
| 186 | 213 | ||
| 187 | &function_begin($name,""); | 214 | &function_begin_B($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":""); |
| 215 | |||
| 216 | $r="eax"; | ||
| 217 | $a="edx"; | ||
| 218 | $c="ecx"; | ||
| 219 | |||
| 220 | if ($sse2) { | ||
| 221 | &picmeup("eax","OPENSSL_ia32cap_P"); | ||
| 222 | &bt(&DWP(0,"eax"),26); | ||
| 223 | &jnc(&label("mw_non_sse2")); | ||
| 224 | |||
| 225 | &mov($r,&wparam(0)); | ||
| 226 | &mov($a,&wparam(1)); | ||
| 227 | &mov($c,&wparam(2)); | ||
| 228 | &movd("mm0",&wparam(3)); # mm0 = w | ||
| 229 | &pxor("mm1","mm1"); # mm1 = carry = 0 | ||
| 230 | |||
| 231 | &set_label("mw_sse2_loop",16); | ||
| 232 | &movd("mm2",&DWP(0,$a)); # mm2 = a[i] | ||
| 233 | &pmuludq("mm2","mm0"); # a[i] *= w | ||
| 234 | &lea($a,&DWP(4,$a)); | ||
| 235 | &paddq("mm1","mm2"); # carry += a[i]*w | ||
| 236 | &movd(&DWP(0,$r),"mm1"); # r[i] = carry_low | ||
| 237 | &sub($c,1); | ||
| 238 | &psrlq("mm1",32); # carry = carry_high | ||
| 239 | &lea($r,&DWP(4,$r)); | ||
| 240 | &jnz(&label("mw_sse2_loop")); | ||
| 241 | |||
| 242 | &movd("eax","mm1"); # return carry | ||
| 243 | &emms(); | ||
| 244 | &ret(); | ||
| 245 | &set_label("mw_non_sse2",16); | ||
| 246 | } | ||
| 247 | |||
| 248 | # function_begin prologue | ||
| 249 | &push("ebp"); | ||
| 250 | &push("ebx"); | ||
| 251 | &push("esi"); | ||
| 252 | &push("edi"); | ||
| 188 | 253 | ||
| 189 | &comment(""); | 254 | &comment(""); |
| 190 | $Low="eax"; | 255 | $Low="eax"; |
| @@ -257,7 +322,40 @@ sub bn_sqr_words | |||
| 257 | { | 322 | { |
| 258 | local($name)=@_; | 323 | local($name)=@_; |
| 259 | 324 | ||
| 260 | &function_begin($name,""); | 325 | &function_begin_B($name,$sse2?"EXTRN\t_OPENSSL_ia32cap_P:DWORD":""); |
| 326 | |||
| 327 | $r="eax"; | ||
| 328 | $a="edx"; | ||
| 329 | $c="ecx"; | ||
| 330 | |||
| 331 | if ($sse2) { | ||
| 332 | &picmeup("eax","OPENSSL_ia32cap_P"); | ||
| 333 | &bt(&DWP(0,"eax"),26); | ||
| 334 | &jnc(&label("sqr_non_sse2")); | ||
| 335 | |||
| 336 | &mov($r,&wparam(0)); | ||
| 337 | &mov($a,&wparam(1)); | ||
| 338 | &mov($c,&wparam(2)); | ||
| 339 | |||
| 340 | &set_label("sqr_sse2_loop",16); | ||
| 341 | &movd("mm0",&DWP(0,$a)); # mm0 = a[i] | ||
| 342 | &pmuludq("mm0","mm0"); # a[i] *= a[i] | ||
| 343 | &lea($a,&DWP(4,$a)); # a++ | ||
| 344 | &movq(&QWP(0,$r),"mm0"); # r[i] = a[i]*a[i] | ||
| 345 | &sub($c,1); | ||
| 346 | &lea($r,&DWP(8,$r)); # r += 2 | ||
| 347 | &jnz(&label("sqr_sse2_loop")); | ||
| 348 | |||
| 349 | &emms(); | ||
| 350 | &ret(); | ||
| 351 | &set_label("sqr_non_sse2",16); | ||
| 352 | } | ||
| 353 | |||
| 354 | # function_begin prologue | ||
| 355 | &push("ebp"); | ||
| 356 | &push("ebx"); | ||
| 357 | &push("esi"); | ||
| 358 | &push("edi"); | ||
| 261 | 359 | ||
| 262 | &comment(""); | 360 | &comment(""); |
| 263 | $r="esi"; | 361 | $r="esi"; |
| @@ -313,12 +411,13 @@ sub bn_div_words | |||
| 313 | { | 411 | { |
| 314 | local($name)=@_; | 412 | local($name)=@_; |
| 315 | 413 | ||
| 316 | &function_begin($name,""); | 414 | &function_begin_B($name,""); |
| 317 | &mov("edx",&wparam(0)); # | 415 | &mov("edx",&wparam(0)); # |
| 318 | &mov("eax",&wparam(1)); # | 416 | &mov("eax",&wparam(1)); # |
| 319 | &mov("ebx",&wparam(2)); # | 417 | &mov("ecx",&wparam(2)); # |
| 320 | &div("ebx"); | 418 | &div("ecx"); |
| 321 | &function_end($name); | 419 | &ret(); |
| 420 | &function_end_B($name); | ||
| 322 | } | 421 | } |
| 323 | 422 | ||
| 324 | sub bn_add_words | 423 | sub bn_add_words |
diff --git a/src/lib/libcrypto/bn/asm/bn-alpha.pl b/src/lib/libcrypto/bn/asm/bn-alpha.pl deleted file mode 100644 index 302edf2376..0000000000 --- a/src/lib/libcrypto/bn/asm/bn-alpha.pl +++ /dev/null | |||
| @@ -1,571 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # I have this in perl so I can use more usefull register names and then convert | ||
| 3 | # them into alpha registers. | ||
| 4 | # | ||
| 5 | |||
| 6 | $d=&data(); | ||
| 7 | $d =~ s/CC/0/g; | ||
| 8 | $d =~ s/R1/1/g; | ||
| 9 | $d =~ s/R2/2/g; | ||
| 10 | $d =~ s/R3/3/g; | ||
| 11 | $d =~ s/R4/4/g; | ||
| 12 | $d =~ s/L1/5/g; | ||
| 13 | $d =~ s/L2/6/g; | ||
| 14 | $d =~ s/L3/7/g; | ||
| 15 | $d =~ s/L4/8/g; | ||
| 16 | $d =~ s/O1/22/g; | ||
| 17 | $d =~ s/O2/23/g; | ||
| 18 | $d =~ s/O3/24/g; | ||
| 19 | $d =~ s/O4/25/g; | ||
| 20 | $d =~ s/A1/20/g; | ||
| 21 | $d =~ s/A2/21/g; | ||
| 22 | $d =~ s/A3/27/g; | ||
| 23 | $d =~ s/A4/28/g; | ||
| 24 | if (0){ | ||
| 25 | } | ||
| 26 | |||
| 27 | print $d; | ||
| 28 | |||
| 29 | sub data | ||
| 30 | { | ||
| 31 | local($data)=<<'EOF'; | ||
| 32 | |||
| 33 | # DEC Alpha assember | ||
| 34 | # The bn_div_words is actually gcc output but the other parts are hand done. | ||
| 35 | # Thanks to tzeruch@ceddec.com for sending me the gcc output for | ||
| 36 | # bn_div_words. | ||
| 37 | # I've gone back and re-done most of routines. | ||
| 38 | # The key thing to remeber for the 164 CPU is that while a | ||
| 39 | # multiply operation takes 8 cycles, another one can only be issued | ||
| 40 | # after 4 cycles have elapsed. I've done modification to help | ||
| 41 | # improve this. Also, normally, a ld instruction will not be available | ||
| 42 | # for about 3 cycles. | ||
| 43 | .file 1 "bn_asm.c" | ||
| 44 | .set noat | ||
| 45 | gcc2_compiled.: | ||
| 46 | __gnu_compiled_c: | ||
| 47 | .text | ||
| 48 | .align 3 | ||
| 49 | .globl bn_mul_add_words | ||
| 50 | .ent bn_mul_add_words | ||
| 51 | bn_mul_add_words: | ||
| 52 | bn_mul_add_words..ng: | ||
| 53 | .frame $30,0,$26,0 | ||
| 54 | .prologue 0 | ||
| 55 | .align 5 | ||
| 56 | subq $18,4,$18 | ||
| 57 | bis $31,$31,$CC | ||
| 58 | blt $18,$43 # if we are -1, -2, -3 or -4 goto tail code | ||
| 59 | ldq $A1,0($17) # 1 1 | ||
| 60 | ldq $R1,0($16) # 1 1 | ||
| 61 | .align 3 | ||
| 62 | $42: | ||
| 63 | mulq $A1,$19,$L1 # 1 2 1 ###### | ||
| 64 | ldq $A2,8($17) # 2 1 | ||
| 65 | ldq $R2,8($16) # 2 1 | ||
| 66 | umulh $A1,$19,$A1 # 1 2 ###### | ||
| 67 | ldq $A3,16($17) # 3 1 | ||
| 68 | ldq $R3,16($16) # 3 1 | ||
| 69 | mulq $A2,$19,$L2 # 2 2 1 ###### | ||
| 70 | ldq $A4,24($17) # 4 1 | ||
| 71 | addq $R1,$L1,$R1 # 1 2 2 | ||
| 72 | ldq $R4,24($16) # 4 1 | ||
| 73 | umulh $A2,$19,$A2 # 2 2 ###### | ||
| 74 | cmpult $R1,$L1,$O1 # 1 2 3 1 | ||
| 75 | addq $A1,$O1,$A1 # 1 3 1 | ||
| 76 | addq $R1,$CC,$R1 # 1 2 3 1 | ||
| 77 | mulq $A3,$19,$L3 # 3 2 1 ###### | ||
| 78 | cmpult $R1,$CC,$CC # 1 2 3 2 | ||
| 79 | addq $R2,$L2,$R2 # 2 2 2 | ||
| 80 | addq $A1,$CC,$CC # 1 3 2 | ||
| 81 | cmpult $R2,$L2,$O2 # 2 2 3 1 | ||
| 82 | addq $A2,$O2,$A2 # 2 3 1 | ||
| 83 | umulh $A3,$19,$A3 # 3 2 ###### | ||
| 84 | addq $R2,$CC,$R2 # 2 2 3 1 | ||
| 85 | cmpult $R2,$CC,$CC # 2 2 3 2 | ||
| 86 | subq $18,4,$18 | ||
| 87 | mulq $A4,$19,$L4 # 4 2 1 ###### | ||
| 88 | addq $A2,$CC,$CC # 2 3 2 | ||
| 89 | addq $R3,$L3,$R3 # 3 2 2 | ||
| 90 | addq $16,32,$16 | ||
| 91 | cmpult $R3,$L3,$O3 # 3 2 3 1 | ||
| 92 | stq $R1,-32($16) # 1 2 4 | ||
| 93 | umulh $A4,$19,$A4 # 4 2 ###### | ||
| 94 | addq $A3,$O3,$A3 # 3 3 1 | ||
| 95 | addq $R3,$CC,$R3 # 3 2 3 1 | ||
| 96 | stq $R2,-24($16) # 2 2 4 | ||
| 97 | cmpult $R3,$CC,$CC # 3 2 3 2 | ||
| 98 | stq $R3,-16($16) # 3 2 4 | ||
| 99 | addq $R4,$L4,$R4 # 4 2 2 | ||
| 100 | addq $A3,$CC,$CC # 3 3 2 | ||
| 101 | cmpult $R4,$L4,$O4 # 4 2 3 1 | ||
| 102 | addq $17,32,$17 | ||
| 103 | addq $A4,$O4,$A4 # 4 3 1 | ||
| 104 | addq $R4,$CC,$R4 # 4 2 3 1 | ||
| 105 | cmpult $R4,$CC,$CC # 4 2 3 2 | ||
| 106 | stq $R4,-8($16) # 4 2 4 | ||
| 107 | addq $A4,$CC,$CC # 4 3 2 | ||
| 108 | blt $18,$43 | ||
| 109 | |||
| 110 | ldq $A1,0($17) # 1 1 | ||
| 111 | ldq $R1,0($16) # 1 1 | ||
| 112 | |||
| 113 | br $42 | ||
| 114 | |||
| 115 | .align 4 | ||
| 116 | $45: | ||
| 117 | ldq $A1,0($17) # 4 1 | ||
| 118 | ldq $R1,0($16) # 4 1 | ||
| 119 | mulq $A1,$19,$L1 # 4 2 1 | ||
| 120 | subq $18,1,$18 | ||
| 121 | addq $16,8,$16 | ||
| 122 | addq $17,8,$17 | ||
| 123 | umulh $A1,$19,$A1 # 4 2 | ||
| 124 | addq $R1,$L1,$R1 # 4 2 2 | ||
| 125 | cmpult $R1,$L1,$O1 # 4 2 3 1 | ||
| 126 | addq $A1,$O1,$A1 # 4 3 1 | ||
| 127 | addq $R1,$CC,$R1 # 4 2 3 1 | ||
| 128 | cmpult $R1,$CC,$CC # 4 2 3 2 | ||
| 129 | addq $A1,$CC,$CC # 4 3 2 | ||
| 130 | stq $R1,-8($16) # 4 2 4 | ||
| 131 | bgt $18,$45 | ||
| 132 | ret $31,($26),1 # else exit | ||
| 133 | |||
| 134 | .align 4 | ||
| 135 | $43: | ||
| 136 | addq $18,4,$18 | ||
| 137 | bgt $18,$45 # goto tail code | ||
| 138 | ret $31,($26),1 # else exit | ||
| 139 | |||
| 140 | .end bn_mul_add_words | ||
| 141 | .align 3 | ||
| 142 | .globl bn_mul_words | ||
| 143 | .ent bn_mul_words | ||
| 144 | bn_mul_words: | ||
| 145 | bn_mul_words..ng: | ||
| 146 | .frame $30,0,$26,0 | ||
| 147 | .prologue 0 | ||
| 148 | .align 5 | ||
| 149 | subq $18,4,$18 | ||
| 150 | bis $31,$31,$CC | ||
| 151 | blt $18,$143 # if we are -1, -2, -3 or -4 goto tail code | ||
| 152 | ldq $A1,0($17) # 1 1 | ||
| 153 | .align 3 | ||
| 154 | $142: | ||
| 155 | |||
| 156 | mulq $A1,$19,$L1 # 1 2 1 ##### | ||
| 157 | ldq $A2,8($17) # 2 1 | ||
| 158 | ldq $A3,16($17) # 3 1 | ||
| 159 | umulh $A1,$19,$A1 # 1 2 ##### | ||
| 160 | ldq $A4,24($17) # 4 1 | ||
| 161 | mulq $A2,$19,$L2 # 2 2 1 ##### | ||
| 162 | addq $L1,$CC,$L1 # 1 2 3 1 | ||
| 163 | subq $18,4,$18 | ||
| 164 | cmpult $L1,$CC,$CC # 1 2 3 2 | ||
| 165 | umulh $A2,$19,$A2 # 2 2 ##### | ||
| 166 | addq $A1,$CC,$CC # 1 3 2 | ||
| 167 | addq $17,32,$17 | ||
| 168 | addq $L2,$CC,$L2 # 2 2 3 1 | ||
| 169 | mulq $A3,$19,$L3 # 3 2 1 ##### | ||
| 170 | cmpult $L2,$CC,$CC # 2 2 3 2 | ||
| 171 | addq $A2,$CC,$CC # 2 3 2 | ||
| 172 | addq $16,32,$16 | ||
| 173 | umulh $A3,$19,$A3 # 3 2 ##### | ||
| 174 | stq $L1,-32($16) # 1 2 4 | ||
| 175 | mulq $A4,$19,$L4 # 4 2 1 ##### | ||
| 176 | addq $L3,$CC,$L3 # 3 2 3 1 | ||
| 177 | stq $L2,-24($16) # 2 2 4 | ||
| 178 | cmpult $L3,$CC,$CC # 3 2 3 2 | ||
| 179 | umulh $A4,$19,$A4 # 4 2 ##### | ||
| 180 | addq $A3,$CC,$CC # 3 3 2 | ||
| 181 | stq $L3,-16($16) # 3 2 4 | ||
| 182 | addq $L4,$CC,$L4 # 4 2 3 1 | ||
| 183 | cmpult $L4,$CC,$CC # 4 2 3 2 | ||
| 184 | |||
| 185 | addq $A4,$CC,$CC # 4 3 2 | ||
| 186 | |||
| 187 | stq $L4,-8($16) # 4 2 4 | ||
| 188 | |||
| 189 | blt $18,$143 | ||
| 190 | |||
| 191 | ldq $A1,0($17) # 1 1 | ||
| 192 | |||
| 193 | br $142 | ||
| 194 | |||
| 195 | .align 4 | ||
| 196 | $145: | ||
| 197 | ldq $A1,0($17) # 4 1 | ||
| 198 | mulq $A1,$19,$L1 # 4 2 1 | ||
| 199 | subq $18,1,$18 | ||
| 200 | umulh $A1,$19,$A1 # 4 2 | ||
| 201 | addq $L1,$CC,$L1 # 4 2 3 1 | ||
| 202 | addq $16,8,$16 | ||
| 203 | cmpult $L1,$CC,$CC # 4 2 3 2 | ||
| 204 | addq $17,8,$17 | ||
| 205 | addq $A1,$CC,$CC # 4 3 2 | ||
| 206 | stq $L1,-8($16) # 4 2 4 | ||
| 207 | |||
| 208 | bgt $18,$145 | ||
| 209 | ret $31,($26),1 # else exit | ||
| 210 | |||
| 211 | .align 4 | ||
| 212 | $143: | ||
| 213 | addq $18,4,$18 | ||
| 214 | bgt $18,$145 # goto tail code | ||
| 215 | ret $31,($26),1 # else exit | ||
| 216 | |||
| 217 | .end bn_mul_words | ||
| 218 | .align 3 | ||
| 219 | .globl bn_sqr_words | ||
| 220 | .ent bn_sqr_words | ||
| 221 | bn_sqr_words: | ||
| 222 | bn_sqr_words..ng: | ||
| 223 | .frame $30,0,$26,0 | ||
| 224 | .prologue 0 | ||
| 225 | |||
| 226 | subq $18,4,$18 | ||
| 227 | blt $18,$543 # if we are -1, -2, -3 or -4 goto tail code | ||
| 228 | ldq $A1,0($17) # 1 1 | ||
| 229 | .align 3 | ||
| 230 | $542: | ||
| 231 | mulq $A1,$A1,$L1 ###### | ||
| 232 | ldq $A2,8($17) # 1 1 | ||
| 233 | subq $18,4 | ||
| 234 | umulh $A1,$A1,$R1 ###### | ||
| 235 | ldq $A3,16($17) # 1 1 | ||
| 236 | mulq $A2,$A2,$L2 ###### | ||
| 237 | ldq $A4,24($17) # 1 1 | ||
| 238 | stq $L1,0($16) # r[0] | ||
| 239 | umulh $A2,$A2,$R2 ###### | ||
| 240 | stq $R1,8($16) # r[1] | ||
| 241 | mulq $A3,$A3,$L3 ###### | ||
| 242 | stq $L2,16($16) # r[0] | ||
| 243 | umulh $A3,$A3,$R3 ###### | ||
| 244 | stq $R2,24($16) # r[1] | ||
| 245 | mulq $A4,$A4,$L4 ###### | ||
| 246 | stq $L3,32($16) # r[0] | ||
| 247 | umulh $A4,$A4,$R4 ###### | ||
| 248 | stq $R3,40($16) # r[1] | ||
| 249 | |||
| 250 | addq $16,64,$16 | ||
| 251 | addq $17,32,$17 | ||
| 252 | stq $L4,-16($16) # r[0] | ||
| 253 | stq $R4,-8($16) # r[1] | ||
| 254 | |||
| 255 | blt $18,$543 | ||
| 256 | ldq $A1,0($17) # 1 1 | ||
| 257 | br $542 | ||
| 258 | |||
| 259 | $442: | ||
| 260 | ldq $A1,0($17) # a[0] | ||
| 261 | mulq $A1,$A1,$L1 # a[0]*w low part r2 | ||
| 262 | addq $16,16,$16 | ||
| 263 | addq $17,8,$17 | ||
| 264 | subq $18,1,$18 | ||
| 265 | umulh $A1,$A1,$R1 # a[0]*w high part r3 | ||
| 266 | stq $L1,-16($16) # r[0] | ||
| 267 | stq $R1,-8($16) # r[1] | ||
| 268 | |||
| 269 | bgt $18,$442 | ||
| 270 | ret $31,($26),1 # else exit | ||
| 271 | |||
| 272 | .align 4 | ||
| 273 | $543: | ||
| 274 | addq $18,4,$18 | ||
| 275 | bgt $18,$442 # goto tail code | ||
| 276 | ret $31,($26),1 # else exit | ||
| 277 | .end bn_sqr_words | ||
| 278 | |||
| 279 | .align 3 | ||
| 280 | .globl bn_add_words | ||
| 281 | .ent bn_add_words | ||
| 282 | bn_add_words: | ||
| 283 | bn_add_words..ng: | ||
| 284 | .frame $30,0,$26,0 | ||
| 285 | .prologue 0 | ||
| 286 | |||
| 287 | subq $19,4,$19 | ||
| 288 | bis $31,$31,$CC # carry = 0 | ||
| 289 | blt $19,$900 | ||
| 290 | ldq $L1,0($17) # a[0] | ||
| 291 | ldq $R1,0($18) # b[1] | ||
| 292 | .align 3 | ||
| 293 | $901: | ||
| 294 | addq $R1,$L1,$R1 # r=a+b; | ||
| 295 | ldq $L2,8($17) # a[1] | ||
| 296 | cmpult $R1,$L1,$O1 # did we overflow? | ||
| 297 | ldq $R2,8($18) # b[1] | ||
| 298 | addq $R1,$CC,$R1 # c+= overflow | ||
| 299 | ldq $L3,16($17) # a[2] | ||
| 300 | cmpult $R1,$CC,$CC # overflow? | ||
| 301 | ldq $R3,16($18) # b[2] | ||
| 302 | addq $CC,$O1,$CC | ||
| 303 | ldq $L4,24($17) # a[3] | ||
| 304 | addq $R2,$L2,$R2 # r=a+b; | ||
| 305 | ldq $R4,24($18) # b[3] | ||
| 306 | cmpult $R2,$L2,$O2 # did we overflow? | ||
| 307 | addq $R3,$L3,$R3 # r=a+b; | ||
| 308 | addq $R2,$CC,$R2 # c+= overflow | ||
| 309 | cmpult $R3,$L3,$O3 # did we overflow? | ||
| 310 | cmpult $R2,$CC,$CC # overflow? | ||
| 311 | addq $R4,$L4,$R4 # r=a+b; | ||
| 312 | addq $CC,$O2,$CC | ||
| 313 | cmpult $R4,$L4,$O4 # did we overflow? | ||
| 314 | addq $R3,$CC,$R3 # c+= overflow | ||
| 315 | stq $R1,0($16) # r[0]=c | ||
| 316 | cmpult $R3,$CC,$CC # overflow? | ||
| 317 | stq $R2,8($16) # r[1]=c | ||
| 318 | addq $CC,$O3,$CC | ||
| 319 | stq $R3,16($16) # r[2]=c | ||
| 320 | addq $R4,$CC,$R4 # c+= overflow | ||
| 321 | subq $19,4,$19 # loop-- | ||
| 322 | cmpult $R4,$CC,$CC # overflow? | ||
| 323 | addq $17,32,$17 # a++ | ||
| 324 | addq $CC,$O4,$CC | ||
| 325 | stq $R4,24($16) # r[3]=c | ||
| 326 | addq $18,32,$18 # b++ | ||
| 327 | addq $16,32,$16 # r++ | ||
| 328 | |||
| 329 | blt $19,$900 | ||
| 330 | ldq $L1,0($17) # a[0] | ||
| 331 | ldq $R1,0($18) # b[1] | ||
| 332 | br $901 | ||
| 333 | .align 4 | ||
| 334 | $945: | ||
| 335 | ldq $L1,0($17) # a[0] | ||
| 336 | ldq $R1,0($18) # b[1] | ||
| 337 | addq $R1,$L1,$R1 # r=a+b; | ||
| 338 | subq $19,1,$19 # loop-- | ||
| 339 | addq $R1,$CC,$R1 # c+= overflow | ||
| 340 | addq $17,8,$17 # a++ | ||
| 341 | cmpult $R1,$L1,$O1 # did we overflow? | ||
| 342 | cmpult $R1,$CC,$CC # overflow? | ||
| 343 | addq $18,8,$18 # b++ | ||
| 344 | stq $R1,0($16) # r[0]=c | ||
| 345 | addq $CC,$O1,$CC | ||
| 346 | addq $16,8,$16 # r++ | ||
| 347 | |||
| 348 | bgt $19,$945 | ||
| 349 | ret $31,($26),1 # else exit | ||
| 350 | |||
| 351 | $900: | ||
| 352 | addq $19,4,$19 | ||
| 353 | bgt $19,$945 # goto tail code | ||
| 354 | ret $31,($26),1 # else exit | ||
| 355 | .end bn_add_words | ||
| 356 | |||
| 357 | .align 3 | ||
| 358 | .globl bn_sub_words | ||
| 359 | .ent bn_sub_words | ||
| 360 | bn_sub_words: | ||
| 361 | bn_sub_words..ng: | ||
| 362 | .frame $30,0,$26,0 | ||
| 363 | .prologue 0 | ||
| 364 | |||
| 365 | subq $19,4,$19 | ||
| 366 | bis $31,$31,$CC # carry = 0 | ||
| 367 | br $800 | ||
| 368 | blt $19,$800 | ||
| 369 | ldq $L1,0($17) # a[0] | ||
| 370 | ldq $R1,0($18) # b[1] | ||
| 371 | .align 3 | ||
| 372 | $801: | ||
| 373 | addq $R1,$L1,$R1 # r=a+b; | ||
| 374 | ldq $L2,8($17) # a[1] | ||
| 375 | cmpult $R1,$L1,$O1 # did we overflow? | ||
| 376 | ldq $R2,8($18) # b[1] | ||
| 377 | addq $R1,$CC,$R1 # c+= overflow | ||
| 378 | ldq $L3,16($17) # a[2] | ||
| 379 | cmpult $R1,$CC,$CC # overflow? | ||
| 380 | ldq $R3,16($18) # b[2] | ||
| 381 | addq $CC,$O1,$CC | ||
| 382 | ldq $L4,24($17) # a[3] | ||
| 383 | addq $R2,$L2,$R2 # r=a+b; | ||
| 384 | ldq $R4,24($18) # b[3] | ||
| 385 | cmpult $R2,$L2,$O2 # did we overflow? | ||
| 386 | addq $R3,$L3,$R3 # r=a+b; | ||
| 387 | addq $R2,$CC,$R2 # c+= overflow | ||
| 388 | cmpult $R3,$L3,$O3 # did we overflow? | ||
| 389 | cmpult $R2,$CC,$CC # overflow? | ||
| 390 | addq $R4,$L4,$R4 # r=a+b; | ||
| 391 | addq $CC,$O2,$CC | ||
| 392 | cmpult $R4,$L4,$O4 # did we overflow? | ||
| 393 | addq $R3,$CC,$R3 # c+= overflow | ||
| 394 | stq $R1,0($16) # r[0]=c | ||
| 395 | cmpult $R3,$CC,$CC # overflow? | ||
| 396 | stq $R2,8($16) # r[1]=c | ||
| 397 | addq $CC,$O3,$CC | ||
| 398 | stq $R3,16($16) # r[2]=c | ||
| 399 | addq $R4,$CC,$R4 # c+= overflow | ||
| 400 | subq $19,4,$19 # loop-- | ||
| 401 | cmpult $R4,$CC,$CC # overflow? | ||
| 402 | addq $17,32,$17 # a++ | ||
| 403 | addq $CC,$O4,$CC | ||
| 404 | stq $R4,24($16) # r[3]=c | ||
| 405 | addq $18,32,$18 # b++ | ||
| 406 | addq $16,32,$16 # r++ | ||
| 407 | |||
| 408 | blt $19,$800 | ||
| 409 | ldq $L1,0($17) # a[0] | ||
| 410 | ldq $R1,0($18) # b[1] | ||
| 411 | br $801 | ||
| 412 | .align 4 | ||
| 413 | $845: | ||
| 414 | ldq $L1,0($17) # a[0] | ||
| 415 | ldq $R1,0($18) # b[1] | ||
| 416 | cmpult $L1,$R1,$O1 # will we borrow? | ||
| 417 | subq $L1,$R1,$R1 # r=a-b; | ||
| 418 | subq $19,1,$19 # loop-- | ||
| 419 | cmpult $R1,$CC,$O2 # will we borrow? | ||
| 420 | subq $R1,$CC,$R1 # c+= overflow | ||
| 421 | addq $17,8,$17 # a++ | ||
| 422 | addq $18,8,$18 # b++ | ||
| 423 | stq $R1,0($16) # r[0]=c | ||
| 424 | addq $O2,$O1,$CC | ||
| 425 | addq $16,8,$16 # r++ | ||
| 426 | |||
| 427 | bgt $19,$845 | ||
| 428 | ret $31,($26),1 # else exit | ||
| 429 | |||
| 430 | $800: | ||
| 431 | addq $19,4,$19 | ||
| 432 | bgt $19,$845 # goto tail code | ||
| 433 | ret $31,($26),1 # else exit | ||
| 434 | .end bn_sub_words | ||
| 435 | |||
| 436 | # | ||
| 437 | # What follows was taken directly from the C compiler with a few | ||
| 438 | # hacks to redo the lables. | ||
| 439 | # | ||
| 440 | .text | ||
| 441 | .align 3 | ||
| 442 | .globl bn_div_words | ||
| 443 | .ent bn_div_words | ||
| 444 | bn_div_words: | ||
| 445 | ldgp $29,0($27) | ||
| 446 | bn_div_words..ng: | ||
| 447 | lda $30,-48($30) | ||
| 448 | .frame $30,48,$26,0 | ||
| 449 | stq $26,0($30) | ||
| 450 | stq $9,8($30) | ||
| 451 | stq $10,16($30) | ||
| 452 | stq $11,24($30) | ||
| 453 | stq $12,32($30) | ||
| 454 | stq $13,40($30) | ||
| 455 | .mask 0x4003e00,-48 | ||
| 456 | .prologue 1 | ||
| 457 | bis $16,$16,$9 | ||
| 458 | bis $17,$17,$10 | ||
| 459 | bis $18,$18,$11 | ||
| 460 | bis $31,$31,$13 | ||
| 461 | bis $31,2,$12 | ||
| 462 | bne $11,$119 | ||
| 463 | lda $0,-1 | ||
| 464 | br $31,$136 | ||
| 465 | .align 4 | ||
| 466 | $119: | ||
| 467 | bis $11,$11,$16 | ||
| 468 | jsr $26,BN_num_bits_word | ||
| 469 | ldgp $29,0($26) | ||
| 470 | subq $0,64,$1 | ||
| 471 | beq $1,$120 | ||
| 472 | bis $31,1,$1 | ||
| 473 | sll $1,$0,$1 | ||
| 474 | cmpule $9,$1,$1 | ||
| 475 | bne $1,$120 | ||
| 476 | # lda $16,_IO_stderr_ | ||
| 477 | # lda $17,$C32 | ||
| 478 | # bis $0,$0,$18 | ||
| 479 | # jsr $26,fprintf | ||
| 480 | # ldgp $29,0($26) | ||
| 481 | jsr $26,abort | ||
| 482 | ldgp $29,0($26) | ||
| 483 | .align 4 | ||
| 484 | $120: | ||
| 485 | bis $31,64,$3 | ||
| 486 | cmpult $9,$11,$2 | ||
| 487 | subq $3,$0,$1 | ||
| 488 | addl $1,$31,$0 | ||
| 489 | subq $9,$11,$1 | ||
| 490 | cmoveq $2,$1,$9 | ||
| 491 | beq $0,$122 | ||
| 492 | zapnot $0,15,$2 | ||
| 493 | subq $3,$0,$1 | ||
| 494 | sll $11,$2,$11 | ||
| 495 | sll $9,$2,$3 | ||
| 496 | srl $10,$1,$1 | ||
| 497 | sll $10,$2,$10 | ||
| 498 | bis $3,$1,$9 | ||
| 499 | $122: | ||
| 500 | srl $11,32,$5 | ||
| 501 | zapnot $11,15,$6 | ||
| 502 | lda $7,-1 | ||
| 503 | .align 5 | ||
| 504 | $123: | ||
| 505 | srl $9,32,$1 | ||
| 506 | subq $1,$5,$1 | ||
| 507 | bne $1,$126 | ||
| 508 | zapnot $7,15,$27 | ||
| 509 | br $31,$127 | ||
| 510 | .align 4 | ||
| 511 | $126: | ||
| 512 | bis $9,$9,$24 | ||
| 513 | bis $5,$5,$25 | ||
| 514 | divqu $24,$25,$27 | ||
| 515 | $127: | ||
| 516 | srl $10,32,$4 | ||
| 517 | .align 5 | ||
| 518 | $128: | ||
| 519 | mulq $27,$5,$1 | ||
| 520 | subq $9,$1,$3 | ||
| 521 | zapnot $3,240,$1 | ||
| 522 | bne $1,$129 | ||
| 523 | mulq $6,$27,$2 | ||
| 524 | sll $3,32,$1 | ||
| 525 | addq $1,$4,$1 | ||
| 526 | cmpule $2,$1,$2 | ||
| 527 | bne $2,$129 | ||
| 528 | subq $27,1,$27 | ||
| 529 | br $31,$128 | ||
| 530 | .align 4 | ||
| 531 | $129: | ||
| 532 | mulq $27,$6,$1 | ||
| 533 | mulq $27,$5,$4 | ||
| 534 | srl $1,32,$3 | ||
| 535 | sll $1,32,$1 | ||
| 536 | addq $4,$3,$4 | ||
| 537 | cmpult $10,$1,$2 | ||
| 538 | subq $10,$1,$10 | ||
| 539 | addq $2,$4,$2 | ||
| 540 | cmpult $9,$2,$1 | ||
| 541 | bis $2,$2,$4 | ||
| 542 | beq $1,$134 | ||
| 543 | addq $9,$11,$9 | ||
| 544 | subq $27,1,$27 | ||
| 545 | $134: | ||
| 546 | subl $12,1,$12 | ||
| 547 | subq $9,$4,$9 | ||
| 548 | beq $12,$124 | ||
| 549 | sll $27,32,$13 | ||
| 550 | sll $9,32,$2 | ||
| 551 | srl $10,32,$1 | ||
| 552 | sll $10,32,$10 | ||
| 553 | bis $2,$1,$9 | ||
| 554 | br $31,$123 | ||
| 555 | .align 4 | ||
| 556 | $124: | ||
| 557 | bis $13,$27,$0 | ||
| 558 | $136: | ||
| 559 | ldq $26,0($30) | ||
| 560 | ldq $9,8($30) | ||
| 561 | ldq $10,16($30) | ||
| 562 | ldq $11,24($30) | ||
| 563 | ldq $12,32($30) | ||
| 564 | ldq $13,40($30) | ||
| 565 | addq $30,48,$30 | ||
| 566 | ret $31,($26),1 | ||
| 567 | .end bn_div_words | ||
| 568 | EOF | ||
| 569 | return($data); | ||
| 570 | } | ||
| 571 | |||
diff --git a/src/lib/libcrypto/bn/asm/ca.pl b/src/lib/libcrypto/bn/asm/ca.pl deleted file mode 100644 index c1ce67a6b4..0000000000 --- a/src/lib/libcrypto/bn/asm/ca.pl +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # I have this in perl so I can use more usefull register names and then convert | ||
| 3 | # them into alpha registers. | ||
| 4 | # | ||
| 5 | |||
| 6 | push(@INC,"perlasm","../../perlasm"); | ||
| 7 | require "alpha.pl"; | ||
| 8 | require "alpha/mul_add.pl"; | ||
| 9 | require "alpha/mul.pl"; | ||
| 10 | require "alpha/sqr.pl"; | ||
| 11 | require "alpha/add.pl"; | ||
| 12 | require "alpha/sub.pl"; | ||
| 13 | require "alpha/mul_c8.pl"; | ||
| 14 | require "alpha/mul_c4.pl"; | ||
| 15 | require "alpha/sqr_c4.pl"; | ||
| 16 | require "alpha/sqr_c8.pl"; | ||
| 17 | require "alpha/div.pl"; | ||
| 18 | |||
| 19 | &asm_init($ARGV[0],$0); | ||
| 20 | |||
| 21 | &bn_mul_words("bn_mul_words"); | ||
| 22 | &bn_sqr_words("bn_sqr_words"); | ||
| 23 | &bn_mul_add_words("bn_mul_add_words"); | ||
| 24 | &bn_add_words("bn_add_words"); | ||
| 25 | &bn_sub_words("bn_sub_words"); | ||
| 26 | &bn_div_words("bn_div_words"); | ||
| 27 | &bn_mul_comba8("bn_mul_comba8"); | ||
| 28 | &bn_mul_comba4("bn_mul_comba4"); | ||
| 29 | &bn_sqr_comba4("bn_sqr_comba4"); | ||
| 30 | &bn_sqr_comba8("bn_sqr_comba8"); | ||
| 31 | |||
| 32 | &asm_finish(); | ||
| 33 | |||
diff --git a/src/lib/libcrypto/bn/asm/co-586.pl b/src/lib/libcrypto/bn/asm/co-586.pl index 5d962cb957..57101a6bd7 100644 --- a/src/lib/libcrypto/bn/asm/co-586.pl +++ b/src/lib/libcrypto/bn/asm/co-586.pl | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #!/usr/local/bin/perl | 1 | #!/usr/local/bin/perl |
| 2 | 2 | ||
| 3 | push(@INC,"perlasm","../../perlasm"); | 3 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 4 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 4 | require "x86asm.pl"; | 5 | require "x86asm.pl"; |
| 5 | 6 | ||
| 6 | &asm_init($ARGV[0],$0); | 7 | &asm_init($ARGV[0],$0); |
diff --git a/src/lib/libcrypto/bn/asm/co-alpha.pl b/src/lib/libcrypto/bn/asm/co-alpha.pl deleted file mode 100644 index 67dad3e3d5..0000000000 --- a/src/lib/libcrypto/bn/asm/co-alpha.pl +++ /dev/null | |||
| @@ -1,116 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # I have this in perl so I can use more usefull register names and then convert | ||
| 3 | # them into alpha registers. | ||
| 4 | # | ||
| 5 | |||
| 6 | push(@INC,"perlasm","../../perlasm"); | ||
| 7 | require "alpha.pl"; | ||
| 8 | |||
| 9 | &asm_init($ARGV[0],$0); | ||
| 10 | |||
| 11 | print &bn_sub_words("bn_sub_words"); | ||
| 12 | |||
| 13 | &asm_finish(); | ||
| 14 | |||
| 15 | sub bn_sub_words | ||
| 16 | { | ||
| 17 | local($name)=@_; | ||
| 18 | local($cc,$a,$b,$r); | ||
| 19 | |||
| 20 | $cc="r0"; | ||
| 21 | $a0="r1"; $b0="r5"; $r0="r9"; $tmp="r13"; | ||
| 22 | $a1="r2"; $b1="r6"; $r1="r10"; $t1="r14"; | ||
| 23 | $a2="r3"; $b2="r7"; $r2="r11"; | ||
| 24 | $a3="r4"; $b3="r8"; $r3="r12"; $t3="r15"; | ||
| 25 | |||
| 26 | $rp=&wparam(0); | ||
| 27 | $ap=&wparam(1); | ||
| 28 | $bp=&wparam(2); | ||
| 29 | $count=&wparam(3); | ||
| 30 | |||
| 31 | &function_begin($name,""); | ||
| 32 | |||
| 33 | &comment(""); | ||
| 34 | &sub($count,4,$count); | ||
| 35 | &mov("zero",$cc); | ||
| 36 | &blt($count,&label("finish")); | ||
| 37 | |||
| 38 | &ld($a0,&QWPw(0,$ap)); | ||
| 39 | &ld($b0,&QWPw(0,$bp)); | ||
| 40 | |||
| 41 | ########################################################## | ||
| 42 | &set_label("loop"); | ||
| 43 | |||
| 44 | &ld($a1,&QWPw(1,$ap)); | ||
| 45 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 46 | &ld($b1,&QWPw(1,$bp)); | ||
| 47 | &sub($a0,$b0,$a0); # do the subtract | ||
| 48 | &ld($a2,&QWPw(2,$ap)); | ||
| 49 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 50 | &ld($b2,&QWPw(2,$bp)); | ||
| 51 | &sub($a0,$cc,$a0); # will we borrow? | ||
| 52 | &ld($a3,&QWPw(3,$ap)); | ||
| 53 | &add($b0,$tmp,$cc); # add the borrows | ||
| 54 | |||
| 55 | &cmpult($a1,$b1,$t1); # will we borrow? | ||
| 56 | &sub($a1,$b1,$a1); # do the subtract | ||
| 57 | &ld($b3,&QWPw(3,$bp)); | ||
| 58 | &cmpult($a1,$cc,$b1); # will we borrow? | ||
| 59 | &sub($a1,$cc,$a1); # will we borrow? | ||
| 60 | &add($b1,$t1,$cc); # add the borrows | ||
| 61 | |||
| 62 | &cmpult($a2,$b2,$tmp); # will we borrow? | ||
| 63 | &sub($a2,$b2,$a2); # do the subtract | ||
| 64 | &st($a0,&QWPw(0,$rp)); # save | ||
| 65 | &cmpult($a2,$cc,$b2); # will we borrow? | ||
| 66 | &sub($a2,$cc,$a2); # will we borrow? | ||
| 67 | &add($b2,$tmp,$cc); # add the borrows | ||
| 68 | |||
| 69 | &cmpult($a3,$b3,$t3); # will we borrow? | ||
| 70 | &sub($a3,$b3,$a3); # do the subtract | ||
| 71 | &st($a1,&QWPw(1,$rp)); # save | ||
| 72 | &cmpult($a3,$cc,$b3); # will we borrow? | ||
| 73 | &sub($a3,$cc,$a3); # will we borrow? | ||
| 74 | &add($b3,$t3,$cc); # add the borrows | ||
| 75 | |||
| 76 | &st($a2,&QWPw(2,$rp)); # save | ||
| 77 | &sub($count,4,$count); # count-=4 | ||
| 78 | &st($a3,&QWPw(3,$rp)); # save | ||
| 79 | &add($ap,4*$QWS,$ap); # count+=4 | ||
| 80 | &add($bp,4*$QWS,$bp); # count+=4 | ||
| 81 | &add($rp,4*$QWS,$rp); # count+=4 | ||
| 82 | |||
| 83 | &blt($count,&label("finish")); | ||
| 84 | &ld($a0,&QWPw(0,$ap)); | ||
| 85 | &ld($b0,&QWPw(0,$bp)); | ||
| 86 | &br(&label("loop")); | ||
| 87 | ################################################## | ||
| 88 | # Do the last 0..3 words | ||
| 89 | |||
| 90 | &set_label("last_loop"); | ||
| 91 | |||
| 92 | &ld($a0,&QWPw(0,$ap)); # get a | ||
| 93 | &ld($b0,&QWPw(0,$bp)); # get b | ||
| 94 | &cmpult($a0,$b0,$tmp); # will we borrow? | ||
| 95 | &sub($a0,$b0,$a0); # do the subtract | ||
| 96 | &cmpult($a0,$cc,$b0); # will we borrow? | ||
| 97 | &sub($a0,$cc,$a0); # will we borrow? | ||
| 98 | &st($a0,&QWPw(0,$rp)); # save | ||
| 99 | &add($b0,$tmp,$cc); # add the borrows | ||
| 100 | |||
| 101 | &add($ap,$QWS,$ap); | ||
| 102 | &add($bp,$QWS,$bp); | ||
| 103 | &add($rp,$QWS,$rp); | ||
| 104 | &sub($count,1,$count); | ||
| 105 | &bgt($count,&label("last_loop")); | ||
| 106 | &function_end_A($name); | ||
| 107 | |||
| 108 | ###################################################### | ||
| 109 | &set_label("finish"); | ||
| 110 | &add($count,4,$count); | ||
| 111 | &bgt($count,&label("last_loop")); | ||
| 112 | |||
| 113 | &set_label("end"); | ||
| 114 | &function_end($name); | ||
| 115 | } | ||
| 116 | |||
diff --git a/src/lib/libcrypto/bn/asm/mips1.s b/src/lib/libcrypto/bn/asm/mips1.s deleted file mode 100644 index 44fa1254c7..0000000000 --- a/src/lib/libcrypto/bn/asm/mips1.s +++ /dev/null | |||
| @@ -1,539 +0,0 @@ | |||
| 1 | /* This assember is for R2000/R3000 machines, or higher ones that do | ||
| 2 | * no want to do any 64 bit arithmatic. | ||
| 3 | * Make sure that the SSLeay bignum library is compiled with | ||
| 4 | * THIRTY_TWO_BIT set. | ||
| 5 | * This must either be compiled with the system CC, or, if you use GNU gas, | ||
| 6 | * cc -E mips1.s|gas -o mips1.o | ||
| 7 | */ | ||
| 8 | .set reorder | ||
| 9 | .set noat | ||
| 10 | |||
| 11 | #define R1 $1 | ||
| 12 | #define CC $2 | ||
| 13 | #define R2 $3 | ||
| 14 | #define R3 $8 | ||
| 15 | #define R4 $9 | ||
| 16 | #define L1 $10 | ||
| 17 | #define L2 $11 | ||
| 18 | #define L3 $12 | ||
| 19 | #define L4 $13 | ||
| 20 | #define H1 $14 | ||
| 21 | #define H2 $15 | ||
| 22 | #define H3 $24 | ||
| 23 | #define H4 $25 | ||
| 24 | |||
| 25 | #define P1 $4 | ||
| 26 | #define P2 $5 | ||
| 27 | #define P3 $6 | ||
| 28 | #define P4 $7 | ||
| 29 | |||
| 30 | .align 2 | ||
| 31 | .ent bn_mul_add_words | ||
| 32 | .globl bn_mul_add_words | ||
| 33 | .text | ||
| 34 | bn_mul_add_words: | ||
| 35 | .frame $sp,0,$31 | ||
| 36 | .mask 0x00000000,0 | ||
| 37 | .fmask 0x00000000,0 | ||
| 38 | |||
| 39 | #blt P3,4,$lab34 | ||
| 40 | |||
| 41 | subu R1,P3,4 | ||
| 42 | move CC,$0 | ||
| 43 | bltz R1,$lab34 | ||
| 44 | $lab2: | ||
| 45 | lw R1,0(P1) | ||
| 46 | lw L1,0(P2) | ||
| 47 | lw R2,4(P1) | ||
| 48 | lw L2,4(P2) | ||
| 49 | lw R3,8(P1) | ||
| 50 | lw L3,8(P2) | ||
| 51 | lw R4,12(P1) | ||
| 52 | lw L4,12(P2) | ||
| 53 | multu L1,P4 | ||
| 54 | addu R1,R1,CC | ||
| 55 | mflo L1 | ||
| 56 | sltu CC,R1,CC | ||
| 57 | addu R1,R1,L1 | ||
| 58 | mfhi H1 | ||
| 59 | sltu L1,R1,L1 | ||
| 60 | sw R1,0(P1) | ||
| 61 | addu CC,CC,L1 | ||
| 62 | multu L2,P4 | ||
| 63 | addu CC,H1,CC | ||
| 64 | mflo L2 | ||
| 65 | addu R2,R2,CC | ||
| 66 | sltu CC,R2,CC | ||
| 67 | mfhi H2 | ||
| 68 | addu R2,R2,L2 | ||
| 69 | addu P2,P2,16 | ||
| 70 | sltu L2,R2,L2 | ||
| 71 | sw R2,4(P1) | ||
| 72 | addu CC,CC,L2 | ||
| 73 | multu L3,P4 | ||
| 74 | addu CC,H2,CC | ||
| 75 | mflo L3 | ||
| 76 | addu R3,R3,CC | ||
| 77 | sltu CC,R3,CC | ||
| 78 | mfhi H3 | ||
| 79 | addu R3,R3,L3 | ||
| 80 | addu P1,P1,16 | ||
| 81 | sltu L3,R3,L3 | ||
| 82 | sw R3,-8(P1) | ||
| 83 | addu CC,CC,L3 | ||
| 84 | multu L4,P4 | ||
| 85 | addu CC,H3,CC | ||
| 86 | mflo L4 | ||
| 87 | addu R4,R4,CC | ||
| 88 | sltu CC,R4,CC | ||
| 89 | mfhi H4 | ||
| 90 | addu R4,R4,L4 | ||
| 91 | subu P3,P3,4 | ||
| 92 | sltu L4,R4,L4 | ||
| 93 | addu CC,CC,L4 | ||
| 94 | addu CC,H4,CC | ||
| 95 | |||
| 96 | subu R1,P3,4 | ||
| 97 | sw R4,-4(P1) # delay slot | ||
| 98 | bgez R1,$lab2 | ||
| 99 | |||
| 100 | bleu P3,0,$lab3 | ||
| 101 | .align 2 | ||
| 102 | $lab33: | ||
| 103 | lw L1,0(P2) | ||
| 104 | lw R1,0(P1) | ||
| 105 | multu L1,P4 | ||
| 106 | addu R1,R1,CC | ||
| 107 | sltu CC,R1,CC | ||
| 108 | addu P1,P1,4 | ||
| 109 | mflo L1 | ||
| 110 | mfhi H1 | ||
| 111 | addu R1,R1,L1 | ||
| 112 | addu P2,P2,4 | ||
| 113 | sltu L1,R1,L1 | ||
| 114 | subu P3,P3,1 | ||
| 115 | addu CC,CC,L1 | ||
| 116 | sw R1,-4(P1) | ||
| 117 | addu CC,H1,CC | ||
| 118 | bgtz P3,$lab33 | ||
| 119 | j $31 | ||
| 120 | .align 2 | ||
| 121 | $lab3: | ||
| 122 | j $31 | ||
| 123 | .align 2 | ||
| 124 | $lab34: | ||
| 125 | bgt P3,0,$lab33 | ||
| 126 | j $31 | ||
| 127 | .end bn_mul_add_words | ||
| 128 | |||
| 129 | .align 2 | ||
| 130 | # Program Unit: bn_mul_words | ||
| 131 | .ent bn_mul_words | ||
| 132 | .globl bn_mul_words | ||
| 133 | .text | ||
| 134 | bn_mul_words: | ||
| 135 | .frame $sp,0,$31 | ||
| 136 | .mask 0x00000000,0 | ||
| 137 | .fmask 0x00000000,0 | ||
| 138 | |||
| 139 | subu P3,P3,4 | ||
| 140 | move CC,$0 | ||
| 141 | bltz P3,$lab45 | ||
| 142 | $lab44: | ||
| 143 | lw L1,0(P2) | ||
| 144 | lw L2,4(P2) | ||
| 145 | lw L3,8(P2) | ||
| 146 | lw L4,12(P2) | ||
| 147 | multu L1,P4 | ||
| 148 | subu P3,P3,4 | ||
| 149 | mflo L1 | ||
| 150 | mfhi H1 | ||
| 151 | addu L1,L1,CC | ||
| 152 | multu L2,P4 | ||
| 153 | sltu CC,L1,CC | ||
| 154 | sw L1,0(P1) | ||
| 155 | addu CC,H1,CC | ||
| 156 | mflo L2 | ||
| 157 | mfhi H2 | ||
| 158 | addu L2,L2,CC | ||
| 159 | multu L3,P4 | ||
| 160 | sltu CC,L2,CC | ||
| 161 | sw L2,4(P1) | ||
| 162 | addu CC,H2,CC | ||
| 163 | mflo L3 | ||
| 164 | mfhi H3 | ||
| 165 | addu L3,L3,CC | ||
| 166 | multu L4,P4 | ||
| 167 | sltu CC,L3,CC | ||
| 168 | sw L3,8(P1) | ||
| 169 | addu CC,H3,CC | ||
| 170 | mflo L4 | ||
| 171 | mfhi H4 | ||
| 172 | addu L4,L4,CC | ||
| 173 | addu P1,P1,16 | ||
| 174 | sltu CC,L4,CC | ||
| 175 | addu P2,P2,16 | ||
| 176 | addu CC,H4,CC | ||
| 177 | sw L4,-4(P1) | ||
| 178 | |||
| 179 | bgez P3,$lab44 | ||
| 180 | b $lab45 | ||
| 181 | $lab46: | ||
| 182 | lw L1,0(P2) | ||
| 183 | addu P1,P1,4 | ||
| 184 | multu L1,P4 | ||
| 185 | addu P2,P2,4 | ||
| 186 | mflo L1 | ||
| 187 | mfhi H1 | ||
| 188 | addu L1,L1,CC | ||
| 189 | subu P3,P3,1 | ||
| 190 | sltu CC,L1,CC | ||
| 191 | sw L1,-4(P1) | ||
| 192 | addu CC,H1,CC | ||
| 193 | bgtz P3,$lab46 | ||
| 194 | j $31 | ||
| 195 | $lab45: | ||
| 196 | addu P3,P3,4 | ||
| 197 | bgtz P3,$lab46 | ||
| 198 | j $31 | ||
| 199 | .align 2 | ||
| 200 | .end bn_mul_words | ||
| 201 | |||
| 202 | # Program Unit: bn_sqr_words | ||
| 203 | .ent bn_sqr_words | ||
| 204 | .globl bn_sqr_words | ||
| 205 | .text | ||
| 206 | bn_sqr_words: | ||
| 207 | .frame $sp,0,$31 | ||
| 208 | .mask 0x00000000,0 | ||
| 209 | .fmask 0x00000000,0 | ||
| 210 | |||
| 211 | subu P3,P3,4 | ||
| 212 | bltz P3,$lab55 | ||
| 213 | $lab54: | ||
| 214 | lw L1,0(P2) | ||
| 215 | lw L2,4(P2) | ||
| 216 | lw L3,8(P2) | ||
| 217 | lw L4,12(P2) | ||
| 218 | |||
| 219 | multu L1,L1 | ||
| 220 | subu P3,P3,4 | ||
| 221 | mflo L1 | ||
| 222 | mfhi H1 | ||
| 223 | sw L1,0(P1) | ||
| 224 | sw H1,4(P1) | ||
| 225 | |||
| 226 | multu L2,L2 | ||
| 227 | addu P1,P1,32 | ||
| 228 | mflo L2 | ||
| 229 | mfhi H2 | ||
| 230 | sw L2,-24(P1) | ||
| 231 | sw H2,-20(P1) | ||
| 232 | |||
| 233 | multu L3,L3 | ||
| 234 | addu P2,P2,16 | ||
| 235 | mflo L3 | ||
| 236 | mfhi H3 | ||
| 237 | sw L3,-16(P1) | ||
| 238 | sw H3,-12(P1) | ||
| 239 | |||
| 240 | multu L4,L4 | ||
| 241 | |||
| 242 | mflo L4 | ||
| 243 | mfhi H4 | ||
| 244 | sw L4,-8(P1) | ||
| 245 | sw H4,-4(P1) | ||
| 246 | |||
| 247 | bgtz P3,$lab54 | ||
| 248 | b $lab55 | ||
| 249 | $lab56: | ||
| 250 | lw L1,0(P2) | ||
| 251 | addu P1,P1,8 | ||
| 252 | multu L1,L1 | ||
| 253 | addu P2,P2,4 | ||
| 254 | subu P3,P3,1 | ||
| 255 | mflo L1 | ||
| 256 | mfhi H1 | ||
| 257 | sw L1,-8(P1) | ||
| 258 | sw H1,-4(P1) | ||
| 259 | |||
| 260 | bgtz P3,$lab56 | ||
| 261 | j $31 | ||
| 262 | $lab55: | ||
| 263 | addu P3,P3,4 | ||
| 264 | bgtz P3,$lab56 | ||
| 265 | j $31 | ||
| 266 | .align 2 | ||
| 267 | .end bn_sqr_words | ||
| 268 | |||
| 269 | # Program Unit: bn_add_words | ||
| 270 | .ent bn_add_words | ||
| 271 | .globl bn_add_words | ||
| 272 | .text | ||
| 273 | bn_add_words: # 0x590 | ||
| 274 | .frame $sp,0,$31 | ||
| 275 | .mask 0x00000000,0 | ||
| 276 | .fmask 0x00000000,0 | ||
| 277 | |||
| 278 | subu P4,P4,4 | ||
| 279 | move CC,$0 | ||
| 280 | bltz P4,$lab65 | ||
| 281 | $lab64: | ||
| 282 | lw L1,0(P2) | ||
| 283 | lw R1,0(P3) | ||
| 284 | lw L2,4(P2) | ||
| 285 | lw R2,4(P3) | ||
| 286 | |||
| 287 | addu L1,L1,CC | ||
| 288 | lw L3,8(P2) | ||
| 289 | sltu CC,L1,CC | ||
| 290 | addu L1,L1,R1 | ||
| 291 | sltu R1,L1,R1 | ||
| 292 | lw R3,8(P3) | ||
| 293 | addu CC,CC,R1 | ||
| 294 | lw L4,12(P2) | ||
| 295 | |||
| 296 | addu L2,L2,CC | ||
| 297 | lw R4,12(P3) | ||
| 298 | sltu CC,L2,CC | ||
| 299 | addu L2,L2,R2 | ||
| 300 | sltu R2,L2,R2 | ||
| 301 | sw L1,0(P1) | ||
| 302 | addu CC,CC,R2 | ||
| 303 | addu P1,P1,16 | ||
| 304 | addu L3,L3,CC | ||
| 305 | sw L2,-12(P1) | ||
| 306 | |||
| 307 | sltu CC,L3,CC | ||
| 308 | addu L3,L3,R3 | ||
| 309 | sltu R3,L3,R3 | ||
| 310 | addu P2,P2,16 | ||
| 311 | addu CC,CC,R3 | ||
| 312 | |||
| 313 | addu L4,L4,CC | ||
| 314 | addu P3,P3,16 | ||
| 315 | sltu CC,L4,CC | ||
| 316 | addu L4,L4,R4 | ||
| 317 | subu P4,P4,4 | ||
| 318 | sltu R4,L4,R4 | ||
| 319 | sw L3,-8(P1) | ||
| 320 | addu CC,CC,R4 | ||
| 321 | sw L4,-4(P1) | ||
| 322 | |||
| 323 | bgtz P4,$lab64 | ||
| 324 | b $lab65 | ||
| 325 | $lab66: | ||
| 326 | lw L1,0(P2) | ||
| 327 | lw R1,0(P3) | ||
| 328 | addu L1,L1,CC | ||
| 329 | addu P1,P1,4 | ||
| 330 | sltu CC,L1,CC | ||
| 331 | addu P2,P2,4 | ||
| 332 | addu P3,P3,4 | ||
| 333 | addu L1,L1,R1 | ||
| 334 | subu P4,P4,1 | ||
| 335 | sltu R1,L1,R1 | ||
| 336 | sw L1,-4(P1) | ||
| 337 | addu CC,CC,R1 | ||
| 338 | |||
| 339 | bgtz P4,$lab66 | ||
| 340 | j $31 | ||
| 341 | $lab65: | ||
| 342 | addu P4,P4,4 | ||
| 343 | bgtz P4,$lab66 | ||
| 344 | j $31 | ||
| 345 | .end bn_add_words | ||
| 346 | |||
| 347 | # Program Unit: bn_div64 | ||
| 348 | .set at | ||
| 349 | .set reorder | ||
| 350 | .text | ||
| 351 | .align 2 | ||
| 352 | .globl bn_div64 | ||
| 353 | # 321 { | ||
| 354 | .ent bn_div64 2 | ||
| 355 | bn_div64: | ||
| 356 | subu $sp, 64 | ||
| 357 | sw $31, 56($sp) | ||
| 358 | sw $16, 48($sp) | ||
| 359 | .mask 0x80010000, -56 | ||
| 360 | .frame $sp, 64, $31 | ||
| 361 | move $9, $4 | ||
| 362 | move $12, $5 | ||
| 363 | move $16, $6 | ||
| 364 | # 322 BN_ULONG dh,dl,q,ret=0,th,tl,t; | ||
| 365 | move $31, $0 | ||
| 366 | # 323 int i,count=2; | ||
| 367 | li $13, 2 | ||
| 368 | # 324 | ||
| 369 | # 325 if (d == 0) return(BN_MASK2); | ||
| 370 | bne $16, 0, $80 | ||
| 371 | li $2, -1 | ||
| 372 | b $93 | ||
| 373 | $80: | ||
| 374 | # 326 | ||
| 375 | # 327 i=BN_num_bits_word(d); | ||
| 376 | move $4, $16 | ||
| 377 | sw $31, 16($sp) | ||
| 378 | sw $9, 24($sp) | ||
| 379 | sw $12, 32($sp) | ||
| 380 | sw $13, 40($sp) | ||
| 381 | .livereg 0x800ff0e,0xfff | ||
| 382 | jal BN_num_bits_word | ||
| 383 | li $4, 32 | ||
| 384 | lw $31, 16($sp) | ||
| 385 | lw $9, 24($sp) | ||
| 386 | lw $12, 32($sp) | ||
| 387 | lw $13, 40($sp) | ||
| 388 | move $3, $2 | ||
| 389 | # 328 if ((i != BN_BITS2) && (h > (BN_ULONG)1<<i)) | ||
| 390 | beq $2, $4, $81 | ||
| 391 | li $14, 1 | ||
| 392 | sll $15, $14, $2 | ||
| 393 | bleu $9, $15, $81 | ||
| 394 | # 329 { | ||
| 395 | # 330 #if !defined(NO_STDIO) && !defined(WIN16) | ||
| 396 | # 331 fprintf(stderr,"Division would overflow (%d)\n",i); | ||
| 397 | # 332 #endif | ||
| 398 | # 333 abort(); | ||
| 399 | sw $3, 8($sp) | ||
| 400 | sw $9, 24($sp) | ||
| 401 | sw $12, 32($sp) | ||
| 402 | sw $13, 40($sp) | ||
| 403 | sw $31, 26($sp) | ||
| 404 | .livereg 0xff0e,0xfff | ||
| 405 | jal abort | ||
| 406 | lw $3, 8($sp) | ||
| 407 | li $4, 32 | ||
| 408 | lw $9, 24($sp) | ||
| 409 | lw $12, 32($sp) | ||
| 410 | lw $13, 40($sp) | ||
| 411 | lw $31, 26($sp) | ||
| 412 | # 334 } | ||
| 413 | $81: | ||
| 414 | # 335 i=BN_BITS2-i; | ||
| 415 | subu $3, $4, $3 | ||
| 416 | # 336 if (h >= d) h-=d; | ||
| 417 | bltu $9, $16, $82 | ||
| 418 | subu $9, $9, $16 | ||
| 419 | $82: | ||
| 420 | # 337 | ||
| 421 | # 338 if (i) | ||
| 422 | beq $3, 0, $83 | ||
| 423 | # 339 { | ||
| 424 | # 340 d<<=i; | ||
| 425 | sll $16, $16, $3 | ||
| 426 | # 341 h=(h<<i)|(l>>(BN_BITS2-i)); | ||
| 427 | sll $24, $9, $3 | ||
| 428 | subu $25, $4, $3 | ||
| 429 | srl $14, $12, $25 | ||
| 430 | or $9, $24, $14 | ||
| 431 | # 342 l<<=i; | ||
| 432 | sll $12, $12, $3 | ||
| 433 | # 343 } | ||
| 434 | $83: | ||
| 435 | # 344 dh=(d&BN_MASK2h)>>BN_BITS4; | ||
| 436 | # 345 dl=(d&BN_MASK2l); | ||
| 437 | and $8, $16, -65536 | ||
| 438 | srl $8, $8, 16 | ||
| 439 | and $10, $16, 65535 | ||
| 440 | li $6, -65536 | ||
| 441 | $84: | ||
| 442 | # 346 for (;;) | ||
| 443 | # 347 { | ||
| 444 | # 348 if ((h>>BN_BITS4) == dh) | ||
| 445 | srl $15, $9, 16 | ||
| 446 | bne $8, $15, $85 | ||
| 447 | # 349 q=BN_MASK2l; | ||
| 448 | li $5, 65535 | ||
| 449 | b $86 | ||
| 450 | $85: | ||
| 451 | # 350 else | ||
| 452 | # 351 q=h/dh; | ||
| 453 | divu $5, $9, $8 | ||
| 454 | $86: | ||
| 455 | # 352 | ||
| 456 | # 353 for (;;) | ||
| 457 | # 354 { | ||
| 458 | # 355 t=(h-q*dh); | ||
| 459 | mul $4, $5, $8 | ||
| 460 | subu $2, $9, $4 | ||
| 461 | move $3, $2 | ||
| 462 | # 356 if ((t&BN_MASK2h) || | ||
| 463 | # 357 ((dl*q) <= ( | ||
| 464 | # 358 (t<<BN_BITS4)+ | ||
| 465 | # 359 ((l&BN_MASK2h)>>BN_BITS4)))) | ||
| 466 | and $25, $2, $6 | ||
| 467 | bne $25, $0, $87 | ||
| 468 | mul $24, $10, $5 | ||
| 469 | sll $14, $3, 16 | ||
| 470 | and $15, $12, $6 | ||
| 471 | srl $25, $15, 16 | ||
| 472 | addu $15, $14, $25 | ||
| 473 | bgtu $24, $15, $88 | ||
| 474 | $87: | ||
| 475 | # 360 break; | ||
| 476 | mul $3, $10, $5 | ||
| 477 | b $89 | ||
| 478 | $88: | ||
| 479 | # 361 q--; | ||
| 480 | addu $5, $5, -1 | ||
| 481 | # 362 } | ||
| 482 | b $86 | ||
| 483 | $89: | ||
| 484 | # 363 th=q*dh; | ||
| 485 | # 364 tl=q*dl; | ||
| 486 | # 365 t=(tl>>BN_BITS4); | ||
| 487 | # 366 tl=(tl<<BN_BITS4)&BN_MASK2h; | ||
| 488 | sll $14, $3, 16 | ||
| 489 | and $2, $14, $6 | ||
| 490 | move $11, $2 | ||
| 491 | # 367 th+=t; | ||
| 492 | srl $25, $3, 16 | ||
| 493 | addu $7, $4, $25 | ||
| 494 | # 368 | ||
| 495 | # 369 if (l < tl) th++; | ||
| 496 | bgeu $12, $2, $90 | ||
| 497 | addu $7, $7, 1 | ||
| 498 | $90: | ||
| 499 | # 370 l-=tl; | ||
| 500 | subu $12, $12, $11 | ||
| 501 | # 371 if (h < th) | ||
| 502 | bgeu $9, $7, $91 | ||
| 503 | # 372 { | ||
| 504 | # 373 h+=d; | ||
| 505 | addu $9, $9, $16 | ||
| 506 | # 374 q--; | ||
| 507 | addu $5, $5, -1 | ||
| 508 | # 375 } | ||
| 509 | $91: | ||
| 510 | # 376 h-=th; | ||
| 511 | subu $9, $9, $7 | ||
| 512 | # 377 | ||
| 513 | # 378 if (--count == 0) break; | ||
| 514 | addu $13, $13, -1 | ||
| 515 | beq $13, 0, $92 | ||
| 516 | # 379 | ||
| 517 | # 380 ret=q<<BN_BITS4; | ||
| 518 | sll $31, $5, 16 | ||
| 519 | # 381 h=((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2; | ||
| 520 | sll $24, $9, 16 | ||
| 521 | srl $15, $12, 16 | ||
| 522 | or $9, $24, $15 | ||
| 523 | # 382 l=(l&BN_MASK2l)<<BN_BITS4; | ||
| 524 | and $12, $12, 65535 | ||
| 525 | sll $12, $12, 16 | ||
| 526 | # 383 } | ||
| 527 | b $84 | ||
| 528 | $92: | ||
| 529 | # 384 ret|=q; | ||
| 530 | or $31, $31, $5 | ||
| 531 | # 385 return(ret); | ||
| 532 | move $2, $31 | ||
| 533 | $93: | ||
| 534 | lw $16, 48($sp) | ||
| 535 | lw $31, 56($sp) | ||
| 536 | addu $sp, 64 | ||
| 537 | j $31 | ||
| 538 | .end bn_div64 | ||
| 539 | |||
diff --git a/src/lib/libcrypto/bn/asm/mo-586.pl b/src/lib/libcrypto/bn/asm/mo-586.pl deleted file mode 100644 index 0982293094..0000000000 --- a/src/lib/libcrypto/bn/asm/mo-586.pl +++ /dev/null | |||
| @@ -1,603 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | # This is crypto/bn/asm/x86-mont.pl (with asciz from crypto/perlasm/x86asm.pl) | ||
| 4 | # from OpenSSL 0.9.9-dev | ||
| 5 | |||
| 6 | sub ::asciz | ||
| 7 | { my @str=unpack("C*",shift); | ||
| 8 | push @str,0; | ||
| 9 | while ($#str>15) { | ||
| 10 | &data_byte(@str[0..15]); | ||
| 11 | foreach (0..15) { shift @str; } | ||
| 12 | } | ||
| 13 | &data_byte(@str) if (@str); | ||
| 14 | } | ||
| 15 | |||
| 16 | # ==================================================================== | ||
| 17 | # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL | ||
| 18 | # project. The module is, however, dual licensed under OpenSSL and | ||
| 19 | # CRYPTOGAMS licenses depending on where you obtain it. For further | ||
| 20 | # details see http://www.openssl.org/~appro/cryptogams/. | ||
| 21 | # ==================================================================== | ||
| 22 | |||
| 23 | # October 2005 | ||
| 24 | # | ||
| 25 | # This is a "teaser" code, as it can be improved in several ways... | ||
| 26 | # First of all non-SSE2 path should be implemented (yes, for now it | ||
| 27 | # performs Montgomery multiplication/convolution only on SSE2-capable | ||
| 28 | # CPUs such as P4, others fall down to original code). Then inner loop | ||
| 29 | # can be unrolled and modulo-scheduled to improve ILP and possibly | ||
| 30 | # moved to 128-bit XMM register bank (though it would require input | ||
| 31 | # rearrangement and/or increase bus bandwidth utilization). Dedicated | ||
| 32 | # squaring procedure should give further performance improvement... | ||
| 33 | # Yet, for being draft, the code improves rsa512 *sign* benchmark by | ||
| 34 | # 110%(!), rsa1024 one - by 70% and rsa4096 - by 20%:-) | ||
| 35 | |||
| 36 | # December 2006 | ||
| 37 | # | ||
| 38 | # Modulo-scheduling SSE2 loops results in further 15-20% improvement. | ||
| 39 | # Integer-only code [being equipped with dedicated squaring procedure] | ||
| 40 | # gives ~40% on rsa512 sign benchmark... | ||
| 41 | |||
| 42 | push(@INC,"perlasm","../../perlasm"); | ||
| 43 | require "x86asm.pl"; | ||
| 44 | |||
| 45 | &asm_init($ARGV[0],$0); | ||
| 46 | |||
| 47 | $sse2=0; | ||
| 48 | for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } | ||
| 49 | |||
| 50 | &external_label("OPENSSL_ia32cap_P") if ($sse2); | ||
| 51 | |||
| 52 | &function_begin("bn_mul_mont"); | ||
| 53 | |||
| 54 | $i="edx"; | ||
| 55 | $j="ecx"; | ||
| 56 | $ap="esi"; $tp="esi"; # overlapping variables!!! | ||
| 57 | $rp="edi"; $bp="edi"; # overlapping variables!!! | ||
| 58 | $np="ebp"; | ||
| 59 | $num="ebx"; | ||
| 60 | |||
| 61 | $_num=&DWP(4*0,"esp"); # stack top layout | ||
| 62 | $_rp=&DWP(4*1,"esp"); | ||
| 63 | $_ap=&DWP(4*2,"esp"); | ||
| 64 | $_bp=&DWP(4*3,"esp"); | ||
| 65 | $_np=&DWP(4*4,"esp"); | ||
| 66 | $_n0=&DWP(4*5,"esp"); $_n0q=&QWP(4*5,"esp"); | ||
| 67 | $_sp=&DWP(4*6,"esp"); | ||
| 68 | $_bpend=&DWP(4*7,"esp"); | ||
| 69 | $frame=32; # size of above frame rounded up to 16n | ||
| 70 | |||
| 71 | &xor ("eax","eax"); | ||
| 72 | &mov ("edi",&wparam(5)); # int num | ||
| 73 | &cmp ("edi",4); | ||
| 74 | &jl (&label("just_leave")); | ||
| 75 | |||
| 76 | &lea ("esi",&wparam(0)); # put aside pointer to argument block | ||
| 77 | &lea ("edx",&wparam(1)); # load ap | ||
| 78 | &mov ("ebp","esp"); # saved stack pointer! | ||
| 79 | &add ("edi",2); # extra two words on top of tp | ||
| 80 | &neg ("edi"); | ||
| 81 | &lea ("esp",&DWP(-$frame,"esp","edi",4)); # alloca($frame+4*(num+2)) | ||
| 82 | &neg ("edi"); | ||
| 83 | |||
| 84 | # minimize cache contention by arraning 2K window between stack | ||
| 85 | # pointer and ap argument [np is also position sensitive vector, | ||
| 86 | # but it's assumed to be near ap, as it's allocated at ~same | ||
| 87 | # time]. | ||
| 88 | &mov ("eax","esp"); | ||
| 89 | &sub ("eax","edx"); | ||
| 90 | &and ("eax",2047); | ||
| 91 | &sub ("esp","eax"); # this aligns sp and ap modulo 2048 | ||
| 92 | |||
| 93 | &xor ("edx","esp"); | ||
| 94 | &and ("edx",2048); | ||
| 95 | &xor ("edx",2048); | ||
| 96 | &sub ("esp","edx"); # this splits them apart modulo 4096 | ||
| 97 | |||
| 98 | &and ("esp",-64); # align to cache line | ||
| 99 | |||
| 100 | ################################# load argument block... | ||
| 101 | &mov ("eax",&DWP(0*4,"esi"));# BN_ULONG *rp | ||
| 102 | &mov ("ebx",&DWP(1*4,"esi"));# const BN_ULONG *ap | ||
| 103 | &mov ("ecx",&DWP(2*4,"esi"));# const BN_ULONG *bp | ||
| 104 | &mov ("edx",&DWP(3*4,"esi"));# const BN_ULONG *np | ||
| 105 | &mov ("esi",&DWP(4*4,"esi"));# const BN_ULONG *n0 | ||
| 106 | #&mov ("edi",&DWP(5*4,"esi"));# int num | ||
| 107 | |||
| 108 | &mov ("esi",&DWP(0,"esi")); # pull n0[0] | ||
| 109 | &mov ($_rp,"eax"); # ... save a copy of argument block | ||
| 110 | &mov ($_ap,"ebx"); | ||
| 111 | &mov ($_bp,"ecx"); | ||
| 112 | &mov ($_np,"edx"); | ||
| 113 | &mov ($_n0,"esi"); | ||
| 114 | &lea ($num,&DWP(-3,"edi")); # num=num-1 to assist modulo-scheduling | ||
| 115 | #&mov ($_num,$num); # redundant as $num is not reused | ||
| 116 | &mov ($_sp,"ebp"); # saved stack pointer! | ||
| 117 | |||
| 118 | if($sse2) { | ||
| 119 | $acc0="mm0"; # mmx register bank layout | ||
| 120 | $acc1="mm1"; | ||
| 121 | $car0="mm2"; | ||
| 122 | $car1="mm3"; | ||
| 123 | $mul0="mm4"; | ||
| 124 | $mul1="mm5"; | ||
| 125 | $temp="mm6"; | ||
| 126 | $mask="mm7"; | ||
| 127 | |||
| 128 | &picmeup("eax","OPENSSL_ia32cap_P"); | ||
| 129 | &bt (&DWP(0,"eax"),26); | ||
| 130 | &jnc (&label("non_sse2")); | ||
| 131 | |||
| 132 | &mov ("eax",-1); | ||
| 133 | &movd ($mask,"eax"); # mask 32 lower bits | ||
| 134 | |||
| 135 | &mov ($ap,$_ap); # load input pointers | ||
| 136 | &mov ($bp,$_bp); | ||
| 137 | &mov ($np,$_np); | ||
| 138 | |||
| 139 | &xor ($i,$i); # i=0 | ||
| 140 | &xor ($j,$j); # j=0 | ||
| 141 | |||
| 142 | &movd ($mul0,&DWP(0,$bp)); # bp[0] | ||
| 143 | &movd ($mul1,&DWP(0,$ap)); # ap[0] | ||
| 144 | &movd ($car1,&DWP(0,$np)); # np[0] | ||
| 145 | |||
| 146 | &pmuludq($mul1,$mul0); # ap[0]*bp[0] | ||
| 147 | &movq ($car0,$mul1); | ||
| 148 | &movq ($acc0,$mul1); # I wish movd worked for | ||
| 149 | &pand ($acc0,$mask); # inter-register transfers | ||
| 150 | |||
| 151 | &pmuludq($mul1,$_n0q); # *=n0 | ||
| 152 | |||
| 153 | &pmuludq($car1,$mul1); # "t[0]"*np[0]*n0 | ||
| 154 | &paddq ($car1,$acc0); | ||
| 155 | |||
| 156 | &movd ($acc1,&DWP(4,$np)); # np[1] | ||
| 157 | &movd ($acc0,&DWP(4,$ap)); # ap[1] | ||
| 158 | |||
| 159 | &psrlq ($car0,32); | ||
| 160 | &psrlq ($car1,32); | ||
| 161 | |||
| 162 | &inc ($j); # j++ | ||
| 163 | &set_label("1st",16); | ||
| 164 | &pmuludq($acc0,$mul0); # ap[j]*bp[0] | ||
| 165 | &pmuludq($acc1,$mul1); # np[j]*m1 | ||
| 166 | &paddq ($car0,$acc0); # +=c0 | ||
| 167 | &paddq ($car1,$acc1); # +=c1 | ||
| 168 | |||
| 169 | &movq ($acc0,$car0); | ||
| 170 | &pand ($acc0,$mask); | ||
| 171 | &movd ($acc1,&DWP(4,$np,$j,4)); # np[j+1] | ||
| 172 | &paddq ($car1,$acc0); # +=ap[j]*bp[0]; | ||
| 173 | &movd ($acc0,&DWP(4,$ap,$j,4)); # ap[j+1] | ||
| 174 | &psrlq ($car0,32); | ||
| 175 | &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[j-1]= | ||
| 176 | &psrlq ($car1,32); | ||
| 177 | |||
| 178 | &lea ($j,&DWP(1,$j)); | ||
| 179 | &cmp ($j,$num); | ||
| 180 | &jl (&label("1st")); | ||
| 181 | |||
| 182 | &pmuludq($acc0,$mul0); # ap[num-1]*bp[0] | ||
| 183 | &pmuludq($acc1,$mul1); # np[num-1]*m1 | ||
| 184 | &paddq ($car0,$acc0); # +=c0 | ||
| 185 | &paddq ($car1,$acc1); # +=c1 | ||
| 186 | |||
| 187 | &movq ($acc0,$car0); | ||
| 188 | &pand ($acc0,$mask); | ||
| 189 | &paddq ($car1,$acc0); # +=ap[num-1]*bp[0]; | ||
| 190 | &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[num-2]= | ||
| 191 | |||
| 192 | &psrlq ($car0,32); | ||
| 193 | &psrlq ($car1,32); | ||
| 194 | |||
| 195 | &paddq ($car1,$car0); | ||
| 196 | &movq (&QWP($frame,"esp",$num,4),$car1); # tp[num].tp[num-1] | ||
| 197 | |||
| 198 | &inc ($i); # i++ | ||
| 199 | &set_label("outer"); | ||
| 200 | &xor ($j,$j); # j=0 | ||
| 201 | |||
| 202 | &movd ($mul0,&DWP(0,$bp,$i,4)); # bp[i] | ||
| 203 | &movd ($mul1,&DWP(0,$ap)); # ap[0] | ||
| 204 | &movd ($temp,&DWP($frame,"esp")); # tp[0] | ||
| 205 | &movd ($car1,&DWP(0,$np)); # np[0] | ||
| 206 | &pmuludq($mul1,$mul0); # ap[0]*bp[i] | ||
| 207 | |||
| 208 | &paddq ($mul1,$temp); # +=tp[0] | ||
| 209 | &movq ($acc0,$mul1); | ||
| 210 | &movq ($car0,$mul1); | ||
| 211 | &pand ($acc0,$mask); | ||
| 212 | |||
| 213 | &pmuludq($mul1,$_n0q); # *=n0 | ||
| 214 | |||
| 215 | &pmuludq($car1,$mul1); | ||
| 216 | &paddq ($car1,$acc0); | ||
| 217 | |||
| 218 | &movd ($temp,&DWP($frame+4,"esp")); # tp[1] | ||
| 219 | &movd ($acc1,&DWP(4,$np)); # np[1] | ||
| 220 | &movd ($acc0,&DWP(4,$ap)); # ap[1] | ||
| 221 | |||
| 222 | &psrlq ($car0,32); | ||
| 223 | &psrlq ($car1,32); | ||
| 224 | &paddq ($car0,$temp); # +=tp[1] | ||
| 225 | |||
| 226 | &inc ($j); # j++ | ||
| 227 | &dec ($num); | ||
| 228 | &set_label("inner"); | ||
| 229 | &pmuludq($acc0,$mul0); # ap[j]*bp[i] | ||
| 230 | &pmuludq($acc1,$mul1); # np[j]*m1 | ||
| 231 | &paddq ($car0,$acc0); # +=c0 | ||
| 232 | &paddq ($car1,$acc1); # +=c1 | ||
| 233 | |||
| 234 | &movq ($acc0,$car0); | ||
| 235 | &movd ($temp,&DWP($frame+4,"esp",$j,4));# tp[j+1] | ||
| 236 | &pand ($acc0,$mask); | ||
| 237 | &movd ($acc1,&DWP(4,$np,$j,4)); # np[j+1] | ||
| 238 | &paddq ($car1,$acc0); # +=ap[j]*bp[i]+tp[j] | ||
| 239 | &movd ($acc0,&DWP(4,$ap,$j,4)); # ap[j+1] | ||
| 240 | &psrlq ($car0,32); | ||
| 241 | &movd (&DWP($frame-4,"esp",$j,4),$car1);# tp[j-1]= | ||
| 242 | &psrlq ($car1,32); | ||
| 243 | &paddq ($car0,$temp); # +=tp[j+1] | ||
| 244 | |||
| 245 | &dec ($num); | ||
| 246 | &lea ($j,&DWP(1,$j)); # j++ | ||
| 247 | &jnz (&label("inner")); | ||
| 248 | |||
| 249 | &mov ($num,$j); | ||
| 250 | &pmuludq($acc0,$mul0); # ap[num-1]*bp[i] | ||
| 251 | &pmuludq($acc1,$mul1); # np[num-1]*m1 | ||
| 252 | &paddq ($car0,$acc0); # +=c0 | ||
| 253 | &paddq ($car1,$acc1); # +=c1 | ||
| 254 | |||
| 255 | &movq ($acc0,$car0); | ||
| 256 | &pand ($acc0,$mask); | ||
| 257 | &paddq ($car1,$acc0); # +=ap[num-1]*bp[i]+tp[num-1] | ||
| 258 | &movd (&DWP($frame-4,"esp",$j,4),$car1); # tp[num-2]= | ||
| 259 | &psrlq ($car0,32); | ||
| 260 | &psrlq ($car1,32); | ||
| 261 | |||
| 262 | &movd ($temp,&DWP($frame+4,"esp",$num,4)); # += tp[num] | ||
| 263 | &paddq ($car1,$car0); | ||
| 264 | &paddq ($car1,$temp); | ||
| 265 | &movq (&QWP($frame,"esp",$num,4),$car1); # tp[num].tp[num-1] | ||
| 266 | |||
| 267 | &lea ($i,&DWP(1,$i)); # i++ | ||
| 268 | &cmp ($i,$num); | ||
| 269 | &jle (&label("outer")); | ||
| 270 | |||
| 271 | &emms (); # done with mmx bank | ||
| 272 | &jmp (&label("common_tail")); | ||
| 273 | |||
| 274 | &set_label("non_sse2",16); | ||
| 275 | } | ||
| 276 | |||
| 277 | if (0) { | ||
| 278 | &mov ("esp",$_sp); | ||
| 279 | &xor ("eax","eax"); # signal "not fast enough [yet]" | ||
| 280 | &jmp (&label("just_leave")); | ||
| 281 | # While the below code provides competitive performance for | ||
| 282 | # all key lengthes on modern Intel cores, it's still more | ||
| 283 | # than 10% slower for 4096-bit key elsewhere:-( "Competitive" | ||
| 284 | # means compared to the original integer-only assembler. | ||
| 285 | # 512-bit RSA sign is better by ~40%, but that's about all | ||
| 286 | # one can say about all CPUs... | ||
| 287 | } else { | ||
| 288 | $inp="esi"; # integer path uses these registers differently | ||
| 289 | $word="edi"; | ||
| 290 | $carry="ebp"; | ||
| 291 | |||
| 292 | &mov ($inp,$_ap); | ||
| 293 | &lea ($carry,&DWP(1,$num)); | ||
| 294 | &mov ($word,$_bp); | ||
| 295 | &xor ($j,$j); # j=0 | ||
| 296 | &mov ("edx",$inp); | ||
| 297 | &and ($carry,1); # see if num is even | ||
| 298 | &sub ("edx",$word); # see if ap==bp | ||
| 299 | &lea ("eax",&DWP(4,$word,$num,4)); # &bp[num] | ||
| 300 | &or ($carry,"edx"); | ||
| 301 | &mov ($word,&DWP(0,$word)); # bp[0] | ||
| 302 | &jz (&label("bn_sqr_mont")); | ||
| 303 | &mov ($_bpend,"eax"); | ||
| 304 | &mov ("eax",&DWP(0,$inp)); | ||
| 305 | &xor ("edx","edx"); | ||
| 306 | |||
| 307 | &set_label("mull",16); | ||
| 308 | &mov ($carry,"edx"); | ||
| 309 | &mul ($word); # ap[j]*bp[0] | ||
| 310 | &add ($carry,"eax"); | ||
| 311 | &lea ($j,&DWP(1,$j)); | ||
| 312 | &adc ("edx",0); | ||
| 313 | &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j+1] | ||
| 314 | &cmp ($j,$num); | ||
| 315 | &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]= | ||
| 316 | &jl (&label("mull")); | ||
| 317 | |||
| 318 | &mov ($carry,"edx"); | ||
| 319 | &mul ($word); # ap[num-1]*bp[0] | ||
| 320 | &mov ($word,$_n0); | ||
| 321 | &add ("eax",$carry); | ||
| 322 | &mov ($inp,$_np); | ||
| 323 | &adc ("edx",0); | ||
| 324 | &imul ($word,&DWP($frame,"esp")); # n0*tp[0] | ||
| 325 | |||
| 326 | &mov (&DWP($frame,"esp",$num,4),"eax"); # tp[num-1]= | ||
| 327 | &xor ($j,$j); | ||
| 328 | &mov (&DWP($frame+4,"esp",$num,4),"edx"); # tp[num]= | ||
| 329 | &mov (&DWP($frame+8,"esp",$num,4),$j); # tp[num+1]= | ||
| 330 | |||
| 331 | &mov ("eax",&DWP(0,$inp)); # np[0] | ||
| 332 | &mul ($word); # np[0]*m | ||
| 333 | &add ("eax",&DWP($frame,"esp")); # +=tp[0] | ||
| 334 | &mov ("eax",&DWP(4,$inp)); # np[1] | ||
| 335 | &adc ("edx",0); | ||
| 336 | &inc ($j); | ||
| 337 | |||
| 338 | &jmp (&label("2ndmadd")); | ||
| 339 | |||
| 340 | &set_label("1stmadd",16); | ||
| 341 | &mov ($carry,"edx"); | ||
| 342 | &mul ($word); # ap[j]*bp[i] | ||
| 343 | &add ($carry,&DWP($frame,"esp",$j,4)); # +=tp[j] | ||
| 344 | &lea ($j,&DWP(1,$j)); | ||
| 345 | &adc ("edx",0); | ||
| 346 | &add ($carry,"eax"); | ||
| 347 | &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j+1] | ||
| 348 | &adc ("edx",0); | ||
| 349 | &cmp ($j,$num); | ||
| 350 | &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]= | ||
| 351 | &jl (&label("1stmadd")); | ||
| 352 | |||
| 353 | &mov ($carry,"edx"); | ||
| 354 | &mul ($word); # ap[num-1]*bp[i] | ||
| 355 | &add ("eax",&DWP($frame,"esp",$num,4)); # +=tp[num-1] | ||
| 356 | &mov ($word,$_n0); | ||
| 357 | &adc ("edx",0); | ||
| 358 | &mov ($inp,$_np); | ||
| 359 | &add ($carry,"eax"); | ||
| 360 | &adc ("edx",0); | ||
| 361 | &imul ($word,&DWP($frame,"esp")); # n0*tp[0] | ||
| 362 | |||
| 363 | &xor ($j,$j); | ||
| 364 | &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=tp[num] | ||
| 365 | &mov (&DWP($frame,"esp",$num,4),$carry); # tp[num-1]= | ||
| 366 | &adc ($j,0); | ||
| 367 | &mov ("eax",&DWP(0,$inp)); # np[0] | ||
| 368 | &mov (&DWP($frame+4,"esp",$num,4),"edx"); # tp[num]= | ||
| 369 | &mov (&DWP($frame+8,"esp",$num,4),$j); # tp[num+1]= | ||
| 370 | |||
| 371 | &mul ($word); # np[0]*m | ||
| 372 | &add ("eax",&DWP($frame,"esp")); # +=tp[0] | ||
| 373 | &mov ("eax",&DWP(4,$inp)); # np[1] | ||
| 374 | &adc ("edx",0); | ||
| 375 | &mov ($j,1); | ||
| 376 | |||
| 377 | &set_label("2ndmadd",16); | ||
| 378 | &mov ($carry,"edx"); | ||
| 379 | &mul ($word); # np[j]*m | ||
| 380 | &add ($carry,&DWP($frame,"esp",$j,4)); # +=tp[j] | ||
| 381 | &lea ($j,&DWP(1,$j)); | ||
| 382 | &adc ("edx",0); | ||
| 383 | &add ($carry,"eax"); | ||
| 384 | &mov ("eax",&DWP(0,$inp,$j,4)); # np[j+1] | ||
| 385 | &adc ("edx",0); | ||
| 386 | &cmp ($j,$num); | ||
| 387 | &mov (&DWP($frame-8,"esp",$j,4),$carry); # tp[j-1]= | ||
| 388 | &jl (&label("2ndmadd")); | ||
| 389 | |||
| 390 | &mov ($carry,"edx"); | ||
| 391 | &mul ($word); # np[j]*m | ||
| 392 | &add ($carry,&DWP($frame,"esp",$num,4)); # +=tp[num-1] | ||
| 393 | &adc ("edx",0); | ||
| 394 | &add ($carry,"eax"); | ||
| 395 | &adc ("edx",0); | ||
| 396 | &mov (&DWP($frame-4,"esp",$num,4),$carry); # tp[num-2]= | ||
| 397 | |||
| 398 | &xor ("eax","eax"); | ||
| 399 | &mov ($j,$_bp); # &bp[i] | ||
| 400 | &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=tp[num] | ||
| 401 | &adc ("eax",&DWP($frame+8,"esp",$num,4)); # +=tp[num+1] | ||
| 402 | &lea ($j,&DWP(4,$j)); | ||
| 403 | &mov (&DWP($frame,"esp",$num,4),"edx"); # tp[num-1]= | ||
| 404 | &cmp ($j,$_bpend); | ||
| 405 | &mov (&DWP($frame+4,"esp",$num,4),"eax"); # tp[num]= | ||
| 406 | &je (&label("common_tail")); | ||
| 407 | |||
| 408 | &mov ($word,&DWP(0,$j)); # bp[i+1] | ||
| 409 | &mov ($inp,$_ap); | ||
| 410 | &mov ($_bp,$j); # &bp[++i] | ||
| 411 | &xor ($j,$j); | ||
| 412 | &xor ("edx","edx"); | ||
| 413 | &mov ("eax",&DWP(0,$inp)); | ||
| 414 | &jmp (&label("1stmadd")); | ||
| 415 | |||
| 416 | &set_label("bn_sqr_mont",16); | ||
| 417 | $sbit=$num; | ||
| 418 | &mov ($_num,$num); | ||
| 419 | &mov ($_bp,$j); # i=0 | ||
| 420 | |||
| 421 | &mov ("eax",$word); # ap[0] | ||
| 422 | &mul ($word); # ap[0]*ap[0] | ||
| 423 | &mov (&DWP($frame,"esp"),"eax"); # tp[0]= | ||
| 424 | &mov ($sbit,"edx"); | ||
| 425 | &shr ("edx",1); | ||
| 426 | &and ($sbit,1); | ||
| 427 | &inc ($j); | ||
| 428 | &set_label("sqr",16); | ||
| 429 | &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j] | ||
| 430 | &mov ($carry,"edx"); | ||
| 431 | &mul ($word); # ap[j]*ap[0] | ||
| 432 | &add ("eax",$carry); | ||
| 433 | &lea ($j,&DWP(1,$j)); | ||
| 434 | &adc ("edx",0); | ||
| 435 | &lea ($carry,&DWP(0,$sbit,"eax",2)); | ||
| 436 | &shr ("eax",31); | ||
| 437 | &cmp ($j,$_num); | ||
| 438 | &mov ($sbit,"eax"); | ||
| 439 | &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]= | ||
| 440 | &jl (&label("sqr")); | ||
| 441 | |||
| 442 | &mov ("eax",&DWP(0,$inp,$j,4)); # ap[num-1] | ||
| 443 | &mov ($carry,"edx"); | ||
| 444 | &mul ($word); # ap[num-1]*ap[0] | ||
| 445 | &add ("eax",$carry); | ||
| 446 | &mov ($word,$_n0); | ||
| 447 | &adc ("edx",0); | ||
| 448 | &mov ($inp,$_np); | ||
| 449 | &lea ($carry,&DWP(0,$sbit,"eax",2)); | ||
| 450 | &imul ($word,&DWP($frame,"esp")); # n0*tp[0] | ||
| 451 | &shr ("eax",31); | ||
| 452 | &mov (&DWP($frame,"esp",$j,4),$carry); # tp[num-1]= | ||
| 453 | |||
| 454 | &lea ($carry,&DWP(0,"eax","edx",2)); | ||
| 455 | &mov ("eax",&DWP(0,$inp)); # np[0] | ||
| 456 | &shr ("edx",31); | ||
| 457 | &mov (&DWP($frame+4,"esp",$j,4),$carry); # tp[num]= | ||
| 458 | &mov (&DWP($frame+8,"esp",$j,4),"edx"); # tp[num+1]= | ||
| 459 | |||
| 460 | &mul ($word); # np[0]*m | ||
| 461 | &add ("eax",&DWP($frame,"esp")); # +=tp[0] | ||
| 462 | &mov ($num,$j); | ||
| 463 | &adc ("edx",0); | ||
| 464 | &mov ("eax",&DWP(4,$inp)); # np[1] | ||
| 465 | &mov ($j,1); | ||
| 466 | |||
| 467 | &set_label("3rdmadd",16); | ||
| 468 | &mov ($carry,"edx"); | ||
| 469 | &mul ($word); # np[j]*m | ||
| 470 | &add ($carry,&DWP($frame,"esp",$j,4)); # +=tp[j] | ||
| 471 | &adc ("edx",0); | ||
| 472 | &add ($carry,"eax"); | ||
| 473 | &mov ("eax",&DWP(4,$inp,$j,4)); # np[j+1] | ||
| 474 | &adc ("edx",0); | ||
| 475 | &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j-1]= | ||
| 476 | |||
| 477 | &mov ($carry,"edx"); | ||
| 478 | &mul ($word); # np[j+1]*m | ||
| 479 | &add ($carry,&DWP($frame+4,"esp",$j,4)); # +=tp[j+1] | ||
| 480 | &lea ($j,&DWP(2,$j)); | ||
| 481 | &adc ("edx",0); | ||
| 482 | &add ($carry,"eax"); | ||
| 483 | &mov ("eax",&DWP(0,$inp,$j,4)); # np[j+2] | ||
| 484 | &adc ("edx",0); | ||
| 485 | &cmp ($j,$num); | ||
| 486 | &mov (&DWP($frame-8,"esp",$j,4),$carry); # tp[j]= | ||
| 487 | &jl (&label("3rdmadd")); | ||
| 488 | |||
| 489 | &mov ($carry,"edx"); | ||
| 490 | &mul ($word); # np[j]*m | ||
| 491 | &add ($carry,&DWP($frame,"esp",$num,4)); # +=tp[num-1] | ||
| 492 | &adc ("edx",0); | ||
| 493 | &add ($carry,"eax"); | ||
| 494 | &adc ("edx",0); | ||
| 495 | &mov (&DWP($frame-4,"esp",$num,4),$carry); # tp[num-2]= | ||
| 496 | |||
| 497 | &mov ($j,$_bp); # i | ||
| 498 | &xor ("eax","eax"); | ||
| 499 | &mov ($inp,$_ap); | ||
| 500 | &add ("edx",&DWP($frame+4,"esp",$num,4)); # carry+=tp[num] | ||
| 501 | &adc ("eax",&DWP($frame+8,"esp",$num,4)); # +=tp[num+1] | ||
| 502 | &mov (&DWP($frame,"esp",$num,4),"edx"); # tp[num-1]= | ||
| 503 | &cmp ($j,$num); | ||
| 504 | &mov (&DWP($frame+4,"esp",$num,4),"eax"); # tp[num]= | ||
| 505 | &je (&label("common_tail")); | ||
| 506 | |||
| 507 | &mov ($word,&DWP(4,$inp,$j,4)); # ap[i] | ||
| 508 | &lea ($j,&DWP(1,$j)); | ||
| 509 | &mov ("eax",$word); | ||
| 510 | &mov ($_bp,$j); # ++i | ||
| 511 | &mul ($word); # ap[i]*ap[i] | ||
| 512 | &add ("eax",&DWP($frame,"esp",$j,4)); # +=tp[i] | ||
| 513 | &adc ("edx",0); | ||
| 514 | &mov (&DWP($frame,"esp",$j,4),"eax"); # tp[i]= | ||
| 515 | &xor ($carry,$carry); | ||
| 516 | &cmp ($j,$num); | ||
| 517 | &lea ($j,&DWP(1,$j)); | ||
| 518 | &je (&label("sqrlast")); | ||
| 519 | |||
| 520 | &mov ($sbit,"edx"); # zaps $num | ||
| 521 | &shr ("edx",1); | ||
| 522 | &and ($sbit,1); | ||
| 523 | &set_label("sqradd",16); | ||
| 524 | &mov ("eax",&DWP(0,$inp,$j,4)); # ap[j] | ||
| 525 | &mov ($carry,"edx"); | ||
| 526 | &mul ($word); # ap[j]*ap[i] | ||
| 527 | &add ("eax",$carry); | ||
| 528 | &lea ($carry,&DWP(0,"eax","eax")); | ||
| 529 | &adc ("edx",0); | ||
| 530 | &shr ("eax",31); | ||
| 531 | &add ($carry,&DWP($frame,"esp",$j,4)); # +=tp[j] | ||
| 532 | &lea ($j,&DWP(1,$j)); | ||
| 533 | &adc ("eax",0); | ||
| 534 | &add ($carry,$sbit); | ||
| 535 | &adc ("eax",0); | ||
| 536 | &cmp ($j,$_num); | ||
| 537 | &mov (&DWP($frame-4,"esp",$j,4),$carry); # tp[j]= | ||
| 538 | &mov ($sbit,"eax"); | ||
| 539 | &jle (&label("sqradd")); | ||
| 540 | |||
| 541 | &mov ($carry,"edx"); | ||
| 542 | &lea ("edx",&DWP(0,$sbit,"edx",2)); | ||
| 543 | &shr ($carry,31); | ||
| 544 | &set_label("sqrlast"); | ||
| 545 | &mov ($word,$_n0); | ||
| 546 | &mov ($inp,$_np); | ||
| 547 | &imul ($word,&DWP($frame,"esp")); # n0*tp[0] | ||
| 548 | |||
| 549 | &add ("edx",&DWP($frame,"esp",$j,4)); # +=tp[num] | ||
| 550 | &mov ("eax",&DWP(0,$inp)); # np[0] | ||
| 551 | &adc ($carry,0); | ||
| 552 | &mov (&DWP($frame,"esp",$j,4),"edx"); # tp[num]= | ||
| 553 | &mov (&DWP($frame+4,"esp",$j,4),$carry); # tp[num+1]= | ||
| 554 | |||
| 555 | &mul ($word); # np[0]*m | ||
| 556 | &add ("eax",&DWP($frame,"esp")); # +=tp[0] | ||
| 557 | &lea ($num,&DWP(-1,$j)); | ||
| 558 | &adc ("edx",0); | ||
| 559 | &mov ($j,1); | ||
| 560 | &mov ("eax",&DWP(4,$inp)); # np[1] | ||
| 561 | |||
| 562 | &jmp (&label("3rdmadd")); | ||
| 563 | } | ||
| 564 | |||
| 565 | &set_label("common_tail",16); | ||
| 566 | &mov ($np,$_np); # load modulus pointer | ||
| 567 | &mov ($rp,$_rp); # load result pointer | ||
| 568 | &lea ($tp,&DWP($frame,"esp")); # [$ap and $bp are zapped] | ||
| 569 | |||
| 570 | &mov ("eax",&DWP(0,$tp)); # tp[0] | ||
| 571 | &mov ($j,$num); # j=num-1 | ||
| 572 | &xor ($i,$i); # i=0 and clear CF! | ||
| 573 | |||
| 574 | &set_label("sub",16); | ||
| 575 | &sbb ("eax",&DWP(0,$np,$i,4)); | ||
| 576 | &mov (&DWP(0,$rp,$i,4),"eax"); # rp[i]=tp[i]-np[i] | ||
| 577 | &dec ($j); # doesn't affect CF! | ||
| 578 | &mov ("eax",&DWP(4,$tp,$i,4)); # tp[i+1] | ||
| 579 | &lea ($i,&DWP(1,$i)); # i++ | ||
| 580 | &jge (&label("sub")); | ||
| 581 | |||
| 582 | &sbb ("eax",0); # handle upmost overflow bit | ||
| 583 | &and ($tp,"eax"); | ||
| 584 | ¬ ("eax"); | ||
| 585 | &mov ($np,$rp); | ||
| 586 | &and ($np,"eax"); | ||
| 587 | &or ($tp,$np); # tp=carry?tp:rp | ||
| 588 | |||
| 589 | &set_label("copy",16); # copy or in-place refresh | ||
| 590 | &mov ("eax",&DWP(0,$tp,$num,4)); | ||
| 591 | &mov (&DWP(0,$rp,$num,4),"eax"); # rp[i]=tp[i] | ||
| 592 | &mov (&DWP($frame,"esp",$num,4),$j); # zap temporary vector | ||
| 593 | &dec ($num); | ||
| 594 | &jge (&label("copy")); | ||
| 595 | |||
| 596 | &mov ("esp",$_sp); # pull saved stack pointer | ||
| 597 | &mov ("eax",1); | ||
| 598 | &set_label("just_leave"); | ||
| 599 | &function_end("bn_mul_mont"); | ||
| 600 | |||
| 601 | &asciz("Montgomery Multiplication for x86, CRYPTOGAMS by <appro\@openssl.org>"); | ||
| 602 | |||
| 603 | &asm_finish(); | ||
diff --git a/src/lib/libcrypto/bn/asm/pa-risc.s b/src/lib/libcrypto/bn/asm/pa-risc.s deleted file mode 100644 index 775130a191..0000000000 --- a/src/lib/libcrypto/bn/asm/pa-risc.s +++ /dev/null | |||
| @@ -1,710 +0,0 @@ | |||
| 1 | .SPACE $PRIVATE$ | ||
| 2 | .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31 | ||
| 3 | .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82 | ||
| 4 | .SPACE $TEXT$ | ||
| 5 | .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44 | ||
| 6 | .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY | ||
| 7 | .IMPORT $global$,DATA | ||
| 8 | .IMPORT $$dyncall,MILLICODE | ||
| 9 | ; gcc_compiled.: | ||
| 10 | .SPACE $TEXT$ | ||
| 11 | .SUBSPA $CODE$ | ||
| 12 | |||
| 13 | .align 4 | ||
| 14 | .EXPORT bn_mul_add_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR | ||
| 15 | bn_mul_add_words | ||
| 16 | .PROC | ||
| 17 | .CALLINFO FRAME=0,CALLS,SAVE_RP | ||
| 18 | .ENTRY | ||
| 19 | stw %r2,-20(0,%r30) | ||
| 20 | ldi 0,%r28 | ||
| 21 | extru %r23,31,16,%r2 | ||
| 22 | stw %r2,-16(0,%r30) | ||
| 23 | extru %r23,15,16,%r23 | ||
| 24 | ldil L'65536,%r31 | ||
| 25 | fldws -16(0,%r30),%fr11R | ||
| 26 | stw %r23,-16(0,%r30) | ||
| 27 | ldo 12(%r25),%r29 | ||
| 28 | ldo 12(%r26),%r23 | ||
| 29 | fldws -16(0,%r30),%fr11L | ||
| 30 | L$0002 | ||
| 31 | ldw 0(0,%r25),%r19 | ||
| 32 | extru %r19,31,16,%r20 | ||
| 33 | stw %r20,-16(0,%r30) | ||
| 34 | extru %r19,15,16,%r19 | ||
| 35 | fldws -16(0,%r30),%fr22L | ||
| 36 | stw %r19,-16(0,%r30) | ||
| 37 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 38 | fldws -16(0,%r30),%fr22L | ||
| 39 | fstws %fr8R,-16(0,%r30) | ||
| 40 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 41 | ldw -16(0,%r30),%r2 | ||
| 42 | stw %r20,-16(0,%r30) | ||
| 43 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 44 | fldws -16(0,%r30),%fr22L | ||
| 45 | fstws %fr10R,-16(0,%r30) | ||
| 46 | copy %r2,%r22 | ||
| 47 | ldw -16(0,%r30),%r2 | ||
| 48 | fstws %fr9R,-16(0,%r30) | ||
| 49 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 50 | copy %r2,%r19 | ||
| 51 | ldw -16(0,%r30),%r2 | ||
| 52 | fstws %fr8R,-16(0,%r30) | ||
| 53 | copy %r2,%r20 | ||
| 54 | ldw -16(0,%r30),%r2 | ||
| 55 | addl %r2,%r19,%r21 | ||
| 56 | comclr,<<= %r19,%r21,0 | ||
| 57 | addl %r20,%r31,%r20 | ||
| 58 | L$0005 | ||
| 59 | extru %r21,15,16,%r19 | ||
| 60 | addl %r20,%r19,%r20 | ||
| 61 | zdep %r21,15,16,%r19 | ||
| 62 | addl %r22,%r19,%r22 | ||
| 63 | comclr,<<= %r19,%r22,0 | ||
| 64 | addi,tr 1,%r20,%r19 | ||
| 65 | copy %r20,%r19 | ||
| 66 | addl %r22,%r28,%r20 | ||
| 67 | comclr,<<= %r28,%r20,0 | ||
| 68 | addi 1,%r19,%r19 | ||
| 69 | ldw 0(0,%r26),%r28 | ||
| 70 | addl %r20,%r28,%r20 | ||
| 71 | comclr,<<= %r28,%r20,0 | ||
| 72 | addi,tr 1,%r19,%r28 | ||
| 73 | copy %r19,%r28 | ||
| 74 | addib,= -1,%r24,L$0003 | ||
| 75 | stw %r20,0(0,%r26) | ||
| 76 | ldw -8(0,%r29),%r19 | ||
| 77 | extru %r19,31,16,%r20 | ||
| 78 | stw %r20,-16(0,%r30) | ||
| 79 | extru %r19,15,16,%r19 | ||
| 80 | fldws -16(0,%r30),%fr22L | ||
| 81 | stw %r19,-16(0,%r30) | ||
| 82 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 83 | fldws -16(0,%r30),%fr22L | ||
| 84 | fstws %fr8R,-16(0,%r30) | ||
| 85 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 86 | ldw -16(0,%r30),%r2 | ||
| 87 | stw %r20,-16(0,%r30) | ||
| 88 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 89 | fldws -16(0,%r30),%fr22L | ||
| 90 | fstws %fr10R,-16(0,%r30) | ||
| 91 | copy %r2,%r22 | ||
| 92 | ldw -16(0,%r30),%r2 | ||
| 93 | fstws %fr9R,-16(0,%r30) | ||
| 94 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 95 | copy %r2,%r19 | ||
| 96 | ldw -16(0,%r30),%r2 | ||
| 97 | fstws %fr8R,-16(0,%r30) | ||
| 98 | copy %r2,%r20 | ||
| 99 | ldw -16(0,%r30),%r2 | ||
| 100 | addl %r2,%r19,%r21 | ||
| 101 | comclr,<<= %r19,%r21,0 | ||
| 102 | addl %r20,%r31,%r20 | ||
| 103 | L$0010 | ||
| 104 | extru %r21,15,16,%r19 | ||
| 105 | addl %r20,%r19,%r20 | ||
| 106 | zdep %r21,15,16,%r19 | ||
| 107 | addl %r22,%r19,%r22 | ||
| 108 | comclr,<<= %r19,%r22,0 | ||
| 109 | addi,tr 1,%r20,%r19 | ||
| 110 | copy %r20,%r19 | ||
| 111 | addl %r22,%r28,%r20 | ||
| 112 | comclr,<<= %r28,%r20,0 | ||
| 113 | addi 1,%r19,%r19 | ||
| 114 | ldw -8(0,%r23),%r28 | ||
| 115 | addl %r20,%r28,%r20 | ||
| 116 | comclr,<<= %r28,%r20,0 | ||
| 117 | addi,tr 1,%r19,%r28 | ||
| 118 | copy %r19,%r28 | ||
| 119 | addib,= -1,%r24,L$0003 | ||
| 120 | stw %r20,-8(0,%r23) | ||
| 121 | ldw -4(0,%r29),%r19 | ||
| 122 | extru %r19,31,16,%r20 | ||
| 123 | stw %r20,-16(0,%r30) | ||
| 124 | extru %r19,15,16,%r19 | ||
| 125 | fldws -16(0,%r30),%fr22L | ||
| 126 | stw %r19,-16(0,%r30) | ||
| 127 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 128 | fldws -16(0,%r30),%fr22L | ||
| 129 | fstws %fr8R,-16(0,%r30) | ||
| 130 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 131 | ldw -16(0,%r30),%r2 | ||
| 132 | stw %r20,-16(0,%r30) | ||
| 133 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 134 | fldws -16(0,%r30),%fr22L | ||
| 135 | fstws %fr10R,-16(0,%r30) | ||
| 136 | copy %r2,%r22 | ||
| 137 | ldw -16(0,%r30),%r2 | ||
| 138 | fstws %fr9R,-16(0,%r30) | ||
| 139 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 140 | copy %r2,%r19 | ||
| 141 | ldw -16(0,%r30),%r2 | ||
| 142 | fstws %fr8R,-16(0,%r30) | ||
| 143 | copy %r2,%r20 | ||
| 144 | ldw -16(0,%r30),%r2 | ||
| 145 | addl %r2,%r19,%r21 | ||
| 146 | comclr,<<= %r19,%r21,0 | ||
| 147 | addl %r20,%r31,%r20 | ||
| 148 | L$0015 | ||
| 149 | extru %r21,15,16,%r19 | ||
| 150 | addl %r20,%r19,%r20 | ||
| 151 | zdep %r21,15,16,%r19 | ||
| 152 | addl %r22,%r19,%r22 | ||
| 153 | comclr,<<= %r19,%r22,0 | ||
| 154 | addi,tr 1,%r20,%r19 | ||
| 155 | copy %r20,%r19 | ||
| 156 | addl %r22,%r28,%r20 | ||
| 157 | comclr,<<= %r28,%r20,0 | ||
| 158 | addi 1,%r19,%r19 | ||
| 159 | ldw -4(0,%r23),%r28 | ||
| 160 | addl %r20,%r28,%r20 | ||
| 161 | comclr,<<= %r28,%r20,0 | ||
| 162 | addi,tr 1,%r19,%r28 | ||
| 163 | copy %r19,%r28 | ||
| 164 | addib,= -1,%r24,L$0003 | ||
| 165 | stw %r20,-4(0,%r23) | ||
| 166 | ldw 0(0,%r29),%r19 | ||
| 167 | extru %r19,31,16,%r20 | ||
| 168 | stw %r20,-16(0,%r30) | ||
| 169 | extru %r19,15,16,%r19 | ||
| 170 | fldws -16(0,%r30),%fr22L | ||
| 171 | stw %r19,-16(0,%r30) | ||
| 172 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 173 | fldws -16(0,%r30),%fr22L | ||
| 174 | fstws %fr8R,-16(0,%r30) | ||
| 175 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 176 | ldw -16(0,%r30),%r2 | ||
| 177 | stw %r20,-16(0,%r30) | ||
| 178 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 179 | fldws -16(0,%r30),%fr22L | ||
| 180 | fstws %fr10R,-16(0,%r30) | ||
| 181 | copy %r2,%r22 | ||
| 182 | ldw -16(0,%r30),%r2 | ||
| 183 | fstws %fr9R,-16(0,%r30) | ||
| 184 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 185 | copy %r2,%r19 | ||
| 186 | ldw -16(0,%r30),%r2 | ||
| 187 | fstws %fr8R,-16(0,%r30) | ||
| 188 | copy %r2,%r20 | ||
| 189 | ldw -16(0,%r30),%r2 | ||
| 190 | addl %r2,%r19,%r21 | ||
| 191 | comclr,<<= %r19,%r21,0 | ||
| 192 | addl %r20,%r31,%r20 | ||
| 193 | L$0020 | ||
| 194 | extru %r21,15,16,%r19 | ||
| 195 | addl %r20,%r19,%r20 | ||
| 196 | zdep %r21,15,16,%r19 | ||
| 197 | addl %r22,%r19,%r22 | ||
| 198 | comclr,<<= %r19,%r22,0 | ||
| 199 | addi,tr 1,%r20,%r19 | ||
| 200 | copy %r20,%r19 | ||
| 201 | addl %r22,%r28,%r20 | ||
| 202 | comclr,<<= %r28,%r20,0 | ||
| 203 | addi 1,%r19,%r19 | ||
| 204 | ldw 0(0,%r23),%r28 | ||
| 205 | addl %r20,%r28,%r20 | ||
| 206 | comclr,<<= %r28,%r20,0 | ||
| 207 | addi,tr 1,%r19,%r28 | ||
| 208 | copy %r19,%r28 | ||
| 209 | addib,= -1,%r24,L$0003 | ||
| 210 | stw %r20,0(0,%r23) | ||
| 211 | ldo 16(%r29),%r29 | ||
| 212 | ldo 16(%r25),%r25 | ||
| 213 | ldo 16(%r23),%r23 | ||
| 214 | bl L$0002,0 | ||
| 215 | ldo 16(%r26),%r26 | ||
| 216 | L$0003 | ||
| 217 | ldw -20(0,%r30),%r2 | ||
| 218 | bv,n 0(%r2) | ||
| 219 | .EXIT | ||
| 220 | .PROCEND | ||
| 221 | .align 4 | ||
| 222 | .EXPORT bn_mul_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR | ||
| 223 | bn_mul_words | ||
| 224 | .PROC | ||
| 225 | .CALLINFO FRAME=0,CALLS,SAVE_RP | ||
| 226 | .ENTRY | ||
| 227 | stw %r2,-20(0,%r30) | ||
| 228 | ldi 0,%r28 | ||
| 229 | extru %r23,31,16,%r2 | ||
| 230 | stw %r2,-16(0,%r30) | ||
| 231 | extru %r23,15,16,%r23 | ||
| 232 | ldil L'65536,%r31 | ||
| 233 | fldws -16(0,%r30),%fr11R | ||
| 234 | stw %r23,-16(0,%r30) | ||
| 235 | ldo 12(%r26),%r29 | ||
| 236 | ldo 12(%r25),%r23 | ||
| 237 | fldws -16(0,%r30),%fr11L | ||
| 238 | L$0026 | ||
| 239 | ldw 0(0,%r25),%r19 | ||
| 240 | extru %r19,31,16,%r20 | ||
| 241 | stw %r20,-16(0,%r30) | ||
| 242 | extru %r19,15,16,%r19 | ||
| 243 | fldws -16(0,%r30),%fr22L | ||
| 244 | stw %r19,-16(0,%r30) | ||
| 245 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 246 | fldws -16(0,%r30),%fr22L | ||
| 247 | fstws %fr8R,-16(0,%r30) | ||
| 248 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 249 | ldw -16(0,%r30),%r2 | ||
| 250 | stw %r20,-16(0,%r30) | ||
| 251 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 252 | fldws -16(0,%r30),%fr22L | ||
| 253 | fstws %fr10R,-16(0,%r30) | ||
| 254 | copy %r2,%r22 | ||
| 255 | ldw -16(0,%r30),%r2 | ||
| 256 | fstws %fr9R,-16(0,%r30) | ||
| 257 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 258 | copy %r2,%r19 | ||
| 259 | ldw -16(0,%r30),%r2 | ||
| 260 | fstws %fr8R,-16(0,%r30) | ||
| 261 | copy %r2,%r20 | ||
| 262 | ldw -16(0,%r30),%r2 | ||
| 263 | addl %r2,%r19,%r21 | ||
| 264 | comclr,<<= %r19,%r21,0 | ||
| 265 | addl %r20,%r31,%r20 | ||
| 266 | L$0029 | ||
| 267 | extru %r21,15,16,%r19 | ||
| 268 | addl %r20,%r19,%r20 | ||
| 269 | zdep %r21,15,16,%r19 | ||
| 270 | addl %r22,%r19,%r22 | ||
| 271 | comclr,<<= %r19,%r22,0 | ||
| 272 | addi,tr 1,%r20,%r19 | ||
| 273 | copy %r20,%r19 | ||
| 274 | addl %r22,%r28,%r20 | ||
| 275 | comclr,<<= %r28,%r20,0 | ||
| 276 | addi,tr 1,%r19,%r28 | ||
| 277 | copy %r19,%r28 | ||
| 278 | addib,= -1,%r24,L$0027 | ||
| 279 | stw %r20,0(0,%r26) | ||
| 280 | ldw -8(0,%r23),%r19 | ||
| 281 | extru %r19,31,16,%r20 | ||
| 282 | stw %r20,-16(0,%r30) | ||
| 283 | extru %r19,15,16,%r19 | ||
| 284 | fldws -16(0,%r30),%fr22L | ||
| 285 | stw %r19,-16(0,%r30) | ||
| 286 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 287 | fldws -16(0,%r30),%fr22L | ||
| 288 | fstws %fr8R,-16(0,%r30) | ||
| 289 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 290 | ldw -16(0,%r30),%r2 | ||
| 291 | stw %r20,-16(0,%r30) | ||
| 292 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 293 | fldws -16(0,%r30),%fr22L | ||
| 294 | fstws %fr10R,-16(0,%r30) | ||
| 295 | copy %r2,%r22 | ||
| 296 | ldw -16(0,%r30),%r2 | ||
| 297 | fstws %fr9R,-16(0,%r30) | ||
| 298 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 299 | copy %r2,%r19 | ||
| 300 | ldw -16(0,%r30),%r2 | ||
| 301 | fstws %fr8R,-16(0,%r30) | ||
| 302 | copy %r2,%r20 | ||
| 303 | ldw -16(0,%r30),%r2 | ||
| 304 | addl %r2,%r19,%r21 | ||
| 305 | comclr,<<= %r19,%r21,0 | ||
| 306 | addl %r20,%r31,%r20 | ||
| 307 | L$0033 | ||
| 308 | extru %r21,15,16,%r19 | ||
| 309 | addl %r20,%r19,%r20 | ||
| 310 | zdep %r21,15,16,%r19 | ||
| 311 | addl %r22,%r19,%r22 | ||
| 312 | comclr,<<= %r19,%r22,0 | ||
| 313 | addi,tr 1,%r20,%r19 | ||
| 314 | copy %r20,%r19 | ||
| 315 | addl %r22,%r28,%r20 | ||
| 316 | comclr,<<= %r28,%r20,0 | ||
| 317 | addi,tr 1,%r19,%r28 | ||
| 318 | copy %r19,%r28 | ||
| 319 | addib,= -1,%r24,L$0027 | ||
| 320 | stw %r20,-8(0,%r29) | ||
| 321 | ldw -4(0,%r23),%r19 | ||
| 322 | extru %r19,31,16,%r20 | ||
| 323 | stw %r20,-16(0,%r30) | ||
| 324 | extru %r19,15,16,%r19 | ||
| 325 | fldws -16(0,%r30),%fr22L | ||
| 326 | stw %r19,-16(0,%r30) | ||
| 327 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 328 | fldws -16(0,%r30),%fr22L | ||
| 329 | fstws %fr8R,-16(0,%r30) | ||
| 330 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 331 | ldw -16(0,%r30),%r2 | ||
| 332 | stw %r20,-16(0,%r30) | ||
| 333 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 334 | fldws -16(0,%r30),%fr22L | ||
| 335 | fstws %fr10R,-16(0,%r30) | ||
| 336 | copy %r2,%r22 | ||
| 337 | ldw -16(0,%r30),%r2 | ||
| 338 | fstws %fr9R,-16(0,%r30) | ||
| 339 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 340 | copy %r2,%r19 | ||
| 341 | ldw -16(0,%r30),%r2 | ||
| 342 | fstws %fr8R,-16(0,%r30) | ||
| 343 | copy %r2,%r20 | ||
| 344 | ldw -16(0,%r30),%r2 | ||
| 345 | addl %r2,%r19,%r21 | ||
| 346 | comclr,<<= %r19,%r21,0 | ||
| 347 | addl %r20,%r31,%r20 | ||
| 348 | L$0037 | ||
| 349 | extru %r21,15,16,%r19 | ||
| 350 | addl %r20,%r19,%r20 | ||
| 351 | zdep %r21,15,16,%r19 | ||
| 352 | addl %r22,%r19,%r22 | ||
| 353 | comclr,<<= %r19,%r22,0 | ||
| 354 | addi,tr 1,%r20,%r19 | ||
| 355 | copy %r20,%r19 | ||
| 356 | addl %r22,%r28,%r20 | ||
| 357 | comclr,<<= %r28,%r20,0 | ||
| 358 | addi,tr 1,%r19,%r28 | ||
| 359 | copy %r19,%r28 | ||
| 360 | addib,= -1,%r24,L$0027 | ||
| 361 | stw %r20,-4(0,%r29) | ||
| 362 | ldw 0(0,%r23),%r19 | ||
| 363 | extru %r19,31,16,%r20 | ||
| 364 | stw %r20,-16(0,%r30) | ||
| 365 | extru %r19,15,16,%r19 | ||
| 366 | fldws -16(0,%r30),%fr22L | ||
| 367 | stw %r19,-16(0,%r30) | ||
| 368 | xmpyu %fr22L,%fr11R,%fr8 | ||
| 369 | fldws -16(0,%r30),%fr22L | ||
| 370 | fstws %fr8R,-16(0,%r30) | ||
| 371 | xmpyu %fr11R,%fr22L,%fr10 | ||
| 372 | ldw -16(0,%r30),%r2 | ||
| 373 | stw %r20,-16(0,%r30) | ||
| 374 | xmpyu %fr22L,%fr11L,%fr9 | ||
| 375 | fldws -16(0,%r30),%fr22L | ||
| 376 | fstws %fr10R,-16(0,%r30) | ||
| 377 | copy %r2,%r22 | ||
| 378 | ldw -16(0,%r30),%r2 | ||
| 379 | fstws %fr9R,-16(0,%r30) | ||
| 380 | xmpyu %fr11L,%fr22L,%fr8 | ||
| 381 | copy %r2,%r19 | ||
| 382 | ldw -16(0,%r30),%r2 | ||
| 383 | fstws %fr8R,-16(0,%r30) | ||
| 384 | copy %r2,%r20 | ||
| 385 | ldw -16(0,%r30),%r2 | ||
| 386 | addl %r2,%r19,%r21 | ||
| 387 | comclr,<<= %r19,%r21,0 | ||
| 388 | addl %r20,%r31,%r20 | ||
| 389 | L$0041 | ||
| 390 | extru %r21,15,16,%r19 | ||
| 391 | addl %r20,%r19,%r20 | ||
| 392 | zdep %r21,15,16,%r19 | ||
| 393 | addl %r22,%r19,%r22 | ||
| 394 | comclr,<<= %r19,%r22,0 | ||
| 395 | addi,tr 1,%r20,%r19 | ||
| 396 | copy %r20,%r19 | ||
| 397 | addl %r22,%r28,%r20 | ||
| 398 | comclr,<<= %r28,%r20,0 | ||
| 399 | addi,tr 1,%r19,%r28 | ||
| 400 | copy %r19,%r28 | ||
| 401 | addib,= -1,%r24,L$0027 | ||
| 402 | stw %r20,0(0,%r29) | ||
| 403 | ldo 16(%r23),%r23 | ||
| 404 | ldo 16(%r25),%r25 | ||
| 405 | ldo 16(%r29),%r29 | ||
| 406 | bl L$0026,0 | ||
| 407 | ldo 16(%r26),%r26 | ||
| 408 | L$0027 | ||
| 409 | ldw -20(0,%r30),%r2 | ||
| 410 | bv,n 0(%r2) | ||
| 411 | .EXIT | ||
| 412 | .PROCEND | ||
| 413 | .align 4 | ||
| 414 | .EXPORT bn_sqr_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR | ||
| 415 | bn_sqr_words | ||
| 416 | .PROC | ||
| 417 | .CALLINFO FRAME=0,NO_CALLS | ||
| 418 | .ENTRY | ||
| 419 | ldo 28(%r26),%r23 | ||
| 420 | ldo 12(%r25),%r28 | ||
| 421 | L$0046 | ||
| 422 | ldw 0(0,%r25),%r21 | ||
| 423 | extru %r21,31,16,%r22 | ||
| 424 | stw %r22,-16(0,%r30) | ||
| 425 | extru %r21,15,16,%r21 | ||
| 426 | fldws -16(0,%r30),%fr10L | ||
| 427 | stw %r21,-16(0,%r30) | ||
| 428 | fldws -16(0,%r30),%fr10R | ||
| 429 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 430 | fstws %fr8R,-16(0,%r30) | ||
| 431 | ldw -16(0,%r30),%r29 | ||
| 432 | stw %r22,-16(0,%r30) | ||
| 433 | fldws -16(0,%r30),%fr10R | ||
| 434 | stw %r21,-16(0,%r30) | ||
| 435 | copy %r29,%r19 | ||
| 436 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 437 | fldws -16(0,%r30),%fr10L | ||
| 438 | stw %r21,-16(0,%r30) | ||
| 439 | fldws -16(0,%r30),%fr10R | ||
| 440 | fstws %fr8R,-16(0,%r30) | ||
| 441 | extru %r19,16,17,%r20 | ||
| 442 | zdep %r19,14,15,%r19 | ||
| 443 | ldw -16(0,%r30),%r29 | ||
| 444 | xmpyu %fr10L,%fr10R,%fr9 | ||
| 445 | addl %r29,%r19,%r22 | ||
| 446 | stw %r22,0(0,%r26) | ||
| 447 | fstws %fr9R,-16(0,%r30) | ||
| 448 | ldw -16(0,%r30),%r29 | ||
| 449 | addl %r29,%r20,%r21 | ||
| 450 | comclr,<<= %r19,%r22,0 | ||
| 451 | addi 1,%r21,%r21 | ||
| 452 | addib,= -1,%r24,L$0057 | ||
| 453 | stw %r21,-24(0,%r23) | ||
| 454 | ldw -8(0,%r28),%r21 | ||
| 455 | extru %r21,31,16,%r22 | ||
| 456 | stw %r22,-16(0,%r30) | ||
| 457 | extru %r21,15,16,%r21 | ||
| 458 | fldws -16(0,%r30),%fr10L | ||
| 459 | stw %r21,-16(0,%r30) | ||
| 460 | fldws -16(0,%r30),%fr10R | ||
| 461 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 462 | fstws %fr8R,-16(0,%r30) | ||
| 463 | ldw -16(0,%r30),%r29 | ||
| 464 | stw %r22,-16(0,%r30) | ||
| 465 | fldws -16(0,%r30),%fr10R | ||
| 466 | stw %r21,-16(0,%r30) | ||
| 467 | copy %r29,%r19 | ||
| 468 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 469 | fldws -16(0,%r30),%fr10L | ||
| 470 | stw %r21,-16(0,%r30) | ||
| 471 | fldws -16(0,%r30),%fr10R | ||
| 472 | fstws %fr8R,-16(0,%r30) | ||
| 473 | extru %r19,16,17,%r20 | ||
| 474 | zdep %r19,14,15,%r19 | ||
| 475 | ldw -16(0,%r30),%r29 | ||
| 476 | xmpyu %fr10L,%fr10R,%fr9 | ||
| 477 | addl %r29,%r19,%r22 | ||
| 478 | stw %r22,-20(0,%r23) | ||
| 479 | fstws %fr9R,-16(0,%r30) | ||
| 480 | ldw -16(0,%r30),%r29 | ||
| 481 | addl %r29,%r20,%r21 | ||
| 482 | comclr,<<= %r19,%r22,0 | ||
| 483 | addi 1,%r21,%r21 | ||
| 484 | addib,= -1,%r24,L$0057 | ||
| 485 | stw %r21,-16(0,%r23) | ||
| 486 | ldw -4(0,%r28),%r21 | ||
| 487 | extru %r21,31,16,%r22 | ||
| 488 | stw %r22,-16(0,%r30) | ||
| 489 | extru %r21,15,16,%r21 | ||
| 490 | fldws -16(0,%r30),%fr10L | ||
| 491 | stw %r21,-16(0,%r30) | ||
| 492 | fldws -16(0,%r30),%fr10R | ||
| 493 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 494 | fstws %fr8R,-16(0,%r30) | ||
| 495 | ldw -16(0,%r30),%r29 | ||
| 496 | stw %r22,-16(0,%r30) | ||
| 497 | fldws -16(0,%r30),%fr10R | ||
| 498 | stw %r21,-16(0,%r30) | ||
| 499 | copy %r29,%r19 | ||
| 500 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 501 | fldws -16(0,%r30),%fr10L | ||
| 502 | stw %r21,-16(0,%r30) | ||
| 503 | fldws -16(0,%r30),%fr10R | ||
| 504 | fstws %fr8R,-16(0,%r30) | ||
| 505 | extru %r19,16,17,%r20 | ||
| 506 | zdep %r19,14,15,%r19 | ||
| 507 | ldw -16(0,%r30),%r29 | ||
| 508 | xmpyu %fr10L,%fr10R,%fr9 | ||
| 509 | addl %r29,%r19,%r22 | ||
| 510 | stw %r22,-12(0,%r23) | ||
| 511 | fstws %fr9R,-16(0,%r30) | ||
| 512 | ldw -16(0,%r30),%r29 | ||
| 513 | addl %r29,%r20,%r21 | ||
| 514 | comclr,<<= %r19,%r22,0 | ||
| 515 | addi 1,%r21,%r21 | ||
| 516 | addib,= -1,%r24,L$0057 | ||
| 517 | stw %r21,-8(0,%r23) | ||
| 518 | ldw 0(0,%r28),%r21 | ||
| 519 | extru %r21,31,16,%r22 | ||
| 520 | stw %r22,-16(0,%r30) | ||
| 521 | extru %r21,15,16,%r21 | ||
| 522 | fldws -16(0,%r30),%fr10L | ||
| 523 | stw %r21,-16(0,%r30) | ||
| 524 | fldws -16(0,%r30),%fr10R | ||
| 525 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 526 | fstws %fr8R,-16(0,%r30) | ||
| 527 | ldw -16(0,%r30),%r29 | ||
| 528 | stw %r22,-16(0,%r30) | ||
| 529 | fldws -16(0,%r30),%fr10R | ||
| 530 | stw %r21,-16(0,%r30) | ||
| 531 | copy %r29,%r19 | ||
| 532 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 533 | fldws -16(0,%r30),%fr10L | ||
| 534 | stw %r21,-16(0,%r30) | ||
| 535 | fldws -16(0,%r30),%fr10R | ||
| 536 | fstws %fr8R,-16(0,%r30) | ||
| 537 | extru %r19,16,17,%r20 | ||
| 538 | zdep %r19,14,15,%r19 | ||
| 539 | ldw -16(0,%r30),%r29 | ||
| 540 | xmpyu %fr10L,%fr10R,%fr9 | ||
| 541 | addl %r29,%r19,%r22 | ||
| 542 | stw %r22,-4(0,%r23) | ||
| 543 | fstws %fr9R,-16(0,%r30) | ||
| 544 | ldw -16(0,%r30),%r29 | ||
| 545 | addl %r29,%r20,%r21 | ||
| 546 | comclr,<<= %r19,%r22,0 | ||
| 547 | addi 1,%r21,%r21 | ||
| 548 | addib,= -1,%r24,L$0057 | ||
| 549 | stw %r21,0(0,%r23) | ||
| 550 | ldo 16(%r28),%r28 | ||
| 551 | ldo 16(%r25),%r25 | ||
| 552 | ldo 32(%r23),%r23 | ||
| 553 | bl L$0046,0 | ||
| 554 | ldo 32(%r26),%r26 | ||
| 555 | L$0057 | ||
| 556 | bv,n 0(%r2) | ||
| 557 | .EXIT | ||
| 558 | .PROCEND | ||
| 559 | .IMPORT BN_num_bits_word,CODE | ||
| 560 | .IMPORT fprintf,CODE | ||
| 561 | .IMPORT __iob,DATA | ||
| 562 | .SPACE $TEXT$ | ||
| 563 | .SUBSPA $LIT$ | ||
| 564 | |||
| 565 | .align 4 | ||
| 566 | L$C0000 | ||
| 567 | .STRING "Division would overflow\x0a\x00" | ||
| 568 | .IMPORT abort,CODE | ||
| 569 | .SPACE $TEXT$ | ||
| 570 | .SUBSPA $CODE$ | ||
| 571 | |||
| 572 | .align 4 | ||
| 573 | .EXPORT bn_div64,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,RTNVAL=GR | ||
| 574 | bn_div64 | ||
| 575 | .PROC | ||
| 576 | .CALLINFO FRAME=128,CALLS,SAVE_RP,ENTRY_GR=8 | ||
| 577 | .ENTRY | ||
| 578 | stw %r2,-20(0,%r30) | ||
| 579 | stwm %r8,128(0,%r30) | ||
| 580 | stw %r7,-124(0,%r30) | ||
| 581 | stw %r4,-112(0,%r30) | ||
| 582 | stw %r3,-108(0,%r30) | ||
| 583 | copy %r26,%r3 | ||
| 584 | copy %r25,%r4 | ||
| 585 | stw %r6,-120(0,%r30) | ||
| 586 | ldi 0,%r7 | ||
| 587 | stw %r5,-116(0,%r30) | ||
| 588 | movb,<> %r24,%r5,L$0059 | ||
| 589 | ldi 2,%r6 | ||
| 590 | bl L$0076,0 | ||
| 591 | ldi -1,%r28 | ||
| 592 | L$0059 | ||
| 593 | .CALL ARGW0=GR | ||
| 594 | bl BN_num_bits_word,%r2 | ||
| 595 | copy %r5,%r26 | ||
| 596 | ldi 32,%r19 | ||
| 597 | comb,= %r19,%r28,L$0060 | ||
| 598 | subi 31,%r28,%r19 | ||
| 599 | mtsar %r19 | ||
| 600 | zvdepi 1,32,%r19 | ||
| 601 | comb,>>= %r19,%r3,L$0060 | ||
| 602 | addil LR'__iob-$global$+32,%r27 | ||
| 603 | ldo RR'__iob-$global$+32(%r1),%r26 | ||
| 604 | ldil LR'L$C0000,%r25 | ||
| 605 | .CALL ARGW0=GR,ARGW1=GR | ||
| 606 | bl fprintf,%r2 | ||
| 607 | ldo RR'L$C0000(%r25),%r25 | ||
| 608 | .CALL | ||
| 609 | bl abort,%r2 | ||
| 610 | nop | ||
| 611 | L$0060 | ||
| 612 | comb,>> %r5,%r3,L$0061 | ||
| 613 | subi 32,%r28,%r28 | ||
| 614 | sub %r3,%r5,%r3 | ||
| 615 | L$0061 | ||
| 616 | comib,= 0,%r28,L$0062 | ||
| 617 | subi 31,%r28,%r19 | ||
| 618 | mtsar %r19 | ||
| 619 | zvdep %r5,32,%r5 | ||
| 620 | zvdep %r3,32,%r21 | ||
| 621 | subi 32,%r28,%r20 | ||
| 622 | mtsar %r20 | ||
| 623 | vshd 0,%r4,%r20 | ||
| 624 | or %r21,%r20,%r3 | ||
| 625 | mtsar %r19 | ||
| 626 | zvdep %r4,32,%r4 | ||
| 627 | L$0062 | ||
| 628 | extru %r5,15,16,%r23 | ||
| 629 | extru %r5,31,16,%r28 | ||
| 630 | L$0063 | ||
| 631 | extru %r3,15,16,%r19 | ||
| 632 | comb,<> %r23,%r19,L$0066 | ||
| 633 | copy %r3,%r26 | ||
| 634 | bl L$0067,0 | ||
| 635 | zdepi -1,31,16,%r29 | ||
| 636 | L$0066 | ||
| 637 | .IMPORT $$divU,MILLICODE | ||
| 638 | bl $$divU,%r31 | ||
| 639 | copy %r23,%r25 | ||
| 640 | L$0067 | ||
| 641 | stw %r29,-16(0,%r30) | ||
| 642 | fldws -16(0,%r30),%fr10L | ||
| 643 | stw %r28,-16(0,%r30) | ||
| 644 | fldws -16(0,%r30),%fr10R | ||
| 645 | stw %r23,-16(0,%r30) | ||
| 646 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 647 | fldws -16(0,%r30),%fr10R | ||
| 648 | fstws %fr8R,-16(0,%r30) | ||
| 649 | xmpyu %fr10L,%fr10R,%fr9 | ||
| 650 | ldw -16(0,%r30),%r8 | ||
| 651 | fstws %fr9R,-16(0,%r30) | ||
| 652 | copy %r8,%r22 | ||
| 653 | ldw -16(0,%r30),%r8 | ||
| 654 | extru %r4,15,16,%r24 | ||
| 655 | copy %r8,%r21 | ||
| 656 | L$0068 | ||
| 657 | sub %r3,%r21,%r20 | ||
| 658 | copy %r20,%r19 | ||
| 659 | depi 0,31,16,%r19 | ||
| 660 | comib,<> 0,%r19,L$0069 | ||
| 661 | zdep %r20,15,16,%r19 | ||
| 662 | addl %r19,%r24,%r19 | ||
| 663 | comb,>>= %r19,%r22,L$0069 | ||
| 664 | sub %r22,%r28,%r22 | ||
| 665 | sub %r21,%r23,%r21 | ||
| 666 | bl L$0068,0 | ||
| 667 | ldo -1(%r29),%r29 | ||
| 668 | L$0069 | ||
| 669 | stw %r29,-16(0,%r30) | ||
| 670 | fldws -16(0,%r30),%fr10L | ||
| 671 | stw %r28,-16(0,%r30) | ||
| 672 | fldws -16(0,%r30),%fr10R | ||
| 673 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 674 | fstws %fr8R,-16(0,%r30) | ||
| 675 | ldw -16(0,%r30),%r8 | ||
| 676 | stw %r23,-16(0,%r30) | ||
| 677 | fldws -16(0,%r30),%fr10R | ||
| 678 | copy %r8,%r19 | ||
| 679 | xmpyu %fr10L,%fr10R,%fr8 | ||
| 680 | fstws %fr8R,-16(0,%r30) | ||
| 681 | extru %r19,15,16,%r20 | ||
| 682 | ldw -16(0,%r30),%r8 | ||
| 683 | zdep %r19,15,16,%r19 | ||
| 684 | addl %r8,%r20,%r20 | ||
| 685 | comclr,<<= %r19,%r4,0 | ||
| 686 | addi 1,%r20,%r20 | ||
| 687 | comb,<<= %r20,%r3,L$0074 | ||
| 688 | sub %r4,%r19,%r4 | ||
| 689 | addl %r3,%r5,%r3 | ||
| 690 | ldo -1(%r29),%r29 | ||
| 691 | L$0074 | ||
| 692 | addib,= -1,%r6,L$0064 | ||
| 693 | sub %r3,%r20,%r3 | ||
| 694 | zdep %r29,15,16,%r7 | ||
| 695 | shd %r3,%r4,16,%r3 | ||
| 696 | bl L$0063,0 | ||
| 697 | zdep %r4,15,16,%r4 | ||
| 698 | L$0064 | ||
| 699 | or %r7,%r29,%r28 | ||
| 700 | L$0076 | ||
| 701 | ldw -148(0,%r30),%r2 | ||
| 702 | ldw -124(0,%r30),%r7 | ||
| 703 | ldw -120(0,%r30),%r6 | ||
| 704 | ldw -116(0,%r30),%r5 | ||
| 705 | ldw -112(0,%r30),%r4 | ||
| 706 | ldw -108(0,%r30),%r3 | ||
| 707 | bv 0(%r2) | ||
| 708 | ldwm -128(0,%r30),%r8 | ||
| 709 | .EXIT | ||
| 710 | .PROCEND | ||
diff --git a/src/lib/libcrypto/bn/asm/r3000.s b/src/lib/libcrypto/bn/asm/r3000.s deleted file mode 100644 index e95269afa3..0000000000 --- a/src/lib/libcrypto/bn/asm/r3000.s +++ /dev/null | |||
| @@ -1,646 +0,0 @@ | |||
| 1 | .file 1 "../bn_mulw.c" | ||
| 2 | .set nobopt | ||
| 3 | .option pic2 | ||
| 4 | |||
| 5 | # GNU C 2.6.3 [AL 1.1, MM 40] SGI running IRIX 5.0 compiled by GNU C | ||
| 6 | |||
| 7 | # Cc1 defaults: | ||
| 8 | # -mabicalls | ||
| 9 | |||
| 10 | # Cc1 arguments (-G value = 0, Cpu = 3000, ISA = 1): | ||
| 11 | # -quiet -dumpbase -O2 -o | ||
| 12 | |||
| 13 | gcc2_compiled.: | ||
| 14 | __gnu_compiled_c: | ||
| 15 | .rdata | ||
| 16 | |||
| 17 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 18 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x34,0x39,0x20 | ||
| 19 | .byte 0x24,0x0 | ||
| 20 | |||
| 21 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 22 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x33,0x34,0x20 | ||
| 23 | .byte 0x24,0x0 | ||
| 24 | |||
| 25 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 26 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x35,0x20,0x24 | ||
| 27 | .byte 0x0 | ||
| 28 | |||
| 29 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 30 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x38,0x20,0x24 | ||
| 31 | .byte 0x0 | ||
| 32 | |||
| 33 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 34 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x32,0x33,0x20 | ||
| 35 | .byte 0x24,0x0 | ||
| 36 | |||
| 37 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 38 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x37,0x38,0x20 | ||
| 39 | .byte 0x24,0x0 | ||
| 40 | |||
| 41 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 42 | .byte 0x6e,0x3a,0x20,0x33,0x2e,0x37,0x30,0x20 | ||
| 43 | .byte 0x24,0x0 | ||
| 44 | |||
| 45 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 46 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x32,0x20,0x24 | ||
| 47 | .byte 0x0 | ||
| 48 | |||
| 49 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 50 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x34,0x20,0x24 | ||
| 51 | .byte 0x0 | ||
| 52 | |||
| 53 | .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f | ||
| 54 | .byte 0x6e,0x3a,0x20,0x31,0x2e,0x38,0x20,0x24 | ||
| 55 | .byte 0x0 | ||
| 56 | .text | ||
| 57 | .align 2 | ||
| 58 | .globl bn_mul_add_words | ||
| 59 | .ent bn_mul_add_words | ||
| 60 | bn_mul_add_words: | ||
| 61 | .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0 | ||
| 62 | .mask 0x00000000,0 | ||
| 63 | .fmask 0x00000000,0 | ||
| 64 | .set noreorder | ||
| 65 | .cpload $25 | ||
| 66 | .set reorder | ||
| 67 | move $12,$4 | ||
| 68 | move $14,$5 | ||
| 69 | move $9,$6 | ||
| 70 | move $13,$7 | ||
| 71 | move $8,$0 | ||
| 72 | addu $10,$12,12 | ||
| 73 | addu $11,$14,12 | ||
| 74 | $L2: | ||
| 75 | lw $6,0($14) | ||
| 76 | #nop | ||
| 77 | multu $13,$6 | ||
| 78 | mfhi $6 | ||
| 79 | mflo $7 | ||
| 80 | #nop | ||
| 81 | move $5,$8 | ||
| 82 | move $4,$0 | ||
| 83 | lw $3,0($12) | ||
| 84 | addu $9,$9,-1 | ||
| 85 | move $2,$0 | ||
| 86 | addu $7,$7,$3 | ||
| 87 | sltu $8,$7,$3 | ||
| 88 | addu $6,$6,$2 | ||
| 89 | addu $6,$6,$8 | ||
| 90 | addu $7,$7,$5 | ||
| 91 | sltu $2,$7,$5 | ||
| 92 | addu $6,$6,$4 | ||
| 93 | addu $6,$6,$2 | ||
| 94 | srl $3,$6,0 | ||
| 95 | move $2,$0 | ||
| 96 | move $8,$3 | ||
| 97 | .set noreorder | ||
| 98 | .set nomacro | ||
| 99 | beq $9,$0,$L3 | ||
| 100 | sw $7,0($12) | ||
| 101 | .set macro | ||
| 102 | .set reorder | ||
| 103 | |||
| 104 | lw $6,-8($11) | ||
| 105 | #nop | ||
| 106 | multu $13,$6 | ||
| 107 | mfhi $6 | ||
| 108 | mflo $7 | ||
| 109 | #nop | ||
| 110 | move $5,$8 | ||
| 111 | move $4,$0 | ||
| 112 | lw $3,-8($10) | ||
| 113 | addu $9,$9,-1 | ||
| 114 | move $2,$0 | ||
| 115 | addu $7,$7,$3 | ||
| 116 | sltu $8,$7,$3 | ||
| 117 | addu $6,$6,$2 | ||
| 118 | addu $6,$6,$8 | ||
| 119 | addu $7,$7,$5 | ||
| 120 | sltu $2,$7,$5 | ||
| 121 | addu $6,$6,$4 | ||
| 122 | addu $6,$6,$2 | ||
| 123 | srl $3,$6,0 | ||
| 124 | move $2,$0 | ||
| 125 | move $8,$3 | ||
| 126 | .set noreorder | ||
| 127 | .set nomacro | ||
| 128 | beq $9,$0,$L3 | ||
| 129 | sw $7,-8($10) | ||
| 130 | .set macro | ||
| 131 | .set reorder | ||
| 132 | |||
| 133 | lw $6,-4($11) | ||
| 134 | #nop | ||
| 135 | multu $13,$6 | ||
| 136 | mfhi $6 | ||
| 137 | mflo $7 | ||
| 138 | #nop | ||
| 139 | move $5,$8 | ||
| 140 | move $4,$0 | ||
| 141 | lw $3,-4($10) | ||
| 142 | addu $9,$9,-1 | ||
| 143 | move $2,$0 | ||
| 144 | addu $7,$7,$3 | ||
| 145 | sltu $8,$7,$3 | ||
| 146 | addu $6,$6,$2 | ||
| 147 | addu $6,$6,$8 | ||
| 148 | addu $7,$7,$5 | ||
| 149 | sltu $2,$7,$5 | ||
| 150 | addu $6,$6,$4 | ||
| 151 | addu $6,$6,$2 | ||
| 152 | srl $3,$6,0 | ||
| 153 | move $2,$0 | ||
| 154 | move $8,$3 | ||
| 155 | .set noreorder | ||
| 156 | .set nomacro | ||
| 157 | beq $9,$0,$L3 | ||
| 158 | sw $7,-4($10) | ||
| 159 | .set macro | ||
| 160 | .set reorder | ||
| 161 | |||
| 162 | lw $6,0($11) | ||
| 163 | #nop | ||
| 164 | multu $13,$6 | ||
| 165 | mfhi $6 | ||
| 166 | mflo $7 | ||
| 167 | #nop | ||
| 168 | move $5,$8 | ||
| 169 | move $4,$0 | ||
| 170 | lw $3,0($10) | ||
| 171 | addu $9,$9,-1 | ||
| 172 | move $2,$0 | ||
| 173 | addu $7,$7,$3 | ||
| 174 | sltu $8,$7,$3 | ||
| 175 | addu $6,$6,$2 | ||
| 176 | addu $6,$6,$8 | ||
| 177 | addu $7,$7,$5 | ||
| 178 | sltu $2,$7,$5 | ||
| 179 | addu $6,$6,$4 | ||
| 180 | addu $6,$6,$2 | ||
| 181 | srl $3,$6,0 | ||
| 182 | move $2,$0 | ||
| 183 | move $8,$3 | ||
| 184 | .set noreorder | ||
| 185 | .set nomacro | ||
| 186 | beq $9,$0,$L3 | ||
| 187 | sw $7,0($10) | ||
| 188 | .set macro | ||
| 189 | .set reorder | ||
| 190 | |||
| 191 | addu $11,$11,16 | ||
| 192 | addu $14,$14,16 | ||
| 193 | addu $10,$10,16 | ||
| 194 | .set noreorder | ||
| 195 | .set nomacro | ||
| 196 | j $L2 | ||
| 197 | addu $12,$12,16 | ||
| 198 | .set macro | ||
| 199 | .set reorder | ||
| 200 | |||
| 201 | $L3: | ||
| 202 | .set noreorder | ||
| 203 | .set nomacro | ||
| 204 | j $31 | ||
| 205 | move $2,$8 | ||
| 206 | .set macro | ||
| 207 | .set reorder | ||
| 208 | |||
| 209 | .end bn_mul_add_words | ||
| 210 | .align 2 | ||
| 211 | .globl bn_mul_words | ||
| 212 | .ent bn_mul_words | ||
| 213 | bn_mul_words: | ||
| 214 | .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0 | ||
| 215 | .mask 0x00000000,0 | ||
| 216 | .fmask 0x00000000,0 | ||
| 217 | .set noreorder | ||
| 218 | .cpload $25 | ||
| 219 | .set reorder | ||
| 220 | move $11,$4 | ||
| 221 | move $12,$5 | ||
| 222 | move $8,$6 | ||
| 223 | move $6,$0 | ||
| 224 | addu $10,$11,12 | ||
| 225 | addu $9,$12,12 | ||
| 226 | $L10: | ||
| 227 | lw $4,0($12) | ||
| 228 | #nop | ||
| 229 | multu $7,$4 | ||
| 230 | mfhi $4 | ||
| 231 | mflo $5 | ||
| 232 | #nop | ||
| 233 | move $3,$6 | ||
| 234 | move $2,$0 | ||
| 235 | addu $8,$8,-1 | ||
| 236 | addu $5,$5,$3 | ||
| 237 | sltu $6,$5,$3 | ||
| 238 | addu $4,$4,$2 | ||
| 239 | addu $4,$4,$6 | ||
| 240 | srl $3,$4,0 | ||
| 241 | move $2,$0 | ||
| 242 | move $6,$3 | ||
| 243 | .set noreorder | ||
| 244 | .set nomacro | ||
| 245 | beq $8,$0,$L11 | ||
| 246 | sw $5,0($11) | ||
| 247 | .set macro | ||
| 248 | .set reorder | ||
| 249 | |||
| 250 | lw $4,-8($9) | ||
| 251 | #nop | ||
| 252 | multu $7,$4 | ||
| 253 | mfhi $4 | ||
| 254 | mflo $5 | ||
| 255 | #nop | ||
| 256 | move $3,$6 | ||
| 257 | move $2,$0 | ||
| 258 | addu $8,$8,-1 | ||
| 259 | addu $5,$5,$3 | ||
| 260 | sltu $6,$5,$3 | ||
| 261 | addu $4,$4,$2 | ||
| 262 | addu $4,$4,$6 | ||
| 263 | srl $3,$4,0 | ||
| 264 | move $2,$0 | ||
| 265 | move $6,$3 | ||
| 266 | .set noreorder | ||
| 267 | .set nomacro | ||
| 268 | beq $8,$0,$L11 | ||
| 269 | sw $5,-8($10) | ||
| 270 | .set macro | ||
| 271 | .set reorder | ||
| 272 | |||
| 273 | lw $4,-4($9) | ||
| 274 | #nop | ||
| 275 | multu $7,$4 | ||
| 276 | mfhi $4 | ||
| 277 | mflo $5 | ||
| 278 | #nop | ||
| 279 | move $3,$6 | ||
| 280 | move $2,$0 | ||
| 281 | addu $8,$8,-1 | ||
| 282 | addu $5,$5,$3 | ||
| 283 | sltu $6,$5,$3 | ||
| 284 | addu $4,$4,$2 | ||
| 285 | addu $4,$4,$6 | ||
| 286 | srl $3,$4,0 | ||
| 287 | move $2,$0 | ||
| 288 | move $6,$3 | ||
| 289 | .set noreorder | ||
| 290 | .set nomacro | ||
| 291 | beq $8,$0,$L11 | ||
| 292 | sw $5,-4($10) | ||
| 293 | .set macro | ||
| 294 | .set reorder | ||
| 295 | |||
| 296 | lw $4,0($9) | ||
| 297 | #nop | ||
| 298 | multu $7,$4 | ||
| 299 | mfhi $4 | ||
| 300 | mflo $5 | ||
| 301 | #nop | ||
| 302 | move $3,$6 | ||
| 303 | move $2,$0 | ||
| 304 | addu $8,$8,-1 | ||
| 305 | addu $5,$5,$3 | ||
| 306 | sltu $6,$5,$3 | ||
| 307 | addu $4,$4,$2 | ||
| 308 | addu $4,$4,$6 | ||
| 309 | srl $3,$4,0 | ||
| 310 | move $2,$0 | ||
| 311 | move $6,$3 | ||
| 312 | .set noreorder | ||
| 313 | .set nomacro | ||
| 314 | beq $8,$0,$L11 | ||
| 315 | sw $5,0($10) | ||
| 316 | .set macro | ||
| 317 | .set reorder | ||
| 318 | |||
| 319 | addu $9,$9,16 | ||
| 320 | addu $12,$12,16 | ||
| 321 | addu $10,$10,16 | ||
| 322 | .set noreorder | ||
| 323 | .set nomacro | ||
| 324 | j $L10 | ||
| 325 | addu $11,$11,16 | ||
| 326 | .set macro | ||
| 327 | .set reorder | ||
| 328 | |||
| 329 | $L11: | ||
| 330 | .set noreorder | ||
| 331 | .set nomacro | ||
| 332 | j $31 | ||
| 333 | move $2,$6 | ||
| 334 | .set macro | ||
| 335 | .set reorder | ||
| 336 | |||
| 337 | .end bn_mul_words | ||
| 338 | .align 2 | ||
| 339 | .globl bn_sqr_words | ||
| 340 | .ent bn_sqr_words | ||
| 341 | bn_sqr_words: | ||
| 342 | .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0 | ||
| 343 | .mask 0x00000000,0 | ||
| 344 | .fmask 0x00000000,0 | ||
| 345 | .set noreorder | ||
| 346 | .cpload $25 | ||
| 347 | .set reorder | ||
| 348 | move $9,$4 | ||
| 349 | addu $7,$9,28 | ||
| 350 | addu $8,$5,12 | ||
| 351 | $L18: | ||
| 352 | lw $2,0($5) | ||
| 353 | #nop | ||
| 354 | multu $2,$2 | ||
| 355 | mfhi $2 | ||
| 356 | mflo $3 | ||
| 357 | #nop | ||
| 358 | addu $6,$6,-1 | ||
| 359 | sw $3,0($9) | ||
| 360 | srl $3,$2,0 | ||
| 361 | move $2,$0 | ||
| 362 | .set noreorder | ||
| 363 | .set nomacro | ||
| 364 | beq $6,$0,$L19 | ||
| 365 | sw $3,-24($7) | ||
| 366 | .set macro | ||
| 367 | .set reorder | ||
| 368 | |||
| 369 | lw $2,-8($8) | ||
| 370 | #nop | ||
| 371 | multu $2,$2 | ||
| 372 | mfhi $2 | ||
| 373 | mflo $3 | ||
| 374 | #nop | ||
| 375 | addu $6,$6,-1 | ||
| 376 | sw $3,-20($7) | ||
| 377 | srl $3,$2,0 | ||
| 378 | move $2,$0 | ||
| 379 | .set noreorder | ||
| 380 | .set nomacro | ||
| 381 | beq $6,$0,$L19 | ||
| 382 | sw $3,-16($7) | ||
| 383 | .set macro | ||
| 384 | .set reorder | ||
| 385 | |||
| 386 | lw $2,-4($8) | ||
| 387 | #nop | ||
| 388 | multu $2,$2 | ||
| 389 | mfhi $2 | ||
| 390 | mflo $3 | ||
| 391 | #nop | ||
| 392 | addu $6,$6,-1 | ||
| 393 | sw $3,-12($7) | ||
| 394 | srl $3,$2,0 | ||
| 395 | move $2,$0 | ||
| 396 | .set noreorder | ||
| 397 | .set nomacro | ||
| 398 | beq $6,$0,$L19 | ||
| 399 | sw $3,-8($7) | ||
| 400 | .set macro | ||
| 401 | .set reorder | ||
| 402 | |||
| 403 | lw $2,0($8) | ||
| 404 | #nop | ||
| 405 | multu $2,$2 | ||
| 406 | mfhi $2 | ||
| 407 | mflo $3 | ||
| 408 | #nop | ||
| 409 | addu $6,$6,-1 | ||
| 410 | sw $3,-4($7) | ||
| 411 | srl $3,$2,0 | ||
| 412 | move $2,$0 | ||
| 413 | .set noreorder | ||
| 414 | .set nomacro | ||
| 415 | beq $6,$0,$L19 | ||
| 416 | sw $3,0($7) | ||
| 417 | .set macro | ||
| 418 | .set reorder | ||
| 419 | |||
| 420 | addu $8,$8,16 | ||
| 421 | addu $5,$5,16 | ||
| 422 | addu $7,$7,32 | ||
| 423 | .set noreorder | ||
| 424 | .set nomacro | ||
| 425 | j $L18 | ||
| 426 | addu $9,$9,32 | ||
| 427 | .set macro | ||
| 428 | .set reorder | ||
| 429 | |||
| 430 | $L19: | ||
| 431 | j $31 | ||
| 432 | .end bn_sqr_words | ||
| 433 | .rdata | ||
| 434 | .align 2 | ||
| 435 | $LC0: | ||
| 436 | |||
| 437 | .byte 0x44,0x69,0x76,0x69,0x73,0x69,0x6f,0x6e | ||
| 438 | .byte 0x20,0x77,0x6f,0x75,0x6c,0x64,0x20,0x6f | ||
| 439 | .byte 0x76,0x65,0x72,0x66,0x6c,0x6f,0x77,0xa | ||
| 440 | .byte 0x0 | ||
| 441 | .text | ||
| 442 | .align 2 | ||
| 443 | .globl bn_div64 | ||
| 444 | .ent bn_div64 | ||
| 445 | bn_div64: | ||
| 446 | .frame $sp,56,$31 # vars= 0, regs= 7/0, args= 16, extra= 8 | ||
| 447 | .mask 0x901f0000,-8 | ||
| 448 | .fmask 0x00000000,0 | ||
| 449 | .set noreorder | ||
| 450 | .cpload $25 | ||
| 451 | .set reorder | ||
| 452 | subu $sp,$sp,56 | ||
| 453 | .cprestore 16 | ||
| 454 | sw $16,24($sp) | ||
| 455 | move $16,$4 | ||
| 456 | sw $17,28($sp) | ||
| 457 | move $17,$5 | ||
| 458 | sw $18,32($sp) | ||
| 459 | move $18,$6 | ||
| 460 | sw $20,40($sp) | ||
| 461 | move $20,$0 | ||
| 462 | sw $19,36($sp) | ||
| 463 | li $19,0x00000002 # 2 | ||
| 464 | sw $31,48($sp) | ||
| 465 | .set noreorder | ||
| 466 | .set nomacro | ||
| 467 | bne $18,$0,$L26 | ||
| 468 | sw $28,44($sp) | ||
| 469 | .set macro | ||
| 470 | .set reorder | ||
| 471 | |||
| 472 | .set noreorder | ||
| 473 | .set nomacro | ||
| 474 | j $L43 | ||
| 475 | li $2,-1 # 0xffffffff | ||
| 476 | .set macro | ||
| 477 | .set reorder | ||
| 478 | |||
| 479 | $L26: | ||
| 480 | move $4,$18 | ||
| 481 | jal BN_num_bits_word | ||
| 482 | move $4,$2 | ||
| 483 | li $2,0x00000020 # 32 | ||
| 484 | .set noreorder | ||
| 485 | .set nomacro | ||
| 486 | beq $4,$2,$L27 | ||
| 487 | li $2,0x00000001 # 1 | ||
| 488 | .set macro | ||
| 489 | .set reorder | ||
| 490 | |||
| 491 | sll $2,$2,$4 | ||
| 492 | sltu $2,$2,$16 | ||
| 493 | .set noreorder | ||
| 494 | .set nomacro | ||
| 495 | beq $2,$0,$L44 | ||
| 496 | li $5,0x00000020 # 32 | ||
| 497 | .set macro | ||
| 498 | .set reorder | ||
| 499 | |||
| 500 | la $4,__iob+32 | ||
| 501 | la $5,$LC0 | ||
| 502 | jal fprintf | ||
| 503 | jal abort | ||
| 504 | $L27: | ||
| 505 | li $5,0x00000020 # 32 | ||
| 506 | $L44: | ||
| 507 | sltu $2,$16,$18 | ||
| 508 | .set noreorder | ||
| 509 | .set nomacro | ||
| 510 | bne $2,$0,$L28 | ||
| 511 | subu $4,$5,$4 | ||
| 512 | .set macro | ||
| 513 | .set reorder | ||
| 514 | |||
| 515 | subu $16,$16,$18 | ||
| 516 | $L28: | ||
| 517 | .set noreorder | ||
| 518 | .set nomacro | ||
| 519 | beq $4,$0,$L29 | ||
| 520 | li $10,-65536 # 0xffff0000 | ||
| 521 | .set macro | ||
| 522 | .set reorder | ||
| 523 | |||
| 524 | sll $18,$18,$4 | ||
| 525 | sll $3,$16,$4 | ||
| 526 | subu $2,$5,$4 | ||
| 527 | srl $2,$17,$2 | ||
| 528 | or $16,$3,$2 | ||
| 529 | sll $17,$17,$4 | ||
| 530 | $L29: | ||
| 531 | srl $7,$18,16 | ||
| 532 | andi $9,$18,0xffff | ||
| 533 | $L30: | ||
| 534 | srl $2,$16,16 | ||
| 535 | .set noreorder | ||
| 536 | .set nomacro | ||
| 537 | beq $2,$7,$L34 | ||
| 538 | li $6,0x0000ffff # 65535 | ||
| 539 | .set macro | ||
| 540 | .set reorder | ||
| 541 | |||
| 542 | divu $6,$16,$7 | ||
| 543 | $L34: | ||
| 544 | mult $6,$9 | ||
| 545 | mflo $5 | ||
| 546 | #nop | ||
| 547 | #nop | ||
| 548 | mult $6,$7 | ||
| 549 | and $2,$17,$10 | ||
| 550 | srl $8,$2,16 | ||
| 551 | mflo $4 | ||
| 552 | $L35: | ||
| 553 | subu $3,$16,$4 | ||
| 554 | and $2,$3,$10 | ||
| 555 | .set noreorder | ||
| 556 | .set nomacro | ||
| 557 | bne $2,$0,$L36 | ||
| 558 | sll $2,$3,16 | ||
| 559 | .set macro | ||
| 560 | .set reorder | ||
| 561 | |||
| 562 | addu $2,$2,$8 | ||
| 563 | sltu $2,$2,$5 | ||
| 564 | .set noreorder | ||
| 565 | .set nomacro | ||
| 566 | beq $2,$0,$L36 | ||
| 567 | subu $5,$5,$9 | ||
| 568 | .set macro | ||
| 569 | .set reorder | ||
| 570 | |||
| 571 | subu $4,$4,$7 | ||
| 572 | .set noreorder | ||
| 573 | .set nomacro | ||
| 574 | j $L35 | ||
| 575 | addu $6,$6,-1 | ||
| 576 | .set macro | ||
| 577 | .set reorder | ||
| 578 | |||
| 579 | $L36: | ||
| 580 | mult $6,$7 | ||
| 581 | mflo $5 | ||
| 582 | #nop | ||
| 583 | #nop | ||
| 584 | mult $6,$9 | ||
| 585 | mflo $4 | ||
| 586 | #nop | ||
| 587 | #nop | ||
| 588 | srl $3,$4,16 | ||
| 589 | sll $2,$4,16 | ||
| 590 | and $4,$2,$10 | ||
| 591 | sltu $2,$17,$4 | ||
| 592 | .set noreorder | ||
| 593 | .set nomacro | ||
| 594 | beq $2,$0,$L40 | ||
| 595 | addu $5,$5,$3 | ||
| 596 | .set macro | ||
| 597 | .set reorder | ||
| 598 | |||
| 599 | addu $5,$5,1 | ||
| 600 | $L40: | ||
| 601 | sltu $2,$16,$5 | ||
| 602 | .set noreorder | ||
| 603 | .set nomacro | ||
| 604 | beq $2,$0,$L41 | ||
| 605 | subu $17,$17,$4 | ||
| 606 | .set macro | ||
| 607 | .set reorder | ||
| 608 | |||
| 609 | addu $16,$16,$18 | ||
| 610 | addu $6,$6,-1 | ||
| 611 | $L41: | ||
| 612 | addu $19,$19,-1 | ||
| 613 | .set noreorder | ||
| 614 | .set nomacro | ||
| 615 | beq $19,$0,$L31 | ||
| 616 | subu $16,$16,$5 | ||
| 617 | .set macro | ||
| 618 | .set reorder | ||
| 619 | |||
| 620 | sll $20,$6,16 | ||
| 621 | sll $3,$16,16 | ||
| 622 | srl $2,$17,16 | ||
| 623 | or $16,$3,$2 | ||
| 624 | .set noreorder | ||
| 625 | .set nomacro | ||
| 626 | j $L30 | ||
| 627 | sll $17,$17,16 | ||
| 628 | .set macro | ||
| 629 | .set reorder | ||
| 630 | |||
| 631 | $L31: | ||
| 632 | or $2,$20,$6 | ||
| 633 | $L43: | ||
| 634 | lw $31,48($sp) | ||
| 635 | lw $20,40($sp) | ||
| 636 | lw $19,36($sp) | ||
| 637 | lw $18,32($sp) | ||
| 638 | lw $17,28($sp) | ||
| 639 | lw $16,24($sp) | ||
| 640 | addu $sp,$sp,56 | ||
| 641 | j $31 | ||
| 642 | .end bn_div64 | ||
| 643 | |||
| 644 | .globl abort .text | ||
| 645 | .globl fprintf .text | ||
| 646 | .globl BN_num_bits_word .text | ||
diff --git a/src/lib/libcrypto/bn/asm/sparcv8plus.S b/src/lib/libcrypto/bn/asm/sparcv8plus.S index 8c56e2e7e7..63de1860f2 100644 --- a/src/lib/libcrypto/bn/asm/sparcv8plus.S +++ b/src/lib/libcrypto/bn/asm/sparcv8plus.S | |||
| @@ -144,6 +144,19 @@ | |||
| 144 | * } | 144 | * } |
| 145 | */ | 145 | */ |
| 146 | 146 | ||
| 147 | #if defined(__SUNPRO_C) && defined(__sparcv9) | ||
| 148 | /* They've said -xarch=v9 at command line */ | ||
| 149 | .register %g2,#scratch | ||
| 150 | .register %g3,#scratch | ||
| 151 | # define FRAME_SIZE -192 | ||
| 152 | #elif defined(__GNUC__) && defined(__arch64__) | ||
| 153 | /* They've said -m64 at command line */ | ||
| 154 | .register %g2,#scratch | ||
| 155 | .register %g3,#scratch | ||
| 156 | # define FRAME_SIZE -192 | ||
| 157 | #else | ||
| 158 | # define FRAME_SIZE -96 | ||
| 159 | #endif | ||
| 147 | /* | 160 | /* |
| 148 | * GNU assembler can't stand stuw:-( | 161 | * GNU assembler can't stand stuw:-( |
| 149 | */ | 162 | */ |
| @@ -619,8 +632,6 @@ bn_sub_words: | |||
| 619 | * Andy. | 632 | * Andy. |
| 620 | */ | 633 | */ |
| 621 | 634 | ||
| 622 | #define FRAME_SIZE -96 | ||
| 623 | |||
| 624 | /* | 635 | /* |
| 625 | * Here is register usage map for *all* routines below. | 636 | * Here is register usage map for *all* routines below. |
| 626 | */ | 637 | */ |
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index f1719a5877..e484b7fc11 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h | |||
| @@ -56,6 +56,59 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | /* ==================================================================== | 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 | /* ==================================================================== | ||
| 59 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 112 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 60 | * | 113 | * |
| 61 | * Portions of the attached software ("Contribution") are developed by | 114 | * Portions of the attached software ("Contribution") are developed by |
| @@ -77,6 +130,7 @@ | |||
| 77 | #include <stdio.h> /* FILE */ | 130 | #include <stdio.h> /* FILE */ |
| 78 | #endif | 131 | #endif |
| 79 | #include <openssl/ossl_typ.h> | 132 | #include <openssl/ossl_typ.h> |
| 133 | #include <openssl/crypto.h> | ||
| 80 | 134 | ||
| 81 | #ifdef __cplusplus | 135 | #ifdef __cplusplus |
| 82 | extern "C" { | 136 | extern "C" { |
| @@ -94,9 +148,11 @@ extern "C" { | |||
| 94 | /* #define BN_DEBUG */ | 148 | /* #define BN_DEBUG */ |
| 95 | /* #define BN_DEBUG_RAND */ | 149 | /* #define BN_DEBUG_RAND */ |
| 96 | 150 | ||
| 151 | #ifndef OPENSSL_SMALL_FOOTPRINT | ||
| 97 | #define BN_MUL_COMBA | 152 | #define BN_MUL_COMBA |
| 98 | #define BN_SQR_COMBA | 153 | #define BN_SQR_COMBA |
| 99 | #define BN_RECURSION | 154 | #define BN_RECURSION |
| 155 | #endif | ||
| 100 | 156 | ||
| 101 | /* This next option uses the C libraries (2 word)/(1 word) function. | 157 | /* This next option uses the C libraries (2 word)/(1 word) function. |
| 102 | * If it is not defined, I use my C version (which is slower). | 158 | * If it is not defined, I use my C version (which is slower). |
| @@ -137,6 +193,8 @@ extern "C" { | |||
| 137 | #define BN_DEC_FMT1 "%lu" | 193 | #define BN_DEC_FMT1 "%lu" |
| 138 | #define BN_DEC_FMT2 "%019lu" | 194 | #define BN_DEC_FMT2 "%019lu" |
| 139 | #define BN_DEC_NUM 19 | 195 | #define BN_DEC_NUM 19 |
| 196 | #define BN_HEX_FMT1 "%lX" | ||
| 197 | #define BN_HEX_FMT2 "%016lX" | ||
| 140 | #endif | 198 | #endif |
| 141 | 199 | ||
| 142 | /* This is where the long long data type is 64 bits, but long is 32. | 200 | /* This is where the long long data type is 64 bits, but long is 32. |
| @@ -162,83 +220,37 @@ extern "C" { | |||
| 162 | #define BN_DEC_FMT1 "%llu" | 220 | #define BN_DEC_FMT1 "%llu" |
| 163 | #define BN_DEC_FMT2 "%019llu" | 221 | #define BN_DEC_FMT2 "%019llu" |
| 164 | #define BN_DEC_NUM 19 | 222 | #define BN_DEC_NUM 19 |
| 223 | #define BN_HEX_FMT1 "%llX" | ||
| 224 | #define BN_HEX_FMT2 "%016llX" | ||
| 165 | #endif | 225 | #endif |
| 166 | 226 | ||
| 167 | #ifdef THIRTY_TWO_BIT | 227 | #ifdef THIRTY_TWO_BIT |
| 168 | #ifdef BN_LLONG | 228 | #ifdef BN_LLONG |
| 169 | # if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__) | 229 | # if defined(_WIN32) && !defined(__GNUC__) |
| 170 | # define BN_ULLONG unsigned __int64 | 230 | # define BN_ULLONG unsigned __int64 |
| 231 | # define BN_MASK (0xffffffffffffffffI64) | ||
| 171 | # else | 232 | # else |
| 172 | # define BN_ULLONG unsigned long long | 233 | # define BN_ULLONG unsigned long long |
| 234 | # define BN_MASK (0xffffffffffffffffLL) | ||
| 173 | # endif | 235 | # endif |
| 174 | #endif | 236 | #endif |
| 175 | #define BN_ULONG unsigned long | 237 | #define BN_ULONG unsigned int |
| 176 | #define BN_LONG long | 238 | #define BN_LONG int |
| 177 | #define BN_BITS 64 | 239 | #define BN_BITS 64 |
| 178 | #define BN_BYTES 4 | 240 | #define BN_BYTES 4 |
| 179 | #define BN_BITS2 32 | 241 | #define BN_BITS2 32 |
| 180 | #define BN_BITS4 16 | 242 | #define BN_BITS4 16 |
| 181 | #ifdef OPENSSL_SYS_WIN32 | ||
| 182 | /* VC++ doesn't like the LL suffix */ | ||
| 183 | #define BN_MASK (0xffffffffffffffffL) | ||
| 184 | #else | ||
| 185 | #define BN_MASK (0xffffffffffffffffLL) | ||
| 186 | #endif | ||
| 187 | #define BN_MASK2 (0xffffffffL) | 243 | #define BN_MASK2 (0xffffffffL) |
| 188 | #define BN_MASK2l (0xffff) | 244 | #define BN_MASK2l (0xffff) |
| 189 | #define BN_MASK2h1 (0xffff8000L) | 245 | #define BN_MASK2h1 (0xffff8000L) |
| 190 | #define BN_MASK2h (0xffff0000L) | 246 | #define BN_MASK2h (0xffff0000L) |
| 191 | #define BN_TBIT (0x80000000L) | 247 | #define BN_TBIT (0x80000000L) |
| 192 | #define BN_DEC_CONV (1000000000L) | 248 | #define BN_DEC_CONV (1000000000L) |
| 193 | #define BN_DEC_FMT1 "%lu" | ||
| 194 | #define BN_DEC_FMT2 "%09lu" | ||
| 195 | #define BN_DEC_NUM 9 | ||
| 196 | #endif | ||
| 197 | |||
| 198 | #ifdef SIXTEEN_BIT | ||
| 199 | #ifndef BN_DIV2W | ||
| 200 | #define BN_DIV2W | ||
| 201 | #endif | ||
| 202 | #define BN_ULLONG unsigned long | ||
| 203 | #define BN_ULONG unsigned short | ||
| 204 | #define BN_LONG short | ||
| 205 | #define BN_BITS 32 | ||
| 206 | #define BN_BYTES 2 | ||
| 207 | #define BN_BITS2 16 | ||
| 208 | #define BN_BITS4 8 | ||
| 209 | #define BN_MASK (0xffffffff) | ||
| 210 | #define BN_MASK2 (0xffff) | ||
| 211 | #define BN_MASK2l (0xff) | ||
| 212 | #define BN_MASK2h1 (0xff80) | ||
| 213 | #define BN_MASK2h (0xff00) | ||
| 214 | #define BN_TBIT (0x8000) | ||
| 215 | #define BN_DEC_CONV (100000) | ||
| 216 | #define BN_DEC_FMT1 "%u" | 249 | #define BN_DEC_FMT1 "%u" |
| 217 | #define BN_DEC_FMT2 "%05u" | 250 | #define BN_DEC_FMT2 "%09u" |
| 218 | #define BN_DEC_NUM 5 | 251 | #define BN_DEC_NUM 9 |
| 219 | #endif | 252 | #define BN_HEX_FMT1 "%X" |
| 220 | 253 | #define BN_HEX_FMT2 "%08X" | |
| 221 | #ifdef EIGHT_BIT | ||
| 222 | #ifndef BN_DIV2W | ||
| 223 | #define BN_DIV2W | ||
| 224 | #endif | ||
| 225 | #define BN_ULLONG unsigned short | ||
| 226 | #define BN_ULONG unsigned char | ||
| 227 | #define BN_LONG char | ||
| 228 | #define BN_BITS 16 | ||
| 229 | #define BN_BYTES 1 | ||
| 230 | #define BN_BITS2 8 | ||
| 231 | #define BN_BITS4 4 | ||
| 232 | #define BN_MASK (0xffff) | ||
| 233 | #define BN_MASK2 (0xff) | ||
| 234 | #define BN_MASK2l (0xf) | ||
| 235 | #define BN_MASK2h1 (0xf8) | ||
| 236 | #define BN_MASK2h (0xf0) | ||
| 237 | #define BN_TBIT (0x80) | ||
| 238 | #define BN_DEC_CONV (100) | ||
| 239 | #define BN_DEC_FMT1 "%u" | ||
| 240 | #define BN_DEC_FMT2 "%02u" | ||
| 241 | #define BN_DEC_NUM 2 | ||
| 242 | #endif | 254 | #endif |
| 243 | 255 | ||
| 244 | #define BN_DEFAULT_BITS 1280 | 256 | #define BN_DEFAULT_BITS 1280 |
| @@ -303,12 +315,8 @@ struct bn_mont_ctx_st | |||
| 303 | BIGNUM N; /* The modulus */ | 315 | BIGNUM N; /* The modulus */ |
| 304 | BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 | 316 | BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 |
| 305 | * (Ni is only stored for bignum algorithm) */ | 317 | * (Ni is only stored for bignum algorithm) */ |
| 306 | #if 0 | 318 | BN_ULONG n0[2];/* least significant word(s) of Ni; |
| 307 | /* OpenSSL 0.9.9 preview: */ | 319 | (type changed with 0.9.9, was "BN_ULONG n0;" before) */ |
| 308 | BN_ULONG n0[2];/* least significant word(s) of Ni */ | ||
| 309 | #else | ||
| 310 | BN_ULONG n0; /* least significant word of Ni */ | ||
| 311 | #endif | ||
| 312 | int flags; | 320 | int flags; |
| 313 | }; | 321 | }; |
| 314 | 322 | ||
| @@ -504,6 +512,7 @@ char * BN_bn2hex(const BIGNUM *a); | |||
| 504 | char * BN_bn2dec(const BIGNUM *a); | 512 | char * BN_bn2dec(const BIGNUM *a); |
| 505 | int BN_hex2bn(BIGNUM **a, const char *str); | 513 | int BN_hex2bn(BIGNUM **a, const char *str); |
| 506 | int BN_dec2bn(BIGNUM **a, const char *str); | 514 | int BN_dec2bn(BIGNUM **a, const char *str); |
| 515 | int BN_asc2bn(BIGNUM **a, const char *str); | ||
| 507 | int BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); | 516 | int BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); |
| 508 | int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */ | 517 | int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */ |
| 509 | BIGNUM *BN_mod_inverse(BIGNUM *ret, | 518 | BIGNUM *BN_mod_inverse(BIGNUM *ret, |
| @@ -531,17 +540,6 @@ int BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb); | |||
| 531 | int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, | 540 | int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, |
| 532 | int do_trial_division, BN_GENCB *cb); | 541 | int do_trial_division, BN_GENCB *cb); |
| 533 | 542 | ||
| 534 | int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); | ||
| 535 | |||
| 536 | int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, | ||
| 537 | const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2, | ||
| 538 | const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb); | ||
| 539 | int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, | ||
| 540 | BIGNUM *Xp1, BIGNUM *Xp2, | ||
| 541 | const BIGNUM *Xp, | ||
| 542 | const BIGNUM *e, BN_CTX *ctx, | ||
| 543 | BN_GENCB *cb); | ||
| 544 | |||
| 545 | BN_MONT_CTX *BN_MONT_CTX_new(void ); | 543 | BN_MONT_CTX *BN_MONT_CTX_new(void ); |
| 546 | void BN_MONT_CTX_init(BN_MONT_CTX *ctx); | 544 | void BN_MONT_CTX_init(BN_MONT_CTX *ctx); |
| 547 | int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b, | 545 | int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b, |
| @@ -560,19 +558,22 @@ BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, | |||
| 560 | #define BN_BLINDING_NO_UPDATE 0x00000001 | 558 | #define BN_BLINDING_NO_UPDATE 0x00000001 |
| 561 | #define BN_BLINDING_NO_RECREATE 0x00000002 | 559 | #define BN_BLINDING_NO_RECREATE 0x00000002 |
| 562 | 560 | ||
| 563 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGNUM *mod); | 561 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); |
| 564 | void BN_BLINDING_free(BN_BLINDING *b); | 562 | void BN_BLINDING_free(BN_BLINDING *b); |
| 565 | int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); | 563 | int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); |
| 566 | int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); | 564 | int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); |
| 567 | int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); | 565 | int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); |
| 568 | int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); | 566 | int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); |
| 569 | int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); | 567 | int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); |
| 568 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 570 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); | 569 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); |
| 571 | void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); | 570 | void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); |
| 571 | #endif | ||
| 572 | CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *); | ||
| 572 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); | 573 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); |
| 573 | void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); | 574 | void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); |
| 574 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, | 575 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, |
| 575 | const BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx, | 576 | const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, |
| 576 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 577 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
| 577 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), | 578 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), |
| 578 | BN_MONT_CTX *m_ctx); | 579 | BN_MONT_CTX *m_ctx); |
| @@ -625,24 +626,24 @@ int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | |||
| 625 | * t^p[0] + t^p[1] + ... + t^p[k] | 626 | * t^p[0] + t^p[1] + ... + t^p[k] |
| 626 | * where m = p[0] > p[1] > ... > p[k] = 0. | 627 | * where m = p[0] > p[1] > ... > p[k] = 0. |
| 627 | */ | 628 | */ |
| 628 | int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]); | 629 | int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); |
| 629 | /* r = a mod p */ | 630 | /* r = a mod p */ |
| 630 | int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | 631 | int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, |
| 631 | const unsigned int p[], BN_CTX *ctx); /* r = (a * b) mod p */ | 632 | const int p[], BN_CTX *ctx); /* r = (a * b) mod p */ |
| 632 | int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], | 633 | int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], |
| 633 | BN_CTX *ctx); /* r = (a * a) mod p */ | 634 | BN_CTX *ctx); /* r = (a * a) mod p */ |
| 634 | int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const unsigned int p[], | 635 | int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], |
| 635 | BN_CTX *ctx); /* r = (1 / b) mod p */ | 636 | BN_CTX *ctx); /* r = (1 / b) mod p */ |
| 636 | int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | 637 | int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, |
| 637 | const unsigned int p[], BN_CTX *ctx); /* r = (a / b) mod p */ | 638 | const int p[], BN_CTX *ctx); /* r = (a / b) mod p */ |
| 638 | int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | 639 | int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, |
| 639 | const unsigned int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */ | 640 | const int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */ |
| 640 | int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, | 641 | int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, |
| 641 | const unsigned int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */ | 642 | const int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */ |
| 642 | int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, | 643 | int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, |
| 643 | const unsigned int p[], BN_CTX *ctx); /* r^2 + r = a mod p */ | 644 | const int p[], BN_CTX *ctx); /* r^2 + r = a mod p */ |
| 644 | int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max); | 645 | int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); |
| 645 | int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a); | 646 | int BN_GF2m_arr2poly(const int p[], BIGNUM *a); |
| 646 | 647 | ||
| 647 | /* faster mod functions for the 'NIST primes' | 648 | /* faster mod functions for the 'NIST primes' |
| 648 | * 0 <= a < p^2 */ | 649 | * 0 <= a < p^2 */ |
| @@ -751,10 +752,12 @@ int RAND_pseudo_bytes(unsigned char *buf,int num); | |||
| 751 | #define bn_correct_top(a) \ | 752 | #define bn_correct_top(a) \ |
| 752 | { \ | 753 | { \ |
| 753 | BN_ULONG *ftl; \ | 754 | BN_ULONG *ftl; \ |
| 754 | if ((a)->top > 0) \ | 755 | int tmp_top = (a)->top; \ |
| 756 | if (tmp_top > 0) \ | ||
| 755 | { \ | 757 | { \ |
| 756 | for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \ | 758 | for (ftl= &((a)->d[tmp_top-1]); tmp_top > 0; tmp_top--) \ |
| 757 | if (*(ftl--)) break; \ | 759 | if (*(ftl--)) break; \ |
| 760 | (a)->top = tmp_top; \ | ||
| 758 | } \ | 761 | } \ |
| 759 | bn_pollute(a); \ | 762 | bn_pollute(a); \ |
| 760 | } | 763 | } |
diff --git a/src/lib/libcrypto/bn/bn_asm.c b/src/lib/libcrypto/bn/bn_asm.c index 99bc2de491..c43c91cc09 100644 --- a/src/lib/libcrypto/bn/bn_asm.c +++ b/src/lib/libcrypto/bn/bn_asm.c | |||
| @@ -75,6 +75,7 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 75 | assert(num >= 0); | 75 | assert(num >= 0); |
| 76 | if (num <= 0) return(c1); | 76 | if (num <= 0) return(c1); |
| 77 | 77 | ||
| 78 | #ifndef OPENSSL_SMALL_FOOTPRINT | ||
| 78 | while (num&~3) | 79 | while (num&~3) |
| 79 | { | 80 | { |
| 80 | mul_add(rp[0],ap[0],w,c1); | 81 | mul_add(rp[0],ap[0],w,c1); |
| @@ -83,11 +84,11 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 83 | mul_add(rp[3],ap[3],w,c1); | 84 | mul_add(rp[3],ap[3],w,c1); |
| 84 | ap+=4; rp+=4; num-=4; | 85 | ap+=4; rp+=4; num-=4; |
| 85 | } | 86 | } |
| 86 | if (num) | 87 | #endif |
| 88 | while (num) | ||
| 87 | { | 89 | { |
| 88 | mul_add(rp[0],ap[0],w,c1); if (--num==0) return c1; | 90 | mul_add(rp[0],ap[0],w,c1); |
| 89 | mul_add(rp[1],ap[1],w,c1); if (--num==0) return c1; | 91 | ap++; rp++; num--; |
| 90 | mul_add(rp[2],ap[2],w,c1); return c1; | ||
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | return(c1); | 94 | return(c1); |
| @@ -100,6 +101,7 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 100 | assert(num >= 0); | 101 | assert(num >= 0); |
| 101 | if (num <= 0) return(c1); | 102 | if (num <= 0) return(c1); |
| 102 | 103 | ||
| 104 | #ifndef OPENSSL_SMALL_FOOTPRINT | ||
| 103 | while (num&~3) | 105 | while (num&~3) |
| 104 | { | 106 | { |
| 105 | mul(rp[0],ap[0],w,c1); | 107 | mul(rp[0],ap[0],w,c1); |
| @@ -108,11 +110,11 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 108 | mul(rp[3],ap[3],w,c1); | 110 | mul(rp[3],ap[3],w,c1); |
| 109 | ap+=4; rp+=4; num-=4; | 111 | ap+=4; rp+=4; num-=4; |
| 110 | } | 112 | } |
| 111 | if (num) | 113 | #endif |
| 114 | while (num) | ||
| 112 | { | 115 | { |
| 113 | mul(rp[0],ap[0],w,c1); if (--num == 0) return c1; | 116 | mul(rp[0],ap[0],w,c1); |
| 114 | mul(rp[1],ap[1],w,c1); if (--num == 0) return c1; | 117 | ap++; rp++; num--; |
| 115 | mul(rp[2],ap[2],w,c1); | ||
| 116 | } | 118 | } |
| 117 | return(c1); | 119 | return(c1); |
| 118 | } | 120 | } |
| @@ -121,6 +123,8 @@ void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int n) | |||
| 121 | { | 123 | { |
| 122 | assert(n >= 0); | 124 | assert(n >= 0); |
| 123 | if (n <= 0) return; | 125 | if (n <= 0) return; |
| 126 | |||
| 127 | #ifndef OPENSSL_SMALL_FOOTPRINT | ||
| 124 | while (n&~3) | 128 | while (n&~3) |
| 125 | { | 129 | { |
| 126 | sqr(r[0],r[1],a[0]); | 130 | sqr(r[0],r[1],a[0]); |
| @@ -129,11 +133,11 @@ void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int n) | |||
| 129 | sqr(r[6],r[7],a[3]); | 133 | sqr(r[6],r[7],a[3]); |
| 130 | a+=4; r+=8; n-=4; | 134 | a+=4; r+=8; n-=4; |
| 131 | } | 135 | } |
| 132 | if (n) | 136 | #endif |
| 137 | while (n) | ||
| 133 | { | 138 | { |
| 134 | sqr(r[0],r[1],a[0]); if (--n == 0) return; | 139 | sqr(r[0],r[1],a[0]); |
| 135 | sqr(r[2],r[3],a[1]); if (--n == 0) return; | 140 | a++; r+=2; n--; |
| 136 | sqr(r[4],r[5],a[2]); | ||
| 137 | } | 141 | } |
| 138 | } | 142 | } |
| 139 | 143 | ||
| @@ -150,18 +154,20 @@ BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 150 | bl=LBITS(w); | 154 | bl=LBITS(w); |
| 151 | bh=HBITS(w); | 155 | bh=HBITS(w); |
| 152 | 156 | ||
| 153 | for (;;) | 157 | #ifndef OPENSSL_SMALL_FOOTPRINT |
| 158 | while (num&~3) | ||
| 154 | { | 159 | { |
| 155 | mul_add(rp[0],ap[0],bl,bh,c); | 160 | mul_add(rp[0],ap[0],bl,bh,c); |
| 156 | if (--num == 0) break; | ||
| 157 | mul_add(rp[1],ap[1],bl,bh,c); | 161 | mul_add(rp[1],ap[1],bl,bh,c); |
| 158 | if (--num == 0) break; | ||
| 159 | mul_add(rp[2],ap[2],bl,bh,c); | 162 | mul_add(rp[2],ap[2],bl,bh,c); |
| 160 | if (--num == 0) break; | ||
| 161 | mul_add(rp[3],ap[3],bl,bh,c); | 163 | mul_add(rp[3],ap[3],bl,bh,c); |
| 162 | if (--num == 0) break; | 164 | ap+=4; rp+=4; num-=4; |
| 163 | ap+=4; | 165 | } |
| 164 | rp+=4; | 166 | #endif |
| 167 | while (num) | ||
| 168 | { | ||
| 169 | mul_add(rp[0],ap[0],bl,bh,c); | ||
| 170 | ap++; rp++; num--; | ||
| 165 | } | 171 | } |
| 166 | return(c); | 172 | return(c); |
| 167 | } | 173 | } |
| @@ -177,18 +183,20 @@ BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) | |||
| 177 | bl=LBITS(w); | 183 | bl=LBITS(w); |
| 178 | bh=HBITS(w); | 184 | bh=HBITS(w); |
| 179 | 185 | ||
| 180 | for (;;) | 186 | #ifndef OPENSSL_SMALL_FOOTPRINT |
| 187 | while (num&~3) | ||
| 181 | { | 188 | { |
| 182 | mul(rp[0],ap[0],bl,bh,carry); | 189 | mul(rp[0],ap[0],bl,bh,carry); |
| 183 | if (--num == 0) break; | ||
| 184 | mul(rp[1],ap[1],bl,bh,carry); | 190 | mul(rp[1],ap[1],bl,bh,carry); |
| 185 | if (--num == 0) break; | ||
| 186 | mul(rp[2],ap[2],bl,bh,carry); | 191 | mul(rp[2],ap[2],bl,bh,carry); |
| 187 | if (--num == 0) break; | ||
| 188 | mul(rp[3],ap[3],bl,bh,carry); | 192 | mul(rp[3],ap[3],bl,bh,carry); |
| 189 | if (--num == 0) break; | 193 | ap+=4; rp+=4; num-=4; |
| 190 | ap+=4; | 194 | } |
| 191 | rp+=4; | 195 | #endif |
| 196 | while (num) | ||
| 197 | { | ||
| 198 | mul(rp[0],ap[0],bl,bh,carry); | ||
| 199 | ap++; rp++; num--; | ||
| 192 | } | 200 | } |
| 193 | return(carry); | 201 | return(carry); |
| 194 | } | 202 | } |
| @@ -197,22 +205,21 @@ void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int n) | |||
| 197 | { | 205 | { |
| 198 | assert(n >= 0); | 206 | assert(n >= 0); |
| 199 | if (n <= 0) return; | 207 | if (n <= 0) return; |
| 200 | for (;;) | 208 | |
| 209 | #ifndef OPENSSL_SMALL_FOOTPRINT | ||
| 210 | while (n&~3) | ||
| 201 | { | 211 | { |
| 202 | sqr64(r[0],r[1],a[0]); | 212 | sqr64(r[0],r[1],a[0]); |
| 203 | if (--n == 0) break; | ||
| 204 | |||
| 205 | sqr64(r[2],r[3],a[1]); | 213 | sqr64(r[2],r[3],a[1]); |
| 206 | if (--n == 0) break; | ||
| 207 | |||
| 208 | sqr64(r[4],r[5],a[2]); | 214 | sqr64(r[4],r[5],a[2]); |
| 209 | if (--n == 0) break; | ||
| 210 | |||
| 211 | sqr64(r[6],r[7],a[3]); | 215 | sqr64(r[6],r[7],a[3]); |
| 212 | if (--n == 0) break; | 216 | a+=4; r+=8; n-=4; |
| 213 | 217 | } | |
| 214 | a+=4; | 218 | #endif |
| 215 | r+=8; | 219 | while (n) |
| 220 | { | ||
| 221 | sqr64(r[0],r[1],a[0]); | ||
| 222 | a++; r+=2; n--; | ||
| 216 | } | 223 | } |
| 217 | } | 224 | } |
| 218 | 225 | ||
| @@ -303,31 +310,30 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | |||
| 303 | assert(n >= 0); | 310 | assert(n >= 0); |
| 304 | if (n <= 0) return((BN_ULONG)0); | 311 | if (n <= 0) return((BN_ULONG)0); |
| 305 | 312 | ||
| 306 | for (;;) | 313 | #ifndef OPENSSL_SMALL_FOOTPRINT |
| 314 | while (n&~3) | ||
| 307 | { | 315 | { |
| 308 | ll+=(BN_ULLONG)a[0]+b[0]; | 316 | ll+=(BN_ULLONG)a[0]+b[0]; |
| 309 | r[0]=(BN_ULONG)ll&BN_MASK2; | 317 | r[0]=(BN_ULONG)ll&BN_MASK2; |
| 310 | ll>>=BN_BITS2; | 318 | ll>>=BN_BITS2; |
| 311 | if (--n <= 0) break; | ||
| 312 | |||
| 313 | ll+=(BN_ULLONG)a[1]+b[1]; | 319 | ll+=(BN_ULLONG)a[1]+b[1]; |
| 314 | r[1]=(BN_ULONG)ll&BN_MASK2; | 320 | r[1]=(BN_ULONG)ll&BN_MASK2; |
| 315 | ll>>=BN_BITS2; | 321 | ll>>=BN_BITS2; |
| 316 | if (--n <= 0) break; | ||
| 317 | |||
| 318 | ll+=(BN_ULLONG)a[2]+b[2]; | 322 | ll+=(BN_ULLONG)a[2]+b[2]; |
| 319 | r[2]=(BN_ULONG)ll&BN_MASK2; | 323 | r[2]=(BN_ULONG)ll&BN_MASK2; |
| 320 | ll>>=BN_BITS2; | 324 | ll>>=BN_BITS2; |
| 321 | if (--n <= 0) break; | ||
| 322 | |||
| 323 | ll+=(BN_ULLONG)a[3]+b[3]; | 325 | ll+=(BN_ULLONG)a[3]+b[3]; |
| 324 | r[3]=(BN_ULONG)ll&BN_MASK2; | 326 | r[3]=(BN_ULONG)ll&BN_MASK2; |
| 325 | ll>>=BN_BITS2; | 327 | ll>>=BN_BITS2; |
| 326 | if (--n <= 0) break; | 328 | a+=4; b+=4; r+=4; n-=4; |
| 327 | 329 | } | |
| 328 | a+=4; | 330 | #endif |
| 329 | b+=4; | 331 | while (n) |
| 330 | r+=4; | 332 | { |
| 333 | ll+=(BN_ULLONG)a[0]+b[0]; | ||
| 334 | r[0]=(BN_ULONG)ll&BN_MASK2; | ||
| 335 | ll>>=BN_BITS2; | ||
| 336 | a++; b++; r++; n--; | ||
| 331 | } | 337 | } |
| 332 | return((BN_ULONG)ll); | 338 | return((BN_ULONG)ll); |
| 333 | } | 339 | } |
| @@ -340,7 +346,8 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | |||
| 340 | if (n <= 0) return((BN_ULONG)0); | 346 | if (n <= 0) return((BN_ULONG)0); |
| 341 | 347 | ||
| 342 | c=0; | 348 | c=0; |
| 343 | for (;;) | 349 | #ifndef OPENSSL_SMALL_FOOTPRINT |
| 350 | while (n&~3) | ||
| 344 | { | 351 | { |
| 345 | t=a[0]; | 352 | t=a[0]; |
| 346 | t=(t+c)&BN_MASK2; | 353 | t=(t+c)&BN_MASK2; |
| @@ -348,35 +355,36 @@ BN_ULONG bn_add_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | |||
| 348 | l=(t+b[0])&BN_MASK2; | 355 | l=(t+b[0])&BN_MASK2; |
| 349 | c+=(l < t); | 356 | c+=(l < t); |
| 350 | r[0]=l; | 357 | r[0]=l; |
| 351 | if (--n <= 0) break; | ||
| 352 | |||
| 353 | t=a[1]; | 358 | t=a[1]; |
| 354 | t=(t+c)&BN_MASK2; | 359 | t=(t+c)&BN_MASK2; |
| 355 | c=(t < c); | 360 | c=(t < c); |
| 356 | l=(t+b[1])&BN_MASK2; | 361 | l=(t+b[1])&BN_MASK2; |
| 357 | c+=(l < t); | 362 | c+=(l < t); |
| 358 | r[1]=l; | 363 | r[1]=l; |
| 359 | if (--n <= 0) break; | ||
| 360 | |||
| 361 | t=a[2]; | 364 | t=a[2]; |
| 362 | t=(t+c)&BN_MASK2; | 365 | t=(t+c)&BN_MASK2; |
| 363 | c=(t < c); | 366 | c=(t < c); |
| 364 | l=(t+b[2])&BN_MASK2; | 367 | l=(t+b[2])&BN_MASK2; |
| 365 | c+=(l < t); | 368 | c+=(l < t); |
| 366 | r[2]=l; | 369 | r[2]=l; |
| 367 | if (--n <= 0) break; | ||
| 368 | |||
| 369 | t=a[3]; | 370 | t=a[3]; |
| 370 | t=(t+c)&BN_MASK2; | 371 | t=(t+c)&BN_MASK2; |
| 371 | c=(t < c); | 372 | c=(t < c); |
| 372 | l=(t+b[3])&BN_MASK2; | 373 | l=(t+b[3])&BN_MASK2; |
| 373 | c+=(l < t); | 374 | c+=(l < t); |
| 374 | r[3]=l; | 375 | r[3]=l; |
| 375 | if (--n <= 0) break; | 376 | a+=4; b+=4; r+=4; n-=4; |
| 376 | 377 | } | |
| 377 | a+=4; | 378 | #endif |
| 378 | b+=4; | 379 | while(n) |
| 379 | r+=4; | 380 | { |
| 381 | t=a[0]; | ||
| 382 | t=(t+c)&BN_MASK2; | ||
| 383 | c=(t < c); | ||
| 384 | l=(t+b[0])&BN_MASK2; | ||
| 385 | c+=(l < t); | ||
| 386 | r[0]=l; | ||
| 387 | a++; b++; r++; n--; | ||
| 380 | } | 388 | } |
| 381 | return((BN_ULONG)c); | 389 | return((BN_ULONG)c); |
| 382 | } | 390 | } |
| @@ -390,36 +398,35 @@ BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) | |||
| 390 | assert(n >= 0); | 398 | assert(n >= 0); |
| 391 | if (n <= 0) return((BN_ULONG)0); | 399 | if (n <= 0) return((BN_ULONG)0); |
| 392 | 400 | ||
| 393 | for (;;) | 401 | #ifndef OPENSSL_SMALL_FOOTPRINT |
| 402 | while (n&~3) | ||
| 394 | { | 403 | { |
| 395 | t1=a[0]; t2=b[0]; | 404 | t1=a[0]; t2=b[0]; |
| 396 | r[0]=(t1-t2-c)&BN_MASK2; | 405 | r[0]=(t1-t2-c)&BN_MASK2; |
| 397 | if (t1 != t2) c=(t1 < t2); | 406 | if (t1 != t2) c=(t1 < t2); |
| 398 | if (--n <= 0) break; | ||
| 399 | |||
| 400 | t1=a[1]; t2=b[1]; | 407 | t1=a[1]; t2=b[1]; |
| 401 | r[1]=(t1-t2-c)&BN_MASK2; | 408 | r[1]=(t1-t2-c)&BN_MASK2; |
| 402 | if (t1 != t2) c=(t1 < t2); | 409 | if (t1 != t2) c=(t1 < t2); |
| 403 | if (--n <= 0) break; | ||
| 404 | |||
| 405 | t1=a[2]; t2=b[2]; | 410 | t1=a[2]; t2=b[2]; |
| 406 | r[2]=(t1-t2-c)&BN_MASK2; | 411 | r[2]=(t1-t2-c)&BN_MASK2; |
| 407 | if (t1 != t2) c=(t1 < t2); | 412 | if (t1 != t2) c=(t1 < t2); |
| 408 | if (--n <= 0) break; | ||
| 409 | |||
| 410 | t1=a[3]; t2=b[3]; | 413 | t1=a[3]; t2=b[3]; |
| 411 | r[3]=(t1-t2-c)&BN_MASK2; | 414 | r[3]=(t1-t2-c)&BN_MASK2; |
| 412 | if (t1 != t2) c=(t1 < t2); | 415 | if (t1 != t2) c=(t1 < t2); |
| 413 | if (--n <= 0) break; | 416 | a+=4; b+=4; r+=4; n-=4; |
| 414 | 417 | } | |
| 415 | a+=4; | 418 | #endif |
| 416 | b+=4; | 419 | while (n) |
| 417 | r+=4; | 420 | { |
| 421 | t1=a[0]; t2=b[0]; | ||
| 422 | r[0]=(t1-t2-c)&BN_MASK2; | ||
| 423 | if (t1 != t2) c=(t1 < t2); | ||
| 424 | a++; b++; r++; n--; | ||
| 418 | } | 425 | } |
| 419 | return(c); | 426 | return(c); |
| 420 | } | 427 | } |
| 421 | 428 | ||
| 422 | #ifdef BN_MUL_COMBA | 429 | #if defined(BN_MUL_COMBA) && !defined(OPENSSL_SMALL_FOOTPRINT) |
| 423 | 430 | ||
| 424 | #undef bn_mul_comba8 | 431 | #undef bn_mul_comba8 |
| 425 | #undef bn_mul_comba4 | 432 | #undef bn_mul_comba4 |
| @@ -820,18 +827,134 @@ void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a) | |||
| 820 | r[6]=c1; | 827 | r[6]=c1; |
| 821 | r[7]=c2; | 828 | r[7]=c2; |
| 822 | } | 829 | } |
| 830 | |||
| 831 | #ifdef OPENSSL_NO_ASM | ||
| 832 | #ifdef OPENSSL_BN_ASM_MONT | ||
| 833 | #include <alloca.h> | ||
| 834 | /* | ||
| 835 | * This is essentially reference implementation, which may or may not | ||
| 836 | * result in performance improvement. E.g. on IA-32 this routine was | ||
| 837 | * observed to give 40% faster rsa1024 private key operations and 10% | ||
| 838 | * faster rsa4096 ones, while on AMD64 it improves rsa1024 sign only | ||
| 839 | * by 10% and *worsens* rsa4096 sign by 15%. Once again, it's a | ||
| 840 | * reference implementation, one to be used as starting point for | ||
| 841 | * platform-specific assembler. Mentioned numbers apply to compiler | ||
| 842 | * generated code compiled with and without -DOPENSSL_BN_ASM_MONT and | ||
| 843 | * can vary not only from platform to platform, but even for compiler | ||
| 844 | * versions. Assembler vs. assembler improvement coefficients can | ||
| 845 | * [and are known to] differ and are to be documented elsewhere. | ||
| 846 | */ | ||
| 847 | int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0p, int num) | ||
| 848 | { | ||
| 849 | BN_ULONG c0,c1,ml,*tp,n0; | ||
| 850 | #ifdef mul64 | ||
| 851 | BN_ULONG mh; | ||
| 852 | #endif | ||
| 853 | volatile BN_ULONG *vp; | ||
| 854 | int i=0,j; | ||
| 855 | |||
| 856 | #if 0 /* template for platform-specific implementation */ | ||
| 857 | if (ap==bp) return bn_sqr_mont(rp,ap,np,n0p,num); | ||
| 858 | #endif | ||
| 859 | vp = tp = alloca((num+2)*sizeof(BN_ULONG)); | ||
| 860 | |||
| 861 | n0 = *n0p; | ||
| 862 | |||
| 863 | c0 = 0; | ||
| 864 | ml = bp[0]; | ||
| 865 | #ifdef mul64 | ||
| 866 | mh = HBITS(ml); | ||
| 867 | ml = LBITS(ml); | ||
| 868 | for (j=0;j<num;++j) | ||
| 869 | mul(tp[j],ap[j],ml,mh,c0); | ||
| 870 | #else | ||
| 871 | for (j=0;j<num;++j) | ||
| 872 | mul(tp[j],ap[j],ml,c0); | ||
| 873 | #endif | ||
| 874 | |||
| 875 | tp[num] = c0; | ||
| 876 | tp[num+1] = 0; | ||
| 877 | goto enter; | ||
| 878 | |||
| 879 | for(i=0;i<num;i++) | ||
| 880 | { | ||
| 881 | c0 = 0; | ||
| 882 | ml = bp[i]; | ||
| 883 | #ifdef mul64 | ||
| 884 | mh = HBITS(ml); | ||
| 885 | ml = LBITS(ml); | ||
| 886 | for (j=0;j<num;++j) | ||
| 887 | mul_add(tp[j],ap[j],ml,mh,c0); | ||
| 888 | #else | ||
| 889 | for (j=0;j<num;++j) | ||
| 890 | mul_add(tp[j],ap[j],ml,c0); | ||
| 891 | #endif | ||
| 892 | c1 = (tp[num] + c0)&BN_MASK2; | ||
| 893 | tp[num] = c1; | ||
| 894 | tp[num+1] = (c1<c0?1:0); | ||
| 895 | enter: | ||
| 896 | c1 = tp[0]; | ||
| 897 | ml = (c1*n0)&BN_MASK2; | ||
| 898 | c0 = 0; | ||
| 899 | #ifdef mul64 | ||
| 900 | mh = HBITS(ml); | ||
| 901 | ml = LBITS(ml); | ||
| 902 | mul_add(c1,np[0],ml,mh,c0); | ||
| 903 | #else | ||
| 904 | mul_add(c1,ml,np[0],c0); | ||
| 905 | #endif | ||
| 906 | for(j=1;j<num;j++) | ||
| 907 | { | ||
| 908 | c1 = tp[j]; | ||
| 909 | #ifdef mul64 | ||
| 910 | mul_add(c1,np[j],ml,mh,c0); | ||
| 911 | #else | ||
| 912 | mul_add(c1,ml,np[j],c0); | ||
| 913 | #endif | ||
| 914 | tp[j-1] = c1&BN_MASK2; | ||
| 915 | } | ||
| 916 | c1 = (tp[num] + c0)&BN_MASK2; | ||
| 917 | tp[num-1] = c1; | ||
| 918 | tp[num] = tp[num+1] + (c1<c0?1:0); | ||
| 919 | } | ||
| 920 | |||
| 921 | if (tp[num]!=0 || tp[num-1]>=np[num-1]) | ||
| 922 | { | ||
| 923 | c0 = bn_sub_words(rp,tp,np,num); | ||
| 924 | if (tp[num]!=0 || c0==0) | ||
| 925 | { | ||
| 926 | for(i=0;i<num+2;i++) vp[i] = 0; | ||
| 927 | return 1; | ||
| 928 | } | ||
| 929 | } | ||
| 930 | for(i=0;i<num;i++) rp[i] = tp[i], vp[i] = 0; | ||
| 931 | vp[num] = 0; | ||
| 932 | vp[num+1] = 0; | ||
| 933 | return 1; | ||
| 934 | } | ||
| 935 | #else | ||
| 936 | /* | ||
| 937 | * Return value of 0 indicates that multiplication/convolution was not | ||
| 938 | * performed to signal the caller to fall down to alternative/original | ||
| 939 | * code-path. | ||
| 940 | */ | ||
| 941 | int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num) | ||
| 942 | { return 0; } | ||
| 943 | #endif /* OPENSSL_BN_ASM_MONT */ | ||
| 944 | #endif | ||
| 945 | |||
| 823 | #else /* !BN_MUL_COMBA */ | 946 | #else /* !BN_MUL_COMBA */ |
| 824 | 947 | ||
| 825 | /* hmm... is it faster just to do a multiply? */ | 948 | /* hmm... is it faster just to do a multiply? */ |
| 826 | #undef bn_sqr_comba4 | 949 | #undef bn_sqr_comba4 |
| 827 | void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a) | 950 | void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a) |
| 828 | { | 951 | { |
| 829 | BN_ULONG t[8]; | 952 | BN_ULONG t[8]; |
| 830 | bn_sqr_normal(r,a,4,t); | 953 | bn_sqr_normal(r,a,4,t); |
| 831 | } | 954 | } |
| 832 | 955 | ||
| 833 | #undef bn_sqr_comba8 | 956 | #undef bn_sqr_comba8 |
| 834 | void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a) | 957 | void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a) |
| 835 | { | 958 | { |
| 836 | BN_ULONG t[16]; | 959 | BN_ULONG t[16]; |
| 837 | bn_sqr_normal(r,a,8,t); | 960 | bn_sqr_normal(r,a,8,t); |
| @@ -857,4 +980,51 @@ void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b) | |||
| 857 | r[15]=bn_mul_add_words(&(r[7]),a,8,b[7]); | 980 | r[15]=bn_mul_add_words(&(r[7]),a,8,b[7]); |
| 858 | } | 981 | } |
| 859 | 982 | ||
| 983 | #ifdef OPENSSL_NO_ASM | ||
| 984 | #ifdef OPENSSL_BN_ASM_MONT | ||
| 985 | #include <alloca.h> | ||
| 986 | int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0p, int num) | ||
| 987 | { | ||
| 988 | BN_ULONG c0,c1,*tp,n0=*n0p; | ||
| 989 | volatile BN_ULONG *vp; | ||
| 990 | int i=0,j; | ||
| 991 | |||
| 992 | vp = tp = alloca((num+2)*sizeof(BN_ULONG)); | ||
| 993 | |||
| 994 | for(i=0;i<=num;i++) tp[i]=0; | ||
| 995 | |||
| 996 | for(i=0;i<num;i++) | ||
| 997 | { | ||
| 998 | c0 = bn_mul_add_words(tp,ap,num,bp[i]); | ||
| 999 | c1 = (tp[num] + c0)&BN_MASK2; | ||
| 1000 | tp[num] = c1; | ||
| 1001 | tp[num+1] = (c1<c0?1:0); | ||
| 1002 | |||
| 1003 | c0 = bn_mul_add_words(tp,np,num,tp[0]*n0); | ||
| 1004 | c1 = (tp[num] + c0)&BN_MASK2; | ||
| 1005 | tp[num] = c1; | ||
| 1006 | tp[num+1] += (c1<c0?1:0); | ||
| 1007 | for(j=0;j<=num;j++) tp[j]=tp[j+1]; | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | if (tp[num]!=0 || tp[num-1]>=np[num-1]) | ||
| 1011 | { | ||
| 1012 | c0 = bn_sub_words(rp,tp,np,num); | ||
| 1013 | if (tp[num]!=0 || c0==0) | ||
| 1014 | { | ||
| 1015 | for(i=0;i<num+2;i++) vp[i] = 0; | ||
| 1016 | return 1; | ||
| 1017 | } | ||
| 1018 | } | ||
| 1019 | for(i=0;i<num;i++) rp[i] = tp[i], vp[i] = 0; | ||
| 1020 | vp[num] = 0; | ||
| 1021 | vp[num+1] = 0; | ||
| 1022 | return 1; | ||
| 1023 | } | ||
| 1024 | #else | ||
| 1025 | int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num) | ||
| 1026 | { return 0; } | ||
| 1027 | #endif /* OPENSSL_BN_ASM_MONT */ | ||
| 1028 | #endif | ||
| 1029 | |||
| 860 | #endif /* !BN_MUL_COMBA */ | 1030 | #endif /* !BN_MUL_COMBA */ |
diff --git a/src/lib/libcrypto/bn/bn_blind.c b/src/lib/libcrypto/bn/bn_blind.c index c11fb4ccc2..e060592fdc 100644 --- a/src/lib/libcrypto/bn/bn_blind.c +++ b/src/lib/libcrypto/bn/bn_blind.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/bn/bn_blind.c */ | 1 | /* crypto/bn/bn_blind.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -121,8 +121,11 @@ struct bn_blinding_st | |||
| 121 | BIGNUM *Ai; | 121 | BIGNUM *Ai; |
| 122 | BIGNUM *e; | 122 | BIGNUM *e; |
| 123 | BIGNUM *mod; /* just a reference */ | 123 | BIGNUM *mod; /* just a reference */ |
| 124 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 124 | unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b; | 125 | unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b; |
| 125 | * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */ | 126 | * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */ |
| 127 | #endif | ||
| 128 | CRYPTO_THREADID tid; | ||
| 126 | unsigned int counter; | 129 | unsigned int counter; |
| 127 | unsigned long flags; | 130 | unsigned long flags; |
| 128 | BN_MONT_CTX *m_ctx; | 131 | BN_MONT_CTX *m_ctx; |
| @@ -131,7 +134,7 @@ struct bn_blinding_st | |||
| 131 | BN_MONT_CTX *m_ctx); | 134 | BN_MONT_CTX *m_ctx); |
| 132 | }; | 135 | }; |
| 133 | 136 | ||
| 134 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGNUM *mod) | 137 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) |
| 135 | { | 138 | { |
| 136 | BN_BLINDING *ret=NULL; | 139 | BN_BLINDING *ret=NULL; |
| 137 | 140 | ||
| @@ -158,6 +161,7 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGN | |||
| 158 | BN_set_flags(ret->mod, BN_FLG_CONSTTIME); | 161 | BN_set_flags(ret->mod, BN_FLG_CONSTTIME); |
| 159 | 162 | ||
| 160 | ret->counter = BN_BLINDING_COUNTER; | 163 | ret->counter = BN_BLINDING_COUNTER; |
| 164 | CRYPTO_THREADID_current(&ret->tid); | ||
| 161 | return(ret); | 165 | return(ret); |
| 162 | err: | 166 | err: |
| 163 | if (ret != NULL) BN_BLINDING_free(ret); | 167 | if (ret != NULL) BN_BLINDING_free(ret); |
| @@ -263,6 +267,7 @@ int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ct | |||
| 263 | return(ret); | 267 | return(ret); |
| 264 | } | 268 | } |
| 265 | 269 | ||
| 270 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 266 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *b) | 271 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *b) |
| 267 | { | 272 | { |
| 268 | return b->thread_id; | 273 | return b->thread_id; |
| @@ -272,6 +277,12 @@ void BN_BLINDING_set_thread_id(BN_BLINDING *b, unsigned long n) | |||
| 272 | { | 277 | { |
| 273 | b->thread_id = n; | 278 | b->thread_id = n; |
| 274 | } | 279 | } |
| 280 | #endif | ||
| 281 | |||
| 282 | CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *b) | ||
| 283 | { | ||
| 284 | return &b->tid; | ||
| 285 | } | ||
| 275 | 286 | ||
| 276 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b) | 287 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b) |
| 277 | { | 288 | { |
| @@ -284,7 +295,7 @@ void BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags) | |||
| 284 | } | 295 | } |
| 285 | 296 | ||
| 286 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, | 297 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, |
| 287 | const BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx, | 298 | const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, |
| 288 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 299 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
| 289 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), | 300 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), |
| 290 | BN_MONT_CTX *m_ctx) | 301 | BN_MONT_CTX *m_ctx) |
diff --git a/src/lib/libcrypto/bn/bn_ctx.c b/src/lib/libcrypto/bn/bn_ctx.c index b3452f1a91..3f2256f675 100644 --- a/src/lib/libcrypto/bn/bn_ctx.c +++ b/src/lib/libcrypto/bn/bn_ctx.c | |||
| @@ -161,7 +161,7 @@ static void ctxdbg(BN_CTX *ctx) | |||
| 161 | fprintf(stderr,"(%08x): ", (unsigned int)ctx); | 161 | fprintf(stderr,"(%08x): ", (unsigned int)ctx); |
| 162 | while(bnidx < ctx->used) | 162 | while(bnidx < ctx->used) |
| 163 | { | 163 | { |
| 164 | fprintf(stderr,"%02x ", item->vals[bnidx++ % BN_CTX_POOL_SIZE].dmax); | 164 | fprintf(stderr,"%03x ", item->vals[bnidx++ % BN_CTX_POOL_SIZE].dmax); |
| 165 | if(!(bnidx % BN_CTX_POOL_SIZE)) | 165 | if(!(bnidx % BN_CTX_POOL_SIZE)) |
| 166 | item = item->next; | 166 | item = item->next; |
| 167 | } | 167 | } |
| @@ -171,8 +171,8 @@ static void ctxdbg(BN_CTX *ctx) | |||
| 171 | while(fpidx < stack->depth) | 171 | while(fpidx < stack->depth) |
| 172 | { | 172 | { |
| 173 | while(bnidx++ < stack->indexes[fpidx]) | 173 | while(bnidx++ < stack->indexes[fpidx]) |
| 174 | fprintf(stderr," "); | 174 | fprintf(stderr," "); |
| 175 | fprintf(stderr,"^^ "); | 175 | fprintf(stderr,"^^^ "); |
| 176 | bnidx++; | 176 | bnidx++; |
| 177 | fpidx++; | 177 | fpidx++; |
| 178 | } | 178 | } |
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c index d6ddc9cbe3..802a43d642 100644 --- a/src/lib/libcrypto/bn/bn_div.c +++ b/src/lib/libcrypto/bn/bn_div.c | |||
| @@ -229,7 +229,8 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, | |||
| 229 | if (dv == NULL) | 229 | if (dv == NULL) |
| 230 | res=BN_CTX_get(ctx); | 230 | res=BN_CTX_get(ctx); |
| 231 | else res=dv; | 231 | else res=dv; |
| 232 | if (sdiv == NULL || res == NULL) goto err; | 232 | if (sdiv == NULL || res == NULL || tmp == NULL || snum == NULL) |
| 233 | goto err; | ||
| 233 | 234 | ||
| 234 | /* First we normalise the numbers */ | 235 | /* First we normalise the numbers */ |
| 235 | norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); | 236 | norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); |
| @@ -336,7 +337,7 @@ X) -> 0x%08X\n", | |||
| 336 | t2 -= d1; | 337 | t2 -= d1; |
| 337 | } | 338 | } |
| 338 | #else /* !BN_LLONG */ | 339 | #else /* !BN_LLONG */ |
| 339 | BN_ULONG t2l,t2h,ql,qh; | 340 | BN_ULONG t2l,t2h; |
| 340 | 341 | ||
| 341 | q=bn_div_words(n0,n1,d0); | 342 | q=bn_div_words(n0,n1,d0); |
| 342 | #ifdef BN_DEBUG_LEVITTE | 343 | #ifdef BN_DEBUG_LEVITTE |
| @@ -354,9 +355,12 @@ X) -> 0x%08X\n", | |||
| 354 | t2l = d1 * q; | 355 | t2l = d1 * q; |
| 355 | t2h = BN_UMULT_HIGH(d1,q); | 356 | t2h = BN_UMULT_HIGH(d1,q); |
| 356 | #else | 357 | #else |
| 358 | { | ||
| 359 | BN_ULONG ql, qh; | ||
| 357 | t2l=LBITS(d1); t2h=HBITS(d1); | 360 | t2l=LBITS(d1); t2h=HBITS(d1); |
| 358 | ql =LBITS(q); qh =HBITS(q); | 361 | ql =LBITS(q); qh =HBITS(q); |
| 359 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ | 362 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ |
| 363 | } | ||
| 360 | #endif | 364 | #endif |
| 361 | 365 | ||
| 362 | for (;;) | 366 | for (;;) |
| @@ -560,7 +564,7 @@ X) -> 0x%08X\n", | |||
| 560 | t2 -= d1; | 564 | t2 -= d1; |
| 561 | } | 565 | } |
| 562 | #else /* !BN_LLONG */ | 566 | #else /* !BN_LLONG */ |
| 563 | BN_ULONG t2l,t2h,ql,qh; | 567 | BN_ULONG t2l,t2h; |
| 564 | 568 | ||
| 565 | q=bn_div_words(n0,n1,d0); | 569 | q=bn_div_words(n0,n1,d0); |
| 566 | #ifdef BN_DEBUG_LEVITTE | 570 | #ifdef BN_DEBUG_LEVITTE |
| @@ -578,9 +582,12 @@ X) -> 0x%08X\n", | |||
| 578 | t2l = d1 * q; | 582 | t2l = d1 * q; |
| 579 | t2h = BN_UMULT_HIGH(d1,q); | 583 | t2h = BN_UMULT_HIGH(d1,q); |
| 580 | #else | 584 | #else |
| 585 | { | ||
| 586 | BN_ULONG ql, qh; | ||
| 581 | t2l=LBITS(d1); t2h=HBITS(d1); | 587 | t2l=LBITS(d1); t2h=HBITS(d1); |
| 582 | ql =LBITS(q); qh =HBITS(q); | 588 | ql =LBITS(q); qh =HBITS(q); |
| 583 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ | 589 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ |
| 590 | } | ||
| 584 | #endif | 591 | #endif |
| 585 | 592 | ||
| 586 | for (;;) | 593 | for (;;) |
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c index 70a33f0d93..d9b6c737fc 100644 --- a/src/lib/libcrypto/bn/bn_exp.c +++ b/src/lib/libcrypto/bn/bn_exp.c | |||
| @@ -134,7 +134,8 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 134 | rr = BN_CTX_get(ctx); | 134 | rr = BN_CTX_get(ctx); |
| 135 | else | 135 | else |
| 136 | rr = r; | 136 | rr = r; |
| 137 | if ((v = BN_CTX_get(ctx)) == NULL) goto err; | 137 | v = BN_CTX_get(ctx); |
| 138 | if (rr == NULL || v == NULL) goto err; | ||
| 138 | 139 | ||
| 139 | if (BN_copy(v,a) == NULL) goto err; | 140 | if (BN_copy(v,a) == NULL) goto err; |
| 140 | bits=BN_num_bits(p); | 141 | bits=BN_num_bits(p); |
diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c index ae642ccb39..527b0fa15b 100644 --- a/src/lib/libcrypto/bn/bn_gf2m.c +++ b/src/lib/libcrypto/bn/bn_gf2m.c | |||
| @@ -121,74 +121,12 @@ static const BN_ULONG SQR_tb[16] = | |||
| 121 | SQR_tb[(w) >> 12 & 0xF] << 24 | SQR_tb[(w) >> 8 & 0xF] << 16 | \ | 121 | SQR_tb[(w) >> 12 & 0xF] << 24 | SQR_tb[(w) >> 8 & 0xF] << 16 | \ |
| 122 | SQR_tb[(w) >> 4 & 0xF] << 8 | SQR_tb[(w) & 0xF] | 122 | SQR_tb[(w) >> 4 & 0xF] << 8 | SQR_tb[(w) & 0xF] |
| 123 | #endif | 123 | #endif |
| 124 | #ifdef SIXTEEN_BIT | ||
| 125 | #define SQR1(w) \ | ||
| 126 | SQR_tb[(w) >> 12 & 0xF] << 8 | SQR_tb[(w) >> 8 & 0xF] | ||
| 127 | #define SQR0(w) \ | ||
| 128 | SQR_tb[(w) >> 4 & 0xF] << 8 | SQR_tb[(w) & 0xF] | ||
| 129 | #endif | ||
| 130 | #ifdef EIGHT_BIT | ||
| 131 | #define SQR1(w) \ | ||
| 132 | SQR_tb[(w) >> 4 & 0xF] | ||
| 133 | #define SQR0(w) \ | ||
| 134 | SQR_tb[(w) & 15] | ||
| 135 | #endif | ||
| 136 | 124 | ||
| 137 | /* Product of two polynomials a, b each with degree < BN_BITS2 - 1, | 125 | /* Product of two polynomials a, b each with degree < BN_BITS2 - 1, |
| 138 | * result is a polynomial r with degree < 2 * BN_BITS - 1 | 126 | * result is a polynomial r with degree < 2 * BN_BITS - 1 |
| 139 | * The caller MUST ensure that the variables have the right amount | 127 | * The caller MUST ensure that the variables have the right amount |
| 140 | * of space allocated. | 128 | * of space allocated. |
| 141 | */ | 129 | */ |
| 142 | #ifdef EIGHT_BIT | ||
| 143 | static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, const BN_ULONG b) | ||
| 144 | { | ||
| 145 | register BN_ULONG h, l, s; | ||
| 146 | BN_ULONG tab[4], top1b = a >> 7; | ||
| 147 | register BN_ULONG a1, a2; | ||
| 148 | |||
| 149 | a1 = a & (0x7F); a2 = a1 << 1; | ||
| 150 | |||
| 151 | tab[0] = 0; tab[1] = a1; tab[2] = a2; tab[3] = a1^a2; | ||
| 152 | |||
| 153 | s = tab[b & 0x3]; l = s; | ||
| 154 | s = tab[b >> 2 & 0x3]; l ^= s << 2; h = s >> 6; | ||
| 155 | s = tab[b >> 4 & 0x3]; l ^= s << 4; h ^= s >> 4; | ||
| 156 | s = tab[b >> 6 ]; l ^= s << 6; h ^= s >> 2; | ||
| 157 | |||
| 158 | /* compensate for the top bit of a */ | ||
| 159 | |||
| 160 | if (top1b & 01) { l ^= b << 7; h ^= b >> 1; } | ||
| 161 | |||
| 162 | *r1 = h; *r0 = l; | ||
| 163 | } | ||
| 164 | #endif | ||
| 165 | #ifdef SIXTEEN_BIT | ||
| 166 | static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, const BN_ULONG b) | ||
| 167 | { | ||
| 168 | register BN_ULONG h, l, s; | ||
| 169 | BN_ULONG tab[4], top1b = a >> 15; | ||
| 170 | register BN_ULONG a1, a2; | ||
| 171 | |||
| 172 | a1 = a & (0x7FFF); a2 = a1 << 1; | ||
| 173 | |||
| 174 | tab[0] = 0; tab[1] = a1; tab[2] = a2; tab[3] = a1^a2; | ||
| 175 | |||
| 176 | s = tab[b & 0x3]; l = s; | ||
| 177 | s = tab[b >> 2 & 0x3]; l ^= s << 2; h = s >> 14; | ||
| 178 | s = tab[b >> 4 & 0x3]; l ^= s << 4; h ^= s >> 12; | ||
| 179 | s = tab[b >> 6 & 0x3]; l ^= s << 6; h ^= s >> 10; | ||
| 180 | s = tab[b >> 8 & 0x3]; l ^= s << 8; h ^= s >> 8; | ||
| 181 | s = tab[b >>10 & 0x3]; l ^= s << 10; h ^= s >> 6; | ||
| 182 | s = tab[b >>12 & 0x3]; l ^= s << 12; h ^= s >> 4; | ||
| 183 | s = tab[b >>14 ]; l ^= s << 14; h ^= s >> 2; | ||
| 184 | |||
| 185 | /* compensate for the top bit of a */ | ||
| 186 | |||
| 187 | if (top1b & 01) { l ^= b << 15; h ^= b >> 1; } | ||
| 188 | |||
| 189 | *r1 = h; *r0 = l; | ||
| 190 | } | ||
| 191 | #endif | ||
| 192 | #ifdef THIRTY_TWO_BIT | 130 | #ifdef THIRTY_TWO_BIT |
| 193 | static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, const BN_ULONG b) | 131 | static void bn_GF2m_mul_1x1(BN_ULONG *r1, BN_ULONG *r0, const BN_ULONG a, const BN_ULONG b) |
| 194 | { | 132 | { |
| @@ -321,7 +259,7 @@ int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) | |||
| 321 | 259 | ||
| 322 | 260 | ||
| 323 | /* Performs modular reduction of a and store result in r. r could be a. */ | 261 | /* Performs modular reduction of a and store result in r. r could be a. */ |
| 324 | int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]) | 262 | int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]) |
| 325 | { | 263 | { |
| 326 | int j, k; | 264 | int j, k; |
| 327 | int n, dN, d0, d1; | 265 | int n, dN, d0, d1; |
| @@ -422,11 +360,11 @@ int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]) | |||
| 422 | int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p) | 360 | int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p) |
| 423 | { | 361 | { |
| 424 | int ret = 0; | 362 | int ret = 0; |
| 425 | const int max = BN_num_bits(p); | 363 | const int max = BN_num_bits(p) + 1; |
| 426 | unsigned int *arr=NULL; | 364 | int *arr=NULL; |
| 427 | bn_check_top(a); | 365 | bn_check_top(a); |
| 428 | bn_check_top(p); | 366 | bn_check_top(p); |
| 429 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; | 367 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; |
| 430 | ret = BN_GF2m_poly2arr(p, arr, max); | 368 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 431 | if (!ret || ret > max) | 369 | if (!ret || ret > max) |
| 432 | { | 370 | { |
| @@ -444,7 +382,7 @@ err: | |||
| 444 | /* Compute the product of two polynomials a and b, reduce modulo p, and store | 382 | /* Compute the product of two polynomials a and b, reduce modulo p, and store |
| 445 | * the result in r. r could be a or b; a could be b. | 383 | * the result in r. r could be a or b; a could be b. |
| 446 | */ | 384 | */ |
| 447 | int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const unsigned int p[], BN_CTX *ctx) | 385 | int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx) |
| 448 | { | 386 | { |
| 449 | int zlen, i, j, k, ret = 0; | 387 | int zlen, i, j, k, ret = 0; |
| 450 | BIGNUM *s; | 388 | BIGNUM *s; |
| @@ -500,12 +438,12 @@ err: | |||
| 500 | int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx) | 438 | int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx) |
| 501 | { | 439 | { |
| 502 | int ret = 0; | 440 | int ret = 0; |
| 503 | const int max = BN_num_bits(p); | 441 | const int max = BN_num_bits(p) + 1; |
| 504 | unsigned int *arr=NULL; | 442 | int *arr=NULL; |
| 505 | bn_check_top(a); | 443 | bn_check_top(a); |
| 506 | bn_check_top(b); | 444 | bn_check_top(b); |
| 507 | bn_check_top(p); | 445 | bn_check_top(p); |
| 508 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; | 446 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; |
| 509 | ret = BN_GF2m_poly2arr(p, arr, max); | 447 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 510 | if (!ret || ret > max) | 448 | if (!ret || ret > max) |
| 511 | { | 449 | { |
| @@ -521,7 +459,7 @@ err: | |||
| 521 | 459 | ||
| 522 | 460 | ||
| 523 | /* Square a, reduce the result mod p, and store it in a. r could be a. */ | 461 | /* Square a, reduce the result mod p, and store it in a. r could be a. */ |
| 524 | int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], BN_CTX *ctx) | 462 | int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx) |
| 525 | { | 463 | { |
| 526 | int i, ret = 0; | 464 | int i, ret = 0; |
| 527 | BIGNUM *s; | 465 | BIGNUM *s; |
| @@ -556,12 +494,12 @@ err: | |||
| 556 | int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | 494 | int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) |
| 557 | { | 495 | { |
| 558 | int ret = 0; | 496 | int ret = 0; |
| 559 | const int max = BN_num_bits(p); | 497 | const int max = BN_num_bits(p) + 1; |
| 560 | unsigned int *arr=NULL; | 498 | int *arr=NULL; |
| 561 | 499 | ||
| 562 | bn_check_top(a); | 500 | bn_check_top(a); |
| 563 | bn_check_top(p); | 501 | bn_check_top(p); |
| 564 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; | 502 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; |
| 565 | ret = BN_GF2m_poly2arr(p, arr, max); | 503 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 566 | if (!ret || ret > max) | 504 | if (!ret || ret > max) |
| 567 | { | 505 | { |
| @@ -643,7 +581,7 @@ err: | |||
| 643 | * function is only provided for convenience; for best performance, use the | 581 | * function is only provided for convenience; for best performance, use the |
| 644 | * BN_GF2m_mod_inv function. | 582 | * BN_GF2m_mod_inv function. |
| 645 | */ | 583 | */ |
| 646 | int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const unsigned int p[], BN_CTX *ctx) | 584 | int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const int p[], BN_CTX *ctx) |
| 647 | { | 585 | { |
| 648 | BIGNUM *field; | 586 | BIGNUM *field; |
| 649 | int ret = 0; | 587 | int ret = 0; |
| @@ -769,7 +707,7 @@ err: | |||
| 769 | * function is only provided for convenience; for best performance, use the | 707 | * function is only provided for convenience; for best performance, use the |
| 770 | * BN_GF2m_mod_div function. | 708 | * BN_GF2m_mod_div function. |
| 771 | */ | 709 | */ |
| 772 | int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *yy, const BIGNUM *xx, const unsigned int p[], BN_CTX *ctx) | 710 | int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *yy, const BIGNUM *xx, const int p[], BN_CTX *ctx) |
| 773 | { | 711 | { |
| 774 | BIGNUM *field; | 712 | BIGNUM *field; |
| 775 | int ret = 0; | 713 | int ret = 0; |
| @@ -794,7 +732,7 @@ err: | |||
| 794 | * the result in r. r could be a. | 732 | * the result in r. r could be a. |
| 795 | * Uses simple square-and-multiply algorithm A.5.1 from IEEE P1363. | 733 | * Uses simple square-and-multiply algorithm A.5.1 from IEEE P1363. |
| 796 | */ | 734 | */ |
| 797 | int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const unsigned int p[], BN_CTX *ctx) | 735 | int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx) |
| 798 | { | 736 | { |
| 799 | int ret = 0, i, n; | 737 | int ret = 0, i, n; |
| 800 | BIGNUM *u; | 738 | BIGNUM *u; |
| @@ -840,12 +778,12 @@ err: | |||
| 840 | int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx) | 778 | int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx) |
| 841 | { | 779 | { |
| 842 | int ret = 0; | 780 | int ret = 0; |
| 843 | const int max = BN_num_bits(p); | 781 | const int max = BN_num_bits(p) + 1; |
| 844 | unsigned int *arr=NULL; | 782 | int *arr=NULL; |
| 845 | bn_check_top(a); | 783 | bn_check_top(a); |
| 846 | bn_check_top(b); | 784 | bn_check_top(b); |
| 847 | bn_check_top(p); | 785 | bn_check_top(p); |
| 848 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; | 786 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; |
| 849 | ret = BN_GF2m_poly2arr(p, arr, max); | 787 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 850 | if (!ret || ret > max) | 788 | if (!ret || ret > max) |
| 851 | { | 789 | { |
| @@ -863,7 +801,7 @@ err: | |||
| 863 | * the result in r. r could be a. | 801 | * the result in r. r could be a. |
| 864 | * Uses exponentiation as in algorithm A.4.1 from IEEE P1363. | 802 | * Uses exponentiation as in algorithm A.4.1 from IEEE P1363. |
| 865 | */ | 803 | */ |
| 866 | int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], BN_CTX *ctx) | 804 | int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx) |
| 867 | { | 805 | { |
| 868 | int ret = 0; | 806 | int ret = 0; |
| 869 | BIGNUM *u; | 807 | BIGNUM *u; |
| @@ -899,11 +837,11 @@ err: | |||
| 899 | int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | 837 | int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) |
| 900 | { | 838 | { |
| 901 | int ret = 0; | 839 | int ret = 0; |
| 902 | const int max = BN_num_bits(p); | 840 | const int max = BN_num_bits(p) + 1; |
| 903 | unsigned int *arr=NULL; | 841 | int *arr=NULL; |
| 904 | bn_check_top(a); | 842 | bn_check_top(a); |
| 905 | bn_check_top(p); | 843 | bn_check_top(p); |
| 906 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; | 844 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err; |
| 907 | ret = BN_GF2m_poly2arr(p, arr, max); | 845 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 908 | if (!ret || ret > max) | 846 | if (!ret || ret > max) |
| 909 | { | 847 | { |
| @@ -920,10 +858,9 @@ err: | |||
| 920 | /* Find r such that r^2 + r = a mod p. r could be a. If no r exists returns 0. | 858 | /* Find r such that r^2 + r = a mod p. r could be a. If no r exists returns 0. |
| 921 | * Uses algorithms A.4.7 and A.4.6 from IEEE P1363. | 859 | * Uses algorithms A.4.7 and A.4.6 from IEEE P1363. |
| 922 | */ | 860 | */ |
| 923 | int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const unsigned int p[], BN_CTX *ctx) | 861 | int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], BN_CTX *ctx) |
| 924 | { | 862 | { |
| 925 | int ret = 0, count = 0; | 863 | int ret = 0, count = 0, j; |
| 926 | unsigned int j; | ||
| 927 | BIGNUM *a, *z, *rho, *w, *w2, *tmp; | 864 | BIGNUM *a, *z, *rho, *w, *w2, *tmp; |
| 928 | 865 | ||
| 929 | bn_check_top(a_); | 866 | bn_check_top(a_); |
| @@ -1018,11 +955,11 @@ err: | |||
| 1018 | int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | 955 | int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) |
| 1019 | { | 956 | { |
| 1020 | int ret = 0; | 957 | int ret = 0; |
| 1021 | const int max = BN_num_bits(p); | 958 | const int max = BN_num_bits(p) + 1; |
| 1022 | unsigned int *arr=NULL; | 959 | int *arr=NULL; |
| 1023 | bn_check_top(a); | 960 | bn_check_top(a); |
| 1024 | bn_check_top(p); | 961 | bn_check_top(p); |
| 1025 | if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * | 962 | if ((arr = (int *)OPENSSL_malloc(sizeof(int) * |
| 1026 | max)) == NULL) goto err; | 963 | max)) == NULL) goto err; |
| 1027 | ret = BN_GF2m_poly2arr(p, arr, max); | 964 | ret = BN_GF2m_poly2arr(p, arr, max); |
| 1028 | if (!ret || ret > max) | 965 | if (!ret || ret > max) |
| @@ -1038,20 +975,17 @@ err: | |||
| 1038 | } | 975 | } |
| 1039 | 976 | ||
| 1040 | /* Convert the bit-string representation of a polynomial | 977 | /* Convert the bit-string representation of a polynomial |
| 1041 | * ( \sum_{i=0}^n a_i * x^i , where a_0 is *not* zero) into an array | 978 | * ( \sum_{i=0}^n a_i * x^i) into an array of integers corresponding |
| 1042 | * of integers corresponding to the bits with non-zero coefficient. | 979 | * to the bits with non-zero coefficient. Array is terminated with -1. |
| 1043 | * Up to max elements of the array will be filled. Return value is total | 980 | * Up to max elements of the array will be filled. Return value is total |
| 1044 | * number of coefficients that would be extracted if array was large enough. | 981 | * number of array elements that would be filled if array was large enough. |
| 1045 | */ | 982 | */ |
| 1046 | int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max) | 983 | int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max) |
| 1047 | { | 984 | { |
| 1048 | int i, j, k = 0; | 985 | int i, j, k = 0; |
| 1049 | BN_ULONG mask; | 986 | BN_ULONG mask; |
| 1050 | 987 | ||
| 1051 | if (BN_is_zero(a) || !BN_is_bit_set(a, 0)) | 988 | if (BN_is_zero(a)) |
| 1052 | /* a_0 == 0 => return error (the unsigned int array | ||
| 1053 | * must be terminated by 0) | ||
| 1054 | */ | ||
| 1055 | return 0; | 989 | return 0; |
| 1056 | 990 | ||
| 1057 | for (i = a->top - 1; i >= 0; i--) | 991 | for (i = a->top - 1; i >= 0; i--) |
| @@ -1071,24 +1005,28 @@ int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max) | |||
| 1071 | } | 1005 | } |
| 1072 | } | 1006 | } |
| 1073 | 1007 | ||
| 1008 | if (k < max) { | ||
| 1009 | p[k] = -1; | ||
| 1010 | k++; | ||
| 1011 | } | ||
| 1012 | |||
| 1074 | return k; | 1013 | return k; |
| 1075 | } | 1014 | } |
| 1076 | 1015 | ||
| 1077 | /* Convert the coefficient array representation of a polynomial to a | 1016 | /* Convert the coefficient array representation of a polynomial to a |
| 1078 | * bit-string. The array must be terminated by 0. | 1017 | * bit-string. The array must be terminated by -1. |
| 1079 | */ | 1018 | */ |
| 1080 | int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a) | 1019 | int BN_GF2m_arr2poly(const int p[], BIGNUM *a) |
| 1081 | { | 1020 | { |
| 1082 | int i; | 1021 | int i; |
| 1083 | 1022 | ||
| 1084 | bn_check_top(a); | 1023 | bn_check_top(a); |
| 1085 | BN_zero(a); | 1024 | BN_zero(a); |
| 1086 | for (i = 0; p[i] != 0; i++) | 1025 | for (i = 0; p[i] != -1; i++) |
| 1087 | { | 1026 | { |
| 1088 | if (BN_set_bit(a, p[i]) == 0) | 1027 | if (BN_set_bit(a, p[i]) == 0) |
| 1089 | return 0; | 1028 | return 0; |
| 1090 | } | 1029 | } |
| 1091 | BN_set_bit(a, 0); | ||
| 1092 | bn_check_top(a); | 1030 | bn_check_top(a); |
| 1093 | 1031 | ||
| 1094 | return 1; | 1032 | return 1; |
diff --git a/src/lib/libcrypto/bn/bn_lcl.h b/src/lib/libcrypto/bn/bn_lcl.h index 27ac4397a1..8e5e98e3f2 100644 --- a/src/lib/libcrypto/bn/bn_lcl.h +++ b/src/lib/libcrypto/bn/bn_lcl.h | |||
| @@ -255,7 +255,8 @@ extern "C" { | |||
| 255 | : "r"(a), "r"(b)); \ | 255 | : "r"(a), "r"(b)); \ |
| 256 | ret; }) | 256 | ret; }) |
| 257 | # endif /* compiler */ | 257 | # endif /* compiler */ |
| 258 | # elif defined(__x86_64) && defined(SIXTY_FOUR_BIT_LONG) | 258 | # elif (defined(__x86_64) || defined(__x86_64__)) && \ |
| 259 | (defined(SIXTY_FOUR_BIT_LONG) || defined(SIXTY_FOUR_BIT)) | ||
| 259 | # if defined(__GNUC__) | 260 | # if defined(__GNUC__) |
| 260 | # define BN_UMULT_HIGH(a,b) ({ \ | 261 | # define BN_UMULT_HIGH(a,b) ({ \ |
| 261 | register BN_ULONG ret,discard; \ | 262 | register BN_ULONG ret,discard; \ |
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 32a8fbaf51..5470fbe6ef 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -133,15 +133,34 @@ int BN_get_params(int which) | |||
| 133 | 133 | ||
| 134 | const BIGNUM *BN_value_one(void) | 134 | const BIGNUM *BN_value_one(void) |
| 135 | { | 135 | { |
| 136 | static BN_ULONG data_one=1L; | 136 | static const BN_ULONG data_one=1L; |
| 137 | static BIGNUM const_one={&data_one,1,1,0,BN_FLG_STATIC_DATA}; | 137 | static const BIGNUM const_one={(BN_ULONG *)&data_one,1,1,0,BN_FLG_STATIC_DATA}; |
| 138 | 138 | ||
| 139 | return(&const_one); | 139 | return(&const_one); |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | char *BN_options(void) | ||
| 143 | { | ||
| 144 | static int init=0; | ||
| 145 | static char data[16]; | ||
| 146 | |||
| 147 | if (!init) | ||
| 148 | { | ||
| 149 | init++; | ||
| 150 | #ifdef BN_LLONG | ||
| 151 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
| 152 | (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8); | ||
| 153 | #else | ||
| 154 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
| 155 | (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8); | ||
| 156 | #endif | ||
| 157 | } | ||
| 158 | return(data); | ||
| 159 | } | ||
| 160 | |||
| 142 | int BN_num_bits_word(BN_ULONG l) | 161 | int BN_num_bits_word(BN_ULONG l) |
| 143 | { | 162 | { |
| 144 | static const char bits[256]={ | 163 | static const unsigned char bits[256]={ |
| 145 | 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, | 164 | 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, |
| 146 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | 165 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, |
| 147 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | 166 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, |
| @@ -216,7 +235,7 @@ int BN_num_bits_word(BN_ULONG l) | |||
| 216 | else | 235 | else |
| 217 | #endif | 236 | #endif |
| 218 | { | 237 | { |
| 219 | #if defined(SIXTEEN_BIT) || defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) | 238 | #if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) |
| 220 | if (l & 0xff00L) | 239 | if (l & 0xff00L) |
| 221 | return(bits[(int)(l>>8)]+8); | 240 | return(bits[(int)(l>>8)]+8); |
| 222 | else | 241 | else |
| @@ -744,7 +763,7 @@ int BN_is_bit_set(const BIGNUM *a, int n) | |||
| 744 | i=n/BN_BITS2; | 763 | i=n/BN_BITS2; |
| 745 | j=n%BN_BITS2; | 764 | j=n%BN_BITS2; |
| 746 | if (a->top <= i) return 0; | 765 | if (a->top <= i) return 0; |
| 747 | return(((a->d[i])>>j)&((BN_ULONG)1)); | 766 | return (int)(((a->d[i])>>j)&((BN_ULONG)1)); |
| 748 | } | 767 | } |
| 749 | 768 | ||
| 750 | int BN_mask_bits(BIGNUM *a, int n) | 769 | int BN_mask_bits(BIGNUM *a, int n) |
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index 4799b152dd..7224637ab3 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c | |||
| @@ -122,26 +122,10 @@ | |||
| 122 | 122 | ||
| 123 | #define MONT_WORD /* use the faster word-based algorithm */ | 123 | #define MONT_WORD /* use the faster word-based algorithm */ |
| 124 | 124 | ||
| 125 | #if defined(MONT_WORD) && defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32) | 125 | #ifdef MONT_WORD |
| 126 | /* This condition means we have a specific non-default build: | ||
| 127 | * In the 0.9.8 branch, OPENSSL_BN_ASM_MONT is normally not set for any | ||
| 128 | * BN_BITS2<=32 platform; an explicit "enable-montasm" is required. | ||
| 129 | * I.e., if we are here, the user intentionally deviates from the | ||
| 130 | * normal stable build to get better Montgomery performance from | ||
| 131 | * the 0.9.9-dev backport. | ||
| 132 | * | ||
| 133 | * In this case only, we also enable BN_from_montgomery_word() | ||
| 134 | * (another non-stable feature from 0.9.9-dev). | ||
| 135 | */ | ||
| 136 | #define MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD | ||
| 137 | #endif | ||
| 138 | |||
| 139 | #ifdef MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD | ||
| 140 | static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont); | 126 | static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont); |
| 141 | #endif | 127 | #endif |
| 142 | 128 | ||
| 143 | |||
| 144 | |||
| 145 | int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | 129 | int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, |
| 146 | BN_MONT_CTX *mont, BN_CTX *ctx) | 130 | BN_MONT_CTX *mont, BN_CTX *ctx) |
| 147 | { | 131 | { |
| @@ -153,11 +137,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | |||
| 153 | if (num>1 && a->top==num && b->top==num) | 137 | if (num>1 && a->top==num && b->top==num) |
| 154 | { | 138 | { |
| 155 | if (bn_wexpand(r,num) == NULL) return(0); | 139 | if (bn_wexpand(r,num) == NULL) return(0); |
| 156 | #if 0 /* for OpenSSL 0.9.9 mont->n0 */ | ||
| 157 | if (bn_mul_mont(r->d,a->d,b->d,mont->N.d,mont->n0,num)) | 140 | if (bn_mul_mont(r->d,a->d,b->d,mont->N.d,mont->n0,num)) |
| 158 | #else | ||
| 159 | if (bn_mul_mont(r->d,a->d,b->d,mont->N.d,&mont->n0,num)) | ||
| 160 | #endif | ||
| 161 | { | 141 | { |
| 162 | r->neg = a->neg^b->neg; | 142 | r->neg = a->neg^b->neg; |
| 163 | r->top = num; | 143 | r->top = num; |
| @@ -181,7 +161,7 @@ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, | |||
| 181 | if (!BN_mul(tmp,a,b,ctx)) goto err; | 161 | if (!BN_mul(tmp,a,b,ctx)) goto err; |
| 182 | } | 162 | } |
| 183 | /* reduce from aRR to aR */ | 163 | /* reduce from aRR to aR */ |
| 184 | #ifdef MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD | 164 | #ifdef MONT_WORD |
| 185 | if (!BN_from_montgomery_word(r,tmp,mont)) goto err; | 165 | if (!BN_from_montgomery_word(r,tmp,mont)) goto err; |
| 186 | #else | 166 | #else |
| 187 | if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err; | 167 | if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err; |
| @@ -193,7 +173,7 @@ err: | |||
| 193 | return(ret); | 173 | return(ret); |
| 194 | } | 174 | } |
| 195 | 175 | ||
| 196 | #ifdef MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD | 176 | #ifdef MONT_WORD |
| 197 | static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) | 177 | static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) |
| 198 | { | 178 | { |
| 199 | BIGNUM *n; | 179 | BIGNUM *n; |
| @@ -217,15 +197,15 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) | |||
| 217 | nrp= &(r->d[nl]); | 197 | nrp= &(r->d[nl]); |
| 218 | 198 | ||
| 219 | /* clear the top words of T */ | 199 | /* clear the top words of T */ |
| 200 | #if 1 | ||
| 220 | for (i=r->top; i<max; i++) /* memset? XXX */ | 201 | for (i=r->top; i<max; i++) /* memset? XXX */ |
| 221 | r->d[i]=0; | 202 | r->d[i]=0; |
| 203 | #else | ||
| 204 | memset(&(r->d[r->top]),0,(max-r->top)*sizeof(BN_ULONG)); | ||
| 205 | #endif | ||
| 222 | 206 | ||
| 223 | r->top=max; | 207 | r->top=max; |
| 224 | #if 0 /* for OpenSSL 0.9.9 mont->n0 */ | ||
| 225 | n0=mont->n0[0]; | 208 | n0=mont->n0[0]; |
| 226 | #else | ||
| 227 | n0=mont->n0; | ||
| 228 | #endif | ||
| 229 | 209 | ||
| 230 | #ifdef BN_COUNT | 210 | #ifdef BN_COUNT |
| 231 | fprintf(stderr,"word BN_from_montgomery_word %d * %d\n",nl,nl); | 211 | fprintf(stderr,"word BN_from_montgomery_word %d * %d\n",nl,nl); |
| @@ -270,6 +250,8 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) | |||
| 270 | } | 250 | } |
| 271 | al=r->top-ri; | 251 | al=r->top-ri; |
| 272 | 252 | ||
| 253 | #define BRANCH_FREE 1 | ||
| 254 | #if BRANCH_FREE | ||
| 273 | if (bn_wexpand(ret,ri) == NULL) return(0); | 255 | if (bn_wexpand(ret,ri) == NULL) return(0); |
| 274 | x=0-(((al-ri)>>(sizeof(al)*8-1))&1); | 256 | x=0-(((al-ri)>>(sizeof(al)*8-1))&1); |
| 275 | ret->top=x=(ri&~x)|(al&x); /* min(ri,al) */ | 257 | ret->top=x=(ri&~x)|(al&x); /* min(ri,al) */ |
| @@ -317,164 +299,8 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) | |||
| 317 | rp[i]=nrp[i], ap[i]=0; | 299 | rp[i]=nrp[i], ap[i]=0; |
| 318 | bn_correct_top(r); | 300 | bn_correct_top(r); |
| 319 | bn_correct_top(ret); | 301 | bn_correct_top(ret); |
| 320 | bn_check_top(ret); | ||
| 321 | |||
| 322 | return(1); | ||
| 323 | } | ||
| 324 | |||
| 325 | int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | ||
| 326 | BN_CTX *ctx) | ||
| 327 | { | ||
| 328 | int retn=0; | ||
| 329 | BIGNUM *t; | ||
| 330 | |||
| 331 | BN_CTX_start(ctx); | ||
| 332 | if ((t = BN_CTX_get(ctx)) && BN_copy(t,a)) | ||
| 333 | retn = BN_from_montgomery_word(ret,t,mont); | ||
| 334 | BN_CTX_end(ctx); | ||
| 335 | return retn; | ||
| 336 | } | ||
| 337 | |||
| 338 | #else /* !MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD */ | ||
| 339 | |||
| 340 | int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | ||
| 341 | BN_CTX *ctx) | ||
| 342 | { | ||
| 343 | int retn=0; | ||
| 344 | |||
| 345 | #ifdef MONT_WORD | ||
| 346 | BIGNUM *n,*r; | ||
| 347 | BN_ULONG *ap,*np,*rp,n0,v,*nrp; | ||
| 348 | int al,nl,max,i,x,ri; | ||
| 349 | |||
| 350 | BN_CTX_start(ctx); | ||
| 351 | if ((r = BN_CTX_get(ctx)) == NULL) goto err; | ||
| 352 | |||
| 353 | if (!BN_copy(r,a)) goto err; | ||
| 354 | n= &(mont->N); | ||
| 355 | |||
| 356 | ap=a->d; | ||
| 357 | /* mont->ri is the size of mont->N in bits (rounded up | ||
| 358 | to the word size) */ | ||
| 359 | al=ri=mont->ri/BN_BITS2; | ||
| 360 | |||
| 361 | nl=n->top; | ||
| 362 | if ((al == 0) || (nl == 0)) { r->top=0; return(1); } | ||
| 363 | |||
| 364 | max=(nl+al+1); /* allow for overflow (no?) XXX */ | ||
| 365 | if (bn_wexpand(r,max) == NULL) goto err; | ||
| 366 | |||
| 367 | r->neg=a->neg^n->neg; | ||
| 368 | np=n->d; | ||
| 369 | rp=r->d; | ||
| 370 | nrp= &(r->d[nl]); | ||
| 371 | |||
| 372 | /* clear the top words of T */ | ||
| 373 | #if 1 | ||
| 374 | for (i=r->top; i<max; i++) /* memset? XXX */ | ||
| 375 | r->d[i]=0; | ||
| 376 | #else | 302 | #else |
| 377 | memset(&(r->d[r->top]),0,(max-r->top)*sizeof(BN_ULONG)); | 303 | if (bn_wexpand(ret,al) == NULL) return(0); |
| 378 | #endif | ||
| 379 | |||
| 380 | r->top=max; | ||
| 381 | n0=mont->n0; | ||
| 382 | |||
| 383 | #ifdef BN_COUNT | ||
| 384 | fprintf(stderr,"word BN_from_montgomery %d * %d\n",nl,nl); | ||
| 385 | #endif | ||
| 386 | for (i=0; i<nl; i++) | ||
| 387 | { | ||
| 388 | #ifdef __TANDEM | ||
| 389 | { | ||
| 390 | long long t1; | ||
| 391 | long long t2; | ||
| 392 | long long t3; | ||
| 393 | t1 = rp[0] * (n0 & 0177777); | ||
| 394 | t2 = 037777600000l; | ||
| 395 | t2 = n0 & t2; | ||
| 396 | t3 = rp[0] & 0177777; | ||
| 397 | t2 = (t3 * t2) & BN_MASK2; | ||
| 398 | t1 = t1 + t2; | ||
| 399 | v=bn_mul_add_words(rp,np,nl,(BN_ULONG) t1); | ||
| 400 | } | ||
| 401 | #else | ||
| 402 | v=bn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2); | ||
| 403 | #endif | ||
| 404 | nrp++; | ||
| 405 | rp++; | ||
| 406 | if (((nrp[-1]+=v)&BN_MASK2) >= v) | ||
| 407 | continue; | ||
| 408 | else | ||
| 409 | { | ||
| 410 | if (((++nrp[0])&BN_MASK2) != 0) continue; | ||
| 411 | if (((++nrp[1])&BN_MASK2) != 0) continue; | ||
| 412 | for (x=2; (((++nrp[x])&BN_MASK2) == 0); x++) ; | ||
| 413 | } | ||
| 414 | } | ||
| 415 | bn_correct_top(r); | ||
| 416 | |||
| 417 | /* mont->ri will be a multiple of the word size and below code | ||
| 418 | * is kind of BN_rshift(ret,r,mont->ri) equivalent */ | ||
| 419 | if (r->top <= ri) | ||
| 420 | { | ||
| 421 | ret->top=0; | ||
| 422 | retn=1; | ||
| 423 | goto err; | ||
| 424 | } | ||
| 425 | al=r->top-ri; | ||
| 426 | |||
| 427 | # define BRANCH_FREE 1 | ||
| 428 | # if BRANCH_FREE | ||
| 429 | if (bn_wexpand(ret,ri) == NULL) goto err; | ||
| 430 | x=0-(((al-ri)>>(sizeof(al)*8-1))&1); | ||
| 431 | ret->top=x=(ri&~x)|(al&x); /* min(ri,al) */ | ||
| 432 | ret->neg=r->neg; | ||
| 433 | |||
| 434 | rp=ret->d; | ||
| 435 | ap=&(r->d[ri]); | ||
| 436 | |||
| 437 | { | ||
| 438 | size_t m1,m2; | ||
| 439 | |||
| 440 | v=bn_sub_words(rp,ap,np,ri); | ||
| 441 | /* this ----------------^^ works even in al<ri case | ||
| 442 | * thanks to zealous zeroing of top of the vector in the | ||
| 443 | * beginning. */ | ||
| 444 | |||
| 445 | /* if (al==ri && !v) || al>ri) nrp=rp; else nrp=ap; */ | ||
| 446 | /* in other words if subtraction result is real, then | ||
| 447 | * trick unconditional memcpy below to perform in-place | ||
| 448 | * "refresh" instead of actual copy. */ | ||
| 449 | m1=0-(size_t)(((al-ri)>>(sizeof(al)*8-1))&1); /* al<ri */ | ||
| 450 | m2=0-(size_t)(((ri-al)>>(sizeof(al)*8-1))&1); /* al>ri */ | ||
| 451 | m1|=m2; /* (al!=ri) */ | ||
| 452 | m1|=(0-(size_t)v); /* (al!=ri || v) */ | ||
| 453 | m1&=~m2; /* (al!=ri || v) && !al>ri */ | ||
| 454 | nrp=(BN_ULONG *)(((size_t)rp&~m1)|((size_t)ap&m1)); | ||
| 455 | } | ||
| 456 | |||
| 457 | /* 'i<ri' is chosen to eliminate dependency on input data, even | ||
| 458 | * though it results in redundant copy in al<ri case. */ | ||
| 459 | for (i=0,ri-=4; i<ri; i+=4) | ||
| 460 | { | ||
| 461 | BN_ULONG t1,t2,t3,t4; | ||
| 462 | |||
| 463 | t1=nrp[i+0]; | ||
| 464 | t2=nrp[i+1]; | ||
| 465 | t3=nrp[i+2]; ap[i+0]=0; | ||
| 466 | t4=nrp[i+3]; ap[i+1]=0; | ||
| 467 | rp[i+0]=t1; ap[i+2]=0; | ||
| 468 | rp[i+1]=t2; ap[i+3]=0; | ||
| 469 | rp[i+2]=t3; | ||
| 470 | rp[i+3]=t4; | ||
| 471 | } | ||
| 472 | for (ri+=4; i<ri; i++) | ||
| 473 | rp[i]=nrp[i], ap[i]=0; | ||
| 474 | bn_correct_top(r); | ||
| 475 | bn_correct_top(ret); | ||
| 476 | # else | ||
| 477 | if (bn_wexpand(ret,al) == NULL) goto err; | ||
| 478 | ret->top=al; | 304 | ret->top=al; |
| 479 | ret->neg=r->neg; | 305 | ret->neg=r->neg; |
| 480 | 306 | ||
| @@ -497,8 +323,30 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | |||
| 497 | al+=4; | 323 | al+=4; |
| 498 | for (; i<al; i++) | 324 | for (; i<al; i++) |
| 499 | rp[i]=ap[i]; | 325 | rp[i]=ap[i]; |
| 500 | # endif | 326 | |
| 501 | #else /* !MONT_WORD */ | 327 | if (BN_ucmp(ret, &(mont->N)) >= 0) |
| 328 | { | ||
| 329 | if (!BN_usub(ret,ret,&(mont->N))) return(0); | ||
| 330 | } | ||
| 331 | #endif | ||
| 332 | bn_check_top(ret); | ||
| 333 | |||
| 334 | return(1); | ||
| 335 | } | ||
| 336 | #endif /* MONT_WORD */ | ||
| 337 | |||
| 338 | int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | ||
| 339 | BN_CTX *ctx) | ||
| 340 | { | ||
| 341 | int retn=0; | ||
| 342 | #ifdef MONT_WORD | ||
| 343 | BIGNUM *t; | ||
| 344 | |||
| 345 | BN_CTX_start(ctx); | ||
| 346 | if ((t = BN_CTX_get(ctx)) && BN_copy(t,a)) | ||
| 347 | retn = BN_from_montgomery_word(ret,t,mont); | ||
| 348 | BN_CTX_end(ctx); | ||
| 349 | #else /* !MONT_WORD */ | ||
| 502 | BIGNUM *t1,*t2; | 350 | BIGNUM *t1,*t2; |
| 503 | 351 | ||
| 504 | BN_CTX_start(ctx); | 352 | BN_CTX_start(ctx); |
| @@ -515,21 +363,18 @@ int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, | |||
| 515 | if (!BN_mul(t1,t2,&mont->N,ctx)) goto err; | 363 | if (!BN_mul(t1,t2,&mont->N,ctx)) goto err; |
| 516 | if (!BN_add(t2,a,t1)) goto err; | 364 | if (!BN_add(t2,a,t1)) goto err; |
| 517 | if (!BN_rshift(ret,t2,mont->ri)) goto err; | 365 | if (!BN_rshift(ret,t2,mont->ri)) goto err; |
| 518 | #endif /* MONT_WORD */ | ||
| 519 | 366 | ||
| 520 | #if !defined(BRANCH_FREE) || BRANCH_FREE==0 | ||
| 521 | if (BN_ucmp(ret, &(mont->N)) >= 0) | 367 | if (BN_ucmp(ret, &(mont->N)) >= 0) |
| 522 | { | 368 | { |
| 523 | if (!BN_usub(ret,ret,&(mont->N))) goto err; | 369 | if (!BN_usub(ret,ret,&(mont->N))) goto err; |
| 524 | } | 370 | } |
| 525 | #endif | ||
| 526 | retn=1; | 371 | retn=1; |
| 527 | bn_check_top(ret); | 372 | bn_check_top(ret); |
| 528 | err: | 373 | err: |
| 529 | BN_CTX_end(ctx); | 374 | BN_CTX_end(ctx); |
| 375 | #endif /* MONT_WORD */ | ||
| 530 | return(retn); | 376 | return(retn); |
| 531 | } | 377 | } |
| 532 | #endif /* MONT_FROM_WORD___NON_DEFAULT_0_9_8_BUILD */ | ||
| 533 | 378 | ||
| 534 | BN_MONT_CTX *BN_MONT_CTX_new(void) | 379 | BN_MONT_CTX *BN_MONT_CTX_new(void) |
| 535 | { | 380 | { |
| @@ -549,11 +394,7 @@ void BN_MONT_CTX_init(BN_MONT_CTX *ctx) | |||
| 549 | BN_init(&(ctx->RR)); | 394 | BN_init(&(ctx->RR)); |
| 550 | BN_init(&(ctx->N)); | 395 | BN_init(&(ctx->N)); |
| 551 | BN_init(&(ctx->Ni)); | 396 | BN_init(&(ctx->Ni)); |
| 552 | #if 0 /* for OpenSSL 0.9.9 mont->n0 */ | ||
| 553 | ctx->n0[0] = ctx->n0[1] = 0; | 397 | ctx->n0[0] = ctx->n0[1] = 0; |
| 554 | #else | ||
| 555 | ctx->n0 = 0; | ||
| 556 | #endif | ||
| 557 | ctx->flags=0; | 398 | ctx->flags=0; |
| 558 | } | 399 | } |
| 559 | 400 | ||
| @@ -585,26 +426,22 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
| 585 | BIGNUM tmod; | 426 | BIGNUM tmod; |
| 586 | BN_ULONG buf[2]; | 427 | BN_ULONG buf[2]; |
| 587 | 428 | ||
| 588 | mont->ri=(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2*BN_BITS2; | ||
| 589 | BN_zero(R); | ||
| 590 | #if 0 /* for OpenSSL 0.9.9 mont->n0, would be "#if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32)", | ||
| 591 | only certain BN_BITS2<=32 platforms actually need this */ | ||
| 592 | if (!(BN_set_bit(R,2*BN_BITS2))) goto err; /* R */ | ||
| 593 | #else | ||
| 594 | if (!(BN_set_bit(R,BN_BITS2))) goto err; /* R */ | ||
| 595 | #endif | ||
| 596 | |||
| 597 | buf[0]=mod->d[0]; /* tmod = N mod word size */ | ||
| 598 | buf[1]=0; | ||
| 599 | |||
| 600 | BN_init(&tmod); | 429 | BN_init(&tmod); |
| 601 | tmod.d=buf; | 430 | tmod.d=buf; |
| 602 | tmod.top = buf[0] != 0 ? 1 : 0; | ||
| 603 | tmod.dmax=2; | 431 | tmod.dmax=2; |
| 604 | tmod.neg=0; | 432 | tmod.neg=0; |
| 605 | 433 | ||
| 606 | #if 0 /* for OpenSSL 0.9.9 mont->n0, would be "#if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32)"; | 434 | mont->ri=(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2*BN_BITS2; |
| 607 | only certain BN_BITS2<=32 platforms actually need this */ | 435 | |
| 436 | #if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32) | ||
| 437 | /* Only certain BN_BITS2<=32 platforms actually make use of | ||
| 438 | * n0[1], and we could use the #else case (with a shorter R | ||
| 439 | * value) for the others. However, currently only the assembler | ||
| 440 | * files do know which is which. */ | ||
| 441 | |||
| 442 | BN_zero(R); | ||
| 443 | if (!(BN_set_bit(R,2*BN_BITS2))) goto err; | ||
| 444 | |||
| 608 | tmod.top=0; | 445 | tmod.top=0; |
| 609 | if ((buf[0] = mod->d[0])) tmod.top=1; | 446 | if ((buf[0] = mod->d[0])) tmod.top=1; |
| 610 | if ((buf[1] = mod->top>1 ? mod->d[1] : 0)) tmod.top=2; | 447 | if ((buf[1] = mod->top>1 ? mod->d[1] : 0)) tmod.top=2; |
| @@ -632,6 +469,12 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
| 632 | mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0; | 469 | mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0; |
| 633 | mont->n0[1] = (Ri->top > 1) ? Ri->d[1] : 0; | 470 | mont->n0[1] = (Ri->top > 1) ? Ri->d[1] : 0; |
| 634 | #else | 471 | #else |
| 472 | BN_zero(R); | ||
| 473 | if (!(BN_set_bit(R,BN_BITS2))) goto err; /* R */ | ||
| 474 | |||
| 475 | buf[0]=mod->d[0]; /* tmod = N mod word size */ | ||
| 476 | buf[1]=0; | ||
| 477 | tmod.top = buf[0] != 0 ? 1 : 0; | ||
| 635 | /* Ri = R^-1 mod N*/ | 478 | /* Ri = R^-1 mod N*/ |
| 636 | if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) | 479 | if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) |
| 637 | goto err; | 480 | goto err; |
| @@ -647,12 +490,8 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
| 647 | if (!BN_div(Ri,NULL,Ri,&tmod,ctx)) goto err; | 490 | if (!BN_div(Ri,NULL,Ri,&tmod,ctx)) goto err; |
| 648 | /* Ni = (R*Ri-1)/N, | 491 | /* Ni = (R*Ri-1)/N, |
| 649 | * keep only least significant word: */ | 492 | * keep only least significant word: */ |
| 650 | # if 0 /* for OpenSSL 0.9.9 mont->n0 */ | ||
| 651 | mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0; | 493 | mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0; |
| 652 | mont->n0[1] = 0; | 494 | mont->n0[1] = 0; |
| 653 | # else | ||
| 654 | mont->n0 = (Ri->top > 0) ? Ri->d[0] : 0; | ||
| 655 | # endif | ||
| 656 | #endif | 495 | #endif |
| 657 | } | 496 | } |
| 658 | #else /* !MONT_WORD */ | 497 | #else /* !MONT_WORD */ |
| @@ -689,12 +528,8 @@ BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from) | |||
| 689 | if (!BN_copy(&(to->N),&(from->N))) return NULL; | 528 | if (!BN_copy(&(to->N),&(from->N))) return NULL; |
| 690 | if (!BN_copy(&(to->Ni),&(from->Ni))) return NULL; | 529 | if (!BN_copy(&(to->Ni),&(from->Ni))) return NULL; |
| 691 | to->ri=from->ri; | 530 | to->ri=from->ri; |
| 692 | #if 0 /* for OpenSSL 0.9.9 mont->n0 */ | ||
| 693 | to->n0[0]=from->n0[0]; | 531 | to->n0[0]=from->n0[0]; |
| 694 | to->n0[1]=from->n0[1]; | 532 | to->n0[1]=from->n0[1]; |
| 695 | #else | ||
| 696 | to->n0=from->n0; | ||
| 697 | #endif | ||
| 698 | return(to); | 533 | return(to); |
| 699 | } | 534 | } |
| 700 | 535 | ||
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c index b848c8cc60..a0e9ec3b46 100644 --- a/src/lib/libcrypto/bn/bn_mul.c +++ b/src/lib/libcrypto/bn/bn_mul.c | |||
| @@ -1028,17 +1028,19 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | |||
| 1028 | assert(j <= al || j <= bl); | 1028 | assert(j <= al || j <= bl); |
| 1029 | k = j+j; | 1029 | k = j+j; |
| 1030 | t = BN_CTX_get(ctx); | 1030 | t = BN_CTX_get(ctx); |
| 1031 | if (t == NULL) | ||
| 1032 | goto err; | ||
| 1031 | if (al > j || bl > j) | 1033 | if (al > j || bl > j) |
| 1032 | { | 1034 | { |
| 1033 | bn_wexpand(t,k*4); | 1035 | if (bn_wexpand(t,k*4) == NULL) goto err; |
| 1034 | bn_wexpand(rr,k*4); | 1036 | if (bn_wexpand(rr,k*4) == NULL) goto err; |
| 1035 | bn_mul_part_recursive(rr->d,a->d,b->d, | 1037 | bn_mul_part_recursive(rr->d,a->d,b->d, |
| 1036 | j,al-j,bl-j,t->d); | 1038 | j,al-j,bl-j,t->d); |
| 1037 | } | 1039 | } |
| 1038 | else /* al <= j || bl <= j */ | 1040 | else /* al <= j || bl <= j */ |
| 1039 | { | 1041 | { |
| 1040 | bn_wexpand(t,k*2); | 1042 | if (bn_wexpand(t,k*2) == NULL) goto err; |
| 1041 | bn_wexpand(rr,k*2); | 1043 | if (bn_wexpand(rr,k*2) == NULL) goto err; |
| 1042 | bn_mul_recursive(rr->d,a->d,b->d, | 1044 | bn_mul_recursive(rr->d,a->d,b->d, |
| 1043 | j,al-j,bl-j,t->d); | 1045 | j,al-j,bl-j,t->d); |
| 1044 | } | 1046 | } |
diff --git a/src/lib/libcrypto/bn/bn_opt.c b/src/lib/libcrypto/bn/bn_opt.c deleted file mode 100644 index 21cbb38f62..0000000000 --- a/src/lib/libcrypto/bn/bn_opt.c +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | /* crypto/bn/bn_opt.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 | #ifndef BN_DEBUG | ||
| 60 | # undef NDEBUG /* avoid conflicting definitions */ | ||
| 61 | # define NDEBUG | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #include <assert.h> | ||
| 65 | #include <limits.h> | ||
| 66 | #include <stdio.h> | ||
| 67 | #include "cryptlib.h" | ||
| 68 | #include "bn_lcl.h" | ||
| 69 | |||
| 70 | char *BN_options(void) | ||
| 71 | { | ||
| 72 | static int init=0; | ||
| 73 | static char data[16]; | ||
| 74 | |||
| 75 | if (!init) | ||
| 76 | { | ||
| 77 | init++; | ||
| 78 | #ifdef BN_LLONG | ||
| 79 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
| 80 | (int)sizeof(BN_ULLONG)*8,(int)sizeof(BN_ULONG)*8); | ||
| 81 | #else | ||
| 82 | BIO_snprintf(data,sizeof data,"bn(%d,%d)", | ||
| 83 | (int)sizeof(BN_ULONG)*8,(int)sizeof(BN_ULONG)*8); | ||
| 84 | #endif | ||
| 85 | } | ||
| 86 | return(data); | ||
| 87 | } | ||
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c index 810dde34e1..bebb466d08 100644 --- a/src/lib/libcrypto/bn/bn_print.c +++ b/src/lib/libcrypto/bn/bn_print.c | |||
| @@ -294,6 +294,27 @@ err: | |||
| 294 | return(0); | 294 | return(0); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | int BN_asc2bn(BIGNUM **bn, const char *a) | ||
| 298 | { | ||
| 299 | const char *p = a; | ||
| 300 | if (*p == '-') | ||
| 301 | p++; | ||
| 302 | |||
| 303 | if (p[0] == '0' && (p[1] == 'X' || p[1] == 'x')) | ||
| 304 | { | ||
| 305 | if (!BN_hex2bn(bn, p + 2)) | ||
| 306 | return 0; | ||
| 307 | } | ||
| 308 | else | ||
| 309 | { | ||
| 310 | if (!BN_dec2bn(bn, p)) | ||
| 311 | return 0; | ||
| 312 | } | ||
| 313 | if (*a == '-') | ||
| 314 | (*bn)->neg = 1; | ||
| 315 | return 1; | ||
| 316 | } | ||
| 317 | |||
| 297 | #ifndef OPENSSL_NO_BIO | 318 | #ifndef OPENSSL_NO_BIO |
| 298 | #ifndef OPENSSL_NO_FP_API | 319 | #ifndef OPENSSL_NO_FP_API |
| 299 | int BN_print_fp(FILE *fp, const BIGNUM *a) | 320 | int BN_print_fp(FILE *fp, const BIGNUM *a) |
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/bntest.c b/src/lib/libcrypto/bn/bntest.c index cf190380f5..0cd99c5b4b 100644 --- a/src/lib/libcrypto/bn/bntest.c +++ b/src/lib/libcrypto/bn/bntest.c | |||
| @@ -486,7 +486,7 @@ static void print_word(BIO *bp,BN_ULONG w) | |||
| 486 | return; | 486 | return; |
| 487 | } | 487 | } |
| 488 | #endif | 488 | #endif |
| 489 | BIO_printf(bp,"%lX",w); | 489 | BIO_printf(bp,BN_HEX_FMT1,w); |
| 490 | } | 490 | } |
| 491 | 491 | ||
| 492 | int test_div_word(BIO *bp) | 492 | int test_div_word(BIO *bp) |
| @@ -732,6 +732,8 @@ int test_mont(BIO *bp, BN_CTX *ctx) | |||
| 732 | BN_init(&n); | 732 | BN_init(&n); |
| 733 | 733 | ||
| 734 | mont=BN_MONT_CTX_new(); | 734 | mont=BN_MONT_CTX_new(); |
| 735 | if (mont == NULL) | ||
| 736 | return 0; | ||
| 735 | 737 | ||
| 736 | BN_bntest_rand(&a,100,0,0); /**/ | 738 | BN_bntest_rand(&a,100,0,0); /**/ |
| 737 | BN_bntest_rand(&b,100,0,0); /**/ | 739 | BN_bntest_rand(&b,100,0,0); /**/ |
| @@ -1027,7 +1029,7 @@ int test_exp(BIO *bp, BN_CTX *ctx) | |||
| 1027 | BN_bntest_rand(a,20+i*5,0,0); /**/ | 1029 | BN_bntest_rand(a,20+i*5,0,0); /**/ |
| 1028 | BN_bntest_rand(b,2+i,0,0); /**/ | 1030 | BN_bntest_rand(b,2+i,0,0); /**/ |
| 1029 | 1031 | ||
| 1030 | if (!BN_exp(d,a,b,ctx)) | 1032 | if (BN_exp(d,a,b,ctx) <= 0) |
| 1031 | return(0); | 1033 | return(0); |
| 1032 | 1034 | ||
| 1033 | if (bp != NULL) | 1035 | if (bp != NULL) |
| @@ -1116,8 +1118,8 @@ int test_gf2m_mod(BIO *bp) | |||
| 1116 | { | 1118 | { |
| 1117 | BIGNUM *a,*b[2],*c,*d,*e; | 1119 | BIGNUM *a,*b[2],*c,*d,*e; |
| 1118 | int i, j, ret = 0; | 1120 | int i, j, ret = 0; |
| 1119 | unsigned int p0[] = {163,7,6,3,0}; | 1121 | int p0[] = {163,7,6,3,0,-1}; |
| 1120 | unsigned int p1[] = {193,15,0}; | 1122 | int p1[] = {193,15,0,-1}; |
| 1121 | 1123 | ||
| 1122 | a=BN_new(); | 1124 | a=BN_new(); |
| 1123 | b[0]=BN_new(); | 1125 | b[0]=BN_new(); |
| @@ -1174,8 +1176,8 @@ int test_gf2m_mod_mul(BIO *bp,BN_CTX *ctx) | |||
| 1174 | { | 1176 | { |
| 1175 | BIGNUM *a,*b[2],*c,*d,*e,*f,*g,*h; | 1177 | BIGNUM *a,*b[2],*c,*d,*e,*f,*g,*h; |
| 1176 | int i, j, ret = 0; | 1178 | int i, j, ret = 0; |
| 1177 | unsigned int p0[] = {163,7,6,3,0}; | 1179 | int p0[] = {163,7,6,3,0,-1}; |
| 1178 | unsigned int p1[] = {193,15,0}; | 1180 | int p1[] = {193,15,0,-1}; |
| 1179 | 1181 | ||
| 1180 | a=BN_new(); | 1182 | a=BN_new(); |
| 1181 | b[0]=BN_new(); | 1183 | b[0]=BN_new(); |
| @@ -1245,8 +1247,8 @@ int test_gf2m_mod_sqr(BIO *bp,BN_CTX *ctx) | |||
| 1245 | { | 1247 | { |
| 1246 | BIGNUM *a,*b[2],*c,*d; | 1248 | BIGNUM *a,*b[2],*c,*d; |
| 1247 | int i, j, ret = 0; | 1249 | int i, j, ret = 0; |
| 1248 | unsigned int p0[] = {163,7,6,3,0}; | 1250 | int p0[] = {163,7,6,3,0,-1}; |
| 1249 | unsigned int p1[] = {193,15,0}; | 1251 | int p1[] = {193,15,0,-1}; |
| 1250 | 1252 | ||
| 1251 | a=BN_new(); | 1253 | a=BN_new(); |
| 1252 | b[0]=BN_new(); | 1254 | b[0]=BN_new(); |
| @@ -1304,8 +1306,8 @@ int test_gf2m_mod_inv(BIO *bp,BN_CTX *ctx) | |||
| 1304 | { | 1306 | { |
| 1305 | BIGNUM *a,*b[2],*c,*d; | 1307 | BIGNUM *a,*b[2],*c,*d; |
| 1306 | int i, j, ret = 0; | 1308 | int i, j, ret = 0; |
| 1307 | unsigned int p0[] = {163,7,6,3,0}; | 1309 | int p0[] = {163,7,6,3,0,-1}; |
| 1308 | unsigned int p1[] = {193,15,0}; | 1310 | int p1[] = {193,15,0,-1}; |
| 1309 | 1311 | ||
| 1310 | a=BN_new(); | 1312 | a=BN_new(); |
| 1311 | b[0]=BN_new(); | 1313 | b[0]=BN_new(); |
| @@ -1359,8 +1361,8 @@ int test_gf2m_mod_div(BIO *bp,BN_CTX *ctx) | |||
| 1359 | { | 1361 | { |
| 1360 | BIGNUM *a,*b[2],*c,*d,*e,*f; | 1362 | BIGNUM *a,*b[2],*c,*d,*e,*f; |
| 1361 | int i, j, ret = 0; | 1363 | int i, j, ret = 0; |
| 1362 | unsigned int p0[] = {163,7,6,3,0}; | 1364 | int p0[] = {163,7,6,3,0,-1}; |
| 1363 | unsigned int p1[] = {193,15,0}; | 1365 | int p1[] = {193,15,0,-1}; |
| 1364 | 1366 | ||
| 1365 | a=BN_new(); | 1367 | a=BN_new(); |
| 1366 | b[0]=BN_new(); | 1368 | b[0]=BN_new(); |
| @@ -1422,8 +1424,8 @@ int test_gf2m_mod_exp(BIO *bp,BN_CTX *ctx) | |||
| 1422 | { | 1424 | { |
| 1423 | BIGNUM *a,*b[2],*c,*d,*e,*f; | 1425 | BIGNUM *a,*b[2],*c,*d,*e,*f; |
| 1424 | int i, j, ret = 0; | 1426 | int i, j, ret = 0; |
| 1425 | unsigned int p0[] = {163,7,6,3,0}; | 1427 | int p0[] = {163,7,6,3,0,-1}; |
| 1426 | unsigned int p1[] = {193,15,0}; | 1428 | int p1[] = {193,15,0,-1}; |
| 1427 | 1429 | ||
| 1428 | a=BN_new(); | 1430 | a=BN_new(); |
| 1429 | b[0]=BN_new(); | 1431 | b[0]=BN_new(); |
| @@ -1493,8 +1495,8 @@ int test_gf2m_mod_sqrt(BIO *bp,BN_CTX *ctx) | |||
| 1493 | { | 1495 | { |
| 1494 | BIGNUM *a,*b[2],*c,*d,*e,*f; | 1496 | BIGNUM *a,*b[2],*c,*d,*e,*f; |
| 1495 | int i, j, ret = 0; | 1497 | int i, j, ret = 0; |
| 1496 | unsigned int p0[] = {163,7,6,3,0}; | 1498 | int p0[] = {163,7,6,3,0,-1}; |
| 1497 | unsigned int p1[] = {193,15,0}; | 1499 | int p1[] = {193,15,0,-1}; |
| 1498 | 1500 | ||
| 1499 | a=BN_new(); | 1501 | a=BN_new(); |
| 1500 | b[0]=BN_new(); | 1502 | b[0]=BN_new(); |
| @@ -1552,8 +1554,8 @@ int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx) | |||
| 1552 | { | 1554 | { |
| 1553 | BIGNUM *a,*b[2],*c,*d,*e; | 1555 | BIGNUM *a,*b[2],*c,*d,*e; |
| 1554 | int i, j, s = 0, t, ret = 0; | 1556 | int i, j, s = 0, t, ret = 0; |
| 1555 | unsigned int p0[] = {163,7,6,3,0}; | 1557 | int p0[] = {163,7,6,3,0,-1}; |
| 1556 | unsigned int p1[] = {193,15,0}; | 1558 | int p1[] = {193,15,0,-1}; |
| 1557 | 1559 | ||
| 1558 | a=BN_new(); | 1560 | a=BN_new(); |
| 1559 | b[0]=BN_new(); | 1561 | b[0]=BN_new(); |
diff --git a/src/lib/libcrypto/bn/exptest.c b/src/lib/libcrypto/bn/exptest.c index f598a07cf5..074a8e882a 100644 --- a/src/lib/libcrypto/bn/exptest.c +++ b/src/lib/libcrypto/bn/exptest.c | |||
| @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) | |||
| 163 | { | 163 | { |
| 164 | if (BN_cmp(r_simple,r_mont) != 0) | 164 | if (BN_cmp(r_simple,r_mont) != 0) |
| 165 | printf("\nsimple and mont results differ\n"); | 165 | printf("\nsimple and mont results differ\n"); |
| 166 | if (BN_cmp(r_simple,r_mont) != 0) | 166 | if (BN_cmp(r_simple,r_mont_const) != 0) |
| 167 | printf("\nsimple and mont const time results differ\n"); | 167 | printf("\nsimple and mont const time results differ\n"); |
| 168 | if (BN_cmp(r_simple,r_recp) != 0) | 168 | if (BN_cmp(r_simple,r_recp) != 0) |
| 169 | printf("\nsimple and recp results differ\n"); | 169 | printf("\nsimple and recp results differ\n"); |
| @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) | |||
| 187 | BN_free(b); | 187 | BN_free(b); |
| 188 | BN_free(m); | 188 | BN_free(m); |
| 189 | BN_CTX_free(ctx); | 189 | BN_CTX_free(ctx); |
| 190 | ERR_remove_state(0); | 190 | ERR_remove_thread_state(NULL); |
| 191 | CRYPTO_mem_leaks(out); | 191 | CRYPTO_mem_leaks(out); |
| 192 | BIO_free(out); | 192 | BIO_free(out); |
| 193 | printf(" done\n"); | 193 | printf(" done\n"); |
diff --git a/src/lib/libcrypto/buffer/Makefile.ssl b/src/lib/libcrypto/buffer/Makefile.ssl deleted file mode 100644 index b131ca3078..0000000000 --- a/src/lib/libcrypto/buffer/Makefile.ssl +++ /dev/null | |||
| @@ -1,94 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/buffer/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= buffer | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= buffer.c buf_err.c | ||
| 27 | LIBOBJ= buffer.o buf_err.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= buffer.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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | buf_err.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 83 | buf_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 84 | buf_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 85 | buf_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 86 | buf_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 87 | buf_err.o: ../../include/openssl/symhacks.h buf_err.c | ||
| 88 | buffer.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 89 | buffer.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 90 | buffer.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 91 | buffer.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 92 | buffer.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 93 | buffer.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 94 | buffer.o: ../cryptlib.h buffer.c | ||
diff --git a/src/lib/libcrypto/buffer/buf_err.c b/src/lib/libcrypto/buffer/buf_err.c index 3e25bbe879..8f1de6192b 100644 --- a/src/lib/libcrypto/buffer/buf_err.c +++ b/src/lib/libcrypto/buffer/buf_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/buffer/buf_err.c */ | 1 | /* crypto/buffer/buf_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/buffer/buf_str.c b/src/lib/libcrypto/buffer/buf_str.c deleted file mode 100644 index 28dd1e401e..0000000000 --- a/src/lib/libcrypto/buffer/buf_str.c +++ /dev/null | |||
| @@ -1,116 +0,0 @@ | |||
| 1 | /* crypto/buffer/buf_str.c */ | ||
| 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 | * 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 <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 | |||
| 66 | char *BUF_strndup(const char *str, size_t siz) | ||
| 67 | { | ||
| 68 | char *ret; | ||
| 69 | |||
| 70 | if (str == NULL) return(NULL); | ||
| 71 | |||
| 72 | ret=OPENSSL_malloc(siz+1); | ||
| 73 | if (ret == NULL) | ||
| 74 | { | ||
| 75 | BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE); | ||
| 76 | return(NULL); | ||
| 77 | } | ||
| 78 | BUF_strlcpy(ret,str,siz+1); | ||
| 79 | return(ret); | ||
| 80 | } | ||
| 81 | |||
| 82 | void *BUF_memdup(const void *data, size_t siz) | ||
| 83 | { | ||
| 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 | } | ||
| 109 | |||
| 110 | size_t BUF_strlcat(char *dst, const char *src, size_t size) | ||
| 111 | { | ||
| 112 | size_t l = 0; | ||
| 113 | for(; size > 0 && *dst; size--, dst++) | ||
| 114 | l++; | ||
| 115 | return l + BUF_strlcpy(dst, src, size); | ||
| 116 | } | ||
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c index b3e947771d..620ea8d536 100644 --- a/src/lib/libcrypto/buffer/buffer.c +++ b/src/lib/libcrypto/buffer/buffer.c | |||
| @@ -89,10 +89,10 @@ void BUF_MEM_free(BUF_MEM *a) | |||
| 89 | OPENSSL_free(a); | 89 | OPENSSL_free(a); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | int BUF_MEM_grow(BUF_MEM *str, int len) | 92 | int BUF_MEM_grow(BUF_MEM *str, size_t len) |
| 93 | { | 93 | { |
| 94 | char *ret; | 94 | char *ret; |
| 95 | unsigned int n; | 95 | size_t n; |
| 96 | 96 | ||
| 97 | if (str->length >= len) | 97 | if (str->length >= len) |
| 98 | { | 98 | { |
| @@ -125,10 +125,10 @@ int BUF_MEM_grow(BUF_MEM *str, int len) | |||
| 125 | return(len); | 125 | return(len); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | int BUF_MEM_grow_clean(BUF_MEM *str, int len) | 128 | int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) |
| 129 | { | 129 | { |
| 130 | char *ret; | 130 | char *ret; |
| 131 | unsigned int n; | 131 | size_t n; |
| 132 | 132 | ||
| 133 | if (str->length >= len) | 133 | if (str->length >= len) |
| 134 | { | 134 | { |
| @@ -161,3 +161,84 @@ int BUF_MEM_grow_clean(BUF_MEM *str, int len) | |||
| 161 | } | 161 | } |
| 162 | return(len); | 162 | return(len); |
| 163 | } | 163 | } |
| 164 | |||
| 165 | char *BUF_strdup(const char *str) | ||
| 166 | { | ||
| 167 | if (str == NULL) return(NULL); | ||
| 168 | return BUF_strndup(str, strlen(str)); | ||
| 169 | } | ||
| 170 | |||
| 171 | char *BUF_strndup(const char *str, size_t siz) | ||
| 172 | { | ||
| 173 | char *ret; | ||
| 174 | |||
| 175 | if (str == NULL) return(NULL); | ||
| 176 | |||
| 177 | ret=OPENSSL_malloc(siz+1); | ||
| 178 | if (ret == NULL) | ||
| 179 | { | ||
| 180 | BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE); | ||
| 181 | return(NULL); | ||
| 182 | } | ||
| 183 | BUF_strlcpy(ret,str,siz+1); | ||
| 184 | return(ret); | ||
| 185 | } | ||
| 186 | |||
| 187 | void *BUF_memdup(const void *data, size_t siz) | ||
| 188 | { | ||
| 189 | void *ret; | ||
| 190 | |||
| 191 | if (data == NULL) return(NULL); | ||
| 192 | |||
| 193 | ret=OPENSSL_malloc(siz); | ||
| 194 | if (ret == NULL) | ||
| 195 | { | ||
| 196 | BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE); | ||
| 197 | return(NULL); | ||
| 198 | } | ||
| 199 | return memcpy(ret, data, siz); | ||
| 200 | } | ||
| 201 | |||
| 202 | size_t BUF_strlcpy(char *dst, const char *src, size_t size) | ||
| 203 | { | ||
| 204 | size_t l = 0; | ||
| 205 | for(; size > 1 && *src; size--) | ||
| 206 | { | ||
| 207 | *dst++ = *src++; | ||
| 208 | l++; | ||
| 209 | } | ||
| 210 | if (size) | ||
| 211 | *dst = '\0'; | ||
| 212 | return l + strlen(src); | ||
| 213 | } | ||
| 214 | |||
| 215 | size_t BUF_strlcat(char *dst, const char *src, size_t size) | ||
| 216 | { | ||
| 217 | size_t l = 0; | ||
| 218 | for(; size > 0 && *dst; size--, dst++) | ||
| 219 | l++; | ||
| 220 | return l + BUF_strlcpy(dst, src, size); | ||
| 221 | } | ||
| 222 | |||
| 223 | void BUF_reverse(unsigned char *out, unsigned char *in, size_t size) | ||
| 224 | { | ||
| 225 | size_t i; | ||
| 226 | if (in) | ||
| 227 | { | ||
| 228 | out += size - 1; | ||
| 229 | for (i = 0; i < size; i++) | ||
| 230 | *in++ = *out--; | ||
| 231 | } | ||
| 232 | else | ||
| 233 | { | ||
| 234 | unsigned char *q; | ||
| 235 | char c; | ||
| 236 | q = out + size - 1; | ||
| 237 | for (i = 0; i < size/2; i++) | ||
| 238 | { | ||
| 239 | c = *q; | ||
| 240 | *q-- = *out; | ||
| 241 | *out++ = c; | ||
| 242 | } | ||
| 243 | } | ||
| 244 | } | ||
diff --git a/src/lib/libcrypto/buffer/buffer.h b/src/lib/libcrypto/buffer/buffer.h index 1db9607450..178e418282 100644 --- a/src/lib/libcrypto/buffer/buffer.h +++ b/src/lib/libcrypto/buffer/buffer.h | |||
| @@ -76,18 +76,19 @@ extern "C" { | |||
| 76 | 76 | ||
| 77 | struct buf_mem_st | 77 | struct buf_mem_st |
| 78 | { | 78 | { |
| 79 | int length; /* current number of bytes */ | 79 | size_t length; /* current number of bytes */ |
| 80 | char *data; | 80 | char *data; |
| 81 | int max; /* size of buffer */ | 81 | size_t max; /* size of buffer */ |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | BUF_MEM *BUF_MEM_new(void); | 84 | BUF_MEM *BUF_MEM_new(void); |
| 85 | void BUF_MEM_free(BUF_MEM *a); | 85 | void BUF_MEM_free(BUF_MEM *a); |
| 86 | int BUF_MEM_grow(BUF_MEM *str, int len); | 86 | int BUF_MEM_grow(BUF_MEM *str, size_t len); |
| 87 | int BUF_MEM_grow_clean(BUF_MEM *str, int len); | 87 | int BUF_MEM_grow_clean(BUF_MEM *str, size_t len); |
| 88 | char * BUF_strdup(const char *str); | 88 | char * BUF_strdup(const char *str); |
| 89 | char * BUF_strndup(const char *str, size_t siz); | 89 | char * BUF_strndup(const char *str, size_t siz); |
| 90 | void * BUF_memdup(const void *data, size_t siz); | 90 | void * BUF_memdup(const void *data, size_t siz); |
| 91 | void BUF_reverse(unsigned char *out, unsigned char *in, size_t siz); | ||
| 91 | 92 | ||
| 92 | /* safe string functions */ | 93 | /* safe string functions */ |
| 93 | size_t BUF_strlcpy(char *dst,const char *src,size_t siz); | 94 | size_t BUF_strlcpy(char *dst,const char *src,size_t siz); |
diff --git a/src/lib/libcrypto/cast/Makefile.ssl b/src/lib/libcrypto/cast/Makefile.ssl deleted file mode 100644 index 98393a37ba..0000000000 --- a/src/lib/libcrypto/cast/Makefile.ssl +++ /dev/null | |||
| @@ -1,120 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/cast/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= cast | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | CAST_ENC=c_enc.o | ||
| 21 | # or use | ||
| 22 | #CAST_ENC=asm/cx86-elf.o | ||
| 23 | #CAST_ENC=asm/cx86-out.o | ||
| 24 | #CAST_ENC=asm/cx86-sol.o | ||
| 25 | #CAST_ENC=asm/cx86bdsi.o | ||
| 26 | |||
| 27 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 28 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 29 | |||
| 30 | GENERAL=Makefile | ||
| 31 | TEST=casttest.c | ||
| 32 | APPS= | ||
| 33 | |||
| 34 | LIB=$(TOP)/libcrypto.a | ||
| 35 | LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c | ||
| 36 | LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o | ||
| 37 | |||
| 38 | SRC= $(LIBSRC) | ||
| 39 | |||
| 40 | EXHEADER= cast.h | ||
| 41 | HEADER= cast_s.h cast_lcl.h $(EXHEADER) | ||
| 42 | |||
| 43 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 44 | |||
| 45 | top: | ||
| 46 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 47 | |||
| 48 | all: lib | ||
| 49 | |||
| 50 | lib: $(LIBOBJ) | ||
| 51 | $(AR) $(LIB) $(LIBOBJ) | ||
| 52 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 53 | @touch lib | ||
| 54 | |||
| 55 | # elf | ||
| 56 | asm/cx86-elf.s: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 57 | (cd asm; $(PERL) cast-586.pl elf $(CLAGS) $(PROCESSOR) > cx86-elf.s) | ||
| 58 | |||
| 59 | # a.out | ||
| 60 | asm/cx86-out.o: asm/cx86unix.cpp | ||
| 61 | $(CPP) -DOUT asm/cx86unix.cpp | as -o asm/cx86-out.o | ||
| 62 | |||
| 63 | # bsdi | ||
| 64 | asm/cx86bsdi.o: asm/cx86unix.cpp | ||
| 65 | $(CPP) -DBSDI asm/cx86unix.cpp | sed 's/ :/:/' | as -o asm/cx86bsdi.o | ||
| 66 | |||
| 67 | asm/cx86unix.cpp: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 68 | (cd asm; $(PERL) cast-586.pl cpp $(PROCESSOR) >cx86unix.cpp) | ||
| 69 | |||
| 70 | files: | ||
| 71 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 72 | |||
| 73 | links: | ||
| 74 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 75 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 76 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 77 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 78 | |||
| 79 | install: | ||
| 80 | @for i in $(EXHEADER) ; \ | ||
| 81 | do \ | ||
| 82 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 83 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 84 | done; | ||
| 85 | |||
| 86 | tags: | ||
| 87 | ctags $(SRC) | ||
| 88 | |||
| 89 | tests: | ||
| 90 | |||
| 91 | lint: | ||
| 92 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 93 | |||
| 94 | depend: | ||
| 95 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 96 | |||
| 97 | dclean: | ||
| 98 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 99 | mv -f Makefile.new $(MAKEFILE) | ||
| 100 | |||
| 101 | clean: | ||
| 102 | rm -f asm/cx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 103 | |||
| 104 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 105 | |||
| 106 | c_cfb64.o: ../../e_os.h ../../include/openssl/cast.h | ||
| 107 | c_cfb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 108 | c_cfb64.o: c_cfb64.c cast_lcl.h | ||
| 109 | c_ecb.o: ../../e_os.h ../../include/openssl/cast.h | ||
| 110 | c_ecb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 111 | c_ecb.o: ../../include/openssl/opensslv.h c_ecb.c cast_lcl.h | ||
| 112 | c_enc.o: ../../e_os.h ../../include/openssl/cast.h | ||
| 113 | c_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 114 | c_enc.o: c_enc.c cast_lcl.h | ||
| 115 | c_ofb64.o: ../../e_os.h ../../include/openssl/cast.h | ||
| 116 | c_ofb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 117 | c_ofb64.o: c_ofb64.c cast_lcl.h | ||
| 118 | c_skey.o: ../../e_os.h ../../include/openssl/cast.h | ||
| 119 | c_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 120 | 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 0ed55d1905..7a0083ecb8 100644 --- a/src/lib/libcrypto/cast/asm/cast-586.pl +++ b/src/lib/libcrypto/cast/asm/cast-586.pl | |||
| @@ -3,7 +3,8 @@ | |||
| 3 | # define for pentium pro friendly version | 3 | # define for pentium pro friendly version |
| 4 | $ppro=1; | 4 | $ppro=1; |
| 5 | 5 | ||
| 6 | push(@INC,"perlasm","../../perlasm"); | 6 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 7 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 7 | require "x86asm.pl"; | 8 | require "x86asm.pl"; |
| 8 | require "cbc.pl"; | 9 | require "cbc.pl"; |
| 9 | 10 | ||
diff --git a/src/lib/libcrypto/cast/c_cfb64.c b/src/lib/libcrypto/cast/c_cfb64.c index 514c005c32..dcec13a201 100644 --- a/src/lib/libcrypto/cast/c_cfb64.c +++ b/src/lib/libcrypto/cast/c_cfb64.c | |||
| @@ -65,7 +65,7 @@ | |||
| 65 | */ | 65 | */ |
| 66 | 66 | ||
| 67 | void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, | 67 | void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, |
| 68 | long length, CAST_KEY *schedule, unsigned char *ivec, | 68 | long length, const CAST_KEY *schedule, unsigned char *ivec, |
| 69 | int *num, int enc) | 69 | int *num, int enc) |
| 70 | { | 70 | { |
| 71 | register CAST_LONG v0,v1,t; | 71 | register CAST_LONG v0,v1,t; |
| @@ -119,4 +119,3 @@ void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, | |||
| 119 | v0=v1=ti[0]=ti[1]=t=c=cc=0; | 119 | v0=v1=ti[0]=ti[1]=t=c=cc=0; |
| 120 | *num=n; | 120 | *num=n; |
| 121 | } | 121 | } |
| 122 | |||
diff --git a/src/lib/libcrypto/cast/c_ecb.c b/src/lib/libcrypto/cast/c_ecb.c index f2dc606226..b6a3b1fff9 100644 --- a/src/lib/libcrypto/cast/c_ecb.c +++ b/src/lib/libcrypto/cast/c_ecb.c | |||
| @@ -63,7 +63,7 @@ | |||
| 63 | const char CAST_version[]="CAST" OPENSSL_VERSION_PTEXT; | 63 | const char CAST_version[]="CAST" OPENSSL_VERSION_PTEXT; |
| 64 | 64 | ||
| 65 | void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, | 65 | void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, |
| 66 | CAST_KEY *ks, int enc) | 66 | const CAST_KEY *ks, int enc) |
| 67 | { | 67 | { |
| 68 | CAST_LONG l,d[2]; | 68 | CAST_LONG l,d[2]; |
| 69 | 69 | ||
| @@ -77,4 +77,3 @@ void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, | |||
| 77 | l=d[1]; l2n(l,out); | 77 | l=d[1]; l2n(l,out); |
| 78 | l=d[0]=d[1]=0; | 78 | l=d[0]=d[1]=0; |
| 79 | } | 79 | } |
| 80 | |||
diff --git a/src/lib/libcrypto/cast/c_enc.c b/src/lib/libcrypto/cast/c_enc.c index e80f65b698..2ae54f5cfb 100644 --- a/src/lib/libcrypto/cast/c_enc.c +++ b/src/lib/libcrypto/cast/c_enc.c | |||
| @@ -60,9 +60,10 @@ | |||
| 60 | #include "cast_lcl.h" | 60 | #include "cast_lcl.h" |
| 61 | 61 | ||
| 62 | #ifndef OPENBSD_CAST_ASM | 62 | #ifndef OPENBSD_CAST_ASM |
| 63 | void CAST_encrypt(CAST_LONG *data, CAST_KEY *key) | 63 | void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key) |
| 64 | { | 64 | { |
| 65 | register CAST_LONG l,r,*k,t; | 65 | register CAST_LONG l,r,t; |
| 66 | const register CAST_LONG *k; | ||
| 66 | 67 | ||
| 67 | k= &(key->data[0]); | 68 | k= &(key->data[0]); |
| 68 | l=data[0]; | 69 | l=data[0]; |
| @@ -92,9 +93,10 @@ void CAST_encrypt(CAST_LONG *data, CAST_KEY *key) | |||
| 92 | data[0]=r&0xffffffffL; | 93 | data[0]=r&0xffffffffL; |
| 93 | } | 94 | } |
| 94 | 95 | ||
| 95 | void CAST_decrypt(CAST_LONG *data, CAST_KEY *key) | 96 | void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key) |
| 96 | { | 97 | { |
| 97 | register CAST_LONG l,r,*k,t; | 98 | register CAST_LONG l,r,t; |
| 99 | const register CAST_LONG *k; | ||
| 98 | 100 | ||
| 99 | k= &(key->data[0]); | 101 | k= &(key->data[0]); |
| 100 | l=data[0]; | 102 | l=data[0]; |
| @@ -126,7 +128,7 @@ void CAST_decrypt(CAST_LONG *data, CAST_KEY *key) | |||
| 126 | #endif | 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 | CAST_KEY *ks, unsigned char *iv, int enc) | 131 | const CAST_KEY *ks, unsigned char *iv, int enc) |
| 130 | { | 132 | { |
| 131 | register CAST_LONG tin0,tin1; | 133 | register CAST_LONG tin0,tin1; |
| 132 | register CAST_LONG tout0,tout1,xor0,xor1; | 134 | register CAST_LONG tout0,tout1,xor0,xor1; |
| @@ -206,4 +208,3 @@ void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, | |||
| 206 | tin0=tin1=tout0=tout1=xor0=xor1=0; | 208 | tin0=tin1=tout0=tout1=xor0=xor1=0; |
| 207 | tin[0]=tin[1]=0; | 209 | tin[0]=tin[1]=0; |
| 208 | } | 210 | } |
| 209 | |||
diff --git a/src/lib/libcrypto/cast/c_ofb64.c b/src/lib/libcrypto/cast/c_ofb64.c index fd0469a62f..cb3222456c 100644 --- a/src/lib/libcrypto/cast/c_ofb64.c +++ b/src/lib/libcrypto/cast/c_ofb64.c | |||
| @@ -64,7 +64,7 @@ | |||
| 64 | * 64bit block we have used is contained in *num; | 64 | * 64bit block we have used is contained in *num; |
| 65 | */ | 65 | */ |
| 66 | void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, | 66 | void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, |
| 67 | long length, CAST_KEY *schedule, unsigned char *ivec, | 67 | long length, const CAST_KEY *schedule, unsigned char *ivec, |
| 68 | int *num) | 68 | int *num) |
| 69 | { | 69 | { |
| 70 | register CAST_LONG v0,v1,t; | 70 | register CAST_LONG v0,v1,t; |
| @@ -108,4 +108,3 @@ void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, | |||
| 108 | t=v0=v1=ti[0]=ti[1]=0; | 108 | t=v0=v1=ti[0]=ti[1]=0; |
| 109 | *num=n; | 109 | *num=n; |
| 110 | } | 110 | } |
| 111 | |||
diff --git a/src/lib/libcrypto/cast/c_skey.c b/src/lib/libcrypto/cast/c_skey.c index 68e690a60c..76e40005c9 100644 --- a/src/lib/libcrypto/cast/c_skey.c +++ b/src/lib/libcrypto/cast/c_skey.c | |||
| @@ -57,11 +57,6 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <openssl/cast.h> | 59 | #include <openssl/cast.h> |
| 60 | #include <openssl/crypto.h> | ||
| 61 | #ifdef OPENSSL_FIPS | ||
| 62 | #include <openssl/fips.h> | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #include "cast_lcl.h" | 60 | #include "cast_lcl.h" |
| 66 | #include "cast_s.h" | 61 | #include "cast_s.h" |
| 67 | 62 | ||
| @@ -77,7 +72,7 @@ | |||
| 77 | #define S6 CAST_S_table6 | 72 | #define S6 CAST_S_table6 |
| 78 | #define S7 CAST_S_table7 | 73 | #define S7 CAST_S_table7 |
| 79 | 74 | ||
| 80 | FIPS_NON_FIPS_VCIPHER_Init(CAST) | 75 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data) |
| 81 | { | 76 | { |
| 82 | CAST_LONG x[16]; | 77 | CAST_LONG x[16]; |
| 83 | CAST_LONG z[16]; | 78 | CAST_LONG z[16]; |
diff --git a/src/lib/libcrypto/cast/cast.h b/src/lib/libcrypto/cast/cast.h index 1faf5806aa..1a264f8143 100644 --- a/src/lib/libcrypto/cast/cast.h +++ b/src/lib/libcrypto/cast/cast.h | |||
| @@ -72,7 +72,7 @@ extern "C" { | |||
| 72 | #define CAST_ENCRYPT 1 | 72 | #define CAST_ENCRYPT 1 |
| 73 | #define CAST_DECRYPT 0 | 73 | #define CAST_DECRYPT 0 |
| 74 | 74 | ||
| 75 | #define CAST_LONG unsigned long | 75 | #define CAST_LONG unsigned int |
| 76 | 76 | ||
| 77 | #define CAST_BLOCK 8 | 77 | #define CAST_BLOCK 8 |
| 78 | #define CAST_KEY_LENGTH 16 | 78 | #define CAST_KEY_LENGTH 16 |
| @@ -83,21 +83,19 @@ typedef struct cast_key_st | |||
| 83 | int short_key; /* Use reduced rounds for short key */ | 83 | int short_key; /* Use reduced rounds for short key */ |
| 84 | } CAST_KEY; | 84 | } CAST_KEY; |
| 85 | 85 | ||
| 86 | #ifdef OPENSSL_FIPS | 86 | |
| 87 | void private_CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); | ||
| 88 | #endif | ||
| 89 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); | 87 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); |
| 90 | void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out,CAST_KEY *key, | 88 | void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAST_KEY *key, |
| 91 | int enc); | 89 | int enc); |
| 92 | void CAST_encrypt(CAST_LONG *data,CAST_KEY *key); | 90 | void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); |
| 93 | void CAST_decrypt(CAST_LONG *data,CAST_KEY *key); | 91 | void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); |
| 94 | void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, | 92 | void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, |
| 95 | CAST_KEY *ks, unsigned char *iv, int enc); | 93 | const CAST_KEY *ks, unsigned char *iv, int enc); |
| 96 | void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, | 94 | void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, |
| 97 | long length, CAST_KEY *schedule, unsigned char *ivec, | 95 | long length, const CAST_KEY *schedule, unsigned char *ivec, |
| 98 | int *num, int enc); | 96 | int *num, int enc); |
| 99 | void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, | 97 | void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, |
| 100 | long length, CAST_KEY *schedule, unsigned char *ivec, | 98 | long length, const CAST_KEY *schedule, unsigned char *ivec, |
| 101 | int *num); | 99 | int *num); |
| 102 | 100 | ||
| 103 | #ifdef __cplusplus | 101 | #ifdef __cplusplus |
diff --git a/src/lib/libcrypto/cms/cms_smime.c b/src/lib/libcrypto/cms/cms_smime.c index f35883aa22..4a799eb897 100644 --- a/src/lib/libcrypto/cms/cms_smime.c +++ b/src/lib/libcrypto/cms/cms_smime.c | |||
| @@ -171,7 +171,7 @@ CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags) | |||
| 171 | if (!cms) | 171 | if (!cms) |
| 172 | return NULL; | 172 | return NULL; |
| 173 | 173 | ||
| 174 | if (CMS_final(cms, in, NULL, flags)) | 174 | if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) |
| 175 | return cms; | 175 | return cms; |
| 176 | 176 | ||
| 177 | CMS_ContentInfo_free(cms); | 177 | CMS_ContentInfo_free(cms); |
| @@ -214,10 +214,7 @@ CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, | |||
| 214 | return NULL; | 214 | return NULL; |
| 215 | 215 | ||
| 216 | if(!(flags & CMS_DETACHED)) | 216 | if(!(flags & CMS_DETACHED)) |
| 217 | { | ||
| 218 | flags &= ~CMS_STREAM; | ||
| 219 | CMS_set_detached(cms, 0); | 217 | CMS_set_detached(cms, 0); |
| 220 | } | ||
| 221 | 218 | ||
| 222 | if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) | 219 | if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) |
| 223 | return cms; | 220 | return cms; |
| @@ -269,10 +266,7 @@ CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, | |||
| 269 | return NULL; | 266 | return NULL; |
| 270 | 267 | ||
| 271 | if(!(flags & CMS_DETACHED)) | 268 | if(!(flags & CMS_DETACHED)) |
| 272 | { | ||
| 273 | flags &= ~CMS_STREAM; | ||
| 274 | CMS_set_detached(cms, 0); | 269 | CMS_set_detached(cms, 0); |
| 275 | } | ||
| 276 | 270 | ||
| 277 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) | 271 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) |
| 278 | || CMS_final(cms, in, NULL, flags)) | 272 | || CMS_final(cms, in, NULL, flags)) |
| @@ -456,6 +450,7 @@ int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, | |||
| 456 | X509_STORE *store, unsigned int flags) | 450 | X509_STORE *store, unsigned int flags) |
| 457 | { | 451 | { |
| 458 | int r; | 452 | int r; |
| 453 | flags &= ~(CMS_DETACHED|CMS_TEXT); | ||
| 459 | r = CMS_verify(rcms, certs, store, NULL, NULL, flags); | 454 | r = CMS_verify(rcms, certs, store, NULL, NULL, flags); |
| 460 | if (r <= 0) | 455 | if (r <= 0) |
| 461 | return r; | 456 | return r; |
| @@ -486,10 +481,7 @@ CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, | |||
| 486 | } | 481 | } |
| 487 | 482 | ||
| 488 | if(!(flags & CMS_DETACHED)) | 483 | if(!(flags & CMS_DETACHED)) |
| 489 | { | ||
| 490 | flags &= ~CMS_STREAM; | ||
| 491 | CMS_set_detached(cms, 0); | 484 | CMS_set_detached(cms, 0); |
| 492 | } | ||
| 493 | 485 | ||
| 494 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) | 486 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) |
| 495 | || CMS_final(cms, data, NULL, flags)) | 487 | || CMS_final(cms, data, NULL, flags)) |
| @@ -517,7 +509,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, | |||
| 517 | BIO *rct_cont = NULL; | 509 | BIO *rct_cont = NULL; |
| 518 | int r = 0; | 510 | int r = 0; |
| 519 | 511 | ||
| 520 | flags &= ~CMS_STREAM; | 512 | flags &= ~(CMS_STREAM|CMS_TEXT); |
| 521 | /* Not really detached but avoids content being allocated */ | 513 | /* Not really detached but avoids content being allocated */ |
| 522 | flags |= CMS_PARTIAL|CMS_BINARY|CMS_DETACHED; | 514 | flags |= CMS_PARTIAL|CMS_BINARY|CMS_DETACHED; |
| 523 | if (!pkey || !signcert) | 515 | if (!pkey || !signcert) |
| @@ -598,10 +590,7 @@ CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *data, | |||
| 598 | } | 590 | } |
| 599 | 591 | ||
| 600 | if(!(flags & CMS_DETACHED)) | 592 | if(!(flags & CMS_DETACHED)) |
| 601 | { | ||
| 602 | flags &= ~CMS_STREAM; | ||
| 603 | CMS_set_detached(cms, 0); | 593 | CMS_set_detached(cms, 0); |
| 604 | } | ||
| 605 | 594 | ||
| 606 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) | 595 | if ((flags & (CMS_STREAM|CMS_PARTIAL)) |
| 607 | || CMS_final(cms, data, NULL, flags)) | 596 | || CMS_final(cms, data, NULL, flags)) |
| @@ -781,12 +770,9 @@ CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags) | |||
| 781 | return NULL; | 770 | return NULL; |
| 782 | 771 | ||
| 783 | if(!(flags & CMS_DETACHED)) | 772 | if(!(flags & CMS_DETACHED)) |
| 784 | { | ||
| 785 | flags &= ~CMS_STREAM; | ||
| 786 | CMS_set_detached(cms, 0); | 773 | CMS_set_detached(cms, 0); |
| 787 | } | ||
| 788 | 774 | ||
| 789 | if (CMS_final(cms, in, NULL, flags)) | 775 | if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) |
| 790 | return cms; | 776 | return cms; |
| 791 | 777 | ||
| 792 | CMS_ContentInfo_free(cms); | 778 | CMS_ContentInfo_free(cms); |
diff --git a/src/lib/libcrypto/comp/Makefile.ssl b/src/lib/libcrypto/comp/Makefile.ssl deleted file mode 100644 index f70ba1b285..0000000000 --- a/src/lib/libcrypto/comp/Makefile.ssl +++ /dev/null | |||
| @@ -1,114 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/comp/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= comp | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= comp_lib.c comp_err.c \ | ||
| 27 | c_rle.c c_zlib.c | ||
| 28 | |||
| 29 | LIBOBJ= comp_lib.o comp_err.o \ | ||
| 30 | c_rle.o c_zlib.o | ||
| 31 | |||
| 32 | SRC= $(LIBSRC) | ||
| 33 | |||
| 34 | EXHEADER= comp.h | ||
| 35 | HEADER= $(EXHEADER) | ||
| 36 | |||
| 37 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 38 | |||
| 39 | top: | ||
| 40 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 41 | |||
| 42 | all: lib | ||
| 43 | |||
| 44 | lib: $(LIBOBJ) | ||
| 45 | $(AR) $(LIB) $(LIBOBJ) | ||
| 46 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 47 | @touch lib | ||
| 48 | |||
| 49 | files: | ||
| 50 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 51 | |||
| 52 | links: | ||
| 53 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 60 | do \ | ||
| 61 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 62 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 63 | done; | ||
| 64 | |||
| 65 | tags: | ||
| 66 | ctags $(SRC) | ||
| 67 | |||
| 68 | tests: | ||
| 69 | |||
| 70 | lint: | ||
| 71 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 72 | |||
| 73 | depend: | ||
| 74 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 82 | |||
| 83 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 84 | |||
| 85 | c_rle.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 86 | c_rle.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
| 87 | c_rle.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 88 | c_rle.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 89 | c_rle.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 90 | c_rle.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 91 | c_rle.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h c_rle.c | ||
| 92 | c_zlib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 93 | c_zlib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
| 94 | c_zlib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 95 | c_zlib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 96 | c_zlib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 97 | c_zlib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 98 | c_zlib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 99 | c_zlib.o: c_zlib.c | ||
| 100 | comp_err.o: ../../include/openssl/bio.h ../../include/openssl/comp.h | ||
| 101 | comp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 102 | comp_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 103 | comp_err.o: ../../include/openssl/opensslconf.h | ||
| 104 | comp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 105 | comp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 106 | comp_err.o: comp_err.c | ||
| 107 | comp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 108 | comp_lib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
| 109 | comp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 110 | comp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 111 | comp_lib.o: ../../include/openssl/opensslconf.h | ||
| 112 | comp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 113 | comp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 114 | comp_lib.o: ../../include/openssl/symhacks.h comp_lib.c | ||
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c index 8df7792c50..8adf35f3fc 100644 --- a/src/lib/libcrypto/comp/c_zlib.c +++ b/src/lib/libcrypto/comp/c_zlib.c | |||
| @@ -781,6 +781,7 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 781 | default: | 781 | default: |
| 782 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); | 782 | ret = BIO_ctrl(b->next_bio, cmd, num, ptr); |
| 783 | break; | 783 | break; |
| 784 | |||
| 784 | } | 785 | } |
| 785 | 786 | ||
| 786 | return ret; | 787 | return ret; |
diff --git a/src/lib/libcrypto/comp/comp_err.c b/src/lib/libcrypto/comp/comp_err.c index 187d68b725..661c94c3a4 100644 --- a/src/lib/libcrypto/comp/comp_err.c +++ b/src/lib/libcrypto/comp/comp_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/comp/comp_err.c */ | 1 | /* crypto/comp/comp_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/conf/Makefile.ssl b/src/lib/libcrypto/conf/Makefile.ssl deleted file mode 100644 index c5873bc6e7..0000000000 --- a/src/lib/libcrypto/conf/Makefile.ssl +++ /dev/null | |||
| @@ -1,183 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/conf/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= conf | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= conf_err.c conf_lib.c conf_api.c conf_def.c conf_mod.c \ | ||
| 27 | conf_mall.c conf_sap.c | ||
| 28 | |||
| 29 | LIBOBJ= conf_err.o conf_lib.o conf_api.o conf_def.o conf_mod.o \ | ||
| 30 | conf_mall.o conf_sap.o | ||
| 31 | |||
| 32 | SRC= $(LIBSRC) | ||
| 33 | |||
| 34 | EXHEADER= conf.h conf_api.h | ||
| 35 | HEADER= conf_def.h $(EXHEADER) | ||
| 36 | |||
| 37 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 38 | |||
| 39 | top: | ||
| 40 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 41 | |||
| 42 | all: lib | ||
| 43 | |||
| 44 | lib: $(LIBOBJ) | ||
| 45 | $(AR) $(LIB) $(LIBOBJ) | ||
| 46 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 47 | @touch lib | ||
| 48 | |||
| 49 | files: | ||
| 50 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 51 | |||
| 52 | links: | ||
| 53 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 60 | do \ | ||
| 61 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 62 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 63 | done; | ||
| 64 | |||
| 65 | tags: | ||
| 66 | ctags $(SRC) | ||
| 67 | |||
| 68 | tests: | ||
| 69 | |||
| 70 | lint: | ||
| 71 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 72 | |||
| 73 | depend: | ||
| 74 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 82 | |||
| 83 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 84 | |||
| 85 | conf_api.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 86 | conf_api.o: ../../include/openssl/conf.h ../../include/openssl/conf_api.h | ||
| 87 | conf_api.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 88 | conf_api.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 89 | conf_api.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 90 | conf_api.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 91 | conf_api.o: conf_api.c | ||
| 92 | conf_def.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 93 | conf_def.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 94 | conf_def.o: ../../include/openssl/conf_api.h ../../include/openssl/crypto.h | ||
| 95 | conf_def.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 96 | conf_def.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 97 | conf_def.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 98 | conf_def.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 99 | conf_def.o: ../cryptlib.h conf_def.c conf_def.h | ||
| 100 | conf_err.o: ../../include/openssl/bio.h ../../include/openssl/conf.h | ||
| 101 | conf_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 102 | conf_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 103 | conf_err.o: ../../include/openssl/opensslconf.h | ||
| 104 | conf_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 105 | conf_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 106 | conf_err.o: conf_err.c | ||
| 107 | conf_lib.o: ../../include/openssl/bio.h ../../include/openssl/conf.h | ||
| 108 | conf_lib.o: ../../include/openssl/conf_api.h ../../include/openssl/crypto.h | ||
| 109 | conf_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 110 | conf_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 111 | conf_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 112 | conf_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 113 | conf_lib.o: conf_lib.c | ||
| 114 | conf_mall.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 115 | conf_mall.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 116 | conf_mall.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 117 | conf_mall.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 118 | conf_mall.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 119 | conf_mall.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 120 | conf_mall.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 121 | conf_mall.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 122 | conf_mall.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 123 | conf_mall.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 124 | conf_mall.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 125 | conf_mall.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 126 | conf_mall.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 127 | conf_mall.o: ../../include/openssl/objects.h | ||
| 128 | conf_mall.o: ../../include/openssl/opensslconf.h | ||
| 129 | conf_mall.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 130 | conf_mall.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 131 | conf_mall.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 132 | conf_mall.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 133 | conf_mall.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 134 | conf_mall.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 135 | conf_mall.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 136 | conf_mall.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 137 | conf_mall.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_mall.c | ||
| 138 | conf_mod.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 139 | conf_mod.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 140 | conf_mod.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 141 | conf_mod.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 142 | conf_mod.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 143 | conf_mod.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 144 | conf_mod.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 145 | conf_mod.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 146 | conf_mod.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 147 | conf_mod.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 148 | conf_mod.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 149 | conf_mod.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 150 | conf_mod.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 151 | conf_mod.o: ../../include/openssl/opensslconf.h | ||
| 152 | conf_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 153 | conf_mod.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 154 | conf_mod.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 155 | conf_mod.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 156 | conf_mod.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 157 | conf_mod.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 158 | conf_mod.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 159 | conf_mod.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 160 | conf_mod.o: ../cryptlib.h conf_mod.c | ||
| 161 | conf_sap.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 162 | conf_sap.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 163 | conf_sap.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 164 | conf_sap.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 165 | conf_sap.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 166 | conf_sap.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 167 | conf_sap.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 168 | conf_sap.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 169 | conf_sap.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 170 | conf_sap.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 171 | conf_sap.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 172 | conf_sap.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 173 | conf_sap.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 174 | conf_sap.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 175 | conf_sap.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 176 | conf_sap.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 177 | conf_sap.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 178 | conf_sap.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 179 | conf_sap.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 180 | conf_sap.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 181 | conf_sap.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 182 | conf_sap.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 183 | conf_sap.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_sap.c | ||
diff --git a/src/lib/libcrypto/conf/README b/src/lib/libcrypto/conf/README index ca58d0240f..96e53b34ed 100644 --- a/src/lib/libcrypto/conf/README +++ b/src/lib/libcrypto/conf/README | |||
| @@ -1,8 +1,3 @@ | |||
| 1 | WARNING WARNING WARNING!!! | ||
| 2 | |||
| 3 | This stuff is experimental, may change radically or be deleted altogether | ||
| 4 | before OpenSSL 0.9.7 release. You have been warned! | ||
| 5 | |||
| 6 | Configuration modules. These are a set of modules which can perform | 1 | Configuration modules. These are a set of modules which can perform |
| 7 | various configuration functions. | 2 | various configuration functions. |
| 8 | 3 | ||
| @@ -13,7 +8,7 @@ The routines read a configuration file set up like this: | |||
| 13 | 8 | ||
| 14 | ----- | 9 | ----- |
| 15 | #default section | 10 | #default section |
| 16 | openssl_init=init_section | 11 | openssl_conf=init_section |
| 17 | 12 | ||
| 18 | [init_section] | 13 | [init_section] |
| 19 | 14 | ||
| @@ -30,29 +25,27 @@ path=/some/path/to/some/dso.so | |||
| 30 | other_stuff=other_value | 25 | other_stuff=other_value |
| 31 | ---- | 26 | ---- |
| 32 | 27 | ||
| 33 | When this file is loaded a configuration module with the specified | 28 | When this file is loaded a configuration module with the specified string |
| 34 | string (module* in the above example) is looked up and its init | 29 | (module* in the above example) is looked up and its init function called as: |
| 35 | function called as: | ||
| 36 | 30 | ||
| 37 | int conf_init_func(CONF_IMODULE *md, CONF *cnf); | 31 | int conf_init_func(CONF_IMODULE *md, CONF *cnf); |
| 38 | 32 | ||
| 39 | The function can then take whatever action is appropriate, for example | 33 | The function can then take whatever action is appropriate, for example further |
| 40 | further lookups based on the value. Multiple instances of the same | 34 | lookups based on the value. Multiple instances of the same config module can be |
| 41 | config module can be loaded. | 35 | loaded. |
| 42 | 36 | ||
| 43 | When the application closes down the modules are cleaned up by calling | 37 | When the application closes down the modules are cleaned up by calling an |
| 44 | an optional finish function: | 38 | optional finish function: |
| 45 | 39 | ||
| 46 | void conf_finish_func(CONF_IMODULE *md); | 40 | void conf_finish_func(CONF_IMODULE *md); |
| 47 | 41 | ||
| 48 | The finish functions are called in reverse order: that is the last module | 42 | The finish functions are called in reverse order: that is the last module |
| 49 | loaded is the first one cleaned up. | 43 | loaded is the first one cleaned up. |
| 50 | 44 | ||
| 51 | If no module exists with a given name then an attempt is made to load | 45 | If no module exists with a given name then an attempt is made to load a DSO |
| 52 | a DSO with the supplied name. This might mean that "module3" attempts | 46 | with the supplied name. This might mean that "module3" attempts to load a DSO |
| 53 | to load a DSO called libmodule3.so or module3.dll for example. An explicit | 47 | called libmodule3.so or module3.dll for example. An explicit DSO name can be |
| 54 | DSO name can be given by including a separate section as in the module4 example | 48 | given by including a separate section as in the module4 example above. |
| 55 | above. | ||
| 56 | 49 | ||
| 57 | The DSO is expected to at least contain an initialization function: | 50 | The DSO is expected to at least contain an initialization function: |
| 58 | 51 | ||
| @@ -64,15 +57,17 @@ void OPENSSL_finish(CONF_IMODULE *md); | |||
| 64 | 57 | ||
| 65 | Static modules can also be added using, | 58 | Static modules can also be added using, |
| 66 | 59 | ||
| 67 | int CONF_module_add(char *name, dso_mod_init_func *ifunc, dso_mod_finish_func *ffunc); | 60 | int CONF_module_add(char *name, dso_mod_init_func *ifunc, dso_mod_finish_func |
| 61 | *ffunc); | ||
| 68 | 62 | ||
| 69 | where "name" is the name in the configuration file this function corresponds to. | 63 | where "name" is the name in the configuration file this function corresponds |
| 64 | to. | ||
| 70 | 65 | ||
| 71 | A set of builtin modules (currently only an ASN1 non functional test module) can be | 66 | A set of builtin modules (currently only an ASN1 non functional test module) |
| 72 | added by calling OPENSSL_load_builtin_modules(). | 67 | can be added by calling OPENSSL_load_builtin_modules(). |
| 73 | 68 | ||
| 74 | The function OPENSSL_config() is intended as a simple configuration function that | 69 | The function OPENSSL_config() is intended as a simple configuration function |
| 75 | any application can call to perform various default configuration tasks. It uses the | 70 | that any application can call to perform various default configuration tasks. |
| 76 | file openssl.cnf in the usual locations. | 71 | It uses the file openssl.cnf in the usual locations. |
| 77 | 72 | ||
| 78 | 73 | ||
diff --git a/src/lib/libcrypto/conf/conf.h b/src/lib/libcrypto/conf/conf.h index 8aa06bc5ec..c2199978a3 100644 --- a/src/lib/libcrypto/conf/conf.h +++ b/src/lib/libcrypto/conf/conf.h | |||
| @@ -79,8 +79,7 @@ typedef struct | |||
| 79 | } CONF_VALUE; | 79 | } CONF_VALUE; |
| 80 | 80 | ||
| 81 | DECLARE_STACK_OF(CONF_VALUE) | 81 | DECLARE_STACK_OF(CONF_VALUE) |
| 82 | DECLARE_STACK_OF(CONF_MODULE) | 82 | DECLARE_LHASH_OF(CONF_VALUE); |
| 83 | DECLARE_STACK_OF(CONF_IMODULE) | ||
| 84 | 83 | ||
| 85 | struct conf_st; | 84 | struct conf_st; |
| 86 | struct conf_method_st; | 85 | struct conf_method_st; |
| @@ -105,6 +104,9 @@ struct conf_method_st | |||
| 105 | typedef struct conf_imodule_st CONF_IMODULE; | 104 | typedef struct conf_imodule_st CONF_IMODULE; |
| 106 | typedef struct conf_module_st CONF_MODULE; | 105 | typedef struct conf_module_st CONF_MODULE; |
| 107 | 106 | ||
| 107 | DECLARE_STACK_OF(CONF_MODULE) | ||
| 108 | DECLARE_STACK_OF(CONF_IMODULE) | ||
| 109 | |||
| 108 | /* DSO module function typedefs */ | 110 | /* DSO module function typedefs */ |
| 109 | typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf); | 111 | typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf); |
| 110 | typedef void conf_finish_func(CONF_IMODULE *md); | 112 | typedef void conf_finish_func(CONF_IMODULE *md); |
| @@ -117,18 +119,23 @@ typedef void conf_finish_func(CONF_IMODULE *md); | |||
| 117 | #define CONF_MFLAGS_DEFAULT_SECTION 0x20 | 119 | #define CONF_MFLAGS_DEFAULT_SECTION 0x20 |
| 118 | 120 | ||
| 119 | int CONF_set_default_method(CONF_METHOD *meth); | 121 | int CONF_set_default_method(CONF_METHOD *meth); |
| 120 | void CONF_set_nconf(CONF *conf,LHASH *hash); | 122 | void CONF_set_nconf(CONF *conf,LHASH_OF(CONF_VALUE) *hash); |
| 121 | LHASH *CONF_load(LHASH *conf,const char *file,long *eline); | 123 | LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf,const char *file, |
| 124 | long *eline); | ||
| 122 | #ifndef OPENSSL_NO_FP_API | 125 | #ifndef OPENSSL_NO_FP_API |
| 123 | LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline); | 126 | LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, |
| 127 | long *eline); | ||
| 124 | #endif | 128 | #endif |
| 125 | LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline); | 129 | LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,long *eline); |
| 126 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section); | 130 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, |
| 127 | char *CONF_get_string(LHASH *conf,const char *group,const char *name); | 131 | const char *section); |
| 128 | long CONF_get_number(LHASH *conf,const char *group,const char *name); | 132 | char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group, |
| 129 | void CONF_free(LHASH *conf); | 133 | const char *name); |
| 130 | int CONF_dump_fp(LHASH *conf, FILE *out); | 134 | long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group, |
| 131 | int CONF_dump_bio(LHASH *conf, BIO *out); | 135 | const char *name); |
| 136 | void CONF_free(LHASH_OF(CONF_VALUE) *conf); | ||
| 137 | int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); | ||
| 138 | int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); | ||
| 132 | 139 | ||
| 133 | void OPENSSL_config(const char *config_name); | 140 | void OPENSSL_config(const char *config_name); |
| 134 | void OPENSSL_no_config(void); | 141 | void OPENSSL_no_config(void); |
| @@ -140,7 +147,7 @@ struct conf_st | |||
| 140 | { | 147 | { |
| 141 | CONF_METHOD *meth; | 148 | CONF_METHOD *meth; |
| 142 | void *meth_data; | 149 | void *meth_data; |
| 143 | LHASH *data; | 150 | LHASH_OF(CONF_VALUE) *data; |
| 144 | }; | 151 | }; |
| 145 | 152 | ||
| 146 | CONF *NCONF_new(CONF_METHOD *meth); | 153 | CONF *NCONF_new(CONF_METHOD *meth); |
| @@ -214,6 +221,7 @@ void ERR_load_CONF_strings(void); | |||
| 214 | #define CONF_F_CONF_LOAD_BIO 102 | 221 | #define CONF_F_CONF_LOAD_BIO 102 |
| 215 | #define CONF_F_CONF_LOAD_FP 103 | 222 | #define CONF_F_CONF_LOAD_FP 103 |
| 216 | #define CONF_F_CONF_MODULES_LOAD 116 | 223 | #define CONF_F_CONF_MODULES_LOAD 116 |
| 224 | #define CONF_F_CONF_PARSE_LIST 119 | ||
| 217 | #define CONF_F_DEF_LOAD 120 | 225 | #define CONF_F_DEF_LOAD 120 |
| 218 | #define CONF_F_DEF_LOAD_BIO 121 | 226 | #define CONF_F_DEF_LOAD_BIO 121 |
| 219 | #define CONF_F_MODULE_INIT 115 | 227 | #define CONF_F_MODULE_INIT 115 |
| @@ -233,6 +241,7 @@ void ERR_load_CONF_strings(void); | |||
| 233 | 241 | ||
| 234 | /* Reason codes. */ | 242 | /* Reason codes. */ |
| 235 | #define CONF_R_ERROR_LOADING_DSO 110 | 243 | #define CONF_R_ERROR_LOADING_DSO 110 |
| 244 | #define CONF_R_LIST_CANNOT_BE_NULL 115 | ||
| 236 | #define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 | 245 | #define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 |
| 237 | #define CONF_R_MISSING_EQUAL_SIGN 101 | 246 | #define CONF_R_MISSING_EQUAL_SIGN 101 |
| 238 | #define CONF_R_MISSING_FINISH_FUNCTION 111 | 247 | #define CONF_R_MISSING_FINISH_FUNCTION 111 |
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c index 909d72b4b8..22617e5fa1 100644 --- a/src/lib/libcrypto/conf/conf_api.c +++ b/src/lib/libcrypto/conf/conf_api.c | |||
| @@ -69,16 +69,12 @@ | |||
| 69 | #include <openssl/conf_api.h> | 69 | #include <openssl/conf_api.h> |
| 70 | #include "e_os.h" | 70 | #include "e_os.h" |
| 71 | 71 | ||
| 72 | static void value_free_hash(CONF_VALUE *a, LHASH *conf); | 72 | static void value_free_hash_doall_arg(CONF_VALUE *a, |
| 73 | static void value_free_stack(CONF_VALUE *a,LHASH *conf); | 73 | LHASH_OF(CONF_VALUE) *conf); |
| 74 | static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE *, LHASH *) | 74 | static void value_free_stack_doall(CONF_VALUE *a); |
| 75 | static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_stack, CONF_VALUE *, LHASH *) | 75 | static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE, |
| 76 | /* We don't use function pointer casting or wrapper functions - but cast each | 76 | LHASH_OF(CONF_VALUE)) |
| 77 | * callback parameter inside the callback functions. */ | 77 | static IMPLEMENT_LHASH_DOALL_FN(value_free_stack, CONF_VALUE) |
| 78 | /* static unsigned long hash(CONF_VALUE *v); */ | ||
| 79 | static unsigned long hash(const void *v_void); | ||
| 80 | /* static int cmp_conf(CONF_VALUE *a,CONF_VALUE *b); */ | ||
| 81 | static int cmp_conf(const void *a_void,const void *b_void); | ||
| 82 | 78 | ||
| 83 | /* Up until OpenSSL 0.9.5a, this was get_section */ | 79 | /* Up until OpenSSL 0.9.5a, this was get_section */ |
| 84 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section) | 80 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section) |
| @@ -88,7 +84,7 @@ CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section) | |||
| 88 | if ((conf == NULL) || (section == NULL)) return(NULL); | 84 | if ((conf == NULL) || (section == NULL)) return(NULL); |
| 89 | vv.name=NULL; | 85 | vv.name=NULL; |
| 90 | vv.section=(char *)section; | 86 | vv.section=(char *)section; |
| 91 | v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); | 87 | v=lh_CONF_VALUE_retrieve(conf->data,&vv); |
| 92 | return(v); | 88 | return(v); |
| 93 | } | 89 | } |
| 94 | 90 | ||
| @@ -118,7 +114,7 @@ int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) | |||
| 118 | return 0; | 114 | return 0; |
| 119 | } | 115 | } |
| 120 | 116 | ||
| 121 | v = (CONF_VALUE *)lh_insert(conf->data, value); | 117 | v = lh_CONF_VALUE_insert(conf->data, value); |
| 122 | if (v != NULL) | 118 | if (v != NULL) |
| 123 | { | 119 | { |
| 124 | (void)sk_CONF_VALUE_delete_ptr(ts,v); | 120 | (void)sk_CONF_VALUE_delete_ptr(ts,v); |
| @@ -141,24 +137,24 @@ char *_CONF_get_string(const CONF *conf, const char *section, const char *name) | |||
| 141 | { | 137 | { |
| 142 | vv.name=(char *)name; | 138 | vv.name=(char *)name; |
| 143 | vv.section=(char *)section; | 139 | vv.section=(char *)section; |
| 144 | v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); | 140 | v=lh_CONF_VALUE_retrieve(conf->data,&vv); |
| 145 | if (v != NULL) return(v->value); | 141 | if (v != NULL) return(v->value); |
| 146 | if (strcmp(section,"ENV") == 0) | 142 | if (strcmp(section,"ENV") == 0) |
| 147 | { | 143 | { |
| 148 | p=Getenv(name); | 144 | p=getenv(name); |
| 149 | if (p != NULL) return(p); | 145 | if (p != NULL) return(p); |
| 150 | } | 146 | } |
| 151 | } | 147 | } |
| 152 | vv.section="default"; | 148 | vv.section="default"; |
| 153 | vv.name=(char *)name; | 149 | vv.name=(char *)name; |
| 154 | v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); | 150 | v=lh_CONF_VALUE_retrieve(conf->data,&vv); |
| 155 | if (v != NULL) | 151 | if (v != NULL) |
| 156 | return(v->value); | 152 | return(v->value); |
| 157 | else | 153 | else |
| 158 | return(NULL); | 154 | return(NULL); |
| 159 | } | 155 | } |
| 160 | else | 156 | else |
| 161 | return(Getenv(name)); | 157 | return(getenv(name)); |
| 162 | } | 158 | } |
| 163 | 159 | ||
| 164 | #if 0 /* There's no way to provide error checking with this function, so | 160 | #if 0 /* There's no way to provide error checking with this function, so |
| @@ -182,6 +178,34 @@ long _CONF_get_number(CONF *conf, char *section, char *name) | |||
| 182 | } | 178 | } |
| 183 | #endif | 179 | #endif |
| 184 | 180 | ||
| 181 | static unsigned long conf_value_hash(const CONF_VALUE *v) | ||
| 182 | { | ||
| 183 | return (lh_strhash(v->section)<<2)^lh_strhash(v->name); | ||
| 184 | } | ||
| 185 | static IMPLEMENT_LHASH_HASH_FN(conf_value, CONF_VALUE) | ||
| 186 | |||
| 187 | static int conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b) | ||
| 188 | { | ||
| 189 | int i; | ||
| 190 | |||
| 191 | if (a->section != b->section) | ||
| 192 | { | ||
| 193 | i=strcmp(a->section,b->section); | ||
| 194 | if (i) return(i); | ||
| 195 | } | ||
| 196 | |||
| 197 | if ((a->name != NULL) && (b->name != NULL)) | ||
| 198 | { | ||
| 199 | i=strcmp(a->name,b->name); | ||
| 200 | return(i); | ||
| 201 | } | ||
| 202 | else if (a->name == b->name) | ||
| 203 | return(0); | ||
| 204 | else | ||
| 205 | return((a->name == NULL)?-1:1); | ||
| 206 | } | ||
| 207 | static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE) | ||
| 208 | |||
| 185 | int _CONF_new_data(CONF *conf) | 209 | int _CONF_new_data(CONF *conf) |
| 186 | { | 210 | { |
| 187 | if (conf == NULL) | 211 | if (conf == NULL) |
| @@ -189,7 +213,7 @@ int _CONF_new_data(CONF *conf) | |||
| 189 | return 0; | 213 | return 0; |
| 190 | } | 214 | } |
| 191 | if (conf->data == NULL) | 215 | if (conf->data == NULL) |
| 192 | if ((conf->data = lh_new(hash, cmp_conf)) == NULL) | 216 | if ((conf->data = lh_CONF_VALUE_new()) == NULL) |
| 193 | { | 217 | { |
| 194 | return 0; | 218 | return 0; |
| 195 | } | 219 | } |
| @@ -200,105 +224,73 @@ void _CONF_free_data(CONF *conf) | |||
| 200 | { | 224 | { |
| 201 | if (conf == NULL || conf->data == NULL) return; | 225 | if (conf == NULL || conf->data == NULL) return; |
| 202 | 226 | ||
| 203 | conf->data->down_load=0; /* evil thing to make sure the 'OPENSSL_free()' | 227 | lh_CONF_VALUE_down_load(conf->data)=0; /* evil thing to make |
| 204 | * works as expected */ | 228 | * sure the 'OPENSSL_free()' works as |
| 205 | lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(value_free_hash), | 229 | * expected */ |
| 206 | conf->data); | 230 | lh_CONF_VALUE_doall_arg(conf->data, |
| 231 | LHASH_DOALL_ARG_FN(value_free_hash), | ||
| 232 | LHASH_OF(CONF_VALUE), conf->data); | ||
| 207 | 233 | ||
| 208 | /* We now have only 'section' entries in the hash table. | 234 | /* We now have only 'section' entries in the hash table. |
| 209 | * Due to problems with */ | 235 | * Due to problems with */ |
| 210 | 236 | ||
| 211 | lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(value_free_stack), | 237 | lh_CONF_VALUE_doall(conf->data, LHASH_DOALL_FN(value_free_stack)); |
| 212 | conf->data); | 238 | lh_CONF_VALUE_free(conf->data); |
| 213 | lh_free(conf->data); | ||
| 214 | } | 239 | } |
| 215 | 240 | ||
| 216 | static void value_free_hash(CONF_VALUE *a, LHASH *conf) | 241 | static void value_free_hash_doall_arg(CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf) |
| 217 | { | 242 | { |
| 218 | if (a->name != NULL) | 243 | if (a->name != NULL) |
| 219 | { | 244 | (void)lh_CONF_VALUE_delete(conf,a); |
| 220 | a=(CONF_VALUE *)lh_delete(conf,a); | ||
| 221 | } | ||
| 222 | } | 245 | } |
| 223 | 246 | ||
| 224 | static void value_free_stack(CONF_VALUE *a, LHASH *conf) | 247 | static void value_free_stack_doall(CONF_VALUE *a) |
| 225 | { | 248 | { |
| 226 | CONF_VALUE *vv; | 249 | CONF_VALUE *vv; |
| 227 | STACK *sk; | 250 | STACK_OF(CONF_VALUE) *sk; |
| 228 | int i; | 251 | int i; |
| 229 | 252 | ||
| 230 | if (a->name != NULL) return; | 253 | if (a->name != NULL) return; |
| 231 | 254 | ||
| 232 | sk=(STACK *)a->value; | 255 | sk=(STACK_OF(CONF_VALUE) *)a->value; |
| 233 | for (i=sk_num(sk)-1; i>=0; i--) | 256 | for (i=sk_CONF_VALUE_num(sk)-1; i>=0; i--) |
| 234 | { | 257 | { |
| 235 | vv=(CONF_VALUE *)sk_value(sk,i); | 258 | vv=sk_CONF_VALUE_value(sk,i); |
| 236 | OPENSSL_free(vv->value); | 259 | OPENSSL_free(vv->value); |
| 237 | OPENSSL_free(vv->name); | 260 | OPENSSL_free(vv->name); |
| 238 | OPENSSL_free(vv); | 261 | OPENSSL_free(vv); |
| 239 | } | 262 | } |
| 240 | if (sk != NULL) sk_free(sk); | 263 | if (sk != NULL) sk_CONF_VALUE_free(sk); |
| 241 | OPENSSL_free(a->section); | 264 | OPENSSL_free(a->section); |
| 242 | OPENSSL_free(a); | 265 | OPENSSL_free(a); |
| 243 | } | 266 | } |
| 244 | 267 | ||
| 245 | /* static unsigned long hash(CONF_VALUE *v) */ | ||
| 246 | static unsigned long hash(const void *v_void) | ||
| 247 | { | ||
| 248 | CONF_VALUE *v = (CONF_VALUE *)v_void; | ||
| 249 | return((lh_strhash(v->section)<<2)^lh_strhash(v->name)); | ||
| 250 | } | ||
| 251 | |||
| 252 | /* static int cmp_conf(CONF_VALUE *a, CONF_VALUE *b) */ | ||
| 253 | static int cmp_conf(const void *a_void,const void *b_void) | ||
| 254 | { | ||
| 255 | int i; | ||
| 256 | CONF_VALUE *a = (CONF_VALUE *)a_void; | ||
| 257 | CONF_VALUE *b = (CONF_VALUE *)b_void; | ||
| 258 | |||
| 259 | if (a->section != b->section) | ||
| 260 | { | ||
| 261 | i=strcmp(a->section,b->section); | ||
| 262 | if (i) return(i); | ||
| 263 | } | ||
| 264 | |||
| 265 | if ((a->name != NULL) && (b->name != NULL)) | ||
| 266 | { | ||
| 267 | i=strcmp(a->name,b->name); | ||
| 268 | return(i); | ||
| 269 | } | ||
| 270 | else if (a->name == b->name) | ||
| 271 | return(0); | ||
| 272 | else | ||
| 273 | return((a->name == NULL)?-1:1); | ||
| 274 | } | ||
| 275 | |||
| 276 | /* Up until OpenSSL 0.9.5a, this was new_section */ | 268 | /* Up until OpenSSL 0.9.5a, this was new_section */ |
| 277 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) | 269 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) |
| 278 | { | 270 | { |
| 279 | STACK *sk=NULL; | 271 | STACK_OF(CONF_VALUE) *sk=NULL; |
| 280 | int ok=0,i; | 272 | int ok=0,i; |
| 281 | CONF_VALUE *v=NULL,*vv; | 273 | CONF_VALUE *v=NULL,*vv; |
| 282 | 274 | ||
| 283 | if ((sk=sk_new_null()) == NULL) | 275 | if ((sk=sk_CONF_VALUE_new_null()) == NULL) |
| 284 | goto err; | 276 | goto err; |
| 285 | if ((v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL) | 277 | if ((v=OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL) |
| 286 | goto err; | 278 | goto err; |
| 287 | i=strlen(section)+1; | 279 | i=strlen(section)+1; |
| 288 | if ((v->section=(char *)OPENSSL_malloc(i)) == NULL) | 280 | if ((v->section=OPENSSL_malloc(i)) == NULL) |
| 289 | goto err; | 281 | goto err; |
| 290 | 282 | ||
| 291 | memcpy(v->section,section,i); | 283 | memcpy(v->section,section,i); |
| 292 | v->name=NULL; | 284 | v->name=NULL; |
| 293 | v->value=(char *)sk; | 285 | v->value=(char *)sk; |
| 294 | 286 | ||
| 295 | vv=(CONF_VALUE *)lh_insert(conf->data,v); | 287 | vv=lh_CONF_VALUE_insert(conf->data,v); |
| 296 | assert(vv == NULL); | 288 | assert(vv == NULL); |
| 297 | ok=1; | 289 | ok=1; |
| 298 | err: | 290 | err: |
| 299 | if (!ok) | 291 | if (!ok) |
| 300 | { | 292 | { |
| 301 | if (sk != NULL) sk_free(sk); | 293 | if (sk != NULL) sk_CONF_VALUE_free(sk); |
| 302 | if (v != NULL) OPENSSL_free(v); | 294 | if (v != NULL) OPENSSL_free(v); |
| 303 | v=NULL; | 295 | v=NULL; |
| 304 | } | 296 | } |
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c index d8bce8732a..0b571b0394 100644 --- a/src/lib/libcrypto/conf/conf_def.c +++ b/src/lib/libcrypto/conf/conf_def.c | |||
| @@ -129,7 +129,7 @@ static CONF *def_create(CONF_METHOD *meth) | |||
| 129 | { | 129 | { |
| 130 | CONF *ret; | 130 | CONF *ret; |
| 131 | 131 | ||
| 132 | ret = (CONF *)OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *)); | 132 | ret = OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *)); |
| 133 | if (ret) | 133 | if (ret) |
| 134 | if (meth->init(ret) == 0) | 134 | if (meth->init(ret) == 0) |
| 135 | { | 135 | { |
| @@ -145,7 +145,7 @@ static int def_init_default(CONF *conf) | |||
| 145 | return 0; | 145 | return 0; |
| 146 | 146 | ||
| 147 | conf->meth = &default_method; | 147 | conf->meth = &default_method; |
| 148 | conf->meth_data = (void *)CONF_type_default; | 148 | conf->meth_data = CONF_type_default; |
| 149 | conf->data = NULL; | 149 | conf->data = NULL; |
| 150 | 150 | ||
| 151 | return 1; | 151 | return 1; |
| @@ -722,7 +722,7 @@ static char *scan_dquote(CONF *conf, char *p) | |||
| 722 | return(p); | 722 | return(p); |
| 723 | } | 723 | } |
| 724 | 724 | ||
| 725 | static void dump_value(CONF_VALUE *a, BIO *out) | 725 | static void dump_value_doall_arg(CONF_VALUE *a, BIO *out) |
| 726 | { | 726 | { |
| 727 | if (a->name) | 727 | if (a->name) |
| 728 | BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value); | 728 | BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value); |
| @@ -730,11 +730,12 @@ static void dump_value(CONF_VALUE *a, BIO *out) | |||
| 730 | BIO_printf(out, "[[%s]]\n", a->section); | 730 | BIO_printf(out, "[[%s]]\n", a->section); |
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE *, BIO *) | 733 | static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE, BIO) |
| 734 | 734 | ||
| 735 | static int def_dump(const CONF *conf, BIO *out) | 735 | static int def_dump(const CONF *conf, BIO *out) |
| 736 | { | 736 | { |
| 737 | lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), out); | 737 | lh_CONF_VALUE_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), |
| 738 | BIO, out); | ||
| 738 | return 1; | 739 | return 1; |
| 739 | } | 740 | } |
| 740 | 741 | ||
diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c index a16a5e0bd4..25bb5dc9aa 100644 --- a/src/lib/libcrypto/conf/conf_err.c +++ b/src/lib/libcrypto/conf/conf_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/conf/conf_err.c */ | 1 | /* crypto/conf/conf_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -75,6 +75,7 @@ static ERR_STRING_DATA CONF_str_functs[]= | |||
| 75 | {ERR_FUNC(CONF_F_CONF_LOAD_BIO), "CONF_load_bio"}, | 75 | {ERR_FUNC(CONF_F_CONF_LOAD_BIO), "CONF_load_bio"}, |
| 76 | {ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"}, | 76 | {ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"}, |
| 77 | {ERR_FUNC(CONF_F_CONF_MODULES_LOAD), "CONF_modules_load"}, | 77 | {ERR_FUNC(CONF_F_CONF_MODULES_LOAD), "CONF_modules_load"}, |
| 78 | {ERR_FUNC(CONF_F_CONF_PARSE_LIST), "CONF_parse_list"}, | ||
| 78 | {ERR_FUNC(CONF_F_DEF_LOAD), "DEF_LOAD"}, | 79 | {ERR_FUNC(CONF_F_DEF_LOAD), "DEF_LOAD"}, |
| 79 | {ERR_FUNC(CONF_F_DEF_LOAD_BIO), "DEF_LOAD_BIO"}, | 80 | {ERR_FUNC(CONF_F_DEF_LOAD_BIO), "DEF_LOAD_BIO"}, |
| 80 | {ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"}, | 81 | {ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"}, |
| @@ -97,6 +98,7 @@ static ERR_STRING_DATA CONF_str_functs[]= | |||
| 97 | static ERR_STRING_DATA CONF_str_reasons[]= | 98 | static ERR_STRING_DATA CONF_str_reasons[]= |
| 98 | { | 99 | { |
| 99 | {ERR_REASON(CONF_R_ERROR_LOADING_DSO) ,"error loading dso"}, | 100 | {ERR_REASON(CONF_R_ERROR_LOADING_DSO) ,"error loading dso"}, |
| 101 | {ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) ,"list cannot be null"}, | ||
| 100 | {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET),"missing close square bracket"}, | 102 | {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET),"missing close square bracket"}, |
| 101 | {ERR_REASON(CONF_R_MISSING_EQUAL_SIGN) ,"missing equal sign"}, | 103 | {ERR_REASON(CONF_R_MISSING_EQUAL_SIGN) ,"missing equal sign"}, |
| 102 | {ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION),"missing finish function"}, | 104 | {ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION),"missing finish function"}, |
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c index 2a3399d269..54046defca 100644 --- a/src/lib/libcrypto/conf/conf_lib.c +++ b/src/lib/libcrypto/conf/conf_lib.c | |||
| @@ -69,7 +69,7 @@ static CONF_METHOD *default_CONF_method=NULL; | |||
| 69 | 69 | ||
| 70 | /* Init a 'CONF' structure from an old LHASH */ | 70 | /* Init a 'CONF' structure from an old LHASH */ |
| 71 | 71 | ||
| 72 | void CONF_set_nconf(CONF *conf, LHASH *hash) | 72 | void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash) |
| 73 | { | 73 | { |
| 74 | if (default_CONF_method == NULL) | 74 | if (default_CONF_method == NULL) |
| 75 | default_CONF_method = NCONF_default(); | 75 | default_CONF_method = NCONF_default(); |
| @@ -87,9 +87,10 @@ int CONF_set_default_method(CONF_METHOD *meth) | |||
| 87 | return 1; | 87 | return 1; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | LHASH *CONF_load(LHASH *conf, const char *file, long *eline) | 90 | LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, |
| 91 | long *eline) | ||
| 91 | { | 92 | { |
| 92 | LHASH *ltmp; | 93 | LHASH_OF(CONF_VALUE) *ltmp; |
| 93 | BIO *in=NULL; | 94 | BIO *in=NULL; |
| 94 | 95 | ||
| 95 | #ifdef OPENSSL_SYS_VMS | 96 | #ifdef OPENSSL_SYS_VMS |
| @@ -110,10 +111,11 @@ LHASH *CONF_load(LHASH *conf, const char *file, long *eline) | |||
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | #ifndef OPENSSL_NO_FP_API | 113 | #ifndef OPENSSL_NO_FP_API |
| 113 | LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline) | 114 | LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, |
| 115 | long *eline) | ||
| 114 | { | 116 | { |
| 115 | BIO *btmp; | 117 | BIO *btmp; |
| 116 | LHASH *ltmp; | 118 | LHASH_OF(CONF_VALUE) *ltmp; |
| 117 | if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { | 119 | if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { |
| 118 | CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB); | 120 | CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB); |
| 119 | return NULL; | 121 | return NULL; |
| @@ -124,7 +126,8 @@ LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline) | |||
| 124 | } | 126 | } |
| 125 | #endif | 127 | #endif |
| 126 | 128 | ||
| 127 | LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline) | 129 | LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, |
| 130 | long *eline) | ||
| 128 | { | 131 | { |
| 129 | CONF ctmp; | 132 | CONF ctmp; |
| 130 | int ret; | 133 | int ret; |
| @@ -137,7 +140,8 @@ LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline) | |||
| 137 | return NULL; | 140 | return NULL; |
| 138 | } | 141 | } |
| 139 | 142 | ||
| 140 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section) | 143 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, |
| 144 | const char *section) | ||
| 141 | { | 145 | { |
| 142 | if (conf == NULL) | 146 | if (conf == NULL) |
| 143 | { | 147 | { |
| @@ -151,7 +155,8 @@ STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section) | |||
| 151 | } | 155 | } |
| 152 | } | 156 | } |
| 153 | 157 | ||
| 154 | char *CONF_get_string(LHASH *conf,const char *group,const char *name) | 158 | char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group, |
| 159 | const char *name) | ||
| 155 | { | 160 | { |
| 156 | if (conf == NULL) | 161 | if (conf == NULL) |
| 157 | { | 162 | { |
| @@ -165,7 +170,8 @@ char *CONF_get_string(LHASH *conf,const char *group,const char *name) | |||
| 165 | } | 170 | } |
| 166 | } | 171 | } |
| 167 | 172 | ||
| 168 | long CONF_get_number(LHASH *conf,const char *group,const char *name) | 173 | long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group, |
| 174 | const char *name) | ||
| 169 | { | 175 | { |
| 170 | int status; | 176 | int status; |
| 171 | long result = 0; | 177 | long result = 0; |
| @@ -189,7 +195,7 @@ long CONF_get_number(LHASH *conf,const char *group,const char *name) | |||
| 189 | return result; | 195 | return result; |
| 190 | } | 196 | } |
| 191 | 197 | ||
| 192 | void CONF_free(LHASH *conf) | 198 | void CONF_free(LHASH_OF(CONF_VALUE) *conf) |
| 193 | { | 199 | { |
| 194 | CONF ctmp; | 200 | CONF ctmp; |
| 195 | CONF_set_nconf(&ctmp, conf); | 201 | CONF_set_nconf(&ctmp, conf); |
| @@ -197,7 +203,7 @@ void CONF_free(LHASH *conf) | |||
| 197 | } | 203 | } |
| 198 | 204 | ||
| 199 | #ifndef OPENSSL_NO_FP_API | 205 | #ifndef OPENSSL_NO_FP_API |
| 200 | int CONF_dump_fp(LHASH *conf, FILE *out) | 206 | int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out) |
| 201 | { | 207 | { |
| 202 | BIO *btmp; | 208 | BIO *btmp; |
| 203 | int ret; | 209 | int ret; |
| @@ -212,7 +218,7 @@ int CONF_dump_fp(LHASH *conf, FILE *out) | |||
| 212 | } | 218 | } |
| 213 | #endif | 219 | #endif |
| 214 | 220 | ||
| 215 | int CONF_dump_bio(LHASH *conf, BIO *out) | 221 | int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out) |
| 216 | { | 222 | { |
| 217 | CONF ctmp; | 223 | CONF ctmp; |
| 218 | CONF_set_nconf(&ctmp, conf); | 224 | CONF_set_nconf(&ctmp, conf); |
diff --git a/src/lib/libcrypto/conf/conf_mall.c b/src/lib/libcrypto/conf/conf_mall.c index 1cc1fd5534..c6f4cb2d55 100644 --- a/src/lib/libcrypto/conf/conf_mall.c +++ b/src/lib/libcrypto/conf/conf_mall.c | |||
| @@ -63,7 +63,6 @@ | |||
| 63 | #include <openssl/dso.h> | 63 | #include <openssl/dso.h> |
| 64 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 65 | #include <openssl/asn1.h> | 65 | #include <openssl/asn1.h> |
| 66 | #include <openssl/evp.h> | ||
| 67 | #ifndef OPENSSL_NO_ENGINE | 66 | #ifndef OPENSSL_NO_ENGINE |
| 68 | #include <openssl/engine.h> | 67 | #include <openssl/engine.h> |
| 69 | #endif | 68 | #endif |
| @@ -77,6 +76,5 @@ void OPENSSL_load_builtin_modules(void) | |||
| 77 | #ifndef OPENSSL_NO_ENGINE | 76 | #ifndef OPENSSL_NO_ENGINE |
| 78 | ENGINE_add_conf_module(); | 77 | ENGINE_add_conf_module(); |
| 79 | #endif | 78 | #endif |
| 80 | EVP_add_alg_module(); | ||
| 81 | } | 79 | } |
| 82 | 80 | ||
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c index ee9c677d9b..df1642a0a5 100644 --- a/src/lib/libcrypto/conf/conf_mod.c +++ b/src/lib/libcrypto/conf/conf_mod.c | |||
| @@ -582,8 +582,14 @@ int CONF_parse_list(const char *list_, int sep, int nospc, | |||
| 582 | { | 582 | { |
| 583 | int ret; | 583 | int ret; |
| 584 | const char *lstart, *tmpend, *p; | 584 | const char *lstart, *tmpend, *p; |
| 585 | lstart = list_; | ||
| 586 | 585 | ||
| 586 | if(list_ == NULL) | ||
| 587 | { | ||
| 588 | CONFerr(CONF_F_CONF_PARSE_LIST, CONF_R_LIST_CANNOT_BE_NULL); | ||
| 589 | return 0; | ||
| 590 | } | ||
| 591 | |||
| 592 | lstart = list_; | ||
| 587 | for(;;) | 593 | for(;;) |
| 588 | { | 594 | { |
| 589 | if (nospc) | 595 | if (nospc) |
diff --git a/src/lib/libcrypto/cpt_err.c b/src/lib/libcrypto/cpt_err.c index 9fd41fff8c..139b9284e4 100644 --- a/src/lib/libcrypto/cpt_err.c +++ b/src/lib/libcrypto/cpt_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/cpt_err.c */ | 1 | /* crypto/cpt_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c index 8f9e88e403..b4449b86d6 100644 --- a/src/lib/libcrypto/cryptlib.c +++ b/src/lib/libcrypto/cryptlib.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/cryptlib.c */ | 1 | /* crypto/cryptlib.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -121,17 +121,279 @@ | |||
| 121 | static double SSLeay_MSVC5_hack=0.0; /* and for VC1.5 */ | 121 | static double SSLeay_MSVC5_hack=0.0; /* and for VC1.5 */ |
| 122 | #endif | 122 | #endif |
| 123 | 123 | ||
| 124 | DECLARE_STACK_OF(CRYPTO_dynlock) | ||
| 125 | |||
| 126 | /* real #defines in crypto.h, keep these upto date */ | ||
| 127 | static const char* const lock_names[CRYPTO_NUM_LOCKS] = | ||
| 128 | { | ||
| 129 | "<<ERROR>>", | ||
| 130 | "err", | ||
| 131 | "ex_data", | ||
| 132 | "x509", | ||
| 133 | "x509_info", | ||
| 134 | "x509_pkey", | ||
| 135 | "x509_crl", | ||
| 136 | "x509_req", | ||
| 137 | "dsa", | ||
| 138 | "rsa", | ||
| 139 | "evp_pkey", | ||
| 140 | "x509_store", | ||
| 141 | "ssl_ctx", | ||
| 142 | "ssl_cert", | ||
| 143 | "ssl_session", | ||
| 144 | "ssl_sess_cert", | ||
| 145 | "ssl", | ||
| 146 | "ssl_method", | ||
| 147 | "rand", | ||
| 148 | "rand2", | ||
| 149 | "debug_malloc", | ||
| 150 | "BIO", | ||
| 151 | "gethostbyname", | ||
| 152 | "getservbyname", | ||
| 153 | "readdir", | ||
| 154 | "RSA_blinding", | ||
| 155 | "dh", | ||
| 156 | "debug_malloc2", | ||
| 157 | "dso", | ||
| 158 | "dynlock", | ||
| 159 | "engine", | ||
| 160 | "ui", | ||
| 161 | "ecdsa", | ||
| 162 | "ec", | ||
| 163 | "ecdh", | ||
| 164 | "bn", | ||
| 165 | "ec_pre_comp", | ||
| 166 | "store", | ||
| 167 | "comp", | ||
| 168 | "fips", | ||
| 169 | "fips2", | ||
| 170 | #if CRYPTO_NUM_LOCKS != 41 | ||
| 171 | # error "Inconsistency between crypto.h and cryptlib.c" | ||
| 172 | #endif | ||
| 173 | }; | ||
| 174 | |||
| 175 | /* This is for applications to allocate new type names in the non-dynamic | ||
| 176 | array of lock names. These are numbered with positive numbers. */ | ||
| 177 | static STACK_OF(OPENSSL_STRING) *app_locks=NULL; | ||
| 178 | |||
| 179 | /* For applications that want a more dynamic way of handling threads, the | ||
| 180 | following stack is used. These are externally numbered with negative | ||
| 181 | numbers. */ | ||
| 182 | static STACK_OF(CRYPTO_dynlock) *dyn_locks=NULL; | ||
| 183 | |||
| 184 | |||
| 124 | static void (MS_FAR *locking_callback)(int mode,int type, | 185 | static void (MS_FAR *locking_callback)(int mode,int type, |
| 125 | const char *file,int line)=NULL; | 186 | const char *file,int line)=0; |
| 126 | static int (MS_FAR *add_lock_callback)(int *pointer,int amount, | 187 | static int (MS_FAR *add_lock_callback)(int *pointer,int amount, |
| 127 | int type,const char *file,int line)=NULL; | 188 | int type,const char *file,int line)=0; |
| 128 | static unsigned long (MS_FAR *id_callback)(void)=NULL; | 189 | #ifndef OPENSSL_NO_DEPRECATED |
| 190 | static unsigned long (MS_FAR *id_callback)(void)=0; | ||
| 191 | #endif | ||
| 192 | static void (MS_FAR *threadid_callback)(CRYPTO_THREADID *)=0; | ||
| 193 | static struct CRYPTO_dynlock_value *(MS_FAR *dynlock_create_callback) | ||
| 194 | (const char *file,int line)=0; | ||
| 195 | static void (MS_FAR *dynlock_lock_callback)(int mode, | ||
| 196 | struct CRYPTO_dynlock_value *l, const char *file,int line)=0; | ||
| 197 | static void (MS_FAR *dynlock_destroy_callback)(struct CRYPTO_dynlock_value *l, | ||
| 198 | const char *file,int line)=0; | ||
| 199 | |||
| 200 | int CRYPTO_get_new_lockid(char *name) | ||
| 201 | { | ||
| 202 | char *str; | ||
| 203 | int i; | ||
| 204 | |||
| 205 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) | ||
| 206 | /* A hack to make Visual C++ 5.0 work correctly when linking as | ||
| 207 | * a DLL using /MT. Without this, the application cannot use | ||
| 208 | * any floating point printf's. | ||
| 209 | * It also seems to be needed for Visual C 1.5 (win16) */ | ||
| 210 | SSLeay_MSVC5_hack=(double)name[0]*(double)name[1]; | ||
| 211 | #endif | ||
| 212 | |||
| 213 | if ((app_locks == NULL) && ((app_locks=sk_OPENSSL_STRING_new_null()) == NULL)) | ||
| 214 | { | ||
| 215 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_LOCKID,ERR_R_MALLOC_FAILURE); | ||
| 216 | return(0); | ||
| 217 | } | ||
| 218 | if ((str=BUF_strdup(name)) == NULL) | ||
| 219 | { | ||
| 220 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_LOCKID,ERR_R_MALLOC_FAILURE); | ||
| 221 | return(0); | ||
| 222 | } | ||
| 223 | i=sk_OPENSSL_STRING_push(app_locks,str); | ||
| 224 | if (!i) | ||
| 225 | OPENSSL_free(str); | ||
| 226 | else | ||
| 227 | i+=CRYPTO_NUM_LOCKS; /* gap of one :-) */ | ||
| 228 | return(i); | ||
| 229 | } | ||
| 129 | 230 | ||
| 130 | int CRYPTO_num_locks(void) | 231 | int CRYPTO_num_locks(void) |
| 131 | { | 232 | { |
| 132 | return CRYPTO_NUM_LOCKS; | 233 | return CRYPTO_NUM_LOCKS; |
| 133 | } | 234 | } |
| 134 | 235 | ||
| 236 | int CRYPTO_get_new_dynlockid(void) | ||
| 237 | { | ||
| 238 | int i = 0; | ||
| 239 | CRYPTO_dynlock *pointer = NULL; | ||
| 240 | |||
| 241 | if (dynlock_create_callback == NULL) | ||
| 242 | { | ||
| 243 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK); | ||
| 244 | return(0); | ||
| 245 | } | ||
| 246 | CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); | ||
| 247 | if ((dyn_locks == NULL) | ||
| 248 | && ((dyn_locks=sk_CRYPTO_dynlock_new_null()) == NULL)) | ||
| 249 | { | ||
| 250 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 251 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE); | ||
| 252 | return(0); | ||
| 253 | } | ||
| 254 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 255 | |||
| 256 | pointer = (CRYPTO_dynlock *)OPENSSL_malloc(sizeof(CRYPTO_dynlock)); | ||
| 257 | if (pointer == NULL) | ||
| 258 | { | ||
| 259 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE); | ||
| 260 | return(0); | ||
| 261 | } | ||
| 262 | pointer->references = 1; | ||
| 263 | pointer->data = dynlock_create_callback(__FILE__,__LINE__); | ||
| 264 | if (pointer->data == NULL) | ||
| 265 | { | ||
| 266 | OPENSSL_free(pointer); | ||
| 267 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE); | ||
| 268 | return(0); | ||
| 269 | } | ||
| 270 | |||
| 271 | CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); | ||
| 272 | /* First, try to find an existing empty slot */ | ||
| 273 | i=sk_CRYPTO_dynlock_find(dyn_locks,NULL); | ||
| 274 | /* If there was none, push, thereby creating a new one */ | ||
| 275 | if (i == -1) | ||
| 276 | /* Since sk_push() returns the number of items on the | ||
| 277 | stack, not the location of the pushed item, we need | ||
| 278 | to transform the returned number into a position, | ||
| 279 | by decreasing it. */ | ||
| 280 | i=sk_CRYPTO_dynlock_push(dyn_locks,pointer) - 1; | ||
| 281 | else | ||
| 282 | /* If we found a place with a NULL pointer, put our pointer | ||
| 283 | in it. */ | ||
| 284 | (void)sk_CRYPTO_dynlock_set(dyn_locks,i,pointer); | ||
| 285 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 286 | |||
| 287 | if (i == -1) | ||
| 288 | { | ||
| 289 | dynlock_destroy_callback(pointer->data,__FILE__,__LINE__); | ||
| 290 | OPENSSL_free(pointer); | ||
| 291 | } | ||
| 292 | else | ||
| 293 | i += 1; /* to avoid 0 */ | ||
| 294 | return -i; | ||
| 295 | } | ||
| 296 | |||
| 297 | void CRYPTO_destroy_dynlockid(int i) | ||
| 298 | { | ||
| 299 | CRYPTO_dynlock *pointer = NULL; | ||
| 300 | if (i) | ||
| 301 | i = -i-1; | ||
| 302 | if (dynlock_destroy_callback == NULL) | ||
| 303 | return; | ||
| 304 | |||
| 305 | CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); | ||
| 306 | |||
| 307 | if (dyn_locks == NULL || i >= sk_CRYPTO_dynlock_num(dyn_locks)) | ||
| 308 | { | ||
| 309 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 310 | return; | ||
| 311 | } | ||
| 312 | pointer = sk_CRYPTO_dynlock_value(dyn_locks, i); | ||
| 313 | if (pointer != NULL) | ||
| 314 | { | ||
| 315 | --pointer->references; | ||
| 316 | #ifdef REF_CHECK | ||
| 317 | if (pointer->references < 0) | ||
| 318 | { | ||
| 319 | fprintf(stderr,"CRYPTO_destroy_dynlockid, bad reference count\n"); | ||
| 320 | abort(); | ||
| 321 | } | ||
| 322 | else | ||
| 323 | #endif | ||
| 324 | if (pointer->references <= 0) | ||
| 325 | { | ||
| 326 | (void)sk_CRYPTO_dynlock_set(dyn_locks, i, NULL); | ||
| 327 | } | ||
| 328 | else | ||
| 329 | pointer = NULL; | ||
| 330 | } | ||
| 331 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 332 | |||
| 333 | if (pointer) | ||
| 334 | { | ||
| 335 | dynlock_destroy_callback(pointer->data,__FILE__,__LINE__); | ||
| 336 | OPENSSL_free(pointer); | ||
| 337 | } | ||
| 338 | } | ||
| 339 | |||
| 340 | struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i) | ||
| 341 | { | ||
| 342 | CRYPTO_dynlock *pointer = NULL; | ||
| 343 | if (i) | ||
| 344 | i = -i-1; | ||
| 345 | |||
| 346 | CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); | ||
| 347 | |||
| 348 | if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks)) | ||
| 349 | pointer = sk_CRYPTO_dynlock_value(dyn_locks, i); | ||
| 350 | if (pointer) | ||
| 351 | pointer->references++; | ||
| 352 | |||
| 353 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 354 | |||
| 355 | if (pointer) | ||
| 356 | return pointer->data; | ||
| 357 | return NULL; | ||
| 358 | } | ||
| 359 | |||
| 360 | struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void)) | ||
| 361 | (const char *file,int line) | ||
| 362 | { | ||
| 363 | return(dynlock_create_callback); | ||
| 364 | } | ||
| 365 | |||
| 366 | void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, | ||
| 367 | struct CRYPTO_dynlock_value *l, const char *file,int line) | ||
| 368 | { | ||
| 369 | return(dynlock_lock_callback); | ||
| 370 | } | ||
| 371 | |||
| 372 | void (*CRYPTO_get_dynlock_destroy_callback(void)) | ||
| 373 | (struct CRYPTO_dynlock_value *l, const char *file,int line) | ||
| 374 | { | ||
| 375 | return(dynlock_destroy_callback); | ||
| 376 | } | ||
| 377 | |||
| 378 | void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*func) | ||
| 379 | (const char *file, int line)) | ||
| 380 | { | ||
| 381 | dynlock_create_callback=func; | ||
| 382 | } | ||
| 383 | |||
| 384 | void CRYPTO_set_dynlock_lock_callback(void (*func)(int mode, | ||
| 385 | struct CRYPTO_dynlock_value *l, const char *file, int line)) | ||
| 386 | { | ||
| 387 | dynlock_lock_callback=func; | ||
| 388 | } | ||
| 389 | |||
| 390 | void CRYPTO_set_dynlock_destroy_callback(void (*func) | ||
| 391 | (struct CRYPTO_dynlock_value *l, const char *file, int line)) | ||
| 392 | { | ||
| 393 | dynlock_destroy_callback=func; | ||
| 394 | } | ||
| 395 | |||
| 396 | |||
| 135 | void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file, | 397 | void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file, |
| 136 | int line) | 398 | int line) |
| 137 | { | 399 | { |
| @@ -156,6 +418,108 @@ void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type, | |||
| 156 | add_lock_callback=func; | 418 | add_lock_callback=func; |
| 157 | } | 419 | } |
| 158 | 420 | ||
| 421 | /* the memset() here and in set_pointer() seem overkill, but for the sake of | ||
| 422 | * CRYPTO_THREADID_cmp() this avoids any platform silliness that might cause two | ||
| 423 | * "equal" THREADID structs to not be memcmp()-identical. */ | ||
| 424 | void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val) | ||
| 425 | { | ||
| 426 | memset(id, 0, sizeof(*id)); | ||
| 427 | id->val = val; | ||
| 428 | } | ||
| 429 | |||
| 430 | static const unsigned char hash_coeffs[] = { 3, 5, 7, 11, 13, 17, 19, 23 }; | ||
| 431 | void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr) | ||
| 432 | { | ||
| 433 | unsigned char *dest = (void *)&id->val; | ||
| 434 | unsigned int accum = 0; | ||
| 435 | unsigned char dnum = sizeof(id->val); | ||
| 436 | |||
| 437 | memset(id, 0, sizeof(*id)); | ||
| 438 | id->ptr = ptr; | ||
| 439 | if (sizeof(id->val) >= sizeof(id->ptr)) | ||
| 440 | { | ||
| 441 | /* 'ptr' can be embedded in 'val' without loss of uniqueness */ | ||
| 442 | id->val = (unsigned long)id->ptr; | ||
| 443 | return; | ||
| 444 | } | ||
| 445 | /* hash ptr ==> val. Each byte of 'val' gets the mod-256 total of a | ||
| 446 | * linear function over the bytes in 'ptr', the co-efficients of which | ||
| 447 | * are a sequence of low-primes (hash_coeffs is an 8-element cycle) - | ||
| 448 | * the starting prime for the sequence varies for each byte of 'val' | ||
| 449 | * (unique polynomials unless pointers are >64-bit). For added spice, | ||
| 450 | * the totals accumulate rather than restarting from zero, and the index | ||
| 451 | * of the 'val' byte is added each time (position dependence). If I was | ||
| 452 | * a black-belt, I'd scan big-endian pointers in reverse to give | ||
| 453 | * low-order bits more play, but this isn't crypto and I'd prefer nobody | ||
| 454 | * mistake it as such. Plus I'm lazy. */ | ||
| 455 | while (dnum--) | ||
| 456 | { | ||
| 457 | const unsigned char *src = (void *)&id->ptr; | ||
| 458 | unsigned char snum = sizeof(id->ptr); | ||
| 459 | while (snum--) | ||
| 460 | accum += *(src++) * hash_coeffs[(snum + dnum) & 7]; | ||
| 461 | accum += dnum; | ||
| 462 | *(dest++) = accum & 255; | ||
| 463 | } | ||
| 464 | } | ||
| 465 | |||
| 466 | int CRYPTO_THREADID_set_callback(void (*func)(CRYPTO_THREADID *)) | ||
| 467 | { | ||
| 468 | if (threadid_callback) | ||
| 469 | return 0; | ||
| 470 | threadid_callback = func; | ||
| 471 | return 1; | ||
| 472 | } | ||
| 473 | |||
| 474 | void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *) | ||
| 475 | { | ||
| 476 | return threadid_callback; | ||
| 477 | } | ||
| 478 | |||
| 479 | void CRYPTO_THREADID_current(CRYPTO_THREADID *id) | ||
| 480 | { | ||
| 481 | if (threadid_callback) | ||
| 482 | { | ||
| 483 | threadid_callback(id); | ||
| 484 | return; | ||
| 485 | } | ||
| 486 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 487 | /* If the deprecated callback was set, fall back to that */ | ||
| 488 | if (id_callback) | ||
| 489 | { | ||
| 490 | CRYPTO_THREADID_set_numeric(id, id_callback()); | ||
| 491 | return; | ||
| 492 | } | ||
| 493 | #endif | ||
| 494 | /* Else pick a backup */ | ||
| 495 | #ifdef OPENSSL_SYS_WIN16 | ||
| 496 | CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentTask()); | ||
| 497 | #elif defined(OPENSSL_SYS_WIN32) | ||
| 498 | CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId()); | ||
| 499 | #elif defined(OPENSSL_SYS_BEOS) | ||
| 500 | CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL)); | ||
| 501 | #else | ||
| 502 | /* For everything else, default to using the address of 'errno' */ | ||
| 503 | CRYPTO_THREADID_set_pointer(id, &errno); | ||
| 504 | #endif | ||
| 505 | } | ||
| 506 | |||
| 507 | int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b) | ||
| 508 | { | ||
| 509 | return memcmp(a, b, sizeof(*a)); | ||
| 510 | } | ||
| 511 | |||
| 512 | void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src) | ||
| 513 | { | ||
| 514 | memcpy(dest, src, sizeof(*src)); | ||
| 515 | } | ||
| 516 | |||
| 517 | unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id) | ||
| 518 | { | ||
| 519 | return id->val; | ||
| 520 | } | ||
| 521 | |||
| 522 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 159 | unsigned long (*CRYPTO_get_id_callback(void))(void) | 523 | unsigned long (*CRYPTO_get_id_callback(void))(void) |
| 160 | { | 524 | { |
| 161 | return(id_callback); | 525 | return(id_callback); |
| @@ -178,6 +542,8 @@ unsigned long CRYPTO_thread_id(void) | |||
| 178 | ret=(unsigned long)GetCurrentThreadId(); | 542 | ret=(unsigned long)GetCurrentThreadId(); |
| 179 | #elif defined(GETPID_IS_MEANINGLESS) | 543 | #elif defined(GETPID_IS_MEANINGLESS) |
| 180 | ret=1L; | 544 | ret=1L; |
| 545 | #elif defined(OPENSSL_SYS_BEOS) | ||
| 546 | ret=(unsigned long)find_thread(NULL); | ||
| 181 | #else | 547 | #else |
| 182 | ret=(unsigned long)getpid(); | 548 | ret=(unsigned long)getpid(); |
| 183 | #endif | 549 | #endif |
| @@ -186,19 +552,13 @@ unsigned long CRYPTO_thread_id(void) | |||
| 186 | ret=id_callback(); | 552 | ret=id_callback(); |
| 187 | return(ret); | 553 | return(ret); |
| 188 | } | 554 | } |
| 189 | 555 | #endif | |
| 190 | static void (*do_dynlock_cb)(int mode, int type, const char *file, int line); | ||
| 191 | |||
| 192 | void int_CRYPTO_set_do_dynlock_callback( | ||
| 193 | void (*dyn_cb)(int mode, int type, const char *file, int line)) | ||
| 194 | { | ||
| 195 | do_dynlock_cb = dyn_cb; | ||
| 196 | } | ||
| 197 | 556 | ||
| 198 | void CRYPTO_lock(int mode, int type, const char *file, int line) | 557 | void CRYPTO_lock(int mode, int type, const char *file, int line) |
| 199 | { | 558 | { |
| 200 | #ifdef LOCK_DEBUG | 559 | #ifdef LOCK_DEBUG |
| 201 | { | 560 | { |
| 561 | CRYPTO_THREADID id; | ||
| 202 | char *rw_text,*operation_text; | 562 | char *rw_text,*operation_text; |
| 203 | 563 | ||
| 204 | if (mode & CRYPTO_LOCK) | 564 | if (mode & CRYPTO_LOCK) |
| @@ -215,15 +575,25 @@ void CRYPTO_lock(int mode, int type, const char *file, int line) | |||
| 215 | else | 575 | else |
| 216 | rw_text="ERROR"; | 576 | rw_text="ERROR"; |
| 217 | 577 | ||
| 578 | CRYPTO_THREADID_current(&id); | ||
| 218 | fprintf(stderr,"lock:%08lx:(%s)%s %-18s %s:%d\n", | 579 | fprintf(stderr,"lock:%08lx:(%s)%s %-18s %s:%d\n", |
| 219 | CRYPTO_thread_id(), rw_text, operation_text, | 580 | CRYPTO_THREADID_hash(&id), rw_text, operation_text, |
| 220 | CRYPTO_get_lock_name(type), file, line); | 581 | CRYPTO_get_lock_name(type), file, line); |
| 221 | } | 582 | } |
| 222 | #endif | 583 | #endif |
| 223 | if (type < 0) | 584 | if (type < 0) |
| 224 | { | 585 | { |
| 225 | if (do_dynlock_cb) | 586 | if (dynlock_lock_callback != NULL) |
| 226 | do_dynlock_cb(mode, type, file, line); | 587 | { |
| 588 | struct CRYPTO_dynlock_value *pointer | ||
| 589 | = CRYPTO_get_dynlock_value(type); | ||
| 590 | |||
| 591 | OPENSSL_assert(pointer != NULL); | ||
| 592 | |||
| 593 | dynlock_lock_callback(mode, pointer, file, line); | ||
| 594 | |||
| 595 | CRYPTO_destroy_dynlockid(type); | ||
| 596 | } | ||
| 227 | } | 597 | } |
| 228 | else | 598 | else |
| 229 | if (locking_callback != NULL) | 599 | if (locking_callback != NULL) |
| @@ -243,11 +613,14 @@ int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, | |||
| 243 | 613 | ||
| 244 | ret=add_lock_callback(pointer,amount,type,file,line); | 614 | ret=add_lock_callback(pointer,amount,type,file,line); |
| 245 | #ifdef LOCK_DEBUG | 615 | #ifdef LOCK_DEBUG |
| 616 | { | ||
| 617 | CRYPTO_THREADID id; | ||
| 618 | CRYPTO_THREADID_current(&id); | ||
| 246 | fprintf(stderr,"ladd:%08lx:%2d+%2d->%2d %-18s %s:%d\n", | 619 | fprintf(stderr,"ladd:%08lx:%2d+%2d->%2d %-18s %s:%d\n", |
| 247 | CRYPTO_thread_id(), | 620 | CRYPTO_THREADID_hash(&id), before,amount,ret, |
| 248 | before,amount,ret, | ||
| 249 | CRYPTO_get_lock_name(type), | 621 | CRYPTO_get_lock_name(type), |
| 250 | file,line); | 622 | file,line); |
| 623 | } | ||
| 251 | #endif | 624 | #endif |
| 252 | } | 625 | } |
| 253 | else | 626 | else |
| @@ -256,11 +629,15 @@ int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, | |||
| 256 | 629 | ||
| 257 | ret= *pointer+amount; | 630 | ret= *pointer+amount; |
| 258 | #ifdef LOCK_DEBUG | 631 | #ifdef LOCK_DEBUG |
| 632 | { | ||
| 633 | CRYPTO_THREADID id; | ||
| 634 | CRYPTO_THREADID_current(&id); | ||
| 259 | fprintf(stderr,"ladd:%08lx:%2d+%2d->%2d %-18s %s:%d\n", | 635 | fprintf(stderr,"ladd:%08lx:%2d+%2d->%2d %-18s %s:%d\n", |
| 260 | CRYPTO_thread_id(), | 636 | CRYPTO_THREADID_hash(&id), |
| 261 | *pointer,amount,ret, | 637 | *pointer,amount,ret, |
| 262 | CRYPTO_get_lock_name(type), | 638 | CRYPTO_get_lock_name(type), |
| 263 | file,line); | 639 | file,line); |
| 640 | } | ||
| 264 | #endif | 641 | #endif |
| 265 | *pointer=ret; | 642 | *pointer=ret; |
| 266 | CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,file,line); | 643 | CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,file,line); |
| @@ -268,6 +645,18 @@ int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, | |||
| 268 | return(ret); | 645 | return(ret); |
| 269 | } | 646 | } |
| 270 | 647 | ||
| 648 | const char *CRYPTO_get_lock_name(int type) | ||
| 649 | { | ||
| 650 | if (type < 0) | ||
| 651 | return("dynamic"); | ||
| 652 | else if (type < CRYPTO_NUM_LOCKS) | ||
| 653 | return(lock_names[type]); | ||
| 654 | else if (type-CRYPTO_NUM_LOCKS > sk_OPENSSL_STRING_num(app_locks)) | ||
| 655 | return("ERROR"); | ||
| 656 | else | ||
| 657 | return(sk_OPENSSL_STRING_value(app_locks,type-CRYPTO_NUM_LOCKS)); | ||
| 658 | } | ||
| 659 | |||
| 271 | #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ | 660 | #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ |
| 272 | defined(__INTEL__) || \ | 661 | defined(__INTEL__) || \ |
| 273 | defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64) | 662 | defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64) |
| @@ -301,70 +690,16 @@ void OPENSSL_cpuid_setup(void) | |||
| 301 | unsigned long *OPENSSL_ia32cap_loc(void) { return NULL; } | 690 | unsigned long *OPENSSL_ia32cap_loc(void) { return NULL; } |
| 302 | #endif | 691 | #endif |
| 303 | int OPENSSL_NONPIC_relocated = 0; | 692 | int OPENSSL_NONPIC_relocated = 0; |
| 304 | #if !defined(OPENSSL_CPUID_SETUP) | 693 | #if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ) |
| 305 | void OPENSSL_cpuid_setup(void) {} | 694 | void OPENSSL_cpuid_setup(void) {} |
| 306 | #endif | 695 | #endif |
| 307 | 696 | ||
| 308 | #if (defined(_WIN32) || defined(__CYGWIN__)) && defined(_WINDLL) | 697 | #if (defined(_WIN32) || defined(__CYGWIN__)) && defined(_WINDLL) |
| 309 | |||
| 310 | #ifdef OPENSSL_FIPS | ||
| 311 | |||
| 312 | #include <tlhelp32.h> | ||
| 313 | #if defined(__GNUC__) && __GNUC__>=2 | ||
| 314 | static int DllInit(void) __attribute__((constructor)); | ||
| 315 | #elif defined(_MSC_VER) | ||
| 316 | static int DllInit(void); | ||
| 317 | # ifdef _WIN64 | ||
| 318 | # pragma section(".CRT$XCU",read) | ||
| 319 | __declspec(allocate(".CRT$XCU")) | ||
| 320 | # else | ||
| 321 | # pragma data_seg(".CRT$XCU") | ||
| 322 | # endif | ||
| 323 | static int (*p)(void) = DllInit; | ||
| 324 | # pragma data_seg() | ||
| 325 | #endif | ||
| 326 | |||
| 327 | static int DllInit(void) | ||
| 328 | { | ||
| 329 | #if defined(_WIN32_WINNT) | ||
| 330 | union { int(*f)(void); BYTE *p; } t = { DllInit }; | ||
| 331 | HANDLE hModuleSnap = INVALID_HANDLE_VALUE; | ||
| 332 | IMAGE_DOS_HEADER *dos_header; | ||
| 333 | IMAGE_NT_HEADERS *nt_headers; | ||
| 334 | MODULEENTRY32 me32 = {sizeof(me32)}; | ||
| 335 | |||
| 336 | hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,0); | ||
| 337 | if (hModuleSnap != INVALID_HANDLE_VALUE && | ||
| 338 | Module32First(hModuleSnap,&me32)) do | ||
| 339 | { | ||
| 340 | if (t.p >= me32.modBaseAddr && | ||
| 341 | t.p < me32.modBaseAddr+me32.modBaseSize) | ||
| 342 | { | ||
| 343 | dos_header=(IMAGE_DOS_HEADER *)me32.modBaseAddr; | ||
| 344 | if (dos_header->e_magic==IMAGE_DOS_SIGNATURE) | ||
| 345 | { | ||
| 346 | nt_headers=(IMAGE_NT_HEADERS *) | ||
| 347 | ((BYTE *)dos_header+dos_header->e_lfanew); | ||
| 348 | if (nt_headers->Signature==IMAGE_NT_SIGNATURE && | ||
| 349 | me32.modBaseAddr!=(BYTE*)nt_headers->OptionalHeader.ImageBase) | ||
| 350 | OPENSSL_NONPIC_relocated=1; | ||
| 351 | } | ||
| 352 | break; | ||
| 353 | } | ||
| 354 | } while (Module32Next(hModuleSnap,&me32)); | ||
| 355 | |||
| 356 | if (hModuleSnap != INVALID_HANDLE_VALUE) | ||
| 357 | CloseHandle(hModuleSnap); | ||
| 358 | #endif | ||
| 359 | OPENSSL_cpuid_setup(); | ||
| 360 | return 0; | ||
| 361 | } | ||
| 362 | |||
| 363 | #else | ||
| 364 | |||
| 365 | #ifdef __CYGWIN__ | 698 | #ifdef __CYGWIN__ |
| 366 | /* pick DLL_[PROCESS|THREAD]_[ATTACH|DETACH] definitions */ | 699 | /* pick DLL_[PROCESS|THREAD]_[ATTACH|DETACH] definitions */ |
| 367 | #include <windows.h> | 700 | #include <windows.h> |
| 701 | /* this has side-effect of _WIN32 getting defined, which otherwise | ||
| 702 | * is mutually exclusive with __CYGWIN__... */ | ||
| 368 | #endif | 703 | #endif |
| 369 | 704 | ||
| 370 | /* All we really need to do is remove the 'error' state when a thread | 705 | /* All we really need to do is remove the 'error' state when a thread |
| @@ -405,16 +740,27 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, | |||
| 405 | } | 740 | } |
| 406 | #endif | 741 | #endif |
| 407 | 742 | ||
| 408 | #endif | ||
| 409 | |||
| 410 | #if defined(_WIN32) && !defined(__CYGWIN__) | 743 | #if defined(_WIN32) && !defined(__CYGWIN__) |
| 411 | #include <tchar.h> | 744 | #include <tchar.h> |
| 745 | #include <signal.h> | ||
| 412 | 746 | ||
| 413 | #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 | 747 | #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 |
| 414 | int OPENSSL_isservice(void) | 748 | int OPENSSL_isservice(void) |
| 415 | { HWINSTA h; | 749 | { HWINSTA h; |
| 416 | DWORD len; | 750 | DWORD len; |
| 417 | WCHAR *name; | 751 | WCHAR *name; |
| 752 | static union { void *p; int (*f)(void); } _OPENSSL_isservice = { NULL }; | ||
| 753 | |||
| 754 | if (_OPENSSL_isservice.p == NULL) { | ||
| 755 | HANDLE h = GetModuleHandle(NULL); | ||
| 756 | if (h != NULL) | ||
| 757 | _OPENSSL_isservice.p = GetProcAddress(h,"_OPENSSL_isservice"); | ||
| 758 | if (_OPENSSL_isservice.p == NULL) | ||
| 759 | _OPENSSL_isservice.p = (void *)-1; | ||
| 760 | } | ||
| 761 | |||
| 762 | if (_OPENSSL_isservice.p != (void *)-1) | ||
| 763 | return (*_OPENSSL_isservice.f)(); | ||
| 418 | 764 | ||
| 419 | (void)GetDesktopWindow(); /* return value is ignored */ | 765 | (void)GetDesktopWindow(); /* return value is ignored */ |
| 420 | 766 | ||
| @@ -513,7 +859,7 @@ void OPENSSL_showfatal (const char *fmta,...) | |||
| 513 | 859 | ||
| 514 | #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 | 860 | #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 |
| 515 | /* this -------------v--- guards NT-specific calls */ | 861 | /* this -------------v--- guards NT-specific calls */ |
| 516 | if (GetVersion() < 0x80000000 && OPENSSL_isservice()) | 862 | if (GetVersion() < 0x80000000 && OPENSSL_isservice() > 0) |
| 517 | { HANDLE h = RegisterEventSource(0,_T("OPENSSL")); | 863 | { HANDLE h = RegisterEventSource(0,_T("OPENSSL")); |
| 518 | const TCHAR *pmsg=buf; | 864 | const TCHAR *pmsg=buf; |
| 519 | ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0); | 865 | ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0); |
| @@ -539,7 +885,13 @@ void OpenSSLDie(const char *file,int line,const char *assertion) | |||
| 539 | OPENSSL_showfatal( | 885 | OPENSSL_showfatal( |
| 540 | "%s(%d): OpenSSL internal error, assertion failed: %s\n", | 886 | "%s(%d): OpenSSL internal error, assertion failed: %s\n", |
| 541 | file,line,assertion); | 887 | file,line,assertion); |
| 888 | #if !defined(_WIN32) || defined(__CYGWIN__) | ||
| 542 | abort(); | 889 | abort(); |
| 890 | #else | ||
| 891 | /* Win32 abort() customarily shows a dialog, but we just did that... */ | ||
| 892 | raise(SIGABRT); | ||
| 893 | _exit(3); | ||
| 894 | #endif | ||
| 543 | } | 895 | } |
| 544 | 896 | ||
| 545 | void *OPENSSL_stderr(void) { return stderr; } | 897 | void *OPENSSL_stderr(void) { return stderr; } |
diff --git a/src/lib/libcrypto/crypto-lib.com b/src/lib/libcrypto/crypto-lib.com index 8f1c1d5a80..a4b6635091 100644 --- a/src/lib/libcrypto/crypto-lib.com +++ b/src/lib/libcrypto/crypto-lib.com | |||
| @@ -6,10 +6,11 @@ $! A-Com Computing, Inc. | |||
| 6 | $! byer@mail.all-net.net | 6 | $! byer@mail.all-net.net |
| 7 | $! | 7 | $! |
| 8 | $! Changes by Richard Levitte <richard@levitte.org> | 8 | $! Changes by Richard Levitte <richard@levitte.org> |
| 9 | $! Zoltan Arpadffy <arpadffy@polarhome.com> | ||
| 9 | $! | 10 | $! |
| 10 | $! This command files compiles and creates the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" | 11 | $! This command files compiles and creates the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" |
| 11 | $! library for OpenSSL. The "xxx" denotes the machine architecture of AXP | 12 | $! library for OpenSSL. The "xxx" denotes the machine architecture, ALPHA, |
| 12 | $! or VAX. | 13 | $! IA64 or VAX. |
| 13 | $! | 14 | $! |
| 14 | $! It was re-written so it would try to determine what "C" compiler to use | 15 | $! It was re-written so it would try to determine what "C" compiler to use |
| 15 | $! or you can specify which "C" compiler to use. | 16 | $! or you can specify which "C" compiler to use. |
| @@ -17,28 +18,28 @@ $! | |||
| 17 | $! Specify the following as P1 to build just that part or ALL to just | 18 | $! Specify the following as P1 to build just that part or ALL to just |
| 18 | $! build everything. | 19 | $! build everything. |
| 19 | $! | 20 | $! |
| 20 | $! LIBRARY To just compile the [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library. | 21 | $! LIBRARY To just compile the [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library. |
| 21 | $! APPS To just compile the [.xxx.EXE.CRYPTO]*.EXE | 22 | $! APPS To just compile the [.xxx.EXE.CRYPTO]*.EXE |
| 22 | $! ALL To do both LIBRARY and APPS | 23 | $! ALL To do both LIBRARY and APPS |
| 23 | $! | 24 | $! |
| 24 | $! Specify DEBUG or NODEBUG as P2 to compile with or without debugger | 25 | $! Specify DEBUG or NODEBUG as P2 to compile with or without debugger |
| 25 | $! information. | 26 | $! information. |
| 26 | $! | 27 | $! |
| 27 | $! Specify which compiler at P3 to try to compile under. | 28 | $! Specify which compiler at P3 to try to compile under. |
| 28 | $! | 29 | $! |
| 29 | $! VAXC For VAX C. | 30 | $! VAXC For VAX C. |
| 30 | $! DECC For DEC C. | 31 | $! DECC For DEC C. |
| 31 | $! GNUC For GNU C. | 32 | $! GNUC For GNU C. |
| 32 | $! | 33 | $! |
| 33 | $! If you don't speficy a compiler, it will try to determine which | 34 | $! If you don't specify a compiler, it will try to determine which |
| 34 | $! "C" compiler to use. | 35 | $! "C" compiler to use. |
| 35 | $! | 36 | $! |
| 36 | $! P4, if defined, sets a TCP/IP library to use, through one of the following | 37 | $! P4, if defined, sets a TCP/IP library to use, through one of the following |
| 37 | $! keywords: | 38 | $! keywords: |
| 38 | $! | 39 | $! |
| 39 | $! UCX for UCX | 40 | $! UCX For UCX |
| 40 | $! TCPIP for TCPIP (post UCX) | 41 | $! TCPIP For TCPIP (post UCX) |
| 41 | $! SOCKETSHR for SOCKETSHR+NETLIB | 42 | $! SOCKETSHR For SOCKETSHR+NETLIB |
| 42 | $! | 43 | $! |
| 43 | $! P5, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up) | 44 | $! P5, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up) |
| 44 | $! | 45 | $! |
| @@ -54,36 +55,49 @@ $ TCPIP_LIB = "" | |||
| 54 | $! | 55 | $! |
| 55 | $! Check Which Architecture We Are Using. | 56 | $! Check Which Architecture We Are Using. |
| 56 | $! | 57 | $! |
| 57 | $ IF (F$GETSYI("CPU").GE.128) | 58 | $ IF (F$GETSYI("CPU").LT.128) |
| 58 | $ THEN | 59 | $ THEN |
| 59 | $! | 60 | $! |
| 60 | $! The Architecture Is AXP | 61 | $! The Architecture Is VAX |
| 61 | $! | 62 | $! |
| 62 | $ ARCH := AXP | 63 | $ ARCH = "VAX" |
| 63 | $! | 64 | $! |
| 64 | $! Else... | 65 | $! Else... |
| 65 | $! | 66 | $! |
| 66 | $ ELSE | 67 | $ ELSE |
| 67 | $! | 68 | $! |
| 68 | $! The Architecture Is VAX. | 69 | $! The Architecture Is Alpha, IA64 or whatever comes in the future. |
| 69 | $! | 70 | $! |
| 70 | $ ARCH := VAX | 71 | $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE") |
| 72 | $ IF (ARCH .EQS. "") THEN ARCH = "UNK" | ||
| 71 | $! | 73 | $! |
| 72 | $! End The Architecture Check. | 74 | $! End The Architecture Check. |
| 73 | $! | 75 | $! |
| 74 | $ ENDIF | 76 | $ ENDIF |
| 75 | $! | 77 | $! |
| 76 | $! Define The Different Encryption Types. | 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. | ||
| 77 | $! | 82 | $! |
| 83 | $ ET_WHIRLPOOL = "WHRLPOOL" | ||
| 84 | $ IF ARCH .EQS. "VAX" THEN ET_WHIRLPOOL = "" | ||
| 78 | $ ENCRYPT_TYPES = "Basic,"+ - | 85 | $ ENCRYPT_TYPES = "Basic,"+ - |
| 79 | "OBJECTS,"+ - | 86 | "OBJECTS,"+ - |
| 80 | "MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ - | 87 | "MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ET_WHIRLPOOL+","+ - |
| 81 | "DES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,"+ - | 88 | "DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,MODES,"+ - |
| 82 | "BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,AES,"+ - | 89 | "BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,"+ - |
| 83 | "BUFFER,BIO,STACK,LHASH,RAND,ERR,"+ - | 90 | "BUFFER,BIO,STACK,LHASH,RAND,ERR,"+ - |
| 84 | "EVP,EVP_2,ASN1,ASN1_2,PEM,X509,X509V3,"+ - | 91 | "EVP,EVP_2,EVP_3,ASN1,ASN1_2,PEM,X509,X509V3,"+ - |
| 85 | "CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI,KRB5,"+ - | 92 | "CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI,KRB5,"+ - |
| 86 | "STORE,CMS,PQUEUE,JPAKE" | 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] | ||
| 87 | $! | 101 | $! |
| 88 | $! Check To Make Sure We Have Valid Command Line Parameters. | 102 | $! Check To Make Sure We Have Valid Command Line Parameters. |
| 89 | $! | 103 | $! |
| @@ -97,9 +111,6 @@ $! Tell The User What Kind of Machine We Run On. | |||
| 97 | $! | 111 | $! |
| 98 | $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine." | 112 | $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine." |
| 99 | $! | 113 | $! |
| 100 | $! Define The OBJ Directory. | ||
| 101 | $! | ||
| 102 | $ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.CRYPTO] | ||
| 103 | $! | 114 | $! |
| 104 | $! Check To See If The Architecture Specific OBJ Directory Exists. | 115 | $! Check To See If The Architecture Specific OBJ Directory Exists. |
| 105 | $! | 116 | $! |
| @@ -114,10 +125,6 @@ $! End The Architecture Specific OBJ Directory Check. | |||
| 114 | $! | 125 | $! |
| 115 | $ ENDIF | 126 | $ ENDIF |
| 116 | $! | 127 | $! |
| 117 | $! Define The EXE Directory. | ||
| 118 | $! | ||
| 119 | $ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.CRYPTO] | ||
| 120 | $! | ||
| 121 | $! Check To See If The Architecture Specific Directory Exists. | 128 | $! Check To See If The Architecture Specific Directory Exists. |
| 122 | $! | 129 | $! |
| 123 | $ IF (F$PARSE(EXE_DIR).EQS."") | 130 | $ IF (F$PARSE(EXE_DIR).EQS."") |
| @@ -161,15 +168,16 @@ $! | |||
| 161 | $ APPS_DES = "DES/DES,CBC3_ENC" | 168 | $ APPS_DES = "DES/DES,CBC3_ENC" |
| 162 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" | 169 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" |
| 163 | $ | 170 | $ |
| 164 | $ LIB_ = "cryptlib,dyn_lck,mem,mem_clr,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time,o_str,o_dir,o_init,fips_err" | 171 | $ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,cpt_err,ebcdic,uid,o_time,o_str,o_dir" |
| 165 | $ LIB_MD2 = "md2_dgst,md2_one" | 172 | $ LIB_MD2 = "md2_dgst,md2_one" |
| 166 | $ LIB_MD4 = "md4_dgst,md4_one" | 173 | $ LIB_MD4 = "md4_dgst,md4_one" |
| 167 | $ LIB_MD5 = "md5_dgst,md5_one" | 174 | $ LIB_MD5 = "md5_dgst,md5_one" |
| 168 | $ LIB_SHA = "sha_dgst,sha1dgst,sha_one,sha1_one,sha256,sha512" | 175 | $ LIB_SHA = "sha_dgst,sha1dgst,sha_one,sha1_one,sha256,sha512" |
| 169 | $ LIB_MDC2 = "mdc2dgst,mdc2_one" | 176 | $ LIB_MDC2 = "mdc2dgst,mdc2_one" |
| 170 | $ LIB_HMAC = "hmac" | 177 | $ LIB_HMAC = "hmac,hm_ameth,hm_pmeth" |
| 171 | $ LIB_RIPEMD = "rmd_dgst,rmd_one" | 178 | $ LIB_RIPEMD = "rmd_dgst,rmd_one" |
| 172 | $ LIB_DES = "des_lib,set_key,ecb_enc,cbc_enc,"+ - | 179 | $ LIB_WHRLPOOL = "wp_dgst,wp_block" |
| 180 | $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ - | ||
| 173 | "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ - | 181 | "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ - |
| 174 | "enc_read,enc_writ,ofb64enc,"+ - | 182 | "enc_read,enc_writ,ofb64enc,"+ - |
| 175 | "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ - | 183 | "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ - |
| @@ -184,36 +192,39 @@ $ LIB_BF = "bf_skey,bf_ecb,bf_enc,bf_cfb64,bf_ofb64" | |||
| 184 | $ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64" | 192 | $ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64" |
| 185 | $ LIB_CAMELLIA = "camellia,cmll_misc,cmll_ecb,cmll_cbc,cmll_ofb,"+ - | 193 | $ LIB_CAMELLIA = "camellia,cmll_misc,cmll_ecb,cmll_cbc,cmll_ofb,"+ - |
| 186 | "cmll_cfb,cmll_ctr" | 194 | "cmll_cfb,cmll_ctr" |
| 187 | $ LIB_SEED = "seed,seed_cbc,seed_ecb,seed_cfb,seed_ofb" | 195 | $ LIB_SEED = "seed,seed_ecb,seed_cbc,seed_cfb,seed_ofb" |
| 196 | $ LIB_MODES = "cbc128,ctr128,cfb128,ofb128" | ||
| 188 | $ LIB_BN_ASM = "[.asm]vms.mar,vms-helper" | 197 | $ LIB_BN_ASM = "[.asm]vms.mar,vms-helper" |
| 189 | $ IF F$TRNLNM("OPENSSL_NO_ASM").OR.ARCH.EQS."AXP" THEN LIB_BN_ASM = "bn_asm" | 198 | $ IF F$TRNLNM("OPENSSL_NO_ASM") .OR. ARCH .NES. "VAX" THEN - |
| 199 | LIB_BN_ASM = "bn_asm" | ||
| 190 | $ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ - | 200 | $ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ - |
| 191 | "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ - | 201 | "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ - |
| 192 | "bn_kron,bn_sqrt,bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+","+ - | 202 | "bn_kron,bn_sqrt,bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+","+ - |
| 193 | "bn_recp,bn_mont,bn_mpi,bn_exp2,bn_gf2m,bn_nist,"+ - | 203 | "bn_recp,bn_mont,bn_mpi,bn_exp2,bn_gf2m,bn_nist,"+ - |
| 194 | "bn_depr,bn_x931p,bn_const,bn_opt" | 204 | "bn_depr,bn_const" |
| 195 | $ LIB_EC = "ec_lib,ecp_smpl,ecp_mont,ecp_nist,ec_cvt,ec_mult,"+ - | 205 | $ LIB_EC = "ec_lib,ecp_smpl,ecp_mont,ecp_nist,ec_cvt,ec_mult,"+ - |
| 196 | "ec_err,ec_curve,ec_check,ec_print,ec_asn1,ec_key,"+ - | 206 | "ec_err,ec_curve,ec_check,ec_print,ec_asn1,ec_key,"+ - |
| 197 | "ec2_smpl,ec2_mult" | 207 | "ec2_smpl,ec2_mult,ec_ameth,ec_pmeth,eck_prn" |
| 198 | $ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ - | 208 | $ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ - |
| 199 | "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null,"+ - | 209 | "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null,"+ - |
| 200 | "rsa_pss,rsa_x931,rsa_x931g,rsa_asn1,rsa_depr,rsa_eng" | 210 | "rsa_pss,rsa_x931,rsa_asn1,rsa_depr,rsa_ameth,rsa_prn,"+ - |
| 211 | "rsa_pmeth" | ||
| 201 | $ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,"+ - | 212 | $ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,"+ - |
| 202 | "dsa_err,dsa_ossl,dsa_depr,dsa_utl" | 213 | "dsa_err,dsa_ossl,dsa_depr,dsa_ameth,dsa_pmeth,dsa_prn" |
| 203 | $ LIB_ECDSA = "ecs_lib,ecs_asn1,ecs_ossl,ecs_sign,ecs_vrf,ecs_err" | 214 | $ LIB_ECDSA = "ecs_lib,ecs_asn1,ecs_ossl,ecs_sign,ecs_vrf,ecs_err" |
| 204 | $ LIB_DH = "dh_asn1,dh_gen,dh_key,dh_lib,dh_check,dh_err,dh_depr" | 215 | $ LIB_DH = "dh_asn1,dh_gen,dh_key,dh_lib,dh_check,dh_err,dh_depr,"+ - |
| 216 | "dh_ameth,dh_pmeth,dh_prn" | ||
| 205 | $ LIB_ECDH = "ech_lib,ech_ossl,ech_key,ech_err" | 217 | $ LIB_ECDH = "ech_lib,ech_ossl,ech_key,ech_err" |
| 206 | $ LIB_DSO = "dso_dl,dso_dlfcn,dso_err,dso_lib,dso_null,"+ - | 218 | $ LIB_DSO = "dso_dl,dso_dlfcn,dso_err,dso_lib,dso_null,"+ - |
| 207 | "dso_openssl,dso_win32,dso_vms" | 219 | "dso_openssl,dso_win32,dso_vms,dso_beos" |
| 208 | $ LIB_ENGINE = "eng_err,eng_lib,eng_list,eng_init,eng_ctrl,"+ - | 220 | $ LIB_ENGINE = "eng_err,eng_lib,eng_list,eng_init,eng_ctrl,"+ - |
| 209 | "eng_table,eng_pkey,eng_fat,eng_all,"+ - | 221 | "eng_table,eng_pkey,eng_fat,eng_all,"+ - |
| 210 | "tb_rsa,tb_dsa,tb_ecdsa,tb_dh,tb_ecdh,tb_rand,tb_store,"+ - | 222 | "tb_rsa,tb_dsa,tb_ecdsa,tb_dh,tb_ecdh,tb_rand,tb_store,"+ - |
| 211 | "tb_cipher,tb_digest,"+ - | 223 | "tb_cipher,tb_digest,tb_pkmeth,tb_asnmth,"+ - |
| 212 | "eng_openssl,eng_dyn,eng_cnf,eng_cryptodev,eng_padlock"+ - | 224 | "eng_openssl,eng_dyn,eng_cnf,eng_cryptodev" |
| 213 | "eng_aesni" | 225 | $ LIB_AES = "aes_core,aes_misc,aes_ecb,aes_cbc,aes_cfb,aes_ofb,aes_ctr,"+ - |
| 214 | $ LIB_AES = "aes_core,aes_misc,aes_ecb,aes_cbc,aes_cfb,aes_ofb,"+ - | 226 | "aes_ige,aes_wrap" |
| 215 | "aes_ctr,aes_ige,aes_wrap" | 227 | $ LIB_BUFFER = "buffer,buf_err" |
| 216 | $ LIB_BUFFER = "buffer,buf_str,buf_err" | ||
| 217 | $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ - | 228 | $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ - |
| 218 | "bss_mem,bss_null,bss_fd,"+ - | 229 | "bss_mem,bss_null,bss_fd,"+ - |
| 219 | "bss_file,bss_sock,bss_conn,"+ - | 230 | "bss_file,bss_sock,bss_conn,"+ - |
| @@ -225,33 +236,34 @@ $ LIB_STACK = "stack" | |||
| 225 | $ LIB_LHASH = "lhash,lh_stats" | 236 | $ LIB_LHASH = "lhash,lh_stats" |
| 226 | $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ - | 237 | $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ - |
| 227 | "rand_vms" | 238 | "rand_vms" |
| 228 | $ LIB_ERR = "err,err_def,err_all,err_prn,err_str,err_bio" | 239 | $ LIB_ERR = "err,err_all,err_prn" |
| 229 | $ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err" | 240 | $ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err,obj_xref" |
| 230 | $ LIB_EVP = "encode,digest,dig_eng,evp_enc,evp_key,evp_acnf,evp_cnf,"+ - | 241 | $ LIB_EVP = "encode,digest,evp_enc,evp_key,evp_acnf,"+ - |
| 231 | "e_des,e_bf,e_idea,e_des3,e_camellia,"+ - | 242 | "e_des,e_bf,e_idea,e_des3,e_camellia,"+ - |
| 232 | "e_rc4,e_aes,names,e_seed,"+ - | 243 | "e_rc4,e_aes,names,e_seed,"+ - |
| 233 | "e_xcbc_d,e_rc2,e_cast,e_rc5,enc_min" | 244 | "e_xcbc_d,e_rc2,e_cast,e_rc5" |
| 234 | $ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1," + - | 245 | $ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1,m_wp," + - |
| 235 | "m_dss,m_dss1,m_mdc2,m_ripemd,m_ecdsa,"+ - | 246 | "m_dss,m_dss1,m_mdc2,m_ripemd,m_ecdsa,"+ - |
| 236 | "p_open,p_seal,p_sign,p_verify,p_lib,p_enc,p_dec,"+ - | 247 | "p_open,p_seal,p_sign,p_verify,p_lib,p_enc,p_dec,"+ - |
| 237 | "bio_md,bio_b64,bio_enc,evp_err,e_null,"+ - | 248 | "bio_md,bio_b64,bio_enc,evp_err,e_null,"+ - |
| 238 | "c_all,c_allc,c_alld,evp_lib,bio_ok,"+- | 249 | "c_all,c_allc,c_alld,evp_lib,bio_ok,"+- |
| 239 | "evp_pkey,evp_pbe,p5_crpt,p5_crpt2" | 250 | "evp_pkey,evp_pbe,p5_crpt,p5_crpt2" |
| 240 | $ LIB_EVP_3 = "e_old" | 251 | $ LIB_EVP_3 = "e_old,pmeth_lib,pmeth_fn,pmeth_gn,m_sigver" |
| 241 | $ LIB_ASN1 = "a_object,a_bitstr,a_utctm,a_gentm,a_time,a_int,a_octet,"+ - | 252 | $ LIB_ASN1 = "a_object,a_bitstr,a_utctm,a_gentm,a_time,a_int,a_octet,"+ - |
| 242 | "a_print,a_type,a_set,a_dup,a_d2i_fp,a_i2d_fp,"+ - | 253 | "a_print,a_type,a_set,a_dup,a_d2i_fp,a_i2d_fp,"+ - |
| 243 | "a_enum,a_utf8,a_sign,a_digest,a_verify,a_mbstr,a_strex,"+ - | 254 | "a_enum,a_utf8,a_sign,a_digest,a_verify,a_mbstr,a_strex,"+ - |
| 244 | "x_algor,x_val,x_pubkey,x_sig,x_req,x_attrib,x_bignum,"+ - | 255 | "x_algor,x_val,x_pubkey,x_sig,x_req,x_attrib,x_bignum,"+ - |
| 245 | "x_long,x_name,x_x509,x_x509a,x_crl,x_info,x_spki,nsseq,"+ - | 256 | "x_long,x_name,x_x509,x_x509a,x_crl,x_info,x_spki,nsseq,"+ - |
| 246 | "d2i_pu,d2i_pr,i2d_pu,i2d_pr" | 257 | "x_nx509,d2i_pu,d2i_pr,i2d_pu,i2d_pr" |
| 247 | $ LIB_ASN1_2 = "t_req,t_x509,t_x509a,t_crl,t_pkey,t_spki,t_bitst,"+ - | 258 | $ LIB_ASN1_2 = "t_req,t_x509,t_x509a,t_crl,t_pkey,t_spki,t_bitst,"+ - |
| 248 | "tasn_new,tasn_fre,tasn_enc,tasn_dec,tasn_utl,tasn_typ,"+ - | 259 | "tasn_new,tasn_fre,tasn_enc,tasn_dec,tasn_utl,tasn_typ,"+ - |
| 260 | "tasn_prn,ameth_lib,"+ - | ||
| 249 | "f_int,f_string,n_pkey,"+ - | 261 | "f_int,f_string,n_pkey,"+ - |
| 250 | "f_enum,a_hdr,x_pkey,a_bool,x_exten,asn_mime,"+ - | 262 | "f_enum,x_pkey,a_bool,x_exten,bio_asn1,bio_ndef,asn_mime,"+ - |
| 251 | "asn1_gen,asn1_par,asn1_lib,asn1_err,a_meth,a_bytes,a_strnid,"+ - | 263 | "asn1_gen,asn1_par,asn1_lib,asn1_err,a_bytes,a_strnid,"+ - |
| 252 | "evp_asn1,asn_pack,p5_pbe,p5_pbev2,p8_pkey,asn_moid" | 264 | "evp_asn1,asn_pack,p5_pbe,p5_pbev2,p8_pkey,asn_moid" |
| 253 | $ LIB_PEM = "pem_sign,pem_seal,pem_info,pem_lib,pem_all,pem_err,"+ - | 265 | $ LIB_PEM = "pem_sign,pem_seal,pem_info,pem_lib,pem_all,pem_err,"+ - |
| 254 | "pem_x509,pem_xaux,pem_oth,pem_pk8,pem_pkey" | 266 | "pem_x509,pem_xaux,pem_oth,pem_pk8,pem_pkey,pvkfmt" |
| 255 | $ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ - | 267 | $ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ - |
| 256 | "x509_obj,x509_req,x509spki,x509_vfy,"+ - | 268 | "x509_obj,x509_req,x509spki,x509_vfy,"+ - |
| 257 | "x509_set,x509cset,x509rset,x509_err,"+ - | 269 | "x509_set,x509cset,x509rset,x509_err,"+ - |
| @@ -267,7 +279,7 @@ $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ - | |||
| 267 | $ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap" | 279 | $ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap" |
| 268 | $ LIB_TXT_DB = "txt_db" | 280 | $ LIB_TXT_DB = "txt_db" |
| 269 | $ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ - | 281 | $ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ - |
| 270 | "pk7_mime" | 282 | "pk7_mime,bio_pk7" |
| 271 | $ LIB_PKCS12 = "p12_add,p12_asn,p12_attr,p12_crpt,p12_crt,p12_decr,"+ - | 283 | $ LIB_PKCS12 = "p12_add,p12_asn,p12_attr,p12_crpt,p12_crt,p12_decr,"+ - |
| 272 | "p12_init,p12_key,p12_kiss,p12_mutl,"+ - | 284 | "p12_init,p12_key,p12_kiss,p12_mutl,"+ - |
| 273 | "p12_utl,p12_npas,pk12err,p12_p8d,p12_p8e" | 285 | "p12_utl,p12_npas,pk12err,p12_p8d,p12_p8e" |
| @@ -282,6 +294,9 @@ $ LIB_STORE = "str_err,str_lib,str_meth,str_mem" | |||
| 282 | $ LIB_CMS = "cms_lib,cms_asn1,cms_att,cms_io,cms_smime,cms_err,"+ - | 294 | $ LIB_CMS = "cms_lib,cms_asn1,cms_att,cms_io,cms_smime,cms_err,"+ - |
| 283 | "cms_sd,cms_dd,cms_cd,cms_env,cms_enc,cms_ess" | 295 | "cms_sd,cms_dd,cms_cd,cms_env,cms_enc,cms_ess" |
| 284 | $ LIB_PQUEUE = "pqueue" | 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" | ||
| 285 | $ LIB_JPAKE = "jpake,jpake_err" | 300 | $ LIB_JPAKE = "jpake,jpake_err" |
| 286 | $! | 301 | $! |
| 287 | $! Setup exceptional compilations | 302 | $! Setup exceptional compilations |
| @@ -292,7 +307,7 @@ $ ! Disable the DOLLARID warning | |||
| 292 | $ COMPILEWITH_CC4 = ",a_utctm,bss_log,o_time,o_dir" | 307 | $ COMPILEWITH_CC4 = ",a_utctm,bss_log,o_time,o_dir" |
| 293 | $ ! Disable disjoint optimization | 308 | $ ! Disable disjoint optimization |
| 294 | $ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + - | 309 | $ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + - |
| 295 | "sha_dgst,sha1dgst,rmd_dgst,bf_enc," | 310 | "seed,sha_dgst,sha1dgst,rmd_dgst,bf_enc," |
| 296 | $ ! Disable the MIXLINKAGE warning | 311 | $ ! Disable the MIXLINKAGE warning |
| 297 | $ COMPILEWITH_CC6 = ",enc_read,set_key," | 312 | $ COMPILEWITH_CC6 = ",enc_read,set_key," |
| 298 | $! | 313 | $! |
| @@ -335,11 +350,11 @@ $! Create The Library and Apps Module Names. | |||
| 335 | $! | 350 | $! |
| 336 | $ LIB_MODULE = "LIB_" + MODULE_NAME | 351 | $ LIB_MODULE = "LIB_" + MODULE_NAME |
| 337 | $ APPS_MODULE = "APPS_" + MODULE_NAME | 352 | $ APPS_MODULE = "APPS_" + MODULE_NAME |
| 338 | $ IF (MODULE_NAME.EQS."ASN1_2") | 353 | $ IF (F$EXTRACT(0,5,MODULE_NAME).EQS."ASN1_") |
| 339 | $ THEN | 354 | $ THEN |
| 340 | $ MODULE_NAME = "ASN1" | 355 | $ MODULE_NAME = "ASN1" |
| 341 | $ ENDIF | 356 | $ ENDIF |
| 342 | $ IF (MODULE_NAME.EQS."EVP_2") | 357 | $ IF (F$EXTRACT(0,4,MODULE_NAME).EQS."EVP_") |
| 343 | $ THEN | 358 | $ THEN |
| 344 | $ MODULE_NAME = "EVP" | 359 | $ MODULE_NAME = "EVP" |
| 345 | $ ENDIF | 360 | $ ENDIF |
| @@ -354,7 +369,7 @@ $! | |||
| 354 | $ IF F$TYPE('LIB_MODULE') .EQS. "" | 369 | $ IF F$TYPE('LIB_MODULE') .EQS. "" |
| 355 | $ THEN | 370 | $ THEN |
| 356 | $ WRITE SYS$ERROR "" | 371 | $ WRITE SYS$ERROR "" |
| 357 | $ WRITE SYS$ERROR "The module ",MODULE_NAME," does not exist. Continuing..." | 372 | $ WRITE SYS$ERROR "The module ",MODULE_NAME1," does not exist. Continuing..." |
| 358 | $ WRITE SYS$ERROR "" | 373 | $ WRITE SYS$ERROR "" |
| 359 | $ GOTO MODULE_NEXT | 374 | $ GOTO MODULE_NEXT |
| 360 | $ ENDIF | 375 | $ ENDIF |
| @@ -695,7 +710,7 @@ $! | |||
| 695 | $ IF (F$SEARCH(OPT_FILE).EQS."") | 710 | $ IF (F$SEARCH(OPT_FILE).EQS."") |
| 696 | $ THEN | 711 | $ THEN |
| 697 | $! | 712 | $! |
| 698 | $! Figure Out If We Need An AXP Or A VAX Linker Option File. | 713 | $! Figure Out If We Need A non-VAX Or A VAX Linker Option File. |
| 699 | $! | 714 | $! |
| 700 | $ IF ARCH .EQS. "VAX" | 715 | $ IF ARCH .EQS. "VAX" |
| 701 | $ THEN | 716 | $ THEN |
| @@ -715,19 +730,19 @@ $! Else... | |||
| 715 | $! | 730 | $! |
| 716 | $ ELSE | 731 | $ ELSE |
| 717 | $! | 732 | $! |
| 718 | $! Create The AXP Linker Option File. | 733 | $! Create The non-VAX Linker Option File. |
| 719 | $! | 734 | $! |
| 720 | $ CREATE 'OPT_FILE' | 735 | $ CREATE 'OPT_FILE' |
| 721 | $DECK | 736 | $DECK |
| 722 | ! | 737 | ! |
| 723 | ! Default System Options File For AXP To Link Agianst | 738 | ! Default System Options File For non-VAX To Link Agianst |
| 724 | ! The Sharable C Runtime Library. | 739 | ! The Sharable C Runtime Library. |
| 725 | ! | 740 | ! |
| 726 | SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE | 741 | SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE |
| 727 | SYS$SHARE:CMA$OPEN_RTL/SHARE | 742 | SYS$SHARE:CMA$OPEN_RTL/SHARE |
| 728 | $EOD | 743 | $EOD |
| 729 | $! | 744 | $! |
| 730 | $! End The VAX/AXP DEC C Option File Check. | 745 | $! End The DEC C Option File Check. |
| 731 | $! | 746 | $! |
| 732 | $ ENDIF | 747 | $ ENDIF |
| 733 | $! | 748 | $! |
| @@ -764,12 +779,12 @@ $! Else... | |||
| 764 | $! | 779 | $! |
| 765 | $ ELSE | 780 | $ ELSE |
| 766 | $! | 781 | $! |
| 767 | $! Else, Check To See If P1 Has A Valid Arguement. | 782 | $! Else, Check To See If P1 Has A Valid Argument. |
| 768 | $! | 783 | $! |
| 769 | $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."APPS") | 784 | $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."APPS") |
| 770 | $ THEN | 785 | $ THEN |
| 771 | $! | 786 | $! |
| 772 | $! A Valid Arguement. | 787 | $! A Valid Argument. |
| 773 | $! | 788 | $! |
| 774 | $ BUILDALL = P1 | 789 | $ BUILDALL = P1 |
| 775 | $! | 790 | $! |
| @@ -788,15 +803,16 @@ $ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.CRYPTO]*.E | |||
| 788 | $ WRITE SYS$OUTPUT "" | 803 | $ WRITE SYS$OUTPUT "" |
| 789 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:" | 804 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:" |
| 790 | $ WRITE SYS$OUTPUT "" | 805 | $ WRITE SYS$OUTPUT "" |
| 791 | $ WRITE SYS$OUTPUT " AXP : Alpha Architecture." | 806 | $ WRITE SYS$OUTPUT " ALPHA : Alpha Architecture." |
| 792 | $ WRITE SYS$OUTPUT " VAX : VAX Architecture." | 807 | $ WRITE SYS$OUTPUT " IA64 : IA64 Architecture." |
| 808 | $ WRITE SYS$OUTPUT " VAX : VAX Architecture." | ||
| 793 | $ WRITE SYS$OUTPUT "" | 809 | $ WRITE SYS$OUTPUT "" |
| 794 | $! | 810 | $! |
| 795 | $! Time To EXIT. | 811 | $! Time To EXIT. |
| 796 | $! | 812 | $! |
| 797 | $ EXIT | 813 | $ EXIT |
| 798 | $! | 814 | $! |
| 799 | $! End The Valid Arguement Check. | 815 | $! End The Valid Argument Check. |
| 800 | $! | 816 | $! |
| 801 | $ ENDIF | 817 | $ ENDIF |
| 802 | $! | 818 | $! |
| @@ -849,7 +865,7 @@ $! Time To EXIT. | |||
| 849 | $! | 865 | $! |
| 850 | $ EXIT | 866 | $ EXIT |
| 851 | $! | 867 | $! |
| 852 | $! End The Valid Arguement Check. | 868 | $! End The Valid Argument Check. |
| 853 | $! | 869 | $! |
| 854 | $ ENDIF | 870 | $ ENDIF |
| 855 | $! | 871 | $! |
| @@ -914,7 +930,7 @@ $ ELSE | |||
| 914 | $! | 930 | $! |
| 915 | $! Check To See If We Have VAXC Or DECC. | 931 | $! Check To See If We Have VAXC Or DECC. |
| 916 | $! | 932 | $! |
| 917 | $ IF (ARCH.EQS."AXP").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."") | 933 | $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."") |
| 918 | $ THEN | 934 | $ THEN |
| 919 | $! | 935 | $! |
| 920 | $! Looks Like DECC, Set To Use DECC. | 936 | $! Looks Like DECC, Set To Use DECC. |
| @@ -1020,12 +1036,12 @@ $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - | |||
| 1020 | THEN CC = "CC/DECC" | 1036 | THEN CC = "CC/DECC" |
| 1021 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - | 1037 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - |
| 1022 | "/NOLIST/PREFIX=ALL" + - | 1038 | "/NOLIST/PREFIX=ALL" + - |
| 1023 | "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP])" + - | 1039 | "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + - |
| 1024 | CCEXTRAFLAGS | 1040 | CCEXTRAFLAGS |
| 1025 | $! | 1041 | $! |
| 1026 | $! Define The Linker Options File Name. | 1042 | $! Define The Linker Options File Name. |
| 1027 | $! | 1043 | $! |
| 1028 | $ OPT_FILE = "SYS$DISK:[]VAX_DECC_OPTIONS.OPT" | 1044 | $ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT" |
| 1029 | $! | 1045 | $! |
| 1030 | $! End DECC Check. | 1046 | $! End DECC Check. |
| 1031 | $! | 1047 | $! |
| @@ -1047,14 +1063,14 @@ $! | |||
| 1047 | $! Compile Using VAXC. | 1063 | $! Compile Using VAXC. |
| 1048 | $! | 1064 | $! |
| 1049 | $ CC = "CC" | 1065 | $ CC = "CC" |
| 1050 | $ IF ARCH.EQS."AXP" | 1066 | $ IF ARCH.NES."VAX" |
| 1051 | $ THEN | 1067 | $ THEN |
| 1052 | $ WRITE SYS$OUTPUT "There is no VAX C on Alpha!" | 1068 | $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!" |
| 1053 | $ EXIT | 1069 | $ EXIT |
| 1054 | $ ENDIF | 1070 | $ ENDIF |
| 1055 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" | 1071 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" |
| 1056 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | 1072 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - |
| 1057 | "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + - | 1073 | "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + - |
| 1058 | CCEXTRAFLAGS | 1074 | CCEXTRAFLAGS |
| 1059 | $ CCDEFS = """VAXC""," + CCDEFS | 1075 | $ CCDEFS = """VAXC""," + CCDEFS |
| 1060 | $! | 1076 | $! |
| @@ -1064,7 +1080,7 @@ $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB] | |||
| 1064 | $! | 1080 | $! |
| 1065 | $! Define The Linker Options File Name. | 1081 | $! Define The Linker Options File Name. |
| 1066 | $! | 1082 | $! |
| 1067 | $ OPT_FILE = "SYS$DISK:[]VAX_VAXC_OPTIONS.OPT" | 1083 | $ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT" |
| 1068 | $! | 1084 | $! |
| 1069 | $! End VAXC Check | 1085 | $! End VAXC Check |
| 1070 | $! | 1086 | $! |
| @@ -1086,12 +1102,12 @@ $! | |||
| 1086 | $! Use GNU C... | 1102 | $! Use GNU C... |
| 1087 | $! | 1103 | $! |
| 1088 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | 1104 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - |
| 1089 | "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + - | 1105 | "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + - |
| 1090 | CCEXTRAFLAGS | 1106 | CCEXTRAFLAGS |
| 1091 | $! | 1107 | $! |
| 1092 | $! Define The Linker Options File Name. | 1108 | $! Define The Linker Options File Name. |
| 1093 | $! | 1109 | $! |
| 1094 | $ OPT_FILE = "SYS$DISK:[]VAX_GNUC_OPTIONS.OPT" | 1110 | $ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT" |
| 1095 | $! | 1111 | $! |
| 1096 | $! End The GNU C Check. | 1112 | $! End The GNU C Check. |
| 1097 | $! | 1113 | $! |
| @@ -1136,7 +1152,7 @@ $! Show user the result | |||
| 1136 | $! | 1152 | $! |
| 1137 | $ WRITE/SYMBOL SYS$OUTPUT "Main C Compiling Command: ",CC | 1153 | $ WRITE/SYMBOL SYS$OUTPUT "Main C Compiling Command: ",CC |
| 1138 | $! | 1154 | $! |
| 1139 | $! Else The User Entered An Invalid Arguement. | 1155 | $! Else The User Entered An Invalid Argument. |
| 1140 | $! | 1156 | $! |
| 1141 | $ ELSE | 1157 | $ ELSE |
| 1142 | $! | 1158 | $! |
| @@ -1154,14 +1170,14 @@ $! Time To EXIT. | |||
| 1154 | $! | 1170 | $! |
| 1155 | $ EXIT | 1171 | $ EXIT |
| 1156 | $! | 1172 | $! |
| 1157 | $! End The Valid Arguement Check. | 1173 | $! End The Valid Argument Check. |
| 1158 | $! | 1174 | $! |
| 1159 | $ ENDIF | 1175 | $ ENDIF |
| 1160 | $! | 1176 | $! |
| 1161 | $! Build a MACRO command for the architecture at hand | 1177 | $! Build a MACRO command for the architecture at hand |
| 1162 | $! | 1178 | $! |
| 1163 | $ IF ARCH .EQS. "VAX" THEN MACRO = "MACRO/''DEBUGGER'" | 1179 | $ IF ARCH .EQS. "VAX" THEN MACRO = "MACRO/''DEBUGGER'" |
| 1164 | $ IF ARCH .EQS. "AXP" THEN MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'" | 1180 | $ IF ARCH .NES. "VAX" THEN MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'" |
| 1165 | $! | 1181 | $! |
| 1166 | $! Show user the result | 1182 | $! Show user the result |
| 1167 | $! | 1183 | $! |
| @@ -1249,7 +1265,7 @@ $! Print info | |||
| 1249 | $! | 1265 | $! |
| 1250 | $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB | 1266 | $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB |
| 1251 | $! | 1267 | $! |
| 1252 | $! Else The User Entered An Invalid Arguement. | 1268 | $! Else The User Entered An Invalid Argument. |
| 1253 | $! | 1269 | $! |
| 1254 | $ ELSE | 1270 | $ ELSE |
| 1255 | $! | 1271 | $! |
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index 0e4fb0723c..b0360cec51 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/crypto.h */ | 1 | /* crypto/crypto.h */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -219,13 +219,9 @@ typedef struct openssl_item_st | |||
| 219 | #define CRYPTO_LOCK_EC_PRE_COMP 36 | 219 | #define CRYPTO_LOCK_EC_PRE_COMP 36 |
| 220 | #define CRYPTO_LOCK_STORE 37 | 220 | #define CRYPTO_LOCK_STORE 37 |
| 221 | #define CRYPTO_LOCK_COMP 38 | 221 | #define CRYPTO_LOCK_COMP 38 |
| 222 | #ifndef OPENSSL_FIPS | ||
| 223 | #define CRYPTO_NUM_LOCKS 39 | ||
| 224 | #else | ||
| 225 | #define CRYPTO_LOCK_FIPS 39 | 222 | #define CRYPTO_LOCK_FIPS 39 |
| 226 | #define CRYPTO_LOCK_FIPS2 40 | 223 | #define CRYPTO_LOCK_FIPS2 40 |
| 227 | #define CRYPTO_NUM_LOCKS 41 | 224 | #define CRYPTO_NUM_LOCKS 41 |
| 228 | #endif | ||
| 229 | 225 | ||
| 230 | #define CRYPTO_LOCK 1 | 226 | #define CRYPTO_LOCK 1 |
| 231 | #define CRYPTO_UNLOCK 2 | 227 | #define CRYPTO_UNLOCK 2 |
| @@ -288,9 +284,10 @@ typedef struct bio_st BIO_dummy; | |||
| 288 | 284 | ||
| 289 | struct crypto_ex_data_st | 285 | struct crypto_ex_data_st |
| 290 | { | 286 | { |
| 291 | STACK *sk; | 287 | STACK_OF(void) *sk; |
| 292 | int dummy; /* gcc is screwing up this data structure :-( */ | 288 | int dummy; /* gcc is screwing up this data structure :-( */ |
| 293 | }; | 289 | }; |
| 290 | DECLARE_STACK_OF(void) | ||
| 294 | 291 | ||
| 295 | /* This stuff is basically class callback functions | 292 | /* This stuff is basically class callback functions |
| 296 | * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */ | 293 | * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */ |
| @@ -347,7 +344,14 @@ DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) | |||
| 347 | 344 | ||
| 348 | /* Set standard debugging functions (not done by default | 345 | /* Set standard debugging functions (not done by default |
| 349 | * unless CRYPTO_MDEBUG is defined) */ | 346 | * unless CRYPTO_MDEBUG is defined) */ |
| 350 | void CRYPTO_malloc_debug_init(void); | 347 | #define CRYPTO_malloc_debug_init() do {\ |
| 348 | CRYPTO_set_mem_debug_functions(\ | ||
| 349 | CRYPTO_dbg_malloc,\ | ||
| 350 | CRYPTO_dbg_realloc,\ | ||
| 351 | CRYPTO_dbg_free,\ | ||
| 352 | CRYPTO_dbg_set_options,\ | ||
| 353 | CRYPTO_dbg_get_options);\ | ||
| 354 | } while(0) | ||
| 351 | 355 | ||
| 352 | int CRYPTO_mem_ctrl(int mode); | 356 | int CRYPTO_mem_ctrl(int mode); |
| 353 | int CRYPTO_is_mem_check_on(void); | 357 | int CRYPTO_is_mem_check_on(void); |
| @@ -420,16 +424,32 @@ void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type, | |||
| 420 | const char *file, int line)); | 424 | const char *file, int line)); |
| 421 | int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type, | 425 | int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type, |
| 422 | const char *file,int line); | 426 | const char *file,int line); |
| 427 | |||
| 428 | /* Don't use this structure directly. */ | ||
| 429 | typedef struct crypto_threadid_st | ||
| 430 | { | ||
| 431 | void *ptr; | ||
| 432 | unsigned long val; | ||
| 433 | } CRYPTO_THREADID; | ||
| 434 | /* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ | ||
| 435 | void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val); | ||
| 436 | void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr); | ||
| 437 | int CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID *)); | ||
| 438 | void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *); | ||
| 439 | void CRYPTO_THREADID_current(CRYPTO_THREADID *id); | ||
| 440 | int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b); | ||
| 441 | void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src); | ||
| 442 | unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id); | ||
| 443 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 423 | void CRYPTO_set_id_callback(unsigned long (*func)(void)); | 444 | void CRYPTO_set_id_callback(unsigned long (*func)(void)); |
| 424 | unsigned long (*CRYPTO_get_id_callback(void))(void); | 445 | unsigned long (*CRYPTO_get_id_callback(void))(void); |
| 425 | unsigned long CRYPTO_thread_id(void); | 446 | unsigned long CRYPTO_thread_id(void); |
| 447 | #endif | ||
| 448 | |||
| 426 | const char *CRYPTO_get_lock_name(int type); | 449 | const char *CRYPTO_get_lock_name(int type); |
| 427 | int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, | 450 | int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, |
| 428 | int line); | 451 | int line); |
| 429 | 452 | ||
| 430 | void int_CRYPTO_set_do_dynlock_callback( | ||
| 431 | void (*do_dynlock_cb)(int mode, int type, const char *file, int line)); | ||
| 432 | |||
| 433 | int CRYPTO_get_new_dynlockid(void); | 453 | int CRYPTO_get_new_dynlockid(void); |
| 434 | void CRYPTO_destroy_dynlockid(int i); | 454 | void CRYPTO_destroy_dynlockid(int i); |
| 435 | struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); | 455 | struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); |
| @@ -454,10 +474,6 @@ int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), | |||
| 454 | void (*f)(void *,int), | 474 | void (*f)(void *,int), |
| 455 | void (*so)(long), | 475 | void (*so)(long), |
| 456 | long (*go)(void)); | 476 | long (*go)(void)); |
| 457 | void CRYPTO_set_mem_info_functions( | ||
| 458 | int (*push_info_fn)(const char *info, const char *file, int line), | ||
| 459 | int (*pop_info_fn)(void), | ||
| 460 | int (*remove_all_info_fn)(void)); | ||
| 461 | void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); | 477 | void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); |
| 462 | void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); | 478 | void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); |
| 463 | void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int), | 479 | void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int), |
| @@ -514,9 +530,6 @@ void CRYPTO_dbg_free(void *addr,int before_p); | |||
| 514 | void CRYPTO_dbg_set_options(long bits); | 530 | void CRYPTO_dbg_set_options(long bits); |
| 515 | long CRYPTO_dbg_get_options(void); | 531 | long CRYPTO_dbg_get_options(void); |
| 516 | 532 | ||
| 517 | int CRYPTO_dbg_push_info(const char *info, const char *file, int line); | ||
| 518 | int CRYPTO_dbg_pop_info(void); | ||
| 519 | int CRYPTO_dbg_remove_all_info(void); | ||
| 520 | 533 | ||
| 521 | #ifndef OPENSSL_NO_FP_API | 534 | #ifndef OPENSSL_NO_FP_API |
| 522 | void CRYPTO_mem_leaks_fp(FILE *); | 535 | void CRYPTO_mem_leaks_fp(FILE *); |
| @@ -534,69 +547,12 @@ unsigned long *OPENSSL_ia32cap_loc(void); | |||
| 534 | #define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) | 547 | #define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) |
| 535 | int OPENSSL_isservice(void); | 548 | int OPENSSL_isservice(void); |
| 536 | 549 | ||
| 537 | #ifdef OPENSSL_FIPS | ||
| 538 | #define FIPS_ERROR_IGNORED(alg) OpenSSLDie(__FILE__, __LINE__, \ | ||
| 539 | alg " previous FIPS forbidden algorithm error ignored"); | ||
| 540 | |||
| 541 | #define FIPS_BAD_ABORT(alg) OpenSSLDie(__FILE__, __LINE__, \ | ||
| 542 | #alg " Algorithm forbidden in FIPS mode"); | ||
| 543 | |||
| 544 | #ifdef OPENSSL_FIPS_STRICT | ||
| 545 | #define FIPS_BAD_ALGORITHM(alg) FIPS_BAD_ABORT(alg) | ||
| 546 | #else | ||
| 547 | #define FIPS_BAD_ALGORITHM(alg) \ | ||
| 548 | { \ | ||
| 549 | FIPSerr(FIPS_F_HASH_FINAL,FIPS_R_NON_FIPS_METHOD); \ | ||
| 550 | ERR_add_error_data(2, "Algorithm=", #alg); \ | ||
| 551 | return 0; \ | ||
| 552 | } | ||
| 553 | #endif | ||
| 554 | |||
| 555 | /* Low level digest API blocking macro */ | ||
| 556 | |||
| 557 | #define FIPS_NON_FIPS_MD_Init(alg) \ | ||
| 558 | int alg##_Init(alg##_CTX *c) \ | ||
| 559 | { \ | ||
| 560 | if (FIPS_mode()) \ | ||
| 561 | FIPS_BAD_ALGORITHM(alg) \ | ||
| 562 | return private_##alg##_Init(c); \ | ||
| 563 | } \ | ||
| 564 | int private_##alg##_Init(alg##_CTX *c) | ||
| 565 | |||
| 566 | /* For ciphers the API often varies from cipher to cipher and each needs to | ||
| 567 | * be treated as a special case. Variable key length ciphers (Blowfish, RC4, | ||
| 568 | * CAST) however are very similar and can use a blocking macro. | ||
| 569 | */ | ||
| 570 | |||
| 571 | #define FIPS_NON_FIPS_VCIPHER_Init(alg) \ | ||
| 572 | void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) \ | ||
| 573 | { \ | ||
| 574 | if (FIPS_mode()) \ | ||
| 575 | FIPS_BAD_ABORT(alg) \ | ||
| 576 | private_##alg##_set_key(key, len, data); \ | ||
| 577 | } \ | ||
| 578 | void private_##alg##_set_key(alg##_KEY *key, int len, \ | ||
| 579 | const unsigned char *data) | ||
| 580 | |||
| 581 | #else | ||
| 582 | |||
| 583 | #define FIPS_NON_FIPS_VCIPHER_Init(alg) \ | ||
| 584 | void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) | ||
| 585 | |||
| 586 | #define FIPS_NON_FIPS_MD_Init(alg) \ | ||
| 587 | int alg##_Init(alg##_CTX *c) | ||
| 588 | |||
| 589 | #endif /* def OPENSSL_FIPS */ | ||
| 590 | |||
| 591 | /* BEGIN ERROR CODES */ | 550 | /* BEGIN ERROR CODES */ |
| 592 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 551 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 593 | * made after this point may be overwritten when the script is next run. | 552 | * made after this point may be overwritten when the script is next run. |
| 594 | */ | 553 | */ |
| 595 | void ERR_load_CRYPTO_strings(void); | 554 | void ERR_load_CRYPTO_strings(void); |
| 596 | 555 | ||
| 597 | #define OPENSSL_HAVE_INIT 1 | ||
| 598 | void OPENSSL_init(void); | ||
| 599 | |||
| 600 | /* Error codes for the CRYPTO functions. */ | 556 | /* Error codes for the CRYPTO functions. */ |
| 601 | 557 | ||
| 602 | /* Function codes. */ | 558 | /* Function codes. */ |
diff --git a/src/lib/libcrypto/des/Makefile.ssl b/src/lib/libcrypto/des/Makefile.ssl deleted file mode 100644 index 0d9ba2b42f..0000000000 --- a/src/lib/libcrypto/des/Makefile.ssl +++ /dev/null | |||
| @@ -1,316 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/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 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | RANLIB= ranlib | ||
| 20 | DES_ENC= des_enc.o fcrypt_b.o | ||
| 21 | # or use | ||
| 22 | #DES_ENC= dx86-elf.o yx86-elf.o | ||
| 23 | |||
| 24 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 25 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 26 | |||
| 27 | GENERAL=Makefile | ||
| 28 | TEST=destest.c | ||
| 29 | APPS= | ||
| 30 | |||
| 31 | LIB=$(TOP)/libcrypto.a | ||
| 32 | LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ | ||
| 33 | ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \ | ||
| 34 | fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \ | ||
| 35 | qud_cksm.c rand_key.c rpc_enc.c set_key.c \ | ||
| 36 | des_enc.c fcrypt_b.c \ | ||
| 37 | xcbc_enc.c \ | ||
| 38 | str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c des_old.c des_old2.c \ | ||
| 39 | read2pwd.c | ||
| 40 | |||
| 41 | LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \ | ||
| 42 | ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \ | ||
| 43 | enc_read.o enc_writ.o ofb64enc.o \ | ||
| 44 | ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \ | ||
| 45 | ${DES_ENC} \ | ||
| 46 | fcrypt.o xcbc_enc.o rpc_enc.o cbc_cksm.o \ | ||
| 47 | ede_cbcm_enc.o des_old.o des_old2.o read2pwd.o | ||
| 48 | |||
| 49 | SRC= $(LIBSRC) | ||
| 50 | |||
| 51 | EXHEADER= des.h des_old.h | ||
| 52 | HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER) | ||
| 53 | |||
| 54 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 55 | |||
| 56 | top: | ||
| 57 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 58 | |||
| 59 | all: lib | ||
| 60 | |||
| 61 | lib: $(LIBOBJ) | ||
| 62 | $(AR) $(LIB) $(LIBOBJ) | ||
| 63 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 64 | @touch lib | ||
| 65 | |||
| 66 | des: des.o cbc3_enc.o lib | ||
| 67 | $(CC) $(CFLAGS) -o des des.o cbc3_enc.o $(LIB) | ||
| 68 | |||
| 69 | # elf | ||
| 70 | asm/dx86-elf.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 71 | (cd asm; $(PERL) des-586.pl elf $(CFLAGS) > dx86-elf.s) | ||
| 72 | |||
| 73 | asm/yx86-elf.s: asm/crypt586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 74 | (cd asm; $(PERL) crypt586.pl elf $(CFLAGS) > yx86-elf.s) | ||
| 75 | |||
| 76 | # a.out | ||
| 77 | asm/dx86-out.o: asm/dx86unix.cpp | ||
| 78 | $(CPP) -DOUT asm/dx86unix.cpp | as -o asm/dx86-out.o | ||
| 79 | |||
| 80 | asm/yx86-out.o: asm/yx86unix.cpp | ||
| 81 | $(CPP) -DOUT asm/yx86unix.cpp | as -o asm/yx86-out.o | ||
| 82 | |||
| 83 | # bsdi | ||
| 84 | asm/dx86bsdi.o: asm/dx86unix.cpp | ||
| 85 | $(CPP) -DBSDI asm/dx86unix.cpp | sed 's/ :/:/' | as -o asm/dx86bsdi.o | ||
| 86 | |||
| 87 | asm/yx86bsdi.o: asm/yx86unix.cpp | ||
| 88 | $(CPP) -DBSDI asm/yx86unix.cpp | sed 's/ :/:/' | as -o asm/yx86bsdi.o | ||
| 89 | |||
| 90 | asm/dx86unix.cpp: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 91 | (cd asm; $(PERL) des-586.pl cpp >dx86unix.cpp) | ||
| 92 | |||
| 93 | asm/yx86unix.cpp: asm/crypt586.pl ../perlasm/x86asm.pl | ||
| 94 | (cd asm; $(PERL) crypt586.pl cpp >yx86unix.cpp) | ||
| 95 | |||
| 96 | files: | ||
| 97 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 98 | |||
| 99 | links: | ||
| 100 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 101 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 102 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 103 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 104 | |||
| 105 | install: installs | ||
| 106 | |||
| 107 | installs: | ||
| 108 | @for i in $(EXHEADER) ; \ | ||
| 109 | do \ | ||
| 110 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 111 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 112 | done; | ||
| 113 | |||
| 114 | tags: | ||
| 115 | ctags $(SRC) | ||
| 116 | |||
| 117 | tests: | ||
| 118 | |||
| 119 | lint: | ||
| 120 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 121 | |||
| 122 | depend: | ||
| 123 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 124 | |||
| 125 | dclean: | ||
| 126 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 127 | mv -f Makefile.new $(MAKEFILE) | ||
| 128 | |||
| 129 | clean: | ||
| 130 | rm -f asm/dx86unix.cpp asm/yx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff | ||
| 131 | |||
| 132 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 133 | |||
| 134 | cbc_cksm.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 135 | cbc_cksm.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 136 | cbc_cksm.o: ../../include/openssl/opensslconf.h | ||
| 137 | cbc_cksm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 138 | cbc_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 139 | cbc_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 140 | cbc_cksm.o: cbc_cksm.c des_locl.h | ||
| 141 | cbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 142 | cbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 143 | cbc_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 144 | cbc_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 145 | cbc_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 146 | cbc_enc.o: ../../include/openssl/ui_compat.h cbc_enc.c des_locl.h ncbc_enc.c | ||
| 147 | cfb64ede.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 148 | cfb64ede.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 149 | cfb64ede.o: ../../include/openssl/opensslconf.h | ||
| 150 | cfb64ede.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 151 | cfb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 152 | cfb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 153 | cfb64ede.o: cfb64ede.c des_locl.h | ||
| 154 | cfb64enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 155 | cfb64enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 156 | cfb64enc.o: ../../include/openssl/opensslconf.h | ||
| 157 | cfb64enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 158 | cfb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 159 | cfb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 160 | cfb64enc.o: cfb64enc.c des_locl.h | ||
| 161 | cfb_enc.o: ../../e_os.h ../../include/openssl/crypto.h | ||
| 162 | cfb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 163 | cfb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 164 | cfb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 165 | cfb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 166 | cfb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 167 | cfb_enc.o: cfb_enc.c des_locl.h | ||
| 168 | des_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 169 | des_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 170 | des_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 171 | des_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 172 | des_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 173 | des_enc.o: ../../include/openssl/ui_compat.h des_enc.c des_locl.h ncbc_enc.c | ||
| 174 | des_old.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 175 | des_old.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 176 | des_old.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 177 | des_old.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 178 | des_old.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 179 | des_old.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 180 | des_old.o: ../../include/openssl/ui_compat.h des_old.c | ||
| 181 | des_old2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 182 | des_old2.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 183 | des_old2.o: ../../include/openssl/opensslconf.h | ||
| 184 | des_old2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 185 | des_old2.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 186 | des_old2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 187 | des_old2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 188 | des_old2.o: des_old2.c | ||
| 189 | ecb3_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 190 | ecb3_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 191 | ecb3_enc.o: ../../include/openssl/opensslconf.h | ||
| 192 | ecb3_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 193 | ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 194 | ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 195 | ecb3_enc.o: des_locl.h ecb3_enc.c | ||
| 196 | ecb_enc.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 197 | ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 198 | ecb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 199 | ecb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 200 | ecb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 201 | ecb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 202 | ecb_enc.o: des_locl.h des_ver.h ecb_enc.c spr.h | ||
| 203 | ede_cbcm_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 204 | ede_cbcm_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 205 | ede_cbcm_enc.o: ../../include/openssl/opensslconf.h | ||
| 206 | ede_cbcm_enc.o: ../../include/openssl/opensslv.h | ||
| 207 | ede_cbcm_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 208 | ede_cbcm_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 209 | ede_cbcm_enc.o: ../../include/openssl/ui_compat.h des_locl.h ede_cbcm_enc.c | ||
| 210 | enc_read.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 211 | enc_read.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 212 | enc_read.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 213 | enc_read.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 214 | enc_read.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 215 | enc_read.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 216 | enc_read.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 217 | enc_read.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 218 | enc_read.o: ../cryptlib.h des_locl.h enc_read.c | ||
| 219 | enc_writ.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 220 | enc_writ.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 221 | enc_writ.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 222 | enc_writ.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 223 | enc_writ.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 224 | enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 225 | enc_writ.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 226 | enc_writ.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 227 | enc_writ.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 228 | enc_writ.o: ../cryptlib.h des_locl.h enc_writ.c | ||
| 229 | fcrypt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 230 | fcrypt.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 231 | fcrypt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 232 | fcrypt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 233 | fcrypt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 234 | fcrypt.o: ../../include/openssl/ui_compat.h des_locl.h fcrypt.c | ||
| 235 | fcrypt_b.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 236 | fcrypt_b.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 237 | fcrypt_b.o: ../../include/openssl/opensslconf.h | ||
| 238 | fcrypt_b.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 239 | fcrypt_b.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 240 | fcrypt_b.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 241 | fcrypt_b.o: des_locl.h fcrypt_b.c | ||
| 242 | ofb64ede.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 243 | ofb64ede.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 244 | ofb64ede.o: ../../include/openssl/opensslconf.h | ||
| 245 | ofb64ede.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 246 | ofb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 247 | ofb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 248 | ofb64ede.o: des_locl.h ofb64ede.c | ||
| 249 | ofb64enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 250 | ofb64enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 251 | ofb64enc.o: ../../include/openssl/opensslconf.h | ||
| 252 | ofb64enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 253 | ofb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 254 | ofb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 255 | ofb64enc.o: des_locl.h ofb64enc.c | ||
| 256 | ofb_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 257 | ofb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 258 | ofb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 259 | ofb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 260 | ofb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 261 | ofb_enc.o: ../../include/openssl/ui_compat.h des_locl.h ofb_enc.c | ||
| 262 | pcbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 263 | pcbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 264 | pcbc_enc.o: ../../include/openssl/opensslconf.h | ||
| 265 | pcbc_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 266 | pcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 267 | pcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 268 | pcbc_enc.o: des_locl.h pcbc_enc.c | ||
| 269 | qud_cksm.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 270 | qud_cksm.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 271 | qud_cksm.o: ../../include/openssl/opensslconf.h | ||
| 272 | qud_cksm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 273 | qud_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 274 | qud_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 275 | qud_cksm.o: des_locl.h qud_cksm.c | ||
| 276 | rand_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 277 | rand_key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 278 | rand_key.o: ../../include/openssl/opensslconf.h | ||
| 279 | rand_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 280 | rand_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 281 | rand_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 282 | rand_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 283 | rand_key.o: rand_key.c | ||
| 284 | read2pwd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 285 | read2pwd.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 286 | read2pwd.o: ../../include/openssl/opensslconf.h | ||
| 287 | read2pwd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 288 | read2pwd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 289 | read2pwd.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 290 | read2pwd.o: read2pwd.c | ||
| 291 | rpc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 292 | rpc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 293 | rpc_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 294 | rpc_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 295 | rpc_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 296 | rpc_enc.o: ../../include/openssl/ui_compat.h des_locl.h des_ver.h rpc_des.h | ||
| 297 | rpc_enc.o: rpc_enc.c | ||
| 298 | set_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 299 | set_key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 300 | set_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 301 | set_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 302 | set_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 303 | set_key.o: ../../include/openssl/ui_compat.h des_locl.h set_key.c | ||
| 304 | str2key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 305 | str2key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 306 | str2key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 307 | str2key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 308 | str2key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 309 | str2key.o: ../../include/openssl/ui_compat.h des_locl.h str2key.c | ||
| 310 | xcbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 311 | xcbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 312 | xcbc_enc.o: ../../include/openssl/opensslconf.h | ||
| 313 | xcbc_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 314 | xcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 315 | xcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 316 | xcbc_enc.o: des_locl.h xcbc_enc.c | ||
diff --git a/src/lib/libcrypto/des/asm/crypt586.pl b/src/lib/libcrypto/des/asm/crypt586.pl index 1d04ed6def..e36f7d44bd 100644 --- a/src/lib/libcrypto/des/asm/crypt586.pl +++ b/src/lib/libcrypto/des/asm/crypt586.pl | |||
| @@ -6,7 +6,8 @@ | |||
| 6 | # things perfect. | 6 | # things perfect. |
| 7 | # | 7 | # |
| 8 | 8 | ||
| 9 | push(@INC,"perlasm","../../perlasm"); | 9 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 10 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 10 | require "x86asm.pl"; | 11 | require "x86asm.pl"; |
| 11 | 12 | ||
| 12 | &asm_init($ARGV[0],"crypt586.pl"); | 13 | &asm_init($ARGV[0],"crypt586.pl"); |
| @@ -22,7 +23,7 @@ sub fcrypt_body | |||
| 22 | { | 23 | { |
| 23 | local($name,$do_ip)=@_; | 24 | local($name,$do_ip)=@_; |
| 24 | 25 | ||
| 25 | &function_begin($name,"EXTRN _DES_SPtrans:DWORD"); | 26 | &function_begin($name); |
| 26 | 27 | ||
| 27 | &comment(""); | 28 | &comment(""); |
| 28 | &comment("Load the 2 words"); | 29 | &comment("Load the 2 words"); |
diff --git a/src/lib/libcrypto/des/asm/des-586.pl b/src/lib/libcrypto/des/asm/des-586.pl index 60d577cc8d..5b5f39cebd 100644 --- a/src/lib/libcrypto/des/asm/des-586.pl +++ b/src/lib/libcrypto/des/asm/des-586.pl | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | # Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk> | 4 | # Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk> |
| 5 | # | 5 | # |
| 6 | 6 | ||
| 7 | push(@INC,"perlasm","../../perlasm"); | 7 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 8 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 8 | require "x86asm.pl"; | 9 | require "x86asm.pl"; |
| 9 | require "cbc.pl"; | 10 | require "cbc.pl"; |
| 10 | require "desboth.pl"; | 11 | require "desboth.pl"; |
| @@ -18,33 +19,110 @@ require "desboth.pl"; | |||
| 18 | 19 | ||
| 19 | $L="edi"; | 20 | $L="edi"; |
| 20 | $R="esi"; | 21 | $R="esi"; |
| 22 | $trans="ebp"; | ||
| 23 | $small_footprint=1 if (grep(/\-DOPENSSL_SMALL_FOOTPRINT/,@ARGV)); | ||
| 24 | # one can discuss setting this variable to 1 unconditionally, as | ||
| 25 | # the folded loop is only 3% slower than unrolled, but >7 times smaller | ||
| 21 | 26 | ||
| 22 | &external_label("DES_SPtrans"); | 27 | &public_label("DES_SPtrans"); |
| 28 | |||
| 29 | &DES_encrypt_internal(); | ||
| 30 | &DES_decrypt_internal(); | ||
| 23 | &DES_encrypt("DES_encrypt1",1); | 31 | &DES_encrypt("DES_encrypt1",1); |
| 24 | &DES_encrypt("DES_encrypt2",0); | 32 | &DES_encrypt("DES_encrypt2",0); |
| 33 | &DES_encrypt3("DES_encrypt3",1); | ||
| 34 | &DES_encrypt3("DES_decrypt3",0); | ||
| 35 | &cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1); | ||
| 36 | &cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5); | ||
| 37 | &DES_SPtrans(); | ||
| 38 | |||
| 39 | &asm_finish(); | ||
| 25 | 40 | ||
| 26 | if (!$main'openbsd) | 41 | sub DES_encrypt_internal() |
| 27 | { | 42 | { |
| 28 | &DES_encrypt3("DES_encrypt3",1); | 43 | &function_begin_B("_x86_DES_encrypt"); |
| 29 | &DES_encrypt3("DES_decrypt3",0); | 44 | |
| 30 | &cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1); | 45 | if ($small_footprint) |
| 31 | &cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5); | 46 | { |
| 47 | &lea("edx",&DWP(128,"ecx")); | ||
| 48 | &push("edx"); | ||
| 49 | &push("ecx"); | ||
| 50 | &set_label("eloop"); | ||
| 51 | &D_ENCRYPT(0,$L,$R,0,$trans,"eax","ebx","ecx","edx",&swtmp(0)); | ||
| 52 | &comment(""); | ||
| 53 | &D_ENCRYPT(1,$R,$L,2,$trans,"eax","ebx","ecx","edx",&swtmp(0)); | ||
| 54 | &comment(""); | ||
| 55 | &add("ecx",16); | ||
| 56 | &cmp("ecx",&swtmp(1)); | ||
| 57 | &mov(&swtmp(0),"ecx"); | ||
| 58 | &jb(&label("eloop")); | ||
| 59 | &add("esp",8); | ||
| 60 | } | ||
| 61 | else | ||
| 62 | { | ||
| 63 | &push("ecx"); | ||
| 64 | for ($i=0; $i<16; $i+=2) | ||
| 65 | { | ||
| 66 | &comment("Round $i"); | ||
| 67 | &D_ENCRYPT($i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx",&swtmp(0)); | ||
| 68 | &comment("Round ".sprintf("%d",$i+1)); | ||
| 69 | &D_ENCRYPT($i+1,$R,$L,($i+1)*2,$trans,"eax","ebx","ecx","edx",&swtmp(0)); | ||
| 70 | } | ||
| 71 | &add("esp",4); | ||
| 32 | } | 72 | } |
| 73 | &ret(); | ||
| 33 | 74 | ||
| 34 | &asm_finish(); | 75 | &function_end_B("_x86_DES_encrypt"); |
| 76 | } | ||
| 77 | |||
| 78 | sub DES_decrypt_internal() | ||
| 79 | { | ||
| 80 | &function_begin_B("_x86_DES_decrypt"); | ||
| 81 | |||
| 82 | if ($small_footprint) | ||
| 83 | { | ||
| 84 | &push("ecx"); | ||
| 85 | &lea("ecx",&DWP(128,"ecx")); | ||
| 86 | &push("ecx"); | ||
| 87 | &set_label("dloop"); | ||
| 88 | &D_ENCRYPT(0,$L,$R,-2,$trans,"eax","ebx","ecx","edx",&swtmp(0)); | ||
| 89 | &comment(""); | ||
| 90 | &D_ENCRYPT(1,$R,$L,-4,$trans,"eax","ebx","ecx","edx",&swtmp(0)); | ||
| 91 | &comment(""); | ||
| 92 | &sub("ecx",16); | ||
| 93 | &cmp("ecx",&swtmp(1)); | ||
| 94 | &mov(&swtmp(0),"ecx"); | ||
| 95 | &ja(&label("dloop")); | ||
| 96 | &add("esp",8); | ||
| 97 | } | ||
| 98 | else | ||
| 99 | { | ||
| 100 | &push("ecx"); | ||
| 101 | for ($i=15; $i>0; $i-=2) | ||
| 102 | { | ||
| 103 | &comment("Round $i"); | ||
| 104 | &D_ENCRYPT(15-$i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx",&swtmp(0)); | ||
| 105 | &comment("Round ".sprintf("%d",$i-1)); | ||
| 106 | &D_ENCRYPT(15-$i+1,$R,$L,($i-1)*2,$trans,"eax","ebx","ecx","edx",&swtmp(0)); | ||
| 107 | } | ||
| 108 | &add("esp",4); | ||
| 109 | } | ||
| 110 | &ret(); | ||
| 35 | 111 | ||
| 112 | &function_end_B("_x86_DES_decrypt"); | ||
| 113 | } | ||
| 114 | |||
| 36 | sub DES_encrypt | 115 | sub DES_encrypt |
| 37 | { | 116 | { |
| 38 | local($name,$do_ip)=@_; | 117 | local($name,$do_ip)=@_; |
| 39 | 118 | ||
| 40 | &function_begin_B($name,"EXTRN _DES_SPtrans:DWORD"); | 119 | &function_begin_B($name); |
| 41 | 120 | ||
| 42 | &push("esi"); | 121 | &push("esi"); |
| 43 | &push("edi"); | 122 | &push("edi"); |
| 44 | 123 | ||
| 45 | &comment(""); | 124 | &comment(""); |
| 46 | &comment("Load the 2 words"); | 125 | &comment("Load the 2 words"); |
| 47 | $trans="ebp"; | ||
| 48 | 126 | ||
| 49 | if ($do_ip) | 127 | if ($do_ip) |
| 50 | { | 128 | { |
| @@ -77,39 +155,20 @@ sub DES_encrypt | |||
| 77 | } | 155 | } |
| 78 | 156 | ||
| 79 | # PIC-ification:-) | 157 | # PIC-ification:-) |
| 80 | &picmeup($trans,"DES_SPtrans"); | 158 | &call (&label("pic_point")); |
| 81 | #if ($cpp) { &picmeup($trans,"DES_SPtrans"); } | 159 | &set_label("pic_point"); |
| 82 | #else { &lea($trans,&DWP("DES_SPtrans")); } | 160 | &blindpop($trans); |
| 161 | &lea ($trans,&DWP(&label("DES_SPtrans")."-".&label("pic_point"),$trans)); | ||
| 83 | 162 | ||
| 84 | &mov( "ecx", &wparam(1) ); | 163 | &mov( "ecx", &wparam(1) ); |
| 85 | &cmp("ebx","0"); | ||
| 86 | &je(&label("start_decrypt")); | ||
| 87 | |||
| 88 | for ($i=0; $i<16; $i+=2) | ||
| 89 | { | ||
| 90 | &comment(""); | ||
| 91 | &comment("Round $i"); | ||
| 92 | &D_ENCRYPT($i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx"); | ||
| 93 | |||
| 94 | &comment(""); | ||
| 95 | &comment("Round ".sprintf("%d",$i+1)); | ||
| 96 | &D_ENCRYPT($i+1,$R,$L,($i+1)*2,$trans,"eax","ebx","ecx","edx"); | ||
| 97 | } | ||
| 98 | &jmp(&label("end")); | ||
| 99 | 164 | ||
| 100 | &set_label("start_decrypt"); | 165 | &cmp("ebx","0"); |
| 101 | 166 | &je(&label("decrypt")); | |
| 102 | for ($i=15; $i>0; $i-=2) | 167 | &call("_x86_DES_encrypt"); |
| 103 | { | 168 | &jmp(&label("done")); |
| 104 | &comment(""); | 169 | &set_label("decrypt"); |
| 105 | &comment("Round $i"); | 170 | &call("_x86_DES_decrypt"); |
| 106 | &D_ENCRYPT(15-$i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx"); | 171 | &set_label("done"); |
| 107 | &comment(""); | ||
| 108 | &comment("Round ".sprintf("%d",$i-1)); | ||
| 109 | &D_ENCRYPT(15-$i+1,$R,$L,($i-1)*2,$trans,"eax","ebx","ecx","edx"); | ||
| 110 | } | ||
| 111 | |||
| 112 | &set_label("end"); | ||
| 113 | 172 | ||
| 114 | if ($do_ip) | 173 | if ($do_ip) |
| 115 | { | 174 | { |
| @@ -143,7 +202,7 @@ sub DES_encrypt | |||
| 143 | 202 | ||
| 144 | sub D_ENCRYPT | 203 | sub D_ENCRYPT |
| 145 | { | 204 | { |
| 146 | local($r,$L,$R,$S,$trans,$u,$tmp1,$tmp2,$t)=@_; | 205 | local($r,$L,$R,$S,$trans,$u,$tmp1,$tmp2,$t,$wp1)=@_; |
| 147 | 206 | ||
| 148 | &mov( $u, &DWP(&n2a($S*4),$tmp2,"",0)); | 207 | &mov( $u, &DWP(&n2a($S*4),$tmp2,"",0)); |
| 149 | &xor( $tmp1, $tmp1); | 208 | &xor( $tmp1, $tmp1); |
| @@ -170,7 +229,7 @@ sub D_ENCRYPT | |||
| 170 | &and( $t, "0xff" ); | 229 | &and( $t, "0xff" ); |
| 171 | &xor( $L, &DWP("0x600",$trans,$tmp1,0)); | 230 | &xor( $L, &DWP("0x600",$trans,$tmp1,0)); |
| 172 | &xor( $L, &DWP("0x700",$trans,$tmp2,0)); | 231 | &xor( $L, &DWP("0x700",$trans,$tmp2,0)); |
| 173 | &mov( $tmp2, &wparam(1) ); | 232 | &mov( $tmp2, $wp1 ); |
| 174 | &xor( $L, &DWP("0x400",$trans,$u,0)); | 233 | &xor( $L, &DWP("0x400",$trans,$u,0)); |
| 175 | &xor( $L, &DWP("0x500",$trans,$t,0)); | 234 | &xor( $L, &DWP("0x500",$trans,$t,0)); |
| 176 | } | 235 | } |
| @@ -253,3 +312,142 @@ sub FP_new | |||
| 253 | &rotr($tt , 4); | 312 | &rotr($tt , 4); |
| 254 | } | 313 | } |
| 255 | 314 | ||
| 315 | sub DES_SPtrans | ||
| 316 | { | ||
| 317 | &set_label("DES_SPtrans",64); | ||
| 318 | &data_word(0x02080800, 0x00080000, 0x02000002, 0x02080802); | ||
| 319 | &data_word(0x02000000, 0x00080802, 0x00080002, 0x02000002); | ||
| 320 | &data_word(0x00080802, 0x02080800, 0x02080000, 0x00000802); | ||
| 321 | &data_word(0x02000802, 0x02000000, 0x00000000, 0x00080002); | ||
| 322 | &data_word(0x00080000, 0x00000002, 0x02000800, 0x00080800); | ||
| 323 | &data_word(0x02080802, 0x02080000, 0x00000802, 0x02000800); | ||
| 324 | &data_word(0x00000002, 0x00000800, 0x00080800, 0x02080002); | ||
| 325 | &data_word(0x00000800, 0x02000802, 0x02080002, 0x00000000); | ||
| 326 | &data_word(0x00000000, 0x02080802, 0x02000800, 0x00080002); | ||
| 327 | &data_word(0x02080800, 0x00080000, 0x00000802, 0x02000800); | ||
| 328 | &data_word(0x02080002, 0x00000800, 0x00080800, 0x02000002); | ||
| 329 | &data_word(0x00080802, 0x00000002, 0x02000002, 0x02080000); | ||
| 330 | &data_word(0x02080802, 0x00080800, 0x02080000, 0x02000802); | ||
| 331 | &data_word(0x02000000, 0x00000802, 0x00080002, 0x00000000); | ||
| 332 | &data_word(0x00080000, 0x02000000, 0x02000802, 0x02080800); | ||
| 333 | &data_word(0x00000002, 0x02080002, 0x00000800, 0x00080802); | ||
| 334 | # nibble 1 | ||
| 335 | &data_word(0x40108010, 0x00000000, 0x00108000, 0x40100000); | ||
| 336 | &data_word(0x40000010, 0x00008010, 0x40008000, 0x00108000); | ||
| 337 | &data_word(0x00008000, 0x40100010, 0x00000010, 0x40008000); | ||
| 338 | &data_word(0x00100010, 0x40108000, 0x40100000, 0x00000010); | ||
| 339 | &data_word(0x00100000, 0x40008010, 0x40100010, 0x00008000); | ||
| 340 | &data_word(0x00108010, 0x40000000, 0x00000000, 0x00100010); | ||
| 341 | &data_word(0x40008010, 0x00108010, 0x40108000, 0x40000010); | ||
| 342 | &data_word(0x40000000, 0x00100000, 0x00008010, 0x40108010); | ||
| 343 | &data_word(0x00100010, 0x40108000, 0x40008000, 0x00108010); | ||
| 344 | &data_word(0x40108010, 0x00100010, 0x40000010, 0x00000000); | ||
| 345 | &data_word(0x40000000, 0x00008010, 0x00100000, 0x40100010); | ||
| 346 | &data_word(0x00008000, 0x40000000, 0x00108010, 0x40008010); | ||
| 347 | &data_word(0x40108000, 0x00008000, 0x00000000, 0x40000010); | ||
| 348 | &data_word(0x00000010, 0x40108010, 0x00108000, 0x40100000); | ||
| 349 | &data_word(0x40100010, 0x00100000, 0x00008010, 0x40008000); | ||
| 350 | &data_word(0x40008010, 0x00000010, 0x40100000, 0x00108000); | ||
| 351 | # nibble 2 | ||
| 352 | &data_word(0x04000001, 0x04040100, 0x00000100, 0x04000101); | ||
| 353 | &data_word(0x00040001, 0x04000000, 0x04000101, 0x00040100); | ||
| 354 | &data_word(0x04000100, 0x00040000, 0x04040000, 0x00000001); | ||
| 355 | &data_word(0x04040101, 0x00000101, 0x00000001, 0x04040001); | ||
| 356 | &data_word(0x00000000, 0x00040001, 0x04040100, 0x00000100); | ||
| 357 | &data_word(0x00000101, 0x04040101, 0x00040000, 0x04000001); | ||
| 358 | &data_word(0x04040001, 0x04000100, 0x00040101, 0x04040000); | ||
| 359 | &data_word(0x00040100, 0x00000000, 0x04000000, 0x00040101); | ||
| 360 | &data_word(0x04040100, 0x00000100, 0x00000001, 0x00040000); | ||
| 361 | &data_word(0x00000101, 0x00040001, 0x04040000, 0x04000101); | ||
| 362 | &data_word(0x00000000, 0x04040100, 0x00040100, 0x04040001); | ||
| 363 | &data_word(0x00040001, 0x04000000, 0x04040101, 0x00000001); | ||
| 364 | &data_word(0x00040101, 0x04000001, 0x04000000, 0x04040101); | ||
| 365 | &data_word(0x00040000, 0x04000100, 0x04000101, 0x00040100); | ||
| 366 | &data_word(0x04000100, 0x00000000, 0x04040001, 0x00000101); | ||
| 367 | &data_word(0x04000001, 0x00040101, 0x00000100, 0x04040000); | ||
| 368 | # nibble 3 | ||
| 369 | &data_word(0x00401008, 0x10001000, 0x00000008, 0x10401008); | ||
| 370 | &data_word(0x00000000, 0x10400000, 0x10001008, 0x00400008); | ||
| 371 | &data_word(0x10401000, 0x10000008, 0x10000000, 0x00001008); | ||
| 372 | &data_word(0x10000008, 0x00401008, 0x00400000, 0x10000000); | ||
| 373 | &data_word(0x10400008, 0x00401000, 0x00001000, 0x00000008); | ||
| 374 | &data_word(0x00401000, 0x10001008, 0x10400000, 0x00001000); | ||
| 375 | &data_word(0x00001008, 0x00000000, 0x00400008, 0x10401000); | ||
| 376 | &data_word(0x10001000, 0x10400008, 0x10401008, 0x00400000); | ||
| 377 | &data_word(0x10400008, 0x00001008, 0x00400000, 0x10000008); | ||
| 378 | &data_word(0x00401000, 0x10001000, 0x00000008, 0x10400000); | ||
| 379 | &data_word(0x10001008, 0x00000000, 0x00001000, 0x00400008); | ||
| 380 | &data_word(0x00000000, 0x10400008, 0x10401000, 0x00001000); | ||
| 381 | &data_word(0x10000000, 0x10401008, 0x00401008, 0x00400000); | ||
| 382 | &data_word(0x10401008, 0x00000008, 0x10001000, 0x00401008); | ||
| 383 | &data_word(0x00400008, 0x00401000, 0x10400000, 0x10001008); | ||
| 384 | &data_word(0x00001008, 0x10000000, 0x10000008, 0x10401000); | ||
| 385 | # nibble 4 | ||
| 386 | &data_word(0x08000000, 0x00010000, 0x00000400, 0x08010420); | ||
| 387 | &data_word(0x08010020, 0x08000400, 0x00010420, 0x08010000); | ||
| 388 | &data_word(0x00010000, 0x00000020, 0x08000020, 0x00010400); | ||
| 389 | &data_word(0x08000420, 0x08010020, 0x08010400, 0x00000000); | ||
| 390 | &data_word(0x00010400, 0x08000000, 0x00010020, 0x00000420); | ||
| 391 | &data_word(0x08000400, 0x00010420, 0x00000000, 0x08000020); | ||
| 392 | &data_word(0x00000020, 0x08000420, 0x08010420, 0x00010020); | ||
| 393 | &data_word(0x08010000, 0x00000400, 0x00000420, 0x08010400); | ||
| 394 | &data_word(0x08010400, 0x08000420, 0x00010020, 0x08010000); | ||
| 395 | &data_word(0x00010000, 0x00000020, 0x08000020, 0x08000400); | ||
| 396 | &data_word(0x08000000, 0x00010400, 0x08010420, 0x00000000); | ||
| 397 | &data_word(0x00010420, 0x08000000, 0x00000400, 0x00010020); | ||
| 398 | &data_word(0x08000420, 0x00000400, 0x00000000, 0x08010420); | ||
| 399 | &data_word(0x08010020, 0x08010400, 0x00000420, 0x00010000); | ||
| 400 | &data_word(0x00010400, 0x08010020, 0x08000400, 0x00000420); | ||
| 401 | &data_word(0x00000020, 0x00010420, 0x08010000, 0x08000020); | ||
| 402 | # nibble 5 | ||
| 403 | &data_word(0x80000040, 0x00200040, 0x00000000, 0x80202000); | ||
| 404 | &data_word(0x00200040, 0x00002000, 0x80002040, 0x00200000); | ||
| 405 | &data_word(0x00002040, 0x80202040, 0x00202000, 0x80000000); | ||
| 406 | &data_word(0x80002000, 0x80000040, 0x80200000, 0x00202040); | ||
| 407 | &data_word(0x00200000, 0x80002040, 0x80200040, 0x00000000); | ||
| 408 | &data_word(0x00002000, 0x00000040, 0x80202000, 0x80200040); | ||
| 409 | &data_word(0x80202040, 0x80200000, 0x80000000, 0x00002040); | ||
| 410 | &data_word(0x00000040, 0x00202000, 0x00202040, 0x80002000); | ||
| 411 | &data_word(0x00002040, 0x80000000, 0x80002000, 0x00202040); | ||
| 412 | &data_word(0x80202000, 0x00200040, 0x00000000, 0x80002000); | ||
| 413 | &data_word(0x80000000, 0x00002000, 0x80200040, 0x00200000); | ||
| 414 | &data_word(0x00200040, 0x80202040, 0x00202000, 0x00000040); | ||
| 415 | &data_word(0x80202040, 0x00202000, 0x00200000, 0x80002040); | ||
| 416 | &data_word(0x80000040, 0x80200000, 0x00202040, 0x00000000); | ||
| 417 | &data_word(0x00002000, 0x80000040, 0x80002040, 0x80202000); | ||
| 418 | &data_word(0x80200000, 0x00002040, 0x00000040, 0x80200040); | ||
| 419 | # nibble 6 | ||
| 420 | &data_word(0x00004000, 0x00000200, 0x01000200, 0x01000004); | ||
| 421 | &data_word(0x01004204, 0x00004004, 0x00004200, 0x00000000); | ||
| 422 | &data_word(0x01000000, 0x01000204, 0x00000204, 0x01004000); | ||
| 423 | &data_word(0x00000004, 0x01004200, 0x01004000, 0x00000204); | ||
| 424 | &data_word(0x01000204, 0x00004000, 0x00004004, 0x01004204); | ||
| 425 | &data_word(0x00000000, 0x01000200, 0x01000004, 0x00004200); | ||
| 426 | &data_word(0x01004004, 0x00004204, 0x01004200, 0x00000004); | ||
| 427 | &data_word(0x00004204, 0x01004004, 0x00000200, 0x01000000); | ||
| 428 | &data_word(0x00004204, 0x01004000, 0x01004004, 0x00000204); | ||
| 429 | &data_word(0x00004000, 0x00000200, 0x01000000, 0x01004004); | ||
| 430 | &data_word(0x01000204, 0x00004204, 0x00004200, 0x00000000); | ||
| 431 | &data_word(0x00000200, 0x01000004, 0x00000004, 0x01000200); | ||
| 432 | &data_word(0x00000000, 0x01000204, 0x01000200, 0x00004200); | ||
| 433 | &data_word(0x00000204, 0x00004000, 0x01004204, 0x01000000); | ||
| 434 | &data_word(0x01004200, 0x00000004, 0x00004004, 0x01004204); | ||
| 435 | &data_word(0x01000004, 0x01004200, 0x01004000, 0x00004004); | ||
| 436 | # nibble 7 | ||
| 437 | &data_word(0x20800080, 0x20820000, 0x00020080, 0x00000000); | ||
| 438 | &data_word(0x20020000, 0x00800080, 0x20800000, 0x20820080); | ||
| 439 | &data_word(0x00000080, 0x20000000, 0x00820000, 0x00020080); | ||
| 440 | &data_word(0x00820080, 0x20020080, 0x20000080, 0x20800000); | ||
| 441 | &data_word(0x00020000, 0x00820080, 0x00800080, 0x20020000); | ||
| 442 | &data_word(0x20820080, 0x20000080, 0x00000000, 0x00820000); | ||
| 443 | &data_word(0x20000000, 0x00800000, 0x20020080, 0x20800080); | ||
| 444 | &data_word(0x00800000, 0x00020000, 0x20820000, 0x00000080); | ||
| 445 | &data_word(0x00800000, 0x00020000, 0x20000080, 0x20820080); | ||
| 446 | &data_word(0x00020080, 0x20000000, 0x00000000, 0x00820000); | ||
| 447 | &data_word(0x20800080, 0x20020080, 0x20020000, 0x00800080); | ||
| 448 | &data_word(0x20820000, 0x00000080, 0x00800080, 0x20020000); | ||
| 449 | &data_word(0x20820080, 0x00800000, 0x20800000, 0x20000080); | ||
| 450 | &data_word(0x00820000, 0x00020080, 0x20020080, 0x20800000); | ||
| 451 | &data_word(0x00000080, 0x20820000, 0x00820080, 0x00000000); | ||
| 452 | &data_word(0x20000000, 0x20800080, 0x00020000, 0x00820080); | ||
| 453 | } | ||
diff --git a/src/lib/libcrypto/des/asm/des686.pl b/src/lib/libcrypto/des/asm/des686.pl deleted file mode 100644 index d3ad5d5edd..0000000000 --- a/src/lib/libcrypto/des/asm/des686.pl +++ /dev/null | |||
| @@ -1,230 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | $prog="des686.pl"; | ||
| 4 | |||
| 5 | # base code is in microsft | ||
| 6 | # op dest, source | ||
| 7 | # format. | ||
| 8 | # | ||
| 9 | |||
| 10 | # WILL NOT WORK ANYMORE WITH desboth.pl | ||
| 11 | require "desboth.pl"; | ||
| 12 | |||
| 13 | if ( ($ARGV[0] eq "elf")) | ||
| 14 | { require "x86unix.pl"; } | ||
| 15 | elsif ( ($ARGV[0] eq "a.out")) | ||
| 16 | { $aout=1; require "x86unix.pl"; } | ||
| 17 | elsif ( ($ARGV[0] eq "sol")) | ||
| 18 | { $sol=1; require "x86unix.pl"; } | ||
| 19 | elsif ( ($ARGV[0] eq "cpp")) | ||
| 20 | { $cpp=1; require "x86unix.pl"; } | ||
| 21 | elsif ( ($ARGV[0] eq "win32")) | ||
| 22 | { require "x86ms.pl"; } | ||
| 23 | else | ||
| 24 | { | ||
| 25 | print STDERR <<"EOF"; | ||
| 26 | Pick one target type from | ||
| 27 | elf - linux, FreeBSD etc | ||
| 28 | a.out - old linux | ||
| 29 | sol - x86 solaris | ||
| 30 | cpp - format so x86unix.cpp can be used | ||
| 31 | win32 - Windows 95/Windows NT | ||
| 32 | EOF | ||
| 33 | exit(1); | ||
| 34 | } | ||
| 35 | |||
| 36 | &comment("Don't even think of reading this code"); | ||
| 37 | &comment("It was automatically generated by $prog"); | ||
| 38 | &comment("Which is a perl program used to generate the x86 assember for"); | ||
| 39 | &comment("any of elf, a.out, Win32, or Solaris"); | ||
| 40 | &comment("It can be found in SSLeay 0.6.5+ or in libdes 3.26+"); | ||
| 41 | &comment("eric <eay\@cryptsoft.com>"); | ||
| 42 | &comment(""); | ||
| 43 | |||
| 44 | &file("dx86xxxx"); | ||
| 45 | |||
| 46 | $L="edi"; | ||
| 47 | $R="esi"; | ||
| 48 | |||
| 49 | &DES_encrypt("DES_encrypt1",1); | ||
| 50 | &DES_encrypt("DES_encrypt2",0); | ||
| 51 | |||
| 52 | &DES_encrypt3("DES_encrypt3",1); | ||
| 53 | &DES_encrypt3("DES_decrypt3",0); | ||
| 54 | |||
| 55 | &file_end(); | ||
| 56 | |||
| 57 | sub DES_encrypt | ||
| 58 | { | ||
| 59 | local($name,$do_ip)=@_; | ||
| 60 | |||
| 61 | &function_begin($name,"EXTRN _DES_SPtrans:DWORD"); | ||
| 62 | |||
| 63 | &comment(""); | ||
| 64 | &comment("Load the 2 words"); | ||
| 65 | &mov("eax",&wparam(0)); | ||
| 66 | &mov($L,&DWP(0,"eax","",0)); | ||
| 67 | &mov($R,&DWP(4,"eax","",0)); | ||
| 68 | |||
| 69 | $ksp=&wparam(1); | ||
| 70 | |||
| 71 | if ($do_ip) | ||
| 72 | { | ||
| 73 | &comment(""); | ||
| 74 | &comment("IP"); | ||
| 75 | &IP_new($L,$R,"eax"); | ||
| 76 | } | ||
| 77 | |||
| 78 | &comment(""); | ||
| 79 | &comment("fixup rotate"); | ||
| 80 | &rotl($R,3); | ||
| 81 | &rotl($L,3); | ||
| 82 | &exch($L,$R); | ||
| 83 | |||
| 84 | &comment(""); | ||
| 85 | &comment("load counter, key_schedule and enc flag"); | ||
| 86 | &mov("eax",&wparam(2)); # get encrypt flag | ||
| 87 | &mov("ebp",&wparam(1)); # get ks | ||
| 88 | &cmp("eax","0"); | ||
| 89 | &je(&label("start_decrypt")); | ||
| 90 | |||
| 91 | # encrypting part | ||
| 92 | |||
| 93 | for ($i=0; $i<16; $i+=2) | ||
| 94 | { | ||
| 95 | &comment(""); | ||
| 96 | &comment("Round $i"); | ||
| 97 | &D_ENCRYPT($L,$R,$i*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx"); | ||
| 98 | |||
| 99 | &comment(""); | ||
| 100 | &comment("Round ".sprintf("%d",$i+1)); | ||
| 101 | &D_ENCRYPT($R,$L,($i+1)*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx"); | ||
| 102 | } | ||
| 103 | &jmp(&label("end")); | ||
| 104 | |||
| 105 | &set_label("start_decrypt"); | ||
| 106 | |||
| 107 | for ($i=15; $i>0; $i-=2) | ||
| 108 | { | ||
| 109 | &comment(""); | ||
| 110 | &comment("Round $i"); | ||
| 111 | &D_ENCRYPT($L,$R,$i*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx"); | ||
| 112 | &comment(""); | ||
| 113 | &comment("Round ".sprintf("%d",$i-1)); | ||
| 114 | &D_ENCRYPT($R,$L,($i-1)*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx"); | ||
| 115 | } | ||
| 116 | |||
| 117 | &set_label("end"); | ||
| 118 | |||
| 119 | &comment(""); | ||
| 120 | &comment("Fixup"); | ||
| 121 | &rotr($L,3); # r | ||
| 122 | &rotr($R,3); # l | ||
| 123 | |||
| 124 | if ($do_ip) | ||
| 125 | { | ||
| 126 | &comment(""); | ||
| 127 | &comment("FP"); | ||
| 128 | &FP_new($R,$L,"eax"); | ||
| 129 | } | ||
| 130 | |||
| 131 | &mov("eax",&wparam(0)); | ||
| 132 | &mov(&DWP(0,"eax","",0),$L); | ||
| 133 | &mov(&DWP(4,"eax","",0),$R); | ||
| 134 | |||
| 135 | &function_end($name); | ||
| 136 | } | ||
| 137 | |||
| 138 | |||
| 139 | # The logic is to load R into 2 registers and operate on both at the same time. | ||
| 140 | # We also load the 2 R's into 2 more registers so we can do the 'move word down a byte' | ||
| 141 | # while also masking the other copy and doing a lookup. We then also accumulate the | ||
| 142 | # L value in 2 registers then combine them at the end. | ||
| 143 | sub D_ENCRYPT | ||
| 144 | { | ||
| 145 | local($L,$R,$S,$ks,$desSP,$u,$t,$tmp1,$tmp2,$tmp3)=@_; | ||
| 146 | |||
| 147 | &mov( $u, &DWP(&n2a($S*4),$ks,"",0)); | ||
| 148 | &mov( $t, &DWP(&n2a(($S+1)*4),$ks,"",0)); | ||
| 149 | &xor( $u, $R ); | ||
| 150 | &xor( $t, $R ); | ||
| 151 | &rotr( $t, 4 ); | ||
| 152 | |||
| 153 | # the numbers at the end of the line are origional instruction order | ||
| 154 | &mov( $tmp2, $u ); # 1 2 | ||
| 155 | &mov( $tmp1, $t ); # 1 1 | ||
| 156 | &and( $tmp2, "0xfc" ); # 1 4 | ||
| 157 | &and( $tmp1, "0xfc" ); # 1 3 | ||
| 158 | &shr( $t, 8 ); # 1 5 | ||
| 159 | &xor( $L, &DWP("0x100+$desSP",$tmp1,"",0)); # 1 7 | ||
| 160 | &shr( $u, 8 ); # 1 6 | ||
| 161 | &mov( $tmp1, &DWP(" $desSP",$tmp2,"",0)); # 1 8 | ||
| 162 | |||
| 163 | &mov( $tmp2, $u ); # 2 2 | ||
| 164 | &xor( $L, $tmp1 ); # 1 9 | ||
| 165 | &and( $tmp2, "0xfc" ); # 2 4 | ||
| 166 | &mov( $tmp1, $t ); # 2 1 | ||
| 167 | &and( $tmp1, "0xfc" ); # 2 3 | ||
| 168 | &shr( $t, 8 ); # 2 5 | ||
| 169 | &xor( $L, &DWP("0x300+$desSP",$tmp1,"",0)); # 2 7 | ||
| 170 | &shr( $u, 8 ); # 2 6 | ||
| 171 | &mov( $tmp1, &DWP("0x200+$desSP",$tmp2,"",0)); # 2 8 | ||
| 172 | &mov( $tmp2, $u ); # 3 2 | ||
| 173 | |||
| 174 | &xor( $L, $tmp1 ); # 2 9 | ||
| 175 | &and( $tmp2, "0xfc" ); # 3 4 | ||
| 176 | |||
| 177 | &mov( $tmp1, $t ); # 3 1 | ||
| 178 | &shr( $u, 8 ); # 3 6 | ||
| 179 | &and( $tmp1, "0xfc" ); # 3 3 | ||
| 180 | &shr( $t, 8 ); # 3 5 | ||
| 181 | &xor( $L, &DWP("0x500+$desSP",$tmp1,"",0)); # 3 7 | ||
| 182 | &mov( $tmp1, &DWP("0x400+$desSP",$tmp2,"",0)); # 3 8 | ||
| 183 | |||
| 184 | &and( $t, "0xfc" ); # 4 1 | ||
| 185 | &xor( $L, $tmp1 ); # 3 9 | ||
| 186 | |||
| 187 | &and( $u, "0xfc" ); # 4 2 | ||
| 188 | &xor( $L, &DWP("0x700+$desSP",$t,"",0)); # 4 3 | ||
| 189 | &xor( $L, &DWP("0x600+$desSP",$u,"",0)); # 4 4 | ||
| 190 | } | ||
| 191 | |||
| 192 | sub PERM_OP | ||
| 193 | { | ||
| 194 | local($a,$b,$tt,$shift,$mask)=@_; | ||
| 195 | |||
| 196 | &mov( $tt, $a ); | ||
| 197 | &shr( $tt, $shift ); | ||
| 198 | &xor( $tt, $b ); | ||
| 199 | &and( $tt, $mask ); | ||
| 200 | &xor( $b, $tt ); | ||
| 201 | &shl( $tt, $shift ); | ||
| 202 | &xor( $a, $tt ); | ||
| 203 | } | ||
| 204 | |||
| 205 | sub IP_new | ||
| 206 | { | ||
| 207 | local($l,$r,$tt)=@_; | ||
| 208 | |||
| 209 | &PERM_OP($r,$l,$tt, 4,"0x0f0f0f0f"); | ||
| 210 | &PERM_OP($l,$r,$tt,16,"0x0000ffff"); | ||
| 211 | &PERM_OP($r,$l,$tt, 2,"0x33333333"); | ||
| 212 | &PERM_OP($l,$r,$tt, 8,"0x00ff00ff"); | ||
| 213 | &PERM_OP($r,$l,$tt, 1,"0x55555555"); | ||
| 214 | } | ||
| 215 | |||
| 216 | sub FP_new | ||
| 217 | { | ||
| 218 | local($l,$r,$tt)=@_; | ||
| 219 | |||
| 220 | &PERM_OP($l,$r,$tt, 1,"0x55555555"); | ||
| 221 | &PERM_OP($r,$l,$tt, 8,"0x00ff00ff"); | ||
| 222 | &PERM_OP($l,$r,$tt, 2,"0x33333333"); | ||
| 223 | &PERM_OP($r,$l,$tt,16,"0x0000ffff"); | ||
| 224 | &PERM_OP($l,$r,$tt, 4,"0x0f0f0f0f"); | ||
| 225 | } | ||
| 226 | |||
| 227 | sub n2a | ||
| 228 | { | ||
| 229 | sprintf("%d",$_[0]); | ||
| 230 | } | ||
diff --git a/src/lib/libcrypto/des/des-lib.com b/src/lib/libcrypto/des/des-lib.com index fc2c35a1ce..348f1c0470 100644 --- a/src/lib/libcrypto/des/des-lib.com +++ b/src/lib/libcrypto/des/des-lib.com | |||
| @@ -9,7 +9,7 @@ $! Changes by Richard Levitte <richard@levitte.org> | |||
| 9 | $! | 9 | $! |
| 10 | $! This command files compiles and creates the | 10 | $! This command files compiles and creates the |
| 11 | $! "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" library. The "xxx" denotes the machine | 11 | $! "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" library. The "xxx" denotes the machine |
| 12 | $! architecture of AXP or VAX. | 12 | $! architecture of ALPHA, IA64 or VAX. |
| 13 | $! | 13 | $! |
| 14 | $! It was re-written to try to determine which "C" compiler to try to use | 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. | 15 | $! or the user can specify a compiler in P3. |
| @@ -45,25 +45,34 @@ $! | |||
| 45 | $! | 45 | $! |
| 46 | $! Check Which Architecture We Are Using. | 46 | $! Check Which Architecture We Are Using. |
| 47 | $! | 47 | $! |
| 48 | $ IF (F$GETSYI("CPU").GE.128) | 48 | $ IF (F$GETSYI("CPU").LT.128) |
| 49 | $ THEN | 49 | $ THEN |
| 50 | $! | 50 | $! |
| 51 | $! The Architecture Is AXP. | 51 | $! The Architecture Is VAX |
| 52 | $! | 52 | $! |
| 53 | $ ARCH := AXP | 53 | $ ARCH := VAX |
| 54 | $! | 54 | $! |
| 55 | $! Else... | 55 | $! Else... |
| 56 | $! | 56 | $! |
| 57 | $ ELSE | 57 | $ ELSE |
| 58 | $! | 58 | $! |
| 59 | $! The Architecture Is VAX. | 59 | $! The Architecture Is Alpha, IA64 or whatever comes in the future. |
| 60 | $! | 60 | $! |
| 61 | $ ARCH := VAX | 61 | $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE") |
| 62 | $ IF (ARCH .EQS. "") THEN ARCH = "UNK" | ||
| 62 | $! | 63 | $! |
| 63 | $! End The Architecture Check. | 64 | $! End The Architecture Check. |
| 64 | $! | 65 | $! |
| 65 | $ ENDIF | 66 | $ ENDIF |
| 66 | $! | 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 | $! | ||
| 67 | $! Check To Make Sure We Have Valid Command Line Parameters. | 76 | $! Check To Make Sure We Have Valid Command Line Parameters. |
| 68 | $! | 77 | $! |
| 69 | $ GOSUB CHECK_OPTIONS | 78 | $ GOSUB CHECK_OPTIONS |
| @@ -72,10 +81,6 @@ $! Tell The User What Kind of Machine We Run On. | |||
| 72 | $! | 81 | $! |
| 73 | $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine." | 82 | $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine." |
| 74 | $! | 83 | $! |
| 75 | $! Define The OBJ Directory Name. | ||
| 76 | $! | ||
| 77 | $ OBJ_DIR := SYS$DISK:[--.'ARCH'.OBJ.CRYPTO.DES] | ||
| 78 | $! | ||
| 79 | $! Check To See If The Architecture Specific OBJ Directory Exists. | 84 | $! Check To See If The Architecture Specific OBJ Directory Exists. |
| 80 | $! | 85 | $! |
| 81 | $ IF (F$PARSE(OBJ_DIR).EQS."") | 86 | $ IF (F$PARSE(OBJ_DIR).EQS."") |
| @@ -89,10 +94,6 @@ $! End The Architecture Specific OBJ Directory Check. | |||
| 89 | $! | 94 | $! |
| 90 | $ ENDIF | 95 | $ ENDIF |
| 91 | $! | 96 | $! |
| 92 | $! Define The EXE Directory Name. | ||
| 93 | $! | ||
| 94 | $ EXE_DIR :== SYS$DISK:[--.'ARCH'.EXE.CRYPTO.DES] | ||
| 95 | $! | ||
| 96 | $! Check To See If The Architecture Specific Directory Exists. | 97 | $! Check To See If The Architecture Specific Directory Exists. |
| 97 | $! | 98 | $! |
| 98 | $ IF (F$PARSE(EXE_DIR).EQS."") | 99 | $ IF (F$PARSE(EXE_DIR).EQS."") |
| @@ -564,7 +565,7 @@ $! | |||
| 564 | $ IF (F$SEARCH(OPT_FILE).EQS."") | 565 | $ IF (F$SEARCH(OPT_FILE).EQS."") |
| 565 | $ THEN | 566 | $ THEN |
| 566 | $! | 567 | $! |
| 567 | $! Figure Out If We Need An AXP Or A VAX Linker Option File. | 568 | $! Figure Out If We Need An non-VAX Or A VAX Linker Option File. |
| 568 | $! | 569 | $! |
| 569 | $ IF (F$GETSYI("CPU").LT.128) | 570 | $ IF (F$GETSYI("CPU").LT.128) |
| 570 | $ THEN | 571 | $ THEN |
| @@ -584,19 +585,19 @@ $! Else... | |||
| 584 | $! | 585 | $! |
| 585 | $ ELSE | 586 | $ ELSE |
| 586 | $! | 587 | $! |
| 587 | $! Create The AXP Linker Option File. | 588 | $! Create The non-VAX Linker Option File. |
| 588 | $! | 589 | $! |
| 589 | $ CREATE 'OPT_FILE' | 590 | $ CREATE 'OPT_FILE' |
| 590 | $DECK | 591 | $DECK |
| 591 | ! | 592 | ! |
| 592 | ! Default System Options File For AXP To Link Agianst | 593 | ! Default System Options File For non-VAX To Link Agianst |
| 593 | ! The Sharable C Runtime Library. | 594 | ! The Sharable C Runtime Library. |
| 594 | ! | 595 | ! |
| 595 | SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE | 596 | SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE |
| 596 | SYS$SHARE:CMA$OPEN_RTL/SHARE | 597 | SYS$SHARE:CMA$OPEN_RTL/SHARE |
| 597 | $EOD | 598 | $EOD |
| 598 | $! | 599 | $! |
| 599 | $! End The VAX/AXP DEC C Option File Check. | 600 | $! End The DEC C Option File Check. |
| 600 | $! | 601 | $! |
| 601 | $ ENDIF | 602 | $ ENDIF |
| 602 | $! | 603 | $! |
| @@ -658,13 +659,13 @@ $! Else... | |||
| 658 | $! | 659 | $! |
| 659 | $ ELSE | 660 | $ ELSE |
| 660 | $! | 661 | $! |
| 661 | $! Else, Check To See If P1 Has A Valid Arguement. | 662 | $! Else, Check To See If P1 Has A Valid Argument. |
| 662 | $! | 663 | $! |
| 663 | $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."DESTEST").OR.(P1.EQS."SPEED") - | 664 | $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."DESTEST").OR.(P1.EQS."SPEED") - |
| 664 | .OR.(P1.EQS."RPW").OR.(P1.EQS."DES").OR.(P1.EQS."DES_OPTS") | 665 | .OR.(P1.EQS."RPW").OR.(P1.EQS."DES").OR.(P1.EQS."DES_OPTS") |
| 665 | $ THEN | 666 | $ THEN |
| 666 | $! | 667 | $! |
| 667 | $! A Valid Arguement. | 668 | $! A Valid Argument. |
| 668 | $! | 669 | $! |
| 669 | $ BUILDALL = P1 | 670 | $ BUILDALL = P1 |
| 670 | $! | 671 | $! |
| @@ -677,7 +678,7 @@ $! | |||
| 677 | $ WRITE SYS$OUTPUT "" | 678 | $ WRITE SYS$OUTPUT "" |
| 678 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" | 679 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" |
| 679 | $ WRITE SYS$OUTPUT "" | 680 | $ WRITE SYS$OUTPUT "" |
| 680 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything. | 681 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything." |
| 681 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library." | 682 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library." |
| 682 | $ WRITE SYS$OUTPUT " DESTEST : To Compile Just The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program." | 683 | $ WRITE SYS$OUTPUT " DESTEST : To Compile Just The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program." |
| 683 | $ WRITE SYS$OUTPUT " SPEED : To Compile Just The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program." | 684 | $ WRITE SYS$OUTPUT " SPEED : To Compile Just The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program." |
| @@ -687,15 +688,16 @@ $ WRITE SYS$OUTPUT " DES_OPTS : To Compile Just The [.xxx.EXE.CRYTPO.DES | |||
| 687 | $ WRITE SYS$OUTPUT "" | 688 | $ WRITE SYS$OUTPUT "" |
| 688 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For: " | 689 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For: " |
| 689 | $ WRITE SYS$OUTPUT "" | 690 | $ WRITE SYS$OUTPUT "" |
| 690 | $ WRITE SYS$OUTPUT " AXP : Alpha Architecture." | 691 | $ WRITE SYS$OUTPUT " ALPHA : Alpha Architecture." |
| 691 | $ WRITE SYS$OUTPUT " VAX : VAX Architecture." | 692 | $ WRITE SYS$OUTPUT " IA64 : IA64 Architecture." |
| 693 | $ WRITE SYS$OUTPUT " VAX : VAX Architecture." | ||
| 692 | $ WRITE SYS$OUTPUT "" | 694 | $ WRITE SYS$OUTPUT "" |
| 693 | $! | 695 | $! |
| 694 | $! Time To EXIT. | 696 | $! Time To EXIT. |
| 695 | $! | 697 | $! |
| 696 | $ EXIT | 698 | $ EXIT |
| 697 | $! | 699 | $! |
| 698 | $! End The Valid Arguement Check. | 700 | $! End The Valid Argument Check. |
| 699 | $! | 701 | $! |
| 700 | $ ENDIF | 702 | $ ENDIF |
| 701 | $! | 703 | $! |
| @@ -752,7 +754,7 @@ $! Time To EXIT. | |||
| 752 | $! | 754 | $! |
| 753 | $ EXIT | 755 | $ EXIT |
| 754 | $! | 756 | $! |
| 755 | $! End The Valid Arguement Check. | 757 | $! End The Valid Argument Check. |
| 756 | $! | 758 | $! |
| 757 | $ ENDIF | 759 | $ ENDIF |
| 758 | $! | 760 | $! |
| @@ -817,7 +819,7 @@ $ ELSE | |||
| 817 | $! | 819 | $! |
| 818 | $! Check To See If We Have VAXC Or DECC. | 820 | $! Check To See If We Have VAXC Or DECC. |
| 819 | $! | 821 | $! |
| 820 | $ IF (ARCH.EQS."AXP").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."") | 822 | $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."") |
| 821 | $ THEN | 823 | $ THEN |
| 822 | $! | 824 | $! |
| 823 | $! Looks Like DECC, Set To Use DECC. | 825 | $! Looks Like DECC, Set To Use DECC. |
| @@ -882,7 +884,7 @@ $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - | |||
| 882 | $! | 884 | $! |
| 883 | $! Define The Linker Options File Name. | 885 | $! Define The Linker Options File Name. |
| 884 | $! | 886 | $! |
| 885 | $ OPT_FILE = "SYS$DISK:[]VAX_DECC_OPTIONS.OPT" | 887 | $ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT" |
| 886 | $! | 888 | $! |
| 887 | $! End DECC Check. | 889 | $! End DECC Check. |
| 888 | $! | 890 | $! |
| @@ -904,9 +906,9 @@ $! | |||
| 904 | $! Compile Using VAXC. | 906 | $! Compile Using VAXC. |
| 905 | $! | 907 | $! |
| 906 | $ CC = "CC" | 908 | $ CC = "CC" |
| 907 | $ IF ARCH.EQS."AXP" | 909 | $ IF ARCH.NES."VAX" |
| 908 | $ THEN | 910 | $ THEN |
| 909 | $ WRITE SYS$OUTPUT "There is no VAX C on Alpha!" | 911 | $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!" |
| 910 | $ EXIT | 912 | $ EXIT |
| 911 | $ ENDIF | 913 | $ ENDIF |
| 912 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" | 914 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" |
| @@ -919,7 +921,7 @@ $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB] | |||
| 919 | $! | 921 | $! |
| 920 | $! Define The Linker Options File Name. | 922 | $! Define The Linker Options File Name. |
| 921 | $! | 923 | $! |
| 922 | $ OPT_FILE = "SYS$DISK:[]VAX_VAXC_OPTIONS.OPT" | 924 | $ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT" |
| 923 | $! | 925 | $! |
| 924 | $! End VAXC Check | 926 | $! End VAXC Check |
| 925 | $! | 927 | $! |
| @@ -944,7 +946,7 @@ $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS | |||
| 944 | $! | 946 | $! |
| 945 | $! Define The Linker Options File Name. | 947 | $! Define The Linker Options File Name. |
| 946 | $! | 948 | $! |
| 947 | $ OPT_FILE = "SYS$DISK:[]VAX_GNUC_OPTIONS.OPT" | 949 | $ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT" |
| 948 | $! | 950 | $! |
| 949 | $! End The GNU C Check. | 951 | $! End The GNU C Check. |
| 950 | $! | 952 | $! |
| @@ -976,7 +978,7 @@ $! Show user the result | |||
| 976 | $! | 978 | $! |
| 977 | $ WRITE SYS$OUTPUT "Main Compiling Command: ",CC | 979 | $ WRITE SYS$OUTPUT "Main Compiling Command: ",CC |
| 978 | $! | 980 | $! |
| 979 | $! Else The User Entered An Invalid Arguement. | 981 | $! Else The User Entered An Invalid Argument. |
| 980 | $! | 982 | $! |
| 981 | $ ELSE | 983 | $ ELSE |
| 982 | $! | 984 | $! |
diff --git a/src/lib/libcrypto/des/des_enc.c b/src/lib/libcrypto/des/des_enc.c index 22701e0669..5c47553a5a 100644 --- a/src/lib/libcrypto/des/des_enc.c +++ b/src/lib/libcrypto/des/des_enc.c | |||
| @@ -57,6 +57,7 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
| 60 | #include "spr.h" | ||
| 60 | 61 | ||
| 61 | #ifndef OPENBSD_DES_ASM | 62 | #ifndef OPENBSD_DES_ASM |
| 62 | 63 | ||
| @@ -109,12 +110,10 @@ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) | |||
| 109 | D_ENCRYPT(l,r,28); /* 15 */ | 110 | D_ENCRYPT(l,r,28); /* 15 */ |
| 110 | D_ENCRYPT(r,l,30); /* 16 */ | 111 | D_ENCRYPT(r,l,30); /* 16 */ |
| 111 | #else | 112 | #else |
| 112 | for (i=0; i<32; i+=8) | 113 | for (i=0; i<32; i+=4) |
| 113 | { | 114 | { |
| 114 | D_ENCRYPT(l,r,i+0); /* 1 */ | 115 | D_ENCRYPT(l,r,i+0); /* 1 */ |
| 115 | D_ENCRYPT(r,l,i+2); /* 2 */ | 116 | D_ENCRYPT(r,l,i+2); /* 2 */ |
| 116 | D_ENCRYPT(l,r,i+4); /* 3 */ | ||
| 117 | D_ENCRYPT(r,l,i+6); /* 4 */ | ||
| 118 | } | 117 | } |
| 119 | #endif | 118 | #endif |
| 120 | } | 119 | } |
| @@ -138,12 +137,10 @@ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) | |||
| 138 | D_ENCRYPT(l,r, 2); /* 2 */ | 137 | D_ENCRYPT(l,r, 2); /* 2 */ |
| 139 | D_ENCRYPT(r,l, 0); /* 1 */ | 138 | D_ENCRYPT(r,l, 0); /* 1 */ |
| 140 | #else | 139 | #else |
| 141 | for (i=30; i>0; i-=8) | 140 | for (i=30; i>0; i-=4) |
| 142 | { | 141 | { |
| 143 | D_ENCRYPT(l,r,i-0); /* 16 */ | 142 | D_ENCRYPT(l,r,i-0); /* 16 */ |
| 144 | D_ENCRYPT(r,l,i-2); /* 15 */ | 143 | D_ENCRYPT(r,l,i-2); /* 15 */ |
| 145 | D_ENCRYPT(l,r,i-4); /* 14 */ | ||
| 146 | D_ENCRYPT(r,l,i-6); /* 13 */ | ||
| 147 | } | 144 | } |
| 148 | #endif | 145 | #endif |
| 149 | } | 146 | } |
| @@ -205,12 +202,10 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) | |||
| 205 | D_ENCRYPT(l,r,28); /* 15 */ | 202 | D_ENCRYPT(l,r,28); /* 15 */ |
| 206 | D_ENCRYPT(r,l,30); /* 16 */ | 203 | D_ENCRYPT(r,l,30); /* 16 */ |
| 207 | #else | 204 | #else |
| 208 | for (i=0; i<32; i+=8) | 205 | for (i=0; i<32; i+=4) |
| 209 | { | 206 | { |
| 210 | D_ENCRYPT(l,r,i+0); /* 1 */ | 207 | D_ENCRYPT(l,r,i+0); /* 1 */ |
| 211 | D_ENCRYPT(r,l,i+2); /* 2 */ | 208 | D_ENCRYPT(r,l,i+2); /* 2 */ |
| 212 | D_ENCRYPT(l,r,i+4); /* 3 */ | ||
| 213 | D_ENCRYPT(r,l,i+6); /* 4 */ | ||
| 214 | } | 209 | } |
| 215 | #endif | 210 | #endif |
| 216 | } | 211 | } |
| @@ -234,12 +229,10 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) | |||
| 234 | D_ENCRYPT(l,r, 2); /* 2 */ | 229 | D_ENCRYPT(l,r, 2); /* 2 */ |
| 235 | D_ENCRYPT(r,l, 0); /* 1 */ | 230 | D_ENCRYPT(r,l, 0); /* 1 */ |
| 236 | #else | 231 | #else |
| 237 | for (i=30; i>0; i-=8) | 232 | for (i=30; i>0; i-=4) |
| 238 | { | 233 | { |
| 239 | D_ENCRYPT(l,r,i-0); /* 16 */ | 234 | D_ENCRYPT(l,r,i-0); /* 16 */ |
| 240 | D_ENCRYPT(r,l,i-2); /* 15 */ | 235 | D_ENCRYPT(r,l,i-2); /* 15 */ |
| 241 | D_ENCRYPT(l,r,i-4); /* 14 */ | ||
| 242 | D_ENCRYPT(r,l,i-6); /* 13 */ | ||
| 243 | } | 236 | } |
| 244 | #endif | 237 | #endif |
| 245 | } | 238 | } |
| @@ -293,8 +286,6 @@ void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, | |||
| 293 | 286 | ||
| 294 | #ifndef DES_DEFAULT_OPTIONS | 287 | #ifndef DES_DEFAULT_OPTIONS |
| 295 | 288 | ||
| 296 | #if !defined(OPENSSL_FIPS_DES_ASM) | ||
| 297 | |||
| 298 | #undef CBC_ENC_C__DONT_UPDATE_IV | 289 | #undef CBC_ENC_C__DONT_UPDATE_IV |
| 299 | #include "ncbc_enc.c" /* DES_ncbc_encrypt */ | 290 | #include "ncbc_enc.c" /* DES_ncbc_encrypt */ |
| 300 | 291 | ||
| @@ -410,6 +401,4 @@ void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, | |||
| 410 | tin[0]=tin[1]=0; | 401 | tin[0]=tin[1]=0; |
| 411 | } | 402 | } |
| 412 | 403 | ||
| 413 | #endif | ||
| 414 | |||
| 415 | #endif /* DES_DEFAULT_OPTIONS */ | 404 | #endif /* DES_DEFAULT_OPTIONS */ |
diff --git a/src/lib/libcrypto/des/des_lib.c b/src/lib/libcrypto/des/des_lib.c deleted file mode 100644 index d4b3047932..0000000000 --- a/src/lib/libcrypto/des/des_lib.c +++ /dev/null | |||
| @@ -1,106 +0,0 @@ | |||
| 1 | /* crypto/des/ecb_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 | #include "des_ver.h" | ||
| 61 | #include <openssl/opensslv.h> | ||
| 62 | #include <openssl/bio.h> | ||
| 63 | |||
| 64 | OPENSSL_GLOBAL const char libdes_version[]="libdes" OPENSSL_VERSION_PTEXT; | ||
| 65 | OPENSSL_GLOBAL const char DES_version[]="DES" OPENSSL_VERSION_PTEXT; | ||
| 66 | |||
| 67 | const char *DES_options(void) | ||
| 68 | { | ||
| 69 | static int init=1; | ||
| 70 | static char buf[32]; | ||
| 71 | |||
| 72 | if (init) | ||
| 73 | { | ||
| 74 | const char *ptr,*unroll,*risc,*size; | ||
| 75 | |||
| 76 | #ifdef DES_PTR | ||
| 77 | ptr="ptr"; | ||
| 78 | #else | ||
| 79 | ptr="idx"; | ||
| 80 | #endif | ||
| 81 | #if defined(DES_RISC1) || defined(DES_RISC2) | ||
| 82 | #ifdef DES_RISC1 | ||
| 83 | risc="risc1"; | ||
| 84 | #endif | ||
| 85 | #ifdef DES_RISC2 | ||
| 86 | risc="risc2"; | ||
| 87 | #endif | ||
| 88 | #else | ||
| 89 | risc="cisc"; | ||
| 90 | #endif | ||
| 91 | #ifdef DES_UNROLL | ||
| 92 | unroll="16"; | ||
| 93 | #else | ||
| 94 | unroll="4"; | ||
| 95 | #endif | ||
| 96 | if (sizeof(DES_LONG) != sizeof(long)) | ||
| 97 | size="int"; | ||
| 98 | else | ||
| 99 | size="long"; | ||
| 100 | BIO_snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, | ||
| 101 | size); | ||
| 102 | init=0; | ||
| 103 | } | ||
| 104 | return(buf); | ||
| 105 | } | ||
| 106 | |||
diff --git a/src/lib/libcrypto/des/des_locl.h b/src/lib/libcrypto/des/des_locl.h index 4b9ecff233..a3b512e9b0 100644 --- a/src/lib/libcrypto/des/des_locl.h +++ b/src/lib/libcrypto/des/des_locl.h | |||
| @@ -61,7 +61,7 @@ | |||
| 61 | 61 | ||
| 62 | #include <openssl/e_os2.h> | 62 | #include <openssl/e_os2.h> |
| 63 | 63 | ||
| 64 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) | 64 | #if defined(OPENSSL_SYS_WIN32) |
| 65 | #ifndef OPENSSL_SYS_MSDOS | 65 | #ifndef OPENSSL_SYS_MSDOS |
| 66 | #define OPENSSL_SYS_MSDOS | 66 | #define OPENSSL_SYS_MSDOS |
| 67 | #endif | 67 | #endif |
| @@ -425,4 +425,8 @@ extern const DES_LONG DES_SPtrans[8][64]; | |||
| 425 | 425 | ||
| 426 | void fcrypt_body(DES_LONG *out,DES_key_schedule *ks, | 426 | void fcrypt_body(DES_LONG *out,DES_key_schedule *ks, |
| 427 | DES_LONG Eswap0, DES_LONG Eswap1); | 427 | DES_LONG Eswap0, DES_LONG Eswap1); |
| 428 | |||
| 429 | #ifdef OPENSSL_SMALL_FOOTPRINT | ||
| 430 | #undef DES_UNROLL | ||
| 431 | #endif | ||
| 428 | #endif | 432 | #endif |
diff --git a/src/lib/libcrypto/des/ecb_enc.c b/src/lib/libcrypto/des/ecb_enc.c index 75ae6cf8bb..0684e769b3 100644 --- a/src/lib/libcrypto/des/ecb_enc.c +++ b/src/lib/libcrypto/des/ecb_enc.c | |||
| @@ -57,7 +57,53 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
| 60 | #include "spr.h" | 60 | #include "des_ver.h" |
| 61 | #include <openssl/opensslv.h> | ||
| 62 | #include <openssl/bio.h> | ||
| 63 | |||
| 64 | OPENSSL_GLOBAL const char libdes_version[]="libdes" OPENSSL_VERSION_PTEXT; | ||
| 65 | OPENSSL_GLOBAL const char DES_version[]="DES" OPENSSL_VERSION_PTEXT; | ||
| 66 | |||
| 67 | const char *DES_options(void) | ||
| 68 | { | ||
| 69 | static int init=1; | ||
| 70 | static char buf[32]; | ||
| 71 | |||
| 72 | if (init) | ||
| 73 | { | ||
| 74 | const char *ptr,*unroll,*risc,*size; | ||
| 75 | |||
| 76 | #ifdef DES_PTR | ||
| 77 | ptr="ptr"; | ||
| 78 | #else | ||
| 79 | ptr="idx"; | ||
| 80 | #endif | ||
| 81 | #if defined(DES_RISC1) || defined(DES_RISC2) | ||
| 82 | #ifdef DES_RISC1 | ||
| 83 | risc="risc1"; | ||
| 84 | #endif | ||
| 85 | #ifdef DES_RISC2 | ||
| 86 | risc="risc2"; | ||
| 87 | #endif | ||
| 88 | #else | ||
| 89 | risc="cisc"; | ||
| 90 | #endif | ||
| 91 | #ifdef DES_UNROLL | ||
| 92 | unroll="16"; | ||
| 93 | #else | ||
| 94 | unroll="2"; | ||
| 95 | #endif | ||
| 96 | if (sizeof(DES_LONG) != sizeof(long)) | ||
| 97 | size="int"; | ||
| 98 | else | ||
| 99 | size="long"; | ||
| 100 | BIO_snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, | ||
| 101 | size); | ||
| 102 | init=0; | ||
| 103 | } | ||
| 104 | return(buf); | ||
| 105 | } | ||
| 106 | |||
| 61 | 107 | ||
| 62 | void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, | 108 | void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, |
| 63 | DES_key_schedule *ks, int enc) | 109 | DES_key_schedule *ks, int enc) |
diff --git a/src/lib/libcrypto/des/enc_read.c b/src/lib/libcrypto/des/enc_read.c index e7da2ec66b..edb6620d08 100644 --- a/src/lib/libcrypto/des/enc_read.c +++ b/src/lib/libcrypto/des/enc_read.c | |||
| @@ -63,7 +63,7 @@ | |||
| 63 | 63 | ||
| 64 | /* This has some uglies in it but it works - even over sockets. */ | 64 | /* This has some uglies in it but it works - even over sockets. */ |
| 65 | /*extern int errno;*/ | 65 | /*extern int errno;*/ |
| 66 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_rw_mode)=DES_PCBC_MODE; | 66 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_rw_mode,DES_PCBC_MODE) |
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | /* | 69 | /* |
| @@ -87,6 +87,9 @@ OPENSSL_IMPLEMENT_GLOBAL(int,DES_rw_mode)=DES_PCBC_MODE; | |||
| 87 | int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, | 87 | int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, |
| 88 | DES_cblock *iv) | 88 | DES_cblock *iv) |
| 89 | { | 89 | { |
| 90 | #if defined(OPENSSL_NO_POSIX_IO) | ||
| 91 | return(0); | ||
| 92 | #else | ||
| 90 | /* data to be unencrypted */ | 93 | /* data to be unencrypted */ |
| 91 | int net_num=0; | 94 | int net_num=0; |
| 92 | static unsigned char *net=NULL; | 95 | static unsigned char *net=NULL; |
| @@ -147,7 +150,7 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, | |||
| 147 | /* first - get the length */ | 150 | /* first - get the length */ |
| 148 | while (net_num < HDRSIZE) | 151 | while (net_num < HDRSIZE) |
| 149 | { | 152 | { |
| 150 | #ifndef _WIN32 | 153 | #ifndef OPENSSL_SYS_WIN32 |
| 151 | i=read(fd,(void *)&(net[net_num]),HDRSIZE-net_num); | 154 | i=read(fd,(void *)&(net[net_num]),HDRSIZE-net_num); |
| 152 | #else | 155 | #else |
| 153 | i=_read(fd,(void *)&(net[net_num]),HDRSIZE-net_num); | 156 | i=_read(fd,(void *)&(net[net_num]),HDRSIZE-net_num); |
| @@ -173,7 +176,11 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, | |||
| 173 | net_num=0; | 176 | net_num=0; |
| 174 | while (net_num < rnum) | 177 | while (net_num < rnum) |
| 175 | { | 178 | { |
| 179 | #ifndef OPENSSL_SYS_WIN32 | ||
| 176 | i=read(fd,(void *)&(net[net_num]),rnum-net_num); | 180 | i=read(fd,(void *)&(net[net_num]),rnum-net_num); |
| 181 | #else | ||
| 182 | i=_read(fd,(void *)&(net[net_num]),rnum-net_num); | ||
| 183 | #endif | ||
| 177 | #ifdef EINTR | 184 | #ifdef EINTR |
| 178 | if ((i == -1) && (errno == EINTR)) continue; | 185 | if ((i == -1) && (errno == EINTR)) continue; |
| 179 | #endif | 186 | #endif |
| @@ -228,5 +235,6 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, | |||
| 228 | } | 235 | } |
| 229 | } | 236 | } |
| 230 | return num; | 237 | return num; |
| 238 | #endif /* OPENSSL_NO_POSIX_IO */ | ||
| 231 | } | 239 | } |
| 232 | 240 | ||
diff --git a/src/lib/libcrypto/des/enc_writ.c b/src/lib/libcrypto/des/enc_writ.c index c2f032c9a6..2353ac1e89 100644 --- a/src/lib/libcrypto/des/enc_writ.c +++ b/src/lib/libcrypto/des/enc_writ.c | |||
| @@ -80,6 +80,9 @@ | |||
| 80 | int DES_enc_write(int fd, const void *_buf, int len, | 80 | int DES_enc_write(int fd, const void *_buf, int len, |
| 81 | DES_key_schedule *sched, DES_cblock *iv) | 81 | DES_key_schedule *sched, DES_cblock *iv) |
| 82 | { | 82 | { |
| 83 | #if defined(OPENSSL_NO_POSIX_IO) | ||
| 84 | return (-1); | ||
| 85 | #else | ||
| 83 | #ifdef _LIBC | 86 | #ifdef _LIBC |
| 84 | extern unsigned long time(); | 87 | extern unsigned long time(); |
| 85 | extern int write(); | 88 | extern int write(); |
| @@ -172,4 +175,5 @@ int DES_enc_write(int fd, const void *_buf, int len, | |||
| 172 | } | 175 | } |
| 173 | 176 | ||
| 174 | return(len); | 177 | return(len); |
| 178 | #endif /* OPENSSL_NO_POSIX_IO */ | ||
| 175 | } | 179 | } |
diff --git a/src/lib/libcrypto/des/fcrypt_b.c b/src/lib/libcrypto/des/fcrypt_b.c index c56b461e91..87fc71eb26 100644 --- a/src/lib/libcrypto/des/fcrypt_b.c +++ b/src/lib/libcrypto/des/fcrypt_b.c | |||
| @@ -102,12 +102,10 @@ void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0, | |||
| 102 | #ifndef DES_UNROLL | 102 | #ifndef DES_UNROLL |
| 103 | register int i; | 103 | register int i; |
| 104 | 104 | ||
| 105 | for (i=0; i<32; i+=8) | 105 | for (i=0; i<32; i+=4) |
| 106 | { | 106 | { |
| 107 | D_ENCRYPT(l,r,i+0); /* 1 */ | 107 | D_ENCRYPT(l,r,i+0); /* 1 */ |
| 108 | D_ENCRYPT(r,l,i+2); /* 2 */ | 108 | D_ENCRYPT(r,l,i+2); /* 2 */ |
| 109 | D_ENCRYPT(l,r,i+4); /* 1 */ | ||
| 110 | D_ENCRYPT(r,l,i+6); /* 2 */ | ||
| 111 | } | 109 | } |
| 112 | #else | 110 | #else |
| 113 | D_ENCRYPT(l,r, 0); /* 1 */ | 111 | D_ENCRYPT(l,r, 0); /* 1 */ |
diff --git a/src/lib/libcrypto/des/rpc_des.h b/src/lib/libcrypto/des/rpc_des.h index efc474f00e..8263c512ab 100644 --- a/src/lib/libcrypto/des/rpc_des.h +++ b/src/lib/libcrypto/des/rpc_des.h | |||
| @@ -124,10 +124,10 @@ struct desparams { | |||
| 124 | /* | 124 | /* |
| 125 | * Encrypt an arbitrary sized buffer | 125 | * Encrypt an arbitrary sized buffer |
| 126 | */ | 126 | */ |
| 127 | #define DESIOCBLOCK _IOWR(d, 6, struct desparams) | 127 | #define DESIOCBLOCK _IOWR('d', 6, struct desparams) |
| 128 | 128 | ||
| 129 | /* | 129 | /* |
| 130 | * Encrypt of small amount of data, quickly | 130 | * Encrypt of small amount of data, quickly |
| 131 | */ | 131 | */ |
| 132 | #define DESIOCQUICK _IOWR(d, 7, struct desparams) | 132 | #define DESIOCQUICK _IOWR('d', 7, struct desparams) |
| 133 | 133 | ||
diff --git a/src/lib/libcrypto/des/set_key.c b/src/lib/libcrypto/des/set_key.c index c0806d593c..3004cc3ab3 100644 --- a/src/lib/libcrypto/des/set_key.c +++ b/src/lib/libcrypto/des/set_key.c | |||
| @@ -64,12 +64,8 @@ | |||
| 64 | * 1.0 First working version | 64 | * 1.0 First working version |
| 65 | */ | 65 | */ |
| 66 | #include "des_locl.h" | 66 | #include "des_locl.h" |
| 67 | #ifdef OPENSSL_FIPS | ||
| 68 | #include <openssl/fips.h> | ||
| 69 | #endif | ||
| 70 | |||
| 71 | 67 | ||
| 72 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key); /* defaults to false */ | 68 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */ |
| 73 | 69 | ||
| 74 | static const unsigned char odd_parity[256]={ | 70 | static const unsigned char odd_parity[256]={ |
| 75 | 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, | 71 | 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, |
| @@ -340,7 +336,7 @@ int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule) | |||
| 340 | 336 | ||
| 341 | void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) | 337 | void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) |
| 342 | { | 338 | { |
| 343 | static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; | 339 | static const int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; |
| 344 | register DES_LONG c,d,t,s,t2; | 340 | register DES_LONG c,d,t,s,t2; |
| 345 | register const unsigned char *in; | 341 | register const unsigned char *in; |
| 346 | register DES_LONG *k; | 342 | register DES_LONG *k; |
| @@ -353,10 +349,6 @@ void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) | |||
| 353 | k = &schedule->ks->deslong[0]; | 349 | k = &schedule->ks->deslong[0]; |
| 354 | in = &(*key)[0]; | 350 | in = &(*key)[0]; |
| 355 | 351 | ||
| 356 | #ifdef OPENSSL_FIPS | ||
| 357 | FIPS_selftest_check(); | ||
| 358 | #endif | ||
| 359 | |||
| 360 | c2l(in,c); | 352 | c2l(in,c); |
| 361 | c2l(in,d); | 353 | c2l(in,d); |
| 362 | 354 | ||
| @@ -413,4 +405,3 @@ void des_fixup_key_parity(des_cblock *key) | |||
| 413 | des_set_odd_parity(key); | 405 | des_set_odd_parity(key); |
| 414 | } | 406 | } |
| 415 | */ | 407 | */ |
| 416 | |||
diff --git a/src/lib/libcrypto/des/times/aix.cc b/src/lib/libcrypto/des/times/aix.cc index e9b2e45751..d96b74e2ce 100644 --- a/src/lib/libcrypto/des/times/aix.cc +++ b/src/lib/libcrypto/des/times/aix.cc | |||
| @@ -2,10 +2,10 @@ From: Paco Garcia <pgarcia@cam.es> | |||
| 2 | 2 | ||
| 3 | This machine is a Bull Estrella Minitower Model MT604-100 | 3 | This machine is a Bull Estrella Minitower Model MT604-100 |
| 4 | Processor : PPC604 | 4 | Processor : PPC604 |
| 5 | P.Speed : 100MHz | 5 | P.Speed : 100Mhz |
| 6 | Data/Instr Cache : 16 K | 6 | Data/Instr Cache : 16 K |
| 7 | L2 Cache : 256 K | 7 | L2 Cache : 256 K |
| 8 | PCI BUS Speed : 33 MHz | 8 | PCI BUS Speed : 33 Mhz |
| 9 | TransfRate PCI : 132 MB/s | 9 | TransfRate PCI : 132 MB/s |
| 10 | Memory : 96 MB | 10 | Memory : 96 MB |
| 11 | 11 | ||
diff --git a/src/lib/libcrypto/des/xcbc_enc.c b/src/lib/libcrypto/des/xcbc_enc.c index dc0c761b71..058cab6bce 100644 --- a/src/lib/libcrypto/des/xcbc_enc.c +++ b/src/lib/libcrypto/des/xcbc_enc.c | |||
| @@ -61,7 +61,7 @@ | |||
| 61 | /* RSA's DESX */ | 61 | /* RSA's DESX */ |
| 62 | 62 | ||
| 63 | #if 0 /* broken code, preserved just in case anyone specifically looks for this */ | 63 | #if 0 /* broken code, preserved just in case anyone specifically looks for this */ |
| 64 | static unsigned char desx_white_in2out[256]={ | 64 | static const unsigned char desx_white_in2out[256]={ |
| 65 | 0xBD,0x56,0xEA,0xF2,0xA2,0xF1,0xAC,0x2A,0xB0,0x93,0xD1,0x9C,0x1B,0x33,0xFD,0xD0, | 65 | 0xBD,0x56,0xEA,0xF2,0xA2,0xF1,0xAC,0x2A,0xB0,0x93,0xD1,0x9C,0x1B,0x33,0xFD,0xD0, |
| 66 | 0x30,0x04,0xB6,0xDC,0x7D,0xDF,0x32,0x4B,0xF7,0xCB,0x45,0x9B,0x31,0xBB,0x21,0x5A, | 66 | 0x30,0x04,0xB6,0xDC,0x7D,0xDF,0x32,0x4B,0xF7,0xCB,0x45,0x9B,0x31,0xBB,0x21,0x5A, |
| 67 | 0x41,0x9F,0xE1,0xD9,0x4A,0x4D,0x9E,0xDA,0xA0,0x68,0x2C,0xC3,0x27,0x5F,0x80,0x36, | 67 | 0x41,0x9F,0xE1,0xD9,0x4A,0x4D,0x9E,0xDA,0xA0,0x68,0x2C,0xC3,0x27,0x5F,0x80,0x36, |
diff --git a/src/lib/libcrypto/dh/Makefile b/src/lib/libcrypto/dh/Makefile index d01fa960eb..f23b4f7fde 100644 --- a/src/lib/libcrypto/dh/Makefile +++ b/src/lib/libcrypto/dh/Makefile | |||
| @@ -17,8 +17,10 @@ TEST= dhtest.c | |||
| 17 | APPS= | 17 | APPS= |
| 18 | 18 | ||
| 19 | LIB=$(TOP)/libcrypto.a | 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 | 20 | LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c \ |
| 21 | LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr.o | 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 | ||
| 22 | 24 | ||
| 23 | SRC= $(LIBSRC) | 25 | SRC= $(LIBSRC) |
| 24 | 26 | ||
| @@ -33,7 +35,7 @@ top: | |||
| 33 | all: lib | 35 | all: lib |
| 34 | 36 | ||
| 35 | lib: $(LIBOBJ) | 37 | lib: $(LIBOBJ) |
| 36 | $(ARX) $(LIB) $(LIBOBJ) | 38 | $(AR) $(LIB) $(LIBOBJ) |
| 37 | $(RANLIB) $(LIB) || echo Never mind. | 39 | $(RANLIB) $(LIB) || echo Never mind. |
| 38 | @touch lib | 40 | @touch lib |
| 39 | 41 | ||
| @@ -74,6 +76,21 @@ clean: | |||
| 74 | 76 | ||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 77 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 76 | 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 | ||
| 77 | dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | 94 | dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h |
| 78 | dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | 95 | dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h |
| 79 | dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | 96 | dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h |
| @@ -129,11 +146,35 @@ dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | |||
| 129 | dh_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 146 | dh_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 130 | dh_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 147 | dh_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 131 | dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 148 | dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 132 | dh_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 149 | dh_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 133 | dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 150 | dh_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 134 | dh_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 151 | dh_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 135 | dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 152 | dh_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 136 | dh_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 153 | dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 137 | dh_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 154 | dh_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 138 | dh_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 155 | dh_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 139 | dh_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dh_lib.c | 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/Makefile.ssl b/src/lib/libcrypto/dh/Makefile.ssl deleted file mode 100644 index e05fc01a12..0000000000 --- a/src/lib/libcrypto/dh/Makefile.ssl +++ /dev/null | |||
| @@ -1,133 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/dh/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= dh | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= dhtest.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c | ||
| 27 | LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= dh.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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 | dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 83 | dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 84 | dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 85 | dh_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 86 | dh_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 87 | dh_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 88 | dh_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 89 | dh_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 90 | dh_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 91 | dh_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_asn1.c | ||
| 92 | dh_check.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 93 | dh_check.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 94 | dh_check.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
| 95 | dh_check.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 96 | dh_check.o: ../../include/openssl/opensslconf.h | ||
| 97 | dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 98 | dh_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 99 | dh_check.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_check.c | ||
| 100 | dh_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 101 | dh_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 102 | dh_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 103 | dh_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 104 | dh_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 105 | dh_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 106 | dh_err.o: ../../include/openssl/symhacks.h dh_err.c | ||
| 107 | dh_gen.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 108 | dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 109 | dh_gen.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
| 110 | dh_gen.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 111 | dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 112 | dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 113 | dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 114 | dh_gen.o: ../cryptlib.h dh_gen.c | ||
| 115 | dh_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 116 | dh_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 117 | dh_key.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
| 118 | dh_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 119 | dh_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 120 | dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 121 | dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 122 | dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c | ||
| 123 | dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 124 | dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 125 | dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 126 | dh_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 127 | dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 128 | dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 129 | dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 130 | dh_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 131 | dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 132 | dh_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 133 | dh_lib.o: ../cryptlib.h dh_lib.c | ||
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h index 10475ac4b3..849309a489 100644 --- a/src/lib/libcrypto/dh/dh.h +++ b/src/lib/libcrypto/dh/dh.h | |||
| @@ -77,8 +77,6 @@ | |||
| 77 | # define OPENSSL_DH_MAX_MODULUS_BITS 10000 | 77 | # define OPENSSL_DH_MAX_MODULUS_BITS 10000 |
| 78 | #endif | 78 | #endif |
| 79 | 79 | ||
| 80 | #define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 | ||
| 81 | |||
| 82 | #define DH_FLAG_CACHE_MONT_P 0x01 | 80 | #define DH_FLAG_CACHE_MONT_P 0x01 |
| 83 | #define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH | 81 | #define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH |
| 84 | * implementation now uses constant time | 82 | * implementation now uses constant time |
| @@ -159,7 +157,6 @@ struct dh_st | |||
| 159 | this for backward compatibility: */ | 157 | this for backward compatibility: */ |
| 160 | #define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME | 158 | #define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME |
| 161 | 159 | ||
| 162 | #define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x) | ||
| 163 | #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ | 160 | #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ |
| 164 | (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) | 161 | (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) |
| 165 | #define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ | 162 | #define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ |
| @@ -167,12 +164,9 @@ struct dh_st | |||
| 167 | #define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x) | 164 | #define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x) |
| 168 | #define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) | 165 | #define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) |
| 169 | 166 | ||
| 170 | const DH_METHOD *DH_OpenSSL(void); | 167 | DH *DHparams_dup(DH *); |
| 171 | 168 | ||
| 172 | #ifdef OPENSSL_FIPS | 169 | const DH_METHOD *DH_OpenSSL(void); |
| 173 | DH * FIPS_dh_new(void); | ||
| 174 | void FIPS_dh_free(DH *dh); | ||
| 175 | #endif | ||
| 176 | 170 | ||
| 177 | void DH_set_default_method(const DH_METHOD *meth); | 171 | void DH_set_default_method(const DH_METHOD *meth); |
| 178 | const DH_METHOD *DH_get_default_method(void); | 172 | const DH_METHOD *DH_get_default_method(void); |
| @@ -212,6 +206,18 @@ int DHparams_print(BIO *bp, const DH *x); | |||
| 212 | int DHparams_print(char *bp, const DH *x); | 206 | int DHparams_print(char *bp, const DH *x); |
| 213 | #endif | 207 | #endif |
| 214 | 208 | ||
| 209 | #define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ | ||
| 210 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ | ||
| 211 | EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) | ||
| 212 | |||
| 213 | #define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ | ||
| 214 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ | ||
| 215 | EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) | ||
| 216 | |||
| 217 | #define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) | ||
| 218 | #define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) | ||
| 219 | |||
| 220 | |||
| 215 | /* BEGIN ERROR CODES */ | 221 | /* BEGIN ERROR CODES */ |
| 216 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 222 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 217 | * made after this point may be overwritten when the script is next run. | 223 | * made after this point may be overwritten when the script is next run. |
| @@ -222,22 +228,31 @@ void ERR_load_DH_strings(void); | |||
| 222 | 228 | ||
| 223 | /* Function codes. */ | 229 | /* Function codes. */ |
| 224 | #define DH_F_COMPUTE_KEY 102 | 230 | #define DH_F_COMPUTE_KEY 102 |
| 225 | #define DH_F_DHPARAMS_PRINT 100 | ||
| 226 | #define DH_F_DHPARAMS_PRINT_FP 101 | 231 | #define DH_F_DHPARAMS_PRINT_FP 101 |
| 227 | #define DH_F_DH_BUILTIN_GENPARAMS 106 | 232 | #define DH_F_DH_BUILTIN_GENPARAMS 106 |
| 228 | #define DH_F_DH_COMPUTE_KEY 107 | ||
| 229 | #define DH_F_DH_GENERATE_KEY 108 | ||
| 230 | #define DH_F_DH_GENERATE_PARAMETERS 109 | ||
| 231 | #define DH_F_DH_NEW_METHOD 105 | 233 | #define DH_F_DH_NEW_METHOD 105 |
| 234 | #define DH_F_DH_PARAM_DECODE 107 | ||
| 235 | #define DH_F_DH_PRIV_DECODE 110 | ||
| 236 | #define DH_F_DH_PRIV_ENCODE 111 | ||
| 237 | #define DH_F_DH_PUB_DECODE 108 | ||
| 238 | #define DH_F_DH_PUB_ENCODE 109 | ||
| 239 | #define DH_F_DO_DH_PRINT 100 | ||
| 232 | #define DH_F_GENERATE_KEY 103 | 240 | #define DH_F_GENERATE_KEY 103 |
| 233 | #define DH_F_GENERATE_PARAMETERS 104 | 241 | #define DH_F_GENERATE_PARAMETERS 104 |
| 242 | #define DH_F_PKEY_DH_DERIVE 112 | ||
| 243 | #define DH_F_PKEY_DH_KEYGEN 113 | ||
| 234 | 244 | ||
| 235 | /* Reason codes. */ | 245 | /* Reason codes. */ |
| 236 | #define DH_R_BAD_GENERATOR 101 | 246 | #define DH_R_BAD_GENERATOR 101 |
| 247 | #define DH_R_BN_DECODE_ERROR 109 | ||
| 248 | #define DH_R_BN_ERROR 106 | ||
| 249 | #define DH_R_DECODE_ERROR 104 | ||
| 237 | #define DH_R_INVALID_PUBKEY 102 | 250 | #define DH_R_INVALID_PUBKEY 102 |
| 238 | #define DH_R_KEY_SIZE_TOO_SMALL 104 | 251 | #define DH_R_KEYS_NOT_SET 108 |
| 239 | #define DH_R_MODULUS_TOO_LARGE 103 | 252 | #define DH_R_MODULUS_TOO_LARGE 103 |
| 253 | #define DH_R_NO_PARAMETERS_SET 107 | ||
| 240 | #define DH_R_NO_PRIVATE_VALUE 100 | 254 | #define DH_R_NO_PRIVATE_VALUE 100 |
| 255 | #define DH_R_PARAMETER_ENCODING_ERROR 105 | ||
| 241 | 256 | ||
| 242 | #ifdef __cplusplus | 257 | #ifdef __cplusplus |
| 243 | } | 258 | } |
diff --git a/src/lib/libcrypto/dh/dh_asn1.c b/src/lib/libcrypto/dh/dh_asn1.c index 76740af2bd..0b4357d605 100644 --- a/src/lib/libcrypto/dh/dh_asn1.c +++ b/src/lib/libcrypto/dh/dh_asn1.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -64,7 +64,8 @@ | |||
| 64 | #include <openssl/asn1t.h> | 64 | #include <openssl/asn1t.h> |
| 65 | 65 | ||
| 66 | /* Override the default free and new methods */ | 66 | /* Override the default free and new methods */ |
| 67 | static int dh_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 67 | static int dh_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 68 | void *exarg) | ||
| 68 | { | 69 | { |
| 69 | if(operation == ASN1_OP_NEW_PRE) { | 70 | if(operation == ASN1_OP_NEW_PRE) { |
| 70 | *pval = (ASN1_VALUE *)DH_new(); | 71 | *pval = (ASN1_VALUE *)DH_new(); |
| @@ -85,3 +86,8 @@ ASN1_SEQUENCE_cb(DHparams, dh_cb) = { | |||
| 85 | } ASN1_SEQUENCE_END_cb(DH, DHparams) | 86 | } ASN1_SEQUENCE_END_cb(DH, DHparams) |
| 86 | 87 | ||
| 87 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DH, DHparams, DHparams) | 88 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DH, DHparams, DHparams) |
| 89 | |||
| 90 | DH *DHparams_dup(DH *dh) | ||
| 91 | { | ||
| 92 | return ASN1_item_dup(ASN1_ITEM_rptr(DHparams), dh); | ||
| 93 | } | ||
diff --git a/src/lib/libcrypto/dh/dh_check.c b/src/lib/libcrypto/dh/dh_check.c index 316cb9221d..066898174e 100644 --- a/src/lib/libcrypto/dh/dh_check.c +++ b/src/lib/libcrypto/dh/dh_check.c | |||
| @@ -70,8 +70,6 @@ | |||
| 70 | * should hold. | 70 | * should hold. |
| 71 | */ | 71 | */ |
| 72 | 72 | ||
| 73 | #ifndef OPENSSL_FIPS | ||
| 74 | |||
| 75 | int DH_check(const DH *dh, int *ret) | 73 | int DH_check(const DH *dh, int *ret) |
| 76 | { | 74 | { |
| 77 | int ok=0; | 75 | int ok=0; |
| @@ -130,11 +128,11 @@ int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) | |||
| 130 | q=BN_new(); | 128 | q=BN_new(); |
| 131 | if (q == NULL) goto err; | 129 | if (q == NULL) goto err; |
| 132 | BN_set_word(q,1); | 130 | BN_set_word(q,1); |
| 133 | if (BN_cmp(pub_key,q) <= 0) | 131 | if (BN_cmp(pub_key,q)<=0) |
| 134 | *ret|=DH_CHECK_PUBKEY_TOO_SMALL; | 132 | *ret|=DH_CHECK_PUBKEY_TOO_SMALL; |
| 135 | BN_copy(q,dh->p); | 133 | BN_copy(q,dh->p); |
| 136 | BN_sub_word(q,1); | 134 | BN_sub_word(q,1); |
| 137 | if (BN_cmp(pub_key,q) >= 0) | 135 | if (BN_cmp(pub_key,q)>=0) |
| 138 | *ret|=DH_CHECK_PUBKEY_TOO_LARGE; | 136 | *ret|=DH_CHECK_PUBKEY_TOO_LARGE; |
| 139 | 137 | ||
| 140 | ok = 1; | 138 | ok = 1; |
| @@ -142,5 +140,3 @@ err: | |||
| 142 | if (q != NULL) BN_free(q); | 140 | if (q != NULL) BN_free(q); |
| 143 | return(ok); | 141 | return(ok); |
| 144 | } | 142 | } |
| 145 | |||
| 146 | #endif | ||
diff --git a/src/lib/libcrypto/dh/dh_err.c b/src/lib/libcrypto/dh/dh_err.c index 13263c81c1..d5cf0c22a3 100644 --- a/src/lib/libcrypto/dh/dh_err.c +++ b/src/lib/libcrypto/dh/dh_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/dh/dh_err.c */ | 1 | /* crypto/dh/dh_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -71,25 +71,34 @@ | |||
| 71 | static ERR_STRING_DATA DH_str_functs[]= | 71 | static ERR_STRING_DATA DH_str_functs[]= |
| 72 | { | 72 | { |
| 73 | {ERR_FUNC(DH_F_COMPUTE_KEY), "COMPUTE_KEY"}, | 73 | {ERR_FUNC(DH_F_COMPUTE_KEY), "COMPUTE_KEY"}, |
| 74 | {ERR_FUNC(DH_F_DHPARAMS_PRINT), "DHparams_print"}, | ||
| 75 | {ERR_FUNC(DH_F_DHPARAMS_PRINT_FP), "DHparams_print_fp"}, | 74 | {ERR_FUNC(DH_F_DHPARAMS_PRINT_FP), "DHparams_print_fp"}, |
| 76 | {ERR_FUNC(DH_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"}, | 75 | {ERR_FUNC(DH_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"}, |
| 77 | {ERR_FUNC(DH_F_DH_COMPUTE_KEY), "DH_compute_key"}, | ||
| 78 | {ERR_FUNC(DH_F_DH_GENERATE_KEY), "DH_generate_key"}, | ||
| 79 | {ERR_FUNC(DH_F_DH_GENERATE_PARAMETERS), "DH_generate_parameters"}, | ||
| 80 | {ERR_FUNC(DH_F_DH_NEW_METHOD), "DH_new_method"}, | 76 | {ERR_FUNC(DH_F_DH_NEW_METHOD), "DH_new_method"}, |
| 77 | {ERR_FUNC(DH_F_DH_PARAM_DECODE), "DH_PARAM_DECODE"}, | ||
| 78 | {ERR_FUNC(DH_F_DH_PRIV_DECODE), "DH_PRIV_DECODE"}, | ||
| 79 | {ERR_FUNC(DH_F_DH_PRIV_ENCODE), "DH_PRIV_ENCODE"}, | ||
| 80 | {ERR_FUNC(DH_F_DH_PUB_DECODE), "DH_PUB_DECODE"}, | ||
| 81 | {ERR_FUNC(DH_F_DH_PUB_ENCODE), "DH_PUB_ENCODE"}, | ||
| 82 | {ERR_FUNC(DH_F_DO_DH_PRINT), "DO_DH_PRINT"}, | ||
| 81 | {ERR_FUNC(DH_F_GENERATE_KEY), "GENERATE_KEY"}, | 83 | {ERR_FUNC(DH_F_GENERATE_KEY), "GENERATE_KEY"}, |
| 82 | {ERR_FUNC(DH_F_GENERATE_PARAMETERS), "GENERATE_PARAMETERS"}, | 84 | {ERR_FUNC(DH_F_GENERATE_PARAMETERS), "GENERATE_PARAMETERS"}, |
| 85 | {ERR_FUNC(DH_F_PKEY_DH_DERIVE), "PKEY_DH_DERIVE"}, | ||
| 86 | {ERR_FUNC(DH_F_PKEY_DH_KEYGEN), "PKEY_DH_KEYGEN"}, | ||
| 83 | {0,NULL} | 87 | {0,NULL} |
| 84 | }; | 88 | }; |
| 85 | 89 | ||
| 86 | static ERR_STRING_DATA DH_str_reasons[]= | 90 | static ERR_STRING_DATA DH_str_reasons[]= |
| 87 | { | 91 | { |
| 88 | {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, | 92 | {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, |
| 93 | {ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"}, | ||
| 94 | {ERR_REASON(DH_R_BN_ERROR) ,"bn error"}, | ||
| 95 | {ERR_REASON(DH_R_DECODE_ERROR) ,"decode error"}, | ||
| 89 | {ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"}, | 96 | {ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"}, |
| 90 | {ERR_REASON(DH_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, | 97 | {ERR_REASON(DH_R_KEYS_NOT_SET) ,"keys not set"}, |
| 91 | {ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"}, | 98 | {ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"}, |
| 99 | {ERR_REASON(DH_R_NO_PARAMETERS_SET) ,"no parameters set"}, | ||
| 92 | {ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, | 100 | {ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, |
| 101 | {ERR_REASON(DH_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, | ||
| 93 | {0,NULL} | 102 | {0,NULL} |
| 94 | }; | 103 | }; |
| 95 | 104 | ||
diff --git a/src/lib/libcrypto/dh/dh_gen.c b/src/lib/libcrypto/dh/dh_gen.c index 999e1deb40..cfd5b11868 100644 --- a/src/lib/libcrypto/dh/dh_gen.c +++ b/src/lib/libcrypto/dh/dh_gen.c | |||
| @@ -66,8 +66,6 @@ | |||
| 66 | #include <openssl/bn.h> | 66 | #include <openssl/bn.h> |
| 67 | #include <openssl/dh.h> | 67 | #include <openssl/dh.h> |
| 68 | 68 | ||
| 69 | #ifndef OPENSSL_FIPS | ||
| 70 | |||
| 71 | static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_GENCB *cb); | 69 | static int dh_builtin_genparams(DH *ret, int prime_len, int generator, BN_GENCB *cb); |
| 72 | 70 | ||
| 73 | int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GENCB *cb) | 71 | int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, BN_GENCB *cb) |
| @@ -175,5 +173,3 @@ err: | |||
| 175 | } | 173 | } |
| 176 | return ok; | 174 | return ok; |
| 177 | } | 175 | } |
| 178 | |||
| 179 | #endif | ||
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c index 79dd331863..e7db440342 100644 --- a/src/lib/libcrypto/dh/dh_key.c +++ b/src/lib/libcrypto/dh/dh_key.c | |||
| @@ -62,8 +62,6 @@ | |||
| 62 | #include <openssl/rand.h> | 62 | #include <openssl/rand.h> |
| 63 | #include <openssl/dh.h> | 63 | #include <openssl/dh.h> |
| 64 | 64 | ||
| 65 | #ifndef OPENSSL_FIPS | ||
| 66 | |||
| 67 | static int generate_key(DH *dh); | 65 | static int generate_key(DH *dh); |
| 68 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); | 66 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); |
| 69 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, | 67 | static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, |
| @@ -263,5 +261,3 @@ static int dh_finish(DH *dh) | |||
| 263 | BN_MONT_CTX_free(dh->method_mont_p); | 261 | BN_MONT_CTX_free(dh->method_mont_p); |
| 264 | return(1); | 262 | return(1); |
| 265 | } | 263 | } |
| 266 | |||
| 267 | #endif | ||
diff --git a/src/lib/libcrypto/doc/DSA_get_ex_new_index.pod b/src/lib/libcrypto/doc/DSA_get_ex_new_index.pod index 4612e708ec..fb6efc1182 100644 --- a/src/lib/libcrypto/doc/DSA_get_ex_new_index.pod +++ b/src/lib/libcrypto/doc/DSA_get_ex_new_index.pod | |||
| @@ -6,7 +6,7 @@ DSA_get_ex_new_index, DSA_set_ex_data, DSA_get_ex_data - add application specifi | |||
| 6 | 6 | ||
| 7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
| 8 | 8 | ||
| 9 | #include <openssl/DSA.h> | 9 | #include <openssl/dsa.h> |
| 10 | 10 | ||
| 11 | int DSA_get_ex_new_index(long argl, void *argp, | 11 | int DSA_get_ex_new_index(long argl, void *argp, |
| 12 | CRYPTO_EX_new *new_func, | 12 | CRYPTO_EX_new *new_func, |
diff --git a/src/lib/libcrypto/doc/EVP_DigestInit.pod b/src/lib/libcrypto/doc/EVP_DigestInit.pod index 236e2fa8d1..37a751b1c5 100644 --- a/src/lib/libcrypto/doc/EVP_DigestInit.pod +++ b/src/lib/libcrypto/doc/EVP_DigestInit.pod | |||
| @@ -64,9 +64,9 @@ EVP digest routines | |||
| 64 | 64 | ||
| 65 | The EVP digest routines are a high level interface to message digests. | 65 | The EVP digest routines are a high level interface to message digests. |
| 66 | 66 | ||
| 67 | EVP_MD_CTX_init() initializes digest contet B<ctx>. | 67 | EVP_MD_CTX_init() initializes digest context B<ctx>. |
| 68 | 68 | ||
| 69 | EVP_MD_CTX_create() allocates, initializes and returns a digest contet. | 69 | EVP_MD_CTX_create() allocates, initializes and returns a digest context. |
| 70 | 70 | ||
| 71 | EVP_DigestInit_ex() sets up digest context B<ctx> to use a digest | 71 | EVP_DigestInit_ex() sets up digest context B<ctx> to use a digest |
| 72 | B<type> from ENGINE B<impl>. B<ctx> must be initialized before calling this | 72 | B<type> from ENGINE B<impl>. B<ctx> must be initialized before calling this |
| @@ -102,7 +102,7 @@ the passed context B<ctx> does not have to be initialized, and it always | |||
| 102 | uses the default digest implementation. | 102 | uses the default digest implementation. |
| 103 | 103 | ||
| 104 | EVP_DigestFinal() is similar to EVP_DigestFinal_ex() except the digest | 104 | EVP_DigestFinal() is similar to EVP_DigestFinal_ex() except the digest |
| 105 | contet B<ctx> is automatically cleaned up. | 105 | context B<ctx> is automatically cleaned up. |
| 106 | 106 | ||
| 107 | EVP_MD_CTX_copy() is similar to EVP_MD_CTX_copy_ex() except the destination | 107 | EVP_MD_CTX_copy() is similar to EVP_MD_CTX_copy_ex() except the destination |
| 108 | B<out> does not have to be initialized. | 108 | B<out> does not have to be initialized. |
| @@ -132,7 +132,9 @@ return B<EVP_MD> structures for the MD2, MD5, SHA, SHA1, MDC2 and RIPEMD160 dige | |||
| 132 | algorithms respectively. The associated signature algorithm is RSA in each case. | 132 | algorithms respectively. The associated signature algorithm is RSA in each case. |
| 133 | 133 | ||
| 134 | EVP_dss() and EVP_dss1() return B<EVP_MD> structures for SHA and SHA1 digest | 134 | EVP_dss() and EVP_dss1() return B<EVP_MD> structures for SHA and SHA1 digest |
| 135 | algorithms but using DSS (DSA) for the signature algorithm. | 135 | algorithms but using DSS (DSA) for the signature algorithm. Note: there is |
| 136 | no need to use these pseudo-digests in OpenSSL 1.0.0 and later, they are | ||
| 137 | however retained for compatibility. | ||
| 136 | 138 | ||
| 137 | EVP_md_null() is a "null" message digest that does nothing: i.e. the hash it | 139 | EVP_md_null() is a "null" message digest that does nothing: i.e. the hash it |
| 138 | returns is of zero length. | 140 | returns is of zero length. |
| @@ -228,12 +230,6 @@ digest name passed on the command line. | |||
| 228 | printf("\n"); | 230 | printf("\n"); |
| 229 | } | 231 | } |
| 230 | 232 | ||
| 231 | =head1 BUGS | ||
| 232 | |||
| 233 | The link between digests and signing algorithms results in a situation where | ||
| 234 | EVP_sha1() must be used with RSA and EVP_dss1() must be used with DSS | ||
| 235 | even though they are identical digests. | ||
| 236 | |||
| 237 | =head1 SEE ALSO | 233 | =head1 SEE ALSO |
| 238 | 234 | ||
| 239 | 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)>, |
| @@ -253,4 +249,11 @@ EVP_md_null(), EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), | |||
| 253 | EVP_dss(), EVP_dss1(), EVP_mdc2() and EVP_ripemd160() were | 249 | EVP_dss(), EVP_dss1(), EVP_mdc2() and EVP_ripemd160() were |
| 254 | changed to return truely const EVP_MD * in OpenSSL 0.9.7. | 250 | changed to return truely const EVP_MD * in OpenSSL 0.9.7. |
| 255 | 251 | ||
| 252 | The link between digests and signing algorithms was fixed in OpenSSL 1.0 and | ||
| 253 | later, so now EVP_sha1() can be used with RSA and DSA, there is no need to | ||
| 254 | use EVP_dss1() any more. | ||
| 255 | |||
| 256 | OpenSSL 1.0 and later does not include the MD2 digest algorithm in the | ||
| 257 | default configuration due to its security weaknesses. | ||
| 258 | |||
| 256 | =cut | 259 | =cut |
diff --git a/src/lib/libcrypto/doc/EVP_SignInit.pod b/src/lib/libcrypto/doc/EVP_SignInit.pod index 0bace24938..781d43e401 100644 --- a/src/lib/libcrypto/doc/EVP_SignInit.pod +++ b/src/lib/libcrypto/doc/EVP_SignInit.pod | |||
| @@ -77,6 +77,15 @@ will occur. | |||
| 77 | Older versions of this documentation wrongly stated that calls to | 77 | Older versions of this documentation wrongly stated that calls to |
| 78 | EVP_SignUpdate() could not be made after calling EVP_SignFinal(). | 78 | EVP_SignUpdate() could not be made after calling EVP_SignFinal(). |
| 79 | 79 | ||
| 80 | Since the private key is passed in the call to EVP_SignFinal() any error | ||
| 81 | relating to the private key (for example an unsuitable key and digest | ||
| 82 | combination) will not be indicated until after potentially large amounts of | ||
| 83 | data have been passed through EVP_SignUpdate(). | ||
| 84 | |||
| 85 | It is not possible to change the signing parameters using these function. | ||
| 86 | |||
| 87 | The previous two bugs are fixed in the newer EVP_SignDigest*() function. | ||
| 88 | |||
| 80 | =head1 SEE ALSO | 89 | =head1 SEE ALSO |
| 81 | 90 | ||
| 82 | L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, | 91 | L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, |
diff --git a/src/lib/libcrypto/doc/EVP_VerifyInit.pod b/src/lib/libcrypto/doc/EVP_VerifyInit.pod index b6afaedee5..9097f09410 100644 --- a/src/lib/libcrypto/doc/EVP_VerifyInit.pod +++ b/src/lib/libcrypto/doc/EVP_VerifyInit.pod | |||
| @@ -67,6 +67,15 @@ will occur. | |||
| 67 | Older versions of this documentation wrongly stated that calls to | 67 | Older versions of this documentation wrongly stated that calls to |
| 68 | EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal(). | 68 | EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal(). |
| 69 | 69 | ||
| 70 | Since the public key is passed in the call to EVP_SignFinal() any error | ||
| 71 | relating to the private key (for example an unsuitable key and digest | ||
| 72 | combination) will not be indicated until after potentially large amounts of | ||
| 73 | data have been passed through EVP_SignUpdate(). | ||
| 74 | |||
| 75 | It is not possible to change the signing parameters using these function. | ||
| 76 | |||
| 77 | The previous two bugs are fixed in the newer EVP_VerifyDigest*() function. | ||
| 78 | |||
| 70 | =head1 SEE ALSO | 79 | =head1 SEE ALSO |
| 71 | 80 | ||
| 72 | L<evp(3)|evp(3)>, | 81 | L<evp(3)|evp(3)>, |
diff --git a/src/lib/libcrypto/doc/d2i_RSAPublicKey.pod b/src/lib/libcrypto/doc/d2i_RSAPublicKey.pod index 279b29c873..aa6078bcf6 100644 --- a/src/lib/libcrypto/doc/d2i_RSAPublicKey.pod +++ b/src/lib/libcrypto/doc/d2i_RSAPublicKey.pod | |||
| @@ -11,21 +11,21 @@ d2i_Netscape_RSA - RSA public and private key encoding functions. | |||
| 11 | #include <openssl/rsa.h> | 11 | #include <openssl/rsa.h> |
| 12 | #include <openssl/x509.h> | 12 | #include <openssl/x509.h> |
| 13 | 13 | ||
| 14 | RSA * d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length); | 14 | RSA * d2i_RSAPublicKey(RSA **a, const unsigned char **pp, long length); |
| 15 | 15 | ||
| 16 | int i2d_RSAPublicKey(RSA *a, unsigned char **pp); | 16 | int i2d_RSAPublicKey(RSA *a, unsigned char **pp); |
| 17 | 17 | ||
| 18 | RSA * d2i_RSA_PUBKEY(RSA **a, unsigned char **pp, long length); | 18 | RSA * d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length); |
| 19 | 19 | ||
| 20 | int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); | 20 | int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); |
| 21 | 21 | ||
| 22 | RSA * d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length); | 22 | RSA * d2i_RSAPrivateKey(RSA **a, const unsigned char **pp, long length); |
| 23 | 23 | ||
| 24 | int i2d_RSAPrivateKey(RSA *a, unsigned char **pp); | 24 | int i2d_RSAPrivateKey(RSA *a, unsigned char **pp); |
| 25 | 25 | ||
| 26 | int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()); | 26 | int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()); |
| 27 | 27 | ||
| 28 | RSA * d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()); | 28 | RSA * d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, int (*cb)()); |
| 29 | 29 | ||
| 30 | =head1 DESCRIPTION | 30 | =head1 DESCRIPTION |
| 31 | 31 | ||
diff --git a/src/lib/libcrypto/doc/evp.pod b/src/lib/libcrypto/doc/evp.pod index b3ca14314f..9faa349243 100644 --- a/src/lib/libcrypto/doc/evp.pod +++ b/src/lib/libcrypto/doc/evp.pod | |||
| @@ -22,14 +22,24 @@ digital signatures. | |||
| 22 | Symmetric encryption is available with the B<EVP_Encrypt>I<...> | 22 | Symmetric encryption is available with the B<EVP_Encrypt>I<...> |
| 23 | functions. The B<EVP_Digest>I<...> functions provide message digests. | 23 | functions. The B<EVP_Digest>I<...> functions provide message digests. |
| 24 | 24 | ||
| 25 | The B<EVP_PKEY>I<...> functions provide a high level interface to | ||
| 26 | asymmetric algorithms. | ||
| 27 | |||
| 25 | Algorithms are loaded with OpenSSL_add_all_algorithms(3). | 28 | Algorithms are loaded with OpenSSL_add_all_algorithms(3). |
| 26 | 29 | ||
| 27 | All the symmetric algorithms (ciphers) and digests can be replaced by ENGINE | 30 | All the symmetric algorithms (ciphers), digests and asymmetric algorithms |
| 28 | modules providing alternative implementations. If ENGINE implementations of | 31 | (public key algorithms) can be replaced by ENGINE modules providing alternative |
| 29 | ciphers or digests are registered as defaults, then the various EVP functions | 32 | implementations. If ENGINE implementations of ciphers or digests are registered |
| 30 | will automatically use those implementations automatically in preference to | 33 | as defaults, then the various EVP functions will automatically use those |
| 31 | built in software implementations. For more information, consult the engine(3) | 34 | implementations automatically in preference to built in software |
| 32 | man page. | 35 | implementations. For more information, consult the engine(3) man page. |
| 36 | |||
| 37 | Although low level algorithm specific functions exist for many algorithms | ||
| 38 | their use is discouraged. They cannot be used with an ENGINE and ENGINE | ||
| 39 | versions of new algorithms cannot be accessed using the low level functions. | ||
| 40 | Also makes code harder to adapt to new algorithms and some options are not | ||
| 41 | cleanly supported at the low level and some operations are more efficient | ||
| 42 | using the high level interface. | ||
| 33 | 43 | ||
| 34 | =head1 SEE ALSO | 44 | =head1 SEE ALSO |
| 35 | 45 | ||
diff --git a/src/lib/libcrypto/dsa/Makefile b/src/lib/libcrypto/dsa/Makefile index 2cc45cdc62..8073c4ecfe 100644 --- a/src/lib/libcrypto/dsa/Makefile +++ b/src/lib/libcrypto/dsa/Makefile | |||
| @@ -18,14 +18,14 @@ APPS= | |||
| 18 | 18 | ||
| 19 | LIB=$(TOP)/libcrypto.a | 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 \ | 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_utl.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 \ | 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_utl.o | 23 | dsa_err.o dsa_ossl.o dsa_depr.o dsa_ameth.o dsa_pmeth.o dsa_prn.o |
| 24 | 24 | ||
| 25 | SRC= $(LIBSRC) | 25 | SRC= $(LIBSRC) |
| 26 | 26 | ||
| 27 | EXHEADER= dsa.h | 27 | EXHEADER= dsa.h |
| 28 | HEADER= $(EXHEADER) | 28 | HEADER= dsa_locl.h $(EXHEADER) |
| 29 | 29 | ||
| 30 | ALL= $(GENERAL) $(SRC) $(HEADER) | 30 | ALL= $(GENERAL) $(SRC) $(HEADER) |
| 31 | 31 | ||
| @@ -35,7 +35,7 @@ top: | |||
| 35 | all: lib | 35 | all: lib |
| 36 | 36 | ||
| 37 | lib: $(LIBOBJ) | 37 | lib: $(LIBOBJ) |
| 38 | $(ARX) $(LIB) $(LIBOBJ) | 38 | $(AR) $(LIB) $(LIBOBJ) |
| 39 | $(RANLIB) $(LIB) || echo Never mind. | 39 | $(RANLIB) $(LIB) || echo Never mind. |
| 40 | @touch lib | 40 | @touch lib |
| 41 | 41 | ||
| @@ -76,12 +76,27 @@ clean: | |||
| 76 | 76 | ||
| 77 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 77 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 78 | 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 | ||
| 79 | dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | 95 | dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h |
| 80 | dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | 96 | dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h |
| 81 | dsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | 97 | dsa_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 82 | dsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | 98 | dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 83 | dsa_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 99 | dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h |
| 84 | dsa_asn1.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
| 85 | dsa_asn1.o: ../../include/openssl/opensslconf.h | 100 | dsa_asn1.o: ../../include/openssl/opensslconf.h |
| 86 | dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 101 | dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 87 | dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 102 | dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| @@ -91,9 +106,8 @@ dsa_depr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | |||
| 91 | dsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 106 | dsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 92 | dsa_depr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 107 | dsa_depr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 93 | dsa_depr.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 108 | dsa_depr.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 94 | dsa_depr.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 109 | dsa_depr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 95 | dsa_depr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 110 | dsa_depr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 96 | dsa_depr.o: ../../include/openssl/opensslconf.h | ||
| 97 | dsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 111 | dsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 98 | dsa_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 112 | dsa_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
| 99 | dsa_depr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 113 | dsa_depr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| @@ -110,13 +124,12 @@ dsa_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | |||
| 110 | dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 124 | dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 111 | dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 125 | dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 112 | dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 126 | dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 113 | dsa_gen.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 127 | dsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 114 | dsa_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 128 | dsa_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 115 | dsa_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 129 | dsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 116 | dsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | 130 | dsa_gen.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
| 117 | dsa_gen.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 131 | dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 118 | dsa_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 132 | dsa_gen.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_gen.c dsa_locl.h |
| 119 | dsa_gen.o: ../cryptlib.h dsa_gen.c | ||
| 120 | dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | 133 | dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 121 | dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 134 | dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 122 | dsa_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 135 | dsa_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| @@ -132,14 +145,14 @@ dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | |||
| 132 | dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 145 | dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 133 | dsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 146 | dsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 134 | dsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 147 | dsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 135 | dsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 148 | dsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 136 | dsa_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 149 | dsa_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 137 | dsa_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 150 | dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 138 | dsa_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 151 | dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 139 | dsa_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 152 | dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 140 | dsa_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 153 | dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 141 | dsa_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 154 | dsa_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 142 | dsa_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dsa_lib.c | 155 | dsa_lib.o: ../cryptlib.h dsa_lib.c |
| 143 | dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h | 156 | dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h |
| 144 | dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 157 | dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 145 | dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 158 | dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| @@ -148,40 +161,48 @@ dsa_ossl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | |||
| 148 | dsa_ossl.o: ../../include/openssl/opensslconf.h | 161 | dsa_ossl.o: ../../include/openssl/opensslconf.h |
| 149 | dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 162 | dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 150 | dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 163 | dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
| 151 | dsa_ossl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 164 | dsa_ossl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 152 | dsa_ossl.o: ../cryptlib.h dsa_ossl.c | 165 | dsa_ossl.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_ossl.c |
| 153 | dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h | 166 | dsa_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h |
| 154 | dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.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 | ||
| 155 | dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 193 | dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 156 | dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 194 | dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 157 | dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/fips.h | 195 | dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/lhash.h |
| 158 | dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 196 | dsa_sign.o: ../../include/openssl/opensslconf.h |
| 159 | dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 197 | dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 160 | dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 198 | dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
| 161 | dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 199 | dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 162 | dsa_sign.o: ../cryptlib.h dsa_sign.c | 200 | dsa_sign.o: ../cryptlib.h dsa_sign.c |
| 163 | dsa_utl.o: ../../e_os.h ../../include/openssl/asn1.h | 201 | dsa_vrf.o: ../../e_os.h ../../include/openssl/bio.h |
| 164 | dsa_utl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 202 | dsa_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 165 | dsa_utl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 203 | dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 166 | dsa_utl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | 204 | dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h |
| 167 | dsa_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 168 | dsa_utl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 169 | dsa_utl.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 170 | dsa_utl.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | ||
| 171 | dsa_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 172 | dsa_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 173 | dsa_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 174 | dsa_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 175 | dsa_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 176 | dsa_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 177 | dsa_utl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h dsa_utl.c | ||
| 178 | dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 179 | dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 180 | dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 181 | dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | ||
| 182 | dsa_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 183 | dsa_vrf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
| 184 | dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 205 | dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 185 | dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | 206 | dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
| 186 | dsa_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 207 | dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 187 | dsa_vrf.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_vrf.c | 208 | dsa_vrf.o: ../cryptlib.h dsa_vrf.c |
diff --git a/src/lib/libcrypto/dsa/Makefile.ssl b/src/lib/libcrypto/dsa/Makefile.ssl deleted file mode 100644 index e5f8a8cf51..0000000000 --- a/src/lib/libcrypto/dsa/Makefile.ssl +++ /dev/null | |||
| @@ -1,171 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/dsa/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= dsa | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST=dsatest.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \ | ||
| 27 | dsa_err.c dsa_ossl.c | ||
| 28 | LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \ | ||
| 29 | dsa_err.o dsa_ossl.o | ||
| 30 | |||
| 31 | SRC= $(LIBSRC) | ||
| 32 | |||
| 33 | EXHEADER= dsa.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.ssl >> $(TOP)/MINFO | ||
| 50 | |||
| 51 | links: | ||
| 52 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 55 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 56 | |||
| 57 | install: | ||
| 58 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 74 | |||
| 75 | dclean: | ||
| 76 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 77 | mv -f Makefile.new $(MAKEFILE) | ||
| 78 | |||
| 79 | clean: | ||
| 80 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 81 | |||
| 82 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 83 | |||
| 84 | dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 85 | dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 86 | dsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 87 | dsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 88 | dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 89 | dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 90 | dsa_asn1.o: ../../include/openssl/opensslconf.h | ||
| 91 | dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 92 | dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 93 | dsa_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_asn1.c | ||
| 94 | dsa_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 95 | dsa_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 96 | dsa_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 97 | dsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 98 | dsa_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 99 | dsa_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 100 | dsa_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 101 | dsa_err.o: dsa_err.c | ||
| 102 | dsa_gen.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 103 | dsa_gen.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 104 | dsa_gen.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 105 | dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 106 | dsa_gen.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 107 | dsa_gen.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 108 | dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 109 | dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 110 | dsa_gen.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 111 | dsa_gen.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 112 | dsa_gen.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 113 | dsa_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 114 | dsa_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 115 | dsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 116 | dsa_gen.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 117 | dsa_gen.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 118 | dsa_gen.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 119 | dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 120 | dsa_gen.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 121 | dsa_gen.o: ../../include/openssl/ui_compat.h ../cryptlib.h dsa_gen.c | ||
| 122 | dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 123 | dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 124 | dsa_key.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 125 | dsa_key.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 126 | dsa_key.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 127 | dsa_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 128 | dsa_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 129 | dsa_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 130 | dsa_key.o: ../cryptlib.h dsa_key.c | ||
| 131 | dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 132 | dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 133 | dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 134 | dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 135 | dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 136 | dsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 137 | dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 138 | dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 139 | dsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 140 | dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 141 | dsa_lib.o: ../../include/openssl/ui.h ../cryptlib.h dsa_lib.c | ||
| 142 | dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 143 | dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 144 | dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 145 | dsa_ossl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 146 | dsa_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 147 | dsa_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 148 | dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 149 | dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 150 | dsa_ossl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 151 | dsa_ossl.o: ../cryptlib.h dsa_ossl.c | ||
| 152 | dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 153 | dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 154 | dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 155 | dsa_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 156 | dsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 157 | dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 158 | dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 159 | dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 160 | dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 161 | dsa_sign.o: ../cryptlib.h dsa_sign.c | ||
| 162 | dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 163 | dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 164 | dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 165 | dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 166 | dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 167 | dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 168 | dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 169 | dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 170 | dsa_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 171 | dsa_vrf.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_vrf.c | ||
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 702c50d6dc..ac50a5c846 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
| @@ -88,8 +88,6 @@ | |||
| 88 | # define OPENSSL_DSA_MAX_MODULUS_BITS 10000 | 88 | # define OPENSSL_DSA_MAX_MODULUS_BITS 10000 |
| 89 | #endif | 89 | #endif |
| 90 | 90 | ||
| 91 | #define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 | ||
| 92 | |||
| 93 | #define DSA_FLAG_CACHE_MONT_P 0x01 | 91 | #define DSA_FLAG_CACHE_MONT_P 0x01 |
| 94 | #define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA | 92 | #define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA |
| 95 | * implementation now uses constant time | 93 | * implementation now uses constant time |
| @@ -99,25 +97,6 @@ | |||
| 99 | * be used for all exponents. | 97 | * be used for all exponents. |
| 100 | */ | 98 | */ |
| 101 | 99 | ||
| 102 | /* If this flag is set the DSA method is FIPS compliant and can be used | ||
| 103 | * in FIPS mode. This is set in the validated module method. If an | ||
| 104 | * application sets this flag in its own methods it is its reposibility | ||
| 105 | * to ensure the result is compliant. | ||
| 106 | */ | ||
| 107 | |||
| 108 | #define DSA_FLAG_FIPS_METHOD 0x0400 | ||
| 109 | |||
| 110 | /* If this flag is set the operations normally disabled in FIPS mode are | ||
| 111 | * permitted it is then the applications responsibility to ensure that the | ||
| 112 | * usage is compliant. | ||
| 113 | */ | ||
| 114 | |||
| 115 | #define DSA_FLAG_NON_FIPS_ALLOW 0x0400 | ||
| 116 | |||
| 117 | #ifdef OPENSSL_FIPS | ||
| 118 | #define FIPS_DSA_SIZE_T int | ||
| 119 | #endif | ||
| 120 | |||
| 121 | #ifdef __cplusplus | 100 | #ifdef __cplusplus |
| 122 | extern "C" { | 101 | extern "C" { |
| 123 | #endif | 102 | #endif |
| @@ -139,7 +118,7 @@ struct dsa_method | |||
| 139 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, | 118 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, |
| 140 | BIGNUM **rp); | 119 | BIGNUM **rp); |
| 141 | int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, | 120 | int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, |
| 142 | DSA_SIG *sig, DSA *dsa); | 121 | DSA_SIG *sig, DSA *dsa); |
| 143 | int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, | 122 | int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, |
| 144 | BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, | 123 | BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, |
| 145 | BN_MONT_CTX *in_mont); | 124 | BN_MONT_CTX *in_mont); |
| @@ -152,7 +131,7 @@ struct dsa_method | |||
| 152 | char *app_data; | 131 | char *app_data; |
| 153 | /* If this is non-NULL, it is used to generate DSA parameters */ | 132 | /* If this is non-NULL, it is used to generate DSA parameters */ |
| 154 | int (*dsa_paramgen)(DSA *dsa, int bits, | 133 | int (*dsa_paramgen)(DSA *dsa, int bits, |
| 155 | unsigned char *seed, int seed_len, | 134 | const unsigned char *seed, int seed_len, |
| 156 | int *counter_ret, unsigned long *h_ret, | 135 | int *counter_ret, unsigned long *h_ret, |
| 157 | BN_GENCB *cb); | 136 | BN_GENCB *cb); |
| 158 | /* If this is non-NULL, it is used to generate DSA keys */ | 137 | /* If this is non-NULL, it is used to generate DSA keys */ |
| @@ -186,7 +165,6 @@ struct dsa_st | |||
| 186 | ENGINE *engine; | 165 | ENGINE *engine; |
| 187 | }; | 166 | }; |
| 188 | 167 | ||
| 189 | #define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x) | ||
| 190 | #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ | 168 | #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ |
| 191 | (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) | 169 | (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) |
| 192 | #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ | 170 | #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ |
| @@ -195,6 +173,7 @@ struct dsa_st | |||
| 195 | #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) | 173 | #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) |
| 196 | 174 | ||
| 197 | 175 | ||
| 176 | DSA *DSAparams_dup(DSA *x); | ||
| 198 | DSA_SIG * DSA_SIG_new(void); | 177 | DSA_SIG * DSA_SIG_new(void); |
| 199 | void DSA_SIG_free(DSA_SIG *a); | 178 | void DSA_SIG_free(DSA_SIG *a); |
| 200 | int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); | 179 | int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); |
| @@ -210,11 +189,6 @@ void DSA_set_default_method(const DSA_METHOD *); | |||
| 210 | const DSA_METHOD *DSA_get_default_method(void); | 189 | const DSA_METHOD *DSA_get_default_method(void); |
| 211 | int DSA_set_method(DSA *dsa, const DSA_METHOD *); | 190 | int DSA_set_method(DSA *dsa, const DSA_METHOD *); |
| 212 | 191 | ||
| 213 | #ifdef OPENSSL_FIPS | ||
| 214 | DSA * FIPS_dsa_new(void); | ||
| 215 | void FIPS_dsa_free (DSA *r); | ||
| 216 | #endif | ||
| 217 | |||
| 218 | DSA * DSA_new(void); | 192 | DSA * DSA_new(void); |
| 219 | DSA * DSA_new_method(ENGINE *engine); | 193 | DSA * DSA_new_method(ENGINE *engine); |
| 220 | void DSA_free (DSA *r); | 194 | void DSA_free (DSA *r); |
| @@ -246,7 +220,7 @@ DSA * DSA_generate_parameters(int bits, | |||
| 246 | 220 | ||
| 247 | /* New version */ | 221 | /* New version */ |
| 248 | int DSA_generate_parameters_ex(DSA *dsa, int bits, | 222 | int DSA_generate_parameters_ex(DSA *dsa, int bits, |
| 249 | unsigned char *seed,int seed_len, | 223 | const unsigned char *seed,int seed_len, |
| 250 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); | 224 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); |
| 251 | 225 | ||
| 252 | int DSA_generate_key(DSA *a); | 226 | int DSA_generate_key(DSA *a); |
| @@ -275,10 +249,13 @@ int DSA_print_fp(FILE *bp, const DSA *x, int off); | |||
| 275 | DH *DSA_dup_DH(const DSA *r); | 249 | DH *DSA_dup_DH(const DSA *r); |
| 276 | #endif | 250 | #endif |
| 277 | 251 | ||
| 278 | #ifdef OPENSSL_FIPS | 252 | #define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ |
| 279 | int FIPS_dsa_sig_encode(unsigned char *out, DSA_SIG *sig); | 253 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ |
| 280 | int FIPS_dsa_sig_decode(DSA_SIG *sig, const unsigned char *in, int inlen); | 254 | EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) |
| 281 | #endif | 255 | |
| 256 | #define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) | ||
| 257 | #define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) | ||
| 258 | #define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) | ||
| 282 | 259 | ||
| 283 | /* BEGIN ERROR CODES */ | 260 | /* BEGIN ERROR CODES */ |
| 284 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 261 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| @@ -290,33 +267,39 @@ void ERR_load_DSA_strings(void); | |||
| 290 | 267 | ||
| 291 | /* Function codes. */ | 268 | /* Function codes. */ |
| 292 | #define DSA_F_D2I_DSA_SIG 110 | 269 | #define DSA_F_D2I_DSA_SIG 110 |
| 270 | #define DSA_F_DO_DSA_PRINT 104 | ||
| 293 | #define DSA_F_DSAPARAMS_PRINT 100 | 271 | #define DSA_F_DSAPARAMS_PRINT 100 |
| 294 | #define DSA_F_DSAPARAMS_PRINT_FP 101 | 272 | #define DSA_F_DSAPARAMS_PRINT_FP 101 |
| 295 | #define DSA_F_DSA_BUILTIN_KEYGEN 119 | ||
| 296 | #define DSA_F_DSA_BUILTIN_PARAMGEN 118 | ||
| 297 | #define DSA_F_DSA_DO_SIGN 112 | 273 | #define DSA_F_DSA_DO_SIGN 112 |
| 298 | #define DSA_F_DSA_DO_VERIFY 113 | 274 | #define DSA_F_DSA_DO_VERIFY 113 |
| 299 | #define DSA_F_DSA_GENERATE_PARAMETERS 117 | ||
| 300 | #define DSA_F_DSA_NEW_METHOD 103 | 275 | #define DSA_F_DSA_NEW_METHOD 103 |
| 301 | #define DSA_F_DSA_PRINT 104 | 276 | #define DSA_F_DSA_PARAM_DECODE 119 |
| 302 | #define DSA_F_DSA_PRINT_FP 105 | 277 | #define DSA_F_DSA_PRINT_FP 105 |
| 303 | #define DSA_F_DSA_SET_DEFAULT_METHOD 115 | 278 | #define DSA_F_DSA_PRIV_DECODE 115 |
| 304 | #define DSA_F_DSA_SET_METHOD 116 | 279 | #define DSA_F_DSA_PRIV_ENCODE 116 |
| 280 | #define DSA_F_DSA_PUB_DECODE 117 | ||
| 281 | #define DSA_F_DSA_PUB_ENCODE 118 | ||
| 305 | #define DSA_F_DSA_SIGN 106 | 282 | #define DSA_F_DSA_SIGN 106 |
| 306 | #define DSA_F_DSA_SIGN_SETUP 107 | 283 | #define DSA_F_DSA_SIGN_SETUP 107 |
| 307 | #define DSA_F_DSA_SIG_NEW 109 | 284 | #define DSA_F_DSA_SIG_NEW 109 |
| 308 | #define DSA_F_DSA_VERIFY 108 | 285 | #define DSA_F_DSA_VERIFY 108 |
| 309 | #define DSA_F_I2D_DSA_SIG 111 | 286 | #define DSA_F_I2D_DSA_SIG 111 |
| 287 | #define DSA_F_OLD_DSA_PRIV_DECODE 122 | ||
| 288 | #define DSA_F_PKEY_DSA_CTRL 120 | ||
| 289 | #define DSA_F_PKEY_DSA_KEYGEN 121 | ||
| 310 | #define DSA_F_SIG_CB 114 | 290 | #define DSA_F_SIG_CB 114 |
| 311 | 291 | ||
| 312 | /* Reason codes. */ | 292 | /* Reason codes. */ |
| 313 | #define DSA_R_BAD_Q_VALUE 102 | 293 | #define DSA_R_BAD_Q_VALUE 102 |
| 294 | #define DSA_R_BN_DECODE_ERROR 108 | ||
| 295 | #define DSA_R_BN_ERROR 109 | ||
| 314 | #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 | 296 | #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 |
| 315 | #define DSA_R_KEY_SIZE_TOO_SMALL 106 | 297 | #define DSA_R_DECODE_ERROR 104 |
| 298 | #define DSA_R_INVALID_DIGEST_TYPE 106 | ||
| 316 | #define DSA_R_MISSING_PARAMETERS 101 | 299 | #define DSA_R_MISSING_PARAMETERS 101 |
| 317 | #define DSA_R_MODULUS_TOO_LARGE 103 | 300 | #define DSA_R_MODULUS_TOO_LARGE 103 |
| 318 | #define DSA_R_NON_FIPS_METHOD 104 | 301 | #define DSA_R_NO_PARAMETERS_SET 107 |
| 319 | #define DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE 105 | 302 | #define DSA_R_PARAMETER_ENCODING_ERROR 105 |
| 320 | 303 | ||
| 321 | #ifdef __cplusplus | 304 | #ifdef __cplusplus |
| 322 | } | 305 | } |
diff --git a/src/lib/libcrypto/dsa/dsa_asn1.c b/src/lib/libcrypto/dsa/dsa_asn1.c index 0645facb4b..c37460b2d6 100644 --- a/src/lib/libcrypto/dsa/dsa_asn1.c +++ b/src/lib/libcrypto/dsa/dsa_asn1.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -61,24 +61,23 @@ | |||
| 61 | #include <openssl/dsa.h> | 61 | #include <openssl/dsa.h> |
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/bn.h> | ||
| 65 | #ifdef OPENSSL_FIPS | ||
| 66 | #include <openssl/fips.h> | ||
| 67 | #endif | ||
| 68 | |||
| 69 | 64 | ||
| 70 | /* Override the default new methods */ | 65 | /* Override the default new methods */ |
| 71 | static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 66 | static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 67 | void *exarg) | ||
| 72 | { | 68 | { |
| 73 | if(operation == ASN1_OP_NEW_PRE) { | 69 | if(operation == ASN1_OP_NEW_PRE) { |
| 74 | DSA_SIG *sig; | 70 | DSA_SIG *sig; |
| 75 | sig = OPENSSL_malloc(sizeof(DSA_SIG)); | 71 | sig = OPENSSL_malloc(sizeof(DSA_SIG)); |
| 72 | if (!sig) | ||
| 73 | { | ||
| 74 | DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); | ||
| 75 | return 0; | ||
| 76 | } | ||
| 76 | sig->r = NULL; | 77 | sig->r = NULL; |
| 77 | sig->s = NULL; | 78 | sig->s = NULL; |
| 78 | *pval = (ASN1_VALUE *)sig; | 79 | *pval = (ASN1_VALUE *)sig; |
| 79 | if(sig) return 2; | 80 | return 2; |
| 80 | DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); | ||
| 81 | return 0; | ||
| 82 | } | 81 | } |
| 83 | return 1; | 82 | return 1; |
| 84 | } | 83 | } |
| @@ -88,10 +87,11 @@ ASN1_SEQUENCE_cb(DSA_SIG, sig_cb) = { | |||
| 88 | ASN1_SIMPLE(DSA_SIG, s, CBIGNUM) | 87 | ASN1_SIMPLE(DSA_SIG, s, CBIGNUM) |
| 89 | } ASN1_SEQUENCE_END_cb(DSA_SIG, DSA_SIG) | 88 | } ASN1_SEQUENCE_END_cb(DSA_SIG, DSA_SIG) |
| 90 | 89 | ||
| 91 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA_SIG,DSA_SIG,DSA_SIG) | 90 | IMPLEMENT_ASN1_FUNCTIONS_const(DSA_SIG) |
| 92 | 91 | ||
| 93 | /* Override the default free and new methods */ | 92 | /* Override the default free and new methods */ |
| 94 | static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 93 | static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 94 | void *exarg) | ||
| 95 | { | 95 | { |
| 96 | if(operation == ASN1_OP_NEW_PRE) { | 96 | if(operation == ASN1_OP_NEW_PRE) { |
| 97 | *pval = (ASN1_VALUE *)DSA_new(); | 97 | *pval = (ASN1_VALUE *)DSA_new(); |
| @@ -144,75 +144,7 @@ ASN1_CHOICE_cb(DSAPublicKey, dsa_cb) = { | |||
| 144 | 144 | ||
| 145 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA, DSAPublicKey, DSAPublicKey) | 145 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA, DSAPublicKey, DSAPublicKey) |
| 146 | 146 | ||
| 147 | int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, | 147 | DSA *DSAparams_dup(DSA *dsa) |
| 148 | unsigned int *siglen, DSA *dsa) | ||
| 149 | { | ||
| 150 | DSA_SIG *s; | ||
| 151 | #ifdef OPENSSL_FIPS | ||
| 152 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW)) | ||
| 153 | { | ||
| 154 | DSAerr(DSA_F_DSA_SIGN, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
| 155 | return 0; | ||
| 156 | } | ||
| 157 | #endif | ||
| 158 | s=DSA_do_sign(dgst,dlen,dsa); | ||
| 159 | if (s == NULL) | ||
| 160 | { | ||
| 161 | *siglen=0; | ||
| 162 | return(0); | ||
| 163 | } | ||
| 164 | *siglen=i2d_DSA_SIG(s,&sig); | ||
| 165 | DSA_SIG_free(s); | ||
| 166 | return(1); | ||
| 167 | } | ||
| 168 | |||
| 169 | int DSA_size(const DSA *r) | ||
| 170 | { | ||
| 171 | int ret,i; | ||
| 172 | ASN1_INTEGER bs; | ||
| 173 | unsigned char buf[4]; /* 4 bytes looks really small. | ||
| 174 | However, i2d_ASN1_INTEGER() will not look | ||
| 175 | beyond the first byte, as long as the second | ||
| 176 | parameter is NULL. */ | ||
| 177 | |||
| 178 | i=BN_num_bits(r->q); | ||
| 179 | bs.length=(i+7)/8; | ||
| 180 | bs.data=buf; | ||
| 181 | bs.type=V_ASN1_INTEGER; | ||
| 182 | /* If the top bit is set the asn1 encoding is 1 larger. */ | ||
| 183 | buf[0]=0xff; | ||
| 184 | |||
| 185 | i=i2d_ASN1_INTEGER(&bs,NULL); | ||
| 186 | i+=i; /* r and s */ | ||
| 187 | ret=ASN1_object_size(1,i,V_ASN1_SEQUENCE); | ||
| 188 | return(ret); | ||
| 189 | } | ||
| 190 | |||
| 191 | /* data has already been hashed (probably with SHA or SHA-1). */ | ||
| 192 | /* returns | ||
| 193 | * 1: correct signature | ||
| 194 | * 0: incorrect signature | ||
| 195 | * -1: error | ||
| 196 | */ | ||
| 197 | int DSA_verify(int type, const unsigned char *dgst, int dgst_len, | ||
| 198 | const unsigned char *sigbuf, int siglen, DSA *dsa) | ||
| 199 | { | 148 | { |
| 200 | DSA_SIG *s; | 149 | return ASN1_item_dup(ASN1_ITEM_rptr(DSAparams), dsa); |
| 201 | int ret=-1; | ||
| 202 | #ifdef OPENSSL_FIPS | ||
| 203 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW)) | ||
| 204 | { | ||
| 205 | DSAerr(DSA_F_DSA_VERIFY, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
| 206 | return 0; | ||
| 207 | } | ||
| 208 | #endif | ||
| 209 | |||
| 210 | s = DSA_SIG_new(); | ||
| 211 | if (s == NULL) return(ret); | ||
| 212 | if (d2i_DSA_SIG(&s,&sigbuf,siglen) == NULL) goto err; | ||
| 213 | ret=DSA_do_verify(dgst,dgst_len,s,dsa); | ||
| 214 | err: | ||
| 215 | DSA_SIG_free(s); | ||
| 216 | return(ret); | ||
| 217 | } | 150 | } |
| 218 | |||
diff --git a/src/lib/libcrypto/dsa/dsa_err.c b/src/lib/libcrypto/dsa/dsa_err.c index 872839af94..bba984e92e 100644 --- a/src/lib/libcrypto/dsa/dsa_err.c +++ b/src/lib/libcrypto/dsa/dsa_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/dsa/dsa_err.c */ | 1 | /* crypto/dsa/dsa_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -71,23 +71,26 @@ | |||
| 71 | static ERR_STRING_DATA DSA_str_functs[]= | 71 | static ERR_STRING_DATA DSA_str_functs[]= |
| 72 | { | 72 | { |
| 73 | {ERR_FUNC(DSA_F_D2I_DSA_SIG), "d2i_DSA_SIG"}, | 73 | {ERR_FUNC(DSA_F_D2I_DSA_SIG), "d2i_DSA_SIG"}, |
| 74 | {ERR_FUNC(DSA_F_DO_DSA_PRINT), "DO_DSA_PRINT"}, | ||
| 74 | {ERR_FUNC(DSA_F_DSAPARAMS_PRINT), "DSAparams_print"}, | 75 | {ERR_FUNC(DSA_F_DSAPARAMS_PRINT), "DSAparams_print"}, |
| 75 | {ERR_FUNC(DSA_F_DSAPARAMS_PRINT_FP), "DSAparams_print_fp"}, | 76 | {ERR_FUNC(DSA_F_DSAPARAMS_PRINT_FP), "DSAparams_print_fp"}, |
| 76 | {ERR_FUNC(DSA_F_DSA_BUILTIN_KEYGEN), "DSA_BUILTIN_KEYGEN"}, | ||
| 77 | {ERR_FUNC(DSA_F_DSA_BUILTIN_PARAMGEN), "DSA_BUILTIN_PARAMGEN"}, | ||
| 78 | {ERR_FUNC(DSA_F_DSA_DO_SIGN), "DSA_do_sign"}, | 77 | {ERR_FUNC(DSA_F_DSA_DO_SIGN), "DSA_do_sign"}, |
| 79 | {ERR_FUNC(DSA_F_DSA_DO_VERIFY), "DSA_do_verify"}, | 78 | {ERR_FUNC(DSA_F_DSA_DO_VERIFY), "DSA_do_verify"}, |
| 80 | {ERR_FUNC(DSA_F_DSA_GENERATE_PARAMETERS), "DSA_generate_parameters"}, | ||
| 81 | {ERR_FUNC(DSA_F_DSA_NEW_METHOD), "DSA_new_method"}, | 79 | {ERR_FUNC(DSA_F_DSA_NEW_METHOD), "DSA_new_method"}, |
| 82 | {ERR_FUNC(DSA_F_DSA_PRINT), "DSA_print"}, | 80 | {ERR_FUNC(DSA_F_DSA_PARAM_DECODE), "DSA_PARAM_DECODE"}, |
| 83 | {ERR_FUNC(DSA_F_DSA_PRINT_FP), "DSA_print_fp"}, | 81 | {ERR_FUNC(DSA_F_DSA_PRINT_FP), "DSA_print_fp"}, |
| 84 | {ERR_FUNC(DSA_F_DSA_SET_DEFAULT_METHOD), "DSA_set_default_method"}, | 82 | {ERR_FUNC(DSA_F_DSA_PRIV_DECODE), "DSA_PRIV_DECODE"}, |
| 85 | {ERR_FUNC(DSA_F_DSA_SET_METHOD), "DSA_set_method"}, | 83 | {ERR_FUNC(DSA_F_DSA_PRIV_ENCODE), "DSA_PRIV_ENCODE"}, |
| 84 | {ERR_FUNC(DSA_F_DSA_PUB_DECODE), "DSA_PUB_DECODE"}, | ||
| 85 | {ERR_FUNC(DSA_F_DSA_PUB_ENCODE), "DSA_PUB_ENCODE"}, | ||
| 86 | {ERR_FUNC(DSA_F_DSA_SIGN), "DSA_sign"}, | 86 | {ERR_FUNC(DSA_F_DSA_SIGN), "DSA_sign"}, |
| 87 | {ERR_FUNC(DSA_F_DSA_SIGN_SETUP), "DSA_sign_setup"}, | 87 | {ERR_FUNC(DSA_F_DSA_SIGN_SETUP), "DSA_sign_setup"}, |
| 88 | {ERR_FUNC(DSA_F_DSA_SIG_NEW), "DSA_SIG_new"}, | 88 | {ERR_FUNC(DSA_F_DSA_SIG_NEW), "DSA_SIG_new"}, |
| 89 | {ERR_FUNC(DSA_F_DSA_VERIFY), "DSA_verify"}, | 89 | {ERR_FUNC(DSA_F_DSA_VERIFY), "DSA_verify"}, |
| 90 | {ERR_FUNC(DSA_F_I2D_DSA_SIG), "i2d_DSA_SIG"}, | 90 | {ERR_FUNC(DSA_F_I2D_DSA_SIG), "i2d_DSA_SIG"}, |
| 91 | {ERR_FUNC(DSA_F_OLD_DSA_PRIV_DECODE), "OLD_DSA_PRIV_DECODE"}, | ||
| 92 | {ERR_FUNC(DSA_F_PKEY_DSA_CTRL), "PKEY_DSA_CTRL"}, | ||
| 93 | {ERR_FUNC(DSA_F_PKEY_DSA_KEYGEN), "PKEY_DSA_KEYGEN"}, | ||
| 91 | {ERR_FUNC(DSA_F_SIG_CB), "SIG_CB"}, | 94 | {ERR_FUNC(DSA_F_SIG_CB), "SIG_CB"}, |
| 92 | {0,NULL} | 95 | {0,NULL} |
| 93 | }; | 96 | }; |
| @@ -95,12 +98,15 @@ static ERR_STRING_DATA DSA_str_functs[]= | |||
| 95 | static ERR_STRING_DATA DSA_str_reasons[]= | 98 | static ERR_STRING_DATA DSA_str_reasons[]= |
| 96 | { | 99 | { |
| 97 | {ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"}, | 100 | {ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"}, |
| 101 | {ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"}, | ||
| 102 | {ERR_REASON(DSA_R_BN_ERROR) ,"bn error"}, | ||
| 98 | {ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, | 103 | {ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, |
| 99 | {ERR_REASON(DSA_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, | 104 | {ERR_REASON(DSA_R_DECODE_ERROR) ,"decode error"}, |
| 105 | {ERR_REASON(DSA_R_INVALID_DIGEST_TYPE) ,"invalid digest type"}, | ||
| 100 | {ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"}, | 106 | {ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"}, |
| 101 | {ERR_REASON(DSA_R_MODULUS_TOO_LARGE) ,"modulus too large"}, | 107 | {ERR_REASON(DSA_R_MODULUS_TOO_LARGE) ,"modulus too large"}, |
| 102 | {ERR_REASON(DSA_R_NON_FIPS_METHOD) ,"non fips method"}, | 108 | {ERR_REASON(DSA_R_NO_PARAMETERS_SET) ,"no parameters set"}, |
| 103 | {ERR_REASON(DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE),"operation not allowed in fips mode"}, | 109 | {ERR_REASON(DSA_R_PARAMETER_ENCODING_ERROR),"parameter encoding error"}, |
| 104 | {0,NULL} | 110 | {0,NULL} |
| 105 | }; | 111 | }; |
| 106 | 112 | ||
diff --git a/src/lib/libcrypto/dsa/dsa_gen.c b/src/lib/libcrypto/dsa/dsa_gen.c index 6f1728e3cf..0fcd25f8b0 100644 --- a/src/lib/libcrypto/dsa/dsa_gen.c +++ b/src/lib/libcrypto/dsa/dsa_gen.c | |||
| @@ -74,69 +74,88 @@ | |||
| 74 | #ifndef OPENSSL_NO_SHA | 74 | #ifndef OPENSSL_NO_SHA |
| 75 | 75 | ||
| 76 | #include <stdio.h> | 76 | #include <stdio.h> |
| 77 | #include <time.h> | ||
| 78 | #include "cryptlib.h" | 77 | #include "cryptlib.h" |
| 79 | #include <openssl/evp.h> | 78 | #include <openssl/evp.h> |
| 80 | #include <openssl/bn.h> | 79 | #include <openssl/bn.h> |
| 81 | #include <openssl/dsa.h> | ||
| 82 | #include <openssl/rand.h> | 80 | #include <openssl/rand.h> |
| 83 | #include <openssl/sha.h> | 81 | #include <openssl/sha.h> |
| 84 | 82 | #include "dsa_locl.h" | |
| 85 | #ifndef OPENSSL_FIPS | ||
| 86 | |||
| 87 | static int dsa_builtin_paramgen(DSA *ret, int bits, | ||
| 88 | unsigned char *seed_in, int seed_len, | ||
| 89 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); | ||
| 90 | 83 | ||
| 91 | int DSA_generate_parameters_ex(DSA *ret, int bits, | 84 | int DSA_generate_parameters_ex(DSA *ret, int bits, |
| 92 | unsigned char *seed_in, int seed_len, | 85 | const unsigned char *seed_in, int seed_len, |
| 93 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb) | 86 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb) |
| 94 | { | 87 | { |
| 95 | if(ret->meth->dsa_paramgen) | 88 | if(ret->meth->dsa_paramgen) |
| 96 | return ret->meth->dsa_paramgen(ret, bits, seed_in, seed_len, | 89 | return ret->meth->dsa_paramgen(ret, bits, seed_in, seed_len, |
| 97 | counter_ret, h_ret, cb); | 90 | counter_ret, h_ret, cb); |
| 98 | return dsa_builtin_paramgen(ret, bits, seed_in, seed_len, | 91 | else |
| 99 | counter_ret, h_ret, cb); | 92 | { |
| 93 | const EVP_MD *evpmd; | ||
| 94 | size_t qbits = bits >= 2048 ? 256 : 160; | ||
| 95 | |||
| 96 | if (bits >= 2048) | ||
| 97 | { | ||
| 98 | qbits = 256; | ||
| 99 | evpmd = EVP_sha256(); | ||
| 100 | } | ||
| 101 | else | ||
| 102 | { | ||
| 103 | qbits = 160; | ||
| 104 | evpmd = EVP_sha1(); | ||
| 105 | } | ||
| 106 | |||
| 107 | return dsa_builtin_paramgen(ret, bits, qbits, evpmd, | ||
| 108 | seed_in, seed_len, counter_ret, h_ret, cb); | ||
| 109 | } | ||
| 100 | } | 110 | } |
| 101 | 111 | ||
| 102 | static int dsa_builtin_paramgen(DSA *ret, int bits, | 112 | int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, |
| 103 | unsigned char *seed_in, int seed_len, | 113 | const EVP_MD *evpmd, const unsigned char *seed_in, size_t seed_len, |
| 104 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb) | 114 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb) |
| 105 | { | 115 | { |
| 106 | int ok=0; | 116 | int ok=0; |
| 107 | unsigned char seed[SHA_DIGEST_LENGTH]; | 117 | unsigned char seed[SHA256_DIGEST_LENGTH]; |
| 108 | unsigned char md[SHA_DIGEST_LENGTH]; | 118 | unsigned char md[SHA256_DIGEST_LENGTH]; |
| 109 | unsigned char buf[SHA_DIGEST_LENGTH],buf2[SHA_DIGEST_LENGTH]; | 119 | unsigned char buf[SHA256_DIGEST_LENGTH],buf2[SHA256_DIGEST_LENGTH]; |
| 110 | BIGNUM *r0,*W,*X,*c,*test; | 120 | BIGNUM *r0,*W,*X,*c,*test; |
| 111 | BIGNUM *g=NULL,*q=NULL,*p=NULL; | 121 | BIGNUM *g=NULL,*q=NULL,*p=NULL; |
| 112 | BN_MONT_CTX *mont=NULL; | 122 | BN_MONT_CTX *mont=NULL; |
| 113 | int k,n=0,i,b,m=0; | 123 | int i, k,n=0,b,m=0, qsize = qbits >> 3; |
| 114 | int counter=0; | 124 | int counter=0; |
| 115 | int r=0; | 125 | int r=0; |
| 116 | BN_CTX *ctx=NULL; | 126 | BN_CTX *ctx=NULL; |
| 117 | unsigned int h=2; | 127 | unsigned int h=2; |
| 118 | 128 | ||
| 119 | if (bits < 512) bits=512; | 129 | if (qsize != SHA_DIGEST_LENGTH && qsize != SHA224_DIGEST_LENGTH && |
| 120 | bits=(bits+63)/64*64; | 130 | qsize != SHA256_DIGEST_LENGTH) |
| 131 | /* invalid q size */ | ||
| 132 | return 0; | ||
| 133 | |||
| 134 | if (evpmd == NULL) | ||
| 135 | /* use SHA1 as default */ | ||
| 136 | evpmd = EVP_sha1(); | ||
| 137 | |||
| 138 | if (bits < 512) | ||
| 139 | bits = 512; | ||
| 140 | |||
| 141 | bits = (bits+63)/64*64; | ||
| 121 | 142 | ||
| 122 | /* NB: seed_len == 0 is special case: copy generated seed to | 143 | /* NB: seed_len == 0 is special case: copy generated seed to |
| 123 | * seed_in if it is not NULL. | 144 | * seed_in if it is not NULL. |
| 124 | */ | 145 | */ |
| 125 | if (seed_len && (seed_len < 20)) | 146 | if (seed_len && (seed_len < (size_t)qsize)) |
| 126 | seed_in = NULL; /* seed buffer too small -- ignore */ | 147 | seed_in = NULL; /* seed buffer too small -- ignore */ |
| 127 | if (seed_len > 20) | 148 | if (seed_len > (size_t)qsize) |
| 128 | seed_len = 20; /* App. 2.2 of FIPS PUB 186 allows larger SEED, | 149 | seed_len = qsize; /* App. 2.2 of FIPS PUB 186 allows larger SEED, |
| 129 | * but our internal buffers are restricted to 160 bits*/ | 150 | * but our internal buffers are restricted to 160 bits*/ |
| 130 | if ((seed_in != NULL) && (seed_len == 20)) | 151 | if (seed_in != NULL) |
| 131 | { | 152 | memcpy(seed, seed_in, seed_len); |
| 132 | memcpy(seed,seed_in,seed_len); | 153 | |
| 133 | /* set seed_in to NULL to avoid it being copied back */ | 154 | if ((ctx=BN_CTX_new()) == NULL) |
| 134 | seed_in = NULL; | 155 | goto err; |
| 135 | } | ||
| 136 | |||
| 137 | if ((ctx=BN_CTX_new()) == NULL) goto err; | ||
| 138 | 156 | ||
| 139 | if ((mont=BN_MONT_CTX_new()) == NULL) goto err; | 157 | if ((mont=BN_MONT_CTX_new()) == NULL) |
| 158 | goto err; | ||
| 140 | 159 | ||
| 141 | BN_CTX_start(ctx); | 160 | BN_CTX_start(ctx); |
| 142 | r0 = BN_CTX_get(ctx); | 161 | r0 = BN_CTX_get(ctx); |
| @@ -163,7 +182,7 @@ static int dsa_builtin_paramgen(DSA *ret, int bits, | |||
| 163 | 182 | ||
| 164 | if (!seed_len) | 183 | if (!seed_len) |
| 165 | { | 184 | { |
| 166 | RAND_pseudo_bytes(seed,SHA_DIGEST_LENGTH); | 185 | RAND_pseudo_bytes(seed, qsize); |
| 167 | seed_is_random = 1; | 186 | seed_is_random = 1; |
| 168 | } | 187 | } |
| 169 | else | 188 | else |
| @@ -171,25 +190,27 @@ static int dsa_builtin_paramgen(DSA *ret, int bits, | |||
| 171 | seed_is_random = 0; | 190 | seed_is_random = 0; |
| 172 | seed_len=0; /* use random seed if 'seed_in' turns out to be bad*/ | 191 | seed_len=0; /* use random seed if 'seed_in' turns out to be bad*/ |
| 173 | } | 192 | } |
| 174 | memcpy(buf,seed,SHA_DIGEST_LENGTH); | 193 | memcpy(buf , seed, qsize); |
| 175 | memcpy(buf2,seed,SHA_DIGEST_LENGTH); | 194 | memcpy(buf2, seed, qsize); |
| 176 | /* precompute "SEED + 1" for step 7: */ | 195 | /* precompute "SEED + 1" for step 7: */ |
| 177 | for (i=SHA_DIGEST_LENGTH-1; i >= 0; i--) | 196 | for (i = qsize-1; i >= 0; i--) |
| 178 | { | 197 | { |
| 179 | buf[i]++; | 198 | buf[i]++; |
| 180 | if (buf[i] != 0) break; | 199 | if (buf[i] != 0) |
| 200 | break; | ||
| 181 | } | 201 | } |
| 182 | 202 | ||
| 183 | /* step 2 */ | 203 | /* step 2 */ |
| 184 | EVP_Digest(seed,SHA_DIGEST_LENGTH,md,NULL,HASH, NULL); | 204 | EVP_Digest(seed, qsize, md, NULL, evpmd, NULL); |
| 185 | EVP_Digest(buf,SHA_DIGEST_LENGTH,buf2,NULL,HASH, NULL); | 205 | EVP_Digest(buf, qsize, buf2, NULL, evpmd, NULL); |
| 186 | for (i=0; i<SHA_DIGEST_LENGTH; i++) | 206 | for (i = 0; i < qsize; i++) |
| 187 | md[i]^=buf2[i]; | 207 | md[i]^=buf2[i]; |
| 188 | 208 | ||
| 189 | /* step 3 */ | 209 | /* step 3 */ |
| 190 | md[0]|=0x80; | 210 | md[0] |= 0x80; |
| 191 | md[SHA_DIGEST_LENGTH-1]|=0x01; | 211 | md[qsize-1] |= 0x01; |
| 192 | if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,q)) goto err; | 212 | if (!BN_bin2bn(md, qsize, q)) |
| 213 | goto err; | ||
| 193 | 214 | ||
| 194 | /* step 4 */ | 215 | /* step 4 */ |
| 195 | r = BN_is_prime_fasttest_ex(q, DSS_prime_checks, ctx, | 216 | r = BN_is_prime_fasttest_ex(q, DSS_prime_checks, ctx, |
| @@ -224,18 +245,19 @@ static int dsa_builtin_paramgen(DSA *ret, int bits, | |||
| 224 | for (k=0; k<=n; k++) | 245 | for (k=0; k<=n; k++) |
| 225 | { | 246 | { |
| 226 | /* obtain "SEED + offset + k" by incrementing: */ | 247 | /* obtain "SEED + offset + k" by incrementing: */ |
| 227 | for (i=SHA_DIGEST_LENGTH-1; i >= 0; i--) | 248 | for (i = qsize-1; i >= 0; i--) |
| 228 | { | 249 | { |
| 229 | buf[i]++; | 250 | buf[i]++; |
| 230 | if (buf[i] != 0) break; | 251 | if (buf[i] != 0) |
| 252 | break; | ||
| 231 | } | 253 | } |
| 232 | 254 | ||
| 233 | EVP_Digest(buf,SHA_DIGEST_LENGTH,md,NULL,HASH, NULL); | 255 | EVP_Digest(buf, qsize, md ,NULL, evpmd, NULL); |
| 234 | 256 | ||
| 235 | /* step 8 */ | 257 | /* step 8 */ |
| 236 | if (!BN_bin2bn(md,SHA_DIGEST_LENGTH,r0)) | 258 | if (!BN_bin2bn(md, qsize, r0)) |
| 237 | goto err; | 259 | goto err; |
| 238 | if (!BN_lshift(r0,r0,160*k)) goto err; | 260 | if (!BN_lshift(r0,r0,(qsize << 3)*k)) goto err; |
| 239 | if (!BN_add(W,W,r0)) goto err; | 261 | if (!BN_add(W,W,r0)) goto err; |
| 240 | } | 262 | } |
| 241 | 263 | ||
| @@ -309,7 +331,6 @@ err: | |||
| 309 | ok=0; | 331 | ok=0; |
| 310 | goto err; | 332 | goto err; |
| 311 | } | 333 | } |
| 312 | if (seed_in != NULL) memcpy(seed_in,seed,20); | ||
| 313 | if (counter_ret != NULL) *counter_ret=counter; | 334 | if (counter_ret != NULL) *counter_ret=counter; |
| 314 | if (h_ret != NULL) *h_ret=h; | 335 | if (h_ret != NULL) *h_ret=h; |
| 315 | } | 336 | } |
| @@ -322,4 +343,3 @@ err: | |||
| 322 | return ok; | 343 | return ok; |
| 323 | } | 344 | } |
| 324 | #endif | 345 | #endif |
| 325 | #endif | ||
diff --git a/src/lib/libcrypto/dsa/dsa_key.c b/src/lib/libcrypto/dsa/dsa_key.c index 5e39124230..c4aa86bc6d 100644 --- a/src/lib/libcrypto/dsa/dsa_key.c +++ b/src/lib/libcrypto/dsa/dsa_key.c | |||
| @@ -64,8 +64,6 @@ | |||
| 64 | #include <openssl/dsa.h> | 64 | #include <openssl/dsa.h> |
| 65 | #include <openssl/rand.h> | 65 | #include <openssl/rand.h> |
| 66 | 66 | ||
| 67 | #ifndef OPENSSL_FIPS | ||
| 68 | |||
| 69 | static int dsa_builtin_keygen(DSA *dsa); | 67 | static int dsa_builtin_keygen(DSA *dsa); |
| 70 | 68 | ||
| 71 | int DSA_generate_key(DSA *dsa) | 69 | int DSA_generate_key(DSA *dsa) |
| @@ -128,5 +126,3 @@ err: | |||
| 128 | return(ok); | 126 | return(ok); |
| 129 | } | 127 | } |
| 130 | #endif | 128 | #endif |
| 131 | |||
| 132 | #endif | ||
diff --git a/src/lib/libcrypto/dsa/dsa_lib.c b/src/lib/libcrypto/dsa/dsa_lib.c index 7ac9dc8c89..e9b75902db 100644 --- a/src/lib/libcrypto/dsa/dsa_lib.c +++ b/src/lib/libcrypto/dsa/dsa_lib.c | |||
| @@ -76,14 +76,6 @@ static const DSA_METHOD *default_DSA_method = NULL; | |||
| 76 | 76 | ||
| 77 | void DSA_set_default_method(const DSA_METHOD *meth) | 77 | void DSA_set_default_method(const DSA_METHOD *meth) |
| 78 | { | 78 | { |
| 79 | #ifdef OPENSSL_FIPS | ||
| 80 | if (FIPS_mode() && !(meth->flags & DSA_FLAG_FIPS_METHOD)) | ||
| 81 | { | ||
| 82 | DSAerr(DSA_F_DSA_SET_DEFAULT_METHOD, DSA_R_NON_FIPS_METHOD); | ||
| 83 | return; | ||
| 84 | } | ||
| 85 | #endif | ||
| 86 | |||
| 87 | default_DSA_method = meth; | 79 | default_DSA_method = meth; |
| 88 | } | 80 | } |
| 89 | 81 | ||
| @@ -104,13 +96,6 @@ int DSA_set_method(DSA *dsa, const DSA_METHOD *meth) | |||
| 104 | /* NB: The caller is specifically setting a method, so it's not up to us | 96 | /* NB: The caller is specifically setting a method, so it's not up to us |
| 105 | * to deal with which ENGINE it comes from. */ | 97 | * to deal with which ENGINE it comes from. */ |
| 106 | const DSA_METHOD *mtmp; | 98 | const DSA_METHOD *mtmp; |
| 107 | #ifdef OPENSSL_FIPS | ||
| 108 | if (FIPS_mode() && !(meth->flags & DSA_FLAG_FIPS_METHOD)) | ||
| 109 | { | ||
| 110 | DSAerr(DSA_F_DSA_SET_METHOD, DSA_R_NON_FIPS_METHOD); | ||
| 111 | return 0; | ||
| 112 | } | ||
| 113 | #endif | ||
| 114 | mtmp = dsa->meth; | 99 | mtmp = dsa->meth; |
| 115 | if (mtmp->finish) mtmp->finish(dsa); | 100 | if (mtmp->finish) mtmp->finish(dsa); |
| 116 | #ifndef OPENSSL_NO_ENGINE | 101 | #ifndef OPENSSL_NO_ENGINE |
| @@ -162,18 +147,6 @@ DSA *DSA_new_method(ENGINE *engine) | |||
| 162 | } | 147 | } |
| 163 | } | 148 | } |
| 164 | #endif | 149 | #endif |
| 165 | #ifdef OPENSSL_FIPS | ||
| 166 | if (FIPS_mode() && !(ret->meth->flags & DSA_FLAG_FIPS_METHOD)) | ||
| 167 | { | ||
| 168 | DSAerr(DSA_F_DSA_NEW_METHOD, DSA_R_NON_FIPS_METHOD); | ||
| 169 | #ifndef OPENSSL_NO_ENGINE | ||
| 170 | if (ret->engine) | ||
| 171 | ENGINE_finish(ret->engine); | ||
| 172 | #endif | ||
| 173 | OPENSSL_free(ret); | ||
| 174 | return NULL; | ||
| 175 | } | ||
| 176 | #endif | ||
| 177 | 150 | ||
| 178 | ret->pad=0; | 151 | ret->pad=0; |
| 179 | ret->version=0; | 152 | ret->version=0; |
| @@ -260,6 +233,28 @@ int DSA_up_ref(DSA *r) | |||
| 260 | return ((i > 1) ? 1 : 0); | 233 | return ((i > 1) ? 1 : 0); |
| 261 | } | 234 | } |
| 262 | 235 | ||
| 236 | int DSA_size(const DSA *r) | ||
| 237 | { | ||
| 238 | int ret,i; | ||
| 239 | ASN1_INTEGER bs; | ||
| 240 | unsigned char buf[4]; /* 4 bytes looks really small. | ||
| 241 | However, i2d_ASN1_INTEGER() will not look | ||
| 242 | beyond the first byte, as long as the second | ||
| 243 | parameter is NULL. */ | ||
| 244 | |||
| 245 | i=BN_num_bits(r->q); | ||
| 246 | bs.length=(i+7)/8; | ||
| 247 | bs.data=buf; | ||
| 248 | bs.type=V_ASN1_INTEGER; | ||
| 249 | /* If the top bit is set the asn1 encoding is 1 larger. */ | ||
| 250 | buf[0]=0xff; | ||
| 251 | |||
| 252 | i=i2d_ASN1_INTEGER(&bs,NULL); | ||
| 253 | i+=i; /* r and s */ | ||
| 254 | ret=ASN1_object_size(1,i,V_ASN1_SEQUENCE); | ||
| 255 | return(ret); | ||
| 256 | } | ||
| 257 | |||
| 263 | int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 258 | int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
| 264 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | 259 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) |
| 265 | { | 260 | { |
diff --git a/src/lib/libcrypto/dsa/dsa_ossl.c b/src/lib/libcrypto/dsa/dsa_ossl.c index 412cf1d88b..4fead07e80 100644 --- a/src/lib/libcrypto/dsa/dsa_ossl.c +++ b/src/lib/libcrypto/dsa/dsa_ossl.c | |||
| @@ -61,16 +61,15 @@ | |||
| 61 | #include <stdio.h> | 61 | #include <stdio.h> |
| 62 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
| 63 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
| 64 | #include <openssl/sha.h> | ||
| 64 | #include <openssl/dsa.h> | 65 | #include <openssl/dsa.h> |
| 65 | #include <openssl/rand.h> | 66 | #include <openssl/rand.h> |
| 66 | #include <openssl/asn1.h> | 67 | #include <openssl/asn1.h> |
| 67 | 68 | ||
| 68 | #ifndef OPENSSL_FIPS | ||
| 69 | |||
| 70 | static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); | 69 | static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); |
| 71 | static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp); | 70 | static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp); |
| 72 | static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | 71 | static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, |
| 73 | DSA *dsa); | 72 | DSA *dsa); |
| 74 | static int dsa_init(DSA *dsa); | 73 | static int dsa_init(DSA *dsa); |
| 75 | static int dsa_finish(DSA *dsa); | 74 | static int dsa_finish(DSA *dsa); |
| 76 | 75 | ||
| @@ -135,7 +134,7 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | |||
| 135 | BIGNUM m; | 134 | BIGNUM m; |
| 136 | BIGNUM xr; | 135 | BIGNUM xr; |
| 137 | BN_CTX *ctx=NULL; | 136 | BN_CTX *ctx=NULL; |
| 138 | int i,reason=ERR_R_BN_LIB; | 137 | int reason=ERR_R_BN_LIB; |
| 139 | DSA_SIG *ret=NULL; | 138 | DSA_SIG *ret=NULL; |
| 140 | 139 | ||
| 141 | BN_init(&m); | 140 | BN_init(&m); |
| @@ -150,8 +149,9 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | |||
| 150 | s=BN_new(); | 149 | s=BN_new(); |
| 151 | if (s == NULL) goto err; | 150 | if (s == NULL) goto err; |
| 152 | 151 | ||
| 153 | i=BN_num_bytes(dsa->q); /* should be 20 */ | 152 | /* reject a excessive digest length (currently at most |
| 154 | if ((dlen > i) || (dlen > 50)) | 153 | * dsa-with-SHA256 is supported) */ |
| 154 | if (dlen > SHA256_DIGEST_LENGTH) | ||
| 155 | { | 155 | { |
| 156 | reason=DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE; | 156 | reason=DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE; |
| 157 | goto err; | 157 | goto err; |
| @@ -172,7 +172,14 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | |||
| 172 | dsa->r=NULL; | 172 | dsa->r=NULL; |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | if (BN_bin2bn(dgst,dlen,&m) == NULL) goto err; | 175 | |
| 176 | if (dlen > BN_num_bytes(dsa->q)) | ||
| 177 | /* if the digest length is greater than the size of q use the | ||
| 178 | * BN_num_bits(dsa->q) leftmost bits of the digest, see | ||
| 179 | * fips 186-3, 4.2 */ | ||
| 180 | dlen = BN_num_bytes(dsa->q); | ||
| 181 | if (BN_bin2bn(dgst,dlen,&m) == NULL) | ||
| 182 | goto err; | ||
| 176 | 183 | ||
| 177 | /* Compute s = inv(k) (m + xr) mod q */ | 184 | /* Compute s = inv(k) (m + xr) mod q */ |
| 178 | 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 */ |
| @@ -283,30 +290,31 @@ err: | |||
| 283 | if (!ret) | 290 | if (!ret) |
| 284 | { | 291 | { |
| 285 | DSAerr(DSA_F_DSA_SIGN_SETUP,ERR_R_BN_LIB); | 292 | DSAerr(DSA_F_DSA_SIGN_SETUP,ERR_R_BN_LIB); |
| 286 | if (kinv != NULL) BN_clear_free(kinv); | 293 | if (r != NULL) |
| 287 | if (r != NULL) BN_clear_free(r); | 294 | BN_clear_free(r); |
| 288 | } | 295 | } |
| 289 | if (ctx_in == NULL) BN_CTX_free(ctx); | 296 | if (ctx_in == NULL) BN_CTX_free(ctx); |
| 290 | if (kinv != NULL) BN_clear_free(kinv); | ||
| 291 | BN_clear_free(&k); | 297 | BN_clear_free(&k); |
| 292 | BN_clear_free(&kq); | 298 | BN_clear_free(&kq); |
| 293 | return(ret); | 299 | return(ret); |
| 294 | } | 300 | } |
| 295 | 301 | ||
| 296 | static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | 302 | static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, |
| 297 | DSA *dsa) | 303 | DSA *dsa) |
| 298 | { | 304 | { |
| 299 | BN_CTX *ctx; | 305 | BN_CTX *ctx; |
| 300 | BIGNUM u1,u2,t1; | 306 | BIGNUM u1,u2,t1; |
| 301 | BN_MONT_CTX *mont=NULL; | 307 | BN_MONT_CTX *mont=NULL; |
| 302 | int ret = -1; | 308 | int ret = -1, i; |
| 303 | if (!dsa->p || !dsa->q || !dsa->g) | 309 | if (!dsa->p || !dsa->q || !dsa->g) |
| 304 | { | 310 | { |
| 305 | DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MISSING_PARAMETERS); | 311 | DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MISSING_PARAMETERS); |
| 306 | return -1; | 312 | return -1; |
| 307 | } | 313 | } |
| 308 | 314 | ||
| 309 | if (BN_num_bits(dsa->q) != 160) | 315 | i = BN_num_bits(dsa->q); |
| 316 | /* fips 186-3 allows only different sizes for q */ | ||
| 317 | if (i != 160 && i != 224 && i != 256) | ||
| 310 | { | 318 | { |
| 311 | DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_BAD_Q_VALUE); | 319 | DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_BAD_Q_VALUE); |
| 312 | return -1; | 320 | return -1; |
| @@ -318,6 +326,14 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | |||
| 318 | return -1; | 326 | return -1; |
| 319 | } | 327 | } |
| 320 | 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 | |||
| 321 | BN_init(&u1); | 337 | BN_init(&u1); |
| 322 | BN_init(&u2); | 338 | BN_init(&u2); |
| 323 | BN_init(&t1); | 339 | BN_init(&t1); |
| @@ -342,6 +358,11 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | |||
| 342 | if ((BN_mod_inverse(&u2,sig->s,dsa->q,ctx)) == NULL) goto err; | 358 | if ((BN_mod_inverse(&u2,sig->s,dsa->q,ctx)) == NULL) goto err; |
| 343 | 359 | ||
| 344 | /* save M in u1 */ | 360 | /* save M in u1 */ |
| 361 | if (dgst_len > (i >> 3)) | ||
| 362 | /* if the digest length is greater than the size of q use the | ||
| 363 | * BN_num_bits(dsa->q) leftmost bits of the digest, see | ||
| 364 | * fips 186-3, 4.2 */ | ||
| 365 | dgst_len = (i >> 3); | ||
| 345 | if (BN_bin2bn(dgst,dgst_len,&u1) == NULL) goto err; | 366 | if (BN_bin2bn(dgst,dgst_len,&u1) == NULL) goto err; |
| 346 | 367 | ||
| 347 | /* u1 = M * w mod q */ | 368 | /* u1 = M * w mod q */ |
| @@ -393,4 +414,3 @@ static int dsa_finish(DSA *dsa) | |||
| 393 | return(1); | 414 | return(1); |
| 394 | } | 415 | } |
| 395 | 416 | ||
| 396 | #endif | ||
diff --git a/src/lib/libcrypto/dsa/dsa_sign.c b/src/lib/libcrypto/dsa/dsa_sign.c index 4cfbbe57a8..17555e5892 100644 --- a/src/lib/libcrypto/dsa/dsa_sign.c +++ b/src/lib/libcrypto/dsa/dsa_sign.c | |||
| @@ -58,38 +58,33 @@ | |||
| 58 | 58 | ||
| 59 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | 59 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ |
| 60 | 60 | ||
| 61 | #include <stdio.h> | ||
| 62 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 63 | #include <openssl/bn.h> | ||
| 64 | #include <openssl/dsa.h> | 62 | #include <openssl/dsa.h> |
| 65 | #include <openssl/rand.h> | 63 | #include <openssl/rand.h> |
| 66 | #include <openssl/asn1.h> | ||
| 67 | #ifdef OPENSSL_FIPS | ||
| 68 | #include <openssl/fips.h> | ||
| 69 | #endif | ||
| 70 | |||
| 71 | 64 | ||
| 72 | DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | 65 | DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) |
| 73 | { | 66 | { |
| 74 | #ifdef OPENSSL_FIPS | ||
| 75 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW)) | ||
| 76 | { | ||
| 77 | DSAerr(DSA_F_DSA_DO_SIGN, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
| 78 | return NULL; | ||
| 79 | } | ||
| 80 | #endif | ||
| 81 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); | 67 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); |
| 82 | } | 68 | } |
| 83 | 69 | ||
| 84 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | 70 | int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, |
| 71 | unsigned int *siglen, DSA *dsa) | ||
| 85 | { | 72 | { |
| 86 | #ifdef OPENSSL_FIPS | 73 | DSA_SIG *s; |
| 87 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW)) | 74 | RAND_seed(dgst, dlen); |
| 75 | s=DSA_do_sign(dgst,dlen,dsa); | ||
| 76 | if (s == NULL) | ||
| 88 | { | 77 | { |
| 89 | DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | 78 | *siglen=0; |
| 90 | return 0; | 79 | return(0); |
| 91 | } | 80 | } |
| 92 | #endif | 81 | *siglen=i2d_DSA_SIG(s,&sig); |
| 82 | DSA_SIG_free(s); | ||
| 83 | return(1); | ||
| 84 | } | ||
| 85 | |||
| 86 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | ||
| 87 | { | ||
| 93 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); | 88 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); |
| 94 | } | 89 | } |
| 95 | 90 | ||
diff --git a/src/lib/libcrypto/dsa/dsa_utl.c b/src/lib/libcrypto/dsa/dsa_utl.c deleted file mode 100644 index 24c021d120..0000000000 --- a/src/lib/libcrypto/dsa/dsa_utl.c +++ /dev/null | |||
| @@ -1,95 +0,0 @@ | |||
| 1 | /* crypto/dsa/dsa_lib.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 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | ||
| 60 | |||
| 61 | #include <stdio.h> | ||
| 62 | #include "cryptlib.h" | ||
| 63 | #include <openssl/bn.h> | ||
| 64 | #include <openssl/dsa.h> | ||
| 65 | #include <openssl/asn1.h> | ||
| 66 | #ifndef OPENSSL_NO_ENGINE | ||
| 67 | #include <openssl/engine.h> | ||
| 68 | #endif | ||
| 69 | #ifndef OPENSSL_NO_DH | ||
| 70 | #include <openssl/dh.h> | ||
| 71 | #endif | ||
| 72 | |||
| 73 | DSA_SIG *DSA_SIG_new(void) | ||
| 74 | { | ||
| 75 | DSA_SIG *sig; | ||
| 76 | sig = OPENSSL_malloc(sizeof(DSA_SIG)); | ||
| 77 | if (!sig) | ||
| 78 | return NULL; | ||
| 79 | sig->r = NULL; | ||
| 80 | sig->s = NULL; | ||
| 81 | return sig; | ||
| 82 | } | ||
| 83 | |||
| 84 | void DSA_SIG_free(DSA_SIG *sig) | ||
| 85 | { | ||
| 86 | if (sig) | ||
| 87 | { | ||
| 88 | if (sig->r) | ||
| 89 | BN_free(sig->r); | ||
| 90 | if (sig->s) | ||
| 91 | BN_free(sig->s); | ||
| 92 | OPENSSL_free(sig); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
diff --git a/src/lib/libcrypto/dsa/dsa_vrf.c b/src/lib/libcrypto/dsa/dsa_vrf.c index c75e423048..226a75ff3f 100644 --- a/src/lib/libcrypto/dsa/dsa_vrf.c +++ b/src/lib/libcrypto/dsa/dsa_vrf.c | |||
| @@ -58,27 +58,32 @@ | |||
| 58 | 58 | ||
| 59 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | 59 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ |
| 60 | 60 | ||
| 61 | #include <stdio.h> | ||
| 62 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 63 | #include <openssl/bn.h> | ||
| 64 | #include <openssl/dsa.h> | 62 | #include <openssl/dsa.h> |
| 65 | #include <openssl/rand.h> | ||
| 66 | #include <openssl/asn1.h> | ||
| 67 | #ifdef OPENSSL_FIPS | ||
| 68 | #include <openssl/fips.h> | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #include <openssl/asn1_mac.h> | ||
| 72 | 63 | ||
| 73 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | 64 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, |
| 74 | DSA *dsa) | 65 | DSA *dsa) |
| 75 | { | 66 | { |
| 76 | #ifdef OPENSSL_FIPS | ||
| 77 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW)) | ||
| 78 | { | ||
| 79 | DSAerr(DSA_F_DSA_DO_VERIFY, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | #endif | ||
| 83 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); | 67 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); |
| 84 | } | 68 | } |
| 69 | |||
| 70 | /* data has already been hashed (probably with SHA or SHA-1). */ | ||
| 71 | /* returns | ||
| 72 | * 1: correct signature | ||
| 73 | * 0: incorrect signature | ||
| 74 | * -1: error | ||
| 75 | */ | ||
| 76 | int DSA_verify(int type, const unsigned char *dgst, int dgst_len, | ||
| 77 | const unsigned char *sigbuf, int siglen, DSA *dsa) | ||
| 78 | { | ||
| 79 | DSA_SIG *s; | ||
| 80 | int ret=-1; | ||
| 81 | |||
| 82 | s = DSA_SIG_new(); | ||
| 83 | if (s == NULL) return(ret); | ||
| 84 | if (d2i_DSA_SIG(&s,&sigbuf,siglen) == NULL) goto err; | ||
| 85 | ret=DSA_do_verify(dgst,dgst_len,s,dsa); | ||
| 86 | err: | ||
| 87 | DSA_SIG_free(s); | ||
| 88 | return(ret); | ||
| 89 | } | ||
diff --git a/src/lib/libcrypto/dsa/dsatest.c b/src/lib/libcrypto/dsa/dsatest.c index 912317bb44..edffd24e6b 100644 --- a/src/lib/libcrypto/dsa/dsatest.c +++ b/src/lib/libcrypto/dsa/dsatest.c | |||
| @@ -169,7 +169,6 @@ int main(int argc, char **argv) | |||
| 169 | } | 169 | } |
| 170 | BIO_printf(bio_err,"\ncounter=%d h=%ld\n",counter,h); | 170 | BIO_printf(bio_err,"\ncounter=%d h=%ld\n",counter,h); |
| 171 | 171 | ||
| 172 | if (dsa == NULL) goto end; | ||
| 173 | DSA_print(bio_err,dsa,0); | 172 | DSA_print(bio_err,dsa,0); |
| 174 | if (counter != 105) | 173 | if (counter != 105) |
| 175 | { | 174 | { |
| @@ -223,7 +222,7 @@ end: | |||
| 223 | ERR_print_errors(bio_err); | 222 | ERR_print_errors(bio_err); |
| 224 | if (dsa != NULL) DSA_free(dsa); | 223 | if (dsa != NULL) DSA_free(dsa); |
| 225 | CRYPTO_cleanup_all_ex_data(); | 224 | CRYPTO_cleanup_all_ex_data(); |
| 226 | ERR_remove_state(0); | 225 | ERR_remove_thread_state(NULL); |
| 227 | ERR_free_strings(); | 226 | ERR_free_strings(); |
| 228 | CRYPTO_mem_leaks(bio_err); | 227 | CRYPTO_mem_leaks(bio_err); |
| 229 | if (bio_err != NULL) | 228 | if (bio_err != NULL) |
diff --git a/src/lib/libcrypto/dso/Makefile.ssl b/src/lib/libcrypto/dso/Makefile.ssl deleted file mode 100644 index c0449d184e..0000000000 --- a/src/lib/libcrypto/dso/Makefile.ssl +++ /dev/null | |||
| @@ -1,142 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/dso/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= dso | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \ | ||
| 27 | dso_openssl.c dso_win32.c dso_vms.c | ||
| 28 | LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \ | ||
| 29 | dso_openssl.o dso_win32.o dso_vms.o | ||
| 30 | |||
| 31 | SRC= $(LIBSRC) | ||
| 32 | |||
| 33 | EXHEADER= dso.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.ssl >> $(TOP)/MINFO | ||
| 50 | |||
| 51 | links: | ||
| 52 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 55 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 56 | |||
| 57 | install: | ||
| 58 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 74 | |||
| 75 | dclean: | ||
| 76 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 77 | mv -f Makefile.new $(MAKEFILE) | ||
| 78 | |||
| 79 | clean: | ||
| 80 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 81 | |||
| 82 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 83 | |||
| 84 | dso_dl.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 85 | dso_dl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 86 | dso_dl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 87 | dso_dl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 88 | dso_dl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 89 | dso_dl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 90 | dso_dl.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_dl.c | ||
| 91 | dso_dlfcn.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 92 | dso_dlfcn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 93 | dso_dlfcn.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 94 | dso_dlfcn.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 95 | dso_dlfcn.o: ../../include/openssl/opensslconf.h | ||
| 96 | dso_dlfcn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 97 | dso_dlfcn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 98 | dso_dlfcn.o: ../cryptlib.h dso_dlfcn.c | ||
| 99 | dso_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 100 | dso_err.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 101 | dso_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 102 | dso_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 103 | dso_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 104 | dso_err.o: ../../include/openssl/symhacks.h dso_err.c | ||
| 105 | dso_lib.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 106 | dso_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 107 | dso_lib.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 108 | dso_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 109 | dso_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 110 | dso_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 111 | dso_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_lib.c | ||
| 112 | dso_null.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 113 | dso_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 114 | dso_null.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 115 | dso_null.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 116 | dso_null.o: ../../include/openssl/opensslconf.h | ||
| 117 | dso_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 118 | dso_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 119 | dso_null.o: ../cryptlib.h dso_null.c | ||
| 120 | dso_openssl.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 121 | dso_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 122 | dso_openssl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 123 | dso_openssl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 124 | dso_openssl.o: ../../include/openssl/opensslconf.h | ||
| 125 | dso_openssl.o: ../../include/openssl/opensslv.h | ||
| 126 | dso_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 127 | dso_openssl.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_openssl.c | ||
| 128 | dso_vms.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 129 | dso_vms.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 130 | dso_vms.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 131 | dso_vms.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 132 | dso_vms.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 133 | dso_vms.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 134 | dso_vms.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_vms.c | ||
| 135 | dso_win32.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 136 | dso_win32.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 137 | dso_win32.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 138 | dso_win32.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 139 | dso_win32.o: ../../include/openssl/opensslconf.h | ||
| 140 | dso_win32.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 141 | dso_win32.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 142 | dso_win32.o: ../cryptlib.h dso_win32.c | ||
diff --git a/src/lib/libcrypto/dso/dso.h b/src/lib/libcrypto/dso/dso.h index 3e51913a72..839f2e0617 100644 --- a/src/lib/libcrypto/dso/dso.h +++ b/src/lib/libcrypto/dso/dso.h | |||
| @@ -170,6 +170,11 @@ typedef struct dso_meth_st | |||
| 170 | /* [De]Initialisation handlers. */ | 170 | /* [De]Initialisation handlers. */ |
| 171 | int (*init)(DSO *dso); | 171 | int (*init)(DSO *dso); |
| 172 | int (*finish)(DSO *dso); | 172 | int (*finish)(DSO *dso); |
| 173 | |||
| 174 | /* Return pathname of the module containing location */ | ||
| 175 | int (*pathbyaddr)(void *addr,char *path,int sz); | ||
| 176 | /* Perform global symbol lookup, i.e. among *all* modules */ | ||
| 177 | void *(*globallookup)(const char *symname); | ||
| 173 | } DSO_METHOD; | 178 | } DSO_METHOD; |
| 174 | 179 | ||
| 175 | /**********************************************************************/ | 180 | /**********************************************************************/ |
| @@ -183,7 +188,7 @@ struct dso_st | |||
| 183 | * for use in the dso_bind handler. All in all, let each | 188 | * for use in the dso_bind handler. All in all, let each |
| 184 | * method control its own destiny. "Handles" and such go in | 189 | * method control its own destiny. "Handles" and such go in |
| 185 | * a STACK. */ | 190 | * a STACK. */ |
| 186 | STACK *meth_data; | 191 | STACK_OF(void) *meth_data; |
| 187 | int references; | 192 | int references; |
| 188 | int flags; | 193 | int flags; |
| 189 | /* For use by applications etc ... use this for your bits'n'pieces, | 194 | /* For use by applications etc ... use this for your bits'n'pieces, |
| @@ -296,6 +301,30 @@ DSO_METHOD *DSO_METHOD_win32(void); | |||
| 296 | /* If VMS is defined, use shared images. If not, return NULL. */ | 301 | /* If VMS is defined, use shared images. If not, return NULL. */ |
| 297 | DSO_METHOD *DSO_METHOD_vms(void); | 302 | DSO_METHOD *DSO_METHOD_vms(void); |
| 298 | 303 | ||
| 304 | /* This function writes null-terminated pathname of DSO module | ||
| 305 | * containing 'addr' into 'sz' large caller-provided 'path' and | ||
| 306 | * returns the number of characters [including trailing zero] | ||
| 307 | * written to it. If 'sz' is 0 or negative, 'path' is ignored and | ||
| 308 | * required amount of charachers [including trailing zero] to | ||
| 309 | * accomodate pathname is returned. If 'addr' is NULL, then | ||
| 310 | * pathname of cryptolib itself is returned. Negative or zero | ||
| 311 | * return value denotes error. | ||
| 312 | */ | ||
| 313 | int DSO_pathbyaddr(void *addr,char *path,int sz); | ||
| 314 | |||
| 315 | /* This function should be used with caution! It looks up symbols in | ||
| 316 | * *all* loaded modules and if module gets unloaded by somebody else | ||
| 317 | * attempt to dereference the pointer is doomed to have fatal | ||
| 318 | * consequences. Primary usage for this function is to probe *core* | ||
| 319 | * system functionality, e.g. check if getnameinfo(3) is available | ||
| 320 | * at run-time without bothering about OS-specific details such as | ||
| 321 | * libc.so.versioning or where does it actually reside: in libc | ||
| 322 | * itself or libsocket. */ | ||
| 323 | void *DSO_global_lookup(const char *name); | ||
| 324 | |||
| 325 | /* If BeOS is defined, use shared images. If not, return NULL. */ | ||
| 326 | DSO_METHOD *DSO_METHOD_beos(void); | ||
| 327 | |||
| 299 | /* BEGIN ERROR CODES */ | 328 | /* BEGIN ERROR CODES */ |
| 300 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 329 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 301 | * made after this point may be overwritten when the script is next run. | 330 | * made after this point may be overwritten when the script is next run. |
| @@ -305,6 +334,11 @@ void ERR_load_DSO_strings(void); | |||
| 305 | /* Error codes for the DSO functions. */ | 334 | /* Error codes for the DSO functions. */ |
| 306 | 335 | ||
| 307 | /* Function codes. */ | 336 | /* Function codes. */ |
| 337 | #define DSO_F_BEOS_BIND_FUNC 144 | ||
| 338 | #define DSO_F_BEOS_BIND_VAR 145 | ||
| 339 | #define DSO_F_BEOS_LOAD 146 | ||
| 340 | #define DSO_F_BEOS_NAME_CONVERTER 147 | ||
| 341 | #define DSO_F_BEOS_UNLOAD 148 | ||
| 308 | #define DSO_F_DLFCN_BIND_FUNC 100 | 342 | #define DSO_F_DLFCN_BIND_FUNC 100 |
| 309 | #define DSO_F_DLFCN_BIND_VAR 101 | 343 | #define DSO_F_DLFCN_BIND_VAR 101 |
| 310 | #define DSO_F_DLFCN_LOAD 102 | 344 | #define DSO_F_DLFCN_LOAD 102 |
| @@ -324,22 +358,29 @@ void ERR_load_DSO_strings(void); | |||
| 324 | #define DSO_F_DSO_FREE 111 | 358 | #define DSO_F_DSO_FREE 111 |
| 325 | #define DSO_F_DSO_GET_FILENAME 127 | 359 | #define DSO_F_DSO_GET_FILENAME 127 |
| 326 | #define DSO_F_DSO_GET_LOADED_FILENAME 128 | 360 | #define DSO_F_DSO_GET_LOADED_FILENAME 128 |
| 361 | #define DSO_F_DSO_GLOBAL_LOOKUP 139 | ||
| 327 | #define DSO_F_DSO_LOAD 112 | 362 | #define DSO_F_DSO_LOAD 112 |
| 328 | #define DSO_F_DSO_MERGE 132 | 363 | #define DSO_F_DSO_MERGE 132 |
| 329 | #define DSO_F_DSO_NEW_METHOD 113 | 364 | #define DSO_F_DSO_NEW_METHOD 113 |
| 365 | #define DSO_F_DSO_PATHBYADDR 140 | ||
| 330 | #define DSO_F_DSO_SET_FILENAME 129 | 366 | #define DSO_F_DSO_SET_FILENAME 129 |
| 331 | #define DSO_F_DSO_SET_NAME_CONVERTER 122 | 367 | #define DSO_F_DSO_SET_NAME_CONVERTER 122 |
| 332 | #define DSO_F_DSO_UP_REF 114 | 368 | #define DSO_F_DSO_UP_REF 114 |
| 369 | #define DSO_F_GLOBAL_LOOKUP_FUNC 138 | ||
| 370 | #define DSO_F_PATHBYADDR 137 | ||
| 333 | #define DSO_F_VMS_BIND_SYM 115 | 371 | #define DSO_F_VMS_BIND_SYM 115 |
| 334 | #define DSO_F_VMS_LOAD 116 | 372 | #define DSO_F_VMS_LOAD 116 |
| 335 | #define DSO_F_VMS_MERGER 133 | 373 | #define DSO_F_VMS_MERGER 133 |
| 336 | #define DSO_F_VMS_UNLOAD 117 | 374 | #define DSO_F_VMS_UNLOAD 117 |
| 337 | #define DSO_F_WIN32_BIND_FUNC 118 | 375 | #define DSO_F_WIN32_BIND_FUNC 118 |
| 338 | #define DSO_F_WIN32_BIND_VAR 119 | 376 | #define DSO_F_WIN32_BIND_VAR 119 |
| 377 | #define DSO_F_WIN32_GLOBALLOOKUP 142 | ||
| 378 | #define DSO_F_WIN32_GLOBALLOOKUP_FUNC 143 | ||
| 339 | #define DSO_F_WIN32_JOINER 135 | 379 | #define DSO_F_WIN32_JOINER 135 |
| 340 | #define DSO_F_WIN32_LOAD 120 | 380 | #define DSO_F_WIN32_LOAD 120 |
| 341 | #define DSO_F_WIN32_MERGER 134 | 381 | #define DSO_F_WIN32_MERGER 134 |
| 342 | #define DSO_F_WIN32_NAME_CONVERTER 125 | 382 | #define DSO_F_WIN32_NAME_CONVERTER 125 |
| 383 | #define DSO_F_WIN32_PATHBYADDR 141 | ||
| 343 | #define DSO_F_WIN32_SPLITTER 136 | 384 | #define DSO_F_WIN32_SPLITTER 136 |
| 344 | #define DSO_F_WIN32_UNLOAD 121 | 385 | #define DSO_F_WIN32_UNLOAD 121 |
| 345 | 386 | ||
diff --git a/src/lib/libcrypto/dso/dso_dl.c b/src/lib/libcrypto/dso/dso_dl.c index 417abb6ea9..c3b4f6cf45 100644 --- a/src/lib/libcrypto/dso/dso_dl.c +++ b/src/lib/libcrypto/dso/dso_dl.c | |||
| @@ -85,6 +85,8 @@ static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg); | |||
| 85 | #endif | 85 | #endif |
| 86 | static char *dl_name_converter(DSO *dso, const char *filename); | 86 | static char *dl_name_converter(DSO *dso, const char *filename); |
| 87 | static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2); | 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); | ||
| 88 | 90 | ||
| 89 | static DSO_METHOD dso_meth_dl = { | 91 | static DSO_METHOD dso_meth_dl = { |
| 90 | "OpenSSL 'dl' shared library method", | 92 | "OpenSSL 'dl' shared library method", |
| @@ -101,7 +103,9 @@ static DSO_METHOD dso_meth_dl = { | |||
| 101 | dl_name_converter, | 103 | dl_name_converter, |
| 102 | dl_merger, | 104 | dl_merger, |
| 103 | NULL, /* init */ | 105 | NULL, /* init */ |
| 104 | NULL /* finish */ | 106 | NULL, /* finish */ |
| 107 | dl_pathbyaddr, | ||
| 108 | dl_globallookup | ||
| 105 | }; | 109 | }; |
| 106 | 110 | ||
| 107 | DSO_METHOD *DSO_METHOD_dl(void) | 111 | DSO_METHOD *DSO_METHOD_dl(void) |
| @@ -255,18 +259,20 @@ static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2) | |||
| 255 | same goes if the second file specification is missing. */ | 259 | same goes if the second file specification is missing. */ |
| 256 | if (!filespec2 || filespec1[0] == '/') | 260 | if (!filespec2 || filespec1[0] == '/') |
| 257 | { | 261 | { |
| 258 | merged = OPENSSL_malloc(strlen(filespec1) + 1); | 262 | size_t len = strlen(filespec1) + 1; |
| 263 | merged = OPENSSL_malloc(len); | ||
| 259 | if(!merged) | 264 | if(!merged) |
| 260 | { | 265 | { |
| 261 | DSOerr(DSO_F_DL_MERGER, | 266 | DSOerr(DSO_F_DL_MERGER, |
| 262 | ERR_R_MALLOC_FAILURE); | 267 | ERR_R_MALLOC_FAILURE); |
| 263 | return(NULL); | 268 | return(NULL); |
| 264 | } | 269 | } |
| 265 | strcpy(merged, filespec1); | 270 | memcpy(merged, filespec1, len); |
| 266 | } | 271 | } |
| 267 | /* If the first file specification is missing, the second one rules. */ | 272 | /* If the first file specification is missing, the second one rules. */ |
| 268 | else if (!filespec1) | 273 | else if (!filespec1) |
| 269 | { | 274 | { |
| 275 | size_t len = strlen(filespec2) + 1; | ||
| 270 | merged = OPENSSL_malloc(strlen(filespec2) + 1); | 276 | merged = OPENSSL_malloc(strlen(filespec2) + 1); |
| 271 | if(!merged) | 277 | if(!merged) |
| 272 | { | 278 | { |
| @@ -274,7 +280,7 @@ static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2) | |||
| 274 | ERR_R_MALLOC_FAILURE); | 280 | ERR_R_MALLOC_FAILURE); |
| 275 | return(NULL); | 281 | return(NULL); |
| 276 | } | 282 | } |
| 277 | strcpy(merged, filespec2); | 283 | memcpy(merged, filespec2, len); |
| 278 | } | 284 | } |
| 279 | else | 285 | else |
| 280 | /* This part isn't as trivial as it looks. It assumes that | 286 | /* This part isn't as trivial as it looks. It assumes that |
| @@ -283,7 +289,7 @@ static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2) | |||
| 283 | the concatenation of filespec2 followed by a slash followed | 289 | the concatenation of filespec2 followed by a slash followed |
| 284 | by filespec1. */ | 290 | by filespec1. */ |
| 285 | { | 291 | { |
| 286 | int spec2len, len; | 292 | size_t spec2len, len; |
| 287 | 293 | ||
| 288 | spec2len = (filespec2 ? strlen(filespec2) : 0); | 294 | spec2len = (filespec2 ? strlen(filespec2) : 0); |
| 289 | len = spec2len + (filespec1 ? strlen(filespec1) : 0); | 295 | len = spec2len + (filespec1 ? strlen(filespec1) : 0); |
| @@ -300,9 +306,9 @@ static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2) | |||
| 300 | ERR_R_MALLOC_FAILURE); | 306 | ERR_R_MALLOC_FAILURE); |
| 301 | return(NULL); | 307 | return(NULL); |
| 302 | } | 308 | } |
| 303 | strcpy(merged, filespec2); | 309 | strlcpy(merged, filespec2, len + 2); |
| 304 | merged[spec2len] = '/'; | 310 | merged[spec2len] = '/'; |
| 305 | strcpy(&merged[spec2len + 1], filespec1); | 311 | strlcpy(&merged[spec2len + 1], filespec1, 1 + len - spec2len); |
| 306 | } | 312 | } |
| 307 | return(merged); | 313 | return(merged); |
| 308 | } | 314 | } |
| @@ -350,4 +356,40 @@ static char *dl_name_converter(DSO *dso, const char *filename) | |||
| 350 | return(translated); | 356 | return(translated); |
| 351 | } | 357 | } |
| 352 | 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 | } | ||
| 353 | #endif /* DSO_DL */ | 395 | #endif /* DSO_DL */ |
diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c index 656cd496f8..5dceaf7b00 100644 --- a/src/lib/libcrypto/dso/dso_dlfcn.c +++ b/src/lib/libcrypto/dso/dso_dlfcn.c | |||
| @@ -56,6 +56,16 @@ | |||
| 56 | * | 56 | * |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | /* We need to do this early, because stdio.h includes the header files | ||
| 60 | that handle _GNU_SOURCE and other similar macros. Defining it later | ||
| 61 | is simply too late, because those headers are protected from re- | ||
| 62 | inclusion. */ | ||
| 63 | #ifdef __linux | ||
| 64 | # ifndef _GNU_SOURCE | ||
| 65 | # define _GNU_SOURCE /* make sure dladdr is declared */ | ||
| 66 | # endif | ||
| 67 | #endif | ||
| 68 | |||
| 59 | #include <stdio.h> | 69 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 70 | #include "cryptlib.h" |
| 61 | #include <openssl/dso.h> | 71 | #include <openssl/dso.h> |
| @@ -68,7 +78,16 @@ DSO_METHOD *DSO_METHOD_dlfcn(void) | |||
| 68 | #else | 78 | #else |
| 69 | 79 | ||
| 70 | #ifdef HAVE_DLFCN_H | 80 | #ifdef HAVE_DLFCN_H |
| 71 | #include <dlfcn.h> | 81 | # ifdef __osf__ |
| 82 | # define __EXTENSIONS__ | ||
| 83 | # endif | ||
| 84 | # include <dlfcn.h> | ||
| 85 | # define HAVE_DLINFO 1 | ||
| 86 | # if defined(_AIX) || defined(__CYGWIN__) || \ | ||
| 87 | defined(__SCO_VERSION__) || defined(_SCO_ELF) || \ | ||
| 88 | (defined(__OpenBSD__) && !defined(RTLD_SELF)) | ||
| 89 | # undef HAVE_DLINFO | ||
| 90 | # endif | ||
| 72 | #endif | 91 | #endif |
| 73 | 92 | ||
| 74 | /* Part of the hack in "dlfcn_load" ... */ | 93 | /* Part of the hack in "dlfcn_load" ... */ |
| @@ -87,6 +106,8 @@ static long dlfcn_ctrl(DSO *dso, int cmd, long larg, void *parg); | |||
| 87 | static char *dlfcn_name_converter(DSO *dso, const char *filename); | 106 | static char *dlfcn_name_converter(DSO *dso, const char *filename); |
| 88 | static char *dlfcn_merger(DSO *dso, const char *filespec1, | 107 | static char *dlfcn_merger(DSO *dso, const char *filespec1, |
| 89 | const char *filespec2); | 108 | const char *filespec2); |
| 109 | static int dlfcn_pathbyaddr(void *addr,char *path,int sz); | ||
| 110 | static void *dlfcn_globallookup(const char *name); | ||
| 90 | 111 | ||
| 91 | static DSO_METHOD dso_meth_dlfcn = { | 112 | static DSO_METHOD dso_meth_dlfcn = { |
| 92 | "OpenSSL 'dlfcn' shared library method", | 113 | "OpenSSL 'dlfcn' shared library method", |
| @@ -103,7 +124,9 @@ static DSO_METHOD dso_meth_dlfcn = { | |||
| 103 | dlfcn_name_converter, | 124 | dlfcn_name_converter, |
| 104 | dlfcn_merger, | 125 | dlfcn_merger, |
| 105 | NULL, /* init */ | 126 | NULL, /* init */ |
| 106 | NULL /* finish */ | 127 | NULL, /* finish */ |
| 128 | dlfcn_pathbyaddr, | ||
| 129 | dlfcn_globallookup | ||
| 107 | }; | 130 | }; |
| 108 | 131 | ||
| 109 | DSO_METHOD *DSO_METHOD_dlfcn(void) | 132 | DSO_METHOD *DSO_METHOD_dlfcn(void) |
| @@ -163,7 +186,7 @@ static int dlfcn_load(DSO *dso) | |||
| 163 | ERR_add_error_data(4, "filename(", filename, "): ", dlerror()); | 186 | ERR_add_error_data(4, "filename(", filename, "): ", dlerror()); |
| 164 | goto err; | 187 | goto err; |
| 165 | } | 188 | } |
| 166 | if(!sk_push(dso->meth_data, (char *)ptr)) | 189 | if(!sk_void_push(dso->meth_data, (char *)ptr)) |
| 167 | { | 190 | { |
| 168 | DSOerr(DSO_F_DLFCN_LOAD,DSO_R_STACK_ERROR); | 191 | DSOerr(DSO_F_DLFCN_LOAD,DSO_R_STACK_ERROR); |
| 169 | goto err; | 192 | goto err; |
| @@ -188,15 +211,15 @@ static int dlfcn_unload(DSO *dso) | |||
| 188 | DSOerr(DSO_F_DLFCN_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); | 211 | DSOerr(DSO_F_DLFCN_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); |
| 189 | return(0); | 212 | return(0); |
| 190 | } | 213 | } |
| 191 | if(sk_num(dso->meth_data) < 1) | 214 | if(sk_void_num(dso->meth_data) < 1) |
| 192 | return(1); | 215 | return(1); |
| 193 | ptr = (void *)sk_pop(dso->meth_data); | 216 | ptr = sk_void_pop(dso->meth_data); |
| 194 | if(ptr == NULL) | 217 | if(ptr == NULL) |
| 195 | { | 218 | { |
| 196 | DSOerr(DSO_F_DLFCN_UNLOAD,DSO_R_NULL_HANDLE); | 219 | DSOerr(DSO_F_DLFCN_UNLOAD,DSO_R_NULL_HANDLE); |
| 197 | /* Should push the value back onto the stack in | 220 | /* Should push the value back onto the stack in |
| 198 | * case of a retry. */ | 221 | * case of a retry. */ |
| 199 | sk_push(dso->meth_data, (char *)ptr); | 222 | sk_void_push(dso->meth_data, ptr); |
| 200 | return(0); | 223 | return(0); |
| 201 | } | 224 | } |
| 202 | /* For now I'm not aware of any errors associated with dlclose() */ | 225 | /* For now I'm not aware of any errors associated with dlclose() */ |
| @@ -213,12 +236,12 @@ static void *dlfcn_bind_var(DSO *dso, const char *symname) | |||
| 213 | DSOerr(DSO_F_DLFCN_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); | 236 | DSOerr(DSO_F_DLFCN_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); |
| 214 | return(NULL); | 237 | return(NULL); |
| 215 | } | 238 | } |
| 216 | if(sk_num(dso->meth_data) < 1) | 239 | if(sk_void_num(dso->meth_data) < 1) |
| 217 | { | 240 | { |
| 218 | DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_STACK_ERROR); | 241 | DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_STACK_ERROR); |
| 219 | return(NULL); | 242 | return(NULL); |
| 220 | } | 243 | } |
| 221 | ptr = (void *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); | 244 | ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); |
| 222 | if(ptr == NULL) | 245 | if(ptr == NULL) |
| 223 | { | 246 | { |
| 224 | DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_NULL_HANDLE); | 247 | DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_NULL_HANDLE); |
| @@ -237,32 +260,35 @@ static void *dlfcn_bind_var(DSO *dso, const char *symname) | |||
| 237 | static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname) | 260 | static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname) |
| 238 | { | 261 | { |
| 239 | void *ptr; | 262 | void *ptr; |
| 240 | DSO_FUNC_TYPE sym, *tsym = &sym; | 263 | union { |
| 264 | DSO_FUNC_TYPE sym; | ||
| 265 | void *dlret; | ||
| 266 | } u; | ||
| 241 | 267 | ||
| 242 | if((dso == NULL) || (symname == NULL)) | 268 | if((dso == NULL) || (symname == NULL)) |
| 243 | { | 269 | { |
| 244 | DSOerr(DSO_F_DLFCN_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); | 270 | DSOerr(DSO_F_DLFCN_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); |
| 245 | return(NULL); | 271 | return(NULL); |
| 246 | } | 272 | } |
| 247 | if(sk_num(dso->meth_data) < 1) | 273 | if(sk_void_num(dso->meth_data) < 1) |
| 248 | { | 274 | { |
| 249 | DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_STACK_ERROR); | 275 | DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_STACK_ERROR); |
| 250 | return(NULL); | 276 | return(NULL); |
| 251 | } | 277 | } |
| 252 | ptr = (void *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); | 278 | ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); |
| 253 | if(ptr == NULL) | 279 | if(ptr == NULL) |
| 254 | { | 280 | { |
| 255 | DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE); | 281 | DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE); |
| 256 | return(NULL); | 282 | return(NULL); |
| 257 | } | 283 | } |
| 258 | *(void **)(tsym) = dlsym(ptr, symname); | 284 | u.dlret = dlsym(ptr, symname); |
| 259 | if(sym == NULL) | 285 | if(u.dlret == NULL) |
| 260 | { | 286 | { |
| 261 | DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE); | 287 | DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE); |
| 262 | ERR_add_error_data(4, "symname(", symname, "): ", dlerror()); | 288 | ERR_add_error_data(4, "symname(", symname, "): ", dlerror()); |
| 263 | return(NULL); | 289 | return(NULL); |
| 264 | } | 290 | } |
| 265 | return(sym); | 291 | return u.sym; |
| 266 | } | 292 | } |
| 267 | 293 | ||
| 268 | static char *dlfcn_merger(DSO *dso, const char *filespec1, | 294 | static char *dlfcn_merger(DSO *dso, const char *filespec1, |
| @@ -279,14 +305,13 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
| 279 | } | 305 | } |
| 280 | /* If the first file specification is a rooted path, it rules. | 306 | /* If the first file specification is a rooted path, it rules. |
| 281 | same goes if the second file specification is missing. */ | 307 | same goes if the second file specification is missing. */ |
| 282 | if (!filespec2 || filespec1[0] == '/') | 308 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) |
| 283 | { | 309 | { |
| 284 | len = strlen(filespec1) + 1; | 310 | len = strlen(filespec1) + 1; |
| 285 | merged = OPENSSL_malloc(len); | 311 | merged = OPENSSL_malloc(len); |
| 286 | if(!merged) | 312 | if(!merged) |
| 287 | { | 313 | { |
| 288 | DSOerr(DSO_F_DLFCN_MERGER, | 314 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); |
| 289 | ERR_R_MALLOC_FAILURE); | ||
| 290 | return(NULL); | 315 | return(NULL); |
| 291 | } | 316 | } |
| 292 | strlcpy(merged, filespec1, len); | 317 | strlcpy(merged, filespec1, len); |
| @@ -313,7 +338,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
| 313 | { | 338 | { |
| 314 | int spec2len, len; | 339 | int spec2len, len; |
| 315 | 340 | ||
| 316 | spec2len = (filespec2 ? strlen(filespec2) : 0); | 341 | spec2len = strlen(filespec2); |
| 317 | len = spec2len + (filespec1 ? strlen(filespec1) : 0); | 342 | len = spec2len + (filespec1 ? strlen(filespec1) : 0); |
| 318 | 343 | ||
| 319 | if(filespec2 && filespec2[spec2len - 1] == '/') | 344 | if(filespec2 && filespec2[spec2len - 1] == '/') |
| @@ -335,6 +360,15 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
| 335 | return(merged); | 360 | return(merged); |
| 336 | } | 361 | } |
| 337 | 362 | ||
| 363 | #ifdef OPENSSL_SYS_MACOSX | ||
| 364 | #define DSO_ext ".dylib" | ||
| 365 | #define DSO_extlen 6 | ||
| 366 | #else | ||
| 367 | #define DSO_ext ".so" | ||
| 368 | #define DSO_extlen 3 | ||
| 369 | #endif | ||
| 370 | |||
| 371 | |||
| 338 | static char *dlfcn_name_converter(DSO *dso, const char *filename) | 372 | static char *dlfcn_name_converter(DSO *dso, const char *filename) |
| 339 | { | 373 | { |
| 340 | char *translated; | 374 | char *translated; |
| @@ -345,8 +379,8 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename) | |||
| 345 | transform = (strstr(filename, "/") == NULL); | 379 | transform = (strstr(filename, "/") == NULL); |
| 346 | if(transform) | 380 | if(transform) |
| 347 | { | 381 | { |
| 348 | /* We will convert this to "%s.so" or "lib%s.so" */ | 382 | /* We will convert this to "%s.so" or "lib%s.so" etc */ |
| 349 | rsize += 3; /* The length of ".so" */ | 383 | rsize += DSO_extlen; /* The length of ".so" */ |
| 350 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | 384 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) |
| 351 | rsize += 3; /* The length of "lib" */ | 385 | rsize += 3; /* The length of "lib" */ |
| 352 | } | 386 | } |
| @@ -360,13 +394,92 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename) | |||
| 360 | if(transform) | 394 | if(transform) |
| 361 | { | 395 | { |
| 362 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | 396 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) |
| 363 | snprintf(translated, rsize, "lib%s.so", filename); | 397 | snprintf(translated, rsize, "lib%s" DSO_ext, filename); |
| 364 | else | 398 | else |
| 365 | snprintf(translated, rsize, "%s.so", filename); | 399 | snprintf(translated, rsize, "%s" DSO_ext, filename); |
| 366 | } | 400 | } |
| 367 | else | 401 | else |
| 368 | snprintf(translated, rsize, "%s", filename); | 402 | snprintf(translated, rsize, "%s", filename); |
| 369 | return(translated); | 403 | return(translated); |
| 370 | } | 404 | } |
| 371 | 405 | ||
| 406 | #if defined(__sgi) && !defined(__OpenBSD__) | ||
| 407 | /* | ||
| 408 | This is a quote from IRIX manual for dladdr(3c): | ||
| 409 | |||
| 410 | <dlfcn.h> does not contain a prototype for dladdr or definition of | ||
| 411 | Dl_info. The #include <dlfcn.h> in the SYNOPSIS line is traditional, | ||
| 412 | but contains no dladdr prototype and no IRIX library contains an | ||
| 413 | implementation. Write your own declaration based on the code below. | ||
| 414 | |||
| 415 | The following code is dependent on internal interfaces that are not | ||
| 416 | part of the IRIX compatibility guarantee; however, there is no future | ||
| 417 | intention to change this interface, so on a practical level, the code | ||
| 418 | below is safe to use on IRIX. | ||
| 419 | */ | ||
| 420 | #include <rld_interface.h> | ||
| 421 | #ifndef _RLD_INTERFACE_DLFCN_H_DLADDR | ||
| 422 | #define _RLD_INTERFACE_DLFCN_H_DLADDR | ||
| 423 | typedef struct Dl_info { | ||
| 424 | const char * dli_fname; | ||
| 425 | void * dli_fbase; | ||
| 426 | const char * dli_sname; | ||
| 427 | void * dli_saddr; | ||
| 428 | int dli_version; | ||
| 429 | int dli_reserved1; | ||
| 430 | long dli_reserved[4]; | ||
| 431 | } Dl_info; | ||
| 432 | #else | ||
| 433 | typedef struct Dl_info Dl_info; | ||
| 434 | #endif | ||
| 435 | #define _RLD_DLADDR 14 | ||
| 436 | |||
| 437 | static int dladdr(void *address, Dl_info *dl) | ||
| 438 | { | ||
| 439 | void *v; | ||
| 440 | v = _rld_new_interface(_RLD_DLADDR,address,dl); | ||
| 441 | return (int)v; | ||
| 442 | } | ||
| 443 | #endif /* __sgi */ | ||
| 444 | |||
| 445 | static int dlfcn_pathbyaddr(void *addr,char *path,int sz) | ||
| 446 | { | ||
| 447 | #ifdef HAVE_DLINFO | ||
| 448 | Dl_info dli; | ||
| 449 | int len; | ||
| 450 | |||
| 451 | if (addr == NULL) | ||
| 452 | { | ||
| 453 | union { int(*f)(void*,char*,int); void *p; } t = | ||
| 454 | { dlfcn_pathbyaddr }; | ||
| 455 | addr = t.p; | ||
| 456 | } | ||
| 457 | |||
| 458 | if (dladdr(addr,&dli)) | ||
| 459 | { | ||
| 460 | len = (int)strlen(dli.dli_fname); | ||
| 461 | if (sz <= 0) return len+1; | ||
| 462 | if (len >= sz) len=sz-1; | ||
| 463 | memcpy(path,dli.dli_fname,len); | ||
| 464 | path[len++]=0; | ||
| 465 | return len; | ||
| 466 | } | ||
| 467 | |||
| 468 | ERR_add_error_data(4, "dlfcn_pathbyaddr(): ", dlerror()); | ||
| 469 | #endif | ||
| 470 | return -1; | ||
| 471 | } | ||
| 472 | |||
| 473 | static void *dlfcn_globallookup(const char *name) | ||
| 474 | { | ||
| 475 | void *ret = NULL,*handle = dlopen(NULL,RTLD_LAZY); | ||
| 476 | |||
| 477 | if (handle) | ||
| 478 | { | ||
| 479 | ret = dlsym(handle,name); | ||
| 480 | dlclose(handle); | ||
| 481 | } | ||
| 482 | |||
| 483 | return ret; | ||
| 484 | } | ||
| 372 | #endif /* DSO_DLFCN */ | 485 | #endif /* DSO_DLFCN */ |
diff --git a/src/lib/libcrypto/dso/dso_err.c b/src/lib/libcrypto/dso/dso_err.c index a8b0a210de..2bb07c2514 100644 --- a/src/lib/libcrypto/dso/dso_err.c +++ b/src/lib/libcrypto/dso/dso_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/dso/dso_err.c */ | 1 | /* crypto/dso/dso_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -70,6 +70,11 @@ | |||
| 70 | 70 | ||
| 71 | static ERR_STRING_DATA DSO_str_functs[]= | 71 | static ERR_STRING_DATA DSO_str_functs[]= |
| 72 | { | 72 | { |
| 73 | {ERR_FUNC(DSO_F_BEOS_BIND_FUNC), "BEOS_BIND_FUNC"}, | ||
| 74 | {ERR_FUNC(DSO_F_BEOS_BIND_VAR), "BEOS_BIND_VAR"}, | ||
| 75 | {ERR_FUNC(DSO_F_BEOS_LOAD), "BEOS_LOAD"}, | ||
| 76 | {ERR_FUNC(DSO_F_BEOS_NAME_CONVERTER), "BEOS_NAME_CONVERTER"}, | ||
| 77 | {ERR_FUNC(DSO_F_BEOS_UNLOAD), "BEOS_UNLOAD"}, | ||
| 73 | {ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "DLFCN_BIND_FUNC"}, | 78 | {ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "DLFCN_BIND_FUNC"}, |
| 74 | {ERR_FUNC(DSO_F_DLFCN_BIND_VAR), "DLFCN_BIND_VAR"}, | 79 | {ERR_FUNC(DSO_F_DLFCN_BIND_VAR), "DLFCN_BIND_VAR"}, |
| 75 | {ERR_FUNC(DSO_F_DLFCN_LOAD), "DLFCN_LOAD"}, | 80 | {ERR_FUNC(DSO_F_DLFCN_LOAD), "DLFCN_LOAD"}, |
| @@ -89,22 +94,29 @@ static ERR_STRING_DATA DSO_str_functs[]= | |||
| 89 | {ERR_FUNC(DSO_F_DSO_FREE), "DSO_free"}, | 94 | {ERR_FUNC(DSO_F_DSO_FREE), "DSO_free"}, |
| 90 | {ERR_FUNC(DSO_F_DSO_GET_FILENAME), "DSO_get_filename"}, | 95 | {ERR_FUNC(DSO_F_DSO_GET_FILENAME), "DSO_get_filename"}, |
| 91 | {ERR_FUNC(DSO_F_DSO_GET_LOADED_FILENAME), "DSO_get_loaded_filename"}, | 96 | {ERR_FUNC(DSO_F_DSO_GET_LOADED_FILENAME), "DSO_get_loaded_filename"}, |
| 97 | {ERR_FUNC(DSO_F_DSO_GLOBAL_LOOKUP), "DSO_global_lookup"}, | ||
| 92 | {ERR_FUNC(DSO_F_DSO_LOAD), "DSO_load"}, | 98 | {ERR_FUNC(DSO_F_DSO_LOAD), "DSO_load"}, |
| 93 | {ERR_FUNC(DSO_F_DSO_MERGE), "DSO_merge"}, | 99 | {ERR_FUNC(DSO_F_DSO_MERGE), "DSO_merge"}, |
| 94 | {ERR_FUNC(DSO_F_DSO_NEW_METHOD), "DSO_new_method"}, | 100 | {ERR_FUNC(DSO_F_DSO_NEW_METHOD), "DSO_new_method"}, |
| 101 | {ERR_FUNC(DSO_F_DSO_PATHBYADDR), "DSO_pathbyaddr"}, | ||
| 95 | {ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"}, | 102 | {ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"}, |
| 96 | {ERR_FUNC(DSO_F_DSO_SET_NAME_CONVERTER), "DSO_set_name_converter"}, | 103 | {ERR_FUNC(DSO_F_DSO_SET_NAME_CONVERTER), "DSO_set_name_converter"}, |
| 97 | {ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"}, | 104 | {ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"}, |
| 105 | {ERR_FUNC(DSO_F_GLOBAL_LOOKUP_FUNC), "GLOBAL_LOOKUP_FUNC"}, | ||
| 106 | {ERR_FUNC(DSO_F_PATHBYADDR), "PATHBYADDR"}, | ||
| 98 | {ERR_FUNC(DSO_F_VMS_BIND_SYM), "VMS_BIND_SYM"}, | 107 | {ERR_FUNC(DSO_F_VMS_BIND_SYM), "VMS_BIND_SYM"}, |
| 99 | {ERR_FUNC(DSO_F_VMS_LOAD), "VMS_LOAD"}, | 108 | {ERR_FUNC(DSO_F_VMS_LOAD), "VMS_LOAD"}, |
| 100 | {ERR_FUNC(DSO_F_VMS_MERGER), "VMS_MERGER"}, | 109 | {ERR_FUNC(DSO_F_VMS_MERGER), "VMS_MERGER"}, |
| 101 | {ERR_FUNC(DSO_F_VMS_UNLOAD), "VMS_UNLOAD"}, | 110 | {ERR_FUNC(DSO_F_VMS_UNLOAD), "VMS_UNLOAD"}, |
| 102 | {ERR_FUNC(DSO_F_WIN32_BIND_FUNC), "WIN32_BIND_FUNC"}, | 111 | {ERR_FUNC(DSO_F_WIN32_BIND_FUNC), "WIN32_BIND_FUNC"}, |
| 103 | {ERR_FUNC(DSO_F_WIN32_BIND_VAR), "WIN32_BIND_VAR"}, | 112 | {ERR_FUNC(DSO_F_WIN32_BIND_VAR), "WIN32_BIND_VAR"}, |
| 113 | {ERR_FUNC(DSO_F_WIN32_GLOBALLOOKUP), "WIN32_GLOBALLOOKUP"}, | ||
| 114 | {ERR_FUNC(DSO_F_WIN32_GLOBALLOOKUP_FUNC), "WIN32_GLOBALLOOKUP_FUNC"}, | ||
| 104 | {ERR_FUNC(DSO_F_WIN32_JOINER), "WIN32_JOINER"}, | 115 | {ERR_FUNC(DSO_F_WIN32_JOINER), "WIN32_JOINER"}, |
| 105 | {ERR_FUNC(DSO_F_WIN32_LOAD), "WIN32_LOAD"}, | 116 | {ERR_FUNC(DSO_F_WIN32_LOAD), "WIN32_LOAD"}, |
| 106 | {ERR_FUNC(DSO_F_WIN32_MERGER), "WIN32_MERGER"}, | 117 | {ERR_FUNC(DSO_F_WIN32_MERGER), "WIN32_MERGER"}, |
| 107 | {ERR_FUNC(DSO_F_WIN32_NAME_CONVERTER), "WIN32_NAME_CONVERTER"}, | 118 | {ERR_FUNC(DSO_F_WIN32_NAME_CONVERTER), "WIN32_NAME_CONVERTER"}, |
| 119 | {ERR_FUNC(DSO_F_WIN32_PATHBYADDR), "WIN32_PATHBYADDR"}, | ||
| 108 | {ERR_FUNC(DSO_F_WIN32_SPLITTER), "WIN32_SPLITTER"}, | 120 | {ERR_FUNC(DSO_F_WIN32_SPLITTER), "WIN32_SPLITTER"}, |
| 109 | {ERR_FUNC(DSO_F_WIN32_UNLOAD), "WIN32_UNLOAD"}, | 121 | {ERR_FUNC(DSO_F_WIN32_UNLOAD), "WIN32_UNLOAD"}, |
| 110 | {0,NULL} | 122 | {0,NULL} |
diff --git a/src/lib/libcrypto/dso/dso_lib.c b/src/lib/libcrypto/dso/dso_lib.c index 49bdd71309..8a15b794ab 100644 --- a/src/lib/libcrypto/dso/dso_lib.c +++ b/src/lib/libcrypto/dso/dso_lib.c | |||
| @@ -107,7 +107,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) | |||
| 107 | return(NULL); | 107 | return(NULL); |
| 108 | } | 108 | } |
| 109 | memset(ret, 0, sizeof(DSO)); | 109 | memset(ret, 0, sizeof(DSO)); |
| 110 | ret->meth_data = sk_new_null(); | 110 | ret->meth_data = sk_void_new_null(); |
| 111 | if(ret->meth_data == NULL) | 111 | if(ret->meth_data == NULL) |
| 112 | { | 112 | { |
| 113 | /* sk_new doesn't generate any errors so we do */ | 113 | /* sk_new doesn't generate any errors so we do */ |
| @@ -163,7 +163,7 @@ int DSO_free(DSO *dso) | |||
| 163 | return(0); | 163 | return(0); |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | sk_free(dso->meth_data); | 166 | sk_void_free(dso->meth_data); |
| 167 | if(dso->filename != NULL) | 167 | if(dso->filename != NULL) |
| 168 | OPENSSL_free(dso->filename); | 168 | OPENSSL_free(dso->filename); |
| 169 | if(dso->loaded_filename != NULL) | 169 | if(dso->loaded_filename != NULL) |
| @@ -399,13 +399,6 @@ char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2) | |||
| 399 | DSOerr(DSO_F_DSO_MERGE,ERR_R_PASSED_NULL_PARAMETER); | 399 | DSOerr(DSO_F_DSO_MERGE,ERR_R_PASSED_NULL_PARAMETER); |
| 400 | return(NULL); | 400 | return(NULL); |
| 401 | } | 401 | } |
| 402 | if(filespec1 == NULL) | ||
| 403 | filespec1 = dso->filename; | ||
| 404 | if(filespec1 == NULL) | ||
| 405 | { | ||
| 406 | DSOerr(DSO_F_DSO_MERGE,DSO_R_NO_FILE_SPECIFICATION); | ||
| 407 | return(NULL); | ||
| 408 | } | ||
| 409 | if((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) | 402 | if((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) |
| 410 | { | 403 | { |
| 411 | if(dso->merger != NULL) | 404 | if(dso->merger != NULL) |
| @@ -464,3 +457,27 @@ const char *DSO_get_loaded_filename(DSO *dso) | |||
| 464 | } | 457 | } |
| 465 | return(dso->loaded_filename); | 458 | return(dso->loaded_filename); |
| 466 | } | 459 | } |
| 460 | |||
| 461 | int DSO_pathbyaddr(void *addr,char *path,int sz) | ||
| 462 | { | ||
| 463 | DSO_METHOD *meth = default_DSO_meth; | ||
| 464 | if (meth == NULL) meth = DSO_METHOD_openssl(); | ||
| 465 | if (meth->pathbyaddr == NULL) | ||
| 466 | { | ||
| 467 | DSOerr(DSO_F_DSO_PATHBYADDR,DSO_R_UNSUPPORTED); | ||
| 468 | return -1; | ||
| 469 | } | ||
| 470 | return (*meth->pathbyaddr)(addr,path,sz); | ||
| 471 | } | ||
| 472 | |||
| 473 | void *DSO_global_lookup(const char *name) | ||
| 474 | { | ||
| 475 | DSO_METHOD *meth = default_DSO_meth; | ||
| 476 | if (meth == NULL) meth = DSO_METHOD_openssl(); | ||
| 477 | if (meth->globallookup == NULL) | ||
| 478 | { | ||
| 479 | DSOerr(DSO_F_DSO_GLOBAL_LOOKUP,DSO_R_UNSUPPORTED); | ||
| 480 | return NULL; | ||
| 481 | } | ||
| 482 | return (*meth->globallookup)(name); | ||
| 483 | } | ||
diff --git a/src/lib/libcrypto/dso/dso_null.c b/src/lib/libcrypto/dso/dso_null.c index 4972984651..49d842d1f5 100644 --- a/src/lib/libcrypto/dso/dso_null.c +++ b/src/lib/libcrypto/dso/dso_null.c | |||
| @@ -78,7 +78,9 @@ static DSO_METHOD dso_meth_null = { | |||
| 78 | NULL, /* dso_name_converter */ | 78 | NULL, /* dso_name_converter */ |
| 79 | NULL, /* dso_merger */ | 79 | NULL, /* dso_merger */ |
| 80 | NULL, /* init */ | 80 | NULL, /* init */ |
| 81 | NULL /* finish */ | 81 | NULL, /* finish */ |
| 82 | NULL, /* pathbyaddr */ | ||
| 83 | NULL /* globallookup */ | ||
| 82 | }; | 84 | }; |
| 83 | 85 | ||
| 84 | DSO_METHOD *DSO_METHOD_null(void) | 86 | DSO_METHOD *DSO_METHOD_null(void) |
diff --git a/src/lib/libcrypto/dso/dso_openssl.c b/src/lib/libcrypto/dso/dso_openssl.c index a4395ebffe..b17e8e8e9e 100644 --- a/src/lib/libcrypto/dso/dso_openssl.c +++ b/src/lib/libcrypto/dso/dso_openssl.c | |||
| @@ -74,6 +74,8 @@ DSO_METHOD *DSO_METHOD_openssl(void) | |||
| 74 | return(DSO_METHOD_win32()); | 74 | return(DSO_METHOD_win32()); |
| 75 | #elif defined(DSO_VMS) | 75 | #elif defined(DSO_VMS) |
| 76 | return(DSO_METHOD_vms()); | 76 | return(DSO_METHOD_vms()); |
| 77 | #elif defined(DSO_BEOS) | ||
| 78 | return(DSO_METHOD_beos()); | ||
| 77 | #else | 79 | #else |
| 78 | return(DSO_METHOD_null()); | 80 | return(DSO_METHOD_null()); |
| 79 | #endif | 81 | #endif |
diff --git a/src/lib/libcrypto/dso/dso_vms.c b/src/lib/libcrypto/dso/dso_vms.c index 2c434ee8a6..321512772a 100644 --- a/src/lib/libcrypto/dso/dso_vms.c +++ b/src/lib/libcrypto/dso/dso_vms.c | |||
| @@ -215,7 +215,7 @@ static int vms_load(DSO *dso) | |||
| 215 | p->imagename_dsc.dsc$b_class = DSC$K_CLASS_S; | 215 | p->imagename_dsc.dsc$b_class = DSC$K_CLASS_S; |
| 216 | p->imagename_dsc.dsc$a_pointer = p->imagename; | 216 | p->imagename_dsc.dsc$a_pointer = p->imagename; |
| 217 | 217 | ||
| 218 | if(!sk_push(dso->meth_data, (char *)p)) | 218 | if(!sk_void_push(dso->meth_data, (char *)p)) |
| 219 | { | 219 | { |
| 220 | DSOerr(DSO_F_VMS_LOAD,DSO_R_STACK_ERROR); | 220 | DSOerr(DSO_F_VMS_LOAD,DSO_R_STACK_ERROR); |
| 221 | goto err; | 221 | goto err; |
| @@ -245,9 +245,9 @@ static int vms_unload(DSO *dso) | |||
| 245 | DSOerr(DSO_F_VMS_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); | 245 | DSOerr(DSO_F_VMS_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); |
| 246 | return(0); | 246 | return(0); |
| 247 | } | 247 | } |
| 248 | if(sk_num(dso->meth_data) < 1) | 248 | if(sk_void_num(dso->meth_data) < 1) |
| 249 | return(1); | 249 | return(1); |
| 250 | p = (DSO_VMS_INTERNAL *)sk_pop(dso->meth_data); | 250 | p = (DSO_VMS_INTERNAL *)sk_void_pop(dso->meth_data); |
| 251 | if(p == NULL) | 251 | if(p == NULL) |
| 252 | { | 252 | { |
| 253 | DSOerr(DSO_F_VMS_UNLOAD,DSO_R_NULL_HANDLE); | 253 | DSOerr(DSO_F_VMS_UNLOAD,DSO_R_NULL_HANDLE); |
| @@ -302,13 +302,13 @@ void vms_bind_sym(DSO *dso, const char *symname, void **sym) | |||
| 302 | DSOerr(DSO_F_VMS_BIND_SYM,ERR_R_PASSED_NULL_PARAMETER); | 302 | DSOerr(DSO_F_VMS_BIND_SYM,ERR_R_PASSED_NULL_PARAMETER); |
| 303 | return; | 303 | return; |
| 304 | } | 304 | } |
| 305 | if(sk_num(dso->meth_data) < 1) | 305 | if(sk_void_num(dso->meth_data) < 1) |
| 306 | { | 306 | { |
| 307 | DSOerr(DSO_F_VMS_BIND_SYM,DSO_R_STACK_ERROR); | 307 | DSOerr(DSO_F_VMS_BIND_SYM,DSO_R_STACK_ERROR); |
| 308 | return; | 308 | return; |
| 309 | } | 309 | } |
| 310 | ptr = (DSO_VMS_INTERNAL *)sk_value(dso->meth_data, | 310 | ptr = (DSO_VMS_INTERNAL *)sk_void_value(dso->meth_data, |
| 311 | sk_num(dso->meth_data) - 1); | 311 | sk_void_num(dso->meth_data) - 1); |
| 312 | if(ptr == NULL) | 312 | if(ptr == NULL) |
| 313 | { | 313 | { |
| 314 | DSOerr(DSO_F_VMS_BIND_SYM,DSO_R_NULL_HANDLE); | 314 | DSOerr(DSO_F_VMS_BIND_SYM,DSO_R_NULL_HANDLE); |
diff --git a/src/lib/libcrypto/dso/dso_win32.c b/src/lib/libcrypto/dso/dso_win32.c index fd3dd6a7fe..6fb6c54181 100644 --- a/src/lib/libcrypto/dso/dso_win32.c +++ b/src/lib/libcrypto/dso/dso_win32.c | |||
| @@ -96,7 +96,11 @@ static HINSTANCE LoadLibraryA(LPCSTR lpLibFileName) | |||
| 96 | #else | 96 | #else |
| 97 | fnamw = (WCHAR *)alloca (len_0*sizeof(WCHAR)); | 97 | fnamw = (WCHAR *)alloca (len_0*sizeof(WCHAR)); |
| 98 | #endif | 98 | #endif |
| 99 | if (fnamw == NULL) return NULL; | 99 | if (fnamw == NULL) |
| 100 | { | ||
| 101 | SetLastError(ERROR_NOT_ENOUGH_MEMORY); | ||
| 102 | return NULL; | ||
| 103 | } | ||
| 100 | 104 | ||
| 101 | #if defined(_WIN32_WCE) && _WIN32_WCE>=101 | 105 | #if defined(_WIN32_WCE) && _WIN32_WCE>=101 |
| 102 | if (!MultiByteToWideChar(CP_ACP,0,lpLibFileName,len_0,fnamw,len_0)) | 106 | if (!MultiByteToWideChar(CP_ACP,0,lpLibFileName,len_0,fnamw,len_0)) |
| @@ -124,6 +128,8 @@ static long win32_ctrl(DSO *dso, int cmd, long larg, void *parg); | |||
| 124 | static char *win32_name_converter(DSO *dso, const char *filename); | 128 | static char *win32_name_converter(DSO *dso, const char *filename); |
| 125 | static char *win32_merger(DSO *dso, const char *filespec1, | 129 | static char *win32_merger(DSO *dso, const char *filespec1, |
| 126 | const char *filespec2); | 130 | const char *filespec2); |
| 131 | static int win32_pathbyaddr(void *addr,char *path,int sz); | ||
| 132 | static void *win32_globallookup(const char *name); | ||
| 127 | 133 | ||
| 128 | static const char *openssl_strnchr(const char *string, int c, size_t len); | 134 | static const char *openssl_strnchr(const char *string, int c, size_t len); |
| 129 | 135 | ||
| @@ -142,7 +148,9 @@ static DSO_METHOD dso_meth_win32 = { | |||
| 142 | win32_name_converter, | 148 | win32_name_converter, |
| 143 | win32_merger, | 149 | win32_merger, |
| 144 | NULL, /* init */ | 150 | NULL, /* init */ |
| 145 | NULL /* finish */ | 151 | NULL, /* finish */ |
| 152 | win32_pathbyaddr, | ||
| 153 | win32_globallookup | ||
| 146 | }; | 154 | }; |
| 147 | 155 | ||
| 148 | DSO_METHOD *DSO_METHOD_win32(void) | 156 | DSO_METHOD *DSO_METHOD_win32(void) |
| @@ -180,7 +188,7 @@ static int win32_load(DSO *dso) | |||
| 180 | goto err; | 188 | goto err; |
| 181 | } | 189 | } |
| 182 | *p = h; | 190 | *p = h; |
| 183 | if(!sk_push(dso->meth_data, (char *)p)) | 191 | if(!sk_void_push(dso->meth_data, p)) |
| 184 | { | 192 | { |
| 185 | DSOerr(DSO_F_WIN32_LOAD,DSO_R_STACK_ERROR); | 193 | DSOerr(DSO_F_WIN32_LOAD,DSO_R_STACK_ERROR); |
| 186 | goto err; | 194 | goto err; |
| @@ -207,9 +215,9 @@ static int win32_unload(DSO *dso) | |||
| 207 | DSOerr(DSO_F_WIN32_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); | 215 | DSOerr(DSO_F_WIN32_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); |
| 208 | return(0); | 216 | return(0); |
| 209 | } | 217 | } |
| 210 | if(sk_num(dso->meth_data) < 1) | 218 | if(sk_void_num(dso->meth_data) < 1) |
| 211 | return(1); | 219 | return(1); |
| 212 | p = (HINSTANCE *)sk_pop(dso->meth_data); | 220 | p = sk_void_pop(dso->meth_data); |
| 213 | if(p == NULL) | 221 | if(p == NULL) |
| 214 | { | 222 | { |
| 215 | DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_NULL_HANDLE); | 223 | DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_NULL_HANDLE); |
| @@ -220,7 +228,7 @@ static int win32_unload(DSO *dso) | |||
| 220 | DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_UNLOAD_FAILED); | 228 | DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_UNLOAD_FAILED); |
| 221 | /* We should push the value back onto the stack in | 229 | /* We should push the value back onto the stack in |
| 222 | * case of a retry. */ | 230 | * case of a retry. */ |
| 223 | sk_push(dso->meth_data, (char *)p); | 231 | sk_void_push(dso->meth_data, p); |
| 224 | return(0); | 232 | return(0); |
| 225 | } | 233 | } |
| 226 | /* Cleanup */ | 234 | /* Cleanup */ |
| @@ -240,12 +248,12 @@ static void *win32_bind_var(DSO *dso, const char *symname) | |||
| 240 | DSOerr(DSO_F_WIN32_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); | 248 | DSOerr(DSO_F_WIN32_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); |
| 241 | return(NULL); | 249 | return(NULL); |
| 242 | } | 250 | } |
| 243 | if(sk_num(dso->meth_data) < 1) | 251 | if(sk_void_num(dso->meth_data) < 1) |
| 244 | { | 252 | { |
| 245 | DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_STACK_ERROR); | 253 | DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_STACK_ERROR); |
| 246 | return(NULL); | 254 | return(NULL); |
| 247 | } | 255 | } |
| 248 | ptr = (HINSTANCE *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); | 256 | ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); |
| 249 | if(ptr == NULL) | 257 | if(ptr == NULL) |
| 250 | { | 258 | { |
| 251 | DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_NULL_HANDLE); | 259 | DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_NULL_HANDLE); |
| @@ -271,12 +279,12 @@ static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname) | |||
| 271 | DSOerr(DSO_F_WIN32_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); | 279 | DSOerr(DSO_F_WIN32_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); |
| 272 | return(NULL); | 280 | return(NULL); |
| 273 | } | 281 | } |
| 274 | if(sk_num(dso->meth_data) < 1) | 282 | if(sk_void_num(dso->meth_data) < 1) |
| 275 | { | 283 | { |
| 276 | DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_STACK_ERROR); | 284 | DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_STACK_ERROR); |
| 277 | return(NULL); | 285 | return(NULL); |
| 278 | } | 286 | } |
| 279 | ptr = (HINSTANCE *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); | 287 | ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); |
| 280 | if(ptr == NULL) | 288 | if(ptr == NULL) |
| 281 | { | 289 | { |
| 282 | DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_NULL_HANDLE); | 290 | DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_NULL_HANDLE); |
| @@ -327,8 +335,8 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename, | |||
| 327 | memset(result, 0, sizeof(struct file_st)); | 335 | memset(result, 0, sizeof(struct file_st)); |
| 328 | position = IN_DEVICE; | 336 | position = IN_DEVICE; |
| 329 | 337 | ||
| 330 | if(filename[0] == '\\' && filename[1] == '\\' | 338 | if((filename[0] == '\\' && filename[1] == '\\') |
| 331 | || filename[0] == '/' && filename[1] == '/') | 339 | || (filename[0] == '/' && filename[1] == '/')) |
| 332 | { | 340 | { |
| 333 | position = IN_NODE; | 341 | position = IN_NODE; |
| 334 | filename += 2; | 342 | filename += 2; |
| @@ -347,10 +355,11 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename, | |||
| 347 | DSOerr(DSO_F_WIN32_SPLITTER, | 355 | DSOerr(DSO_F_WIN32_SPLITTER, |
| 348 | DSO_R_INCORRECT_FILE_SYNTAX); | 356 | DSO_R_INCORRECT_FILE_SYNTAX); |
| 349 | /*goto err;*/ | 357 | /*goto err;*/ |
| 358 | OPENSSL_free(result); | ||
| 350 | return(NULL); | 359 | return(NULL); |
| 351 | } | 360 | } |
| 352 | result->device = start; | 361 | result->device = start; |
| 353 | result->devicelen = filename - start; | 362 | result->devicelen = (int)(filename - start); |
| 354 | position = IN_FILE; | 363 | position = IN_FILE; |
| 355 | start = ++filename; | 364 | start = ++filename; |
| 356 | result->dir = start; | 365 | result->dir = start; |
| @@ -359,7 +368,7 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename, | |||
| 359 | case '/': | 368 | case '/': |
| 360 | if(position == IN_NODE) | 369 | if(position == IN_NODE) |
| 361 | { | 370 | { |
| 362 | result->nodelen = filename - start; | 371 | result->nodelen = (int)(filename - start); |
| 363 | position = IN_FILE; | 372 | position = IN_FILE; |
| 364 | start = ++filename; | 373 | start = ++filename; |
| 365 | result->dir = start; | 374 | result->dir = start; |
| @@ -369,20 +378,20 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename, | |||
| 369 | position = IN_FILE; | 378 | position = IN_FILE; |
| 370 | filename++; | 379 | filename++; |
| 371 | result->dir = start; | 380 | result->dir = start; |
| 372 | result->dirlen = filename - start; | 381 | result->dirlen = (int)(filename - start); |
| 373 | start = filename; | 382 | start = filename; |
| 374 | } | 383 | } |
| 375 | else | 384 | else |
| 376 | { | 385 | { |
| 377 | filename++; | 386 | filename++; |
| 378 | result->dirlen += filename - start; | 387 | result->dirlen += (int)(filename - start); |
| 379 | start = filename; | 388 | start = filename; |
| 380 | } | 389 | } |
| 381 | break; | 390 | break; |
| 382 | case '\0': | 391 | case '\0': |
| 383 | if(position == IN_NODE) | 392 | if(position == IN_NODE) |
| 384 | { | 393 | { |
| 385 | result->nodelen = filename - start; | 394 | result->nodelen = (int)(filename - start); |
| 386 | } | 395 | } |
| 387 | else | 396 | else |
| 388 | { | 397 | { |
| @@ -396,13 +405,13 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename, | |||
| 396 | result->dirlen = 0; | 405 | result->dirlen = 0; |
| 397 | } | 406 | } |
| 398 | result->dirlen += | 407 | result->dirlen += |
| 399 | filename - start; | 408 | (int)(filename - start); |
| 400 | } | 409 | } |
| 401 | else | 410 | else |
| 402 | { | 411 | { |
| 403 | result->file = start; | 412 | result->file = start; |
| 404 | result->filelen = | 413 | result->filelen = |
| 405 | filename - start; | 414 | (int)(filename - start); |
| 406 | } | 415 | } |
| 407 | } | 416 | } |
| 408 | } | 417 | } |
| @@ -496,7 +505,7 @@ static char *win32_joiner(DSO *dso, const struct file_st *file_split) | |||
| 496 | + file_split->predirlen | 505 | + file_split->predirlen |
| 497 | - (start - file_split->predir); | 506 | - (start - file_split->predir); |
| 498 | strncpy(&result[offset], start, | 507 | strncpy(&result[offset], start, |
| 499 | end - start); offset += end - start; | 508 | end - start); offset += (int)(end - start); |
| 500 | result[offset] = '\\'; offset++; | 509 | result[offset] = '\\'; offset++; |
| 501 | start = end + 1; | 510 | start = end + 1; |
| 502 | } | 511 | } |
| @@ -517,7 +526,7 @@ static char *win32_joiner(DSO *dso, const struct file_st *file_split) | |||
| 517 | + file_split->dirlen | 526 | + file_split->dirlen |
| 518 | - (start - file_split->dir); | 527 | - (start - file_split->dir); |
| 519 | strncpy(&result[offset], start, | 528 | strncpy(&result[offset], start, |
| 520 | end - start); offset += end - start; | 529 | end - start); offset += (int)(end - start); |
| 521 | result[offset] = '\\'; offset++; | 530 | result[offset] = '\\'; offset++; |
| 522 | start = end + 1; | 531 | start = end + 1; |
| 523 | } | 532 | } |
| @@ -613,6 +622,8 @@ static char *win32_merger(DSO *dso, const char *filespec1, const char *filespec2 | |||
| 613 | 622 | ||
| 614 | merged = win32_joiner(dso, filespec1_split); | 623 | merged = win32_joiner(dso, filespec1_split); |
| 615 | } | 624 | } |
| 625 | OPENSSL_free(filespec1_split); | ||
| 626 | OPENSSL_free(filespec2_split); | ||
| 616 | return(merged); | 627 | return(merged); |
| 617 | } | 628 | } |
| 618 | 629 | ||
| @@ -656,5 +667,178 @@ static const char *openssl_strnchr(const char *string, int c, size_t len) | |||
| 656 | return NULL; | 667 | return NULL; |
| 657 | } | 668 | } |
| 658 | 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 *); | ||
| 659 | 683 | ||
| 660 | #endif /* OPENSSL_SYS_WIN32 */ | 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/dyn_lck.c b/src/lib/libcrypto/dyn_lck.c deleted file mode 100644 index 7f82c41264..0000000000 --- a/src/lib/libcrypto/dyn_lck.c +++ /dev/null | |||
| @@ -1,428 +0,0 @@ | |||
| 1 | /* crypto/cryptlib.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1998-2003 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 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
| 113 | * ECDH support in OpenSSL originally developed by | ||
| 114 | * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. | ||
| 115 | */ | ||
| 116 | |||
| 117 | #include "cryptlib.h" | ||
| 118 | #include <openssl/safestack.h> | ||
| 119 | |||
| 120 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) | ||
| 121 | static double SSLeay_MSVC5_hack=0.0; /* and for VC1.5 */ | ||
| 122 | #endif | ||
| 123 | |||
| 124 | DECLARE_STACK_OF(CRYPTO_dynlock) | ||
| 125 | IMPLEMENT_STACK_OF(CRYPTO_dynlock) | ||
| 126 | |||
| 127 | /* real #defines in crypto.h, keep these upto date */ | ||
| 128 | static const char* const lock_names[CRYPTO_NUM_LOCKS] = | ||
| 129 | { | ||
| 130 | "<<ERROR>>", | ||
| 131 | "err", | ||
| 132 | "ex_data", | ||
| 133 | "x509", | ||
| 134 | "x509_info", | ||
| 135 | "x509_pkey", | ||
| 136 | "x509_crl", | ||
| 137 | "x509_req", | ||
| 138 | "dsa", | ||
| 139 | "rsa", | ||
| 140 | "evp_pkey", | ||
| 141 | "x509_store", | ||
| 142 | "ssl_ctx", | ||
| 143 | "ssl_cert", | ||
| 144 | "ssl_session", | ||
| 145 | "ssl_sess_cert", | ||
| 146 | "ssl", | ||
| 147 | "ssl_method", | ||
| 148 | "rand", | ||
| 149 | "rand2", | ||
| 150 | "debug_malloc", | ||
| 151 | "BIO", | ||
| 152 | "gethostbyname", | ||
| 153 | "getservbyname", | ||
| 154 | "readdir", | ||
| 155 | "RSA_blinding", | ||
| 156 | "dh", | ||
| 157 | "debug_malloc2", | ||
| 158 | "dso", | ||
| 159 | "dynlock", | ||
| 160 | "engine", | ||
| 161 | "ui", | ||
| 162 | "ecdsa", | ||
| 163 | "ec", | ||
| 164 | "ecdh", | ||
| 165 | "bn", | ||
| 166 | "ec_pre_comp", | ||
| 167 | "store", | ||
| 168 | "comp", | ||
| 169 | #ifndef OPENSSL_FIPS | ||
| 170 | # if CRYPTO_NUM_LOCKS != 39 | ||
| 171 | # error "Inconsistency between crypto.h and cryptlib.c" | ||
| 172 | # endif | ||
| 173 | #else | ||
| 174 | "fips", | ||
| 175 | "fips2", | ||
| 176 | # if CRYPTO_NUM_LOCKS != 41 | ||
| 177 | # error "Inconsistency between crypto.h and cryptlib.c" | ||
| 178 | # endif | ||
| 179 | #endif | ||
| 180 | }; | ||
| 181 | |||
| 182 | /* This is for applications to allocate new type names in the non-dynamic | ||
| 183 | array of lock names. These are numbered with positive numbers. */ | ||
| 184 | static STACK *app_locks=NULL; | ||
| 185 | |||
| 186 | /* For applications that want a more dynamic way of handling threads, the | ||
| 187 | following stack is used. These are externally numbered with negative | ||
| 188 | numbers. */ | ||
| 189 | static STACK_OF(CRYPTO_dynlock) *dyn_locks=NULL; | ||
| 190 | |||
| 191 | |||
| 192 | static struct CRYPTO_dynlock_value *(MS_FAR *dynlock_create_callback) | ||
| 193 | (const char *file,int line)=NULL; | ||
| 194 | static void (MS_FAR *dynlock_lock_callback)(int mode, | ||
| 195 | struct CRYPTO_dynlock_value *l, const char *file,int line)=NULL; | ||
| 196 | static void (MS_FAR *dynlock_destroy_callback)(struct CRYPTO_dynlock_value *l, | ||
| 197 | const char *file,int line)=NULL; | ||
| 198 | |||
| 199 | int CRYPTO_get_new_lockid(char *name) | ||
| 200 | { | ||
| 201 | char *str; | ||
| 202 | int i; | ||
| 203 | |||
| 204 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) | ||
| 205 | /* A hack to make Visual C++ 5.0 work correctly when linking as | ||
| 206 | * a DLL using /MT. Without this, the application cannot use | ||
| 207 | * and floating point printf's. | ||
| 208 | * It also seems to be needed for Visual C 1.5 (win16) */ | ||
| 209 | SSLeay_MSVC5_hack=(double)name[0]*(double)name[1]; | ||
| 210 | #endif | ||
| 211 | |||
| 212 | if ((app_locks == NULL) && ((app_locks=sk_new_null()) == NULL)) | ||
| 213 | { | ||
| 214 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_LOCKID,ERR_R_MALLOC_FAILURE); | ||
| 215 | return(0); | ||
| 216 | } | ||
| 217 | if ((str=BUF_strdup(name)) == NULL) | ||
| 218 | { | ||
| 219 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_LOCKID,ERR_R_MALLOC_FAILURE); | ||
| 220 | return(0); | ||
| 221 | } | ||
| 222 | i=sk_push(app_locks,str); | ||
| 223 | if (!i) | ||
| 224 | OPENSSL_free(str); | ||
| 225 | else | ||
| 226 | i+=CRYPTO_NUM_LOCKS; /* gap of one :-) */ | ||
| 227 | return(i); | ||
| 228 | } | ||
| 229 | |||
| 230 | int CRYPTO_get_new_dynlockid(void) | ||
| 231 | { | ||
| 232 | int i = 0; | ||
| 233 | CRYPTO_dynlock *pointer = NULL; | ||
| 234 | |||
| 235 | if (dynlock_create_callback == NULL) | ||
| 236 | { | ||
| 237 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK); | ||
| 238 | return(0); | ||
| 239 | } | ||
| 240 | CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); | ||
| 241 | if ((dyn_locks == NULL) | ||
| 242 | && ((dyn_locks=sk_CRYPTO_dynlock_new_null()) == NULL)) | ||
| 243 | { | ||
| 244 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 245 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE); | ||
| 246 | return(0); | ||
| 247 | } | ||
| 248 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 249 | |||
| 250 | pointer = (CRYPTO_dynlock *)OPENSSL_malloc(sizeof(CRYPTO_dynlock)); | ||
| 251 | if (pointer == NULL) | ||
| 252 | { | ||
| 253 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE); | ||
| 254 | return(0); | ||
| 255 | } | ||
| 256 | pointer->references = 1; | ||
| 257 | pointer->data = dynlock_create_callback(__FILE__,__LINE__); | ||
| 258 | if (pointer->data == NULL) | ||
| 259 | { | ||
| 260 | OPENSSL_free(pointer); | ||
| 261 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE); | ||
| 262 | return(0); | ||
| 263 | } | ||
| 264 | |||
| 265 | CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); | ||
| 266 | /* First, try to find an existing empty slot */ | ||
| 267 | i=sk_CRYPTO_dynlock_find(dyn_locks,NULL); | ||
| 268 | /* If there was none, push, thereby creating a new one */ | ||
| 269 | if (i == -1) | ||
| 270 | /* Since sk_push() returns the number of items on the | ||
| 271 | stack, not the location of the pushed item, we need | ||
| 272 | to transform the returned number into a position, | ||
| 273 | by decreasing it. */ | ||
| 274 | i=sk_CRYPTO_dynlock_push(dyn_locks,pointer) - 1; | ||
| 275 | else | ||
| 276 | /* If we found a place with a NULL pointer, put our pointer | ||
| 277 | in it. */ | ||
| 278 | (void)sk_CRYPTO_dynlock_set(dyn_locks,i,pointer); | ||
| 279 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 280 | |||
| 281 | if (i == -1) | ||
| 282 | { | ||
| 283 | dynlock_destroy_callback(pointer->data,__FILE__,__LINE__); | ||
| 284 | OPENSSL_free(pointer); | ||
| 285 | } | ||
| 286 | else | ||
| 287 | i += 1; /* to avoid 0 */ | ||
| 288 | return -i; | ||
| 289 | } | ||
| 290 | |||
| 291 | void CRYPTO_destroy_dynlockid(int i) | ||
| 292 | { | ||
| 293 | CRYPTO_dynlock *pointer = NULL; | ||
| 294 | if (i) | ||
| 295 | i = -i-1; | ||
| 296 | if (dynlock_destroy_callback == NULL) | ||
| 297 | return; | ||
| 298 | |||
| 299 | CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); | ||
| 300 | |||
| 301 | if (dyn_locks == NULL || i >= sk_CRYPTO_dynlock_num(dyn_locks)) | ||
| 302 | { | ||
| 303 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 304 | return; | ||
| 305 | } | ||
| 306 | pointer = sk_CRYPTO_dynlock_value(dyn_locks, i); | ||
| 307 | if (pointer != NULL) | ||
| 308 | { | ||
| 309 | --pointer->references; | ||
| 310 | #ifdef REF_CHECK | ||
| 311 | if (pointer->references < 0) | ||
| 312 | { | ||
| 313 | fprintf(stderr,"CRYPTO_destroy_dynlockid, bad reference count\n"); | ||
| 314 | abort(); | ||
| 315 | } | ||
| 316 | else | ||
| 317 | #endif | ||
| 318 | if (pointer->references <= 0) | ||
| 319 | { | ||
| 320 | (void)sk_CRYPTO_dynlock_set(dyn_locks, i, NULL); | ||
| 321 | } | ||
| 322 | else | ||
| 323 | pointer = NULL; | ||
| 324 | } | ||
| 325 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 326 | |||
| 327 | if (pointer) | ||
| 328 | { | ||
| 329 | dynlock_destroy_callback(pointer->data,__FILE__,__LINE__); | ||
| 330 | OPENSSL_free(pointer); | ||
| 331 | } | ||
| 332 | } | ||
| 333 | |||
| 334 | struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i) | ||
| 335 | { | ||
| 336 | CRYPTO_dynlock *pointer = NULL; | ||
| 337 | if (i) | ||
| 338 | i = -i-1; | ||
| 339 | |||
| 340 | CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); | ||
| 341 | |||
| 342 | if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks)) | ||
| 343 | pointer = sk_CRYPTO_dynlock_value(dyn_locks, i); | ||
| 344 | if (pointer) | ||
| 345 | pointer->references++; | ||
| 346 | |||
| 347 | CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); | ||
| 348 | |||
| 349 | if (pointer) | ||
| 350 | return pointer->data; | ||
| 351 | return NULL; | ||
| 352 | } | ||
| 353 | |||
| 354 | struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void)) | ||
| 355 | (const char *file,int line) | ||
| 356 | { | ||
| 357 | return(dynlock_create_callback); | ||
| 358 | } | ||
| 359 | |||
| 360 | void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, | ||
| 361 | struct CRYPTO_dynlock_value *l, const char *file,int line) | ||
| 362 | { | ||
| 363 | return(dynlock_lock_callback); | ||
| 364 | } | ||
| 365 | |||
| 366 | void (*CRYPTO_get_dynlock_destroy_callback(void)) | ||
| 367 | (struct CRYPTO_dynlock_value *l, const char *file,int line) | ||
| 368 | { | ||
| 369 | return(dynlock_destroy_callback); | ||
| 370 | } | ||
| 371 | |||
| 372 | void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*func) | ||
| 373 | (const char *file, int line)) | ||
| 374 | { | ||
| 375 | dynlock_create_callback=func; | ||
| 376 | } | ||
| 377 | |||
| 378 | static void do_dynlock(int mode, int type, const char *file, int line) | ||
| 379 | { | ||
| 380 | if (dynlock_lock_callback != NULL) | ||
| 381 | { | ||
| 382 | struct CRYPTO_dynlock_value *pointer | ||
| 383 | = CRYPTO_get_dynlock_value(type); | ||
| 384 | |||
| 385 | OPENSSL_assert(pointer != NULL); | ||
| 386 | |||
| 387 | dynlock_lock_callback(mode, pointer, file, line); | ||
| 388 | |||
| 389 | CRYPTO_destroy_dynlockid(type); | ||
| 390 | } | ||
| 391 | } | ||
| 392 | |||
| 393 | void CRYPTO_set_dynlock_lock_callback(void (*func)(int mode, | ||
| 394 | struct CRYPTO_dynlock_value *l, const char *file, int line)) | ||
| 395 | { | ||
| 396 | /* Set callback so CRYPTO_lock() can now handle dynamic locks. | ||
| 397 | * This is OK because at this point and application shouldn't be using | ||
| 398 | * OpenSSL from multiple threads because it is setting up the locking | ||
| 399 | * callbacks. | ||
| 400 | */ | ||
| 401 | static int done = 0; | ||
| 402 | if (!done) | ||
| 403 | { | ||
| 404 | int_CRYPTO_set_do_dynlock_callback(do_dynlock); | ||
| 405 | done = 1; | ||
| 406 | } | ||
| 407 | |||
| 408 | dynlock_lock_callback=func; | ||
| 409 | } | ||
| 410 | |||
| 411 | void CRYPTO_set_dynlock_destroy_callback(void (*func) | ||
| 412 | (struct CRYPTO_dynlock_value *l, const char *file, int line)) | ||
| 413 | { | ||
| 414 | dynlock_destroy_callback=func; | ||
| 415 | } | ||
| 416 | |||
| 417 | const char *CRYPTO_get_lock_name(int type) | ||
| 418 | { | ||
| 419 | if (type < 0) | ||
| 420 | return("dynamic"); | ||
| 421 | else if (type < CRYPTO_NUM_LOCKS) | ||
| 422 | return(lock_names[type]); | ||
| 423 | else if (type-CRYPTO_NUM_LOCKS > sk_num(app_locks)) | ||
| 424 | return("ERROR"); | ||
| 425 | else | ||
| 426 | return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS)); | ||
| 427 | } | ||
| 428 | |||
diff --git a/src/lib/libcrypto/ec/Makefile.ssl b/src/lib/libcrypto/ec/Makefile.ssl deleted file mode 100644 index a2805c47a2..0000000000 --- a/src/lib/libcrypto/ec/Makefile.ssl +++ /dev/null | |||
| @@ -1,128 +0,0 @@ | |||
| 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 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST=ectest.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= ec_lib.c ecp_smpl.c ecp_mont.c ecp_recp.c ecp_nist.c ec_cvt.c ec_mult.c \ | ||
| 27 | ec_err.c | ||
| 28 | |||
| 29 | LIBOBJ= ec_lib.o ecp_smpl.o ecp_mont.o ecp_recp.o ecp_nist.o ec_cvt.o ec_mult.o \ | ||
| 30 | ec_err.o | ||
| 31 | |||
| 32 | SRC= $(LIBSRC) | ||
| 33 | |||
| 34 | EXHEADER= ec.h | ||
| 35 | HEADER= ec_lcl.h $(EXHEADER) | ||
| 36 | |||
| 37 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 38 | |||
| 39 | top: | ||
| 40 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 41 | |||
| 42 | all: lib | ||
| 43 | |||
| 44 | lib: $(LIBOBJ) | ||
| 45 | $(AR) $(LIB) $(LIBOBJ) | ||
| 46 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 47 | @touch lib | ||
| 48 | |||
| 49 | files: | ||
| 50 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 51 | |||
| 52 | links: | ||
| 53 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 60 | do \ | ||
| 61 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 62 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 63 | done; | ||
| 64 | |||
| 65 | tags: | ||
| 66 | ctags $(SRC) | ||
| 67 | |||
| 68 | tests: | ||
| 69 | |||
| 70 | lint: | ||
| 71 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 72 | |||
| 73 | depend: | ||
| 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 | ec_cvt.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h | ||
| 86 | ec_cvt.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h | ||
| 87 | ec_cvt.o: ../../include/openssl/symhacks.h ec_cvt.c ec_lcl.h | ||
| 88 | ec_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 89 | ec_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 90 | ec_err.o: ../../include/openssl/ec.h ../../include/openssl/err.h | ||
| 91 | ec_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 92 | ec_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 93 | ec_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 94 | ec_err.o: ec_err.c | ||
| 95 | ec_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 96 | ec_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 97 | ec_lib.o: ../../include/openssl/ec.h ../../include/openssl/err.h | ||
| 98 | ec_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 99 | ec_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 100 | ec_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 101 | ec_lib.o: ec_lcl.h ec_lib.c | ||
| 102 | ec_mult.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 103 | ec_mult.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 104 | ec_mult.o: ../../include/openssl/ec.h ../../include/openssl/err.h | ||
| 105 | ec_mult.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 106 | ec_mult.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 107 | ec_mult.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 108 | ec_mult.o: ec_lcl.h ec_mult.c | ||
| 109 | ecp_mont.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 110 | ecp_mont.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 111 | ecp_mont.o: ../../include/openssl/ec.h ../../include/openssl/err.h | ||
| 112 | ecp_mont.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 113 | ecp_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 114 | ecp_mont.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 115 | ecp_mont.o: ec_lcl.h ecp_mont.c | ||
| 116 | ecp_nist.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h | ||
| 117 | ecp_nist.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h | ||
| 118 | ecp_nist.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_nist.c | ||
| 119 | ecp_recp.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h | ||
| 120 | ecp_recp.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h | ||
| 121 | ecp_recp.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_recp.c | ||
| 122 | ecp_smpl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 123 | ecp_smpl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 124 | ecp_smpl.o: ../../include/openssl/ec.h ../../include/openssl/err.h | ||
| 125 | ecp_smpl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 126 | ecp_smpl.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 127 | ecp_smpl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 128 | ecp_smpl.o: ec_lcl.h ecp_smpl.c | ||
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h index 8bc2a235b1..ee7078130c 100644 --- a/src/lib/libcrypto/ec/ec.h +++ b/src/lib/libcrypto/ec/ec.h | |||
| @@ -2,8 +2,12 @@ | |||
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| 5 | /** | ||
| 6 | * \file crypto/ec/ec.h Include file for the OpenSSL EC functions | ||
| 7 | * \author Originally written by Bodo Moeller for the OpenSSL project | ||
| 8 | */ | ||
| 5 | /* ==================================================================== | 9 | /* ==================================================================== |
| 6 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. | 10 | * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. |
| 7 | * | 11 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions |
| @@ -92,15 +96,21 @@ extern "C" { | |||
| 92 | # endif | 96 | # endif |
| 93 | #endif | 97 | #endif |
| 94 | 98 | ||
| 95 | 99 | ||
| 96 | #ifndef OPENSSL_ECC_MAX_FIELD_BITS | 100 | #ifndef OPENSSL_ECC_MAX_FIELD_BITS |
| 97 | # define OPENSSL_ECC_MAX_FIELD_BITS 661 | 101 | # define OPENSSL_ECC_MAX_FIELD_BITS 661 |
| 98 | #endif | 102 | #endif |
| 99 | 103 | ||
| 104 | /** Enum for the point conversion form as defined in X9.62 (ECDSA) | ||
| 105 | * for the encoding of a elliptic curve point (x,y) */ | ||
| 100 | typedef enum { | 106 | typedef enum { |
| 101 | /* values as defined in X9.62 (ECDSA) and elsewhere */ | 107 | /** the point is encoded as z||x, where the octet z specifies |
| 108 | * which solution of the quadratic equation y is */ | ||
| 102 | POINT_CONVERSION_COMPRESSED = 2, | 109 | POINT_CONVERSION_COMPRESSED = 2, |
| 110 | /** the point is encoded as z||x||y, where z is the octet 0x02 */ | ||
| 103 | POINT_CONVERSION_UNCOMPRESSED = 4, | 111 | POINT_CONVERSION_UNCOMPRESSED = 4, |
| 112 | /** the point is encoded as z||x||y, where the octet z specifies | ||
| 113 | * which solution of the quadratic equation y is */ | ||
| 104 | POINT_CONVERSION_HYBRID = 6 | 114 | POINT_CONVERSION_HYBRID = 6 |
| 105 | } point_conversion_form_t; | 115 | } point_conversion_form_t; |
| 106 | 116 | ||
| @@ -121,37 +131,129 @@ typedef struct ec_group_st | |||
| 121 | typedef struct ec_point_st EC_POINT; | 131 | typedef struct ec_point_st EC_POINT; |
| 122 | 132 | ||
| 123 | 133 | ||
| 124 | /* EC_METHODs for curves over GF(p). | 134 | /********************************************************************/ |
| 125 | * EC_GFp_simple_method provides the basis for the optimized methods. | 135 | /* EC_METHODs for curves over GF(p) */ |
| 136 | /********************************************************************/ | ||
| 137 | |||
| 138 | /** Returns the basic GFp ec methods which provides the basis for the | ||
| 139 | * optimized methods. | ||
| 140 | * \return EC_METHOD object | ||
| 126 | */ | 141 | */ |
| 127 | const EC_METHOD *EC_GFp_simple_method(void); | 142 | const EC_METHOD *EC_GFp_simple_method(void); |
| 143 | |||
| 144 | /** Returns GFp methods using montgomery multiplication. | ||
| 145 | * \return EC_METHOD object | ||
| 146 | */ | ||
| 128 | const EC_METHOD *EC_GFp_mont_method(void); | 147 | const EC_METHOD *EC_GFp_mont_method(void); |
| 148 | |||
| 149 | /** Returns GFp methods using optimized methods for NIST recommended curves | ||
| 150 | * \return EC_METHOD object | ||
| 151 | */ | ||
| 129 | const EC_METHOD *EC_GFp_nist_method(void); | 152 | const EC_METHOD *EC_GFp_nist_method(void); |
| 130 | 153 | ||
| 131 | /* EC_METHOD for curves over GF(2^m). | 154 | |
| 155 | /********************************************************************/ | ||
| 156 | /* EC_METHOD for curves over GF(2^m) */ | ||
| 157 | /********************************************************************/ | ||
| 158 | |||
| 159 | /** Returns the basic GF2m ec method | ||
| 160 | * \return EC_METHOD object | ||
| 132 | */ | 161 | */ |
| 133 | const EC_METHOD *EC_GF2m_simple_method(void); | 162 | const EC_METHOD *EC_GF2m_simple_method(void); |
| 134 | 163 | ||
| 135 | 164 | ||
| 136 | EC_GROUP *EC_GROUP_new(const EC_METHOD *); | 165 | /********************************************************************/ |
| 137 | void EC_GROUP_free(EC_GROUP *); | 166 | /* EC_GROUP functions */ |
| 138 | void EC_GROUP_clear_free(EC_GROUP *); | 167 | /********************************************************************/ |
| 139 | int EC_GROUP_copy(EC_GROUP *, const EC_GROUP *); | ||
| 140 | EC_GROUP *EC_GROUP_dup(const EC_GROUP *); | ||
| 141 | 168 | ||
| 142 | const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *); | 169 | /** Creates a new EC_GROUP object |
| 143 | int EC_METHOD_get_field_type(const EC_METHOD *); | 170 | * \param meth EC_METHOD to use |
| 171 | * \return newly created EC_GROUP object or NULL in case of an error. | ||
| 172 | */ | ||
| 173 | EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); | ||
| 144 | 174 | ||
| 145 | int EC_GROUP_set_generator(EC_GROUP *, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor); | 175 | /** Frees a EC_GROUP object |
| 146 | const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *); | 176 | * \param group EC_GROUP object to be freed. |
| 147 | int EC_GROUP_get_order(const EC_GROUP *, BIGNUM *order, BN_CTX *); | 177 | */ |
| 148 | int EC_GROUP_get_cofactor(const EC_GROUP *, BIGNUM *cofactor, BN_CTX *); | 178 | void EC_GROUP_free(EC_GROUP *group); |
| 149 | 179 | ||
| 150 | void EC_GROUP_set_curve_name(EC_GROUP *, int nid); | 180 | /** Clears and frees a EC_GROUP object |
| 151 | int EC_GROUP_get_curve_name(const EC_GROUP *); | 181 | * \param group EC_GROUP object to be cleared and freed. |
| 182 | */ | ||
| 183 | void EC_GROUP_clear_free(EC_GROUP *group); | ||
| 152 | 184 | ||
| 153 | void EC_GROUP_set_asn1_flag(EC_GROUP *, int flag); | 185 | /** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. |
| 154 | int EC_GROUP_get_asn1_flag(const EC_GROUP *); | 186 | * \param dst destination EC_GROUP object |
| 187 | * \param src source EC_GROUP object | ||
| 188 | * \return 1 on success and 0 if an error occurred. | ||
| 189 | */ | ||
| 190 | int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); | ||
| 191 | |||
| 192 | /** Creates a new EC_GROUP object and copies the copies the content | ||
| 193 | * form src to the newly created EC_KEY object | ||
| 194 | * \param src source EC_GROUP object | ||
| 195 | * \return newly created EC_GROUP object or NULL in case of an error. | ||
| 196 | */ | ||
| 197 | EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); | ||
| 198 | |||
| 199 | /** Returns the EC_METHOD of the EC_GROUP object. | ||
| 200 | * \param group EC_GROUP object | ||
| 201 | * \return EC_METHOD used in this EC_GROUP object. | ||
| 202 | */ | ||
| 203 | const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); | ||
| 204 | |||
| 205 | /** Returns the field type of the EC_METHOD. | ||
| 206 | * \param meth EC_METHOD object | ||
| 207 | * \return NID of the underlying field type OID. | ||
| 208 | */ | ||
| 209 | int EC_METHOD_get_field_type(const EC_METHOD *meth); | ||
| 210 | |||
| 211 | /** Sets the generator and it's order/cofactor of a EC_GROUP object. | ||
| 212 | * \param group EC_GROUP object | ||
| 213 | * \param generator EC_POINT object with the generator. | ||
| 214 | * \param order the order of the group generated by the generator. | ||
| 215 | * \param cofactor the index of the sub-group generated by the generator | ||
| 216 | * in the group of all points on the elliptic curve. | ||
| 217 | * \return 1 on success and 0 if an error occured | ||
| 218 | */ | ||
| 219 | int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor); | ||
| 220 | |||
| 221 | /** Returns the generator of a EC_GROUP object. | ||
| 222 | * \param group EC_GROUP object | ||
| 223 | * \return the currently used generator (possibly NULL). | ||
| 224 | */ | ||
| 225 | const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); | ||
| 226 | |||
| 227 | /** Gets the order of a EC_GROUP | ||
| 228 | * \param group EC_GROUP object | ||
| 229 | * \param order BIGNUM to which the order is copied | ||
| 230 | * \param ctx BN_CTX object (optional) | ||
| 231 | * \return 1 on success and 0 if an error occured | ||
| 232 | */ | ||
| 233 | int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); | ||
| 234 | |||
| 235 | /** Gets the cofactor of a EC_GROUP | ||
| 236 | * \param group EC_GROUP object | ||
| 237 | * \param cofactor BIGNUM to which the cofactor is copied | ||
| 238 | * \param ctx BN_CTX object (optional) | ||
| 239 | * \return 1 on success and 0 if an error occured | ||
| 240 | */ | ||
| 241 | int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx); | ||
| 242 | |||
| 243 | /** Sets the name of a EC_GROUP object | ||
| 244 | * \param group EC_GROUP object | ||
| 245 | * \param nid NID of the curve name OID | ||
| 246 | */ | ||
| 247 | void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); | ||
| 248 | |||
| 249 | /** Returns the curve name of a EC_GROUP object | ||
| 250 | * \param group EC_GROUP object | ||
| 251 | * \return NID of the curve name OID or 0 if not set. | ||
| 252 | */ | ||
| 253 | int EC_GROUP_get_curve_name(const EC_GROUP *group); | ||
| 254 | |||
| 255 | void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); | ||
| 256 | int EC_GROUP_get_asn1_flag(const EC_GROUP *group); | ||
| 155 | 257 | ||
| 156 | void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t); | 258 | void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t); |
| 157 | point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); | 259 | point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); |
| @@ -160,36 +262,114 @@ unsigned char *EC_GROUP_get0_seed(const EC_GROUP *); | |||
| 160 | size_t EC_GROUP_get_seed_len(const EC_GROUP *); | 262 | size_t EC_GROUP_get_seed_len(const EC_GROUP *); |
| 161 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); | 263 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); |
| 162 | 264 | ||
| 163 | int EC_GROUP_set_curve_GFp(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); | 265 | /** Sets the parameter of a ec over GFp defined by y^2 = x^3 + a*x + b |
| 164 | int EC_GROUP_get_curve_GFp(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *); | 266 | * \param group EC_GROUP object |
| 165 | int EC_GROUP_set_curve_GF2m(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); | 267 | * \param p BIGNUM with the prime number |
| 166 | int EC_GROUP_get_curve_GF2m(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *); | 268 | * \param a BIGNUM with parameter a of the equation |
| 269 | * \param b BIGNUM with parameter b of the equation | ||
| 270 | * \param ctx BN_CTX object (optional) | ||
| 271 | * \return 1 on success and 0 if an error occured | ||
| 272 | */ | ||
| 273 | int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | ||
| 274 | |||
| 275 | /** Gets the parameter of the ec over GFp defined by y^2 = x^3 + a*x + b | ||
| 276 | * \param group EC_GROUP object | ||
| 277 | * \param p BIGNUM for the prime number | ||
| 278 | * \param a BIGNUM for parameter a of the equation | ||
| 279 | * \param b BIGNUM for parameter b of the equation | ||
| 280 | * \param ctx BN_CTX object (optional) | ||
| 281 | * \return 1 on success and 0 if an error occured | ||
| 282 | */ | ||
| 283 | int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | ||
| 284 | |||
| 285 | /** Sets the parameter of a ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b | ||
| 286 | * \param group EC_GROUP object | ||
| 287 | * \param p BIGNUM with the polynomial defining the underlying field | ||
| 288 | * \param a BIGNUM with parameter a of the equation | ||
| 289 | * \param b BIGNUM with parameter b of the equation | ||
| 290 | * \param ctx BN_CTX object (optional) | ||
| 291 | * \return 1 on success and 0 if an error occured | ||
| 292 | */ | ||
| 293 | int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | ||
| 294 | |||
| 295 | /** Gets the parameter of the ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b | ||
| 296 | * \param group EC_GROUP object | ||
| 297 | * \param p BIGNUM for the polynomial defining the underlying field | ||
| 298 | * \param a BIGNUM for parameter a of the equation | ||
| 299 | * \param b BIGNUM for parameter b of the equation | ||
| 300 | * \param ctx BN_CTX object (optional) | ||
| 301 | * \return 1 on success and 0 if an error occured | ||
| 302 | */ | ||
| 303 | int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | ||
| 167 | 304 | ||
| 168 | /* returns the number of bits needed to represent a field element */ | 305 | /** Returns the number of bits needed to represent a field element |
| 169 | int EC_GROUP_get_degree(const EC_GROUP *); | 306 | * \param group EC_GROUP object |
| 307 | * \return number of bits needed to represent a field element | ||
| 308 | */ | ||
| 309 | int EC_GROUP_get_degree(const EC_GROUP *group); | ||
| 170 | 310 | ||
| 171 | /* EC_GROUP_check() returns 1 if 'group' defines a valid group, 0 otherwise */ | 311 | /** Checks whether the parameter in the EC_GROUP define a valid ec group |
| 312 | * \param group EC_GROUP object | ||
| 313 | * \param ctx BN_CTX object (optional) | ||
| 314 | * \return 1 if group is a valid ec group and 0 otherwise | ||
| 315 | */ | ||
| 172 | int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); | 316 | int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); |
| 173 | /* EC_GROUP_check_discriminant() returns 1 if the discriminant of the | ||
| 174 | * elliptic curve is not zero, 0 otherwise */ | ||
| 175 | int EC_GROUP_check_discriminant(const EC_GROUP *, BN_CTX *); | ||
| 176 | 317 | ||
| 177 | /* EC_GROUP_cmp() returns 0 if both groups are equal and 1 otherwise */ | 318 | /** Checks whether the discriminant of the elliptic curve is zero or not |
| 178 | int EC_GROUP_cmp(const EC_GROUP *, const EC_GROUP *, BN_CTX *); | 319 | * \param group EC_GROUP object |
| 320 | * \param ctx BN_CTX object (optional) | ||
| 321 | * \return 1 if the discriminant is not zero and 0 otherwise | ||
| 322 | */ | ||
| 323 | int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); | ||
| 324 | |||
| 325 | /** Compares two EC_GROUP objects | ||
| 326 | * \param a first EC_GROUP object | ||
| 327 | * \param b second EC_GROUP object | ||
| 328 | * \param ctx BN_CTX object (optional) | ||
| 329 | * \return 0 if both groups are equal and 1 otherwise | ||
| 330 | */ | ||
| 331 | int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); | ||
| 179 | 332 | ||
| 180 | /* EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() | 333 | /* EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() |
| 181 | * after choosing an appropriate EC_METHOD */ | 334 | * after choosing an appropriate EC_METHOD */ |
| 182 | EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); | ||
| 183 | EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); | ||
| 184 | 335 | ||
| 185 | /* EC_GROUP_new_by_curve_name() creates a EC_GROUP structure | 336 | /** Creates a new EC_GROUP object with the specified parameters defined |
| 186 | * specified by a curve name (in form of a NID) */ | 337 | * over GFp (defined by the equation y^2 = x^3 + a*x + b) |
| 338 | * \param p BIGNUM with the prime number | ||
| 339 | * \param a BIGNUM with the parameter a of the equation | ||
| 340 | * \param b BIGNUM with the parameter b of the equation | ||
| 341 | * \param ctx BN_CTX object (optional) | ||
| 342 | * \return newly created EC_GROUP object with the specified parameters | ||
| 343 | */ | ||
| 344 | EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | ||
| 345 | |||
| 346 | /** Creates a new EC_GROUP object with the specified parameters defined | ||
| 347 | * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) | ||
| 348 | * \param p BIGNUM with the polynomial defining the underlying field | ||
| 349 | * \param a BIGNUM with the parameter a of the equation | ||
| 350 | * \param b BIGNUM with the parameter b of the equation | ||
| 351 | * \param ctx BN_CTX object (optional) | ||
| 352 | * \return newly created EC_GROUP object with the specified parameters | ||
| 353 | */ | ||
| 354 | EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | ||
| 355 | |||
| 356 | /** Creates a EC_GROUP object with a curve specified by a NID | ||
| 357 | * \param nid NID of the OID of the curve name | ||
| 358 | * \return newly created EC_GROUP object with specified curve or NULL | ||
| 359 | * if an error occurred | ||
| 360 | */ | ||
| 187 | EC_GROUP *EC_GROUP_new_by_curve_name(int nid); | 361 | EC_GROUP *EC_GROUP_new_by_curve_name(int nid); |
| 188 | /* handling of internal curves */ | 362 | |
| 363 | |||
| 364 | /********************************************************************/ | ||
| 365 | /* handling of internal curves */ | ||
| 366 | /********************************************************************/ | ||
| 367 | |||
| 189 | typedef struct { | 368 | typedef struct { |
| 190 | int nid; | 369 | int nid; |
| 191 | const char *comment; | 370 | const char *comment; |
| 192 | } EC_builtin_curve; | 371 | } EC_builtin_curve; |
| 372 | |||
| 193 | /* EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number | 373 | /* EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number |
| 194 | * of all available curves or zero if a error occurred. | 374 | * of all available curves or zero if a error occurred. |
| 195 | * In case r ist not zero nitems EC_builtin_curve structures | 375 | * In case r ist not zero nitems EC_builtin_curve structures |
| @@ -197,39 +377,168 @@ typedef struct { | |||
| 197 | size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); | 377 | size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); |
| 198 | 378 | ||
| 199 | 379 | ||
| 200 | /* EC_POINT functions */ | 380 | /********************************************************************/ |
| 381 | /* EC_POINT functions */ | ||
| 382 | /********************************************************************/ | ||
| 383 | |||
| 384 | /** Creates a new EC_POINT object for the specified EC_GROUP | ||
| 385 | * \param group EC_GROUP the underlying EC_GROUP object | ||
| 386 | * \return newly created EC_POINT object or NULL if an error occurred | ||
| 387 | */ | ||
| 388 | EC_POINT *EC_POINT_new(const EC_GROUP *group); | ||
| 389 | |||
| 390 | /** Frees a EC_POINT object | ||
| 391 | * \param point EC_POINT object to be freed | ||
| 392 | */ | ||
| 393 | void EC_POINT_free(EC_POINT *point); | ||
| 394 | |||
| 395 | /** Clears and frees a EC_POINT object | ||
| 396 | * \param point EC_POINT object to be cleared and freed | ||
| 397 | */ | ||
| 398 | void EC_POINT_clear_free(EC_POINT *point); | ||
| 399 | |||
| 400 | /** Copies EC_POINT object | ||
| 401 | * \param dst destination EC_POINT object | ||
| 402 | * \param src source EC_POINT object | ||
| 403 | * \return 1 on success and 0 if an error occured | ||
| 404 | */ | ||
| 405 | int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); | ||
| 201 | 406 | ||
| 202 | EC_POINT *EC_POINT_new(const EC_GROUP *); | 407 | /** Creates a new EC_POINT object and copies the content of the supplied |
| 203 | void EC_POINT_free(EC_POINT *); | 408 | * EC_POINT |
| 204 | void EC_POINT_clear_free(EC_POINT *); | 409 | * \param src source EC_POINT object |
| 205 | int EC_POINT_copy(EC_POINT *, const EC_POINT *); | 410 | * \param group underlying the EC_GROUP object |
| 206 | EC_POINT *EC_POINT_dup(const EC_POINT *, const EC_GROUP *); | 411 | * \return newly created EC_POINT object or NULL if an error occurred |
| 412 | */ | ||
| 413 | EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); | ||
| 207 | 414 | ||
| 208 | const EC_METHOD *EC_POINT_method_of(const EC_POINT *); | 415 | /** Returns the EC_METHOD used in EC_POINT object |
| 209 | 416 | * \param point EC_POINT object | |
| 210 | int EC_POINT_set_to_infinity(const EC_GROUP *, EC_POINT *); | 417 | * \return the EC_METHOD used |
| 211 | int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *, EC_POINT *, | 418 | */ |
| 212 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *); | 419 | const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); |
| 213 | int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *, const EC_POINT *, | 420 | |
| 214 | BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *); | 421 | /** Sets a point to infinity (neutral element) |
| 215 | int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *, EC_POINT *, | 422 | * \param group underlying EC_GROUP object |
| 216 | const BIGNUM *x, const BIGNUM *y, BN_CTX *); | 423 | * \param point EC_POINT to set to infinity |
| 217 | int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *, const EC_POINT *, | 424 | * \return 1 on success and 0 if an error occured |
| 218 | BIGNUM *x, BIGNUM *y, BN_CTX *); | 425 | */ |
| 219 | int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *, EC_POINT *, | 426 | int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); |
| 220 | const BIGNUM *x, int y_bit, BN_CTX *); | 427 | |
| 221 | 428 | /** Sets the jacobian projective coordinates of a EC_POINT over GFp | |
| 222 | int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *, EC_POINT *, | 429 | * \param group underlying EC_GROUP object |
| 223 | const BIGNUM *x, const BIGNUM *y, BN_CTX *); | 430 | * \param p EC_POINT object |
| 224 | int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *, const EC_POINT *, | 431 | * \param x BIGNUM with the x-coordinate |
| 225 | BIGNUM *x, BIGNUM *y, BN_CTX *); | 432 | * \param y BIGNUM with the y-coordinate |
| 226 | int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *, EC_POINT *, | 433 | * \param z BIGNUM with the z-coordinate |
| 227 | const BIGNUM *x, int y_bit, BN_CTX *); | 434 | * \param ctx BN_CTX object (optional) |
| 228 | 435 | * \return 1 on success and 0 if an error occured | |
| 229 | size_t EC_POINT_point2oct(const EC_GROUP *, const EC_POINT *, point_conversion_form_t form, | 436 | */ |
| 230 | unsigned char *buf, size_t len, BN_CTX *); | 437 | int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, |
| 231 | int EC_POINT_oct2point(const EC_GROUP *, EC_POINT *, | 438 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx); |
| 232 | const unsigned char *buf, size_t len, BN_CTX *); | 439 | |
| 440 | /** Gets the jacobian projective coordinates of a EC_POINT over GFp | ||
| 441 | * \param group underlying EC_GROUP object | ||
| 442 | * \param p EC_POINT object | ||
| 443 | * \param x BIGNUM for the x-coordinate | ||
| 444 | * \param y BIGNUM for the y-coordinate | ||
| 445 | * \param z BIGNUM for the z-coordinate | ||
| 446 | * \param ctx BN_CTX object (optional) | ||
| 447 | * \return 1 on success and 0 if an error occured | ||
| 448 | */ | ||
| 449 | int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, | ||
| 450 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx); | ||
| 451 | |||
| 452 | /** Sets the affine coordinates of a EC_POINT over GFp | ||
| 453 | * \param group underlying EC_GROUP object | ||
| 454 | * \param p EC_POINT object | ||
| 455 | * \param x BIGNUM with the x-coordinate | ||
| 456 | * \param y BIGNUM with the y-coordinate | ||
| 457 | * \param ctx BN_CTX object (optional) | ||
| 458 | * \return 1 on success and 0 if an error occured | ||
| 459 | */ | ||
| 460 | int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, | ||
| 461 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx); | ||
| 462 | |||
| 463 | /** Gets the affine coordinates of a EC_POINT over GFp | ||
| 464 | * \param group underlying EC_GROUP object | ||
| 465 | * \param p EC_POINT object | ||
| 466 | * \param x BIGNUM for the x-coordinate | ||
| 467 | * \param y BIGNUM for the y-coordinate | ||
| 468 | * \param ctx BN_CTX object (optional) | ||
| 469 | * \return 1 on success and 0 if an error occured | ||
| 470 | */ | ||
| 471 | int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, | ||
| 472 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); | ||
| 473 | |||
| 474 | /** Sets the x9.62 compressed coordinates of a EC_POINT over GFp | ||
| 475 | * \param group underlying EC_GROUP object | ||
| 476 | * \param p EC_POINT object | ||
| 477 | * \param x BIGNUM with x-coordinate | ||
| 478 | * \param y_bit integer with the y-Bit (either 0 or 1) | ||
| 479 | * \param ctx BN_CTX object (optional) | ||
| 480 | * \return 1 on success and 0 if an error occured | ||
| 481 | */ | ||
| 482 | int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, | ||
| 483 | const BIGNUM *x, int y_bit, BN_CTX *ctx); | ||
| 484 | |||
| 485 | /** Sets the affine coordinates of a EC_POINT over GF2m | ||
| 486 | * \param group underlying EC_GROUP object | ||
| 487 | * \param p EC_POINT object | ||
| 488 | * \param x BIGNUM with the x-coordinate | ||
| 489 | * \param y BIGNUM with the y-coordinate | ||
| 490 | * \param ctx BN_CTX object (optional) | ||
| 491 | * \return 1 on success and 0 if an error occured | ||
| 492 | */ | ||
| 493 | int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, | ||
| 494 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx); | ||
| 495 | |||
| 496 | /** Gets the affine coordinates of a EC_POINT over GF2m | ||
| 497 | * \param group underlying EC_GROUP object | ||
| 498 | * \param p EC_POINT object | ||
| 499 | * \param x BIGNUM for the x-coordinate | ||
| 500 | * \param y BIGNUM for the y-coordinate | ||
| 501 | * \param ctx BN_CTX object (optional) | ||
| 502 | * \return 1 on success and 0 if an error occured | ||
| 503 | */ | ||
| 504 | int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, | ||
| 505 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); | ||
| 506 | |||
| 507 | /** Sets the x9.62 compressed coordinates of a EC_POINT over GF2m | ||
| 508 | * \param group underlying EC_GROUP object | ||
| 509 | * \param p EC_POINT object | ||
| 510 | * \param x BIGNUM with x-coordinate | ||
| 511 | * \param y_bit integer with the y-Bit (either 0 or 1) | ||
| 512 | * \param ctx BN_CTX object (optional) | ||
| 513 | * \return 1 on success and 0 if an error occured | ||
| 514 | */ | ||
| 515 | int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, | ||
| 516 | const BIGNUM *x, int y_bit, BN_CTX *ctx); | ||
| 517 | |||
| 518 | /** Encodes a EC_POINT object to a octet string | ||
| 519 | * \param group underlying EC_GROUP object | ||
| 520 | * \param p EC_POINT object | ||
| 521 | * \param form point conversion form | ||
| 522 | * \param buf memory buffer for the result. If NULL the function returns | ||
| 523 | * required buffer size. | ||
| 524 | * \param len length of the memory buffer | ||
| 525 | * \param ctx BN_CTX object (optional) | ||
| 526 | * \return the length of the encoded octet string or 0 if an error occurred | ||
| 527 | */ | ||
| 528 | size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, | ||
| 529 | point_conversion_form_t form, | ||
| 530 | unsigned char *buf, size_t len, BN_CTX *ctx); | ||
| 531 | |||
| 532 | /** Decodes a EC_POINT from a octet string | ||
| 533 | * \param group underlying EC_GROUP object | ||
| 534 | * \param p EC_POINT object | ||
| 535 | * \param buf memory buffer with the encoded ec point | ||
| 536 | * \param len length of the encoded ec point | ||
| 537 | * \param ctx BN_CTX object (optional) | ||
| 538 | * \return 1 on success and 0 if an error occured | ||
| 539 | */ | ||
| 540 | int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, | ||
| 541 | const unsigned char *buf, size_t len, BN_CTX *ctx); | ||
| 233 | 542 | ||
| 234 | /* other interfaces to point2oct/oct2point: */ | 543 | /* other interfaces to point2oct/oct2point: */ |
| 235 | BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, | 544 | BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, |
| @@ -241,29 +550,105 @@ char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, | |||
| 241 | EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, | 550 | EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, |
| 242 | EC_POINT *, BN_CTX *); | 551 | EC_POINT *, BN_CTX *); |
| 243 | 552 | ||
| 244 | int EC_POINT_add(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *); | ||
| 245 | int EC_POINT_dbl(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, BN_CTX *); | ||
| 246 | int EC_POINT_invert(const EC_GROUP *, EC_POINT *, BN_CTX *); | ||
| 247 | 553 | ||
| 248 | int EC_POINT_is_at_infinity(const EC_GROUP *, const EC_POINT *); | 554 | /********************************************************************/ |
| 249 | int EC_POINT_is_on_curve(const EC_GROUP *, const EC_POINT *, BN_CTX *); | 555 | /* functions for doing EC_POINT arithmetic */ |
| 250 | int EC_POINT_cmp(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b, BN_CTX *); | 556 | /********************************************************************/ |
| 557 | |||
| 558 | /** Computes the sum of two EC_POINT | ||
| 559 | * \param group underlying EC_GROUP object | ||
| 560 | * \param r EC_POINT object for the result (r = a + b) | ||
| 561 | * \param a EC_POINT object with the first summand | ||
| 562 | * \param b EC_POINT object with the second summand | ||
| 563 | * \param ctx BN_CTX object (optional) | ||
| 564 | * \return 1 on success and 0 if an error occured | ||
| 565 | */ | ||
| 566 | int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); | ||
| 567 | |||
| 568 | /** Computes the double of a EC_POINT | ||
| 569 | * \param group underlying EC_GROUP object | ||
| 570 | * \param r EC_POINT object for the result (r = 2 * a) | ||
| 571 | * \param a EC_POINT object | ||
| 572 | * \param ctx BN_CTX object (optional) | ||
| 573 | * \return 1 on success and 0 if an error occured | ||
| 574 | */ | ||
| 575 | int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx); | ||
| 576 | |||
| 577 | /** Computes the inverse of a EC_POINT | ||
| 578 | * \param group underlying EC_GROUP object | ||
| 579 | * \param a EC_POINT object to be inverted (it's used for the result as well) | ||
| 580 | * \param ctx BN_CTX object (optional) | ||
| 581 | * \return 1 on success and 0 if an error occured | ||
| 582 | */ | ||
| 583 | int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); | ||
| 584 | |||
| 585 | /** Checks whether the point is the neutral element of the group | ||
| 586 | * \param group the underlying EC_GROUP object | ||
| 587 | * \param p EC_POINT object | ||
| 588 | * \return 1 if the point is the neutral element and 0 otherwise | ||
| 589 | */ | ||
| 590 | int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); | ||
| 591 | |||
| 592 | /** Checks whether the point is on the curve | ||
| 593 | * \param group underlying EC_GROUP object | ||
| 594 | * \param point EC_POINT object to check | ||
| 595 | * \param ctx BN_CTX object (optional) | ||
| 596 | * \return 1 if point if on the curve and 0 otherwise | ||
| 597 | */ | ||
| 598 | int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx); | ||
| 599 | |||
| 600 | /** Compares two EC_POINTs | ||
| 601 | * \param group underlying EC_GROUP object | ||
| 602 | * \param a first EC_POINT object | ||
| 603 | * \param b second EC_POINT object | ||
| 604 | * \param ctx BN_CTX object (optional) | ||
| 605 | * \return 0 if both points are equal and a value != 0 otherwise | ||
| 606 | */ | ||
| 607 | int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); | ||
| 251 | 608 | ||
| 252 | int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *); | 609 | int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *); |
| 253 | int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *); | 610 | int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *); |
| 254 | 611 | ||
| 612 | /** Computes r = generator * n sum_{i=0}^num p[i] * m[i] | ||
| 613 | * \param group underlying EC_GROUP object | ||
| 614 | * \param r EC_POINT object for the result | ||
| 615 | * \param n BIGNUM with the multiplier for the group generator (optional) | ||
| 616 | * \param num number futher summands | ||
| 617 | * \param p array of size num of EC_POINT objects | ||
| 618 | * \param m array of size num of BIGNUM objects | ||
| 619 | * \param ctx BN_CTX object (optional) | ||
| 620 | * \return 1 on success and 0 if an error occured | ||
| 621 | */ | ||
| 622 | int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num, const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx); | ||
| 623 | |||
| 624 | /** Computes r = generator * n + q * m | ||
| 625 | * \param group underlying EC_GROUP object | ||
| 626 | * \param r EC_POINT object for the result | ||
| 627 | * \param n BIGNUM with the multiplier for the group generator (optional) | ||
| 628 | * \param q EC_POINT object with the first factor of the second summand | ||
| 629 | * \param m BIGNUM with the second factor of the second summand | ||
| 630 | * \param ctx BN_CTX object (optional) | ||
| 631 | * \return 1 on success and 0 if an error occured | ||
| 632 | */ | ||
| 633 | int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); | ||
| 255 | 634 | ||
| 256 | int EC_POINTs_mul(const EC_GROUP *, EC_POINT *r, const BIGNUM *, size_t num, const EC_POINT *[], const BIGNUM *[], BN_CTX *); | 635 | /** Stores multiples of generator for faster point multiplication |
| 257 | int EC_POINT_mul(const EC_GROUP *, EC_POINT *r, const BIGNUM *, const EC_POINT *, const BIGNUM *, BN_CTX *); | 636 | * \param group EC_GROUP object |
| 258 | 637 | * \param ctx BN_CTX object (optional) | |
| 259 | /* EC_GROUP_precompute_mult() stores multiples of generator for faster point multiplication */ | 638 | * \return 1 on success and 0 if an error occured |
| 260 | int EC_GROUP_precompute_mult(EC_GROUP *, BN_CTX *); | 639 | */ |
| 261 | /* EC_GROUP_have_precompute_mult() reports whether such precomputation has been done */ | 640 | int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); |
| 262 | int EC_GROUP_have_precompute_mult(const EC_GROUP *); | ||
| 263 | 641 | ||
| 642 | /** Reports whether a precomputation has been done | ||
| 643 | * \param group EC_GROUP object | ||
| 644 | * \return 1 if a pre-computation has been done and 0 otherwise | ||
| 645 | */ | ||
| 646 | int EC_GROUP_have_precompute_mult(const EC_GROUP *group); | ||
| 264 | 647 | ||
| 265 | 648 | ||
| 266 | /* ASN1 stuff */ | 649 | /********************************************************************/ |
| 650 | /* ASN1 stuff */ | ||
| 651 | /********************************************************************/ | ||
| 267 | 652 | ||
| 268 | /* EC_GROUP_get_basis_type() returns the NID of the basis type | 653 | /* EC_GROUP_get_basis_type() returns the NID of the basis type |
| 269 | * used to represent the field elements */ | 654 | * used to represent the field elements */ |
| @@ -293,28 +678,96 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); | |||
| 293 | int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); | 678 | int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); |
| 294 | #endif | 679 | #endif |
| 295 | 680 | ||
| 296 | /* the EC_KEY stuff */ | 681 | |
| 682 | /********************************************************************/ | ||
| 683 | /* EC_KEY functions */ | ||
| 684 | /********************************************************************/ | ||
| 685 | |||
| 297 | typedef struct ec_key_st EC_KEY; | 686 | typedef struct ec_key_st EC_KEY; |
| 298 | 687 | ||
| 299 | /* some values for the encoding_flag */ | 688 | /* some values for the encoding_flag */ |
| 300 | #define EC_PKEY_NO_PARAMETERS 0x001 | 689 | #define EC_PKEY_NO_PARAMETERS 0x001 |
| 301 | #define EC_PKEY_NO_PUBKEY 0x002 | 690 | #define EC_PKEY_NO_PUBKEY 0x002 |
| 302 | 691 | ||
| 692 | /** Creates a new EC_KEY object. | ||
| 693 | * \return EC_KEY object or NULL if an error occurred. | ||
| 694 | */ | ||
| 303 | EC_KEY *EC_KEY_new(void); | 695 | EC_KEY *EC_KEY_new(void); |
| 696 | |||
| 697 | /** Creates a new EC_KEY object using a named curve as underlying | ||
| 698 | * EC_GROUP object. | ||
| 699 | * \param nid NID of the named curve. | ||
| 700 | * \return EC_KEY object or NULL if an error occurred. | ||
| 701 | */ | ||
| 304 | EC_KEY *EC_KEY_new_by_curve_name(int nid); | 702 | EC_KEY *EC_KEY_new_by_curve_name(int nid); |
| 305 | void EC_KEY_free(EC_KEY *); | 703 | |
| 306 | EC_KEY *EC_KEY_copy(EC_KEY *, const EC_KEY *); | 704 | /** Frees a EC_KEY object. |
| 307 | EC_KEY *EC_KEY_dup(const EC_KEY *); | 705 | * \param key EC_KEY object to be freed. |
| 308 | 706 | */ | |
| 309 | int EC_KEY_up_ref(EC_KEY *); | 707 | void EC_KEY_free(EC_KEY *key); |
| 310 | 708 | ||
| 311 | const EC_GROUP *EC_KEY_get0_group(const EC_KEY *); | 709 | /** Copies a EC_KEY object. |
| 312 | int EC_KEY_set_group(EC_KEY *, const EC_GROUP *); | 710 | * \param dst destination EC_KEY object |
| 313 | const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *); | 711 | * \param src src EC_KEY object |
| 314 | int EC_KEY_set_private_key(EC_KEY *, const BIGNUM *); | 712 | * \return dst or NULL if an error occurred. |
| 315 | const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *); | 713 | */ |
| 316 | int EC_KEY_set_public_key(EC_KEY *, const EC_POINT *); | 714 | EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); |
| 317 | unsigned EC_KEY_get_enc_flags(const EC_KEY *); | 715 | |
| 716 | /** Creates a new EC_KEY object and copies the content from src to it. | ||
| 717 | * \param src the source EC_KEY object | ||
| 718 | * \return newly created EC_KEY object or NULL if an error occurred. | ||
| 719 | */ | ||
| 720 | EC_KEY *EC_KEY_dup(const EC_KEY *src); | ||
| 721 | |||
| 722 | /** Increases the internal reference count of a EC_KEY object. | ||
| 723 | * \param key EC_KEY object | ||
| 724 | * \return 1 on success and 0 if an error occurred. | ||
| 725 | */ | ||
| 726 | int EC_KEY_up_ref(EC_KEY *key); | ||
| 727 | |||
| 728 | /** Returns the EC_GROUP object of a EC_KEY object | ||
| 729 | * \param key EC_KEY object | ||
| 730 | * \return the EC_GROUP object (possibly NULL). | ||
| 731 | */ | ||
| 732 | const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); | ||
| 733 | |||
| 734 | /** Sets the EC_GROUP of a EC_KEY object. | ||
| 735 | * \param key EC_KEY object | ||
| 736 | * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY | ||
| 737 | * object will use an own copy of the EC_GROUP). | ||
| 738 | * \return 1 on success and 0 if an error occurred. | ||
| 739 | */ | ||
| 740 | int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); | ||
| 741 | |||
| 742 | /** Returns the private key of a EC_KEY object. | ||
| 743 | * \param key EC_KEY object | ||
| 744 | * \return a BIGNUM with the private key (possibly NULL). | ||
| 745 | */ | ||
| 746 | const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); | ||
| 747 | |||
| 748 | /** Sets the private key of a EC_KEY object. | ||
| 749 | * \param key EC_KEY object | ||
| 750 | * \param prv BIGNUM with the private key (note: the EC_KEY object | ||
| 751 | * will use an own copy of the BIGNUM). | ||
| 752 | * \return 1 on success and 0 if an error occurred. | ||
| 753 | */ | ||
| 754 | int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); | ||
| 755 | |||
| 756 | /** Returns the public key of a EC_KEY object. | ||
| 757 | * \param key the EC_KEY object | ||
| 758 | * \return a EC_POINT object with the public key (possibly NULL) | ||
| 759 | */ | ||
| 760 | const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); | ||
| 761 | |||
| 762 | /** Sets the public key of a EC_KEY object. | ||
| 763 | * \param key EC_KEY object | ||
| 764 | * \param pub EC_POINT object with the public key (note: the EC_KEY object | ||
| 765 | * will use an own copy of the EC_POINT object). | ||
| 766 | * \return 1 on success and 0 if an error occurred. | ||
| 767 | */ | ||
| 768 | int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); | ||
| 769 | |||
| 770 | unsigned EC_KEY_get_enc_flags(const EC_KEY *key); | ||
| 318 | void EC_KEY_set_enc_flags(EC_KEY *, unsigned int); | 771 | void EC_KEY_set_enc_flags(EC_KEY *, unsigned int); |
| 319 | point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *); | 772 | point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *); |
| 320 | void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t); | 773 | void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t); |
| @@ -325,31 +778,126 @@ void EC_KEY_insert_key_method_data(EC_KEY *, void *data, | |||
| 325 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); | 778 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); |
| 326 | /* wrapper functions for the underlying EC_GROUP object */ | 779 | /* wrapper functions for the underlying EC_GROUP object */ |
| 327 | void EC_KEY_set_asn1_flag(EC_KEY *, int); | 780 | void EC_KEY_set_asn1_flag(EC_KEY *, int); |
| 328 | int EC_KEY_precompute_mult(EC_KEY *, BN_CTX *ctx); | 781 | |
| 329 | 782 | /** Creates a table of pre-computed multiples of the generator to | |
| 330 | /* EC_KEY_generate_key() creates a ec private (public) key */ | 783 | * accelerate further EC_KEY operations. |
| 331 | int EC_KEY_generate_key(EC_KEY *); | 784 | * \param key EC_KEY object |
| 332 | /* EC_KEY_check_key() */ | 785 | * \param ctx BN_CTX object (optional) |
| 333 | int EC_KEY_check_key(const EC_KEY *); | 786 | * \return 1 on success and 0 if an error occurred. |
| 334 | 787 | */ | |
| 335 | /* de- and encoding functions for SEC1 ECPrivateKey */ | 788 | int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); |
| 336 | EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len); | 789 | |
| 337 | int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out); | 790 | /** Creates a new ec private (and optional a new public) key. |
| 338 | /* de- and encoding functions for EC parameters */ | 791 | * \param key EC_KEY object |
| 339 | EC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len); | 792 | * \return 1 on success and 0 if an error occurred. |
| 340 | int i2d_ECParameters(EC_KEY *a, unsigned char **out); | 793 | */ |
| 341 | /* de- and encoding functions for EC public key | 794 | int EC_KEY_generate_key(EC_KEY *key); |
| 342 | * (octet string, not DER -- hence 'o2i' and 'i2o') */ | 795 | |
| 343 | EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len); | 796 | /** Verifies that a private and/or public key is valid. |
| 344 | int i2o_ECPublicKey(EC_KEY *a, unsigned char **out); | 797 | * \param key the EC_KEY object |
| 798 | * \return 1 on success and 0 otherwise. | ||
| 799 | */ | ||
| 800 | int EC_KEY_check_key(const EC_KEY *key); | ||
| 801 | |||
| 802 | |||
| 803 | /********************************************************************/ | ||
| 804 | /* de- and encoding functions for SEC1 ECPrivateKey */ | ||
| 805 | /********************************************************************/ | ||
| 806 | |||
| 807 | /** Decodes a private key from a memory buffer. | ||
| 808 | * \param key a pointer to a EC_KEY object which should be used (or NULL) | ||
| 809 | * \param in pointer to memory with the DER encoded private key | ||
| 810 | * \param len length of the DER encoded private key | ||
| 811 | * \return the decoded private key or NULL if an error occurred. | ||
| 812 | */ | ||
| 813 | EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); | ||
| 814 | |||
| 815 | /** Encodes a private key object and stores the result in a buffer. | ||
| 816 | * \param key the EC_KEY object to encode | ||
| 817 | * \param out the buffer for the result (if NULL the function returns number | ||
| 818 | * of bytes needed). | ||
| 819 | * \return 1 on success and 0 if an error occurred. | ||
| 820 | */ | ||
| 821 | int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); | ||
| 822 | |||
| 823 | |||
| 824 | /********************************************************************/ | ||
| 825 | /* de- and encoding functions for EC parameters */ | ||
| 826 | /********************************************************************/ | ||
| 827 | |||
| 828 | /** Decodes ec parameter from a memory buffer. | ||
| 829 | * \param key a pointer to a EC_KEY object which should be used (or NULL) | ||
| 830 | * \param in pointer to memory with the DER encoded ec parameters | ||
| 831 | * \param len length of the DER encoded ec parameters | ||
| 832 | * \return a EC_KEY object with the decoded parameters or NULL if an error | ||
| 833 | * occurred. | ||
| 834 | */ | ||
| 835 | EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); | ||
| 836 | |||
| 837 | /** Encodes ec parameter and stores the result in a buffer. | ||
| 838 | * \param key the EC_KEY object with ec paramters to encode | ||
| 839 | * \param out the buffer for the result (if NULL the function returns number | ||
| 840 | * of bytes needed). | ||
| 841 | * \return 1 on success and 0 if an error occurred. | ||
| 842 | */ | ||
| 843 | int i2d_ECParameters(EC_KEY *key, unsigned char **out); | ||
| 844 | |||
| 845 | |||
| 846 | /********************************************************************/ | ||
| 847 | /* de- and encoding functions for EC public key */ | ||
| 848 | /* (octet string, not DER -- hence 'o2i' and 'i2o') */ | ||
| 849 | /********************************************************************/ | ||
| 850 | |||
| 851 | /** Decodes a ec public key from a octet string. | ||
| 852 | * \param key a pointer to a EC_KEY object which should be used | ||
| 853 | * \param in memory buffer with the encoded public key | ||
| 854 | * \param len length of the encoded public key | ||
| 855 | * \return EC_KEY object with decoded public key or NULL if an error | ||
| 856 | * occurred. | ||
| 857 | */ | ||
| 858 | EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); | ||
| 859 | |||
| 860 | /** Encodes a ec public key in an octet string. | ||
| 861 | * \param key the EC_KEY object with the public key | ||
| 862 | * \param out the buffer for the result (if NULL the function returns number | ||
| 863 | * of bytes needed). | ||
| 864 | * \return 1 on success and 0 if an error occurred | ||
| 865 | */ | ||
| 866 | int i2o_ECPublicKey(EC_KEY *key, unsigned char **out); | ||
| 345 | 867 | ||
| 346 | #ifndef OPENSSL_NO_BIO | 868 | #ifndef OPENSSL_NO_BIO |
| 347 | int ECParameters_print(BIO *bp, const EC_KEY *x); | 869 | /** Prints out the ec parameters on human readable form. |
| 348 | int EC_KEY_print(BIO *bp, const EC_KEY *x, int off); | 870 | * \param bp BIO object to which the information is printed |
| 871 | * \param key EC_KEY object | ||
| 872 | * \return 1 on success and 0 if an error occurred | ||
| 873 | */ | ||
| 874 | int ECParameters_print(BIO *bp, const EC_KEY *key); | ||
| 875 | |||
| 876 | /** Prints out the contents of a EC_KEY object | ||
| 877 | * \param bp BIO object to which the information is printed | ||
| 878 | * \param key EC_KEY object | ||
| 879 | * \param off line offset | ||
| 880 | * \return 1 on success and 0 if an error occurred | ||
| 881 | */ | ||
| 882 | int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); | ||
| 883 | |||
| 349 | #endif | 884 | #endif |
| 350 | #ifndef OPENSSL_NO_FP_API | 885 | #ifndef OPENSSL_NO_FP_API |
| 351 | int ECParameters_print_fp(FILE *fp, const EC_KEY *x); | 886 | /** Prints out the ec parameters on human readable form. |
| 352 | int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off); | 887 | * \param fp file descriptor to which the information is printed |
| 888 | * \param key EC_KEY object | ||
| 889 | * \return 1 on success and 0 if an error occurred | ||
| 890 | */ | ||
| 891 | int ECParameters_print_fp(FILE *fp, const EC_KEY *key); | ||
| 892 | |||
| 893 | /** Prints out the contents of a EC_KEY object | ||
| 894 | * \param fp file descriptor to which the information is printed | ||
| 895 | * \param key EC_KEY object | ||
| 896 | * \param off line offset | ||
| 897 | * \return 1 on success and 0 if an error occurred | ||
| 898 | */ | ||
| 899 | int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); | ||
| 900 | |||
| 353 | #endif | 901 | #endif |
| 354 | 902 | ||
| 355 | #define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) | 903 | #define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) |
| @@ -362,6 +910,13 @@ int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off); | |||
| 362 | # endif | 910 | # endif |
| 363 | #endif | 911 | #endif |
| 364 | 912 | ||
| 913 | #define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ | ||
| 914 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, EVP_PKEY_OP_PARAMGEN, \ | ||
| 915 | EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL) | ||
| 916 | |||
| 917 | |||
| 918 | #define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) | ||
| 919 | |||
| 365 | /* BEGIN ERROR CODES */ | 920 | /* BEGIN ERROR CODES */ |
| 366 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 921 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 367 | * made after this point may be overwritten when the script is next run. | 922 | * made after this point may be overwritten when the script is next run. |
| @@ -375,6 +930,14 @@ void ERR_load_EC_strings(void); | |||
| 375 | #define EC_F_D2I_ECPARAMETERS 144 | 930 | #define EC_F_D2I_ECPARAMETERS 144 |
| 376 | #define EC_F_D2I_ECPKPARAMETERS 145 | 931 | #define EC_F_D2I_ECPKPARAMETERS 145 |
| 377 | #define EC_F_D2I_ECPRIVATEKEY 146 | 932 | #define EC_F_D2I_ECPRIVATEKEY 146 |
| 933 | #define EC_F_DO_EC_KEY_PRINT 221 | ||
| 934 | #define EC_F_ECKEY_PARAM2TYPE 223 | ||
| 935 | #define EC_F_ECKEY_PARAM_DECODE 212 | ||
| 936 | #define EC_F_ECKEY_PRIV_DECODE 213 | ||
| 937 | #define EC_F_ECKEY_PRIV_ENCODE 214 | ||
| 938 | #define EC_F_ECKEY_PUB_DECODE 215 | ||
| 939 | #define EC_F_ECKEY_PUB_ENCODE 216 | ||
| 940 | #define EC_F_ECKEY_TYPE2PARAM 220 | ||
| 378 | #define EC_F_ECPARAMETERS_PRINT 147 | 941 | #define EC_F_ECPARAMETERS_PRINT 147 |
| 379 | #define EC_F_ECPARAMETERS_PRINT_FP 148 | 942 | #define EC_F_ECPARAMETERS_PRINT_FP 148 |
| 380 | #define EC_F_ECPKPARAMETERS_PRINT 149 | 943 | #define EC_F_ECPKPARAMETERS_PRINT 149 |
| @@ -448,7 +1011,6 @@ void ERR_load_EC_strings(void); | |||
| 448 | #define EC_F_EC_KEY_PRINT 180 | 1011 | #define EC_F_EC_KEY_PRINT 180 |
| 449 | #define EC_F_EC_KEY_PRINT_FP 181 | 1012 | #define EC_F_EC_KEY_PRINT_FP 181 |
| 450 | #define EC_F_EC_POINTS_MAKE_AFFINE 136 | 1013 | #define EC_F_EC_POINTS_MAKE_AFFINE 136 |
| 451 | #define EC_F_EC_POINTS_MUL 138 | ||
| 452 | #define EC_F_EC_POINT_ADD 112 | 1014 | #define EC_F_EC_POINT_ADD 112 |
| 453 | #define EC_F_EC_POINT_CMP 113 | 1015 | #define EC_F_EC_POINT_CMP 113 |
| 454 | #define EC_F_EC_POINT_COPY 114 | 1016 | #define EC_F_EC_POINT_COPY 114 |
| @@ -479,21 +1041,31 @@ void ERR_load_EC_strings(void); | |||
| 479 | #define EC_F_I2D_ECPRIVATEKEY 192 | 1041 | #define EC_F_I2D_ECPRIVATEKEY 192 |
| 480 | #define EC_F_I2O_ECPUBLICKEY 151 | 1042 | #define EC_F_I2O_ECPUBLICKEY 151 |
| 481 | #define EC_F_O2I_ECPUBLICKEY 152 | 1043 | #define EC_F_O2I_ECPUBLICKEY 152 |
| 1044 | #define EC_F_OLD_EC_PRIV_DECODE 222 | ||
| 1045 | #define EC_F_PKEY_EC_CTRL 197 | ||
| 1046 | #define EC_F_PKEY_EC_CTRL_STR 198 | ||
| 1047 | #define EC_F_PKEY_EC_DERIVE 217 | ||
| 1048 | #define EC_F_PKEY_EC_KEYGEN 199 | ||
| 1049 | #define EC_F_PKEY_EC_PARAMGEN 219 | ||
| 1050 | #define EC_F_PKEY_EC_SIGN 218 | ||
| 482 | 1051 | ||
| 483 | /* Reason codes. */ | 1052 | /* Reason codes. */ |
| 484 | #define EC_R_ASN1_ERROR 115 | 1053 | #define EC_R_ASN1_ERROR 115 |
| 485 | #define EC_R_ASN1_UNKNOWN_FIELD 116 | 1054 | #define EC_R_ASN1_UNKNOWN_FIELD 116 |
| 486 | #define EC_R_BUFFER_TOO_SMALL 100 | 1055 | #define EC_R_BUFFER_TOO_SMALL 100 |
| 487 | #define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 | 1056 | #define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 |
| 1057 | #define EC_R_DECODE_ERROR 142 | ||
| 488 | #define EC_R_DISCRIMINANT_IS_ZERO 118 | 1058 | #define EC_R_DISCRIMINANT_IS_ZERO 118 |
| 489 | #define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 | 1059 | #define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 |
| 490 | #define EC_R_FIELD_TOO_LARGE 138 | 1060 | #define EC_R_FIELD_TOO_LARGE 143 |
| 491 | #define EC_R_GROUP2PKPARAMETERS_FAILURE 120 | 1061 | #define EC_R_GROUP2PKPARAMETERS_FAILURE 120 |
| 492 | #define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 | 1062 | #define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 |
| 493 | #define EC_R_INCOMPATIBLE_OBJECTS 101 | 1063 | #define EC_R_INCOMPATIBLE_OBJECTS 101 |
| 494 | #define EC_R_INVALID_ARGUMENT 112 | 1064 | #define EC_R_INVALID_ARGUMENT 112 |
| 495 | #define EC_R_INVALID_COMPRESSED_POINT 110 | 1065 | #define EC_R_INVALID_COMPRESSED_POINT 110 |
| 496 | #define EC_R_INVALID_COMPRESSION_BIT 109 | 1066 | #define EC_R_INVALID_COMPRESSION_BIT 109 |
| 1067 | #define EC_R_INVALID_CURVE 141 | ||
| 1068 | #define EC_R_INVALID_DIGEST_TYPE 138 | ||
| 497 | #define EC_R_INVALID_ENCODING 102 | 1069 | #define EC_R_INVALID_ENCODING 102 |
| 498 | #define EC_R_INVALID_FIELD 103 | 1070 | #define EC_R_INVALID_FIELD 103 |
| 499 | #define EC_R_INVALID_FORM 104 | 1071 | #define EC_R_INVALID_FORM 104 |
| @@ -501,6 +1073,7 @@ void ERR_load_EC_strings(void); | |||
| 501 | #define EC_R_INVALID_PENTANOMIAL_BASIS 132 | 1073 | #define EC_R_INVALID_PENTANOMIAL_BASIS 132 |
| 502 | #define EC_R_INVALID_PRIVATE_KEY 123 | 1074 | #define EC_R_INVALID_PRIVATE_KEY 123 |
| 503 | #define EC_R_INVALID_TRINOMIAL_BASIS 137 | 1075 | #define EC_R_INVALID_TRINOMIAL_BASIS 137 |
| 1076 | #define EC_R_KEYS_NOT_SET 140 | ||
| 504 | #define EC_R_MISSING_PARAMETERS 124 | 1077 | #define EC_R_MISSING_PARAMETERS 124 |
| 505 | #define EC_R_MISSING_PRIVATE_KEY 125 | 1078 | #define EC_R_MISSING_PRIVATE_KEY 125 |
| 506 | #define EC_R_NOT_A_NIST_PRIME 135 | 1079 | #define EC_R_NOT_A_NIST_PRIME 135 |
| @@ -508,6 +1081,7 @@ void ERR_load_EC_strings(void); | |||
| 508 | #define EC_R_NOT_IMPLEMENTED 126 | 1081 | #define EC_R_NOT_IMPLEMENTED 126 |
| 509 | #define EC_R_NOT_INITIALIZED 111 | 1082 | #define EC_R_NOT_INITIALIZED 111 |
| 510 | #define EC_R_NO_FIELD_MOD 133 | 1083 | #define EC_R_NO_FIELD_MOD 133 |
| 1084 | #define EC_R_NO_PARAMETERS_SET 139 | ||
| 511 | #define EC_R_PASSED_NULL_PARAMETER 134 | 1085 | #define EC_R_PASSED_NULL_PARAMETER 134 |
| 512 | #define EC_R_PKPARAMETERS2GROUP_FAILURE 127 | 1086 | #define EC_R_PKPARAMETERS2GROUP_FAILURE 127 |
| 513 | #define EC_R_POINT_AT_INFINITY 106 | 1087 | #define EC_R_POINT_AT_INFINITY 106 |
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c index 522d036ca1..cf357b462a 100644 --- a/src/lib/libcrypto/ec/ec2_smpl.c +++ b/src/lib/libcrypto/ec/ec2_smpl.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | * | 14 | * |
| 15 | */ | 15 | */ |
| 16 | /* ==================================================================== | 16 | /* ==================================================================== |
| 17 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. | 17 | * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. |
| 18 | * | 18 | * |
| 19 | * Redistribution and use in source and binary forms, with or without | 19 | * Redistribution and use in source and binary forms, with or without |
| 20 | * modification, are permitted provided that the following conditions | 20 | * modification, are permitted provided that the following conditions |
| @@ -157,6 +157,7 @@ void ec_GF2m_simple_group_clear_finish(EC_GROUP *group) | |||
| 157 | group->poly[2] = 0; | 157 | group->poly[2] = 0; |
| 158 | group->poly[3] = 0; | 158 | group->poly[3] = 0; |
| 159 | group->poly[4] = 0; | 159 | group->poly[4] = 0; |
| 160 | group->poly[5] = -1; | ||
| 160 | } | 161 | } |
| 161 | 162 | ||
| 162 | 163 | ||
| @@ -174,10 +175,9 @@ int ec_GF2m_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) | |||
| 174 | dest->poly[2] = src->poly[2]; | 175 | dest->poly[2] = src->poly[2]; |
| 175 | dest->poly[3] = src->poly[3]; | 176 | dest->poly[3] = src->poly[3]; |
| 176 | dest->poly[4] = src->poly[4]; | 177 | dest->poly[4] = src->poly[4]; |
| 177 | if(bn_wexpand(&dest->a, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL) | 178 | dest->poly[5] = src->poly[5]; |
| 178 | return 0; | 179 | if (bn_wexpand(&dest->a, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL) return 0; |
| 179 | if(bn_wexpand(&dest->b, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL) | 180 | if (bn_wexpand(&dest->b, (int)(dest->poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL) return 0; |
| 180 | return 0; | ||
| 181 | for (i = dest->a.top; i < dest->a.dmax; i++) dest->a.d[i] = 0; | 181 | for (i = dest->a.top; i < dest->a.dmax; i++) dest->a.d[i] = 0; |
| 182 | for (i = dest->b.top; i < dest->b.dmax; i++) dest->b.d[i] = 0; | 182 | for (i = dest->b.top; i < dest->b.dmax; i++) dest->b.d[i] = 0; |
| 183 | return 1; | 183 | return 1; |
| @@ -192,7 +192,7 @@ int ec_GF2m_simple_group_set_curve(EC_GROUP *group, | |||
| 192 | 192 | ||
| 193 | /* group->field */ | 193 | /* group->field */ |
| 194 | if (!BN_copy(&group->field, p)) goto err; | 194 | if (!BN_copy(&group->field, p)) goto err; |
| 195 | i = BN_GF2m_poly2arr(&group->field, group->poly, 5); | 195 | i = BN_GF2m_poly2arr(&group->field, group->poly, 6) - 1; |
| 196 | if ((i != 5) && (i != 3)) | 196 | if ((i != 5) && (i != 3)) |
| 197 | { | 197 | { |
| 198 | ECerr(EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE, EC_R_UNSUPPORTED_FIELD); | 198 | ECerr(EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE, EC_R_UNSUPPORTED_FIELD); |
| @@ -406,18 +406,94 @@ int ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_ | |||
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | 408 | ||
| 409 | /* Include patented algorithms. */ | 409 | /* Calculates and sets the affine coordinates of an EC_POINT from the given |
| 410 | #include "ec2_smpt.c" | 410 | * compressed coordinates. Uses algorithm 2.3.4 of SEC 1. |
| 411 | * Note that the simple implementation only uses affine coordinates. | ||
| 412 | * | ||
| 413 | * The method is from the following publication: | ||
| 414 | * | ||
| 415 | * Harper, Menezes, Vanstone: | ||
| 416 | * "Public-Key Cryptosystems with Very Small Key Lengths", | ||
| 417 | * EUROCRYPT '92, Springer-Verlag LNCS 658, | ||
| 418 | * published February 1993 | ||
| 419 | * | ||
| 420 | * US Patents 6,141,420 and 6,618,483 (Vanstone, Mullin, Agnew) describe | ||
| 421 | * the same method, but claim no priority date earlier than July 29, 1994 | ||
| 422 | * (and additionally fail to cite the EUROCRYPT '92 publication as prior art). | ||
| 423 | */ | ||
| 424 | int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point, | ||
| 425 | const BIGNUM *x_, int y_bit, BN_CTX *ctx) | ||
| 426 | { | ||
| 427 | BN_CTX *new_ctx = NULL; | ||
| 428 | BIGNUM *tmp, *x, *y, *z; | ||
| 429 | int ret = 0, z0; | ||
| 430 | |||
| 431 | /* clear error queue */ | ||
| 432 | ERR_clear_error(); | ||
| 433 | |||
| 434 | if (ctx == NULL) | ||
| 435 | { | ||
| 436 | ctx = new_ctx = BN_CTX_new(); | ||
| 437 | if (ctx == NULL) | ||
| 438 | return 0; | ||
| 439 | } | ||
| 440 | |||
| 441 | y_bit = (y_bit != 0) ? 1 : 0; | ||
| 442 | |||
| 443 | BN_CTX_start(ctx); | ||
| 444 | tmp = BN_CTX_get(ctx); | ||
| 445 | x = BN_CTX_get(ctx); | ||
| 446 | y = BN_CTX_get(ctx); | ||
| 447 | z = BN_CTX_get(ctx); | ||
| 448 | if (z == NULL) goto err; | ||
| 449 | |||
| 450 | if (!BN_GF2m_mod_arr(x, x_, group->poly)) goto err; | ||
| 451 | if (BN_is_zero(x)) | ||
| 452 | { | ||
| 453 | if (!BN_GF2m_mod_sqrt_arr(y, &group->b, group->poly, ctx)) goto err; | ||
| 454 | } | ||
| 455 | else | ||
| 456 | { | ||
| 457 | if (!group->meth->field_sqr(group, tmp, x, ctx)) goto err; | ||
| 458 | if (!group->meth->field_div(group, tmp, &group->b, tmp, ctx)) goto err; | ||
| 459 | if (!BN_GF2m_add(tmp, &group->a, tmp)) goto err; | ||
| 460 | if (!BN_GF2m_add(tmp, x, tmp)) goto err; | ||
| 461 | if (!BN_GF2m_mod_solve_quad_arr(z, tmp, group->poly, ctx)) | ||
| 462 | { | ||
| 463 | unsigned long err = ERR_peek_last_error(); | ||
| 464 | |||
| 465 | if (ERR_GET_LIB(err) == ERR_LIB_BN && ERR_GET_REASON(err) == BN_R_NO_SOLUTION) | ||
| 466 | { | ||
| 467 | ERR_clear_error(); | ||
| 468 | ECerr(EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES, EC_R_INVALID_COMPRESSED_POINT); | ||
| 469 | } | ||
| 470 | else | ||
| 471 | ECerr(EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES, ERR_R_BN_LIB); | ||
| 472 | goto err; | ||
| 473 | } | ||
| 474 | z0 = (BN_is_odd(z)) ? 1 : 0; | ||
| 475 | if (!group->meth->field_mul(group, y, x, z, ctx)) goto err; | ||
| 476 | if (z0 != y_bit) | ||
| 477 | { | ||
| 478 | if (!BN_GF2m_add(y, y, x)) goto err; | ||
| 479 | } | ||
| 480 | } | ||
| 481 | |||
| 482 | if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err; | ||
| 483 | |||
| 484 | ret = 1; | ||
| 485 | |||
| 486 | err: | ||
| 487 | BN_CTX_end(ctx); | ||
| 488 | if (new_ctx != NULL) | ||
| 489 | BN_CTX_free(new_ctx); | ||
| 490 | return ret; | ||
| 491 | } | ||
| 411 | 492 | ||
| 412 | 493 | ||
| 413 | /* Converts an EC_POINT to an octet string. | 494 | /* Converts an EC_POINT to an octet string. |
| 414 | * If buf is NULL, the encoded length will be returned. | 495 | * If buf is NULL, the encoded length will be returned. |
| 415 | * If the length len of buf is smaller than required an error will be returned. | 496 | * If the length len of buf is smaller than required an error will be returned. |
| 416 | * | ||
| 417 | * The point compression section of this function is patented by Certicom Corp. | ||
| 418 | * under US Patent 6,141,420. Point compression is disabled by default and can | ||
| 419 | * be enabled by defining the preprocessor macro OPENSSL_EC_BIN_PT_COMP at | ||
| 420 | * Configure-time. | ||
| 421 | */ | 497 | */ |
| 422 | size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t form, | 498 | size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t form, |
| 423 | unsigned char *buf, size_t len, BN_CTX *ctx) | 499 | unsigned char *buf, size_t len, BN_CTX *ctx) |
| @@ -428,14 +504,6 @@ size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, po | |||
| 428 | BIGNUM *x, *y, *yxi; | 504 | BIGNUM *x, *y, *yxi; |
| 429 | size_t field_len, i, skip; | 505 | size_t field_len, i, skip; |
| 430 | 506 | ||
| 431 | #ifndef OPENSSL_EC_BIN_PT_COMP | ||
| 432 | if ((form == POINT_CONVERSION_COMPRESSED) || (form == POINT_CONVERSION_HYBRID)) | ||
| 433 | { | ||
| 434 | ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, ERR_R_DISABLED); | ||
| 435 | goto err; | ||
| 436 | } | ||
| 437 | #endif | ||
| 438 | |||
| 439 | if ((form != POINT_CONVERSION_COMPRESSED) | 507 | if ((form != POINT_CONVERSION_COMPRESSED) |
| 440 | && (form != POINT_CONVERSION_UNCOMPRESSED) | 508 | && (form != POINT_CONVERSION_UNCOMPRESSED) |
| 441 | && (form != POINT_CONVERSION_HYBRID)) | 509 | && (form != POINT_CONVERSION_HYBRID)) |
| @@ -490,13 +558,11 @@ size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, po | |||
| 490 | if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err; | 558 | if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err; |
| 491 | 559 | ||
| 492 | buf[0] = form; | 560 | buf[0] = form; |
| 493 | #ifdef OPENSSL_EC_BIN_PT_COMP | ||
| 494 | if ((form != POINT_CONVERSION_UNCOMPRESSED) && !BN_is_zero(x)) | 561 | if ((form != POINT_CONVERSION_UNCOMPRESSED) && !BN_is_zero(x)) |
| 495 | { | 562 | { |
| 496 | if (!group->meth->field_div(group, yxi, y, x, ctx)) goto err; | 563 | if (!group->meth->field_div(group, yxi, y, x, ctx)) goto err; |
| 497 | if (BN_is_odd(yxi)) buf[0]++; | 564 | if (BN_is_odd(yxi)) buf[0]++; |
| 498 | } | 565 | } |
| 499 | #endif | ||
| 500 | 566 | ||
| 501 | i = 1; | 567 | i = 1; |
| 502 | 568 | ||
diff --git a/src/lib/libcrypto/ec/ec2_smpt.c b/src/lib/libcrypto/ec/ec2_smpt.c deleted file mode 100644 index 59d52bf663..0000000000 --- a/src/lib/libcrypto/ec/ec2_smpt.c +++ /dev/null | |||
| @@ -1,74 +0,0 @@ | |||
| 1 | /* crypto/ec/ec2_smpt.c */ | ||
| 2 | /* This code was originally written by Douglas Stebila | ||
| 3 | * <dstebila@student.math.uwaterloo.ca> for the OpenSSL project. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1998-2002 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 | |||
| 60 | /* Calaculates and sets the affine coordinates of an EC_POINT from the given | ||
| 61 | * compressed coordinates. Uses algorithm 2.3.4 of SEC 1. | ||
| 62 | * Note that the simple implementation only uses affine coordinates. | ||
| 63 | * | ||
| 64 | * This algorithm is patented by Certicom Corp. under US Patent 6,141,420 | ||
| 65 | * (for licensing information, contact licensing@certicom.com). | ||
| 66 | * This function is disabled by default and can be enabled by defining the | ||
| 67 | * preprocessor macro OPENSSL_EC_BIN_PT_COMP at Configure-time. | ||
| 68 | */ | ||
| 69 | int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point, | ||
| 70 | const BIGNUM *x_, int y_bit, BN_CTX *ctx) | ||
| 71 | { | ||
| 72 | ECerr(EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES, ERR_R_DISABLED); | ||
| 73 | return 0; | ||
| 74 | } | ||
diff --git a/src/lib/libcrypto/ec/ec_err.c b/src/lib/libcrypto/ec/ec_err.c index d04c895560..84b4833371 100644 --- a/src/lib/libcrypto/ec/ec_err.c +++ b/src/lib/libcrypto/ec/ec_err.c | |||
| @@ -74,6 +74,14 @@ static ERR_STRING_DATA EC_str_functs[]= | |||
| 74 | {ERR_FUNC(EC_F_D2I_ECPARAMETERS), "d2i_ECParameters"}, | 74 | {ERR_FUNC(EC_F_D2I_ECPARAMETERS), "d2i_ECParameters"}, |
| 75 | {ERR_FUNC(EC_F_D2I_ECPKPARAMETERS), "d2i_ECPKParameters"}, | 75 | {ERR_FUNC(EC_F_D2I_ECPKPARAMETERS), "d2i_ECPKParameters"}, |
| 76 | {ERR_FUNC(EC_F_D2I_ECPRIVATEKEY), "d2i_ECPrivateKey"}, | 76 | {ERR_FUNC(EC_F_D2I_ECPRIVATEKEY), "d2i_ECPrivateKey"}, |
| 77 | {ERR_FUNC(EC_F_DO_EC_KEY_PRINT), "DO_EC_KEY_PRINT"}, | ||
| 78 | {ERR_FUNC(EC_F_ECKEY_PARAM2TYPE), "ECKEY_PARAM2TYPE"}, | ||
| 79 | {ERR_FUNC(EC_F_ECKEY_PARAM_DECODE), "ECKEY_PARAM_DECODE"}, | ||
| 80 | {ERR_FUNC(EC_F_ECKEY_PRIV_DECODE), "ECKEY_PRIV_DECODE"}, | ||
| 81 | {ERR_FUNC(EC_F_ECKEY_PRIV_ENCODE), "ECKEY_PRIV_ENCODE"}, | ||
| 82 | {ERR_FUNC(EC_F_ECKEY_PUB_DECODE), "ECKEY_PUB_DECODE"}, | ||
| 83 | {ERR_FUNC(EC_F_ECKEY_PUB_ENCODE), "ECKEY_PUB_ENCODE"}, | ||
| 84 | {ERR_FUNC(EC_F_ECKEY_TYPE2PARAM), "ECKEY_TYPE2PARAM"}, | ||
| 77 | {ERR_FUNC(EC_F_ECPARAMETERS_PRINT), "ECParameters_print"}, | 85 | {ERR_FUNC(EC_F_ECPARAMETERS_PRINT), "ECParameters_print"}, |
| 78 | {ERR_FUNC(EC_F_ECPARAMETERS_PRINT_FP), "ECParameters_print_fp"}, | 86 | {ERR_FUNC(EC_F_ECPARAMETERS_PRINT_FP), "ECParameters_print_fp"}, |
| 79 | {ERR_FUNC(EC_F_ECPKPARAMETERS_PRINT), "ECPKParameters_print"}, | 87 | {ERR_FUNC(EC_F_ECPKPARAMETERS_PRINT), "ECPKParameters_print"}, |
| @@ -147,7 +155,6 @@ static ERR_STRING_DATA EC_str_functs[]= | |||
| 147 | {ERR_FUNC(EC_F_EC_KEY_PRINT), "EC_KEY_print"}, | 155 | {ERR_FUNC(EC_F_EC_KEY_PRINT), "EC_KEY_print"}, |
| 148 | {ERR_FUNC(EC_F_EC_KEY_PRINT_FP), "EC_KEY_print_fp"}, | 156 | {ERR_FUNC(EC_F_EC_KEY_PRINT_FP), "EC_KEY_print_fp"}, |
| 149 | {ERR_FUNC(EC_F_EC_POINTS_MAKE_AFFINE), "EC_POINTs_make_affine"}, | 157 | {ERR_FUNC(EC_F_EC_POINTS_MAKE_AFFINE), "EC_POINTs_make_affine"}, |
| 150 | {ERR_FUNC(EC_F_EC_POINTS_MUL), "EC_POINTs_mul"}, | ||
| 151 | {ERR_FUNC(EC_F_EC_POINT_ADD), "EC_POINT_add"}, | 158 | {ERR_FUNC(EC_F_EC_POINT_ADD), "EC_POINT_add"}, |
| 152 | {ERR_FUNC(EC_F_EC_POINT_CMP), "EC_POINT_cmp"}, | 159 | {ERR_FUNC(EC_F_EC_POINT_CMP), "EC_POINT_cmp"}, |
| 153 | {ERR_FUNC(EC_F_EC_POINT_COPY), "EC_POINT_copy"}, | 160 | {ERR_FUNC(EC_F_EC_POINT_COPY), "EC_POINT_copy"}, |
| @@ -178,6 +185,13 @@ static ERR_STRING_DATA EC_str_functs[]= | |||
| 178 | {ERR_FUNC(EC_F_I2D_ECPRIVATEKEY), "i2d_ECPrivateKey"}, | 185 | {ERR_FUNC(EC_F_I2D_ECPRIVATEKEY), "i2d_ECPrivateKey"}, |
| 179 | {ERR_FUNC(EC_F_I2O_ECPUBLICKEY), "i2o_ECPublicKey"}, | 186 | {ERR_FUNC(EC_F_I2O_ECPUBLICKEY), "i2o_ECPublicKey"}, |
| 180 | {ERR_FUNC(EC_F_O2I_ECPUBLICKEY), "o2i_ECPublicKey"}, | 187 | {ERR_FUNC(EC_F_O2I_ECPUBLICKEY), "o2i_ECPublicKey"}, |
| 188 | {ERR_FUNC(EC_F_OLD_EC_PRIV_DECODE), "OLD_EC_PRIV_DECODE"}, | ||
| 189 | {ERR_FUNC(EC_F_PKEY_EC_CTRL), "PKEY_EC_CTRL"}, | ||
| 190 | {ERR_FUNC(EC_F_PKEY_EC_CTRL_STR), "PKEY_EC_CTRL_STR"}, | ||
| 191 | {ERR_FUNC(EC_F_PKEY_EC_DERIVE), "PKEY_EC_DERIVE"}, | ||
| 192 | {ERR_FUNC(EC_F_PKEY_EC_KEYGEN), "PKEY_EC_KEYGEN"}, | ||
| 193 | {ERR_FUNC(EC_F_PKEY_EC_PARAMGEN), "PKEY_EC_PARAMGEN"}, | ||
| 194 | {ERR_FUNC(EC_F_PKEY_EC_SIGN), "PKEY_EC_SIGN"}, | ||
| 181 | {0,NULL} | 195 | {0,NULL} |
| 182 | }; | 196 | }; |
| 183 | 197 | ||
| @@ -187,6 +201,7 @@ static ERR_STRING_DATA EC_str_reasons[]= | |||
| 187 | {ERR_REASON(EC_R_ASN1_UNKNOWN_FIELD) ,"asn1 unknown field"}, | 201 | {ERR_REASON(EC_R_ASN1_UNKNOWN_FIELD) ,"asn1 unknown field"}, |
| 188 | {ERR_REASON(EC_R_BUFFER_TOO_SMALL) ,"buffer too small"}, | 202 | {ERR_REASON(EC_R_BUFFER_TOO_SMALL) ,"buffer too small"}, |
| 189 | {ERR_REASON(EC_R_D2I_ECPKPARAMETERS_FAILURE),"d2i ecpkparameters failure"}, | 203 | {ERR_REASON(EC_R_D2I_ECPKPARAMETERS_FAILURE),"d2i ecpkparameters failure"}, |
| 204 | {ERR_REASON(EC_R_DECODE_ERROR) ,"decode error"}, | ||
| 190 | {ERR_REASON(EC_R_DISCRIMINANT_IS_ZERO) ,"discriminant is zero"}, | 205 | {ERR_REASON(EC_R_DISCRIMINANT_IS_ZERO) ,"discriminant is zero"}, |
| 191 | {ERR_REASON(EC_R_EC_GROUP_NEW_BY_NAME_FAILURE),"ec group new by name failure"}, | 206 | {ERR_REASON(EC_R_EC_GROUP_NEW_BY_NAME_FAILURE),"ec group new by name failure"}, |
| 192 | {ERR_REASON(EC_R_FIELD_TOO_LARGE) ,"field too large"}, | 207 | {ERR_REASON(EC_R_FIELD_TOO_LARGE) ,"field too large"}, |
| @@ -196,6 +211,8 @@ static ERR_STRING_DATA EC_str_reasons[]= | |||
| 196 | {ERR_REASON(EC_R_INVALID_ARGUMENT) ,"invalid argument"}, | 211 | {ERR_REASON(EC_R_INVALID_ARGUMENT) ,"invalid argument"}, |
| 197 | {ERR_REASON(EC_R_INVALID_COMPRESSED_POINT),"invalid compressed point"}, | 212 | {ERR_REASON(EC_R_INVALID_COMPRESSED_POINT),"invalid compressed point"}, |
| 198 | {ERR_REASON(EC_R_INVALID_COMPRESSION_BIT),"invalid compression bit"}, | 213 | {ERR_REASON(EC_R_INVALID_COMPRESSION_BIT),"invalid compression bit"}, |
| 214 | {ERR_REASON(EC_R_INVALID_CURVE) ,"invalid curve"}, | ||
| 215 | {ERR_REASON(EC_R_INVALID_DIGEST_TYPE) ,"invalid digest type"}, | ||
| 199 | {ERR_REASON(EC_R_INVALID_ENCODING) ,"invalid encoding"}, | 216 | {ERR_REASON(EC_R_INVALID_ENCODING) ,"invalid encoding"}, |
| 200 | {ERR_REASON(EC_R_INVALID_FIELD) ,"invalid field"}, | 217 | {ERR_REASON(EC_R_INVALID_FIELD) ,"invalid field"}, |
| 201 | {ERR_REASON(EC_R_INVALID_FORM) ,"invalid form"}, | 218 | {ERR_REASON(EC_R_INVALID_FORM) ,"invalid form"}, |
| @@ -203,6 +220,7 @@ static ERR_STRING_DATA EC_str_reasons[]= | |||
| 203 | {ERR_REASON(EC_R_INVALID_PENTANOMIAL_BASIS),"invalid pentanomial basis"}, | 220 | {ERR_REASON(EC_R_INVALID_PENTANOMIAL_BASIS),"invalid pentanomial basis"}, |
| 204 | {ERR_REASON(EC_R_INVALID_PRIVATE_KEY) ,"invalid private key"}, | 221 | {ERR_REASON(EC_R_INVALID_PRIVATE_KEY) ,"invalid private key"}, |
| 205 | {ERR_REASON(EC_R_INVALID_TRINOMIAL_BASIS),"invalid trinomial basis"}, | 222 | {ERR_REASON(EC_R_INVALID_TRINOMIAL_BASIS),"invalid trinomial basis"}, |
| 223 | {ERR_REASON(EC_R_KEYS_NOT_SET) ,"keys not set"}, | ||
| 206 | {ERR_REASON(EC_R_MISSING_PARAMETERS) ,"missing parameters"}, | 224 | {ERR_REASON(EC_R_MISSING_PARAMETERS) ,"missing parameters"}, |
| 207 | {ERR_REASON(EC_R_MISSING_PRIVATE_KEY) ,"missing private key"}, | 225 | {ERR_REASON(EC_R_MISSING_PRIVATE_KEY) ,"missing private key"}, |
| 208 | {ERR_REASON(EC_R_NOT_A_NIST_PRIME) ,"not a NIST prime"}, | 226 | {ERR_REASON(EC_R_NOT_A_NIST_PRIME) ,"not a NIST prime"}, |
| @@ -210,6 +228,7 @@ static ERR_STRING_DATA EC_str_reasons[]= | |||
| 210 | {ERR_REASON(EC_R_NOT_IMPLEMENTED) ,"not implemented"}, | 228 | {ERR_REASON(EC_R_NOT_IMPLEMENTED) ,"not implemented"}, |
| 211 | {ERR_REASON(EC_R_NOT_INITIALIZED) ,"not initialized"}, | 229 | {ERR_REASON(EC_R_NOT_INITIALIZED) ,"not initialized"}, |
| 212 | {ERR_REASON(EC_R_NO_FIELD_MOD) ,"no field mod"}, | 230 | {ERR_REASON(EC_R_NO_FIELD_MOD) ,"no field mod"}, |
| 231 | {ERR_REASON(EC_R_NO_PARAMETERS_SET) ,"no parameters set"}, | ||
| 213 | {ERR_REASON(EC_R_PASSED_NULL_PARAMETER) ,"passed null parameter"}, | 232 | {ERR_REASON(EC_R_PASSED_NULL_PARAMETER) ,"passed null parameter"}, |
| 214 | {ERR_REASON(EC_R_PKPARAMETERS2GROUP_FAILURE),"pkparameters2group failure"}, | 233 | {ERR_REASON(EC_R_PKPARAMETERS2GROUP_FAILURE),"pkparameters2group failure"}, |
| 215 | {ERR_REASON(EC_R_POINT_AT_INFINITY) ,"point at infinity"}, | 234 | {ERR_REASON(EC_R_POINT_AT_INFINITY) ,"point at infinity"}, |
diff --git a/src/lib/libcrypto/ec/ec_lcl.h b/src/lib/libcrypto/ec/ec_lcl.h index fdd7aa2755..3e2c34b0bc 100644 --- a/src/lib/libcrypto/ec/ec_lcl.h +++ b/src/lib/libcrypto/ec/ec_lcl.h | |||
| @@ -205,11 +205,14 @@ struct ec_group_st { | |||
| 205 | * irreducible polynomial defining the field. | 205 | * irreducible polynomial defining the field. |
| 206 | */ | 206 | */ |
| 207 | 207 | ||
| 208 | unsigned int poly[5]; /* Field specification for curves over GF(2^m). | 208 | int poly[6]; /* Field specification for curves over GF(2^m). |
| 209 | * The irreducible f(t) is then of the form: | 209 | * The irreducible f(t) is then of the form: |
| 210 | * t^poly[0] + t^poly[1] + ... + t^poly[k] | 210 | * t^poly[0] + t^poly[1] + ... + t^poly[k] |
| 211 | * where m = poly[0] > poly[1] > ... > poly[k] = 0. | 211 | * where m = poly[0] > poly[1] > ... > poly[k] = 0. |
| 212 | */ | 212 | * The array is terminated with poly[k+1]=-1. |
| 213 | * All elliptic curve irreducibles have at most 5 | ||
| 214 | * non-zero terms. | ||
| 215 | */ | ||
| 213 | 216 | ||
| 214 | BIGNUM a, b; /* Curve coefficients. | 217 | BIGNUM a, b; /* Curve coefficients. |
| 215 | * (Here the assumption is that BIGNUMs can be used | 218 | * (Here the assumption is that BIGNUMs can be used |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 5af84376c6..dd7da0fcf9 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
| @@ -79,7 +79,7 @@ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) | |||
| 79 | 79 | ||
| 80 | if (meth == NULL) | 80 | if (meth == NULL) |
| 81 | { | 81 | { |
| 82 | ECerr(EC_F_EC_GROUP_NEW, ERR_R_PASSED_NULL_PARAMETER); | 82 | ECerr(EC_F_EC_GROUP_NEW, EC_R_SLOT_FULL); |
| 83 | return NULL; | 83 | return NULL; |
| 84 | } | 84 | } |
| 85 | if (meth->group_init == 0) | 85 | if (meth->group_init == 0) |
| @@ -740,7 +740,7 @@ void EC_POINT_clear_free(EC_POINT *point) | |||
| 740 | 740 | ||
| 741 | if (point->meth->point_clear_finish != 0) | 741 | if (point->meth->point_clear_finish != 0) |
| 742 | point->meth->point_clear_finish(point); | 742 | point->meth->point_clear_finish(point); |
| 743 | else if (point->meth != NULL && point->meth->point_finish != 0) | 743 | else if (point->meth->point_finish != 0) |
| 744 | point->meth->point_finish(point); | 744 | point->meth->point_finish(point); |
| 745 | OPENSSL_cleanse(point, sizeof *point); | 745 | OPENSSL_cleanse(point, sizeof *point); |
| 746 | OPENSSL_free(point); | 746 | OPENSSL_free(point); |
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c index 2ba173ef36..f05df5332e 100644 --- a/src/lib/libcrypto/ec/ec_mult.c +++ b/src/lib/libcrypto/ec/ec_mult.c | |||
| @@ -224,6 +224,12 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) | |||
| 224 | sign = -1; | 224 | sign = -1; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | if (scalar->d == NULL || scalar->top == 0) | ||
| 228 | { | ||
| 229 | ECerr(EC_F_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR); | ||
| 230 | goto err; | ||
| 231 | } | ||
| 232 | |||
| 227 | len = BN_num_bits(scalar); | 233 | len = BN_num_bits(scalar); |
| 228 | r = OPENSSL_malloc(len + 1); /* modified wNAF may be one digit longer than binary representation | 234 | r = OPENSSL_malloc(len + 1); /* modified wNAF may be one digit longer than binary representation |
| 229 | * (*ret_len will be set to the actual length, i.e. at most | 235 | * (*ret_len will be set to the actual length, i.e. at most |
| @@ -233,12 +239,6 @@ static signed char *compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len) | |||
| 233 | ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE); | 239 | ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE); |
| 234 | goto err; | 240 | goto err; |
| 235 | } | 241 | } |
| 236 | |||
| 237 | if (scalar->d == NULL || scalar->top == 0) | ||
| 238 | { | ||
| 239 | ECerr(EC_F_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR); | ||
| 240 | goto err; | ||
| 241 | } | ||
| 242 | window_val = scalar->d[0] & mask; | 242 | window_val = scalar->d[0] & mask; |
| 243 | j = 0; | 243 | j = 0; |
| 244 | while ((window_val != 0) || (j + w + 1 < len)) /* if j+w+1 >= len, window_val will not increase */ | 244 | while ((window_val != 0) || (j + w + 1 < len)) /* if j+w+1 >= len, window_val will not increase */ |
| @@ -419,7 +419,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
| 419 | if (numblocks > pre_comp->numblocks) | 419 | if (numblocks > pre_comp->numblocks) |
| 420 | numblocks = pre_comp->numblocks; | 420 | numblocks = pre_comp->numblocks; |
| 421 | 421 | ||
| 422 | pre_points_per_block = 1u << (pre_comp->w - 1); | 422 | pre_points_per_block = (size_t)1 << (pre_comp->w - 1); |
| 423 | 423 | ||
| 424 | /* check that pre_comp looks sane */ | 424 | /* check that pre_comp looks sane */ |
| 425 | if (pre_comp->num != (pre_comp->numblocks * pre_points_per_block)) | 425 | if (pre_comp->num != (pre_comp->numblocks * pre_points_per_block)) |
| @@ -461,7 +461,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
| 461 | 461 | ||
| 462 | bits = i < num ? BN_num_bits(scalars[i]) : BN_num_bits(scalar); | 462 | bits = i < num ? BN_num_bits(scalars[i]) : BN_num_bits(scalar); |
| 463 | wsize[i] = EC_window_bits_for_scalar_size(bits); | 463 | wsize[i] = EC_window_bits_for_scalar_size(bits); |
| 464 | num_val += 1u << (wsize[i] - 1); | 464 | num_val += (size_t)1 << (wsize[i] - 1); |
| 465 | wNAF[i + 1] = NULL; /* make sure we always have a pivot */ | 465 | wNAF[i + 1] = NULL; /* make sure we always have a pivot */ |
| 466 | wNAF[i] = compute_wNAF((i < num ? scalars[i] : scalar), wsize[i], &wNAF_len[i]); | 466 | wNAF[i] = compute_wNAF((i < num ? scalars[i] : scalar), wsize[i], &wNAF_len[i]); |
| 467 | if (wNAF[i] == NULL) | 467 | if (wNAF[i] == NULL) |
| @@ -600,7 +600,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
| 600 | for (i = 0; i < num + num_scalar; i++) | 600 | for (i = 0; i < num + num_scalar; i++) |
| 601 | { | 601 | { |
| 602 | val_sub[i] = v; | 602 | val_sub[i] = v; |
| 603 | for (j = 0; j < (1u << (wsize[i] - 1)); j++) | 603 | for (j = 0; j < ((size_t)1 << (wsize[i] - 1)); j++) |
| 604 | { | 604 | { |
| 605 | *v = EC_POINT_new(group); | 605 | *v = EC_POINT_new(group); |
| 606 | if (*v == NULL) goto err; | 606 | if (*v == NULL) goto err; |
| @@ -636,7 +636,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
| 636 | if (wsize[i] > 1) | 636 | if (wsize[i] > 1) |
| 637 | { | 637 | { |
| 638 | if (!EC_POINT_dbl(group, tmp, val_sub[i][0], ctx)) goto err; | 638 | if (!EC_POINT_dbl(group, tmp, val_sub[i][0], ctx)) goto err; |
| 639 | for (j = 1; j < (1u << (wsize[i] - 1)); j++) | 639 | for (j = 1; j < ((size_t)1 << (wsize[i] - 1)); j++) |
| 640 | { | 640 | { |
| 641 | if (!EC_POINT_add(group, val_sub[i][j], val_sub[i][j - 1], tmp, ctx)) goto err; | 641 | if (!EC_POINT_add(group, val_sub[i][j], val_sub[i][j - 1], tmp, ctx)) goto err; |
| 642 | } | 642 | } |
| @@ -820,7 +820,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) | |||
| 820 | 820 | ||
| 821 | numblocks = (bits + blocksize - 1) / blocksize; /* max. number of blocks to use for wNAF splitting */ | 821 | numblocks = (bits + blocksize - 1) / blocksize; /* max. number of blocks to use for wNAF splitting */ |
| 822 | 822 | ||
| 823 | pre_points_per_block = 1u << (w - 1); | 823 | pre_points_per_block = (size_t)1 << (w - 1); |
| 824 | num = pre_points_per_block * numblocks; /* number of points to compute and store */ | 824 | num = pre_points_per_block * numblocks; /* number of points to compute and store */ |
| 825 | 825 | ||
| 826 | points = OPENSSL_malloc(sizeof (EC_POINT*)*(num + 1)); | 826 | points = OPENSSL_malloc(sizeof (EC_POINT*)*(num + 1)); |
diff --git a/src/lib/libcrypto/ec/ecp_nist.c b/src/lib/libcrypto/ec/ecp_nist.c index 71893d5eab..2a5682ea41 100644 --- a/src/lib/libcrypto/ec/ecp_nist.c +++ b/src/lib/libcrypto/ec/ecp_nist.c | |||
| @@ -112,10 +112,6 @@ const EC_METHOD *EC_GFp_nist_method(void) | |||
| 112 | return &ret; | 112 | return &ret; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | #if BN_BITS2 == 64 | ||
| 116 | #define NO_32_BIT_TYPE | ||
| 117 | #endif | ||
| 118 | |||
| 119 | int ec_GFp_nist_group_copy(EC_GROUP *dest, const EC_GROUP *src) | 115 | int ec_GFp_nist_group_copy(EC_GROUP *dest, const EC_GROUP *src) |
| 120 | { | 116 | { |
| 121 | dest->field_mod_func = src->field_mod_func; | 117 | dest->field_mod_func = src->field_mod_func; |
| @@ -139,34 +135,12 @@ int ec_GFp_nist_group_set_curve(EC_GROUP *group, const BIGNUM *p, | |||
| 139 | if (BN_ucmp(BN_get0_nist_prime_192(), p) == 0) | 135 | if (BN_ucmp(BN_get0_nist_prime_192(), p) == 0) |
| 140 | group->field_mod_func = BN_nist_mod_192; | 136 | group->field_mod_func = BN_nist_mod_192; |
| 141 | else if (BN_ucmp(BN_get0_nist_prime_224(), p) == 0) | 137 | else if (BN_ucmp(BN_get0_nist_prime_224(), p) == 0) |
| 142 | { | ||
| 143 | #ifndef NO_32_BIT_TYPE | ||
| 144 | group->field_mod_func = BN_nist_mod_224; | 138 | group->field_mod_func = BN_nist_mod_224; |
| 145 | #else | ||
| 146 | ECerr(EC_F_EC_GFP_NIST_GROUP_SET_CURVE, EC_R_NOT_A_SUPPORTED_NIST_PRIME); | ||
| 147 | goto err; | ||
| 148 | #endif | ||
| 149 | } | ||
| 150 | else if (BN_ucmp(BN_get0_nist_prime_256(), p) == 0) | 139 | else if (BN_ucmp(BN_get0_nist_prime_256(), p) == 0) |
| 151 | { | ||
| 152 | #ifndef NO_32_BIT_TYPE | ||
| 153 | group->field_mod_func = BN_nist_mod_256; | 140 | group->field_mod_func = BN_nist_mod_256; |
| 154 | #else | ||
| 155 | ECerr(EC_F_EC_GFP_NIST_GROUP_SET_CURVE, EC_R_NOT_A_SUPPORTED_NIST_PRIME); | ||
| 156 | goto err; | ||
| 157 | #endif | ||
| 158 | } | ||
| 159 | else if (BN_ucmp(BN_get0_nist_prime_384(), p) == 0) | 141 | else if (BN_ucmp(BN_get0_nist_prime_384(), p) == 0) |
| 160 | { | ||
| 161 | #ifndef NO_32_BIT_TYPE | ||
| 162 | group->field_mod_func = BN_nist_mod_384; | 142 | group->field_mod_func = BN_nist_mod_384; |
| 163 | #else | ||
| 164 | ECerr(EC_F_EC_GFP_NIST_GROUP_SET_CURVE, EC_R_NOT_A_SUPPORTED_NIST_PRIME); | ||
| 165 | goto err; | ||
| 166 | #endif | ||
| 167 | } | ||
| 168 | else if (BN_ucmp(BN_get0_nist_prime_521(), p) == 0) | 143 | else if (BN_ucmp(BN_get0_nist_prime_521(), p) == 0) |
| 169 | /* this one works in the NO_32_BIT_TYPE case */ | ||
| 170 | group->field_mod_func = BN_nist_mod_521; | 144 | group->field_mod_func = BN_nist_mod_521; |
| 171 | else | 145 | else |
| 172 | { | 146 | { |
diff --git a/src/lib/libcrypto/ec/ecp_recp.c b/src/lib/libcrypto/ec/ecp_recp.c deleted file mode 100644 index fec843b5c8..0000000000 --- a/src/lib/libcrypto/ec/ecp_recp.c +++ /dev/null | |||
| @@ -1,133 +0,0 @@ | |||
| 1 | /* crypto/ec/ecp_recp.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1998-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 | * 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 "ec_lcl.h" | ||
| 57 | |||
| 58 | #if 0 | ||
| 59 | const EC_METHOD *EC_GFp_recp_method(void) | ||
| 60 | { | ||
| 61 | static const EC_METHOD ret = { | ||
| 62 | ec_GFp_recp_group_init, | ||
| 63 | ec_GFp_recp_group_finish, | ||
| 64 | ec_GFp_recp_group_clear_finish, | ||
| 65 | ec_GFp_recp_group_copy, | ||
| 66 | ec_GFp_recp_group_set_curve_GFp, | ||
| 67 | ec_GFp_simple_group_get_curve_GFp, | ||
| 68 | ec_GFp_simple_group_set_generator, | ||
| 69 | ec_GFp_simple_group_get0_generator, | ||
| 70 | ec_GFp_simple_group_get_order, | ||
| 71 | ec_GFp_simple_group_get_cofactor, | ||
| 72 | ec_GFp_simple_point_init, | ||
| 73 | ec_GFp_simple_point_finish, | ||
| 74 | ec_GFp_simple_point_clear_finish, | ||
| 75 | ec_GFp_simple_point_copy, | ||
| 76 | ec_GFp_simple_point_set_to_infinity, | ||
| 77 | ec_GFp_simple_set_Jprojective_coordinates_GFp, | ||
| 78 | ec_GFp_simple_get_Jprojective_coordinates_GFp, | ||
| 79 | ec_GFp_simple_point_set_affine_coordinates_GFp, | ||
| 80 | ec_GFp_simple_point_get_affine_coordinates_GFp, | ||
| 81 | ec_GFp_simple_set_compressed_coordinates_GFp, | ||
| 82 | ec_GFp_simple_point2oct, | ||
| 83 | ec_GFp_simple_oct2point, | ||
| 84 | ec_GFp_simple_add, | ||
| 85 | ec_GFp_simple_dbl, | ||
| 86 | ec_GFp_simple_invert, | ||
| 87 | ec_GFp_simple_is_at_infinity, | ||
| 88 | ec_GFp_simple_is_on_curve, | ||
| 89 | ec_GFp_simple_cmp, | ||
| 90 | ec_GFp_simple_make_affine, | ||
| 91 | ec_GFp_simple_points_make_affine, | ||
| 92 | ec_GFp_recp_field_mul, | ||
| 93 | ec_GFp_recp_field_sqr, | ||
| 94 | 0 /* field_encode */, | ||
| 95 | 0 /* field_decode */, | ||
| 96 | 0 /* field_set_to_one */ }; | ||
| 97 | |||
| 98 | return &ret; | ||
| 99 | } | ||
| 100 | #endif | ||
| 101 | |||
| 102 | int ec_GFp_recp_group_init(EC_GROUP *group) | ||
| 103 | { | ||
| 104 | int ok; | ||
| 105 | |||
| 106 | ok = ec_GFp_simple_group_init(group); | ||
| 107 | group->field_data1 = NULL; | ||
| 108 | return ok; | ||
| 109 | } | ||
| 110 | |||
| 111 | |||
| 112 | int ec_GFp_recp_group_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | ||
| 113 | /* TODO */ | ||
| 114 | |||
| 115 | |||
| 116 | void ec_GFp_recp_group_finish(EC_GROUP *group); | ||
| 117 | /* TODO */ | ||
| 118 | |||
| 119 | |||
| 120 | void ec_GFp_recp_group_clear_finish(EC_GROUP *group); | ||
| 121 | /* TODO */ | ||
| 122 | |||
| 123 | |||
| 124 | int ec_GFp_recp_group_copy(EC_GROUP *dest, const EC_GROUP *src); | ||
| 125 | /* TODO */ | ||
| 126 | |||
| 127 | |||
| 128 | int ec_GFp_recp_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | ||
| 129 | /* TODO */ | ||
| 130 | |||
| 131 | |||
| 132 | int ec_GFp_recp_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); | ||
| 133 | /* TODO */ | ||
diff --git a/src/lib/libcrypto/ec/ectest.c b/src/lib/libcrypto/ec/ectest.c index 6148d553f9..7509cb9c7c 100644 --- a/src/lib/libcrypto/ec/ectest.c +++ b/src/lib/libcrypto/ec/ectest.c | |||
| @@ -432,9 +432,7 @@ void prime_field_tests() | |||
| 432 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | 432 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; |
| 433 | fprintf(stdout, "."); | 433 | fprintf(stdout, "."); |
| 434 | fflush(stdout); | 434 | fflush(stdout); |
| 435 | #if 0 | ||
| 436 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | 435 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; |
| 437 | #endif | ||
| 438 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | 436 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; |
| 439 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | 437 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; |
| 440 | fprintf(stdout, " ok\n"); | 438 | fprintf(stdout, " ok\n"); |
| @@ -478,9 +476,7 @@ void prime_field_tests() | |||
| 478 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | 476 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; |
| 479 | fprintf(stdout, "."); | 477 | fprintf(stdout, "."); |
| 480 | fflush(stdout); | 478 | fflush(stdout); |
| 481 | #if 0 | ||
| 482 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | 479 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; |
| 483 | #endif | ||
| 484 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | 480 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; |
| 485 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | 481 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; |
| 486 | fprintf(stdout, " ok\n"); | 482 | fprintf(stdout, " ok\n"); |
| @@ -525,9 +521,7 @@ void prime_field_tests() | |||
| 525 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | 521 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; |
| 526 | fprintf(stdout, "."); | 522 | fprintf(stdout, "."); |
| 527 | fflush(stdout); | 523 | fflush(stdout); |
| 528 | #if 0 | ||
| 529 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | 524 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; |
| 530 | #endif | ||
| 531 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | 525 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; |
| 532 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | 526 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; |
| 533 | fprintf(stdout, " ok\n"); | 527 | fprintf(stdout, " ok\n"); |
| @@ -577,9 +571,7 @@ void prime_field_tests() | |||
| 577 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | 571 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; |
| 578 | fprintf(stdout, "."); | 572 | fprintf(stdout, "."); |
| 579 | fflush(stdout); | 573 | fflush(stdout); |
| 580 | #if 0 | ||
| 581 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | 574 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; |
| 582 | #endif | ||
| 583 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | 575 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; |
| 584 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | 576 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; |
| 585 | fprintf(stdout, " ok\n"); | 577 | fprintf(stdout, " ok\n"); |
| @@ -635,9 +627,7 @@ void prime_field_tests() | |||
| 635 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | 627 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; |
| 636 | fprintf(stdout, "."); | 628 | fprintf(stdout, "."); |
| 637 | fflush(stdout); | 629 | fflush(stdout); |
| 638 | #if 0 | ||
| 639 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | 630 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; |
| 640 | #endif | ||
| 641 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | 631 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; |
| 642 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | 632 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; |
| 643 | fprintf(stdout, " ok\n"); | 633 | fprintf(stdout, " ok\n"); |
| @@ -809,7 +799,7 @@ void prime_field_tests() | |||
| 809 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; \ | 799 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; \ |
| 810 | fprintf(stdout, "."); \ | 800 | fprintf(stdout, "."); \ |
| 811 | fflush(stdout); \ | 801 | fflush(stdout); \ |
| 812 | /* if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; */ \ | 802 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; \ |
| 813 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; \ | 803 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; \ |
| 814 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; \ | 804 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; \ |
| 815 | fprintf(stdout, " ok\n"); \ | 805 | fprintf(stdout, " ok\n"); \ |
| @@ -1336,7 +1326,7 @@ int main(int argc, char *argv[]) | |||
| 1336 | #endif | 1326 | #endif |
| 1337 | CRYPTO_cleanup_all_ex_data(); | 1327 | CRYPTO_cleanup_all_ex_data(); |
| 1338 | ERR_free_strings(); | 1328 | ERR_free_strings(); |
| 1339 | ERR_remove_state(0); | 1329 | ERR_remove_thread_state(NULL); |
| 1340 | CRYPTO_mem_leaks_fp(stderr); | 1330 | CRYPTO_mem_leaks_fp(stderr); |
| 1341 | 1331 | ||
| 1342 | return 0; | 1332 | return 0; |
diff --git a/src/lib/libcrypto/ecdh/Makefile b/src/lib/libcrypto/ecdh/Makefile index 7a7b618eeb..65d8904ee8 100644 --- a/src/lib/libcrypto/ecdh/Makefile +++ b/src/lib/libcrypto/ecdh/Makefile | |||
| @@ -34,7 +34,7 @@ top: | |||
| 34 | all: lib | 34 | all: lib |
| 35 | 35 | ||
| 36 | lib: $(LIBOBJ) | 36 | lib: $(LIBOBJ) |
| 37 | $(ARX) $(LIB) $(LIBOBJ) | 37 | $(AR) $(LIB) $(LIBOBJ) |
| 38 | $(RANLIB) $(LIB) || echo Never mind. | 38 | $(RANLIB) $(LIB) || echo Never mind. |
| 39 | @touch lib | 39 | @touch lib |
| 40 | 40 | ||
| @@ -88,27 +88,26 @@ ech_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 88 | ech_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.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 | 89 | ech_key.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 90 | ech_key.o: ../../include/openssl/engine.h ../../include/openssl/evp.h | 90 | ech_key.o: ../../include/openssl/engine.h ../../include/openssl/evp.h |
| 91 | ech_key.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 91 | ech_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 92 | ech_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 92 | ech_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 93 | ech_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 93 | ech_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 94 | ech_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 94 | ech_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 95 | ech_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 95 | ech_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 96 | ech_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 96 | ech_key.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 97 | ech_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 97 | ech_key.o: ../../include/openssl/x509_vfy.h ech_key.c ech_locl.h |
| 98 | ech_key.o: ech_key.c ech_locl.h | ||
| 99 | ech_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 98 | ech_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 100 | ech_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 99 | ech_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 101 | ech_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 100 | ech_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 102 | ech_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 101 | ech_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 103 | ech_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 102 | ech_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 104 | ech_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 103 | ech_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 105 | ech_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 104 | ech_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 106 | ech_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 105 | ech_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 107 | ech_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 106 | ech_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 108 | ech_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 107 | ech_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 109 | ech_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 108 | ech_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 110 | ech_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 109 | ech_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 111 | ech_lib.o: ../../include/openssl/x509_vfy.h ech_lib.c ech_locl.h | 110 | ech_lib.o: ech_lib.c ech_locl.h |
| 112 | ech_ossl.o: ../../e_os.h ../../include/openssl/asn1.h | 111 | ech_ossl.o: ../../e_os.h ../../include/openssl/asn1.h |
| 113 | ech_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 112 | ech_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 114 | ech_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 113 | ech_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
diff --git a/src/lib/libcrypto/ecdsa/Makefile b/src/lib/libcrypto/ecdsa/Makefile index 4865f3c8d6..e89e0c010c 100644 --- a/src/lib/libcrypto/ecdsa/Makefile +++ b/src/lib/libcrypto/ecdsa/Makefile | |||
| @@ -34,7 +34,7 @@ top: | |||
| 34 | all: lib | 34 | all: lib |
| 35 | 35 | ||
| 36 | lib: $(LIBOBJ) | 36 | lib: $(LIBOBJ) |
| 37 | $(ARX) $(LIB) $(LIBOBJ) | 37 | $(AR) $(LIB) $(LIBOBJ) |
| 38 | $(RANLIB) $(LIB) || echo Never mind. | 38 | $(RANLIB) $(LIB) || echo Never mind. |
| 39 | @touch lib | 39 | @touch lib |
| 40 | 40 | ||
| @@ -97,14 +97,13 @@ ecs_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | |||
| 97 | ecs_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.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 | 98 | ecs_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 99 | ecs_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 99 | ecs_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 100 | ecs_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 100 | ecs_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 101 | ecs_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 101 | ecs_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 102 | ecs_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 102 | ecs_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 103 | ecs_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 103 | ecs_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 104 | ecs_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 104 | ecs_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 105 | ecs_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 105 | ecs_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 106 | ecs_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 106 | ecs_lib.o: ../../include/openssl/x509_vfy.h ecs_lib.c ecs_locl.h |
| 107 | ecs_lib.o: ecs_lib.c ecs_locl.h | ||
| 108 | ecs_ossl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 107 | ecs_ossl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 109 | ecs_ossl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | 108 | ecs_ossl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h |
| 110 | ecs_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 109 | ecs_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| @@ -119,24 +118,23 @@ ecs_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 119 | ecs_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 118 | ecs_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 120 | ecs_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 119 | ecs_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 121 | ecs_sign.o: ../../include/openssl/engine.h ../../include/openssl/evp.h | 120 | ecs_sign.o: ../../include/openssl/engine.h ../../include/openssl/evp.h |
| 122 | ecs_sign.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 121 | ecs_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 123 | ecs_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 122 | ecs_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 124 | ecs_sign.o: ../../include/openssl/opensslconf.h | ||
| 125 | ecs_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 123 | ecs_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 126 | ecs_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 124 | ecs_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 127 | ecs_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 125 | ecs_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 128 | ecs_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 126 | ecs_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 129 | ecs_sign.o: ../../include/openssl/x509_vfy.h ecs_locl.h ecs_sign.c | 127 | ecs_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 128 | ecs_sign.o: ecs_locl.h ecs_sign.c | ||
| 130 | ecs_vrf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 129 | ecs_vrf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 131 | ecs_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 130 | ecs_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 132 | ecs_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 131 | ecs_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 133 | ecs_vrf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 132 | ecs_vrf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 134 | ecs_vrf.o: ../../include/openssl/engine.h ../../include/openssl/evp.h | 133 | ecs_vrf.o: ../../include/openssl/engine.h ../../include/openssl/evp.h |
| 135 | ecs_vrf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 134 | ecs_vrf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 136 | ecs_vrf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 135 | ecs_vrf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 137 | ecs_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 136 | ecs_vrf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 138 | ecs_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 137 | ecs_vrf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 139 | ecs_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 138 | ecs_vrf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 140 | ecs_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 139 | ecs_vrf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 141 | ecs_vrf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 140 | ecs_vrf.o: ../../include/openssl/x509_vfy.h ecs_locl.h ecs_vrf.c |
| 142 | ecs_vrf.o: ecs_locl.h ecs_vrf.c | ||
diff --git a/src/lib/libcrypto/engine/Makefile b/src/lib/libcrypto/engine/Makefile index 0736153075..9c214824eb 100644 --- a/src/lib/libcrypto/engine/Makefile +++ b/src/lib/libcrypto/engine/Makefile | |||
| @@ -20,15 +20,13 @@ LIB=$(TOP)/libcrypto.a | |||
| 20 | LIBSRC= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c \ | 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 \ | 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 \ | 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 \ | 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 eng_padlock.c \ | 24 | eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c |
| 25 | eng_aesni.c | ||
| 26 | LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \ | 25 | LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \ |
| 27 | eng_table.o eng_pkey.o eng_fat.o eng_all.o \ | 26 | eng_table.o eng_pkey.o eng_fat.o eng_all.o \ |
| 28 | tb_rsa.o tb_dsa.o tb_ecdsa.o tb_dh.o tb_ecdh.o tb_rand.o tb_store.o \ | 27 | tb_rsa.o tb_dsa.o tb_ecdsa.o tb_dh.o tb_ecdh.o tb_rand.o tb_store.o \ |
| 29 | tb_cipher.o tb_digest.o \ | 28 | tb_cipher.o tb_digest.o tb_pkmeth.o tb_asnmth.o \ |
| 30 | eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o eng_padlock.o \ | 29 | eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o |
| 31 | eng_aesni.o | ||
| 32 | 30 | ||
| 33 | SRC= $(LIBSRC) | 31 | SRC= $(LIBSRC) |
| 34 | 32 | ||
| @@ -43,7 +41,7 @@ top: | |||
| 43 | all: lib | 41 | all: lib |
| 44 | 42 | ||
| 45 | lib: $(LIBOBJ) | 43 | lib: $(LIBOBJ) |
| 46 | $(ARX) $(LIB) $(LIBOBJ) | 44 | $(AR) $(LIB) $(LIBOBJ) |
| 47 | $(RANLIB) $(LIB) || echo Never mind. | 45 | $(RANLIB) $(LIB) || echo Never mind. |
| 48 | @touch lib | 46 | @touch lib |
| 49 | 47 | ||
| @@ -84,56 +82,40 @@ clean: | |||
| 84 | 82 | ||
| 85 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 83 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 86 | 84 | ||
| 87 | eng_aesni.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 88 | eng_aesni.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 89 | eng_aesni.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 90 | eng_aesni.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 91 | eng_aesni.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 92 | eng_aesni.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 93 | eng_aesni.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 94 | eng_aesni.o: ../../include/openssl/lhash.h ../../include/openssl/modes.h | ||
| 95 | eng_aesni.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 96 | eng_aesni.o: ../../include/openssl/opensslconf.h | ||
| 97 | eng_aesni.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 98 | eng_aesni.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 99 | eng_aesni.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 100 | eng_aesni.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 101 | eng_aesni.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_aesni.c | ||
| 102 | eng_all.o: ../../e_os.h ../../include/openssl/asn1.h | 85 | eng_all.o: ../../e_os.h ../../include/openssl/asn1.h |
| 103 | eng_all.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 86 | eng_all.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 104 | eng_all.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 87 | eng_all.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 105 | eng_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 88 | eng_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 106 | eng_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 89 | eng_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 107 | eng_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 90 | eng_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 108 | eng_all.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 91 | eng_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 109 | eng_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 92 | eng_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 110 | eng_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 93 | eng_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 111 | eng_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 94 | eng_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 112 | eng_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 95 | eng_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 113 | eng_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 96 | eng_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 114 | eng_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 97 | eng_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_all.c eng_int.h |
| 115 | eng_all.o: ../cryptlib.h eng_all.c eng_int.h | ||
| 116 | eng_cnf.o: ../../e_os.h ../../include/openssl/asn1.h | 98 | eng_cnf.o: ../../e_os.h ../../include/openssl/asn1.h |
| 117 | eng_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 99 | eng_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 118 | eng_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | 100 | eng_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h |
| 119 | eng_cnf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 101 | eng_cnf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 120 | eng_cnf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 102 | eng_cnf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 121 | eng_cnf.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 103 | eng_cnf.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 122 | eng_cnf.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 104 | eng_cnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 123 | eng_cnf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 105 | eng_cnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 124 | eng_cnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 106 | eng_cnf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 125 | eng_cnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 107 | eng_cnf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 126 | eng_cnf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 108 | eng_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 127 | eng_cnf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 109 | eng_cnf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 128 | eng_cnf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 110 | eng_cnf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 129 | eng_cnf.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_cnf.c eng_int.h | 111 | eng_cnf.o: ../cryptlib.h eng_cnf.c eng_int.h |
| 130 | eng_cryptodev.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 112 | eng_cryptodev.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 131 | eng_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | 113 | eng_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h |
| 132 | eng_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 114 | eng_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 133 | eng_cryptodev.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 115 | eng_cryptodev.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 134 | eng_cryptodev.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 116 | eng_cryptodev.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 135 | eng_cryptodev.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 117 | eng_cryptodev.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 136 | eng_cryptodev.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 118 | eng_cryptodev.o: ../../include/openssl/obj_mac.h |
| 137 | eng_cryptodev.o: ../../include/openssl/objects.h | 119 | eng_cryptodev.o: ../../include/openssl/objects.h |
| 138 | eng_cryptodev.o: ../../include/openssl/opensslconf.h | 120 | eng_cryptodev.o: ../../include/openssl/opensslconf.h |
| 139 | eng_cryptodev.o: ../../include/openssl/opensslv.h | 121 | eng_cryptodev.o: ../../include/openssl/opensslv.h |
| @@ -148,9 +130,8 @@ eng_ctrl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | |||
| 148 | eng_ctrl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 130 | eng_ctrl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 149 | eng_ctrl.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 131 | eng_ctrl.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 150 | eng_ctrl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 132 | eng_ctrl.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 151 | eng_ctrl.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 133 | eng_ctrl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 152 | eng_ctrl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 134 | eng_ctrl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 153 | eng_ctrl.o: ../../include/openssl/opensslconf.h | ||
| 154 | eng_ctrl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 135 | eng_ctrl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 155 | eng_ctrl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 136 | eng_ctrl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 156 | eng_ctrl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 137 | eng_ctrl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| @@ -162,50 +143,49 @@ eng_dyn.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h | |||
| 162 | eng_dyn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 143 | eng_dyn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 163 | eng_dyn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 144 | eng_dyn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 164 | eng_dyn.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 145 | eng_dyn.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 165 | eng_dyn.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 146 | eng_dyn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 166 | eng_dyn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 147 | eng_dyn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 167 | eng_dyn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 148 | eng_dyn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 168 | eng_dyn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 149 | eng_dyn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 169 | eng_dyn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 150 | eng_dyn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 170 | eng_dyn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 151 | eng_dyn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 171 | eng_dyn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 152 | eng_dyn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 172 | eng_dyn.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_dyn.c eng_int.h | 153 | eng_dyn.o: ../cryptlib.h eng_dyn.c eng_int.h |
| 173 | eng_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 154 | eng_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 174 | eng_err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 155 | eng_err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 175 | eng_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 156 | eng_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 176 | eng_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 157 | eng_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 177 | eng_err.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 158 | eng_err.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 178 | eng_err.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 159 | eng_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 179 | eng_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 160 | eng_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 180 | eng_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 161 | eng_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 181 | eng_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 162 | eng_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 182 | eng_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 163 | eng_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 183 | eng_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 164 | eng_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 184 | eng_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 165 | eng_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 185 | eng_err.o: ../../include/openssl/x509_vfy.h eng_err.c | 166 | eng_err.o: eng_err.c |
| 186 | eng_fat.o: ../../e_os.h ../../include/openssl/asn1.h | 167 | eng_fat.o: ../../e_os.h ../../include/openssl/asn1.h |
| 187 | eng_fat.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 168 | eng_fat.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 188 | eng_fat.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | 169 | eng_fat.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h |
| 189 | eng_fat.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 170 | eng_fat.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 190 | eng_fat.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 171 | eng_fat.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 191 | eng_fat.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 172 | eng_fat.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 192 | eng_fat.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 173 | eng_fat.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 193 | eng_fat.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 174 | eng_fat.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 194 | eng_fat.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 175 | eng_fat.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 195 | eng_fat.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 176 | eng_fat.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 196 | eng_fat.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 177 | eng_fat.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 197 | eng_fat.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 178 | eng_fat.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 198 | eng_fat.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 179 | eng_fat.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 199 | eng_fat.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_fat.c eng_int.h | 180 | eng_fat.o: ../cryptlib.h eng_fat.c eng_int.h |
| 200 | eng_init.o: ../../e_os.h ../../include/openssl/asn1.h | 181 | eng_init.o: ../../e_os.h ../../include/openssl/asn1.h |
| 201 | eng_init.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 182 | eng_init.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 202 | eng_init.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 183 | eng_init.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 203 | eng_init.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 184 | eng_init.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 204 | eng_init.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 185 | eng_init.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 205 | eng_init.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 186 | eng_init.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 206 | eng_init.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 187 | eng_init.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 207 | eng_init.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 188 | eng_init.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 208 | eng_init.o: ../../include/openssl/opensslconf.h | ||
| 209 | eng_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 189 | eng_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 210 | eng_init.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 190 | eng_init.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 211 | eng_init.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 191 | eng_init.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| @@ -217,23 +197,22 @@ eng_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | |||
| 217 | eng_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 197 | eng_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 218 | eng_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 198 | eng_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 219 | eng_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 199 | eng_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 220 | eng_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 200 | eng_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 221 | eng_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 201 | eng_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 222 | eng_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 202 | eng_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 223 | eng_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 203 | eng_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 224 | eng_lib.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 204 | eng_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 225 | eng_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 205 | eng_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 226 | eng_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 206 | eng_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 227 | eng_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h eng_lib.c | 207 | eng_lib.o: ../cryptlib.h eng_int.h eng_lib.c |
| 228 | eng_list.o: ../../e_os.h ../../include/openssl/asn1.h | 208 | eng_list.o: ../../e_os.h ../../include/openssl/asn1.h |
| 229 | eng_list.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 209 | eng_list.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 230 | eng_list.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 210 | eng_list.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 231 | eng_list.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 211 | eng_list.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 232 | eng_list.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 212 | eng_list.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 233 | eng_list.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 213 | eng_list.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 234 | eng_list.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 214 | eng_list.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 235 | eng_list.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 215 | eng_list.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 236 | eng_list.o: ../../include/openssl/opensslconf.h | ||
| 237 | eng_list.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 216 | eng_list.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 238 | eng_list.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 217 | eng_list.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 239 | eng_list.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 218 | eng_list.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| @@ -246,9 +225,8 @@ eng_openssl.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h | |||
| 246 | eng_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 225 | eng_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 247 | eng_openssl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 226 | eng_openssl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 248 | eng_openssl.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 227 | eng_openssl.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 249 | eng_openssl.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 228 | eng_openssl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 250 | eng_openssl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 229 | eng_openssl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 251 | eng_openssl.o: ../../include/openssl/objects.h | ||
| 252 | eng_openssl.o: ../../include/openssl/opensslconf.h | 230 | eng_openssl.o: ../../include/openssl/opensslconf.h |
| 253 | eng_openssl.o: ../../include/openssl/opensslv.h | 231 | eng_openssl.o: ../../include/openssl/opensslv.h |
| 254 | eng_openssl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | 232 | eng_openssl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h |
| @@ -258,31 +236,14 @@ eng_openssl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | |||
| 258 | eng_openssl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 236 | eng_openssl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 259 | eng_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 237 | eng_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 260 | eng_openssl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_openssl.c | 238 | eng_openssl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_openssl.c |
| 261 | eng_padlock.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 262 | eng_padlock.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 263 | eng_padlock.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h | ||
| 264 | eng_padlock.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 265 | eng_padlock.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 266 | eng_padlock.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 267 | eng_padlock.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | ||
| 268 | eng_padlock.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 269 | eng_padlock.o: ../../include/openssl/objects.h | ||
| 270 | eng_padlock.o: ../../include/openssl/opensslconf.h | ||
| 271 | eng_padlock.o: ../../include/openssl/opensslv.h | ||
| 272 | eng_padlock.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 273 | eng_padlock.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 274 | eng_padlock.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 275 | eng_padlock.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 276 | eng_padlock.o: ../../include/openssl/x509_vfy.h eng_padlock.c | ||
| 277 | eng_pkey.o: ../../e_os.h ../../include/openssl/asn1.h | 239 | eng_pkey.o: ../../e_os.h ../../include/openssl/asn1.h |
| 278 | eng_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 240 | eng_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 279 | eng_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 241 | eng_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 280 | eng_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 242 | eng_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 281 | eng_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 243 | eng_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 282 | eng_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 244 | eng_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 283 | eng_pkey.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 245 | eng_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 284 | eng_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 246 | eng_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 285 | eng_pkey.o: ../../include/openssl/opensslconf.h | ||
| 286 | eng_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 247 | eng_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 287 | eng_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 248 | eng_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 288 | eng_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 249 | eng_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| @@ -294,8 +255,8 @@ eng_table.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | |||
| 294 | eng_table.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 255 | eng_table.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 295 | eng_table.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 256 | eng_table.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 296 | eng_table.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 257 | eng_table.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 297 | eng_table.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 258 | eng_table.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 298 | eng_table.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 259 | eng_table.o: ../../include/openssl/objects.h |
| 299 | eng_table.o: ../../include/openssl/opensslconf.h | 260 | eng_table.o: ../../include/openssl/opensslconf.h |
| 300 | eng_table.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 261 | eng_table.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 301 | eng_table.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 262 | eng_table.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| @@ -303,14 +264,29 @@ eng_table.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | |||
| 303 | eng_table.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 264 | eng_table.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 304 | eng_table.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h | 265 | eng_table.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h |
| 305 | eng_table.o: eng_table.c | 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 | ||
| 306 | tb_cipher.o: ../../e_os.h ../../include/openssl/asn1.h | 282 | tb_cipher.o: ../../e_os.h ../../include/openssl/asn1.h |
| 307 | tb_cipher.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 283 | tb_cipher.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 308 | tb_cipher.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 284 | tb_cipher.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 309 | tb_cipher.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 285 | tb_cipher.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 310 | tb_cipher.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 286 | tb_cipher.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 311 | tb_cipher.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 287 | tb_cipher.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 312 | tb_cipher.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 288 | tb_cipher.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 313 | tb_cipher.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 289 | tb_cipher.o: ../../include/openssl/objects.h |
| 314 | tb_cipher.o: ../../include/openssl/opensslconf.h | 290 | tb_cipher.o: ../../include/openssl/opensslconf.h |
| 315 | tb_cipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 291 | tb_cipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 316 | tb_cipher.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 292 | tb_cipher.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| @@ -323,22 +299,22 @@ tb_dh.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 323 | tb_dh.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 299 | tb_dh.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 324 | tb_dh.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 300 | tb_dh.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 325 | tb_dh.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 301 | tb_dh.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 326 | tb_dh.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 302 | tb_dh.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 327 | tb_dh.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 303 | tb_dh.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 328 | tb_dh.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 304 | tb_dh.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 329 | tb_dh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 305 | tb_dh.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 330 | tb_dh.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 306 | tb_dh.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 331 | tb_dh.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 307 | tb_dh.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 332 | tb_dh.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 308 | tb_dh.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 333 | tb_dh.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_dh.c | 309 | tb_dh.o: ../cryptlib.h eng_int.h tb_dh.c |
| 334 | tb_digest.o: ../../e_os.h ../../include/openssl/asn1.h | 310 | tb_digest.o: ../../e_os.h ../../include/openssl/asn1.h |
| 335 | tb_digest.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 311 | tb_digest.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 336 | tb_digest.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 312 | tb_digest.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 337 | tb_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 313 | tb_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 338 | tb_digest.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 314 | tb_digest.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 339 | tb_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 315 | tb_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 340 | tb_digest.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 316 | tb_digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 341 | tb_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 317 | tb_digest.o: ../../include/openssl/objects.h |
| 342 | tb_digest.o: ../../include/openssl/opensslconf.h | 318 | tb_digest.o: ../../include/openssl/opensslconf.h |
| 343 | tb_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 319 | tb_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 344 | tb_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 320 | tb_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| @@ -351,78 +327,89 @@ tb_dsa.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 351 | tb_dsa.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 327 | tb_dsa.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 352 | tb_dsa.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 328 | tb_dsa.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 353 | tb_dsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 329 | tb_dsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 354 | tb_dsa.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 330 | tb_dsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 355 | tb_dsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 331 | tb_dsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 356 | tb_dsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 332 | tb_dsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 357 | tb_dsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 333 | tb_dsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 358 | tb_dsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 334 | tb_dsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 359 | tb_dsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 335 | tb_dsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 360 | tb_dsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 336 | tb_dsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 361 | tb_dsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_dsa.c | 337 | tb_dsa.o: ../cryptlib.h eng_int.h tb_dsa.c |
| 362 | tb_ecdh.o: ../../e_os.h ../../include/openssl/asn1.h | 338 | tb_ecdh.o: ../../e_os.h ../../include/openssl/asn1.h |
| 363 | tb_ecdh.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 339 | tb_ecdh.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 364 | tb_ecdh.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 340 | tb_ecdh.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 365 | tb_ecdh.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 341 | tb_ecdh.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 366 | tb_ecdh.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 342 | tb_ecdh.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 367 | tb_ecdh.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 343 | tb_ecdh.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 368 | tb_ecdh.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 344 | tb_ecdh.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 369 | tb_ecdh.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 345 | tb_ecdh.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 370 | tb_ecdh.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 346 | tb_ecdh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 371 | tb_ecdh.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 347 | tb_ecdh.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 372 | tb_ecdh.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 348 | tb_ecdh.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 373 | tb_ecdh.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 349 | tb_ecdh.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 374 | tb_ecdh.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 350 | tb_ecdh.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_ecdh.c |
| 375 | tb_ecdh.o: ../cryptlib.h eng_int.h tb_ecdh.c | ||
| 376 | tb_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h | 351 | tb_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h |
| 377 | tb_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 352 | tb_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 378 | tb_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 353 | tb_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 379 | tb_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 354 | tb_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 380 | tb_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 355 | tb_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 381 | tb_ecdsa.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 356 | tb_ecdsa.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 382 | tb_ecdsa.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 357 | tb_ecdsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 383 | tb_ecdsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 358 | tb_ecdsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 384 | tb_ecdsa.o: ../../include/openssl/opensslconf.h | ||
| 385 | tb_ecdsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 359 | tb_ecdsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 386 | tb_ecdsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 360 | tb_ecdsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 387 | tb_ecdsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 361 | tb_ecdsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 388 | tb_ecdsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 362 | tb_ecdsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 389 | tb_ecdsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_ecdsa.c | 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 | ||
| 390 | tb_rand.o: ../../e_os.h ../../include/openssl/asn1.h | 379 | tb_rand.o: ../../e_os.h ../../include/openssl/asn1.h |
| 391 | tb_rand.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 380 | tb_rand.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 392 | tb_rand.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 381 | tb_rand.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 393 | tb_rand.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 382 | tb_rand.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 394 | tb_rand.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 383 | tb_rand.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 395 | tb_rand.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 384 | tb_rand.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 396 | tb_rand.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 385 | tb_rand.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 397 | tb_rand.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 386 | tb_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 398 | tb_rand.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 387 | tb_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 399 | tb_rand.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 388 | tb_rand.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 400 | tb_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 389 | tb_rand.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 401 | tb_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 390 | tb_rand.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 402 | tb_rand.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 391 | tb_rand.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_rand.c |
| 403 | tb_rand.o: ../cryptlib.h eng_int.h tb_rand.c | ||
| 404 | tb_rsa.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 392 | tb_rsa.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 405 | tb_rsa.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 393 | tb_rsa.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 406 | tb_rsa.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 394 | tb_rsa.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 407 | tb_rsa.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 395 | tb_rsa.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 408 | tb_rsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 396 | tb_rsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 409 | tb_rsa.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 397 | tb_rsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 410 | tb_rsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 398 | tb_rsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 411 | tb_rsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 399 | tb_rsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 412 | tb_rsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 400 | tb_rsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 413 | tb_rsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 401 | tb_rsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 414 | tb_rsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 402 | tb_rsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 415 | tb_rsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 403 | tb_rsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 416 | tb_rsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_rsa.c | 404 | tb_rsa.o: ../cryptlib.h eng_int.h tb_rsa.c |
| 417 | tb_store.o: ../../e_os.h ../../include/openssl/asn1.h | 405 | tb_store.o: ../../e_os.h ../../include/openssl/asn1.h |
| 418 | tb_store.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 406 | tb_store.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 419 | tb_store.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 407 | tb_store.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 420 | tb_store.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 408 | tb_store.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 421 | tb_store.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 409 | tb_store.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 422 | tb_store.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 410 | tb_store.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 423 | tb_store.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 411 | tb_store.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 424 | tb_store.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 412 | tb_store.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 425 | tb_store.o: ../../include/openssl/opensslconf.h | ||
| 426 | tb_store.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 413 | tb_store.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 427 | tb_store.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 414 | tb_store.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 428 | tb_store.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 415 | tb_store.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
diff --git a/src/lib/libcrypto/engine/Makefile.ssl b/src/lib/libcrypto/engine/Makefile.ssl deleted file mode 100644 index 30a4446ff9..0000000000 --- a/src/lib/libcrypto/engine/Makefile.ssl +++ /dev/null | |||
| @@ -1,538 +0,0 @@ | |||
| 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 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= enginetest.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c \ | ||
| 27 | eng_table.c eng_pkey.c eng_fat.c eng_all.c \ | ||
| 28 | tb_rsa.c tb_dsa.c tb_dh.c tb_rand.c tb_cipher.c tb_digest.c \ | ||
| 29 | eng_openssl.c eng_dyn.c eng_cnf.c \ | ||
| 30 | hw_atalla.c hw_cswift.c hw_ncipher.c hw_nuron.c hw_ubsec.c \ | ||
| 31 | hw_cryptodev.c hw_aep.c hw_sureware.c hw_4758_cca.c | ||
| 32 | LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \ | ||
| 33 | eng_table.o eng_pkey.o eng_fat.o eng_all.o \ | ||
| 34 | tb_rsa.o tb_dsa.o tb_dh.o tb_rand.o tb_cipher.o tb_digest.o \ | ||
| 35 | eng_openssl.o eng_dyn.o eng_cnf.o \ | ||
| 36 | hw_atalla.o hw_cswift.o hw_ncipher.o hw_nuron.o hw_ubsec.o \ | ||
| 37 | hw_cryptodev.o hw_aep.o hw_sureware.o hw_4758_cca.o | ||
| 38 | |||
| 39 | SRC= $(LIBSRC) | ||
| 40 | |||
| 41 | EXHEADER= engine.h | ||
| 42 | HEADER= $(EXHEADER) | ||
| 43 | |||
| 44 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 45 | |||
| 46 | top: | ||
| 47 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 48 | |||
| 49 | all: lib | ||
| 50 | |||
| 51 | lib: $(LIBOBJ) | ||
| 52 | $(AR) $(LIB) $(LIBOBJ) | ||
| 53 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 54 | @touch lib | ||
| 55 | |||
| 56 | files: | ||
| 57 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 58 | |||
| 59 | links: | ||
| 60 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 61 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 62 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 63 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 64 | |||
| 65 | install: | ||
| 66 | @for i in $(EXHEADER) ; \ | ||
| 67 | do \ | ||
| 68 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 69 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 70 | done; | ||
| 71 | |||
| 72 | tags: | ||
| 73 | ctags $(SRC) | ||
| 74 | |||
| 75 | errors: | ||
| 76 | $(PERL) $(TOP)/util/mkerr.pl -conf hw.ec \ | ||
| 77 | -nostatic -staticloader -write hw_*.c | ||
| 78 | |||
| 79 | tests: | ||
| 80 | |||
| 81 | lint: | ||
| 82 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 83 | |||
| 84 | depend: | ||
| 85 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 86 | |||
| 87 | dclean: | ||
| 88 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 89 | mv -f Makefile.new $(MAKEFILE) | ||
| 90 | |||
| 91 | clean: | ||
| 92 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 93 | |||
| 94 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 95 | |||
| 96 | eng_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 97 | eng_all.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 98 | eng_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 99 | eng_all.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 100 | eng_all.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 101 | eng_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 102 | eng_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 103 | eng_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 104 | eng_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 105 | eng_all.o: ../../include/openssl/ui.h eng_all.c eng_int.h | ||
| 106 | eng_cnf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 107 | eng_cnf.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 108 | eng_cnf.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 109 | eng_cnf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 110 | eng_cnf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 111 | eng_cnf.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 112 | eng_cnf.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 113 | eng_cnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 114 | eng_cnf.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 115 | eng_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 116 | eng_cnf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 117 | eng_cnf.o: ../cryptlib.h eng_cnf.c | ||
| 118 | eng_ctrl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 119 | eng_ctrl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 120 | eng_ctrl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 121 | eng_ctrl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 122 | eng_ctrl.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 123 | eng_ctrl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 124 | eng_ctrl.o: ../../include/openssl/opensslconf.h | ||
| 125 | eng_ctrl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 126 | eng_ctrl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 127 | eng_ctrl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 128 | eng_ctrl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 129 | eng_ctrl.o: ../cryptlib.h eng_ctrl.c eng_int.h | ||
| 130 | eng_dyn.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 131 | eng_dyn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 132 | eng_dyn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 133 | eng_dyn.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 134 | eng_dyn.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 135 | eng_dyn.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 136 | eng_dyn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 137 | eng_dyn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 138 | eng_dyn.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 139 | eng_dyn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 140 | eng_dyn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 141 | eng_dyn.o: ../cryptlib.h eng_dyn.c eng_int.h | ||
| 142 | eng_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 143 | eng_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 144 | eng_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 145 | eng_err.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 146 | eng_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 147 | eng_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 148 | eng_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 149 | eng_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 150 | eng_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 151 | eng_err.o: ../../include/openssl/ui.h eng_err.c | ||
| 152 | eng_fat.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 153 | eng_fat.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 154 | eng_fat.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 155 | eng_fat.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 156 | eng_fat.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 157 | eng_fat.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 158 | eng_fat.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 159 | eng_fat.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 160 | eng_fat.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 161 | eng_fat.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 162 | eng_fat.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 163 | eng_fat.o: ../cryptlib.h eng_fat.c eng_int.h | ||
| 164 | eng_init.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 165 | eng_init.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 166 | eng_init.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 167 | eng_init.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 168 | eng_init.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 169 | eng_init.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 170 | eng_init.o: ../../include/openssl/opensslconf.h | ||
| 171 | eng_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 172 | eng_init.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 173 | eng_init.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 174 | eng_init.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 175 | eng_init.o: ../cryptlib.h eng_init.c eng_int.h | ||
| 176 | eng_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 177 | eng_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 178 | eng_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 179 | eng_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 180 | eng_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 181 | eng_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 182 | eng_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 183 | eng_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 184 | eng_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 185 | eng_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 186 | eng_lib.o: ../../include/openssl/ui.h ../cryptlib.h eng_int.h eng_lib.c | ||
| 187 | eng_list.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 188 | eng_list.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 189 | eng_list.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 190 | eng_list.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 191 | eng_list.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 192 | eng_list.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 193 | eng_list.o: ../../include/openssl/opensslconf.h | ||
| 194 | eng_list.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 195 | eng_list.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 196 | eng_list.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 197 | eng_list.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 198 | eng_list.o: ../cryptlib.h eng_int.h eng_list.c | ||
| 199 | eng_openssl.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 200 | eng_openssl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 201 | eng_openssl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 202 | eng_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 203 | eng_openssl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 204 | eng_openssl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 205 | eng_openssl.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h | ||
| 206 | eng_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 207 | eng_openssl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 208 | eng_openssl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 209 | eng_openssl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 210 | eng_openssl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 211 | eng_openssl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 212 | eng_openssl.o: ../../include/openssl/opensslconf.h | ||
| 213 | eng_openssl.o: ../../include/openssl/opensslv.h | ||
| 214 | eng_openssl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 215 | eng_openssl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 216 | eng_openssl.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 217 | eng_openssl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 218 | eng_openssl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 219 | eng_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 220 | eng_openssl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 221 | eng_openssl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 222 | eng_openssl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 223 | eng_openssl.o: ../cryptlib.h eng_openssl.c | ||
| 224 | eng_pkey.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 225 | eng_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 226 | eng_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 227 | eng_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 228 | eng_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 229 | eng_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 230 | eng_pkey.o: ../../include/openssl/opensslconf.h | ||
| 231 | eng_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 232 | eng_pkey.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 233 | eng_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 234 | eng_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 235 | eng_pkey.o: ../cryptlib.h eng_int.h eng_pkey.c | ||
| 236 | eng_table.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 237 | eng_table.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 238 | eng_table.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 239 | eng_table.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 240 | eng_table.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 241 | eng_table.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 242 | eng_table.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 243 | eng_table.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 244 | eng_table.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 245 | eng_table.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 246 | eng_table.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 247 | eng_table.o: ../../include/openssl/objects.h | ||
| 248 | eng_table.o: ../../include/openssl/opensslconf.h | ||
| 249 | eng_table.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 250 | eng_table.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 251 | eng_table.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 252 | eng_table.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 253 | eng_table.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 254 | eng_table.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 255 | eng_table.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 256 | eng_table.o: eng_int.h eng_table.c | ||
| 257 | hw_4758_cca.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 258 | hw_4758_cca.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 259 | hw_4758_cca.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 260 | hw_4758_cca.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 261 | hw_4758_cca.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 262 | hw_4758_cca.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 263 | hw_4758_cca.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h | ||
| 264 | hw_4758_cca.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 265 | hw_4758_cca.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 266 | hw_4758_cca.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 267 | hw_4758_cca.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 268 | hw_4758_cca.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 269 | hw_4758_cca.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 270 | hw_4758_cca.o: ../../include/openssl/opensslconf.h | ||
| 271 | hw_4758_cca.o: ../../include/openssl/opensslv.h | ||
| 272 | hw_4758_cca.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 273 | hw_4758_cca.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 274 | hw_4758_cca.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 275 | hw_4758_cca.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 276 | hw_4758_cca.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 277 | hw_4758_cca.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 278 | hw_4758_cca.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 279 | hw_4758_cca.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 280 | hw_4758_cca.o: ../cryptlib.h hw_4758_cca.c hw_4758_cca_err.c hw_4758_cca_err.h | ||
| 281 | hw_4758_cca.o: vendor_defns/hw_4758_cca.h | ||
| 282 | hw_aep.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 283 | hw_aep.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 284 | hw_aep.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 285 | hw_aep.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h | ||
| 286 | hw_aep.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 287 | hw_aep.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 288 | hw_aep.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 289 | hw_aep.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 290 | hw_aep.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 291 | hw_aep.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 292 | hw_aep.o: ../../include/openssl/ui.h hw_aep.c hw_aep_err.c hw_aep_err.h | ||
| 293 | hw_aep.o: vendor_defns/aep.h | ||
| 294 | hw_atalla.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 295 | hw_atalla.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 296 | hw_atalla.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 297 | hw_atalla.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 298 | hw_atalla.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 299 | hw_atalla.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 300 | hw_atalla.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 301 | hw_atalla.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 302 | hw_atalla.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 303 | hw_atalla.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 304 | hw_atalla.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 305 | hw_atalla.o: ../cryptlib.h hw_atalla.c hw_atalla_err.c hw_atalla_err.h | ||
| 306 | hw_atalla.o: vendor_defns/atalla.h | ||
| 307 | hw_cryptodev.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 308 | hw_cryptodev.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 309 | hw_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 310 | hw_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 311 | hw_cryptodev.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 312 | hw_cryptodev.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 313 | hw_cryptodev.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 314 | hw_cryptodev.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 315 | hw_cryptodev.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 316 | hw_cryptodev.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 317 | hw_cryptodev.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 318 | hw_cryptodev.o: ../../include/openssl/objects.h | ||
| 319 | hw_cryptodev.o: ../../include/openssl/opensslconf.h | ||
| 320 | hw_cryptodev.o: ../../include/openssl/opensslv.h | ||
| 321 | hw_cryptodev.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 322 | hw_cryptodev.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 323 | hw_cryptodev.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 324 | hw_cryptodev.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 325 | hw_cryptodev.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 326 | hw_cryptodev.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 327 | hw_cryptodev.o: ../../include/openssl/ui_compat.h hw_cryptodev.c | ||
| 328 | hw_cswift.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 329 | hw_cswift.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 330 | hw_cswift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 331 | hw_cswift.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 332 | hw_cswift.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 333 | hw_cswift.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 334 | hw_cswift.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 335 | hw_cswift.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 336 | hw_cswift.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 337 | hw_cswift.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 338 | hw_cswift.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 339 | hw_cswift.o: ../cryptlib.h hw_cswift.c hw_cswift_err.c hw_cswift_err.h | ||
| 340 | hw_cswift.o: vendor_defns/cswift.h | ||
| 341 | hw_ncipher.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 342 | hw_ncipher.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 343 | hw_ncipher.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 344 | hw_ncipher.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 345 | hw_ncipher.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 346 | hw_ncipher.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 347 | hw_ncipher.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h | ||
| 348 | hw_ncipher.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 349 | hw_ncipher.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 350 | hw_ncipher.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 351 | hw_ncipher.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 352 | hw_ncipher.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 353 | hw_ncipher.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 354 | hw_ncipher.o: ../../include/openssl/opensslconf.h | ||
| 355 | hw_ncipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 356 | hw_ncipher.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 357 | hw_ncipher.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 358 | hw_ncipher.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 359 | hw_ncipher.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 360 | hw_ncipher.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 361 | hw_ncipher.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 362 | hw_ncipher.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 363 | hw_ncipher.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 364 | hw_ncipher.o: ../../include/openssl/x509_vfy.h ../cryptlib.h hw_ncipher.c | ||
| 365 | hw_ncipher.o: hw_ncipher_err.c hw_ncipher_err.h vendor_defns/hwcryptohook.h | ||
| 366 | hw_nuron.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 367 | hw_nuron.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 368 | hw_nuron.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 369 | hw_nuron.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 370 | hw_nuron.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 371 | hw_nuron.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 372 | hw_nuron.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 373 | hw_nuron.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 374 | hw_nuron.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 375 | hw_nuron.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 376 | hw_nuron.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 377 | hw_nuron.o: ../cryptlib.h hw_nuron.c hw_nuron_err.c hw_nuron_err.h | ||
| 378 | hw_sureware.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 379 | hw_sureware.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 380 | hw_sureware.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 381 | hw_sureware.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 382 | hw_sureware.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 383 | hw_sureware.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 384 | hw_sureware.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h | ||
| 385 | hw_sureware.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 386 | hw_sureware.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 387 | hw_sureware.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 388 | hw_sureware.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 389 | hw_sureware.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 390 | hw_sureware.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 391 | hw_sureware.o: ../../include/openssl/opensslconf.h | ||
| 392 | hw_sureware.o: ../../include/openssl/opensslv.h | ||
| 393 | hw_sureware.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 394 | hw_sureware.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 395 | hw_sureware.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 396 | hw_sureware.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 397 | hw_sureware.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 398 | hw_sureware.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 399 | hw_sureware.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 400 | hw_sureware.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 401 | hw_sureware.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 402 | hw_sureware.o: ../cryptlib.h eng_int.h engine.h hw_sureware.c hw_sureware_err.c | ||
| 403 | hw_sureware.o: hw_sureware_err.h vendor_defns/sureware.h | ||
| 404 | hw_ubsec.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 405 | hw_ubsec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 406 | hw_ubsec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 407 | hw_ubsec.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 408 | hw_ubsec.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 409 | hw_ubsec.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 410 | hw_ubsec.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 411 | hw_ubsec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 412 | hw_ubsec.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 413 | hw_ubsec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 414 | hw_ubsec.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 415 | hw_ubsec.o: ../cryptlib.h hw_ubsec.c hw_ubsec_err.c hw_ubsec_err.h | ||
| 416 | hw_ubsec.o: vendor_defns/hw_ubsec.h | ||
| 417 | tb_cipher.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 418 | tb_cipher.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 419 | tb_cipher.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 420 | tb_cipher.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 421 | tb_cipher.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 422 | tb_cipher.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 423 | tb_cipher.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 424 | tb_cipher.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 425 | tb_cipher.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 426 | tb_cipher.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 427 | tb_cipher.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 428 | tb_cipher.o: ../../include/openssl/objects.h | ||
| 429 | tb_cipher.o: ../../include/openssl/opensslconf.h | ||
| 430 | tb_cipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 431 | tb_cipher.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 432 | tb_cipher.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 433 | tb_cipher.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 434 | tb_cipher.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 435 | tb_cipher.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 436 | tb_cipher.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 437 | tb_cipher.o: eng_int.h tb_cipher.c | ||
| 438 | tb_dh.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 439 | tb_dh.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 440 | tb_dh.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 441 | tb_dh.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 442 | tb_dh.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 443 | tb_dh.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 444 | tb_dh.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 445 | tb_dh.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 446 | tb_dh.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 447 | tb_dh.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 448 | tb_dh.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 449 | tb_dh.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 450 | tb_dh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 451 | tb_dh.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 452 | tb_dh.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 453 | tb_dh.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 454 | tb_dh.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 455 | tb_dh.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 456 | tb_dh.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h eng_int.h | ||
| 457 | tb_dh.o: tb_dh.c | ||
| 458 | tb_digest.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 459 | tb_digest.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 460 | tb_digest.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 461 | tb_digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 462 | tb_digest.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 463 | tb_digest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 464 | tb_digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 465 | tb_digest.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 466 | tb_digest.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 467 | tb_digest.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 468 | tb_digest.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 469 | tb_digest.o: ../../include/openssl/objects.h | ||
| 470 | tb_digest.o: ../../include/openssl/opensslconf.h | ||
| 471 | tb_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 472 | tb_digest.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 473 | tb_digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 474 | tb_digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 475 | tb_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 476 | tb_digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 477 | tb_digest.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 478 | tb_digest.o: eng_int.h tb_digest.c | ||
| 479 | tb_dsa.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 480 | tb_dsa.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 481 | tb_dsa.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 482 | tb_dsa.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 483 | tb_dsa.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 484 | tb_dsa.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 485 | tb_dsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 486 | tb_dsa.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 487 | tb_dsa.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 488 | tb_dsa.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 489 | tb_dsa.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 490 | tb_dsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 491 | tb_dsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 492 | tb_dsa.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 493 | tb_dsa.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 494 | tb_dsa.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 495 | tb_dsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 496 | tb_dsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 497 | tb_dsa.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 498 | tb_dsa.o: eng_int.h tb_dsa.c | ||
| 499 | tb_rand.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 500 | tb_rand.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 501 | tb_rand.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 502 | tb_rand.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 503 | tb_rand.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 504 | tb_rand.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 505 | tb_rand.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 506 | tb_rand.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 507 | tb_rand.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 508 | tb_rand.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 509 | tb_rand.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 510 | tb_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 511 | tb_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 512 | tb_rand.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 513 | tb_rand.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 514 | tb_rand.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 515 | tb_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 516 | tb_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 517 | tb_rand.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 518 | tb_rand.o: eng_int.h tb_rand.c | ||
| 519 | tb_rsa.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 520 | tb_rsa.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 521 | tb_rsa.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 522 | tb_rsa.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 523 | tb_rsa.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 524 | tb_rsa.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 525 | tb_rsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 526 | tb_rsa.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 527 | tb_rsa.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 528 | tb_rsa.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 529 | tb_rsa.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 530 | tb_rsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 531 | tb_rsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 532 | tb_rsa.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 533 | tb_rsa.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 534 | tb_rsa.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 535 | tb_rsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 536 | tb_rsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 537 | tb_rsa.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 538 | tb_rsa.o: eng_int.h tb_rsa.c | ||
diff --git a/src/lib/libcrypto/engine/eng_all.c b/src/lib/libcrypto/engine/eng_all.c index 69e54f461e..79d1f2beff 100644 --- a/src/lib/libcrypto/engine/eng_all.c +++ b/src/lib/libcrypto/engine/eng_all.c | |||
| @@ -61,15 +61,15 @@ | |||
| 61 | 61 | ||
| 62 | void ENGINE_load_builtin_engines(void) | 62 | void ENGINE_load_builtin_engines(void) |
| 63 | { | 63 | { |
| 64 | #if 0 | ||
| 64 | /* There's no longer any need for an "openssl" ENGINE unless, one day, | 65 | /* There's no longer any need for an "openssl" ENGINE unless, one day, |
| 65 | * it is the *only* way for standard builtin implementations to be be | 66 | * it is the *only* way for standard builtin implementations to be be |
| 66 | * accessed (ie. it would be possible to statically link binaries with | 67 | * accessed (ie. it would be possible to statically link binaries with |
| 67 | * *no* builtin implementations). */ | 68 | * *no* builtin implementations). */ |
| 68 | #if 0 | ||
| 69 | ENGINE_load_openssl(); | 69 | ENGINE_load_openssl(); |
| 70 | #endif | 70 | #endif |
| 71 | #if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_PADLOCK) | 71 | #if !defined(OPENSSL_NO_HW) && (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)) |
| 72 | ENGINE_load_padlock(); | 72 | ENGINE_load_cryptodev(); |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | #if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_AESNI) | 75 | #if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_AESNI) |
| @@ -103,14 +103,15 @@ void ENGINE_load_builtin_engines(void) | |||
| 103 | #ifndef OPENSSL_NO_HW_UBSEC | 103 | #ifndef OPENSSL_NO_HW_UBSEC |
| 104 | ENGINE_load_ubsec(); | 104 | ENGINE_load_ubsec(); |
| 105 | #endif | 105 | #endif |
| 106 | #ifndef OPENSSL_NO_HW_PADLOCK | ||
| 107 | ENGINE_load_padlock(); | ||
| 106 | #endif | 108 | #endif |
| 107 | #if !defined(OPENSSL_NO_GMP) && !defined(OPENSSL_NO_HW_GMP) | ||
| 108 | ENGINE_load_gmp(); | ||
| 109 | #endif | 109 | #endif |
| 110 | #ifndef OPENSSL_NO_GOST | ||
| 111 | ENGINE_load_gost(); | ||
| 110 | #endif | 112 | #endif |
| 111 | #ifndef OPENSSL_NO_HW | 113 | #ifndef OPENSSL_NO_GMP |
| 112 | #if defined(__OpenBSD__) || defined(__FreeBSD__) | 114 | ENGINE_load_gmp(); |
| 113 | ENGINE_load_cryptodev(); | ||
| 114 | #endif | 115 | #endif |
| 115 | #if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG) | 116 | #if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG) |
| 116 | ENGINE_load_capi(); | 117 | ENGINE_load_capi(); |
| @@ -118,7 +119,7 @@ void ENGINE_load_builtin_engines(void) | |||
| 118 | #endif | 119 | #endif |
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | #if defined(__OpenBSD__) || defined(__FreeBSD__) | 122 | #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) |
| 122 | void ENGINE_setup_bsd_cryptodev(void) { | 123 | void ENGINE_setup_bsd_cryptodev(void) { |
| 123 | static int bsd_cryptodev_default_loaded = 0; | 124 | static int bsd_cryptodev_default_loaded = 0; |
| 124 | if (!bsd_cryptodev_default_loaded) { | 125 | if (!bsd_cryptodev_default_loaded) { |
diff --git a/src/lib/libcrypto/engine/eng_cnf.c b/src/lib/libcrypto/engine/eng_cnf.c index 08066cea59..95c4070015 100644 --- a/src/lib/libcrypto/engine/eng_cnf.c +++ b/src/lib/libcrypto/engine/eng_cnf.c | |||
| @@ -95,7 +95,7 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf) | |||
| 95 | int ret = 0; | 95 | int ret = 0; |
| 96 | long do_init = -1; | 96 | long do_init = -1; |
| 97 | STACK_OF(CONF_VALUE) *ecmds; | 97 | STACK_OF(CONF_VALUE) *ecmds; |
| 98 | CONF_VALUE *ecmd; | 98 | CONF_VALUE *ecmd = NULL; |
| 99 | char *ctrlname, *ctrlvalue; | 99 | char *ctrlname, *ctrlvalue; |
| 100 | ENGINE *e = NULL; | 100 | ENGINE *e = NULL; |
| 101 | int soft = 0; | 101 | int soft = 0; |
| @@ -157,7 +157,7 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf) | |||
| 157 | return 1; | 157 | return 1; |
| 158 | } | 158 | } |
| 159 | if (!e) | 159 | if (!e) |
| 160 | return 0; | 160 | goto err; |
| 161 | } | 161 | } |
| 162 | /* Allow "EMPTY" to mean no value: this allows a valid | 162 | /* Allow "EMPTY" to mean no value: this allows a valid |
| 163 | * "value" to be passed to ctrls of type NO_INPUT | 163 | * "value" to be passed to ctrls of type NO_INPUT |
| @@ -186,16 +186,27 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf) | |||
| 186 | } | 186 | } |
| 187 | else if (!ENGINE_ctrl_cmd_string(e, | 187 | else if (!ENGINE_ctrl_cmd_string(e, |
| 188 | ctrlname, ctrlvalue, 0)) | 188 | ctrlname, ctrlvalue, 0)) |
| 189 | return 0; | 189 | goto err; |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | 192 | ||
| 193 | 193 | ||
| 194 | } | 194 | } |
| 195 | if (e && (do_init == -1) && !int_engine_init(e)) | 195 | if (e && (do_init == -1) && !int_engine_init(e)) |
| 196 | { | ||
| 197 | ecmd = NULL; | ||
| 196 | goto err; | 198 | goto err; |
| 199 | } | ||
| 197 | ret = 1; | 200 | ret = 1; |
| 198 | err: | 201 | err: |
| 202 | if (ret != 1) | ||
| 203 | { | ||
| 204 | ENGINEerr(ENGINE_F_INT_ENGINE_CONFIGURE, ENGINE_R_ENGINE_CONFIGURATION_ERROR); | ||
| 205 | if (ecmd) | ||
| 206 | ERR_add_error_data(6, "section=", ecmd->section, | ||
| 207 | ", name=", ecmd->name, | ||
| 208 | ", value=", ecmd->value); | ||
| 209 | } | ||
| 199 | if (e) | 210 | if (e) |
| 200 | ENGINE_free(e); | 211 | ENGINE_free(e); |
| 201 | return ret; | 212 | return ret; |
diff --git a/src/lib/libcrypto/engine/eng_cryptodev.c b/src/lib/libcrypto/engine/eng_cryptodev.c index 52f4ca3901..f04c79151b 100644 --- a/src/lib/libcrypto/engine/eng_cryptodev.c +++ b/src/lib/libcrypto/engine/eng_cryptodev.c | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | #include <openssl/bn.h> | 32 | #include <openssl/bn.h> |
| 33 | 33 | ||
| 34 | #if (defined(__unix__) || defined(unix)) && !defined(USG) && \ | 34 | #if (defined(__unix__) || defined(unix)) && !defined(USG) && \ |
| 35 | (defined(OpenBSD) || defined(__FreeBSD__)) | 35 | (defined(__OpenBSD__) || defined(__FreeBSD__)) |
| 36 | #include <sys/param.h> | 36 | #include <sys/param.h> |
| 37 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) | 37 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) |
| 38 | # define HAVE_CRYPTODEV | 38 | # define HAVE_CRYPTODEV |
diff --git a/src/lib/libcrypto/engine/eng_ctrl.c b/src/lib/libcrypto/engine/eng_ctrl.c index 95b6b455aa..5ce25d92ec 100644 --- a/src/lib/libcrypto/engine/eng_ctrl.c +++ b/src/lib/libcrypto/engine/eng_ctrl.c | |||
| @@ -280,7 +280,7 @@ int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, | |||
| 280 | } | 280 | } |
| 281 | /* Force the result of the control command to 0 or 1, for the reasons | 281 | /* Force the result of the control command to 0 or 1, for the reasons |
| 282 | * mentioned before. */ | 282 | * mentioned before. */ |
| 283 | if (ENGINE_ctrl(e, num, i, p, f)) | 283 | if (ENGINE_ctrl(e, num, i, p, f) > 0) |
| 284 | return 1; | 284 | return 1; |
| 285 | return 0; | 285 | return 0; |
| 286 | } | 286 | } |
| @@ -345,7 +345,7 @@ int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, | |||
| 345 | * usage of these commands is consistent across applications and | 345 | * usage of these commands is consistent across applications and |
| 346 | * that certain applications don't understand it one way, and | 346 | * that certain applications don't understand it one way, and |
| 347 | * others another. */ | 347 | * others another. */ |
| 348 | if(ENGINE_ctrl(e, num, 0, (void *)arg, NULL)) | 348 | if(ENGINE_ctrl(e, num, 0, (void *)arg, NULL) > 0) |
| 349 | return 1; | 349 | return 1; |
| 350 | return 0; | 350 | return 0; |
| 351 | } | 351 | } |
| @@ -360,7 +360,7 @@ int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, | |||
| 360 | if(flags & ENGINE_CMD_FLAG_STRING) | 360 | if(flags & ENGINE_CMD_FLAG_STRING) |
| 361 | { | 361 | { |
| 362 | /* Same explanation as above */ | 362 | /* Same explanation as above */ |
| 363 | if(ENGINE_ctrl(e, num, 0, (void *)arg, NULL)) | 363 | if(ENGINE_ctrl(e, num, 0, (void *)arg, NULL) > 0) |
| 364 | return 1; | 364 | return 1; |
| 365 | return 0; | 365 | return 0; |
| 366 | } | 366 | } |
| @@ -383,7 +383,7 @@ int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, | |||
| 383 | } | 383 | } |
| 384 | /* Force the result of the control command to 0 or 1, for the reasons | 384 | /* Force the result of the control command to 0 or 1, for the reasons |
| 385 | * mentioned before. */ | 385 | * mentioned before. */ |
| 386 | if(ENGINE_ctrl(e, num, l, NULL, NULL)) | 386 | if(ENGINE_ctrl(e, num, l, NULL, NULL) > 0) |
| 387 | return 1; | 387 | return 1; |
| 388 | return 0; | 388 | return 0; |
| 389 | } | 389 | } |
diff --git a/src/lib/libcrypto/engine/eng_dyn.c b/src/lib/libcrypto/engine/eng_dyn.c index acb30c34d8..807da7a5eb 100644 --- a/src/lib/libcrypto/engine/eng_dyn.c +++ b/src/lib/libcrypto/engine/eng_dyn.c | |||
| @@ -146,14 +146,14 @@ struct st_dynamic_data_ctx | |||
| 146 | * 'dirs' for loading. Default is to use 'dirs' as a fallback. */ | 146 | * 'dirs' for loading. Default is to use 'dirs' as a fallback. */ |
| 147 | int dir_load; | 147 | int dir_load; |
| 148 | /* A stack of directories from which ENGINEs could be loaded */ | 148 | /* A stack of directories from which ENGINEs could be loaded */ |
| 149 | STACK *dirs; | 149 | STACK_OF(OPENSSL_STRING) *dirs; |
| 150 | }; | 150 | }; |
| 151 | 151 | ||
| 152 | /* This is the "ex_data" index we obtain and reserve for use with our context | 152 | /* This is the "ex_data" index we obtain and reserve for use with our context |
| 153 | * structure. */ | 153 | * structure. */ |
| 154 | static int dynamic_ex_data_idx = -1; | 154 | static int dynamic_ex_data_idx = -1; |
| 155 | 155 | ||
| 156 | static void int_free_str(void *s) { OPENSSL_free(s); } | 156 | static void int_free_str(char *s) { OPENSSL_free(s); } |
| 157 | /* Because our ex_data element may or may not get allocated depending on whether | 157 | /* Because our ex_data element may or may not get allocated depending on whether |
| 158 | * a "first-use" occurs before the ENGINE is freed, we have a memory leak | 158 | * a "first-use" occurs before the ENGINE is freed, we have a memory leak |
| 159 | * problem to solve. We can't declare a "new" handler for the ex_data as we | 159 | * problem to solve. We can't declare a "new" handler for the ex_data as we |
| @@ -174,7 +174,7 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr, | |||
| 174 | if(ctx->engine_id) | 174 | if(ctx->engine_id) |
| 175 | OPENSSL_free((void*)ctx->engine_id); | 175 | OPENSSL_free((void*)ctx->engine_id); |
| 176 | if(ctx->dirs) | 176 | if(ctx->dirs) |
| 177 | sk_pop_free(ctx->dirs, int_free_str); | 177 | sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str); |
| 178 | OPENSSL_free(ctx); | 178 | OPENSSL_free(ctx); |
| 179 | } | 179 | } |
| 180 | } | 180 | } |
| @@ -203,7 +203,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) | |||
| 203 | c->DYNAMIC_F1 = "v_check"; | 203 | c->DYNAMIC_F1 = "v_check"; |
| 204 | c->DYNAMIC_F2 = "bind_engine"; | 204 | c->DYNAMIC_F2 = "bind_engine"; |
| 205 | c->dir_load = 1; | 205 | c->dir_load = 1; |
| 206 | c->dirs = sk_new_null(); | 206 | c->dirs = sk_OPENSSL_STRING_new_null(); |
| 207 | if(!c->dirs) | 207 | if(!c->dirs) |
| 208 | { | 208 | { |
| 209 | ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); | 209 | ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); |
| @@ -393,7 +393,7 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) | |||
| 393 | ERR_R_MALLOC_FAILURE); | 393 | ERR_R_MALLOC_FAILURE); |
| 394 | return 0; | 394 | return 0; |
| 395 | } | 395 | } |
| 396 | sk_insert(ctx->dirs, tmp_str, -1); | 396 | sk_OPENSSL_STRING_insert(ctx->dirs, tmp_str, -1); |
| 397 | } | 397 | } |
| 398 | return 1; | 398 | return 1; |
| 399 | default: | 399 | default: |
| @@ -411,11 +411,11 @@ static int int_load(dynamic_data_ctx *ctx) | |||
| 411 | ctx->DYNAMIC_LIBNAME, NULL, 0)) != NULL) | 411 | ctx->DYNAMIC_LIBNAME, NULL, 0)) != NULL) |
| 412 | return 1; | 412 | return 1; |
| 413 | /* If we're not allowed to use 'dirs' or we have none, fail */ | 413 | /* If we're not allowed to use 'dirs' or we have none, fail */ |
| 414 | if(!ctx->dir_load || ((num = sk_num(ctx->dirs)) < 1)) | 414 | if(!ctx->dir_load || (num = sk_OPENSSL_STRING_num(ctx->dirs)) < 1) |
| 415 | return 0; | 415 | return 0; |
| 416 | for(loop = 0; loop < num; loop++) | 416 | for(loop = 0; loop < num; loop++) |
| 417 | { | 417 | { |
| 418 | const char *s = sk_value(ctx->dirs, loop); | 418 | const char *s = sk_OPENSSL_STRING_value(ctx->dirs, loop); |
| 419 | char *merge = DSO_merge(ctx->dynamic_dso, ctx->DYNAMIC_LIBNAME, s); | 419 | char *merge = DSO_merge(ctx->dynamic_dso, ctx->DYNAMIC_LIBNAME, s); |
| 420 | if(!merge) | 420 | if(!merge) |
| 421 | return 0; | 421 | return 0; |
diff --git a/src/lib/libcrypto/engine/eng_err.c b/src/lib/libcrypto/engine/eng_err.c index 574ffbb5c0..81c70acfa8 100644 --- a/src/lib/libcrypto/engine/eng_err.c +++ b/src/lib/libcrypto/engine/eng_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/engine/eng_err.c */ | 1 | /* crypto/engine/eng_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -86,6 +86,8 @@ static ERR_STRING_DATA ENGINE_str_functs[]= | |||
| 86 | {ERR_FUNC(ENGINE_F_ENGINE_GET_DEFAULT_TYPE), "ENGINE_GET_DEFAULT_TYPE"}, | 86 | {ERR_FUNC(ENGINE_F_ENGINE_GET_DEFAULT_TYPE), "ENGINE_GET_DEFAULT_TYPE"}, |
| 87 | {ERR_FUNC(ENGINE_F_ENGINE_GET_DIGEST), "ENGINE_get_digest"}, | 87 | {ERR_FUNC(ENGINE_F_ENGINE_GET_DIGEST), "ENGINE_get_digest"}, |
| 88 | {ERR_FUNC(ENGINE_F_ENGINE_GET_NEXT), "ENGINE_get_next"}, | 88 | {ERR_FUNC(ENGINE_F_ENGINE_GET_NEXT), "ENGINE_get_next"}, |
| 89 | {ERR_FUNC(ENGINE_F_ENGINE_GET_PKEY_ASN1_METH), "ENGINE_get_pkey_asn1_meth"}, | ||
| 90 | {ERR_FUNC(ENGINE_F_ENGINE_GET_PKEY_METH), "ENGINE_get_pkey_meth"}, | ||
| 89 | {ERR_FUNC(ENGINE_F_ENGINE_GET_PREV), "ENGINE_get_prev"}, | 91 | {ERR_FUNC(ENGINE_F_ENGINE_GET_PREV), "ENGINE_get_prev"}, |
| 90 | {ERR_FUNC(ENGINE_F_ENGINE_INIT), "ENGINE_init"}, | 92 | {ERR_FUNC(ENGINE_F_ENGINE_INIT), "ENGINE_init"}, |
| 91 | {ERR_FUNC(ENGINE_F_ENGINE_LIST_ADD), "ENGINE_LIST_ADD"}, | 93 | {ERR_FUNC(ENGINE_F_ENGINE_LIST_ADD), "ENGINE_LIST_ADD"}, |
| @@ -124,6 +126,7 @@ static ERR_STRING_DATA ENGINE_str_reasons[]= | |||
| 124 | {ERR_REASON(ENGINE_R_DSO_FAILURE) ,"DSO failure"}, | 126 | {ERR_REASON(ENGINE_R_DSO_FAILURE) ,"DSO failure"}, |
| 125 | {ERR_REASON(ENGINE_R_DSO_NOT_FOUND) ,"dso not found"}, | 127 | {ERR_REASON(ENGINE_R_DSO_NOT_FOUND) ,"dso not found"}, |
| 126 | {ERR_REASON(ENGINE_R_ENGINES_SECTION_ERROR),"engines section error"}, | 128 | {ERR_REASON(ENGINE_R_ENGINES_SECTION_ERROR),"engines section error"}, |
| 129 | {ERR_REASON(ENGINE_R_ENGINE_CONFIGURATION_ERROR),"engine configuration error"}, | ||
| 127 | {ERR_REASON(ENGINE_R_ENGINE_IS_NOT_IN_LIST),"engine is not in the list"}, | 130 | {ERR_REASON(ENGINE_R_ENGINE_IS_NOT_IN_LIST),"engine is not in the list"}, |
| 128 | {ERR_REASON(ENGINE_R_ENGINE_SECTION_ERROR),"engine section error"}, | 131 | {ERR_REASON(ENGINE_R_ENGINE_SECTION_ERROR),"engine section error"}, |
| 129 | {ERR_REASON(ENGINE_R_FAILED_LOADING_PRIVATE_KEY),"failed loading private key"}, | 132 | {ERR_REASON(ENGINE_R_FAILED_LOADING_PRIVATE_KEY),"failed loading private key"}, |
| @@ -150,6 +153,7 @@ static ERR_STRING_DATA ENGINE_str_reasons[]= | |||
| 150 | {ERR_REASON(ENGINE_R_RSA_NOT_IMPLEMENTED),"rsa not implemented"}, | 153 | {ERR_REASON(ENGINE_R_RSA_NOT_IMPLEMENTED),"rsa not implemented"}, |
| 151 | {ERR_REASON(ENGINE_R_UNIMPLEMENTED_CIPHER),"unimplemented cipher"}, | 154 | {ERR_REASON(ENGINE_R_UNIMPLEMENTED_CIPHER),"unimplemented cipher"}, |
| 152 | {ERR_REASON(ENGINE_R_UNIMPLEMENTED_DIGEST),"unimplemented digest"}, | 155 | {ERR_REASON(ENGINE_R_UNIMPLEMENTED_DIGEST),"unimplemented digest"}, |
| 156 | {ERR_REASON(ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD),"unimplemented public key method"}, | ||
| 153 | {ERR_REASON(ENGINE_R_VERSION_INCOMPATIBILITY),"version incompatibility"}, | 157 | {ERR_REASON(ENGINE_R_VERSION_INCOMPATIBILITY),"version incompatibility"}, |
| 154 | {0,NULL} | 158 | {0,NULL} |
| 155 | }; | 159 | }; |
diff --git a/src/lib/libcrypto/engine/eng_fat.c b/src/lib/libcrypto/engine/eng_fat.c index 27c1662f62..db66e62350 100644 --- a/src/lib/libcrypto/engine/eng_fat.c +++ b/src/lib/libcrypto/engine/eng_fat.c | |||
| @@ -89,6 +89,12 @@ int ENGINE_set_default(ENGINE *e, unsigned int flags) | |||
| 89 | #endif | 89 | #endif |
| 90 | if((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e)) | 90 | if((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e)) |
| 91 | return 0; | 91 | return 0; |
| 92 | if((flags & ENGINE_METHOD_PKEY_METHS) | ||
| 93 | && !ENGINE_set_default_pkey_meths(e)) | ||
| 94 | return 0; | ||
| 95 | if((flags & ENGINE_METHOD_PKEY_ASN1_METHS) | ||
| 96 | && !ENGINE_set_default_pkey_asn1_meths(e)) | ||
| 97 | return 0; | ||
| 92 | return 1; | 98 | return 1; |
| 93 | } | 99 | } |
| 94 | 100 | ||
| @@ -115,6 +121,13 @@ static int int_def_cb(const char *alg, int len, void *arg) | |||
| 115 | *pflags |= ENGINE_METHOD_CIPHERS; | 121 | *pflags |= ENGINE_METHOD_CIPHERS; |
| 116 | else if (!strncmp(alg, "DIGESTS", len)) | 122 | else if (!strncmp(alg, "DIGESTS", len)) |
| 117 | *pflags |= ENGINE_METHOD_DIGESTS; | 123 | *pflags |= ENGINE_METHOD_DIGESTS; |
| 124 | else if (!strncmp(alg, "PKEY", len)) | ||
| 125 | *pflags |= | ||
| 126 | ENGINE_METHOD_PKEY_METHS|ENGINE_METHOD_PKEY_ASN1_METHS; | ||
| 127 | else if (!strncmp(alg, "PKEY_CRYPTO", len)) | ||
| 128 | *pflags |= ENGINE_METHOD_PKEY_METHS; | ||
| 129 | else if (!strncmp(alg, "PKEY_ASN1", len)) | ||
| 130 | *pflags |= ENGINE_METHOD_PKEY_ASN1_METHS; | ||
| 118 | else | 131 | else |
| 119 | return 0; | 132 | return 0; |
| 120 | return 1; | 133 | return 1; |
| @@ -154,6 +167,7 @@ int ENGINE_register_complete(ENGINE *e) | |||
| 154 | ENGINE_register_ECDSA(e); | 167 | ENGINE_register_ECDSA(e); |
| 155 | #endif | 168 | #endif |
| 156 | ENGINE_register_RAND(e); | 169 | ENGINE_register_RAND(e); |
| 170 | ENGINE_register_pkey_meths(e); | ||
| 157 | return 1; | 171 | return 1; |
| 158 | } | 172 | } |
| 159 | 173 | ||
diff --git a/src/lib/libcrypto/engine/eng_int.h b/src/lib/libcrypto/engine/eng_int.h index a66f107a44..451ef8feb8 100644 --- a/src/lib/libcrypto/engine/eng_int.h +++ b/src/lib/libcrypto/engine/eng_int.h | |||
| @@ -127,6 +127,8 @@ ENGINE *engine_table_select(ENGINE_TABLE **table, int nid); | |||
| 127 | ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f, int l); | 127 | ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f, int l); |
| 128 | #define engine_table_select(t,n) engine_table_select_tmp(t,n,__FILE__,__LINE__) | 128 | #define engine_table_select(t,n) engine_table_select_tmp(t,n,__FILE__,__LINE__) |
| 129 | #endif | 129 | #endif |
| 130 | typedef void (engine_table_doall_cb)(int nid, STACK_OF(ENGINE) *sk, ENGINE *def, void *arg); | ||
| 131 | void engine_table_doall(ENGINE_TABLE *table, engine_table_doall_cb *cb, void *arg); | ||
| 130 | 132 | ||
| 131 | /* Internal versions of API functions that have control over locking. These are | 133 | /* Internal versions of API functions that have control over locking. These are |
| 132 | * used between C files when functionality needs to be shared but the caller may | 134 | * used between C files when functionality needs to be shared but the caller may |
| @@ -143,6 +145,11 @@ void engine_set_all_null(ENGINE *e); | |||
| 143 | /* NB: Bitwise OR-able values for the "flags" variable in ENGINE are now exposed | 145 | /* NB: Bitwise OR-able values for the "flags" variable in ENGINE are now exposed |
| 144 | * in engine.h. */ | 146 | * in engine.h. */ |
| 145 | 147 | ||
| 148 | /* Free up dynamically allocated public key methods associated with ENGINE */ | ||
| 149 | |||
| 150 | void engine_pkey_meths_free(ENGINE *e); | ||
| 151 | void engine_pkey_asn1_meths_free(ENGINE *e); | ||
| 152 | |||
| 146 | /* This is a structure for storing implementations of various crypto | 153 | /* This is a structure for storing implementations of various crypto |
| 147 | * algorithms and functions. */ | 154 | * algorithms and functions. */ |
| 148 | struct engine_st | 155 | struct engine_st |
| @@ -160,7 +167,10 @@ struct engine_st | |||
| 160 | ENGINE_CIPHERS_PTR ciphers; | 167 | ENGINE_CIPHERS_PTR ciphers; |
| 161 | /* Digest handling is via this callback */ | 168 | /* Digest handling is via this callback */ |
| 162 | ENGINE_DIGESTS_PTR digests; | 169 | ENGINE_DIGESTS_PTR digests; |
| 163 | 170 | /* Public key handling via this callback */ | |
| 171 | ENGINE_PKEY_METHS_PTR pkey_meths; | ||
| 172 | /* ASN1 public key handling via this callback */ | ||
| 173 | ENGINE_PKEY_ASN1_METHS_PTR pkey_asn1_meths; | ||
| 164 | 174 | ||
| 165 | ENGINE_GEN_INT_FUNC_PTR destroy; | 175 | ENGINE_GEN_INT_FUNC_PTR destroy; |
| 166 | 176 | ||
diff --git a/src/lib/libcrypto/engine/eng_lib.c b/src/lib/libcrypto/engine/eng_lib.c index 5815b867f4..18a6664645 100644 --- a/src/lib/libcrypto/engine/eng_lib.c +++ b/src/lib/libcrypto/engine/eng_lib.c | |||
| @@ -125,6 +125,9 @@ int engine_free_util(ENGINE *e, int locked) | |||
| 125 | abort(); | 125 | abort(); |
| 126 | } | 126 | } |
| 127 | #endif | 127 | #endif |
| 128 | /* Free up any dynamically allocated public key methods */ | ||
| 129 | engine_pkey_meths_free(e); | ||
| 130 | engine_pkey_asn1_meths_free(e); | ||
| 128 | /* Give the ENGINE a chance to do any structural cleanup corresponding | 131 | /* Give the ENGINE a chance to do any structural cleanup corresponding |
| 129 | * to allocation it did in its constructor (eg. unload error strings) */ | 132 | * to allocation it did in its constructor (eg. unload error strings) */ |
| 130 | if(e->destroy) | 133 | if(e->destroy) |
diff --git a/src/lib/libcrypto/engine/eng_list.c b/src/lib/libcrypto/engine/eng_list.c index bd511944ba..27846edb1e 100644 --- a/src/lib/libcrypto/engine/eng_list.c +++ b/src/lib/libcrypto/engine/eng_list.c | |||
| @@ -336,6 +336,7 @@ static void engine_cpy(ENGINE *dest, const ENGINE *src) | |||
| 336 | dest->store_meth = src->store_meth; | 336 | dest->store_meth = src->store_meth; |
| 337 | dest->ciphers = src->ciphers; | 337 | dest->ciphers = src->ciphers; |
| 338 | dest->digests = src->digests; | 338 | dest->digests = src->digests; |
| 339 | dest->pkey_meths = src->pkey_meths; | ||
| 339 | dest->destroy = src->destroy; | 340 | dest->destroy = src->destroy; |
| 340 | dest->init = src->init; | 341 | dest->init = src->init; |
| 341 | dest->finish = src->finish; | 342 | dest->finish = src->finish; |
| @@ -412,6 +413,7 @@ ENGINE *ENGINE_by_id(const char *id) | |||
| 412 | return iterator; | 413 | return iterator; |
| 413 | } | 414 | } |
| 414 | notfound: | 415 | notfound: |
| 416 | ENGINE_free(iterator); | ||
| 415 | ENGINEerr(ENGINE_F_ENGINE_BY_ID,ENGINE_R_NO_SUCH_ENGINE); | 417 | ENGINEerr(ENGINE_F_ENGINE_BY_ID,ENGINE_R_NO_SUCH_ENGINE); |
| 416 | ERR_add_error_data(2, "id=", id); | 418 | ERR_add_error_data(2, "id=", id); |
| 417 | return NULL; | 419 | return NULL; |
diff --git a/src/lib/libcrypto/engine/eng_openssl.c b/src/lib/libcrypto/engine/eng_openssl.c index 7c139ae2ef..9abb95cc22 100644 --- a/src/lib/libcrypto/engine/eng_openssl.c +++ b/src/lib/libcrypto/engine/eng_openssl.c | |||
| @@ -238,7 +238,7 @@ static int test_rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 238 | return 1; | 238 | return 1; |
| 239 | } | 239 | } |
| 240 | static int test_rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 240 | static int test_rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 241 | const unsigned char *in, unsigned int inl) | 241 | const unsigned char *in, size_t inl) |
| 242 | { | 242 | { |
| 243 | #ifdef TEST_ENG_OPENSSL_RC4_P_CIPHER | 243 | #ifdef TEST_ENG_OPENSSL_RC4_P_CIPHER |
| 244 | fprintf(stderr, "(TEST_ENG_OPENSSL_RC4) test_cipher() called\n"); | 244 | fprintf(stderr, "(TEST_ENG_OPENSSL_RC4) test_cipher() called\n"); |
diff --git a/src/lib/libcrypto/engine/eng_table.c b/src/lib/libcrypto/engine/eng_table.c index 8879a267d1..4fde948185 100644 --- a/src/lib/libcrypto/engine/eng_table.c +++ b/src/lib/libcrypto/engine/eng_table.c | |||
| @@ -70,12 +70,22 @@ typedef struct st_engine_pile | |||
| 70 | int uptodate; | 70 | int uptodate; |
| 71 | } ENGINE_PILE; | 71 | } ENGINE_PILE; |
| 72 | 72 | ||
| 73 | DECLARE_LHASH_OF(ENGINE_PILE); | ||
| 74 | |||
| 73 | /* The type exposed in eng_int.h */ | 75 | /* The type exposed in eng_int.h */ |
| 74 | struct st_engine_table | 76 | struct st_engine_table |
| 75 | { | 77 | { |
| 76 | LHASH piles; | 78 | LHASH_OF(ENGINE_PILE) piles; |
| 77 | }; /* ENGINE_TABLE */ | 79 | }; /* ENGINE_TABLE */ |
| 78 | 80 | ||
| 81 | |||
| 82 | typedef struct st_engine_pile_doall | ||
| 83 | { | ||
| 84 | engine_table_doall_cb *cb; | ||
| 85 | void *arg; | ||
| 86 | } ENGINE_PILE_DOALL; | ||
| 87 | |||
| 88 | |||
| 79 | /* Global flags (ENGINE_TABLE_FLAG_***). */ | 89 | /* Global flags (ENGINE_TABLE_FLAG_***). */ |
| 80 | static unsigned int table_flags = 0; | 90 | static unsigned int table_flags = 0; |
| 81 | 91 | ||
| @@ -84,6 +94,7 @@ unsigned int ENGINE_get_table_flags(void) | |||
| 84 | { | 94 | { |
| 85 | return table_flags; | 95 | return table_flags; |
| 86 | } | 96 | } |
| 97 | |||
| 87 | void ENGINE_set_table_flags(unsigned int flags) | 98 | void ENGINE_set_table_flags(unsigned int flags) |
| 88 | { | 99 | { |
| 89 | table_flags = flags; | 100 | table_flags = flags; |
| @@ -94,19 +105,21 @@ static unsigned long engine_pile_hash(const ENGINE_PILE *c) | |||
| 94 | { | 105 | { |
| 95 | return c->nid; | 106 | return c->nid; |
| 96 | } | 107 | } |
| 108 | |||
| 97 | static int engine_pile_cmp(const ENGINE_PILE *a, const ENGINE_PILE *b) | 109 | static int engine_pile_cmp(const ENGINE_PILE *a, const ENGINE_PILE *b) |
| 98 | { | 110 | { |
| 99 | return a->nid - b->nid; | 111 | return a->nid - b->nid; |
| 100 | } | 112 | } |
| 101 | static IMPLEMENT_LHASH_HASH_FN(engine_pile_hash, const ENGINE_PILE *) | 113 | static IMPLEMENT_LHASH_HASH_FN(engine_pile, ENGINE_PILE) |
| 102 | static IMPLEMENT_LHASH_COMP_FN(engine_pile_cmp, const ENGINE_PILE *) | 114 | static IMPLEMENT_LHASH_COMP_FN(engine_pile, ENGINE_PILE) |
| 115 | |||
| 103 | static int int_table_check(ENGINE_TABLE **t, int create) | 116 | static int int_table_check(ENGINE_TABLE **t, int create) |
| 104 | { | 117 | { |
| 105 | LHASH *lh; | 118 | LHASH_OF(ENGINE_PILE) *lh; |
| 119 | |||
| 106 | if(*t) return 1; | 120 | if(*t) return 1; |
| 107 | if(!create) return 0; | 121 | if(!create) return 0; |
| 108 | if((lh = lh_new(LHASH_HASH_FN(engine_pile_hash), | 122 | if((lh = lh_ENGINE_PILE_new()) == NULL) |
| 109 | LHASH_COMP_FN(engine_pile_cmp))) == NULL) | ||
| 110 | return 0; | 123 | return 0; |
| 111 | *t = (ENGINE_TABLE *)lh; | 124 | *t = (ENGINE_TABLE *)lh; |
| 112 | return 1; | 125 | return 1; |
| @@ -130,7 +143,7 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup, | |||
| 130 | while(num_nids--) | 143 | while(num_nids--) |
| 131 | { | 144 | { |
| 132 | tmplate.nid = *nids; | 145 | tmplate.nid = *nids; |
| 133 | fnd = lh_retrieve(&(*table)->piles, &tmplate); | 146 | fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate); |
| 134 | if(!fnd) | 147 | if(!fnd) |
| 135 | { | 148 | { |
| 136 | fnd = OPENSSL_malloc(sizeof(ENGINE_PILE)); | 149 | fnd = OPENSSL_malloc(sizeof(ENGINE_PILE)); |
| @@ -144,7 +157,7 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup, | |||
| 144 | goto end; | 157 | goto end; |
| 145 | } | 158 | } |
| 146 | fnd->funct = NULL; | 159 | fnd->funct = NULL; |
| 147 | lh_insert(&(*table)->piles, fnd); | 160 | (void)lh_ENGINE_PILE_insert(&(*table)->piles, fnd); |
| 148 | } | 161 | } |
| 149 | /* A registration shouldn't add duplciate entries */ | 162 | /* A registration shouldn't add duplciate entries */ |
| 150 | (void)sk_ENGINE_delete_ptr(fnd->sk, e); | 163 | (void)sk_ENGINE_delete_ptr(fnd->sk, e); |
| @@ -173,7 +186,7 @@ end: | |||
| 173 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | 186 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); |
| 174 | return ret; | 187 | return ret; |
| 175 | } | 188 | } |
| 176 | static void int_unregister_cb(ENGINE_PILE *pile, ENGINE *e) | 189 | static void int_unregister_cb_doall_arg(ENGINE_PILE *pile, ENGINE *e) |
| 177 | { | 190 | { |
| 178 | int n; | 191 | int n; |
| 179 | /* Iterate the 'c->sk' stack removing any occurance of 'e' */ | 192 | /* Iterate the 'c->sk' stack removing any occurance of 'e' */ |
| @@ -188,31 +201,35 @@ static void int_unregister_cb(ENGINE_PILE *pile, ENGINE *e) | |||
| 188 | pile->funct = NULL; | 201 | pile->funct = NULL; |
| 189 | } | 202 | } |
| 190 | } | 203 | } |
| 191 | static IMPLEMENT_LHASH_DOALL_ARG_FN(int_unregister_cb,ENGINE_PILE *,ENGINE *) | 204 | static IMPLEMENT_LHASH_DOALL_ARG_FN(int_unregister_cb, ENGINE_PILE, ENGINE) |
| 205 | |||
| 192 | void engine_table_unregister(ENGINE_TABLE **table, ENGINE *e) | 206 | void engine_table_unregister(ENGINE_TABLE **table, ENGINE *e) |
| 193 | { | 207 | { |
| 194 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | 208 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
| 195 | if(int_table_check(table, 0)) | 209 | if(int_table_check(table, 0)) |
| 196 | lh_doall_arg(&(*table)->piles, | 210 | lh_ENGINE_PILE_doall_arg(&(*table)->piles, |
| 197 | LHASH_DOALL_ARG_FN(int_unregister_cb), e); | 211 | LHASH_DOALL_ARG_FN(int_unregister_cb), |
| 212 | ENGINE, e); | ||
| 198 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | 213 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); |
| 199 | } | 214 | } |
| 200 | 215 | ||
| 201 | static void int_cleanup_cb(ENGINE_PILE *p) | 216 | static void int_cleanup_cb_doall(ENGINE_PILE *p) |
| 202 | { | 217 | { |
| 203 | sk_ENGINE_free(p->sk); | 218 | sk_ENGINE_free(p->sk); |
| 204 | if(p->funct) | 219 | if(p->funct) |
| 205 | engine_unlocked_finish(p->funct, 0); | 220 | engine_unlocked_finish(p->funct, 0); |
| 206 | OPENSSL_free(p); | 221 | OPENSSL_free(p); |
| 207 | } | 222 | } |
| 208 | static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb,ENGINE_PILE *) | 223 | static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb, ENGINE_PILE) |
| 224 | |||
| 209 | void engine_table_cleanup(ENGINE_TABLE **table) | 225 | void engine_table_cleanup(ENGINE_TABLE **table) |
| 210 | { | 226 | { |
| 211 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | 227 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
| 212 | if(*table) | 228 | if(*table) |
| 213 | { | 229 | { |
| 214 | lh_doall(&(*table)->piles, LHASH_DOALL_FN(int_cleanup_cb)); | 230 | lh_ENGINE_PILE_doall(&(*table)->piles, |
| 215 | lh_free(&(*table)->piles); | 231 | LHASH_DOALL_FN(int_cleanup_cb)); |
| 232 | lh_ENGINE_PILE_free(&(*table)->piles); | ||
| 216 | *table = NULL; | 233 | *table = NULL; |
| 217 | } | 234 | } |
| 218 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | 235 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); |
| @@ -237,12 +254,13 @@ ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f, in | |||
| 237 | #endif | 254 | #endif |
| 238 | return NULL; | 255 | return NULL; |
| 239 | } | 256 | } |
| 257 | ERR_set_mark(); | ||
| 240 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | 258 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); |
| 241 | /* Check again inside the lock otherwise we could race against cleanup | 259 | /* Check again inside the lock otherwise we could race against cleanup |
| 242 | * operations. But don't worry about a fprintf(stderr). */ | 260 | * operations. But don't worry about a fprintf(stderr). */ |
| 243 | if(!int_table_check(table, 0)) goto end; | 261 | if(!int_table_check(table, 0)) goto end; |
| 244 | tmplate.nid = nid; | 262 | tmplate.nid = nid; |
| 245 | fnd = lh_retrieve(&(*table)->piles, &tmplate); | 263 | fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate); |
| 246 | if(!fnd) goto end; | 264 | if(!fnd) goto end; |
| 247 | if(fnd->funct && engine_unlocked_init(fnd->funct)) | 265 | if(fnd->funct && engine_unlocked_init(fnd->funct)) |
| 248 | { | 266 | { |
| @@ -310,6 +328,24 @@ end: | |||
| 310 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | 328 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); |
| 311 | /* Whatever happened, any failed init()s are not failures in this | 329 | /* Whatever happened, any failed init()s are not failures in this |
| 312 | * context, so clear our error state. */ | 330 | * context, so clear our error state. */ |
| 313 | ERR_clear_error(); | 331 | ERR_pop_to_mark(); |
| 314 | return ret; | 332 | return ret; |
| 315 | } | 333 | } |
| 334 | |||
| 335 | /* Table enumeration */ | ||
| 336 | |||
| 337 | static void int_cb_doall_arg(ENGINE_PILE *pile, ENGINE_PILE_DOALL *dall) | ||
| 338 | { | ||
| 339 | dall->cb(pile->nid, pile->sk, pile->funct, dall->arg); | ||
| 340 | } | ||
| 341 | static IMPLEMENT_LHASH_DOALL_ARG_FN(int_cb, ENGINE_PILE,ENGINE_PILE_DOALL) | ||
| 342 | |||
| 343 | void engine_table_doall(ENGINE_TABLE *table, engine_table_doall_cb *cb, | ||
| 344 | void *arg) | ||
| 345 | { | ||
| 346 | ENGINE_PILE_DOALL dall; | ||
| 347 | dall.cb = cb; | ||
| 348 | dall.arg = arg; | ||
| 349 | lh_ENGINE_PILE_doall_arg(&table->piles, LHASH_DOALL_ARG_FN(int_cb), | ||
| 350 | ENGINE_PILE_DOALL, &dall); | ||
| 351 | } | ||
diff --git a/src/lib/libcrypto/engine/engine.h b/src/lib/libcrypto/engine/engine.h index ecab9453ba..8ad11b15d7 100644 --- a/src/lib/libcrypto/engine/engine.h +++ b/src/lib/libcrypto/engine/engine.h | |||
| @@ -88,16 +88,15 @@ | |||
| 88 | #include <openssl/ecdsa.h> | 88 | #include <openssl/ecdsa.h> |
| 89 | #endif | 89 | #endif |
| 90 | #include <openssl/rand.h> | 90 | #include <openssl/rand.h> |
| 91 | #include <openssl/store.h> | ||
| 92 | #include <openssl/ui.h> | 91 | #include <openssl/ui.h> |
| 93 | #include <openssl/err.h> | 92 | #include <openssl/err.h> |
| 94 | #endif | 93 | #endif |
| 95 | 94 | ||
| 96 | #include <openssl/x509.h> | ||
| 97 | |||
| 98 | #include <openssl/ossl_typ.h> | 95 | #include <openssl/ossl_typ.h> |
| 99 | #include <openssl/symhacks.h> | 96 | #include <openssl/symhacks.h> |
| 100 | 97 | ||
| 98 | #include <openssl/x509.h> | ||
| 99 | |||
| 101 | #ifdef __cplusplus | 100 | #ifdef __cplusplus |
| 102 | extern "C" { | 101 | extern "C" { |
| 103 | #endif | 102 | #endif |
| @@ -113,6 +112,8 @@ extern "C" { | |||
| 113 | #define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 | 112 | #define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 |
| 114 | #define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 | 113 | #define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 |
| 115 | #define ENGINE_METHOD_STORE (unsigned int)0x0100 | 114 | #define ENGINE_METHOD_STORE (unsigned int)0x0100 |
| 115 | #define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 | ||
| 116 | #define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 | ||
| 116 | /* Obvious all-or-nothing cases. */ | 117 | /* Obvious all-or-nothing cases. */ |
| 117 | #define ENGINE_METHOD_ALL (unsigned int)0xFFFF | 118 | #define ENGINE_METHOD_ALL (unsigned int)0xFFFF |
| 118 | #define ENGINE_METHOD_NONE (unsigned int)0x0000 | 119 | #define ENGINE_METHOD_NONE (unsigned int)0x0000 |
| @@ -297,7 +298,8 @@ typedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl, | |||
| 297 | * parameter is non-NULL it is set to the size of the returned array. */ | 298 | * parameter is non-NULL it is set to the size of the returned array. */ |
| 298 | typedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int); | 299 | typedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int); |
| 299 | typedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int); | 300 | typedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int); |
| 300 | 301 | typedef int (*ENGINE_PKEY_METHS_PTR)(ENGINE *, EVP_PKEY_METHOD **, const int **, int); | |
| 302 | typedef int (*ENGINE_PKEY_ASN1_METHS_PTR)(ENGINE *, EVP_PKEY_ASN1_METHOD **, const int **, int); | ||
| 301 | /* STRUCTURE functions ... all of these functions deal with pointers to ENGINE | 303 | /* STRUCTURE functions ... all of these functions deal with pointers to ENGINE |
| 302 | * structures where the pointers have a "structural reference". This means that | 304 | * structures where the pointers have a "structural reference". This means that |
| 303 | * their reference is to allowed access to the structure but it does not imply | 305 | * their reference is to allowed access to the structure but it does not imply |
| @@ -329,20 +331,21 @@ void ENGINE_load_aep(void); | |||
| 329 | void ENGINE_load_atalla(void); | 331 | void ENGINE_load_atalla(void); |
| 330 | void ENGINE_load_chil(void); | 332 | void ENGINE_load_chil(void); |
| 331 | void ENGINE_load_cswift(void); | 333 | void ENGINE_load_cswift(void); |
| 332 | #ifndef OPENSSL_NO_GMP | ||
| 333 | void ENGINE_load_gmp(void); | ||
| 334 | #endif | ||
| 335 | void ENGINE_load_nuron(void); | 334 | void ENGINE_load_nuron(void); |
| 336 | void ENGINE_load_sureware(void); | 335 | void ENGINE_load_sureware(void); |
| 337 | void ENGINE_load_ubsec(void); | 336 | void ENGINE_load_ubsec(void); |
| 337 | void ENGINE_load_padlock(void); | ||
| 338 | void ENGINE_load_capi(void); | ||
| 339 | #ifndef OPENSSL_NO_GMP | ||
| 340 | void ENGINE_load_gmp(void); | ||
| 341 | #endif | ||
| 342 | #ifndef OPENSSL_NO_GOST | ||
| 343 | void ENGINE_load_gost(void); | ||
| 344 | #endif | ||
| 338 | #endif | 345 | #endif |
| 339 | void ENGINE_load_cryptodev(void); | 346 | void ENGINE_load_cryptodev(void); |
| 340 | void ENGINE_load_aesni(void); | 347 | void ENGINE_load_aesni(void); |
| 341 | void ENGINE_load_padlock(void); | ||
| 342 | void ENGINE_load_builtin_engines(void); | 348 | void ENGINE_load_builtin_engines(void); |
| 343 | #ifndef OPENSSL_NO_CAPIENG | ||
| 344 | void ENGINE_load_capi(void); | ||
| 345 | #endif | ||
| 346 | 349 | ||
| 347 | /* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation | 350 | /* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation |
| 348 | * "registry" handling. */ | 351 | * "registry" handling. */ |
| @@ -393,6 +396,14 @@ int ENGINE_register_digests(ENGINE *e); | |||
| 393 | void ENGINE_unregister_digests(ENGINE *e); | 396 | void ENGINE_unregister_digests(ENGINE *e); |
| 394 | void ENGINE_register_all_digests(void); | 397 | void ENGINE_register_all_digests(void); |
| 395 | 398 | ||
| 399 | int ENGINE_register_pkey_meths(ENGINE *e); | ||
| 400 | void ENGINE_unregister_pkey_meths(ENGINE *e); | ||
| 401 | void ENGINE_register_all_pkey_meths(void); | ||
| 402 | |||
| 403 | int ENGINE_register_pkey_asn1_meths(ENGINE *e); | ||
| 404 | void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); | ||
| 405 | void ENGINE_register_all_pkey_asn1_meths(void); | ||
| 406 | |||
| 396 | /* These functions register all support from the above categories. Note, use of | 407 | /* These functions register all support from the above categories. Note, use of |
| 397 | * these functions can result in static linkage of code your application may not | 408 | * these functions can result in static linkage of code your application may not |
| 398 | * need. If you only need a subset of functionality, consider using more | 409 | * need. If you only need a subset of functionality, consider using more |
| @@ -472,6 +483,8 @@ int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, | |||
| 472 | ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); | 483 | ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); |
| 473 | int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); | 484 | int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); |
| 474 | int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); | 485 | int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); |
| 486 | int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); | ||
| 487 | int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); | ||
| 475 | int ENGINE_set_flags(ENGINE *e, int flags); | 488 | int ENGINE_set_flags(ENGINE *e, int flags); |
| 476 | int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); | 489 | int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); |
| 477 | /* These functions allow control over any per-structure ENGINE data. */ | 490 | /* These functions allow control over any per-structure ENGINE data. */ |
| @@ -508,8 +521,16 @@ ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); | |||
| 508 | ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e); | 521 | ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e); |
| 509 | ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); | 522 | ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); |
| 510 | ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); | 523 | ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); |
| 524 | ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); | ||
| 525 | ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); | ||
| 511 | const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); | 526 | const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); |
| 512 | const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); | 527 | const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); |
| 528 | const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); | ||
| 529 | const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); | ||
| 530 | const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, | ||
| 531 | const char *str, int len); | ||
| 532 | const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, | ||
| 533 | const char *str, int len); | ||
| 513 | const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); | 534 | const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); |
| 514 | int ENGINE_get_flags(const ENGINE *e); | 535 | int ENGINE_get_flags(const ENGINE *e); |
| 515 | 536 | ||
| @@ -561,6 +582,8 @@ ENGINE *ENGINE_get_default_RAND(void); | |||
| 561 | * ciphering or digesting corresponding to "nid". */ | 582 | * ciphering or digesting corresponding to "nid". */ |
| 562 | ENGINE *ENGINE_get_cipher_engine(int nid); | 583 | ENGINE *ENGINE_get_cipher_engine(int nid); |
| 563 | ENGINE *ENGINE_get_digest_engine(int nid); | 584 | ENGINE *ENGINE_get_digest_engine(int nid); |
| 585 | ENGINE *ENGINE_get_pkey_meth_engine(int nid); | ||
| 586 | ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); | ||
| 564 | 587 | ||
| 565 | /* This sets a new default ENGINE structure for performing RSA | 588 | /* This sets a new default ENGINE structure for performing RSA |
| 566 | * operations. If the result is non-zero (success) then the ENGINE | 589 | * operations. If the result is non-zero (success) then the ENGINE |
| @@ -576,6 +599,8 @@ int ENGINE_set_default_DH(ENGINE *e); | |||
| 576 | int ENGINE_set_default_RAND(ENGINE *e); | 599 | int ENGINE_set_default_RAND(ENGINE *e); |
| 577 | int ENGINE_set_default_ciphers(ENGINE *e); | 600 | int ENGINE_set_default_ciphers(ENGINE *e); |
| 578 | int ENGINE_set_default_digests(ENGINE *e); | 601 | int ENGINE_set_default_digests(ENGINE *e); |
| 602 | int ENGINE_set_default_pkey_meths(ENGINE *e); | ||
| 603 | int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); | ||
| 579 | 604 | ||
| 580 | /* The combination "set" - the flags are bitwise "OR"d from the | 605 | /* The combination "set" - the flags are bitwise "OR"d from the |
| 581 | * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" | 606 | * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" |
| @@ -704,7 +729,7 @@ typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id, | |||
| 704 | * values. */ | 729 | * values. */ |
| 705 | void *ENGINE_get_static_state(void); | 730 | void *ENGINE_get_static_state(void); |
| 706 | 731 | ||
| 707 | #if defined(__OpenBSD__) || defined(__FreeBSD__) | 732 | #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) |
| 708 | void ENGINE_setup_bsd_cryptodev(void); | 733 | void ENGINE_setup_bsd_cryptodev(void); |
| 709 | #endif | 734 | #endif |
| 710 | 735 | ||
| @@ -733,13 +758,15 @@ void ERR_load_ENGINE_strings(void); | |||
| 733 | #define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177 | 758 | #define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177 |
| 734 | #define ENGINE_F_ENGINE_GET_DIGEST 186 | 759 | #define ENGINE_F_ENGINE_GET_DIGEST 186 |
| 735 | #define ENGINE_F_ENGINE_GET_NEXT 115 | 760 | #define ENGINE_F_ENGINE_GET_NEXT 115 |
| 761 | #define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193 | ||
| 762 | #define ENGINE_F_ENGINE_GET_PKEY_METH 192 | ||
| 736 | #define ENGINE_F_ENGINE_GET_PREV 116 | 763 | #define ENGINE_F_ENGINE_GET_PREV 116 |
| 737 | #define ENGINE_F_ENGINE_INIT 119 | 764 | #define ENGINE_F_ENGINE_INIT 119 |
| 738 | #define ENGINE_F_ENGINE_LIST_ADD 120 | 765 | #define ENGINE_F_ENGINE_LIST_ADD 120 |
| 739 | #define ENGINE_F_ENGINE_LIST_REMOVE 121 | 766 | #define ENGINE_F_ENGINE_LIST_REMOVE 121 |
| 740 | #define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 | 767 | #define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 |
| 741 | #define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 | 768 | #define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 |
| 742 | #define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 192 | 769 | #define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194 |
| 743 | #define ENGINE_F_ENGINE_NEW 122 | 770 | #define ENGINE_F_ENGINE_NEW 122 |
| 744 | #define ENGINE_F_ENGINE_REMOVE 123 | 771 | #define ENGINE_F_ENGINE_REMOVE 123 |
| 745 | #define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 | 772 | #define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 |
| @@ -768,6 +795,7 @@ void ERR_load_ENGINE_strings(void); | |||
| 768 | #define ENGINE_R_DSO_FAILURE 104 | 795 | #define ENGINE_R_DSO_FAILURE 104 |
| 769 | #define ENGINE_R_DSO_NOT_FOUND 132 | 796 | #define ENGINE_R_DSO_NOT_FOUND 132 |
| 770 | #define ENGINE_R_ENGINES_SECTION_ERROR 148 | 797 | #define ENGINE_R_ENGINES_SECTION_ERROR 148 |
| 798 | #define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 | ||
| 771 | #define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 | 799 | #define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 |
| 772 | #define ENGINE_R_ENGINE_SECTION_ERROR 149 | 800 | #define ENGINE_R_ENGINE_SECTION_ERROR 149 |
| 773 | #define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 | 801 | #define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 |
| @@ -794,6 +822,7 @@ void ERR_load_ENGINE_strings(void); | |||
| 794 | #define ENGINE_R_RSA_NOT_IMPLEMENTED 141 | 822 | #define ENGINE_R_RSA_NOT_IMPLEMENTED 141 |
| 795 | #define ENGINE_R_UNIMPLEMENTED_CIPHER 146 | 823 | #define ENGINE_R_UNIMPLEMENTED_CIPHER 146 |
| 796 | #define ENGINE_R_UNIMPLEMENTED_DIGEST 147 | 824 | #define ENGINE_R_UNIMPLEMENTED_DIGEST 147 |
| 825 | #define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 | ||
| 797 | #define ENGINE_R_VERSION_INCOMPATIBILITY 145 | 826 | #define ENGINE_R_VERSION_INCOMPATIBILITY 145 |
| 798 | 827 | ||
| 799 | #ifdef __cplusplus | 828 | #ifdef __cplusplus |
diff --git a/src/lib/libcrypto/engine/enginetest.c b/src/lib/libcrypto/engine/enginetest.c index e3834611db..f4d70e7e0a 100644 --- a/src/lib/libcrypto/engine/enginetest.c +++ b/src/lib/libcrypto/engine/enginetest.c | |||
| @@ -276,7 +276,7 @@ end: | |||
| 276 | ENGINE_cleanup(); | 276 | ENGINE_cleanup(); |
| 277 | CRYPTO_cleanup_all_ex_data(); | 277 | CRYPTO_cleanup_all_ex_data(); |
| 278 | ERR_free_strings(); | 278 | ERR_free_strings(); |
| 279 | ERR_remove_state(0); | 279 | ERR_remove_thread_state(NULL); |
| 280 | CRYPTO_mem_leaks_fp(stderr); | 280 | CRYPTO_mem_leaks_fp(stderr); |
| 281 | return to_return; | 281 | return to_return; |
| 282 | } | 282 | } |
diff --git a/src/lib/libcrypto/engine/hw.ec b/src/lib/libcrypto/engine/hw.ec deleted file mode 100644 index 5481a43918..0000000000 --- a/src/lib/libcrypto/engine/hw.ec +++ /dev/null | |||
| @@ -1,8 +0,0 @@ | |||
| 1 | L AEPHK hw_aep_err.h hw_aep_err.c | ||
| 2 | L ATALLA hw_atalla_err.h hw_atalla_err.c | ||
| 3 | L CSWIFT hw_cswift_err.h hw_cswift_err.c | ||
| 4 | L HWCRHK hw_ncipher_err.h hw_ncipher_err.c | ||
| 5 | L NURON hw_nuron_err.h hw_nuron_err.c | ||
| 6 | L SUREWARE hw_sureware_err.h hw_sureware_err.c | ||
| 7 | L UBSEC hw_ubsec_err.h hw_ubsec_err.c | ||
| 8 | L CCA4758 hw_4758_cca_err.h hw_4758_cca_err.c | ||
diff --git a/src/lib/libcrypto/engine/hw_4758_cca.c b/src/lib/libcrypto/engine/hw_4758_cca.c deleted file mode 100644 index 4f5ae8a46d..0000000000 --- a/src/lib/libcrypto/engine/hw_4758_cca.c +++ /dev/null | |||
| @@ -1,969 +0,0 @@ | |||
| 1 | /* Author: Maurice Gittens <maurice@gittens.nl> */ | ||
| 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 | * 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 <stdio.h> | ||
| 57 | #include <openssl/crypto.h> | ||
| 58 | /* #include <openssl/pem.h> */ | ||
| 59 | #include "cryptlib.h" | ||
| 60 | #include <openssl/dso.h> | ||
| 61 | #include <openssl/x509.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | #include <openssl/engine.h> | ||
| 64 | |||
| 65 | #ifndef OPENSSL_NO_HW | ||
| 66 | #ifndef OPENSSL_NO_HW_4758_CCA | ||
| 67 | |||
| 68 | #ifdef FLAT_INC | ||
| 69 | #include "hw_4758_cca.h" | ||
| 70 | #else | ||
| 71 | #include "vendor_defns/hw_4758_cca.h" | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #include "hw_4758_cca_err.c" | ||
| 75 | |||
| 76 | static int ibm_4758_cca_destroy(ENGINE *e); | ||
| 77 | static int ibm_4758_cca_init(ENGINE *e); | ||
| 78 | static int ibm_4758_cca_finish(ENGINE *e); | ||
| 79 | static int ibm_4758_cca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | ||
| 80 | |||
| 81 | /* rsa functions */ | ||
| 82 | /*---------------*/ | ||
| 83 | #ifndef OPENSSL_NO_RSA | ||
| 84 | static int cca_rsa_pub_enc(int flen, const unsigned char *from, | ||
| 85 | unsigned char *to, RSA *rsa,int padding); | ||
| 86 | static int cca_rsa_priv_dec(int flen, const unsigned char *from, | ||
| 87 | unsigned char *to, RSA *rsa,int padding); | ||
| 88 | static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len, | ||
| 89 | unsigned char *sigret, unsigned int *siglen, const RSA *rsa); | ||
| 90 | static int cca_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, | ||
| 91 | unsigned char *sigbuf, unsigned int siglen, const RSA *rsa); | ||
| 92 | |||
| 93 | /* utility functions */ | ||
| 94 | /*-----------------------*/ | ||
| 95 | static EVP_PKEY *ibm_4758_load_privkey(ENGINE*, const char*, | ||
| 96 | UI_METHOD *ui_method, void *callback_data); | ||
| 97 | static EVP_PKEY *ibm_4758_load_pubkey(ENGINE*, const char*, | ||
| 98 | UI_METHOD *ui_method, void *callback_data); | ||
| 99 | |||
| 100 | static int getModulusAndExponent(const unsigned char *token, long *exponentLength, | ||
| 101 | unsigned char *exponent, long *modulusLength, | ||
| 102 | long *modulusFieldLength, unsigned char *modulus); | ||
| 103 | #endif | ||
| 104 | |||
| 105 | /* RAND number functions */ | ||
| 106 | /*-----------------------*/ | ||
| 107 | static int cca_get_random_bytes(unsigned char*, int ); | ||
| 108 | static int cca_random_status(void); | ||
| 109 | |||
| 110 | static void cca_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
| 111 | int idx,long argl, void *argp); | ||
| 112 | |||
| 113 | /* Function pointers for CCA verbs */ | ||
| 114 | /*---------------------------------*/ | ||
| 115 | #ifndef OPENSSL_NO_RSA | ||
| 116 | static F_KEYRECORDREAD keyRecordRead; | ||
| 117 | static F_DIGITALSIGNATUREGENERATE digitalSignatureGenerate; | ||
| 118 | static F_DIGITALSIGNATUREVERIFY digitalSignatureVerify; | ||
| 119 | static F_PUBLICKEYEXTRACT publicKeyExtract; | ||
| 120 | static F_PKAENCRYPT pkaEncrypt; | ||
| 121 | static F_PKADECRYPT pkaDecrypt; | ||
| 122 | #endif | ||
| 123 | static F_RANDOMNUMBERGENERATE randomNumberGenerate; | ||
| 124 | |||
| 125 | /* static variables */ | ||
| 126 | /*------------------*/ | ||
| 127 | static const char *CCA4758_LIB_NAME = NULL; | ||
| 128 | static const char *get_CCA4758_LIB_NAME(void) | ||
| 129 | { | ||
| 130 | if(CCA4758_LIB_NAME) | ||
| 131 | return CCA4758_LIB_NAME; | ||
| 132 | return CCA_LIB_NAME; | ||
| 133 | } | ||
| 134 | static void free_CCA4758_LIB_NAME(void) | ||
| 135 | { | ||
| 136 | if(CCA4758_LIB_NAME) | ||
| 137 | OPENSSL_free((void*)CCA4758_LIB_NAME); | ||
| 138 | CCA4758_LIB_NAME = NULL; | ||
| 139 | } | ||
| 140 | static long set_CCA4758_LIB_NAME(const char *name) | ||
| 141 | { | ||
| 142 | free_CCA4758_LIB_NAME(); | ||
| 143 | return (((CCA4758_LIB_NAME = BUF_strdup(name)) != NULL) ? 1 : 0); | ||
| 144 | } | ||
| 145 | #ifndef OPENSSL_NO_RSA | ||
| 146 | static const char* n_keyRecordRead = CSNDKRR; | ||
| 147 | static const char* n_digitalSignatureGenerate = CSNDDSG; | ||
| 148 | static const char* n_digitalSignatureVerify = CSNDDSV; | ||
| 149 | static const char* n_publicKeyExtract = CSNDPKX; | ||
| 150 | static const char* n_pkaEncrypt = CSNDPKE; | ||
| 151 | static const char* n_pkaDecrypt = CSNDPKD; | ||
| 152 | #endif | ||
| 153 | static const char* n_randomNumberGenerate = CSNBRNG; | ||
| 154 | |||
| 155 | static int hndidx = -1; | ||
| 156 | static DSO *dso = NULL; | ||
| 157 | |||
| 158 | /* openssl engine initialization structures */ | ||
| 159 | /*------------------------------------------*/ | ||
| 160 | |||
| 161 | #define CCA4758_CMD_SO_PATH ENGINE_CMD_BASE | ||
| 162 | static const ENGINE_CMD_DEFN cca4758_cmd_defns[] = { | ||
| 163 | {CCA4758_CMD_SO_PATH, | ||
| 164 | "SO_PATH", | ||
| 165 | "Specifies the path to the '4758cca' shared library", | ||
| 166 | ENGINE_CMD_FLAG_STRING}, | ||
| 167 | {0, NULL, NULL, 0} | ||
| 168 | }; | ||
| 169 | |||
| 170 | #ifndef OPENSSL_NO_RSA | ||
| 171 | static RSA_METHOD ibm_4758_cca_rsa = | ||
| 172 | { | ||
| 173 | "IBM 4758 CCA RSA method", | ||
| 174 | cca_rsa_pub_enc, | ||
| 175 | NULL, | ||
| 176 | NULL, | ||
| 177 | cca_rsa_priv_dec, | ||
| 178 | NULL, /*rsa_mod_exp,*/ | ||
| 179 | NULL, /*mod_exp_mont,*/ | ||
| 180 | NULL, /* init */ | ||
| 181 | NULL, /* finish */ | ||
| 182 | RSA_FLAG_SIGN_VER, /* flags */ | ||
| 183 | NULL, /* app_data */ | ||
| 184 | cca_rsa_sign, /* rsa_sign */ | ||
| 185 | cca_rsa_verify /* rsa_verify */ | ||
| 186 | }; | ||
| 187 | #endif | ||
| 188 | |||
| 189 | static RAND_METHOD ibm_4758_cca_rand = | ||
| 190 | { | ||
| 191 | /* "IBM 4758 RAND method", */ | ||
| 192 | NULL, /* seed */ | ||
| 193 | cca_get_random_bytes, /* get random bytes from the card */ | ||
| 194 | NULL, /* cleanup */ | ||
| 195 | NULL, /* add */ | ||
| 196 | cca_get_random_bytes, /* pseudo rand */ | ||
| 197 | cca_random_status, /* status */ | ||
| 198 | }; | ||
| 199 | |||
| 200 | static const char *engine_4758_cca_id = "4758cca"; | ||
| 201 | static const char *engine_4758_cca_name = "IBM 4758 CCA hardware engine support"; | ||
| 202 | |||
| 203 | /* engine implementation */ | ||
| 204 | /*-----------------------*/ | ||
| 205 | static int bind_helper(ENGINE *e) | ||
| 206 | { | ||
| 207 | if(!ENGINE_set_id(e, engine_4758_cca_id) || | ||
| 208 | !ENGINE_set_name(e, engine_4758_cca_name) || | ||
| 209 | #ifndef OPENSSL_NO_RSA | ||
| 210 | !ENGINE_set_RSA(e, &ibm_4758_cca_rsa) || | ||
| 211 | #endif | ||
| 212 | !ENGINE_set_RAND(e, &ibm_4758_cca_rand) || | ||
| 213 | !ENGINE_set_destroy_function(e, ibm_4758_cca_destroy) || | ||
| 214 | !ENGINE_set_init_function(e, ibm_4758_cca_init) || | ||
| 215 | !ENGINE_set_finish_function(e, ibm_4758_cca_finish) || | ||
| 216 | !ENGINE_set_ctrl_function(e, ibm_4758_cca_ctrl) || | ||
| 217 | !ENGINE_set_load_privkey_function(e, ibm_4758_load_privkey) || | ||
| 218 | !ENGINE_set_load_pubkey_function(e, ibm_4758_load_pubkey) || | ||
| 219 | !ENGINE_set_cmd_defns(e, cca4758_cmd_defns)) | ||
| 220 | return 0; | ||
| 221 | /* Ensure the error handling is set up */ | ||
| 222 | ERR_load_CCA4758_strings(); | ||
| 223 | return 1; | ||
| 224 | } | ||
| 225 | |||
| 226 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 227 | static ENGINE *engine_4758_cca(void) | ||
| 228 | { | ||
| 229 | ENGINE *ret = ENGINE_new(); | ||
| 230 | if(!ret) | ||
| 231 | return NULL; | ||
| 232 | if(!bind_helper(ret)) | ||
| 233 | { | ||
| 234 | ENGINE_free(ret); | ||
| 235 | return NULL; | ||
| 236 | } | ||
| 237 | return ret; | ||
| 238 | } | ||
| 239 | |||
| 240 | void ENGINE_load_4758cca(void) | ||
| 241 | { | ||
| 242 | ENGINE *e_4758 = engine_4758_cca(); | ||
| 243 | if (!e_4758) return; | ||
| 244 | ENGINE_add(e_4758); | ||
| 245 | ENGINE_free(e_4758); | ||
| 246 | ERR_clear_error(); | ||
| 247 | } | ||
| 248 | #endif | ||
| 249 | |||
| 250 | static int ibm_4758_cca_destroy(ENGINE *e) | ||
| 251 | { | ||
| 252 | ERR_unload_CCA4758_strings(); | ||
| 253 | free_CCA4758_LIB_NAME(); | ||
| 254 | return 1; | ||
| 255 | } | ||
| 256 | |||
| 257 | static int ibm_4758_cca_init(ENGINE *e) | ||
| 258 | { | ||
| 259 | if(dso) | ||
| 260 | { | ||
| 261 | CCA4758err(CCA4758_F_IBM_4758_CCA_INIT,CCA4758_R_ALREADY_LOADED); | ||
| 262 | goto err; | ||
| 263 | } | ||
| 264 | |||
| 265 | dso = DSO_load(NULL, get_CCA4758_LIB_NAME(), NULL, 0); | ||
| 266 | if(!dso) | ||
| 267 | { | ||
| 268 | CCA4758err(CCA4758_F_IBM_4758_CCA_INIT,CCA4758_R_DSO_FAILURE); | ||
| 269 | goto err; | ||
| 270 | } | ||
| 271 | |||
| 272 | #ifndef OPENSSL_NO_RSA | ||
| 273 | if(!(keyRecordRead = (F_KEYRECORDREAD) | ||
| 274 | DSO_bind_func(dso, n_keyRecordRead)) || | ||
| 275 | !(randomNumberGenerate = (F_RANDOMNUMBERGENERATE) | ||
| 276 | DSO_bind_func(dso, n_randomNumberGenerate)) || | ||
| 277 | !(digitalSignatureGenerate = (F_DIGITALSIGNATUREGENERATE) | ||
| 278 | DSO_bind_func(dso, n_digitalSignatureGenerate)) || | ||
| 279 | !(digitalSignatureVerify = (F_DIGITALSIGNATUREVERIFY) | ||
| 280 | DSO_bind_func(dso, n_digitalSignatureVerify)) || | ||
| 281 | !(publicKeyExtract = (F_PUBLICKEYEXTRACT) | ||
| 282 | DSO_bind_func(dso, n_publicKeyExtract)) || | ||
| 283 | !(pkaEncrypt = (F_PKAENCRYPT) | ||
| 284 | DSO_bind_func(dso, n_pkaEncrypt)) || | ||
| 285 | !(pkaDecrypt = (F_PKADECRYPT) | ||
| 286 | DSO_bind_func(dso, n_pkaDecrypt))) | ||
| 287 | { | ||
| 288 | CCA4758err(CCA4758_F_IBM_4758_CCA_INIT,CCA4758_R_DSO_FAILURE); | ||
| 289 | goto err; | ||
| 290 | } | ||
| 291 | #else | ||
| 292 | if(!(randomNumberGenerate = (F_RANDOMNUMBERGENERATE) | ||
| 293 | DSO_bind_func(dso, n_randomNumberGenerate))) | ||
| 294 | { | ||
| 295 | CCA4758err(CCA4758_F_IBM_4758_CCA_INIT,CCA4758_R_DSO_FAILURE); | ||
| 296 | goto err; | ||
| 297 | } | ||
| 298 | #endif | ||
| 299 | |||
| 300 | hndidx = RSA_get_ex_new_index(0, "IBM 4758 CCA RSA key handle", | ||
| 301 | NULL, NULL, cca_ex_free); | ||
| 302 | |||
| 303 | return 1; | ||
| 304 | err: | ||
| 305 | if(dso) | ||
| 306 | DSO_free(dso); | ||
| 307 | dso = NULL; | ||
| 308 | |||
| 309 | keyRecordRead = (F_KEYRECORDREAD)0; | ||
| 310 | randomNumberGenerate = (F_RANDOMNUMBERGENERATE)0; | ||
| 311 | digitalSignatureGenerate = (F_DIGITALSIGNATUREGENERATE)0; | ||
| 312 | digitalSignatureVerify = (F_DIGITALSIGNATUREVERIFY)0; | ||
| 313 | publicKeyExtract = (F_PUBLICKEYEXTRACT)0; | ||
| 314 | pkaEncrypt = (F_PKAENCRYPT)0; | ||
| 315 | pkaDecrypt = (F_PKADECRYPT)0; | ||
| 316 | return 0; | ||
| 317 | } | ||
| 318 | |||
| 319 | static int ibm_4758_cca_finish(ENGINE *e) | ||
| 320 | { | ||
| 321 | free_CCA4758_LIB_NAME(); | ||
| 322 | if(!dso) | ||
| 323 | { | ||
| 324 | CCA4758err(CCA4758_F_IBM_4758_CCA_FINISH, | ||
| 325 | CCA4758_R_NOT_LOADED); | ||
| 326 | return 0; | ||
| 327 | } | ||
| 328 | if(!DSO_free(dso)) | ||
| 329 | { | ||
| 330 | CCA4758err(CCA4758_F_IBM_4758_CCA_FINISH, | ||
| 331 | CCA4758_R_UNIT_FAILURE); | ||
| 332 | return 0; | ||
| 333 | } | ||
| 334 | dso = NULL; | ||
| 335 | keyRecordRead = (F_KEYRECORDREAD)0; | ||
| 336 | randomNumberGenerate = (F_RANDOMNUMBERGENERATE)0; | ||
| 337 | digitalSignatureGenerate = (F_DIGITALSIGNATUREGENERATE)0; | ||
| 338 | digitalSignatureVerify = (F_DIGITALSIGNATUREVERIFY)0; | ||
| 339 | publicKeyExtract = (F_PUBLICKEYEXTRACT)0; | ||
| 340 | pkaEncrypt = (F_PKAENCRYPT)0; | ||
| 341 | pkaDecrypt = (F_PKADECRYPT)0; | ||
| 342 | return 1; | ||
| 343 | } | ||
| 344 | |||
| 345 | static int ibm_4758_cca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | ||
| 346 | { | ||
| 347 | int initialised = ((dso == NULL) ? 0 : 1); | ||
| 348 | switch(cmd) | ||
| 349 | { | ||
| 350 | case CCA4758_CMD_SO_PATH: | ||
| 351 | if(p == NULL) | ||
| 352 | { | ||
| 353 | CCA4758err(CCA4758_F_IBM_4758_CCA_CTRL, | ||
| 354 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 355 | return 0; | ||
| 356 | } | ||
| 357 | if(initialised) | ||
| 358 | { | ||
| 359 | CCA4758err(CCA4758_F_IBM_4758_CCA_CTRL, | ||
| 360 | CCA4758_R_ALREADY_LOADED); | ||
| 361 | return 0; | ||
| 362 | } | ||
| 363 | return set_CCA4758_LIB_NAME((const char *)p); | ||
| 364 | default: | ||
| 365 | break; | ||
| 366 | } | ||
| 367 | CCA4758err(CCA4758_F_IBM_4758_CCA_CTRL, | ||
| 368 | CCA4758_R_COMMAND_NOT_IMPLEMENTED); | ||
| 369 | return 0; | ||
| 370 | } | ||
| 371 | |||
| 372 | #ifndef OPENSSL_NO_RSA | ||
| 373 | |||
| 374 | #define MAX_CCA_PKA_TOKEN_SIZE 2500 | ||
| 375 | |||
| 376 | static EVP_PKEY *ibm_4758_load_privkey(ENGINE* e, const char* key_id, | ||
| 377 | UI_METHOD *ui_method, void *callback_data) | ||
| 378 | { | ||
| 379 | RSA *rtmp = NULL; | ||
| 380 | EVP_PKEY *res = NULL; | ||
| 381 | unsigned char* keyToken = NULL; | ||
| 382 | unsigned char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE]; | ||
| 383 | long pubKeyTokenLength = MAX_CCA_PKA_TOKEN_SIZE; | ||
| 384 | long keyTokenLength = MAX_CCA_PKA_TOKEN_SIZE; | ||
| 385 | long returnCode; | ||
| 386 | long reasonCode; | ||
| 387 | long exitDataLength = 0; | ||
| 388 | long ruleArrayLength = 0; | ||
| 389 | unsigned char exitData[8]; | ||
| 390 | unsigned char ruleArray[8]; | ||
| 391 | unsigned char keyLabel[64]; | ||
| 392 | long keyLabelLength = strlen(key_id); | ||
| 393 | unsigned char modulus[256]; | ||
| 394 | long modulusFieldLength = sizeof(modulus); | ||
| 395 | long modulusLength = 0; | ||
| 396 | unsigned char exponent[256]; | ||
| 397 | long exponentLength = sizeof(exponent); | ||
| 398 | |||
| 399 | if (keyLabelLength > sizeof(keyLabel)) | ||
| 400 | { | ||
| 401 | CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY, | ||
| 402 | CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
| 403 | return NULL; | ||
| 404 | } | ||
| 405 | |||
| 406 | memset(keyLabel,' ', sizeof(keyLabel)); | ||
| 407 | memcpy(keyLabel, key_id, keyLabelLength); | ||
| 408 | |||
| 409 | keyToken = OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long)); | ||
| 410 | if (!keyToken) | ||
| 411 | { | ||
| 412 | CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY, | ||
| 413 | ERR_R_MALLOC_FAILURE); | ||
| 414 | goto err; | ||
| 415 | } | ||
| 416 | |||
| 417 | keyRecordRead(&returnCode, &reasonCode, &exitDataLength, | ||
| 418 | exitData, &ruleArrayLength, ruleArray, keyLabel, | ||
| 419 | &keyTokenLength, keyToken+sizeof(long)); | ||
| 420 | |||
| 421 | if (returnCode) | ||
| 422 | { | ||
| 423 | CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY, | ||
| 424 | CCA4758_R_FAILED_LOADING_PRIVATE_KEY); | ||
| 425 | goto err; | ||
| 426 | } | ||
| 427 | |||
| 428 | publicKeyExtract(&returnCode, &reasonCode, &exitDataLength, | ||
| 429 | exitData, &ruleArrayLength, ruleArray, &keyTokenLength, | ||
| 430 | keyToken+sizeof(long), &pubKeyTokenLength, pubKeyToken); | ||
| 431 | |||
| 432 | if (returnCode) | ||
| 433 | { | ||
| 434 | CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY, | ||
| 435 | CCA4758_R_FAILED_LOADING_PRIVATE_KEY); | ||
| 436 | goto err; | ||
| 437 | } | ||
| 438 | |||
| 439 | if (!getModulusAndExponent(pubKeyToken, &exponentLength, | ||
| 440 | exponent, &modulusLength, &modulusFieldLength, | ||
| 441 | modulus)) | ||
| 442 | { | ||
| 443 | CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY, | ||
| 444 | CCA4758_R_FAILED_LOADING_PRIVATE_KEY); | ||
| 445 | goto err; | ||
| 446 | } | ||
| 447 | |||
| 448 | (*(long*)keyToken) = keyTokenLength; | ||
| 449 | rtmp = RSA_new_method(e); | ||
| 450 | RSA_set_ex_data(rtmp, hndidx, (char *)keyToken); | ||
| 451 | |||
| 452 | rtmp->e = BN_bin2bn(exponent, exponentLength, NULL); | ||
| 453 | rtmp->n = BN_bin2bn(modulus, modulusFieldLength, NULL); | ||
| 454 | rtmp->flags |= RSA_FLAG_EXT_PKEY; | ||
| 455 | |||
| 456 | res = EVP_PKEY_new(); | ||
| 457 | EVP_PKEY_assign_RSA(res, rtmp); | ||
| 458 | |||
| 459 | return res; | ||
| 460 | err: | ||
| 461 | if (keyToken) | ||
| 462 | OPENSSL_free(keyToken); | ||
| 463 | if (res) | ||
| 464 | EVP_PKEY_free(res); | ||
| 465 | if (rtmp) | ||
| 466 | RSA_free(rtmp); | ||
| 467 | return NULL; | ||
| 468 | } | ||
| 469 | |||
| 470 | static EVP_PKEY *ibm_4758_load_pubkey(ENGINE* e, const char* key_id, | ||
| 471 | UI_METHOD *ui_method, void *callback_data) | ||
| 472 | { | ||
| 473 | RSA *rtmp = NULL; | ||
| 474 | EVP_PKEY *res = NULL; | ||
| 475 | unsigned char* keyToken = NULL; | ||
| 476 | long keyTokenLength = MAX_CCA_PKA_TOKEN_SIZE; | ||
| 477 | long returnCode; | ||
| 478 | long reasonCode; | ||
| 479 | long exitDataLength = 0; | ||
| 480 | long ruleArrayLength = 0; | ||
| 481 | unsigned char exitData[8]; | ||
| 482 | unsigned char ruleArray[8]; | ||
| 483 | unsigned char keyLabel[64]; | ||
| 484 | long keyLabelLength = strlen(key_id); | ||
| 485 | unsigned char modulus[512]; | ||
| 486 | long modulusFieldLength = sizeof(modulus); | ||
| 487 | long modulusLength = 0; | ||
| 488 | unsigned char exponent[512]; | ||
| 489 | long exponentLength = sizeof(exponent); | ||
| 490 | |||
| 491 | if (keyLabelLength > sizeof(keyLabel)) | ||
| 492 | { | ||
| 493 | CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY, | ||
| 494 | CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
| 495 | return NULL; | ||
| 496 | } | ||
| 497 | |||
| 498 | memset(keyLabel,' ', sizeof(keyLabel)); | ||
| 499 | memcpy(keyLabel, key_id, keyLabelLength); | ||
| 500 | |||
| 501 | keyToken = OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long)); | ||
| 502 | if (!keyToken) | ||
| 503 | { | ||
| 504 | CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PUBKEY, | ||
| 505 | ERR_R_MALLOC_FAILURE); | ||
| 506 | goto err; | ||
| 507 | } | ||
| 508 | |||
| 509 | keyRecordRead(&returnCode, &reasonCode, &exitDataLength, exitData, | ||
| 510 | &ruleArrayLength, ruleArray, keyLabel, &keyTokenLength, | ||
| 511 | keyToken+sizeof(long)); | ||
| 512 | |||
| 513 | if (returnCode) | ||
| 514 | { | ||
| 515 | CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY, | ||
| 516 | ERR_R_MALLOC_FAILURE); | ||
| 517 | goto err; | ||
| 518 | } | ||
| 519 | |||
| 520 | if (!getModulusAndExponent(keyToken+sizeof(long), &exponentLength, | ||
| 521 | exponent, &modulusLength, &modulusFieldLength, modulus)) | ||
| 522 | { | ||
| 523 | CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY, | ||
| 524 | CCA4758_R_FAILED_LOADING_PUBLIC_KEY); | ||
| 525 | goto err; | ||
| 526 | } | ||
| 527 | |||
| 528 | (*(long*)keyToken) = keyTokenLength; | ||
| 529 | rtmp = RSA_new_method(e); | ||
| 530 | RSA_set_ex_data(rtmp, hndidx, (char *)keyToken); | ||
| 531 | rtmp->e = BN_bin2bn(exponent, exponentLength, NULL); | ||
| 532 | rtmp->n = BN_bin2bn(modulus, modulusFieldLength, NULL); | ||
| 533 | rtmp->flags |= RSA_FLAG_EXT_PKEY; | ||
| 534 | res = EVP_PKEY_new(); | ||
| 535 | EVP_PKEY_assign_RSA(res, rtmp); | ||
| 536 | |||
| 537 | return res; | ||
| 538 | err: | ||
| 539 | if (keyToken) | ||
| 540 | OPENSSL_free(keyToken); | ||
| 541 | if (res) | ||
| 542 | EVP_PKEY_free(res); | ||
| 543 | if (rtmp) | ||
| 544 | RSA_free(rtmp); | ||
| 545 | return NULL; | ||
| 546 | } | ||
| 547 | |||
| 548 | static int cca_rsa_pub_enc(int flen, const unsigned char *from, | ||
| 549 | unsigned char *to, RSA *rsa,int padding) | ||
| 550 | { | ||
| 551 | long returnCode; | ||
| 552 | long reasonCode; | ||
| 553 | long lflen = flen; | ||
| 554 | long exitDataLength = 0; | ||
| 555 | unsigned char exitData[8]; | ||
| 556 | long ruleArrayLength = 1; | ||
| 557 | unsigned char ruleArray[8] = "PKCS-1.2"; | ||
| 558 | long dataStructureLength = 0; | ||
| 559 | unsigned char dataStructure[8]; | ||
| 560 | long outputLength = RSA_size(rsa); | ||
| 561 | long keyTokenLength; | ||
| 562 | unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); | ||
| 563 | |||
| 564 | keyTokenLength = *(long*)keyToken; | ||
| 565 | keyToken+=sizeof(long); | ||
| 566 | |||
| 567 | pkaEncrypt(&returnCode, &reasonCode, &exitDataLength, exitData, | ||
| 568 | &ruleArrayLength, ruleArray, &lflen, (unsigned char*)from, | ||
| 569 | &dataStructureLength, dataStructure, &keyTokenLength, | ||
| 570 | keyToken, &outputLength, to); | ||
| 571 | |||
| 572 | if (returnCode || reasonCode) | ||
| 573 | return -(returnCode << 16 | reasonCode); | ||
| 574 | return outputLength; | ||
| 575 | } | ||
| 576 | |||
| 577 | static int cca_rsa_priv_dec(int flen, const unsigned char *from, | ||
| 578 | unsigned char *to, RSA *rsa,int padding) | ||
| 579 | { | ||
| 580 | long returnCode; | ||
| 581 | long reasonCode; | ||
| 582 | long lflen = flen; | ||
| 583 | long exitDataLength = 0; | ||
| 584 | unsigned char exitData[8]; | ||
| 585 | long ruleArrayLength = 1; | ||
| 586 | unsigned char ruleArray[8] = "PKCS-1.2"; | ||
| 587 | long dataStructureLength = 0; | ||
| 588 | unsigned char dataStructure[8]; | ||
| 589 | long outputLength = RSA_size(rsa); | ||
| 590 | long keyTokenLength; | ||
| 591 | unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); | ||
| 592 | |||
| 593 | keyTokenLength = *(long*)keyToken; | ||
| 594 | keyToken+=sizeof(long); | ||
| 595 | |||
| 596 | pkaDecrypt(&returnCode, &reasonCode, &exitDataLength, exitData, | ||
| 597 | &ruleArrayLength, ruleArray, &lflen, (unsigned char*)from, | ||
| 598 | &dataStructureLength, dataStructure, &keyTokenLength, | ||
| 599 | keyToken, &outputLength, to); | ||
| 600 | |||
| 601 | return (returnCode | reasonCode) ? 0 : 1; | ||
| 602 | } | ||
| 603 | |||
| 604 | #define SSL_SIG_LEN 36 | ||
| 605 | |||
| 606 | static int cca_rsa_verify(int type, const unsigned char *m, unsigned int m_len, | ||
| 607 | unsigned char *sigbuf, unsigned int siglen, const RSA *rsa) | ||
| 608 | { | ||
| 609 | long returnCode; | ||
| 610 | long reasonCode; | ||
| 611 | long lsiglen = siglen; | ||
| 612 | long exitDataLength = 0; | ||
| 613 | unsigned char exitData[8]; | ||
| 614 | long ruleArrayLength = 1; | ||
| 615 | unsigned char ruleArray[8] = "PKCS-1.1"; | ||
| 616 | long keyTokenLength; | ||
| 617 | unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); | ||
| 618 | long length = SSL_SIG_LEN; | ||
| 619 | long keyLength ; | ||
| 620 | unsigned char *hashBuffer = NULL; | ||
| 621 | X509_SIG sig; | ||
| 622 | ASN1_TYPE parameter; | ||
| 623 | X509_ALGOR algorithm; | ||
| 624 | ASN1_OCTET_STRING digest; | ||
| 625 | |||
| 626 | keyTokenLength = *(long*)keyToken; | ||
| 627 | keyToken+=sizeof(long); | ||
| 628 | |||
| 629 | if (type == NID_md5 || type == NID_sha1) | ||
| 630 | { | ||
| 631 | sig.algor = &algorithm; | ||
| 632 | algorithm.algorithm = OBJ_nid2obj(type); | ||
| 633 | |||
| 634 | if (!algorithm.algorithm) | ||
| 635 | { | ||
| 636 | CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, | ||
| 637 | CCA4758_R_UNKNOWN_ALGORITHM_TYPE); | ||
| 638 | return 0; | ||
| 639 | } | ||
| 640 | |||
| 641 | if (!algorithm.algorithm->length) | ||
| 642 | { | ||
| 643 | CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, | ||
| 644 | CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD); | ||
| 645 | return 0; | ||
| 646 | } | ||
| 647 | |||
| 648 | parameter.type = V_ASN1_NULL; | ||
| 649 | parameter.value.ptr = NULL; | ||
| 650 | algorithm.parameter = ¶meter; | ||
| 651 | |||
| 652 | sig.digest = &digest; | ||
| 653 | sig.digest->data = (unsigned char*)m; | ||
| 654 | sig.digest->length = m_len; | ||
| 655 | |||
| 656 | length = i2d_X509_SIG(&sig, NULL); | ||
| 657 | } | ||
| 658 | |||
| 659 | keyLength = RSA_size(rsa); | ||
| 660 | |||
| 661 | if (length - RSA_PKCS1_PADDING > keyLength) | ||
| 662 | { | ||
| 663 | CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, | ||
| 664 | CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
| 665 | return 0; | ||
| 666 | } | ||
| 667 | |||
| 668 | switch (type) | ||
| 669 | { | ||
| 670 | case NID_md5_sha1 : | ||
| 671 | if (m_len != SSL_SIG_LEN) | ||
| 672 | { | ||
| 673 | CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, | ||
| 674 | CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
| 675 | return 0; | ||
| 676 | } | ||
| 677 | |||
| 678 | hashBuffer = (unsigned char *)m; | ||
| 679 | length = m_len; | ||
| 680 | break; | ||
| 681 | case NID_md5 : | ||
| 682 | { | ||
| 683 | unsigned char *ptr; | ||
| 684 | ptr = hashBuffer = OPENSSL_malloc( | ||
| 685 | (unsigned int)keyLength+1); | ||
| 686 | if (!hashBuffer) | ||
| 687 | { | ||
| 688 | CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, | ||
| 689 | ERR_R_MALLOC_FAILURE); | ||
| 690 | return 0; | ||
| 691 | } | ||
| 692 | |||
| 693 | i2d_X509_SIG(&sig, &ptr); | ||
| 694 | } | ||
| 695 | break; | ||
| 696 | case NID_sha1 : | ||
| 697 | { | ||
| 698 | unsigned char *ptr; | ||
| 699 | ptr = hashBuffer = OPENSSL_malloc( | ||
| 700 | (unsigned int)keyLength+1); | ||
| 701 | if (!hashBuffer) | ||
| 702 | { | ||
| 703 | CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, | ||
| 704 | ERR_R_MALLOC_FAILURE); | ||
| 705 | return 0; | ||
| 706 | } | ||
| 707 | i2d_X509_SIG(&sig, &ptr); | ||
| 708 | } | ||
| 709 | break; | ||
| 710 | default: | ||
| 711 | return 0; | ||
| 712 | } | ||
| 713 | |||
| 714 | digitalSignatureVerify(&returnCode, &reasonCode, &exitDataLength, | ||
| 715 | exitData, &ruleArrayLength, ruleArray, &keyTokenLength, | ||
| 716 | keyToken, &length, hashBuffer, &lsiglen, sigbuf); | ||
| 717 | |||
| 718 | if (type == NID_sha1 || type == NID_md5) | ||
| 719 | { | ||
| 720 | OPENSSL_cleanse(hashBuffer, keyLength+1); | ||
| 721 | OPENSSL_free(hashBuffer); | ||
| 722 | } | ||
| 723 | |||
| 724 | return ((returnCode || reasonCode) ? 0 : 1); | ||
| 725 | } | ||
| 726 | |||
| 727 | #define SSL_SIG_LEN 36 | ||
| 728 | |||
| 729 | static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len, | ||
| 730 | unsigned char *sigret, unsigned int *siglen, const RSA *rsa) | ||
| 731 | { | ||
| 732 | long returnCode; | ||
| 733 | long reasonCode; | ||
| 734 | long exitDataLength = 0; | ||
| 735 | unsigned char exitData[8]; | ||
| 736 | long ruleArrayLength = 1; | ||
| 737 | unsigned char ruleArray[8] = "PKCS-1.1"; | ||
| 738 | long outputLength=256; | ||
| 739 | long outputBitLength; | ||
| 740 | long keyTokenLength; | ||
| 741 | unsigned char *hashBuffer = NULL; | ||
| 742 | unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); | ||
| 743 | long length = SSL_SIG_LEN; | ||
| 744 | long keyLength ; | ||
| 745 | X509_SIG sig; | ||
| 746 | ASN1_TYPE parameter; | ||
| 747 | X509_ALGOR algorithm; | ||
| 748 | ASN1_OCTET_STRING digest; | ||
| 749 | |||
| 750 | keyTokenLength = *(long*)keyToken; | ||
| 751 | keyToken+=sizeof(long); | ||
| 752 | |||
| 753 | if (type == NID_md5 || type == NID_sha1) | ||
| 754 | { | ||
| 755 | sig.algor = &algorithm; | ||
| 756 | algorithm.algorithm = OBJ_nid2obj(type); | ||
| 757 | |||
| 758 | if (!algorithm.algorithm) | ||
| 759 | { | ||
| 760 | CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN, | ||
| 761 | CCA4758_R_UNKNOWN_ALGORITHM_TYPE); | ||
| 762 | return 0; | ||
| 763 | } | ||
| 764 | |||
| 765 | if (!algorithm.algorithm->length) | ||
| 766 | { | ||
| 767 | CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN, | ||
| 768 | CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD); | ||
| 769 | return 0; | ||
| 770 | } | ||
| 771 | |||
| 772 | parameter.type = V_ASN1_NULL; | ||
| 773 | parameter.value.ptr = NULL; | ||
| 774 | algorithm.parameter = ¶meter; | ||
| 775 | |||
| 776 | sig.digest = &digest; | ||
| 777 | sig.digest->data = (unsigned char*)m; | ||
| 778 | sig.digest->length = m_len; | ||
| 779 | |||
| 780 | length = i2d_X509_SIG(&sig, NULL); | ||
| 781 | } | ||
| 782 | |||
| 783 | keyLength = RSA_size(rsa); | ||
| 784 | |||
| 785 | if (length - RSA_PKCS1_PADDING > keyLength) | ||
| 786 | { | ||
| 787 | CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN, | ||
| 788 | CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
| 789 | return 0; | ||
| 790 | } | ||
| 791 | |||
| 792 | switch (type) | ||
| 793 | { | ||
| 794 | case NID_md5_sha1 : | ||
| 795 | if (m_len != SSL_SIG_LEN) | ||
| 796 | { | ||
| 797 | CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN, | ||
| 798 | CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
| 799 | return 0; | ||
| 800 | } | ||
| 801 | hashBuffer = (unsigned char*)m; | ||
| 802 | length = m_len; | ||
| 803 | break; | ||
| 804 | case NID_md5 : | ||
| 805 | { | ||
| 806 | unsigned char *ptr; | ||
| 807 | ptr = hashBuffer = OPENSSL_malloc( | ||
| 808 | (unsigned int)keyLength+1); | ||
| 809 | if (!hashBuffer) | ||
| 810 | { | ||
| 811 | CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, | ||
| 812 | ERR_R_MALLOC_FAILURE); | ||
| 813 | return 0; | ||
| 814 | } | ||
| 815 | i2d_X509_SIG(&sig, &ptr); | ||
| 816 | } | ||
| 817 | break; | ||
| 818 | case NID_sha1 : | ||
| 819 | { | ||
| 820 | unsigned char *ptr; | ||
| 821 | ptr = hashBuffer = OPENSSL_malloc( | ||
| 822 | (unsigned int)keyLength+1); | ||
| 823 | if (!hashBuffer) | ||
| 824 | { | ||
| 825 | CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, | ||
| 826 | ERR_R_MALLOC_FAILURE); | ||
| 827 | return 0; | ||
| 828 | } | ||
| 829 | i2d_X509_SIG(&sig, &ptr); | ||
| 830 | } | ||
| 831 | break; | ||
| 832 | default: | ||
| 833 | return 0; | ||
| 834 | } | ||
| 835 | |||
| 836 | digitalSignatureGenerate(&returnCode, &reasonCode, &exitDataLength, | ||
| 837 | exitData, &ruleArrayLength, ruleArray, &keyTokenLength, | ||
| 838 | keyToken, &length, hashBuffer, &outputLength, &outputBitLength, | ||
| 839 | sigret); | ||
| 840 | |||
| 841 | if (type == NID_sha1 || type == NID_md5) | ||
| 842 | { | ||
| 843 | OPENSSL_cleanse(hashBuffer, keyLength+1); | ||
| 844 | OPENSSL_free(hashBuffer); | ||
| 845 | } | ||
| 846 | |||
| 847 | *siglen = outputLength; | ||
| 848 | |||
| 849 | return ((returnCode || reasonCode) ? 0 : 1); | ||
| 850 | } | ||
| 851 | |||
| 852 | static int getModulusAndExponent(const unsigned char*token, long *exponentLength, | ||
| 853 | unsigned char *exponent, long *modulusLength, long *modulusFieldLength, | ||
| 854 | unsigned char *modulus) | ||
| 855 | { | ||
| 856 | unsigned long len; | ||
| 857 | |||
| 858 | if (*token++ != (char)0x1E) /* internal PKA token? */ | ||
| 859 | return 0; | ||
| 860 | |||
| 861 | if (*token++) /* token version must be zero */ | ||
| 862 | return 0; | ||
| 863 | |||
| 864 | len = *token++; | ||
| 865 | len = len << 8; | ||
| 866 | len |= (unsigned char)*token++; | ||
| 867 | |||
| 868 | token += 4; /* skip reserved bytes */ | ||
| 869 | |||
| 870 | if (*token++ == (char)0x04) | ||
| 871 | { | ||
| 872 | if (*token++) /* token version must be zero */ | ||
| 873 | return 0; | ||
| 874 | |||
| 875 | len = *token++; | ||
| 876 | len = len << 8; | ||
| 877 | len |= (unsigned char)*token++; | ||
| 878 | |||
| 879 | token+=2; /* skip reserved section */ | ||
| 880 | |||
| 881 | len = *token++; | ||
| 882 | len = len << 8; | ||
| 883 | len |= (unsigned char)*token++; | ||
| 884 | |||
| 885 | *exponentLength = len; | ||
| 886 | |||
| 887 | len = *token++; | ||
| 888 | len = len << 8; | ||
| 889 | len |= (unsigned char)*token++; | ||
| 890 | |||
| 891 | *modulusLength = len; | ||
| 892 | |||
| 893 | len = *token++; | ||
| 894 | len = len << 8; | ||
| 895 | len |= (unsigned char)*token++; | ||
| 896 | |||
| 897 | *modulusFieldLength = len; | ||
| 898 | |||
| 899 | memcpy(exponent, token, *exponentLength); | ||
| 900 | token+= *exponentLength; | ||
| 901 | |||
| 902 | memcpy(modulus, token, *modulusFieldLength); | ||
| 903 | return 1; | ||
| 904 | } | ||
| 905 | return 0; | ||
| 906 | } | ||
| 907 | |||
| 908 | #endif /* OPENSSL_NO_RSA */ | ||
| 909 | |||
| 910 | static int cca_random_status(void) | ||
| 911 | { | ||
| 912 | return 1; | ||
| 913 | } | ||
| 914 | |||
| 915 | static int cca_get_random_bytes(unsigned char* buf, int num) | ||
| 916 | { | ||
| 917 | long ret_code; | ||
| 918 | long reason_code; | ||
| 919 | long exit_data_length; | ||
| 920 | unsigned char exit_data[4]; | ||
| 921 | unsigned char form[] = "RANDOM "; | ||
| 922 | unsigned char rand_buf[8]; | ||
| 923 | |||
| 924 | while(num >= sizeof(rand_buf)) | ||
| 925 | { | ||
| 926 | randomNumberGenerate(&ret_code, &reason_code, &exit_data_length, | ||
| 927 | exit_data, form, rand_buf); | ||
| 928 | if (ret_code) | ||
| 929 | return 0; | ||
| 930 | num -= sizeof(rand_buf); | ||
| 931 | memcpy(buf, rand_buf, sizeof(rand_buf)); | ||
| 932 | buf += sizeof(rand_buf); | ||
| 933 | } | ||
| 934 | |||
| 935 | if (num) | ||
| 936 | { | ||
| 937 | randomNumberGenerate(&ret_code, &reason_code, NULL, NULL, | ||
| 938 | form, rand_buf); | ||
| 939 | if (ret_code) | ||
| 940 | return 0; | ||
| 941 | memcpy(buf, rand_buf, num); | ||
| 942 | } | ||
| 943 | |||
| 944 | return 1; | ||
| 945 | } | ||
| 946 | |||
| 947 | static void cca_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, int idx, | ||
| 948 | long argl, void *argp) | ||
| 949 | { | ||
| 950 | if (item) | ||
| 951 | OPENSSL_free(item); | ||
| 952 | } | ||
| 953 | |||
| 954 | /* Goo to handle building as a dynamic engine */ | ||
| 955 | #ifdef ENGINE_DYNAMIC_SUPPORT | ||
| 956 | static int bind_fn(ENGINE *e, const char *id) | ||
| 957 | { | ||
| 958 | if(id && (strcmp(id, engine_4758_cca_id) != 0)) | ||
| 959 | return 0; | ||
| 960 | if(!bind_helper(e)) | ||
| 961 | return 0; | ||
| 962 | return 1; | ||
| 963 | } | ||
| 964 | IMPLEMENT_DYNAMIC_CHECK_FN() | ||
| 965 | IMPLEMENT_DYNAMIC_BIND_FN(bind_fn) | ||
| 966 | #endif /* ENGINE_DYNAMIC_SUPPORT */ | ||
| 967 | |||
| 968 | #endif /* !OPENSSL_NO_HW_4758_CCA */ | ||
| 969 | #endif /* !OPENSSL_NO_HW */ | ||
diff --git a/src/lib/libcrypto/engine/hw_4758_cca_err.c b/src/lib/libcrypto/engine/hw_4758_cca_err.c deleted file mode 100644 index 7ea5c63707..0000000000 --- a/src/lib/libcrypto/engine/hw_4758_cca_err.c +++ /dev/null | |||
| @@ -1,149 +0,0 @@ | |||
| 1 | /* hw_4758_cca_err.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1999-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 | |||
| 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 "hw_4758_cca_err.h" | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | static ERR_STRING_DATA CCA4758_str_functs[]= | ||
| 68 | { | ||
| 69 | {ERR_PACK(0,CCA4758_F_IBM_4758_CCA_CTRL,0), "IBM_4758_CCA_CTRL"}, | ||
| 70 | {ERR_PACK(0,CCA4758_F_IBM_4758_CCA_FINISH,0), "IBM_4758_CCA_FINISH"}, | ||
| 71 | {ERR_PACK(0,CCA4758_F_IBM_4758_CCA_INIT,0), "IBM_4758_CCA_INIT"}, | ||
| 72 | {ERR_PACK(0,CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,0), "IBM_4758_CCA_LOAD_PRIVKEY"}, | ||
| 73 | {ERR_PACK(0,CCA4758_F_IBM_4758_CCA_LOAD_PUBKEY,0), "IBM_4758_CCA_LOAD_PUBKEY"}, | ||
| 74 | {ERR_PACK(0,CCA4758_F_IBM_4758_CCA_SIGN,0), "IBM_4758_CCA_SIGN"}, | ||
| 75 | {ERR_PACK(0,CCA4758_F_IBM_4758_CCA_VERIFY,0), "IBM_4758_CCA_VERIFY"}, | ||
| 76 | {0,NULL} | ||
| 77 | }; | ||
| 78 | |||
| 79 | static ERR_STRING_DATA CCA4758_str_reasons[]= | ||
| 80 | { | ||
| 81 | {CCA4758_R_ALREADY_LOADED ,"already loaded"}, | ||
| 82 | {CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD ,"asn1 oid unknown for md"}, | ||
| 83 | {CCA4758_R_COMMAND_NOT_IMPLEMENTED ,"command not implemented"}, | ||
| 84 | {CCA4758_R_DSO_FAILURE ,"dso failure"}, | ||
| 85 | {CCA4758_R_FAILED_LOADING_PRIVATE_KEY ,"failed loading private key"}, | ||
| 86 | {CCA4758_R_FAILED_LOADING_PUBLIC_KEY ,"failed loading public key"}, | ||
| 87 | {CCA4758_R_NOT_LOADED ,"not loaded"}, | ||
| 88 | {CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL ,"size too large or too small"}, | ||
| 89 | {CCA4758_R_UNIT_FAILURE ,"unit failure"}, | ||
| 90 | {CCA4758_R_UNKNOWN_ALGORITHM_TYPE ,"unknown algorithm type"}, | ||
| 91 | {0,NULL} | ||
| 92 | }; | ||
| 93 | |||
| 94 | #endif | ||
| 95 | |||
| 96 | #ifdef CCA4758_LIB_NAME | ||
| 97 | static ERR_STRING_DATA CCA4758_lib_name[]= | ||
| 98 | { | ||
| 99 | {0 ,CCA4758_LIB_NAME}, | ||
| 100 | {0,NULL} | ||
| 101 | }; | ||
| 102 | #endif | ||
| 103 | |||
| 104 | |||
| 105 | static int CCA4758_lib_error_code=0; | ||
| 106 | static int CCA4758_error_init=1; | ||
| 107 | |||
| 108 | static void ERR_load_CCA4758_strings(void) | ||
| 109 | { | ||
| 110 | if (CCA4758_lib_error_code == 0) | ||
| 111 | CCA4758_lib_error_code=ERR_get_next_error_library(); | ||
| 112 | |||
| 113 | if (CCA4758_error_init) | ||
| 114 | { | ||
| 115 | CCA4758_error_init=0; | ||
| 116 | #ifndef OPENSSL_NO_ERR | ||
| 117 | ERR_load_strings(CCA4758_lib_error_code,CCA4758_str_functs); | ||
| 118 | ERR_load_strings(CCA4758_lib_error_code,CCA4758_str_reasons); | ||
| 119 | #endif | ||
| 120 | |||
| 121 | #ifdef CCA4758_LIB_NAME | ||
| 122 | CCA4758_lib_name->error = ERR_PACK(CCA4758_lib_error_code,0,0); | ||
| 123 | ERR_load_strings(0,CCA4758_lib_name); | ||
| 124 | #endif | ||
| 125 | } | ||
| 126 | } | ||
| 127 | |||
| 128 | static void ERR_unload_CCA4758_strings(void) | ||
| 129 | { | ||
| 130 | if (CCA4758_error_init == 0) | ||
| 131 | { | ||
| 132 | #ifndef OPENSSL_NO_ERR | ||
| 133 | ERR_unload_strings(CCA4758_lib_error_code,CCA4758_str_functs); | ||
| 134 | ERR_unload_strings(CCA4758_lib_error_code,CCA4758_str_reasons); | ||
| 135 | #endif | ||
| 136 | |||
| 137 | #ifdef CCA4758_LIB_NAME | ||
| 138 | ERR_unload_strings(0,CCA4758_lib_name); | ||
| 139 | #endif | ||
| 140 | CCA4758_error_init=1; | ||
| 141 | } | ||
| 142 | } | ||
| 143 | |||
| 144 | static void ERR_CCA4758_error(int function, int reason, char *file, int line) | ||
| 145 | { | ||
| 146 | if (CCA4758_lib_error_code == 0) | ||
| 147 | CCA4758_lib_error_code=ERR_get_next_error_library(); | ||
| 148 | ERR_PUT_error(CCA4758_lib_error_code,function,reason,file,line); | ||
| 149 | } | ||
diff --git a/src/lib/libcrypto/engine/hw_4758_cca_err.h b/src/lib/libcrypto/engine/hw_4758_cca_err.h deleted file mode 100644 index 2fc563ab11..0000000000 --- a/src/lib/libcrypto/engine/hw_4758_cca_err.h +++ /dev/null | |||
| @@ -1,93 +0,0 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2001 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_CCA4758_ERR_H | ||
| 56 | #define HEADER_CCA4758_ERR_H | ||
| 57 | |||
| 58 | /* BEGIN ERROR CODES */ | ||
| 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 60 | * made after this point may be overwritten when the script is next run. | ||
| 61 | */ | ||
| 62 | static void ERR_load_CCA4758_strings(void); | ||
| 63 | static void ERR_unload_CCA4758_strings(void); | ||
| 64 | static void ERR_CCA4758_error(int function, int reason, char *file, int line); | ||
| 65 | #define CCA4758err(f,r) ERR_CCA4758_error((f),(r),__FILE__,__LINE__) | ||
| 66 | |||
| 67 | /* Error codes for the CCA4758 functions. */ | ||
| 68 | |||
| 69 | /* Function codes. */ | ||
| 70 | #define CCA4758_F_IBM_4758_CCA_CTRL 100 | ||
| 71 | #define CCA4758_F_IBM_4758_CCA_FINISH 101 | ||
| 72 | #define CCA4758_F_IBM_4758_CCA_INIT 102 | ||
| 73 | #define CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY 103 | ||
| 74 | #define CCA4758_F_IBM_4758_CCA_LOAD_PUBKEY 104 | ||
| 75 | #define CCA4758_F_IBM_4758_CCA_SIGN 105 | ||
| 76 | #define CCA4758_F_IBM_4758_CCA_VERIFY 106 | ||
| 77 | |||
| 78 | /* Reason codes. */ | ||
| 79 | #define CCA4758_R_ALREADY_LOADED 100 | ||
| 80 | #define CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD 101 | ||
| 81 | #define CCA4758_R_COMMAND_NOT_IMPLEMENTED 102 | ||
| 82 | #define CCA4758_R_DSO_FAILURE 103 | ||
| 83 | #define CCA4758_R_FAILED_LOADING_PRIVATE_KEY 104 | ||
| 84 | #define CCA4758_R_FAILED_LOADING_PUBLIC_KEY 105 | ||
| 85 | #define CCA4758_R_NOT_LOADED 106 | ||
| 86 | #define CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL 107 | ||
| 87 | #define CCA4758_R_UNIT_FAILURE 108 | ||
| 88 | #define CCA4758_R_UNKNOWN_ALGORITHM_TYPE 109 | ||
| 89 | |||
| 90 | #ifdef __cplusplus | ||
| 91 | } | ||
| 92 | #endif | ||
| 93 | #endif | ||
diff --git a/src/lib/libcrypto/engine/hw_aep.c b/src/lib/libcrypto/engine/hw_aep.c deleted file mode 100644 index 5f1772ea99..0000000000 --- a/src/lib/libcrypto/engine/hw_aep.c +++ /dev/null | |||
| @@ -1,1120 +0,0 @@ | |||
| 1 | /* crypto/engine/hw_aep.c */ | ||
| 2 | /* | ||
| 3 | */ | ||
| 4 | /* ==================================================================== | ||
| 5 | * Copyright (c) 1999 The OpenSSL Project. 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 | * | ||
| 11 | * 1. Redistributions of source code must retain the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer. | ||
| 13 | * | ||
| 14 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 15 | * notice, this list of conditions and the following disclaimer in | ||
| 16 | * the documentation and/or other materials provided with the | ||
| 17 | * distribution. | ||
| 18 | * | ||
| 19 | * 3. All advertising materials mentioning features or use of this | ||
| 20 | * software must display the following acknowledgment: | ||
| 21 | * "This product includes software developed by the OpenSSL Project | ||
| 22 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 23 | * | ||
| 24 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 25 | * endorse or promote products derived from this software without | ||
| 26 | * prior written permission. For written permission, please contact | ||
| 27 | * licensing@OpenSSL.org. | ||
| 28 | * | ||
| 29 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 30 | * nor may "OpenSSL" appear in their names without prior written | ||
| 31 | * permission of the OpenSSL Project. | ||
| 32 | * | ||
| 33 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 34 | * acknowledgment: | ||
| 35 | * "This product includes software developed by the OpenSSL Project | ||
| 36 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 37 | * | ||
| 38 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 39 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 40 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 41 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 42 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 43 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 44 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 45 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 46 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 47 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 48 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 49 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 50 | * ==================================================================== | ||
| 51 | * | ||
| 52 | * This product includes cryptographic software written by Eric Young | ||
| 53 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 54 | * Hudson (tjh@cryptsoft.com). | ||
| 55 | * | ||
| 56 | */ | ||
| 57 | |||
| 58 | #include <stdio.h> | ||
| 59 | #include <openssl/bn.h> | ||
| 60 | #include <string.h> | ||
| 61 | |||
| 62 | #include <openssl/e_os2.h> | ||
| 63 | #if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__) | ||
| 64 | #include <sys/types.h> | ||
| 65 | #include <unistd.h> | ||
| 66 | #else | ||
| 67 | #include <process.h> | ||
| 68 | typedef int pid_t; | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #include <openssl/crypto.h> | ||
| 72 | #include <openssl/dso.h> | ||
| 73 | #include <openssl/engine.h> | ||
| 74 | #include <openssl/buffer.h> | ||
| 75 | |||
| 76 | #ifndef OPENSSL_NO_HW | ||
| 77 | #ifndef OPENSSL_NO_HW_AEP | ||
| 78 | #ifdef FLAT_INC | ||
| 79 | #include "aep.h" | ||
| 80 | #else | ||
| 81 | #include "vendor_defns/aep.h" | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #define AEP_LIB_NAME "aep engine" | ||
| 85 | #define FAIL_TO_SW 0x10101010 | ||
| 86 | |||
| 87 | #include "hw_aep_err.c" | ||
| 88 | |||
| 89 | static int aep_init(ENGINE *e); | ||
| 90 | static int aep_finish(ENGINE *e); | ||
| 91 | static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | ||
| 92 | static int aep_destroy(ENGINE *e); | ||
| 93 | |||
| 94 | static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR hConnection); | ||
| 95 | static AEP_RV aep_return_connection(AEP_CONNECTION_HNDL hConnection); | ||
| 96 | static AEP_RV aep_close_connection(AEP_CONNECTION_HNDL hConnection); | ||
| 97 | static AEP_RV aep_close_all_connections(int use_engine_lock, int *in_use); | ||
| 98 | |||
| 99 | /* BIGNUM stuff */ | ||
| 100 | static int aep_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 101 | const BIGNUM *m, BN_CTX *ctx); | ||
| 102 | |||
| 103 | static AEP_RV aep_mod_exp_crt(BIGNUM *r,const BIGNUM *a, const BIGNUM *p, | ||
| 104 | const BIGNUM *q, const BIGNUM *dmp1,const BIGNUM *dmq1, | ||
| 105 | const BIGNUM *iqmp, BN_CTX *ctx); | ||
| 106 | |||
| 107 | /* RSA stuff */ | ||
| 108 | #ifndef OPENSSL_NO_RSA | ||
| 109 | static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); | ||
| 110 | #endif | ||
| 111 | |||
| 112 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
| 113 | static int aep_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 114 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 115 | |||
| 116 | /* DSA stuff */ | ||
| 117 | #ifndef OPENSSL_NO_DSA | ||
| 118 | static int aep_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, | ||
| 119 | BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
| 120 | BN_CTX *ctx, BN_MONT_CTX *in_mont); | ||
| 121 | |||
| 122 | static int aep_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
| 123 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 124 | BN_MONT_CTX *m_ctx); | ||
| 125 | #endif | ||
| 126 | |||
| 127 | /* DH stuff */ | ||
| 128 | /* This function is aliased to mod_exp (with the DH and mont dropped). */ | ||
| 129 | #ifndef OPENSSL_NO_DH | ||
| 130 | static int aep_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | ||
| 131 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 132 | #endif | ||
| 133 | |||
| 134 | /* rand stuff */ | ||
| 135 | #ifdef AEPRAND | ||
| 136 | static int aep_rand(unsigned char *buf, int num); | ||
| 137 | static int aep_rand_status(void); | ||
| 138 | #endif | ||
| 139 | |||
| 140 | /* Bignum conversion stuff */ | ||
| 141 | static AEP_RV GetBigNumSize(AEP_VOID_PTR ArbBigNum, AEP_U32* BigNumSize); | ||
| 142 | static AEP_RV MakeAEPBigNum(AEP_VOID_PTR ArbBigNum, AEP_U32 BigNumSize, | ||
| 143 | unsigned char* AEP_BigNum); | ||
| 144 | static AEP_RV ConvertAEPBigNum(void* ArbBigNum, AEP_U32 BigNumSize, | ||
| 145 | unsigned char* AEP_BigNum); | ||
| 146 | |||
| 147 | /* The definitions for control commands specific to this engine */ | ||
| 148 | #define AEP_CMD_SO_PATH ENGINE_CMD_BASE | ||
| 149 | static const ENGINE_CMD_DEFN aep_cmd_defns[] = | ||
| 150 | { | ||
| 151 | { AEP_CMD_SO_PATH, | ||
| 152 | "SO_PATH", | ||
| 153 | "Specifies the path to the 'aep' shared library", | ||
| 154 | ENGINE_CMD_FLAG_STRING | ||
| 155 | }, | ||
| 156 | {0, NULL, NULL, 0} | ||
| 157 | }; | ||
| 158 | |||
| 159 | #ifndef OPENSSL_NO_RSA | ||
| 160 | /* Our internal RSA_METHOD that we provide pointers to */ | ||
| 161 | static RSA_METHOD aep_rsa = | ||
| 162 | { | ||
| 163 | "Aep RSA method", | ||
| 164 | NULL, /*rsa_pub_encrypt*/ | ||
| 165 | NULL, /*rsa_pub_decrypt*/ | ||
| 166 | NULL, /*rsa_priv_encrypt*/ | ||
| 167 | NULL, /*rsa_priv_encrypt*/ | ||
| 168 | aep_rsa_mod_exp, /*rsa_mod_exp*/ | ||
| 169 | aep_mod_exp_mont, /*bn_mod_exp*/ | ||
| 170 | NULL, /*init*/ | ||
| 171 | NULL, /*finish*/ | ||
| 172 | 0, /*flags*/ | ||
| 173 | NULL, /*app_data*/ | ||
| 174 | NULL, /*rsa_sign*/ | ||
| 175 | NULL /*rsa_verify*/ | ||
| 176 | }; | ||
| 177 | #endif | ||
| 178 | |||
| 179 | #ifndef OPENSSL_NO_DSA | ||
| 180 | /* Our internal DSA_METHOD that we provide pointers to */ | ||
| 181 | static DSA_METHOD aep_dsa = | ||
| 182 | { | ||
| 183 | "Aep DSA method", | ||
| 184 | NULL, /* dsa_do_sign */ | ||
| 185 | NULL, /* dsa_sign_setup */ | ||
| 186 | NULL, /* dsa_do_verify */ | ||
| 187 | aep_dsa_mod_exp, /* dsa_mod_exp */ | ||
| 188 | aep_mod_exp_dsa, /* bn_mod_exp */ | ||
| 189 | NULL, /* init */ | ||
| 190 | NULL, /* finish */ | ||
| 191 | 0, /* flags */ | ||
| 192 | NULL /* app_data */ | ||
| 193 | }; | ||
| 194 | #endif | ||
| 195 | |||
| 196 | #ifndef OPENSSL_NO_DH | ||
| 197 | /* Our internal DH_METHOD that we provide pointers to */ | ||
| 198 | static DH_METHOD aep_dh = | ||
| 199 | { | ||
| 200 | "Aep DH method", | ||
| 201 | NULL, | ||
| 202 | NULL, | ||
| 203 | aep_mod_exp_dh, | ||
| 204 | NULL, | ||
| 205 | NULL, | ||
| 206 | 0, | ||
| 207 | NULL | ||
| 208 | }; | ||
| 209 | #endif | ||
| 210 | |||
| 211 | #ifdef AEPRAND | ||
| 212 | /* our internal RAND_method that we provide pointers to */ | ||
| 213 | static RAND_METHOD aep_random = | ||
| 214 | { | ||
| 215 | /*"AEP RAND method", */ | ||
| 216 | NULL, | ||
| 217 | aep_rand, | ||
| 218 | NULL, | ||
| 219 | NULL, | ||
| 220 | aep_rand, | ||
| 221 | aep_rand_status, | ||
| 222 | }; | ||
| 223 | #endif | ||
| 224 | |||
| 225 | /*Define an array of structures to hold connections*/ | ||
| 226 | static AEP_CONNECTION_ENTRY aep_app_conn_table[MAX_PROCESS_CONNECTIONS]; | ||
| 227 | |||
| 228 | /*Used to determine if this is a new process*/ | ||
| 229 | static pid_t recorded_pid = 0; | ||
| 230 | |||
| 231 | #ifdef AEPRAND | ||
| 232 | static AEP_U8 rand_block[RAND_BLK_SIZE]; | ||
| 233 | static AEP_U32 rand_block_bytes = 0; | ||
| 234 | #endif | ||
| 235 | |||
| 236 | /* Constants used when creating the ENGINE */ | ||
| 237 | static const char *engine_aep_id = "aep"; | ||
| 238 | static const char *engine_aep_name = "Aep hardware engine support"; | ||
| 239 | |||
| 240 | static int max_key_len = 2176; | ||
| 241 | |||
| 242 | |||
| 243 | /* This internal function is used by ENGINE_aep() and possibly by the | ||
| 244 | * "dynamic" ENGINE support too */ | ||
| 245 | static int bind_aep(ENGINE *e) | ||
| 246 | { | ||
| 247 | #ifndef OPENSSL_NO_RSA | ||
| 248 | const RSA_METHOD *meth1; | ||
| 249 | #endif | ||
| 250 | #ifndef OPENSSL_NO_DSA | ||
| 251 | const DSA_METHOD *meth2; | ||
| 252 | #endif | ||
| 253 | #ifndef OPENSSL_NO_DH | ||
| 254 | const DH_METHOD *meth3; | ||
| 255 | #endif | ||
| 256 | |||
| 257 | if(!ENGINE_set_id(e, engine_aep_id) || | ||
| 258 | !ENGINE_set_name(e, engine_aep_name) || | ||
| 259 | #ifndef OPENSSL_NO_RSA | ||
| 260 | !ENGINE_set_RSA(e, &aep_rsa) || | ||
| 261 | #endif | ||
| 262 | #ifndef OPENSSL_NO_DSA | ||
| 263 | !ENGINE_set_DSA(e, &aep_dsa) || | ||
| 264 | #endif | ||
| 265 | #ifndef OPENSSL_NO_DH | ||
| 266 | !ENGINE_set_DH(e, &aep_dh) || | ||
| 267 | #endif | ||
| 268 | #ifdef AEPRAND | ||
| 269 | !ENGINE_set_RAND(e, &aep_random) || | ||
| 270 | #endif | ||
| 271 | !ENGINE_set_init_function(e, aep_init) || | ||
| 272 | !ENGINE_set_destroy_function(e, aep_destroy) || | ||
| 273 | !ENGINE_set_finish_function(e, aep_finish) || | ||
| 274 | !ENGINE_set_ctrl_function(e, aep_ctrl) || | ||
| 275 | !ENGINE_set_cmd_defns(e, aep_cmd_defns)) | ||
| 276 | return 0; | ||
| 277 | |||
| 278 | #ifndef OPENSSL_NO_RSA | ||
| 279 | /* We know that the "PKCS1_SSLeay()" functions hook properly | ||
| 280 | * to the aep-specific mod_exp and mod_exp_crt so we use | ||
| 281 | * those functions. NB: We don't use ENGINE_openssl() or | ||
| 282 | * anything "more generic" because something like the RSAref | ||
| 283 | * code may not hook properly, and if you own one of these | ||
| 284 | * cards then you have the right to do RSA operations on it | ||
| 285 | * anyway! */ | ||
| 286 | meth1 = RSA_PKCS1_SSLeay(); | ||
| 287 | aep_rsa.rsa_pub_enc = meth1->rsa_pub_enc; | ||
| 288 | aep_rsa.rsa_pub_dec = meth1->rsa_pub_dec; | ||
| 289 | aep_rsa.rsa_priv_enc = meth1->rsa_priv_enc; | ||
| 290 | aep_rsa.rsa_priv_dec = meth1->rsa_priv_dec; | ||
| 291 | #endif | ||
| 292 | |||
| 293 | |||
| 294 | #ifndef OPENSSL_NO_DSA | ||
| 295 | /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish | ||
| 296 | * bits. */ | ||
| 297 | meth2 = DSA_OpenSSL(); | ||
| 298 | aep_dsa.dsa_do_sign = meth2->dsa_do_sign; | ||
| 299 | aep_dsa.dsa_sign_setup = meth2->dsa_sign_setup; | ||
| 300 | aep_dsa.dsa_do_verify = meth2->dsa_do_verify; | ||
| 301 | |||
| 302 | aep_dsa = *DSA_get_default_method(); | ||
| 303 | aep_dsa.dsa_mod_exp = aep_dsa_mod_exp; | ||
| 304 | aep_dsa.bn_mod_exp = aep_mod_exp_dsa; | ||
| 305 | #endif | ||
| 306 | |||
| 307 | #ifndef OPENSSL_NO_DH | ||
| 308 | /* Much the same for Diffie-Hellman */ | ||
| 309 | meth3 = DH_OpenSSL(); | ||
| 310 | aep_dh.generate_key = meth3->generate_key; | ||
| 311 | aep_dh.compute_key = meth3->compute_key; | ||
| 312 | aep_dh.bn_mod_exp = meth3->bn_mod_exp; | ||
| 313 | #endif | ||
| 314 | |||
| 315 | /* Ensure the aep error handling is set up */ | ||
| 316 | ERR_load_AEPHK_strings(); | ||
| 317 | |||
| 318 | return 1; | ||
| 319 | } | ||
| 320 | |||
| 321 | #ifdef ENGINE_DYNAMIC_SUPPORT | ||
| 322 | static int bind_helper(ENGINE *e, const char *id) | ||
| 323 | { | ||
| 324 | if(id && (strcmp(id, engine_aep_id) != 0)) | ||
| 325 | return 0; | ||
| 326 | if(!bind_aep(e)) | ||
| 327 | return 0; | ||
| 328 | return 1; | ||
| 329 | } | ||
| 330 | IMPLEMENT_DYNAMIC_CHECK_FN() | ||
| 331 | IMPLEMENT_DYNAMIC_BIND_FN(bind_helper) | ||
| 332 | #else | ||
| 333 | static ENGINE *engine_aep(void) | ||
| 334 | { | ||
| 335 | ENGINE *ret = ENGINE_new(); | ||
| 336 | if(!ret) | ||
| 337 | return NULL; | ||
| 338 | if(!bind_aep(ret)) | ||
| 339 | { | ||
| 340 | ENGINE_free(ret); | ||
| 341 | return NULL; | ||
| 342 | } | ||
| 343 | return ret; | ||
| 344 | } | ||
| 345 | |||
| 346 | void ENGINE_load_aep(void) | ||
| 347 | { | ||
| 348 | /* Copied from eng_[openssl|dyn].c */ | ||
| 349 | ENGINE *toadd = engine_aep(); | ||
| 350 | if(!toadd) return; | ||
| 351 | ENGINE_add(toadd); | ||
| 352 | ENGINE_free(toadd); | ||
| 353 | ERR_clear_error(); | ||
| 354 | } | ||
| 355 | #endif | ||
| 356 | |||
| 357 | /* This is a process-global DSO handle used for loading and unloading | ||
| 358 | * the Aep library. NB: This is only set (or unset) during an | ||
| 359 | * init() or finish() call (reference counts permitting) and they're | ||
| 360 | * operating with global locks, so this should be thread-safe | ||
| 361 | * implicitly. */ | ||
| 362 | static DSO *aep_dso = NULL; | ||
| 363 | |||
| 364 | /* These are the static string constants for the DSO file name and the function | ||
| 365 | * symbol names to bind to. | ||
| 366 | */ | ||
| 367 | static const char *AEP_LIBNAME = NULL; | ||
| 368 | static const char *get_AEP_LIBNAME(void) | ||
| 369 | { | ||
| 370 | if(AEP_LIBNAME) | ||
| 371 | return AEP_LIBNAME; | ||
| 372 | return "aep"; | ||
| 373 | } | ||
| 374 | static void free_AEP_LIBNAME(void) | ||
| 375 | { | ||
| 376 | if(AEP_LIBNAME) | ||
| 377 | OPENSSL_free((void*)AEP_LIBNAME); | ||
| 378 | AEP_LIBNAME = NULL; | ||
| 379 | } | ||
| 380 | static long set_AEP_LIBNAME(const char *name) | ||
| 381 | { | ||
| 382 | free_AEP_LIBNAME(); | ||
| 383 | return ((AEP_LIBNAME = BUF_strdup(name)) != NULL ? 1 : 0); | ||
| 384 | } | ||
| 385 | |||
| 386 | static const char *AEP_F1 = "AEP_ModExp"; | ||
| 387 | static const char *AEP_F2 = "AEP_ModExpCrt"; | ||
| 388 | #ifdef AEPRAND | ||
| 389 | static const char *AEP_F3 = "AEP_GenRandom"; | ||
| 390 | #endif | ||
| 391 | static const char *AEP_F4 = "AEP_Finalize"; | ||
| 392 | static const char *AEP_F5 = "AEP_Initialize"; | ||
| 393 | static const char *AEP_F6 = "AEP_OpenConnection"; | ||
| 394 | static const char *AEP_F7 = "AEP_SetBNCallBacks"; | ||
| 395 | static const char *AEP_F8 = "AEP_CloseConnection"; | ||
| 396 | |||
| 397 | /* These are the function pointers that are (un)set when the library has | ||
| 398 | * successfully (un)loaded. */ | ||
| 399 | static t_AEP_OpenConnection *p_AEP_OpenConnection = NULL; | ||
| 400 | static t_AEP_CloseConnection *p_AEP_CloseConnection = NULL; | ||
| 401 | static t_AEP_ModExp *p_AEP_ModExp = NULL; | ||
| 402 | static t_AEP_ModExpCrt *p_AEP_ModExpCrt = NULL; | ||
| 403 | #ifdef AEPRAND | ||
| 404 | static t_AEP_GenRandom *p_AEP_GenRandom = NULL; | ||
| 405 | #endif | ||
| 406 | static t_AEP_Initialize *p_AEP_Initialize = NULL; | ||
| 407 | static t_AEP_Finalize *p_AEP_Finalize = NULL; | ||
| 408 | static t_AEP_SetBNCallBacks *p_AEP_SetBNCallBacks = NULL; | ||
| 409 | |||
| 410 | /* (de)initialisation functions. */ | ||
| 411 | static int aep_init(ENGINE *e) | ||
| 412 | { | ||
| 413 | t_AEP_ModExp *p1; | ||
| 414 | t_AEP_ModExpCrt *p2; | ||
| 415 | #ifdef AEPRAND | ||
| 416 | t_AEP_GenRandom *p3; | ||
| 417 | #endif | ||
| 418 | t_AEP_Finalize *p4; | ||
| 419 | t_AEP_Initialize *p5; | ||
| 420 | t_AEP_OpenConnection *p6; | ||
| 421 | t_AEP_SetBNCallBacks *p7; | ||
| 422 | t_AEP_CloseConnection *p8; | ||
| 423 | |||
| 424 | int to_return = 0; | ||
| 425 | |||
| 426 | if(aep_dso != NULL) | ||
| 427 | { | ||
| 428 | AEPHKerr(AEPHK_F_AEP_INIT,AEPHK_R_ALREADY_LOADED); | ||
| 429 | goto err; | ||
| 430 | } | ||
| 431 | /* Attempt to load libaep.so. */ | ||
| 432 | |||
| 433 | aep_dso = DSO_load(NULL, get_AEP_LIBNAME(), NULL, 0); | ||
| 434 | |||
| 435 | if(aep_dso == NULL) | ||
| 436 | { | ||
| 437 | AEPHKerr(AEPHK_F_AEP_INIT,AEPHK_R_NOT_LOADED); | ||
| 438 | goto err; | ||
| 439 | } | ||
| 440 | |||
| 441 | if( !(p1 = (t_AEP_ModExp *) DSO_bind_func( aep_dso,AEP_F1)) || | ||
| 442 | !(p2 = (t_AEP_ModExpCrt*) DSO_bind_func( aep_dso,AEP_F2)) || | ||
| 443 | #ifdef AEPRAND | ||
| 444 | !(p3 = (t_AEP_GenRandom*) DSO_bind_func( aep_dso,AEP_F3)) || | ||
| 445 | #endif | ||
| 446 | !(p4 = (t_AEP_Finalize*) DSO_bind_func( aep_dso,AEP_F4)) || | ||
| 447 | !(p5 = (t_AEP_Initialize*) DSO_bind_func( aep_dso,AEP_F5)) || | ||
| 448 | !(p6 = (t_AEP_OpenConnection*) DSO_bind_func( aep_dso,AEP_F6)) || | ||
| 449 | !(p7 = (t_AEP_SetBNCallBacks*) DSO_bind_func( aep_dso,AEP_F7)) || | ||
| 450 | !(p8 = (t_AEP_CloseConnection*) DSO_bind_func( aep_dso,AEP_F8))) | ||
| 451 | { | ||
| 452 | AEPHKerr(AEPHK_F_AEP_INIT,AEPHK_R_NOT_LOADED); | ||
| 453 | goto err; | ||
| 454 | } | ||
| 455 | |||
| 456 | /* Copy the pointers */ | ||
| 457 | |||
| 458 | p_AEP_ModExp = p1; | ||
| 459 | p_AEP_ModExpCrt = p2; | ||
| 460 | #ifdef AEPRAND | ||
| 461 | p_AEP_GenRandom = p3; | ||
| 462 | #endif | ||
| 463 | p_AEP_Finalize = p4; | ||
| 464 | p_AEP_Initialize = p5; | ||
| 465 | p_AEP_OpenConnection = p6; | ||
| 466 | p_AEP_SetBNCallBacks = p7; | ||
| 467 | p_AEP_CloseConnection = p8; | ||
| 468 | |||
| 469 | to_return = 1; | ||
| 470 | |||
| 471 | return to_return; | ||
| 472 | |||
| 473 | err: | ||
| 474 | |||
| 475 | if(aep_dso) | ||
| 476 | DSO_free(aep_dso); | ||
| 477 | aep_dso = NULL; | ||
| 478 | |||
| 479 | p_AEP_OpenConnection = NULL; | ||
| 480 | p_AEP_ModExp = NULL; | ||
| 481 | p_AEP_ModExpCrt = NULL; | ||
| 482 | #ifdef AEPRAND | ||
| 483 | p_AEP_GenRandom = NULL; | ||
| 484 | #endif | ||
| 485 | p_AEP_Initialize = NULL; | ||
| 486 | p_AEP_Finalize = NULL; | ||
| 487 | p_AEP_SetBNCallBacks = NULL; | ||
| 488 | p_AEP_CloseConnection = NULL; | ||
| 489 | |||
| 490 | return to_return; | ||
| 491 | } | ||
| 492 | |||
| 493 | /* Destructor (complements the "ENGINE_aep()" constructor) */ | ||
| 494 | static int aep_destroy(ENGINE *e) | ||
| 495 | { | ||
| 496 | free_AEP_LIBNAME(); | ||
| 497 | ERR_unload_AEPHK_strings(); | ||
| 498 | return 1; | ||
| 499 | } | ||
| 500 | |||
| 501 | static int aep_finish(ENGINE *e) | ||
| 502 | { | ||
| 503 | int to_return = 0, in_use; | ||
| 504 | AEP_RV rv; | ||
| 505 | |||
| 506 | if(aep_dso == NULL) | ||
| 507 | { | ||
| 508 | AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_NOT_LOADED); | ||
| 509 | goto err; | ||
| 510 | } | ||
| 511 | |||
| 512 | rv = aep_close_all_connections(0, &in_use); | ||
| 513 | if (rv != AEP_R_OK) | ||
| 514 | { | ||
| 515 | AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_CLOSE_HANDLES_FAILED); | ||
| 516 | goto err; | ||
| 517 | } | ||
| 518 | if (in_use) | ||
| 519 | { | ||
| 520 | AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_CONNECTIONS_IN_USE); | ||
| 521 | goto err; | ||
| 522 | } | ||
| 523 | |||
| 524 | rv = p_AEP_Finalize(); | ||
| 525 | if (rv != AEP_R_OK) | ||
| 526 | { | ||
| 527 | AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_FINALIZE_FAILED); | ||
| 528 | goto err; | ||
| 529 | } | ||
| 530 | |||
| 531 | if(!DSO_free(aep_dso)) | ||
| 532 | { | ||
| 533 | AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_UNIT_FAILURE); | ||
| 534 | goto err; | ||
| 535 | } | ||
| 536 | |||
| 537 | aep_dso = NULL; | ||
| 538 | p_AEP_CloseConnection = NULL; | ||
| 539 | p_AEP_OpenConnection = NULL; | ||
| 540 | p_AEP_ModExp = NULL; | ||
| 541 | p_AEP_ModExpCrt = NULL; | ||
| 542 | #ifdef AEPRAND | ||
| 543 | p_AEP_GenRandom = NULL; | ||
| 544 | #endif | ||
| 545 | p_AEP_Initialize = NULL; | ||
| 546 | p_AEP_Finalize = NULL; | ||
| 547 | p_AEP_SetBNCallBacks = NULL; | ||
| 548 | |||
| 549 | to_return = 1; | ||
| 550 | err: | ||
| 551 | return to_return; | ||
| 552 | } | ||
| 553 | |||
| 554 | static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | ||
| 555 | { | ||
| 556 | int initialised = ((aep_dso == NULL) ? 0 : 1); | ||
| 557 | switch(cmd) | ||
| 558 | { | ||
| 559 | case AEP_CMD_SO_PATH: | ||
| 560 | if(p == NULL) | ||
| 561 | { | ||
| 562 | AEPHKerr(AEPHK_F_AEP_CTRL, | ||
| 563 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 564 | return 0; | ||
| 565 | } | ||
| 566 | if(initialised) | ||
| 567 | { | ||
| 568 | AEPHKerr(AEPHK_F_AEP_CTRL, | ||
| 569 | AEPHK_R_ALREADY_LOADED); | ||
| 570 | return 0; | ||
| 571 | } | ||
| 572 | return set_AEP_LIBNAME((const char*)p); | ||
| 573 | default: | ||
| 574 | break; | ||
| 575 | } | ||
| 576 | AEPHKerr(AEPHK_F_AEP_CTRL,AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED); | ||
| 577 | return 0; | ||
| 578 | } | ||
| 579 | |||
| 580 | static int aep_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 581 | const BIGNUM *m, BN_CTX *ctx) | ||
| 582 | { | ||
| 583 | int to_return = 0; | ||
| 584 | int r_len = 0; | ||
| 585 | AEP_CONNECTION_HNDL hConnection; | ||
| 586 | AEP_RV rv; | ||
| 587 | |||
| 588 | r_len = BN_num_bits(m); | ||
| 589 | |||
| 590 | /* Perform in software if modulus is too large for hardware. */ | ||
| 591 | |||
| 592 | if (r_len > max_key_len){ | ||
| 593 | AEPHKerr(AEPHK_F_AEP_MOD_EXP, AEPHK_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
| 594 | return BN_mod_exp(r, a, p, m, ctx); | ||
| 595 | } | ||
| 596 | |||
| 597 | /*Grab a connection from the pool*/ | ||
| 598 | rv = aep_get_connection(&hConnection); | ||
| 599 | if (rv != AEP_R_OK) | ||
| 600 | { | ||
| 601 | AEPHKerr(AEPHK_F_AEP_MOD_EXP,AEPHK_R_GET_HANDLE_FAILED); | ||
| 602 | return BN_mod_exp(r, a, p, m, ctx); | ||
| 603 | } | ||
| 604 | |||
| 605 | /*To the card with the mod exp*/ | ||
| 606 | rv = p_AEP_ModExp(hConnection,(void*)a, (void*)p,(void*)m, (void*)r,NULL); | ||
| 607 | |||
| 608 | if (rv != AEP_R_OK) | ||
| 609 | { | ||
| 610 | AEPHKerr(AEPHK_F_AEP_MOD_EXP,AEPHK_R_MOD_EXP_FAILED); | ||
| 611 | rv = aep_close_connection(hConnection); | ||
| 612 | return BN_mod_exp(r, a, p, m, ctx); | ||
| 613 | } | ||
| 614 | |||
| 615 | /*Return the connection to the pool*/ | ||
| 616 | rv = aep_return_connection(hConnection); | ||
| 617 | if (rv != AEP_R_OK) | ||
| 618 | { | ||
| 619 | AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_RETURN_CONNECTION_FAILED); | ||
| 620 | goto err; | ||
| 621 | } | ||
| 622 | |||
| 623 | to_return = 1; | ||
| 624 | err: | ||
| 625 | return to_return; | ||
| 626 | } | ||
| 627 | |||
| 628 | static AEP_RV aep_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 629 | const BIGNUM *q, const BIGNUM *dmp1, | ||
| 630 | const BIGNUM *dmq1,const BIGNUM *iqmp, BN_CTX *ctx) | ||
| 631 | { | ||
| 632 | AEP_RV rv = AEP_R_OK; | ||
| 633 | AEP_CONNECTION_HNDL hConnection; | ||
| 634 | |||
| 635 | /*Grab a connection from the pool*/ | ||
| 636 | rv = aep_get_connection(&hConnection); | ||
| 637 | if (rv != AEP_R_OK) | ||
| 638 | { | ||
| 639 | AEPHKerr(AEPHK_F_AEP_MOD_EXP_CRT,AEPHK_R_GET_HANDLE_FAILED); | ||
| 640 | return FAIL_TO_SW; | ||
| 641 | } | ||
| 642 | |||
| 643 | /*To the card with the mod exp*/ | ||
| 644 | rv = p_AEP_ModExpCrt(hConnection,(void*)a, (void*)p, (void*)q, (void*)dmp1,(void*)dmq1, | ||
| 645 | (void*)iqmp,(void*)r,NULL); | ||
| 646 | if (rv != AEP_R_OK) | ||
| 647 | { | ||
| 648 | AEPHKerr(AEPHK_F_AEP_MOD_EXP_CRT,AEPHK_R_MOD_EXP_CRT_FAILED); | ||
| 649 | rv = aep_close_connection(hConnection); | ||
| 650 | return FAIL_TO_SW; | ||
| 651 | } | ||
| 652 | |||
| 653 | /*Return the connection to the pool*/ | ||
| 654 | rv = aep_return_connection(hConnection); | ||
| 655 | if (rv != AEP_R_OK) | ||
| 656 | { | ||
| 657 | AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_RETURN_CONNECTION_FAILED); | ||
| 658 | goto err; | ||
| 659 | } | ||
| 660 | |||
| 661 | err: | ||
| 662 | return rv; | ||
| 663 | } | ||
| 664 | |||
| 665 | |||
| 666 | #ifdef AEPRAND | ||
| 667 | static int aep_rand(unsigned char *buf,int len ) | ||
| 668 | { | ||
| 669 | AEP_RV rv = AEP_R_OK; | ||
| 670 | AEP_CONNECTION_HNDL hConnection; | ||
| 671 | |||
| 672 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 673 | |||
| 674 | /*Can the request be serviced with what's already in the buffer?*/ | ||
| 675 | if (len <= rand_block_bytes) | ||
| 676 | { | ||
| 677 | memcpy(buf, &rand_block[RAND_BLK_SIZE - rand_block_bytes], len); | ||
| 678 | rand_block_bytes -= len; | ||
| 679 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 680 | } | ||
| 681 | else | ||
| 682 | /*If not the get another block of random bytes*/ | ||
| 683 | { | ||
| 684 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 685 | |||
| 686 | rv = aep_get_connection(&hConnection); | ||
| 687 | if (rv != AEP_R_OK) | ||
| 688 | { | ||
| 689 | AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_GET_HANDLE_FAILED); | ||
| 690 | goto err_nounlock; | ||
| 691 | } | ||
| 692 | |||
| 693 | if (len > RAND_BLK_SIZE) | ||
| 694 | { | ||
| 695 | rv = p_AEP_GenRandom(hConnection, len, 2, buf, NULL); | ||
| 696 | if (rv != AEP_R_OK) | ||
| 697 | { | ||
| 698 | AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_GET_RANDOM_FAILED); | ||
| 699 | goto err_nounlock; | ||
| 700 | } | ||
| 701 | } | ||
| 702 | else | ||
| 703 | { | ||
| 704 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 705 | |||
| 706 | rv = p_AEP_GenRandom(hConnection, RAND_BLK_SIZE, 2, &rand_block[0], NULL); | ||
| 707 | if (rv != AEP_R_OK) | ||
| 708 | { | ||
| 709 | AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_GET_RANDOM_FAILED); | ||
| 710 | |||
| 711 | goto err; | ||
| 712 | } | ||
| 713 | |||
| 714 | rand_block_bytes = RAND_BLK_SIZE; | ||
| 715 | |||
| 716 | memcpy(buf, &rand_block[RAND_BLK_SIZE - rand_block_bytes], len); | ||
| 717 | rand_block_bytes -= len; | ||
| 718 | |||
| 719 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 720 | } | ||
| 721 | |||
| 722 | rv = aep_return_connection(hConnection); | ||
| 723 | if (rv != AEP_R_OK) | ||
| 724 | { | ||
| 725 | AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_RETURN_CONNECTION_FAILED); | ||
| 726 | |||
| 727 | goto err_nounlock; | ||
| 728 | } | ||
| 729 | } | ||
| 730 | |||
| 731 | return 1; | ||
| 732 | err: | ||
| 733 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 734 | err_nounlock: | ||
| 735 | return 0; | ||
| 736 | } | ||
| 737 | |||
| 738 | static int aep_rand_status(void) | ||
| 739 | { | ||
| 740 | return 1; | ||
| 741 | } | ||
| 742 | #endif | ||
| 743 | |||
| 744 | #ifndef OPENSSL_NO_RSA | ||
| 745 | static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | ||
| 746 | { | ||
| 747 | BN_CTX *ctx = NULL; | ||
| 748 | int to_return = 0; | ||
| 749 | AEP_RV rv = AEP_R_OK; | ||
| 750 | |||
| 751 | if ((ctx = BN_CTX_new()) == NULL) | ||
| 752 | goto err; | ||
| 753 | |||
| 754 | if (!aep_dso) | ||
| 755 | { | ||
| 756 | AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP,AEPHK_R_NOT_LOADED); | ||
| 757 | goto err; | ||
| 758 | } | ||
| 759 | |||
| 760 | /*See if we have all the necessary bits for a crt*/ | ||
| 761 | if (rsa->q && rsa->dmp1 && rsa->dmq1 && rsa->iqmp) | ||
| 762 | { | ||
| 763 | rv = aep_mod_exp_crt(r0,I,rsa->p,rsa->q, rsa->dmp1,rsa->dmq1,rsa->iqmp,ctx); | ||
| 764 | |||
| 765 | if (rv == FAIL_TO_SW){ | ||
| 766 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 767 | to_return = (*meth->rsa_mod_exp)(r0, I, rsa); | ||
| 768 | goto err; | ||
| 769 | } | ||
| 770 | else if (rv != AEP_R_OK) | ||
| 771 | goto err; | ||
| 772 | } | ||
| 773 | else | ||
| 774 | { | ||
| 775 | if (!rsa->d || !rsa->n) | ||
| 776 | { | ||
| 777 | AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP,AEPHK_R_MISSING_KEY_COMPONENTS); | ||
| 778 | goto err; | ||
| 779 | } | ||
| 780 | |||
| 781 | rv = aep_mod_exp(r0,I,rsa->d,rsa->n,ctx); | ||
| 782 | if (rv != AEP_R_OK) | ||
| 783 | goto err; | ||
| 784 | |||
| 785 | } | ||
| 786 | |||
| 787 | to_return = 1; | ||
| 788 | |||
| 789 | err: | ||
| 790 | if(ctx) | ||
| 791 | BN_CTX_free(ctx); | ||
| 792 | return to_return; | ||
| 793 | } | ||
| 794 | #endif | ||
| 795 | |||
| 796 | #ifndef OPENSSL_NO_DSA | ||
| 797 | static int aep_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, | ||
| 798 | BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
| 799 | BN_CTX *ctx, BN_MONT_CTX *in_mont) | ||
| 800 | { | ||
| 801 | BIGNUM t; | ||
| 802 | int to_return = 0; | ||
| 803 | BN_init(&t); | ||
| 804 | |||
| 805 | /* let rr = a1 ^ p1 mod m */ | ||
| 806 | if (!aep_mod_exp(rr,a1,p1,m,ctx)) goto end; | ||
| 807 | /* let t = a2 ^ p2 mod m */ | ||
| 808 | if (!aep_mod_exp(&t,a2,p2,m,ctx)) goto end; | ||
| 809 | /* let rr = rr * t mod m */ | ||
| 810 | if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end; | ||
| 811 | to_return = 1; | ||
| 812 | end: | ||
| 813 | BN_free(&t); | ||
| 814 | return to_return; | ||
| 815 | } | ||
| 816 | |||
| 817 | static int aep_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
| 818 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 819 | BN_MONT_CTX *m_ctx) | ||
| 820 | { | ||
| 821 | return aep_mod_exp(r, a, p, m, ctx); | ||
| 822 | } | ||
| 823 | #endif | ||
| 824 | |||
| 825 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
| 826 | static int aep_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 827 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 828 | { | ||
| 829 | return aep_mod_exp(r, a, p, m, ctx); | ||
| 830 | } | ||
| 831 | |||
| 832 | #ifndef OPENSSL_NO_DH | ||
| 833 | /* This function is aliased to mod_exp (with the dh and mont dropped). */ | ||
| 834 | static int aep_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | ||
| 835 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 836 | BN_MONT_CTX *m_ctx) | ||
| 837 | { | ||
| 838 | return aep_mod_exp(r, a, p, m, ctx); | ||
| 839 | } | ||
| 840 | #endif | ||
| 841 | |||
| 842 | static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR phConnection) | ||
| 843 | { | ||
| 844 | int count; | ||
| 845 | AEP_RV rv = AEP_R_OK; | ||
| 846 | |||
| 847 | /*Get the current process id*/ | ||
| 848 | pid_t curr_pid; | ||
| 849 | |||
| 850 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 851 | |||
| 852 | curr_pid = getpid(); | ||
| 853 | |||
| 854 | /*Check if this is the first time this is being called from the current | ||
| 855 | process*/ | ||
| 856 | if (recorded_pid != curr_pid) | ||
| 857 | { | ||
| 858 | /*Remember our pid so we can check if we're in a new process*/ | ||
| 859 | recorded_pid = curr_pid; | ||
| 860 | |||
| 861 | /*Call Finalize to make sure we have not inherited some data | ||
| 862 | from a parent process*/ | ||
| 863 | p_AEP_Finalize(); | ||
| 864 | |||
| 865 | /*Initialise the AEP API*/ | ||
| 866 | rv = p_AEP_Initialize(NULL); | ||
| 867 | |||
| 868 | if (rv != AEP_R_OK) | ||
| 869 | { | ||
| 870 | AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_INIT_FAILURE); | ||
| 871 | recorded_pid = 0; | ||
| 872 | goto end; | ||
| 873 | } | ||
| 874 | |||
| 875 | /*Set the AEP big num call back functions*/ | ||
| 876 | rv = p_AEP_SetBNCallBacks(&GetBigNumSize, &MakeAEPBigNum, | ||
| 877 | &ConvertAEPBigNum); | ||
| 878 | |||
| 879 | if (rv != AEP_R_OK) | ||
| 880 | { | ||
| 881 | AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_SETBNCALLBACK_FAILURE); | ||
| 882 | recorded_pid = 0; | ||
| 883 | goto end; | ||
| 884 | } | ||
| 885 | |||
| 886 | #ifdef AEPRAND | ||
| 887 | /*Reset the rand byte count*/ | ||
| 888 | rand_block_bytes = 0; | ||
| 889 | #endif | ||
| 890 | |||
| 891 | /*Init the structures*/ | ||
| 892 | for (count = 0;count < MAX_PROCESS_CONNECTIONS;count ++) | ||
| 893 | { | ||
| 894 | aep_app_conn_table[count].conn_state = NotConnected; | ||
| 895 | aep_app_conn_table[count].conn_hndl = 0; | ||
| 896 | } | ||
| 897 | |||
| 898 | /*Open a connection*/ | ||
| 899 | rv = p_AEP_OpenConnection(phConnection); | ||
| 900 | |||
| 901 | if (rv != AEP_R_OK) | ||
| 902 | { | ||
| 903 | AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_UNIT_FAILURE); | ||
| 904 | recorded_pid = 0; | ||
| 905 | goto end; | ||
| 906 | } | ||
| 907 | |||
| 908 | aep_app_conn_table[0].conn_state = InUse; | ||
| 909 | aep_app_conn_table[0].conn_hndl = *phConnection; | ||
| 910 | goto end; | ||
| 911 | } | ||
| 912 | /*Check the existing connections to see if we can find a free one*/ | ||
| 913 | for (count = 0;count < MAX_PROCESS_CONNECTIONS;count ++) | ||
| 914 | { | ||
| 915 | if (aep_app_conn_table[count].conn_state == Connected) | ||
| 916 | { | ||
| 917 | aep_app_conn_table[count].conn_state = InUse; | ||
| 918 | *phConnection = aep_app_conn_table[count].conn_hndl; | ||
| 919 | goto end; | ||
| 920 | } | ||
| 921 | } | ||
| 922 | /*If no connections available, we're going to have to try | ||
| 923 | to open a new one*/ | ||
| 924 | for (count = 0;count < MAX_PROCESS_CONNECTIONS;count ++) | ||
| 925 | { | ||
| 926 | if (aep_app_conn_table[count].conn_state == NotConnected) | ||
| 927 | { | ||
| 928 | /*Open a connection*/ | ||
| 929 | rv = p_AEP_OpenConnection(phConnection); | ||
| 930 | |||
| 931 | if (rv != AEP_R_OK) | ||
| 932 | { | ||
| 933 | AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_UNIT_FAILURE); | ||
| 934 | goto end; | ||
| 935 | } | ||
| 936 | |||
| 937 | aep_app_conn_table[count].conn_state = InUse; | ||
| 938 | aep_app_conn_table[count].conn_hndl = *phConnection; | ||
| 939 | goto end; | ||
| 940 | } | ||
| 941 | } | ||
| 942 | rv = AEP_R_GENERAL_ERROR; | ||
| 943 | end: | ||
| 944 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 945 | return rv; | ||
| 946 | } | ||
| 947 | |||
| 948 | |||
| 949 | static AEP_RV aep_return_connection(AEP_CONNECTION_HNDL hConnection) | ||
| 950 | { | ||
| 951 | int count; | ||
| 952 | |||
| 953 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 954 | |||
| 955 | /*Find the connection item that matches this connection handle*/ | ||
| 956 | for(count = 0;count < MAX_PROCESS_CONNECTIONS;count ++) | ||
| 957 | { | ||
| 958 | if (aep_app_conn_table[count].conn_hndl == hConnection) | ||
| 959 | { | ||
| 960 | aep_app_conn_table[count].conn_state = Connected; | ||
| 961 | break; | ||
| 962 | } | ||
| 963 | } | ||
| 964 | |||
| 965 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 966 | |||
| 967 | return AEP_R_OK; | ||
| 968 | } | ||
| 969 | |||
| 970 | static AEP_RV aep_close_connection(AEP_CONNECTION_HNDL hConnection) | ||
| 971 | { | ||
| 972 | int count; | ||
| 973 | AEP_RV rv = AEP_R_OK; | ||
| 974 | |||
| 975 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 976 | |||
| 977 | /*Find the connection item that matches this connection handle*/ | ||
| 978 | for(count = 0;count < MAX_PROCESS_CONNECTIONS;count ++) | ||
| 979 | { | ||
| 980 | if (aep_app_conn_table[count].conn_hndl == hConnection) | ||
| 981 | { | ||
| 982 | rv = p_AEP_CloseConnection(aep_app_conn_table[count].conn_hndl); | ||
| 983 | if (rv != AEP_R_OK) | ||
| 984 | goto end; | ||
| 985 | aep_app_conn_table[count].conn_state = NotConnected; | ||
| 986 | aep_app_conn_table[count].conn_hndl = 0; | ||
| 987 | break; | ||
| 988 | } | ||
| 989 | } | ||
| 990 | |||
| 991 | end: | ||
| 992 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 993 | return rv; | ||
| 994 | } | ||
| 995 | |||
| 996 | static AEP_RV aep_close_all_connections(int use_engine_lock, int *in_use) | ||
| 997 | { | ||
| 998 | int count; | ||
| 999 | AEP_RV rv = AEP_R_OK; | ||
| 1000 | |||
| 1001 | *in_use = 0; | ||
| 1002 | if (use_engine_lock) CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 1003 | for (count = 0;count < MAX_PROCESS_CONNECTIONS;count ++) | ||
| 1004 | { | ||
| 1005 | switch (aep_app_conn_table[count].conn_state) | ||
| 1006 | { | ||
| 1007 | case Connected: | ||
| 1008 | rv = p_AEP_CloseConnection(aep_app_conn_table[count].conn_hndl); | ||
| 1009 | if (rv != AEP_R_OK) | ||
| 1010 | goto end; | ||
| 1011 | aep_app_conn_table[count].conn_state = NotConnected; | ||
| 1012 | aep_app_conn_table[count].conn_hndl = 0; | ||
| 1013 | break; | ||
| 1014 | case InUse: | ||
| 1015 | (*in_use)++; | ||
| 1016 | break; | ||
| 1017 | case NotConnected: | ||
| 1018 | break; | ||
| 1019 | } | ||
| 1020 | } | ||
| 1021 | end: | ||
| 1022 | if (use_engine_lock) CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 1023 | return rv; | ||
| 1024 | } | ||
| 1025 | |||
| 1026 | /*BigNum call back functions, used to convert OpenSSL bignums into AEP bignums. | ||
| 1027 | Note only 32bit Openssl build support*/ | ||
| 1028 | |||
| 1029 | static AEP_RV GetBigNumSize(AEP_VOID_PTR ArbBigNum, AEP_U32* BigNumSize) | ||
| 1030 | { | ||
| 1031 | BIGNUM* bn; | ||
| 1032 | |||
| 1033 | /*Cast the ArbBigNum pointer to our BIGNUM struct*/ | ||
| 1034 | bn = (BIGNUM*) ArbBigNum; | ||
| 1035 | |||
| 1036 | #ifdef SIXTY_FOUR_BIT_LONG | ||
| 1037 | *BigNumSize = bn->top << 3; | ||
| 1038 | #else | ||
| 1039 | /*Size of the bignum in bytes is equal to the bn->top (no of 32 bit | ||
| 1040 | words) multiplies by 4*/ | ||
| 1041 | *BigNumSize = bn->top << 2; | ||
| 1042 | #endif | ||
| 1043 | |||
| 1044 | return AEP_R_OK; | ||
| 1045 | } | ||
| 1046 | |||
| 1047 | static AEP_RV MakeAEPBigNum(AEP_VOID_PTR ArbBigNum, AEP_U32 BigNumSize, | ||
| 1048 | unsigned char* AEP_BigNum) | ||
| 1049 | { | ||
| 1050 | BIGNUM* bn; | ||
| 1051 | |||
| 1052 | #ifndef SIXTY_FOUR_BIT_LONG | ||
| 1053 | unsigned char* buf; | ||
| 1054 | int i; | ||
| 1055 | #endif | ||
| 1056 | |||
| 1057 | /*Cast the ArbBigNum pointer to our BIGNUM struct*/ | ||
| 1058 | bn = (BIGNUM*) ArbBigNum; | ||
| 1059 | |||
| 1060 | #ifdef SIXTY_FOUR_BIT_LONG | ||
| 1061 | memcpy(AEP_BigNum, bn->d, BigNumSize); | ||
| 1062 | #else | ||
| 1063 | /*Must copy data into a (monotone) least significant byte first format | ||
| 1064 | performing endian conversion if necessary*/ | ||
| 1065 | for(i=0;i<bn->top;i++) | ||
| 1066 | { | ||
| 1067 | buf = (unsigned char*)&bn->d[i]; | ||
| 1068 | |||
| 1069 | *((AEP_U32*)AEP_BigNum) = (AEP_U32) | ||
| 1070 | ((unsigned) buf[1] << 8 | buf[0]) | | ||
| 1071 | ((unsigned) buf[3] << 8 | buf[2]) << 16; | ||
| 1072 | |||
| 1073 | AEP_BigNum += 4; | ||
| 1074 | } | ||
| 1075 | #endif | ||
| 1076 | |||
| 1077 | return AEP_R_OK; | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | /*Turn an AEP Big Num back to a user big num*/ | ||
| 1081 | static AEP_RV ConvertAEPBigNum(void* ArbBigNum, AEP_U32 BigNumSize, | ||
| 1082 | unsigned char* AEP_BigNum) | ||
| 1083 | { | ||
| 1084 | BIGNUM* bn; | ||
| 1085 | #ifndef SIXTY_FOUR_BIT_LONG | ||
| 1086 | int i; | ||
| 1087 | #endif | ||
| 1088 | |||
| 1089 | bn = (BIGNUM*)ArbBigNum; | ||
| 1090 | |||
| 1091 | /*Expand the result bn so that it can hold our big num. | ||
| 1092 | Size is in bits*/ | ||
| 1093 | bn_expand(bn, (int)(BigNumSize << 3)); | ||
| 1094 | |||
| 1095 | #ifdef SIXTY_FOUR_BIT_LONG | ||
| 1096 | bn->top = BigNumSize >> 3; | ||
| 1097 | |||
| 1098 | if((BigNumSize & 7) != 0) | ||
| 1099 | bn->top++; | ||
| 1100 | |||
| 1101 | memset(bn->d, 0, bn->top << 3); | ||
| 1102 | |||
| 1103 | memcpy(bn->d, AEP_BigNum, BigNumSize); | ||
| 1104 | #else | ||
| 1105 | bn->top = BigNumSize >> 2; | ||
| 1106 | |||
| 1107 | for(i=0;i<bn->top;i++) | ||
| 1108 | { | ||
| 1109 | bn->d[i] = (AEP_U32) | ||
| 1110 | ((unsigned) AEP_BigNum[3] << 8 | AEP_BigNum[2]) << 16 | | ||
| 1111 | ((unsigned) AEP_BigNum[1] << 8 | AEP_BigNum[0]); | ||
| 1112 | AEP_BigNum += 4; | ||
| 1113 | } | ||
| 1114 | #endif | ||
| 1115 | |||
| 1116 | return AEP_R_OK; | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | #endif /* !OPENSSL_NO_HW_AEP */ | ||
| 1120 | #endif /* !OPENSSL_NO_HW */ | ||
diff --git a/src/lib/libcrypto/engine/hw_aep_err.c b/src/lib/libcrypto/engine/hw_aep_err.c deleted file mode 100644 index 092f532946..0000000000 --- a/src/lib/libcrypto/engine/hw_aep_err.c +++ /dev/null | |||
| @@ -1,157 +0,0 @@ | |||
| 1 | /* hw_aep_err.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 | /* 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 "hw_aep_err.h" | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | static ERR_STRING_DATA AEPHK_str_functs[]= | ||
| 68 | { | ||
| 69 | {ERR_PACK(0,AEPHK_F_AEP_CTRL,0), "AEP_CTRL"}, | ||
| 70 | {ERR_PACK(0,AEPHK_F_AEP_FINISH,0), "AEP_FINISH"}, | ||
| 71 | {ERR_PACK(0,AEPHK_F_AEP_GET_CONNECTION,0), "AEP_GET_CONNECTION"}, | ||
| 72 | {ERR_PACK(0,AEPHK_F_AEP_INIT,0), "AEP_INIT"}, | ||
| 73 | {ERR_PACK(0,AEPHK_F_AEP_MOD_EXP,0), "AEP_MOD_EXP"}, | ||
| 74 | {ERR_PACK(0,AEPHK_F_AEP_MOD_EXP_CRT,0), "AEP_MOD_EXP_CRT"}, | ||
| 75 | {ERR_PACK(0,AEPHK_F_AEP_RAND,0), "AEP_RAND"}, | ||
| 76 | {ERR_PACK(0,AEPHK_F_AEP_RSA_MOD_EXP,0), "AEP_RSA_MOD_EXP"}, | ||
| 77 | {0,NULL} | ||
| 78 | }; | ||
| 79 | |||
| 80 | static ERR_STRING_DATA AEPHK_str_reasons[]= | ||
| 81 | { | ||
| 82 | {AEPHK_R_ALREADY_LOADED ,"already loaded"}, | ||
| 83 | {AEPHK_R_CLOSE_HANDLES_FAILED ,"close handles failed"}, | ||
| 84 | {AEPHK_R_CONNECTIONS_IN_USE ,"connections in use"}, | ||
| 85 | {AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, | ||
| 86 | {AEPHK_R_FINALIZE_FAILED ,"finalize failed"}, | ||
| 87 | {AEPHK_R_GET_HANDLE_FAILED ,"get handle failed"}, | ||
| 88 | {AEPHK_R_GET_RANDOM_FAILED ,"get random failed"}, | ||
| 89 | {AEPHK_R_INIT_FAILURE ,"init failure"}, | ||
| 90 | {AEPHK_R_MISSING_KEY_COMPONENTS ,"missing key components"}, | ||
| 91 | {AEPHK_R_MOD_EXP_CRT_FAILED ,"mod exp crt failed"}, | ||
| 92 | {AEPHK_R_MOD_EXP_FAILED ,"mod exp failed"}, | ||
| 93 | {AEPHK_R_NOT_LOADED ,"not loaded"}, | ||
| 94 | {AEPHK_R_OK ,"ok"}, | ||
| 95 | {AEPHK_R_RETURN_CONNECTION_FAILED ,"return connection failed"}, | ||
| 96 | {AEPHK_R_SETBNCALLBACK_FAILURE ,"setbncallback failure"}, | ||
| 97 | {AEPHK_R_SIZE_TOO_LARGE_OR_TOO_SMALL ,"size too large or too small"}, | ||
| 98 | {AEPHK_R_UNIT_FAILURE ,"unit failure"}, | ||
| 99 | {0,NULL} | ||
| 100 | }; | ||
| 101 | |||
| 102 | #endif | ||
| 103 | |||
| 104 | #ifdef AEPHK_LIB_NAME | ||
| 105 | static ERR_STRING_DATA AEPHK_lib_name[]= | ||
| 106 | { | ||
| 107 | {0 ,AEPHK_LIB_NAME}, | ||
| 108 | {0,NULL} | ||
| 109 | }; | ||
| 110 | #endif | ||
| 111 | |||
| 112 | |||
| 113 | static int AEPHK_lib_error_code=0; | ||
| 114 | static int AEPHK_error_init=1; | ||
| 115 | |||
| 116 | static void ERR_load_AEPHK_strings(void) | ||
| 117 | { | ||
| 118 | if (AEPHK_lib_error_code == 0) | ||
| 119 | AEPHK_lib_error_code=ERR_get_next_error_library(); | ||
| 120 | |||
| 121 | if (AEPHK_error_init) | ||
| 122 | { | ||
| 123 | AEPHK_error_init=0; | ||
| 124 | #ifndef OPENSSL_NO_ERR | ||
| 125 | ERR_load_strings(AEPHK_lib_error_code,AEPHK_str_functs); | ||
| 126 | ERR_load_strings(AEPHK_lib_error_code,AEPHK_str_reasons); | ||
| 127 | #endif | ||
| 128 | |||
| 129 | #ifdef AEPHK_LIB_NAME | ||
| 130 | AEPHK_lib_name->error = ERR_PACK(AEPHK_lib_error_code,0,0); | ||
| 131 | ERR_load_strings(0,AEPHK_lib_name); | ||
| 132 | #endif | ||
| 133 | } | ||
| 134 | } | ||
| 135 | |||
| 136 | static void ERR_unload_AEPHK_strings(void) | ||
| 137 | { | ||
| 138 | if (AEPHK_error_init == 0) | ||
| 139 | { | ||
| 140 | #ifndef OPENSSL_NO_ERR | ||
| 141 | ERR_unload_strings(AEPHK_lib_error_code,AEPHK_str_functs); | ||
| 142 | ERR_unload_strings(AEPHK_lib_error_code,AEPHK_str_reasons); | ||
| 143 | #endif | ||
| 144 | |||
| 145 | #ifdef AEPHK_LIB_NAME | ||
| 146 | ERR_unload_strings(0,AEPHK_lib_name); | ||
| 147 | #endif | ||
| 148 | AEPHK_error_init=1; | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | static void ERR_AEPHK_error(int function, int reason, char *file, int line) | ||
| 153 | { | ||
| 154 | if (AEPHK_lib_error_code == 0) | ||
| 155 | AEPHK_lib_error_code=ERR_get_next_error_library(); | ||
| 156 | ERR_PUT_error(AEPHK_lib_error_code,function,reason,file,line); | ||
| 157 | } | ||
diff --git a/src/lib/libcrypto/engine/hw_aep_err.h b/src/lib/libcrypto/engine/hw_aep_err.h deleted file mode 100644 index 8fe4cf921f..0000000000 --- a/src/lib/libcrypto/engine/hw_aep_err.h +++ /dev/null | |||
| @@ -1,101 +0,0 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2001 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_AEPHK_ERR_H | ||
| 56 | #define HEADER_AEPHK_ERR_H | ||
| 57 | |||
| 58 | /* BEGIN ERROR CODES */ | ||
| 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 60 | * made after this point may be overwritten when the script is next run. | ||
| 61 | */ | ||
| 62 | static void ERR_load_AEPHK_strings(void); | ||
| 63 | static void ERR_unload_AEPHK_strings(void); | ||
| 64 | static void ERR_AEPHK_error(int function, int reason, char *file, int line); | ||
| 65 | #define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),__FILE__,__LINE__) | ||
| 66 | |||
| 67 | /* Error codes for the AEPHK functions. */ | ||
| 68 | |||
| 69 | /* Function codes. */ | ||
| 70 | #define AEPHK_F_AEP_CTRL 100 | ||
| 71 | #define AEPHK_F_AEP_FINISH 101 | ||
| 72 | #define AEPHK_F_AEP_GET_CONNECTION 102 | ||
| 73 | #define AEPHK_F_AEP_INIT 103 | ||
| 74 | #define AEPHK_F_AEP_MOD_EXP 104 | ||
| 75 | #define AEPHK_F_AEP_MOD_EXP_CRT 105 | ||
| 76 | #define AEPHK_F_AEP_RAND 106 | ||
| 77 | #define AEPHK_F_AEP_RSA_MOD_EXP 107 | ||
| 78 | |||
| 79 | /* Reason codes. */ | ||
| 80 | #define AEPHK_R_ALREADY_LOADED 100 | ||
| 81 | #define AEPHK_R_CLOSE_HANDLES_FAILED 101 | ||
| 82 | #define AEPHK_R_CONNECTIONS_IN_USE 102 | ||
| 83 | #define AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103 | ||
| 84 | #define AEPHK_R_FINALIZE_FAILED 104 | ||
| 85 | #define AEPHK_R_GET_HANDLE_FAILED 105 | ||
| 86 | #define AEPHK_R_GET_RANDOM_FAILED 106 | ||
| 87 | #define AEPHK_R_INIT_FAILURE 107 | ||
| 88 | #define AEPHK_R_MISSING_KEY_COMPONENTS 108 | ||
| 89 | #define AEPHK_R_MOD_EXP_CRT_FAILED 109 | ||
| 90 | #define AEPHK_R_MOD_EXP_FAILED 110 | ||
| 91 | #define AEPHK_R_NOT_LOADED 111 | ||
| 92 | #define AEPHK_R_OK 112 | ||
| 93 | #define AEPHK_R_RETURN_CONNECTION_FAILED 113 | ||
| 94 | #define AEPHK_R_SETBNCALLBACK_FAILURE 114 | ||
| 95 | #define AEPHK_R_SIZE_TOO_LARGE_OR_TOO_SMALL 116 | ||
| 96 | #define AEPHK_R_UNIT_FAILURE 115 | ||
| 97 | |||
| 98 | #ifdef __cplusplus | ||
| 99 | } | ||
| 100 | #endif | ||
| 101 | #endif | ||
diff --git a/src/lib/libcrypto/engine/hw_atalla.c b/src/lib/libcrypto/engine/hw_atalla.c deleted file mode 100644 index 2b8342bbdd..0000000000 --- a/src/lib/libcrypto/engine/hw_atalla.c +++ /dev/null | |||
| @@ -1,595 +0,0 @@ | |||
| 1 | /* crypto/engine/hw_atalla.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 <openssl/crypto.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/dso.h> | ||
| 63 | #include <openssl/engine.h> | ||
| 64 | |||
| 65 | #ifndef OPENSSL_NO_HW | ||
| 66 | #ifndef OPENSSL_NO_HW_ATALLA | ||
| 67 | |||
| 68 | #ifdef FLAT_INC | ||
| 69 | #include "atalla.h" | ||
| 70 | #else | ||
| 71 | #include "vendor_defns/atalla.h" | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #define ATALLA_LIB_NAME "atalla engine" | ||
| 75 | #include "hw_atalla_err.c" | ||
| 76 | |||
| 77 | static int atalla_destroy(ENGINE *e); | ||
| 78 | static int atalla_init(ENGINE *e); | ||
| 79 | static int atalla_finish(ENGINE *e); | ||
| 80 | static int atalla_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | ||
| 81 | |||
| 82 | /* BIGNUM stuff */ | ||
| 83 | static int atalla_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 84 | const BIGNUM *m, BN_CTX *ctx); | ||
| 85 | |||
| 86 | #ifndef OPENSSL_NO_RSA | ||
| 87 | /* RSA stuff */ | ||
| 88 | static int atalla_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); | ||
| 89 | #endif | ||
| 90 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
| 91 | static int atalla_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 92 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 93 | |||
| 94 | #ifndef OPENSSL_NO_DSA | ||
| 95 | /* DSA stuff */ | ||
| 96 | static int atalla_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, | ||
| 97 | BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
| 98 | BN_CTX *ctx, BN_MONT_CTX *in_mont); | ||
| 99 | static int atalla_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
| 100 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 101 | BN_MONT_CTX *m_ctx); | ||
| 102 | #endif | ||
| 103 | |||
| 104 | #ifndef OPENSSL_NO_DH | ||
| 105 | /* DH stuff */ | ||
| 106 | /* This function is alised to mod_exp (with the DH and mont dropped). */ | ||
| 107 | static int atalla_mod_exp_dh(const DH *dh, BIGNUM *r, | ||
| 108 | const BIGNUM *a, const BIGNUM *p, | ||
| 109 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 110 | #endif | ||
| 111 | |||
| 112 | /* The definitions for control commands specific to this engine */ | ||
| 113 | #define ATALLA_CMD_SO_PATH ENGINE_CMD_BASE | ||
| 114 | static const ENGINE_CMD_DEFN atalla_cmd_defns[] = { | ||
| 115 | {ATALLA_CMD_SO_PATH, | ||
| 116 | "SO_PATH", | ||
| 117 | "Specifies the path to the 'atasi' shared library", | ||
| 118 | ENGINE_CMD_FLAG_STRING}, | ||
| 119 | {0, NULL, NULL, 0} | ||
| 120 | }; | ||
| 121 | |||
| 122 | #ifndef OPENSSL_NO_RSA | ||
| 123 | /* Our internal RSA_METHOD that we provide pointers to */ | ||
| 124 | static RSA_METHOD atalla_rsa = | ||
| 125 | { | ||
| 126 | "Atalla RSA method", | ||
| 127 | NULL, | ||
| 128 | NULL, | ||
| 129 | NULL, | ||
| 130 | NULL, | ||
| 131 | atalla_rsa_mod_exp, | ||
| 132 | atalla_mod_exp_mont, | ||
| 133 | NULL, | ||
| 134 | NULL, | ||
| 135 | 0, | ||
| 136 | NULL, | ||
| 137 | NULL, | ||
| 138 | NULL | ||
| 139 | }; | ||
| 140 | #endif | ||
| 141 | |||
| 142 | #ifndef OPENSSL_NO_DSA | ||
| 143 | /* Our internal DSA_METHOD that we provide pointers to */ | ||
| 144 | static DSA_METHOD atalla_dsa = | ||
| 145 | { | ||
| 146 | "Atalla DSA method", | ||
| 147 | NULL, /* dsa_do_sign */ | ||
| 148 | NULL, /* dsa_sign_setup */ | ||
| 149 | NULL, /* dsa_do_verify */ | ||
| 150 | atalla_dsa_mod_exp, /* dsa_mod_exp */ | ||
| 151 | atalla_mod_exp_dsa, /* bn_mod_exp */ | ||
| 152 | NULL, /* init */ | ||
| 153 | NULL, /* finish */ | ||
| 154 | 0, /* flags */ | ||
| 155 | NULL /* app_data */ | ||
| 156 | }; | ||
| 157 | #endif | ||
| 158 | |||
| 159 | #ifndef OPENSSL_NO_DH | ||
| 160 | /* Our internal DH_METHOD that we provide pointers to */ | ||
| 161 | static DH_METHOD atalla_dh = | ||
| 162 | { | ||
| 163 | "Atalla DH method", | ||
| 164 | NULL, | ||
| 165 | NULL, | ||
| 166 | atalla_mod_exp_dh, | ||
| 167 | NULL, | ||
| 168 | NULL, | ||
| 169 | 0, | ||
| 170 | NULL | ||
| 171 | }; | ||
| 172 | #endif | ||
| 173 | |||
| 174 | /* Constants used when creating the ENGINE */ | ||
| 175 | static const char *engine_atalla_id = "atalla"; | ||
| 176 | static const char *engine_atalla_name = "Atalla hardware engine support"; | ||
| 177 | |||
| 178 | /* This internal function is used by ENGINE_atalla() and possibly by the | ||
| 179 | * "dynamic" ENGINE support too */ | ||
| 180 | static int bind_helper(ENGINE *e) | ||
| 181 | { | ||
| 182 | #ifndef OPENSSL_NO_RSA | ||
| 183 | const RSA_METHOD *meth1; | ||
| 184 | #endif | ||
| 185 | #ifndef OPENSSL_NO_DSA | ||
| 186 | const DSA_METHOD *meth2; | ||
| 187 | #endif | ||
| 188 | #ifndef OPENSSL_NO_DH | ||
| 189 | const DH_METHOD *meth3; | ||
| 190 | #endif | ||
| 191 | if(!ENGINE_set_id(e, engine_atalla_id) || | ||
| 192 | !ENGINE_set_name(e, engine_atalla_name) || | ||
| 193 | #ifndef OPENSSL_NO_RSA | ||
| 194 | !ENGINE_set_RSA(e, &atalla_rsa) || | ||
| 195 | #endif | ||
| 196 | #ifndef OPENSSL_NO_DSA | ||
| 197 | !ENGINE_set_DSA(e, &atalla_dsa) || | ||
| 198 | #endif | ||
| 199 | #ifndef OPENSSL_NO_DH | ||
| 200 | !ENGINE_set_DH(e, &atalla_dh) || | ||
| 201 | #endif | ||
| 202 | !ENGINE_set_destroy_function(e, atalla_destroy) || | ||
| 203 | !ENGINE_set_init_function(e, atalla_init) || | ||
| 204 | !ENGINE_set_finish_function(e, atalla_finish) || | ||
| 205 | !ENGINE_set_ctrl_function(e, atalla_ctrl) || | ||
| 206 | !ENGINE_set_cmd_defns(e, atalla_cmd_defns)) | ||
| 207 | return 0; | ||
| 208 | |||
| 209 | #ifndef OPENSSL_NO_RSA | ||
| 210 | /* We know that the "PKCS1_SSLeay()" functions hook properly | ||
| 211 | * to the atalla-specific mod_exp and mod_exp_crt so we use | ||
| 212 | * those functions. NB: We don't use ENGINE_openssl() or | ||
| 213 | * anything "more generic" because something like the RSAref | ||
| 214 | * code may not hook properly, and if you own one of these | ||
| 215 | * cards then you have the right to do RSA operations on it | ||
| 216 | * anyway! */ | ||
| 217 | meth1 = RSA_PKCS1_SSLeay(); | ||
| 218 | atalla_rsa.rsa_pub_enc = meth1->rsa_pub_enc; | ||
| 219 | atalla_rsa.rsa_pub_dec = meth1->rsa_pub_dec; | ||
| 220 | atalla_rsa.rsa_priv_enc = meth1->rsa_priv_enc; | ||
| 221 | atalla_rsa.rsa_priv_dec = meth1->rsa_priv_dec; | ||
| 222 | #endif | ||
| 223 | |||
| 224 | #ifndef OPENSSL_NO_DSA | ||
| 225 | /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish | ||
| 226 | * bits. */ | ||
| 227 | meth2 = DSA_OpenSSL(); | ||
| 228 | atalla_dsa.dsa_do_sign = meth2->dsa_do_sign; | ||
| 229 | atalla_dsa.dsa_sign_setup = meth2->dsa_sign_setup; | ||
| 230 | atalla_dsa.dsa_do_verify = meth2->dsa_do_verify; | ||
| 231 | #endif | ||
| 232 | |||
| 233 | #ifndef OPENSSL_NO_DH | ||
| 234 | /* Much the same for Diffie-Hellman */ | ||
| 235 | meth3 = DH_OpenSSL(); | ||
| 236 | atalla_dh.generate_key = meth3->generate_key; | ||
| 237 | atalla_dh.compute_key = meth3->compute_key; | ||
| 238 | #endif | ||
| 239 | |||
| 240 | /* Ensure the atalla error handling is set up */ | ||
| 241 | ERR_load_ATALLA_strings(); | ||
| 242 | return 1; | ||
| 243 | } | ||
| 244 | |||
| 245 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 246 | static ENGINE *engine_atalla(void) | ||
| 247 | { | ||
| 248 | ENGINE *ret = ENGINE_new(); | ||
| 249 | if(!ret) | ||
| 250 | return NULL; | ||
| 251 | if(!bind_helper(ret)) | ||
| 252 | { | ||
| 253 | ENGINE_free(ret); | ||
| 254 | return NULL; | ||
| 255 | } | ||
| 256 | return ret; | ||
| 257 | } | ||
| 258 | |||
| 259 | void ENGINE_load_atalla(void) | ||
| 260 | { | ||
| 261 | /* Copied from eng_[openssl|dyn].c */ | ||
| 262 | ENGINE *toadd = engine_atalla(); | ||
| 263 | if(!toadd) return; | ||
| 264 | ENGINE_add(toadd); | ||
| 265 | ENGINE_free(toadd); | ||
| 266 | ERR_clear_error(); | ||
| 267 | } | ||
| 268 | #endif | ||
| 269 | |||
| 270 | /* This is a process-global DSO handle used for loading and unloading | ||
| 271 | * the Atalla library. NB: This is only set (or unset) during an | ||
| 272 | * init() or finish() call (reference counts permitting) and they're | ||
| 273 | * operating with global locks, so this should be thread-safe | ||
| 274 | * implicitly. */ | ||
| 275 | static DSO *atalla_dso = NULL; | ||
| 276 | |||
| 277 | /* These are the function pointers that are (un)set when the library has | ||
| 278 | * successfully (un)loaded. */ | ||
| 279 | static tfnASI_GetHardwareConfig *p_Atalla_GetHardwareConfig = NULL; | ||
| 280 | static tfnASI_RSAPrivateKeyOpFn *p_Atalla_RSAPrivateKeyOpFn = NULL; | ||
| 281 | static tfnASI_GetPerformanceStatistics *p_Atalla_GetPerformanceStatistics = NULL; | ||
| 282 | |||
| 283 | /* These are the static string constants for the DSO file name and the function | ||
| 284 | * symbol names to bind to. Regrettably, the DSO name on *nix appears to be | ||
| 285 | * "atasi.so" rather than something more consistent like "libatasi.so". At the | ||
| 286 | * time of writing, I'm not sure what the file name on win32 is but clearly | ||
| 287 | * native name translation is not possible (eg libatasi.so on *nix, and | ||
| 288 | * atasi.dll on win32). For the purposes of testing, I have created a symbollic | ||
| 289 | * link called "libatasi.so" so that we can use native name-translation - a | ||
| 290 | * better solution will be needed. */ | ||
| 291 | static const char *ATALLA_LIBNAME = NULL; | ||
| 292 | static const char *get_ATALLA_LIBNAME(void) | ||
| 293 | { | ||
| 294 | if(ATALLA_LIBNAME) | ||
| 295 | return ATALLA_LIBNAME; | ||
| 296 | return "atasi"; | ||
| 297 | } | ||
| 298 | static void free_ATALLA_LIBNAME(void) | ||
| 299 | { | ||
| 300 | if(ATALLA_LIBNAME) | ||
| 301 | OPENSSL_free((void*)ATALLA_LIBNAME); | ||
| 302 | ATALLA_LIBNAME = NULL; | ||
| 303 | } | ||
| 304 | static long set_ATALLA_LIBNAME(const char *name) | ||
| 305 | { | ||
| 306 | free_ATALLA_LIBNAME(); | ||
| 307 | return (((ATALLA_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0); | ||
| 308 | } | ||
| 309 | static const char *ATALLA_F1 = "ASI_GetHardwareConfig"; | ||
| 310 | static const char *ATALLA_F2 = "ASI_RSAPrivateKeyOpFn"; | ||
| 311 | static const char *ATALLA_F3 = "ASI_GetPerformanceStatistics"; | ||
| 312 | |||
| 313 | /* Destructor (complements the "ENGINE_atalla()" constructor) */ | ||
| 314 | static int atalla_destroy(ENGINE *e) | ||
| 315 | { | ||
| 316 | free_ATALLA_LIBNAME(); | ||
| 317 | /* Unload the atalla error strings so any error state including our | ||
| 318 | * functs or reasons won't lead to a segfault (they simply get displayed | ||
| 319 | * without corresponding string data because none will be found). */ | ||
| 320 | ERR_unload_ATALLA_strings(); | ||
| 321 | return 1; | ||
| 322 | } | ||
| 323 | |||
| 324 | /* (de)initialisation functions. */ | ||
| 325 | static int atalla_init(ENGINE *e) | ||
| 326 | { | ||
| 327 | tfnASI_GetHardwareConfig *p1; | ||
| 328 | tfnASI_RSAPrivateKeyOpFn *p2; | ||
| 329 | tfnASI_GetPerformanceStatistics *p3; | ||
| 330 | /* Not sure of the origin of this magic value, but Ben's code had it | ||
| 331 | * and it seemed to have been working for a few people. :-) */ | ||
| 332 | unsigned int config_buf[1024]; | ||
| 333 | |||
| 334 | if(atalla_dso != NULL) | ||
| 335 | { | ||
| 336 | ATALLAerr(ATALLA_F_ATALLA_INIT,ATALLA_R_ALREADY_LOADED); | ||
| 337 | goto err; | ||
| 338 | } | ||
| 339 | /* Attempt to load libatasi.so/atasi.dll/whatever. Needs to be | ||
| 340 | * changed unfortunately because the Atalla drivers don't have | ||
| 341 | * standard library names that can be platform-translated well. */ | ||
| 342 | /* TODO: Work out how to actually map to the names the Atalla | ||
| 343 | * drivers really use - for now a symbollic link needs to be | ||
| 344 | * created on the host system from libatasi.so to atasi.so on | ||
| 345 | * unix variants. */ | ||
| 346 | atalla_dso = DSO_load(NULL, get_ATALLA_LIBNAME(), NULL, 0); | ||
| 347 | if(atalla_dso == NULL) | ||
| 348 | { | ||
| 349 | ATALLAerr(ATALLA_F_ATALLA_INIT,ATALLA_R_NOT_LOADED); | ||
| 350 | goto err; | ||
| 351 | } | ||
| 352 | if(!(p1 = (tfnASI_GetHardwareConfig *)DSO_bind_func( | ||
| 353 | atalla_dso, ATALLA_F1)) || | ||
| 354 | !(p2 = (tfnASI_RSAPrivateKeyOpFn *)DSO_bind_func( | ||
| 355 | atalla_dso, ATALLA_F2)) || | ||
| 356 | !(p3 = (tfnASI_GetPerformanceStatistics *)DSO_bind_func( | ||
| 357 | atalla_dso, ATALLA_F3))) | ||
| 358 | { | ||
| 359 | ATALLAerr(ATALLA_F_ATALLA_INIT,ATALLA_R_NOT_LOADED); | ||
| 360 | goto err; | ||
| 361 | } | ||
| 362 | /* Copy the pointers */ | ||
| 363 | p_Atalla_GetHardwareConfig = p1; | ||
| 364 | p_Atalla_RSAPrivateKeyOpFn = p2; | ||
| 365 | p_Atalla_GetPerformanceStatistics = p3; | ||
| 366 | /* Perform a basic test to see if there's actually any unit | ||
| 367 | * running. */ | ||
| 368 | if(p1(0L, config_buf) != 0) | ||
| 369 | { | ||
| 370 | ATALLAerr(ATALLA_F_ATALLA_INIT,ATALLA_R_UNIT_FAILURE); | ||
| 371 | goto err; | ||
| 372 | } | ||
| 373 | /* Everything's fine. */ | ||
| 374 | return 1; | ||
| 375 | err: | ||
| 376 | if(atalla_dso) | ||
| 377 | DSO_free(atalla_dso); | ||
| 378 | atalla_dso = NULL; | ||
| 379 | p_Atalla_GetHardwareConfig = NULL; | ||
| 380 | p_Atalla_RSAPrivateKeyOpFn = NULL; | ||
| 381 | p_Atalla_GetPerformanceStatistics = NULL; | ||
| 382 | return 0; | ||
| 383 | } | ||
| 384 | |||
| 385 | static int atalla_finish(ENGINE *e) | ||
| 386 | { | ||
| 387 | free_ATALLA_LIBNAME(); | ||
| 388 | if(atalla_dso == NULL) | ||
| 389 | { | ||
| 390 | ATALLAerr(ATALLA_F_ATALLA_FINISH,ATALLA_R_NOT_LOADED); | ||
| 391 | return 0; | ||
| 392 | } | ||
| 393 | if(!DSO_free(atalla_dso)) | ||
| 394 | { | ||
| 395 | ATALLAerr(ATALLA_F_ATALLA_FINISH,ATALLA_R_UNIT_FAILURE); | ||
| 396 | return 0; | ||
| 397 | } | ||
| 398 | atalla_dso = NULL; | ||
| 399 | p_Atalla_GetHardwareConfig = NULL; | ||
| 400 | p_Atalla_RSAPrivateKeyOpFn = NULL; | ||
| 401 | p_Atalla_GetPerformanceStatistics = NULL; | ||
| 402 | return 1; | ||
| 403 | } | ||
| 404 | |||
| 405 | static int atalla_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | ||
| 406 | { | ||
| 407 | int initialised = ((atalla_dso == NULL) ? 0 : 1); | ||
| 408 | switch(cmd) | ||
| 409 | { | ||
| 410 | case ATALLA_CMD_SO_PATH: | ||
| 411 | if(p == NULL) | ||
| 412 | { | ||
| 413 | ATALLAerr(ATALLA_F_ATALLA_CTRL,ERR_R_PASSED_NULL_PARAMETER); | ||
| 414 | return 0; | ||
| 415 | } | ||
| 416 | if(initialised) | ||
| 417 | { | ||
| 418 | ATALLAerr(ATALLA_F_ATALLA_CTRL,ATALLA_R_ALREADY_LOADED); | ||
| 419 | return 0; | ||
| 420 | } | ||
| 421 | return set_ATALLA_LIBNAME((const char *)p); | ||
| 422 | default: | ||
| 423 | break; | ||
| 424 | } | ||
| 425 | ATALLAerr(ATALLA_F_ATALLA_CTRL,ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED); | ||
| 426 | return 0; | ||
| 427 | } | ||
| 428 | |||
| 429 | static int atalla_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 430 | const BIGNUM *m, BN_CTX *ctx) | ||
| 431 | { | ||
| 432 | /* I need somewhere to store temporary serialised values for | ||
| 433 | * use with the Atalla API calls. A neat cheat - I'll use | ||
| 434 | * BIGNUMs from the BN_CTX but access their arrays directly as | ||
| 435 | * byte arrays <grin>. This way I don't have to clean anything | ||
| 436 | * up. */ | ||
| 437 | BIGNUM *modulus; | ||
| 438 | BIGNUM *exponent; | ||
| 439 | BIGNUM *argument; | ||
| 440 | BIGNUM *result; | ||
| 441 | RSAPrivateKey keydata; | ||
| 442 | int to_return, numbytes; | ||
| 443 | |||
| 444 | modulus = exponent = argument = result = NULL; | ||
| 445 | to_return = 0; /* expect failure */ | ||
| 446 | |||
| 447 | if(!atalla_dso) | ||
| 448 | { | ||
| 449 | ATALLAerr(ATALLA_F_ATALLA_MOD_EXP,ATALLA_R_NOT_LOADED); | ||
| 450 | goto err; | ||
| 451 | } | ||
| 452 | /* Prepare the params */ | ||
| 453 | BN_CTX_start(ctx); | ||
| 454 | modulus = BN_CTX_get(ctx); | ||
| 455 | exponent = BN_CTX_get(ctx); | ||
| 456 | argument = BN_CTX_get(ctx); | ||
| 457 | result = BN_CTX_get(ctx); | ||
| 458 | if (!result) | ||
| 459 | { | ||
| 460 | ATALLAerr(ATALLA_F_ATALLA_MOD_EXP,ATALLA_R_BN_CTX_FULL); | ||
| 461 | goto err; | ||
| 462 | } | ||
| 463 | if(!bn_wexpand(modulus, m->top) || !bn_wexpand(exponent, m->top) || | ||
| 464 | !bn_wexpand(argument, m->top) || !bn_wexpand(result, m->top)) | ||
| 465 | { | ||
| 466 | ATALLAerr(ATALLA_F_ATALLA_MOD_EXP,ATALLA_R_BN_EXPAND_FAIL); | ||
| 467 | goto err; | ||
| 468 | } | ||
| 469 | /* Prepare the key-data */ | ||
| 470 | memset(&keydata, 0,sizeof keydata); | ||
| 471 | numbytes = BN_num_bytes(m); | ||
| 472 | memset(exponent->d, 0, numbytes); | ||
| 473 | memset(modulus->d, 0, numbytes); | ||
| 474 | BN_bn2bin(p, (unsigned char *)exponent->d + numbytes - BN_num_bytes(p)); | ||
| 475 | BN_bn2bin(m, (unsigned char *)modulus->d + numbytes - BN_num_bytes(m)); | ||
| 476 | keydata.privateExponent.data = (unsigned char *)exponent->d; | ||
| 477 | keydata.privateExponent.len = numbytes; | ||
| 478 | keydata.modulus.data = (unsigned char *)modulus->d; | ||
| 479 | keydata.modulus.len = numbytes; | ||
| 480 | /* Prepare the argument */ | ||
| 481 | memset(argument->d, 0, numbytes); | ||
| 482 | memset(result->d, 0, numbytes); | ||
| 483 | BN_bn2bin(a, (unsigned char *)argument->d + numbytes - BN_num_bytes(a)); | ||
| 484 | /* Perform the operation */ | ||
| 485 | if(p_Atalla_RSAPrivateKeyOpFn(&keydata, (unsigned char *)result->d, | ||
| 486 | (unsigned char *)argument->d, | ||
| 487 | keydata.modulus.len) != 0) | ||
| 488 | { | ||
| 489 | ATALLAerr(ATALLA_F_ATALLA_MOD_EXP,ATALLA_R_REQUEST_FAILED); | ||
| 490 | goto err; | ||
| 491 | } | ||
| 492 | /* Convert the response */ | ||
| 493 | BN_bin2bn((unsigned char *)result->d, numbytes, r); | ||
| 494 | to_return = 1; | ||
| 495 | err: | ||
| 496 | BN_CTX_end(ctx); | ||
| 497 | return to_return; | ||
| 498 | } | ||
| 499 | |||
| 500 | #ifndef OPENSSL_NO_RSA | ||
| 501 | static int atalla_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | ||
| 502 | { | ||
| 503 | BN_CTX *ctx = NULL; | ||
| 504 | int to_return = 0; | ||
| 505 | |||
| 506 | if(!atalla_dso) | ||
| 507 | { | ||
| 508 | ATALLAerr(ATALLA_F_ATALLA_RSA_MOD_EXP,ATALLA_R_NOT_LOADED); | ||
| 509 | goto err; | ||
| 510 | } | ||
| 511 | if((ctx = BN_CTX_new()) == NULL) | ||
| 512 | goto err; | ||
| 513 | if(!rsa->d || !rsa->n) | ||
| 514 | { | ||
| 515 | ATALLAerr(ATALLA_F_ATALLA_RSA_MOD_EXP,ATALLA_R_MISSING_KEY_COMPONENTS); | ||
| 516 | goto err; | ||
| 517 | } | ||
| 518 | to_return = atalla_mod_exp(r0, I, rsa->d, rsa->n, ctx); | ||
| 519 | err: | ||
| 520 | if(ctx) | ||
| 521 | BN_CTX_free(ctx); | ||
| 522 | return to_return; | ||
| 523 | } | ||
| 524 | #endif | ||
| 525 | |||
| 526 | #ifndef OPENSSL_NO_DSA | ||
| 527 | /* This code was liberated and adapted from the commented-out code in | ||
| 528 | * dsa_ossl.c. Because of the unoptimised form of the Atalla acceleration | ||
| 529 | * (it doesn't have a CRT form for RSA), this function means that an | ||
| 530 | * Atalla system running with a DSA server certificate can handshake | ||
| 531 | * around 5 or 6 times faster/more than an equivalent system running with | ||
| 532 | * RSA. Just check out the "signs" statistics from the RSA and DSA parts | ||
| 533 | * of "openssl speed -engine atalla dsa1024 rsa1024". */ | ||
| 534 | static int atalla_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, | ||
| 535 | BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
| 536 | BN_CTX *ctx, BN_MONT_CTX *in_mont) | ||
| 537 | { | ||
| 538 | BIGNUM t; | ||
| 539 | int to_return = 0; | ||
| 540 | |||
| 541 | BN_init(&t); | ||
| 542 | /* let rr = a1 ^ p1 mod m */ | ||
| 543 | if (!atalla_mod_exp(rr,a1,p1,m,ctx)) goto end; | ||
| 544 | /* let t = a2 ^ p2 mod m */ | ||
| 545 | if (!atalla_mod_exp(&t,a2,p2,m,ctx)) goto end; | ||
| 546 | /* let rr = rr * t mod m */ | ||
| 547 | if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end; | ||
| 548 | to_return = 1; | ||
| 549 | end: | ||
| 550 | BN_free(&t); | ||
| 551 | return to_return; | ||
| 552 | } | ||
| 553 | |||
| 554 | static int atalla_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
| 555 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 556 | BN_MONT_CTX *m_ctx) | ||
| 557 | { | ||
| 558 | return atalla_mod_exp(r, a, p, m, ctx); | ||
| 559 | } | ||
| 560 | #endif | ||
| 561 | |||
| 562 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
| 563 | static int atalla_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 564 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 565 | { | ||
| 566 | return atalla_mod_exp(r, a, p, m, ctx); | ||
| 567 | } | ||
| 568 | |||
| 569 | #ifndef OPENSSL_NO_DH | ||
| 570 | /* This function is aliased to mod_exp (with the dh and mont dropped). */ | ||
| 571 | static int atalla_mod_exp_dh(const DH *dh, BIGNUM *r, | ||
| 572 | const BIGNUM *a, const BIGNUM *p, | ||
| 573 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 574 | { | ||
| 575 | return atalla_mod_exp(r, a, p, m, ctx); | ||
| 576 | } | ||
| 577 | #endif | ||
| 578 | |||
| 579 | /* This stuff is needed if this ENGINE is being compiled into a self-contained | ||
| 580 | * shared-library. */ | ||
| 581 | #ifdef ENGINE_DYNAMIC_SUPPORT | ||
| 582 | static int bind_fn(ENGINE *e, const char *id) | ||
| 583 | { | ||
| 584 | if(id && (strcmp(id, engine_atalla_id) != 0)) | ||
| 585 | return 0; | ||
| 586 | if(!bind_helper(e)) | ||
| 587 | return 0; | ||
| 588 | return 1; | ||
| 589 | } | ||
| 590 | IMPLEMENT_DYNAMIC_CHECK_FN() | ||
| 591 | IMPLEMENT_DYNAMIC_BIND_FN(bind_fn) | ||
| 592 | #endif /* ENGINE_DYNAMIC_SUPPORT */ | ||
| 593 | |||
| 594 | #endif /* !OPENSSL_NO_HW_ATALLA */ | ||
| 595 | #endif /* !OPENSSL_NO_HW */ | ||
diff --git a/src/lib/libcrypto/engine/hw_atalla_err.c b/src/lib/libcrypto/engine/hw_atalla_err.c deleted file mode 100644 index 1df9c4570c..0000000000 --- a/src/lib/libcrypto/engine/hw_atalla_err.c +++ /dev/null | |||
| @@ -1,145 +0,0 @@ | |||
| 1 | /* hw_atalla_err.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 | /* 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 "hw_atalla_err.h" | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | static ERR_STRING_DATA ATALLA_str_functs[]= | ||
| 68 | { | ||
| 69 | {ERR_PACK(0,ATALLA_F_ATALLA_CTRL,0), "ATALLA_CTRL"}, | ||
| 70 | {ERR_PACK(0,ATALLA_F_ATALLA_FINISH,0), "ATALLA_FINISH"}, | ||
| 71 | {ERR_PACK(0,ATALLA_F_ATALLA_INIT,0), "ATALLA_INIT"}, | ||
| 72 | {ERR_PACK(0,ATALLA_F_ATALLA_MOD_EXP,0), "ATALLA_MOD_EXP"}, | ||
| 73 | {ERR_PACK(0,ATALLA_F_ATALLA_RSA_MOD_EXP,0), "ATALLA_RSA_MOD_EXP"}, | ||
| 74 | {0,NULL} | ||
| 75 | }; | ||
| 76 | |||
| 77 | static ERR_STRING_DATA ATALLA_str_reasons[]= | ||
| 78 | { | ||
| 79 | {ATALLA_R_ALREADY_LOADED ,"already loaded"}, | ||
| 80 | {ATALLA_R_BN_CTX_FULL ,"bn ctx full"}, | ||
| 81 | {ATALLA_R_BN_EXPAND_FAIL ,"bn expand fail"}, | ||
| 82 | {ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, | ||
| 83 | {ATALLA_R_MISSING_KEY_COMPONENTS ,"missing key components"}, | ||
| 84 | {ATALLA_R_NOT_LOADED ,"not loaded"}, | ||
| 85 | {ATALLA_R_REQUEST_FAILED ,"request failed"}, | ||
| 86 | {ATALLA_R_UNIT_FAILURE ,"unit failure"}, | ||
| 87 | {0,NULL} | ||
| 88 | }; | ||
| 89 | |||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifdef ATALLA_LIB_NAME | ||
| 93 | static ERR_STRING_DATA ATALLA_lib_name[]= | ||
| 94 | { | ||
| 95 | {0 ,ATALLA_LIB_NAME}, | ||
| 96 | {0,NULL} | ||
| 97 | }; | ||
| 98 | #endif | ||
| 99 | |||
| 100 | |||
| 101 | static int ATALLA_lib_error_code=0; | ||
| 102 | static int ATALLA_error_init=1; | ||
| 103 | |||
| 104 | static void ERR_load_ATALLA_strings(void) | ||
| 105 | { | ||
| 106 | if (ATALLA_lib_error_code == 0) | ||
| 107 | ATALLA_lib_error_code=ERR_get_next_error_library(); | ||
| 108 | |||
| 109 | if (ATALLA_error_init) | ||
| 110 | { | ||
| 111 | ATALLA_error_init=0; | ||
| 112 | #ifndef OPENSSL_NO_ERR | ||
| 113 | ERR_load_strings(ATALLA_lib_error_code,ATALLA_str_functs); | ||
| 114 | ERR_load_strings(ATALLA_lib_error_code,ATALLA_str_reasons); | ||
| 115 | #endif | ||
| 116 | |||
| 117 | #ifdef ATALLA_LIB_NAME | ||
| 118 | ATALLA_lib_name->error = ERR_PACK(ATALLA_lib_error_code,0,0); | ||
| 119 | ERR_load_strings(0,ATALLA_lib_name); | ||
| 120 | #endif | ||
| 121 | } | ||
| 122 | } | ||
| 123 | |||
| 124 | static void ERR_unload_ATALLA_strings(void) | ||
| 125 | { | ||
| 126 | if (ATALLA_error_init == 0) | ||
| 127 | { | ||
| 128 | #ifndef OPENSSL_NO_ERR | ||
| 129 | ERR_unload_strings(ATALLA_lib_error_code,ATALLA_str_functs); | ||
| 130 | ERR_unload_strings(ATALLA_lib_error_code,ATALLA_str_reasons); | ||
| 131 | #endif | ||
| 132 | |||
| 133 | #ifdef ATALLA_LIB_NAME | ||
| 134 | ERR_unload_strings(0,ATALLA_lib_name); | ||
| 135 | #endif | ||
| 136 | ATALLA_error_init=1; | ||
| 137 | } | ||
| 138 | } | ||
| 139 | |||
| 140 | static void ERR_ATALLA_error(int function, int reason, char *file, int line) | ||
| 141 | { | ||
| 142 | if (ATALLA_lib_error_code == 0) | ||
| 143 | ATALLA_lib_error_code=ERR_get_next_error_library(); | ||
| 144 | ERR_PUT_error(ATALLA_lib_error_code,function,reason,file,line); | ||
| 145 | } | ||
diff --git a/src/lib/libcrypto/engine/hw_atalla_err.h b/src/lib/libcrypto/engine/hw_atalla_err.h deleted file mode 100644 index cdac052d8c..0000000000 --- a/src/lib/libcrypto/engine/hw_atalla_err.h +++ /dev/null | |||
| @@ -1,89 +0,0 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2001 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_ATALLA_ERR_H | ||
| 56 | #define HEADER_ATALLA_ERR_H | ||
| 57 | |||
| 58 | /* BEGIN ERROR CODES */ | ||
| 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 60 | * made after this point may be overwritten when the script is next run. | ||
| 61 | */ | ||
| 62 | static void ERR_load_ATALLA_strings(void); | ||
| 63 | static void ERR_unload_ATALLA_strings(void); | ||
| 64 | static void ERR_ATALLA_error(int function, int reason, char *file, int line); | ||
| 65 | #define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),__FILE__,__LINE__) | ||
| 66 | |||
| 67 | /* Error codes for the ATALLA functions. */ | ||
| 68 | |||
| 69 | /* Function codes. */ | ||
| 70 | #define ATALLA_F_ATALLA_CTRL 100 | ||
| 71 | #define ATALLA_F_ATALLA_FINISH 101 | ||
| 72 | #define ATALLA_F_ATALLA_INIT 102 | ||
| 73 | #define ATALLA_F_ATALLA_MOD_EXP 103 | ||
| 74 | #define ATALLA_F_ATALLA_RSA_MOD_EXP 104 | ||
| 75 | |||
| 76 | /* Reason codes. */ | ||
| 77 | #define ATALLA_R_ALREADY_LOADED 100 | ||
| 78 | #define ATALLA_R_BN_CTX_FULL 101 | ||
| 79 | #define ATALLA_R_BN_EXPAND_FAIL 102 | ||
| 80 | #define ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED 103 | ||
| 81 | #define ATALLA_R_MISSING_KEY_COMPONENTS 104 | ||
| 82 | #define ATALLA_R_NOT_LOADED 105 | ||
| 83 | #define ATALLA_R_REQUEST_FAILED 106 | ||
| 84 | #define ATALLA_R_UNIT_FAILURE 107 | ||
| 85 | |||
| 86 | #ifdef __cplusplus | ||
| 87 | } | ||
| 88 | #endif | ||
| 89 | #endif | ||
diff --git a/src/lib/libcrypto/engine/hw_cswift.c b/src/lib/libcrypto/engine/hw_cswift.c deleted file mode 100644 index 1411fd8333..0000000000 --- a/src/lib/libcrypto/engine/hw_cswift.c +++ /dev/null | |||
| @@ -1,1109 +0,0 @@ | |||
| 1 | /* crypto/engine/hw_cswift.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 <openssl/crypto.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/dso.h> | ||
| 63 | #include <openssl/engine.h> | ||
| 64 | |||
| 65 | #ifndef OPENSSL_NO_HW | ||
| 66 | #ifndef OPENSSL_NO_HW_CSWIFT | ||
| 67 | |||
| 68 | /* Attribution notice: Rainbow have generously allowed me to reproduce | ||
| 69 | * the necessary definitions here from their API. This means the support | ||
| 70 | * can build independently of whether application builders have the | ||
| 71 | * API or hardware. This will allow developers to easily produce software | ||
| 72 | * that has latent hardware support for any users that have accelerators | ||
| 73 | * installed, without the developers themselves needing anything extra. | ||
| 74 | * | ||
| 75 | * I have only clipped the parts from the CryptoSwift header files that | ||
| 76 | * are (or seem) relevant to the CryptoSwift support code. This is | ||
| 77 | * simply to keep the file sizes reasonable. | ||
| 78 | * [Geoff] | ||
| 79 | */ | ||
| 80 | #ifdef FLAT_INC | ||
| 81 | #include "cswift.h" | ||
| 82 | #else | ||
| 83 | #include "vendor_defns/cswift.h" | ||
| 84 | #endif | ||
| 85 | |||
| 86 | #define CSWIFT_LIB_NAME "cswift engine" | ||
| 87 | #include "hw_cswift_err.c" | ||
| 88 | |||
| 89 | static int cswift_destroy(ENGINE *e); | ||
| 90 | static int cswift_init(ENGINE *e); | ||
| 91 | static int cswift_finish(ENGINE *e); | ||
| 92 | static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | ||
| 93 | static int cswift_bn_32copy(SW_LARGENUMBER * out, const BIGNUM * in); | ||
| 94 | |||
| 95 | /* BIGNUM stuff */ | ||
| 96 | static int cswift_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 97 | const BIGNUM *m, BN_CTX *ctx); | ||
| 98 | static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 99 | const BIGNUM *q, const BIGNUM *dmp1, const BIGNUM *dmq1, | ||
| 100 | const BIGNUM *iqmp, BN_CTX *ctx); | ||
| 101 | |||
| 102 | #ifndef OPENSSL_NO_RSA | ||
| 103 | /* RSA stuff */ | ||
| 104 | static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); | ||
| 105 | #endif | ||
| 106 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
| 107 | static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 108 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 109 | |||
| 110 | #ifndef OPENSSL_NO_DSA | ||
| 111 | /* DSA stuff */ | ||
| 112 | static DSA_SIG *cswift_dsa_sign(const unsigned char *dgst, int dlen, DSA *dsa); | ||
| 113 | static int cswift_dsa_verify(const unsigned char *dgst, int dgst_len, | ||
| 114 | DSA_SIG *sig, DSA *dsa); | ||
| 115 | #endif | ||
| 116 | |||
| 117 | #ifndef OPENSSL_NO_DH | ||
| 118 | /* DH stuff */ | ||
| 119 | /* This function is alised to mod_exp (with the DH and mont dropped). */ | ||
| 120 | static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r, | ||
| 121 | const BIGNUM *a, const BIGNUM *p, | ||
| 122 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 123 | #endif | ||
| 124 | |||
| 125 | /* RAND stuff */ | ||
| 126 | static int cswift_rand_bytes(unsigned char *buf, int num); | ||
| 127 | static int cswift_rand_status(void); | ||
| 128 | |||
| 129 | /* The definitions for control commands specific to this engine */ | ||
| 130 | #define CSWIFT_CMD_SO_PATH ENGINE_CMD_BASE | ||
| 131 | static const ENGINE_CMD_DEFN cswift_cmd_defns[] = { | ||
| 132 | {CSWIFT_CMD_SO_PATH, | ||
| 133 | "SO_PATH", | ||
| 134 | "Specifies the path to the 'cswift' shared library", | ||
| 135 | ENGINE_CMD_FLAG_STRING}, | ||
| 136 | {0, NULL, NULL, 0} | ||
| 137 | }; | ||
| 138 | |||
| 139 | #ifndef OPENSSL_NO_RSA | ||
| 140 | /* Our internal RSA_METHOD that we provide pointers to */ | ||
| 141 | static RSA_METHOD cswift_rsa = | ||
| 142 | { | ||
| 143 | "CryptoSwift RSA method", | ||
| 144 | NULL, | ||
| 145 | NULL, | ||
| 146 | NULL, | ||
| 147 | NULL, | ||
| 148 | cswift_rsa_mod_exp, | ||
| 149 | cswift_mod_exp_mont, | ||
| 150 | NULL, | ||
| 151 | NULL, | ||
| 152 | 0, | ||
| 153 | NULL, | ||
| 154 | NULL, | ||
| 155 | NULL | ||
| 156 | }; | ||
| 157 | #endif | ||
| 158 | |||
| 159 | #ifndef OPENSSL_NO_DSA | ||
| 160 | /* Our internal DSA_METHOD that we provide pointers to */ | ||
| 161 | static DSA_METHOD cswift_dsa = | ||
| 162 | { | ||
| 163 | "CryptoSwift DSA method", | ||
| 164 | cswift_dsa_sign, | ||
| 165 | NULL, /* dsa_sign_setup */ | ||
| 166 | cswift_dsa_verify, | ||
| 167 | NULL, /* dsa_mod_exp */ | ||
| 168 | NULL, /* bn_mod_exp */ | ||
| 169 | NULL, /* init */ | ||
| 170 | NULL, /* finish */ | ||
| 171 | 0, /* flags */ | ||
| 172 | NULL /* app_data */ | ||
| 173 | }; | ||
| 174 | #endif | ||
| 175 | |||
| 176 | #ifndef OPENSSL_NO_DH | ||
| 177 | /* Our internal DH_METHOD that we provide pointers to */ | ||
| 178 | static DH_METHOD cswift_dh = | ||
| 179 | { | ||
| 180 | "CryptoSwift DH method", | ||
| 181 | NULL, | ||
| 182 | NULL, | ||
| 183 | cswift_mod_exp_dh, | ||
| 184 | NULL, | ||
| 185 | NULL, | ||
| 186 | 0, | ||
| 187 | NULL | ||
| 188 | }; | ||
| 189 | #endif | ||
| 190 | |||
| 191 | static RAND_METHOD cswift_random = | ||
| 192 | { | ||
| 193 | /* "CryptoSwift RAND method", */ | ||
| 194 | NULL, | ||
| 195 | cswift_rand_bytes, | ||
| 196 | NULL, | ||
| 197 | NULL, | ||
| 198 | cswift_rand_bytes, | ||
| 199 | cswift_rand_status, | ||
| 200 | }; | ||
| 201 | |||
| 202 | |||
| 203 | /* Constants used when creating the ENGINE */ | ||
| 204 | static const char *engine_cswift_id = "cswift"; | ||
| 205 | static const char *engine_cswift_name = "CryptoSwift hardware engine support"; | ||
| 206 | |||
| 207 | /* This internal function is used by ENGINE_cswift() and possibly by the | ||
| 208 | * "dynamic" ENGINE support too */ | ||
| 209 | static int bind_helper(ENGINE *e) | ||
| 210 | { | ||
| 211 | #ifndef OPENSSL_NO_RSA | ||
| 212 | const RSA_METHOD *meth1; | ||
| 213 | #endif | ||
| 214 | #ifndef OPENSSL_NO_DH | ||
| 215 | const DH_METHOD *meth2; | ||
| 216 | #endif | ||
| 217 | if(!ENGINE_set_id(e, engine_cswift_id) || | ||
| 218 | !ENGINE_set_name(e, engine_cswift_name) || | ||
| 219 | #ifndef OPENSSL_NO_RSA | ||
| 220 | !ENGINE_set_RSA(e, &cswift_rsa) || | ||
| 221 | #endif | ||
| 222 | #ifndef OPENSSL_NO_DSA | ||
| 223 | !ENGINE_set_DSA(e, &cswift_dsa) || | ||
| 224 | #endif | ||
| 225 | #ifndef OPENSSL_NO_DH | ||
| 226 | !ENGINE_set_DH(e, &cswift_dh) || | ||
| 227 | #endif | ||
| 228 | !ENGINE_set_RAND(e, &cswift_random) || | ||
| 229 | !ENGINE_set_destroy_function(e, cswift_destroy) || | ||
| 230 | !ENGINE_set_init_function(e, cswift_init) || | ||
| 231 | !ENGINE_set_finish_function(e, cswift_finish) || | ||
| 232 | !ENGINE_set_ctrl_function(e, cswift_ctrl) || | ||
| 233 | !ENGINE_set_cmd_defns(e, cswift_cmd_defns)) | ||
| 234 | return 0; | ||
| 235 | |||
| 236 | #ifndef OPENSSL_NO_RSA | ||
| 237 | /* We know that the "PKCS1_SSLeay()" functions hook properly | ||
| 238 | * to the cswift-specific mod_exp and mod_exp_crt so we use | ||
| 239 | * those functions. NB: We don't use ENGINE_openssl() or | ||
| 240 | * anything "more generic" because something like the RSAref | ||
| 241 | * code may not hook properly, and if you own one of these | ||
| 242 | * cards then you have the right to do RSA operations on it | ||
| 243 | * anyway! */ | ||
| 244 | meth1 = RSA_PKCS1_SSLeay(); | ||
| 245 | cswift_rsa.rsa_pub_enc = meth1->rsa_pub_enc; | ||
| 246 | cswift_rsa.rsa_pub_dec = meth1->rsa_pub_dec; | ||
| 247 | cswift_rsa.rsa_priv_enc = meth1->rsa_priv_enc; | ||
| 248 | cswift_rsa.rsa_priv_dec = meth1->rsa_priv_dec; | ||
| 249 | #endif | ||
| 250 | |||
| 251 | #ifndef OPENSSL_NO_DH | ||
| 252 | /* Much the same for Diffie-Hellman */ | ||
| 253 | meth2 = DH_OpenSSL(); | ||
| 254 | cswift_dh.generate_key = meth2->generate_key; | ||
| 255 | cswift_dh.compute_key = meth2->compute_key; | ||
| 256 | #endif | ||
| 257 | |||
| 258 | /* Ensure the cswift error handling is set up */ | ||
| 259 | ERR_load_CSWIFT_strings(); | ||
| 260 | return 1; | ||
| 261 | } | ||
| 262 | |||
| 263 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 264 | static ENGINE *engine_cswift(void) | ||
| 265 | { | ||
| 266 | ENGINE *ret = ENGINE_new(); | ||
| 267 | if(!ret) | ||
| 268 | return NULL; | ||
| 269 | if(!bind_helper(ret)) | ||
| 270 | { | ||
| 271 | ENGINE_free(ret); | ||
| 272 | return NULL; | ||
| 273 | } | ||
| 274 | return ret; | ||
| 275 | } | ||
| 276 | |||
| 277 | void ENGINE_load_cswift(void) | ||
| 278 | { | ||
| 279 | /* Copied from eng_[openssl|dyn].c */ | ||
| 280 | ENGINE *toadd = engine_cswift(); | ||
| 281 | if(!toadd) return; | ||
| 282 | ENGINE_add(toadd); | ||
| 283 | ENGINE_free(toadd); | ||
| 284 | ERR_clear_error(); | ||
| 285 | } | ||
| 286 | #endif | ||
| 287 | |||
| 288 | /* This is a process-global DSO handle used for loading and unloading | ||
| 289 | * the CryptoSwift library. NB: This is only set (or unset) during an | ||
| 290 | * init() or finish() call (reference counts permitting) and they're | ||
| 291 | * operating with global locks, so this should be thread-safe | ||
| 292 | * implicitly. */ | ||
| 293 | static DSO *cswift_dso = NULL; | ||
| 294 | |||
| 295 | /* These are the function pointers that are (un)set when the library has | ||
| 296 | * successfully (un)loaded. */ | ||
| 297 | t_swAcquireAccContext *p_CSwift_AcquireAccContext = NULL; | ||
| 298 | t_swAttachKeyParam *p_CSwift_AttachKeyParam = NULL; | ||
| 299 | t_swSimpleRequest *p_CSwift_SimpleRequest = NULL; | ||
| 300 | t_swReleaseAccContext *p_CSwift_ReleaseAccContext = NULL; | ||
| 301 | |||
| 302 | /* Used in the DSO operations. */ | ||
| 303 | static const char *CSWIFT_LIBNAME = NULL; | ||
| 304 | static const char *get_CSWIFT_LIBNAME(void) | ||
| 305 | { | ||
| 306 | if(CSWIFT_LIBNAME) | ||
| 307 | return CSWIFT_LIBNAME; | ||
| 308 | return "swift"; | ||
| 309 | } | ||
| 310 | static void free_CSWIFT_LIBNAME(void) | ||
| 311 | { | ||
| 312 | if(CSWIFT_LIBNAME) | ||
| 313 | OPENSSL_free((void*)CSWIFT_LIBNAME); | ||
| 314 | CSWIFT_LIBNAME = NULL; | ||
| 315 | } | ||
| 316 | static long set_CSWIFT_LIBNAME(const char *name) | ||
| 317 | { | ||
| 318 | free_CSWIFT_LIBNAME(); | ||
| 319 | return (((CSWIFT_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0); | ||
| 320 | } | ||
| 321 | static const char *CSWIFT_F1 = "swAcquireAccContext"; | ||
| 322 | static const char *CSWIFT_F2 = "swAttachKeyParam"; | ||
| 323 | static const char *CSWIFT_F3 = "swSimpleRequest"; | ||
| 324 | static const char *CSWIFT_F4 = "swReleaseAccContext"; | ||
| 325 | |||
| 326 | |||
| 327 | /* CryptoSwift library functions and mechanics - these are used by the | ||
| 328 | * higher-level functions further down. NB: As and where there's no | ||
| 329 | * error checking, take a look lower down where these functions are | ||
| 330 | * called, the checking and error handling is probably down there. */ | ||
| 331 | |||
| 332 | /* utility function to obtain a context */ | ||
| 333 | static int get_context(SW_CONTEXT_HANDLE *hac) | ||
| 334 | { | ||
| 335 | SW_STATUS status; | ||
| 336 | |||
| 337 | status = p_CSwift_AcquireAccContext(hac); | ||
| 338 | if(status != SW_OK) | ||
| 339 | return 0; | ||
| 340 | return 1; | ||
| 341 | } | ||
| 342 | |||
| 343 | /* similarly to release one. */ | ||
| 344 | static void release_context(SW_CONTEXT_HANDLE hac) | ||
| 345 | { | ||
| 346 | p_CSwift_ReleaseAccContext(hac); | ||
| 347 | } | ||
| 348 | |||
| 349 | /* Destructor (complements the "ENGINE_cswift()" constructor) */ | ||
| 350 | static int cswift_destroy(ENGINE *e) | ||
| 351 | { | ||
| 352 | free_CSWIFT_LIBNAME(); | ||
| 353 | ERR_unload_CSWIFT_strings(); | ||
| 354 | return 1; | ||
| 355 | } | ||
| 356 | |||
| 357 | /* (de)initialisation functions. */ | ||
| 358 | static int cswift_init(ENGINE *e) | ||
| 359 | { | ||
| 360 | SW_CONTEXT_HANDLE hac; | ||
| 361 | t_swAcquireAccContext *p1; | ||
| 362 | t_swAttachKeyParam *p2; | ||
| 363 | t_swSimpleRequest *p3; | ||
| 364 | t_swReleaseAccContext *p4; | ||
| 365 | |||
| 366 | if(cswift_dso != NULL) | ||
| 367 | { | ||
| 368 | CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_ALREADY_LOADED); | ||
| 369 | goto err; | ||
| 370 | } | ||
| 371 | /* Attempt to load libswift.so/swift.dll/whatever. */ | ||
| 372 | cswift_dso = DSO_load(NULL, get_CSWIFT_LIBNAME(), NULL, 0); | ||
| 373 | if(cswift_dso == NULL) | ||
| 374 | { | ||
| 375 | CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_NOT_LOADED); | ||
| 376 | goto err; | ||
| 377 | } | ||
| 378 | if(!(p1 = (t_swAcquireAccContext *) | ||
| 379 | DSO_bind_func(cswift_dso, CSWIFT_F1)) || | ||
| 380 | !(p2 = (t_swAttachKeyParam *) | ||
| 381 | DSO_bind_func(cswift_dso, CSWIFT_F2)) || | ||
| 382 | !(p3 = (t_swSimpleRequest *) | ||
| 383 | DSO_bind_func(cswift_dso, CSWIFT_F3)) || | ||
| 384 | !(p4 = (t_swReleaseAccContext *) | ||
| 385 | DSO_bind_func(cswift_dso, CSWIFT_F4))) | ||
| 386 | { | ||
| 387 | CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_NOT_LOADED); | ||
| 388 | goto err; | ||
| 389 | } | ||
| 390 | /* Copy the pointers */ | ||
| 391 | p_CSwift_AcquireAccContext = p1; | ||
| 392 | p_CSwift_AttachKeyParam = p2; | ||
| 393 | p_CSwift_SimpleRequest = p3; | ||
| 394 | p_CSwift_ReleaseAccContext = p4; | ||
| 395 | /* Try and get a context - if not, we may have a DSO but no | ||
| 396 | * accelerator! */ | ||
| 397 | if(!get_context(&hac)) | ||
| 398 | { | ||
| 399 | CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_UNIT_FAILURE); | ||
| 400 | goto err; | ||
| 401 | } | ||
| 402 | release_context(hac); | ||
| 403 | /* Everything's fine. */ | ||
| 404 | return 1; | ||
| 405 | err: | ||
| 406 | if(cswift_dso) | ||
| 407 | { | ||
| 408 | DSO_free(cswift_dso); | ||
| 409 | cswift_dso = NULL; | ||
| 410 | } | ||
| 411 | p_CSwift_AcquireAccContext = NULL; | ||
| 412 | p_CSwift_AttachKeyParam = NULL; | ||
| 413 | p_CSwift_SimpleRequest = NULL; | ||
| 414 | p_CSwift_ReleaseAccContext = NULL; | ||
| 415 | return 0; | ||
| 416 | } | ||
| 417 | |||
| 418 | static int cswift_finish(ENGINE *e) | ||
| 419 | { | ||
| 420 | free_CSWIFT_LIBNAME(); | ||
| 421 | if(cswift_dso == NULL) | ||
| 422 | { | ||
| 423 | CSWIFTerr(CSWIFT_F_CSWIFT_FINISH,CSWIFT_R_NOT_LOADED); | ||
| 424 | return 0; | ||
| 425 | } | ||
| 426 | if(!DSO_free(cswift_dso)) | ||
| 427 | { | ||
| 428 | CSWIFTerr(CSWIFT_F_CSWIFT_FINISH,CSWIFT_R_UNIT_FAILURE); | ||
| 429 | return 0; | ||
| 430 | } | ||
| 431 | cswift_dso = NULL; | ||
| 432 | p_CSwift_AcquireAccContext = NULL; | ||
| 433 | p_CSwift_AttachKeyParam = NULL; | ||
| 434 | p_CSwift_SimpleRequest = NULL; | ||
| 435 | p_CSwift_ReleaseAccContext = NULL; | ||
| 436 | return 1; | ||
| 437 | } | ||
| 438 | |||
| 439 | static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | ||
| 440 | { | ||
| 441 | int initialised = ((cswift_dso == NULL) ? 0 : 1); | ||
| 442 | switch(cmd) | ||
| 443 | { | ||
| 444 | case CSWIFT_CMD_SO_PATH: | ||
| 445 | if(p == NULL) | ||
| 446 | { | ||
| 447 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL,ERR_R_PASSED_NULL_PARAMETER); | ||
| 448 | return 0; | ||
| 449 | } | ||
| 450 | if(initialised) | ||
| 451 | { | ||
| 452 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL,CSWIFT_R_ALREADY_LOADED); | ||
| 453 | return 0; | ||
| 454 | } | ||
| 455 | return set_CSWIFT_LIBNAME((const char *)p); | ||
| 456 | default: | ||
| 457 | break; | ||
| 458 | } | ||
| 459 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL,CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED); | ||
| 460 | return 0; | ||
| 461 | } | ||
| 462 | |||
| 463 | /* Un petit mod_exp */ | ||
| 464 | static int cswift_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 465 | const BIGNUM *m, BN_CTX *ctx) | ||
| 466 | { | ||
| 467 | /* I need somewhere to store temporary serialised values for | ||
| 468 | * use with the CryptoSwift API calls. A neat cheat - I'll use | ||
| 469 | * BIGNUMs from the BN_CTX but access their arrays directly as | ||
| 470 | * byte arrays <grin>. This way I don't have to clean anything | ||
| 471 | * up. */ | ||
| 472 | BIGNUM *modulus; | ||
| 473 | BIGNUM *exponent; | ||
| 474 | BIGNUM *argument; | ||
| 475 | BIGNUM *result; | ||
| 476 | SW_STATUS sw_status; | ||
| 477 | SW_LARGENUMBER arg, res; | ||
| 478 | SW_PARAM sw_param; | ||
| 479 | SW_CONTEXT_HANDLE hac; | ||
| 480 | int to_return, acquired; | ||
| 481 | |||
| 482 | modulus = exponent = argument = result = NULL; | ||
| 483 | to_return = 0; /* expect failure */ | ||
| 484 | acquired = 0; | ||
| 485 | |||
| 486 | if(!get_context(&hac)) | ||
| 487 | { | ||
| 488 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_UNIT_FAILURE); | ||
| 489 | goto err; | ||
| 490 | } | ||
| 491 | acquired = 1; | ||
| 492 | /* Prepare the params */ | ||
| 493 | BN_CTX_start(ctx); | ||
| 494 | modulus = BN_CTX_get(ctx); | ||
| 495 | exponent = BN_CTX_get(ctx); | ||
| 496 | argument = BN_CTX_get(ctx); | ||
| 497 | result = BN_CTX_get(ctx); | ||
| 498 | if(!result) | ||
| 499 | { | ||
| 500 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_BN_CTX_FULL); | ||
| 501 | goto err; | ||
| 502 | } | ||
| 503 | if(!bn_wexpand(modulus, m->top) || !bn_wexpand(exponent, p->top) || | ||
| 504 | !bn_wexpand(argument, a->top) || !bn_wexpand(result, m->top)) | ||
| 505 | { | ||
| 506 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_BN_EXPAND_FAIL); | ||
| 507 | goto err; | ||
| 508 | } | ||
| 509 | sw_param.type = SW_ALG_EXP; | ||
| 510 | sw_param.up.exp.modulus.nbytes = BN_bn2bin(m, | ||
| 511 | (unsigned char *)modulus->d); | ||
| 512 | sw_param.up.exp.modulus.value = (unsigned char *)modulus->d; | ||
| 513 | sw_param.up.exp.exponent.nbytes = BN_bn2bin(p, | ||
| 514 | (unsigned char *)exponent->d); | ||
| 515 | sw_param.up.exp.exponent.value = (unsigned char *)exponent->d; | ||
| 516 | /* Attach the key params */ | ||
| 517 | sw_status = p_CSwift_AttachKeyParam(hac, &sw_param); | ||
| 518 | switch(sw_status) | ||
| 519 | { | ||
| 520 | case SW_OK: | ||
| 521 | break; | ||
| 522 | case SW_ERR_INPUT_SIZE: | ||
| 523 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_BAD_KEY_SIZE); | ||
| 524 | goto err; | ||
| 525 | default: | ||
| 526 | { | ||
| 527 | char tmpbuf[DECIMAL_SIZE(sw_status)+1]; | ||
| 528 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_REQUEST_FAILED); | ||
| 529 | sprintf(tmpbuf, "%ld", sw_status); | ||
| 530 | ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf); | ||
| 531 | } | ||
| 532 | goto err; | ||
| 533 | } | ||
| 534 | /* Prepare the argument and response */ | ||
| 535 | arg.nbytes = BN_bn2bin(a, (unsigned char *)argument->d); | ||
| 536 | arg.value = (unsigned char *)argument->d; | ||
| 537 | res.nbytes = BN_num_bytes(m); | ||
| 538 | memset(result->d, 0, res.nbytes); | ||
| 539 | res.value = (unsigned char *)result->d; | ||
| 540 | /* Perform the operation */ | ||
| 541 | if((sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_MODEXP, &arg, 1, | ||
| 542 | &res, 1)) != SW_OK) | ||
| 543 | { | ||
| 544 | char tmpbuf[DECIMAL_SIZE(sw_status)+1]; | ||
| 545 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_REQUEST_FAILED); | ||
| 546 | sprintf(tmpbuf, "%ld", sw_status); | ||
| 547 | ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf); | ||
| 548 | goto err; | ||
| 549 | } | ||
| 550 | /* Convert the response */ | ||
| 551 | BN_bin2bn((unsigned char *)result->d, res.nbytes, r); | ||
| 552 | to_return = 1; | ||
| 553 | err: | ||
| 554 | if(acquired) | ||
| 555 | release_context(hac); | ||
| 556 | BN_CTX_end(ctx); | ||
| 557 | return to_return; | ||
| 558 | } | ||
| 559 | |||
| 560 | |||
| 561 | int cswift_bn_32copy(SW_LARGENUMBER * out, const BIGNUM * in) | ||
| 562 | { | ||
| 563 | int mod; | ||
| 564 | int numbytes = BN_num_bytes(in); | ||
| 565 | |||
| 566 | mod = 0; | ||
| 567 | while( ((out->nbytes = (numbytes+mod)) % 32) ) | ||
| 568 | { | ||
| 569 | mod++; | ||
| 570 | } | ||
| 571 | out->value = (unsigned char*)OPENSSL_malloc(out->nbytes); | ||
| 572 | if(!out->value) | ||
| 573 | { | ||
| 574 | return 0; | ||
| 575 | } | ||
| 576 | BN_bn2bin(in, &out->value[mod]); | ||
| 577 | if(mod) | ||
| 578 | memset(out->value, 0, mod); | ||
| 579 | |||
| 580 | return 1; | ||
| 581 | } | ||
| 582 | |||
| 583 | /* Un petit mod_exp chinois */ | ||
| 584 | static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 585 | const BIGNUM *q, const BIGNUM *dmp1, | ||
| 586 | const BIGNUM *dmq1, const BIGNUM *iqmp, BN_CTX *ctx) | ||
| 587 | { | ||
| 588 | SW_STATUS sw_status; | ||
| 589 | SW_LARGENUMBER arg, res; | ||
| 590 | SW_PARAM sw_param; | ||
| 591 | SW_CONTEXT_HANDLE hac; | ||
| 592 | BIGNUM *result = NULL; | ||
| 593 | BIGNUM *argument = NULL; | ||
| 594 | int to_return = 0; /* expect failure */ | ||
| 595 | int acquired = 0; | ||
| 596 | |||
| 597 | sw_param.up.crt.p.value = NULL; | ||
| 598 | sw_param.up.crt.q.value = NULL; | ||
| 599 | sw_param.up.crt.dmp1.value = NULL; | ||
| 600 | sw_param.up.crt.dmq1.value = NULL; | ||
| 601 | sw_param.up.crt.iqmp.value = NULL; | ||
| 602 | |||
| 603 | if(!get_context(&hac)) | ||
| 604 | { | ||
| 605 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_UNIT_FAILURE); | ||
| 606 | goto err; | ||
| 607 | } | ||
| 608 | acquired = 1; | ||
| 609 | |||
| 610 | /* Prepare the params */ | ||
| 611 | argument = BN_new(); | ||
| 612 | result = BN_new(); | ||
| 613 | if(!result || !argument) | ||
| 614 | { | ||
| 615 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_CTX_FULL); | ||
| 616 | goto err; | ||
| 617 | } | ||
| 618 | |||
| 619 | |||
| 620 | sw_param.type = SW_ALG_CRT; | ||
| 621 | /************************************************************************/ | ||
| 622 | /* 04/02/2003 */ | ||
| 623 | /* Modified by Frederic Giudicelli (deny-all.com) to overcome the */ | ||
| 624 | /* limitation of cswift with values not a multiple of 32 */ | ||
| 625 | /************************************************************************/ | ||
| 626 | if(!cswift_bn_32copy(&sw_param.up.crt.p, p)) | ||
| 627 | { | ||
| 628 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL); | ||
| 629 | goto err; | ||
| 630 | } | ||
| 631 | if(!cswift_bn_32copy(&sw_param.up.crt.q, q)) | ||
| 632 | { | ||
| 633 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL); | ||
| 634 | goto err; | ||
| 635 | } | ||
| 636 | if(!cswift_bn_32copy(&sw_param.up.crt.dmp1, dmp1)) | ||
| 637 | { | ||
| 638 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL); | ||
| 639 | goto err; | ||
| 640 | } | ||
| 641 | if(!cswift_bn_32copy(&sw_param.up.crt.dmq1, dmq1)) | ||
| 642 | { | ||
| 643 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL); | ||
| 644 | goto err; | ||
| 645 | } | ||
| 646 | if(!cswift_bn_32copy(&sw_param.up.crt.iqmp, iqmp)) | ||
| 647 | { | ||
| 648 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL); | ||
| 649 | goto err; | ||
| 650 | } | ||
| 651 | if( !bn_wexpand(argument, a->top) || | ||
| 652 | !bn_wexpand(result, p->top + q->top)) | ||
| 653 | { | ||
| 654 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL); | ||
| 655 | goto err; | ||
| 656 | } | ||
| 657 | |||
| 658 | /* Attach the key params */ | ||
| 659 | sw_status = p_CSwift_AttachKeyParam(hac, &sw_param); | ||
| 660 | switch(sw_status) | ||
| 661 | { | ||
| 662 | case SW_OK: | ||
| 663 | break; | ||
| 664 | case SW_ERR_INPUT_SIZE: | ||
| 665 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BAD_KEY_SIZE); | ||
| 666 | goto err; | ||
| 667 | default: | ||
| 668 | { | ||
| 669 | char tmpbuf[DECIMAL_SIZE(sw_status)+1]; | ||
| 670 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_REQUEST_FAILED); | ||
| 671 | sprintf(tmpbuf, "%ld", sw_status); | ||
| 672 | ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf); | ||
| 673 | } | ||
| 674 | goto err; | ||
| 675 | } | ||
| 676 | /* Prepare the argument and response */ | ||
| 677 | arg.nbytes = BN_bn2bin(a, (unsigned char *)argument->d); | ||
| 678 | arg.value = (unsigned char *)argument->d; | ||
| 679 | res.nbytes = 2 * BN_num_bytes(p); | ||
| 680 | memset(result->d, 0, res.nbytes); | ||
| 681 | res.value = (unsigned char *)result->d; | ||
| 682 | /* Perform the operation */ | ||
| 683 | if((sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_MODEXP_CRT, &arg, 1, | ||
| 684 | &res, 1)) != SW_OK) | ||
| 685 | { | ||
| 686 | char tmpbuf[DECIMAL_SIZE(sw_status)+1]; | ||
| 687 | CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_REQUEST_FAILED); | ||
| 688 | sprintf(tmpbuf, "%ld", sw_status); | ||
| 689 | ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf); | ||
| 690 | goto err; | ||
| 691 | } | ||
| 692 | /* Convert the response */ | ||
| 693 | BN_bin2bn((unsigned char *)result->d, res.nbytes, r); | ||
| 694 | to_return = 1; | ||
| 695 | err: | ||
| 696 | if(sw_param.up.crt.p.value) | ||
| 697 | OPENSSL_free(sw_param.up.crt.p.value); | ||
| 698 | if(sw_param.up.crt.q.value) | ||
| 699 | OPENSSL_free(sw_param.up.crt.q.value); | ||
| 700 | if(sw_param.up.crt.dmp1.value) | ||
| 701 | OPENSSL_free(sw_param.up.crt.dmp1.value); | ||
| 702 | if(sw_param.up.crt.dmq1.value) | ||
| 703 | OPENSSL_free(sw_param.up.crt.dmq1.value); | ||
| 704 | if(sw_param.up.crt.iqmp.value) | ||
| 705 | OPENSSL_free(sw_param.up.crt.iqmp.value); | ||
| 706 | if(result) | ||
| 707 | BN_free(result); | ||
| 708 | if(argument) | ||
| 709 | BN_free(argument); | ||
| 710 | if(acquired) | ||
| 711 | release_context(hac); | ||
| 712 | return to_return; | ||
| 713 | } | ||
| 714 | |||
| 715 | #ifndef OPENSSL_NO_RSA | ||
| 716 | static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | ||
| 717 | { | ||
| 718 | BN_CTX *ctx; | ||
| 719 | int to_return = 0; | ||
| 720 | const RSA_METHOD * def_rsa_method; | ||
| 721 | |||
| 722 | /* Try the limits of RSA (2048 bits) */ | ||
| 723 | if(BN_num_bytes(rsa->p) > 128 || | ||
| 724 | BN_num_bytes(rsa->q) > 128 || | ||
| 725 | BN_num_bytes(rsa->dmp1) > 128 || | ||
| 726 | BN_num_bytes(rsa->dmq1) > 128 || | ||
| 727 | BN_num_bytes(rsa->iqmp) > 128) | ||
| 728 | { | ||
| 729 | #ifdef RSA_NULL | ||
| 730 | def_rsa_method=RSA_null_method(); | ||
| 731 | #else | ||
| 732 | #if 0 | ||
| 733 | def_rsa_method=RSA_PKCS1_RSAref(); | ||
| 734 | #else | ||
| 735 | def_rsa_method=RSA_PKCS1_SSLeay(); | ||
| 736 | #endif | ||
| 737 | #endif | ||
| 738 | if(def_rsa_method) | ||
| 739 | return def_rsa_method->rsa_mod_exp(r0, I, rsa); | ||
| 740 | } | ||
| 741 | |||
| 742 | if((ctx = BN_CTX_new()) == NULL) | ||
| 743 | goto err; | ||
| 744 | if(!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) | ||
| 745 | { | ||
| 746 | CSWIFTerr(CSWIFT_F_CSWIFT_RSA_MOD_EXP,CSWIFT_R_MISSING_KEY_COMPONENTS); | ||
| 747 | goto err; | ||
| 748 | } | ||
| 749 | to_return = cswift_mod_exp_crt(r0, I, rsa->p, rsa->q, rsa->dmp1, | ||
| 750 | rsa->dmq1, rsa->iqmp, ctx); | ||
| 751 | err: | ||
| 752 | if(ctx) | ||
| 753 | BN_CTX_free(ctx); | ||
| 754 | return to_return; | ||
| 755 | } | ||
| 756 | #endif | ||
| 757 | |||
| 758 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
| 759 | static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 760 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 761 | { | ||
| 762 | const RSA_METHOD * def_rsa_method; | ||
| 763 | |||
| 764 | /* Try the limits of RSA (2048 bits) */ | ||
| 765 | if(BN_num_bytes(r) > 256 || | ||
| 766 | BN_num_bytes(a) > 256 || | ||
| 767 | BN_num_bytes(m) > 256) | ||
| 768 | { | ||
| 769 | #ifdef RSA_NULL | ||
| 770 | def_rsa_method=RSA_null_method(); | ||
| 771 | #else | ||
| 772 | #if 0 | ||
| 773 | def_rsa_method=RSA_PKCS1_RSAref(); | ||
| 774 | #else | ||
| 775 | def_rsa_method=RSA_PKCS1_SSLeay(); | ||
| 776 | #endif | ||
| 777 | #endif | ||
| 778 | if(def_rsa_method) | ||
| 779 | return def_rsa_method->bn_mod_exp(r, a, p, m, ctx, m_ctx); | ||
| 780 | } | ||
| 781 | |||
| 782 | return cswift_mod_exp(r, a, p, m, ctx); | ||
| 783 | } | ||
| 784 | |||
| 785 | #ifndef OPENSSL_NO_DSA | ||
| 786 | static DSA_SIG *cswift_dsa_sign(const unsigned char *dgst, int dlen, DSA *dsa) | ||
| 787 | { | ||
| 788 | SW_CONTEXT_HANDLE hac; | ||
| 789 | SW_PARAM sw_param; | ||
| 790 | SW_STATUS sw_status; | ||
| 791 | SW_LARGENUMBER arg, res; | ||
| 792 | unsigned char *ptr; | ||
| 793 | BN_CTX *ctx; | ||
| 794 | BIGNUM *dsa_p = NULL; | ||
| 795 | BIGNUM *dsa_q = NULL; | ||
| 796 | BIGNUM *dsa_g = NULL; | ||
| 797 | BIGNUM *dsa_key = NULL; | ||
| 798 | BIGNUM *result = NULL; | ||
| 799 | DSA_SIG *to_return = NULL; | ||
| 800 | int acquired = 0; | ||
| 801 | |||
| 802 | if((ctx = BN_CTX_new()) == NULL) | ||
| 803 | goto err; | ||
| 804 | if(!get_context(&hac)) | ||
| 805 | { | ||
| 806 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_UNIT_FAILURE); | ||
| 807 | goto err; | ||
| 808 | } | ||
| 809 | acquired = 1; | ||
| 810 | /* Prepare the params */ | ||
| 811 | BN_CTX_start(ctx); | ||
| 812 | dsa_p = BN_CTX_get(ctx); | ||
| 813 | dsa_q = BN_CTX_get(ctx); | ||
| 814 | dsa_g = BN_CTX_get(ctx); | ||
| 815 | dsa_key = BN_CTX_get(ctx); | ||
| 816 | result = BN_CTX_get(ctx); | ||
| 817 | if(!result) | ||
| 818 | { | ||
| 819 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_BN_CTX_FULL); | ||
| 820 | goto err; | ||
| 821 | } | ||
| 822 | if(!bn_wexpand(dsa_p, dsa->p->top) || | ||
| 823 | !bn_wexpand(dsa_q, dsa->q->top) || | ||
| 824 | !bn_wexpand(dsa_g, dsa->g->top) || | ||
| 825 | !bn_wexpand(dsa_key, dsa->priv_key->top) || | ||
| 826 | !bn_wexpand(result, dsa->p->top)) | ||
| 827 | { | ||
| 828 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_BN_EXPAND_FAIL); | ||
| 829 | goto err; | ||
| 830 | } | ||
| 831 | sw_param.type = SW_ALG_DSA; | ||
| 832 | sw_param.up.dsa.p.nbytes = BN_bn2bin(dsa->p, | ||
| 833 | (unsigned char *)dsa_p->d); | ||
| 834 | sw_param.up.dsa.p.value = (unsigned char *)dsa_p->d; | ||
| 835 | sw_param.up.dsa.q.nbytes = BN_bn2bin(dsa->q, | ||
| 836 | (unsigned char *)dsa_q->d); | ||
| 837 | sw_param.up.dsa.q.value = (unsigned char *)dsa_q->d; | ||
| 838 | sw_param.up.dsa.g.nbytes = BN_bn2bin(dsa->g, | ||
| 839 | (unsigned char *)dsa_g->d); | ||
| 840 | sw_param.up.dsa.g.value = (unsigned char *)dsa_g->d; | ||
| 841 | sw_param.up.dsa.key.nbytes = BN_bn2bin(dsa->priv_key, | ||
| 842 | (unsigned char *)dsa_key->d); | ||
| 843 | sw_param.up.dsa.key.value = (unsigned char *)dsa_key->d; | ||
| 844 | /* Attach the key params */ | ||
| 845 | sw_status = p_CSwift_AttachKeyParam(hac, &sw_param); | ||
| 846 | switch(sw_status) | ||
| 847 | { | ||
| 848 | case SW_OK: | ||
| 849 | break; | ||
| 850 | case SW_ERR_INPUT_SIZE: | ||
| 851 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_BAD_KEY_SIZE); | ||
| 852 | goto err; | ||
| 853 | default: | ||
| 854 | { | ||
| 855 | char tmpbuf[DECIMAL_SIZE(sw_status)+1]; | ||
| 856 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_REQUEST_FAILED); | ||
| 857 | sprintf(tmpbuf, "%ld", sw_status); | ||
| 858 | ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf); | ||
| 859 | } | ||
| 860 | goto err; | ||
| 861 | } | ||
| 862 | /* Prepare the argument and response */ | ||
| 863 | arg.nbytes = dlen; | ||
| 864 | arg.value = (unsigned char *)dgst; | ||
| 865 | res.nbytes = BN_num_bytes(dsa->p); | ||
| 866 | memset(result->d, 0, res.nbytes); | ||
| 867 | res.value = (unsigned char *)result->d; | ||
| 868 | /* Perform the operation */ | ||
| 869 | sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_DSS_SIGN, &arg, 1, | ||
| 870 | &res, 1); | ||
| 871 | if(sw_status != SW_OK) | ||
| 872 | { | ||
| 873 | char tmpbuf[DECIMAL_SIZE(sw_status)+1]; | ||
| 874 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_REQUEST_FAILED); | ||
| 875 | sprintf(tmpbuf, "%ld", sw_status); | ||
| 876 | ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf); | ||
| 877 | goto err; | ||
| 878 | } | ||
| 879 | /* Convert the response */ | ||
| 880 | ptr = (unsigned char *)result->d; | ||
| 881 | if((to_return = DSA_SIG_new()) == NULL) | ||
| 882 | goto err; | ||
| 883 | to_return->r = BN_bin2bn((unsigned char *)result->d, 20, NULL); | ||
| 884 | to_return->s = BN_bin2bn((unsigned char *)result->d + 20, 20, NULL); | ||
| 885 | |||
| 886 | err: | ||
| 887 | if(acquired) | ||
| 888 | release_context(hac); | ||
| 889 | if(ctx) | ||
| 890 | { | ||
| 891 | BN_CTX_end(ctx); | ||
| 892 | BN_CTX_free(ctx); | ||
| 893 | } | ||
| 894 | return to_return; | ||
| 895 | } | ||
| 896 | |||
| 897 | static int cswift_dsa_verify(const unsigned char *dgst, int dgst_len, | ||
| 898 | DSA_SIG *sig, DSA *dsa) | ||
| 899 | { | ||
| 900 | SW_CONTEXT_HANDLE hac; | ||
| 901 | SW_PARAM sw_param; | ||
| 902 | SW_STATUS sw_status; | ||
| 903 | SW_LARGENUMBER arg[2], res; | ||
| 904 | unsigned long sig_result; | ||
| 905 | BN_CTX *ctx; | ||
| 906 | BIGNUM *dsa_p = NULL; | ||
| 907 | BIGNUM *dsa_q = NULL; | ||
| 908 | BIGNUM *dsa_g = NULL; | ||
| 909 | BIGNUM *dsa_key = NULL; | ||
| 910 | BIGNUM *argument = NULL; | ||
| 911 | int to_return = -1; | ||
| 912 | int acquired = 0; | ||
| 913 | |||
| 914 | if((ctx = BN_CTX_new()) == NULL) | ||
| 915 | goto err; | ||
| 916 | if(!get_context(&hac)) | ||
| 917 | { | ||
| 918 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_UNIT_FAILURE); | ||
| 919 | goto err; | ||
| 920 | } | ||
| 921 | acquired = 1; | ||
| 922 | /* Prepare the params */ | ||
| 923 | BN_CTX_start(ctx); | ||
| 924 | dsa_p = BN_CTX_get(ctx); | ||
| 925 | dsa_q = BN_CTX_get(ctx); | ||
| 926 | dsa_g = BN_CTX_get(ctx); | ||
| 927 | dsa_key = BN_CTX_get(ctx); | ||
| 928 | argument = BN_CTX_get(ctx); | ||
| 929 | if(!argument) | ||
| 930 | { | ||
| 931 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_BN_CTX_FULL); | ||
| 932 | goto err; | ||
| 933 | } | ||
| 934 | if(!bn_wexpand(dsa_p, dsa->p->top) || | ||
| 935 | !bn_wexpand(dsa_q, dsa->q->top) || | ||
| 936 | !bn_wexpand(dsa_g, dsa->g->top) || | ||
| 937 | !bn_wexpand(dsa_key, dsa->pub_key->top) || | ||
| 938 | !bn_wexpand(argument, 40)) | ||
| 939 | { | ||
| 940 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_BN_EXPAND_FAIL); | ||
| 941 | goto err; | ||
| 942 | } | ||
| 943 | sw_param.type = SW_ALG_DSA; | ||
| 944 | sw_param.up.dsa.p.nbytes = BN_bn2bin(dsa->p, | ||
| 945 | (unsigned char *)dsa_p->d); | ||
| 946 | sw_param.up.dsa.p.value = (unsigned char *)dsa_p->d; | ||
| 947 | sw_param.up.dsa.q.nbytes = BN_bn2bin(dsa->q, | ||
| 948 | (unsigned char *)dsa_q->d); | ||
| 949 | sw_param.up.dsa.q.value = (unsigned char *)dsa_q->d; | ||
| 950 | sw_param.up.dsa.g.nbytes = BN_bn2bin(dsa->g, | ||
| 951 | (unsigned char *)dsa_g->d); | ||
| 952 | sw_param.up.dsa.g.value = (unsigned char *)dsa_g->d; | ||
| 953 | sw_param.up.dsa.key.nbytes = BN_bn2bin(dsa->pub_key, | ||
| 954 | (unsigned char *)dsa_key->d); | ||
| 955 | sw_param.up.dsa.key.value = (unsigned char *)dsa_key->d; | ||
| 956 | /* Attach the key params */ | ||
| 957 | sw_status = p_CSwift_AttachKeyParam(hac, &sw_param); | ||
| 958 | switch(sw_status) | ||
| 959 | { | ||
| 960 | case SW_OK: | ||
| 961 | break; | ||
| 962 | case SW_ERR_INPUT_SIZE: | ||
| 963 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_BAD_KEY_SIZE); | ||
| 964 | goto err; | ||
| 965 | default: | ||
| 966 | { | ||
| 967 | char tmpbuf[DECIMAL_SIZE(sw_status)+1]; | ||
| 968 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_REQUEST_FAILED); | ||
| 969 | sprintf(tmpbuf, "%ld", sw_status); | ||
| 970 | ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf); | ||
| 971 | } | ||
| 972 | goto err; | ||
| 973 | } | ||
| 974 | /* Prepare the argument and response */ | ||
| 975 | arg[0].nbytes = dgst_len; | ||
| 976 | arg[0].value = (unsigned char *)dgst; | ||
| 977 | arg[1].nbytes = 40; | ||
| 978 | arg[1].value = (unsigned char *)argument->d; | ||
| 979 | memset(arg[1].value, 0, 40); | ||
| 980 | BN_bn2bin(sig->r, arg[1].value + 20 - BN_num_bytes(sig->r)); | ||
| 981 | BN_bn2bin(sig->s, arg[1].value + 40 - BN_num_bytes(sig->s)); | ||
| 982 | res.nbytes = 4; /* unsigned long */ | ||
| 983 | res.value = (unsigned char *)(&sig_result); | ||
| 984 | /* Perform the operation */ | ||
| 985 | sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_DSS_VERIFY, arg, 2, | ||
| 986 | &res, 1); | ||
| 987 | if(sw_status != SW_OK) | ||
| 988 | { | ||
| 989 | char tmpbuf[DECIMAL_SIZE(sw_status)+1]; | ||
| 990 | CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_REQUEST_FAILED); | ||
| 991 | sprintf(tmpbuf, "%ld", sw_status); | ||
| 992 | ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf); | ||
| 993 | goto err; | ||
| 994 | } | ||
| 995 | /* Convert the response */ | ||
| 996 | to_return = ((sig_result == 0) ? 0 : 1); | ||
| 997 | |||
| 998 | err: | ||
| 999 | if(acquired) | ||
| 1000 | release_context(hac); | ||
| 1001 | if(ctx) | ||
| 1002 | { | ||
| 1003 | BN_CTX_end(ctx); | ||
| 1004 | BN_CTX_free(ctx); | ||
| 1005 | } | ||
| 1006 | return to_return; | ||
| 1007 | } | ||
| 1008 | #endif | ||
| 1009 | |||
| 1010 | #ifndef OPENSSL_NO_DH | ||
| 1011 | /* This function is aliased to mod_exp (with the dh and mont dropped). */ | ||
| 1012 | static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r, | ||
| 1013 | const BIGNUM *a, const BIGNUM *p, | ||
| 1014 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 1015 | { | ||
| 1016 | return cswift_mod_exp(r, a, p, m, ctx); | ||
| 1017 | } | ||
| 1018 | #endif | ||
| 1019 | |||
| 1020 | /* Random bytes are good */ | ||
| 1021 | static int cswift_rand_bytes(unsigned char *buf, int num) | ||
| 1022 | { | ||
| 1023 | SW_CONTEXT_HANDLE hac; | ||
| 1024 | SW_STATUS swrc; | ||
| 1025 | SW_LARGENUMBER largenum; | ||
| 1026 | int acquired = 0; | ||
| 1027 | int to_return = 0; /* assume failure */ | ||
| 1028 | unsigned char buf32[1024]; | ||
| 1029 | |||
| 1030 | |||
| 1031 | if (!get_context(&hac)) | ||
| 1032 | { | ||
| 1033 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_UNIT_FAILURE); | ||
| 1034 | goto err; | ||
| 1035 | } | ||
| 1036 | acquired = 1; | ||
| 1037 | |||
| 1038 | /************************************************************************/ | ||
| 1039 | /* 04/02/2003 */ | ||
| 1040 | /* Modified by Frederic Giudicelli (deny-all.com) to overcome the */ | ||
| 1041 | /* limitation of cswift with values not a multiple of 32 */ | ||
| 1042 | /************************************************************************/ | ||
| 1043 | |||
| 1044 | while(num >= sizeof(buf32)) | ||
| 1045 | { | ||
| 1046 | largenum.value = buf; | ||
| 1047 | largenum.nbytes = sizeof(buf32); | ||
| 1048 | /* tell CryptoSwift how many bytes we want and where we want it. | ||
| 1049 | * Note: - CryptoSwift cannot do more than 4096 bytes at a time. | ||
| 1050 | * - CryptoSwift can only do multiple of 32-bits. */ | ||
| 1051 | swrc = p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, &largenum, 1); | ||
| 1052 | if (swrc != SW_OK) | ||
| 1053 | { | ||
| 1054 | char tmpbuf[20]; | ||
| 1055 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_REQUEST_FAILED); | ||
| 1056 | sprintf(tmpbuf, "%ld", swrc); | ||
| 1057 | ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf); | ||
| 1058 | goto err; | ||
| 1059 | } | ||
| 1060 | buf += sizeof(buf32); | ||
| 1061 | num -= sizeof(buf32); | ||
| 1062 | } | ||
| 1063 | if(num) | ||
| 1064 | { | ||
| 1065 | largenum.nbytes = sizeof(buf32); | ||
| 1066 | largenum.value = buf32; | ||
| 1067 | swrc = p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, &largenum, 1); | ||
| 1068 | if (swrc != SW_OK) | ||
| 1069 | { | ||
| 1070 | char tmpbuf[20]; | ||
| 1071 | CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_REQUEST_FAILED); | ||
| 1072 | sprintf(tmpbuf, "%ld", swrc); | ||
| 1073 | ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf); | ||
| 1074 | goto err; | ||
| 1075 | } | ||
| 1076 | memcpy(buf, largenum.value, num); | ||
| 1077 | } | ||
| 1078 | |||
| 1079 | to_return = 1; /* success */ | ||
| 1080 | err: | ||
| 1081 | if (acquired) | ||
| 1082 | release_context(hac); | ||
| 1083 | |||
| 1084 | return to_return; | ||
| 1085 | } | ||
| 1086 | |||
| 1087 | static int cswift_rand_status(void) | ||
| 1088 | { | ||
| 1089 | return 1; | ||
| 1090 | } | ||
| 1091 | |||
| 1092 | |||
| 1093 | /* This stuff is needed if this ENGINE is being compiled into a self-contained | ||
| 1094 | * shared-library. */ | ||
| 1095 | #ifdef ENGINE_DYNAMIC_SUPPORT | ||
| 1096 | static int bind_fn(ENGINE *e, const char *id) | ||
| 1097 | { | ||
| 1098 | if(id && (strcmp(id, engine_cswift_id) != 0)) | ||
| 1099 | return 0; | ||
| 1100 | if(!bind_helper(e)) | ||
| 1101 | return 0; | ||
| 1102 | return 1; | ||
| 1103 | } | ||
| 1104 | IMPLEMENT_DYNAMIC_CHECK_FN() | ||
| 1105 | IMPLEMENT_DYNAMIC_BIND_FN(bind_fn) | ||
| 1106 | #endif /* ENGINE_DYNAMIC_SUPPORT */ | ||
| 1107 | |||
| 1108 | #endif /* !OPENSSL_NO_HW_CSWIFT */ | ||
| 1109 | #endif /* !OPENSSL_NO_HW */ | ||
diff --git a/src/lib/libcrypto/engine/hw_cswift_err.c b/src/lib/libcrypto/engine/hw_cswift_err.c deleted file mode 100644 index 684f53bf27..0000000000 --- a/src/lib/libcrypto/engine/hw_cswift_err.c +++ /dev/null | |||
| @@ -1,149 +0,0 @@ | |||
| 1 | /* hw_cswift_err.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 | /* 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 "hw_cswift_err.h" | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | static ERR_STRING_DATA CSWIFT_str_functs[]= | ||
| 68 | { | ||
| 69 | {ERR_PACK(0,CSWIFT_F_CSWIFT_CTRL,0), "CSWIFT_CTRL"}, | ||
| 70 | {ERR_PACK(0,CSWIFT_F_CSWIFT_DSA_SIGN,0), "CSWIFT_DSA_SIGN"}, | ||
| 71 | {ERR_PACK(0,CSWIFT_F_CSWIFT_DSA_VERIFY,0), "CSWIFT_DSA_VERIFY"}, | ||
| 72 | {ERR_PACK(0,CSWIFT_F_CSWIFT_FINISH,0), "CSWIFT_FINISH"}, | ||
| 73 | {ERR_PACK(0,CSWIFT_F_CSWIFT_INIT,0), "CSWIFT_INIT"}, | ||
| 74 | {ERR_PACK(0,CSWIFT_F_CSWIFT_MOD_EXP,0), "CSWIFT_MOD_EXP"}, | ||
| 75 | {ERR_PACK(0,CSWIFT_F_CSWIFT_MOD_EXP_CRT,0), "CSWIFT_MOD_EXP_CRT"}, | ||
| 76 | {ERR_PACK(0,CSWIFT_F_CSWIFT_RSA_MOD_EXP,0), "CSWIFT_RSA_MOD_EXP"}, | ||
| 77 | {0,NULL} | ||
| 78 | }; | ||
| 79 | |||
| 80 | static ERR_STRING_DATA CSWIFT_str_reasons[]= | ||
| 81 | { | ||
| 82 | {CSWIFT_R_ALREADY_LOADED ,"already loaded"}, | ||
| 83 | {CSWIFT_R_BAD_KEY_SIZE ,"bad key size"}, | ||
| 84 | {CSWIFT_R_BN_CTX_FULL ,"bn ctx full"}, | ||
| 85 | {CSWIFT_R_BN_EXPAND_FAIL ,"bn expand fail"}, | ||
| 86 | {CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, | ||
| 87 | {CSWIFT_R_MISSING_KEY_COMPONENTS ,"missing key components"}, | ||
| 88 | {CSWIFT_R_NOT_LOADED ,"not loaded"}, | ||
| 89 | {CSWIFT_R_REQUEST_FAILED ,"request failed"}, | ||
| 90 | {CSWIFT_R_UNIT_FAILURE ,"unit failure"}, | ||
| 91 | {0,NULL} | ||
| 92 | }; | ||
| 93 | |||
| 94 | #endif | ||
| 95 | |||
| 96 | #ifdef CSWIFT_LIB_NAME | ||
| 97 | static ERR_STRING_DATA CSWIFT_lib_name[]= | ||
| 98 | { | ||
| 99 | {0 ,CSWIFT_LIB_NAME}, | ||
| 100 | {0,NULL} | ||
| 101 | }; | ||
| 102 | #endif | ||
| 103 | |||
| 104 | |||
| 105 | static int CSWIFT_lib_error_code=0; | ||
| 106 | static int CSWIFT_error_init=1; | ||
| 107 | |||
| 108 | static void ERR_load_CSWIFT_strings(void) | ||
| 109 | { | ||
| 110 | if (CSWIFT_lib_error_code == 0) | ||
| 111 | CSWIFT_lib_error_code=ERR_get_next_error_library(); | ||
| 112 | |||
| 113 | if (CSWIFT_error_init) | ||
| 114 | { | ||
| 115 | CSWIFT_error_init=0; | ||
| 116 | #ifndef OPENSSL_NO_ERR | ||
| 117 | ERR_load_strings(CSWIFT_lib_error_code,CSWIFT_str_functs); | ||
| 118 | ERR_load_strings(CSWIFT_lib_error_code,CSWIFT_str_reasons); | ||
| 119 | #endif | ||
| 120 | |||
| 121 | #ifdef CSWIFT_LIB_NAME | ||
| 122 | CSWIFT_lib_name->error = ERR_PACK(CSWIFT_lib_error_code,0,0); | ||
| 123 | ERR_load_strings(0,CSWIFT_lib_name); | ||
| 124 | #endif | ||
| 125 | } | ||
| 126 | } | ||
| 127 | |||
| 128 | static void ERR_unload_CSWIFT_strings(void) | ||
| 129 | { | ||
| 130 | if (CSWIFT_error_init == 0) | ||
| 131 | { | ||
| 132 | #ifndef OPENSSL_NO_ERR | ||
| 133 | ERR_unload_strings(CSWIFT_lib_error_code,CSWIFT_str_functs); | ||
| 134 | ERR_unload_strings(CSWIFT_lib_error_code,CSWIFT_str_reasons); | ||
| 135 | #endif | ||
| 136 | |||
| 137 | #ifdef CSWIFT_LIB_NAME | ||
| 138 | ERR_unload_strings(0,CSWIFT_lib_name); | ||
| 139 | #endif | ||
| 140 | CSWIFT_error_init=1; | ||
| 141 | } | ||
| 142 | } | ||
| 143 | |||
| 144 | static void ERR_CSWIFT_error(int function, int reason, char *file, int line) | ||
| 145 | { | ||
| 146 | if (CSWIFT_lib_error_code == 0) | ||
| 147 | CSWIFT_lib_error_code=ERR_get_next_error_library(); | ||
| 148 | ERR_PUT_error(CSWIFT_lib_error_code,function,reason,file,line); | ||
| 149 | } | ||
diff --git a/src/lib/libcrypto/engine/hw_cswift_err.h b/src/lib/libcrypto/engine/hw_cswift_err.h deleted file mode 100644 index 7120c3216f..0000000000 --- a/src/lib/libcrypto/engine/hw_cswift_err.h +++ /dev/null | |||
| @@ -1,93 +0,0 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2001 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_CSWIFT_ERR_H | ||
| 56 | #define HEADER_CSWIFT_ERR_H | ||
| 57 | |||
| 58 | /* BEGIN ERROR CODES */ | ||
| 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 60 | * made after this point may be overwritten when the script is next run. | ||
| 61 | */ | ||
| 62 | static void ERR_load_CSWIFT_strings(void); | ||
| 63 | static void ERR_unload_CSWIFT_strings(void); | ||
| 64 | static void ERR_CSWIFT_error(int function, int reason, char *file, int line); | ||
| 65 | #define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),__FILE__,__LINE__) | ||
| 66 | |||
| 67 | /* Error codes for the CSWIFT functions. */ | ||
| 68 | |||
| 69 | /* Function codes. */ | ||
| 70 | #define CSWIFT_F_CSWIFT_CTRL 100 | ||
| 71 | #define CSWIFT_F_CSWIFT_DSA_SIGN 101 | ||
| 72 | #define CSWIFT_F_CSWIFT_DSA_VERIFY 102 | ||
| 73 | #define CSWIFT_F_CSWIFT_FINISH 103 | ||
| 74 | #define CSWIFT_F_CSWIFT_INIT 104 | ||
| 75 | #define CSWIFT_F_CSWIFT_MOD_EXP 105 | ||
| 76 | #define CSWIFT_F_CSWIFT_MOD_EXP_CRT 106 | ||
| 77 | #define CSWIFT_F_CSWIFT_RSA_MOD_EXP 107 | ||
| 78 | |||
| 79 | /* Reason codes. */ | ||
| 80 | #define CSWIFT_R_ALREADY_LOADED 100 | ||
| 81 | #define CSWIFT_R_BAD_KEY_SIZE 101 | ||
| 82 | #define CSWIFT_R_BN_CTX_FULL 102 | ||
| 83 | #define CSWIFT_R_BN_EXPAND_FAIL 103 | ||
| 84 | #define CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED 104 | ||
| 85 | #define CSWIFT_R_MISSING_KEY_COMPONENTS 105 | ||
| 86 | #define CSWIFT_R_NOT_LOADED 106 | ||
| 87 | #define CSWIFT_R_REQUEST_FAILED 107 | ||
| 88 | #define CSWIFT_R_UNIT_FAILURE 108 | ||
| 89 | |||
| 90 | #ifdef __cplusplus | ||
| 91 | } | ||
| 92 | #endif | ||
| 93 | #endif | ||
diff --git a/src/lib/libcrypto/engine/hw_ncipher.c b/src/lib/libcrypto/engine/hw_ncipher.c deleted file mode 100644 index 0d1c6b8df0..0000000000 --- a/src/lib/libcrypto/engine/hw_ncipher.c +++ /dev/null | |||
| @@ -1,1388 +0,0 @@ | |||
| 1 | /* crypto/engine/hw_ncipher.c -*- mode: C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org), Geoff Thorpe | ||
| 3 | * (geoff@geoffthorpe.net) and Dr Stephen N Henson (shenson@bigfoot.com) | ||
| 4 | * for the OpenSSL project 2000. | ||
| 5 | */ | ||
| 6 | /* ==================================================================== | ||
| 7 | * Copyright (c) 1999-2001 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 | * licensing@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 <stdio.h> | ||
| 61 | #include <string.h> | ||
| 62 | #include "cryptlib.h" | ||
| 63 | #include <openssl/crypto.h> | ||
| 64 | #include <openssl/pem.h> | ||
| 65 | #include <openssl/dso.h> | ||
| 66 | #include <openssl/engine.h> | ||
| 67 | #include <openssl/ui.h> | ||
| 68 | |||
| 69 | #ifndef OPENSSL_NO_HW | ||
| 70 | #ifndef OPENSSL_NO_HW_NCIPHER | ||
| 71 | |||
| 72 | /* Attribution notice: nCipher have said several times that it's OK for | ||
| 73 | * us to implement a general interface to their boxes, and recently declared | ||
| 74 | * their HWCryptoHook to be public, and therefore available for us to use. | ||
| 75 | * Thanks, nCipher. | ||
| 76 | * | ||
| 77 | * The hwcryptohook.h included here is from May 2000. | ||
| 78 | * [Richard Levitte] | ||
| 79 | */ | ||
| 80 | #ifdef FLAT_INC | ||
| 81 | #include "hwcryptohook.h" | ||
| 82 | #else | ||
| 83 | #include "vendor_defns/hwcryptohook.h" | ||
| 84 | #endif | ||
| 85 | |||
| 86 | #define HWCRHK_LIB_NAME "hwcrhk engine" | ||
| 87 | #include "hw_ncipher_err.c" | ||
| 88 | |||
| 89 | static int hwcrhk_destroy(ENGINE *e); | ||
| 90 | static int hwcrhk_init(ENGINE *e); | ||
| 91 | static int hwcrhk_finish(ENGINE *e); | ||
| 92 | static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | ||
| 93 | |||
| 94 | /* Functions to handle mutexes if have dynamic locks */ | ||
| 95 | static int hwcrhk_mutex_init(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext*); | ||
| 96 | static int hwcrhk_mutex_lock(HWCryptoHook_Mutex*); | ||
| 97 | static void hwcrhk_mutex_unlock(HWCryptoHook_Mutex*); | ||
| 98 | static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex*); | ||
| 99 | #if 1 /* This is a HACK which will disappear in 0.9.8 */ | ||
| 100 | /* Functions to handle mutexes if only have static locks */ | ||
| 101 | static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m, | ||
| 102 | HWCryptoHook_CallerContext *c); | ||
| 103 | static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m); | ||
| 104 | static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m); | ||
| 105 | static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m); | ||
| 106 | #endif | ||
| 107 | |||
| 108 | /* BIGNUM stuff */ | ||
| 109 | static int hwcrhk_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 110 | const BIGNUM *m, BN_CTX *ctx); | ||
| 111 | |||
| 112 | #ifndef OPENSSL_NO_RSA | ||
| 113 | /* RSA stuff */ | ||
| 114 | static int hwcrhk_rsa_mod_exp(BIGNUM *r, const BIGNUM *I, RSA *rsa); | ||
| 115 | #endif | ||
| 116 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
| 117 | static int hwcrhk_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 118 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 119 | |||
| 120 | #ifndef OPENSSL_NO_DH | ||
| 121 | /* DH stuff */ | ||
| 122 | /* This function is alised to mod_exp (with the DH and mont dropped). */ | ||
| 123 | static int hwcrhk_mod_exp_dh(const DH *dh, BIGNUM *r, | ||
| 124 | const BIGNUM *a, const BIGNUM *p, | ||
| 125 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 126 | #endif | ||
| 127 | |||
| 128 | /* RAND stuff */ | ||
| 129 | static int hwcrhk_rand_bytes(unsigned char *buf, int num); | ||
| 130 | static int hwcrhk_rand_status(void); | ||
| 131 | |||
| 132 | /* KM stuff */ | ||
| 133 | static EVP_PKEY *hwcrhk_load_privkey(ENGINE *eng, const char *key_id, | ||
| 134 | UI_METHOD *ui_method, void *callback_data); | ||
| 135 | static EVP_PKEY *hwcrhk_load_pubkey(ENGINE *eng, const char *key_id, | ||
| 136 | UI_METHOD *ui_method, void *callback_data); | ||
| 137 | static void hwcrhk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
| 138 | int ind,long argl, void *argp); | ||
| 139 | |||
| 140 | /* Interaction stuff */ | ||
| 141 | static int hwcrhk_insert_card(const char *prompt_info, | ||
| 142 | const char *wrong_info, | ||
| 143 | HWCryptoHook_PassphraseContext *ppctx, | ||
| 144 | HWCryptoHook_CallerContext *cactx); | ||
| 145 | static int hwcrhk_get_pass(const char *prompt_info, | ||
| 146 | int *len_io, char *buf, | ||
| 147 | HWCryptoHook_PassphraseContext *ppctx, | ||
| 148 | HWCryptoHook_CallerContext *cactx); | ||
| 149 | static void hwcrhk_log_message(void *logstr, const char *message); | ||
| 150 | |||
| 151 | /* The definitions for control commands specific to this engine */ | ||
| 152 | #define HWCRHK_CMD_SO_PATH ENGINE_CMD_BASE | ||
| 153 | #define HWCRHK_CMD_FORK_CHECK (ENGINE_CMD_BASE + 1) | ||
| 154 | #define HWCRHK_CMD_THREAD_LOCKING (ENGINE_CMD_BASE + 2) | ||
| 155 | #define HWCRHK_CMD_SET_USER_INTERFACE (ENGINE_CMD_BASE + 3) | ||
| 156 | #define HWCRHK_CMD_SET_CALLBACK_DATA (ENGINE_CMD_BASE + 4) | ||
| 157 | static const ENGINE_CMD_DEFN hwcrhk_cmd_defns[] = { | ||
| 158 | {HWCRHK_CMD_SO_PATH, | ||
| 159 | "SO_PATH", | ||
| 160 | "Specifies the path to the 'hwcrhk' shared library", | ||
| 161 | ENGINE_CMD_FLAG_STRING}, | ||
| 162 | {HWCRHK_CMD_FORK_CHECK, | ||
| 163 | "FORK_CHECK", | ||
| 164 | "Turns fork() checking on or off (boolean)", | ||
| 165 | ENGINE_CMD_FLAG_NUMERIC}, | ||
| 166 | {HWCRHK_CMD_THREAD_LOCKING, | ||
| 167 | "THREAD_LOCKING", | ||
| 168 | "Turns thread-safe locking on or off (boolean)", | ||
| 169 | ENGINE_CMD_FLAG_NUMERIC}, | ||
| 170 | {HWCRHK_CMD_SET_USER_INTERFACE, | ||
| 171 | "SET_USER_INTERFACE", | ||
| 172 | "Set the global user interface (internal)", | ||
| 173 | ENGINE_CMD_FLAG_INTERNAL}, | ||
| 174 | {HWCRHK_CMD_SET_CALLBACK_DATA, | ||
| 175 | "SET_CALLBACK_DATA", | ||
| 176 | "Set the global user interface extra data (internal)", | ||
| 177 | ENGINE_CMD_FLAG_INTERNAL}, | ||
| 178 | {0, NULL, NULL, 0} | ||
| 179 | }; | ||
| 180 | |||
| 181 | #ifndef OPENSSL_NO_RSA | ||
| 182 | /* Our internal RSA_METHOD that we provide pointers to */ | ||
| 183 | static RSA_METHOD hwcrhk_rsa = | ||
| 184 | { | ||
| 185 | "nCipher RSA method", | ||
| 186 | NULL, | ||
| 187 | NULL, | ||
| 188 | NULL, | ||
| 189 | NULL, | ||
| 190 | hwcrhk_rsa_mod_exp, | ||
| 191 | hwcrhk_mod_exp_mont, | ||
| 192 | NULL, | ||
| 193 | NULL, | ||
| 194 | 0, | ||
| 195 | NULL, | ||
| 196 | NULL, | ||
| 197 | NULL | ||
| 198 | }; | ||
| 199 | #endif | ||
| 200 | |||
| 201 | #ifndef OPENSSL_NO_DH | ||
| 202 | /* Our internal DH_METHOD that we provide pointers to */ | ||
| 203 | static DH_METHOD hwcrhk_dh = | ||
| 204 | { | ||
| 205 | "nCipher DH method", | ||
| 206 | NULL, | ||
| 207 | NULL, | ||
| 208 | hwcrhk_mod_exp_dh, | ||
| 209 | NULL, | ||
| 210 | NULL, | ||
| 211 | 0, | ||
| 212 | NULL | ||
| 213 | }; | ||
| 214 | #endif | ||
| 215 | |||
| 216 | static RAND_METHOD hwcrhk_rand = | ||
| 217 | { | ||
| 218 | /* "nCipher RAND method", */ | ||
| 219 | NULL, | ||
| 220 | hwcrhk_rand_bytes, | ||
| 221 | NULL, | ||
| 222 | NULL, | ||
| 223 | hwcrhk_rand_bytes, | ||
| 224 | hwcrhk_rand_status, | ||
| 225 | }; | ||
| 226 | |||
| 227 | /* Constants used when creating the ENGINE */ | ||
| 228 | static const char *engine_hwcrhk_id = "chil"; | ||
| 229 | static const char *engine_hwcrhk_name = "nCipher hardware engine support"; | ||
| 230 | |||
| 231 | /* Internal stuff for HWCryptoHook */ | ||
| 232 | |||
| 233 | /* Some structures needed for proper use of thread locks */ | ||
| 234 | /* hwcryptohook.h has some typedefs that turn struct HWCryptoHook_MutexValue | ||
| 235 | into HWCryptoHook_Mutex */ | ||
| 236 | struct HWCryptoHook_MutexValue | ||
| 237 | { | ||
| 238 | int lockid; | ||
| 239 | }; | ||
| 240 | |||
| 241 | /* hwcryptohook.h has some typedefs that turn | ||
| 242 | struct HWCryptoHook_PassphraseContextValue | ||
| 243 | into HWCryptoHook_PassphraseContext */ | ||
| 244 | struct HWCryptoHook_PassphraseContextValue | ||
| 245 | { | ||
| 246 | UI_METHOD *ui_method; | ||
| 247 | void *callback_data; | ||
| 248 | }; | ||
| 249 | |||
| 250 | /* hwcryptohook.h has some typedefs that turn | ||
| 251 | struct HWCryptoHook_CallerContextValue | ||
| 252 | into HWCryptoHook_CallerContext */ | ||
| 253 | struct HWCryptoHook_CallerContextValue | ||
| 254 | { | ||
| 255 | pem_password_cb *password_callback; /* Deprecated! Only present for | ||
| 256 | backward compatibility! */ | ||
| 257 | UI_METHOD *ui_method; | ||
| 258 | void *callback_data; | ||
| 259 | }; | ||
| 260 | |||
| 261 | /* The MPI structure in HWCryptoHook is pretty compatible with OpenSSL | ||
| 262 | BIGNUM's, so lets define a couple of conversion macros */ | ||
| 263 | #define BN2MPI(mp, bn) \ | ||
| 264 | {mp.size = bn->top * sizeof(BN_ULONG); mp.buf = (unsigned char *)bn->d;} | ||
| 265 | #define MPI2BN(bn, mp) \ | ||
| 266 | {mp.size = bn->dmax * sizeof(BN_ULONG); mp.buf = (unsigned char *)bn->d;} | ||
| 267 | |||
| 268 | static BIO *logstream = NULL; | ||
| 269 | static int disable_mutex_callbacks = 0; | ||
| 270 | |||
| 271 | /* One might wonder why these are needed, since one can pass down at least | ||
| 272 | a UI_METHOD and a pointer to callback data to the key-loading functions. | ||
| 273 | The thing is that the ModExp and RSAImmed functions can load keys as well, | ||
| 274 | if the data they get is in a special, nCipher-defined format (hint: if you | ||
| 275 | look at the private exponent of the RSA data as a string, you'll see this | ||
| 276 | string: "nCipher KM tool key id", followed by some bytes, followed a key | ||
| 277 | identity string, followed by more bytes. This happens when you use "embed" | ||
| 278 | keys instead of "hwcrhk" keys). Unfortunately, those functions do not take | ||
| 279 | any passphrase or caller context, and our functions can't really take any | ||
| 280 | callback data either. Still, the "insert_card" and "get_passphrase" | ||
| 281 | callbacks may be called down the line, and will need to know what user | ||
| 282 | interface callbacks to call, and having callback data from the application | ||
| 283 | may be a nice thing as well, so we need to keep track of that globally. */ | ||
| 284 | static HWCryptoHook_CallerContext password_context = { NULL, NULL, NULL }; | ||
| 285 | |||
| 286 | /* Stuff to pass to the HWCryptoHook library */ | ||
| 287 | static HWCryptoHook_InitInfo hwcrhk_globals = { | ||
| 288 | HWCryptoHook_InitFlags_SimpleForkCheck, /* Flags */ | ||
| 289 | &logstream, /* logstream */ | ||
| 290 | sizeof(BN_ULONG), /* limbsize */ | ||
| 291 | 0, /* mslimb first: false for BNs */ | ||
| 292 | -1, /* msbyte first: use native */ | ||
| 293 | 0, /* Max mutexes, 0 = no small limit */ | ||
| 294 | 0, /* Max simultaneous, 0 = default */ | ||
| 295 | |||
| 296 | /* The next few are mutex stuff: we write wrapper functions | ||
| 297 | around the OS mutex functions. We initialise them to 0 | ||
| 298 | here, and change that to actual function pointers in hwcrhk_init() | ||
| 299 | if dynamic locks are supported (that is, if the application | ||
| 300 | programmer has made sure of setting up callbacks bafore starting | ||
| 301 | this engine) *and* if disable_mutex_callbacks hasn't been set by | ||
| 302 | a call to ENGINE_ctrl(ENGINE_CTRL_CHIL_NO_LOCKING). */ | ||
| 303 | sizeof(HWCryptoHook_Mutex), | ||
| 304 | 0, | ||
| 305 | 0, | ||
| 306 | 0, | ||
| 307 | 0, | ||
| 308 | |||
| 309 | /* The next few are condvar stuff: we write wrapper functions | ||
| 310 | round the OS functions. Currently not implemented and not | ||
| 311 | and absolute necessity even in threaded programs, therefore | ||
| 312 | 0'ed. Will hopefully be implemented some day, since it | ||
| 313 | enhances the efficiency of HWCryptoHook. */ | ||
| 314 | 0, /* sizeof(HWCryptoHook_CondVar), */ | ||
| 315 | 0, /* hwcrhk_cv_init, */ | ||
| 316 | 0, /* hwcrhk_cv_wait, */ | ||
| 317 | 0, /* hwcrhk_cv_signal, */ | ||
| 318 | 0, /* hwcrhk_cv_broadcast, */ | ||
| 319 | 0, /* hwcrhk_cv_destroy, */ | ||
| 320 | |||
| 321 | hwcrhk_get_pass, /* pass phrase */ | ||
| 322 | hwcrhk_insert_card, /* insert a card */ | ||
| 323 | hwcrhk_log_message /* Log message */ | ||
| 324 | }; | ||
| 325 | |||
| 326 | |||
| 327 | /* Now, to our own code */ | ||
| 328 | |||
| 329 | /* This internal function is used by ENGINE_ncipher() and possibly by the | ||
| 330 | * "dynamic" ENGINE support too */ | ||
| 331 | static int bind_helper(ENGINE *e) | ||
| 332 | { | ||
| 333 | #ifndef OPENSSL_NO_RSA | ||
| 334 | const RSA_METHOD *meth1; | ||
| 335 | #endif | ||
| 336 | #ifndef OPENSSL_NO_DH | ||
| 337 | const DH_METHOD *meth2; | ||
| 338 | #endif | ||
| 339 | if(!ENGINE_set_id(e, engine_hwcrhk_id) || | ||
| 340 | !ENGINE_set_name(e, engine_hwcrhk_name) || | ||
| 341 | #ifndef OPENSSL_NO_RSA | ||
| 342 | !ENGINE_set_RSA(e, &hwcrhk_rsa) || | ||
| 343 | #endif | ||
| 344 | #ifndef OPENSSL_NO_DH | ||
| 345 | !ENGINE_set_DH(e, &hwcrhk_dh) || | ||
| 346 | #endif | ||
| 347 | !ENGINE_set_RAND(e, &hwcrhk_rand) || | ||
| 348 | !ENGINE_set_destroy_function(e, hwcrhk_destroy) || | ||
| 349 | !ENGINE_set_init_function(e, hwcrhk_init) || | ||
| 350 | !ENGINE_set_finish_function(e, hwcrhk_finish) || | ||
| 351 | !ENGINE_set_ctrl_function(e, hwcrhk_ctrl) || | ||
| 352 | !ENGINE_set_load_privkey_function(e, hwcrhk_load_privkey) || | ||
| 353 | !ENGINE_set_load_pubkey_function(e, hwcrhk_load_pubkey) || | ||
| 354 | !ENGINE_set_cmd_defns(e, hwcrhk_cmd_defns)) | ||
| 355 | return 0; | ||
| 356 | |||
| 357 | #ifndef OPENSSL_NO_RSA | ||
| 358 | /* We know that the "PKCS1_SSLeay()" functions hook properly | ||
| 359 | * to the cswift-specific mod_exp and mod_exp_crt so we use | ||
| 360 | * those functions. NB: We don't use ENGINE_openssl() or | ||
| 361 | * anything "more generic" because something like the RSAref | ||
| 362 | * code may not hook properly, and if you own one of these | ||
| 363 | * cards then you have the right to do RSA operations on it | ||
| 364 | * anyway! */ | ||
| 365 | meth1 = RSA_PKCS1_SSLeay(); | ||
| 366 | hwcrhk_rsa.rsa_pub_enc = meth1->rsa_pub_enc; | ||
| 367 | hwcrhk_rsa.rsa_pub_dec = meth1->rsa_pub_dec; | ||
| 368 | hwcrhk_rsa.rsa_priv_enc = meth1->rsa_priv_enc; | ||
| 369 | hwcrhk_rsa.rsa_priv_dec = meth1->rsa_priv_dec; | ||
| 370 | #endif | ||
| 371 | |||
| 372 | #ifndef OPENSSL_NO_DH | ||
| 373 | /* Much the same for Diffie-Hellman */ | ||
| 374 | meth2 = DH_OpenSSL(); | ||
| 375 | hwcrhk_dh.generate_key = meth2->generate_key; | ||
| 376 | hwcrhk_dh.compute_key = meth2->compute_key; | ||
| 377 | #endif | ||
| 378 | |||
| 379 | /* Ensure the hwcrhk error handling is set up */ | ||
| 380 | ERR_load_HWCRHK_strings(); | ||
| 381 | return 1; | ||
| 382 | } | ||
| 383 | |||
| 384 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 385 | static ENGINE *engine_ncipher(void) | ||
| 386 | { | ||
| 387 | ENGINE *ret = ENGINE_new(); | ||
| 388 | if(!ret) | ||
| 389 | return NULL; | ||
| 390 | if(!bind_helper(ret)) | ||
| 391 | { | ||
| 392 | ENGINE_free(ret); | ||
| 393 | return NULL; | ||
| 394 | } | ||
| 395 | return ret; | ||
| 396 | } | ||
| 397 | |||
| 398 | void ENGINE_load_chil(void) | ||
| 399 | { | ||
| 400 | /* Copied from eng_[openssl|dyn].c */ | ||
| 401 | ENGINE *toadd = engine_ncipher(); | ||
| 402 | if(!toadd) return; | ||
| 403 | ENGINE_add(toadd); | ||
| 404 | ENGINE_free(toadd); | ||
| 405 | ERR_clear_error(); | ||
| 406 | } | ||
| 407 | #endif | ||
| 408 | |||
| 409 | /* This is a process-global DSO handle used for loading and unloading | ||
| 410 | * the HWCryptoHook library. NB: This is only set (or unset) during an | ||
| 411 | * init() or finish() call (reference counts permitting) and they're | ||
| 412 | * operating with global locks, so this should be thread-safe | ||
| 413 | * implicitly. */ | ||
| 414 | static DSO *hwcrhk_dso = NULL; | ||
| 415 | static HWCryptoHook_ContextHandle hwcrhk_context = 0; | ||
| 416 | #ifndef OPENSSL_NO_RSA | ||
| 417 | static int hndidx_rsa = -1; /* Index for KM handle. Not really used yet. */ | ||
| 418 | #endif | ||
| 419 | |||
| 420 | /* These are the function pointers that are (un)set when the library has | ||
| 421 | * successfully (un)loaded. */ | ||
| 422 | static HWCryptoHook_Init_t *p_hwcrhk_Init = NULL; | ||
| 423 | static HWCryptoHook_Finish_t *p_hwcrhk_Finish = NULL; | ||
| 424 | static HWCryptoHook_ModExp_t *p_hwcrhk_ModExp = NULL; | ||
| 425 | #ifndef OPENSSL_NO_RSA | ||
| 426 | static HWCryptoHook_RSA_t *p_hwcrhk_RSA = NULL; | ||
| 427 | #endif | ||
| 428 | static HWCryptoHook_RandomBytes_t *p_hwcrhk_RandomBytes = NULL; | ||
| 429 | #ifndef OPENSSL_NO_RSA | ||
| 430 | static HWCryptoHook_RSALoadKey_t *p_hwcrhk_RSALoadKey = NULL; | ||
| 431 | static HWCryptoHook_RSAGetPublicKey_t *p_hwcrhk_RSAGetPublicKey = NULL; | ||
| 432 | static HWCryptoHook_RSAUnloadKey_t *p_hwcrhk_RSAUnloadKey = NULL; | ||
| 433 | #endif | ||
| 434 | static HWCryptoHook_ModExpCRT_t *p_hwcrhk_ModExpCRT = NULL; | ||
| 435 | |||
| 436 | /* Used in the DSO operations. */ | ||
| 437 | static const char *HWCRHK_LIBNAME = NULL; | ||
| 438 | static void free_HWCRHK_LIBNAME(void) | ||
| 439 | { | ||
| 440 | if(HWCRHK_LIBNAME) | ||
| 441 | OPENSSL_free((void*)HWCRHK_LIBNAME); | ||
| 442 | HWCRHK_LIBNAME = NULL; | ||
| 443 | } | ||
| 444 | static const char *get_HWCRHK_LIBNAME(void) | ||
| 445 | { | ||
| 446 | if(HWCRHK_LIBNAME) | ||
| 447 | return HWCRHK_LIBNAME; | ||
| 448 | return "nfhwcrhk"; | ||
| 449 | } | ||
| 450 | static long set_HWCRHK_LIBNAME(const char *name) | ||
| 451 | { | ||
| 452 | free_HWCRHK_LIBNAME(); | ||
| 453 | return (((HWCRHK_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0); | ||
| 454 | } | ||
| 455 | static const char *n_hwcrhk_Init = "HWCryptoHook_Init"; | ||
| 456 | static const char *n_hwcrhk_Finish = "HWCryptoHook_Finish"; | ||
| 457 | static const char *n_hwcrhk_ModExp = "HWCryptoHook_ModExp"; | ||
| 458 | #ifndef OPENSSL_NO_RSA | ||
| 459 | static const char *n_hwcrhk_RSA = "HWCryptoHook_RSA"; | ||
| 460 | #endif | ||
| 461 | static const char *n_hwcrhk_RandomBytes = "HWCryptoHook_RandomBytes"; | ||
| 462 | #ifndef OPENSSL_NO_RSA | ||
| 463 | static const char *n_hwcrhk_RSALoadKey = "HWCryptoHook_RSALoadKey"; | ||
| 464 | static const char *n_hwcrhk_RSAGetPublicKey = "HWCryptoHook_RSAGetPublicKey"; | ||
| 465 | static const char *n_hwcrhk_RSAUnloadKey = "HWCryptoHook_RSAUnloadKey"; | ||
| 466 | #endif | ||
| 467 | static const char *n_hwcrhk_ModExpCRT = "HWCryptoHook_ModExpCRT"; | ||
| 468 | |||
| 469 | /* HWCryptoHook library functions and mechanics - these are used by the | ||
| 470 | * higher-level functions further down. NB: As and where there's no | ||
| 471 | * error checking, take a look lower down where these functions are | ||
| 472 | * called, the checking and error handling is probably down there. */ | ||
| 473 | |||
| 474 | /* utility function to obtain a context */ | ||
| 475 | static int get_context(HWCryptoHook_ContextHandle *hac, | ||
| 476 | HWCryptoHook_CallerContext *cac) | ||
| 477 | { | ||
| 478 | char tempbuf[1024]; | ||
| 479 | HWCryptoHook_ErrMsgBuf rmsg; | ||
| 480 | |||
| 481 | rmsg.buf = tempbuf; | ||
| 482 | rmsg.size = sizeof(tempbuf); | ||
| 483 | |||
| 484 | *hac = p_hwcrhk_Init(&hwcrhk_globals, sizeof(hwcrhk_globals), &rmsg, | ||
| 485 | cac); | ||
| 486 | if (!*hac) | ||
| 487 | return 0; | ||
| 488 | return 1; | ||
| 489 | } | ||
| 490 | |||
| 491 | /* similarly to release one. */ | ||
| 492 | static void release_context(HWCryptoHook_ContextHandle hac) | ||
| 493 | { | ||
| 494 | p_hwcrhk_Finish(hac); | ||
| 495 | } | ||
| 496 | |||
| 497 | /* Destructor (complements the "ENGINE_ncipher()" constructor) */ | ||
| 498 | static int hwcrhk_destroy(ENGINE *e) | ||
| 499 | { | ||
| 500 | free_HWCRHK_LIBNAME(); | ||
| 501 | ERR_unload_HWCRHK_strings(); | ||
| 502 | return 1; | ||
| 503 | } | ||
| 504 | |||
| 505 | /* (de)initialisation functions. */ | ||
| 506 | static int hwcrhk_init(ENGINE *e) | ||
| 507 | { | ||
| 508 | HWCryptoHook_Init_t *p1; | ||
| 509 | HWCryptoHook_Finish_t *p2; | ||
| 510 | HWCryptoHook_ModExp_t *p3; | ||
| 511 | #ifndef OPENSSL_NO_RSA | ||
| 512 | HWCryptoHook_RSA_t *p4; | ||
| 513 | HWCryptoHook_RSALoadKey_t *p5; | ||
| 514 | HWCryptoHook_RSAGetPublicKey_t *p6; | ||
| 515 | HWCryptoHook_RSAUnloadKey_t *p7; | ||
| 516 | #endif | ||
| 517 | HWCryptoHook_RandomBytes_t *p8; | ||
| 518 | HWCryptoHook_ModExpCRT_t *p9; | ||
| 519 | |||
| 520 | if(hwcrhk_dso != NULL) | ||
| 521 | { | ||
| 522 | HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_ALREADY_LOADED); | ||
| 523 | goto err; | ||
| 524 | } | ||
| 525 | /* Attempt to load libnfhwcrhk.so/nfhwcrhk.dll/whatever. */ | ||
| 526 | hwcrhk_dso = DSO_load(NULL, get_HWCRHK_LIBNAME(), NULL, 0); | ||
| 527 | if(hwcrhk_dso == NULL) | ||
| 528 | { | ||
| 529 | HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_DSO_FAILURE); | ||
| 530 | goto err; | ||
| 531 | } | ||
| 532 | if(!(p1 = (HWCryptoHook_Init_t *) | ||
| 533 | DSO_bind_func(hwcrhk_dso, n_hwcrhk_Init)) || | ||
| 534 | !(p2 = (HWCryptoHook_Finish_t *) | ||
| 535 | DSO_bind_func(hwcrhk_dso, n_hwcrhk_Finish)) || | ||
| 536 | !(p3 = (HWCryptoHook_ModExp_t *) | ||
| 537 | DSO_bind_func(hwcrhk_dso, n_hwcrhk_ModExp)) || | ||
| 538 | #ifndef OPENSSL_NO_RSA | ||
| 539 | !(p4 = (HWCryptoHook_RSA_t *) | ||
| 540 | DSO_bind_func(hwcrhk_dso, n_hwcrhk_RSA)) || | ||
| 541 | !(p5 = (HWCryptoHook_RSALoadKey_t *) | ||
| 542 | DSO_bind_func(hwcrhk_dso, n_hwcrhk_RSALoadKey)) || | ||
| 543 | !(p6 = (HWCryptoHook_RSAGetPublicKey_t *) | ||
| 544 | DSO_bind_func(hwcrhk_dso, n_hwcrhk_RSAGetPublicKey)) || | ||
| 545 | !(p7 = (HWCryptoHook_RSAUnloadKey_t *) | ||
| 546 | DSO_bind_func(hwcrhk_dso, n_hwcrhk_RSAUnloadKey)) || | ||
| 547 | #endif | ||
| 548 | !(p8 = (HWCryptoHook_RandomBytes_t *) | ||
| 549 | DSO_bind_func(hwcrhk_dso, n_hwcrhk_RandomBytes)) || | ||
| 550 | !(p9 = (HWCryptoHook_ModExpCRT_t *) | ||
| 551 | DSO_bind_func(hwcrhk_dso, n_hwcrhk_ModExpCRT))) | ||
| 552 | { | ||
| 553 | HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_DSO_FAILURE); | ||
| 554 | goto err; | ||
| 555 | } | ||
| 556 | /* Copy the pointers */ | ||
| 557 | p_hwcrhk_Init = p1; | ||
| 558 | p_hwcrhk_Finish = p2; | ||
| 559 | p_hwcrhk_ModExp = p3; | ||
| 560 | #ifndef OPENSSL_NO_RSA | ||
| 561 | p_hwcrhk_RSA = p4; | ||
| 562 | p_hwcrhk_RSALoadKey = p5; | ||
| 563 | p_hwcrhk_RSAGetPublicKey = p6; | ||
| 564 | p_hwcrhk_RSAUnloadKey = p7; | ||
| 565 | #endif | ||
| 566 | p_hwcrhk_RandomBytes = p8; | ||
| 567 | p_hwcrhk_ModExpCRT = p9; | ||
| 568 | |||
| 569 | /* Check if the application decided to support dynamic locks, | ||
| 570 | and if it does, use them. */ | ||
| 571 | if (disable_mutex_callbacks == 0) | ||
| 572 | { | ||
| 573 | if (CRYPTO_get_dynlock_create_callback() != NULL && | ||
| 574 | CRYPTO_get_dynlock_lock_callback() != NULL && | ||
| 575 | CRYPTO_get_dynlock_destroy_callback() != NULL) | ||
| 576 | { | ||
| 577 | hwcrhk_globals.mutex_init = hwcrhk_mutex_init; | ||
| 578 | hwcrhk_globals.mutex_acquire = hwcrhk_mutex_lock; | ||
| 579 | hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock; | ||
| 580 | hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy; | ||
| 581 | } | ||
| 582 | else if (CRYPTO_get_locking_callback() != NULL) | ||
| 583 | { | ||
| 584 | HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_DYNAMIC_LOCKING_MISSING); | ||
| 585 | ERR_add_error_data(1,"You HAVE to add dynamic locking callbacks via CRYPTO_set_dynlock_{create,lock,destroy}_callback()"); | ||
| 586 | #if 1 /* This is a HACK which will disappear in 0.9.8 */ | ||
| 587 | hwcrhk_globals.maxmutexes = 1; /* Only have one lock */ | ||
| 588 | hwcrhk_globals.mutex_init = hwcrhk_static_mutex_init; | ||
| 589 | hwcrhk_globals.mutex_acquire = hwcrhk_static_mutex_lock; | ||
| 590 | hwcrhk_globals.mutex_release = hwcrhk_static_mutex_unlock; | ||
| 591 | hwcrhk_globals.mutex_destroy = hwcrhk_static_mutex_destroy; | ||
| 592 | #else | ||
| 593 | goto err; | ||
| 594 | #endif | ||
| 595 | } | ||
| 596 | } | ||
| 597 | |||
| 598 | /* Try and get a context - if not, we may have a DSO but no | ||
| 599 | * accelerator! */ | ||
| 600 | if(!get_context(&hwcrhk_context, &password_context)) | ||
| 601 | { | ||
| 602 | HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_UNIT_FAILURE); | ||
| 603 | goto err; | ||
| 604 | } | ||
| 605 | /* Everything's fine. */ | ||
| 606 | #ifndef OPENSSL_NO_RSA | ||
| 607 | if (hndidx_rsa == -1) | ||
| 608 | hndidx_rsa = RSA_get_ex_new_index(0, | ||
| 609 | "nFast HWCryptoHook RSA key handle", | ||
| 610 | NULL, NULL, hwcrhk_ex_free); | ||
| 611 | #endif | ||
| 612 | return 1; | ||
| 613 | err: | ||
| 614 | if(hwcrhk_dso) | ||
| 615 | DSO_free(hwcrhk_dso); | ||
| 616 | hwcrhk_dso = NULL; | ||
| 617 | p_hwcrhk_Init = NULL; | ||
| 618 | p_hwcrhk_Finish = NULL; | ||
| 619 | p_hwcrhk_ModExp = NULL; | ||
| 620 | #ifndef OPENSSL_NO_RSA | ||
| 621 | p_hwcrhk_RSA = NULL; | ||
| 622 | p_hwcrhk_RSALoadKey = NULL; | ||
| 623 | p_hwcrhk_RSAGetPublicKey = NULL; | ||
| 624 | p_hwcrhk_RSAUnloadKey = NULL; | ||
| 625 | #endif | ||
| 626 | p_hwcrhk_ModExpCRT = NULL; | ||
| 627 | p_hwcrhk_RandomBytes = NULL; | ||
| 628 | return 0; | ||
| 629 | } | ||
| 630 | |||
| 631 | static int hwcrhk_finish(ENGINE *e) | ||
| 632 | { | ||
| 633 | int to_return = 1; | ||
| 634 | free_HWCRHK_LIBNAME(); | ||
| 635 | if(hwcrhk_dso == NULL) | ||
| 636 | { | ||
| 637 | HWCRHKerr(HWCRHK_F_HWCRHK_FINISH,HWCRHK_R_NOT_LOADED); | ||
| 638 | to_return = 0; | ||
| 639 | goto err; | ||
| 640 | } | ||
| 641 | release_context(hwcrhk_context); | ||
| 642 | if(!DSO_free(hwcrhk_dso)) | ||
| 643 | { | ||
| 644 | HWCRHKerr(HWCRHK_F_HWCRHK_FINISH,HWCRHK_R_DSO_FAILURE); | ||
| 645 | to_return = 0; | ||
| 646 | goto err; | ||
| 647 | } | ||
| 648 | err: | ||
| 649 | if (logstream) | ||
| 650 | BIO_free(logstream); | ||
| 651 | hwcrhk_dso = NULL; | ||
| 652 | p_hwcrhk_Init = NULL; | ||
| 653 | p_hwcrhk_Finish = NULL; | ||
| 654 | p_hwcrhk_ModExp = NULL; | ||
| 655 | #ifndef OPENSSL_NO_RSA | ||
| 656 | p_hwcrhk_RSA = NULL; | ||
| 657 | p_hwcrhk_RSALoadKey = NULL; | ||
| 658 | p_hwcrhk_RSAGetPublicKey = NULL; | ||
| 659 | p_hwcrhk_RSAUnloadKey = NULL; | ||
| 660 | #endif | ||
| 661 | p_hwcrhk_ModExpCRT = NULL; | ||
| 662 | p_hwcrhk_RandomBytes = NULL; | ||
| 663 | return to_return; | ||
| 664 | } | ||
| 665 | |||
| 666 | static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | ||
| 667 | { | ||
| 668 | int to_return = 1; | ||
| 669 | |||
| 670 | switch(cmd) | ||
| 671 | { | ||
| 672 | case HWCRHK_CMD_SO_PATH: | ||
| 673 | if(hwcrhk_dso) | ||
| 674 | { | ||
| 675 | HWCRHKerr(HWCRHK_F_HWCRHK_CTRL,HWCRHK_R_ALREADY_LOADED); | ||
| 676 | return 0; | ||
| 677 | } | ||
| 678 | if(p == NULL) | ||
| 679 | { | ||
| 680 | HWCRHKerr(HWCRHK_F_HWCRHK_CTRL,ERR_R_PASSED_NULL_PARAMETER); | ||
| 681 | return 0; | ||
| 682 | } | ||
| 683 | return set_HWCRHK_LIBNAME((const char *)p); | ||
| 684 | case ENGINE_CTRL_SET_LOGSTREAM: | ||
| 685 | { | ||
| 686 | BIO *bio = (BIO *)p; | ||
| 687 | |||
| 688 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 689 | if (logstream) | ||
| 690 | { | ||
| 691 | BIO_free(logstream); | ||
| 692 | logstream = NULL; | ||
| 693 | } | ||
| 694 | if (CRYPTO_add(&bio->references,1,CRYPTO_LOCK_BIO) > 1) | ||
| 695 | logstream = bio; | ||
| 696 | else | ||
| 697 | HWCRHKerr(HWCRHK_F_HWCRHK_CTRL,HWCRHK_R_BIO_WAS_FREED); | ||
| 698 | } | ||
| 699 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 700 | break; | ||
| 701 | case ENGINE_CTRL_SET_PASSWORD_CALLBACK: | ||
| 702 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 703 | password_context.password_callback = (pem_password_cb *)f; | ||
| 704 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 705 | break; | ||
| 706 | case ENGINE_CTRL_SET_USER_INTERFACE: | ||
| 707 | case HWCRHK_CMD_SET_USER_INTERFACE: | ||
| 708 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 709 | password_context.ui_method = (UI_METHOD *)p; | ||
| 710 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 711 | break; | ||
| 712 | case ENGINE_CTRL_SET_CALLBACK_DATA: | ||
| 713 | case HWCRHK_CMD_SET_CALLBACK_DATA: | ||
| 714 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 715 | password_context.callback_data = p; | ||
| 716 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 717 | break; | ||
| 718 | /* this enables or disables the "SimpleForkCheck" flag used in the | ||
| 719 | * initialisation structure. */ | ||
| 720 | case ENGINE_CTRL_CHIL_SET_FORKCHECK: | ||
| 721 | case HWCRHK_CMD_FORK_CHECK: | ||
| 722 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 723 | if(i) | ||
| 724 | hwcrhk_globals.flags |= | ||
| 725 | HWCryptoHook_InitFlags_SimpleForkCheck; | ||
| 726 | else | ||
| 727 | hwcrhk_globals.flags &= | ||
| 728 | ~HWCryptoHook_InitFlags_SimpleForkCheck; | ||
| 729 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 730 | break; | ||
| 731 | /* This will prevent the initialisation function from "installing" | ||
| 732 | * the mutex-handling callbacks, even if they are available from | ||
| 733 | * within the library (or were provided to the library from the | ||
| 734 | * calling application). This is to remove any baggage for | ||
| 735 | * applications not using multithreading. */ | ||
| 736 | case ENGINE_CTRL_CHIL_NO_LOCKING: | ||
| 737 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 738 | disable_mutex_callbacks = 1; | ||
| 739 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 740 | break; | ||
| 741 | case HWCRHK_CMD_THREAD_LOCKING: | ||
| 742 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 743 | disable_mutex_callbacks = ((i == 0) ? 0 : 1); | ||
| 744 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 745 | break; | ||
| 746 | |||
| 747 | /* The command isn't understood by this engine */ | ||
| 748 | default: | ||
| 749 | HWCRHKerr(HWCRHK_F_HWCRHK_CTRL, | ||
| 750 | HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED); | ||
| 751 | to_return = 0; | ||
| 752 | break; | ||
| 753 | } | ||
| 754 | |||
| 755 | return to_return; | ||
| 756 | } | ||
| 757 | |||
| 758 | static EVP_PKEY *hwcrhk_load_privkey(ENGINE *eng, const char *key_id, | ||
| 759 | UI_METHOD *ui_method, void *callback_data) | ||
| 760 | { | ||
| 761 | #ifndef OPENSSL_NO_RSA | ||
| 762 | RSA *rtmp = NULL; | ||
| 763 | #endif | ||
| 764 | EVP_PKEY *res = NULL; | ||
| 765 | #ifndef OPENSSL_NO_RSA | ||
| 766 | HWCryptoHook_MPI e, n; | ||
| 767 | HWCryptoHook_RSAKeyHandle *hptr; | ||
| 768 | #endif | ||
| 769 | #if !defined(OPENSSL_NO_RSA) | ||
| 770 | char tempbuf[1024]; | ||
| 771 | HWCryptoHook_ErrMsgBuf rmsg; | ||
| 772 | #endif | ||
| 773 | HWCryptoHook_PassphraseContext ppctx; | ||
| 774 | |||
| 775 | #if !defined(OPENSSL_NO_RSA) | ||
| 776 | rmsg.buf = tempbuf; | ||
| 777 | rmsg.size = sizeof(tempbuf); | ||
| 778 | #endif | ||
| 779 | |||
| 780 | if(!hwcrhk_context) | ||
| 781 | { | ||
| 782 | HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY, | ||
| 783 | HWCRHK_R_NOT_INITIALISED); | ||
| 784 | goto err; | ||
| 785 | } | ||
| 786 | #ifndef OPENSSL_NO_RSA | ||
| 787 | hptr = OPENSSL_malloc(sizeof(HWCryptoHook_RSAKeyHandle)); | ||
| 788 | if (!hptr) | ||
| 789 | { | ||
| 790 | HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY, | ||
| 791 | ERR_R_MALLOC_FAILURE); | ||
| 792 | goto err; | ||
| 793 | } | ||
| 794 | ppctx.ui_method = ui_method; | ||
| 795 | ppctx.callback_data = callback_data; | ||
| 796 | if (p_hwcrhk_RSALoadKey(hwcrhk_context, key_id, hptr, | ||
| 797 | &rmsg, &ppctx)) | ||
| 798 | { | ||
| 799 | HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY, | ||
| 800 | HWCRHK_R_CHIL_ERROR); | ||
| 801 | ERR_add_error_data(1,rmsg.buf); | ||
| 802 | goto err; | ||
| 803 | } | ||
| 804 | if (!*hptr) | ||
| 805 | { | ||
| 806 | HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY, | ||
| 807 | HWCRHK_R_NO_KEY); | ||
| 808 | goto err; | ||
| 809 | } | ||
| 810 | #endif | ||
| 811 | #ifndef OPENSSL_NO_RSA | ||
| 812 | rtmp = RSA_new_method(eng); | ||
| 813 | RSA_set_ex_data(rtmp, hndidx_rsa, (char *)hptr); | ||
| 814 | rtmp->e = BN_new(); | ||
| 815 | rtmp->n = BN_new(); | ||
| 816 | rtmp->flags |= RSA_FLAG_EXT_PKEY; | ||
| 817 | MPI2BN(rtmp->e, e); | ||
| 818 | MPI2BN(rtmp->n, n); | ||
| 819 | if (p_hwcrhk_RSAGetPublicKey(*hptr, &n, &e, &rmsg) | ||
| 820 | != HWCRYPTOHOOK_ERROR_MPISIZE) | ||
| 821 | { | ||
| 822 | HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PUBKEY,HWCRHK_R_CHIL_ERROR); | ||
| 823 | ERR_add_error_data(1,rmsg.buf); | ||
| 824 | goto err; | ||
| 825 | } | ||
| 826 | |||
| 827 | bn_expand2(rtmp->e, e.size/sizeof(BN_ULONG)); | ||
| 828 | bn_expand2(rtmp->n, n.size/sizeof(BN_ULONG)); | ||
| 829 | MPI2BN(rtmp->e, e); | ||
| 830 | MPI2BN(rtmp->n, n); | ||
| 831 | |||
| 832 | if (p_hwcrhk_RSAGetPublicKey(*hptr, &n, &e, &rmsg)) | ||
| 833 | { | ||
| 834 | HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PUBKEY, | ||
| 835 | HWCRHK_R_CHIL_ERROR); | ||
| 836 | ERR_add_error_data(1,rmsg.buf); | ||
| 837 | goto err; | ||
| 838 | } | ||
| 839 | rtmp->e->top = e.size / sizeof(BN_ULONG); | ||
| 840 | bn_fix_top(rtmp->e); | ||
| 841 | rtmp->n->top = n.size / sizeof(BN_ULONG); | ||
| 842 | bn_fix_top(rtmp->n); | ||
| 843 | |||
| 844 | res = EVP_PKEY_new(); | ||
| 845 | EVP_PKEY_assign_RSA(res, rtmp); | ||
| 846 | #endif | ||
| 847 | |||
| 848 | if (!res) | ||
| 849 | HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PUBKEY, | ||
| 850 | HWCRHK_R_PRIVATE_KEY_ALGORITHMS_DISABLED); | ||
| 851 | |||
| 852 | return res; | ||
| 853 | err: | ||
| 854 | if (res) | ||
| 855 | EVP_PKEY_free(res); | ||
| 856 | #ifndef OPENSSL_NO_RSA | ||
| 857 | if (rtmp) | ||
| 858 | RSA_free(rtmp); | ||
| 859 | #endif | ||
| 860 | return NULL; | ||
| 861 | } | ||
| 862 | |||
| 863 | static EVP_PKEY *hwcrhk_load_pubkey(ENGINE *eng, const char *key_id, | ||
| 864 | UI_METHOD *ui_method, void *callback_data) | ||
| 865 | { | ||
| 866 | EVP_PKEY *res = NULL; | ||
| 867 | |||
| 868 | #ifndef OPENSSL_NO_RSA | ||
| 869 | res = hwcrhk_load_privkey(eng, key_id, | ||
| 870 | ui_method, callback_data); | ||
| 871 | #endif | ||
| 872 | |||
| 873 | if (res) | ||
| 874 | switch(res->type) | ||
| 875 | { | ||
| 876 | #ifndef OPENSSL_NO_RSA | ||
| 877 | case EVP_PKEY_RSA: | ||
| 878 | { | ||
| 879 | RSA *rsa = NULL; | ||
| 880 | |||
| 881 | CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY); | ||
| 882 | rsa = res->pkey.rsa; | ||
| 883 | res->pkey.rsa = RSA_new(); | ||
| 884 | res->pkey.rsa->n = rsa->n; | ||
| 885 | res->pkey.rsa->e = rsa->e; | ||
| 886 | rsa->n = NULL; | ||
| 887 | rsa->e = NULL; | ||
| 888 | CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY); | ||
| 889 | RSA_free(rsa); | ||
| 890 | } | ||
| 891 | break; | ||
| 892 | #endif | ||
| 893 | default: | ||
| 894 | HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PUBKEY, | ||
| 895 | HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED); | ||
| 896 | goto err; | ||
| 897 | } | ||
| 898 | |||
| 899 | return res; | ||
| 900 | err: | ||
| 901 | if (res) | ||
| 902 | EVP_PKEY_free(res); | ||
| 903 | return NULL; | ||
| 904 | } | ||
| 905 | |||
| 906 | /* A little mod_exp */ | ||
| 907 | static int hwcrhk_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 908 | const BIGNUM *m, BN_CTX *ctx) | ||
| 909 | { | ||
| 910 | char tempbuf[1024]; | ||
| 911 | HWCryptoHook_ErrMsgBuf rmsg; | ||
| 912 | /* Since HWCryptoHook_MPI is pretty compatible with BIGNUM's, | ||
| 913 | we use them directly, plus a little macro magic. We only | ||
| 914 | thing we need to make sure of is that enough space is allocated. */ | ||
| 915 | HWCryptoHook_MPI m_a, m_p, m_n, m_r; | ||
| 916 | int to_return, ret; | ||
| 917 | |||
| 918 | to_return = 0; /* expect failure */ | ||
| 919 | rmsg.buf = tempbuf; | ||
| 920 | rmsg.size = sizeof(tempbuf); | ||
| 921 | |||
| 922 | if(!hwcrhk_context) | ||
| 923 | { | ||
| 924 | HWCRHKerr(HWCRHK_F_HWCRHK_MOD_EXP,HWCRHK_R_NOT_INITIALISED); | ||
| 925 | goto err; | ||
| 926 | } | ||
| 927 | /* Prepare the params */ | ||
| 928 | bn_expand2(r, m->top); /* Check for error !! */ | ||
| 929 | BN2MPI(m_a, a); | ||
| 930 | BN2MPI(m_p, p); | ||
| 931 | BN2MPI(m_n, m); | ||
| 932 | MPI2BN(r, m_r); | ||
| 933 | |||
| 934 | /* Perform the operation */ | ||
| 935 | ret = p_hwcrhk_ModExp(hwcrhk_context, m_a, m_p, m_n, &m_r, &rmsg); | ||
| 936 | |||
| 937 | /* Convert the response */ | ||
| 938 | r->top = m_r.size / sizeof(BN_ULONG); | ||
| 939 | bn_fix_top(r); | ||
| 940 | |||
| 941 | if (ret < 0) | ||
| 942 | { | ||
| 943 | /* FIXME: When this error is returned, HWCryptoHook is | ||
| 944 | telling us that falling back to software computation | ||
| 945 | might be a good thing. */ | ||
| 946 | if(ret == HWCRYPTOHOOK_ERROR_FALLBACK) | ||
| 947 | { | ||
| 948 | HWCRHKerr(HWCRHK_F_HWCRHK_MOD_EXP,HWCRHK_R_REQUEST_FALLBACK); | ||
| 949 | } | ||
| 950 | else | ||
| 951 | { | ||
| 952 | HWCRHKerr(HWCRHK_F_HWCRHK_MOD_EXP,HWCRHK_R_REQUEST_FAILED); | ||
| 953 | } | ||
| 954 | ERR_add_error_data(1,rmsg.buf); | ||
| 955 | goto err; | ||
| 956 | } | ||
| 957 | |||
| 958 | to_return = 1; | ||
| 959 | err: | ||
| 960 | return to_return; | ||
| 961 | } | ||
| 962 | |||
| 963 | #ifndef OPENSSL_NO_RSA | ||
| 964 | static int hwcrhk_rsa_mod_exp(BIGNUM *r, const BIGNUM *I, RSA *rsa) | ||
| 965 | { | ||
| 966 | char tempbuf[1024]; | ||
| 967 | HWCryptoHook_ErrMsgBuf rmsg; | ||
| 968 | HWCryptoHook_RSAKeyHandle *hptr; | ||
| 969 | int to_return = 0, ret; | ||
| 970 | |||
| 971 | rmsg.buf = tempbuf; | ||
| 972 | rmsg.size = sizeof(tempbuf); | ||
| 973 | |||
| 974 | if(!hwcrhk_context) | ||
| 975 | { | ||
| 976 | HWCRHKerr(HWCRHK_F_HWCRHK_MOD_EXP,HWCRHK_R_NOT_INITIALISED); | ||
| 977 | goto err; | ||
| 978 | } | ||
| 979 | |||
| 980 | /* This provides support for nForce keys. Since that's opaque data | ||
| 981 | all we do is provide a handle to the proper key and let HWCryptoHook | ||
| 982 | take care of the rest. */ | ||
| 983 | if ((hptr = (HWCryptoHook_RSAKeyHandle *) RSA_get_ex_data(rsa, hndidx_rsa)) | ||
| 984 | != NULL) | ||
| 985 | { | ||
| 986 | HWCryptoHook_MPI m_a, m_r; | ||
| 987 | |||
| 988 | if(!rsa->n) | ||
| 989 | { | ||
| 990 | HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP, | ||
| 991 | HWCRHK_R_MISSING_KEY_COMPONENTS); | ||
| 992 | goto err; | ||
| 993 | } | ||
| 994 | |||
| 995 | /* Prepare the params */ | ||
| 996 | bn_expand2(r, rsa->n->top); /* Check for error !! */ | ||
| 997 | BN2MPI(m_a, I); | ||
| 998 | MPI2BN(r, m_r); | ||
| 999 | |||
| 1000 | /* Perform the operation */ | ||
| 1001 | ret = p_hwcrhk_RSA(m_a, *hptr, &m_r, &rmsg); | ||
| 1002 | |||
| 1003 | /* Convert the response */ | ||
| 1004 | r->top = m_r.size / sizeof(BN_ULONG); | ||
| 1005 | bn_fix_top(r); | ||
| 1006 | |||
| 1007 | if (ret < 0) | ||
| 1008 | { | ||
| 1009 | /* FIXME: When this error is returned, HWCryptoHook is | ||
| 1010 | telling us that falling back to software computation | ||
| 1011 | might be a good thing. */ | ||
| 1012 | if(ret == HWCRYPTOHOOK_ERROR_FALLBACK) | ||
| 1013 | { | ||
| 1014 | HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP, | ||
| 1015 | HWCRHK_R_REQUEST_FALLBACK); | ||
| 1016 | } | ||
| 1017 | else | ||
| 1018 | { | ||
| 1019 | HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP, | ||
| 1020 | HWCRHK_R_REQUEST_FAILED); | ||
| 1021 | } | ||
| 1022 | ERR_add_error_data(1,rmsg.buf); | ||
| 1023 | goto err; | ||
| 1024 | } | ||
| 1025 | } | ||
| 1026 | else | ||
| 1027 | { | ||
| 1028 | HWCryptoHook_MPI m_a, m_p, m_q, m_dmp1, m_dmq1, m_iqmp, m_r; | ||
| 1029 | |||
| 1030 | if(!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) | ||
| 1031 | { | ||
| 1032 | HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP, | ||
| 1033 | HWCRHK_R_MISSING_KEY_COMPONENTS); | ||
| 1034 | goto err; | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | /* Prepare the params */ | ||
| 1038 | bn_expand2(r, rsa->n->top); /* Check for error !! */ | ||
| 1039 | BN2MPI(m_a, I); | ||
| 1040 | BN2MPI(m_p, rsa->p); | ||
| 1041 | BN2MPI(m_q, rsa->q); | ||
| 1042 | BN2MPI(m_dmp1, rsa->dmp1); | ||
| 1043 | BN2MPI(m_dmq1, rsa->dmq1); | ||
| 1044 | BN2MPI(m_iqmp, rsa->iqmp); | ||
| 1045 | MPI2BN(r, m_r); | ||
| 1046 | |||
| 1047 | /* Perform the operation */ | ||
| 1048 | ret = p_hwcrhk_ModExpCRT(hwcrhk_context, m_a, m_p, m_q, | ||
| 1049 | m_dmp1, m_dmq1, m_iqmp, &m_r, &rmsg); | ||
| 1050 | |||
| 1051 | /* Convert the response */ | ||
| 1052 | r->top = m_r.size / sizeof(BN_ULONG); | ||
| 1053 | bn_fix_top(r); | ||
| 1054 | |||
| 1055 | if (ret < 0) | ||
| 1056 | { | ||
| 1057 | /* FIXME: When this error is returned, HWCryptoHook is | ||
| 1058 | telling us that falling back to software computation | ||
| 1059 | might be a good thing. */ | ||
| 1060 | if(ret == HWCRYPTOHOOK_ERROR_FALLBACK) | ||
| 1061 | { | ||
| 1062 | HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP, | ||
| 1063 | HWCRHK_R_REQUEST_FALLBACK); | ||
| 1064 | } | ||
| 1065 | else | ||
| 1066 | { | ||
| 1067 | HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP, | ||
| 1068 | HWCRHK_R_REQUEST_FAILED); | ||
| 1069 | } | ||
| 1070 | ERR_add_error_data(1,rmsg.buf); | ||
| 1071 | goto err; | ||
| 1072 | } | ||
| 1073 | } | ||
| 1074 | /* If we're here, we must be here with some semblance of success :-) */ | ||
| 1075 | to_return = 1; | ||
| 1076 | err: | ||
| 1077 | return to_return; | ||
| 1078 | } | ||
| 1079 | #endif | ||
| 1080 | |||
| 1081 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
| 1082 | static int hwcrhk_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 1083 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 1084 | { | ||
| 1085 | return hwcrhk_mod_exp(r, a, p, m, ctx); | ||
| 1086 | } | ||
| 1087 | |||
| 1088 | #ifndef OPENSSL_NO_DH | ||
| 1089 | /* This function is aliased to mod_exp (with the dh and mont dropped). */ | ||
| 1090 | static int hwcrhk_mod_exp_dh(const DH *dh, BIGNUM *r, | ||
| 1091 | const BIGNUM *a, const BIGNUM *p, | ||
| 1092 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 1093 | { | ||
| 1094 | return hwcrhk_mod_exp(r, a, p, m, ctx); | ||
| 1095 | } | ||
| 1096 | #endif | ||
| 1097 | |||
| 1098 | /* Random bytes are good */ | ||
| 1099 | static int hwcrhk_rand_bytes(unsigned char *buf, int num) | ||
| 1100 | { | ||
| 1101 | char tempbuf[1024]; | ||
| 1102 | HWCryptoHook_ErrMsgBuf rmsg; | ||
| 1103 | int to_return = 0; /* assume failure */ | ||
| 1104 | int ret; | ||
| 1105 | |||
| 1106 | rmsg.buf = tempbuf; | ||
| 1107 | rmsg.size = sizeof(tempbuf); | ||
| 1108 | |||
| 1109 | if(!hwcrhk_context) | ||
| 1110 | { | ||
| 1111 | HWCRHKerr(HWCRHK_F_HWCRHK_RAND_BYTES,HWCRHK_R_NOT_INITIALISED); | ||
| 1112 | goto err; | ||
| 1113 | } | ||
| 1114 | |||
| 1115 | ret = p_hwcrhk_RandomBytes(hwcrhk_context, buf, num, &rmsg); | ||
| 1116 | if (ret < 0) | ||
| 1117 | { | ||
| 1118 | /* FIXME: When this error is returned, HWCryptoHook is | ||
| 1119 | telling us that falling back to software computation | ||
| 1120 | might be a good thing. */ | ||
| 1121 | if(ret == HWCRYPTOHOOK_ERROR_FALLBACK) | ||
| 1122 | { | ||
| 1123 | HWCRHKerr(HWCRHK_F_HWCRHK_RAND_BYTES, | ||
| 1124 | HWCRHK_R_REQUEST_FALLBACK); | ||
| 1125 | } | ||
| 1126 | else | ||
| 1127 | { | ||
| 1128 | HWCRHKerr(HWCRHK_F_HWCRHK_RAND_BYTES, | ||
| 1129 | HWCRHK_R_REQUEST_FAILED); | ||
| 1130 | } | ||
| 1131 | ERR_add_error_data(1,rmsg.buf); | ||
| 1132 | goto err; | ||
| 1133 | } | ||
| 1134 | to_return = 1; | ||
| 1135 | err: | ||
| 1136 | return to_return; | ||
| 1137 | } | ||
| 1138 | |||
| 1139 | static int hwcrhk_rand_status(void) | ||
| 1140 | { | ||
| 1141 | return 1; | ||
| 1142 | } | ||
| 1143 | |||
| 1144 | /* This cleans up an RSA KM key, called when ex_data is freed */ | ||
| 1145 | |||
| 1146 | static void hwcrhk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
| 1147 | int ind,long argl, void *argp) | ||
| 1148 | { | ||
| 1149 | char tempbuf[1024]; | ||
| 1150 | HWCryptoHook_ErrMsgBuf rmsg; | ||
| 1151 | #ifndef OPENSSL_NO_RSA | ||
| 1152 | HWCryptoHook_RSAKeyHandle *hptr; | ||
| 1153 | #endif | ||
| 1154 | #if !defined(OPENSSL_NO_RSA) | ||
| 1155 | int ret; | ||
| 1156 | #endif | ||
| 1157 | |||
| 1158 | rmsg.buf = tempbuf; | ||
| 1159 | rmsg.size = sizeof(tempbuf); | ||
| 1160 | |||
| 1161 | #ifndef OPENSSL_NO_RSA | ||
| 1162 | hptr = (HWCryptoHook_RSAKeyHandle *) item; | ||
| 1163 | if(hptr) | ||
| 1164 | { | ||
| 1165 | ret = p_hwcrhk_RSAUnloadKey(*hptr, NULL); | ||
| 1166 | OPENSSL_free(hptr); | ||
| 1167 | } | ||
| 1168 | #endif | ||
| 1169 | } | ||
| 1170 | |||
| 1171 | /* Mutex calls: since the HWCryptoHook model closely follows the POSIX model | ||
| 1172 | * these just wrap the POSIX functions and add some logging. | ||
| 1173 | */ | ||
| 1174 | |||
| 1175 | static int hwcrhk_mutex_init(HWCryptoHook_Mutex* mt, | ||
| 1176 | HWCryptoHook_CallerContext *cactx) | ||
| 1177 | { | ||
| 1178 | mt->lockid = CRYPTO_get_new_dynlockid(); | ||
| 1179 | if (mt->lockid == 0) | ||
| 1180 | return 1; /* failure */ | ||
| 1181 | return 0; /* success */ | ||
| 1182 | } | ||
| 1183 | |||
| 1184 | static int hwcrhk_mutex_lock(HWCryptoHook_Mutex *mt) | ||
| 1185 | { | ||
| 1186 | CRYPTO_w_lock(mt->lockid); | ||
| 1187 | return 0; | ||
| 1188 | } | ||
| 1189 | |||
| 1190 | static void hwcrhk_mutex_unlock(HWCryptoHook_Mutex * mt) | ||
| 1191 | { | ||
| 1192 | CRYPTO_w_unlock(mt->lockid); | ||
| 1193 | } | ||
| 1194 | |||
| 1195 | static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex *mt) | ||
| 1196 | { | ||
| 1197 | CRYPTO_destroy_dynlockid(mt->lockid); | ||
| 1198 | } | ||
| 1199 | |||
| 1200 | /* Mutex upcalls to use if the application does not support dynamic locks */ | ||
| 1201 | |||
| 1202 | static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m, | ||
| 1203 | HWCryptoHook_CallerContext *c) | ||
| 1204 | { | ||
| 1205 | return 0; | ||
| 1206 | } | ||
| 1207 | static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m) | ||
| 1208 | { | ||
| 1209 | CRYPTO_w_lock(CRYPTO_LOCK_HWCRHK); | ||
| 1210 | return 0; | ||
| 1211 | } | ||
| 1212 | static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m) | ||
| 1213 | { | ||
| 1214 | CRYPTO_w_unlock(CRYPTO_LOCK_HWCRHK); | ||
| 1215 | } | ||
| 1216 | static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m) | ||
| 1217 | { | ||
| 1218 | } | ||
| 1219 | |||
| 1220 | static int hwcrhk_get_pass(const char *prompt_info, | ||
| 1221 | int *len_io, char *buf, | ||
| 1222 | HWCryptoHook_PassphraseContext *ppctx, | ||
| 1223 | HWCryptoHook_CallerContext *cactx) | ||
| 1224 | { | ||
| 1225 | pem_password_cb *callback = NULL; | ||
| 1226 | void *callback_data = NULL; | ||
| 1227 | UI_METHOD *ui_method = NULL; | ||
| 1228 | |||
| 1229 | if (cactx) | ||
| 1230 | { | ||
| 1231 | if (cactx->ui_method) | ||
| 1232 | ui_method = cactx->ui_method; | ||
| 1233 | if (cactx->password_callback) | ||
| 1234 | callback = cactx->password_callback; | ||
| 1235 | if (cactx->callback_data) | ||
| 1236 | callback_data = cactx->callback_data; | ||
| 1237 | } | ||
| 1238 | if (ppctx) | ||
| 1239 | { | ||
| 1240 | if (ppctx->ui_method) | ||
| 1241 | { | ||
| 1242 | ui_method = ppctx->ui_method; | ||
| 1243 | callback = NULL; | ||
| 1244 | } | ||
| 1245 | if (ppctx->callback_data) | ||
| 1246 | callback_data = ppctx->callback_data; | ||
| 1247 | } | ||
| 1248 | if (callback == NULL && ui_method == NULL) | ||
| 1249 | { | ||
| 1250 | HWCRHKerr(HWCRHK_F_HWCRHK_GET_PASS,HWCRHK_R_NO_CALLBACK); | ||
| 1251 | return -1; | ||
| 1252 | } | ||
| 1253 | |||
| 1254 | if (ui_method) | ||
| 1255 | { | ||
| 1256 | UI *ui = UI_new_method(ui_method); | ||
| 1257 | if (ui) | ||
| 1258 | { | ||
| 1259 | int ok; | ||
| 1260 | char *prompt = UI_construct_prompt(ui, | ||
| 1261 | "pass phrase", prompt_info); | ||
| 1262 | |||
| 1263 | ok = UI_add_input_string(ui,prompt, | ||
| 1264 | UI_INPUT_FLAG_DEFAULT_PWD, | ||
| 1265 | buf,0,(*len_io) - 1); | ||
| 1266 | UI_add_user_data(ui, callback_data); | ||
| 1267 | UI_ctrl(ui, UI_CTRL_PRINT_ERRORS, 1, 0, 0); | ||
| 1268 | |||
| 1269 | if (ok >= 0) | ||
| 1270 | do | ||
| 1271 | { | ||
| 1272 | ok=UI_process(ui); | ||
| 1273 | } | ||
| 1274 | while (ok < 0 && UI_ctrl(ui, UI_CTRL_IS_REDOABLE, 0, 0, 0)); | ||
| 1275 | |||
| 1276 | if (ok >= 0) | ||
| 1277 | *len_io = strlen(buf); | ||
| 1278 | |||
| 1279 | UI_free(ui); | ||
| 1280 | OPENSSL_free(prompt); | ||
| 1281 | } | ||
| 1282 | } | ||
| 1283 | else | ||
| 1284 | { | ||
| 1285 | *len_io = callback(buf, *len_io, 0, callback_data); | ||
| 1286 | } | ||
| 1287 | if(!*len_io) | ||
| 1288 | return -1; | ||
| 1289 | return 0; | ||
| 1290 | } | ||
| 1291 | |||
| 1292 | static int hwcrhk_insert_card(const char *prompt_info, | ||
| 1293 | const char *wrong_info, | ||
| 1294 | HWCryptoHook_PassphraseContext *ppctx, | ||
| 1295 | HWCryptoHook_CallerContext *cactx) | ||
| 1296 | { | ||
| 1297 | int ok = -1; | ||
| 1298 | UI *ui; | ||
| 1299 | void *callback_data = NULL; | ||
| 1300 | UI_METHOD *ui_method = NULL; | ||
| 1301 | |||
| 1302 | if (cactx) | ||
| 1303 | { | ||
| 1304 | if (cactx->ui_method) | ||
| 1305 | ui_method = cactx->ui_method; | ||
| 1306 | if (cactx->callback_data) | ||
| 1307 | callback_data = cactx->callback_data; | ||
| 1308 | } | ||
| 1309 | if (ppctx) | ||
| 1310 | { | ||
| 1311 | if (ppctx->ui_method) | ||
| 1312 | ui_method = ppctx->ui_method; | ||
| 1313 | if (ppctx->callback_data) | ||
| 1314 | callback_data = ppctx->callback_data; | ||
| 1315 | } | ||
| 1316 | if (ui_method == NULL) | ||
| 1317 | { | ||
| 1318 | HWCRHKerr(HWCRHK_F_HWCRHK_INSERT_CARD, | ||
| 1319 | HWCRHK_R_NO_CALLBACK); | ||
| 1320 | return -1; | ||
| 1321 | } | ||
| 1322 | |||
| 1323 | ui = UI_new_method(ui_method); | ||
| 1324 | |||
| 1325 | if (ui) | ||
| 1326 | { | ||
| 1327 | char answer; | ||
| 1328 | char buf[BUFSIZ]; | ||
| 1329 | |||
| 1330 | if (wrong_info) | ||
| 1331 | BIO_snprintf(buf, sizeof(buf)-1, | ||
| 1332 | "Current card: \"%s\"\n", wrong_info); | ||
| 1333 | ok = UI_dup_info_string(ui, buf); | ||
| 1334 | if (ok >= 0 && prompt_info) | ||
| 1335 | { | ||
| 1336 | BIO_snprintf(buf, sizeof(buf)-1, | ||
| 1337 | "Insert card \"%s\"", prompt_info); | ||
| 1338 | ok = UI_dup_input_boolean(ui, buf, | ||
| 1339 | "\n then hit <enter> or C<enter> to cancel\n", | ||
| 1340 | "\r\n", "Cc", UI_INPUT_FLAG_ECHO, &answer); | ||
| 1341 | } | ||
| 1342 | UI_add_user_data(ui, callback_data); | ||
| 1343 | |||
| 1344 | if (ok >= 0) | ||
| 1345 | ok = UI_process(ui); | ||
| 1346 | UI_free(ui); | ||
| 1347 | |||
| 1348 | if (ok == -2 || (ok >= 0 && answer == 'C')) | ||
| 1349 | ok = 1; | ||
| 1350 | else if (ok < 0) | ||
| 1351 | ok = -1; | ||
| 1352 | else | ||
| 1353 | ok = 0; | ||
| 1354 | } | ||
| 1355 | return ok; | ||
| 1356 | } | ||
| 1357 | |||
| 1358 | static void hwcrhk_log_message(void *logstr, const char *message) | ||
| 1359 | { | ||
| 1360 | BIO *lstream = NULL; | ||
| 1361 | |||
| 1362 | CRYPTO_w_lock(CRYPTO_LOCK_BIO); | ||
| 1363 | if (logstr) | ||
| 1364 | lstream=*(BIO **)logstr; | ||
| 1365 | if (lstream) | ||
| 1366 | { | ||
| 1367 | BIO_printf(lstream, "%s\n", message); | ||
| 1368 | } | ||
| 1369 | CRYPTO_w_unlock(CRYPTO_LOCK_BIO); | ||
| 1370 | } | ||
| 1371 | |||
| 1372 | /* This stuff is needed if this ENGINE is being compiled into a self-contained | ||
| 1373 | * shared-library. */ | ||
| 1374 | #ifdef ENGINE_DYNAMIC_SUPPORT | ||
| 1375 | static int bind_fn(ENGINE *e, const char *id) | ||
| 1376 | { | ||
| 1377 | if(id && (strcmp(id, engine_hwcrhk_id) != 0)) | ||
| 1378 | return 0; | ||
| 1379 | if(!bind_helper(e)) | ||
| 1380 | return 0; | ||
| 1381 | return 1; | ||
| 1382 | } | ||
| 1383 | IMPLEMENT_DYNAMIC_CHECK_FN() | ||
| 1384 | IMPLEMENT_DYNAMIC_BIND_FN(bind_fn) | ||
| 1385 | #endif /* ENGINE_DYNAMIC_SUPPORT */ | ||
| 1386 | |||
| 1387 | #endif /* !OPENSSL_NO_HW_NCIPHER */ | ||
| 1388 | #endif /* !OPENSSL_NO_HW */ | ||
diff --git a/src/lib/libcrypto/engine/hw_ncipher_err.c b/src/lib/libcrypto/engine/hw_ncipher_err.c deleted file mode 100644 index 5bc94581b7..0000000000 --- a/src/lib/libcrypto/engine/hw_ncipher_err.c +++ /dev/null | |||
| @@ -1,157 +0,0 @@ | |||
| 1 | /* hw_ncipher_err.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1999-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 | |||
| 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 "hw_ncipher_err.h" | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | static ERR_STRING_DATA HWCRHK_str_functs[]= | ||
| 68 | { | ||
| 69 | {ERR_PACK(0,HWCRHK_F_HWCRHK_CTRL,0), "HWCRHK_CTRL"}, | ||
| 70 | {ERR_PACK(0,HWCRHK_F_HWCRHK_FINISH,0), "HWCRHK_FINISH"}, | ||
| 71 | {ERR_PACK(0,HWCRHK_F_HWCRHK_GET_PASS,0), "HWCRHK_GET_PASS"}, | ||
| 72 | {ERR_PACK(0,HWCRHK_F_HWCRHK_INIT,0), "HWCRHK_INIT"}, | ||
| 73 | {ERR_PACK(0,HWCRHK_F_HWCRHK_INSERT_CARD,0), "HWCRHK_INSERT_CARD"}, | ||
| 74 | {ERR_PACK(0,HWCRHK_F_HWCRHK_LOAD_PRIVKEY,0), "HWCRHK_LOAD_PRIVKEY"}, | ||
| 75 | {ERR_PACK(0,HWCRHK_F_HWCRHK_LOAD_PUBKEY,0), "HWCRHK_LOAD_PUBKEY"}, | ||
| 76 | {ERR_PACK(0,HWCRHK_F_HWCRHK_MOD_EXP,0), "HWCRHK_MOD_EXP"}, | ||
| 77 | {ERR_PACK(0,HWCRHK_F_HWCRHK_RAND_BYTES,0), "HWCRHK_RAND_BYTES"}, | ||
| 78 | {ERR_PACK(0,HWCRHK_F_HWCRHK_RSA_MOD_EXP,0), "HWCRHK_RSA_MOD_EXP"}, | ||
| 79 | {0,NULL} | ||
| 80 | }; | ||
| 81 | |||
| 82 | static ERR_STRING_DATA HWCRHK_str_reasons[]= | ||
| 83 | { | ||
| 84 | {HWCRHK_R_ALREADY_LOADED ,"already loaded"}, | ||
| 85 | {HWCRHK_R_BIO_WAS_FREED ,"bio was freed"}, | ||
| 86 | {HWCRHK_R_CHIL_ERROR ,"chil error"}, | ||
| 87 | {HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, | ||
| 88 | {HWCRHK_R_DSO_FAILURE ,"dso failure"}, | ||
| 89 | {HWCRHK_R_DYNAMIC_LOCKING_MISSING ,"dynamic locking missing"}, | ||
| 90 | {HWCRHK_R_MISSING_KEY_COMPONENTS ,"missing key components"}, | ||
| 91 | {HWCRHK_R_NOT_INITIALISED ,"not initialised"}, | ||
| 92 | {HWCRHK_R_NOT_LOADED ,"not loaded"}, | ||
| 93 | {HWCRHK_R_NO_CALLBACK ,"no callback"}, | ||
| 94 | {HWCRHK_R_NO_KEY ,"no key"}, | ||
| 95 | {HWCRHK_R_PRIVATE_KEY_ALGORITHMS_DISABLED,"private key algorithms disabled"}, | ||
| 96 | {HWCRHK_R_REQUEST_FAILED ,"request failed"}, | ||
| 97 | {HWCRHK_R_REQUEST_FALLBACK ,"request fallback"}, | ||
| 98 | {HWCRHK_R_UNIT_FAILURE ,"unit failure"}, | ||
| 99 | {0,NULL} | ||
| 100 | }; | ||
| 101 | |||
| 102 | #endif | ||
| 103 | |||
| 104 | #ifdef HWCRHK_LIB_NAME | ||
| 105 | static ERR_STRING_DATA HWCRHK_lib_name[]= | ||
| 106 | { | ||
| 107 | {0 ,HWCRHK_LIB_NAME}, | ||
| 108 | {0,NULL} | ||
| 109 | }; | ||
| 110 | #endif | ||
| 111 | |||
| 112 | |||
| 113 | static int HWCRHK_lib_error_code=0; | ||
| 114 | static int HWCRHK_error_init=1; | ||
| 115 | |||
| 116 | static void ERR_load_HWCRHK_strings(void) | ||
| 117 | { | ||
| 118 | if (HWCRHK_lib_error_code == 0) | ||
| 119 | HWCRHK_lib_error_code=ERR_get_next_error_library(); | ||
| 120 | |||
| 121 | if (HWCRHK_error_init) | ||
| 122 | { | ||
| 123 | HWCRHK_error_init=0; | ||
| 124 | #ifndef OPENSSL_NO_ERR | ||
| 125 | ERR_load_strings(HWCRHK_lib_error_code,HWCRHK_str_functs); | ||
| 126 | ERR_load_strings(HWCRHK_lib_error_code,HWCRHK_str_reasons); | ||
| 127 | #endif | ||
| 128 | |||
| 129 | #ifdef HWCRHK_LIB_NAME | ||
| 130 | HWCRHK_lib_name->error = ERR_PACK(HWCRHK_lib_error_code,0,0); | ||
| 131 | ERR_load_strings(0,HWCRHK_lib_name); | ||
| 132 | #endif | ||
| 133 | } | ||
| 134 | } | ||
| 135 | |||
| 136 | static void ERR_unload_HWCRHK_strings(void) | ||
| 137 | { | ||
| 138 | if (HWCRHK_error_init == 0) | ||
| 139 | { | ||
| 140 | #ifndef OPENSSL_NO_ERR | ||
| 141 | ERR_unload_strings(HWCRHK_lib_error_code,HWCRHK_str_functs); | ||
| 142 | ERR_unload_strings(HWCRHK_lib_error_code,HWCRHK_str_reasons); | ||
| 143 | #endif | ||
| 144 | |||
| 145 | #ifdef HWCRHK_LIB_NAME | ||
| 146 | ERR_unload_strings(0,HWCRHK_lib_name); | ||
| 147 | #endif | ||
| 148 | HWCRHK_error_init=1; | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | static void ERR_HWCRHK_error(int function, int reason, char *file, int line) | ||
| 153 | { | ||
| 154 | if (HWCRHK_lib_error_code == 0) | ||
| 155 | HWCRHK_lib_error_code=ERR_get_next_error_library(); | ||
| 156 | ERR_PUT_error(HWCRHK_lib_error_code,function,reason,file,line); | ||
| 157 | } | ||
diff --git a/src/lib/libcrypto/engine/hw_ncipher_err.h b/src/lib/libcrypto/engine/hw_ncipher_err.h deleted file mode 100644 index d232d02319..0000000000 --- a/src/lib/libcrypto/engine/hw_ncipher_err.h +++ /dev/null | |||
| @@ -1,101 +0,0 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2001 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_HWCRHK_ERR_H | ||
| 56 | #define HEADER_HWCRHK_ERR_H | ||
| 57 | |||
| 58 | /* BEGIN ERROR CODES */ | ||
| 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 60 | * made after this point may be overwritten when the script is next run. | ||
| 61 | */ | ||
| 62 | static void ERR_load_HWCRHK_strings(void); | ||
| 63 | static void ERR_unload_HWCRHK_strings(void); | ||
| 64 | static void ERR_HWCRHK_error(int function, int reason, char *file, int line); | ||
| 65 | #define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),__FILE__,__LINE__) | ||
| 66 | |||
| 67 | /* Error codes for the HWCRHK functions. */ | ||
| 68 | |||
| 69 | /* Function codes. */ | ||
| 70 | #define HWCRHK_F_HWCRHK_CTRL 100 | ||
| 71 | #define HWCRHK_F_HWCRHK_FINISH 101 | ||
| 72 | #define HWCRHK_F_HWCRHK_GET_PASS 102 | ||
| 73 | #define HWCRHK_F_HWCRHK_INIT 103 | ||
| 74 | #define HWCRHK_F_HWCRHK_INSERT_CARD 104 | ||
| 75 | #define HWCRHK_F_HWCRHK_LOAD_PRIVKEY 105 | ||
| 76 | #define HWCRHK_F_HWCRHK_LOAD_PUBKEY 106 | ||
| 77 | #define HWCRHK_F_HWCRHK_MOD_EXP 107 | ||
| 78 | #define HWCRHK_F_HWCRHK_RAND_BYTES 108 | ||
| 79 | #define HWCRHK_F_HWCRHK_RSA_MOD_EXP 109 | ||
| 80 | |||
| 81 | /* Reason codes. */ | ||
| 82 | #define HWCRHK_R_ALREADY_LOADED 100 | ||
| 83 | #define HWCRHK_R_BIO_WAS_FREED 101 | ||
| 84 | #define HWCRHK_R_CHIL_ERROR 102 | ||
| 85 | #define HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103 | ||
| 86 | #define HWCRHK_R_DSO_FAILURE 104 | ||
| 87 | #define HWCRHK_R_DYNAMIC_LOCKING_MISSING 114 | ||
| 88 | #define HWCRHK_R_MISSING_KEY_COMPONENTS 105 | ||
| 89 | #define HWCRHK_R_NOT_INITIALISED 106 | ||
| 90 | #define HWCRHK_R_NOT_LOADED 107 | ||
| 91 | #define HWCRHK_R_NO_CALLBACK 108 | ||
| 92 | #define HWCRHK_R_NO_KEY 109 | ||
| 93 | #define HWCRHK_R_PRIVATE_KEY_ALGORITHMS_DISABLED 110 | ||
| 94 | #define HWCRHK_R_REQUEST_FAILED 111 | ||
| 95 | #define HWCRHK_R_REQUEST_FALLBACK 112 | ||
| 96 | #define HWCRHK_R_UNIT_FAILURE 113 | ||
| 97 | |||
| 98 | #ifdef __cplusplus | ||
| 99 | } | ||
| 100 | #endif | ||
| 101 | #endif | ||
diff --git a/src/lib/libcrypto/engine/hw_nuron.c b/src/lib/libcrypto/engine/hw_nuron.c deleted file mode 100644 index fb9188bfe5..0000000000 --- a/src/lib/libcrypto/engine/hw_nuron.c +++ /dev/null | |||
| @@ -1,418 +0,0 @@ | |||
| 1 | /* crypto/engine/hw_nuron.c */ | ||
| 2 | /* Written by Ben Laurie for the OpenSSL Project, leaning heavily on Geoff | ||
| 3 | * Thorpe's Atalla implementation. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2000-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 <openssl/crypto.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/dso.h> | ||
| 63 | #include <openssl/engine.h> | ||
| 64 | |||
| 65 | |||
| 66 | #ifndef OPENSSL_NO_HW | ||
| 67 | #ifndef OPENSSL_NO_HW_NURON | ||
| 68 | |||
| 69 | #define NURON_LIB_NAME "nuron engine" | ||
| 70 | #include "hw_nuron_err.c" | ||
| 71 | |||
| 72 | static const char *NURON_LIBNAME = NULL; | ||
| 73 | static const char *get_NURON_LIBNAME(void) | ||
| 74 | { | ||
| 75 | if(NURON_LIBNAME) | ||
| 76 | return NURON_LIBNAME; | ||
| 77 | return "nuronssl"; | ||
| 78 | } | ||
| 79 | static void free_NURON_LIBNAME(void) | ||
| 80 | { | ||
| 81 | if(NURON_LIBNAME) | ||
| 82 | OPENSSL_free((void*)NURON_LIBNAME); | ||
| 83 | NURON_LIBNAME = NULL; | ||
| 84 | } | ||
| 85 | static long set_NURON_LIBNAME(const char *name) | ||
| 86 | { | ||
| 87 | free_NURON_LIBNAME(); | ||
| 88 | return (((NURON_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0); | ||
| 89 | } | ||
| 90 | static const char *NURON_F1 = "nuron_mod_exp"; | ||
| 91 | |||
| 92 | /* The definitions for control commands specific to this engine */ | ||
| 93 | #define NURON_CMD_SO_PATH ENGINE_CMD_BASE | ||
| 94 | static const ENGINE_CMD_DEFN nuron_cmd_defns[] = { | ||
| 95 | {NURON_CMD_SO_PATH, | ||
| 96 | "SO_PATH", | ||
| 97 | "Specifies the path to the 'nuronssl' shared library", | ||
| 98 | ENGINE_CMD_FLAG_STRING}, | ||
| 99 | {0, NULL, NULL, 0} | ||
| 100 | }; | ||
| 101 | |||
| 102 | typedef int tfnModExp(BIGNUM *r,const BIGNUM *a,const BIGNUM *p,const BIGNUM *m); | ||
| 103 | static tfnModExp *pfnModExp = NULL; | ||
| 104 | |||
| 105 | static DSO *pvDSOHandle = NULL; | ||
| 106 | |||
| 107 | static int nuron_destroy(ENGINE *e) | ||
| 108 | { | ||
| 109 | free_NURON_LIBNAME(); | ||
| 110 | ERR_unload_NURON_strings(); | ||
| 111 | return 1; | ||
| 112 | } | ||
| 113 | |||
| 114 | static int nuron_init(ENGINE *e) | ||
| 115 | { | ||
| 116 | if(pvDSOHandle != NULL) | ||
| 117 | { | ||
| 118 | NURONerr(NURON_F_NURON_INIT,NURON_R_ALREADY_LOADED); | ||
| 119 | return 0; | ||
| 120 | } | ||
| 121 | |||
| 122 | pvDSOHandle = DSO_load(NULL, get_NURON_LIBNAME(), NULL, | ||
| 123 | DSO_FLAG_NAME_TRANSLATION_EXT_ONLY); | ||
| 124 | if(!pvDSOHandle) | ||
| 125 | { | ||
| 126 | NURONerr(NURON_F_NURON_INIT,NURON_R_DSO_NOT_FOUND); | ||
| 127 | return 0; | ||
| 128 | } | ||
| 129 | |||
| 130 | pfnModExp = (tfnModExp *)DSO_bind_func(pvDSOHandle, NURON_F1); | ||
| 131 | if(!pfnModExp) | ||
| 132 | { | ||
| 133 | NURONerr(NURON_F_NURON_INIT,NURON_R_DSO_FUNCTION_NOT_FOUND); | ||
| 134 | return 0; | ||
| 135 | } | ||
| 136 | |||
| 137 | return 1; | ||
| 138 | } | ||
| 139 | |||
| 140 | static int nuron_finish(ENGINE *e) | ||
| 141 | { | ||
| 142 | free_NURON_LIBNAME(); | ||
| 143 | if(pvDSOHandle == NULL) | ||
| 144 | { | ||
| 145 | NURONerr(NURON_F_NURON_FINISH,NURON_R_NOT_LOADED); | ||
| 146 | return 0; | ||
| 147 | } | ||
| 148 | if(!DSO_free(pvDSOHandle)) | ||
| 149 | { | ||
| 150 | NURONerr(NURON_F_NURON_FINISH,NURON_R_DSO_FAILURE); | ||
| 151 | return 0; | ||
| 152 | } | ||
| 153 | pvDSOHandle=NULL; | ||
| 154 | pfnModExp=NULL; | ||
| 155 | return 1; | ||
| 156 | } | ||
| 157 | |||
| 158 | static int nuron_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | ||
| 159 | { | ||
| 160 | int initialised = ((pvDSOHandle == NULL) ? 0 : 1); | ||
| 161 | switch(cmd) | ||
| 162 | { | ||
| 163 | case NURON_CMD_SO_PATH: | ||
| 164 | if(p == NULL) | ||
| 165 | { | ||
| 166 | NURONerr(NURON_F_NURON_CTRL,ERR_R_PASSED_NULL_PARAMETER); | ||
| 167 | return 0; | ||
| 168 | } | ||
| 169 | if(initialised) | ||
| 170 | { | ||
| 171 | NURONerr(NURON_F_NURON_CTRL,NURON_R_ALREADY_LOADED); | ||
| 172 | return 0; | ||
| 173 | } | ||
| 174 | return set_NURON_LIBNAME((const char *)p); | ||
| 175 | default: | ||
| 176 | break; | ||
| 177 | } | ||
| 178 | NURONerr(NURON_F_NURON_CTRL,NURON_R_CTRL_COMMAND_NOT_IMPLEMENTED); | ||
| 179 | return 0; | ||
| 180 | } | ||
| 181 | |||
| 182 | static int nuron_mod_exp(BIGNUM *r,const BIGNUM *a,const BIGNUM *p, | ||
| 183 | const BIGNUM *m,BN_CTX *ctx) | ||
| 184 | { | ||
| 185 | if(!pvDSOHandle) | ||
| 186 | { | ||
| 187 | NURONerr(NURON_F_NURON_MOD_EXP,NURON_R_NOT_LOADED); | ||
| 188 | return 0; | ||
| 189 | } | ||
| 190 | return pfnModExp(r,a,p,m); | ||
| 191 | } | ||
| 192 | |||
| 193 | #ifndef OPENSSL_NO_RSA | ||
| 194 | static int nuron_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | ||
| 195 | { | ||
| 196 | return nuron_mod_exp(r0,I,rsa->d,rsa->n,NULL); | ||
| 197 | } | ||
| 198 | #endif | ||
| 199 | |||
| 200 | #ifndef OPENSSL_NO_DSA | ||
| 201 | /* This code was liberated and adapted from the commented-out code in | ||
| 202 | * dsa_ossl.c. Because of the unoptimised form of the Atalla acceleration | ||
| 203 | * (it doesn't have a CRT form for RSA), this function means that an | ||
| 204 | * Atalla system running with a DSA server certificate can handshake | ||
| 205 | * around 5 or 6 times faster/more than an equivalent system running with | ||
| 206 | * RSA. Just check out the "signs" statistics from the RSA and DSA parts | ||
| 207 | * of "openssl speed -engine atalla dsa1024 rsa1024". */ | ||
| 208 | static int nuron_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, | ||
| 209 | BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
| 210 | BN_CTX *ctx, BN_MONT_CTX *in_mont) | ||
| 211 | { | ||
| 212 | BIGNUM t; | ||
| 213 | int to_return = 0; | ||
| 214 | |||
| 215 | BN_init(&t); | ||
| 216 | /* let rr = a1 ^ p1 mod m */ | ||
| 217 | if (!nuron_mod_exp(rr,a1,p1,m,ctx)) | ||
| 218 | goto end; | ||
| 219 | /* let t = a2 ^ p2 mod m */ | ||
| 220 | if (!nuron_mod_exp(&t,a2,p2,m,ctx)) | ||
| 221 | goto end; | ||
| 222 | /* let rr = rr * t mod m */ | ||
| 223 | if (!BN_mod_mul(rr,rr,&t,m,ctx)) | ||
| 224 | goto end; | ||
| 225 | to_return = 1; | ||
| 226 | end: | ||
| 227 | BN_free(&t); | ||
| 228 | return to_return; | ||
| 229 | } | ||
| 230 | |||
| 231 | |||
| 232 | static int nuron_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
| 233 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 234 | BN_MONT_CTX *m_ctx) | ||
| 235 | { | ||
| 236 | return nuron_mod_exp(r, a, p, m, ctx); | ||
| 237 | } | ||
| 238 | #endif | ||
| 239 | |||
| 240 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
| 241 | static int nuron_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 242 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 243 | { | ||
| 244 | return nuron_mod_exp(r, a, p, m, ctx); | ||
| 245 | } | ||
| 246 | |||
| 247 | #ifndef OPENSSL_NO_DH | ||
| 248 | /* This function is aliased to mod_exp (with the dh and mont dropped). */ | ||
| 249 | static int nuron_mod_exp_dh(const DH *dh, BIGNUM *r, | ||
| 250 | const BIGNUM *a, const BIGNUM *p, | ||
| 251 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 252 | { | ||
| 253 | return nuron_mod_exp(r, a, p, m, ctx); | ||
| 254 | } | ||
| 255 | #endif | ||
| 256 | |||
| 257 | #ifndef OPENSSL_NO_RSA | ||
| 258 | static RSA_METHOD nuron_rsa = | ||
| 259 | { | ||
| 260 | "Nuron RSA method", | ||
| 261 | NULL, | ||
| 262 | NULL, | ||
| 263 | NULL, | ||
| 264 | NULL, | ||
| 265 | nuron_rsa_mod_exp, | ||
| 266 | nuron_mod_exp_mont, | ||
| 267 | NULL, | ||
| 268 | NULL, | ||
| 269 | 0, | ||
| 270 | NULL, | ||
| 271 | NULL, | ||
| 272 | NULL | ||
| 273 | }; | ||
| 274 | #endif | ||
| 275 | |||
| 276 | #ifndef OPENSSL_NO_DSA | ||
| 277 | static DSA_METHOD nuron_dsa = | ||
| 278 | { | ||
| 279 | "Nuron DSA method", | ||
| 280 | NULL, /* dsa_do_sign */ | ||
| 281 | NULL, /* dsa_sign_setup */ | ||
| 282 | NULL, /* dsa_do_verify */ | ||
| 283 | nuron_dsa_mod_exp, /* dsa_mod_exp */ | ||
| 284 | nuron_mod_exp_dsa, /* bn_mod_exp */ | ||
| 285 | NULL, /* init */ | ||
| 286 | NULL, /* finish */ | ||
| 287 | 0, /* flags */ | ||
| 288 | NULL /* app_data */ | ||
| 289 | }; | ||
| 290 | #endif | ||
| 291 | |||
| 292 | #ifndef OPENSSL_NO_DH | ||
| 293 | static DH_METHOD nuron_dh = | ||
| 294 | { | ||
| 295 | "Nuron DH method", | ||
| 296 | NULL, | ||
| 297 | NULL, | ||
| 298 | nuron_mod_exp_dh, | ||
| 299 | NULL, | ||
| 300 | NULL, | ||
| 301 | 0, | ||
| 302 | NULL | ||
| 303 | }; | ||
| 304 | #endif | ||
| 305 | |||
| 306 | /* Constants used when creating the ENGINE */ | ||
| 307 | static const char *engine_nuron_id = "nuron"; | ||
| 308 | static const char *engine_nuron_name = "Nuron hardware engine support"; | ||
| 309 | |||
| 310 | /* This internal function is used by ENGINE_nuron() and possibly by the | ||
| 311 | * "dynamic" ENGINE support too */ | ||
| 312 | static int bind_helper(ENGINE *e) | ||
| 313 | { | ||
| 314 | #ifndef OPENSSL_NO_RSA | ||
| 315 | const RSA_METHOD *meth1; | ||
| 316 | #endif | ||
| 317 | #ifndef OPENSSL_NO_DSA | ||
| 318 | const DSA_METHOD *meth2; | ||
| 319 | #endif | ||
| 320 | #ifndef OPENSSL_NO_DH | ||
| 321 | const DH_METHOD *meth3; | ||
| 322 | #endif | ||
| 323 | if(!ENGINE_set_id(e, engine_nuron_id) || | ||
| 324 | !ENGINE_set_name(e, engine_nuron_name) || | ||
| 325 | #ifndef OPENSSL_NO_RSA | ||
| 326 | !ENGINE_set_RSA(e, &nuron_rsa) || | ||
| 327 | #endif | ||
| 328 | #ifndef OPENSSL_NO_DSA | ||
| 329 | !ENGINE_set_DSA(e, &nuron_dsa) || | ||
| 330 | #endif | ||
| 331 | #ifndef OPENSSL_NO_DH | ||
| 332 | !ENGINE_set_DH(e, &nuron_dh) || | ||
| 333 | #endif | ||
| 334 | !ENGINE_set_destroy_function(e, nuron_destroy) || | ||
| 335 | !ENGINE_set_init_function(e, nuron_init) || | ||
| 336 | !ENGINE_set_finish_function(e, nuron_finish) || | ||
| 337 | !ENGINE_set_ctrl_function(e, nuron_ctrl) || | ||
| 338 | !ENGINE_set_cmd_defns(e, nuron_cmd_defns)) | ||
| 339 | return 0; | ||
| 340 | |||
| 341 | #ifndef OPENSSL_NO_RSA | ||
| 342 | /* We know that the "PKCS1_SSLeay()" functions hook properly | ||
| 343 | * to the nuron-specific mod_exp and mod_exp_crt so we use | ||
| 344 | * those functions. NB: We don't use ENGINE_openssl() or | ||
| 345 | * anything "more generic" because something like the RSAref | ||
| 346 | * code may not hook properly, and if you own one of these | ||
| 347 | * cards then you have the right to do RSA operations on it | ||
| 348 | * anyway! */ | ||
| 349 | meth1=RSA_PKCS1_SSLeay(); | ||
| 350 | nuron_rsa.rsa_pub_enc=meth1->rsa_pub_enc; | ||
| 351 | nuron_rsa.rsa_pub_dec=meth1->rsa_pub_dec; | ||
| 352 | nuron_rsa.rsa_priv_enc=meth1->rsa_priv_enc; | ||
| 353 | nuron_rsa.rsa_priv_dec=meth1->rsa_priv_dec; | ||
| 354 | #endif | ||
| 355 | |||
| 356 | #ifndef OPENSSL_NO_DSA | ||
| 357 | /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish | ||
| 358 | * bits. */ | ||
| 359 | meth2=DSA_OpenSSL(); | ||
| 360 | nuron_dsa.dsa_do_sign=meth2->dsa_do_sign; | ||
| 361 | nuron_dsa.dsa_sign_setup=meth2->dsa_sign_setup; | ||
| 362 | nuron_dsa.dsa_do_verify=meth2->dsa_do_verify; | ||
| 363 | #endif | ||
| 364 | |||
| 365 | #ifndef OPENSSL_NO_DH | ||
| 366 | /* Much the same for Diffie-Hellman */ | ||
| 367 | meth3=DH_OpenSSL(); | ||
| 368 | nuron_dh.generate_key=meth3->generate_key; | ||
| 369 | nuron_dh.compute_key=meth3->compute_key; | ||
| 370 | #endif | ||
| 371 | |||
| 372 | /* Ensure the nuron error handling is set up */ | ||
| 373 | ERR_load_NURON_strings(); | ||
| 374 | return 1; | ||
| 375 | } | ||
| 376 | |||
| 377 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 378 | static ENGINE *engine_nuron(void) | ||
| 379 | { | ||
| 380 | ENGINE *ret = ENGINE_new(); | ||
| 381 | if(!ret) | ||
| 382 | return NULL; | ||
| 383 | if(!bind_helper(ret)) | ||
| 384 | { | ||
| 385 | ENGINE_free(ret); | ||
| 386 | return NULL; | ||
| 387 | } | ||
| 388 | return ret; | ||
| 389 | } | ||
| 390 | |||
| 391 | void ENGINE_load_nuron(void) | ||
| 392 | { | ||
| 393 | /* Copied from eng_[openssl|dyn].c */ | ||
| 394 | ENGINE *toadd = engine_nuron(); | ||
| 395 | if(!toadd) return; | ||
| 396 | ENGINE_add(toadd); | ||
| 397 | ENGINE_free(toadd); | ||
| 398 | ERR_clear_error(); | ||
| 399 | } | ||
| 400 | #endif | ||
| 401 | |||
| 402 | /* This stuff is needed if this ENGINE is being compiled into a self-contained | ||
| 403 | * shared-library. */ | ||
| 404 | #ifdef ENGINE_DYNAMIC_SUPPORT | ||
| 405 | static int bind_fn(ENGINE *e, const char *id) | ||
| 406 | { | ||
| 407 | if(id && (strcmp(id, engine_nuron_id) != 0)) | ||
| 408 | return 0; | ||
| 409 | if(!bind_helper(e)) | ||
| 410 | return 0; | ||
| 411 | return 1; | ||
| 412 | } | ||
| 413 | IMPLEMENT_DYNAMIC_CHECK_FN() | ||
| 414 | IMPLEMENT_DYNAMIC_BIND_FN(bind_fn) | ||
| 415 | #endif /* ENGINE_DYNAMIC_SUPPORT */ | ||
| 416 | |||
| 417 | #endif /* !OPENSSL_NO_HW_NURON */ | ||
| 418 | #endif /* !OPENSSL_NO_HW */ | ||
diff --git a/src/lib/libcrypto/engine/hw_nuron_err.c b/src/lib/libcrypto/engine/hw_nuron_err.c deleted file mode 100644 index df9d7bde76..0000000000 --- a/src/lib/libcrypto/engine/hw_nuron_err.c +++ /dev/null | |||
| @@ -1,142 +0,0 @@ | |||
| 1 | /* hw_nuron_err.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 | /* 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 "hw_nuron_err.h" | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | static ERR_STRING_DATA NURON_str_functs[]= | ||
| 68 | { | ||
| 69 | {ERR_PACK(0,NURON_F_NURON_CTRL,0), "NURON_CTRL"}, | ||
| 70 | {ERR_PACK(0,NURON_F_NURON_FINISH,0), "NURON_FINISH"}, | ||
| 71 | {ERR_PACK(0,NURON_F_NURON_INIT,0), "NURON_INIT"}, | ||
| 72 | {ERR_PACK(0,NURON_F_NURON_MOD_EXP,0), "NURON_MOD_EXP"}, | ||
| 73 | {0,NULL} | ||
| 74 | }; | ||
| 75 | |||
| 76 | static ERR_STRING_DATA NURON_str_reasons[]= | ||
| 77 | { | ||
| 78 | {NURON_R_ALREADY_LOADED ,"already loaded"}, | ||
| 79 | {NURON_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, | ||
| 80 | {NURON_R_DSO_FAILURE ,"dso failure"}, | ||
| 81 | {NURON_R_DSO_FUNCTION_NOT_FOUND ,"dso function not found"}, | ||
| 82 | {NURON_R_DSO_NOT_FOUND ,"dso not found"}, | ||
| 83 | {NURON_R_NOT_LOADED ,"not loaded"}, | ||
| 84 | {0,NULL} | ||
| 85 | }; | ||
| 86 | |||
| 87 | #endif | ||
| 88 | |||
| 89 | #ifdef NURON_LIB_NAME | ||
| 90 | static ERR_STRING_DATA NURON_lib_name[]= | ||
| 91 | { | ||
| 92 | {0 ,NURON_LIB_NAME}, | ||
| 93 | {0,NULL} | ||
| 94 | }; | ||
| 95 | #endif | ||
| 96 | |||
| 97 | |||
| 98 | static int NURON_lib_error_code=0; | ||
| 99 | static int NURON_error_init=1; | ||
| 100 | |||
| 101 | static void ERR_load_NURON_strings(void) | ||
| 102 | { | ||
| 103 | if (NURON_lib_error_code == 0) | ||
| 104 | NURON_lib_error_code=ERR_get_next_error_library(); | ||
| 105 | |||
| 106 | if (NURON_error_init) | ||
| 107 | { | ||
| 108 | NURON_error_init=0; | ||
| 109 | #ifndef OPENSSL_NO_ERR | ||
| 110 | ERR_load_strings(NURON_lib_error_code,NURON_str_functs); | ||
| 111 | ERR_load_strings(NURON_lib_error_code,NURON_str_reasons); | ||
| 112 | #endif | ||
| 113 | |||
| 114 | #ifdef NURON_LIB_NAME | ||
| 115 | NURON_lib_name->error = ERR_PACK(NURON_lib_error_code,0,0); | ||
| 116 | ERR_load_strings(0,NURON_lib_name); | ||
| 117 | #endif | ||
| 118 | } | ||
| 119 | } | ||
| 120 | |||
| 121 | static void ERR_unload_NURON_strings(void) | ||
| 122 | { | ||
| 123 | if (NURON_error_init == 0) | ||
| 124 | { | ||
| 125 | #ifndef OPENSSL_NO_ERR | ||
| 126 | ERR_unload_strings(NURON_lib_error_code,NURON_str_functs); | ||
| 127 | ERR_unload_strings(NURON_lib_error_code,NURON_str_reasons); | ||
| 128 | #endif | ||
| 129 | |||
| 130 | #ifdef NURON_LIB_NAME | ||
| 131 | ERR_unload_strings(0,NURON_lib_name); | ||
| 132 | #endif | ||
| 133 | NURON_error_init=1; | ||
| 134 | } | ||
| 135 | } | ||
| 136 | |||
| 137 | static void ERR_NURON_error(int function, int reason, char *file, int line) | ||
| 138 | { | ||
| 139 | if (NURON_lib_error_code == 0) | ||
| 140 | NURON_lib_error_code=ERR_get_next_error_library(); | ||
| 141 | ERR_PUT_error(NURON_lib_error_code,function,reason,file,line); | ||
| 142 | } | ||
diff --git a/src/lib/libcrypto/engine/hw_nuron_err.h b/src/lib/libcrypto/engine/hw_nuron_err.h deleted file mode 100644 index a56bfdf303..0000000000 --- a/src/lib/libcrypto/engine/hw_nuron_err.h +++ /dev/null | |||
| @@ -1,86 +0,0 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2001 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_NURON_ERR_H | ||
| 56 | #define HEADER_NURON_ERR_H | ||
| 57 | |||
| 58 | /* BEGIN ERROR CODES */ | ||
| 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 60 | * made after this point may be overwritten when the script is next run. | ||
| 61 | */ | ||
| 62 | static void ERR_load_NURON_strings(void); | ||
| 63 | static void ERR_unload_NURON_strings(void); | ||
| 64 | static void ERR_NURON_error(int function, int reason, char *file, int line); | ||
| 65 | #define NURONerr(f,r) ERR_NURON_error((f),(r),__FILE__,__LINE__) | ||
| 66 | |||
| 67 | /* Error codes for the NURON functions. */ | ||
| 68 | |||
| 69 | /* Function codes. */ | ||
| 70 | #define NURON_F_NURON_CTRL 100 | ||
| 71 | #define NURON_F_NURON_FINISH 101 | ||
| 72 | #define NURON_F_NURON_INIT 102 | ||
| 73 | #define NURON_F_NURON_MOD_EXP 103 | ||
| 74 | |||
| 75 | /* Reason codes. */ | ||
| 76 | #define NURON_R_ALREADY_LOADED 100 | ||
| 77 | #define NURON_R_CTRL_COMMAND_NOT_IMPLEMENTED 101 | ||
| 78 | #define NURON_R_DSO_FAILURE 102 | ||
| 79 | #define NURON_R_DSO_FUNCTION_NOT_FOUND 103 | ||
| 80 | #define NURON_R_DSO_NOT_FOUND 104 | ||
| 81 | #define NURON_R_NOT_LOADED 105 | ||
| 82 | |||
| 83 | #ifdef __cplusplus | ||
| 84 | } | ||
| 85 | #endif | ||
| 86 | #endif | ||
diff --git a/src/lib/libcrypto/engine/hw_sureware.c b/src/lib/libcrypto/engine/hw_sureware.c deleted file mode 100644 index fca467e690..0000000000 --- a/src/lib/libcrypto/engine/hw_sureware.c +++ /dev/null | |||
| @@ -1,1039 +0,0 @@ | |||
| 1 | /* Written by Corinne Dive-Reclus(cdive@baltimore.com) | ||
| 2 | * | ||
| 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 | * licensing@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 | * Written by Corinne Dive-Reclus(cdive@baltimore.com) | ||
| 36 | * | ||
| 37 | * Copyright@2001 Baltimore Technologies Ltd. | ||
| 38 | * All right Reserved. | ||
| 39 | * * | ||
| 40 | * THIS FILE IS PROVIDED BY BALTIMORE TECHNOLOGIES ``AS IS'' AND * | ||
| 41 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * | ||
| 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * | ||
| 43 | * ARE DISCLAIMED. IN NO EVENT SHALL BALTIMORE TECHNOLOGIES BE LIABLE * | ||
| 44 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * | ||
| 45 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * | ||
| 46 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * | ||
| 48 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * | ||
| 49 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * | ||
| 50 | * SUCH DAMAGE. * | ||
| 51 | ====================================================================*/ | ||
| 52 | |||
| 53 | #include <stdio.h> | ||
| 54 | #include "cryptlib.h" | ||
| 55 | #include <openssl/crypto.h> | ||
| 56 | #include <openssl/pem.h> | ||
| 57 | #include <openssl/dso.h> | ||
| 58 | #include "eng_int.h" | ||
| 59 | #include "engine.h" | ||
| 60 | #include <openssl/engine.h> | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_HW | ||
| 63 | #ifndef OPENSSL_NO_HW_SUREWARE | ||
| 64 | |||
| 65 | #ifdef FLAT_INC | ||
| 66 | #include "sureware.h" | ||
| 67 | #else | ||
| 68 | #include "vendor_defns/sureware.h" | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #define SUREWARE_LIB_NAME "sureware engine" | ||
| 72 | #include "hw_sureware_err.c" | ||
| 73 | |||
| 74 | static int surewarehk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | ||
| 75 | static int surewarehk_destroy(ENGINE *e); | ||
| 76 | static int surewarehk_init(ENGINE *e); | ||
| 77 | static int surewarehk_finish(ENGINE *e); | ||
| 78 | static int surewarehk_modexp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 79 | const BIGNUM *m, BN_CTX *ctx); | ||
| 80 | |||
| 81 | /* RSA stuff */ | ||
| 82 | static int surewarehk_rsa_priv_dec(int flen,const unsigned char *from,unsigned char *to, | ||
| 83 | RSA *rsa,int padding); | ||
| 84 | static int surewarehk_rsa_sign(int flen,const unsigned char *from,unsigned char *to, | ||
| 85 | RSA *rsa,int padding); | ||
| 86 | |||
| 87 | /* RAND stuff */ | ||
| 88 | static int surewarehk_rand_bytes(unsigned char *buf, int num); | ||
| 89 | static void surewarehk_rand_seed(const void *buf, int num); | ||
| 90 | static void surewarehk_rand_add(const void *buf, int num, double entropy); | ||
| 91 | |||
| 92 | /* KM stuff */ | ||
| 93 | static EVP_PKEY *surewarehk_load_privkey(ENGINE *e, const char *key_id, | ||
| 94 | UI_METHOD *ui_method, void *callback_data); | ||
| 95 | static EVP_PKEY *surewarehk_load_pubkey(ENGINE *e, const char *key_id, | ||
| 96 | UI_METHOD *ui_method, void *callback_data); | ||
| 97 | static void surewarehk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
| 98 | int idx,long argl, void *argp); | ||
| 99 | #if 0 | ||
| 100 | static void surewarehk_dh_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
| 101 | int idx,long argl, void *argp); | ||
| 102 | #endif | ||
| 103 | |||
| 104 | #ifndef OPENSSL_NO_RSA | ||
| 105 | /* This function is aliased to mod_exp (with the mont stuff dropped). */ | ||
| 106 | static int surewarehk_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 107 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 108 | { | ||
| 109 | return surewarehk_modexp(r, a, p, m, ctx); | ||
| 110 | } | ||
| 111 | |||
| 112 | /* Our internal RSA_METHOD that we provide pointers to */ | ||
| 113 | static RSA_METHOD surewarehk_rsa = | ||
| 114 | { | ||
| 115 | "SureWare RSA method", | ||
| 116 | NULL, /* pub_enc*/ | ||
| 117 | NULL, /* pub_dec*/ | ||
| 118 | surewarehk_rsa_sign, /* our rsa_sign is OpenSSL priv_enc*/ | ||
| 119 | surewarehk_rsa_priv_dec, /* priv_dec*/ | ||
| 120 | NULL, /*mod_exp*/ | ||
| 121 | surewarehk_mod_exp_mont, /*mod_exp_mongomery*/ | ||
| 122 | NULL, /* init*/ | ||
| 123 | NULL, /* finish*/ | ||
| 124 | 0, /* RSA flag*/ | ||
| 125 | NULL, | ||
| 126 | NULL, /* OpenSSL sign*/ | ||
| 127 | NULL /* OpenSSL verify*/ | ||
| 128 | }; | ||
| 129 | #endif | ||
| 130 | |||
| 131 | #ifndef OPENSSL_NO_DH | ||
| 132 | /* Our internal DH_METHOD that we provide pointers to */ | ||
| 133 | /* This function is aliased to mod_exp (with the dh and mont dropped). */ | ||
| 134 | static int surewarehk_modexp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | ||
| 135 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 136 | { | ||
| 137 | return surewarehk_modexp(r, a, p, m, ctx); | ||
| 138 | } | ||
| 139 | |||
| 140 | static DH_METHOD surewarehk_dh = | ||
| 141 | { | ||
| 142 | "SureWare DH method", | ||
| 143 | NULL,/*gen_key*/ | ||
| 144 | NULL,/*agree,*/ | ||
| 145 | surewarehk_modexp_dh, /*dh mod exp*/ | ||
| 146 | NULL, /* init*/ | ||
| 147 | NULL, /* finish*/ | ||
| 148 | 0, /* flags*/ | ||
| 149 | NULL | ||
| 150 | }; | ||
| 151 | #endif | ||
| 152 | |||
| 153 | static RAND_METHOD surewarehk_rand = | ||
| 154 | { | ||
| 155 | /* "SureWare RAND method", */ | ||
| 156 | surewarehk_rand_seed, | ||
| 157 | surewarehk_rand_bytes, | ||
| 158 | NULL,/*cleanup*/ | ||
| 159 | surewarehk_rand_add, | ||
| 160 | surewarehk_rand_bytes, | ||
| 161 | NULL,/*rand_status*/ | ||
| 162 | }; | ||
| 163 | |||
| 164 | #ifndef OPENSSL_NO_DSA | ||
| 165 | /* DSA stuff */ | ||
| 166 | static DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); | ||
| 167 | static int surewarehk_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, | ||
| 168 | BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
| 169 | BN_CTX *ctx, BN_MONT_CTX *in_mont) | ||
| 170 | { | ||
| 171 | BIGNUM t; | ||
| 172 | int to_return = 0; | ||
| 173 | BN_init(&t); | ||
| 174 | /* let rr = a1 ^ p1 mod m */ | ||
| 175 | if (!surewarehk_modexp(rr,a1,p1,m,ctx)) goto end; | ||
| 176 | /* let t = a2 ^ p2 mod m */ | ||
| 177 | if (!surewarehk_modexp(&t,a2,p2,m,ctx)) goto end; | ||
| 178 | /* let rr = rr * t mod m */ | ||
| 179 | if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end; | ||
| 180 | to_return = 1; | ||
| 181 | end: | ||
| 182 | BN_free(&t); | ||
| 183 | return to_return; | ||
| 184 | } | ||
| 185 | |||
| 186 | static DSA_METHOD surewarehk_dsa = | ||
| 187 | { | ||
| 188 | "SureWare DSA method", | ||
| 189 | surewarehk_dsa_do_sign, | ||
| 190 | NULL,/*sign setup*/ | ||
| 191 | NULL,/*verify,*/ | ||
| 192 | surewarehk_dsa_mod_exp,/*mod exp*/ | ||
| 193 | NULL,/*bn mod exp*/ | ||
| 194 | NULL, /*init*/ | ||
| 195 | NULL,/*finish*/ | ||
| 196 | 0, | ||
| 197 | NULL, | ||
| 198 | }; | ||
| 199 | #endif | ||
| 200 | |||
| 201 | static const char *engine_sureware_id = "sureware"; | ||
| 202 | static const char *engine_sureware_name = "SureWare hardware engine support"; | ||
| 203 | |||
| 204 | /* Now, to our own code */ | ||
| 205 | |||
| 206 | /* As this is only ever called once, there's no need for locking | ||
| 207 | * (indeed - the lock will already be held by our caller!!!) */ | ||
| 208 | static int bind_sureware(ENGINE *e) | ||
| 209 | { | ||
| 210 | #ifndef OPENSSL_NO_RSA | ||
| 211 | const RSA_METHOD *meth1; | ||
| 212 | #endif | ||
| 213 | #ifndef OPENSSL_NO_DSA | ||
| 214 | const DSA_METHOD *meth2; | ||
| 215 | #endif | ||
| 216 | #ifndef OPENSSL_NO_DH | ||
| 217 | const DH_METHOD *meth3; | ||
| 218 | #endif | ||
| 219 | |||
| 220 | if(!ENGINE_set_id(e, engine_sureware_id) || | ||
| 221 | !ENGINE_set_name(e, engine_sureware_name) || | ||
| 222 | #ifndef OPENSSL_NO_RSA | ||
| 223 | !ENGINE_set_RSA(e, &surewarehk_rsa) || | ||
| 224 | #endif | ||
| 225 | #ifndef OPENSSL_NO_DSA | ||
| 226 | !ENGINE_set_DSA(e, &surewarehk_dsa) || | ||
| 227 | #endif | ||
| 228 | #ifndef OPENSSL_NO_DH | ||
| 229 | !ENGINE_set_DH(e, &surewarehk_dh) || | ||
| 230 | #endif | ||
| 231 | !ENGINE_set_RAND(e, &surewarehk_rand) || | ||
| 232 | !ENGINE_set_destroy_function(e, surewarehk_destroy) || | ||
| 233 | !ENGINE_set_init_function(e, surewarehk_init) || | ||
| 234 | !ENGINE_set_finish_function(e, surewarehk_finish) || | ||
| 235 | !ENGINE_set_ctrl_function(e, surewarehk_ctrl) || | ||
| 236 | !ENGINE_set_load_privkey_function(e, surewarehk_load_privkey) || | ||
| 237 | !ENGINE_set_load_pubkey_function(e, surewarehk_load_pubkey)) | ||
| 238 | return 0; | ||
| 239 | |||
| 240 | #ifndef OPENSSL_NO_RSA | ||
| 241 | /* We know that the "PKCS1_SSLeay()" functions hook properly | ||
| 242 | * to the cswift-specific mod_exp and mod_exp_crt so we use | ||
| 243 | * those functions. NB: We don't use ENGINE_openssl() or | ||
| 244 | * anything "more generic" because something like the RSAref | ||
| 245 | * code may not hook properly, and if you own one of these | ||
| 246 | * cards then you have the right to do RSA operations on it | ||
| 247 | * anyway! */ | ||
| 248 | meth1 = RSA_PKCS1_SSLeay(); | ||
| 249 | if (meth1) | ||
| 250 | { | ||
| 251 | surewarehk_rsa.rsa_pub_enc = meth1->rsa_pub_enc; | ||
| 252 | surewarehk_rsa.rsa_pub_dec = meth1->rsa_pub_dec; | ||
| 253 | } | ||
| 254 | #endif | ||
| 255 | |||
| 256 | #ifndef OPENSSL_NO_DSA | ||
| 257 | /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish | ||
| 258 | * bits. */ | ||
| 259 | meth2 = DSA_OpenSSL(); | ||
| 260 | if (meth2) | ||
| 261 | { | ||
| 262 | surewarehk_dsa.dsa_do_verify = meth2->dsa_do_verify; | ||
| 263 | } | ||
| 264 | #endif | ||
| 265 | |||
| 266 | #ifndef OPENSSL_NO_DH | ||
| 267 | /* Much the same for Diffie-Hellman */ | ||
| 268 | meth3 = DH_OpenSSL(); | ||
| 269 | if (meth3) | ||
| 270 | { | ||
| 271 | surewarehk_dh.generate_key = meth3->generate_key; | ||
| 272 | surewarehk_dh.compute_key = meth3->compute_key; | ||
| 273 | } | ||
| 274 | #endif | ||
| 275 | |||
| 276 | /* Ensure the sureware error handling is set up */ | ||
| 277 | ERR_load_SUREWARE_strings(); | ||
| 278 | return 1; | ||
| 279 | } | ||
| 280 | |||
| 281 | #ifdef ENGINE_DYNAMIC_SUPPORT | ||
| 282 | static int bind_helper(ENGINE *e, const char *id) | ||
| 283 | { | ||
| 284 | if(id && (strcmp(id, engine_sureware_id) != 0)) | ||
| 285 | return 0; | ||
| 286 | if(!bind_sureware(e)) | ||
| 287 | return 0; | ||
| 288 | return 1; | ||
| 289 | } | ||
| 290 | IMPLEMENT_DYNAMIC_CHECK_FN() | ||
| 291 | IMPLEMENT_DYNAMIC_BIND_FN(bind_helper) | ||
| 292 | #else | ||
| 293 | static ENGINE *engine_sureware(void) | ||
| 294 | { | ||
| 295 | ENGINE *ret = ENGINE_new(); | ||
| 296 | if(!ret) | ||
| 297 | return NULL; | ||
| 298 | if(!bind_sureware(ret)) | ||
| 299 | { | ||
| 300 | ENGINE_free(ret); | ||
| 301 | return NULL; | ||
| 302 | } | ||
| 303 | return ret; | ||
| 304 | } | ||
| 305 | |||
| 306 | void ENGINE_load_sureware(void) | ||
| 307 | { | ||
| 308 | /* Copied from eng_[openssl|dyn].c */ | ||
| 309 | ENGINE *toadd = engine_sureware(); | ||
| 310 | if(!toadd) return; | ||
| 311 | ENGINE_add(toadd); | ||
| 312 | ENGINE_free(toadd); | ||
| 313 | ERR_clear_error(); | ||
| 314 | } | ||
| 315 | #endif | ||
| 316 | |||
| 317 | /* This is a process-global DSO handle used for loading and unloading | ||
| 318 | * the SureWareHook library. NB: This is only set (or unset) during an | ||
| 319 | * init() or finish() call (reference counts permitting) and they're | ||
| 320 | * operating with global locks, so this should be thread-safe | ||
| 321 | * implicitly. */ | ||
| 322 | static DSO *surewarehk_dso = NULL; | ||
| 323 | #ifndef OPENSSL_NO_RSA | ||
| 324 | static int rsaHndidx = -1; /* Index for KM handle. Not really used yet. */ | ||
| 325 | #endif | ||
| 326 | #ifndef OPENSSL_NO_DSA | ||
| 327 | static int dsaHndidx = -1; /* Index for KM handle. Not really used yet. */ | ||
| 328 | #endif | ||
| 329 | |||
| 330 | /* These are the function pointers that are (un)set when the library has | ||
| 331 | * successfully (un)loaded. */ | ||
| 332 | static SureWareHook_Init_t *p_surewarehk_Init = NULL; | ||
| 333 | static SureWareHook_Finish_t *p_surewarehk_Finish = NULL; | ||
| 334 | static SureWareHook_Rand_Bytes_t *p_surewarehk_Rand_Bytes = NULL; | ||
| 335 | static SureWareHook_Rand_Seed_t *p_surewarehk_Rand_Seed = NULL; | ||
| 336 | static SureWareHook_Load_Privkey_t *p_surewarehk_Load_Privkey = NULL; | ||
| 337 | static SureWareHook_Info_Pubkey_t *p_surewarehk_Info_Pubkey = NULL; | ||
| 338 | static SureWareHook_Load_Rsa_Pubkey_t *p_surewarehk_Load_Rsa_Pubkey = NULL; | ||
| 339 | static SureWareHook_Load_Dsa_Pubkey_t *p_surewarehk_Load_Dsa_Pubkey = NULL; | ||
| 340 | static SureWareHook_Free_t *p_surewarehk_Free=NULL; | ||
| 341 | static SureWareHook_Rsa_Priv_Dec_t *p_surewarehk_Rsa_Priv_Dec=NULL; | ||
| 342 | static SureWareHook_Rsa_Sign_t *p_surewarehk_Rsa_Sign=NULL; | ||
| 343 | static SureWareHook_Dsa_Sign_t *p_surewarehk_Dsa_Sign=NULL; | ||
| 344 | static SureWareHook_Mod_Exp_t *p_surewarehk_Mod_Exp=NULL; | ||
| 345 | |||
| 346 | /* Used in the DSO operations. */ | ||
| 347 | static const char *surewarehk_LIBNAME = "SureWareHook"; | ||
| 348 | static const char *n_surewarehk_Init = "SureWareHook_Init"; | ||
| 349 | static const char *n_surewarehk_Finish = "SureWareHook_Finish"; | ||
| 350 | static const char *n_surewarehk_Rand_Bytes="SureWareHook_Rand_Bytes"; | ||
| 351 | static const char *n_surewarehk_Rand_Seed="SureWareHook_Rand_Seed"; | ||
| 352 | static const char *n_surewarehk_Load_Privkey="SureWareHook_Load_Privkey"; | ||
| 353 | static const char *n_surewarehk_Info_Pubkey="SureWareHook_Info_Pubkey"; | ||
| 354 | static const char *n_surewarehk_Load_Rsa_Pubkey="SureWareHook_Load_Rsa_Pubkey"; | ||
| 355 | static const char *n_surewarehk_Load_Dsa_Pubkey="SureWareHook_Load_Dsa_Pubkey"; | ||
| 356 | static const char *n_surewarehk_Free="SureWareHook_Free"; | ||
| 357 | static const char *n_surewarehk_Rsa_Priv_Dec="SureWareHook_Rsa_Priv_Dec"; | ||
| 358 | static const char *n_surewarehk_Rsa_Sign="SureWareHook_Rsa_Sign"; | ||
| 359 | static const char *n_surewarehk_Dsa_Sign="SureWareHook_Dsa_Sign"; | ||
| 360 | static const char *n_surewarehk_Mod_Exp="SureWareHook_Mod_Exp"; | ||
| 361 | static BIO *logstream = NULL; | ||
| 362 | |||
| 363 | /* SureWareHook library functions and mechanics - these are used by the | ||
| 364 | * higher-level functions further down. NB: As and where there's no | ||
| 365 | * error checking, take a look lower down where these functions are | ||
| 366 | * called, the checking and error handling is probably down there. | ||
| 367 | */ | ||
| 368 | static int threadsafe=1; | ||
| 369 | static int surewarehk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | ||
| 370 | { | ||
| 371 | int to_return = 1; | ||
| 372 | |||
| 373 | switch(cmd) | ||
| 374 | { | ||
| 375 | case ENGINE_CTRL_SET_LOGSTREAM: | ||
| 376 | { | ||
| 377 | BIO *bio = (BIO *)p; | ||
| 378 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 379 | if (logstream) | ||
| 380 | { | ||
| 381 | BIO_free(logstream); | ||
| 382 | logstream = NULL; | ||
| 383 | } | ||
| 384 | if (CRYPTO_add(&bio->references,1,CRYPTO_LOCK_BIO) > 1) | ||
| 385 | logstream = bio; | ||
| 386 | else | ||
| 387 | SUREWAREerr(SUREWARE_F_SUREWAREHK_CTRL,SUREWARE_R_BIO_WAS_FREED); | ||
| 388 | } | ||
| 389 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 390 | break; | ||
| 391 | /* This will prevent the initialisation function from "installing" | ||
| 392 | * the mutex-handling callbacks, even if they are available from | ||
| 393 | * within the library (or were provided to the library from the | ||
| 394 | * calling application). This is to remove any baggage for | ||
| 395 | * applications not using multithreading. */ | ||
| 396 | case ENGINE_CTRL_CHIL_NO_LOCKING: | ||
| 397 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 398 | threadsafe = 0; | ||
| 399 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 400 | break; | ||
| 401 | |||
| 402 | /* The command isn't understood by this engine */ | ||
| 403 | default: | ||
| 404 | SUREWAREerr(SUREWARE_F_SUREWAREHK_CTRL, | ||
| 405 | ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED); | ||
| 406 | to_return = 0; | ||
| 407 | break; | ||
| 408 | } | ||
| 409 | |||
| 410 | return to_return; | ||
| 411 | } | ||
| 412 | |||
| 413 | /* Destructor (complements the "ENGINE_surewarehk()" constructor) */ | ||
| 414 | static int surewarehk_destroy(ENGINE *e) | ||
| 415 | { | ||
| 416 | ERR_unload_SUREWARE_strings(); | ||
| 417 | return 1; | ||
| 418 | } | ||
| 419 | |||
| 420 | /* (de)initialisation functions. */ | ||
| 421 | static int surewarehk_init(ENGINE *e) | ||
| 422 | { | ||
| 423 | char msg[64]="ENGINE_init"; | ||
| 424 | SureWareHook_Init_t *p1=NULL; | ||
| 425 | SureWareHook_Finish_t *p2=NULL; | ||
| 426 | SureWareHook_Rand_Bytes_t *p3=NULL; | ||
| 427 | SureWareHook_Rand_Seed_t *p4=NULL; | ||
| 428 | SureWareHook_Load_Privkey_t *p5=NULL; | ||
| 429 | SureWareHook_Load_Rsa_Pubkey_t *p6=NULL; | ||
| 430 | SureWareHook_Free_t *p7=NULL; | ||
| 431 | SureWareHook_Rsa_Priv_Dec_t *p8=NULL; | ||
| 432 | SureWareHook_Rsa_Sign_t *p9=NULL; | ||
| 433 | SureWareHook_Dsa_Sign_t *p12=NULL; | ||
| 434 | SureWareHook_Info_Pubkey_t *p13=NULL; | ||
| 435 | SureWareHook_Load_Dsa_Pubkey_t *p14=NULL; | ||
| 436 | SureWareHook_Mod_Exp_t *p15=NULL; | ||
| 437 | |||
| 438 | if(surewarehk_dso != NULL) | ||
| 439 | { | ||
| 440 | SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,ENGINE_R_ALREADY_LOADED); | ||
| 441 | goto err; | ||
| 442 | } | ||
| 443 | /* Attempt to load libsurewarehk.so/surewarehk.dll/whatever. */ | ||
| 444 | surewarehk_dso = DSO_load(NULL, surewarehk_LIBNAME, NULL, 0); | ||
| 445 | if(surewarehk_dso == NULL) | ||
| 446 | { | ||
| 447 | SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,ENGINE_R_DSO_FAILURE); | ||
| 448 | goto err; | ||
| 449 | } | ||
| 450 | if(!(p1=(SureWareHook_Init_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Init)) || | ||
| 451 | !(p2=(SureWareHook_Finish_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Finish)) || | ||
| 452 | !(p3=(SureWareHook_Rand_Bytes_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rand_Bytes)) || | ||
| 453 | !(p4=(SureWareHook_Rand_Seed_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rand_Seed)) || | ||
| 454 | !(p5=(SureWareHook_Load_Privkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Load_Privkey)) || | ||
| 455 | !(p6=(SureWareHook_Load_Rsa_Pubkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Load_Rsa_Pubkey)) || | ||
| 456 | !(p7=(SureWareHook_Free_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Free)) || | ||
| 457 | !(p8=(SureWareHook_Rsa_Priv_Dec_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rsa_Priv_Dec)) || | ||
| 458 | !(p9=(SureWareHook_Rsa_Sign_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rsa_Sign)) || | ||
| 459 | !(p12=(SureWareHook_Dsa_Sign_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Dsa_Sign)) || | ||
| 460 | !(p13=(SureWareHook_Info_Pubkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Info_Pubkey)) || | ||
| 461 | !(p14=(SureWareHook_Load_Dsa_Pubkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Load_Dsa_Pubkey)) || | ||
| 462 | !(p15=(SureWareHook_Mod_Exp_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Mod_Exp))) | ||
| 463 | { | ||
| 464 | SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,ENGINE_R_DSO_FAILURE); | ||
| 465 | goto err; | ||
| 466 | } | ||
| 467 | /* Copy the pointers */ | ||
| 468 | p_surewarehk_Init = p1; | ||
| 469 | p_surewarehk_Finish = p2; | ||
| 470 | p_surewarehk_Rand_Bytes = p3; | ||
| 471 | p_surewarehk_Rand_Seed = p4; | ||
| 472 | p_surewarehk_Load_Privkey = p5; | ||
| 473 | p_surewarehk_Load_Rsa_Pubkey = p6; | ||
| 474 | p_surewarehk_Free = p7; | ||
| 475 | p_surewarehk_Rsa_Priv_Dec = p8; | ||
| 476 | p_surewarehk_Rsa_Sign = p9; | ||
| 477 | p_surewarehk_Dsa_Sign = p12; | ||
| 478 | p_surewarehk_Info_Pubkey = p13; | ||
| 479 | p_surewarehk_Load_Dsa_Pubkey = p14; | ||
| 480 | p_surewarehk_Mod_Exp = p15; | ||
| 481 | /* Contact the hardware and initialises it. */ | ||
| 482 | if(p_surewarehk_Init(msg,threadsafe)==SUREWAREHOOK_ERROR_UNIT_FAILURE) | ||
| 483 | { | ||
| 484 | SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,SUREWARE_R_UNIT_FAILURE); | ||
| 485 | goto err; | ||
| 486 | } | ||
| 487 | if(p_surewarehk_Init(msg,threadsafe)==SUREWAREHOOK_ERROR_UNIT_FAILURE) | ||
| 488 | { | ||
| 489 | SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,SUREWARE_R_UNIT_FAILURE); | ||
| 490 | goto err; | ||
| 491 | } | ||
| 492 | /* try to load the default private key, if failed does not return a failure but | ||
| 493 | wait for an explicit ENGINE_load_privakey */ | ||
| 494 | surewarehk_load_privkey(e,NULL,NULL,NULL); | ||
| 495 | |||
| 496 | /* Everything's fine. */ | ||
| 497 | #ifndef OPENSSL_NO_RSA | ||
| 498 | if (rsaHndidx == -1) | ||
| 499 | rsaHndidx = RSA_get_ex_new_index(0, | ||
| 500 | "SureWareHook RSA key handle", | ||
| 501 | NULL, NULL, surewarehk_ex_free); | ||
| 502 | #endif | ||
| 503 | #ifndef OPENSSL_NO_DSA | ||
| 504 | if (dsaHndidx == -1) | ||
| 505 | dsaHndidx = DSA_get_ex_new_index(0, | ||
| 506 | "SureWareHook DSA key handle", | ||
| 507 | NULL, NULL, surewarehk_ex_free); | ||
| 508 | #endif | ||
| 509 | |||
| 510 | return 1; | ||
| 511 | err: | ||
| 512 | if(surewarehk_dso) | ||
| 513 | DSO_free(surewarehk_dso); | ||
| 514 | surewarehk_dso = NULL; | ||
| 515 | p_surewarehk_Init = NULL; | ||
| 516 | p_surewarehk_Finish = NULL; | ||
| 517 | p_surewarehk_Rand_Bytes = NULL; | ||
| 518 | p_surewarehk_Rand_Seed = NULL; | ||
| 519 | p_surewarehk_Load_Privkey = NULL; | ||
| 520 | p_surewarehk_Load_Rsa_Pubkey = NULL; | ||
| 521 | p_surewarehk_Free = NULL; | ||
| 522 | p_surewarehk_Rsa_Priv_Dec = NULL; | ||
| 523 | p_surewarehk_Rsa_Sign = NULL; | ||
| 524 | p_surewarehk_Dsa_Sign = NULL; | ||
| 525 | p_surewarehk_Info_Pubkey = NULL; | ||
| 526 | p_surewarehk_Load_Dsa_Pubkey = NULL; | ||
| 527 | p_surewarehk_Mod_Exp = NULL; | ||
| 528 | return 0; | ||
| 529 | } | ||
| 530 | |||
| 531 | static int surewarehk_finish(ENGINE *e) | ||
| 532 | { | ||
| 533 | int to_return = 1; | ||
| 534 | if(surewarehk_dso == NULL) | ||
| 535 | { | ||
| 536 | SUREWAREerr(SUREWARE_F_SUREWAREHK_FINISH,ENGINE_R_NOT_LOADED); | ||
| 537 | to_return = 0; | ||
| 538 | goto err; | ||
| 539 | } | ||
| 540 | p_surewarehk_Finish(); | ||
| 541 | if(!DSO_free(surewarehk_dso)) | ||
| 542 | { | ||
| 543 | SUREWAREerr(SUREWARE_F_SUREWAREHK_FINISH,ENGINE_R_DSO_FAILURE); | ||
| 544 | to_return = 0; | ||
| 545 | goto err; | ||
| 546 | } | ||
| 547 | err: | ||
| 548 | if (logstream) | ||
| 549 | BIO_free(logstream); | ||
| 550 | surewarehk_dso = NULL; | ||
| 551 | p_surewarehk_Init = NULL; | ||
| 552 | p_surewarehk_Finish = NULL; | ||
| 553 | p_surewarehk_Rand_Bytes = NULL; | ||
| 554 | p_surewarehk_Rand_Seed = NULL; | ||
| 555 | p_surewarehk_Load_Privkey = NULL; | ||
| 556 | p_surewarehk_Load_Rsa_Pubkey = NULL; | ||
| 557 | p_surewarehk_Free = NULL; | ||
| 558 | p_surewarehk_Rsa_Priv_Dec = NULL; | ||
| 559 | p_surewarehk_Rsa_Sign = NULL; | ||
| 560 | p_surewarehk_Dsa_Sign = NULL; | ||
| 561 | p_surewarehk_Info_Pubkey = NULL; | ||
| 562 | p_surewarehk_Load_Dsa_Pubkey = NULL; | ||
| 563 | p_surewarehk_Mod_Exp = NULL; | ||
| 564 | return to_return; | ||
| 565 | } | ||
| 566 | |||
| 567 | static void surewarehk_error_handling(char *const msg,int func,int ret) | ||
| 568 | { | ||
| 569 | switch (ret) | ||
| 570 | { | ||
| 571 | case SUREWAREHOOK_ERROR_UNIT_FAILURE: | ||
| 572 | ENGINEerr(func,SUREWARE_R_UNIT_FAILURE); | ||
| 573 | break; | ||
| 574 | case SUREWAREHOOK_ERROR_FALLBACK: | ||
| 575 | ENGINEerr(func,SUREWARE_R_REQUEST_FALLBACK); | ||
| 576 | break; | ||
| 577 | case SUREWAREHOOK_ERROR_DATA_SIZE: | ||
| 578 | ENGINEerr(func,SUREWARE_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
| 579 | break; | ||
| 580 | case SUREWAREHOOK_ERROR_INVALID_PAD: | ||
| 581 | ENGINEerr(func,RSA_R_PADDING_CHECK_FAILED); | ||
| 582 | break; | ||
| 583 | default: | ||
| 584 | ENGINEerr(func,SUREWARE_R_REQUEST_FAILED); | ||
| 585 | break; | ||
| 586 | case 1:/*nothing*/ | ||
| 587 | msg[0]='\0'; | ||
| 588 | } | ||
| 589 | if (*msg) | ||
| 590 | { | ||
| 591 | ERR_add_error_data(1,msg); | ||
| 592 | if (logstream) | ||
| 593 | { | ||
| 594 | CRYPTO_w_lock(CRYPTO_LOCK_BIO); | ||
| 595 | BIO_write(logstream, msg, strlen(msg)); | ||
| 596 | CRYPTO_w_unlock(CRYPTO_LOCK_BIO); | ||
| 597 | } | ||
| 598 | } | ||
| 599 | } | ||
| 600 | |||
| 601 | static int surewarehk_rand_bytes(unsigned char *buf, int num) | ||
| 602 | { | ||
| 603 | int ret=0; | ||
| 604 | char msg[64]="ENGINE_rand_bytes"; | ||
| 605 | if(!p_surewarehk_Rand_Bytes) | ||
| 606 | { | ||
| 607 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RAND_BYTES,ENGINE_R_NOT_INITIALISED); | ||
| 608 | } | ||
| 609 | else | ||
| 610 | { | ||
| 611 | ret = p_surewarehk_Rand_Bytes(msg,buf, num); | ||
| 612 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RAND_BYTES,ret); | ||
| 613 | } | ||
| 614 | return ret==1 ? 1 : 0; | ||
| 615 | } | ||
| 616 | |||
| 617 | static void surewarehk_rand_seed(const void *buf, int num) | ||
| 618 | { | ||
| 619 | int ret=0; | ||
| 620 | char msg[64]="ENGINE_rand_seed"; | ||
| 621 | if(!p_surewarehk_Rand_Seed) | ||
| 622 | { | ||
| 623 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RAND_SEED,ENGINE_R_NOT_INITIALISED); | ||
| 624 | } | ||
| 625 | else | ||
| 626 | { | ||
| 627 | ret = p_surewarehk_Rand_Seed(msg,buf, num); | ||
| 628 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RAND_SEED,ret); | ||
| 629 | } | ||
| 630 | } | ||
| 631 | |||
| 632 | static void surewarehk_rand_add(const void *buf, int num, double entropy) | ||
| 633 | { | ||
| 634 | surewarehk_rand_seed(buf,num); | ||
| 635 | } | ||
| 636 | |||
| 637 | static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype) | ||
| 638 | { | ||
| 639 | EVP_PKEY *res = NULL; | ||
| 640 | #ifndef OPENSSL_NO_RSA | ||
| 641 | RSA *rsatmp = NULL; | ||
| 642 | #endif | ||
| 643 | #ifndef OPENSSL_NO_DSA | ||
| 644 | DSA *dsatmp=NULL; | ||
| 645 | #endif | ||
| 646 | char msg[64]="sureware_load_public"; | ||
| 647 | int ret=0; | ||
| 648 | if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey) | ||
| 649 | { | ||
| 650 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_NOT_INITIALISED); | ||
| 651 | goto err; | ||
| 652 | } | ||
| 653 | switch (keytype) | ||
| 654 | { | ||
| 655 | #ifndef OPENSSL_NO_RSA | ||
| 656 | case 1: /*RSA*/ | ||
| 657 | /* set private external reference */ | ||
| 658 | rsatmp = RSA_new_method(e); | ||
| 659 | RSA_set_ex_data(rsatmp,rsaHndidx,hptr); | ||
| 660 | rsatmp->flags |= RSA_FLAG_EXT_PKEY; | ||
| 661 | |||
| 662 | /* set public big nums*/ | ||
| 663 | rsatmp->e = BN_new(); | ||
| 664 | rsatmp->n = BN_new(); | ||
| 665 | bn_expand2(rsatmp->e, el/sizeof(BN_ULONG)); | ||
| 666 | bn_expand2(rsatmp->n, el/sizeof(BN_ULONG)); | ||
| 667 | if (!rsatmp->e || rsatmp->e->dmax!=(int)(el/sizeof(BN_ULONG))|| | ||
| 668 | !rsatmp->n || rsatmp->n->dmax!=(int)(el/sizeof(BN_ULONG))) | ||
| 669 | goto err; | ||
| 670 | ret=p_surewarehk_Load_Rsa_Pubkey(msg,key_id,el, | ||
| 671 | (unsigned long *)rsatmp->n->d, | ||
| 672 | (unsigned long *)rsatmp->e->d); | ||
| 673 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ret); | ||
| 674 | if (ret!=1) | ||
| 675 | { | ||
| 676 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PUBLIC_KEY); | ||
| 677 | goto err; | ||
| 678 | } | ||
| 679 | /* normalise pub e and pub n */ | ||
| 680 | rsatmp->e->top=el/sizeof(BN_ULONG); | ||
| 681 | bn_fix_top(rsatmp->e); | ||
| 682 | rsatmp->n->top=el/sizeof(BN_ULONG); | ||
| 683 | bn_fix_top(rsatmp->n); | ||
| 684 | /* create an EVP object: engine + rsa key */ | ||
| 685 | res = EVP_PKEY_new(); | ||
| 686 | EVP_PKEY_assign_RSA(res, rsatmp); | ||
| 687 | break; | ||
| 688 | #endif | ||
| 689 | |||
| 690 | #ifndef OPENSSL_NO_DSA | ||
| 691 | case 2:/*DSA*/ | ||
| 692 | /* set private/public external reference */ | ||
| 693 | dsatmp = DSA_new_method(e); | ||
| 694 | DSA_set_ex_data(dsatmp,dsaHndidx,hptr); | ||
| 695 | /*dsatmp->flags |= DSA_FLAG_EXT_PKEY;*/ | ||
| 696 | |||
| 697 | /* set public key*/ | ||
| 698 | dsatmp->pub_key = BN_new(); | ||
| 699 | dsatmp->p = BN_new(); | ||
| 700 | dsatmp->q = BN_new(); | ||
| 701 | dsatmp->g = BN_new(); | ||
| 702 | bn_expand2(dsatmp->pub_key, el/sizeof(BN_ULONG)); | ||
| 703 | bn_expand2(dsatmp->p, el/sizeof(BN_ULONG)); | ||
| 704 | bn_expand2(dsatmp->q, 20/sizeof(BN_ULONG)); | ||
| 705 | bn_expand2(dsatmp->g, el/sizeof(BN_ULONG)); | ||
| 706 | if (!dsatmp->pub_key || dsatmp->pub_key->dmax!=(int)(el/sizeof(BN_ULONG))|| | ||
| 707 | !dsatmp->p || dsatmp->p->dmax!=(int)(el/sizeof(BN_ULONG)) || | ||
| 708 | !dsatmp->q || dsatmp->q->dmax!=20/sizeof(BN_ULONG) || | ||
| 709 | !dsatmp->g || dsatmp->g->dmax!=(int)(el/sizeof(BN_ULONG))) | ||
| 710 | goto err; | ||
| 711 | |||
| 712 | ret=p_surewarehk_Load_Dsa_Pubkey(msg,key_id,el, | ||
| 713 | (unsigned long *)dsatmp->pub_key->d, | ||
| 714 | (unsigned long *)dsatmp->p->d, | ||
| 715 | (unsigned long *)dsatmp->q->d, | ||
| 716 | (unsigned long *)dsatmp->g->d); | ||
| 717 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ret); | ||
| 718 | if (ret!=1) | ||
| 719 | { | ||
| 720 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PUBLIC_KEY); | ||
| 721 | goto err; | ||
| 722 | } | ||
| 723 | /* set parameters */ | ||
| 724 | /* normalise pubkey and parameters in case of */ | ||
| 725 | dsatmp->pub_key->top=el/sizeof(BN_ULONG); | ||
| 726 | bn_fix_top(dsatmp->pub_key); | ||
| 727 | dsatmp->p->top=el/sizeof(BN_ULONG); | ||
| 728 | bn_fix_top(dsatmp->p); | ||
| 729 | dsatmp->q->top=20/sizeof(BN_ULONG); | ||
| 730 | bn_fix_top(dsatmp->q); | ||
| 731 | dsatmp->g->top=el/sizeof(BN_ULONG); | ||
| 732 | bn_fix_top(dsatmp->g); | ||
| 733 | |||
| 734 | /* create an EVP object: engine + rsa key */ | ||
| 735 | res = EVP_PKEY_new(); | ||
| 736 | EVP_PKEY_assign_DSA(res, dsatmp); | ||
| 737 | break; | ||
| 738 | #endif | ||
| 739 | |||
| 740 | default: | ||
| 741 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PRIVATE_KEY); | ||
| 742 | goto err; | ||
| 743 | } | ||
| 744 | return res; | ||
| 745 | err: | ||
| 746 | if (res) | ||
| 747 | EVP_PKEY_free(res); | ||
| 748 | #ifndef OPENSSL_NO_RSA | ||
| 749 | if (rsatmp) | ||
| 750 | RSA_free(rsatmp); | ||
| 751 | #endif | ||
| 752 | #ifndef OPENSSL_NO_DSA | ||
| 753 | if (dsatmp) | ||
| 754 | DSA_free(dsatmp); | ||
| 755 | #endif | ||
| 756 | return NULL; | ||
| 757 | } | ||
| 758 | |||
| 759 | static EVP_PKEY *surewarehk_load_privkey(ENGINE *e, const char *key_id, | ||
| 760 | UI_METHOD *ui_method, void *callback_data) | ||
| 761 | { | ||
| 762 | EVP_PKEY *res = NULL; | ||
| 763 | int ret=0; | ||
| 764 | unsigned long el=0; | ||
| 765 | char *hptr=NULL; | ||
| 766 | char keytype=0; | ||
| 767 | char msg[64]="ENGINE_load_privkey"; | ||
| 768 | |||
| 769 | if(!p_surewarehk_Load_Privkey) | ||
| 770 | { | ||
| 771 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_NOT_INITIALISED); | ||
| 772 | } | ||
| 773 | else | ||
| 774 | { | ||
| 775 | ret=p_surewarehk_Load_Privkey(msg,key_id,&hptr,&el,&keytype); | ||
| 776 | if (ret!=1) | ||
| 777 | { | ||
| 778 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PRIVATE_KEY); | ||
| 779 | ERR_add_error_data(1,msg); | ||
| 780 | } | ||
| 781 | else | ||
| 782 | res=sureware_load_public(e,key_id,hptr,el,keytype); | ||
| 783 | } | ||
| 784 | return res; | ||
| 785 | } | ||
| 786 | |||
| 787 | static EVP_PKEY *surewarehk_load_pubkey(ENGINE *e, const char *key_id, | ||
| 788 | UI_METHOD *ui_method, void *callback_data) | ||
| 789 | { | ||
| 790 | EVP_PKEY *res = NULL; | ||
| 791 | int ret=0; | ||
| 792 | unsigned long el=0; | ||
| 793 | char *hptr=NULL; | ||
| 794 | char keytype=0; | ||
| 795 | char msg[64]="ENGINE_load_pubkey"; | ||
| 796 | |||
| 797 | if(!p_surewarehk_Info_Pubkey) | ||
| 798 | { | ||
| 799 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_NOT_INITIALISED); | ||
| 800 | } | ||
| 801 | else | ||
| 802 | { | ||
| 803 | /* call once to identify if DSA or RSA */ | ||
| 804 | ret=p_surewarehk_Info_Pubkey(msg,key_id,&el,&keytype); | ||
| 805 | if (ret!=1) | ||
| 806 | { | ||
| 807 | SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_FAILED_LOADING_PUBLIC_KEY); | ||
| 808 | ERR_add_error_data(1,msg); | ||
| 809 | } | ||
| 810 | else | ||
| 811 | res=sureware_load_public(e,key_id,hptr,el,keytype); | ||
| 812 | } | ||
| 813 | return res; | ||
| 814 | } | ||
| 815 | |||
| 816 | /* This cleans up an RSA/DSA KM key(do not destroy the key into the hardware) | ||
| 817 | , called when ex_data is freed */ | ||
| 818 | static void surewarehk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
| 819 | int idx,long argl, void *argp) | ||
| 820 | { | ||
| 821 | if(!p_surewarehk_Free) | ||
| 822 | { | ||
| 823 | SUREWAREerr(SUREWARE_F_SUREWAREHK_EX_FREE,ENGINE_R_NOT_INITIALISED); | ||
| 824 | } | ||
| 825 | else | ||
| 826 | p_surewarehk_Free((char *)item,0); | ||
| 827 | } | ||
| 828 | |||
| 829 | #if 0 | ||
| 830 | /* This cleans up an DH KM key (destroys the key into hardware), | ||
| 831 | called when ex_data is freed */ | ||
| 832 | static void surewarehk_dh_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, | ||
| 833 | int idx,long argl, void *argp) | ||
| 834 | { | ||
| 835 | if(!p_surewarehk_Free) | ||
| 836 | { | ||
| 837 | SUREWAREerr(SUREWARE_F_SUREWAREHK_EX_FREE,ENGINE_R_NOT_INITIALISED); | ||
| 838 | } | ||
| 839 | else | ||
| 840 | p_surewarehk_Free((char *)item,1); | ||
| 841 | } | ||
| 842 | #endif | ||
| 843 | |||
| 844 | /* | ||
| 845 | * return number of decrypted bytes | ||
| 846 | */ | ||
| 847 | #ifndef OPENSSL_NO_RSA | ||
| 848 | static int surewarehk_rsa_priv_dec(int flen,const unsigned char *from,unsigned char *to, | ||
| 849 | RSA *rsa,int padding) | ||
| 850 | { | ||
| 851 | int ret=0,tlen; | ||
| 852 | char *buf=NULL,*hptr=NULL; | ||
| 853 | char msg[64]="ENGINE_rsa_priv_dec"; | ||
| 854 | if (!p_surewarehk_Rsa_Priv_Dec) | ||
| 855 | { | ||
| 856 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ENGINE_R_NOT_INITIALISED); | ||
| 857 | } | ||
| 858 | /* extract ref to private key */ | ||
| 859 | else if (!(hptr=RSA_get_ex_data(rsa, rsaHndidx))) | ||
| 860 | { | ||
| 861 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,SUREWARE_R_MISSING_KEY_COMPONENTS); | ||
| 862 | goto err; | ||
| 863 | } | ||
| 864 | /* analyse what padding we can do into the hardware */ | ||
| 865 | if (padding==RSA_PKCS1_PADDING) | ||
| 866 | { | ||
| 867 | /* do it one shot */ | ||
| 868 | ret=p_surewarehk_Rsa_Priv_Dec(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_PKCS1_PAD); | ||
| 869 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ret); | ||
| 870 | if (ret!=1) | ||
| 871 | goto err; | ||
| 872 | ret=tlen; | ||
| 873 | } | ||
| 874 | else /* do with no padding into hardware */ | ||
| 875 | { | ||
| 876 | ret=p_surewarehk_Rsa_Priv_Dec(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_NO_PAD); | ||
| 877 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ret); | ||
| 878 | if (ret!=1) | ||
| 879 | goto err; | ||
| 880 | /* intermediate buffer for padding */ | ||
| 881 | if ((buf=OPENSSL_malloc(tlen)) == NULL) | ||
| 882 | { | ||
| 883 | RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ERR_R_MALLOC_FAILURE); | ||
| 884 | goto err; | ||
| 885 | } | ||
| 886 | memcpy(buf,to,tlen);/* transfert to into buf */ | ||
| 887 | switch (padding) /* check padding in software */ | ||
| 888 | { | ||
| 889 | #ifndef OPENSSL_NO_SHA | ||
| 890 | case RSA_PKCS1_OAEP_PADDING: | ||
| 891 | ret=RSA_padding_check_PKCS1_OAEP(to,tlen,(unsigned char *)buf,tlen,tlen,NULL,0); | ||
| 892 | break; | ||
| 893 | #endif | ||
| 894 | case RSA_SSLV23_PADDING: | ||
| 895 | ret=RSA_padding_check_SSLv23(to,tlen,(unsigned char *)buf,flen,tlen); | ||
| 896 | break; | ||
| 897 | case RSA_NO_PADDING: | ||
| 898 | ret=RSA_padding_check_none(to,tlen,(unsigned char *)buf,flen,tlen); | ||
| 899 | break; | ||
| 900 | default: | ||
| 901 | RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,RSA_R_UNKNOWN_PADDING_TYPE); | ||
| 902 | goto err; | ||
| 903 | } | ||
| 904 | if (ret < 0) | ||
| 905 | RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,RSA_R_PADDING_CHECK_FAILED); | ||
| 906 | } | ||
| 907 | err: | ||
| 908 | if (buf) | ||
| 909 | { | ||
| 910 | OPENSSL_cleanse(buf,tlen); | ||
| 911 | OPENSSL_free(buf); | ||
| 912 | } | ||
| 913 | return ret; | ||
| 914 | } | ||
| 915 | |||
| 916 | /* | ||
| 917 | * Does what OpenSSL rsa_priv_enc does. | ||
| 918 | */ | ||
| 919 | static int surewarehk_rsa_sign(int flen,const unsigned char *from,unsigned char *to, | ||
| 920 | RSA *rsa,int padding) | ||
| 921 | { | ||
| 922 | int ret=0,tlen; | ||
| 923 | char *hptr=NULL; | ||
| 924 | char msg[64]="ENGINE_rsa_sign"; | ||
| 925 | if (!p_surewarehk_Rsa_Sign) | ||
| 926 | { | ||
| 927 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,ENGINE_R_NOT_INITIALISED); | ||
| 928 | } | ||
| 929 | /* extract ref to private key */ | ||
| 930 | else if (!(hptr=RSA_get_ex_data(rsa, rsaHndidx))) | ||
| 931 | { | ||
| 932 | SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,SUREWARE_R_MISSING_KEY_COMPONENTS); | ||
| 933 | } | ||
| 934 | else | ||
| 935 | { | ||
| 936 | switch (padding) | ||
| 937 | { | ||
| 938 | case RSA_PKCS1_PADDING: /* do it in one shot */ | ||
| 939 | ret=p_surewarehk_Rsa_Sign(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_PKCS1_PAD); | ||
| 940 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,ret); | ||
| 941 | break; | ||
| 942 | case RSA_NO_PADDING: | ||
| 943 | default: | ||
| 944 | RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,RSA_R_UNKNOWN_PADDING_TYPE); | ||
| 945 | } | ||
| 946 | } | ||
| 947 | return ret==1 ? tlen : ret; | ||
| 948 | } | ||
| 949 | |||
| 950 | #endif | ||
| 951 | |||
| 952 | #ifndef OPENSSL_NO_DSA | ||
| 953 | /* DSA sign and verify */ | ||
| 954 | static DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *from, int flen, DSA *dsa) | ||
| 955 | { | ||
| 956 | int ret=0; | ||
| 957 | char *hptr=NULL; | ||
| 958 | DSA_SIG *psign=NULL; | ||
| 959 | char msg[64]="ENGINE_dsa_do_sign"; | ||
| 960 | if (!p_surewarehk_Dsa_Sign) | ||
| 961 | { | ||
| 962 | SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ENGINE_R_NOT_INITIALISED); | ||
| 963 | } | ||
| 964 | /* extract ref to private key */ | ||
| 965 | else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx))) | ||
| 966 | { | ||
| 967 | SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS); | ||
| 968 | } | ||
| 969 | else | ||
| 970 | { | ||
| 971 | if((psign = DSA_SIG_new()) == NULL) | ||
| 972 | { | ||
| 973 | SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ERR_R_MALLOC_FAILURE); | ||
| 974 | goto err; | ||
| 975 | } | ||
| 976 | psign->r=BN_new(); | ||
| 977 | psign->s=BN_new(); | ||
| 978 | bn_expand2(psign->r, 20/sizeof(BN_ULONG)); | ||
| 979 | bn_expand2(psign->s, 20/sizeof(BN_ULONG)); | ||
| 980 | if (!psign->r || psign->r->dmax!=20/sizeof(BN_ULONG) || | ||
| 981 | !psign->s || psign->s->dmax!=20/sizeof(BN_ULONG)) | ||
| 982 | goto err; | ||
| 983 | ret=p_surewarehk_Dsa_Sign(msg,flen,from, | ||
| 984 | (unsigned long *)psign->r->d, | ||
| 985 | (unsigned long *)psign->s->d, | ||
| 986 | hptr); | ||
| 987 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ret); | ||
| 988 | } | ||
| 989 | psign->r->top=20/sizeof(BN_ULONG); | ||
| 990 | bn_fix_top(psign->r); | ||
| 991 | psign->s->top=20/sizeof(BN_ULONG); | ||
| 992 | bn_fix_top(psign->s); | ||
| 993 | |||
| 994 | err: | ||
| 995 | if (psign) | ||
| 996 | { | ||
| 997 | DSA_SIG_free(psign); | ||
| 998 | psign=NULL; | ||
| 999 | } | ||
| 1000 | return psign; | ||
| 1001 | } | ||
| 1002 | #endif | ||
| 1003 | |||
| 1004 | static int surewarehk_modexp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 1005 | const BIGNUM *m, BN_CTX *ctx) | ||
| 1006 | { | ||
| 1007 | int ret=0; | ||
| 1008 | char msg[64]="ENGINE_modexp"; | ||
| 1009 | if (!p_surewarehk_Mod_Exp) | ||
| 1010 | { | ||
| 1011 | SUREWAREerr(SUREWARE_F_SUREWAREHK_MOD_EXP,ENGINE_R_NOT_INITIALISED); | ||
| 1012 | } | ||
| 1013 | else | ||
| 1014 | { | ||
| 1015 | bn_expand2(r,m->top); | ||
| 1016 | if (r && r->dmax==m->top) | ||
| 1017 | { | ||
| 1018 | /* do it*/ | ||
| 1019 | ret=p_surewarehk_Mod_Exp(msg, | ||
| 1020 | m->top*sizeof(BN_ULONG), | ||
| 1021 | (unsigned long *)m->d, | ||
| 1022 | p->top*sizeof(BN_ULONG), | ||
| 1023 | (unsigned long *)p->d, | ||
| 1024 | a->top*sizeof(BN_ULONG), | ||
| 1025 | (unsigned long *)a->d, | ||
| 1026 | (unsigned long *)r->d); | ||
| 1027 | surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_MOD_EXP,ret); | ||
| 1028 | if (ret==1) | ||
| 1029 | { | ||
| 1030 | /* normalise result */ | ||
| 1031 | r->top=m->top; | ||
| 1032 | bn_fix_top(r); | ||
| 1033 | } | ||
| 1034 | } | ||
| 1035 | } | ||
| 1036 | return ret; | ||
| 1037 | } | ||
| 1038 | #endif /* !OPENSSL_NO_HW_SureWare */ | ||
| 1039 | #endif /* !OPENSSL_NO_HW */ | ||
diff --git a/src/lib/libcrypto/engine/hw_sureware_err.c b/src/lib/libcrypto/engine/hw_sureware_err.c deleted file mode 100644 index 69955dadbb..0000000000 --- a/src/lib/libcrypto/engine/hw_sureware_err.c +++ /dev/null | |||
| @@ -1,150 +0,0 @@ | |||
| 1 | /* hw_sureware_err.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 | /* 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 "hw_sureware_err.h" | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | static ERR_STRING_DATA SUREWARE_str_functs[]= | ||
| 68 | { | ||
| 69 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_CTRL,0), "SUREWAREHK_CTRL"}, | ||
| 70 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,0), "SUREWAREHK_DSA_DO_SIGN"}, | ||
| 71 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_EX_FREE,0), "SUREWAREHK_EX_FREE"}, | ||
| 72 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_FINISH,0), "SUREWAREHK_FINISH"}, | ||
| 73 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_INIT,0), "SUREWAREHK_INIT"}, | ||
| 74 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,0), "SUREWAREHK_LOAD_PRIVATE_KEY"}, | ||
| 75 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,0), "SUREWAREHK_LOAD_PUBLIC_KEY"}, | ||
| 76 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_MOD_EXP,0), "SUREWAREHK_MOD_EXP"}, | ||
| 77 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_RAND_BYTES,0), "SUREWAREHK_RAND_BYTES"}, | ||
| 78 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_RAND_SEED,0), "SUREWAREHK_RAND_SEED"}, | ||
| 79 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,0), "SUREWAREHK_RSA_PRIV_DEC"}, | ||
| 80 | {ERR_PACK(0,SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,0), "SUREWAREHK_RSA_PRIV_ENC"}, | ||
| 81 | {0,NULL} | ||
| 82 | }; | ||
| 83 | |||
| 84 | static ERR_STRING_DATA SUREWARE_str_reasons[]= | ||
| 85 | { | ||
| 86 | {SUREWARE_R_BIO_WAS_FREED ,"bio was freed"}, | ||
| 87 | {SUREWARE_R_MISSING_KEY_COMPONENTS ,"missing key components"}, | ||
| 88 | {SUREWARE_R_REQUEST_FAILED ,"request failed"}, | ||
| 89 | {SUREWARE_R_REQUEST_FALLBACK ,"request fallback"}, | ||
| 90 | {SUREWARE_R_SIZE_TOO_LARGE_OR_TOO_SMALL ,"size too large or too small"}, | ||
| 91 | {SUREWARE_R_UNIT_FAILURE ,"unit failure"}, | ||
| 92 | {0,NULL} | ||
| 93 | }; | ||
| 94 | |||
| 95 | #endif | ||
| 96 | |||
| 97 | #ifdef SUREWARE_LIB_NAME | ||
| 98 | static ERR_STRING_DATA SUREWARE_lib_name[]= | ||
| 99 | { | ||
| 100 | {0 ,SUREWARE_LIB_NAME}, | ||
| 101 | {0,NULL} | ||
| 102 | }; | ||
| 103 | #endif | ||
| 104 | |||
| 105 | |||
| 106 | static int SUREWARE_lib_error_code=0; | ||
| 107 | static int SUREWARE_error_init=1; | ||
| 108 | |||
| 109 | static void ERR_load_SUREWARE_strings(void) | ||
| 110 | { | ||
| 111 | if (SUREWARE_lib_error_code == 0) | ||
| 112 | SUREWARE_lib_error_code=ERR_get_next_error_library(); | ||
| 113 | |||
| 114 | if (SUREWARE_error_init) | ||
| 115 | { | ||
| 116 | SUREWARE_error_init=0; | ||
| 117 | #ifndef OPENSSL_NO_ERR | ||
| 118 | ERR_load_strings(SUREWARE_lib_error_code,SUREWARE_str_functs); | ||
| 119 | ERR_load_strings(SUREWARE_lib_error_code,SUREWARE_str_reasons); | ||
| 120 | #endif | ||
| 121 | |||
| 122 | #ifdef SUREWARE_LIB_NAME | ||
| 123 | SUREWARE_lib_name->error = ERR_PACK(SUREWARE_lib_error_code,0,0); | ||
| 124 | ERR_load_strings(0,SUREWARE_lib_name); | ||
| 125 | #endif | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | static void ERR_unload_SUREWARE_strings(void) | ||
| 130 | { | ||
| 131 | if (SUREWARE_error_init == 0) | ||
| 132 | { | ||
| 133 | #ifndef OPENSSL_NO_ERR | ||
| 134 | ERR_unload_strings(SUREWARE_lib_error_code,SUREWARE_str_functs); | ||
| 135 | ERR_unload_strings(SUREWARE_lib_error_code,SUREWARE_str_reasons); | ||
| 136 | #endif | ||
| 137 | |||
| 138 | #ifdef SUREWARE_LIB_NAME | ||
| 139 | ERR_unload_strings(0,SUREWARE_lib_name); | ||
| 140 | #endif | ||
| 141 | SUREWARE_error_init=1; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | |||
| 145 | static void ERR_SUREWARE_error(int function, int reason, char *file, int line) | ||
| 146 | { | ||
| 147 | if (SUREWARE_lib_error_code == 0) | ||
| 148 | SUREWARE_lib_error_code=ERR_get_next_error_library(); | ||
| 149 | ERR_PUT_error(SUREWARE_lib_error_code,function,reason,file,line); | ||
| 150 | } | ||
diff --git a/src/lib/libcrypto/engine/hw_sureware_err.h b/src/lib/libcrypto/engine/hw_sureware_err.h deleted file mode 100644 index bc52af5e05..0000000000 --- a/src/lib/libcrypto/engine/hw_sureware_err.h +++ /dev/null | |||
| @@ -1,94 +0,0 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2001 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_SUREWARE_ERR_H | ||
| 56 | #define HEADER_SUREWARE_ERR_H | ||
| 57 | |||
| 58 | /* BEGIN ERROR CODES */ | ||
| 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 60 | * made after this point may be overwritten when the script is next run. | ||
| 61 | */ | ||
| 62 | static void ERR_load_SUREWARE_strings(void); | ||
| 63 | static void ERR_unload_SUREWARE_strings(void); | ||
| 64 | static void ERR_SUREWARE_error(int function, int reason, char *file, int line); | ||
| 65 | #define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),__FILE__,__LINE__) | ||
| 66 | |||
| 67 | /* Error codes for the SUREWARE functions. */ | ||
| 68 | |||
| 69 | /* Function codes. */ | ||
| 70 | #define SUREWARE_F_SUREWAREHK_CTRL 100 | ||
| 71 | #define SUREWARE_F_SUREWAREHK_DSA_DO_SIGN 101 | ||
| 72 | #define SUREWARE_F_SUREWAREHK_EX_FREE 102 | ||
| 73 | #define SUREWARE_F_SUREWAREHK_FINISH 103 | ||
| 74 | #define SUREWARE_F_SUREWAREHK_INIT 104 | ||
| 75 | #define SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY 105 | ||
| 76 | #define SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY 106 | ||
| 77 | #define SUREWARE_F_SUREWAREHK_MOD_EXP 107 | ||
| 78 | #define SUREWARE_F_SUREWAREHK_RAND_BYTES 108 | ||
| 79 | #define SUREWARE_F_SUREWAREHK_RAND_SEED 109 | ||
| 80 | #define SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC 110 | ||
| 81 | #define SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC 111 | ||
| 82 | |||
| 83 | /* Reason codes. */ | ||
| 84 | #define SUREWARE_R_BIO_WAS_FREED 100 | ||
| 85 | #define SUREWARE_R_MISSING_KEY_COMPONENTS 105 | ||
| 86 | #define SUREWARE_R_REQUEST_FAILED 101 | ||
| 87 | #define SUREWARE_R_REQUEST_FALLBACK 102 | ||
| 88 | #define SUREWARE_R_SIZE_TOO_LARGE_OR_TOO_SMALL 103 | ||
| 89 | #define SUREWARE_R_UNIT_FAILURE 104 | ||
| 90 | |||
| 91 | #ifdef __cplusplus | ||
| 92 | } | ||
| 93 | #endif | ||
| 94 | #endif | ||
diff --git a/src/lib/libcrypto/engine/hw_ubsec.c b/src/lib/libcrypto/engine/hw_ubsec.c deleted file mode 100644 index 8fb834af31..0000000000 --- a/src/lib/libcrypto/engine/hw_ubsec.c +++ /dev/null | |||
| @@ -1,1061 +0,0 @@ | |||
| 1 | /* crypto/engine/hw_ubsec.c */ | ||
| 2 | /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL | ||
| 3 | * project 2000. | ||
| 4 | * | ||
| 5 | * Cloned shamelessly by Joe Tardo. | ||
| 6 | */ | ||
| 7 | /* ==================================================================== | ||
| 8 | * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. | ||
| 9 | * | ||
| 10 | * Redistribution and use in source and binary forms, with or without | ||
| 11 | * modification, are permitted provided that the following conditions | ||
| 12 | * are met: | ||
| 13 | * | ||
| 14 | * 1. Redistributions of source code must retain the above copyright | ||
| 15 | * notice, this list of conditions and the following disclaimer. | ||
| 16 | * | ||
| 17 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 18 | * notice, this list of conditions and the following disclaimer in | ||
| 19 | * the documentation and/or other materials provided with the | ||
| 20 | * distribution. | ||
| 21 | * | ||
| 22 | * 3. All advertising materials mentioning features or use of this | ||
| 23 | * software must display the following acknowledgment: | ||
| 24 | * "This product includes software developed by the OpenSSL Project | ||
| 25 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 26 | * | ||
| 27 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 28 | * endorse or promote products derived from this software without | ||
| 29 | * prior written permission. For written permission, please contact | ||
| 30 | * licensing@OpenSSL.org. | ||
| 31 | * | ||
| 32 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 33 | * nor may "OpenSSL" appear in their names without prior written | ||
| 34 | * permission of the OpenSSL Project. | ||
| 35 | * | ||
| 36 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 37 | * acknowledgment: | ||
| 38 | * "This product includes software developed by the OpenSSL Project | ||
| 39 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 42 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 44 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 45 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 47 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 48 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 49 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 50 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 51 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 52 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 53 | * ==================================================================== | ||
| 54 | * | ||
| 55 | * This product includes cryptographic software written by Eric Young | ||
| 56 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 57 | * Hudson (tjh@cryptsoft.com). | ||
| 58 | * | ||
| 59 | */ | ||
| 60 | |||
| 61 | #include <stdio.h> | ||
| 62 | #include <openssl/crypto.h> | ||
| 63 | #include "cryptlib.h" | ||
| 64 | #include <openssl/dso.h> | ||
| 65 | #include <openssl/engine.h> | ||
| 66 | |||
| 67 | #ifndef OPENSSL_NO_HW | ||
| 68 | #ifndef OPENSSL_NO_HW_UBSEC | ||
| 69 | |||
| 70 | #ifdef FLAT_INC | ||
| 71 | #include "hw_ubsec.h" | ||
| 72 | #else | ||
| 73 | #include "vendor_defns/hw_ubsec.h" | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #define UBSEC_LIB_NAME "ubsec engine" | ||
| 77 | #include "hw_ubsec_err.c" | ||
| 78 | |||
| 79 | #define FAIL_TO_SOFTWARE -15 | ||
| 80 | |||
| 81 | static int ubsec_destroy(ENGINE *e); | ||
| 82 | static int ubsec_init(ENGINE *e); | ||
| 83 | static int ubsec_finish(ENGINE *e); | ||
| 84 | static int ubsec_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | ||
| 85 | static int ubsec_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 86 | const BIGNUM *m, BN_CTX *ctx); | ||
| 87 | static int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 88 | const BIGNUM *q, const BIGNUM *dp, | ||
| 89 | const BIGNUM *dq, const BIGNUM *qinv, BN_CTX *ctx); | ||
| 90 | #ifndef OPENSSL_NO_RSA | ||
| 91 | static int ubsec_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); | ||
| 92 | #endif | ||
| 93 | static int ubsec_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 94 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 95 | #ifndef OPENSSL_NO_DSA | ||
| 96 | #ifdef NOT_USED | ||
| 97 | static int ubsec_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, | ||
| 98 | BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
| 99 | BN_CTX *ctx, BN_MONT_CTX *in_mont); | ||
| 100 | static int ubsec_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
| 101 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 102 | BN_MONT_CTX *m_ctx); | ||
| 103 | #endif | ||
| 104 | static DSA_SIG *ubsec_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); | ||
| 105 | static int ubsec_dsa_verify(const unsigned char *dgst, int dgst_len, | ||
| 106 | DSA_SIG *sig, DSA *dsa); | ||
| 107 | #endif | ||
| 108 | #ifndef OPENSSL_NO_DH | ||
| 109 | static int ubsec_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | ||
| 110 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 111 | BN_MONT_CTX *m_ctx); | ||
| 112 | static int ubsec_dh_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh); | ||
| 113 | static int ubsec_dh_generate_key(DH *dh); | ||
| 114 | #endif | ||
| 115 | |||
| 116 | #ifdef NOT_USED | ||
| 117 | static int ubsec_rand_bytes(unsigned char *buf, int num); | ||
| 118 | static int ubsec_rand_status(void); | ||
| 119 | #endif | ||
| 120 | |||
| 121 | #define UBSEC_CMD_SO_PATH ENGINE_CMD_BASE | ||
| 122 | static const ENGINE_CMD_DEFN ubsec_cmd_defns[] = { | ||
| 123 | {UBSEC_CMD_SO_PATH, | ||
| 124 | "SO_PATH", | ||
| 125 | "Specifies the path to the 'ubsec' shared library", | ||
| 126 | ENGINE_CMD_FLAG_STRING}, | ||
| 127 | {0, NULL, NULL, 0} | ||
| 128 | }; | ||
| 129 | |||
| 130 | #ifndef OPENSSL_NO_RSA | ||
| 131 | /* Our internal RSA_METHOD that we provide pointers to */ | ||
| 132 | static RSA_METHOD ubsec_rsa = | ||
| 133 | { | ||
| 134 | "UBSEC RSA method", | ||
| 135 | NULL, | ||
| 136 | NULL, | ||
| 137 | NULL, | ||
| 138 | NULL, | ||
| 139 | ubsec_rsa_mod_exp, | ||
| 140 | ubsec_mod_exp_mont, | ||
| 141 | NULL, | ||
| 142 | NULL, | ||
| 143 | 0, | ||
| 144 | NULL, | ||
| 145 | NULL, | ||
| 146 | NULL | ||
| 147 | }; | ||
| 148 | #endif | ||
| 149 | |||
| 150 | #ifndef OPENSSL_NO_DSA | ||
| 151 | /* Our internal DSA_METHOD that we provide pointers to */ | ||
| 152 | static DSA_METHOD ubsec_dsa = | ||
| 153 | { | ||
| 154 | "UBSEC DSA method", | ||
| 155 | ubsec_dsa_do_sign, /* dsa_do_sign */ | ||
| 156 | NULL, /* dsa_sign_setup */ | ||
| 157 | ubsec_dsa_verify, /* dsa_do_verify */ | ||
| 158 | NULL, /* ubsec_dsa_mod_exp */ /* dsa_mod_exp */ | ||
| 159 | NULL, /* ubsec_mod_exp_dsa */ /* bn_mod_exp */ | ||
| 160 | NULL, /* init */ | ||
| 161 | NULL, /* finish */ | ||
| 162 | 0, /* flags */ | ||
| 163 | NULL /* app_data */ | ||
| 164 | }; | ||
| 165 | #endif | ||
| 166 | |||
| 167 | #ifndef OPENSSL_NO_DH | ||
| 168 | /* Our internal DH_METHOD that we provide pointers to */ | ||
| 169 | static DH_METHOD ubsec_dh = | ||
| 170 | { | ||
| 171 | "UBSEC DH method", | ||
| 172 | ubsec_dh_generate_key, | ||
| 173 | ubsec_dh_compute_key, | ||
| 174 | ubsec_mod_exp_dh, | ||
| 175 | NULL, | ||
| 176 | NULL, | ||
| 177 | 0, | ||
| 178 | NULL | ||
| 179 | }; | ||
| 180 | #endif | ||
| 181 | |||
| 182 | /* Constants used when creating the ENGINE */ | ||
| 183 | static const char *engine_ubsec_id = "ubsec"; | ||
| 184 | static const char *engine_ubsec_name = "UBSEC hardware engine support"; | ||
| 185 | |||
| 186 | /* This internal function is used by ENGINE_ubsec() and possibly by the | ||
| 187 | * "dynamic" ENGINE support too */ | ||
| 188 | static int bind_helper(ENGINE *e) | ||
| 189 | { | ||
| 190 | #ifndef OPENSSL_NO_RSA | ||
| 191 | const RSA_METHOD *meth1; | ||
| 192 | #endif | ||
| 193 | #ifndef OPENSSL_NO_DH | ||
| 194 | #ifndef HAVE_UBSEC_DH | ||
| 195 | const DH_METHOD *meth3; | ||
| 196 | #endif /* HAVE_UBSEC_DH */ | ||
| 197 | #endif | ||
| 198 | if(!ENGINE_set_id(e, engine_ubsec_id) || | ||
| 199 | !ENGINE_set_name(e, engine_ubsec_name) || | ||
| 200 | #ifndef OPENSSL_NO_RSA | ||
| 201 | !ENGINE_set_RSA(e, &ubsec_rsa) || | ||
| 202 | #endif | ||
| 203 | #ifndef OPENSSL_NO_DSA | ||
| 204 | !ENGINE_set_DSA(e, &ubsec_dsa) || | ||
| 205 | #endif | ||
| 206 | #ifndef OPENSSL_NO_DH | ||
| 207 | !ENGINE_set_DH(e, &ubsec_dh) || | ||
| 208 | #endif | ||
| 209 | !ENGINE_set_destroy_function(e, ubsec_destroy) || | ||
| 210 | !ENGINE_set_init_function(e, ubsec_init) || | ||
| 211 | !ENGINE_set_finish_function(e, ubsec_finish) || | ||
| 212 | !ENGINE_set_ctrl_function(e, ubsec_ctrl) || | ||
| 213 | !ENGINE_set_cmd_defns(e, ubsec_cmd_defns)) | ||
| 214 | return 0; | ||
| 215 | |||
| 216 | #ifndef OPENSSL_NO_RSA | ||
| 217 | /* We know that the "PKCS1_SSLeay()" functions hook properly | ||
| 218 | * to the Broadcom-specific mod_exp and mod_exp_crt so we use | ||
| 219 | * those functions. NB: We don't use ENGINE_openssl() or | ||
| 220 | * anything "more generic" because something like the RSAref | ||
| 221 | * code may not hook properly, and if you own one of these | ||
| 222 | * cards then you have the right to do RSA operations on it | ||
| 223 | * anyway! */ | ||
| 224 | meth1 = RSA_PKCS1_SSLeay(); | ||
| 225 | ubsec_rsa.rsa_pub_enc = meth1->rsa_pub_enc; | ||
| 226 | ubsec_rsa.rsa_pub_dec = meth1->rsa_pub_dec; | ||
| 227 | ubsec_rsa.rsa_priv_enc = meth1->rsa_priv_enc; | ||
| 228 | ubsec_rsa.rsa_priv_dec = meth1->rsa_priv_dec; | ||
| 229 | #endif | ||
| 230 | |||
| 231 | #ifndef OPENSSL_NO_DH | ||
| 232 | #ifndef HAVE_UBSEC_DH | ||
| 233 | /* Much the same for Diffie-Hellman */ | ||
| 234 | meth3 = DH_OpenSSL(); | ||
| 235 | ubsec_dh.generate_key = meth3->generate_key; | ||
| 236 | ubsec_dh.compute_key = meth3->compute_key; | ||
| 237 | #endif /* HAVE_UBSEC_DH */ | ||
| 238 | #endif | ||
| 239 | |||
| 240 | /* Ensure the ubsec error handling is set up */ | ||
| 241 | ERR_load_UBSEC_strings(); | ||
| 242 | return 1; | ||
| 243 | } | ||
| 244 | |||
| 245 | #ifndef ENGINE_DYNAMIC_SUPPORT | ||
| 246 | static ENGINE *engine_ubsec(void) | ||
| 247 | { | ||
| 248 | ENGINE *ret = ENGINE_new(); | ||
| 249 | if(!ret) | ||
| 250 | return NULL; | ||
| 251 | if(!bind_helper(ret)) | ||
| 252 | { | ||
| 253 | ENGINE_free(ret); | ||
| 254 | return NULL; | ||
| 255 | } | ||
| 256 | return ret; | ||
| 257 | } | ||
| 258 | |||
| 259 | void ENGINE_load_ubsec(void) | ||
| 260 | { | ||
| 261 | /* Copied from eng_[openssl|dyn].c */ | ||
| 262 | ENGINE *toadd = engine_ubsec(); | ||
| 263 | if(!toadd) return; | ||
| 264 | ENGINE_add(toadd); | ||
| 265 | ENGINE_free(toadd); | ||
| 266 | ERR_clear_error(); | ||
| 267 | } | ||
| 268 | #endif | ||
| 269 | |||
| 270 | /* This is a process-global DSO handle used for loading and unloading | ||
| 271 | * the UBSEC library. NB: This is only set (or unset) during an | ||
| 272 | * init() or finish() call (reference counts permitting) and they're | ||
| 273 | * operating with global locks, so this should be thread-safe | ||
| 274 | * implicitly. */ | ||
| 275 | |||
| 276 | static DSO *ubsec_dso = NULL; | ||
| 277 | |||
| 278 | /* These are the function pointers that are (un)set when the library has | ||
| 279 | * successfully (un)loaded. */ | ||
| 280 | |||
| 281 | static t_UBSEC_ubsec_bytes_to_bits *p_UBSEC_ubsec_bytes_to_bits = NULL; | ||
| 282 | static t_UBSEC_ubsec_bits_to_bytes *p_UBSEC_ubsec_bits_to_bytes = NULL; | ||
| 283 | static t_UBSEC_ubsec_open *p_UBSEC_ubsec_open = NULL; | ||
| 284 | static t_UBSEC_ubsec_close *p_UBSEC_ubsec_close = NULL; | ||
| 285 | #ifndef OPENSSL_NO_DH | ||
| 286 | static t_UBSEC_diffie_hellman_generate_ioctl | ||
| 287 | *p_UBSEC_diffie_hellman_generate_ioctl = NULL; | ||
| 288 | static t_UBSEC_diffie_hellman_agree_ioctl *p_UBSEC_diffie_hellman_agree_ioctl = NULL; | ||
| 289 | #endif | ||
| 290 | /* #ifndef OPENSSL_NO_RSA */ | ||
| 291 | static t_UBSEC_rsa_mod_exp_ioctl *p_UBSEC_rsa_mod_exp_ioctl = NULL; | ||
| 292 | static t_UBSEC_rsa_mod_exp_crt_ioctl *p_UBSEC_rsa_mod_exp_crt_ioctl = NULL; | ||
| 293 | /* #endif */ | ||
| 294 | #ifndef OPENSSL_NO_DSA | ||
| 295 | static t_UBSEC_dsa_sign_ioctl *p_UBSEC_dsa_sign_ioctl = NULL; | ||
| 296 | static t_UBSEC_dsa_verify_ioctl *p_UBSEC_dsa_verify_ioctl = NULL; | ||
| 297 | #endif | ||
| 298 | static t_UBSEC_math_accelerate_ioctl *p_UBSEC_math_accelerate_ioctl = NULL; | ||
| 299 | static t_UBSEC_rng_ioctl *p_UBSEC_rng_ioctl = NULL; | ||
| 300 | static t_UBSEC_max_key_len_ioctl *p_UBSEC_max_key_len_ioctl = NULL; | ||
| 301 | |||
| 302 | static int max_key_len = 1024; /* ??? */ | ||
| 303 | |||
| 304 | /* | ||
| 305 | * These are the static string constants for the DSO file name and the function | ||
| 306 | * symbol names to bind to. | ||
| 307 | */ | ||
| 308 | |||
| 309 | static const char *UBSEC_LIBNAME = NULL; | ||
| 310 | static const char *get_UBSEC_LIBNAME(void) | ||
| 311 | { | ||
| 312 | if(UBSEC_LIBNAME) | ||
| 313 | return UBSEC_LIBNAME; | ||
| 314 | return "ubsec"; | ||
| 315 | } | ||
| 316 | static void free_UBSEC_LIBNAME(void) | ||
| 317 | { | ||
| 318 | if(UBSEC_LIBNAME) | ||
| 319 | OPENSSL_free((void*)UBSEC_LIBNAME); | ||
| 320 | UBSEC_LIBNAME = NULL; | ||
| 321 | } | ||
| 322 | static long set_UBSEC_LIBNAME(const char *name) | ||
| 323 | { | ||
| 324 | free_UBSEC_LIBNAME(); | ||
| 325 | return (((UBSEC_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0); | ||
| 326 | } | ||
| 327 | static const char *UBSEC_F1 = "ubsec_bytes_to_bits"; | ||
| 328 | static const char *UBSEC_F2 = "ubsec_bits_to_bytes"; | ||
| 329 | static const char *UBSEC_F3 = "ubsec_open"; | ||
| 330 | static const char *UBSEC_F4 = "ubsec_close"; | ||
| 331 | #ifndef OPENSSL_NO_DH | ||
| 332 | static const char *UBSEC_F5 = "diffie_hellman_generate_ioctl"; | ||
| 333 | static const char *UBSEC_F6 = "diffie_hellman_agree_ioctl"; | ||
| 334 | #endif | ||
| 335 | /* #ifndef OPENSSL_NO_RSA */ | ||
| 336 | static const char *UBSEC_F7 = "rsa_mod_exp_ioctl"; | ||
| 337 | static const char *UBSEC_F8 = "rsa_mod_exp_crt_ioctl"; | ||
| 338 | /* #endif */ | ||
| 339 | #ifndef OPENSSL_NO_DSA | ||
| 340 | static const char *UBSEC_F9 = "dsa_sign_ioctl"; | ||
| 341 | static const char *UBSEC_F10 = "dsa_verify_ioctl"; | ||
| 342 | #endif | ||
| 343 | static const char *UBSEC_F11 = "math_accelerate_ioctl"; | ||
| 344 | static const char *UBSEC_F12 = "rng_ioctl"; | ||
| 345 | static const char *UBSEC_F13 = "ubsec_max_key_len_ioctl"; | ||
| 346 | |||
| 347 | /* Destructor (complements the "ENGINE_ubsec()" constructor) */ | ||
| 348 | static int ubsec_destroy(ENGINE *e) | ||
| 349 | { | ||
| 350 | free_UBSEC_LIBNAME(); | ||
| 351 | ERR_unload_UBSEC_strings(); | ||
| 352 | return 1; | ||
| 353 | } | ||
| 354 | |||
| 355 | /* (de)initialisation functions. */ | ||
| 356 | static int ubsec_init(ENGINE *e) | ||
| 357 | { | ||
| 358 | t_UBSEC_ubsec_bytes_to_bits *p1; | ||
| 359 | t_UBSEC_ubsec_bits_to_bytes *p2; | ||
| 360 | t_UBSEC_ubsec_open *p3; | ||
| 361 | t_UBSEC_ubsec_close *p4; | ||
| 362 | #ifndef OPENSSL_NO_DH | ||
| 363 | t_UBSEC_diffie_hellman_generate_ioctl *p5; | ||
| 364 | t_UBSEC_diffie_hellman_agree_ioctl *p6; | ||
| 365 | #endif | ||
| 366 | /* #ifndef OPENSSL_NO_RSA */ | ||
| 367 | t_UBSEC_rsa_mod_exp_ioctl *p7; | ||
| 368 | t_UBSEC_rsa_mod_exp_crt_ioctl *p8; | ||
| 369 | /* #endif */ | ||
| 370 | #ifndef OPENSSL_NO_DSA | ||
| 371 | t_UBSEC_dsa_sign_ioctl *p9; | ||
| 372 | t_UBSEC_dsa_verify_ioctl *p10; | ||
| 373 | #endif | ||
| 374 | t_UBSEC_math_accelerate_ioctl *p11; | ||
| 375 | t_UBSEC_rng_ioctl *p12; | ||
| 376 | t_UBSEC_max_key_len_ioctl *p13; | ||
| 377 | int fd = 0; | ||
| 378 | |||
| 379 | if(ubsec_dso != NULL) | ||
| 380 | { | ||
| 381 | UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_ALREADY_LOADED); | ||
| 382 | goto err; | ||
| 383 | } | ||
| 384 | /* | ||
| 385 | * Attempt to load libubsec.so/ubsec.dll/whatever. | ||
| 386 | */ | ||
| 387 | ubsec_dso = DSO_load(NULL, get_UBSEC_LIBNAME(), NULL, 0); | ||
| 388 | if(ubsec_dso == NULL) | ||
| 389 | { | ||
| 390 | UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_DSO_FAILURE); | ||
| 391 | goto err; | ||
| 392 | } | ||
| 393 | |||
| 394 | if ( | ||
| 395 | !(p1 = (t_UBSEC_ubsec_bytes_to_bits *) DSO_bind_func(ubsec_dso, UBSEC_F1)) || | ||
| 396 | !(p2 = (t_UBSEC_ubsec_bits_to_bytes *) DSO_bind_func(ubsec_dso, UBSEC_F2)) || | ||
| 397 | !(p3 = (t_UBSEC_ubsec_open *) DSO_bind_func(ubsec_dso, UBSEC_F3)) || | ||
| 398 | !(p4 = (t_UBSEC_ubsec_close *) DSO_bind_func(ubsec_dso, UBSEC_F4)) || | ||
| 399 | #ifndef OPENSSL_NO_DH | ||
| 400 | !(p5 = (t_UBSEC_diffie_hellman_generate_ioctl *) | ||
| 401 | DSO_bind_func(ubsec_dso, UBSEC_F5)) || | ||
| 402 | !(p6 = (t_UBSEC_diffie_hellman_agree_ioctl *) | ||
| 403 | DSO_bind_func(ubsec_dso, UBSEC_F6)) || | ||
| 404 | #endif | ||
| 405 | /* #ifndef OPENSSL_NO_RSA */ | ||
| 406 | !(p7 = (t_UBSEC_rsa_mod_exp_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F7)) || | ||
| 407 | !(p8 = (t_UBSEC_rsa_mod_exp_crt_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F8)) || | ||
| 408 | /* #endif */ | ||
| 409 | #ifndef OPENSSL_NO_DSA | ||
| 410 | !(p9 = (t_UBSEC_dsa_sign_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F9)) || | ||
| 411 | !(p10 = (t_UBSEC_dsa_verify_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F10)) || | ||
| 412 | #endif | ||
| 413 | !(p11 = (t_UBSEC_math_accelerate_ioctl *) | ||
| 414 | DSO_bind_func(ubsec_dso, UBSEC_F11)) || | ||
| 415 | !(p12 = (t_UBSEC_rng_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F12)) || | ||
| 416 | !(p13 = (t_UBSEC_max_key_len_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F13))) | ||
| 417 | { | ||
| 418 | UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_DSO_FAILURE); | ||
| 419 | goto err; | ||
| 420 | } | ||
| 421 | |||
| 422 | /* Copy the pointers */ | ||
| 423 | p_UBSEC_ubsec_bytes_to_bits = p1; | ||
| 424 | p_UBSEC_ubsec_bits_to_bytes = p2; | ||
| 425 | p_UBSEC_ubsec_open = p3; | ||
| 426 | p_UBSEC_ubsec_close = p4; | ||
| 427 | #ifndef OPENSSL_NO_DH | ||
| 428 | p_UBSEC_diffie_hellman_generate_ioctl = p5; | ||
| 429 | p_UBSEC_diffie_hellman_agree_ioctl = p6; | ||
| 430 | #endif | ||
| 431 | #ifndef OPENSSL_NO_RSA | ||
| 432 | p_UBSEC_rsa_mod_exp_ioctl = p7; | ||
| 433 | p_UBSEC_rsa_mod_exp_crt_ioctl = p8; | ||
| 434 | #endif | ||
| 435 | #ifndef OPENSSL_NO_DSA | ||
| 436 | p_UBSEC_dsa_sign_ioctl = p9; | ||
| 437 | p_UBSEC_dsa_verify_ioctl = p10; | ||
| 438 | #endif | ||
| 439 | p_UBSEC_math_accelerate_ioctl = p11; | ||
| 440 | p_UBSEC_rng_ioctl = p12; | ||
| 441 | p_UBSEC_max_key_len_ioctl = p13; | ||
| 442 | |||
| 443 | /* Perform an open to see if there's actually any unit running. */ | ||
| 444 | if (((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) > 0) && (p_UBSEC_max_key_len_ioctl(fd, &max_key_len) == 0)) | ||
| 445 | { | ||
| 446 | p_UBSEC_ubsec_close(fd); | ||
| 447 | return 1; | ||
| 448 | } | ||
| 449 | else | ||
| 450 | { | ||
| 451 | UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE); | ||
| 452 | } | ||
| 453 | |||
| 454 | err: | ||
| 455 | if(ubsec_dso) | ||
| 456 | DSO_free(ubsec_dso); | ||
| 457 | ubsec_dso = NULL; | ||
| 458 | p_UBSEC_ubsec_bytes_to_bits = NULL; | ||
| 459 | p_UBSEC_ubsec_bits_to_bytes = NULL; | ||
| 460 | p_UBSEC_ubsec_open = NULL; | ||
| 461 | p_UBSEC_ubsec_close = NULL; | ||
| 462 | #ifndef OPENSSL_NO_DH | ||
| 463 | p_UBSEC_diffie_hellman_generate_ioctl = NULL; | ||
| 464 | p_UBSEC_diffie_hellman_agree_ioctl = NULL; | ||
| 465 | #endif | ||
| 466 | #ifndef OPENSSL_NO_RSA | ||
| 467 | p_UBSEC_rsa_mod_exp_ioctl = NULL; | ||
| 468 | p_UBSEC_rsa_mod_exp_crt_ioctl = NULL; | ||
| 469 | #endif | ||
| 470 | #ifndef OPENSSL_NO_DSA | ||
| 471 | p_UBSEC_dsa_sign_ioctl = NULL; | ||
| 472 | p_UBSEC_dsa_verify_ioctl = NULL; | ||
| 473 | #endif | ||
| 474 | p_UBSEC_math_accelerate_ioctl = NULL; | ||
| 475 | p_UBSEC_rng_ioctl = NULL; | ||
| 476 | p_UBSEC_max_key_len_ioctl = NULL; | ||
| 477 | |||
| 478 | return 0; | ||
| 479 | } | ||
| 480 | |||
| 481 | static int ubsec_finish(ENGINE *e) | ||
| 482 | { | ||
| 483 | free_UBSEC_LIBNAME(); | ||
| 484 | if(ubsec_dso == NULL) | ||
| 485 | { | ||
| 486 | UBSECerr(UBSEC_F_UBSEC_FINISH, UBSEC_R_NOT_LOADED); | ||
| 487 | return 0; | ||
| 488 | } | ||
| 489 | if(!DSO_free(ubsec_dso)) | ||
| 490 | { | ||
| 491 | UBSECerr(UBSEC_F_UBSEC_FINISH, UBSEC_R_DSO_FAILURE); | ||
| 492 | return 0; | ||
| 493 | } | ||
| 494 | ubsec_dso = NULL; | ||
| 495 | p_UBSEC_ubsec_bytes_to_bits = NULL; | ||
| 496 | p_UBSEC_ubsec_bits_to_bytes = NULL; | ||
| 497 | p_UBSEC_ubsec_open = NULL; | ||
| 498 | p_UBSEC_ubsec_close = NULL; | ||
| 499 | #ifndef OPENSSL_NO_DH | ||
| 500 | p_UBSEC_diffie_hellman_generate_ioctl = NULL; | ||
| 501 | p_UBSEC_diffie_hellman_agree_ioctl = NULL; | ||
| 502 | #endif | ||
| 503 | #ifndef OPENSSL_NO_RSA | ||
| 504 | p_UBSEC_rsa_mod_exp_ioctl = NULL; | ||
| 505 | p_UBSEC_rsa_mod_exp_crt_ioctl = NULL; | ||
| 506 | #endif | ||
| 507 | #ifndef OPENSSL_NO_DSA | ||
| 508 | p_UBSEC_dsa_sign_ioctl = NULL; | ||
| 509 | p_UBSEC_dsa_verify_ioctl = NULL; | ||
| 510 | #endif | ||
| 511 | p_UBSEC_math_accelerate_ioctl = NULL; | ||
| 512 | p_UBSEC_rng_ioctl = NULL; | ||
| 513 | p_UBSEC_max_key_len_ioctl = NULL; | ||
| 514 | return 1; | ||
| 515 | } | ||
| 516 | |||
| 517 | static int ubsec_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | ||
| 518 | { | ||
| 519 | int initialised = ((ubsec_dso == NULL) ? 0 : 1); | ||
| 520 | switch(cmd) | ||
| 521 | { | ||
| 522 | case UBSEC_CMD_SO_PATH: | ||
| 523 | if(p == NULL) | ||
| 524 | { | ||
| 525 | UBSECerr(UBSEC_F_UBSEC_CTRL,ERR_R_PASSED_NULL_PARAMETER); | ||
| 526 | return 0; | ||
| 527 | } | ||
| 528 | if(initialised) | ||
| 529 | { | ||
| 530 | UBSECerr(UBSEC_F_UBSEC_CTRL,UBSEC_R_ALREADY_LOADED); | ||
| 531 | return 0; | ||
| 532 | } | ||
| 533 | return set_UBSEC_LIBNAME((const char *)p); | ||
| 534 | default: | ||
| 535 | break; | ||
| 536 | } | ||
| 537 | UBSECerr(UBSEC_F_UBSEC_CTRL,UBSEC_R_CTRL_COMMAND_NOT_IMPLEMENTED); | ||
| 538 | return 0; | ||
| 539 | } | ||
| 540 | |||
| 541 | static int ubsec_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 542 | const BIGNUM *m, BN_CTX *ctx) | ||
| 543 | { | ||
| 544 | int y_len = 0; | ||
| 545 | int fd; | ||
| 546 | |||
| 547 | if(ubsec_dso == NULL) | ||
| 548 | { | ||
| 549 | UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_NOT_LOADED); | ||
| 550 | return 0; | ||
| 551 | } | ||
| 552 | |||
| 553 | /* Check if hardware can't handle this argument. */ | ||
| 554 | y_len = BN_num_bits(m); | ||
| 555 | if (y_len > max_key_len) { | ||
| 556 | UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
| 557 | return BN_mod_exp(r, a, p, m, ctx); | ||
| 558 | } | ||
| 559 | |||
| 560 | if(!bn_wexpand(r, m->top)) | ||
| 561 | { | ||
| 562 | UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_BN_EXPAND_FAIL); | ||
| 563 | return 0; | ||
| 564 | } | ||
| 565 | |||
| 566 | if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) { | ||
| 567 | fd = 0; | ||
| 568 | UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE); | ||
| 569 | return BN_mod_exp(r, a, p, m, ctx); | ||
| 570 | } | ||
| 571 | |||
| 572 | if (p_UBSEC_rsa_mod_exp_ioctl(fd, (unsigned char *)a->d, BN_num_bits(a), | ||
| 573 | (unsigned char *)m->d, BN_num_bits(m), (unsigned char *)p->d, | ||
| 574 | BN_num_bits(p), (unsigned char *)r->d, &y_len) != 0) | ||
| 575 | { | ||
| 576 | UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_REQUEST_FAILED); | ||
| 577 | p_UBSEC_ubsec_close(fd); | ||
| 578 | |||
| 579 | return BN_mod_exp(r, a, p, m, ctx); | ||
| 580 | } | ||
| 581 | |||
| 582 | p_UBSEC_ubsec_close(fd); | ||
| 583 | |||
| 584 | r->top = (BN_num_bits(m)+BN_BITS2-1)/BN_BITS2; | ||
| 585 | return 1; | ||
| 586 | } | ||
| 587 | |||
| 588 | #ifndef OPENSSL_NO_RSA | ||
| 589 | static int ubsec_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) | ||
| 590 | { | ||
| 591 | BN_CTX *ctx; | ||
| 592 | int to_return = 0; | ||
| 593 | |||
| 594 | if((ctx = BN_CTX_new()) == NULL) | ||
| 595 | goto err; | ||
| 596 | |||
| 597 | if(!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) | ||
| 598 | { | ||
| 599 | UBSECerr(UBSEC_F_UBSEC_RSA_MOD_EXP, UBSEC_R_MISSING_KEY_COMPONENTS); | ||
| 600 | goto err; | ||
| 601 | } | ||
| 602 | |||
| 603 | to_return = ubsec_mod_exp_crt(r0, I, rsa->p, rsa->q, rsa->dmp1, | ||
| 604 | rsa->dmq1, rsa->iqmp, ctx); | ||
| 605 | if (to_return == FAIL_TO_SOFTWARE) | ||
| 606 | { | ||
| 607 | /* | ||
| 608 | * Do in software as hardware failed. | ||
| 609 | */ | ||
| 610 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 611 | to_return = (*meth->rsa_mod_exp)(r0, I, rsa); | ||
| 612 | } | ||
| 613 | err: | ||
| 614 | if(ctx) | ||
| 615 | BN_CTX_free(ctx); | ||
| 616 | return to_return; | ||
| 617 | } | ||
| 618 | #endif | ||
| 619 | |||
| 620 | static int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 621 | const BIGNUM *q, const BIGNUM *dp, | ||
| 622 | const BIGNUM *dq, const BIGNUM *qinv, BN_CTX *ctx) | ||
| 623 | { | ||
| 624 | int y_len, | ||
| 625 | m_len, | ||
| 626 | fd; | ||
| 627 | |||
| 628 | m_len = BN_num_bytes(p) + BN_num_bytes(q) + 1; | ||
| 629 | y_len = BN_num_bits(p) + BN_num_bits(q); | ||
| 630 | |||
| 631 | /* Check if hardware can't handle this argument. */ | ||
| 632 | if (y_len > max_key_len) { | ||
| 633 | UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL); | ||
| 634 | return FAIL_TO_SOFTWARE; | ||
| 635 | } | ||
| 636 | |||
| 637 | if (!bn_wexpand(r, p->top + q->top + 1)) { | ||
| 638 | UBSECerr(UBSEC_F_UBSEC_RSA_MOD_EXP_CRT, UBSEC_R_BN_EXPAND_FAIL); | ||
| 639 | return 0; | ||
| 640 | } | ||
| 641 | |||
| 642 | if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) { | ||
| 643 | fd = 0; | ||
| 644 | UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE); | ||
| 645 | return FAIL_TO_SOFTWARE; | ||
| 646 | } | ||
| 647 | |||
| 648 | if (p_UBSEC_rsa_mod_exp_crt_ioctl(fd, | ||
| 649 | (unsigned char *)a->d, BN_num_bits(a), | ||
| 650 | (unsigned char *)qinv->d, BN_num_bits(qinv), | ||
| 651 | (unsigned char *)dp->d, BN_num_bits(dp), | ||
| 652 | (unsigned char *)p->d, BN_num_bits(p), | ||
| 653 | (unsigned char *)dq->d, BN_num_bits(dq), | ||
| 654 | (unsigned char *)q->d, BN_num_bits(q), | ||
| 655 | (unsigned char *)r->d, &y_len) != 0) { | ||
| 656 | UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_REQUEST_FAILED); | ||
| 657 | p_UBSEC_ubsec_close(fd); | ||
| 658 | return FAIL_TO_SOFTWARE; | ||
| 659 | } | ||
| 660 | |||
| 661 | p_UBSEC_ubsec_close(fd); | ||
| 662 | |||
| 663 | r->top = (BN_num_bits(p) + BN_num_bits(q) + BN_BITS2 - 1)/BN_BITS2; | ||
| 664 | return 1; | ||
| 665 | } | ||
| 666 | |||
| 667 | #ifndef OPENSSL_NO_DSA | ||
| 668 | #ifdef NOT_USED | ||
| 669 | static int ubsec_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, | ||
| 670 | BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
| 671 | BN_CTX *ctx, BN_MONT_CTX *in_mont) | ||
| 672 | { | ||
| 673 | BIGNUM t; | ||
| 674 | int to_return = 0; | ||
| 675 | |||
| 676 | BN_init(&t); | ||
| 677 | /* let rr = a1 ^ p1 mod m */ | ||
| 678 | if (!ubsec_mod_exp(rr,a1,p1,m,ctx)) goto end; | ||
| 679 | /* let t = a2 ^ p2 mod m */ | ||
| 680 | if (!ubsec_mod_exp(&t,a2,p2,m,ctx)) goto end; | ||
| 681 | /* let rr = rr * t mod m */ | ||
| 682 | if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end; | ||
| 683 | to_return = 1; | ||
| 684 | end: | ||
| 685 | BN_free(&t); | ||
| 686 | return to_return; | ||
| 687 | } | ||
| 688 | |||
| 689 | static int ubsec_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
| 690 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 691 | BN_MONT_CTX *m_ctx) | ||
| 692 | { | ||
| 693 | return ubsec_mod_exp(r, a, p, m, ctx); | ||
| 694 | } | ||
| 695 | #endif | ||
| 696 | #endif | ||
| 697 | |||
| 698 | /* | ||
| 699 | * This function is aliased to mod_exp (with the mont stuff dropped). | ||
| 700 | */ | ||
| 701 | static int ubsec_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 702 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 703 | { | ||
| 704 | int ret = 0; | ||
| 705 | |||
| 706 | #ifndef OPENSSL_NO_RSA | ||
| 707 | /* Do in software if the key is too large for the hardware. */ | ||
| 708 | if (BN_num_bits(m) > max_key_len) | ||
| 709 | { | ||
| 710 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 711 | ret = (*meth->bn_mod_exp)(r, a, p, m, ctx, m_ctx); | ||
| 712 | } | ||
| 713 | else | ||
| 714 | #endif | ||
| 715 | { | ||
| 716 | ret = ubsec_mod_exp(r, a, p, m, ctx); | ||
| 717 | } | ||
| 718 | |||
| 719 | return ret; | ||
| 720 | } | ||
| 721 | |||
| 722 | #ifndef OPENSSL_NO_DH | ||
| 723 | /* This function is aliased to mod_exp (with the dh and mont dropped). */ | ||
| 724 | static int ubsec_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | ||
| 725 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 726 | BN_MONT_CTX *m_ctx) | ||
| 727 | { | ||
| 728 | return ubsec_mod_exp(r, a, p, m, ctx); | ||
| 729 | } | ||
| 730 | #endif | ||
| 731 | |||
| 732 | #ifndef OPENSSL_NO_DSA | ||
| 733 | static DSA_SIG *ubsec_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | ||
| 734 | { | ||
| 735 | DSA_SIG *to_return = NULL; | ||
| 736 | int s_len = 160, r_len = 160, d_len, fd; | ||
| 737 | BIGNUM m, *r=NULL, *s=NULL; | ||
| 738 | |||
| 739 | BN_init(&m); | ||
| 740 | |||
| 741 | s = BN_new(); | ||
| 742 | r = BN_new(); | ||
| 743 | if ((s == NULL) || (r==NULL)) | ||
| 744 | goto err; | ||
| 745 | |||
| 746 | d_len = p_UBSEC_ubsec_bytes_to_bits((unsigned char *)dgst, dlen); | ||
| 747 | |||
| 748 | if(!bn_wexpand(r, (160+BN_BITS2-1)/BN_BITS2) || | ||
| 749 | (!bn_wexpand(s, (160+BN_BITS2-1)/BN_BITS2))) { | ||
| 750 | UBSECerr(UBSEC_F_UBSEC_DSA_SIGN, UBSEC_R_BN_EXPAND_FAIL); | ||
| 751 | goto err; | ||
| 752 | } | ||
| 753 | |||
| 754 | if (BN_bin2bn(dgst,dlen,&m) == NULL) { | ||
| 755 | UBSECerr(UBSEC_F_UBSEC_DSA_SIGN, UBSEC_R_BN_EXPAND_FAIL); | ||
| 756 | goto err; | ||
| 757 | } | ||
| 758 | |||
| 759 | if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) { | ||
| 760 | const DSA_METHOD *meth; | ||
| 761 | fd = 0; | ||
| 762 | UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE); | ||
| 763 | meth = DSA_OpenSSL(); | ||
| 764 | to_return = meth->dsa_do_sign(dgst, dlen, dsa); | ||
| 765 | goto err; | ||
| 766 | } | ||
| 767 | |||
| 768 | if (p_UBSEC_dsa_sign_ioctl(fd, 0, /* compute hash before signing */ | ||
| 769 | (unsigned char *)dgst, d_len, | ||
| 770 | NULL, 0, /* compute random value */ | ||
| 771 | (unsigned char *)dsa->p->d, BN_num_bits(dsa->p), | ||
| 772 | (unsigned char *)dsa->q->d, BN_num_bits(dsa->q), | ||
| 773 | (unsigned char *)dsa->g->d, BN_num_bits(dsa->g), | ||
| 774 | (unsigned char *)dsa->priv_key->d, BN_num_bits(dsa->priv_key), | ||
| 775 | (unsigned char *)r->d, &r_len, | ||
| 776 | (unsigned char *)s->d, &s_len ) != 0) { | ||
| 777 | const DSA_METHOD *meth; | ||
| 778 | |||
| 779 | UBSECerr(UBSEC_F_UBSEC_DSA_SIGN, UBSEC_R_REQUEST_FAILED); | ||
| 780 | p_UBSEC_ubsec_close(fd); | ||
| 781 | meth = DSA_OpenSSL(); | ||
| 782 | to_return = meth->dsa_do_sign(dgst, dlen, dsa); | ||
| 783 | |||
| 784 | goto err; | ||
| 785 | } | ||
| 786 | |||
| 787 | p_UBSEC_ubsec_close(fd); | ||
| 788 | |||
| 789 | r->top = (160+BN_BITS2-1)/BN_BITS2; | ||
| 790 | s->top = (160+BN_BITS2-1)/BN_BITS2; | ||
| 791 | |||
| 792 | to_return = DSA_SIG_new(); | ||
| 793 | if(to_return == NULL) { | ||
| 794 | UBSECerr(UBSEC_F_UBSEC_DSA_SIGN, UBSEC_R_BN_EXPAND_FAIL); | ||
| 795 | goto err; | ||
| 796 | } | ||
| 797 | |||
| 798 | to_return->r = r; | ||
| 799 | to_return->s = s; | ||
| 800 | |||
| 801 | err: | ||
| 802 | if (!to_return) { | ||
| 803 | if (r) BN_free(r); | ||
| 804 | if (s) BN_free(s); | ||
| 805 | } | ||
| 806 | BN_clear_free(&m); | ||
| 807 | return to_return; | ||
| 808 | } | ||
| 809 | |||
| 810 | static int ubsec_dsa_verify(const unsigned char *dgst, int dgst_len, | ||
| 811 | DSA_SIG *sig, DSA *dsa) | ||
| 812 | { | ||
| 813 | int v_len, d_len; | ||
| 814 | int to_return = 0; | ||
| 815 | int fd; | ||
| 816 | BIGNUM v; | ||
| 817 | |||
| 818 | BN_init(&v); | ||
| 819 | |||
| 820 | if(!bn_wexpand(&v, dsa->p->top)) { | ||
| 821 | UBSECerr(UBSEC_F_UBSEC_DSA_VERIFY ,UBSEC_R_BN_EXPAND_FAIL); | ||
| 822 | goto err; | ||
| 823 | } | ||
| 824 | |||
| 825 | v_len = BN_num_bits(dsa->p); | ||
| 826 | |||
| 827 | d_len = p_UBSEC_ubsec_bytes_to_bits((unsigned char *)dgst, dgst_len); | ||
| 828 | |||
| 829 | if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) { | ||
| 830 | const DSA_METHOD *meth; | ||
| 831 | fd = 0; | ||
| 832 | UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE); | ||
| 833 | meth = DSA_OpenSSL(); | ||
| 834 | to_return = meth->dsa_do_verify(dgst, dgst_len, sig, dsa); | ||
| 835 | goto err; | ||
| 836 | } | ||
| 837 | |||
| 838 | if (p_UBSEC_dsa_verify_ioctl(fd, 0, /* compute hash before signing */ | ||
| 839 | (unsigned char *)dgst, d_len, | ||
| 840 | (unsigned char *)dsa->p->d, BN_num_bits(dsa->p), | ||
| 841 | (unsigned char *)dsa->q->d, BN_num_bits(dsa->q), | ||
| 842 | (unsigned char *)dsa->g->d, BN_num_bits(dsa->g), | ||
| 843 | (unsigned char *)dsa->pub_key->d, BN_num_bits(dsa->pub_key), | ||
| 844 | (unsigned char *)sig->r->d, BN_num_bits(sig->r), | ||
| 845 | (unsigned char *)sig->s->d, BN_num_bits(sig->s), | ||
| 846 | (unsigned char *)v.d, &v_len) != 0) { | ||
| 847 | const DSA_METHOD *meth; | ||
| 848 | UBSECerr(UBSEC_F_UBSEC_DSA_VERIFY , UBSEC_R_REQUEST_FAILED); | ||
| 849 | p_UBSEC_ubsec_close(fd); | ||
| 850 | |||
| 851 | meth = DSA_OpenSSL(); | ||
| 852 | to_return = meth->dsa_do_verify(dgst, dgst_len, sig, dsa); | ||
| 853 | |||
| 854 | goto err; | ||
| 855 | } | ||
| 856 | |||
| 857 | p_UBSEC_ubsec_close(fd); | ||
| 858 | |||
| 859 | to_return = 1; | ||
| 860 | err: | ||
| 861 | BN_clear_free(&v); | ||
| 862 | return to_return; | ||
| 863 | } | ||
| 864 | #endif | ||
| 865 | |||
| 866 | #ifndef OPENSSL_NO_DH | ||
| 867 | static int ubsec_dh_compute_key (unsigned char *key,const BIGNUM *pub_key,DH *dh) | ||
| 868 | { | ||
| 869 | int ret = -1, | ||
| 870 | k_len, | ||
| 871 | fd; | ||
| 872 | |||
| 873 | k_len = BN_num_bits(dh->p); | ||
| 874 | |||
| 875 | if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) | ||
| 876 | { | ||
| 877 | const DH_METHOD *meth; | ||
| 878 | ENGINEerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE); | ||
| 879 | meth = DH_OpenSSL(); | ||
| 880 | ret = meth->compute_key(key, pub_key, dh); | ||
| 881 | goto err; | ||
| 882 | } | ||
| 883 | |||
| 884 | if (p_UBSEC_diffie_hellman_agree_ioctl(fd, | ||
| 885 | (unsigned char *)dh->priv_key->d, BN_num_bits(dh->priv_key), | ||
| 886 | (unsigned char *)pub_key->d, BN_num_bits(pub_key), | ||
| 887 | (unsigned char *)dh->p->d, BN_num_bits(dh->p), | ||
| 888 | key, &k_len) != 0) | ||
| 889 | { | ||
| 890 | /* Hardware's a no go, failover to software */ | ||
| 891 | const DH_METHOD *meth; | ||
| 892 | ENGINEerr(UBSEC_F_UBSEC_DH_COMPUTE_KEY, UBSEC_R_REQUEST_FAILED); | ||
| 893 | p_UBSEC_ubsec_close(fd); | ||
| 894 | |||
| 895 | meth = DH_OpenSSL(); | ||
| 896 | ret = meth->compute_key(key, pub_key, dh); | ||
| 897 | |||
| 898 | goto err; | ||
| 899 | } | ||
| 900 | |||
| 901 | p_UBSEC_ubsec_close(fd); | ||
| 902 | |||
| 903 | ret = p_UBSEC_ubsec_bits_to_bytes(k_len); | ||
| 904 | err: | ||
| 905 | return ret; | ||
| 906 | } | ||
| 907 | |||
| 908 | static int ubsec_dh_generate_key (DH *dh) | ||
| 909 | { | ||
| 910 | int ret = 0, | ||
| 911 | random_bits = 0, | ||
| 912 | pub_key_len = 0, | ||
| 913 | priv_key_len = 0, | ||
| 914 | fd; | ||
| 915 | BIGNUM *pub_key = NULL; | ||
| 916 | BIGNUM *priv_key = NULL; | ||
| 917 | |||
| 918 | /* | ||
| 919 | * How many bits should Random x be? dh_key.c | ||
| 920 | * sets the range from 0 to num_bits(modulus) ??? | ||
| 921 | */ | ||
| 922 | |||
| 923 | if (dh->priv_key == NULL) | ||
| 924 | { | ||
| 925 | priv_key = BN_new(); | ||
| 926 | if (priv_key == NULL) goto err; | ||
| 927 | priv_key_len = BN_num_bits(dh->p); | ||
| 928 | bn_wexpand(priv_key, dh->p->top); | ||
| 929 | do | ||
| 930 | if (!BN_rand_range(priv_key, dh->p)) goto err; | ||
| 931 | while (BN_is_zero(priv_key)); | ||
| 932 | random_bits = BN_num_bits(priv_key); | ||
| 933 | } | ||
| 934 | else | ||
| 935 | { | ||
| 936 | priv_key = dh->priv_key; | ||
| 937 | } | ||
| 938 | |||
| 939 | if (dh->pub_key == NULL) | ||
| 940 | { | ||
| 941 | pub_key = BN_new(); | ||
| 942 | pub_key_len = BN_num_bits(dh->p); | ||
| 943 | bn_wexpand(pub_key, dh->p->top); | ||
| 944 | if(pub_key == NULL) goto err; | ||
| 945 | } | ||
| 946 | else | ||
| 947 | { | ||
| 948 | pub_key = dh->pub_key; | ||
| 949 | } | ||
| 950 | |||
| 951 | if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) | ||
| 952 | { | ||
| 953 | const DH_METHOD *meth; | ||
| 954 | ENGINEerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE); | ||
| 955 | meth = DH_OpenSSL(); | ||
| 956 | ret = meth->generate_key(dh); | ||
| 957 | goto err; | ||
| 958 | } | ||
| 959 | |||
| 960 | if (p_UBSEC_diffie_hellman_generate_ioctl(fd, | ||
| 961 | (unsigned char *)priv_key->d, &priv_key_len, | ||
| 962 | (unsigned char *)pub_key->d, &pub_key_len, | ||
| 963 | (unsigned char *)dh->g->d, BN_num_bits(dh->g), | ||
| 964 | (unsigned char *)dh->p->d, BN_num_bits(dh->p), | ||
| 965 | 0, 0, random_bits) != 0) | ||
| 966 | { | ||
| 967 | /* Hardware's a no go, failover to software */ | ||
| 968 | const DH_METHOD *meth; | ||
| 969 | |||
| 970 | ENGINEerr(UBSEC_F_UBSEC_DH_COMPUTE_KEY, UBSEC_R_REQUEST_FAILED); | ||
| 971 | p_UBSEC_ubsec_close(fd); | ||
| 972 | |||
| 973 | meth = DH_OpenSSL(); | ||
| 974 | ret = meth->generate_key(dh); | ||
| 975 | |||
| 976 | goto err; | ||
| 977 | } | ||
| 978 | |||
| 979 | p_UBSEC_ubsec_close(fd); | ||
| 980 | |||
| 981 | dh->pub_key = pub_key; | ||
| 982 | dh->pub_key->top = (pub_key_len + BN_BITS2-1) / BN_BITS2; | ||
| 983 | dh->priv_key = priv_key; | ||
| 984 | dh->priv_key->top = (priv_key_len + BN_BITS2-1) / BN_BITS2; | ||
| 985 | |||
| 986 | ret = 1; | ||
| 987 | err: | ||
| 988 | return ret; | ||
| 989 | } | ||
| 990 | #endif | ||
| 991 | |||
| 992 | #ifdef NOT_USED | ||
| 993 | static int ubsec_rand_bytes(unsigned char * buf, | ||
| 994 | int num) | ||
| 995 | { | ||
| 996 | int ret = 0, | ||
| 997 | fd; | ||
| 998 | |||
| 999 | if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) | ||
| 1000 | { | ||
| 1001 | const RAND_METHOD *meth; | ||
| 1002 | ENGINEerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE); | ||
| 1003 | num = p_UBSEC_ubsec_bits_to_bytes(num); | ||
| 1004 | meth = RAND_SSLeay(); | ||
| 1005 | meth->seed(buf, num); | ||
| 1006 | ret = meth->bytes(buf, num); | ||
| 1007 | goto err; | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | num *= 8; /* bytes to bits */ | ||
| 1011 | |||
| 1012 | if (p_UBSEC_rng_ioctl(fd, | ||
| 1013 | UBSEC_RNG_DIRECT, | ||
| 1014 | buf, | ||
| 1015 | &num) != 0) | ||
| 1016 | { | ||
| 1017 | /* Hardware's a no go, failover to software */ | ||
| 1018 | const RAND_METHOD *meth; | ||
| 1019 | |||
| 1020 | ENGINEerr(UBSEC_F_UBSEC_RNG_BYTES, UBSEC_R_REQUEST_FAILED); | ||
| 1021 | p_UBSEC_ubsec_close(fd); | ||
| 1022 | |||
| 1023 | num = p_UBSEC_ubsec_bits_to_bytes(num); | ||
| 1024 | meth = RAND_SSLeay(); | ||
| 1025 | meth->seed(buf, num); | ||
| 1026 | ret = meth->bytes(buf, num); | ||
| 1027 | |||
| 1028 | goto err; | ||
| 1029 | } | ||
| 1030 | |||
| 1031 | p_UBSEC_ubsec_close(fd); | ||
| 1032 | |||
| 1033 | ret = 1; | ||
| 1034 | err: | ||
| 1035 | return(ret); | ||
| 1036 | } | ||
| 1037 | |||
| 1038 | |||
| 1039 | static int ubsec_rand_status(void) | ||
| 1040 | { | ||
| 1041 | return 0; | ||
| 1042 | } | ||
| 1043 | #endif | ||
| 1044 | |||
| 1045 | /* This stuff is needed if this ENGINE is being compiled into a self-contained | ||
| 1046 | * shared-library. */ | ||
| 1047 | #ifdef ENGINE_DYNAMIC_SUPPORT | ||
| 1048 | static int bind_fn(ENGINE *e, const char *id) | ||
| 1049 | { | ||
| 1050 | if(id && (strcmp(id, engine_ubsec_id) != 0)) | ||
| 1051 | return 0; | ||
| 1052 | if(!bind_helper(e)) | ||
| 1053 | return 0; | ||
| 1054 | return 1; | ||
| 1055 | } | ||
| 1056 | IMPLEMENT_DYNAMIC_CHECK_FN() | ||
| 1057 | IMPLEMENT_DYNAMIC_BIND_FN(bind_fn) | ||
| 1058 | #endif /* ENGINE_DYNAMIC_SUPPORT */ | ||
| 1059 | |||
| 1060 | #endif /* !OPENSSL_NO_HW_UBSEC */ | ||
| 1061 | #endif /* !OPENSSL_NO_HW */ | ||
diff --git a/src/lib/libcrypto/engine/hw_ubsec_err.c b/src/lib/libcrypto/engine/hw_ubsec_err.c deleted file mode 100644 index d707331fc2..0000000000 --- a/src/lib/libcrypto/engine/hw_ubsec_err.c +++ /dev/null | |||
| @@ -1,151 +0,0 @@ | |||
| 1 | /* hw_ubsec_err.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 | /* 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 "hw_ubsec_err.h" | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | static ERR_STRING_DATA UBSEC_str_functs[]= | ||
| 68 | { | ||
| 69 | {ERR_PACK(0,UBSEC_F_UBSEC_CTRL,0), "UBSEC_CTRL"}, | ||
| 70 | {ERR_PACK(0,UBSEC_F_UBSEC_DH_COMPUTE_KEY,0), "UBSEC_DH_COMPUTE_KEY"}, | ||
| 71 | {ERR_PACK(0,UBSEC_F_UBSEC_DSA_SIGN,0), "UBSEC_DSA_SIGN"}, | ||
| 72 | {ERR_PACK(0,UBSEC_F_UBSEC_DSA_VERIFY,0), "UBSEC_DSA_VERIFY"}, | ||
| 73 | {ERR_PACK(0,UBSEC_F_UBSEC_FINISH,0), "UBSEC_FINISH"}, | ||
| 74 | {ERR_PACK(0,UBSEC_F_UBSEC_INIT,0), "UBSEC_INIT"}, | ||
| 75 | {ERR_PACK(0,UBSEC_F_UBSEC_MOD_EXP,0), "UBSEC_MOD_EXP"}, | ||
| 76 | {ERR_PACK(0,UBSEC_F_UBSEC_RNG_BYTES,0), "UBSEC_RNG_BYTES"}, | ||
| 77 | {ERR_PACK(0,UBSEC_F_UBSEC_RSA_MOD_EXP,0), "UBSEC_RSA_MOD_EXP"}, | ||
| 78 | {ERR_PACK(0,UBSEC_F_UBSEC_RSA_MOD_EXP_CRT,0), "UBSEC_RSA_MOD_EXP_CRT"}, | ||
| 79 | {0,NULL} | ||
| 80 | }; | ||
| 81 | |||
| 82 | static ERR_STRING_DATA UBSEC_str_reasons[]= | ||
| 83 | { | ||
| 84 | {UBSEC_R_ALREADY_LOADED ,"already loaded"}, | ||
| 85 | {UBSEC_R_BN_EXPAND_FAIL ,"bn expand fail"}, | ||
| 86 | {UBSEC_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"}, | ||
| 87 | {UBSEC_R_DSO_FAILURE ,"dso failure"}, | ||
| 88 | {UBSEC_R_MISSING_KEY_COMPONENTS ,"missing key components"}, | ||
| 89 | {UBSEC_R_NOT_LOADED ,"not loaded"}, | ||
| 90 | {UBSEC_R_REQUEST_FAILED ,"request failed"}, | ||
| 91 | {UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL ,"size too large or too small"}, | ||
| 92 | {UBSEC_R_UNIT_FAILURE ,"unit failure"}, | ||
| 93 | {0,NULL} | ||
| 94 | }; | ||
| 95 | |||
| 96 | #endif | ||
| 97 | |||
| 98 | #ifdef UBSEC_LIB_NAME | ||
| 99 | static ERR_STRING_DATA UBSEC_lib_name[]= | ||
| 100 | { | ||
| 101 | {0 ,UBSEC_LIB_NAME}, | ||
| 102 | {0,NULL} | ||
| 103 | }; | ||
| 104 | #endif | ||
| 105 | |||
| 106 | |||
| 107 | static int UBSEC_lib_error_code=0; | ||
| 108 | static int UBSEC_error_init=1; | ||
| 109 | |||
| 110 | static void ERR_load_UBSEC_strings(void) | ||
| 111 | { | ||
| 112 | if (UBSEC_lib_error_code == 0) | ||
| 113 | UBSEC_lib_error_code=ERR_get_next_error_library(); | ||
| 114 | |||
| 115 | if (UBSEC_error_init) | ||
| 116 | { | ||
| 117 | UBSEC_error_init=0; | ||
| 118 | #ifndef OPENSSL_NO_ERR | ||
| 119 | ERR_load_strings(UBSEC_lib_error_code,UBSEC_str_functs); | ||
| 120 | ERR_load_strings(UBSEC_lib_error_code,UBSEC_str_reasons); | ||
| 121 | #endif | ||
| 122 | |||
| 123 | #ifdef UBSEC_LIB_NAME | ||
| 124 | UBSEC_lib_name->error = ERR_PACK(UBSEC_lib_error_code,0,0); | ||
| 125 | ERR_load_strings(0,UBSEC_lib_name); | ||
| 126 | #endif | ||
| 127 | } | ||
| 128 | } | ||
| 129 | |||
| 130 | static void ERR_unload_UBSEC_strings(void) | ||
| 131 | { | ||
| 132 | if (UBSEC_error_init == 0) | ||
| 133 | { | ||
| 134 | #ifndef OPENSSL_NO_ERR | ||
| 135 | ERR_unload_strings(UBSEC_lib_error_code,UBSEC_str_functs); | ||
| 136 | ERR_unload_strings(UBSEC_lib_error_code,UBSEC_str_reasons); | ||
| 137 | #endif | ||
| 138 | |||
| 139 | #ifdef UBSEC_LIB_NAME | ||
| 140 | ERR_unload_strings(0,UBSEC_lib_name); | ||
| 141 | #endif | ||
| 142 | UBSEC_error_init=1; | ||
| 143 | } | ||
| 144 | } | ||
| 145 | |||
| 146 | static void ERR_UBSEC_error(int function, int reason, char *file, int line) | ||
| 147 | { | ||
| 148 | if (UBSEC_lib_error_code == 0) | ||
| 149 | UBSEC_lib_error_code=ERR_get_next_error_library(); | ||
| 150 | ERR_PUT_error(UBSEC_lib_error_code,function,reason,file,line); | ||
| 151 | } | ||
diff --git a/src/lib/libcrypto/engine/hw_ubsec_err.h b/src/lib/libcrypto/engine/hw_ubsec_err.h deleted file mode 100644 index 023d3be771..0000000000 --- a/src/lib/libcrypto/engine/hw_ubsec_err.h +++ /dev/null | |||
| @@ -1,95 +0,0 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2001 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_UBSEC_ERR_H | ||
| 56 | #define HEADER_UBSEC_ERR_H | ||
| 57 | |||
| 58 | /* BEGIN ERROR CODES */ | ||
| 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 60 | * made after this point may be overwritten when the script is next run. | ||
| 61 | */ | ||
| 62 | static void ERR_load_UBSEC_strings(void); | ||
| 63 | static void ERR_unload_UBSEC_strings(void); | ||
| 64 | static void ERR_UBSEC_error(int function, int reason, char *file, int line); | ||
| 65 | #define UBSECerr(f,r) ERR_UBSEC_error((f),(r),__FILE__,__LINE__) | ||
| 66 | |||
| 67 | /* Error codes for the UBSEC functions. */ | ||
| 68 | |||
| 69 | /* Function codes. */ | ||
| 70 | #define UBSEC_F_UBSEC_CTRL 100 | ||
| 71 | #define UBSEC_F_UBSEC_DH_COMPUTE_KEY 101 | ||
| 72 | #define UBSEC_F_UBSEC_DSA_SIGN 102 | ||
| 73 | #define UBSEC_F_UBSEC_DSA_VERIFY 103 | ||
| 74 | #define UBSEC_F_UBSEC_FINISH 104 | ||
| 75 | #define UBSEC_F_UBSEC_INIT 105 | ||
| 76 | #define UBSEC_F_UBSEC_MOD_EXP 106 | ||
| 77 | #define UBSEC_F_UBSEC_RNG_BYTES 107 | ||
| 78 | #define UBSEC_F_UBSEC_RSA_MOD_EXP 108 | ||
| 79 | #define UBSEC_F_UBSEC_RSA_MOD_EXP_CRT 109 | ||
| 80 | |||
| 81 | /* Reason codes. */ | ||
| 82 | #define UBSEC_R_ALREADY_LOADED 100 | ||
| 83 | #define UBSEC_R_BN_EXPAND_FAIL 101 | ||
| 84 | #define UBSEC_R_CTRL_COMMAND_NOT_IMPLEMENTED 102 | ||
| 85 | #define UBSEC_R_DSO_FAILURE 103 | ||
| 86 | #define UBSEC_R_MISSING_KEY_COMPONENTS 104 | ||
| 87 | #define UBSEC_R_NOT_LOADED 105 | ||
| 88 | #define UBSEC_R_REQUEST_FAILED 106 | ||
| 89 | #define UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL 107 | ||
| 90 | #define UBSEC_R_UNIT_FAILURE 108 | ||
| 91 | |||
| 92 | #ifdef __cplusplus | ||
| 93 | } | ||
| 94 | #endif | ||
| 95 | #endif | ||
diff --git a/src/lib/libcrypto/engine/vendor_defns/aep.h b/src/lib/libcrypto/engine/vendor_defns/aep.h deleted file mode 100644 index 2b2792d2d6..0000000000 --- a/src/lib/libcrypto/engine/vendor_defns/aep.h +++ /dev/null | |||
| @@ -1,178 +0,0 @@ | |||
| 1 | /* This header declares the necessary definitions for using the exponentiation | ||
| 2 | * acceleration capabilities, and rnd number generation of the AEP card. | ||
| 3 | * | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * | ||
| 8 | * Some AEP defines | ||
| 9 | * | ||
| 10 | */ | ||
| 11 | |||
| 12 | /*Successful return value*/ | ||
| 13 | #define AEP_R_OK 0x00000000 | ||
| 14 | |||
| 15 | /*Miscelleanous unsuccessful return value*/ | ||
| 16 | #define AEP_R_GENERAL_ERROR 0x10000001 | ||
| 17 | |||
| 18 | /*Insufficient host memory*/ | ||
| 19 | #define AEP_R_HOST_MEMORY 0x10000002 | ||
| 20 | |||
| 21 | #define AEP_R_FUNCTION_FAILED 0x10000006 | ||
| 22 | |||
| 23 | /*Invalid arguments in function call*/ | ||
| 24 | #define AEP_R_ARGUMENTS_BAD 0x10020000 | ||
| 25 | |||
| 26 | #define AEP_R_NO_TARGET_RESOURCES 0x10030000 | ||
| 27 | |||
| 28 | /*Error occuring on socket operation*/ | ||
| 29 | #define AEP_R_SOCKERROR 0x10000010 | ||
| 30 | |||
| 31 | /*Socket has been closed from the other end*/ | ||
| 32 | #define AEP_R_SOCKEOF 0x10000011 | ||
| 33 | |||
| 34 | /*Invalid handles*/ | ||
| 35 | #define AEP_R_CONNECTION_HANDLE_INVALID 0x100000B3 | ||
| 36 | |||
| 37 | #define AEP_R_TRANSACTION_HANDLE_INVALID 0x10040000 | ||
| 38 | |||
| 39 | /*Transaction has not yet returned from accelerator*/ | ||
| 40 | #define AEP_R_TRANSACTION_NOT_READY 0x00010000 | ||
| 41 | |||
| 42 | /*There is already a thread waiting on this transaction*/ | ||
| 43 | #define AEP_R_TRANSACTION_CLAIMED 0x10050000 | ||
| 44 | |||
| 45 | /*The transaction timed out*/ | ||
| 46 | #define AEP_R_TIMED_OUT 0x10060000 | ||
| 47 | |||
| 48 | #define AEP_R_FXN_NOT_IMPLEMENTED 0x10070000 | ||
| 49 | |||
| 50 | #define AEP_R_TARGET_ERROR 0x10080000 | ||
| 51 | |||
| 52 | /*Error in the AEP daemon process*/ | ||
| 53 | #define AEP_R_DAEMON_ERROR 0x10090000 | ||
| 54 | |||
| 55 | /*Invalid ctx id*/ | ||
| 56 | #define AEP_R_INVALID_CTX_ID 0x10009000 | ||
| 57 | |||
| 58 | #define AEP_R_NO_KEY_MANAGER 0x1000a000 | ||
| 59 | |||
| 60 | /*Error obtaining a mutex*/ | ||
| 61 | #define AEP_R_MUTEX_BAD 0x000001A0 | ||
| 62 | |||
| 63 | /*Fxn call before AEP_Initialise ot after AEP_Finialise*/ | ||
| 64 | #define AEP_R_AEPAPI_NOT_INITIALIZED 0x10000190 | ||
| 65 | |||
| 66 | /*AEP_Initialise has already been called*/ | ||
| 67 | #define AEP_R_AEPAPI_ALREADY_INITIALIZED 0x10000191 | ||
| 68 | |||
| 69 | /*Maximum number of connections to daemon reached*/ | ||
| 70 | #define AEP_R_NO_MORE_CONNECTION_HNDLS 0x10000200 | ||
| 71 | |||
| 72 | /* | ||
| 73 | * | ||
| 74 | * Some AEP Type definitions | ||
| 75 | * | ||
| 76 | */ | ||
| 77 | |||
| 78 | /* an unsigned 8-bit value */ | ||
| 79 | typedef unsigned char AEP_U8; | ||
| 80 | |||
| 81 | /* an unsigned 8-bit character */ | ||
| 82 | typedef char AEP_CHAR; | ||
| 83 | |||
| 84 | /* a BYTE-sized Boolean flag */ | ||
| 85 | typedef AEP_U8 AEP_BBOOL; | ||
| 86 | |||
| 87 | /*Unsigned value, at least 16 bits long*/ | ||
| 88 | typedef unsigned short AEP_U16; | ||
| 89 | |||
| 90 | /* an unsigned value, at least 32 bits long */ | ||
| 91 | #ifdef SIXTY_FOUR_BIT_LONG | ||
| 92 | typedef unsigned int AEP_U32; | ||
| 93 | #else | ||
| 94 | typedef unsigned long AEP_U32; | ||
| 95 | #endif | ||
| 96 | |||
| 97 | #ifdef SIXTY_FOUR_BIT_LONG | ||
| 98 | typedef unsigned long AEP_U64; | ||
| 99 | #else | ||
| 100 | typedef struct { unsigned long l1, l2; } AEP_U64; | ||
| 101 | #endif | ||
| 102 | |||
| 103 | /* at least 32 bits; each bit is a Boolean flag */ | ||
| 104 | typedef AEP_U32 AEP_FLAGS; | ||
| 105 | |||
| 106 | typedef AEP_U8 *AEP_U8_PTR; | ||
| 107 | typedef AEP_CHAR *AEP_CHAR_PTR; | ||
| 108 | typedef AEP_U32 *AEP_U32_PTR; | ||
| 109 | typedef AEP_U64 *AEP_U64_PTR; | ||
| 110 | typedef void *AEP_VOID_PTR; | ||
| 111 | |||
| 112 | /* Pointer to a AEP_VOID_PTR-- i.e., pointer to pointer to void */ | ||
| 113 | typedef AEP_VOID_PTR *AEP_VOID_PTR_PTR; | ||
| 114 | |||
| 115 | /*Used to identify an AEP connection handle*/ | ||
| 116 | typedef AEP_U32 AEP_CONNECTION_HNDL; | ||
| 117 | |||
| 118 | /*Pointer to an AEP connection handle*/ | ||
| 119 | typedef AEP_CONNECTION_HNDL *AEP_CONNECTION_HNDL_PTR; | ||
| 120 | |||
| 121 | /*Used by an application (in conjunction with the apps process id) to | ||
| 122 | identify an individual transaction*/ | ||
| 123 | typedef AEP_U32 AEP_TRANSACTION_ID; | ||
| 124 | |||
| 125 | /*Pointer to an applications transaction identifier*/ | ||
| 126 | typedef AEP_TRANSACTION_ID *AEP_TRANSACTION_ID_PTR; | ||
| 127 | |||
| 128 | /*Return value type*/ | ||
| 129 | typedef AEP_U32 AEP_RV; | ||
| 130 | |||
| 131 | #define MAX_PROCESS_CONNECTIONS 256 | ||
| 132 | |||
| 133 | #define RAND_BLK_SIZE 1024 | ||
| 134 | |||
| 135 | typedef enum{ | ||
| 136 | NotConnected= 0, | ||
| 137 | Connected= 1, | ||
| 138 | InUse= 2 | ||
| 139 | } AEP_CONNECTION_STATE; | ||
| 140 | |||
| 141 | |||
| 142 | typedef struct AEP_CONNECTION_ENTRY{ | ||
| 143 | AEP_CONNECTION_STATE conn_state; | ||
| 144 | AEP_CONNECTION_HNDL conn_hndl; | ||
| 145 | } AEP_CONNECTION_ENTRY; | ||
| 146 | |||
| 147 | |||
| 148 | typedef AEP_RV t_AEP_OpenConnection(AEP_CONNECTION_HNDL_PTR phConnection); | ||
| 149 | typedef AEP_RV t_AEP_CloseConnection(AEP_CONNECTION_HNDL hConnection); | ||
| 150 | |||
| 151 | typedef AEP_RV t_AEP_ModExp(AEP_CONNECTION_HNDL hConnection, | ||
| 152 | AEP_VOID_PTR pA, AEP_VOID_PTR pP, | ||
| 153 | AEP_VOID_PTR pN, | ||
| 154 | AEP_VOID_PTR pResult, | ||
| 155 | AEP_TRANSACTION_ID* pidTransID); | ||
| 156 | |||
| 157 | typedef AEP_RV t_AEP_ModExpCrt(AEP_CONNECTION_HNDL hConnection, | ||
| 158 | AEP_VOID_PTR pA, AEP_VOID_PTR pP, | ||
| 159 | AEP_VOID_PTR pQ, | ||
| 160 | AEP_VOID_PTR pDmp1, AEP_VOID_PTR pDmq1, | ||
| 161 | AEP_VOID_PTR pIqmp, | ||
| 162 | AEP_VOID_PTR pResult, | ||
| 163 | AEP_TRANSACTION_ID* pidTransID); | ||
| 164 | |||
| 165 | #ifdef AEPRAND | ||
| 166 | typedef AEP_RV t_AEP_GenRandom(AEP_CONNECTION_HNDL hConnection, | ||
| 167 | AEP_U32 Len, | ||
| 168 | AEP_U32 Type, | ||
| 169 | AEP_VOID_PTR pResult, | ||
| 170 | AEP_TRANSACTION_ID* pidTransID); | ||
| 171 | #endif | ||
| 172 | |||
| 173 | typedef AEP_RV t_AEP_Initialize(AEP_VOID_PTR pInitArgs); | ||
| 174 | typedef AEP_RV t_AEP_Finalize(); | ||
| 175 | typedef AEP_RV t_AEP_SetBNCallBacks(AEP_RV (*GetBigNumSizeFunc)(), | ||
| 176 | AEP_RV (*MakeAEPBigNumFunc)(), | ||
| 177 | AEP_RV (*ConverAEPBigNumFunc)()); | ||
| 178 | |||
diff --git a/src/lib/libcrypto/engine/vendor_defns/atalla.h b/src/lib/libcrypto/engine/vendor_defns/atalla.h deleted file mode 100644 index 149970d441..0000000000 --- a/src/lib/libcrypto/engine/vendor_defns/atalla.h +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | /* This header declares the necessary definitions for using the exponentiation | ||
| 2 | * acceleration capabilities of Atalla cards. The only cryptographic operation | ||
| 3 | * is performed by "ASI_RSAPrivateKeyOpFn" and this takes a structure that | ||
| 4 | * defines an "RSA private key". However, it is really only performing a | ||
| 5 | * regular mod_exp using the supplied modulus and exponent - no CRT form is | ||
| 6 | * being used. Hence, it is a generic mod_exp function in disguise, and we use | ||
| 7 | * it as such. | ||
| 8 | * | ||
| 9 | * Thanks to the people at Atalla for letting me know these definitions are | ||
| 10 | * fine and that they can be reproduced here. | ||
| 11 | * | ||
| 12 | * Geoff. | ||
| 13 | */ | ||
| 14 | |||
| 15 | typedef struct ItemStr | ||
| 16 | { | ||
| 17 | unsigned char *data; | ||
| 18 | int len; | ||
| 19 | } Item; | ||
| 20 | |||
| 21 | typedef struct RSAPrivateKeyStr | ||
| 22 | { | ||
| 23 | void *reserved; | ||
| 24 | Item version; | ||
| 25 | Item modulus; | ||
| 26 | Item publicExponent; | ||
| 27 | Item privateExponent; | ||
| 28 | Item prime[2]; | ||
| 29 | Item exponent[2]; | ||
| 30 | Item coefficient; | ||
| 31 | } RSAPrivateKey; | ||
| 32 | |||
| 33 | /* Predeclare the function pointer types that we dynamically load from the DSO. | ||
| 34 | * These use the same names and form that Ben's original support code had (in | ||
| 35 | * crypto/bn/bn_exp.c) unless of course I've inadvertently changed the style | ||
| 36 | * somewhere along the way! | ||
| 37 | */ | ||
| 38 | |||
| 39 | typedef int tfnASI_GetPerformanceStatistics(int reset_flag, | ||
| 40 | unsigned int *ret_buf); | ||
| 41 | |||
| 42 | typedef int tfnASI_GetHardwareConfig(long card_num, unsigned int *ret_buf); | ||
| 43 | |||
| 44 | typedef int tfnASI_RSAPrivateKeyOpFn(RSAPrivateKey * rsaKey, | ||
| 45 | unsigned char *output, | ||
| 46 | unsigned char *input, | ||
| 47 | unsigned int modulus_len); | ||
| 48 | |||
diff --git a/src/lib/libcrypto/engine/vendor_defns/cswift.h b/src/lib/libcrypto/engine/vendor_defns/cswift.h deleted file mode 100644 index 60079326bb..0000000000 --- a/src/lib/libcrypto/engine/vendor_defns/cswift.h +++ /dev/null | |||
| @@ -1,234 +0,0 @@ | |||
| 1 | /* Attribution notice: Rainbow have generously allowed me to reproduce | ||
| 2 | * the necessary definitions here from their API. This means the support | ||
| 3 | * can build independently of whether application builders have the | ||
| 4 | * API or hardware. This will allow developers to easily produce software | ||
| 5 | * that has latent hardware support for any users that have accelertors | ||
| 6 | * installed, without the developers themselves needing anything extra. | ||
| 7 | * | ||
| 8 | * I have only clipped the parts from the CryptoSwift header files that | ||
| 9 | * are (or seem) relevant to the CryptoSwift support code. This is | ||
| 10 | * simply to keep the file sizes reasonable. | ||
| 11 | * [Geoff] | ||
| 12 | */ | ||
| 13 | |||
| 14 | |||
| 15 | /* NB: These type widths do *not* seem right in general, in particular | ||
| 16 | * they're not terribly friendly to 64-bit architectures (unsigned long) | ||
| 17 | * will be 64-bit on IA-64 for a start. I'm leaving these alone as they | ||
| 18 | * agree with Rainbow's API and this will only be called into question | ||
| 19 | * on platforms with Rainbow support anyway! ;-) */ | ||
| 20 | |||
| 21 | #ifdef __cplusplus | ||
| 22 | extern "C" { | ||
| 23 | #endif /* __cplusplus */ | ||
| 24 | |||
| 25 | typedef long SW_STATUS; /* status */ | ||
| 26 | typedef unsigned char SW_BYTE; /* 8 bit byte */ | ||
| 27 | typedef unsigned short SW_U16; /* 16 bit number */ | ||
| 28 | #if defined(_IRIX) | ||
| 29 | #include <sgidefs.h> | ||
| 30 | typedef __uint32_t SW_U32; | ||
| 31 | #else | ||
| 32 | typedef unsigned long SW_U32; /* 32 bit integer */ | ||
| 33 | #endif | ||
| 34 | |||
| 35 | #if defined(OPENSSL_SYS_WIN32) | ||
| 36 | typedef struct _SW_U64 { | ||
| 37 | SW_U32 low32; | ||
| 38 | SW_U32 high32; | ||
| 39 | } SW_U64; /* 64 bit integer */ | ||
| 40 | #elif defined(OPENSSL_SYS_MACINTOSH_CLASSIC) | ||
| 41 | typedef longlong SW_U64 | ||
| 42 | #else /* Unix variants */ | ||
| 43 | typedef struct _SW_U64 { | ||
| 44 | SW_U32 low32; | ||
| 45 | SW_U32 high32; | ||
| 46 | } SW_U64; /* 64 bit integer */ | ||
| 47 | #endif | ||
| 48 | |||
| 49 | /* status codes */ | ||
| 50 | #define SW_OK (0L) | ||
| 51 | #define SW_ERR_BASE (-10000L) | ||
| 52 | #define SW_ERR_NO_CARD (SW_ERR_BASE-1) /* The Card is not present */ | ||
| 53 | #define SW_ERR_CARD_NOT_READY (SW_ERR_BASE-2) /* The card has not powered */ | ||
| 54 | /* up yet */ | ||
| 55 | #define SW_ERR_TIME_OUT (SW_ERR_BASE-3) /* Execution of a command */ | ||
| 56 | /* time out */ | ||
| 57 | #define SW_ERR_NO_EXECUTE (SW_ERR_BASE-4) /* The Card failed to */ | ||
| 58 | /* execute the command */ | ||
| 59 | #define SW_ERR_INPUT_NULL_PTR (SW_ERR_BASE-5) /* a required pointer is */ | ||
| 60 | /* NULL */ | ||
| 61 | #define SW_ERR_INPUT_SIZE (SW_ERR_BASE-6) /* size is invalid, too */ | ||
| 62 | /* small, too large. */ | ||
| 63 | #define SW_ERR_INVALID_HANDLE (SW_ERR_BASE-7) /* Invalid SW_ACC_CONTEXT */ | ||
| 64 | /* handle */ | ||
| 65 | #define SW_ERR_PENDING (SW_ERR_BASE-8) /* A request is already out- */ | ||
| 66 | /* standing at this */ | ||
| 67 | /* context handle */ | ||
| 68 | #define SW_ERR_AVAILABLE (SW_ERR_BASE-9) /* A result is available. */ | ||
| 69 | #define SW_ERR_NO_PENDING (SW_ERR_BASE-10)/* No request is pending. */ | ||
| 70 | #define SW_ERR_NO_MEMORY (SW_ERR_BASE-11)/* Not enough memory */ | ||
| 71 | #define SW_ERR_BAD_ALGORITHM (SW_ERR_BASE-12)/* Invalid algorithm type */ | ||
| 72 | /* in SW_PARAM structure */ | ||
| 73 | #define SW_ERR_MISSING_KEY (SW_ERR_BASE-13)/* No key is associated with */ | ||
| 74 | /* context. */ | ||
| 75 | /* swAttachKeyParam() is */ | ||
| 76 | /* not called. */ | ||
| 77 | #define SW_ERR_KEY_CMD_MISMATCH \ | ||
| 78 | (SW_ERR_BASE-14)/* Cannot perform requested */ | ||
| 79 | /* SW_COMMAND_CODE since */ | ||
| 80 | /* key attached via */ | ||
| 81 | /* swAttachKeyParam() */ | ||
| 82 | /* cannot be used for this*/ | ||
| 83 | /* SW_COMMAND_CODE. */ | ||
| 84 | #define SW_ERR_NOT_IMPLEMENTED \ | ||
| 85 | (SW_ERR_BASE-15)/* Not implemented */ | ||
| 86 | #define SW_ERR_BAD_COMMAND (SW_ERR_BASE-16)/* Bad command code */ | ||
| 87 | #define SW_ERR_BAD_ITEM_SIZE (SW_ERR_BASE-17)/* too small or too large in */ | ||
| 88 | /* the "initems" or */ | ||
| 89 | /* "outitems". */ | ||
| 90 | #define SW_ERR_BAD_ACCNUM (SW_ERR_BASE-18)/* Bad accelerator number */ | ||
| 91 | #define SW_ERR_SELFTEST_FAIL (SW_ERR_BASE-19)/* At least one of the self */ | ||
| 92 | /* test fail, look at the */ | ||
| 93 | /* selfTestBitmap in */ | ||
| 94 | /* SW_ACCELERATOR_INFO for*/ | ||
| 95 | /* details. */ | ||
| 96 | #define SW_ERR_MISALIGN (SW_ERR_BASE-20)/* Certain alogrithms require*/ | ||
| 97 | /* key materials aligned */ | ||
| 98 | /* in certain order, e.g. */ | ||
| 99 | /* 128 bit for CRT */ | ||
| 100 | #define SW_ERR_OUTPUT_NULL_PTR \ | ||
| 101 | (SW_ERR_BASE-21)/* a required pointer is */ | ||
| 102 | /* NULL */ | ||
| 103 | #define SW_ERR_OUTPUT_SIZE \ | ||
| 104 | (SW_ERR_BASE-22)/* size is invalid, too */ | ||
| 105 | /* small, too large. */ | ||
| 106 | #define SW_ERR_FIRMWARE_CHECKSUM \ | ||
| 107 | (SW_ERR_BASE-23)/* firmware checksum mismatch*/ | ||
| 108 | /* download failed. */ | ||
| 109 | #define SW_ERR_UNKNOWN_FIRMWARE \ | ||
| 110 | (SW_ERR_BASE-24)/* unknown firmware error */ | ||
| 111 | #define SW_ERR_INTERRUPT (SW_ERR_BASE-25)/* request is abort when */ | ||
| 112 | /* it's waiting to be */ | ||
| 113 | /* completed. */ | ||
| 114 | #define SW_ERR_NVWRITE_FAIL (SW_ERR_BASE-26)/* error in writing to Non- */ | ||
| 115 | /* volatile memory */ | ||
| 116 | #define SW_ERR_NVWRITE_RANGE (SW_ERR_BASE-27)/* out of range error in */ | ||
| 117 | /* writing to NV memory */ | ||
| 118 | #define SW_ERR_RNG_ERROR (SW_ERR_BASE-28)/* Random Number Generation */ | ||
| 119 | /* failure */ | ||
| 120 | #define SW_ERR_DSS_FAILURE (SW_ERR_BASE-29)/* DSS Sign or Verify failure*/ | ||
| 121 | #define SW_ERR_MODEXP_FAILURE (SW_ERR_BASE-30)/* Failure in various math */ | ||
| 122 | /* calculations */ | ||
| 123 | #define SW_ERR_ONBOARD_MEMORY (SW_ERR_BASE-31)/* Error in accessing on - */ | ||
| 124 | /* board memory */ | ||
| 125 | #define SW_ERR_FIRMWARE_VERSION \ | ||
| 126 | (SW_ERR_BASE-32)/* Wrong version in firmware */ | ||
| 127 | /* update */ | ||
| 128 | #define SW_ERR_ZERO_WORKING_ACCELERATOR \ | ||
| 129 | (SW_ERR_BASE-44)/* All accelerators are bad */ | ||
| 130 | |||
| 131 | |||
| 132 | /* algorithm type */ | ||
| 133 | #define SW_ALG_CRT 1 | ||
| 134 | #define SW_ALG_EXP 2 | ||
| 135 | #define SW_ALG_DSA 3 | ||
| 136 | #define SW_ALG_NVDATA 4 | ||
| 137 | |||
| 138 | /* command code */ | ||
| 139 | #define SW_CMD_MODEXP_CRT 1 /* perform Modular Exponentiation using */ | ||
| 140 | /* Chinese Remainder Theorem (CRT) */ | ||
| 141 | #define SW_CMD_MODEXP 2 /* perform Modular Exponentiation */ | ||
| 142 | #define SW_CMD_DSS_SIGN 3 /* perform DSS sign */ | ||
| 143 | #define SW_CMD_DSS_VERIFY 4 /* perform DSS verify */ | ||
| 144 | #define SW_CMD_RAND 5 /* perform random number generation */ | ||
| 145 | #define SW_CMD_NVREAD 6 /* perform read to nonvolatile RAM */ | ||
| 146 | #define SW_CMD_NVWRITE 7 /* perform write to nonvolatile RAM */ | ||
| 147 | |||
| 148 | typedef SW_U32 SW_ALGTYPE; /* alogrithm type */ | ||
| 149 | typedef SW_U32 SW_STATE; /* state */ | ||
| 150 | typedef SW_U32 SW_COMMAND_CODE; /* command code */ | ||
| 151 | typedef SW_U32 SW_COMMAND_BITMAP[4]; /* bitmap */ | ||
| 152 | |||
| 153 | typedef struct _SW_LARGENUMBER { | ||
| 154 | SW_U32 nbytes; /* number of bytes in the buffer "value" */ | ||
| 155 | SW_BYTE* value; /* the large integer as a string of */ | ||
| 156 | /* bytes in network (big endian) order */ | ||
| 157 | } SW_LARGENUMBER; | ||
| 158 | |||
| 159 | #if defined(OPENSSL_SYS_WIN32) | ||
| 160 | #include <windows.h> | ||
| 161 | typedef HANDLE SW_OSHANDLE; /* handle to kernel object */ | ||
| 162 | #define SW_OS_INVALID_HANDLE INVALID_HANDLE_VALUE | ||
| 163 | #define SW_CALLCONV _stdcall | ||
| 164 | #elif defined(OPENSSL_SYS_MACINTOSH_CLASSIC) | ||
| 165 | /* async callback mechanisms */ | ||
| 166 | /* swiftCallbackLevel */ | ||
| 167 | #define SW_MAC_CALLBACK_LEVEL_NO 0 | ||
| 168 | #define SW_MAC_CALLBACK_LEVEL_HARDWARE 1 /* from the hardware ISR */ | ||
| 169 | #define SW_MAC_CALLBACK_LEVEL_SECONDARY 2 /* as secondary ISR */ | ||
| 170 | typedef int SW_MAC_CALLBACK_LEVEL; | ||
| 171 | typedef int SW_OSHANDLE; | ||
| 172 | #define SW_OS_INVALID_HANDLE (-1) | ||
| 173 | #define SW_CALLCONV | ||
| 174 | #else /* Unix variants */ | ||
| 175 | typedef int SW_OSHANDLE; /* handle to driver */ | ||
| 176 | #define SW_OS_INVALID_HANDLE (-1) | ||
| 177 | #define SW_CALLCONV | ||
| 178 | #endif | ||
| 179 | |||
| 180 | typedef struct _SW_CRT { | ||
| 181 | SW_LARGENUMBER p; /* prime number p */ | ||
| 182 | SW_LARGENUMBER q; /* prime number q */ | ||
| 183 | SW_LARGENUMBER dmp1; /* exponent1 */ | ||
| 184 | SW_LARGENUMBER dmq1; /* exponent2 */ | ||
| 185 | SW_LARGENUMBER iqmp; /* CRT coefficient */ | ||
| 186 | } SW_CRT; | ||
| 187 | |||
| 188 | typedef struct _SW_EXP { | ||
| 189 | SW_LARGENUMBER modulus; /* modulus */ | ||
| 190 | SW_LARGENUMBER exponent;/* exponent */ | ||
| 191 | } SW_EXP; | ||
| 192 | |||
| 193 | typedef struct _SW_DSA { | ||
| 194 | SW_LARGENUMBER p; /* */ | ||
| 195 | SW_LARGENUMBER q; /* */ | ||
| 196 | SW_LARGENUMBER g; /* */ | ||
| 197 | SW_LARGENUMBER key; /* private/public key */ | ||
| 198 | } SW_DSA; | ||
| 199 | |||
| 200 | typedef struct _SW_NVDATA { | ||
| 201 | SW_U32 accnum; /* accelerator board number */ | ||
| 202 | SW_U32 offset; /* offset in byte */ | ||
| 203 | } SW_NVDATA; | ||
| 204 | |||
| 205 | typedef struct _SW_PARAM { | ||
| 206 | SW_ALGTYPE type; /* type of the alogrithm */ | ||
| 207 | union { | ||
| 208 | SW_CRT crt; | ||
| 209 | SW_EXP exp; | ||
| 210 | SW_DSA dsa; | ||
| 211 | SW_NVDATA nvdata; | ||
| 212 | } up; | ||
| 213 | } SW_PARAM; | ||
| 214 | |||
| 215 | typedef SW_U32 SW_CONTEXT_HANDLE; /* opaque context handle */ | ||
| 216 | |||
| 217 | |||
| 218 | /* Now the OpenSSL bits, these function types are the for the function | ||
| 219 | * pointers that will bound into the Rainbow shared libraries. */ | ||
| 220 | typedef SW_STATUS SW_CALLCONV t_swAcquireAccContext(SW_CONTEXT_HANDLE *hac); | ||
| 221 | typedef SW_STATUS SW_CALLCONV t_swAttachKeyParam(SW_CONTEXT_HANDLE hac, | ||
| 222 | SW_PARAM *key_params); | ||
| 223 | typedef SW_STATUS SW_CALLCONV t_swSimpleRequest(SW_CONTEXT_HANDLE hac, | ||
| 224 | SW_COMMAND_CODE cmd, | ||
| 225 | SW_LARGENUMBER pin[], | ||
| 226 | SW_U32 pin_count, | ||
| 227 | SW_LARGENUMBER pout[], | ||
| 228 | SW_U32 pout_count); | ||
| 229 | typedef SW_STATUS SW_CALLCONV t_swReleaseAccContext(SW_CONTEXT_HANDLE hac); | ||
| 230 | |||
| 231 | #ifdef __cplusplus | ||
| 232 | } | ||
| 233 | #endif /* __cplusplus */ | ||
| 234 | |||
diff --git a/src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h b/src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h deleted file mode 100644 index 296636e81a..0000000000 --- a/src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h +++ /dev/null | |||
| @@ -1,149 +0,0 @@ | |||
| 1 | /**********************************************************************/ | ||
| 2 | /* */ | ||
| 3 | /* Prototypes of the CCA verbs used by the 4758 CCA openssl driver */ | ||
| 4 | /* */ | ||
| 5 | /* Maurice Gittens <maurice@gittens.nl> */ | ||
| 6 | /* */ | ||
| 7 | /**********************************************************************/ | ||
| 8 | |||
| 9 | #ifndef __HW_4758_CCA__ | ||
| 10 | #define __HW_4758_CCA__ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * Only WIN32 support for now | ||
| 14 | */ | ||
| 15 | #if defined(WIN32) | ||
| 16 | |||
| 17 | #define CCA_LIB_NAME "CSUNSAPI" | ||
| 18 | |||
| 19 | #define CSNDPKX "CSNDPKX_32" | ||
| 20 | #define CSNDKRR "CSNDKRR_32" | ||
| 21 | #define CSNDPKE "CSNDPKE_32" | ||
| 22 | #define CSNDPKD "CSNDPKD_32" | ||
| 23 | #define CSNDDSV "CSNDDSV_32" | ||
| 24 | #define CSNDDSG "CSNDDSG_32" | ||
| 25 | #define CSNBRNG "CSNBRNG_32" | ||
| 26 | |||
| 27 | #define SECURITYAPI __stdcall | ||
| 28 | #else | ||
| 29 | /* Fixme!! | ||
| 30 | Find out the values of these constants for other platforms. | ||
| 31 | */ | ||
| 32 | #define CCA_LIB_NAME "CSUNSAPI" | ||
| 33 | |||
| 34 | #define CSNDPKX "CSNDPKX" | ||
| 35 | #define CSNDKRR "CSNDKRR" | ||
| 36 | #define CSNDPKE "CSNDPKE" | ||
| 37 | #define CSNDPKD "CSNDPKD" | ||
| 38 | #define CSNDDSV "CSNDDSV" | ||
| 39 | #define CSNDDSG "CSNDDSG" | ||
| 40 | #define CSNBRNG "CSNBRNG" | ||
| 41 | |||
| 42 | #define SECURITYAPI | ||
| 43 | #endif | ||
| 44 | |||
| 45 | /* | ||
| 46 | * security API prototypes | ||
| 47 | */ | ||
| 48 | |||
| 49 | /* PKA Key Record Read */ | ||
| 50 | typedef void (SECURITYAPI *F_KEYRECORDREAD) | ||
| 51 | (long * return_code, | ||
| 52 | long * reason_code, | ||
| 53 | long * exit_data_length, | ||
| 54 | unsigned char * exit_data, | ||
| 55 | long * rule_array_count, | ||
| 56 | unsigned char * rule_array, | ||
| 57 | unsigned char * key_label, | ||
| 58 | long * key_token_length, | ||
| 59 | unsigned char * key_token); | ||
| 60 | |||
| 61 | /* Random Number Generate */ | ||
| 62 | typedef void (SECURITYAPI *F_RANDOMNUMBERGENERATE) | ||
| 63 | (long * return_code, | ||
| 64 | long * reason_code, | ||
| 65 | long * exit_data_length, | ||
| 66 | unsigned char * exit_data, | ||
| 67 | unsigned char * form, | ||
| 68 | unsigned char * random_number); | ||
| 69 | |||
| 70 | /* Digital Signature Generate */ | ||
| 71 | typedef void (SECURITYAPI *F_DIGITALSIGNATUREGENERATE) | ||
| 72 | (long * return_code, | ||
| 73 | long * reason_code, | ||
| 74 | long * exit_data_length, | ||
| 75 | unsigned char * exit_data, | ||
| 76 | long * rule_array_count, | ||
| 77 | unsigned char * rule_array, | ||
| 78 | long * PKA_private_key_id_length, | ||
| 79 | unsigned char * PKA_private_key_id, | ||
| 80 | long * hash_length, | ||
| 81 | unsigned char * hash, | ||
| 82 | long * signature_field_length, | ||
| 83 | long * signature_bit_length, | ||
| 84 | unsigned char * signature_field); | ||
| 85 | |||
| 86 | /* Digital Signature Verify */ | ||
| 87 | typedef void (SECURITYAPI *F_DIGITALSIGNATUREVERIFY)( | ||
| 88 | long * return_code, | ||
| 89 | long * reason_code, | ||
| 90 | long * exit_data_length, | ||
| 91 | unsigned char * exit_data, | ||
| 92 | long * rule_array_count, | ||
| 93 | unsigned char * rule_array, | ||
| 94 | long * PKA_public_key_id_length, | ||
| 95 | unsigned char * PKA_public_key_id, | ||
| 96 | long * hash_length, | ||
| 97 | unsigned char * hash, | ||
| 98 | long * signature_field_length, | ||
| 99 | unsigned char * signature_field); | ||
| 100 | |||
| 101 | /* PKA Public Key Extract */ | ||
| 102 | typedef void (SECURITYAPI *F_PUBLICKEYEXTRACT)( | ||
| 103 | long * return_code, | ||
| 104 | long * reason_code, | ||
| 105 | long * exit_data_length, | ||
| 106 | unsigned char * exit_data, | ||
| 107 | long * rule_array_count, | ||
| 108 | unsigned char * rule_array, | ||
| 109 | long * source_key_identifier_length, | ||
| 110 | unsigned char * source_key_identifier, | ||
| 111 | long * target_key_token_length, | ||
| 112 | unsigned char * target_key_token); | ||
| 113 | |||
| 114 | /* PKA Encrypt */ | ||
| 115 | typedef void (SECURITYAPI *F_PKAENCRYPT) | ||
| 116 | (long * return_code, | ||
| 117 | long * reason_code, | ||
| 118 | long * exit_data_length, | ||
| 119 | unsigned char * exit_data, | ||
| 120 | long * rule_array_count, | ||
| 121 | unsigned char * rule_array, | ||
| 122 | long * key_value_length, | ||
| 123 | unsigned char * key_value, | ||
| 124 | long * data_struct_length, | ||
| 125 | unsigned char * data_struct, | ||
| 126 | long * RSA_public_key_length, | ||
| 127 | unsigned char * RSA_public_key, | ||
| 128 | long * RSA_encipher_length, | ||
| 129 | unsigned char * RSA_encipher ); | ||
| 130 | |||
| 131 | /* PKA Decrypt */ | ||
| 132 | typedef void (SECURITYAPI *F_PKADECRYPT) | ||
| 133 | (long * return_code, | ||
| 134 | long * reason_code, | ||
| 135 | long * exit_data_length, | ||
| 136 | unsigned char * exit_data, | ||
| 137 | long * rule_array_count, | ||
| 138 | unsigned char * rule_array, | ||
| 139 | long * enciphered_key_length, | ||
| 140 | unsigned char * enciphered_key, | ||
| 141 | long * data_struct_length, | ||
| 142 | unsigned char * data_struct, | ||
| 143 | long * RSA_private_key_length, | ||
| 144 | unsigned char * RSA_private_key, | ||
| 145 | long * key_value_length, | ||
| 146 | unsigned char * key_value ); | ||
| 147 | |||
| 148 | |||
| 149 | #endif | ||
diff --git a/src/lib/libcrypto/engine/vendor_defns/hw_ubsec.h b/src/lib/libcrypto/engine/vendor_defns/hw_ubsec.h deleted file mode 100644 index b6619d40f2..0000000000 --- a/src/lib/libcrypto/engine/vendor_defns/hw_ubsec.h +++ /dev/null | |||
| @@ -1,100 +0,0 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright 2000 | ||
| 4 | * Broadcom Corporation | ||
| 5 | * 16215 Alton Parkway | ||
| 6 | * PO Box 57013 | ||
| 7 | * Irvine CA 92619-7013 | ||
| 8 | * | ||
| 9 | *****************************************************************************/ | ||
| 10 | /* | ||
| 11 | * Broadcom Corporation uBSec SDK | ||
| 12 | */ | ||
| 13 | /* | ||
| 14 | * Character device header file. | ||
| 15 | */ | ||
| 16 | /* | ||
| 17 | * Revision History: | ||
| 18 | * | ||
| 19 | * October 2000 JTT Created. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #define MAX_PUBLIC_KEY_BITS (1024) | ||
| 23 | #define MAX_PUBLIC_KEY_BYTES (1024/8) | ||
| 24 | #define SHA_BIT_SIZE (160) | ||
| 25 | #define MAX_CRYPTO_KEY_LENGTH 24 | ||
| 26 | #define MAX_MAC_KEY_LENGTH 64 | ||
| 27 | #define UBSEC_CRYPTO_DEVICE_NAME ((unsigned char *)"/dev/ubscrypt") | ||
| 28 | #define UBSEC_KEY_DEVICE_NAME ((unsigned char *)"/dev/ubskey") | ||
| 29 | |||
| 30 | /* Math command types. */ | ||
| 31 | #define UBSEC_MATH_MODADD 0x0001 | ||
| 32 | #define UBSEC_MATH_MODSUB 0x0002 | ||
| 33 | #define UBSEC_MATH_MODMUL 0x0004 | ||
| 34 | #define UBSEC_MATH_MODEXP 0x0008 | ||
| 35 | #define UBSEC_MATH_MODREM 0x0010 | ||
| 36 | #define UBSEC_MATH_MODINV 0x0020 | ||
| 37 | |||
| 38 | typedef long ubsec_MathCommand_t; | ||
| 39 | typedef long ubsec_RNGCommand_t; | ||
| 40 | |||
| 41 | typedef struct ubsec_crypto_context_s { | ||
| 42 | unsigned int flags; | ||
| 43 | unsigned char crypto[MAX_CRYPTO_KEY_LENGTH]; | ||
| 44 | unsigned char auth[MAX_MAC_KEY_LENGTH]; | ||
| 45 | } ubsec_crypto_context_t, *ubsec_crypto_context_p; | ||
| 46 | |||
| 47 | /* | ||
| 48 | * Predeclare the function pointer types that we dynamically load from the DSO. | ||
| 49 | */ | ||
| 50 | |||
| 51 | typedef int t_UBSEC_ubsec_bytes_to_bits(unsigned char *n, int bytes); | ||
| 52 | |||
| 53 | typedef int t_UBSEC_ubsec_bits_to_bytes(int bits); | ||
| 54 | |||
| 55 | typedef int t_UBSEC_ubsec_open(unsigned char *device); | ||
| 56 | |||
| 57 | typedef int t_UBSEC_ubsec_close(int fd); | ||
| 58 | |||
| 59 | typedef int t_UBSEC_diffie_hellman_generate_ioctl (int fd, | ||
| 60 | unsigned char *x, int *x_len, unsigned char *y, int *y_len, | ||
| 61 | unsigned char *g, int g_len, unsigned char *m, int m_len, | ||
| 62 | unsigned char *userX, int userX_len, int random_bits); | ||
| 63 | |||
| 64 | typedef int t_UBSEC_diffie_hellman_agree_ioctl (int fd, | ||
| 65 | unsigned char *x, int x_len, unsigned char *y, int y_len, | ||
| 66 | unsigned char *m, int m_len, unsigned char *k, int *k_len); | ||
| 67 | |||
| 68 | typedef int t_UBSEC_rsa_mod_exp_ioctl (int fd, | ||
| 69 | unsigned char *x, int x_len, unsigned char *m, int m_len, | ||
| 70 | unsigned char *e, int e_len, unsigned char *y, int *y_len); | ||
| 71 | |||
| 72 | typedef int t_UBSEC_rsa_mod_exp_crt_ioctl (int fd, | ||
| 73 | unsigned char *x, int x_len, unsigned char *qinv, int qinv_len, | ||
| 74 | unsigned char *edq, int edq_len, unsigned char *q, int q_len, | ||
| 75 | unsigned char *edp, int edp_len, unsigned char *p, int p_len, | ||
| 76 | unsigned char *y, int *y_len); | ||
| 77 | |||
| 78 | typedef int t_UBSEC_dsa_sign_ioctl (int fd, | ||
| 79 | int hash, unsigned char *data, int data_len, | ||
| 80 | unsigned char *rndom, int random_len, | ||
| 81 | unsigned char *p, int p_len, unsigned char *q, int q_len, | ||
| 82 | unsigned char *g, int g_len, unsigned char *key, int key_len, | ||
| 83 | unsigned char *r, int *r_len, unsigned char *s, int *s_len); | ||
| 84 | |||
| 85 | typedef int t_UBSEC_dsa_verify_ioctl (int fd, | ||
| 86 | int hash, unsigned char *data, int data_len, | ||
| 87 | unsigned char *p, int p_len, unsigned char *q, int q_len, | ||
| 88 | unsigned char *g, int g_len, unsigned char *key, int key_len, | ||
| 89 | unsigned char *r, int r_len, unsigned char *s, int s_len, | ||
| 90 | unsigned char *v, int *v_len); | ||
| 91 | |||
| 92 | typedef int t_UBSEC_math_accelerate_ioctl(int fd, ubsec_MathCommand_t command, | ||
| 93 | unsigned char *ModN, int *ModN_len, unsigned char *ExpE, int *ExpE_len, | ||
| 94 | unsigned char *ParamA, int *ParamA_len, unsigned char *ParamB, int *ParamB_len, | ||
| 95 | unsigned char *Result, int *Result_len); | ||
| 96 | |||
| 97 | typedef int t_UBSEC_rng_ioctl(int fd, ubsec_RNGCommand_t command, | ||
| 98 | unsigned char *Result, int *Result_len); | ||
| 99 | |||
| 100 | typedef int t_UBSEC_max_key_len_ioctl(int fd, int *max_key_len); | ||
diff --git a/src/lib/libcrypto/engine/vendor_defns/hwcryptohook.h b/src/lib/libcrypto/engine/vendor_defns/hwcryptohook.h deleted file mode 100644 index aaa4d4575e..0000000000 --- a/src/lib/libcrypto/engine/vendor_defns/hwcryptohook.h +++ /dev/null | |||
| @@ -1,486 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * ModExp / RSA (with/without KM) plugin API | ||
| 3 | * | ||
| 4 | * The application will load a dynamic library which | ||
| 5 | * exports entrypoint(s) defined in this file. | ||
| 6 | * | ||
| 7 | * This set of entrypoints provides only a multithreaded, | ||
| 8 | * synchronous-within-each-thread, facility. | ||
| 9 | * | ||
| 10 | * | ||
| 11 | * This file is Copyright 1998-2000 nCipher Corporation Limited. | ||
| 12 | * | ||
| 13 | * Redistribution and use in source and binary forms, with opr without | ||
| 14 | * modification, are permitted provided that the following conditions | ||
| 15 | * are met: | ||
| 16 | * | ||
| 17 | * 1. Redistributions of source code must retain the copyright notice, | ||
| 18 | * this list of conditions, and the following disclaimer. | ||
| 19 | * | ||
| 20 | * 2. Redistributions in binary form must reproduce the above | ||
| 21 | * copyright notice, this list of conditions, and the following | ||
| 22 | * disclaimer, in the documentation and/or other materials provided | ||
| 23 | * with the distribution | ||
| 24 | * | ||
| 25 | * IN NO EVENT SHALL NCIPHER CORPORATION LIMITED (`NCIPHER') AND/OR | ||
| 26 | * ANY OTHER AUTHORS OR DISTRIBUTORS OF THIS FILE BE LIABLE for any | ||
| 27 | * damages arising directly or indirectly from this file, its use or | ||
| 28 | * this licence. Without prejudice to the generality of the | ||
| 29 | * foregoing: all liability shall be excluded for direct, indirect, | ||
| 30 | * special, incidental, consequential or other damages or any loss of | ||
| 31 | * profits, business, revenue goodwill or anticipated savings; | ||
| 32 | * liability shall be excluded even if nCipher or anyone else has been | ||
| 33 | * advised of the possibility of damage. In any event, if the | ||
| 34 | * exclusion of liability is not effective, the liability of nCipher | ||
| 35 | * or any author or distributor shall be limited to the lesser of the | ||
| 36 | * price paid and 1,000 pounds sterling. This licence only fails to | ||
| 37 | * exclude or limit liability for death or personal injury arising out | ||
| 38 | * of negligence, and only to the extent that such an exclusion or | ||
| 39 | * limitation is not effective. | ||
| 40 | * | ||
| 41 | * NCIPHER AND THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ALL | ||
| 42 | * AND ANY WARRANTIES (WHETHER EXPRESS OR IMPLIED), including, but not | ||
| 43 | * limited to, any implied warranties of merchantability, fitness for | ||
| 44 | * a particular purpose, satisfactory quality, and/or non-infringement | ||
| 45 | * of any third party rights. | ||
| 46 | * | ||
| 47 | * US Government use: This software and documentation is Commercial | ||
| 48 | * Computer Software and Computer Software Documentation, as defined in | ||
| 49 | * sub-paragraphs (a)(1) and (a)(5) of DFAR 252.227-7014, "Rights in | ||
| 50 | * Noncommercial Computer Software and Noncommercial Computer Software | ||
| 51 | * Documentation." Use, duplication or disclosure by the Government is | ||
| 52 | * subject to the terms and conditions specified here. | ||
| 53 | * | ||
| 54 | * By using or distributing this file you will be accepting these | ||
| 55 | * terms and conditions, including the limitation of liability and | ||
| 56 | * lack of warranty. If you do not wish to accept these terms and | ||
| 57 | * conditions, DO NOT USE THE FILE. | ||
| 58 | * | ||
| 59 | * | ||
| 60 | * The actual dynamically loadable plugin, and the library files for | ||
| 61 | * static linking, which are also provided in some distributions, are | ||
| 62 | * not covered by the licence described above. You should have | ||
| 63 | * received a separate licence with terms and conditions for these | ||
| 64 | * library files; if you received the library files without a licence, | ||
| 65 | * please contact nCipher. | ||
| 66 | * | ||
| 67 | * | ||
| 68 | * $Id: hwcryptohook.h,v 1.1.1.1 2003/05/11 21:35:16 markus Exp $ | ||
| 69 | */ | ||
| 70 | |||
| 71 | #ifndef HWCRYPTOHOOK_H | ||
| 72 | #define HWCRYPTOHOOK_H | ||
| 73 | |||
| 74 | #include <sys/types.h> | ||
| 75 | #include <stdio.h> | ||
| 76 | |||
| 77 | #ifndef HWCRYPTOHOOK_DECLARE_APPTYPES | ||
| 78 | #define HWCRYPTOHOOK_DECLARE_APPTYPES 1 | ||
| 79 | #endif | ||
| 80 | |||
| 81 | #define HWCRYPTOHOOK_ERROR_FAILED -1 | ||
| 82 | #define HWCRYPTOHOOK_ERROR_FALLBACK -2 | ||
| 83 | #define HWCRYPTOHOOK_ERROR_MPISIZE -3 | ||
| 84 | |||
| 85 | #if HWCRYPTOHOOK_DECLARE_APPTYPES | ||
| 86 | |||
| 87 | /* These structs are defined by the application and opaque to the | ||
| 88 | * crypto plugin. The application may define these as it sees fit. | ||
| 89 | * Default declarations are provided here, but the application may | ||
| 90 | * #define HWCRYPTOHOOK_DECLARE_APPTYPES 0 | ||
| 91 | * to prevent these declarations, and instead provide its own | ||
| 92 | * declarations of these types. (Pointers to them must still be | ||
| 93 | * ordinary pointers to structs or unions, or the resulting combined | ||
| 94 | * program will have a type inconsistency.) | ||
| 95 | */ | ||
| 96 | typedef struct HWCryptoHook_MutexValue HWCryptoHook_Mutex; | ||
| 97 | typedef struct HWCryptoHook_CondVarValue HWCryptoHook_CondVar; | ||
| 98 | typedef struct HWCryptoHook_PassphraseContextValue HWCryptoHook_PassphraseContext; | ||
| 99 | typedef struct HWCryptoHook_CallerContextValue HWCryptoHook_CallerContext; | ||
| 100 | |||
| 101 | #endif /* HWCRYPTOHOOK_DECLARE_APPTYPES */ | ||
| 102 | |||
| 103 | /* These next two structs are opaque to the application. The crypto | ||
| 104 | * plugin will return pointers to them; the caller simply manipulates | ||
| 105 | * the pointers. | ||
| 106 | */ | ||
| 107 | typedef struct HWCryptoHook_Context *HWCryptoHook_ContextHandle; | ||
| 108 | typedef struct HWCryptoHook_RSAKey *HWCryptoHook_RSAKeyHandle; | ||
| 109 | |||
| 110 | typedef struct { | ||
| 111 | char *buf; | ||
| 112 | size_t size; | ||
| 113 | } HWCryptoHook_ErrMsgBuf; | ||
| 114 | /* Used for error reporting. When a HWCryptoHook function fails it | ||
| 115 | * will return a sentinel value (0 for pointer-valued functions, or a | ||
| 116 | * negative number, usually HWCRYPTOHOOK_ERROR_FAILED, for | ||
| 117 | * integer-valued ones). It will, if an ErrMsgBuf is passed, also put | ||
| 118 | * an error message there. | ||
| 119 | * | ||
| 120 | * size is the size of the buffer, and will not be modified. If you | ||
| 121 | * pass 0 for size you must pass 0 for buf, and nothing will be | ||
| 122 | * recorded (just as if you passed 0 for the struct pointer). | ||
| 123 | * Messages written to the buffer will always be null-terminated, even | ||
| 124 | * when truncated to fit within size bytes. | ||
| 125 | * | ||
| 126 | * The contents of the buffer are not defined if there is no error. | ||
| 127 | */ | ||
| 128 | |||
| 129 | typedef struct HWCryptoHook_MPIStruct { | ||
| 130 | unsigned char *buf; | ||
| 131 | size_t size; | ||
| 132 | } HWCryptoHook_MPI; | ||
| 133 | /* When one of these is returned, a pointer is passed to the function. | ||
| 134 | * At call, size is the space available. Afterwards it is updated to | ||
| 135 | * be set to the actual length (which may be more than the space available, | ||
| 136 | * if there was not enough room and the result was truncated). | ||
| 137 | * buf (the pointer) is not updated. | ||
| 138 | * | ||
| 139 | * size is in bytes and may be zero at call or return, but must be a | ||
| 140 | * multiple of the limb size. Zero limbs at the MS end are not | ||
| 141 | * permitted. | ||
| 142 | */ | ||
| 143 | |||
| 144 | #define HWCryptoHook_InitFlags_FallbackModExp 0x0002UL | ||
| 145 | #define HWCryptoHook_InitFlags_FallbackRSAImmed 0x0004UL | ||
| 146 | /* Enable requesting fallback to software in case of problems with the | ||
| 147 | * hardware support. This indicates to the crypto provider that the | ||
| 148 | * application is prepared to fall back to software operation if the | ||
| 149 | * ModExp* or RSAImmed* functions return HWCRYPTOHOOK_ERROR_FALLBACK. | ||
| 150 | * Without this flag those calls will never return | ||
| 151 | * HWCRYPTOHOOK_ERROR_FALLBACK. The flag will also cause the crypto | ||
| 152 | * provider to avoid repeatedly attempting to contact dead hardware | ||
| 153 | * within a short interval, if appropriate. | ||
| 154 | */ | ||
| 155 | |||
| 156 | #define HWCryptoHook_InitFlags_SimpleForkCheck 0x0010UL | ||
| 157 | /* Without _SimpleForkCheck the library is allowed to assume that the | ||
| 158 | * application will not fork and call the library in the child(ren). | ||
| 159 | * | ||
| 160 | * When it is specified, this is allowed. However, after a fork | ||
| 161 | * neither parent nor child may unload any loaded keys or call | ||
| 162 | * _Finish. Instead, they should call exit (or die with a signal) | ||
| 163 | * without calling _Finish. After all the children have died the | ||
| 164 | * parent may unload keys or call _Finish. | ||
| 165 | * | ||
| 166 | * This flag only has any effect on UN*X platforms. | ||
| 167 | */ | ||
| 168 | |||
| 169 | typedef struct { | ||
| 170 | unsigned long flags; | ||
| 171 | void *logstream; /* usually a FILE*. See below. */ | ||
| 172 | |||
| 173 | size_t limbsize; /* bignum format - size of radix type, must be power of 2 */ | ||
| 174 | int mslimbfirst; /* 0 or 1 */ | ||
| 175 | int msbytefirst; /* 0 or 1; -1 = native */ | ||
| 176 | |||
| 177 | /* All the callback functions should return 0 on success, or a | ||
| 178 | * nonzero integer (whose value will be visible in the error message | ||
| 179 | * put in the buffer passed to the call). | ||
| 180 | * | ||
| 181 | * If a callback is not available pass a null function pointer. | ||
| 182 | * | ||
| 183 | * The callbacks may not call down again into the crypto plugin. | ||
| 184 | */ | ||
| 185 | |||
| 186 | /* For thread-safety. Set everything to 0 if you promise only to be | ||
| 187 | * singlethreaded. maxsimultaneous is the number of calls to | ||
| 188 | * ModExp[Crt]/RSAImmed{Priv,Pub}/RSA. If you don't know what to | ||
| 189 | * put there then say 0 and the hook library will use a default. | ||
| 190 | * | ||
| 191 | * maxmutexes is a small limit on the number of simultaneous mutexes | ||
| 192 | * which will be requested by the library. If there is no small | ||
| 193 | * limit, set it to 0. If the crypto plugin cannot create the | ||
| 194 | * advertised number of mutexes the calls to its functions may fail. | ||
| 195 | * If a low number of mutexes is advertised the plugin will try to | ||
| 196 | * do the best it can. Making larger numbers of mutexes available | ||
| 197 | * may improve performance and parallelism by reducing contention | ||
| 198 | * over critical sections. Unavailability of any mutexes, implying | ||
| 199 | * single-threaded operation, should be indicated by the setting | ||
| 200 | * mutex_init et al to 0. | ||
| 201 | */ | ||
| 202 | int maxmutexes; | ||
| 203 | int maxsimultaneous; | ||
| 204 | size_t mutexsize; | ||
| 205 | int (*mutex_init)(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext *cactx); | ||
| 206 | int (*mutex_acquire)(HWCryptoHook_Mutex*); | ||
| 207 | void (*mutex_release)(HWCryptoHook_Mutex*); | ||
| 208 | void (*mutex_destroy)(HWCryptoHook_Mutex*); | ||
| 209 | |||
| 210 | /* For greater efficiency, can use condition vars internally for | ||
| 211 | * synchronisation. In this case maxsimultaneous is ignored, but | ||
| 212 | * the other mutex stuff must be available. In singlethreaded | ||
| 213 | * programs, set everything to 0. | ||
| 214 | */ | ||
| 215 | size_t condvarsize; | ||
| 216 | int (*condvar_init)(HWCryptoHook_CondVar*, HWCryptoHook_CallerContext *cactx); | ||
| 217 | int (*condvar_wait)(HWCryptoHook_CondVar*, HWCryptoHook_Mutex*); | ||
| 218 | void (*condvar_signal)(HWCryptoHook_CondVar*); | ||
| 219 | void (*condvar_broadcast)(HWCryptoHook_CondVar*); | ||
| 220 | void (*condvar_destroy)(HWCryptoHook_CondVar*); | ||
| 221 | |||
| 222 | /* The semantics of acquiring and releasing mutexes and broadcasting | ||
| 223 | * and waiting on condition variables are expected to be those from | ||
| 224 | * POSIX threads (pthreads). The mutexes may be (in pthread-speak) | ||
| 225 | * fast mutexes, recursive mutexes, or nonrecursive ones. | ||
| 226 | * | ||
| 227 | * The _release/_signal/_broadcast and _destroy functions must | ||
| 228 | * always succeed when given a valid argument; if they are given an | ||
| 229 | * invalid argument then the program (crypto plugin + application) | ||
| 230 | * has an internal error, and they should abort the program. | ||
| 231 | */ | ||
| 232 | |||
| 233 | int (*getpassphrase)(const char *prompt_info, | ||
| 234 | int *len_io, char *buf, | ||
| 235 | HWCryptoHook_PassphraseContext *ppctx, | ||
| 236 | HWCryptoHook_CallerContext *cactx); | ||
| 237 | /* Passphrases and the prompt_info, if they contain high-bit-set | ||
| 238 | * characters, are UTF-8. The prompt_info may be a null pointer if | ||
| 239 | * no prompt information is available (it should not be an empty | ||
| 240 | * string). It will not contain text like `enter passphrase'; | ||
| 241 | * instead it might say something like `Operator Card for John | ||
| 242 | * Smith' or `SmartCard in nFast Module #1, Slot #1'. | ||
| 243 | * | ||
| 244 | * buf points to a buffer in which to return the passphrase; on | ||
| 245 | * entry *len_io is the length of the buffer. It should be updated | ||
| 246 | * by the callback. The returned passphrase should not be | ||
| 247 | * null-terminated by the callback. | ||
| 248 | */ | ||
| 249 | |||
| 250 | int (*getphystoken)(const char *prompt_info, | ||
| 251 | const char *wrong_info, | ||
| 252 | HWCryptoHook_PassphraseContext *ppctx, | ||
| 253 | HWCryptoHook_CallerContext *cactx); | ||
| 254 | /* Requests that the human user physically insert a different | ||
| 255 | * smartcard, DataKey, etc. The plugin should check whether the | ||
| 256 | * currently inserted token(s) are appropriate, and if they are it | ||
| 257 | * should not make this call. | ||
| 258 | * | ||
| 259 | * prompt_info is as before. wrong_info is a description of the | ||
| 260 | * currently inserted token(s) so that the user is told what | ||
| 261 | * something is. wrong_info, like prompt_info, may be null, but | ||
| 262 | * should not be an empty string. Its contents should be | ||
| 263 | * syntactically similar to that of prompt_info. | ||
| 264 | */ | ||
| 265 | |||
| 266 | /* Note that a single LoadKey operation might cause several calls to | ||
| 267 | * getpassphrase and/or requestphystoken. If requestphystoken is | ||
| 268 | * not provided (ie, a null pointer is passed) then the plugin may | ||
| 269 | * not support loading keys for which authorisation by several cards | ||
| 270 | * is required. If getpassphrase is not provided then cards with | ||
| 271 | * passphrases may not be supported. | ||
| 272 | * | ||
| 273 | * getpassphrase and getphystoken do not need to check that the | ||
| 274 | * passphrase has been entered correctly or the correct token | ||
| 275 | * inserted; the crypto plugin will do that. If this is not the | ||
| 276 | * case then the crypto plugin is responsible for calling these | ||
| 277 | * routines again as appropriate until the correct token(s) and | ||
| 278 | * passphrase(s) are supplied as required, or until any retry limits | ||
| 279 | * implemented by the crypto plugin are reached. | ||
| 280 | * | ||
| 281 | * In either case, the application must allow the user to say `no' | ||
| 282 | * or `cancel' to indicate that they do not know the passphrase or | ||
| 283 | * have the appropriate token; this should cause the callback to | ||
| 284 | * return nonzero indicating error. | ||
| 285 | */ | ||
| 286 | |||
| 287 | void (*logmessage)(void *logstream, const char *message); | ||
| 288 | /* A log message will be generated at least every time something goes | ||
| 289 | * wrong and an ErrMsgBuf is filled in (or would be if one was | ||
| 290 | * provided). Other diagnostic information may be written there too, | ||
| 291 | * including more detailed reasons for errors which are reported in an | ||
| 292 | * ErrMsgBuf. | ||
| 293 | * | ||
| 294 | * When a log message is generated, this callback is called. It | ||
| 295 | * should write a message to the relevant logging arrangements. | ||
| 296 | * | ||
| 297 | * The message string passed will be null-terminated and may be of arbitrary | ||
| 298 | * length. It will not be prefixed by the time and date, nor by the | ||
| 299 | * name of the library that is generating it - if this is required, | ||
| 300 | * the logmessage callback must do it. The message will not have a | ||
| 301 | * trailing newline (though it may contain internal newlines). | ||
| 302 | * | ||
| 303 | * If a null pointer is passed for logmessage a default function is | ||
| 304 | * used. The default function treats logstream as a FILE* which has | ||
| 305 | * been converted to a void*. If logstream is 0 it does nothing. | ||
| 306 | * Otherwise it prepends the date and time and library name and | ||
| 307 | * writes the message to logstream. Each line will be prefixed by a | ||
| 308 | * descriptive string containing the date, time and identity of the | ||
| 309 | * crypto plugin. Errors on the logstream are not reported | ||
| 310 | * anywhere, and the default function doesn't flush the stream, so | ||
| 311 | * the application must set the buffering how it wants it. | ||
| 312 | * | ||
| 313 | * The crypto plugin may also provide a facility to have copies of | ||
| 314 | * log messages sent elsewhere, and or for adjusting the verbosity | ||
| 315 | * of the log messages; any such facilities will be configured by | ||
| 316 | * external means. | ||
| 317 | */ | ||
| 318 | |||
| 319 | } HWCryptoHook_InitInfo; | ||
| 320 | |||
| 321 | typedef | ||
| 322 | HWCryptoHook_ContextHandle HWCryptoHook_Init_t(const HWCryptoHook_InitInfo *initinfo, | ||
| 323 | size_t initinfosize, | ||
| 324 | const HWCryptoHook_ErrMsgBuf *errors, | ||
| 325 | HWCryptoHook_CallerContext *cactx); | ||
| 326 | extern HWCryptoHook_Init_t HWCryptoHook_Init; | ||
| 327 | |||
| 328 | /* Caller should set initinfosize to the size of the HWCryptoHook struct, | ||
| 329 | * so it can be extended later. | ||
| 330 | * | ||
| 331 | * On success, a message for display or logging by the server, | ||
| 332 | * including the name and version number of the plugin, will be filled | ||
| 333 | * in into *errors; on failure *errors is used for error handling, as | ||
| 334 | * usual. | ||
| 335 | */ | ||
| 336 | |||
| 337 | /* All these functions return 0 on success, HWCRYPTOHOOK_ERROR_FAILED | ||
| 338 | * on most failures. HWCRYPTOHOOK_ERROR_MPISIZE means at least one of | ||
| 339 | * the output MPI buffer(s) was too small; the sizes of all have been | ||
| 340 | * set to the desired size (and for those where the buffer was large | ||
| 341 | * enough, the value may have been copied in), and no error message | ||
| 342 | * has been recorded. | ||
| 343 | * | ||
| 344 | * You may pass 0 for the errors struct. In any case, unless you set | ||
| 345 | * _NoStderr at init time then messages may be reported to stderr. | ||
| 346 | */ | ||
| 347 | |||
| 348 | /* The RSAImmed* functions (and key managed RSA) only work with | ||
| 349 | * modules which have an RSA patent licence - currently that means KM | ||
| 350 | * units; the ModExp* ones work with all modules, so you need a patent | ||
| 351 | * licence in the software in the US. They are otherwise identical. | ||
| 352 | */ | ||
| 353 | |||
| 354 | typedef | ||
| 355 | void HWCryptoHook_Finish_t(HWCryptoHook_ContextHandle hwctx); | ||
| 356 | extern HWCryptoHook_Finish_t HWCryptoHook_Finish; | ||
| 357 | /* You must not have any calls going or keys loaded when you call this. */ | ||
| 358 | |||
| 359 | typedef | ||
| 360 | int HWCryptoHook_RandomBytes_t(HWCryptoHook_ContextHandle hwctx, | ||
| 361 | unsigned char *buf, size_t len, | ||
| 362 | const HWCryptoHook_ErrMsgBuf *errors); | ||
| 363 | extern HWCryptoHook_RandomBytes_t HWCryptoHook_RandomBytes; | ||
| 364 | |||
| 365 | typedef | ||
| 366 | int HWCryptoHook_ModExp_t(HWCryptoHook_ContextHandle hwctx, | ||
| 367 | HWCryptoHook_MPI a, | ||
| 368 | HWCryptoHook_MPI p, | ||
| 369 | HWCryptoHook_MPI n, | ||
| 370 | HWCryptoHook_MPI *r, | ||
| 371 | const HWCryptoHook_ErrMsgBuf *errors); | ||
| 372 | extern HWCryptoHook_ModExp_t HWCryptoHook_ModExp; | ||
| 373 | |||
| 374 | typedef | ||
| 375 | int HWCryptoHook_RSAImmedPub_t(HWCryptoHook_ContextHandle hwctx, | ||
| 376 | HWCryptoHook_MPI m, | ||
| 377 | HWCryptoHook_MPI e, | ||
| 378 | HWCryptoHook_MPI n, | ||
| 379 | HWCryptoHook_MPI *r, | ||
| 380 | const HWCryptoHook_ErrMsgBuf *errors); | ||
| 381 | extern HWCryptoHook_RSAImmedPub_t HWCryptoHook_RSAImmedPub; | ||
| 382 | |||
| 383 | typedef | ||
| 384 | int HWCryptoHook_ModExpCRT_t(HWCryptoHook_ContextHandle hwctx, | ||
| 385 | HWCryptoHook_MPI a, | ||
| 386 | HWCryptoHook_MPI p, | ||
| 387 | HWCryptoHook_MPI q, | ||
| 388 | HWCryptoHook_MPI dmp1, | ||
| 389 | HWCryptoHook_MPI dmq1, | ||
| 390 | HWCryptoHook_MPI iqmp, | ||
| 391 | HWCryptoHook_MPI *r, | ||
| 392 | const HWCryptoHook_ErrMsgBuf *errors); | ||
| 393 | extern HWCryptoHook_ModExpCRT_t HWCryptoHook_ModExpCRT; | ||
| 394 | |||
| 395 | typedef | ||
| 396 | int HWCryptoHook_RSAImmedPriv_t(HWCryptoHook_ContextHandle hwctx, | ||
| 397 | HWCryptoHook_MPI m, | ||
| 398 | HWCryptoHook_MPI p, | ||
| 399 | HWCryptoHook_MPI q, | ||
| 400 | HWCryptoHook_MPI dmp1, | ||
| 401 | HWCryptoHook_MPI dmq1, | ||
| 402 | HWCryptoHook_MPI iqmp, | ||
| 403 | HWCryptoHook_MPI *r, | ||
| 404 | const HWCryptoHook_ErrMsgBuf *errors); | ||
| 405 | extern HWCryptoHook_RSAImmedPriv_t HWCryptoHook_RSAImmedPriv; | ||
| 406 | |||
| 407 | /* The RSAImmed* and ModExp* functions may return E_FAILED or | ||
| 408 | * E_FALLBACK for failure. | ||
| 409 | * | ||
| 410 | * E_FAILED means the failure is permanent and definite and there | ||
| 411 | * should be no attempt to fall back to software. (Eg, for some | ||
| 412 | * applications, which support only the acceleration-only | ||
| 413 | * functions, the `key material' may actually be an encoded key | ||
| 414 | * identifier, and doing the operation in software would give wrong | ||
| 415 | * answers.) | ||
| 416 | * | ||
| 417 | * E_FALLBACK means that doing the computation in software would seem | ||
| 418 | * reasonable. If an application pays attention to this and is | ||
| 419 | * able to fall back, it should also set the Fallback init flags. | ||
| 420 | */ | ||
| 421 | |||
| 422 | typedef | ||
| 423 | int HWCryptoHook_RSALoadKey_t(HWCryptoHook_ContextHandle hwctx, | ||
| 424 | const char *key_ident, | ||
| 425 | HWCryptoHook_RSAKeyHandle *keyhandle_r, | ||
| 426 | const HWCryptoHook_ErrMsgBuf *errors, | ||
| 427 | HWCryptoHook_PassphraseContext *ppctx); | ||
| 428 | extern HWCryptoHook_RSALoadKey_t HWCryptoHook_RSALoadKey; | ||
| 429 | /* The key_ident is a null-terminated string configured by the | ||
| 430 | * user via the application's usual configuration mechanisms. | ||
| 431 | * It is provided to the user by the crypto provider's key management | ||
| 432 | * system. The user must be able to enter at least any string of between | ||
| 433 | * 1 and 1023 characters inclusive, consisting of printable 7-bit | ||
| 434 | * ASCII characters. The provider should avoid using | ||
| 435 | * any characters except alphanumerics and the punctuation | ||
| 436 | * characters _ - + . / @ ~ (the user is expected to be able | ||
| 437 | * to enter these without quoting). The string may be case-sensitive. | ||
| 438 | * The application may allow the user to enter other NULL-terminated strings, | ||
| 439 | * and the provider must cope (returning an error if the string is not | ||
| 440 | * valid). | ||
| 441 | * | ||
| 442 | * If the key does not exist, no error is recorded and 0 is returned; | ||
| 443 | * keyhandle_r will be set to 0 instead of to a key handle. | ||
| 444 | */ | ||
| 445 | |||
| 446 | typedef | ||
| 447 | int HWCryptoHook_RSAGetPublicKey_t(HWCryptoHook_RSAKeyHandle k, | ||
| 448 | HWCryptoHook_MPI *n, | ||
| 449 | HWCryptoHook_MPI *e, | ||
| 450 | const HWCryptoHook_ErrMsgBuf *errors); | ||
| 451 | extern HWCryptoHook_RSAGetPublicKey_t HWCryptoHook_RSAGetPublicKey; | ||
| 452 | /* The crypto plugin will not store certificates. | ||
| 453 | * | ||
| 454 | * Although this function for acquiring the public key value is | ||
| 455 | * provided, it is not the purpose of this API to deal fully with the | ||
| 456 | * handling of the public key. | ||
| 457 | * | ||
| 458 | * It is expected that the crypto supplier's key generation program | ||
| 459 | * will provide general facilities for producing X.509 | ||
| 460 | * self-certificates and certificate requests in PEM format. These | ||
| 461 | * will be given to the user so that they can configure them in the | ||
| 462 | * application, send them to CAs, or whatever. | ||
| 463 | * | ||
| 464 | * In case this kind of certificate handling is not appropriate, the | ||
| 465 | * crypto supplier's key generation program should be able to be | ||
| 466 | * configured not to generate such a self-certificate or certificate | ||
| 467 | * request. Then the application will need to do all of this, and | ||
| 468 | * will need to store and handle the public key and certificates | ||
| 469 | * itself. | ||
| 470 | */ | ||
| 471 | |||
| 472 | typedef | ||
| 473 | int HWCryptoHook_RSAUnloadKey_t(HWCryptoHook_RSAKeyHandle k, | ||
| 474 | const HWCryptoHook_ErrMsgBuf *errors); | ||
| 475 | extern HWCryptoHook_RSAUnloadKey_t HWCryptoHook_RSAUnloadKey; | ||
| 476 | /* Might fail due to locking problems, or other serious internal problems. */ | ||
| 477 | |||
| 478 | typedef | ||
| 479 | int HWCryptoHook_RSA_t(HWCryptoHook_MPI m, | ||
| 480 | HWCryptoHook_RSAKeyHandle k, | ||
| 481 | HWCryptoHook_MPI *r, | ||
| 482 | const HWCryptoHook_ErrMsgBuf *errors); | ||
| 483 | extern HWCryptoHook_RSA_t HWCryptoHook_RSA; | ||
| 484 | /* RSA private key operation (sign or decrypt) - raw, unpadded. */ | ||
| 485 | |||
| 486 | #endif /*HWCRYPTOHOOK_H*/ | ||
diff --git a/src/lib/libcrypto/engine/vendor_defns/sureware.h b/src/lib/libcrypto/engine/vendor_defns/sureware.h deleted file mode 100644 index 4bc22027f9..0000000000 --- a/src/lib/libcrypto/engine/vendor_defns/sureware.h +++ /dev/null | |||
| @@ -1,239 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Written by Corinne Dive-Reclus(cdive@baltimore.com) | ||
| 3 | * | ||
| 4 | * Copyright@2001 Baltimore Technologies Ltd. | ||
| 5 | * * | ||
| 6 | * THIS FILE IS PROVIDED BY BALTIMORE TECHNOLOGIES ``AS IS'' AND * | ||
| 7 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * | ||
| 8 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * | ||
| 9 | * ARE DISCLAIMED. IN NO EVENT SHALL BALTIMORE TECHNOLOGIES BE LIABLE * | ||
| 10 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * | ||
| 11 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * | ||
| 12 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * | ||
| 13 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * | ||
| 14 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * | ||
| 15 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * | ||
| 16 | * SUCH DAMAGE. * | ||
| 17 | * | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | #ifdef WIN32 | ||
| 21 | #define SW_EXPORT __declspec ( dllexport ) | ||
| 22 | #else | ||
| 23 | #define SW_EXPORT | ||
| 24 | #endif | ||
| 25 | |||
| 26 | /* | ||
| 27 | * List of exposed SureWare errors | ||
| 28 | */ | ||
| 29 | #define SUREWAREHOOK_ERROR_FAILED -1 | ||
| 30 | #define SUREWAREHOOK_ERROR_FALLBACK -2 | ||
| 31 | #define SUREWAREHOOK_ERROR_UNIT_FAILURE -3 | ||
| 32 | #define SUREWAREHOOK_ERROR_DATA_SIZE -4 | ||
| 33 | #define SUREWAREHOOK_ERROR_INVALID_PAD -5 | ||
| 34 | /* | ||
| 35 | * -----------------WARNING----------------------------------- | ||
| 36 | * In all the following functions: | ||
| 37 | * msg is a string with at least 24 bytes free. | ||
| 38 | * A 24 bytes string will be concatenated to the existing content of msg. | ||
| 39 | */ | ||
| 40 | /* | ||
| 41 | * SureWare Initialisation function | ||
| 42 | * in param threadsafe, if !=0, thread safe enabled | ||
| 43 | * return SureWareHOOK_ERROR_UNIT_FAILURE if failure, 1 if success | ||
| 44 | */ | ||
| 45 | typedef int SureWareHook_Init_t(char*const msg,int threadsafe); | ||
| 46 | extern SW_EXPORT SureWareHook_Init_t SureWareHook_Init; | ||
| 47 | /* | ||
| 48 | * SureWare Finish function | ||
| 49 | */ | ||
| 50 | typedef void SureWareHook_Finish_t(); | ||
| 51 | extern SW_EXPORT SureWareHook_Finish_t SureWareHook_Finish; | ||
| 52 | /* | ||
| 53 | * PRE_CONDITION: | ||
| 54 | * DO NOT CALL ANY OF THE FOLLOWING FUNCTIONS IN CASE OF INIT FAILURE | ||
| 55 | */ | ||
| 56 | /* | ||
| 57 | * SureWare RAND Bytes function | ||
| 58 | * In case of failure, the content of buf is unpredictable. | ||
| 59 | * return 1 if success | ||
| 60 | * SureWareHOOK_ERROR_FALLBACK if function not available in hardware | ||
| 61 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
| 62 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
| 63 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
| 64 | * | ||
| 65 | * in/out param buf : a num bytes long buffer where random bytes will be put | ||
| 66 | * in param num : the number of bytes into buf | ||
| 67 | */ | ||
| 68 | typedef int SureWareHook_Rand_Bytes_t(char*const msg,unsigned char *buf, int num); | ||
| 69 | extern SW_EXPORT SureWareHook_Rand_Bytes_t SureWareHook_Rand_Bytes; | ||
| 70 | |||
| 71 | /* | ||
| 72 | * SureWare RAND Seed function | ||
| 73 | * Adds some seed to the Hardware Random Number Generator | ||
| 74 | * return 1 if success | ||
| 75 | * SureWareHOOK_ERROR_FALLBACK if function not available in hardware | ||
| 76 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
| 77 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
| 78 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
| 79 | * | ||
| 80 | * in param buf : the seed to add into the HRNG | ||
| 81 | * in param num : the number of bytes into buf | ||
| 82 | */ | ||
| 83 | typedef int SureWareHook_Rand_Seed_t(char*const msg,const void *buf, int num); | ||
| 84 | extern SW_EXPORT SureWareHook_Rand_Seed_t SureWareHook_Rand_Seed; | ||
| 85 | |||
| 86 | /* | ||
| 87 | * SureWare Load Private Key function | ||
| 88 | * return 1 if success | ||
| 89 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
| 90 | * No hardware is contact for this function. | ||
| 91 | * | ||
| 92 | * in param key_id :the name of the private protected key file without the extension | ||
| 93 | ".sws" | ||
| 94 | * out param hptr : a pointer to a buffer allocated by SureWare_Hook | ||
| 95 | * out param num: the effective key length in bytes | ||
| 96 | * out param keytype: 1 if RSA 2 if DSA | ||
| 97 | */ | ||
| 98 | typedef int SureWareHook_Load_Privkey_t(char*const msg,const char *key_id,char **hptr,unsigned long *num,char *keytype); | ||
| 99 | extern SW_EXPORT SureWareHook_Load_Privkey_t SureWareHook_Load_Privkey; | ||
| 100 | |||
| 101 | /* | ||
| 102 | * SureWare Info Public Key function | ||
| 103 | * return 1 if success | ||
| 104 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
| 105 | * No hardware is contact for this function. | ||
| 106 | * | ||
| 107 | * in param key_id :the name of the private protected key file without the extension | ||
| 108 | ".swp" | ||
| 109 | * out param hptr : a pointer to a buffer allocated by SureWare_Hook | ||
| 110 | * out param num: the effective key length in bytes | ||
| 111 | * out param keytype: 1 if RSA 2 if DSA | ||
| 112 | */ | ||
| 113 | typedef int SureWareHook_Info_Pubkey_t(char*const msg,const char *key_id,unsigned long *num, | ||
| 114 | char *keytype); | ||
| 115 | extern SW_EXPORT SureWareHook_Info_Pubkey_t SureWareHook_Info_Pubkey; | ||
| 116 | |||
| 117 | /* | ||
| 118 | * SureWare Load Public Key function | ||
| 119 | * return 1 if success | ||
| 120 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
| 121 | * No hardware is contact for this function. | ||
| 122 | * | ||
| 123 | * in param key_id :the name of the public protected key file without the extension | ||
| 124 | ".swp" | ||
| 125 | * in param num : the bytes size of n and e | ||
| 126 | * out param n: where to write modulus in bn format | ||
| 127 | * out param e: where to write exponent in bn format | ||
| 128 | */ | ||
| 129 | typedef int SureWareHook_Load_Rsa_Pubkey_t(char*const msg,const char *key_id,unsigned long num, | ||
| 130 | unsigned long *n, unsigned long *e); | ||
| 131 | extern SW_EXPORT SureWareHook_Load_Rsa_Pubkey_t SureWareHook_Load_Rsa_Pubkey; | ||
| 132 | |||
| 133 | /* | ||
| 134 | * SureWare Load DSA Public Key function | ||
| 135 | * return 1 if success | ||
| 136 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
| 137 | * No hardware is contact for this function. | ||
| 138 | * | ||
| 139 | * in param key_id :the name of the public protected key file without the extension | ||
| 140 | ".swp" | ||
| 141 | * in param num : the bytes size of n and e | ||
| 142 | * out param pub: where to write pub key in bn format | ||
| 143 | * out param p: where to write prime in bn format | ||
| 144 | * out param q: where to write sunprime (length 20 bytes) in bn format | ||
| 145 | * out param g: where to write base in bn format | ||
| 146 | */ | ||
| 147 | typedef int SureWareHook_Load_Dsa_Pubkey_t(char*const msg,const char *key_id,unsigned long num, | ||
| 148 | unsigned long *pub, unsigned long *p,unsigned long*q, | ||
| 149 | unsigned long *g); | ||
| 150 | extern SW_EXPORT SureWareHook_Load_Dsa_Pubkey_t SureWareHook_Load_Dsa_Pubkey; | ||
| 151 | |||
| 152 | /* | ||
| 153 | * SureWare Free function | ||
| 154 | * Destroy the key into the hardware if destroy==1 | ||
| 155 | */ | ||
| 156 | typedef void SureWareHook_Free_t(char *p,int destroy); | ||
| 157 | extern SW_EXPORT SureWareHook_Free_t SureWareHook_Free; | ||
| 158 | |||
| 159 | #define SUREWARE_PKCS1_PAD 1 | ||
| 160 | #define SUREWARE_ISO9796_PAD 2 | ||
| 161 | #define SUREWARE_NO_PAD 0 | ||
| 162 | /* | ||
| 163 | * SureWare RSA Private Decryption | ||
| 164 | * return 1 if success | ||
| 165 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
| 166 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
| 167 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
| 168 | * | ||
| 169 | * in param flen : byte size of from and to | ||
| 170 | * in param from : encrypted data buffer, should be a not-null valid pointer | ||
| 171 | * out param tlen: byte size of decrypted data, if error, unexpected value | ||
| 172 | * out param to : decrypted data buffer, should be a not-null valid pointer | ||
| 173 | * in param prsa: a protected key pointer, should be a not-null valid pointer | ||
| 174 | * int padding: padding id as follow | ||
| 175 | * SUREWARE_PKCS1_PAD | ||
| 176 | * SUREWARE_NO_PAD | ||
| 177 | * | ||
| 178 | */ | ||
| 179 | typedef int SureWareHook_Rsa_Priv_Dec_t(char*const msg,int flen,unsigned char *from, | ||
| 180 | int *tlen,unsigned char *to, | ||
| 181 | char *prsa,int padding); | ||
| 182 | extern SW_EXPORT SureWareHook_Rsa_Priv_Dec_t SureWareHook_Rsa_Priv_Dec; | ||
| 183 | /* | ||
| 184 | * SureWare RSA Signature | ||
| 185 | * return 1 if success | ||
| 186 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
| 187 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
| 188 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
| 189 | * | ||
| 190 | * in param flen : byte size of from and to | ||
| 191 | * in param from : encrypted data buffer, should be a not-null valid pointer | ||
| 192 | * out param tlen: byte size of decrypted data, if error, unexpected value | ||
| 193 | * out param to : decrypted data buffer, should be a not-null valid pointer | ||
| 194 | * in param prsa: a protected key pointer, should be a not-null valid pointer | ||
| 195 | * int padding: padding id as follow | ||
| 196 | * SUREWARE_PKCS1_PAD | ||
| 197 | * SUREWARE_ISO9796_PAD | ||
| 198 | * | ||
| 199 | */ | ||
| 200 | typedef int SureWareHook_Rsa_Sign_t(char*const msg,int flen,unsigned char *from, | ||
| 201 | int *tlen,unsigned char *to, | ||
| 202 | char *prsa,int padding); | ||
| 203 | extern SW_EXPORT SureWareHook_Rsa_Sign_t SureWareHook_Rsa_Sign; | ||
| 204 | /* | ||
| 205 | * SureWare DSA Signature | ||
| 206 | * return 1 if success | ||
| 207 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
| 208 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
| 209 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
| 210 | * | ||
| 211 | * in param flen : byte size of from and to | ||
| 212 | * in param from : encrypted data buffer, should be a not-null valid pointer | ||
| 213 | * out param to : decrypted data buffer, should be a 40bytes valid pointer | ||
| 214 | * in param pdsa: a protected key pointer, should be a not-null valid pointer | ||
| 215 | * | ||
| 216 | */ | ||
| 217 | typedef int SureWareHook_Dsa_Sign_t(char*const msg,int flen,const unsigned char *from, | ||
| 218 | unsigned long *r,unsigned long *s,char *pdsa); | ||
| 219 | extern SW_EXPORT SureWareHook_Dsa_Sign_t SureWareHook_Dsa_Sign; | ||
| 220 | |||
| 221 | |||
| 222 | /* | ||
| 223 | * SureWare Mod Exp | ||
| 224 | * return 1 if success | ||
| 225 | * SureWareHOOK_ERROR_FAILED if error while processing | ||
| 226 | * SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure | ||
| 227 | * SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf | ||
| 228 | * | ||
| 229 | * mod and res are mlen bytes long. | ||
| 230 | * exp is elen bytes long | ||
| 231 | * data is dlen bytes long | ||
| 232 | * mlen,elen and dlen are all multiple of sizeof(unsigned long) | ||
| 233 | */ | ||
| 234 | typedef int SureWareHook_Mod_Exp_t(char*const msg,int mlen,const unsigned long *mod, | ||
| 235 | int elen,const unsigned long *exponent, | ||
| 236 | int dlen,unsigned long *data, | ||
| 237 | unsigned long *res); | ||
| 238 | extern SW_EXPORT SureWareHook_Mod_Exp_t SureWareHook_Mod_Exp; | ||
| 239 | |||
diff --git a/src/lib/libcrypto/err/Makefile.ssl b/src/lib/libcrypto/err/Makefile.ssl deleted file mode 100644 index b253061d07..0000000000 --- a/src/lib/libcrypto/err/Makefile.ssl +++ /dev/null | |||
| @@ -1,119 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/err/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= err | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=err.c err_all.c err_prn.c | ||
| 27 | LIBOBJ=err.o err_all.o err_prn.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= err.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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | err.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 83 | err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 84 | err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 85 | err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 86 | err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 87 | err.o: ../../include/openssl/symhacks.h ../cryptlib.h err.c | ||
| 88 | err_all.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 89 | err_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 90 | err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 91 | err_all.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 92 | err_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 93 | err_all.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 94 | err_all.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h | ||
| 95 | err_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 96 | err_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 97 | err_all.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 98 | err_all.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 99 | err_all.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 100 | err_all.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 101 | err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 102 | err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 103 | err_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem2.h | ||
| 104 | err_all.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 105 | err_all.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 106 | err_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 107 | err_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 108 | err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 109 | err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 110 | err_all.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 111 | err_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 112 | err_all.o: ../../include/openssl/x509v3.h err_all.c | ||
| 113 | err_prn.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 114 | err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 115 | err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 116 | err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 117 | err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 118 | err_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 119 | err_prn.o: ../cryptlib.h err_prn.c | ||
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index 292404a2fb..69713a6e2f 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | /* ==================================================================== | 58 | /* ==================================================================== |
| 59 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | 59 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
| 60 | * | 60 | * |
| 61 | * Redistribution and use in source and binary forms, with or without | 61 | * Redistribution and use in source and binary forms, with or without |
| 62 | * modification, are permitted provided that the following conditions | 62 | * modification, are permitted provided that the following conditions |
| @@ -119,9 +119,507 @@ | |||
| 119 | #include <openssl/bio.h> | 119 | #include <openssl/bio.h> |
| 120 | #include <openssl/err.h> | 120 | #include <openssl/err.h> |
| 121 | 121 | ||
| 122 | static unsigned long get_error_values(int inc,int top, | 122 | DECLARE_LHASH_OF(ERR_STRING_DATA); |
| 123 | const char **file,int *line, | 123 | DECLARE_LHASH_OF(ERR_STATE); |
| 124 | const char **data,int *flags); | 124 | |
| 125 | static void err_load_strings(int lib, ERR_STRING_DATA *str); | ||
| 126 | |||
| 127 | static void ERR_STATE_free(ERR_STATE *s); | ||
| 128 | #ifndef OPENSSL_NO_ERR | ||
| 129 | static ERR_STRING_DATA ERR_str_libraries[]= | ||
| 130 | { | ||
| 131 | {ERR_PACK(ERR_LIB_NONE,0,0) ,"unknown library"}, | ||
| 132 | {ERR_PACK(ERR_LIB_SYS,0,0) ,"system library"}, | ||
| 133 | {ERR_PACK(ERR_LIB_BN,0,0) ,"bignum routines"}, | ||
| 134 | {ERR_PACK(ERR_LIB_RSA,0,0) ,"rsa routines"}, | ||
| 135 | {ERR_PACK(ERR_LIB_DH,0,0) ,"Diffie-Hellman routines"}, | ||
| 136 | {ERR_PACK(ERR_LIB_EVP,0,0) ,"digital envelope routines"}, | ||
| 137 | {ERR_PACK(ERR_LIB_BUF,0,0) ,"memory buffer routines"}, | ||
| 138 | {ERR_PACK(ERR_LIB_OBJ,0,0) ,"object identifier routines"}, | ||
| 139 | {ERR_PACK(ERR_LIB_PEM,0,0) ,"PEM routines"}, | ||
| 140 | {ERR_PACK(ERR_LIB_DSA,0,0) ,"dsa routines"}, | ||
| 141 | {ERR_PACK(ERR_LIB_X509,0,0) ,"x509 certificate routines"}, | ||
| 142 | {ERR_PACK(ERR_LIB_ASN1,0,0) ,"asn1 encoding routines"}, | ||
| 143 | {ERR_PACK(ERR_LIB_CONF,0,0) ,"configuration file routines"}, | ||
| 144 | {ERR_PACK(ERR_LIB_CRYPTO,0,0) ,"common libcrypto routines"}, | ||
| 145 | {ERR_PACK(ERR_LIB_EC,0,0) ,"elliptic curve routines"}, | ||
| 146 | {ERR_PACK(ERR_LIB_SSL,0,0) ,"SSL routines"}, | ||
| 147 | {ERR_PACK(ERR_LIB_BIO,0,0) ,"BIO routines"}, | ||
| 148 | {ERR_PACK(ERR_LIB_PKCS7,0,0) ,"PKCS7 routines"}, | ||
| 149 | {ERR_PACK(ERR_LIB_X509V3,0,0) ,"X509 V3 routines"}, | ||
| 150 | {ERR_PACK(ERR_LIB_PKCS12,0,0) ,"PKCS12 routines"}, | ||
| 151 | {ERR_PACK(ERR_LIB_RAND,0,0) ,"random number generator"}, | ||
| 152 | {ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"}, | ||
| 153 | {ERR_PACK(ERR_LIB_TS,0,0) ,"time stamp routines"}, | ||
| 154 | {ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"}, | ||
| 155 | {ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"}, | ||
| 156 | {ERR_PACK(ERR_LIB_FIPS,0,0) ,"FIPS routines"}, | ||
| 157 | {ERR_PACK(ERR_LIB_CMS,0,0) ,"CMS routines"}, | ||
| 158 | {ERR_PACK(ERR_LIB_HMAC,0,0) ,"HMAC routines"}, | ||
| 159 | {0,NULL}, | ||
| 160 | }; | ||
| 161 | |||
| 162 | static ERR_STRING_DATA ERR_str_functs[]= | ||
| 163 | { | ||
| 164 | {ERR_PACK(0,SYS_F_FOPEN,0), "fopen"}, | ||
| 165 | {ERR_PACK(0,SYS_F_CONNECT,0), "connect"}, | ||
| 166 | {ERR_PACK(0,SYS_F_GETSERVBYNAME,0), "getservbyname"}, | ||
| 167 | {ERR_PACK(0,SYS_F_SOCKET,0), "socket"}, | ||
| 168 | {ERR_PACK(0,SYS_F_IOCTLSOCKET,0), "ioctlsocket"}, | ||
| 169 | {ERR_PACK(0,SYS_F_BIND,0), "bind"}, | ||
| 170 | {ERR_PACK(0,SYS_F_LISTEN,0), "listen"}, | ||
| 171 | {ERR_PACK(0,SYS_F_ACCEPT,0), "accept"}, | ||
| 172 | #ifdef OPENSSL_SYS_WINDOWS | ||
| 173 | {ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"}, | ||
| 174 | #endif | ||
| 175 | {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"}, | ||
| 176 | {ERR_PACK(0,SYS_F_FREAD,0), "fread"}, | ||
| 177 | {0,NULL}, | ||
| 178 | }; | ||
| 179 | |||
| 180 | static ERR_STRING_DATA ERR_str_reasons[]= | ||
| 181 | { | ||
| 182 | {ERR_R_SYS_LIB ,"system lib"}, | ||
| 183 | {ERR_R_BN_LIB ,"BN lib"}, | ||
| 184 | {ERR_R_RSA_LIB ,"RSA lib"}, | ||
| 185 | {ERR_R_DH_LIB ,"DH lib"}, | ||
| 186 | {ERR_R_EVP_LIB ,"EVP lib"}, | ||
| 187 | {ERR_R_BUF_LIB ,"BUF lib"}, | ||
| 188 | {ERR_R_OBJ_LIB ,"OBJ lib"}, | ||
| 189 | {ERR_R_PEM_LIB ,"PEM lib"}, | ||
| 190 | {ERR_R_DSA_LIB ,"DSA lib"}, | ||
| 191 | {ERR_R_X509_LIB ,"X509 lib"}, | ||
| 192 | {ERR_R_ASN1_LIB ,"ASN1 lib"}, | ||
| 193 | {ERR_R_CONF_LIB ,"CONF lib"}, | ||
| 194 | {ERR_R_CRYPTO_LIB ,"CRYPTO lib"}, | ||
| 195 | {ERR_R_EC_LIB ,"EC lib"}, | ||
| 196 | {ERR_R_SSL_LIB ,"SSL lib"}, | ||
| 197 | {ERR_R_BIO_LIB ,"BIO lib"}, | ||
| 198 | {ERR_R_PKCS7_LIB ,"PKCS7 lib"}, | ||
| 199 | {ERR_R_X509V3_LIB ,"X509V3 lib"}, | ||
| 200 | {ERR_R_PKCS12_LIB ,"PKCS12 lib"}, | ||
| 201 | {ERR_R_RAND_LIB ,"RAND lib"}, | ||
| 202 | {ERR_R_DSO_LIB ,"DSO lib"}, | ||
| 203 | {ERR_R_ENGINE_LIB ,"ENGINE lib"}, | ||
| 204 | {ERR_R_OCSP_LIB ,"OCSP lib"}, | ||
| 205 | {ERR_R_TS_LIB ,"TS lib"}, | ||
| 206 | |||
| 207 | {ERR_R_NESTED_ASN1_ERROR ,"nested asn1 error"}, | ||
| 208 | {ERR_R_BAD_ASN1_OBJECT_HEADER ,"bad asn1 object header"}, | ||
| 209 | {ERR_R_BAD_GET_ASN1_OBJECT_CALL ,"bad get asn1 object call"}, | ||
| 210 | {ERR_R_EXPECTING_AN_ASN1_SEQUENCE ,"expecting an asn1 sequence"}, | ||
| 211 | {ERR_R_ASN1_LENGTH_MISMATCH ,"asn1 length mismatch"}, | ||
| 212 | {ERR_R_MISSING_ASN1_EOS ,"missing asn1 eos"}, | ||
| 213 | |||
| 214 | {ERR_R_FATAL ,"fatal"}, | ||
| 215 | {ERR_R_MALLOC_FAILURE ,"malloc failure"}, | ||
| 216 | {ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED ,"called a function you should not call"}, | ||
| 217 | {ERR_R_PASSED_NULL_PARAMETER ,"passed a null parameter"}, | ||
| 218 | {ERR_R_INTERNAL_ERROR ,"internal error"}, | ||
| 219 | {ERR_R_DISABLED ,"called a function that was disabled at compile-time"}, | ||
| 220 | |||
| 221 | {0,NULL}, | ||
| 222 | }; | ||
| 223 | #endif | ||
| 224 | |||
| 225 | |||
| 226 | /* Define the predeclared (but externally opaque) "ERR_FNS" type */ | ||
| 227 | struct st_ERR_FNS | ||
| 228 | { | ||
| 229 | /* Works on the "error_hash" string table */ | ||
| 230 | LHASH_OF(ERR_STRING_DATA) *(*cb_err_get)(int create); | ||
| 231 | void (*cb_err_del)(void); | ||
| 232 | ERR_STRING_DATA *(*cb_err_get_item)(const ERR_STRING_DATA *); | ||
| 233 | ERR_STRING_DATA *(*cb_err_set_item)(ERR_STRING_DATA *); | ||
| 234 | ERR_STRING_DATA *(*cb_err_del_item)(ERR_STRING_DATA *); | ||
| 235 | /* Works on the "thread_hash" error-state table */ | ||
| 236 | LHASH_OF(ERR_STATE) *(*cb_thread_get)(int create); | ||
| 237 | void (*cb_thread_release)(LHASH_OF(ERR_STATE) **hash); | ||
| 238 | ERR_STATE *(*cb_thread_get_item)(const ERR_STATE *); | ||
| 239 | ERR_STATE *(*cb_thread_set_item)(ERR_STATE *); | ||
| 240 | void (*cb_thread_del_item)(const ERR_STATE *); | ||
| 241 | /* Returns the next available error "library" numbers */ | ||
| 242 | int (*cb_get_next_lib)(void); | ||
| 243 | }; | ||
| 244 | |||
| 245 | /* Predeclarations of the "err_defaults" functions */ | ||
| 246 | static LHASH_OF(ERR_STRING_DATA) *int_err_get(int create); | ||
| 247 | static void int_err_del(void); | ||
| 248 | static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *); | ||
| 249 | static ERR_STRING_DATA *int_err_set_item(ERR_STRING_DATA *); | ||
| 250 | static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *); | ||
| 251 | static LHASH_OF(ERR_STATE) *int_thread_get(int create); | ||
| 252 | static void int_thread_release(LHASH_OF(ERR_STATE) **hash); | ||
| 253 | static ERR_STATE *int_thread_get_item(const ERR_STATE *); | ||
| 254 | static ERR_STATE *int_thread_set_item(ERR_STATE *); | ||
| 255 | static void int_thread_del_item(const ERR_STATE *); | ||
| 256 | static int int_err_get_next_lib(void); | ||
| 257 | /* The static ERR_FNS table using these defaults functions */ | ||
| 258 | static const ERR_FNS err_defaults = | ||
| 259 | { | ||
| 260 | int_err_get, | ||
| 261 | int_err_del, | ||
| 262 | int_err_get_item, | ||
| 263 | int_err_set_item, | ||
| 264 | int_err_del_item, | ||
| 265 | int_thread_get, | ||
| 266 | int_thread_release, | ||
| 267 | int_thread_get_item, | ||
| 268 | int_thread_set_item, | ||
| 269 | int_thread_del_item, | ||
| 270 | int_err_get_next_lib | ||
| 271 | }; | ||
| 272 | |||
| 273 | /* The replacable table of ERR_FNS functions we use at run-time */ | ||
| 274 | static const ERR_FNS *err_fns = NULL; | ||
| 275 | |||
| 276 | /* Eg. rather than using "err_get()", use "ERRFN(err_get)()". */ | ||
| 277 | #define ERRFN(a) err_fns->cb_##a | ||
| 278 | |||
| 279 | /* The internal state used by "err_defaults" - as such, the setting, reading, | ||
| 280 | * creating, and deleting of this data should only be permitted via the | ||
| 281 | * "err_defaults" functions. This way, a linked module can completely defer all | ||
| 282 | * ERR state operation (together with requisite locking) to the implementations | ||
| 283 | * and state in the loading application. */ | ||
| 284 | static LHASH_OF(ERR_STRING_DATA) *int_error_hash = NULL; | ||
| 285 | static LHASH_OF(ERR_STATE) *int_thread_hash = NULL; | ||
| 286 | static int int_thread_hash_references = 0; | ||
| 287 | static int int_err_library_number= ERR_LIB_USER; | ||
| 288 | |||
| 289 | /* Internal function that checks whether "err_fns" is set and if not, sets it to | ||
| 290 | * the defaults. */ | ||
| 291 | static void err_fns_check(void) | ||
| 292 | { | ||
| 293 | if (err_fns) return; | ||
| 294 | |||
| 295 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 296 | if (!err_fns) | ||
| 297 | err_fns = &err_defaults; | ||
| 298 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 299 | } | ||
| 300 | |||
| 301 | /* API functions to get or set the underlying ERR functions. */ | ||
| 302 | |||
| 303 | const ERR_FNS *ERR_get_implementation(void) | ||
| 304 | { | ||
| 305 | err_fns_check(); | ||
| 306 | return err_fns; | ||
| 307 | } | ||
| 308 | |||
| 309 | int ERR_set_implementation(const ERR_FNS *fns) | ||
| 310 | { | ||
| 311 | int ret = 0; | ||
| 312 | |||
| 313 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 314 | /* It's too late if 'err_fns' is non-NULL. BTW: not much point setting | ||
| 315 | * an error is there?! */ | ||
| 316 | if (!err_fns) | ||
| 317 | { | ||
| 318 | err_fns = fns; | ||
| 319 | ret = 1; | ||
| 320 | } | ||
| 321 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 322 | return ret; | ||
| 323 | } | ||
| 324 | |||
| 325 | /* These are the callbacks provided to "lh_new()" when creating the LHASH tables | ||
| 326 | * internal to the "err_defaults" implementation. */ | ||
| 327 | |||
| 328 | static unsigned long get_error_values(int inc,int top,const char **file,int *line, | ||
| 329 | const char **data,int *flags); | ||
| 330 | |||
| 331 | /* The internal functions used in the "err_defaults" implementation */ | ||
| 332 | |||
| 333 | static unsigned long err_string_data_hash(const ERR_STRING_DATA *a) | ||
| 334 | { | ||
| 335 | unsigned long ret,l; | ||
| 336 | |||
| 337 | l=a->error; | ||
| 338 | ret=l^ERR_GET_LIB(l)^ERR_GET_FUNC(l); | ||
| 339 | return(ret^ret%19*13); | ||
| 340 | } | ||
| 341 | static IMPLEMENT_LHASH_HASH_FN(err_string_data, ERR_STRING_DATA) | ||
| 342 | |||
| 343 | static int err_string_data_cmp(const ERR_STRING_DATA *a, | ||
| 344 | const ERR_STRING_DATA *b) | ||
| 345 | { | ||
| 346 | return (int)(a->error - b->error); | ||
| 347 | } | ||
| 348 | static IMPLEMENT_LHASH_COMP_FN(err_string_data, ERR_STRING_DATA) | ||
| 349 | |||
| 350 | static LHASH_OF(ERR_STRING_DATA) *int_err_get(int create) | ||
| 351 | { | ||
| 352 | LHASH_OF(ERR_STRING_DATA) *ret = NULL; | ||
| 353 | |||
| 354 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 355 | if (!int_error_hash && create) | ||
| 356 | { | ||
| 357 | CRYPTO_push_info("int_err_get (err.c)"); | ||
| 358 | int_error_hash = lh_ERR_STRING_DATA_new(); | ||
| 359 | CRYPTO_pop_info(); | ||
| 360 | } | ||
| 361 | if (int_error_hash) | ||
| 362 | ret = int_error_hash; | ||
| 363 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 364 | |||
| 365 | return ret; | ||
| 366 | } | ||
| 367 | |||
| 368 | static void int_err_del(void) | ||
| 369 | { | ||
| 370 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 371 | if (int_error_hash) | ||
| 372 | { | ||
| 373 | lh_ERR_STRING_DATA_free(int_error_hash); | ||
| 374 | int_error_hash = NULL; | ||
| 375 | } | ||
| 376 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 377 | } | ||
| 378 | |||
| 379 | static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d) | ||
| 380 | { | ||
| 381 | ERR_STRING_DATA *p; | ||
| 382 | LHASH_OF(ERR_STRING_DATA) *hash; | ||
| 383 | |||
| 384 | err_fns_check(); | ||
| 385 | hash = ERRFN(err_get)(0); | ||
| 386 | if (!hash) | ||
| 387 | return NULL; | ||
| 388 | |||
| 389 | CRYPTO_r_lock(CRYPTO_LOCK_ERR); | ||
| 390 | p = lh_ERR_STRING_DATA_retrieve(hash, d); | ||
| 391 | CRYPTO_r_unlock(CRYPTO_LOCK_ERR); | ||
| 392 | |||
| 393 | return p; | ||
| 394 | } | ||
| 395 | |||
| 396 | static ERR_STRING_DATA *int_err_set_item(ERR_STRING_DATA *d) | ||
| 397 | { | ||
| 398 | ERR_STRING_DATA *p; | ||
| 399 | LHASH_OF(ERR_STRING_DATA) *hash; | ||
| 400 | |||
| 401 | err_fns_check(); | ||
| 402 | hash = ERRFN(err_get)(1); | ||
| 403 | if (!hash) | ||
| 404 | return NULL; | ||
| 405 | |||
| 406 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 407 | p = lh_ERR_STRING_DATA_insert(hash, d); | ||
| 408 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 409 | |||
| 410 | return p; | ||
| 411 | } | ||
| 412 | |||
| 413 | static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *d) | ||
| 414 | { | ||
| 415 | ERR_STRING_DATA *p; | ||
| 416 | LHASH_OF(ERR_STRING_DATA) *hash; | ||
| 417 | |||
| 418 | err_fns_check(); | ||
| 419 | hash = ERRFN(err_get)(0); | ||
| 420 | if (!hash) | ||
| 421 | return NULL; | ||
| 422 | |||
| 423 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 424 | p = lh_ERR_STRING_DATA_delete(hash, d); | ||
| 425 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 426 | |||
| 427 | return p; | ||
| 428 | } | ||
| 429 | |||
| 430 | static unsigned long err_state_hash(const ERR_STATE *a) | ||
| 431 | { | ||
| 432 | return CRYPTO_THREADID_hash(&a->tid) * 13; | ||
| 433 | } | ||
| 434 | static IMPLEMENT_LHASH_HASH_FN(err_state, ERR_STATE) | ||
| 435 | |||
| 436 | static int err_state_cmp(const ERR_STATE *a, const ERR_STATE *b) | ||
| 437 | { | ||
| 438 | return CRYPTO_THREADID_cmp(&a->tid, &b->tid); | ||
| 439 | } | ||
| 440 | static IMPLEMENT_LHASH_COMP_FN(err_state, ERR_STATE) | ||
| 441 | |||
| 442 | static LHASH_OF(ERR_STATE) *int_thread_get(int create) | ||
| 443 | { | ||
| 444 | LHASH_OF(ERR_STATE) *ret = NULL; | ||
| 445 | |||
| 446 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 447 | if (!int_thread_hash && create) | ||
| 448 | { | ||
| 449 | CRYPTO_push_info("int_thread_get (err.c)"); | ||
| 450 | int_thread_hash = lh_ERR_STATE_new(); | ||
| 451 | CRYPTO_pop_info(); | ||
| 452 | } | ||
| 453 | if (int_thread_hash) | ||
| 454 | { | ||
| 455 | int_thread_hash_references++; | ||
| 456 | ret = int_thread_hash; | ||
| 457 | } | ||
| 458 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 459 | return ret; | ||
| 460 | } | ||
| 461 | |||
| 462 | static void int_thread_release(LHASH_OF(ERR_STATE) **hash) | ||
| 463 | { | ||
| 464 | int i; | ||
| 465 | |||
| 466 | if (hash == NULL || *hash == NULL) | ||
| 467 | return; | ||
| 468 | |||
| 469 | i = CRYPTO_add(&int_thread_hash_references, -1, CRYPTO_LOCK_ERR); | ||
| 470 | |||
| 471 | #ifdef REF_PRINT | ||
| 472 | fprintf(stderr,"%4d:%s\n",int_thread_hash_references,"ERR"); | ||
| 473 | #endif | ||
| 474 | if (i > 0) return; | ||
| 475 | #ifdef REF_CHECK | ||
| 476 | if (i < 0) | ||
| 477 | { | ||
| 478 | fprintf(stderr,"int_thread_release, bad reference count\n"); | ||
| 479 | abort(); /* ok */ | ||
| 480 | } | ||
| 481 | #endif | ||
| 482 | *hash = NULL; | ||
| 483 | } | ||
| 484 | |||
| 485 | static ERR_STATE *int_thread_get_item(const ERR_STATE *d) | ||
| 486 | { | ||
| 487 | ERR_STATE *p; | ||
| 488 | LHASH_OF(ERR_STATE) *hash; | ||
| 489 | |||
| 490 | err_fns_check(); | ||
| 491 | hash = ERRFN(thread_get)(0); | ||
| 492 | if (!hash) | ||
| 493 | return NULL; | ||
| 494 | |||
| 495 | CRYPTO_r_lock(CRYPTO_LOCK_ERR); | ||
| 496 | p = lh_ERR_STATE_retrieve(hash, d); | ||
| 497 | CRYPTO_r_unlock(CRYPTO_LOCK_ERR); | ||
| 498 | |||
| 499 | ERRFN(thread_release)(&hash); | ||
| 500 | return p; | ||
| 501 | } | ||
| 502 | |||
| 503 | static ERR_STATE *int_thread_set_item(ERR_STATE *d) | ||
| 504 | { | ||
| 505 | ERR_STATE *p; | ||
| 506 | LHASH_OF(ERR_STATE) *hash; | ||
| 507 | |||
| 508 | err_fns_check(); | ||
| 509 | hash = ERRFN(thread_get)(1); | ||
| 510 | if (!hash) | ||
| 511 | return NULL; | ||
| 512 | |||
| 513 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 514 | p = lh_ERR_STATE_insert(hash, d); | ||
| 515 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 516 | |||
| 517 | ERRFN(thread_release)(&hash); | ||
| 518 | return p; | ||
| 519 | } | ||
| 520 | |||
| 521 | static void int_thread_del_item(const ERR_STATE *d) | ||
| 522 | { | ||
| 523 | ERR_STATE *p; | ||
| 524 | LHASH_OF(ERR_STATE) *hash; | ||
| 525 | |||
| 526 | err_fns_check(); | ||
| 527 | hash = ERRFN(thread_get)(0); | ||
| 528 | if (!hash) | ||
| 529 | return; | ||
| 530 | |||
| 531 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 532 | p = lh_ERR_STATE_delete(hash, d); | ||
| 533 | /* make sure we don't leak memory */ | ||
| 534 | if (int_thread_hash_references == 1 | ||
| 535 | && int_thread_hash && lh_ERR_STATE_num_items(int_thread_hash) == 0) | ||
| 536 | { | ||
| 537 | lh_ERR_STATE_free(int_thread_hash); | ||
| 538 | int_thread_hash = NULL; | ||
| 539 | } | ||
| 540 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 541 | |||
| 542 | ERRFN(thread_release)(&hash); | ||
| 543 | if (p) | ||
| 544 | ERR_STATE_free(p); | ||
| 545 | } | ||
| 546 | |||
| 547 | static int int_err_get_next_lib(void) | ||
| 548 | { | ||
| 549 | int ret; | ||
| 550 | |||
| 551 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 552 | ret = int_err_library_number++; | ||
| 553 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 554 | |||
| 555 | return ret; | ||
| 556 | } | ||
| 557 | |||
| 558 | |||
| 559 | #ifndef OPENSSL_NO_ERR | ||
| 560 | #define NUM_SYS_STR_REASONS 127 | ||
| 561 | #define LEN_SYS_STR_REASON 32 | ||
| 562 | |||
| 563 | static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1]; | ||
| 564 | /* SYS_str_reasons is filled with copies of strerror() results at | ||
| 565 | * initialization. | ||
| 566 | * 'errno' values up to 127 should cover all usual errors, | ||
| 567 | * others will be displayed numerically by ERR_error_string. | ||
| 568 | * It is crucial that we have something for each reason code | ||
| 569 | * that occurs in ERR_str_reasons, or bogus reason strings | ||
| 570 | * will be returned for SYSerr(), which always gets an errno | ||
| 571 | * value and never one of those 'standard' reason codes. */ | ||
| 572 | |||
| 573 | static void build_SYS_str_reasons(void) | ||
| 574 | { | ||
| 575 | /* OPENSSL_malloc cannot be used here, use static storage instead */ | ||
| 576 | static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; | ||
| 577 | int i; | ||
| 578 | static int init = 1; | ||
| 579 | |||
| 580 | CRYPTO_r_lock(CRYPTO_LOCK_ERR); | ||
| 581 | if (!init) | ||
| 582 | { | ||
| 583 | CRYPTO_r_unlock(CRYPTO_LOCK_ERR); | ||
| 584 | return; | ||
| 585 | } | ||
| 586 | |||
| 587 | CRYPTO_r_unlock(CRYPTO_LOCK_ERR); | ||
| 588 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 589 | if (!init) | ||
| 590 | { | ||
| 591 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 592 | return; | ||
| 593 | } | ||
| 594 | |||
| 595 | for (i = 1; i <= NUM_SYS_STR_REASONS; i++) | ||
| 596 | { | ||
| 597 | ERR_STRING_DATA *str = &SYS_str_reasons[i - 1]; | ||
| 598 | |||
| 599 | str->error = (unsigned long)i; | ||
| 600 | if (str->string == NULL) | ||
| 601 | { | ||
| 602 | char (*dest)[LEN_SYS_STR_REASON] = &(strerror_tab[i - 1]); | ||
| 603 | char *src = strerror(i); | ||
| 604 | if (src != NULL) | ||
| 605 | { | ||
| 606 | strncpy(*dest, src, sizeof *dest); | ||
| 607 | (*dest)[sizeof *dest - 1] = '\0'; | ||
| 608 | str->string = *dest; | ||
| 609 | } | ||
| 610 | } | ||
| 611 | if (str->string == NULL) | ||
| 612 | str->string = "unknown"; | ||
| 613 | } | ||
| 614 | |||
| 615 | /* Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] = {0, NULL}, | ||
| 616 | * as required by ERR_load_strings. */ | ||
| 617 | |||
| 618 | init = 0; | ||
| 619 | |||
| 620 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 621 | } | ||
| 622 | #endif | ||
| 125 | 623 | ||
| 126 | #define err_clear_data(p,i) \ | 624 | #define err_clear_data(p,i) \ |
| 127 | do { \ | 625 | do { \ |
| @@ -143,6 +641,68 @@ static unsigned long get_error_values(int inc,int top, | |||
| 143 | (p)->err_line[i]= -1; \ | 641 | (p)->err_line[i]= -1; \ |
| 144 | } while(0) | 642 | } while(0) |
| 145 | 643 | ||
| 644 | static void ERR_STATE_free(ERR_STATE *s) | ||
| 645 | { | ||
| 646 | int i; | ||
| 647 | |||
| 648 | if (s == NULL) | ||
| 649 | return; | ||
| 650 | |||
| 651 | for (i=0; i<ERR_NUM_ERRORS; i++) | ||
| 652 | { | ||
| 653 | err_clear_data(s,i); | ||
| 654 | } | ||
| 655 | OPENSSL_free(s); | ||
| 656 | } | ||
| 657 | |||
| 658 | void ERR_load_ERR_strings(void) | ||
| 659 | { | ||
| 660 | err_fns_check(); | ||
| 661 | #ifndef OPENSSL_NO_ERR | ||
| 662 | err_load_strings(0,ERR_str_libraries); | ||
| 663 | err_load_strings(0,ERR_str_reasons); | ||
| 664 | err_load_strings(ERR_LIB_SYS,ERR_str_functs); | ||
| 665 | build_SYS_str_reasons(); | ||
| 666 | err_load_strings(ERR_LIB_SYS,SYS_str_reasons); | ||
| 667 | #endif | ||
| 668 | } | ||
| 669 | |||
| 670 | static void err_load_strings(int lib, ERR_STRING_DATA *str) | ||
| 671 | { | ||
| 672 | while (str->error) | ||
| 673 | { | ||
| 674 | if (lib) | ||
| 675 | str->error|=ERR_PACK(lib,0,0); | ||
| 676 | ERRFN(err_set_item)(str); | ||
| 677 | str++; | ||
| 678 | } | ||
| 679 | } | ||
| 680 | |||
| 681 | void ERR_load_strings(int lib, ERR_STRING_DATA *str) | ||
| 682 | { | ||
| 683 | ERR_load_ERR_strings(); | ||
| 684 | err_load_strings(lib, str); | ||
| 685 | } | ||
| 686 | |||
| 687 | void ERR_unload_strings(int lib, ERR_STRING_DATA *str) | ||
| 688 | { | ||
| 689 | while (str->error) | ||
| 690 | { | ||
| 691 | if (lib) | ||
| 692 | str->error|=ERR_PACK(lib,0,0); | ||
| 693 | ERRFN(err_del_item)(str); | ||
| 694 | str++; | ||
| 695 | } | ||
| 696 | } | ||
| 697 | |||
| 698 | void ERR_free_strings(void) | ||
| 699 | { | ||
| 700 | err_fns_check(); | ||
| 701 | ERRFN(err_del)(); | ||
| 702 | } | ||
| 703 | |||
| 704 | /********************************************************/ | ||
| 705 | |||
| 146 | void ERR_put_error(int lib, int func, int reason, const char *file, | 706 | void ERR_put_error(int lib, int func, int reason, const char *file, |
| 147 | int line) | 707 | int line) |
| 148 | { | 708 | { |
| @@ -297,6 +857,196 @@ static unsigned long get_error_values(int inc, int top, const char **file, int * | |||
| 297 | return ret; | 857 | return ret; |
| 298 | } | 858 | } |
| 299 | 859 | ||
| 860 | void ERR_error_string_n(unsigned long e, char *buf, size_t len) | ||
| 861 | { | ||
| 862 | char lsbuf[64], fsbuf[64], rsbuf[64]; | ||
| 863 | const char *ls,*fs,*rs; | ||
| 864 | unsigned long l,f,r; | ||
| 865 | |||
| 866 | l=ERR_GET_LIB(e); | ||
| 867 | f=ERR_GET_FUNC(e); | ||
| 868 | r=ERR_GET_REASON(e); | ||
| 869 | |||
| 870 | ls=ERR_lib_error_string(e); | ||
| 871 | fs=ERR_func_error_string(e); | ||
| 872 | rs=ERR_reason_error_string(e); | ||
| 873 | |||
| 874 | if (ls == NULL) | ||
| 875 | BIO_snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l); | ||
| 876 | if (fs == NULL) | ||
| 877 | BIO_snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f); | ||
| 878 | if (rs == NULL) | ||
| 879 | BIO_snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r); | ||
| 880 | |||
| 881 | BIO_snprintf(buf, len,"error:%08lX:%s:%s:%s", e, ls?ls:lsbuf, | ||
| 882 | fs?fs:fsbuf, rs?rs:rsbuf); | ||
| 883 | if (strlen(buf) == len-1) | ||
| 884 | { | ||
| 885 | /* output may be truncated; make sure we always have 5 | ||
| 886 | * colon-separated fields, i.e. 4 colons ... */ | ||
| 887 | #define NUM_COLONS 4 | ||
| 888 | if (len > NUM_COLONS) /* ... if possible */ | ||
| 889 | { | ||
| 890 | int i; | ||
| 891 | char *s = buf; | ||
| 892 | |||
| 893 | for (i = 0; i < NUM_COLONS; i++) | ||
| 894 | { | ||
| 895 | char *colon = strchr(s, ':'); | ||
| 896 | if (colon == NULL || colon > &buf[len-1] - NUM_COLONS + i) | ||
| 897 | { | ||
| 898 | /* set colon no. i at last possible position | ||
| 899 | * (buf[len-1] is the terminating 0)*/ | ||
| 900 | colon = &buf[len-1] - NUM_COLONS + i; | ||
| 901 | *colon = ':'; | ||
| 902 | } | ||
| 903 | s = colon + 1; | ||
| 904 | } | ||
| 905 | } | ||
| 906 | } | ||
| 907 | } | ||
| 908 | |||
| 909 | /* BAD for multi-threading: uses a local buffer if ret == NULL */ | ||
| 910 | /* ERR_error_string_n should be used instead for ret != NULL | ||
| 911 | * as ERR_error_string cannot know how large the buffer is */ | ||
| 912 | char *ERR_error_string(unsigned long e, char *ret) | ||
| 913 | { | ||
| 914 | static char buf[256]; | ||
| 915 | |||
| 916 | if (ret == NULL) ret=buf; | ||
| 917 | ERR_error_string_n(e, ret, 256); | ||
| 918 | |||
| 919 | return ret; | ||
| 920 | } | ||
| 921 | |||
| 922 | LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void) | ||
| 923 | { | ||
| 924 | err_fns_check(); | ||
| 925 | return ERRFN(err_get)(0); | ||
| 926 | } | ||
| 927 | |||
| 928 | LHASH_OF(ERR_STATE) *ERR_get_err_state_table(void) | ||
| 929 | { | ||
| 930 | err_fns_check(); | ||
| 931 | return ERRFN(thread_get)(0); | ||
| 932 | } | ||
| 933 | |||
| 934 | void ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash) | ||
| 935 | { | ||
| 936 | err_fns_check(); | ||
| 937 | ERRFN(thread_release)(hash); | ||
| 938 | } | ||
| 939 | |||
| 940 | const char *ERR_lib_error_string(unsigned long e) | ||
| 941 | { | ||
| 942 | ERR_STRING_DATA d,*p; | ||
| 943 | unsigned long l; | ||
| 944 | |||
| 945 | err_fns_check(); | ||
| 946 | l=ERR_GET_LIB(e); | ||
| 947 | d.error=ERR_PACK(l,0,0); | ||
| 948 | p=ERRFN(err_get_item)(&d); | ||
| 949 | return((p == NULL)?NULL:p->string); | ||
| 950 | } | ||
| 951 | |||
| 952 | const char *ERR_func_error_string(unsigned long e) | ||
| 953 | { | ||
| 954 | ERR_STRING_DATA d,*p; | ||
| 955 | unsigned long l,f; | ||
| 956 | |||
| 957 | err_fns_check(); | ||
| 958 | l=ERR_GET_LIB(e); | ||
| 959 | f=ERR_GET_FUNC(e); | ||
| 960 | d.error=ERR_PACK(l,f,0); | ||
| 961 | p=ERRFN(err_get_item)(&d); | ||
| 962 | return((p == NULL)?NULL:p->string); | ||
| 963 | } | ||
| 964 | |||
| 965 | const char *ERR_reason_error_string(unsigned long e) | ||
| 966 | { | ||
| 967 | ERR_STRING_DATA d,*p=NULL; | ||
| 968 | unsigned long l,r; | ||
| 969 | |||
| 970 | err_fns_check(); | ||
| 971 | l=ERR_GET_LIB(e); | ||
| 972 | r=ERR_GET_REASON(e); | ||
| 973 | d.error=ERR_PACK(l,0,r); | ||
| 974 | p=ERRFN(err_get_item)(&d); | ||
| 975 | if (!p) | ||
| 976 | { | ||
| 977 | d.error=ERR_PACK(0,0,r); | ||
| 978 | p=ERRFN(err_get_item)(&d); | ||
| 979 | } | ||
| 980 | return((p == NULL)?NULL:p->string); | ||
| 981 | } | ||
| 982 | |||
| 983 | void ERR_remove_thread_state(const CRYPTO_THREADID *id) | ||
| 984 | { | ||
| 985 | ERR_STATE tmp; | ||
| 986 | |||
| 987 | if (id) | ||
| 988 | CRYPTO_THREADID_cpy(&tmp.tid, id); | ||
| 989 | else | ||
| 990 | CRYPTO_THREADID_current(&tmp.tid); | ||
| 991 | err_fns_check(); | ||
| 992 | /* thread_del_item automatically destroys the LHASH if the number of | ||
| 993 | * items reaches zero. */ | ||
| 994 | ERRFN(thread_del_item)(&tmp); | ||
| 995 | } | ||
| 996 | |||
| 997 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 998 | void ERR_remove_state(unsigned long pid) | ||
| 999 | { | ||
| 1000 | ERR_remove_thread_state(NULL); | ||
| 1001 | } | ||
| 1002 | #endif | ||
| 1003 | |||
| 1004 | ERR_STATE *ERR_get_state(void) | ||
| 1005 | { | ||
| 1006 | static ERR_STATE fallback; | ||
| 1007 | ERR_STATE *ret,tmp,*tmpp=NULL; | ||
| 1008 | int i; | ||
| 1009 | CRYPTO_THREADID tid; | ||
| 1010 | |||
| 1011 | err_fns_check(); | ||
| 1012 | CRYPTO_THREADID_current(&tid); | ||
| 1013 | CRYPTO_THREADID_cpy(&tmp.tid, &tid); | ||
| 1014 | ret=ERRFN(thread_get_item)(&tmp); | ||
| 1015 | |||
| 1016 | /* ret == the error state, if NULL, make a new one */ | ||
| 1017 | if (ret == NULL) | ||
| 1018 | { | ||
| 1019 | ret=(ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE)); | ||
| 1020 | if (ret == NULL) return(&fallback); | ||
| 1021 | CRYPTO_THREADID_cpy(&ret->tid, &tid); | ||
| 1022 | ret->top=0; | ||
| 1023 | ret->bottom=0; | ||
| 1024 | for (i=0; i<ERR_NUM_ERRORS; i++) | ||
| 1025 | { | ||
| 1026 | ret->err_data[i]=NULL; | ||
| 1027 | ret->err_data_flags[i]=0; | ||
| 1028 | } | ||
| 1029 | tmpp = ERRFN(thread_set_item)(ret); | ||
| 1030 | /* To check if insertion failed, do a get. */ | ||
| 1031 | if (ERRFN(thread_get_item)(ret) != ret) | ||
| 1032 | { | ||
| 1033 | ERR_STATE_free(ret); /* could not insert it */ | ||
| 1034 | return(&fallback); | ||
| 1035 | } | ||
| 1036 | /* If a race occured in this function and we came second, tmpp | ||
| 1037 | * is the first one that we just replaced. */ | ||
| 1038 | if (tmpp) | ||
| 1039 | ERR_STATE_free(tmpp); | ||
| 1040 | } | ||
| 1041 | return ret; | ||
| 1042 | } | ||
| 1043 | |||
| 1044 | int ERR_get_next_error_library(void) | ||
| 1045 | { | ||
| 1046 | err_fns_check(); | ||
| 1047 | return ERRFN(get_next_lib)(); | ||
| 1048 | } | ||
| 1049 | |||
| 300 | void ERR_set_error_data(char *data, int flags) | 1050 | void ERR_set_error_data(char *data, int flags) |
| 301 | { | 1051 | { |
| 302 | ERR_STATE *es; | 1052 | ERR_STATE *es; |
| @@ -383,34 +1133,3 @@ int ERR_pop_to_mark(void) | |||
| 383 | es->err_flags[es->top]&=~ERR_FLAG_MARK; | 1133 | es->err_flags[es->top]&=~ERR_FLAG_MARK; |
| 384 | return 1; | 1134 | return 1; |
| 385 | } | 1135 | } |
| 386 | |||
| 387 | #ifdef OPENSSL_FIPS | ||
| 388 | |||
| 389 | static ERR_STATE *fget_state(void) | ||
| 390 | { | ||
| 391 | static ERR_STATE fstate; | ||
| 392 | return &fstate; | ||
| 393 | } | ||
| 394 | |||
| 395 | ERR_STATE *(*get_state_func)(void) = fget_state; | ||
| 396 | void (*remove_state_func)(unsigned long pid); | ||
| 397 | |||
| 398 | ERR_STATE *ERR_get_state(void) | ||
| 399 | { | ||
| 400 | return get_state_func(); | ||
| 401 | } | ||
| 402 | |||
| 403 | void int_ERR_set_state_func(ERR_STATE *(*get_func)(void), | ||
| 404 | void (*remove_func)(unsigned long pid)) | ||
| 405 | { | ||
| 406 | get_state_func = get_func; | ||
| 407 | remove_state_func = remove_func; | ||
| 408 | } | ||
| 409 | |||
| 410 | void ERR_remove_state(unsigned long pid) | ||
| 411 | { | ||
| 412 | if (remove_state_func) | ||
| 413 | remove_state_func(pid); | ||
| 414 | } | ||
| 415 | |||
| 416 | #endif | ||
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h index dcac415231..b9f8c16d47 100644 --- a/src/lib/libcrypto/err/err.h +++ b/src/lib/libcrypto/err/err.h | |||
| @@ -55,6 +55,59 @@ | |||
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 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 | */ | ||
| 58 | 111 | ||
| 59 | #ifndef HEADER_ERR_H | 112 | #ifndef HEADER_ERR_H |
| 60 | #define HEADER_ERR_H | 113 | #define HEADER_ERR_H |
| @@ -94,7 +147,7 @@ extern "C" { | |||
| 94 | #define ERR_NUM_ERRORS 16 | 147 | #define ERR_NUM_ERRORS 16 |
| 95 | typedef struct err_state_st | 148 | typedef struct err_state_st |
| 96 | { | 149 | { |
| 97 | unsigned long pid; | 150 | CRYPTO_THREADID tid; |
| 98 | int err_flags[ERR_NUM_ERRORS]; | 151 | int err_flags[ERR_NUM_ERRORS]; |
| 99 | unsigned long err_buffer[ERR_NUM_ERRORS]; | 152 | unsigned long err_buffer[ERR_NUM_ERRORS]; |
| 100 | char *err_data[ERR_NUM_ERRORS]; | 153 | char *err_data[ERR_NUM_ERRORS]; |
| @@ -142,7 +195,9 @@ typedef struct err_state_st | |||
| 142 | #define ERR_LIB_STORE 44 | 195 | #define ERR_LIB_STORE 44 |
| 143 | #define ERR_LIB_FIPS 45 | 196 | #define ERR_LIB_FIPS 45 |
| 144 | #define ERR_LIB_CMS 46 | 197 | #define ERR_LIB_CMS 46 |
| 145 | #define ERR_LIB_JPAKE 47 | 198 | #define ERR_LIB_TS 47 |
| 199 | #define ERR_LIB_HMAC 48 | ||
| 200 | #define ERR_LIB_JPAKE 49 | ||
| 146 | 201 | ||
| 147 | #define ERR_LIB_USER 128 | 202 | #define ERR_LIB_USER 128 |
| 148 | 203 | ||
| @@ -176,6 +231,8 @@ typedef struct err_state_st | |||
| 176 | #define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__) | 231 | #define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__) |
| 177 | #define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__) | 232 | #define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__) |
| 178 | #define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__) | 233 | #define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__) |
| 234 | #define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__) | ||
| 235 | #define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__) | ||
| 179 | #define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__) | 236 | #define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__) |
| 180 | 237 | ||
| 181 | /* Borland C seems too stupid to be able to shift and do longs in | 238 | /* Borland C seems too stupid to be able to shift and do longs in |
| @@ -232,6 +289,7 @@ typedef struct err_state_st | |||
| 232 | #define ERR_R_ECDSA_LIB ERR_LIB_ECDSA /* 42 */ | 289 | #define ERR_R_ECDSA_LIB ERR_LIB_ECDSA /* 42 */ |
| 233 | #define ERR_R_ECDH_LIB ERR_LIB_ECDH /* 43 */ | 290 | #define ERR_R_ECDH_LIB ERR_LIB_ECDH /* 43 */ |
| 234 | #define ERR_R_STORE_LIB ERR_LIB_STORE /* 44 */ | 291 | #define ERR_R_STORE_LIB ERR_LIB_STORE /* 44 */ |
| 292 | #define ERR_R_TS_LIB ERR_LIB_TS /* 45 */ | ||
| 235 | 293 | ||
| 236 | #define ERR_R_NESTED_ASN1_ERROR 58 | 294 | #define ERR_R_NESTED_ASN1_ERROR 58 |
| 237 | #define ERR_R_BAD_ASN1_OBJECT_HEADER 59 | 295 | #define ERR_R_BAD_ASN1_OBJECT_HEADER 59 |
| @@ -294,13 +352,16 @@ void ERR_load_ERR_strings(void); | |||
| 294 | void ERR_load_crypto_strings(void); | 352 | void ERR_load_crypto_strings(void); |
| 295 | void ERR_free_strings(void); | 353 | void ERR_free_strings(void); |
| 296 | 354 | ||
| 355 | void ERR_remove_thread_state(const CRYPTO_THREADID *tid); | ||
| 356 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 297 | void ERR_remove_state(unsigned long pid); /* if zero we look it up */ | 357 | void ERR_remove_state(unsigned long pid); /* if zero we look it up */ |
| 358 | #endif | ||
| 298 | ERR_STATE *ERR_get_state(void); | 359 | ERR_STATE *ERR_get_state(void); |
| 299 | 360 | ||
| 300 | #ifndef OPENSSL_NO_LHASH | 361 | #ifndef OPENSSL_NO_LHASH |
| 301 | LHASH *ERR_get_string_table(void); | 362 | LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void); |
| 302 | LHASH *ERR_get_err_state_table(void); | 363 | LHASH_OF(ERR_STATE) *ERR_get_err_state_table(void); |
| 303 | void ERR_release_err_state_table(LHASH **hash); | 364 | void ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash); |
| 304 | #endif | 365 | #endif |
| 305 | 366 | ||
| 306 | int ERR_get_next_error_library(void); | 367 | int ERR_get_next_error_library(void); |
| @@ -308,12 +369,6 @@ int ERR_get_next_error_library(void); | |||
| 308 | int ERR_set_mark(void); | 369 | int ERR_set_mark(void); |
| 309 | int ERR_pop_to_mark(void); | 370 | int ERR_pop_to_mark(void); |
| 310 | 371 | ||
| 311 | #ifdef OPENSSL_FIPS | ||
| 312 | void int_ERR_set_state_func(ERR_STATE *(*get_func)(void), | ||
| 313 | void (*remove_func)(unsigned long pid)); | ||
| 314 | void int_ERR_lib_init(void); | ||
| 315 | #endif | ||
| 316 | |||
| 317 | /* Already defined in ossl_typ.h */ | 372 | /* Already defined in ossl_typ.h */ |
| 318 | /* typedef struct st_ERR_FNS ERR_FNS; */ | 373 | /* typedef struct st_ERR_FNS ERR_FNS; */ |
| 319 | /* An application can use this function and provide the return value to loaded | 374 | /* An application can use this function and provide the return value to loaded |
diff --git a/src/lib/libcrypto/err/err_all.c b/src/lib/libcrypto/err/err_all.c index f21a5276ed..fc049e8e88 100644 --- a/src/lib/libcrypto/err/err_all.c +++ b/src/lib/libcrypto/err/err_all.c | |||
| @@ -64,6 +64,7 @@ | |||
| 64 | #endif | 64 | #endif |
| 65 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
| 66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
| 67 | #include <openssl/comp.h> | ||
| 67 | #ifndef OPENSSL_NO_RSA | 68 | #ifndef OPENSSL_NO_RSA |
| 68 | #include <openssl/rsa.h> | 69 | #include <openssl/rsa.h> |
| 69 | #endif | 70 | #endif |
| @@ -94,16 +95,14 @@ | |||
| 94 | #include <openssl/ui.h> | 95 | #include <openssl/ui.h> |
| 95 | #include <openssl/ocsp.h> | 96 | #include <openssl/ocsp.h> |
| 96 | #include <openssl/err.h> | 97 | #include <openssl/err.h> |
| 97 | #ifdef OPENSSL_FIPS | 98 | #include <openssl/ts.h> |
| 98 | #include <openssl/fips.h> | ||
| 99 | #endif | ||
| 100 | |||
| 101 | #ifndef OPENSSL_NO_CMS | 99 | #ifndef OPENSSL_NO_CMS |
| 102 | #include <openssl/cms.h> | 100 | #include <openssl/cms.h> |
| 103 | #endif | 101 | #endif |
| 104 | #ifndef OPENSSL_NO_JPAKE | 102 | #ifndef OPENSSL_NO_JPAKE |
| 105 | #include <openssl/jpake.h> | 103 | #include <openssl/jpake.h> |
| 106 | #endif | 104 | #endif |
| 105 | #include <openssl/comp.h> | ||
| 107 | 106 | ||
| 108 | void ERR_load_crypto_strings(void) | 107 | void ERR_load_crypto_strings(void) |
| 109 | { | 108 | { |
| @@ -127,6 +126,7 @@ void ERR_load_crypto_strings(void) | |||
| 127 | ERR_load_ASN1_strings(); | 126 | ERR_load_ASN1_strings(); |
| 128 | ERR_load_CONF_strings(); | 127 | ERR_load_CONF_strings(); |
| 129 | ERR_load_CRYPTO_strings(); | 128 | ERR_load_CRYPTO_strings(); |
| 129 | ERR_load_COMP_strings(); | ||
| 130 | #ifndef OPENSSL_NO_EC | 130 | #ifndef OPENSSL_NO_EC |
| 131 | ERR_load_EC_strings(); | 131 | ERR_load_EC_strings(); |
| 132 | #endif | 132 | #endif |
| @@ -143,19 +143,18 @@ void ERR_load_crypto_strings(void) | |||
| 143 | ERR_load_PKCS12_strings(); | 143 | ERR_load_PKCS12_strings(); |
| 144 | ERR_load_RAND_strings(); | 144 | ERR_load_RAND_strings(); |
| 145 | ERR_load_DSO_strings(); | 145 | ERR_load_DSO_strings(); |
| 146 | ERR_load_TS_strings(); | ||
| 146 | #ifndef OPENSSL_NO_ENGINE | 147 | #ifndef OPENSSL_NO_ENGINE |
| 147 | ERR_load_ENGINE_strings(); | 148 | ERR_load_ENGINE_strings(); |
| 148 | #endif | 149 | #endif |
| 149 | ERR_load_OCSP_strings(); | 150 | ERR_load_OCSP_strings(); |
| 150 | ERR_load_UI_strings(); | 151 | ERR_load_UI_strings(); |
| 151 | #ifdef OPENSSL_FIPS | ||
| 152 | ERR_load_FIPS_strings(); | ||
| 153 | #endif | ||
| 154 | #ifndef OPENSSL_NO_CMS | 152 | #ifndef OPENSSL_NO_CMS |
| 155 | ERR_load_CMS_strings(); | 153 | ERR_load_CMS_strings(); |
| 156 | #endif | 154 | #endif |
| 157 | #ifndef OPENSSL_NO_JPAKE | 155 | #ifndef OPENSSL_NO_JPAKE |
| 158 | ERR_load_JPAKE_strings(); | 156 | ERR_load_JPAKE_strings(); |
| 159 | #endif | 157 | #endif |
| 158 | ERR_load_COMP_strings(); | ||
| 160 | #endif | 159 | #endif |
| 161 | } | 160 | } |
diff --git a/src/lib/libcrypto/err/err_bio.c b/src/lib/libcrypto/err/err_bio.c deleted file mode 100644 index a42f804840..0000000000 --- a/src/lib/libcrypto/err/err_bio.c +++ /dev/null | |||
| @@ -1,75 +0,0 @@ | |||
| 1 | /* crypto/err/err_prn.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/lhash.h> | ||
| 62 | #include <openssl/crypto.h> | ||
| 63 | #include <openssl/buffer.h> | ||
| 64 | #include <openssl/err.h> | ||
| 65 | |||
| 66 | static int print_bio(const char *str, size_t len, void *bp) | ||
| 67 | { | ||
| 68 | return BIO_write((BIO *)bp, str, len); | ||
| 69 | } | ||
| 70 | void ERR_print_errors(BIO *bp) | ||
| 71 | { | ||
| 72 | ERR_print_errors_cb(print_bio, bp); | ||
| 73 | } | ||
| 74 | |||
| 75 | |||
diff --git a/src/lib/libcrypto/err/err_def.c b/src/lib/libcrypto/err/err_def.c deleted file mode 100644 index 7ed3d84955..0000000000 --- a/src/lib/libcrypto/err/err_def.c +++ /dev/null | |||
| @@ -1,665 +0,0 @@ | |||
| 1 | /* crypto/err/err_def.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 | #include <stdio.h> | ||
| 113 | #include <stdarg.h> | ||
| 114 | #include <string.h> | ||
| 115 | #include "cryptlib.h" | ||
| 116 | #include <openssl/lhash.h> | ||
| 117 | #include <openssl/crypto.h> | ||
| 118 | #include <openssl/buffer.h> | ||
| 119 | #include <openssl/bio.h> | ||
| 120 | #include <openssl/err.h> | ||
| 121 | |||
| 122 | #define err_clear_data(p,i) \ | ||
| 123 | do { \ | ||
| 124 | if (((p)->err_data[i] != NULL) && \ | ||
| 125 | (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \ | ||
| 126 | { \ | ||
| 127 | OPENSSL_free((p)->err_data[i]); \ | ||
| 128 | (p)->err_data[i]=NULL; \ | ||
| 129 | } \ | ||
| 130 | (p)->err_data_flags[i]=0; \ | ||
| 131 | } while(0) | ||
| 132 | |||
| 133 | #define err_clear(p,i) \ | ||
| 134 | do { \ | ||
| 135 | (p)->err_flags[i]=0; \ | ||
| 136 | (p)->err_buffer[i]=0; \ | ||
| 137 | err_clear_data(p,i); \ | ||
| 138 | (p)->err_file[i]=NULL; \ | ||
| 139 | (p)->err_line[i]= -1; \ | ||
| 140 | } while(0) | ||
| 141 | |||
| 142 | static void err_load_strings(int lib, ERR_STRING_DATA *str); | ||
| 143 | |||
| 144 | static void ERR_STATE_free(ERR_STATE *s); | ||
| 145 | |||
| 146 | /* Define the predeclared (but externally opaque) "ERR_FNS" type */ | ||
| 147 | struct st_ERR_FNS | ||
| 148 | { | ||
| 149 | /* Works on the "error_hash" string table */ | ||
| 150 | LHASH *(*cb_err_get)(int create); | ||
| 151 | void (*cb_err_del)(void); | ||
| 152 | ERR_STRING_DATA *(*cb_err_get_item)(const ERR_STRING_DATA *); | ||
| 153 | ERR_STRING_DATA *(*cb_err_set_item)(ERR_STRING_DATA *); | ||
| 154 | ERR_STRING_DATA *(*cb_err_del_item)(ERR_STRING_DATA *); | ||
| 155 | /* Works on the "thread_hash" error-state table */ | ||
| 156 | LHASH *(*cb_thread_get)(int create); | ||
| 157 | void (*cb_thread_release)(LHASH **hash); | ||
| 158 | ERR_STATE *(*cb_thread_get_item)(const ERR_STATE *); | ||
| 159 | ERR_STATE *(*cb_thread_set_item)(ERR_STATE *); | ||
| 160 | void (*cb_thread_del_item)(const ERR_STATE *); | ||
| 161 | /* Returns the next available error "library" numbers */ | ||
| 162 | int (*cb_get_next_lib)(void); | ||
| 163 | }; | ||
| 164 | |||
| 165 | /* Predeclarations of the "err_defaults" functions */ | ||
| 166 | static LHASH *int_err_get(int create); | ||
| 167 | static void int_err_del(void); | ||
| 168 | static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *); | ||
| 169 | static ERR_STRING_DATA *int_err_set_item(ERR_STRING_DATA *); | ||
| 170 | static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *); | ||
| 171 | static LHASH *int_thread_get(int create); | ||
| 172 | static void int_thread_release(LHASH **hash); | ||
| 173 | static ERR_STATE *int_thread_get_item(const ERR_STATE *); | ||
| 174 | static ERR_STATE *int_thread_set_item(ERR_STATE *); | ||
| 175 | static void int_thread_del_item(const ERR_STATE *); | ||
| 176 | static int int_err_get_next_lib(void); | ||
| 177 | /* The static ERR_FNS table using these defaults functions */ | ||
| 178 | static const ERR_FNS err_defaults = | ||
| 179 | { | ||
| 180 | int_err_get, | ||
| 181 | int_err_del, | ||
| 182 | int_err_get_item, | ||
| 183 | int_err_set_item, | ||
| 184 | int_err_del_item, | ||
| 185 | int_thread_get, | ||
| 186 | int_thread_release, | ||
| 187 | int_thread_get_item, | ||
| 188 | int_thread_set_item, | ||
| 189 | int_thread_del_item, | ||
| 190 | int_err_get_next_lib | ||
| 191 | }; | ||
| 192 | |||
| 193 | /* The replacable table of ERR_FNS functions we use at run-time */ | ||
| 194 | static const ERR_FNS *err_fns = NULL; | ||
| 195 | |||
| 196 | /* Eg. rather than using "err_get()", use "ERRFN(err_get)()". */ | ||
| 197 | #define ERRFN(a) err_fns->cb_##a | ||
| 198 | |||
| 199 | /* The internal state used by "err_defaults" - as such, the setting, reading, | ||
| 200 | * creating, and deleting of this data should only be permitted via the | ||
| 201 | * "err_defaults" functions. This way, a linked module can completely defer all | ||
| 202 | * ERR state operation (together with requisite locking) to the implementations | ||
| 203 | * and state in the loading application. */ | ||
| 204 | static LHASH *int_error_hash = NULL; | ||
| 205 | static LHASH *int_thread_hash = NULL; | ||
| 206 | static int int_thread_hash_references = 0; | ||
| 207 | static int int_err_library_number= ERR_LIB_USER; | ||
| 208 | |||
| 209 | /* Internal function that checks whether "err_fns" is set and if not, sets it to | ||
| 210 | * the defaults. */ | ||
| 211 | static void err_fns_check(void) | ||
| 212 | { | ||
| 213 | if (err_fns) return; | ||
| 214 | |||
| 215 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 216 | if (!err_fns) | ||
| 217 | err_fns = &err_defaults; | ||
| 218 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 219 | } | ||
| 220 | |||
| 221 | /* API functions to get or set the underlying ERR functions. */ | ||
| 222 | |||
| 223 | const ERR_FNS *ERR_get_implementation(void) | ||
| 224 | { | ||
| 225 | err_fns_check(); | ||
| 226 | return err_fns; | ||
| 227 | } | ||
| 228 | |||
| 229 | int ERR_set_implementation(const ERR_FNS *fns) | ||
| 230 | { | ||
| 231 | int ret = 0; | ||
| 232 | |||
| 233 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 234 | /* It's too late if 'err_fns' is non-NULL. BTW: not much point setting | ||
| 235 | * an error is there?! */ | ||
| 236 | if (!err_fns) | ||
| 237 | { | ||
| 238 | err_fns = fns; | ||
| 239 | ret = 1; | ||
| 240 | } | ||
| 241 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 242 | return ret; | ||
| 243 | } | ||
| 244 | |||
| 245 | /* These are the callbacks provided to "lh_new()" when creating the LHASH tables | ||
| 246 | * internal to the "err_defaults" implementation. */ | ||
| 247 | |||
| 248 | /* static unsigned long err_hash(ERR_STRING_DATA *a); */ | ||
| 249 | static unsigned long err_hash(const void *a_void); | ||
| 250 | /* static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b); */ | ||
| 251 | static int err_cmp(const void *a_void, const void *b_void); | ||
| 252 | /* static unsigned long pid_hash(ERR_STATE *pid); */ | ||
| 253 | static unsigned long pid_hash(const void *pid_void); | ||
| 254 | /* static int pid_cmp(ERR_STATE *a,ERR_STATE *pid); */ | ||
| 255 | static int pid_cmp(const void *a_void,const void *pid_void); | ||
| 256 | |||
| 257 | /* The internal functions used in the "err_defaults" implementation */ | ||
| 258 | |||
| 259 | static LHASH *int_err_get(int create) | ||
| 260 | { | ||
| 261 | LHASH *ret = NULL; | ||
| 262 | |||
| 263 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 264 | if (!int_error_hash && create) | ||
| 265 | { | ||
| 266 | CRYPTO_push_info("int_err_get (err.c)"); | ||
| 267 | int_error_hash = lh_new(err_hash, err_cmp); | ||
| 268 | CRYPTO_pop_info(); | ||
| 269 | } | ||
| 270 | if (int_error_hash) | ||
| 271 | ret = int_error_hash; | ||
| 272 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 273 | |||
| 274 | return ret; | ||
| 275 | } | ||
| 276 | |||
| 277 | static void int_err_del(void) | ||
| 278 | { | ||
| 279 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 280 | if (int_error_hash) | ||
| 281 | { | ||
| 282 | lh_free(int_error_hash); | ||
| 283 | int_error_hash = NULL; | ||
| 284 | } | ||
| 285 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 286 | } | ||
| 287 | |||
| 288 | static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d) | ||
| 289 | { | ||
| 290 | ERR_STRING_DATA *p; | ||
| 291 | LHASH *hash; | ||
| 292 | |||
| 293 | err_fns_check(); | ||
| 294 | hash = ERRFN(err_get)(0); | ||
| 295 | if (!hash) | ||
| 296 | return NULL; | ||
| 297 | |||
| 298 | CRYPTO_r_lock(CRYPTO_LOCK_ERR); | ||
| 299 | p = (ERR_STRING_DATA *)lh_retrieve(hash, d); | ||
| 300 | CRYPTO_r_unlock(CRYPTO_LOCK_ERR); | ||
| 301 | |||
| 302 | return p; | ||
| 303 | } | ||
| 304 | |||
| 305 | static ERR_STRING_DATA *int_err_set_item(ERR_STRING_DATA *d) | ||
| 306 | { | ||
| 307 | ERR_STRING_DATA *p; | ||
| 308 | LHASH *hash; | ||
| 309 | |||
| 310 | err_fns_check(); | ||
| 311 | hash = ERRFN(err_get)(1); | ||
| 312 | if (!hash) | ||
| 313 | return NULL; | ||
| 314 | |||
| 315 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 316 | p = (ERR_STRING_DATA *)lh_insert(hash, d); | ||
| 317 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 318 | |||
| 319 | return p; | ||
| 320 | } | ||
| 321 | |||
| 322 | static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *d) | ||
| 323 | { | ||
| 324 | ERR_STRING_DATA *p; | ||
| 325 | LHASH *hash; | ||
| 326 | |||
| 327 | err_fns_check(); | ||
| 328 | hash = ERRFN(err_get)(0); | ||
| 329 | if (!hash) | ||
| 330 | return NULL; | ||
| 331 | |||
| 332 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 333 | p = (ERR_STRING_DATA *)lh_delete(hash, d); | ||
| 334 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 335 | |||
| 336 | return p; | ||
| 337 | } | ||
| 338 | |||
| 339 | static LHASH *int_thread_get(int create) | ||
| 340 | { | ||
| 341 | LHASH *ret = NULL; | ||
| 342 | |||
| 343 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 344 | if (!int_thread_hash && create) | ||
| 345 | { | ||
| 346 | CRYPTO_push_info("int_thread_get (err.c)"); | ||
| 347 | int_thread_hash = lh_new(pid_hash, pid_cmp); | ||
| 348 | CRYPTO_pop_info(); | ||
| 349 | } | ||
| 350 | if (int_thread_hash) | ||
| 351 | { | ||
| 352 | int_thread_hash_references++; | ||
| 353 | ret = int_thread_hash; | ||
| 354 | } | ||
| 355 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 356 | return ret; | ||
| 357 | } | ||
| 358 | |||
| 359 | static void int_thread_release(LHASH **hash) | ||
| 360 | { | ||
| 361 | int i; | ||
| 362 | |||
| 363 | if (hash == NULL || *hash == NULL) | ||
| 364 | return; | ||
| 365 | |||
| 366 | i = CRYPTO_add(&int_thread_hash_references, -1, CRYPTO_LOCK_ERR); | ||
| 367 | |||
| 368 | #ifdef REF_PRINT | ||
| 369 | fprintf(stderr,"%4d:%s\n",int_thread_hash_references,"ERR"); | ||
| 370 | #endif | ||
| 371 | if (i > 0) return; | ||
| 372 | #ifdef REF_CHECK | ||
| 373 | if (i < 0) | ||
| 374 | { | ||
| 375 | fprintf(stderr,"int_thread_release, bad reference count\n"); | ||
| 376 | abort(); /* ok */ | ||
| 377 | } | ||
| 378 | #endif | ||
| 379 | *hash = NULL; | ||
| 380 | } | ||
| 381 | |||
| 382 | static ERR_STATE *int_thread_get_item(const ERR_STATE *d) | ||
| 383 | { | ||
| 384 | ERR_STATE *p; | ||
| 385 | LHASH *hash; | ||
| 386 | |||
| 387 | err_fns_check(); | ||
| 388 | hash = ERRFN(thread_get)(0); | ||
| 389 | if (!hash) | ||
| 390 | return NULL; | ||
| 391 | |||
| 392 | CRYPTO_r_lock(CRYPTO_LOCK_ERR); | ||
| 393 | p = (ERR_STATE *)lh_retrieve(hash, d); | ||
| 394 | CRYPTO_r_unlock(CRYPTO_LOCK_ERR); | ||
| 395 | |||
| 396 | ERRFN(thread_release)(&hash); | ||
| 397 | return p; | ||
| 398 | } | ||
| 399 | |||
| 400 | static ERR_STATE *int_thread_set_item(ERR_STATE *d) | ||
| 401 | { | ||
| 402 | ERR_STATE *p; | ||
| 403 | LHASH *hash; | ||
| 404 | |||
| 405 | err_fns_check(); | ||
| 406 | hash = ERRFN(thread_get)(1); | ||
| 407 | if (!hash) | ||
| 408 | return NULL; | ||
| 409 | |||
| 410 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 411 | p = (ERR_STATE *)lh_insert(hash, d); | ||
| 412 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 413 | |||
| 414 | ERRFN(thread_release)(&hash); | ||
| 415 | return p; | ||
| 416 | } | ||
| 417 | |||
| 418 | static void int_thread_del_item(const ERR_STATE *d) | ||
| 419 | { | ||
| 420 | ERR_STATE *p; | ||
| 421 | LHASH *hash; | ||
| 422 | |||
| 423 | err_fns_check(); | ||
| 424 | hash = ERRFN(thread_get)(0); | ||
| 425 | if (!hash) | ||
| 426 | return; | ||
| 427 | |||
| 428 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 429 | p = (ERR_STATE *)lh_delete(hash, d); | ||
| 430 | /* make sure we don't leak memory */ | ||
| 431 | if (int_thread_hash_references == 1 | ||
| 432 | && int_thread_hash && (lh_num_items(int_thread_hash) == 0)) | ||
| 433 | { | ||
| 434 | lh_free(int_thread_hash); | ||
| 435 | int_thread_hash = NULL; | ||
| 436 | } | ||
| 437 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 438 | |||
| 439 | ERRFN(thread_release)(&hash); | ||
| 440 | if (p) | ||
| 441 | ERR_STATE_free(p); | ||
| 442 | } | ||
| 443 | |||
| 444 | static int int_err_get_next_lib(void) | ||
| 445 | { | ||
| 446 | int ret; | ||
| 447 | |||
| 448 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 449 | ret = int_err_library_number++; | ||
| 450 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 451 | |||
| 452 | return ret; | ||
| 453 | } | ||
| 454 | |||
| 455 | static void ERR_STATE_free(ERR_STATE *s) | ||
| 456 | { | ||
| 457 | int i; | ||
| 458 | |||
| 459 | if (s == NULL) | ||
| 460 | return; | ||
| 461 | |||
| 462 | for (i=0; i<ERR_NUM_ERRORS; i++) | ||
| 463 | { | ||
| 464 | err_clear_data(s,i); | ||
| 465 | } | ||
| 466 | OPENSSL_free(s); | ||
| 467 | } | ||
| 468 | |||
| 469 | static void err_load_strings(int lib, ERR_STRING_DATA *str) | ||
| 470 | { | ||
| 471 | while (str->error) | ||
| 472 | { | ||
| 473 | if (lib) | ||
| 474 | str->error|=ERR_PACK(lib,0,0); | ||
| 475 | ERRFN(err_set_item)(str); | ||
| 476 | str++; | ||
| 477 | } | ||
| 478 | } | ||
| 479 | |||
| 480 | void ERR_load_strings(int lib, ERR_STRING_DATA *str) | ||
| 481 | { | ||
| 482 | err_fns_check(); | ||
| 483 | err_load_strings(lib, str); | ||
| 484 | } | ||
| 485 | |||
| 486 | void ERR_unload_strings(int lib, ERR_STRING_DATA *str) | ||
| 487 | { | ||
| 488 | while (str->error) | ||
| 489 | { | ||
| 490 | if (lib) | ||
| 491 | str->error|=ERR_PACK(lib,0,0); | ||
| 492 | ERRFN(err_del_item)(str); | ||
| 493 | str++; | ||
| 494 | } | ||
| 495 | } | ||
| 496 | |||
| 497 | void ERR_free_strings(void) | ||
| 498 | { | ||
| 499 | err_fns_check(); | ||
| 500 | ERRFN(err_del)(); | ||
| 501 | } | ||
| 502 | |||
| 503 | LHASH *ERR_get_string_table(void) | ||
| 504 | { | ||
| 505 | err_fns_check(); | ||
| 506 | return ERRFN(err_get)(0); | ||
| 507 | } | ||
| 508 | |||
| 509 | LHASH *ERR_get_err_state_table(void) | ||
| 510 | { | ||
| 511 | err_fns_check(); | ||
| 512 | return ERRFN(thread_get)(0); | ||
| 513 | } | ||
| 514 | |||
| 515 | void ERR_release_err_state_table(LHASH **hash) | ||
| 516 | { | ||
| 517 | err_fns_check(); | ||
| 518 | ERRFN(thread_release)(hash); | ||
| 519 | } | ||
| 520 | |||
| 521 | const char *ERR_lib_error_string(unsigned long e) | ||
| 522 | { | ||
| 523 | ERR_STRING_DATA d,*p; | ||
| 524 | unsigned long l; | ||
| 525 | |||
| 526 | err_fns_check(); | ||
| 527 | l=ERR_GET_LIB(e); | ||
| 528 | d.error=ERR_PACK(l,0,0); | ||
| 529 | p=ERRFN(err_get_item)(&d); | ||
| 530 | return((p == NULL)?NULL:p->string); | ||
| 531 | } | ||
| 532 | |||
| 533 | const char *ERR_func_error_string(unsigned long e) | ||
| 534 | { | ||
| 535 | ERR_STRING_DATA d,*p; | ||
| 536 | unsigned long l,f; | ||
| 537 | |||
| 538 | err_fns_check(); | ||
| 539 | l=ERR_GET_LIB(e); | ||
| 540 | f=ERR_GET_FUNC(e); | ||
| 541 | d.error=ERR_PACK(l,f,0); | ||
| 542 | p=ERRFN(err_get_item)(&d); | ||
| 543 | return((p == NULL)?NULL:p->string); | ||
| 544 | } | ||
| 545 | |||
| 546 | const char *ERR_reason_error_string(unsigned long e) | ||
| 547 | { | ||
| 548 | ERR_STRING_DATA d,*p=NULL; | ||
| 549 | unsigned long l,r; | ||
| 550 | |||
| 551 | err_fns_check(); | ||
| 552 | l=ERR_GET_LIB(e); | ||
| 553 | r=ERR_GET_REASON(e); | ||
| 554 | d.error=ERR_PACK(l,0,r); | ||
| 555 | p=ERRFN(err_get_item)(&d); | ||
| 556 | if (!p) | ||
| 557 | { | ||
| 558 | d.error=ERR_PACK(0,0,r); | ||
| 559 | p=ERRFN(err_get_item)(&d); | ||
| 560 | } | ||
| 561 | return((p == NULL)?NULL:p->string); | ||
| 562 | } | ||
| 563 | |||
| 564 | /* static unsigned long err_hash(ERR_STRING_DATA *a) */ | ||
| 565 | static unsigned long err_hash(const void *a_void) | ||
| 566 | { | ||
| 567 | unsigned long ret,l; | ||
| 568 | |||
| 569 | l=((const ERR_STRING_DATA *)a_void)->error; | ||
| 570 | ret=l^ERR_GET_LIB(l)^ERR_GET_FUNC(l); | ||
| 571 | return(ret^ret%19*13); | ||
| 572 | } | ||
| 573 | |||
| 574 | /* static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b) */ | ||
| 575 | static int err_cmp(const void *a_void, const void *b_void) | ||
| 576 | { | ||
| 577 | return((int)(((const ERR_STRING_DATA *)a_void)->error - | ||
| 578 | ((const ERR_STRING_DATA *)b_void)->error)); | ||
| 579 | } | ||
| 580 | |||
| 581 | /* static unsigned long pid_hash(ERR_STATE *a) */ | ||
| 582 | static unsigned long pid_hash(const void *a_void) | ||
| 583 | { | ||
| 584 | return(((const ERR_STATE *)a_void)->pid*13); | ||
| 585 | } | ||
| 586 | |||
| 587 | /* static int pid_cmp(ERR_STATE *a, ERR_STATE *b) */ | ||
| 588 | static int pid_cmp(const void *a_void, const void *b_void) | ||
| 589 | { | ||
| 590 | return((int)((long)((const ERR_STATE *)a_void)->pid - | ||
| 591 | (long)((const ERR_STATE *)b_void)->pid)); | ||
| 592 | } | ||
| 593 | #ifdef OPENSSL_FIPS | ||
| 594 | static void int_err_remove_state(unsigned long pid) | ||
| 595 | #else | ||
| 596 | void ERR_remove_state(unsigned long pid) | ||
| 597 | #endif | ||
| 598 | { | ||
| 599 | ERR_STATE tmp; | ||
| 600 | |||
| 601 | err_fns_check(); | ||
| 602 | if (pid == 0) | ||
| 603 | pid=(unsigned long)CRYPTO_thread_id(); | ||
| 604 | tmp.pid=pid; | ||
| 605 | /* thread_del_item automatically destroys the LHASH if the number of | ||
| 606 | * items reaches zero. */ | ||
| 607 | ERRFN(thread_del_item)(&tmp); | ||
| 608 | } | ||
| 609 | |||
| 610 | #ifdef OPENSSL_FIPS | ||
| 611 | static ERR_STATE *int_err_get_state(void) | ||
| 612 | #else | ||
| 613 | ERR_STATE *ERR_get_state(void) | ||
| 614 | #endif | ||
| 615 | { | ||
| 616 | static ERR_STATE fallback; | ||
| 617 | ERR_STATE *ret,tmp,*tmpp=NULL; | ||
| 618 | int i; | ||
| 619 | unsigned long pid; | ||
| 620 | |||
| 621 | err_fns_check(); | ||
| 622 | pid=(unsigned long)CRYPTO_thread_id(); | ||
| 623 | tmp.pid=pid; | ||
| 624 | ret=ERRFN(thread_get_item)(&tmp); | ||
| 625 | |||
| 626 | /* ret == the error state, if NULL, make a new one */ | ||
| 627 | if (ret == NULL) | ||
| 628 | { | ||
| 629 | ret=(ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE)); | ||
| 630 | if (ret == NULL) return(&fallback); | ||
| 631 | ret->pid=pid; | ||
| 632 | ret->top=0; | ||
| 633 | ret->bottom=0; | ||
| 634 | for (i=0; i<ERR_NUM_ERRORS; i++) | ||
| 635 | { | ||
| 636 | ret->err_data[i]=NULL; | ||
| 637 | ret->err_data_flags[i]=0; | ||
| 638 | } | ||
| 639 | tmpp = ERRFN(thread_set_item)(ret); | ||
| 640 | /* To check if insertion failed, do a get. */ | ||
| 641 | if (ERRFN(thread_get_item)(ret) != ret) | ||
| 642 | { | ||
| 643 | ERR_STATE_free(ret); /* could not insert it */ | ||
| 644 | return(&fallback); | ||
| 645 | } | ||
| 646 | /* If a race occured in this function and we came second, tmpp | ||
| 647 | * is the first one that we just replaced. */ | ||
| 648 | if (tmpp) | ||
| 649 | ERR_STATE_free(tmpp); | ||
| 650 | } | ||
| 651 | return ret; | ||
| 652 | } | ||
| 653 | |||
| 654 | #ifdef OPENSSL_FIPS | ||
| 655 | void int_ERR_lib_init(void) | ||
| 656 | { | ||
| 657 | int_ERR_set_state_func(int_err_get_state, int_err_remove_state); | ||
| 658 | } | ||
| 659 | #endif | ||
| 660 | |||
| 661 | int ERR_get_next_error_library(void) | ||
| 662 | { | ||
| 663 | err_fns_check(); | ||
| 664 | return ERRFN(get_next_lib)(); | ||
| 665 | } | ||
diff --git a/src/lib/libcrypto/err/err_prn.c b/src/lib/libcrypto/err/err_prn.c index 4cdf342fa6..a0168ac8ed 100644 --- a/src/lib/libcrypto/err/err_prn.c +++ b/src/lib/libcrypto/err/err_prn.c | |||
| @@ -72,21 +72,29 @@ void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), | |||
| 72 | const char *file,*data; | 72 | const char *file,*data; |
| 73 | int line,flags; | 73 | int line,flags; |
| 74 | unsigned long es; | 74 | unsigned long es; |
| 75 | CRYPTO_THREADID cur; | ||
| 75 | 76 | ||
| 76 | es=CRYPTO_thread_id(); | 77 | CRYPTO_THREADID_current(&cur); |
| 78 | es=CRYPTO_THREADID_hash(&cur); | ||
| 77 | while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0) | 79 | while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0) |
| 78 | { | 80 | { |
| 79 | ERR_error_string_n(l, buf, sizeof buf); | 81 | ERR_error_string_n(l, buf, sizeof buf); |
| 80 | BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf, | 82 | BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf, |
| 81 | file, line, (flags & ERR_TXT_STRING) ? data : ""); | 83 | file, line, (flags & ERR_TXT_STRING) ? data : ""); |
| 82 | cb(buf2, strlen(buf2), u); | 84 | if (cb(buf2, strlen(buf2), u) <= 0) |
| 85 | break; /* abort outputting the error report */ | ||
| 83 | } | 86 | } |
| 84 | } | 87 | } |
| 85 | 88 | ||
| 86 | #ifndef OPENSSL_NO_FP_API | 89 | #ifndef OPENSSL_NO_FP_API |
| 87 | static int print_fp(const char *str, size_t len, void *fp) | 90 | static int print_fp(const char *str, size_t len, void *fp) |
| 88 | { | 91 | { |
| 89 | return fwrite(str, 1, len, fp); | 92 | BIO bio; |
| 93 | |||
| 94 | BIO_set(&bio,BIO_s_file()); | ||
| 95 | BIO_set_fp(&bio,fp,BIO_NOCLOSE); | ||
| 96 | |||
| 97 | return BIO_printf(&bio, "%s", str); | ||
| 90 | } | 98 | } |
| 91 | void ERR_print_errors_fp(FILE *fp) | 99 | void ERR_print_errors_fp(FILE *fp) |
| 92 | { | 100 | { |
| @@ -94,64 +102,13 @@ void ERR_print_errors_fp(FILE *fp) | |||
| 94 | } | 102 | } |
| 95 | #endif | 103 | #endif |
| 96 | 104 | ||
| 97 | void ERR_error_string_n(unsigned long e, char *buf, size_t len) | 105 | static int print_bio(const char *str, size_t len, void *bp) |
| 98 | { | 106 | { |
| 99 | char lsbuf[64], fsbuf[64], rsbuf[64]; | 107 | return BIO_write((BIO *)bp, str, len); |
| 100 | const char *ls,*fs,*rs; | ||
| 101 | unsigned long l,f,r; | ||
| 102 | |||
| 103 | l=ERR_GET_LIB(e); | ||
| 104 | f=ERR_GET_FUNC(e); | ||
| 105 | r=ERR_GET_REASON(e); | ||
| 106 | |||
| 107 | ls=ERR_lib_error_string(e); | ||
| 108 | fs=ERR_func_error_string(e); | ||
| 109 | rs=ERR_reason_error_string(e); | ||
| 110 | |||
| 111 | if (ls == NULL) | ||
| 112 | BIO_snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l); | ||
| 113 | if (fs == NULL) | ||
| 114 | BIO_snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f); | ||
| 115 | if (rs == NULL) | ||
| 116 | BIO_snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r); | ||
| 117 | |||
| 118 | BIO_snprintf(buf, len,"error:%08lX:%s:%s:%s", e, ls?ls:lsbuf, | ||
| 119 | fs?fs:fsbuf, rs?rs:rsbuf); | ||
| 120 | if (strlen(buf) == len-1) | ||
| 121 | { | ||
| 122 | /* output may be truncated; make sure we always have 5 | ||
| 123 | * colon-separated fields, i.e. 4 colons ... */ | ||
| 124 | #define NUM_COLONS 4 | ||
| 125 | if (len > NUM_COLONS) /* ... if possible */ | ||
| 126 | { | ||
| 127 | int i; | ||
| 128 | char *s = buf; | ||
| 129 | |||
| 130 | for (i = 0; i < NUM_COLONS; i++) | ||
| 131 | { | ||
| 132 | char *colon = strchr(s, ':'); | ||
| 133 | if (colon == NULL || colon > &buf[len-1] - NUM_COLONS + i) | ||
| 134 | { | ||
| 135 | /* set colon no. i at last possible position | ||
| 136 | * (buf[len-1] is the terminating 0)*/ | ||
| 137 | colon = &buf[len-1] - NUM_COLONS + i; | ||
| 138 | *colon = ':'; | ||
| 139 | } | ||
| 140 | s = colon + 1; | ||
| 141 | } | ||
| 142 | } | ||
| 143 | } | ||
| 144 | } | 108 | } |
| 145 | 109 | void ERR_print_errors(BIO *bp) | |
| 146 | /* BAD for multi-threading: uses a local buffer if ret == NULL */ | ||
| 147 | /* ERR_error_string_n should be used instead for ret != NULL | ||
| 148 | * as ERR_error_string cannot know how large the buffer is */ | ||
| 149 | char *ERR_error_string(unsigned long e, char *ret) | ||
| 150 | { | 110 | { |
| 151 | static char buf[256]; | 111 | ERR_print_errors_cb(print_bio, bp); |
| 152 | |||
| 153 | if (ret == NULL) ret=buf; | ||
| 154 | ERR_error_string_n(e, ret, 256); | ||
| 155 | |||
| 156 | return ret; | ||
| 157 | } | 112 | } |
| 113 | |||
| 114 | |||
diff --git a/src/lib/libcrypto/err/err_str.c b/src/lib/libcrypto/err/err_str.c deleted file mode 100644 index d39040888d..0000000000 --- a/src/lib/libcrypto/err/err_str.c +++ /dev/null | |||
| @@ -1,295 +0,0 @@ | |||
| 1 | /* crypto/err/err_str.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 | #include <stdio.h> | ||
| 113 | #include <stdarg.h> | ||
| 114 | #include <string.h> | ||
| 115 | #include "cryptlib.h" | ||
| 116 | #include <openssl/lhash.h> | ||
| 117 | #include <openssl/crypto.h> | ||
| 118 | #include <openssl/buffer.h> | ||
| 119 | #include <openssl/bio.h> | ||
| 120 | #include <openssl/err.h> | ||
| 121 | |||
| 122 | #ifndef OPENSSL_NO_ERR | ||
| 123 | static ERR_STRING_DATA ERR_str_libraries[]= | ||
| 124 | { | ||
| 125 | {ERR_PACK(ERR_LIB_NONE,0,0) ,"unknown library"}, | ||
| 126 | {ERR_PACK(ERR_LIB_SYS,0,0) ,"system library"}, | ||
| 127 | {ERR_PACK(ERR_LIB_BN,0,0) ,"bignum routines"}, | ||
| 128 | {ERR_PACK(ERR_LIB_RSA,0,0) ,"rsa routines"}, | ||
| 129 | {ERR_PACK(ERR_LIB_DH,0,0) ,"Diffie-Hellman routines"}, | ||
| 130 | {ERR_PACK(ERR_LIB_EVP,0,0) ,"digital envelope routines"}, | ||
| 131 | {ERR_PACK(ERR_LIB_BUF,0,0) ,"memory buffer routines"}, | ||
| 132 | {ERR_PACK(ERR_LIB_OBJ,0,0) ,"object identifier routines"}, | ||
| 133 | {ERR_PACK(ERR_LIB_PEM,0,0) ,"PEM routines"}, | ||
| 134 | {ERR_PACK(ERR_LIB_DSA,0,0) ,"dsa routines"}, | ||
| 135 | {ERR_PACK(ERR_LIB_X509,0,0) ,"x509 certificate routines"}, | ||
| 136 | {ERR_PACK(ERR_LIB_ASN1,0,0) ,"asn1 encoding routines"}, | ||
| 137 | {ERR_PACK(ERR_LIB_CONF,0,0) ,"configuration file routines"}, | ||
| 138 | {ERR_PACK(ERR_LIB_CRYPTO,0,0) ,"common libcrypto routines"}, | ||
| 139 | {ERR_PACK(ERR_LIB_EC,0,0) ,"elliptic curve routines"}, | ||
| 140 | {ERR_PACK(ERR_LIB_SSL,0,0) ,"SSL routines"}, | ||
| 141 | {ERR_PACK(ERR_LIB_BIO,0,0) ,"BIO routines"}, | ||
| 142 | {ERR_PACK(ERR_LIB_PKCS7,0,0) ,"PKCS7 routines"}, | ||
| 143 | {ERR_PACK(ERR_LIB_X509V3,0,0) ,"X509 V3 routines"}, | ||
| 144 | {ERR_PACK(ERR_LIB_PKCS12,0,0) ,"PKCS12 routines"}, | ||
| 145 | {ERR_PACK(ERR_LIB_RAND,0,0) ,"random number generator"}, | ||
| 146 | {ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"}, | ||
| 147 | {ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"}, | ||
| 148 | {ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"}, | ||
| 149 | {ERR_PACK(ERR_LIB_FIPS,0,0) ,"FIPS routines"}, | ||
| 150 | {ERR_PACK(ERR_LIB_CMS,0,0) ,"CMS routines"}, | ||
| 151 | {ERR_PACK(ERR_LIB_JPAKE,0,0) ,"JPAKE routines"}, | ||
| 152 | {0,NULL}, | ||
| 153 | }; | ||
| 154 | |||
| 155 | static ERR_STRING_DATA ERR_str_functs[]= | ||
| 156 | { | ||
| 157 | {ERR_PACK(0,SYS_F_FOPEN,0), "fopen"}, | ||
| 158 | {ERR_PACK(0,SYS_F_CONNECT,0), "connect"}, | ||
| 159 | {ERR_PACK(0,SYS_F_GETSERVBYNAME,0), "getservbyname"}, | ||
| 160 | {ERR_PACK(0,SYS_F_SOCKET,0), "socket"}, | ||
| 161 | {ERR_PACK(0,SYS_F_IOCTLSOCKET,0), "ioctlsocket"}, | ||
| 162 | {ERR_PACK(0,SYS_F_BIND,0), "bind"}, | ||
| 163 | {ERR_PACK(0,SYS_F_LISTEN,0), "listen"}, | ||
| 164 | {ERR_PACK(0,SYS_F_ACCEPT,0), "accept"}, | ||
| 165 | #ifdef OPENSSL_SYS_WINDOWS | ||
| 166 | {ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"}, | ||
| 167 | #endif | ||
| 168 | {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"}, | ||
| 169 | {ERR_PACK(0,SYS_F_FREAD,0), "fread"}, | ||
| 170 | {0,NULL}, | ||
| 171 | }; | ||
| 172 | |||
| 173 | static ERR_STRING_DATA ERR_str_reasons[]= | ||
| 174 | { | ||
| 175 | {ERR_R_SYS_LIB ,"system lib"}, | ||
| 176 | {ERR_R_BN_LIB ,"BN lib"}, | ||
| 177 | {ERR_R_RSA_LIB ,"RSA lib"}, | ||
| 178 | {ERR_R_DH_LIB ,"DH lib"}, | ||
| 179 | {ERR_R_EVP_LIB ,"EVP lib"}, | ||
| 180 | {ERR_R_BUF_LIB ,"BUF lib"}, | ||
| 181 | {ERR_R_OBJ_LIB ,"OBJ lib"}, | ||
| 182 | {ERR_R_PEM_LIB ,"PEM lib"}, | ||
| 183 | {ERR_R_DSA_LIB ,"DSA lib"}, | ||
| 184 | {ERR_R_X509_LIB ,"X509 lib"}, | ||
| 185 | {ERR_R_ASN1_LIB ,"ASN1 lib"}, | ||
| 186 | {ERR_R_CONF_LIB ,"CONF lib"}, | ||
| 187 | {ERR_R_CRYPTO_LIB ,"CRYPTO lib"}, | ||
| 188 | {ERR_R_EC_LIB ,"EC lib"}, | ||
| 189 | {ERR_R_SSL_LIB ,"SSL lib"}, | ||
| 190 | {ERR_R_BIO_LIB ,"BIO lib"}, | ||
| 191 | {ERR_R_PKCS7_LIB ,"PKCS7 lib"}, | ||
| 192 | {ERR_R_X509V3_LIB ,"X509V3 lib"}, | ||
| 193 | {ERR_R_PKCS12_LIB ,"PKCS12 lib"}, | ||
| 194 | {ERR_R_RAND_LIB ,"RAND lib"}, | ||
| 195 | {ERR_R_DSO_LIB ,"DSO lib"}, | ||
| 196 | {ERR_R_ENGINE_LIB ,"ENGINE lib"}, | ||
| 197 | {ERR_R_OCSP_LIB ,"OCSP lib"}, | ||
| 198 | |||
| 199 | {ERR_R_NESTED_ASN1_ERROR ,"nested asn1 error"}, | ||
| 200 | {ERR_R_BAD_ASN1_OBJECT_HEADER ,"bad asn1 object header"}, | ||
| 201 | {ERR_R_BAD_GET_ASN1_OBJECT_CALL ,"bad get asn1 object call"}, | ||
| 202 | {ERR_R_EXPECTING_AN_ASN1_SEQUENCE ,"expecting an asn1 sequence"}, | ||
| 203 | {ERR_R_ASN1_LENGTH_MISMATCH ,"asn1 length mismatch"}, | ||
| 204 | {ERR_R_MISSING_ASN1_EOS ,"missing asn1 eos"}, | ||
| 205 | |||
| 206 | {ERR_R_FATAL ,"fatal"}, | ||
| 207 | {ERR_R_MALLOC_FAILURE ,"malloc failure"}, | ||
| 208 | {ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED ,"called a function you should not call"}, | ||
| 209 | {ERR_R_PASSED_NULL_PARAMETER ,"passed a null parameter"}, | ||
| 210 | {ERR_R_INTERNAL_ERROR ,"internal error"}, | ||
| 211 | {ERR_R_DISABLED ,"called a function that was disabled at compile-time"}, | ||
| 212 | |||
| 213 | {0,NULL}, | ||
| 214 | }; | ||
| 215 | #endif | ||
| 216 | |||
| 217 | #ifndef OPENSSL_NO_ERR | ||
| 218 | #define NUM_SYS_STR_REASONS 127 | ||
| 219 | #define LEN_SYS_STR_REASON 32 | ||
| 220 | |||
| 221 | static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1]; | ||
| 222 | /* SYS_str_reasons is filled with copies of strerror() results at | ||
| 223 | * initialization. | ||
| 224 | * 'errno' values up to 127 should cover all usual errors, | ||
| 225 | * others will be displayed numerically by ERR_error_string. | ||
| 226 | * It is crucial that we have something for each reason code | ||
| 227 | * that occurs in ERR_str_reasons, or bogus reason strings | ||
| 228 | * will be returned for SYSerr, which always gets an errno | ||
| 229 | * value and never one of those 'standard' reason codes. */ | ||
| 230 | |||
| 231 | static void build_SYS_str_reasons(void) | ||
| 232 | { | ||
| 233 | /* OPENSSL_malloc cannot be used here, use static storage instead */ | ||
| 234 | static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; | ||
| 235 | int i; | ||
| 236 | static int init = 1; | ||
| 237 | |||
| 238 | CRYPTO_r_lock(CRYPTO_LOCK_ERR); | ||
| 239 | if (!init) | ||
| 240 | { | ||
| 241 | CRYPTO_r_unlock(CRYPTO_LOCK_ERR); | ||
| 242 | return; | ||
| 243 | } | ||
| 244 | |||
| 245 | CRYPTO_r_unlock(CRYPTO_LOCK_ERR); | ||
| 246 | CRYPTO_w_lock(CRYPTO_LOCK_ERR); | ||
| 247 | if (!init) | ||
| 248 | { | ||
| 249 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 250 | return; | ||
| 251 | } | ||
| 252 | |||
| 253 | for (i = 1; i <= NUM_SYS_STR_REASONS; i++) | ||
| 254 | { | ||
| 255 | ERR_STRING_DATA *str = &SYS_str_reasons[i - 1]; | ||
| 256 | |||
| 257 | str->error = (unsigned long)i; | ||
| 258 | if (str->string == NULL) | ||
| 259 | { | ||
| 260 | char (*dest)[LEN_SYS_STR_REASON] = &(strerror_tab[i - 1]); | ||
| 261 | char *src = strerror(i); | ||
| 262 | if (src != NULL) | ||
| 263 | { | ||
| 264 | strncpy(*dest, src, sizeof *dest); | ||
| 265 | (*dest)[sizeof *dest - 1] = '\0'; | ||
| 266 | str->string = *dest; | ||
| 267 | } | ||
| 268 | } | ||
| 269 | if (str->string == NULL) | ||
| 270 | str->string = "unknown"; | ||
| 271 | } | ||
| 272 | |||
| 273 | /* Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] = {0, NULL}, | ||
| 274 | * as required by ERR_load_strings. */ | ||
| 275 | |||
| 276 | init = 0; | ||
| 277 | |||
| 278 | CRYPTO_w_unlock(CRYPTO_LOCK_ERR); | ||
| 279 | } | ||
| 280 | #endif | ||
| 281 | |||
| 282 | void ERR_load_ERR_strings(void) | ||
| 283 | { | ||
| 284 | #ifndef OPENSSL_NO_ERR | ||
| 285 | if (ERR_func_error_string(ERR_str_functs[0].error) == NULL) | ||
| 286 | { | ||
| 287 | ERR_load_strings(0,ERR_str_libraries); | ||
| 288 | ERR_load_strings(0,ERR_str_reasons); | ||
| 289 | ERR_load_strings(ERR_LIB_SYS,ERR_str_functs); | ||
| 290 | build_SYS_str_reasons(); | ||
| 291 | ERR_load_strings(ERR_LIB_SYS,SYS_str_reasons); | ||
| 292 | } | ||
| 293 | #endif | ||
| 294 | } | ||
| 295 | |||
diff --git a/src/lib/libcrypto/err/openssl.ec b/src/lib/libcrypto/err/openssl.ec index 868826624d..e0554b4342 100644 --- a/src/lib/libcrypto/err/openssl.ec +++ b/src/lib/libcrypto/err/openssl.ec | |||
| @@ -31,13 +31,15 @@ L COMP crypto/comp/comp.h crypto/comp/comp_err.c | |||
| 31 | L ECDSA crypto/ecdsa/ecdsa.h crypto/ecdsa/ecs_err.c | 31 | L ECDSA crypto/ecdsa/ecdsa.h crypto/ecdsa/ecs_err.c |
| 32 | L ECDH crypto/ecdh/ecdh.h crypto/ecdh/ech_err.c | 32 | L ECDH crypto/ecdh/ecdh.h crypto/ecdh/ech_err.c |
| 33 | L STORE crypto/store/store.h crypto/store/str_err.c | 33 | L STORE crypto/store/store.h crypto/store/str_err.c |
| 34 | L FIPS fips/fips.h crypto/fips_err.h | 34 | L TS crypto/ts/ts.h crypto/ts/ts_err.c |
| 35 | L HMAC crypto/hmac/hmac.h crypto/hmac/hmac_err.c | ||
| 35 | L CMS crypto/cms/cms.h crypto/cms/cms_err.c | 36 | L CMS crypto/cms/cms.h crypto/cms/cms_err.c |
| 36 | L JPAKE crypto/jpake/jpake.h crypto/jpake/jpake_err.c | 37 | L JPAKE crypto/jpake/jpake.h crypto/jpake/jpake_err.c |
| 37 | 38 | ||
| 38 | # additional header files to be scanned for function names | 39 | # additional header files to be scanned for function names |
| 39 | L NONE crypto/x509/x509_vfy.h NONE | 40 | L NONE crypto/x509/x509_vfy.h NONE |
| 40 | L NONE crypto/ec/ec_lcl.h NONE | 41 | L NONE crypto/ec/ec_lcl.h NONE |
| 42 | L NONE crypto/asn1/asn_lcl.h NONE | ||
| 41 | L NONE crypto/cms/cms_lcl.h NONE | 43 | L NONE crypto/cms/cms_lcl.h NONE |
| 42 | 44 | ||
| 43 | 45 | ||
| @@ -71,6 +73,11 @@ R SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 | |||
| 71 | R SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 | 73 | R SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 |
| 72 | R SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 | 74 | R SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 |
| 73 | R SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 | 75 | R SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 |
| 76 | R SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 | ||
| 77 | R SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 | ||
| 78 | R SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 | ||
| 79 | R SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 | ||
| 80 | R SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 | ||
| 74 | 81 | ||
| 75 | R RSAREF_R_CONTENT_ENCODING 0x0400 | 82 | R RSAREF_R_CONTENT_ENCODING 0x0400 |
| 76 | R RSAREF_R_DATA 0x0401 | 83 | R RSAREF_R_DATA 0x0401 |
diff --git a/src/lib/libcrypto/evp/Makefile b/src/lib/libcrypto/evp/Makefile index c204f84c1d..82825e5299 100644 --- a/src/lib/libcrypto/evp/Makefile +++ b/src/lib/libcrypto/evp/Makefile | |||
| @@ -18,34 +18,34 @@ TESTDATA=evptests.txt | |||
| 18 | APPS= | 18 | APPS= |
| 19 | 19 | ||
| 20 | LIB=$(TOP)/libcrypto.a | 20 | LIB=$(TOP)/libcrypto.a |
| 21 | LIBSRC= encode.c digest.c dig_eng.c evp_enc.c evp_key.c evp_acnf.c evp_cnf.c \ | 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\ | 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 \ | 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 enc_min.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 \ | 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\ | 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 \ | 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 \ | 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 \ | 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 \ | 30 | evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c \ |
| 31 | e_old.c | 31 | e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c |
| 32 | 32 | ||
| 33 | LIBOBJ= encode.o digest.o dig_eng.o evp_enc.o evp_key.o evp_acnf.o evp_cnf.o \ | 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\ | 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 \ | 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 enc_min.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 \ | 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\ | 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 \ | 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 \ | 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 \ | 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 \ | 42 | evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o \ |
| 43 | e_old.o | 43 | e_old.o pmeth_lib.o pmeth_fn.o pmeth_gn.o m_sigver.o |
| 44 | 44 | ||
| 45 | SRC= $(LIBSRC) | 45 | SRC= $(LIBSRC) |
| 46 | 46 | ||
| 47 | EXHEADER= evp.h | 47 | EXHEADER= evp.h |
| 48 | HEADER= $(EXHEADER) | 48 | HEADER= evp_locl.h $(EXHEADER) |
| 49 | 49 | ||
| 50 | ALL= $(GENERAL) $(SRC) $(HEADER) | 50 | ALL= $(GENERAL) $(SRC) $(HEADER) |
| 51 | 51 | ||
| @@ -55,7 +55,7 @@ top: | |||
| 55 | all: lib | 55 | all: lib |
| 56 | 56 | ||
| 57 | lib: $(LIBOBJ) | 57 | lib: $(LIBOBJ) |
| 58 | $(ARX) $(LIB) $(LIBOBJ) | 58 | $(AR) $(LIB) $(LIBOBJ) |
| 59 | $(RANLIB) $(LIB) || echo Never mind. | 59 | $(RANLIB) $(LIB) || echo Never mind. |
| 60 | @touch lib | 60 | @touch lib |
| 61 | 61 | ||
| @@ -101,201 +101,185 @@ bio_b64.o: ../../e_os.h ../../include/openssl/asn1.h | |||
| 101 | bio_b64.o: ../../include/openssl/bio.h ../../include/openssl/buffer.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 | 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 | 103 | bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 104 | bio_b64.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 104 | bio_b64.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 105 | bio_b64.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 105 | bio_b64.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 106 | bio_b64.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 106 | bio_b64.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 107 | bio_b64.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 107 | bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 108 | bio_b64.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 108 | bio_b64.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_b64.c |
| 109 | bio_b64.o: ../cryptlib.h bio_b64.c | ||
| 110 | bio_enc.o: ../../e_os.h ../../include/openssl/asn1.h | 109 | bio_enc.o: ../../e_os.h ../../include/openssl/asn1.h |
| 111 | bio_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 110 | bio_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 112 | bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 111 | bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 113 | bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 112 | bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 114 | bio_enc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 113 | bio_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 115 | bio_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 114 | bio_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 116 | bio_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 115 | bio_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 117 | bio_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 116 | bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 118 | bio_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 117 | bio_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_enc.c |
| 119 | bio_enc.o: ../cryptlib.h bio_enc.c | ||
| 120 | bio_md.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 118 | bio_md.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 121 | bio_md.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 119 | bio_md.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 122 | bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 120 | bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 123 | bio_md.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 121 | bio_md.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 124 | bio_md.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 122 | bio_md.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 125 | bio_md.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 123 | bio_md.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 126 | bio_md.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 124 | bio_md.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
| 127 | bio_md.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 125 | bio_md.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 128 | bio_md.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_md.c | 126 | bio_md.o: ../cryptlib.h bio_md.c |
| 129 | bio_ok.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 127 | bio_ok.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 130 | bio_ok.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 128 | bio_ok.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 131 | bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 129 | bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 132 | bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 130 | bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 133 | bio_ok.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 131 | bio_ok.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 134 | bio_ok.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 132 | bio_ok.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 135 | bio_ok.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 133 | bio_ok.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
| 136 | bio_ok.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 134 | bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 137 | bio_ok.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 135 | bio_ok.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_ok.c |
| 138 | bio_ok.o: ../cryptlib.h bio_ok.c | ||
| 139 | c_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 136 | c_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 140 | c_all.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 137 | c_all.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 141 | c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 138 | c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 142 | c_all.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 139 | c_all.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 143 | c_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 140 | c_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 144 | c_all.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 141 | c_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 145 | c_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 142 | c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 146 | c_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 143 | c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 147 | c_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 144 | c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 148 | c_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 145 | c_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 149 | c_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 146 | c_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 150 | c_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 147 | c_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 151 | c_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_all.c | 148 | c_all.o: ../cryptlib.h c_all.c |
| 152 | c_allc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 149 | c_allc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 153 | c_allc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 150 | c_allc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 154 | c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 151 | c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 155 | c_allc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 152 | c_allc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 156 | c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 153 | c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 157 | c_allc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 154 | c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 158 | c_allc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 155 | c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 159 | c_allc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 156 | c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 160 | c_allc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | 157 | c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h |
| 161 | c_allc.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 158 | c_allc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 162 | c_allc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 159 | c_allc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 163 | c_allc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 160 | c_allc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 164 | c_allc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_allc.c | 161 | c_allc.o: ../cryptlib.h c_allc.c |
| 165 | c_alld.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 162 | c_alld.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 166 | c_alld.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 163 | c_alld.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 167 | c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 164 | c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 168 | c_alld.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 165 | c_alld.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 169 | c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 166 | c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 170 | c_alld.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 167 | c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 171 | c_alld.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 168 | c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 172 | c_alld.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 169 | c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 173 | c_alld.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | 170 | c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h |
| 174 | c_alld.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 171 | c_alld.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 175 | c_alld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 172 | c_alld.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 176 | c_alld.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 173 | c_alld.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 177 | c_alld.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_alld.c | 174 | c_alld.o: ../cryptlib.h c_alld.c |
| 178 | dig_eng.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 179 | dig_eng.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 180 | dig_eng.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 181 | dig_eng.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 182 | dig_eng.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 183 | dig_eng.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 184 | dig_eng.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
| 185 | dig_eng.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 186 | dig_eng.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 187 | dig_eng.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 188 | dig_eng.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 189 | dig_eng.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 190 | dig_eng.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 191 | dig_eng.o: ../cryptlib.h dig_eng.c evp_locl.h | ||
| 192 | digest.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 175 | digest.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 193 | digest.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 176 | digest.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 194 | digest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 177 | digest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 195 | digest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 178 | digest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 196 | digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 179 | digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 197 | digest.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 180 | digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 198 | digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 181 | digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 199 | digest.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 182 | digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 200 | digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 183 | digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 201 | digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 184 | digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 202 | digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 185 | digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 203 | digest.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 186 | digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 204 | digest.o: ../../include/openssl/x509_vfy.h ../cryptlib.h digest.c evp_locl.h | 187 | digest.o: ../cryptlib.h digest.c |
| 205 | e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | 188 | e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h |
| 206 | e_aes.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | 189 | e_aes.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h |
| 207 | e_aes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 190 | e_aes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 208 | e_aes.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 191 | e_aes.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 209 | e_aes.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 192 | e_aes.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 210 | e_aes.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 193 | e_aes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 211 | e_aes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 194 | e_aes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
| 212 | e_aes.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 195 | e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h e_aes.c |
| 213 | e_aes.o: ../../include/openssl/symhacks.h e_aes.c evp_locl.h | 196 | e_aes.o: evp_locl.h |
| 214 | e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 197 | e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 215 | e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/buffer.h | 198 | e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/buffer.h |
| 216 | e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 199 | e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 217 | e_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 200 | e_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 218 | e_bf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 201 | e_bf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 219 | e_bf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 202 | e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 220 | e_bf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 203 | e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 221 | e_bf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 204 | e_bf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 222 | e_bf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 205 | e_bf.o: ../../include/openssl/symhacks.h ../cryptlib.h e_bf.c evp_locl.h |
| 223 | e_bf.o: ../cryptlib.h e_bf.c evp_locl.h | 206 | e_camellia.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 224 | e_camellia.o: ../../include/openssl/opensslconf.h e_camellia.c | 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 | ||
| 225 | e_cast.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 215 | e_cast.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 226 | e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | 216 | e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h |
| 227 | e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 217 | e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 228 | e_cast.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 218 | e_cast.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 229 | e_cast.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 219 | e_cast.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 230 | e_cast.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 220 | e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 231 | e_cast.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 221 | e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 232 | e_cast.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 222 | e_cast.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 233 | e_cast.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 223 | e_cast.o: ../../include/openssl/symhacks.h ../cryptlib.h e_cast.c evp_locl.h |
| 234 | e_cast.o: ../cryptlib.h e_cast.c evp_locl.h | ||
| 235 | e_des.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 224 | e_des.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 236 | e_des.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 225 | e_des.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 237 | e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | 226 | e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h |
| 238 | e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 227 | e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 239 | e_des.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 228 | e_des.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 240 | e_des.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 229 | e_des.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 241 | e_des.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 230 | e_des.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 242 | e_des.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 231 | e_des.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
| 243 | e_des.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 232 | e_des.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 244 | e_des.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 233 | e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
| 245 | e_des.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | 234 | e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h |
| 246 | e_des.o: ../cryptlib.h e_des.c evp_locl.h | ||
| 247 | e_des3.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 235 | e_des3.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 248 | e_des3.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 236 | e_des3.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 249 | e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | 237 | e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h |
| 250 | e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 238 | e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 251 | e_des3.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 239 | e_des3.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 252 | e_des3.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 240 | e_des3.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 253 | e_des3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 241 | e_des3.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 254 | e_des3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 242 | e_des3.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
| 255 | e_des3.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 243 | e_des3.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 256 | e_des3.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 244 | e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
| 257 | e_des3.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | 245 | e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_locl.h |
| 258 | e_des3.o: ../cryptlib.h e_des3.c evp_locl.h | ||
| 259 | e_idea.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 246 | e_idea.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 260 | e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 247 | e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 261 | e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 248 | e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 262 | e_idea.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 249 | e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h |
| 263 | e_idea.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | 250 | e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 264 | e_idea.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 251 | e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 265 | e_idea.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 252 | e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 266 | e_idea.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 253 | e_idea.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 267 | e_idea.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 254 | e_idea.o: ../../include/openssl/symhacks.h ../cryptlib.h e_idea.c evp_locl.h |
| 268 | e_idea.o: ../cryptlib.h e_idea.c evp_locl.h | ||
| 269 | e_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 255 | e_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 270 | e_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 256 | e_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 271 | e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 257 | e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 272 | e_null.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 258 | e_null.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 273 | e_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 259 | e_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 274 | e_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 260 | e_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 275 | e_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 261 | e_null.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
| 276 | e_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 262 | e_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 277 | e_null.o: ../../include/openssl/symhacks.h ../cryptlib.h e_null.c | 263 | e_null.o: ../cryptlib.h e_null.c |
| 278 | e_old.o: e_old.c | 264 | e_old.o: e_old.c |
| 279 | e_rc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 265 | e_rc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 280 | e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 266 | e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 281 | e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 267 | e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 282 | e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 268 | e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 283 | e_rc2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 269 | e_rc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 284 | e_rc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 270 | e_rc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 285 | e_rc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 271 | e_rc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h |
| 286 | e_rc2.o: ../../include/openssl/rc2.h ../../include/openssl/safestack.h | 272 | e_rc2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 287 | e_rc2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 273 | e_rc2.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc2.c evp_locl.h |
| 288 | e_rc2.o: ../cryptlib.h e_rc2.c evp_locl.h | ||
| 289 | e_rc4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 274 | e_rc4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 290 | e_rc4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 275 | e_rc4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 291 | e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 276 | e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 292 | e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 277 | e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 293 | e_rc4.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 278 | e_rc4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 294 | e_rc4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 279 | e_rc4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 295 | e_rc4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 280 | e_rc4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc4.h |
| 296 | e_rc4.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h | 281 | e_rc4.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 297 | e_rc4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 282 | e_rc4.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc4.c |
| 298 | e_rc4.o: ../cryptlib.h e_rc4.c evp_locl.h | ||
| 299 | e_rc5.o: ../../e_os.h ../../include/openssl/bio.h | 283 | e_rc5.o: ../../e_os.h ../../include/openssl/bio.h |
| 300 | e_rc5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 284 | e_rc5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 301 | e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 285 | e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| @@ -306,256 +290,221 @@ e_rc5.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc5.c | |||
| 306 | e_seed.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 290 | e_seed.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 307 | e_seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 291 | e_seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 308 | e_seed.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 292 | e_seed.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 309 | e_seed.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 293 | e_seed.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 310 | e_seed.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 294 | e_seed.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 311 | e_seed.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 295 | e_seed.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 312 | e_seed.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 296 | e_seed.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h |
| 313 | e_seed.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 297 | e_seed.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 314 | e_seed.o: e_seed.c | 298 | e_seed.o: e_seed.c evp_locl.h |
| 315 | e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h | 299 | e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h |
| 316 | e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 300 | e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 317 | e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 301 | e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
| 318 | e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | 302 | e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
| 319 | e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 303 | e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 320 | e_xcbc_d.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 304 | e_xcbc_d.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 321 | e_xcbc_d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 305 | e_xcbc_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 322 | e_xcbc_d.o: ../../include/openssl/opensslconf.h | ||
| 323 | e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 306 | e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 324 | e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 307 | e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 325 | e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | 308 | e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
| 326 | e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c | 309 | e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c |
| 327 | enc_min.o: ../../e_os.h ../../include/openssl/asn1.h | 310 | e_xcbc_d.o: evp_locl.h |
| 328 | enc_min.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 329 | enc_min.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 330 | enc_min.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 331 | enc_min.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 332 | enc_min.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 333 | enc_min.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
| 334 | enc_min.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 335 | enc_min.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 336 | enc_min.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 337 | enc_min.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 338 | enc_min.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 339 | enc_min.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 340 | enc_min.o: ../../include/openssl/x509_vfy.h ../cryptlib.h enc_min.c evp_locl.h | ||
| 341 | encode.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 311 | encode.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 342 | encode.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 312 | encode.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 343 | encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 313 | encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 344 | encode.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 314 | encode.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 345 | encode.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 315 | encode.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 346 | encode.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 316 | encode.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 347 | encode.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 317 | encode.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
| 348 | encode.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 318 | encode.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 349 | encode.o: ../../include/openssl/symhacks.h ../cryptlib.h encode.c | 319 | encode.o: ../cryptlib.h encode.c |
| 350 | evp_acnf.o: ../../e_os.h ../../include/openssl/asn1.h | 320 | evp_acnf.o: ../../e_os.h ../../include/openssl/asn1.h |
| 351 | evp_acnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 321 | evp_acnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 352 | evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | 322 | evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h |
| 353 | evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 323 | evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 354 | evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 324 | evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 355 | evp_acnf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 325 | evp_acnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 356 | evp_acnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 326 | evp_acnf.o: ../../include/openssl/opensslconf.h |
| 357 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 327 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 358 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 328 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 359 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c | 329 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c |
| 360 | evp_cnf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 361 | evp_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 362 | evp_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 363 | evp_cnf.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 364 | evp_cnf.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 365 | evp_cnf.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 366 | evp_cnf.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | ||
| 367 | evp_cnf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 368 | evp_cnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 369 | evp_cnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 370 | evp_cnf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 371 | evp_cnf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 372 | evp_cnf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 373 | evp_cnf.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 374 | evp_cnf.o: ../cryptlib.h evp_cnf.c | ||
| 375 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h | 330 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h |
| 376 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 331 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 377 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 332 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 378 | evp_enc.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 333 | evp_enc.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 379 | evp_enc.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 334 | evp_enc.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 380 | evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 335 | evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 381 | evp_enc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 336 | evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 382 | evp_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 337 | evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 383 | evp_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 338 | evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 384 | evp_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 339 | evp_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 385 | evp_enc.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 340 | evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 386 | evp_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 341 | evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 387 | evp_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 342 | evp_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 388 | evp_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_enc.c evp_locl.h | 343 | evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h |
| 389 | evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 344 | evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 390 | evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 345 | evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 391 | evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 346 | evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 392 | evp_err.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 347 | evp_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 393 | evp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 348 | evp_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 394 | evp_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 349 | evp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 395 | evp_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 350 | evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 396 | evp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 351 | evp_err.o: ../../include/openssl/symhacks.h evp_err.c |
| 397 | evp_err.o: evp_err.c | ||
| 398 | evp_key.o: ../../e_os.h ../../include/openssl/asn1.h | 352 | evp_key.o: ../../e_os.h ../../include/openssl/asn1.h |
| 399 | evp_key.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 353 | evp_key.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 400 | evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 354 | evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 401 | evp_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 355 | evp_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 402 | evp_key.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 356 | evp_key.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 403 | evp_key.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 357 | evp_key.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 404 | evp_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 358 | evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 405 | evp_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 359 | evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 406 | evp_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 360 | evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 407 | evp_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 361 | evp_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 408 | evp_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 362 | evp_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 409 | evp_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | 363 | evp_key.o: ../../include/openssl/ui.h ../../include/openssl/x509.h |
| 410 | evp_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 364 | evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c |
| 411 | evp_key.o: ../cryptlib.h evp_key.c | ||
| 412 | evp_lib.o: ../../e_os.h ../../include/openssl/asn1.h | 365 | evp_lib.o: ../../e_os.h ../../include/openssl/asn1.h |
| 413 | evp_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 366 | evp_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 414 | evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 367 | evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 415 | evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 368 | evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 416 | evp_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 369 | evp_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 417 | evp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 370 | evp_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 418 | evp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 371 | evp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 419 | evp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | 372 | evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 420 | evp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 373 | evp_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_lib.c |
| 421 | evp_lib.o: ../cryptlib.h evp_lib.c | ||
| 422 | evp_pbe.o: ../../e_os.h ../../include/openssl/asn1.h | 374 | evp_pbe.o: ../../e_os.h ../../include/openssl/asn1.h |
| 423 | evp_pbe.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 375 | evp_pbe.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 424 | evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 376 | evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 425 | evp_pbe.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 377 | evp_pbe.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 426 | evp_pbe.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 378 | evp_pbe.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 427 | evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 379 | evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 428 | evp_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 380 | evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 429 | evp_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 381 | evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 430 | evp_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 382 | evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h |
| 431 | evp_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 383 | evp_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 432 | evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 384 | evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 433 | evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 385 | evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 434 | evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c | 386 | evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c |
| 435 | evp_pkey.o: ../../e_os.h ../../include/openssl/asn1.h | 387 | evp_pkey.o: ../../e_os.h ../../include/openssl/asn1.h |
| 436 | evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 388 | evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 437 | evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 389 | evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 438 | evp_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 439 | evp_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 390 | evp_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 440 | evp_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 391 | evp_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 441 | evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 392 | evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 442 | evp_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 393 | evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 443 | evp_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 394 | evp_pkey.o: ../../include/openssl/opensslconf.h |
| 444 | evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 395 | evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 445 | evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | 396 | evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 446 | evp_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 397 | evp_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 447 | evp_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 398 | evp_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 448 | evp_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 399 | evp_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 449 | evp_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pkey.c | 400 | evp_pkey.o: ../asn1/asn1_locl.h ../cryptlib.h evp_pkey.c |
| 450 | m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 401 | m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 451 | m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 402 | m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 452 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 403 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 453 | m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 404 | m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 454 | m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 405 | m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 455 | m_dss.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 406 | m_dss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 456 | m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 407 | m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 457 | m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 408 | m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 458 | m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 409 | m_dss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 459 | m_dss.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 410 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 460 | m_dss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 411 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 461 | m_dss.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 412 | m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 462 | m_dss.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_dss.c | 413 | m_dss.o: ../cryptlib.h m_dss.c |
| 463 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 414 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 464 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 415 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 465 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 416 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 466 | m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 417 | m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 467 | m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 418 | m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 468 | m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 419 | m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 469 | m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 420 | m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 470 | m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 421 | m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 471 | m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 422 | m_dss1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 472 | m_dss1.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 423 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 473 | m_dss1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 424 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 474 | m_dss1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 425 | m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 475 | m_dss1.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_dss1.c | 426 | m_dss1.o: ../cryptlib.h m_dss1.c |
| 476 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h | 427 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h |
| 477 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 428 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 478 | m_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 429 | m_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 479 | m_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 430 | m_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 480 | m_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 431 | m_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 481 | m_ecdsa.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 432 | m_ecdsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 482 | m_ecdsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 433 | m_ecdsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 483 | m_ecdsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 434 | m_ecdsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 484 | m_ecdsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 435 | m_ecdsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 485 | m_ecdsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 436 | m_ecdsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 486 | m_ecdsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 437 | m_ecdsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 487 | m_ecdsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 438 | m_ecdsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 488 | m_ecdsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_ecdsa.c | 439 | m_ecdsa.o: ../cryptlib.h m_ecdsa.c |
| 489 | m_md2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 440 | m_md2.o: ../../e_os.h ../../include/openssl/bio.h |
| 490 | m_md2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 441 | m_md2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 491 | m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 442 | m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 492 | m_md2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 443 | m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
| 493 | m_md2.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 494 | m_md2.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
| 495 | m_md2.o: ../../include/openssl/md2.h ../../include/openssl/obj_mac.h | ||
| 496 | m_md2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 497 | m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 444 | m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 498 | m_md2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | 445 | m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 499 | m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 446 | m_md2.o: ../../include/openssl/symhacks.h ../cryptlib.h m_md2.c |
| 500 | m_md2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 501 | m_md2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 502 | m_md2.o: ../cryptlib.h evp_locl.h m_md2.c | ||
| 503 | m_md4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 447 | m_md4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 504 | m_md4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 448 | m_md4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 505 | m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 449 | m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 506 | m_md4.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 450 | m_md4.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 507 | m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 451 | m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 508 | m_md4.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 452 | m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md4.h |
| 509 | m_md4.o: ../../include/openssl/md4.h ../../include/openssl/obj_mac.h | 453 | m_md4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 510 | m_md4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 454 | m_md4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 511 | m_md4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 455 | m_md4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 512 | m_md4.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | 456 | m_md4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 513 | m_md4.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 457 | m_md4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 514 | m_md4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 458 | m_md4.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 515 | m_md4.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 459 | m_md4.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md4.c |
| 516 | m_md4.o: ../cryptlib.h evp_locl.h m_md4.c | ||
| 517 | m_md5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 460 | m_md5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 518 | m_md5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 461 | m_md5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 519 | m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 462 | m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 520 | m_md5.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 463 | m_md5.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 521 | m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 464 | m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 522 | m_md5.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 465 | m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md5.h |
| 523 | m_md5.o: ../../include/openssl/md5.h ../../include/openssl/obj_mac.h | 466 | m_md5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 524 | m_md5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 467 | m_md5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 525 | m_md5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 468 | m_md5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 526 | m_md5.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | 469 | m_md5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 527 | m_md5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 470 | m_md5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 528 | m_md5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 471 | m_md5.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 529 | m_md5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 472 | m_md5.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md5.c |
| 530 | m_md5.o: ../cryptlib.h evp_locl.h m_md5.c | 473 | m_mdc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 531 | m_mdc2.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 532 | m_mdc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 474 | m_mdc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 533 | m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 475 | m_mdc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h |
| 534 | m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 476 | m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 535 | m_mdc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 477 | m_mdc2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 536 | m_mdc2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 478 | m_mdc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 537 | m_mdc2.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h m_mdc2.c | 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 | ||
| 538 | m_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 488 | m_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 539 | m_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 489 | m_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 540 | m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 490 | m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 541 | m_null.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 491 | m_null.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 542 | m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 492 | m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 543 | m_null.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 493 | m_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 544 | m_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 494 | m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 545 | m_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 495 | m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 546 | m_null.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 496 | m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 547 | m_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 497 | m_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 548 | m_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 498 | m_null.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 549 | m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 499 | m_null.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_null.c |
| 550 | m_null.o: ../cryptlib.h m_null.c | ||
| 551 | m_ripemd.o: ../../e_os.h ../../include/openssl/asn1.h | 500 | m_ripemd.o: ../../e_os.h ../../include/openssl/asn1.h |
| 552 | m_ripemd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 501 | m_ripemd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 553 | m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 502 | m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 554 | m_ripemd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 503 | m_ripemd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 555 | m_ripemd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 504 | m_ripemd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 556 | m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 505 | m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 557 | m_ripemd.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 506 | m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 558 | m_ripemd.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 507 | m_ripemd.o: ../../include/openssl/opensslconf.h |
| 559 | m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 508 | m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 560 | m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/ripemd.h | 509 | m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/ripemd.h |
| 561 | m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 510 | m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| @@ -567,62 +516,87 @@ m_sha.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 567 | m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 516 | m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 568 | m_sha.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 517 | m_sha.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 569 | m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 518 | m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 570 | m_sha.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 519 | m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 571 | m_sha.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 520 | m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 572 | m_sha.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 521 | m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 573 | m_sha.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 522 | m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h |
| 574 | m_sha.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 523 | m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 575 | m_sha.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 524 | m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 576 | m_sha.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 525 | m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 577 | m_sha.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h m_sha.c | 526 | m_sha.o: ../cryptlib.h m_sha.c |
| 578 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 527 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 579 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 528 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 580 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 529 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 581 | m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 530 | m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 582 | m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 531 | m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 583 | m_sha1.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 532 | m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 584 | m_sha1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 533 | m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 585 | m_sha1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 534 | m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 586 | m_sha1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 535 | m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h |
| 587 | m_sha1.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 536 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 588 | m_sha1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 537 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 589 | m_sha1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 538 | m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 590 | m_sha1.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_sha1.c | 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 | ||
| 591 | names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 567 | names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 592 | names.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 568 | names.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 593 | names.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 569 | names.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 594 | names.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 570 | names.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 595 | names.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 571 | names.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 596 | names.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 572 | names.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 597 | names.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 573 | names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 598 | names.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 574 | names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 599 | names.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 575 | names.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 600 | names.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 576 | names.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 601 | names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 577 | names.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 602 | names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 578 | names.o: ../../include/openssl/x509_vfy.h ../cryptlib.h names.c |
| 603 | names.o: ../cryptlib.h names.c | ||
| 604 | p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h | 579 | p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h |
| 605 | p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 580 | p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 606 | p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 581 | p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 607 | p5_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 582 | p5_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 608 | p5_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 583 | p5_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 609 | p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 584 | p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 610 | p5_crpt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 585 | p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 611 | p5_crpt.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 586 | p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 612 | p5_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 587 | p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 613 | p5_crpt.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 588 | p5_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 614 | p5_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 589 | p5_crpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 615 | p5_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 590 | p5_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 616 | p5_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt.c | 591 | p5_crpt.o: ../cryptlib.h p5_crpt.c |
| 617 | p5_crpt2.o: ../../e_os.h ../../include/openssl/asn1.h | 592 | p5_crpt2.o: ../../e_os.h ../../include/openssl/asn1.h |
| 618 | p5_crpt2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 593 | p5_crpt2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 619 | p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 594 | p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 620 | p5_crpt2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 595 | p5_crpt2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 621 | p5_crpt2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 596 | p5_crpt2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 622 | p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 597 | p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h |
| 623 | p5_crpt2.o: ../../include/openssl/hmac.h ../../include/openssl/lhash.h | 598 | p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 624 | p5_crpt2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 599 | p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 625 | p5_crpt2.o: ../../include/openssl/opensslconf.h | ||
| 626 | p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 600 | p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 627 | p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 601 | p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 628 | p5_crpt2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 602 | p5_crpt2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| @@ -633,37 +607,35 @@ p_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 633 | p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 607 | p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 634 | p_dec.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 608 | p_dec.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 635 | p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 609 | p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 636 | p_dec.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 610 | p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 637 | p_dec.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 611 | p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 638 | p_dec.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 612 | p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 639 | p_dec.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 613 | p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 640 | p_dec.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 614 | p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 641 | p_dec.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 615 | p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 642 | p_dec.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 616 | p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 643 | p_dec.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 617 | p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c |
| 644 | p_dec.o: ../cryptlib.h p_dec.c | ||
| 645 | p_enc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 618 | p_enc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 646 | p_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 619 | p_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 647 | p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 620 | p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 648 | p_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 621 | p_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 649 | p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 622 | p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 650 | p_enc.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 623 | p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 651 | p_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 624 | p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 652 | p_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 625 | p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 653 | p_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 626 | p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 654 | p_enc.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 627 | p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 655 | p_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 628 | p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 656 | p_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 629 | p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 657 | p_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 630 | p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c |
| 658 | p_enc.o: ../cryptlib.h p_enc.c | ||
| 659 | p_lib.o: ../../e_os.h ../../include/openssl/asn1.h | 631 | p_lib.o: ../../e_os.h ../../include/openssl/asn1.h |
| 660 | p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | 632 | p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h |
| 661 | p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | 633 | p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h |
| 662 | p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | 634 | p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h |
| 663 | p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | 635 | p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 664 | p_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 636 | p_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 665 | p_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 637 | p_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 666 | p_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 638 | p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 667 | p_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 639 | p_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 668 | p_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 640 | p_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 669 | p_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 641 | p_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| @@ -671,57 +643,91 @@ p_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | |||
| 671 | p_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 643 | p_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 672 | p_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 644 | p_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 673 | p_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 645 | p_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 674 | p_lib.o: ../cryptlib.h p_lib.c | 646 | p_lib.o: ../asn1/asn1_locl.h ../cryptlib.h p_lib.c |
| 675 | p_open.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 647 | p_open.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 676 | p_open.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 648 | p_open.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 677 | p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 649 | p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 678 | p_open.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 650 | p_open.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 679 | p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 651 | p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 680 | p_open.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 652 | p_open.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 681 | p_open.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 653 | p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 682 | p_open.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 654 | p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 683 | p_open.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 655 | p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h |
| 684 | p_open.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 656 | p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 685 | p_open.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 657 | p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 686 | p_open.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 658 | p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 687 | p_open.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_open.c | 659 | p_open.o: ../cryptlib.h p_open.c |
| 688 | p_seal.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 660 | p_seal.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 689 | p_seal.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 661 | p_seal.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 690 | p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 662 | p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 691 | p_seal.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 663 | p_seal.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 692 | p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 664 | p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 693 | p_seal.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 665 | p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 694 | p_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 666 | p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 695 | p_seal.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 667 | p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 696 | p_seal.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 668 | p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 697 | p_seal.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 669 | p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 698 | p_seal.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 670 | p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 699 | p_seal.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 671 | p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 700 | p_seal.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 672 | p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c |
| 701 | p_seal.o: ../cryptlib.h p_seal.c | ||
| 702 | p_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | 673 | p_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 703 | p_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 674 | p_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 704 | p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 675 | p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 705 | p_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 676 | p_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 706 | p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 677 | p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 707 | p_sign.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 678 | p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 708 | p_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 679 | p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 709 | p_sign.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 680 | p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 710 | p_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 681 | p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 711 | p_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 682 | p_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 712 | p_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 683 | p_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 713 | p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 684 | p_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_sign.c |
| 714 | p_sign.o: ../cryptlib.h p_sign.c | ||
| 715 | p_verify.o: ../../e_os.h ../../include/openssl/asn1.h | 685 | p_verify.o: ../../e_os.h ../../include/openssl/asn1.h |
| 716 | p_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 686 | p_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 717 | p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 687 | p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 718 | p_verify.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 688 | p_verify.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 719 | p_verify.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | 689 | p_verify.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h |
| 720 | p_verify.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 690 | p_verify.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 721 | p_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 691 | p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 722 | p_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 692 | p_verify.o: ../../include/openssl/opensslconf.h |
| 723 | p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 693 | p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 724 | p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | 694 | p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 725 | p_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 695 | p_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 726 | p_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 696 | p_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 727 | p_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_verify.c | 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/Makefile.ssl b/src/lib/libcrypto/evp/Makefile.ssl deleted file mode 100644 index f33aebd33a..0000000000 --- a/src/lib/libcrypto/evp/Makefile.ssl +++ /dev/null | |||
| @@ -1,1059 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/evp/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= evp | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST=evp_test.c | ||
| 23 | TESTDATA=evptests.txt | ||
| 24 | APPS= | ||
| 25 | |||
| 26 | LIB=$(TOP)/libcrypto.a | ||
| 27 | LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \ | ||
| 28 | e_des.c e_bf.c e_idea.c e_des3.c \ | ||
| 29 | e_rc4.c e_aes.c names.c \ | ||
| 30 | e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ | ||
| 31 | m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \ | ||
| 32 | m_dss.c m_dss1.c m_mdc2.c m_ripemd.c \ | ||
| 33 | p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \ | ||
| 34 | bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \ | ||
| 35 | c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \ | ||
| 36 | evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c | ||
| 37 | |||
| 38 | LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \ | ||
| 39 | e_des.o e_bf.o e_idea.o e_des3.o \ | ||
| 40 | e_rc4.o e_aes.o names.o \ | ||
| 41 | e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \ | ||
| 42 | m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \ | ||
| 43 | m_dss.o m_dss1.o m_mdc2.o m_ripemd.o \ | ||
| 44 | p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \ | ||
| 45 | bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \ | ||
| 46 | c_all.o c_allc.o c_alld.o evp_lib.o bio_ok.o \ | ||
| 47 | evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o | ||
| 48 | |||
| 49 | SRC= $(LIBSRC) | ||
| 50 | |||
| 51 | EXHEADER= evp.h | ||
| 52 | HEADER= $(EXHEADER) | ||
| 53 | |||
| 54 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 55 | |||
| 56 | top: | ||
| 57 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 58 | |||
| 59 | all: lib | ||
| 60 | |||
| 61 | lib: $(LIBOBJ) | ||
| 62 | $(AR) $(LIB) $(LIBOBJ) | ||
| 63 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 64 | @touch lib | ||
| 65 | |||
| 66 | files: | ||
| 67 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 68 | |||
| 69 | links: | ||
| 70 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 71 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 72 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 73 | cp $(TESTDATA) ../../test | ||
| 74 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 75 | |||
| 76 | install: | ||
| 77 | @for i in $(EXHEADER) ; \ | ||
| 78 | do \ | ||
| 79 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 80 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 81 | done; | ||
| 82 | |||
| 83 | tags: | ||
| 84 | ctags $(SRC) | ||
| 85 | |||
| 86 | tests: | ||
| 87 | |||
| 88 | lint: | ||
| 89 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 90 | |||
| 91 | depend: | ||
| 92 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 100 | |||
| 101 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 102 | |||
| 103 | bio_b64.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 104 | bio_b64.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 105 | bio_b64.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 106 | bio_b64.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 107 | bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 108 | bio_b64.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 109 | bio_b64.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 110 | bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 111 | bio_b64.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 112 | bio_b64.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 113 | bio_b64.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 114 | bio_b64.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 115 | bio_b64.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 116 | bio_b64.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 117 | bio_b64.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 118 | bio_b64.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 119 | bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 120 | bio_b64.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 121 | bio_b64.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 122 | bio_b64.o: ../cryptlib.h bio_b64.c | ||
| 123 | bio_enc.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 124 | bio_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 125 | bio_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 126 | bio_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 127 | bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 128 | bio_enc.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 129 | bio_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 130 | bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 131 | bio_enc.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 132 | bio_enc.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 133 | bio_enc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 134 | bio_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 135 | bio_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 136 | bio_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 137 | bio_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 138 | bio_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 139 | bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 140 | bio_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 141 | bio_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 142 | bio_enc.o: ../cryptlib.h bio_enc.c | ||
| 143 | bio_md.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 144 | bio_md.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 145 | bio_md.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 146 | bio_md.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 147 | bio_md.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 148 | bio_md.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 149 | bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 150 | bio_md.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 151 | bio_md.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 152 | bio_md.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 153 | bio_md.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 154 | bio_md.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 155 | bio_md.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 156 | bio_md.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 157 | bio_md.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 158 | bio_md.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 159 | bio_md.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 160 | bio_md.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 161 | bio_md.o: ../../include/openssl/ui_compat.h ../cryptlib.h bio_md.c | ||
| 162 | bio_ok.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 163 | bio_ok.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 164 | bio_ok.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 165 | bio_ok.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 166 | bio_ok.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 167 | bio_ok.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 168 | bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 169 | bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 170 | bio_ok.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 171 | bio_ok.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 172 | bio_ok.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 173 | bio_ok.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 174 | bio_ok.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 175 | bio_ok.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 176 | bio_ok.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 177 | bio_ok.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 178 | bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 179 | bio_ok.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 180 | bio_ok.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 181 | bio_ok.o: ../cryptlib.h bio_ok.c | ||
| 182 | c_all.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 183 | c_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 184 | c_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 185 | c_all.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 186 | c_all.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 187 | c_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 188 | c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 189 | c_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 190 | c_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 191 | c_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 192 | c_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 193 | c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 194 | c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 195 | c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 196 | c_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 197 | c_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 198 | c_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 199 | c_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 200 | c_all.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 201 | c_all.o: ../../include/openssl/ui_compat.h ../cryptlib.h c_all.c | ||
| 202 | c_allc.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 203 | c_allc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 204 | c_allc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 205 | c_allc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 206 | c_allc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 207 | c_allc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 208 | c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 209 | c_allc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 210 | c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 211 | c_allc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 212 | c_allc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 213 | c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 214 | c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 215 | c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 216 | c_allc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 217 | c_allc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 218 | c_allc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 219 | c_allc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 220 | c_allc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 221 | c_allc.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 222 | c_allc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_allc.c | ||
| 223 | c_alld.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 224 | c_alld.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 225 | c_alld.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 226 | c_alld.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 227 | c_alld.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 228 | c_alld.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 229 | c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 230 | c_alld.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 231 | c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 232 | c_alld.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 233 | c_alld.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 234 | c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 235 | c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 236 | c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 237 | c_alld.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 238 | c_alld.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 239 | c_alld.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 240 | c_alld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 241 | c_alld.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 242 | c_alld.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 243 | c_alld.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_alld.c | ||
| 244 | digest.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 245 | digest.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 246 | digest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 247 | digest.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 248 | digest.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 249 | digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 250 | digest.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 251 | digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 252 | digest.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 253 | digest.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 254 | digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 255 | digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 256 | digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 257 | digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 258 | digest.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 259 | digest.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 260 | digest.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 261 | digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 262 | digest.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 263 | digest.o: ../../include/openssl/ui_compat.h ../cryptlib.h digest.c | ||
| 264 | e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 265 | e_aes.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 266 | e_aes.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 267 | e_aes.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 268 | e_aes.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 269 | e_aes.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 270 | e_aes.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 271 | e_aes.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 272 | e_aes.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 273 | e_aes.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 274 | e_aes.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 275 | e_aes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 276 | e_aes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 277 | e_aes.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 278 | e_aes.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 279 | e_aes.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 280 | e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 281 | e_aes.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h e_aes.c | ||
| 282 | e_aes.o: evp_locl.h | ||
| 283 | e_bf.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 284 | e_bf.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 285 | e_bf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 286 | e_bf.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 287 | e_bf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 288 | e_bf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 289 | e_bf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 290 | e_bf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 291 | e_bf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 292 | e_bf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 293 | e_bf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 294 | e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 295 | e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 296 | e_bf.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 297 | e_bf.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 298 | e_bf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 299 | e_bf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 300 | e_bf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 301 | e_bf.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_bf.c evp_locl.h | ||
| 302 | e_cast.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 303 | e_cast.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 304 | e_cast.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 305 | e_cast.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 306 | e_cast.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 307 | e_cast.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 308 | e_cast.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 309 | e_cast.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 310 | e_cast.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 311 | e_cast.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 312 | e_cast.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 313 | e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 314 | e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 315 | e_cast.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 316 | e_cast.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 317 | e_cast.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 318 | e_cast.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 319 | e_cast.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 320 | e_cast.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_cast.c evp_locl.h | ||
| 321 | e_des.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 322 | e_des.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 323 | e_des.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 324 | e_des.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 325 | e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 326 | e_des.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 327 | e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 328 | e_des.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 329 | e_des.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 330 | e_des.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 331 | e_des.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 332 | e_des.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 333 | e_des.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 334 | e_des.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 335 | e_des.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 336 | e_des.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 337 | e_des.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 338 | e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 339 | e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h | ||
| 340 | e_des3.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 341 | e_des3.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 342 | e_des3.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 343 | e_des3.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 344 | e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 345 | e_des3.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 346 | e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 347 | e_des3.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 348 | e_des3.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 349 | e_des3.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 350 | e_des3.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 351 | e_des3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 352 | e_des3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 353 | e_des3.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 354 | e_des3.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 355 | e_des3.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 356 | e_des3.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 357 | e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 358 | e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_locl.h | ||
| 359 | e_idea.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 360 | e_idea.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 361 | e_idea.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 362 | e_idea.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 363 | e_idea.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 364 | e_idea.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 365 | e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 366 | e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 367 | e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 368 | e_idea.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 369 | e_idea.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 370 | e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 371 | e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 372 | e_idea.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 373 | e_idea.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 374 | e_idea.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 375 | e_idea.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 376 | e_idea.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 377 | e_idea.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_idea.c evp_locl.h | ||
| 378 | e_null.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 379 | e_null.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 380 | e_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 381 | e_null.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 382 | e_null.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 383 | e_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 384 | e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 385 | e_null.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 386 | e_null.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 387 | e_null.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 388 | e_null.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 389 | e_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 390 | e_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 391 | e_null.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 392 | e_null.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 393 | e_null.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 394 | e_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 395 | e_null.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 396 | e_null.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_null.c | ||
| 397 | e_rc2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 398 | e_rc2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 399 | e_rc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 400 | e_rc2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 401 | e_rc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 402 | e_rc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 403 | e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 404 | e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 405 | e_rc2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 406 | e_rc2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 407 | e_rc2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 408 | e_rc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 409 | e_rc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 410 | e_rc2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 411 | e_rc2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 412 | e_rc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 413 | e_rc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 414 | e_rc2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 415 | e_rc2.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc2.c evp_locl.h | ||
| 416 | e_rc4.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 417 | e_rc4.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 418 | e_rc4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 419 | e_rc4.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 420 | e_rc4.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 421 | e_rc4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 422 | e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 423 | e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 424 | e_rc4.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 425 | e_rc4.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 426 | e_rc4.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 427 | e_rc4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 428 | e_rc4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 429 | e_rc4.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 430 | e_rc4.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 431 | e_rc4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 432 | e_rc4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 433 | e_rc4.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 434 | e_rc4.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc4.c | ||
| 435 | e_rc5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 436 | e_rc5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 437 | e_rc5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 438 | e_rc5.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 439 | e_rc5.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 440 | e_rc5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 441 | e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 442 | e_rc5.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 443 | e_rc5.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 444 | e_rc5.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 445 | e_rc5.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 446 | e_rc5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 447 | e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 448 | e_rc5.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 449 | e_rc5.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 450 | e_rc5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 451 | e_rc5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 452 | e_rc5.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 453 | e_rc5.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc5.c evp_locl.h | ||
| 454 | e_xcbc_d.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 455 | e_xcbc_d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 456 | e_xcbc_d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 457 | e_xcbc_d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 458 | e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 459 | e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 460 | e_xcbc_d.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 461 | e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 462 | e_xcbc_d.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 463 | e_xcbc_d.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 464 | e_xcbc_d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 465 | e_xcbc_d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 466 | e_xcbc_d.o: ../../include/openssl/opensslconf.h | ||
| 467 | e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 468 | e_xcbc_d.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 469 | e_xcbc_d.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 470 | e_xcbc_d.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 471 | e_xcbc_d.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 472 | e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 473 | e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c | ||
| 474 | encode.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 475 | encode.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 476 | encode.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 477 | encode.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 478 | encode.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 479 | encode.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 480 | encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 481 | encode.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 482 | encode.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 483 | encode.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 484 | encode.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 485 | encode.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 486 | encode.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 487 | encode.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 488 | encode.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 489 | encode.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 490 | encode.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 491 | encode.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 492 | encode.o: ../../include/openssl/ui_compat.h ../cryptlib.h encode.c | ||
| 493 | evp_acnf.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 494 | evp_acnf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 495 | evp_acnf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 496 | evp_acnf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 497 | evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 498 | evp_acnf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 499 | evp_acnf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 500 | evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 501 | evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 502 | evp_acnf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 503 | evp_acnf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 504 | evp_acnf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 505 | evp_acnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 506 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 507 | evp_acnf.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 508 | evp_acnf.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 509 | evp_acnf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 510 | evp_acnf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 511 | evp_acnf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 512 | evp_acnf.o: ../../include/openssl/ui_compat.h ../cryptlib.h evp_acnf.c | ||
| 513 | evp_enc.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 514 | evp_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 515 | evp_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 516 | evp_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 517 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 518 | evp_enc.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 519 | evp_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 520 | evp_enc.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 521 | evp_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 522 | evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 523 | evp_enc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 524 | evp_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 525 | evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 526 | evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 527 | evp_enc.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 528 | evp_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 529 | evp_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 530 | evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 531 | evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 532 | evp_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 533 | evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h | ||
| 534 | evp_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 535 | evp_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 536 | evp_err.o: ../../include/openssl/bn.h ../../include/openssl/cast.h | ||
| 537 | evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 538 | evp_err.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 539 | evp_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 540 | evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 541 | evp_err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 542 | evp_err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 543 | evp_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 544 | evp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 545 | evp_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 546 | evp_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 547 | evp_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 548 | evp_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 549 | evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 550 | evp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 551 | evp_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 552 | evp_err.o: evp_err.c | ||
| 553 | evp_key.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 554 | evp_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 555 | evp_key.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 556 | evp_key.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 557 | evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 558 | evp_key.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 559 | evp_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 560 | evp_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 561 | evp_key.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 562 | evp_key.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 563 | evp_key.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 564 | evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 565 | evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 566 | evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 567 | evp_key.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 568 | evp_key.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 569 | evp_key.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 570 | evp_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 571 | evp_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 572 | evp_key.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 573 | evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c | ||
| 574 | evp_lib.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 575 | evp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 576 | evp_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 577 | evp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 578 | evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 579 | evp_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 580 | evp_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 581 | evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 582 | evp_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 583 | evp_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 584 | evp_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 585 | evp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 586 | evp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 587 | evp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 588 | evp_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 589 | evp_lib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 590 | evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 591 | evp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 592 | evp_lib.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 593 | evp_lib.o: ../cryptlib.h evp_lib.c | ||
| 594 | evp_pbe.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 595 | evp_pbe.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 596 | evp_pbe.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 597 | evp_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 598 | evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 599 | evp_pbe.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 600 | evp_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 601 | evp_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 602 | evp_pbe.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 603 | evp_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 604 | evp_pbe.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 605 | evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 606 | evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 607 | evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 608 | evp_pbe.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 609 | evp_pbe.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 610 | evp_pbe.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 611 | evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 612 | evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 613 | evp_pbe.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 614 | evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c | ||
| 615 | evp_pkey.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 616 | evp_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 617 | evp_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 618 | evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 619 | evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 620 | evp_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 621 | evp_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 622 | evp_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 623 | evp_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 624 | evp_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 625 | evp_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 626 | evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 627 | evp_pkey.o: ../../include/openssl/opensslconf.h | ||
| 628 | evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 629 | evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 630 | evp_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 631 | evp_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 632 | evp_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 633 | evp_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 634 | evp_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 635 | evp_pkey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 636 | evp_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pkey.c | ||
| 637 | m_dss.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 638 | m_dss.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 639 | m_dss.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 640 | m_dss.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 641 | m_dss.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 642 | m_dss.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 643 | m_dss.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 644 | m_dss.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 645 | m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 646 | m_dss.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 647 | m_dss.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 648 | m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 649 | m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 650 | m_dss.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 651 | m_dss.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 652 | m_dss.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 653 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 654 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 655 | m_dss.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 656 | m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 657 | m_dss.o: ../cryptlib.h m_dss.c | ||
| 658 | m_dss1.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 659 | m_dss1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 660 | m_dss1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 661 | m_dss1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 662 | m_dss1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 663 | m_dss1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 664 | m_dss1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 665 | m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 666 | m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 667 | m_dss1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 668 | m_dss1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 669 | m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 670 | m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 671 | m_dss1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 672 | m_dss1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 673 | m_dss1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 674 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 675 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 676 | m_dss1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 677 | m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 678 | m_dss1.o: ../cryptlib.h m_dss1.c | ||
| 679 | m_md2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 680 | m_md2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 681 | m_md2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 682 | m_md2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 683 | m_md2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 684 | m_md2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 685 | m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 686 | m_md2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 687 | m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 688 | m_md2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 689 | m_md2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 690 | m_md2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 691 | m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 692 | m_md2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 693 | m_md2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 694 | m_md2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 695 | m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 696 | m_md2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 697 | m_md2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 698 | m_md2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 699 | m_md2.o: ../cryptlib.h m_md2.c | ||
| 700 | m_md4.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 701 | m_md4.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 702 | m_md4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 703 | m_md4.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 704 | m_md4.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 705 | m_md4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 706 | m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 707 | m_md4.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 708 | m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 709 | m_md4.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 710 | m_md4.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 711 | m_md4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 712 | m_md4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 713 | m_md4.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 714 | m_md4.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 715 | m_md4.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 716 | m_md4.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 717 | m_md4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 718 | m_md4.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 719 | m_md4.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 720 | m_md4.o: ../cryptlib.h m_md4.c | ||
| 721 | m_md5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 722 | m_md5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 723 | m_md5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 724 | m_md5.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 725 | m_md5.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 726 | m_md5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 727 | m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 728 | m_md5.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 729 | m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 730 | m_md5.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 731 | m_md5.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 732 | m_md5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 733 | m_md5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 734 | m_md5.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 735 | m_md5.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 736 | m_md5.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 737 | m_md5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 738 | m_md5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 739 | m_md5.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 740 | m_md5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 741 | m_md5.o: ../cryptlib.h m_md5.c | ||
| 742 | m_mdc2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 743 | m_mdc2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 744 | m_mdc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 745 | m_mdc2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 746 | m_mdc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 747 | m_mdc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 748 | m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 749 | m_mdc2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 750 | m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 751 | m_mdc2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 752 | m_mdc2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 753 | m_mdc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 754 | m_mdc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 755 | m_mdc2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 756 | m_mdc2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 757 | m_mdc2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 758 | m_mdc2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 759 | m_mdc2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 760 | m_mdc2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 761 | m_mdc2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 762 | m_mdc2.o: ../cryptlib.h m_mdc2.c | ||
| 763 | m_null.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 764 | m_null.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 765 | m_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 766 | m_null.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 767 | m_null.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 768 | m_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 769 | m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 770 | m_null.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 771 | m_null.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 772 | m_null.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 773 | m_null.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 774 | m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 775 | m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 776 | m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 777 | m_null.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 778 | m_null.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 779 | m_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 780 | m_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 781 | m_null.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 782 | m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 783 | m_null.o: ../cryptlib.h m_null.c | ||
| 784 | m_ripemd.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 785 | m_ripemd.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 786 | m_ripemd.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 787 | m_ripemd.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 788 | m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 789 | m_ripemd.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 790 | m_ripemd.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 791 | m_ripemd.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 792 | m_ripemd.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 793 | m_ripemd.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 794 | m_ripemd.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 795 | m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 796 | m_ripemd.o: ../../include/openssl/opensslconf.h | ||
| 797 | m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 798 | m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 799 | m_ripemd.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 800 | m_ripemd.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 801 | m_ripemd.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 802 | m_ripemd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 803 | m_ripemd.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 804 | m_ripemd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 805 | m_ripemd.o: ../cryptlib.h m_ripemd.c | ||
| 806 | m_sha.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 807 | m_sha.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 808 | m_sha.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 809 | m_sha.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 810 | m_sha.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 811 | m_sha.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 812 | m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 813 | m_sha.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 814 | m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 815 | m_sha.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 816 | m_sha.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 817 | m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 818 | m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 819 | m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 820 | m_sha.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 821 | m_sha.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 822 | m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 823 | m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 824 | m_sha.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 825 | m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 826 | m_sha.o: ../cryptlib.h m_sha.c | ||
| 827 | m_sha1.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 828 | m_sha1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 829 | m_sha1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 830 | m_sha1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 831 | m_sha1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 832 | m_sha1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 833 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 834 | m_sha1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 835 | m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 836 | m_sha1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 837 | m_sha1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 838 | m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 839 | m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 840 | m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 841 | m_sha1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 842 | m_sha1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 843 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 844 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 845 | m_sha1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 846 | m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 847 | m_sha1.o: ../cryptlib.h m_sha1.c | ||
| 848 | names.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 849 | names.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 850 | names.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 851 | names.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 852 | names.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 853 | names.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 854 | names.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 855 | names.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 856 | names.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 857 | names.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 858 | names.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 859 | names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 860 | names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 861 | names.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 862 | names.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 863 | names.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 864 | names.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 865 | names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 866 | names.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 867 | names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 868 | names.o: ../cryptlib.h names.c | ||
| 869 | p5_crpt.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 870 | p5_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 871 | p5_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 872 | p5_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 873 | p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 874 | p5_crpt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 875 | p5_crpt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 876 | p5_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 877 | p5_crpt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 878 | p5_crpt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 879 | p5_crpt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 880 | p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 881 | p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 882 | p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 883 | p5_crpt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 884 | p5_crpt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 885 | p5_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 886 | p5_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 887 | p5_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 888 | p5_crpt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 889 | p5_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt.c | ||
| 890 | p5_crpt2.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 891 | p5_crpt2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 892 | p5_crpt2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 893 | p5_crpt2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 894 | p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 895 | p5_crpt2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 896 | p5_crpt2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 897 | p5_crpt2.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 898 | p5_crpt2.o: ../../include/openssl/hmac.h ../../include/openssl/idea.h | ||
| 899 | p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 900 | p5_crpt2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 901 | p5_crpt2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 902 | p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 903 | p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 904 | p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 905 | p5_crpt2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 906 | p5_crpt2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 907 | p5_crpt2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 908 | p5_crpt2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 909 | p5_crpt2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 910 | p5_crpt2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 911 | p5_crpt2.o: ../cryptlib.h p5_crpt2.c | ||
| 912 | p_dec.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 913 | p_dec.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 914 | p_dec.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 915 | p_dec.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 916 | p_dec.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 917 | p_dec.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 918 | p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 919 | p_dec.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 920 | p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 921 | p_dec.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 922 | p_dec.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 923 | p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 924 | p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 925 | p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 926 | p_dec.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 927 | p_dec.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 928 | p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 929 | p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 930 | p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 931 | p_dec.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 932 | p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c | ||
| 933 | p_enc.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 934 | p_enc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 935 | p_enc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 936 | p_enc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 937 | p_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 938 | p_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 939 | p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 940 | p_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 941 | p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 942 | p_enc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 943 | p_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 944 | p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 945 | p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 946 | p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 947 | p_enc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 948 | p_enc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 949 | p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 950 | p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 951 | p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 952 | p_enc.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 953 | p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c | ||
| 954 | p_lib.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 955 | p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 956 | p_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 957 | p_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 958 | p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 959 | p_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 960 | p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 961 | p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 962 | p_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 963 | p_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 964 | p_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 965 | p_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 966 | p_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 967 | p_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 968 | p_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 969 | p_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 970 | p_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 971 | p_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 972 | p_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 973 | p_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 974 | p_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_lib.c | ||
| 975 | p_open.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 976 | p_open.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 977 | p_open.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 978 | p_open.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 979 | p_open.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 980 | p_open.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 981 | p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 982 | p_open.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 983 | p_open.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 984 | p_open.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 985 | p_open.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 986 | p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 987 | p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 988 | p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 989 | p_open.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 990 | p_open.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 991 | p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 992 | p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 993 | p_open.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 994 | p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 995 | p_open.o: ../cryptlib.h p_open.c | ||
| 996 | p_seal.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 997 | p_seal.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 998 | p_seal.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 999 | p_seal.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 1000 | p_seal.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 1001 | p_seal.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 1002 | p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 1003 | p_seal.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 1004 | p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 1005 | p_seal.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 1006 | p_seal.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 1007 | p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 1008 | p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 1009 | p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 1010 | p_seal.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 1011 | p_seal.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 1012 | p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 1013 | p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 1014 | p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 1015 | p_seal.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 1016 | p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c | ||
| 1017 | p_sign.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 1018 | p_sign.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 1019 | p_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 1020 | p_sign.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 1021 | p_sign.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 1022 | p_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 1023 | p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 1024 | p_sign.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 1025 | p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 1026 | p_sign.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 1027 | p_sign.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 1028 | p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 1029 | p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 1030 | p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 1031 | p_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 1032 | p_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 1033 | p_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 1034 | p_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 1035 | p_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 1036 | p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 1037 | p_sign.o: ../cryptlib.h p_sign.c | ||
| 1038 | p_verify.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 1039 | p_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 1040 | p_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 1041 | p_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 1042 | p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 1043 | p_verify.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 1044 | p_verify.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 1045 | p_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 1046 | p_verify.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 1047 | p_verify.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 1048 | p_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 1049 | p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 1050 | p_verify.o: ../../include/openssl/opensslconf.h | ||
| 1051 | p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 1052 | p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 1053 | p_verify.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 1054 | p_verify.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 1055 | p_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 1056 | p_verify.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 1057 | p_verify.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 1058 | p_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 1059 | p_verify.o: ../cryptlib.h p_verify.c | ||
diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c index fa5cbc7eb1..72a2a67277 100644 --- a/src/lib/libcrypto/evp/bio_b64.c +++ b/src/lib/libcrypto/evp/bio_b64.c | |||
| @@ -64,7 +64,7 @@ | |||
| 64 | 64 | ||
| 65 | static int b64_write(BIO *h, const char *buf, int num); | 65 | static int b64_write(BIO *h, const char *buf, int num); |
| 66 | static int b64_read(BIO *h, char *buf, int size); | 66 | static int b64_read(BIO *h, char *buf, int size); |
| 67 | /*static int b64_puts(BIO *h, const char *str); */ | 67 | static int b64_puts(BIO *h, const char *str); |
| 68 | /*static int b64_gets(BIO *h, char *str, int size); */ | 68 | /*static int b64_gets(BIO *h, char *str, int size); */ |
| 69 | static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2); | 69 | static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2); |
| 70 | static int b64_new(BIO *h); | 70 | static int b64_new(BIO *h); |
| @@ -96,7 +96,7 @@ static BIO_METHOD methods_b64= | |||
| 96 | BIO_TYPE_BASE64,"base64 encoding", | 96 | BIO_TYPE_BASE64,"base64 encoding", |
| 97 | b64_write, | 97 | b64_write, |
| 98 | b64_read, | 98 | b64_read, |
| 99 | NULL, /* b64_puts, */ | 99 | b64_puts, |
| 100 | NULL, /* b64_gets, */ | 100 | NULL, /* b64_gets, */ |
| 101 | b64_ctrl, | 101 | b64_ctrl, |
| 102 | b64_new, | 102 | b64_new, |
| @@ -127,6 +127,7 @@ static int b64_new(BIO *bi) | |||
| 127 | bi->init=1; | 127 | bi->init=1; |
| 128 | bi->ptr=(char *)ctx; | 128 | bi->ptr=(char *)ctx; |
| 129 | bi->flags=0; | 129 | bi->flags=0; |
| 130 | bi->num = 0; | ||
| 130 | return(1); | 131 | return(1); |
| 131 | } | 132 | } |
| 132 | 133 | ||
| @@ -151,6 +152,8 @@ static int b64_read(BIO *b, char *out, int outl) | |||
| 151 | 152 | ||
| 152 | if ((ctx == NULL) || (b->next_bio == NULL)) return(0); | 153 | if ((ctx == NULL) || (b->next_bio == NULL)) return(0); |
| 153 | 154 | ||
| 155 | BIO_clear_retry_flags(b); | ||
| 156 | |||
| 154 | if (ctx->encode != B64_DECODE) | 157 | if (ctx->encode != B64_DECODE) |
| 155 | { | 158 | { |
| 156 | ctx->encode=B64_DECODE; | 159 | ctx->encode=B64_DECODE; |
| @@ -163,6 +166,7 @@ static int b64_read(BIO *b, char *out, int outl) | |||
| 163 | /* First check if there are bytes decoded/encoded */ | 166 | /* First check if there are bytes decoded/encoded */ |
| 164 | if (ctx->buf_len > 0) | 167 | if (ctx->buf_len > 0) |
| 165 | { | 168 | { |
| 169 | OPENSSL_assert(ctx->buf_len >= ctx->buf_off); | ||
| 166 | i=ctx->buf_len-ctx->buf_off; | 170 | i=ctx->buf_len-ctx->buf_off; |
| 167 | if (i > outl) i=outl; | 171 | if (i > outl) i=outl; |
| 168 | OPENSSL_assert(ctx->buf_off+i < (int)sizeof(ctx->buf)); | 172 | OPENSSL_assert(ctx->buf_off+i < (int)sizeof(ctx->buf)); |
| @@ -184,7 +188,6 @@ static int b64_read(BIO *b, char *out, int outl) | |||
| 184 | ret_code=0; | 188 | ret_code=0; |
| 185 | while (outl > 0) | 189 | while (outl > 0) |
| 186 | { | 190 | { |
| 187 | |||
| 188 | if (ctx->cont <= 0) | 191 | if (ctx->cont <= 0) |
| 189 | break; | 192 | break; |
| 190 | 193 | ||
| @@ -195,7 +198,7 @@ static int b64_read(BIO *b, char *out, int outl) | |||
| 195 | { | 198 | { |
| 196 | ret_code=i; | 199 | ret_code=i; |
| 197 | 200 | ||
| 198 | /* Should be continue next time we are called? */ | 201 | /* Should we continue next time we are called? */ |
| 199 | if (!BIO_should_retry(b->next_bio)) | 202 | if (!BIO_should_retry(b->next_bio)) |
| 200 | { | 203 | { |
| 201 | ctx->cont=i; | 204 | ctx->cont=i; |
| @@ -285,19 +288,27 @@ static int b64_read(BIO *b, char *out, int outl) | |||
| 285 | continue; | 288 | continue; |
| 286 | } | 289 | } |
| 287 | else | 290 | else |
| 291 | { | ||
| 288 | ctx->tmp_len=0; | 292 | ctx->tmp_len=0; |
| 289 | } | 293 | } |
| 290 | /* If buffer isn't full and we can retry then | 294 | } |
| 291 | * restart to read in more data. | ||
| 292 | */ | ||
| 293 | else if ((i < B64_BLOCK_SIZE) && (ctx->cont > 0)) | 295 | else if ((i < B64_BLOCK_SIZE) && (ctx->cont > 0)) |
| 296 | { | ||
| 297 | /* If buffer isn't full and we can retry then | ||
| 298 | * restart to read in more data. | ||
| 299 | */ | ||
| 294 | continue; | 300 | continue; |
| 301 | } | ||
| 295 | 302 | ||
| 296 | if (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL) | 303 | if (BIO_get_flags(b) & BIO_FLAGS_BASE64_NO_NL) |
| 297 | { | 304 | { |
| 298 | int z,jj; | 305 | int z,jj; |
| 299 | 306 | ||
| 307 | #if 0 | ||
| 300 | jj=(i>>2)<<2; | 308 | jj=(i>>2)<<2; |
| 309 | #else | ||
| 310 | jj = i & ~3; /* process per 4 */ | ||
| 311 | #endif | ||
| 301 | z=EVP_DecodeBlock((unsigned char *)ctx->buf, | 312 | z=EVP_DecodeBlock((unsigned char *)ctx->buf, |
| 302 | (unsigned char *)ctx->tmp,jj); | 313 | (unsigned char *)ctx->tmp,jj); |
| 303 | if (jj > 2) | 314 | if (jj > 2) |
| @@ -313,18 +324,15 @@ static int b64_read(BIO *b, char *out, int outl) | |||
| 313 | * number consumed */ | 324 | * number consumed */ |
| 314 | if (jj != i) | 325 | if (jj != i) |
| 315 | { | 326 | { |
| 316 | memcpy((unsigned char *)ctx->tmp, | 327 | memmove(ctx->tmp, &ctx->tmp[jj], i-jj); |
| 317 | (unsigned char *)&(ctx->tmp[jj]),i-jj); | ||
| 318 | ctx->tmp_len=i-jj; | 328 | ctx->tmp_len=i-jj; |
| 319 | } | 329 | } |
| 320 | ctx->buf_len=0; | 330 | ctx->buf_len=0; |
| 321 | if (z > 0) | 331 | if (z > 0) |
| 322 | { | 332 | { |
| 323 | ctx->buf_len=z; | 333 | ctx->buf_len=z; |
| 324 | i=1; | ||
| 325 | } | 334 | } |
| 326 | else | 335 | i=z; |
| 327 | i=z; | ||
| 328 | } | 336 | } |
| 329 | else | 337 | else |
| 330 | { | 338 | { |
| @@ -357,14 +365,16 @@ static int b64_read(BIO *b, char *out, int outl) | |||
| 357 | outl-=i; | 365 | outl-=i; |
| 358 | out+=i; | 366 | out+=i; |
| 359 | } | 367 | } |
| 360 | BIO_clear_retry_flags(b); | 368 | /* BIO_clear_retry_flags(b); */ |
| 361 | BIO_copy_next_retry(b); | 369 | BIO_copy_next_retry(b); |
| 362 | return((ret == 0)?ret_code:ret); | 370 | return((ret == 0)?ret_code:ret); |
| 363 | } | 371 | } |
| 364 | 372 | ||
| 365 | static int b64_write(BIO *b, const char *in, int inl) | 373 | static int b64_write(BIO *b, const char *in, int inl) |
| 366 | { | 374 | { |
| 367 | int ret=inl,n,i; | 375 | int ret=0; |
| 376 | int n; | ||
| 377 | int i; | ||
| 368 | BIO_B64_CTX *ctx; | 378 | BIO_B64_CTX *ctx; |
| 369 | 379 | ||
| 370 | ctx=(BIO_B64_CTX *)b->ptr; | 380 | ctx=(BIO_B64_CTX *)b->ptr; |
| @@ -379,6 +389,9 @@ static int b64_write(BIO *b, const char *in, int inl) | |||
| 379 | EVP_EncodeInit(&(ctx->base64)); | 389 | EVP_EncodeInit(&(ctx->base64)); |
| 380 | } | 390 | } |
| 381 | 391 | ||
| 392 | OPENSSL_assert(ctx->buf_off < (int)sizeof(ctx->buf)); | ||
| 393 | OPENSSL_assert(ctx->buf_len <= (int)sizeof(ctx->buf)); | ||
| 394 | OPENSSL_assert(ctx->buf_len >= ctx->buf_off); | ||
| 382 | n=ctx->buf_len-ctx->buf_off; | 395 | n=ctx->buf_len-ctx->buf_off; |
| 383 | while (n > 0) | 396 | while (n > 0) |
| 384 | { | 397 | { |
| @@ -388,7 +401,10 @@ static int b64_write(BIO *b, const char *in, int inl) | |||
| 388 | BIO_copy_next_retry(b); | 401 | BIO_copy_next_retry(b); |
| 389 | return(i); | 402 | return(i); |
| 390 | } | 403 | } |
| 404 | OPENSSL_assert(i <= n); | ||
| 391 | ctx->buf_off+=i; | 405 | ctx->buf_off+=i; |
| 406 | OPENSSL_assert(ctx->buf_off <= (int)sizeof(ctx->buf)); | ||
| 407 | OPENSSL_assert(ctx->buf_len >= ctx->buf_off); | ||
| 392 | n-=i; | 408 | n-=i; |
| 393 | } | 409 | } |
| 394 | /* at this point all pending data has been written */ | 410 | /* at this point all pending data has been written */ |
| @@ -405,18 +421,19 @@ static int b64_write(BIO *b, const char *in, int inl) | |||
| 405 | { | 421 | { |
| 406 | if (ctx->tmp_len > 0) | 422 | if (ctx->tmp_len > 0) |
| 407 | { | 423 | { |
| 424 | OPENSSL_assert(ctx->tmp_len <= 3); | ||
| 408 | n=3-ctx->tmp_len; | 425 | n=3-ctx->tmp_len; |
| 409 | /* There's a teoretical possibility for this */ | 426 | /* There's a theoretical possibility for this */ |
| 410 | if (n > inl) | 427 | if (n > inl) |
| 411 | n=inl; | 428 | n=inl; |
| 412 | memcpy(&(ctx->tmp[ctx->tmp_len]),in,n); | 429 | memcpy(&(ctx->tmp[ctx->tmp_len]),in,n); |
| 413 | ctx->tmp_len+=n; | 430 | ctx->tmp_len+=n; |
| 431 | ret += n; | ||
| 414 | if (ctx->tmp_len < 3) | 432 | if (ctx->tmp_len < 3) |
| 415 | break; | 433 | break; |
| 416 | ctx->buf_len=EVP_EncodeBlock( | 434 | ctx->buf_len=EVP_EncodeBlock((unsigned char *)ctx->buf,(unsigned char *)ctx->tmp,ctx->tmp_len); |
| 417 | (unsigned char *)ctx->buf, | 435 | OPENSSL_assert(ctx->buf_len <= (int)sizeof(ctx->buf)); |
| 418 | (unsigned char *)ctx->tmp, | 436 | OPENSSL_assert(ctx->buf_len >= ctx->buf_off); |
| 419 | ctx->tmp_len); | ||
| 420 | /* Since we're now done using the temporary | 437 | /* Since we're now done using the temporary |
| 421 | buffer, the length should be 0'd */ | 438 | buffer, the length should be 0'd */ |
| 422 | ctx->tmp_len=0; | 439 | ctx->tmp_len=0; |
| @@ -425,14 +442,16 @@ static int b64_write(BIO *b, const char *in, int inl) | |||
| 425 | { | 442 | { |
| 426 | if (n < 3) | 443 | if (n < 3) |
| 427 | { | 444 | { |
| 428 | memcpy(&(ctx->tmp[0]),in,n); | 445 | memcpy(ctx->tmp,in,n); |
| 429 | ctx->tmp_len=n; | 446 | ctx->tmp_len=n; |
| 447 | ret += n; | ||
| 430 | break; | 448 | break; |
| 431 | } | 449 | } |
| 432 | n-=n%3; | 450 | n-=n%3; |
| 433 | ctx->buf_len=EVP_EncodeBlock( | 451 | ctx->buf_len=EVP_EncodeBlock((unsigned char *)ctx->buf,(const unsigned char *)in,n); |
| 434 | (unsigned char *)ctx->buf, | 452 | OPENSSL_assert(ctx->buf_len <= (int)sizeof(ctx->buf)); |
| 435 | (unsigned char *)in,n); | 453 | OPENSSL_assert(ctx->buf_len >= ctx->buf_off); |
| 454 | ret += n; | ||
| 436 | } | 455 | } |
| 437 | } | 456 | } |
| 438 | else | 457 | else |
| @@ -440,6 +459,9 @@ static int b64_write(BIO *b, const char *in, int inl) | |||
| 440 | EVP_EncodeUpdate(&(ctx->base64), | 459 | EVP_EncodeUpdate(&(ctx->base64), |
| 441 | (unsigned char *)ctx->buf,&ctx->buf_len, | 460 | (unsigned char *)ctx->buf,&ctx->buf_len, |
| 442 | (unsigned char *)in,n); | 461 | (unsigned char *)in,n); |
| 462 | OPENSSL_assert(ctx->buf_len <= (int)sizeof(ctx->buf)); | ||
| 463 | OPENSSL_assert(ctx->buf_len >= ctx->buf_off); | ||
| 464 | ret += n; | ||
| 443 | } | 465 | } |
| 444 | inl-=n; | 466 | inl-=n; |
| 445 | in+=n; | 467 | in+=n; |
| @@ -454,8 +476,11 @@ static int b64_write(BIO *b, const char *in, int inl) | |||
| 454 | BIO_copy_next_retry(b); | 476 | BIO_copy_next_retry(b); |
| 455 | return((ret == 0)?i:ret); | 477 | return((ret == 0)?i:ret); |
| 456 | } | 478 | } |
| 479 | OPENSSL_assert(i <= n); | ||
| 457 | n-=i; | 480 | n-=i; |
| 458 | ctx->buf_off+=i; | 481 | ctx->buf_off+=i; |
| 482 | OPENSSL_assert(ctx->buf_off <= (int)sizeof(ctx->buf)); | ||
| 483 | OPENSSL_assert(ctx->buf_len >= ctx->buf_off); | ||
| 459 | } | 484 | } |
| 460 | ctx->buf_len=0; | 485 | ctx->buf_len=0; |
| 461 | ctx->buf_off=0; | 486 | ctx->buf_off=0; |
| @@ -486,6 +511,7 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 486 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 511 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); |
| 487 | break; | 512 | break; |
| 488 | case BIO_CTRL_WPENDING: /* More to write in buffer */ | 513 | case BIO_CTRL_WPENDING: /* More to write in buffer */ |
| 514 | OPENSSL_assert(ctx->buf_len >= ctx->buf_off); | ||
| 489 | ret=ctx->buf_len-ctx->buf_off; | 515 | ret=ctx->buf_len-ctx->buf_off; |
| 490 | if ((ret == 0) && (ctx->encode != B64_NONE) | 516 | if ((ret == 0) && (ctx->encode != B64_NONE) |
| 491 | && (ctx->base64.num != 0)) | 517 | && (ctx->base64.num != 0)) |
| @@ -494,6 +520,7 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 494 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 520 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); |
| 495 | break; | 521 | break; |
| 496 | case BIO_CTRL_PENDING: /* More to read in buffer */ | 522 | case BIO_CTRL_PENDING: /* More to read in buffer */ |
| 523 | OPENSSL_assert(ctx->buf_len >= ctx->buf_off); | ||
| 497 | ret=ctx->buf_len-ctx->buf_off; | 524 | ret=ctx->buf_len-ctx->buf_off; |
| 498 | if (ret <= 0) | 525 | if (ret <= 0) |
| 499 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 526 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); |
| @@ -565,3 +592,7 @@ static long b64_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) | |||
| 565 | return(ret); | 592 | return(ret); |
| 566 | } | 593 | } |
| 567 | 594 | ||
| 595 | static int b64_puts(BIO *b, const char *str) | ||
| 596 | { | ||
| 597 | return b64_write(b,str,strlen(str)); | ||
| 598 | } | ||
diff --git a/src/lib/libcrypto/evp/bio_enc.c b/src/lib/libcrypto/evp/bio_enc.c index f6ac94c6e1..b6efb5fbc4 100644 --- a/src/lib/libcrypto/evp/bio_enc.c +++ b/src/lib/libcrypto/evp/bio_enc.c | |||
| @@ -361,8 +361,10 @@ again: | |||
| 361 | case BIO_CTRL_DUP: | 361 | case BIO_CTRL_DUP: |
| 362 | dbio=(BIO *)ptr; | 362 | dbio=(BIO *)ptr; |
| 363 | dctx=(BIO_ENC_CTX *)dbio->ptr; | 363 | dctx=(BIO_ENC_CTX *)dbio->ptr; |
| 364 | memcpy(&(dctx->cipher),&(ctx->cipher),sizeof(ctx->cipher)); | 364 | EVP_CIPHER_CTX_init(&dctx->cipher); |
| 365 | dbio->init=1; | 365 | ret = EVP_CIPHER_CTX_copy(&dctx->cipher,&ctx->cipher); |
| 366 | if (ret) | ||
| 367 | dbio->init=1; | ||
| 366 | break; | 368 | break; |
| 367 | default: | 369 | default: |
| 368 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 370 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); |
diff --git a/src/lib/libcrypto/evp/bio_md.c b/src/lib/libcrypto/evp/bio_md.c index ed5c1135fd..9841e32e1a 100644 --- a/src/lib/libcrypto/evp/bio_md.c +++ b/src/lib/libcrypto/evp/bio_md.c | |||
| @@ -130,8 +130,8 @@ static int md_read(BIO *b, char *out, int outl) | |||
| 130 | { | 130 | { |
| 131 | if (ret > 0) | 131 | if (ret > 0) |
| 132 | { | 132 | { |
| 133 | EVP_DigestUpdate(ctx,(unsigned char *)out, | 133 | if (EVP_DigestUpdate(ctx,(unsigned char *)out, |
| 134 | (unsigned int)ret); | 134 | (unsigned int)ret)<=0) return (-1); |
| 135 | } | 135 | } |
| 136 | } | 136 | } |
| 137 | BIO_clear_retry_flags(b); | 137 | BIO_clear_retry_flags(b); |
| @@ -157,8 +157,11 @@ static int md_write(BIO *b, const char *in, int inl) | |||
| 157 | (unsigned int)ret); | 157 | (unsigned int)ret); |
| 158 | } | 158 | } |
| 159 | } | 159 | } |
| 160 | BIO_clear_retry_flags(b); | 160 | if(b->next_bio != NULL) |
| 161 | BIO_copy_next_retry(b); | 161 | { |
| 162 | BIO_clear_retry_flags(b); | ||
| 163 | BIO_copy_next_retry(b); | ||
| 164 | } | ||
| 162 | return(ret); | 165 | return(ret); |
| 163 | } | 166 | } |
| 164 | 167 | ||
| @@ -194,6 +197,7 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 194 | case BIO_C_GET_MD_CTX: | 197 | case BIO_C_GET_MD_CTX: |
| 195 | pctx=ptr; | 198 | pctx=ptr; |
| 196 | *pctx=ctx; | 199 | *pctx=ctx; |
| 200 | b->init = 1; | ||
| 197 | break; | 201 | break; |
| 198 | case BIO_C_SET_MD_CTX: | 202 | case BIO_C_SET_MD_CTX: |
| 199 | if (b->init) | 203 | if (b->init) |
| @@ -249,7 +253,9 @@ static int md_gets(BIO *bp, char *buf, int size) | |||
| 249 | ctx=bp->ptr; | 253 | ctx=bp->ptr; |
| 250 | if (size < ctx->digest->md_size) | 254 | if (size < ctx->digest->md_size) |
| 251 | return(0); | 255 | return(0); |
| 252 | EVP_DigestFinal_ex(ctx,(unsigned char *)buf,&ret); | 256 | if (EVP_DigestFinal_ex(ctx,(unsigned char *)buf,&ret)<=0) |
| 257 | return -1; | ||
| 258 | |||
| 253 | return((int)ret); | 259 | return((int)ret); |
| 254 | } | 260 | } |
| 255 | 261 | ||
diff --git a/src/lib/libcrypto/evp/c_all.c b/src/lib/libcrypto/evp/c_all.c index a5da52e62d..766c4cecdf 100644 --- a/src/lib/libcrypto/evp/c_all.c +++ b/src/lib/libcrypto/evp/c_all.c | |||
| @@ -83,7 +83,7 @@ void OPENSSL_add_all_algorithms_noconf(void) | |||
| 83 | OpenSSL_add_all_ciphers(); | 83 | OpenSSL_add_all_ciphers(); |
| 84 | OpenSSL_add_all_digests(); | 84 | OpenSSL_add_all_digests(); |
| 85 | #ifndef OPENSSL_NO_ENGINE | 85 | #ifndef OPENSSL_NO_ENGINE |
| 86 | # if defined(__OpenBSD__) || defined(__FreeBSD__) | 86 | # if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) |
| 87 | ENGINE_setup_bsd_cryptodev(); | 87 | ENGINE_setup_bsd_cryptodev(); |
| 88 | # endif | 88 | # endif |
| 89 | #endif | 89 | #endif |
diff --git a/src/lib/libcrypto/evp/c_allc.c b/src/lib/libcrypto/evp/c_allc.c index 7054d8125d..c5f9268378 100644 --- a/src/lib/libcrypto/evp/c_allc.c +++ b/src/lib/libcrypto/evp/c_allc.c | |||
| @@ -71,6 +71,8 @@ void OpenSSL_add_all_ciphers(void) | |||
| 71 | EVP_add_cipher(EVP_des_cfb8()); | 71 | EVP_add_cipher(EVP_des_cfb8()); |
| 72 | EVP_add_cipher(EVP_des_ede_cfb()); | 72 | EVP_add_cipher(EVP_des_ede_cfb()); |
| 73 | EVP_add_cipher(EVP_des_ede3_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()); | ||
| 74 | 76 | ||
| 75 | EVP_add_cipher(EVP_des_ofb()); | 77 | EVP_add_cipher(EVP_des_ofb()); |
| 76 | EVP_add_cipher(EVP_des_ede_ofb()); | 78 | EVP_add_cipher(EVP_des_ede_ofb()); |
| @@ -219,7 +221,4 @@ void OpenSSL_add_all_ciphers(void) | |||
| 219 | EVP_add_cipher_alias(SN_camellia_256_cbc,"CAMELLIA256"); | 221 | EVP_add_cipher_alias(SN_camellia_256_cbc,"CAMELLIA256"); |
| 220 | EVP_add_cipher_alias(SN_camellia_256_cbc,"camellia256"); | 222 | EVP_add_cipher_alias(SN_camellia_256_cbc,"camellia256"); |
| 221 | #endif | 223 | #endif |
| 222 | |||
| 223 | PKCS12_PBE_add(); | ||
| 224 | PKCS5_PBE_add(); | ||
| 225 | } | 224 | } |
diff --git a/src/lib/libcrypto/evp/c_alld.c b/src/lib/libcrypto/evp/c_alld.c index d270b0ee03..311e1fe2f8 100644 --- a/src/lib/libcrypto/evp/c_alld.c +++ b/src/lib/libcrypto/evp/c_alld.c | |||
| @@ -64,9 +64,6 @@ | |||
| 64 | 64 | ||
| 65 | void OpenSSL_add_all_digests(void) | 65 | void OpenSSL_add_all_digests(void) |
| 66 | { | 66 | { |
| 67 | #ifndef OPENSSL_NO_MD2 | ||
| 68 | EVP_add_digest(EVP_md2()); | ||
| 69 | #endif | ||
| 70 | #ifndef OPENSSL_NO_MD4 | 67 | #ifndef OPENSSL_NO_MD4 |
| 71 | EVP_add_digest(EVP_md4()); | 68 | EVP_add_digest(EVP_md4()); |
| 72 | #endif | 69 | #endif |
| @@ -81,7 +78,7 @@ void OpenSSL_add_all_digests(void) | |||
| 81 | EVP_add_digest(EVP_dss()); | 78 | EVP_add_digest(EVP_dss()); |
| 82 | #endif | 79 | #endif |
| 83 | #endif | 80 | #endif |
| 84 | #ifndef OPENSSL_NO_SHA | 81 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) |
| 85 | EVP_add_digest(EVP_sha1()); | 82 | EVP_add_digest(EVP_sha1()); |
| 86 | EVP_add_digest_alias(SN_sha1,"ssl3-sha1"); | 83 | EVP_add_digest_alias(SN_sha1,"ssl3-sha1"); |
| 87 | EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA); | 84 | EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA); |
| @@ -111,4 +108,7 @@ void OpenSSL_add_all_digests(void) | |||
| 111 | EVP_add_digest(EVP_sha384()); | 108 | EVP_add_digest(EVP_sha384()); |
| 112 | EVP_add_digest(EVP_sha512()); | 109 | EVP_add_digest(EVP_sha512()); |
| 113 | #endif | 110 | #endif |
| 111 | #ifndef OPENSSL_NO_WHIRLPOOL | ||
| 112 | EVP_add_digest(EVP_whirlpool()); | ||
| 113 | #endif | ||
| 114 | } | 114 | } |
diff --git a/src/lib/libcrypto/evp/dig_eng.c b/src/lib/libcrypto/evp/dig_eng.c deleted file mode 100644 index 64cdf9366c..0000000000 --- a/src/lib/libcrypto/evp/dig_eng.c +++ /dev/null | |||
| @@ -1,180 +0,0 @@ | |||
| 1 | /* crypto/evp/digest.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 | #include <stdio.h> | ||
| 113 | #include "cryptlib.h" | ||
| 114 | #include <openssl/objects.h> | ||
| 115 | #include <openssl/evp.h> | ||
| 116 | #ifndef OPENSSL_NO_ENGINE | ||
| 117 | #include <openssl/engine.h> | ||
| 118 | #endif | ||
| 119 | #include "evp_locl.h" | ||
| 120 | |||
| 121 | #ifndef OPENSSL_NO_ENGINE | ||
| 122 | |||
| 123 | #ifdef OPENSSL_FIPS | ||
| 124 | |||
| 125 | static int do_evp_md_engine_full(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl) | ||
| 126 | { | ||
| 127 | if (*ptype) | ||
| 128 | { | ||
| 129 | /* Ensure an ENGINE left lying around from last time is cleared | ||
| 130 | * (the previous check attempted to avoid this if the same | ||
| 131 | * ENGINE and EVP_MD could be used). */ | ||
| 132 | if(ctx->engine) | ||
| 133 | ENGINE_finish(ctx->engine); | ||
| 134 | if(impl) | ||
| 135 | { | ||
| 136 | if (!ENGINE_init(impl)) | ||
| 137 | { | ||
| 138 | EVPerr(EVP_F_DO_EVP_MD_ENGINE_FULL,EVP_R_INITIALIZATION_ERROR); | ||
| 139 | return 0; | ||
| 140 | } | ||
| 141 | } | ||
| 142 | else | ||
| 143 | /* Ask if an ENGINE is reserved for this job */ | ||
| 144 | impl = ENGINE_get_digest_engine((*ptype)->type); | ||
| 145 | if(impl) | ||
| 146 | { | ||
| 147 | /* There's an ENGINE for this job ... (apparently) */ | ||
| 148 | const EVP_MD *d = ENGINE_get_digest(impl, (*ptype)->type); | ||
| 149 | if(!d) | ||
| 150 | { | ||
| 151 | /* Same comment from evp_enc.c */ | ||
| 152 | EVPerr(EVP_F_DO_EVP_MD_ENGINE_FULL,EVP_R_INITIALIZATION_ERROR); | ||
| 153 | return 0; | ||
| 154 | } | ||
| 155 | /* We'll use the ENGINE's private digest definition */ | ||
| 156 | *ptype = d; | ||
| 157 | /* Store the ENGINE functional reference so we know | ||
| 158 | * 'type' came from an ENGINE and we need to release | ||
| 159 | * it when done. */ | ||
| 160 | ctx->engine = impl; | ||
| 161 | } | ||
| 162 | else | ||
| 163 | ctx->engine = NULL; | ||
| 164 | } | ||
| 165 | else | ||
| 166 | if(!ctx->digest) | ||
| 167 | { | ||
| 168 | EVPerr(EVP_F_DO_EVP_MD_ENGINE_FULL,EVP_R_NO_DIGEST_SET); | ||
| 169 | return 0; | ||
| 170 | } | ||
| 171 | return 1; | ||
| 172 | } | ||
| 173 | |||
| 174 | void int_EVP_MD_init_engine_callbacks(void) | ||
| 175 | { | ||
| 176 | int_EVP_MD_set_engine_callbacks( | ||
| 177 | ENGINE_init, ENGINE_finish, do_evp_md_engine_full); | ||
| 178 | } | ||
| 179 | #endif | ||
| 180 | #endif | ||
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c index 3bc2d1295c..982ba2b136 100644 --- a/src/lib/libcrypto/evp/digest.c +++ b/src/lib/libcrypto/evp/digest.c | |||
| @@ -116,7 +116,6 @@ | |||
| 116 | #ifndef OPENSSL_NO_ENGINE | 116 | #ifndef OPENSSL_NO_ENGINE |
| 117 | #include <openssl/engine.h> | 117 | #include <openssl/engine.h> |
| 118 | #endif | 118 | #endif |
| 119 | #include "evp_locl.h" | ||
| 120 | 119 | ||
| 121 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx) | 120 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx) |
| 122 | { | 121 | { |
| @@ -127,7 +126,8 @@ EVP_MD_CTX *EVP_MD_CTX_create(void) | |||
| 127 | { | 126 | { |
| 128 | EVP_MD_CTX *ctx=OPENSSL_malloc(sizeof *ctx); | 127 | EVP_MD_CTX *ctx=OPENSSL_malloc(sizeof *ctx); |
| 129 | 128 | ||
| 130 | EVP_MD_CTX_init(ctx); | 129 | if (ctx) |
| 130 | EVP_MD_CTX_init(ctx); | ||
| 131 | 131 | ||
| 132 | return ctx; | 132 | return ctx; |
| 133 | } | 133 | } |
| @@ -138,77 +138,18 @@ int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) | |||
| 138 | return EVP_DigestInit_ex(ctx, type, NULL); | 138 | return EVP_DigestInit_ex(ctx, type, NULL); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | #ifdef OPENSSL_FIPS | 141 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) |
| 142 | |||
| 143 | /* The purpose of these is to trap programs that attempt to use non FIPS | ||
| 144 | * algorithms in FIPS mode and ignore the errors. | ||
| 145 | */ | ||
| 146 | |||
| 147 | static int bad_init(EVP_MD_CTX *ctx) | ||
| 148 | { FIPS_ERROR_IGNORED("Digest init"); return 0;} | ||
| 149 | |||
| 150 | static int bad_update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 151 | { FIPS_ERROR_IGNORED("Digest update"); return 0;} | ||
| 152 | |||
| 153 | static int bad_final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 154 | { FIPS_ERROR_IGNORED("Digest Final"); return 0;} | ||
| 155 | |||
| 156 | static const EVP_MD bad_md = | ||
| 157 | { | 142 | { |
| 158 | 0, | 143 | EVP_MD_CTX_clear_flags(ctx,EVP_MD_CTX_FLAG_CLEANED); |
| 159 | 0, | ||
| 160 | 0, | ||
| 161 | 0, | ||
| 162 | bad_init, | ||
| 163 | bad_update, | ||
| 164 | bad_final, | ||
| 165 | NULL, | ||
| 166 | NULL, | ||
| 167 | NULL, | ||
| 168 | 0, | ||
| 169 | {0,0,0,0}, | ||
| 170 | }; | ||
| 171 | |||
| 172 | #endif | ||
| 173 | |||
| 174 | #ifndef OPENSSL_NO_ENGINE | 144 | #ifndef OPENSSL_NO_ENGINE |
| 175 | 145 | /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts | |
| 176 | #ifdef OPENSSL_FIPS | 146 | * so this context may already have an ENGINE! Try to avoid releasing |
| 177 | 147 | * the previous handle, re-querying for an ENGINE, and having a | |
| 178 | static int do_engine_null(ENGINE *impl) { return 0;} | 148 | * reinitialisation, when it may all be unecessary. */ |
| 179 | static int do_evp_md_engine_null(EVP_MD_CTX *ctx, | 149 | if (ctx->engine && ctx->digest && (!type || |
| 180 | const EVP_MD **ptype, ENGINE *impl) | 150 | (type && (type->type == ctx->digest->type)))) |
| 181 | { return 1; } | 151 | goto skip_to_init; |
| 182 | 152 | if (type) | |
| 183 | static int (*do_engine_init)(ENGINE *impl) | ||
| 184 | = do_engine_null; | ||
| 185 | |||
| 186 | static int (*do_engine_finish)(ENGINE *impl) | ||
| 187 | = do_engine_null; | ||
| 188 | |||
| 189 | static int (*do_evp_md_engine) | ||
| 190 | (EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl) | ||
| 191 | = do_evp_md_engine_null; | ||
| 192 | |||
| 193 | void int_EVP_MD_set_engine_callbacks( | ||
| 194 | int (*eng_md_init)(ENGINE *impl), | ||
| 195 | int (*eng_md_fin)(ENGINE *impl), | ||
| 196 | int (*eng_md_evp) | ||
| 197 | (EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl)) | ||
| 198 | { | ||
| 199 | do_engine_init = eng_md_init; | ||
| 200 | do_engine_finish = eng_md_fin; | ||
| 201 | do_evp_md_engine = eng_md_evp; | ||
| 202 | } | ||
| 203 | |||
| 204 | #else | ||
| 205 | |||
| 206 | #define do_engine_init ENGINE_init | ||
| 207 | #define do_engine_finish ENGINE_finish | ||
| 208 | |||
| 209 | static int do_evp_md_engine(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl) | ||
| 210 | { | ||
| 211 | if (*ptype) | ||
| 212 | { | 153 | { |
| 213 | /* Ensure an ENGINE left lying around from last time is cleared | 154 | /* Ensure an ENGINE left lying around from last time is cleared |
| 214 | * (the previous check attempted to avoid this if the same | 155 | * (the previous check attempted to avoid this if the same |
| @@ -219,25 +160,26 @@ static int do_evp_md_engine(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl) | |||
| 219 | { | 160 | { |
| 220 | if (!ENGINE_init(impl)) | 161 | if (!ENGINE_init(impl)) |
| 221 | { | 162 | { |
| 222 | EVPerr(EVP_F_DO_EVP_MD_ENGINE,EVP_R_INITIALIZATION_ERROR); | 163 | EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_INITIALIZATION_ERROR); |
| 223 | return 0; | 164 | return 0; |
| 224 | } | 165 | } |
| 225 | } | 166 | } |
| 226 | else | 167 | else |
| 227 | /* Ask if an ENGINE is reserved for this job */ | 168 | /* Ask if an ENGINE is reserved for this job */ |
| 228 | impl = ENGINE_get_digest_engine((*ptype)->type); | 169 | impl = ENGINE_get_digest_engine(type->type); |
| 229 | if(impl) | 170 | if(impl) |
| 230 | { | 171 | { |
| 231 | /* There's an ENGINE for this job ... (apparently) */ | 172 | /* There's an ENGINE for this job ... (apparently) */ |
| 232 | const EVP_MD *d = ENGINE_get_digest(impl, (*ptype)->type); | 173 | const EVP_MD *d = ENGINE_get_digest(impl, type->type); |
| 233 | if(!d) | 174 | if(!d) |
| 234 | { | 175 | { |
| 235 | /* Same comment from evp_enc.c */ | 176 | /* Same comment from evp_enc.c */ |
| 236 | EVPerr(EVP_F_DO_EVP_MD_ENGINE,EVP_R_INITIALIZATION_ERROR); | 177 | EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_INITIALIZATION_ERROR); |
| 178 | ENGINE_finish(impl); | ||
| 237 | return 0; | 179 | return 0; |
| 238 | } | 180 | } |
| 239 | /* We'll use the ENGINE's private digest definition */ | 181 | /* We'll use the ENGINE's private digest definition */ |
| 240 | *ptype = d; | 182 | type = d; |
| 241 | /* Store the ENGINE functional reference so we know | 183 | /* Store the ENGINE functional reference so we know |
| 242 | * 'type' came from an ENGINE and we need to release | 184 | * 'type' came from an ENGINE and we need to release |
| 243 | * it when done. */ | 185 | * it when done. */ |
| @@ -249,71 +191,46 @@ static int do_evp_md_engine(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl) | |||
| 249 | else | 191 | else |
| 250 | if(!ctx->digest) | 192 | if(!ctx->digest) |
| 251 | { | 193 | { |
| 252 | EVPerr(EVP_F_DO_EVP_MD_ENGINE,EVP_R_NO_DIGEST_SET); | 194 | EVPerr(EVP_F_EVP_DIGESTINIT_EX,EVP_R_NO_DIGEST_SET); |
| 253 | return 0; | 195 | return 0; |
| 254 | } | 196 | } |
| 255 | return 1; | ||
| 256 | } | ||
| 257 | |||
| 258 | #endif | ||
| 259 | |||
| 260 | #endif | ||
| 261 | |||
| 262 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | ||
| 263 | { | ||
| 264 | M_EVP_MD_CTX_clear_flags(ctx,EVP_MD_CTX_FLAG_CLEANED); | ||
| 265 | #ifdef OPENSSL_FIPS | ||
| 266 | if(FIPS_selftest_failed()) | ||
| 267 | { | ||
| 268 | FIPSerr(FIPS_F_EVP_DIGESTINIT_EX,FIPS_R_FIPS_SELFTEST_FAILED); | ||
| 269 | ctx->digest = &bad_md; | ||
| 270 | return 0; | ||
| 271 | } | ||
| 272 | #endif | ||
| 273 | #ifndef OPENSSL_NO_ENGINE | ||
| 274 | /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts | ||
| 275 | * so this context may already have an ENGINE! Try to avoid releasing | ||
| 276 | * the previous handle, re-querying for an ENGINE, and having a | ||
| 277 | * reinitialisation, when it may all be unecessary. */ | ||
| 278 | if (ctx->engine && ctx->digest && (!type || | ||
| 279 | (type && (type->type == ctx->digest->type)))) | ||
| 280 | goto skip_to_init; | ||
| 281 | if (!do_evp_md_engine(ctx, &type, impl)) | ||
| 282 | return 0; | ||
| 283 | #endif | 197 | #endif |
| 284 | if (ctx->digest != type) | 198 | if (ctx->digest != type) |
| 285 | { | 199 | { |
| 286 | #ifdef OPENSSL_FIPS | 200 | if (ctx->digest && ctx->digest->ctx_size) |
| 287 | if (FIPS_mode()) | 201 | OPENSSL_free(ctx->md_data); |
| 202 | ctx->digest=type; | ||
| 203 | if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) | ||
| 288 | { | 204 | { |
| 289 | if (!(type->flags & EVP_MD_FLAG_FIPS) | 205 | ctx->update = type->update; |
| 290 | && !(ctx->flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)) | 206 | ctx->md_data=OPENSSL_malloc(type->ctx_size); |
| 207 | if (ctx->md_data == NULL) | ||
| 291 | { | 208 | { |
| 292 | EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_DISABLED_FOR_FIPS); | 209 | EVPerr(EVP_F_EVP_DIGESTINIT_EX, |
| 293 | ctx->digest = &bad_md; | 210 | ERR_R_MALLOC_FAILURE); |
| 294 | return 0; | 211 | return 0; |
| 295 | } | 212 | } |
| 296 | } | 213 | } |
| 297 | #endif | ||
| 298 | if (ctx->digest && ctx->digest->ctx_size) | ||
| 299 | OPENSSL_free(ctx->md_data); | ||
| 300 | ctx->digest=type; | ||
| 301 | if (type->ctx_size) | ||
| 302 | ctx->md_data=OPENSSL_malloc(type->ctx_size); | ||
| 303 | } | 214 | } |
| 304 | #ifndef OPENSSL_NO_ENGINE | 215 | #ifndef OPENSSL_NO_ENGINE |
| 305 | skip_to_init: | 216 | skip_to_init: |
| 306 | #endif | 217 | #endif |
| 218 | if (ctx->pctx) | ||
| 219 | { | ||
| 220 | int r; | ||
| 221 | r = EVP_PKEY_CTX_ctrl(ctx->pctx, -1, EVP_PKEY_OP_TYPE_SIG, | ||
| 222 | EVP_PKEY_CTRL_DIGESTINIT, 0, ctx); | ||
| 223 | if (r <= 0 && (r != -2)) | ||
| 224 | return 0; | ||
| 225 | } | ||
| 226 | if (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) | ||
| 227 | return 1; | ||
| 307 | return ctx->digest->init(ctx); | 228 | return ctx->digest->init(ctx); |
| 308 | } | 229 | } |
| 309 | 230 | ||
| 310 | int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, | 231 | int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) |
| 311 | size_t count) | ||
| 312 | { | 232 | { |
| 313 | #ifdef OPENSSL_FIPS | 233 | return ctx->update(ctx,data,count); |
| 314 | FIPS_selftest_check(); | ||
| 315 | #endif | ||
| 316 | return ctx->digest->update(ctx,data,count); | ||
| 317 | } | 234 | } |
| 318 | 235 | ||
| 319 | /* The caller can assume that this removes any secret data from the context */ | 236 | /* The caller can assume that this removes any secret data from the context */ |
| @@ -329,9 +246,6 @@ int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | |||
| 329 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | 246 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) |
| 330 | { | 247 | { |
| 331 | int ret; | 248 | int ret; |
| 332 | #ifdef OPENSSL_FIPS | ||
| 333 | FIPS_selftest_check(); | ||
| 334 | #endif | ||
| 335 | 249 | ||
| 336 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); | 250 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); |
| 337 | ret=ctx->digest->final(ctx,md); | 251 | ret=ctx->digest->final(ctx,md); |
| @@ -340,7 +254,7 @@ int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | |||
| 340 | if (ctx->digest->cleanup) | 254 | if (ctx->digest->cleanup) |
| 341 | { | 255 | { |
| 342 | ctx->digest->cleanup(ctx); | 256 | ctx->digest->cleanup(ctx); |
| 343 | M_EVP_MD_CTX_set_flags(ctx,EVP_MD_CTX_FLAG_CLEANED); | 257 | EVP_MD_CTX_set_flags(ctx,EVP_MD_CTX_FLAG_CLEANED); |
| 344 | } | 258 | } |
| 345 | memset(ctx->md_data,0,ctx->digest->ctx_size); | 259 | memset(ctx->md_data,0,ctx->digest->ctx_size); |
| 346 | return ret; | 260 | return ret; |
| @@ -362,7 +276,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) | |||
| 362 | } | 276 | } |
| 363 | #ifndef OPENSSL_NO_ENGINE | 277 | #ifndef OPENSSL_NO_ENGINE |
| 364 | /* Make sure it's safe to copy a digest context using an ENGINE */ | 278 | /* Make sure it's safe to copy a digest context using an ENGINE */ |
| 365 | if (in->engine && !do_engine_init(in->engine)) | 279 | if (in->engine && !ENGINE_init(in->engine)) |
| 366 | { | 280 | { |
| 367 | EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_ENGINE_LIB); | 281 | EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_ENGINE_LIB); |
| 368 | return 0; | 282 | return 0; |
| @@ -372,19 +286,40 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) | |||
| 372 | if (out->digest == in->digest) | 286 | if (out->digest == in->digest) |
| 373 | { | 287 | { |
| 374 | tmp_buf = out->md_data; | 288 | tmp_buf = out->md_data; |
| 375 | M_EVP_MD_CTX_set_flags(out,EVP_MD_CTX_FLAG_REUSE); | 289 | EVP_MD_CTX_set_flags(out,EVP_MD_CTX_FLAG_REUSE); |
| 376 | } | 290 | } |
| 377 | else tmp_buf = NULL; | 291 | else tmp_buf = NULL; |
| 378 | EVP_MD_CTX_cleanup(out); | 292 | EVP_MD_CTX_cleanup(out); |
| 379 | memcpy(out,in,sizeof *out); | 293 | memcpy(out,in,sizeof *out); |
| 380 | 294 | ||
| 381 | if (out->digest->ctx_size) | 295 | if (in->md_data && out->digest->ctx_size) |
| 382 | { | 296 | { |
| 383 | if (tmp_buf) out->md_data = tmp_buf; | 297 | if (tmp_buf) |
| 384 | else out->md_data=OPENSSL_malloc(out->digest->ctx_size); | 298 | out->md_data = tmp_buf; |
| 299 | else | ||
| 300 | { | ||
| 301 | out->md_data=OPENSSL_malloc(out->digest->ctx_size); | ||
| 302 | if (!out->md_data) | ||
| 303 | { | ||
| 304 | EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_MALLOC_FAILURE); | ||
| 305 | return 0; | ||
| 306 | } | ||
| 307 | } | ||
| 385 | memcpy(out->md_data,in->md_data,out->digest->ctx_size); | 308 | memcpy(out->md_data,in->md_data,out->digest->ctx_size); |
| 386 | } | 309 | } |
| 387 | 310 | ||
| 311 | out->update = in->update; | ||
| 312 | |||
| 313 | if (in->pctx) | ||
| 314 | { | ||
| 315 | out->pctx = EVP_PKEY_CTX_dup(in->pctx); | ||
| 316 | if (!out->pctx) | ||
| 317 | { | ||
| 318 | EVP_MD_CTX_cleanup(out); | ||
| 319 | return 0; | ||
| 320 | } | ||
| 321 | } | ||
| 322 | |||
| 388 | if (out->digest->copy) | 323 | if (out->digest->copy) |
| 389 | return out->digest->copy(out,in); | 324 | return out->digest->copy(out,in); |
| 390 | 325 | ||
| @@ -398,7 +333,7 @@ int EVP_Digest(const void *data, size_t count, | |||
| 398 | int ret; | 333 | int ret; |
| 399 | 334 | ||
| 400 | EVP_MD_CTX_init(&ctx); | 335 | EVP_MD_CTX_init(&ctx); |
| 401 | M_EVP_MD_CTX_set_flags(&ctx,EVP_MD_CTX_FLAG_ONESHOT); | 336 | EVP_MD_CTX_set_flags(&ctx,EVP_MD_CTX_FLAG_ONESHOT); |
| 402 | ret=EVP_DigestInit_ex(&ctx, type, impl) | 337 | ret=EVP_DigestInit_ex(&ctx, type, impl) |
| 403 | && EVP_DigestUpdate(&ctx, data, count) | 338 | && EVP_DigestUpdate(&ctx, data, count) |
| 404 | && EVP_DigestFinal_ex(&ctx, md, size); | 339 | && EVP_DigestFinal_ex(&ctx, md, size); |
| @@ -420,19 +355,21 @@ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) | |||
| 420 | * because sometimes only copies of the context are ever finalised. | 355 | * because sometimes only copies of the context are ever finalised. |
| 421 | */ | 356 | */ |
| 422 | if (ctx->digest && ctx->digest->cleanup | 357 | if (ctx->digest && ctx->digest->cleanup |
| 423 | && !M_EVP_MD_CTX_test_flags(ctx,EVP_MD_CTX_FLAG_CLEANED)) | 358 | && !EVP_MD_CTX_test_flags(ctx,EVP_MD_CTX_FLAG_CLEANED)) |
| 424 | ctx->digest->cleanup(ctx); | 359 | ctx->digest->cleanup(ctx); |
| 425 | if (ctx->digest && ctx->digest->ctx_size && ctx->md_data | 360 | if (ctx->digest && ctx->digest->ctx_size && ctx->md_data |
| 426 | && !M_EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) | 361 | && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) |
| 427 | { | 362 | { |
| 428 | OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size); | 363 | OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size); |
| 429 | OPENSSL_free(ctx->md_data); | 364 | OPENSSL_free(ctx->md_data); |
| 430 | } | 365 | } |
| 366 | if (ctx->pctx) | ||
| 367 | EVP_PKEY_CTX_free(ctx->pctx); | ||
| 431 | #ifndef OPENSSL_NO_ENGINE | 368 | #ifndef OPENSSL_NO_ENGINE |
| 432 | if(ctx->engine) | 369 | if(ctx->engine) |
| 433 | /* The EVP_MD we used belongs to an ENGINE, release the | 370 | /* The EVP_MD we used belongs to an ENGINE, release the |
| 434 | * functional reference we held for this reason. */ | 371 | * functional reference we held for this reason. */ |
| 435 | do_engine_finish(ctx->engine); | 372 | ENGINE_finish(ctx->engine); |
| 436 | #endif | 373 | #endif |
| 437 | memset(ctx,'\0',sizeof *ctx); | 374 | memset(ctx,'\0',sizeof *ctx); |
| 438 | 375 | ||
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index c9a5ee8d75..bd6c0a3a62 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c | |||
| @@ -69,29 +69,32 @@ typedef struct | |||
| 69 | 69 | ||
| 70 | IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY, | 70 | IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY, |
| 71 | NID_aes_128, 16, 16, 16, 128, | 71 | NID_aes_128, 16, 16, 16, 128, |
| 72 | EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1, | 72 | 0, aes_init_key, NULL, |
| 73 | aes_init_key, | 73 | EVP_CIPHER_set_asn1_iv, |
| 74 | NULL, NULL, NULL, NULL) | 74 | EVP_CIPHER_get_asn1_iv, |
| 75 | NULL) | ||
| 75 | IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY, | 76 | IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY, |
| 76 | NID_aes_192, 16, 24, 16, 128, | 77 | NID_aes_192, 16, 24, 16, 128, |
| 77 | EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1, | 78 | 0, aes_init_key, NULL, |
| 78 | aes_init_key, | 79 | EVP_CIPHER_set_asn1_iv, |
| 79 | NULL, NULL, NULL, NULL) | 80 | EVP_CIPHER_get_asn1_iv, |
| 81 | NULL) | ||
| 80 | IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY, | 82 | IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY, |
| 81 | NID_aes_256, 16, 32, 16, 128, | 83 | NID_aes_256, 16, 32, 16, 128, |
| 82 | EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1, | 84 | 0, aes_init_key, NULL, |
| 83 | aes_init_key, | 85 | EVP_CIPHER_set_asn1_iv, |
| 84 | NULL, NULL, NULL, NULL) | 86 | EVP_CIPHER_get_asn1_iv, |
| 87 | NULL) | ||
| 85 | 88 | ||
| 86 | #define IMPLEMENT_AES_CFBR(ksize,cbits,flags) IMPLEMENT_CFBR(aes,AES,EVP_AES_KEY,ks,ksize,cbits,16,flags) | 89 | #define IMPLEMENT_AES_CFBR(ksize,cbits) IMPLEMENT_CFBR(aes,AES,EVP_AES_KEY,ks,ksize,cbits,16) |
| 87 | 90 | ||
| 88 | IMPLEMENT_AES_CFBR(128,1,EVP_CIPH_FLAG_FIPS) | 91 | IMPLEMENT_AES_CFBR(128,1) |
| 89 | IMPLEMENT_AES_CFBR(192,1,EVP_CIPH_FLAG_FIPS) | 92 | IMPLEMENT_AES_CFBR(192,1) |
| 90 | IMPLEMENT_AES_CFBR(256,1,EVP_CIPH_FLAG_FIPS) | 93 | IMPLEMENT_AES_CFBR(256,1) |
| 91 | 94 | ||
| 92 | IMPLEMENT_AES_CFBR(128,8,EVP_CIPH_FLAG_FIPS) | 95 | IMPLEMENT_AES_CFBR(128,8) |
| 93 | IMPLEMENT_AES_CFBR(192,8,EVP_CIPH_FLAG_FIPS) | 96 | IMPLEMENT_AES_CFBR(192,8) |
| 94 | IMPLEMENT_AES_CFBR(256,8,EVP_CIPH_FLAG_FIPS) | 97 | IMPLEMENT_AES_CFBR(256,8) |
| 95 | 98 | ||
| 96 | static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 99 | static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 97 | const unsigned char *iv, int enc) | 100 | const unsigned char *iv, int enc) |
diff --git a/src/lib/libcrypto/evp/e_des.c b/src/lib/libcrypto/evp/e_des.c index 04376df232..ca009f2c52 100644 --- a/src/lib/libcrypto/evp/e_des.c +++ b/src/lib/libcrypto/evp/e_des.c | |||
| @@ -72,7 +72,7 @@ static int des_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); | |||
| 72 | /* Because of various casts and different names can't use IMPLEMENT_BLOCK_CIPHER */ | 72 | /* Because of various casts and different names can't use IMPLEMENT_BLOCK_CIPHER */ |
| 73 | 73 | ||
| 74 | static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 74 | static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 75 | const unsigned char *in, unsigned int inl) | 75 | const unsigned char *in, size_t inl) |
| 76 | { | 76 | { |
| 77 | BLOCK_CIPHER_ecb_loop() | 77 | BLOCK_CIPHER_ecb_loop() |
| 78 | DES_ecb_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i), ctx->cipher_data, ctx->encrypt); | 78 | DES_ecb_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i), ctx->cipher_data, ctx->encrypt); |
| @@ -80,24 +80,52 @@ static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 82 | static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 83 | const unsigned char *in, unsigned int inl) | 83 | const unsigned char *in, size_t inl) |
| 84 | { | 84 | { |
| 85 | DES_ofb64_encrypt(in, out, (long)inl, ctx->cipher_data, (DES_cblock *)ctx->iv, &ctx->num); | 85 | while(inl>=EVP_MAXCHUNK) |
| 86 | { | ||
| 87 | DES_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, ctx->cipher_data, | ||
| 88 | (DES_cblock *)ctx->iv, &ctx->num); | ||
| 89 | inl-=EVP_MAXCHUNK; | ||
| 90 | in +=EVP_MAXCHUNK; | ||
| 91 | out+=EVP_MAXCHUNK; | ||
| 92 | } | ||
| 93 | if (inl) | ||
| 94 | DES_ofb64_encrypt(in, out, (long)inl, ctx->cipher_data, | ||
| 95 | (DES_cblock *)ctx->iv, &ctx->num); | ||
| 86 | return 1; | 96 | return 1; |
| 87 | } | 97 | } |
| 88 | 98 | ||
| 89 | static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 99 | static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 90 | const unsigned char *in, unsigned int inl) | 100 | const unsigned char *in, size_t inl) |
| 91 | { | 101 | { |
| 92 | DES_ncbc_encrypt(in, out, (long)inl, ctx->cipher_data, | 102 | while(inl>=EVP_MAXCHUNK) |
| 93 | (DES_cblock *)ctx->iv, ctx->encrypt); | 103 | { |
| 104 | DES_ncbc_encrypt(in, out, (long)EVP_MAXCHUNK, ctx->cipher_data, | ||
| 105 | (DES_cblock *)ctx->iv, ctx->encrypt); | ||
| 106 | inl-=EVP_MAXCHUNK; | ||
| 107 | in +=EVP_MAXCHUNK; | ||
| 108 | out+=EVP_MAXCHUNK; | ||
| 109 | } | ||
| 110 | if (inl) | ||
| 111 | DES_ncbc_encrypt(in, out, (long)inl, ctx->cipher_data, | ||
| 112 | (DES_cblock *)ctx->iv, ctx->encrypt); | ||
| 94 | return 1; | 113 | return 1; |
| 95 | } | 114 | } |
| 96 | 115 | ||
| 97 | static int des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 116 | static int des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 98 | const unsigned char *in, unsigned int inl) | 117 | const unsigned char *in, size_t inl) |
| 99 | { | 118 | { |
| 100 | DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data, | 119 | while(inl>=EVP_MAXCHUNK) |
| 120 | { | ||
| 121 | DES_cfb64_encrypt(in,out, (long)EVP_MAXCHUNK, ctx->cipher_data, | ||
| 122 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); | ||
| 123 | inl-=EVP_MAXCHUNK; | ||
| 124 | in +=EVP_MAXCHUNK; | ||
| 125 | out+=EVP_MAXCHUNK; | ||
| 126 | } | ||
| 127 | if (inl) | ||
| 128 | DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data, | ||
| 101 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); | 129 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); |
| 102 | return 1; | 130 | return 1; |
| 103 | } | 131 | } |
| @@ -105,45 +133,62 @@ static int des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 105 | /* Although we have a CFB-r implementation for DES, it doesn't pack the right | 133 | /* Although we have a CFB-r implementation for DES, it doesn't pack the right |
| 106 | way, so wrap it here */ | 134 | way, so wrap it here */ |
| 107 | static int des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 135 | static int des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 108 | const unsigned char *in, unsigned int inl) | 136 | const unsigned char *in, size_t inl) |
| 109 | { | 137 | { |
| 110 | unsigned int n; | 138 | size_t n,chunk=EVP_MAXCHUNK/8; |
| 111 | unsigned char c[1],d[1]; | 139 | unsigned char c[1],d[1]; |
| 112 | 140 | ||
| 113 | for(n=0 ; n < inl ; ++n) | 141 | if (inl<chunk) chunk=inl; |
| 142 | |||
| 143 | while (inl && inl>=chunk) | ||
| 114 | { | 144 | { |
| 115 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | 145 | for(n=0 ; n < chunk*8; ++n) |
| 116 | DES_cfb_encrypt(c,d,1,1,ctx->cipher_data,(DES_cblock *)ctx->iv, | 146 | { |
| 147 | c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0; | ||
| 148 | DES_cfb_encrypt(c,d,1,1,ctx->cipher_data,(DES_cblock *)ctx->iv, | ||
| 117 | ctx->encrypt); | 149 | ctx->encrypt); |
| 118 | out[n/8]=(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8)); | 150 | out[n/8]=(out[n/8]&~(0x80 >> (unsigned int)(n%8))) | |
| 151 | ((d[0]&0x80) >> (unsigned int)(n%8)); | ||
| 152 | } | ||
| 153 | inl-=chunk; | ||
| 154 | in +=chunk; | ||
| 155 | out+=chunk; | ||
| 156 | if (inl<chunk) chunk=inl; | ||
| 119 | } | 157 | } |
| 158 | |||
| 120 | return 1; | 159 | return 1; |
| 121 | } | 160 | } |
| 122 | 161 | ||
| 123 | static int des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 162 | static int des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 124 | const unsigned char *in, unsigned int inl) | 163 | const unsigned char *in, size_t inl) |
| 125 | { | 164 | { |
| 126 | DES_cfb_encrypt(in,out,8,inl,ctx->cipher_data,(DES_cblock *)ctx->iv, | 165 | while (inl>=EVP_MAXCHUNK) |
| 127 | ctx->encrypt); | 166 | { |
| 167 | DES_cfb_encrypt(in,out,8,(long)EVP_MAXCHUNK,ctx->cipher_data, | ||
| 168 | (DES_cblock *)ctx->iv,ctx->encrypt); | ||
| 169 | inl-=EVP_MAXCHUNK; | ||
| 170 | in +=EVP_MAXCHUNK; | ||
| 171 | out+=EVP_MAXCHUNK; | ||
| 172 | } | ||
| 173 | if (inl) | ||
| 174 | DES_cfb_encrypt(in,out,8,(long)inl,ctx->cipher_data, | ||
| 175 | (DES_cblock *)ctx->iv,ctx->encrypt); | ||
| 128 | return 1; | 176 | return 1; |
| 129 | } | 177 | } |
| 130 | 178 | ||
| 131 | BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64, | 179 | BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64, |
| 132 | EVP_CIPH_RAND_KEY, | 180 | EVP_CIPH_RAND_KEY, des_init_key, NULL, |
| 133 | des_init_key, NULL, | ||
| 134 | EVP_CIPHER_set_asn1_iv, | 181 | EVP_CIPHER_set_asn1_iv, |
| 135 | EVP_CIPHER_get_asn1_iv, | 182 | EVP_CIPHER_get_asn1_iv, |
| 136 | des_ctrl) | 183 | des_ctrl) |
| 137 | 184 | ||
| 138 | BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,1, | 185 | BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,1, |
| 139 | EVP_CIPH_RAND_KEY, | 186 | EVP_CIPH_RAND_KEY, des_init_key,NULL, |
| 140 | des_init_key, NULL, | ||
| 141 | EVP_CIPHER_set_asn1_iv, | 187 | EVP_CIPHER_set_asn1_iv, |
| 142 | EVP_CIPHER_get_asn1_iv,des_ctrl) | 188 | EVP_CIPHER_get_asn1_iv,des_ctrl) |
| 143 | 189 | ||
| 144 | BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,8, | 190 | BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,8, |
| 145 | EVP_CIPH_RAND_KEY, | 191 | EVP_CIPH_RAND_KEY,des_init_key,NULL, |
| 146 | des_init_key,NULL, | ||
| 147 | EVP_CIPHER_set_asn1_iv, | 192 | EVP_CIPHER_set_asn1_iv, |
| 148 | EVP_CIPHER_get_asn1_iv,des_ctrl) | 193 | EVP_CIPHER_get_asn1_iv,des_ctrl) |
| 149 | 194 | ||
diff --git a/src/lib/libcrypto/evp/e_des3.c b/src/lib/libcrypto/evp/e_des3.c index f910af19b1..3232cfe024 100644 --- a/src/lib/libcrypto/evp/e_des3.c +++ b/src/lib/libcrypto/evp/e_des3.c | |||
| @@ -85,7 +85,7 @@ typedef struct | |||
| 85 | /* Because of various casts and different args can't use IMPLEMENT_BLOCK_CIPHER */ | 85 | /* Because of various casts and different args can't use IMPLEMENT_BLOCK_CIPHER */ |
| 86 | 86 | ||
| 87 | static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 87 | static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 88 | const unsigned char *in, unsigned int inl) | 88 | const unsigned char *in, size_t inl) |
| 89 | { | 89 | { |
| 90 | BLOCK_CIPHER_ecb_loop() | 90 | BLOCK_CIPHER_ecb_loop() |
| 91 | DES_ecb3_encrypt((const_DES_cblock *)(in + i), | 91 | DES_ecb3_encrypt((const_DES_cblock *)(in + i), |
| @@ -97,48 +97,80 @@ static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 99 | static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 100 | const unsigned char *in, unsigned int inl) | 100 | const unsigned char *in, size_t inl) |
| 101 | { | 101 | { |
| 102 | DES_ede3_ofb64_encrypt(in, out, (long)inl, | 102 | if (inl>=EVP_MAXCHUNK) |
| 103 | { | ||
| 104 | DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, | ||
| 103 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | 105 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, |
| 104 | (DES_cblock *)ctx->iv, &ctx->num); | 106 | (DES_cblock *)ctx->iv, &ctx->num); |
| 107 | inl-=EVP_MAXCHUNK; | ||
| 108 | in +=EVP_MAXCHUNK; | ||
| 109 | out+=EVP_MAXCHUNK; | ||
| 110 | } | ||
| 111 | if (inl) | ||
| 112 | DES_ede3_ofb64_encrypt(in, out, (long)inl, | ||
| 113 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | ||
| 114 | (DES_cblock *)ctx->iv, &ctx->num); | ||
| 115 | |||
| 105 | return 1; | 116 | return 1; |
| 106 | } | 117 | } |
| 107 | 118 | ||
| 108 | static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 119 | static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 109 | const unsigned char *in, unsigned int inl) | 120 | const unsigned char *in, size_t inl) |
| 110 | { | 121 | { |
| 111 | #ifdef KSSL_DEBUG | 122 | #ifdef KSSL_DEBUG |
| 112 | { | 123 | { |
| 113 | int i; | 124 | int i; |
| 114 | printf("des_ede_cbc_cipher(ctx=%lx, buflen=%d)\n", (unsigned long)ctx, ctx->buf_len); | 125 | char *cp; |
| 126 | printf("des_ede_cbc_cipher(ctx=%lx, buflen=%d)\n", ctx, ctx->buf_len); | ||
| 115 | printf("\t iv= "); | 127 | printf("\t iv= "); |
| 116 | for(i=0;i<8;i++) | 128 | for(i=0;i<8;i++) |
| 117 | printf("%02X",ctx->iv[i]); | 129 | printf("%02X",ctx->iv[i]); |
| 118 | printf("\n"); | 130 | printf("\n"); |
| 119 | } | 131 | } |
| 120 | #endif /* KSSL_DEBUG */ | 132 | #endif /* KSSL_DEBUG */ |
| 121 | DES_ede3_cbc_encrypt(in, out, (long)inl, | 133 | if (inl>=EVP_MAXCHUNK) |
| 134 | { | ||
| 135 | DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, | ||
| 122 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | 136 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, |
| 123 | (DES_cblock *)ctx->iv, ctx->encrypt); | 137 | (DES_cblock *)ctx->iv, ctx->encrypt); |
| 138 | inl-=EVP_MAXCHUNK; | ||
| 139 | in +=EVP_MAXCHUNK; | ||
| 140 | out+=EVP_MAXCHUNK; | ||
| 141 | } | ||
| 142 | if (inl) | ||
| 143 | DES_ede3_cbc_encrypt(in, out, (long)inl, | ||
| 144 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | ||
| 145 | (DES_cblock *)ctx->iv, ctx->encrypt); | ||
| 124 | return 1; | 146 | return 1; |
| 125 | } | 147 | } |
| 126 | 148 | ||
| 127 | static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 149 | static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 128 | const unsigned char *in, unsigned int inl) | 150 | const unsigned char *in, size_t inl) |
| 129 | { | 151 | { |
| 130 | DES_ede3_cfb64_encrypt(in, out, (long)inl, | 152 | if (inl>=EVP_MAXCHUNK) |
| 153 | { | ||
| 154 | DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, | ||
| 131 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | 155 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, |
| 132 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); | 156 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); |
| 157 | inl-=EVP_MAXCHUNK; | ||
| 158 | in +=EVP_MAXCHUNK; | ||
| 159 | out+=EVP_MAXCHUNK; | ||
| 160 | } | ||
| 161 | if (inl) | ||
| 162 | DES_ede3_cfb64_encrypt(in, out, (long)inl, | ||
| 163 | &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, | ||
| 164 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); | ||
| 133 | return 1; | 165 | return 1; |
| 134 | } | 166 | } |
| 135 | 167 | ||
| 136 | /* Although we have a CFB-r implementation for 3-DES, it doesn't pack the right | 168 | /* Although we have a CFB-r implementation for 3-DES, it doesn't pack the right |
| 137 | way, so wrap it here */ | 169 | way, so wrap it here */ |
| 138 | static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 170 | static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 139 | const unsigned char *in, unsigned int inl) | 171 | const unsigned char *in, size_t inl) |
| 140 | { | 172 | { |
| 141 | unsigned int n; | 173 | size_t n; |
| 142 | unsigned char c[1],d[1]; | 174 | unsigned char c[1],d[1]; |
| 143 | 175 | ||
| 144 | for(n=0 ; n < inl ; ++n) | 176 | for(n=0 ; n < inl ; ++n) |
| @@ -147,25 +179,36 @@ static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 147 | DES_ede3_cfb_encrypt(c,d,1,1, | 179 | DES_ede3_cfb_encrypt(c,d,1,1, |
| 148 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, | 180 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, |
| 149 | (DES_cblock *)ctx->iv,ctx->encrypt); | 181 | (DES_cblock *)ctx->iv,ctx->encrypt); |
| 150 | out[n/8]=(out[n/8]&~(0x80 >> (n%8)))|((d[0]&0x80) >> (n%8)); | 182 | out[n/8]=(out[n/8]&~(0x80 >> (unsigned int)(n%8))) | |
| 183 | ((d[0]&0x80) >> (unsigned int)(n%8)); | ||
| 151 | } | 184 | } |
| 152 | 185 | ||
| 153 | return 1; | 186 | return 1; |
| 154 | } | 187 | } |
| 155 | 188 | ||
| 156 | static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 189 | static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 157 | const unsigned char *in, unsigned int inl) | 190 | const unsigned char *in, size_t inl) |
| 158 | { | 191 | { |
| 159 | DES_ede3_cfb_encrypt(in,out,8,inl, | 192 | while (inl>=EVP_MAXCHUNK) |
| 193 | { | ||
| 194 | DES_ede3_cfb_encrypt(in,out,8,(long)EVP_MAXCHUNK, | ||
| 160 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, | 195 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, |
| 161 | (DES_cblock *)ctx->iv,ctx->encrypt); | 196 | (DES_cblock *)ctx->iv,ctx->encrypt); |
| 197 | inl-=EVP_MAXCHUNK; | ||
| 198 | in +=EVP_MAXCHUNK; | ||
| 199 | out+=EVP_MAXCHUNK; | ||
| 200 | } | ||
| 201 | if (inl) | ||
| 202 | DES_ede3_cfb_encrypt(in,out,8,(long)inl, | ||
| 203 | &data(ctx)->ks1,&data(ctx)->ks2,&data(ctx)->ks3, | ||
| 204 | (DES_cblock *)ctx->iv,ctx->encrypt); | ||
| 162 | return 1; | 205 | return 1; |
| 163 | } | 206 | } |
| 164 | 207 | ||
| 165 | BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64, | 208 | BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64, |
| 166 | EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1, | 209 | EVP_CIPH_RAND_KEY, des_ede_init_key, NULL, |
| 167 | des_ede_init_key, | 210 | EVP_CIPHER_set_asn1_iv, |
| 168 | NULL, NULL, NULL, | 211 | EVP_CIPHER_get_asn1_iv, |
| 169 | des3_ctrl) | 212 | des3_ctrl) |
| 170 | 213 | ||
| 171 | #define des_ede3_cfb64_cipher des_ede_cfb64_cipher | 214 | #define des_ede3_cfb64_cipher des_ede_cfb64_cipher |
| @@ -174,21 +217,21 @@ BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64, | |||
| 174 | #define des_ede3_ecb_cipher des_ede_ecb_cipher | 217 | #define des_ede3_ecb_cipher des_ede_ecb_cipher |
| 175 | 218 | ||
| 176 | BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64, | 219 | BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64, |
| 177 | EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1, | 220 | EVP_CIPH_RAND_KEY, des_ede3_init_key, NULL, |
| 178 | des_ede3_init_key, | 221 | EVP_CIPHER_set_asn1_iv, |
| 179 | NULL, NULL, NULL, | 222 | EVP_CIPHER_get_asn1_iv, |
| 180 | des3_ctrl) | 223 | des3_ctrl) |
| 181 | 224 | ||
| 182 | BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,1, | 225 | BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,1, |
| 183 | EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1, | 226 | EVP_CIPH_RAND_KEY, des_ede3_init_key,NULL, |
| 184 | des_ede3_init_key, | 227 | EVP_CIPHER_set_asn1_iv, |
| 185 | NULL, NULL, NULL, | 228 | EVP_CIPHER_get_asn1_iv, |
| 186 | des3_ctrl) | 229 | des3_ctrl) |
| 187 | 230 | ||
| 188 | BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,8, | 231 | BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,8, |
| 189 | EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1, | 232 | EVP_CIPH_RAND_KEY, des_ede3_init_key,NULL, |
| 190 | des_ede3_init_key, | 233 | EVP_CIPHER_set_asn1_iv, |
| 191 | NULL, NULL, NULL, | 234 | EVP_CIPHER_get_asn1_iv, |
| 192 | des3_ctrl) | 235 | des3_ctrl) |
| 193 | 236 | ||
| 194 | static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 237 | static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| @@ -215,7 +258,7 @@ static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 215 | #ifdef KSSL_DEBUG | 258 | #ifdef KSSL_DEBUG |
| 216 | { | 259 | { |
| 217 | int i; | 260 | int i; |
| 218 | printf("des_ede3_init_key(ctx=%lx)\n", (unsigned long)ctx); | 261 | printf("des_ede3_init_key(ctx=%lx)\n", ctx); |
| 219 | printf("\tKEY= "); | 262 | printf("\tKEY= "); |
| 220 | for(i=0;i<24;i++) printf("%02X",key[i]); printf("\n"); | 263 | for(i=0;i<24;i++) printf("%02X",key[i]); printf("\n"); |
| 221 | printf("\t IV= "); | 264 | printf("\t IV= "); |
diff --git a/src/lib/libcrypto/evp/e_idea.c b/src/lib/libcrypto/evp/e_idea.c index 48c33a774a..806b080360 100644 --- a/src/lib/libcrypto/evp/e_idea.c +++ b/src/lib/libcrypto/evp/e_idea.c | |||
| @@ -73,7 +73,7 @@ static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 73 | */ | 73 | */ |
| 74 | 74 | ||
| 75 | static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 75 | static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 76 | const unsigned char *in, unsigned int inl) | 76 | const unsigned char *in, size_t inl) |
| 77 | { | 77 | { |
| 78 | BLOCK_CIPHER_ecb_loop() | 78 | BLOCK_CIPHER_ecb_loop() |
| 79 | idea_ecb_encrypt(in + i, out + i, ctx->cipher_data); | 79 | idea_ecb_encrypt(in + i, out + i, ctx->cipher_data); |
diff --git a/src/lib/libcrypto/evp/e_null.c b/src/lib/libcrypto/evp/e_null.c index 0872d733e4..7cf50e1416 100644 --- a/src/lib/libcrypto/evp/e_null.c +++ b/src/lib/libcrypto/evp/e_null.c | |||
| @@ -64,12 +64,12 @@ | |||
| 64 | static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 64 | static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 65 | const unsigned char *iv,int enc); | 65 | const unsigned char *iv,int enc); |
| 66 | static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 66 | static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 67 | const unsigned char *in, unsigned int inl); | 67 | const unsigned char *in, size_t inl); |
| 68 | static const EVP_CIPHER n_cipher= | 68 | static const EVP_CIPHER n_cipher= |
| 69 | { | 69 | { |
| 70 | NID_undef, | 70 | NID_undef, |
| 71 | 1,0,0, | 71 | 1,0,0, |
| 72 | EVP_CIPH_FLAG_FIPS, | 72 | 0, |
| 73 | null_init_key, | 73 | null_init_key, |
| 74 | null_cipher, | 74 | null_cipher, |
| 75 | NULL, | 75 | NULL, |
| @@ -93,10 +93,10 @@ static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 95 | static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 96 | const unsigned char *in, unsigned int inl) | 96 | const unsigned char *in, size_t inl) |
| 97 | { | 97 | { |
| 98 | if (in != out) | 98 | if (in != out) |
| 99 | memcpy((char *)out,(const char *)in,(size_t)inl); | 99 | memcpy((char *)out,(const char *)in,inl); |
| 100 | return 1; | 100 | return 1; |
| 101 | } | 101 | } |
| 102 | 102 | ||
diff --git a/src/lib/libcrypto/evp/e_rc2.c b/src/lib/libcrypto/evp/e_rc2.c index d37726ffae..f78d781129 100644 --- a/src/lib/libcrypto/evp/e_rc2.c +++ b/src/lib/libcrypto/evp/e_rc2.c | |||
| @@ -223,6 +223,11 @@ static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | |||
| 223 | return 1; | 223 | return 1; |
| 224 | } | 224 | } |
| 225 | return 0; | 225 | return 0; |
| 226 | #ifdef PBE_PRF_TEST | ||
| 227 | case EVP_CTRL_PBE_PRF_NID: | ||
| 228 | *(int *)ptr = NID_hmacWithMD5; | ||
| 229 | return 1; | ||
| 230 | #endif | ||
| 226 | 231 | ||
| 227 | default: | 232 | default: |
| 228 | return -1; | 233 | return -1; |
diff --git a/src/lib/libcrypto/evp/e_rc4.c b/src/lib/libcrypto/evp/e_rc4.c index 55baad7446..8b5175e0fd 100644 --- a/src/lib/libcrypto/evp/e_rc4.c +++ b/src/lib/libcrypto/evp/e_rc4.c | |||
| @@ -64,7 +64,6 @@ | |||
| 64 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 65 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 66 | #include <openssl/rc4.h> | 66 | #include <openssl/rc4.h> |
| 67 | #include "evp_locl.h" | ||
| 68 | 67 | ||
| 69 | /* FIXME: surely this is available elsewhere? */ | 68 | /* FIXME: surely this is available elsewhere? */ |
| 70 | #define EVP_RC4_KEY_SIZE 16 | 69 | #define EVP_RC4_KEY_SIZE 16 |
| @@ -79,7 +78,7 @@ typedef struct | |||
| 79 | static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 78 | static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 80 | const unsigned char *iv,int enc); | 79 | const unsigned char *iv,int enc); |
| 81 | static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 80 | static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 82 | const unsigned char *in, unsigned int inl); | 81 | const unsigned char *in, size_t inl); |
| 83 | static const EVP_CIPHER r4_cipher= | 82 | static const EVP_CIPHER r4_cipher= |
| 84 | { | 83 | { |
| 85 | NID_rc4, | 84 | NID_rc4, |
| @@ -129,7 +128,7 @@ static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 129 | } | 128 | } |
| 130 | 129 | ||
| 131 | static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 130 | static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 132 | const unsigned char *in, unsigned int inl) | 131 | const unsigned char *in, size_t inl) |
| 133 | { | 132 | { |
| 134 | RC4(&data(ctx)->ks,inl,in,out); | 133 | RC4(&data(ctx)->ks,inl,in,out); |
| 135 | return 1; | 134 | return 1; |
diff --git a/src/lib/libcrypto/evp/e_xcbc_d.c b/src/lib/libcrypto/evp/e_xcbc_d.c index 8832da2433..250e88c8c5 100644 --- a/src/lib/libcrypto/evp/e_xcbc_d.c +++ b/src/lib/libcrypto/evp/e_xcbc_d.c | |||
| @@ -63,12 +63,13 @@ | |||
| 63 | 63 | ||
| 64 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 65 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 66 | #include "evp_locl.h" | ||
| 66 | #include <openssl/des.h> | 67 | #include <openssl/des.h> |
| 67 | 68 | ||
| 68 | static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 69 | static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 69 | const unsigned char *iv,int enc); | 70 | const unsigned char *iv,int enc); |
| 70 | static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 71 | static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 71 | const unsigned char *in, unsigned int inl); | 72 | const unsigned char *in, size_t inl); |
| 72 | 73 | ||
| 73 | 74 | ||
| 74 | typedef struct | 75 | typedef struct |
| @@ -113,13 +114,25 @@ static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | |||
| 113 | } | 114 | } |
| 114 | 115 | ||
| 115 | static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | 116 | static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 116 | const unsigned char *in, unsigned int inl) | 117 | const unsigned char *in, size_t inl) |
| 117 | { | 118 | { |
| 118 | DES_xcbc_encrypt(in,out,inl,&data(ctx)->ks, | 119 | while (inl>=EVP_MAXCHUNK) |
| 120 | { | ||
| 121 | DES_xcbc_encrypt(in,out,(long)EVP_MAXCHUNK,&data(ctx)->ks, | ||
| 119 | (DES_cblock *)&(ctx->iv[0]), | 122 | (DES_cblock *)&(ctx->iv[0]), |
| 120 | &data(ctx)->inw, | 123 | &data(ctx)->inw, |
| 121 | &data(ctx)->outw, | 124 | &data(ctx)->outw, |
| 122 | ctx->encrypt); | 125 | ctx->encrypt); |
| 126 | inl-=EVP_MAXCHUNK; | ||
| 127 | in +=EVP_MAXCHUNK; | ||
| 128 | out+=EVP_MAXCHUNK; | ||
| 129 | } | ||
| 130 | if (inl) | ||
| 131 | DES_xcbc_encrypt(in,out,(long)inl,&data(ctx)->ks, | ||
| 132 | (DES_cblock *)&(ctx->iv[0]), | ||
| 133 | &data(ctx)->inw, | ||
| 134 | &data(ctx)->outw, | ||
| 135 | ctx->encrypt); | ||
| 123 | return 1; | 136 | return 1; |
| 124 | } | 137 | } |
| 125 | #endif | 138 | #endif |
diff --git a/src/lib/libcrypto/evp/enc_min.c b/src/lib/libcrypto/evp/enc_min.c deleted file mode 100644 index 7fba38ee24..0000000000 --- a/src/lib/libcrypto/evp/enc_min.c +++ /dev/null | |||
| @@ -1,390 +0,0 @@ | |||
| 1 | /* crypto/evp/enc_min.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/err.h> | ||
| 63 | #include <openssl/rand.h> | ||
| 64 | #ifndef OPENSSL_NO_ENGINE | ||
| 65 | #include <openssl/engine.h> | ||
| 66 | #endif | ||
| 67 | #include "evp_locl.h" | ||
| 68 | |||
| 69 | void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) | ||
| 70 | { | ||
| 71 | #ifdef OPENSSL_FIPS | ||
| 72 | FIPS_selftest_check(); | ||
| 73 | #endif | ||
| 74 | memset(ctx,0,sizeof(EVP_CIPHER_CTX)); | ||
| 75 | /* ctx->cipher=NULL; */ | ||
| 76 | } | ||
| 77 | |||
| 78 | #ifdef OPENSSL_FIPS | ||
| 79 | |||
| 80 | /* The purpose of these is to trap programs that attempt to use non FIPS | ||
| 81 | * algorithms in FIPS mode and ignore the errors. | ||
| 82 | */ | ||
| 83 | |||
| 84 | static int bad_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 85 | const unsigned char *iv, int enc) | ||
| 86 | { FIPS_ERROR_IGNORED("Cipher init"); return 0;} | ||
| 87 | |||
| 88 | static int bad_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 89 | const unsigned char *in, unsigned int inl) | ||
| 90 | { FIPS_ERROR_IGNORED("Cipher update"); return 0;} | ||
| 91 | |||
| 92 | /* NB: no cleanup because it is allowed after failed init */ | ||
| 93 | |||
| 94 | static int bad_set_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *typ) | ||
| 95 | { FIPS_ERROR_IGNORED("Cipher set_asn1"); return 0;} | ||
| 96 | static int bad_get_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *typ) | ||
| 97 | { FIPS_ERROR_IGNORED("Cipher get_asn1"); return 0;} | ||
| 98 | static int bad_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
| 99 | { FIPS_ERROR_IGNORED("Cipher ctrl"); return 0;} | ||
| 100 | |||
| 101 | static const EVP_CIPHER bad_cipher = | ||
| 102 | { | ||
| 103 | 0, | ||
| 104 | 0, | ||
| 105 | 0, | ||
| 106 | 0, | ||
| 107 | 0, | ||
| 108 | bad_init, | ||
| 109 | bad_do_cipher, | ||
| 110 | NULL, | ||
| 111 | 0, | ||
| 112 | bad_set_asn1, | ||
| 113 | bad_get_asn1, | ||
| 114 | bad_ctrl, | ||
| 115 | NULL | ||
| 116 | }; | ||
| 117 | |||
| 118 | #endif | ||
| 119 | |||
| 120 | #ifndef OPENSSL_NO_ENGINE | ||
| 121 | |||
| 122 | #ifdef OPENSSL_FIPS | ||
| 123 | |||
| 124 | static int do_engine_null(ENGINE *impl) { return 0;} | ||
| 125 | static int do_evp_enc_engine_null(EVP_CIPHER_CTX *ctx, | ||
| 126 | const EVP_CIPHER **pciph, ENGINE *impl) | ||
| 127 | { return 1; } | ||
| 128 | |||
| 129 | static int (*do_engine_finish)(ENGINE *impl) | ||
| 130 | = do_engine_null; | ||
| 131 | |||
| 132 | static int (*do_evp_enc_engine) | ||
| 133 | (EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciph, ENGINE *impl) | ||
| 134 | = do_evp_enc_engine_null; | ||
| 135 | |||
| 136 | void int_EVP_CIPHER_set_engine_callbacks( | ||
| 137 | int (*eng_ciph_fin)(ENGINE *impl), | ||
| 138 | int (*eng_ciph_evp) | ||
| 139 | (EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciph, ENGINE *impl)) | ||
| 140 | { | ||
| 141 | do_engine_finish = eng_ciph_fin; | ||
| 142 | do_evp_enc_engine = eng_ciph_evp; | ||
| 143 | } | ||
| 144 | |||
| 145 | #else | ||
| 146 | |||
| 147 | #define do_engine_finish ENGINE_finish | ||
| 148 | |||
| 149 | static int do_evp_enc_engine(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pcipher, ENGINE *impl) | ||
| 150 | { | ||
| 151 | if(impl) | ||
| 152 | { | ||
| 153 | if (!ENGINE_init(impl)) | ||
| 154 | { | ||
| 155 | EVPerr(EVP_F_DO_EVP_ENC_ENGINE, EVP_R_INITIALIZATION_ERROR); | ||
| 156 | return 0; | ||
| 157 | } | ||
| 158 | } | ||
| 159 | else | ||
| 160 | /* Ask if an ENGINE is reserved for this job */ | ||
| 161 | impl = ENGINE_get_cipher_engine((*pcipher)->nid); | ||
| 162 | if(impl) | ||
| 163 | { | ||
| 164 | /* There's an ENGINE for this job ... (apparently) */ | ||
| 165 | const EVP_CIPHER *c = ENGINE_get_cipher(impl, (*pcipher)->nid); | ||
| 166 | if(!c) | ||
| 167 | { | ||
| 168 | /* One positive side-effect of US's export | ||
| 169 | * control history, is that we should at least | ||
| 170 | * be able to avoid using US mispellings of | ||
| 171 | * "initialisation"? */ | ||
| 172 | EVPerr(EVP_F_DO_EVP_ENC_ENGINE, EVP_R_INITIALIZATION_ERROR); | ||
| 173 | return 0; | ||
| 174 | } | ||
| 175 | /* We'll use the ENGINE's private cipher definition */ | ||
| 176 | *pcipher = c; | ||
| 177 | /* Store the ENGINE functional reference so we know | ||
| 178 | * 'cipher' came from an ENGINE and we need to release | ||
| 179 | * it when done. */ | ||
| 180 | ctx->engine = impl; | ||
| 181 | } | ||
| 182 | else | ||
| 183 | ctx->engine = NULL; | ||
| 184 | return 1; | ||
| 185 | } | ||
| 186 | |||
| 187 | #endif | ||
| 188 | |||
| 189 | #endif | ||
| 190 | |||
| 191 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | ||
| 192 | const unsigned char *key, const unsigned char *iv, int enc) | ||
| 193 | { | ||
| 194 | if (enc == -1) | ||
| 195 | enc = ctx->encrypt; | ||
| 196 | else | ||
| 197 | { | ||
| 198 | if (enc) | ||
| 199 | enc = 1; | ||
| 200 | ctx->encrypt = enc; | ||
| 201 | } | ||
| 202 | #ifdef OPENSSL_FIPS | ||
| 203 | if(FIPS_selftest_failed()) | ||
| 204 | { | ||
| 205 | FIPSerr(FIPS_F_EVP_CIPHERINIT_EX,FIPS_R_FIPS_SELFTEST_FAILED); | ||
| 206 | ctx->cipher = &bad_cipher; | ||
| 207 | return 0; | ||
| 208 | } | ||
| 209 | #endif | ||
| 210 | #ifndef OPENSSL_NO_ENGINE | ||
| 211 | /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts | ||
| 212 | * so this context may already have an ENGINE! Try to avoid releasing | ||
| 213 | * the previous handle, re-querying for an ENGINE, and having a | ||
| 214 | * reinitialisation, when it may all be unecessary. */ | ||
| 215 | if (ctx->engine && ctx->cipher && (!cipher || | ||
| 216 | (cipher && (cipher->nid == ctx->cipher->nid)))) | ||
| 217 | goto skip_to_init; | ||
| 218 | #endif | ||
| 219 | if (cipher) | ||
| 220 | { | ||
| 221 | /* Ensure a context left lying around from last time is cleared | ||
| 222 | * (the previous check attempted to avoid this if the same | ||
| 223 | * ENGINE and EVP_CIPHER could be used). */ | ||
| 224 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 225 | |||
| 226 | /* Restore encrypt field: it is zeroed by cleanup */ | ||
| 227 | ctx->encrypt = enc; | ||
| 228 | #ifndef OPENSSL_NO_ENGINE | ||
| 229 | if (!do_evp_enc_engine(ctx, &cipher, impl)) | ||
| 230 | return 0; | ||
| 231 | #endif | ||
| 232 | |||
| 233 | ctx->cipher=cipher; | ||
| 234 | if (ctx->cipher->ctx_size) | ||
| 235 | { | ||
| 236 | ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); | ||
| 237 | if (!ctx->cipher_data) | ||
| 238 | { | ||
| 239 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE); | ||
| 240 | return 0; | ||
| 241 | } | ||
| 242 | } | ||
| 243 | else | ||
| 244 | { | ||
| 245 | ctx->cipher_data = NULL; | ||
| 246 | } | ||
| 247 | ctx->key_len = cipher->key_len; | ||
| 248 | ctx->flags = 0; | ||
| 249 | if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT) | ||
| 250 | { | ||
| 251 | if(!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) | ||
| 252 | { | ||
| 253 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); | ||
| 254 | return 0; | ||
| 255 | } | ||
| 256 | } | ||
| 257 | } | ||
| 258 | else if(!ctx->cipher) | ||
| 259 | { | ||
| 260 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_NO_CIPHER_SET); | ||
| 261 | return 0; | ||
| 262 | } | ||
| 263 | #ifndef OPENSSL_NO_ENGINE | ||
| 264 | skip_to_init: | ||
| 265 | #endif | ||
| 266 | /* we assume block size is a power of 2 in *cryptUpdate */ | ||
| 267 | OPENSSL_assert(ctx->cipher->block_size == 1 | ||
| 268 | || ctx->cipher->block_size == 8 | ||
| 269 | || ctx->cipher->block_size == 16); | ||
| 270 | |||
| 271 | if(!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV)) { | ||
| 272 | switch(EVP_CIPHER_CTX_mode(ctx)) { | ||
| 273 | |||
| 274 | case EVP_CIPH_STREAM_CIPHER: | ||
| 275 | case EVP_CIPH_ECB_MODE: | ||
| 276 | break; | ||
| 277 | |||
| 278 | case EVP_CIPH_CFB_MODE: | ||
| 279 | case EVP_CIPH_OFB_MODE: | ||
| 280 | |||
| 281 | ctx->num = 0; | ||
| 282 | |||
| 283 | case EVP_CIPH_CBC_MODE: | ||
| 284 | |||
| 285 | OPENSSL_assert(EVP_CIPHER_CTX_iv_length(ctx) <= | ||
| 286 | (int)sizeof(ctx->iv)); | ||
| 287 | if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx)); | ||
| 288 | memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx)); | ||
| 289 | break; | ||
| 290 | |||
| 291 | default: | ||
| 292 | return 0; | ||
| 293 | break; | ||
| 294 | } | ||
| 295 | } | ||
| 296 | |||
| 297 | #ifdef OPENSSL_FIPS | ||
| 298 | /* After 'key' is set no further parameters changes are permissible. | ||
| 299 | * So only check for non FIPS enabling at this point. | ||
| 300 | */ | ||
| 301 | if (key && FIPS_mode()) | ||
| 302 | { | ||
| 303 | if (!(ctx->cipher->flags & EVP_CIPH_FLAG_FIPS) | ||
| 304 | & !(ctx->flags & EVP_CIPH_FLAG_NON_FIPS_ALLOW)) | ||
| 305 | { | ||
| 306 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_DISABLED_FOR_FIPS); | ||
| 307 | #if 0 | ||
| 308 | ERR_add_error_data(2, "cipher=", | ||
| 309 | EVP_CIPHER_name(ctx->cipher)); | ||
| 310 | #endif | ||
| 311 | ctx->cipher = &bad_cipher; | ||
| 312 | return 0; | ||
| 313 | } | ||
| 314 | } | ||
| 315 | #endif | ||
| 316 | |||
| 317 | if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { | ||
| 318 | if(!ctx->cipher->init(ctx,key,iv,enc)) return 0; | ||
| 319 | } | ||
| 320 | ctx->buf_len=0; | ||
| 321 | ctx->final_used=0; | ||
| 322 | ctx->block_mask=ctx->cipher->block_size-1; | ||
| 323 | return 1; | ||
| 324 | } | ||
| 325 | |||
| 326 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | ||
| 327 | { | ||
| 328 | if (c->cipher != NULL) | ||
| 329 | { | ||
| 330 | if(c->cipher->cleanup && !c->cipher->cleanup(c)) | ||
| 331 | return 0; | ||
| 332 | /* Cleanse cipher context data */ | ||
| 333 | if (c->cipher_data) | ||
| 334 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); | ||
| 335 | } | ||
| 336 | if (c->cipher_data) | ||
| 337 | OPENSSL_free(c->cipher_data); | ||
| 338 | #ifndef OPENSSL_NO_ENGINE | ||
| 339 | if (c->engine) | ||
| 340 | /* The EVP_CIPHER we used belongs to an ENGINE, release the | ||
| 341 | * functional reference we held for this reason. */ | ||
| 342 | do_engine_finish(c->engine); | ||
| 343 | #endif | ||
| 344 | memset(c,0,sizeof(EVP_CIPHER_CTX)); | ||
| 345 | return 1; | ||
| 346 | } | ||
| 347 | |||
| 348 | int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) | ||
| 349 | { | ||
| 350 | #ifdef OPENSSL_FIPS | ||
| 351 | FIPS_selftest_check(); | ||
| 352 | #endif | ||
| 353 | return ctx->cipher->do_cipher(ctx,out,in,inl); | ||
| 354 | } | ||
| 355 | |||
| 356 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
| 357 | { | ||
| 358 | int ret; | ||
| 359 | if(!ctx->cipher) { | ||
| 360 | EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_NO_CIPHER_SET); | ||
| 361 | return 0; | ||
| 362 | } | ||
| 363 | |||
| 364 | if(!ctx->cipher->ctrl) { | ||
| 365 | EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_CTRL_NOT_IMPLEMENTED); | ||
| 366 | return 0; | ||
| 367 | } | ||
| 368 | |||
| 369 | ret = ctx->cipher->ctrl(ctx, type, arg, ptr); | ||
| 370 | if(ret == -1) { | ||
| 371 | EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED); | ||
| 372 | return 0; | ||
| 373 | } | ||
| 374 | return ret; | ||
| 375 | } | ||
| 376 | |||
| 377 | unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) | ||
| 378 | { | ||
| 379 | return ctx->cipher->flags; | ||
| 380 | } | ||
| 381 | |||
| 382 | int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) | ||
| 383 | { | ||
| 384 | return ctx->cipher->iv_len; | ||
| 385 | } | ||
| 386 | |||
| 387 | int EVP_CIPHER_nid(const EVP_CIPHER *cipher) | ||
| 388 | { | ||
| 389 | return cipher->nid; | ||
| 390 | } | ||
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c index 5921f0d710..b42c747249 100644 --- a/src/lib/libcrypto/evp/encode.c +++ b/src/lib/libcrypto/evp/encode.c | |||
| @@ -85,7 +85,7 @@ | |||
| 85 | #define CHUNKS_PER_LINE (64/4) | 85 | #define CHUNKS_PER_LINE (64/4) |
| 86 | #define CHAR_PER_LINE (64+1) | 86 | #define CHAR_PER_LINE (64+1) |
| 87 | 87 | ||
| 88 | static unsigned char data_bin2ascii[65]="ABCDEFGHIJKLMNOPQRSTUVWXYZ\ | 88 | static const unsigned char data_bin2ascii[65]="ABCDEFGHIJKLMNOPQRSTUVWXYZ\ |
| 89 | abcdefghijklmnopqrstuvwxyz0123456789+/"; | 89 | abcdefghijklmnopqrstuvwxyz0123456789+/"; |
| 90 | 90 | ||
| 91 | /* 0xF0 is a EOLN | 91 | /* 0xF0 is a EOLN |
| @@ -102,7 +102,7 @@ abcdefghijklmnopqrstuvwxyz0123456789+/"; | |||
| 102 | #define B64_ERROR 0xFF | 102 | #define B64_ERROR 0xFF |
| 103 | #define B64_NOT_BASE64(a) (((a)|0x13) == 0xF3) | 103 | #define B64_NOT_BASE64(a) (((a)|0x13) == 0xF3) |
| 104 | 104 | ||
| 105 | static unsigned char data_ascii2bin[128]={ | 105 | static const unsigned char data_ascii2bin[128]={ |
| 106 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | 106 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, |
| 107 | 0xFF,0xE0,0xF0,0xFF,0xFF,0xF1,0xFF,0xFF, | 107 | 0xFF,0xE0,0xF0,0xFF,0xFF,0xF1,0xFF,0xFF, |
| 108 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | 108 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, |
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index 82b5862ce7..da93e945f5 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
| @@ -75,10 +75,6 @@ | |||
| 75 | #include <openssl/bio.h> | 75 | #include <openssl/bio.h> |
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| 78 | #ifdef OPENSSL_FIPS | ||
| 79 | #include <openssl/fips.h> | ||
| 80 | #endif | ||
| 81 | |||
| 82 | /* | 78 | /* |
| 83 | #define EVP_RC2_KEY_SIZE 16 | 79 | #define EVP_RC2_KEY_SIZE 16 |
| 84 | #define EVP_RC4_KEY_SIZE 16 | 80 | #define EVP_RC4_KEY_SIZE 16 |
| @@ -119,6 +115,7 @@ | |||
| 119 | #define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 | 115 | #define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 |
| 120 | #define EVP_PKEY_DH NID_dhKeyAgreement | 116 | #define EVP_PKEY_DH NID_dhKeyAgreement |
| 121 | #define EVP_PKEY_EC NID_X9_62_id_ecPublicKey | 117 | #define EVP_PKEY_EC NID_X9_62_id_ecPublicKey |
| 118 | #define EVP_PKEY_HMAC NID_hmac | ||
| 122 | 119 | ||
| 123 | #ifdef __cplusplus | 120 | #ifdef __cplusplus |
| 124 | extern "C" { | 121 | extern "C" { |
| @@ -132,6 +129,8 @@ struct evp_pkey_st | |||
| 132 | int type; | 129 | int type; |
| 133 | int save_type; | 130 | int save_type; |
| 134 | int references; | 131 | int references; |
| 132 | const EVP_PKEY_ASN1_METHOD *ameth; | ||
| 133 | ENGINE *engine; | ||
| 135 | union { | 134 | union { |
| 136 | char *ptr; | 135 | char *ptr; |
| 137 | #ifndef OPENSSL_NO_RSA | 136 | #ifndef OPENSSL_NO_RSA |
| @@ -156,73 +155,6 @@ struct evp_pkey_st | |||
| 156 | #define EVP_PKEY_MO_ENCRYPT 0x0004 | 155 | #define EVP_PKEY_MO_ENCRYPT 0x0004 |
| 157 | #define EVP_PKEY_MO_DECRYPT 0x0008 | 156 | #define EVP_PKEY_MO_DECRYPT 0x0008 |
| 158 | 157 | ||
| 159 | #if 0 | ||
| 160 | /* This structure is required to tie the message digest and signing together. | ||
| 161 | * The lookup can be done by md/pkey_method, oid, oid/pkey_method, or | ||
| 162 | * oid, md and pkey. | ||
| 163 | * This is required because for various smart-card perform the digest and | ||
| 164 | * signing/verification on-board. To handle this case, the specific | ||
| 165 | * EVP_MD and EVP_PKEY_METHODs need to be closely associated. | ||
| 166 | * When a PKEY is created, it will have a EVP_PKEY_METHOD associated with it. | ||
| 167 | * This can either be software or a token to provide the required low level | ||
| 168 | * routines. | ||
| 169 | */ | ||
| 170 | typedef struct evp_pkey_md_st | ||
| 171 | { | ||
| 172 | int oid; | ||
| 173 | EVP_MD *md; | ||
| 174 | EVP_PKEY_METHOD *pkey; | ||
| 175 | } EVP_PKEY_MD; | ||
| 176 | |||
| 177 | #define EVP_rsa_md2() \ | ||
| 178 | EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\ | ||
| 179 | EVP_rsa_pkcs1(),EVP_md2()) | ||
| 180 | #define EVP_rsa_md5() \ | ||
| 181 | EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\ | ||
| 182 | EVP_rsa_pkcs1(),EVP_md5()) | ||
| 183 | #define EVP_rsa_sha0() \ | ||
| 184 | EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\ | ||
| 185 | EVP_rsa_pkcs1(),EVP_sha()) | ||
| 186 | #define EVP_rsa_sha1() \ | ||
| 187 | EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\ | ||
| 188 | EVP_rsa_pkcs1(),EVP_sha1()) | ||
| 189 | #define EVP_rsa_ripemd160() \ | ||
| 190 | EVP_PKEY_MD_add(NID_ripemd160WithRSA,\ | ||
| 191 | EVP_rsa_pkcs1(),EVP_ripemd160()) | ||
| 192 | #define EVP_rsa_mdc2() \ | ||
| 193 | EVP_PKEY_MD_add(NID_mdc2WithRSA,\ | ||
| 194 | EVP_rsa_octet_string(),EVP_mdc2()) | ||
| 195 | #define EVP_dsa_sha() \ | ||
| 196 | EVP_PKEY_MD_add(NID_dsaWithSHA,\ | ||
| 197 | EVP_dsa(),EVP_sha()) | ||
| 198 | #define EVP_dsa_sha1() \ | ||
| 199 | EVP_PKEY_MD_add(NID_dsaWithSHA1,\ | ||
| 200 | EVP_dsa(),EVP_sha1()) | ||
| 201 | |||
| 202 | typedef struct evp_pkey_method_st | ||
| 203 | { | ||
| 204 | char *name; | ||
| 205 | int flags; | ||
| 206 | int type; /* RSA, DSA, an SSLeay specific constant */ | ||
| 207 | int oid; /* For the pub-key type */ | ||
| 208 | int encrypt_oid; /* pub/priv key encryption */ | ||
| 209 | |||
| 210 | int (*sign)(); | ||
| 211 | int (*verify)(); | ||
| 212 | struct { | ||
| 213 | int (*set)(); /* get and/or set the underlying type */ | ||
| 214 | int (*get)(); | ||
| 215 | int (*encrypt)(); | ||
| 216 | int (*decrypt)(); | ||
| 217 | int (*i2d)(); | ||
| 218 | int (*d2i)(); | ||
| 219 | int (*dup)(); | ||
| 220 | } pub,priv; | ||
| 221 | int (*set_asn1_parameters)(); | ||
| 222 | int (*get_asn1_parameters)(); | ||
| 223 | } EVP_PKEY_METHOD; | ||
| 224 | #endif | ||
| 225 | |||
| 226 | #ifndef EVP_MD | 158 | #ifndef EVP_MD |
| 227 | struct env_md_st | 159 | struct env_md_st |
| 228 | { | 160 | { |
| @@ -245,6 +177,8 @@ struct env_md_st | |||
| 245 | int required_pkey_type[5]; /*EVP_PKEY_xxx */ | 177 | int required_pkey_type[5]; /*EVP_PKEY_xxx */ |
| 246 | int block_size; | 178 | int block_size; |
| 247 | int ctx_size; /* how big does the ctx->md_data need to be */ | 179 | int ctx_size; /* how big does the ctx->md_data need to be */ |
| 180 | /* control function */ | ||
| 181 | int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); | ||
| 248 | } /* EVP_MD */; | 182 | } /* EVP_MD */; |
| 249 | 183 | ||
| 250 | typedef int evp_sign_method(int type,const unsigned char *m, | 184 | typedef int evp_sign_method(int type,const unsigned char *m, |
| @@ -254,18 +188,42 @@ typedef int evp_verify_method(int type,const unsigned char *m, | |||
| 254 | unsigned int m_length,const unsigned char *sigbuf, | 188 | unsigned int m_length,const unsigned char *sigbuf, |
| 255 | unsigned int siglen, void *key); | 189 | unsigned int siglen, void *key); |
| 256 | 190 | ||
| 257 | typedef struct | ||
| 258 | { | ||
| 259 | EVP_MD_CTX *mctx; | ||
| 260 | void *key; | ||
| 261 | } EVP_MD_SVCTX; | ||
| 262 | |||
| 263 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single | 191 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single |
| 264 | * block */ | 192 | * block */ |
| 265 | 193 | ||
| 266 | #define EVP_MD_FLAG_FIPS 0x0400 /* Note if suitable for use in FIPS mode */ | 194 | #define EVP_MD_FLAG_PKEY_DIGEST 0x0002 /* digest is a "clone" digest used |
| 195 | * which is a copy of an existing | ||
| 196 | * one for a specific public key type. | ||
| 197 | * EVP_dss1() etc */ | ||
| 198 | |||
| 199 | /* Digest uses EVP_PKEY_METHOD for signing instead of MD specific signing */ | ||
| 200 | |||
| 201 | #define EVP_MD_FLAG_PKEY_METHOD_SIGNATURE 0x0004 | ||
| 202 | |||
| 203 | /* DigestAlgorithmIdentifier flags... */ | ||
| 204 | |||
| 205 | #define EVP_MD_FLAG_DIGALGID_MASK 0x0018 | ||
| 267 | 206 | ||
| 268 | #define EVP_MD_FLAG_SVCTX 0x0800 /* pass EVP_MD_SVCTX to sign/verify */ | 207 | /* NULL or absent parameter accepted. Use NULL */ |
| 208 | |||
| 209 | #define EVP_MD_FLAG_DIGALGID_NULL 0x0000 | ||
| 210 | |||
| 211 | /* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ | ||
| 212 | |||
| 213 | #define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 | ||
| 214 | |||
| 215 | /* Custom handling via ctrl */ | ||
| 216 | |||
| 217 | #define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 | ||
| 218 | |||
| 219 | /* Digest ctrls */ | ||
| 220 | |||
| 221 | #define EVP_MD_CTRL_DIGALGID 0x1 | ||
| 222 | #define EVP_MD_CTRL_MICALG 0x2 | ||
| 223 | |||
| 224 | /* Minimum Algorithm specific ctrl value */ | ||
| 225 | |||
| 226 | #define EVP_MD_CTRL_ALG_CTRL 0x1000 | ||
| 269 | 227 | ||
| 270 | #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} | 228 | #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} |
| 271 | 229 | ||
| @@ -307,6 +265,10 @@ struct env_md_ctx_st | |||
| 307 | ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ | 265 | ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ |
| 308 | unsigned long flags; | 266 | unsigned long flags; |
| 309 | void *md_data; | 267 | void *md_data; |
| 268 | /* Public key context for sign/verify */ | ||
| 269 | EVP_PKEY_CTX *pctx; | ||
| 270 | /* Update function: usually copied from EVP_MD */ | ||
| 271 | int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count); | ||
| 310 | } /* EVP_MD_CTX */; | 272 | } /* EVP_MD_CTX */; |
| 311 | 273 | ||
| 312 | /* values for EVP_MD_CTX flags */ | 274 | /* values for EVP_MD_CTX flags */ |
| @@ -317,17 +279,23 @@ struct env_md_ctx_st | |||
| 317 | * cleaned */ | 279 | * cleaned */ |
| 318 | #define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data | 280 | #define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data |
| 319 | * in EVP_MD_CTX_cleanup */ | 281 | * in EVP_MD_CTX_cleanup */ |
| 282 | /* FIPS and pad options are ignored in 1.0.0, definitions are here | ||
| 283 | * so we don't accidentally reuse the values for other purposes. | ||
| 284 | */ | ||
| 285 | |||
| 320 | #define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008 /* Allow use of non FIPS digest | 286 | #define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008 /* Allow use of non FIPS digest |
| 321 | * in FIPS mode */ | 287 | * in FIPS mode */ |
| 322 | 288 | ||
| 289 | /* The following PAD options are also currently ignored in 1.0.0, digest | ||
| 290 | * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() | ||
| 291 | * instead. | ||
| 292 | */ | ||
| 323 | #define EVP_MD_CTX_FLAG_PAD_MASK 0xF0 /* RSA mode to use */ | 293 | #define EVP_MD_CTX_FLAG_PAD_MASK 0xF0 /* RSA mode to use */ |
| 324 | #define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00 /* PKCS#1 v1.5 mode */ | 294 | #define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00 /* PKCS#1 v1.5 mode */ |
| 325 | #define EVP_MD_CTX_FLAG_PAD_X931 0x10 /* X9.31 mode */ | 295 | #define EVP_MD_CTX_FLAG_PAD_X931 0x10 /* X9.31 mode */ |
| 326 | #define EVP_MD_CTX_FLAG_PAD_PSS 0x20 /* PSS mode */ | 296 | #define EVP_MD_CTX_FLAG_PAD_PSS 0x20 /* PSS mode */ |
| 327 | #define M_EVP_MD_CTX_FLAG_PSS_SALT(ctx) \ | 297 | |
| 328 | ((ctx->flags>>16) &0xFFFF) /* seed length */ | 298 | #define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */ |
| 329 | #define EVP_MD_CTX_FLAG_PSS_MDLEN 0xFFFF /* salt len same as digest */ | ||
| 330 | #define EVP_MD_CTX_FLAG_PSS_MREC 0xFFFE /* salt max or auto recovered */ | ||
| 331 | 299 | ||
| 332 | struct evp_cipher_st | 300 | struct evp_cipher_st |
| 333 | { | 301 | { |
| @@ -339,7 +307,7 @@ struct evp_cipher_st | |||
| 339 | int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 307 | int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 340 | const unsigned char *iv, int enc); /* init key */ | 308 | const unsigned char *iv, int enc); /* init key */ |
| 341 | int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, | 309 | int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, |
| 342 | const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */ | 310 | const unsigned char *in, size_t inl);/* encrypt/decrypt data */ |
| 343 | int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ | 311 | int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ |
| 344 | int ctx_size; /* how big ctx->cipher_data needs to be */ | 312 | int ctx_size; /* how big ctx->cipher_data needs to be */ |
| 345 | int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ | 313 | int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ |
| @@ -357,7 +325,7 @@ struct evp_cipher_st | |||
| 357 | #define EVP_CIPH_CBC_MODE 0x2 | 325 | #define EVP_CIPH_CBC_MODE 0x2 |
| 358 | #define EVP_CIPH_CFB_MODE 0x3 | 326 | #define EVP_CIPH_CFB_MODE 0x3 |
| 359 | #define EVP_CIPH_OFB_MODE 0x4 | 327 | #define EVP_CIPH_OFB_MODE 0x4 |
| 360 | #define EVP_CIPH_MODE 0x7 | 328 | #define EVP_CIPH_MODE 0xF0007 |
| 361 | /* Set if variable length cipher */ | 329 | /* Set if variable length cipher */ |
| 362 | #define EVP_CIPH_VARIABLE_LENGTH 0x8 | 330 | #define EVP_CIPH_VARIABLE_LENGTH 0x8 |
| 363 | /* Set if the iv handling should be done by the cipher itself */ | 331 | /* Set if the iv handling should be done by the cipher itself */ |
| @@ -372,10 +340,8 @@ struct evp_cipher_st | |||
| 372 | #define EVP_CIPH_NO_PADDING 0x100 | 340 | #define EVP_CIPH_NO_PADDING 0x100 |
| 373 | /* cipher handles random key generation */ | 341 | /* cipher handles random key generation */ |
| 374 | #define EVP_CIPH_RAND_KEY 0x200 | 342 | #define EVP_CIPH_RAND_KEY 0x200 |
| 375 | /* Note if suitable for use in FIPS mode */ | 343 | /* cipher has its own additional copying logic */ |
| 376 | #define EVP_CIPH_FLAG_FIPS 0x400 | 344 | #define EVP_CIPH_CUSTOM_COPY 0x400 |
| 377 | /* Allow non FIPS cipher in FIPS mode */ | ||
| 378 | #define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x800 | ||
| 379 | /* Allow use default ASN1 get/set iv */ | 345 | /* Allow use default ASN1 get/set iv */ |
| 380 | #define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 | 346 | #define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 |
| 381 | /* Buffer length in bits not bytes: CFB1 mode only */ | 347 | /* Buffer length in bits not bytes: CFB1 mode only */ |
| @@ -389,8 +355,10 @@ struct evp_cipher_st | |||
| 389 | #define EVP_CTRL_SET_RC2_KEY_BITS 0x3 | 355 | #define EVP_CTRL_SET_RC2_KEY_BITS 0x3 |
| 390 | #define EVP_CTRL_GET_RC5_ROUNDS 0x4 | 356 | #define EVP_CTRL_GET_RC5_ROUNDS 0x4 |
| 391 | #define EVP_CTRL_SET_RC5_ROUNDS 0x5 | 357 | #define EVP_CTRL_SET_RC5_ROUNDS 0x5 |
| 392 | #define EVP_CTRL_SET_ACSS_MODE 0x6 | 358 | #define EVP_CTRL_RAND_KEY 0x6 |
| 393 | #define EVP_CTRL_RAND_KEY 0x7 | 359 | #define EVP_CTRL_PBE_PRF_NID 0x7 |
| 360 | #define EVP_CTRL_COPY 0x8 | ||
| 361 | #define EVP_CTRL_SET_ACSS_MODE 0x9 | ||
| 394 | 362 | ||
| 395 | typedef struct evp_cipher_info_st | 363 | typedef struct evp_cipher_info_st |
| 396 | { | 364 | { |
| @@ -463,26 +431,15 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
| 463 | #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) | 431 | #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) |
| 464 | #define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) | 432 | #define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) |
| 465 | 433 | ||
| 466 | /* Macros to reduce FIPS dependencies: do NOT use in applications */ | ||
| 467 | #define M_EVP_MD_size(e) ((e)->md_size) | ||
| 468 | #define M_EVP_MD_block_size(e) ((e)->block_size) | ||
| 469 | #define M_EVP_MD_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs)) | ||
| 470 | #define M_EVP_MD_CTX_clear_flags(ctx,flgs) ((ctx)->flags&=~(flgs)) | ||
| 471 | #define M_EVP_MD_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs)) | ||
| 472 | #define M_EVP_MD_type(e) ((e)->type) | ||
| 473 | #define M_EVP_MD_CTX_type(e) M_EVP_MD_type(M_EVP_MD_CTX_md(e)) | ||
| 474 | #define M_EVP_MD_CTX_md(e) ((e)->digest) | ||
| 475 | |||
| 476 | #define M_EVP_CIPHER_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs)) | ||
| 477 | |||
| 478 | int EVP_MD_type(const EVP_MD *md); | 434 | int EVP_MD_type(const EVP_MD *md); |
| 479 | #define EVP_MD_nid(e) EVP_MD_type(e) | 435 | #define EVP_MD_nid(e) EVP_MD_type(e) |
| 480 | #define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) | 436 | #define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) |
| 481 | int EVP_MD_pkey_type(const EVP_MD *md); | 437 | int EVP_MD_pkey_type(const EVP_MD *md); |
| 482 | int EVP_MD_size(const EVP_MD *md); | 438 | int EVP_MD_size(const EVP_MD *md); |
| 483 | int EVP_MD_block_size(const EVP_MD *md); | 439 | int EVP_MD_block_size(const EVP_MD *md); |
| 440 | unsigned long EVP_MD_flags(const EVP_MD *md); | ||
| 484 | 441 | ||
| 485 | const EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx); | 442 | const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); |
| 486 | #define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) | 443 | #define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) |
| 487 | #define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) | 444 | #define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) |
| 488 | #define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) | 445 | #define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) |
| @@ -500,6 +457,7 @@ int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); | |||
| 500 | int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); | 457 | int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); |
| 501 | int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); | 458 | int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); |
| 502 | int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); | 459 | int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); |
| 460 | int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); | ||
| 503 | void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); | 461 | void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); |
| 504 | void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); | 462 | void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); |
| 505 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) | 463 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) |
| @@ -517,6 +475,8 @@ unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx); | |||
| 517 | #define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | 475 | #define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) |
| 518 | #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) | 476 | #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) |
| 519 | #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) | 477 | #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) |
| 478 | #define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | ||
| 479 | #define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | ||
| 520 | 480 | ||
| 521 | #ifdef CONST_STRICT | 481 | #ifdef CONST_STRICT |
| 522 | void BIO_set_md(BIO *,const EVP_MD *md); | 482 | void BIO_set_md(BIO *,const EVP_MD *md); |
| @@ -563,6 +523,7 @@ int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); | |||
| 563 | int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); | 523 | int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); |
| 564 | 524 | ||
| 565 | int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); | 525 | int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); |
| 526 | int EVP_read_pw_string_min(char *buf,int minlen,int maxlen,const char *prompt,int verify); | ||
| 566 | void EVP_set_pw_prompt(const char *prompt); | 527 | void EVP_set_pw_prompt(const char *prompt); |
| 567 | char * EVP_get_pw_prompt(void); | 528 | char * EVP_get_pw_prompt(void); |
| 568 | 529 | ||
| @@ -609,6 +570,16 @@ int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s, | |||
| 609 | int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf, | 570 | int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf, |
| 610 | unsigned int siglen,EVP_PKEY *pkey); | 571 | unsigned int siglen,EVP_PKEY *pkey); |
| 611 | 572 | ||
| 573 | int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | ||
| 574 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | ||
| 575 | int EVP_DigestSignFinal(EVP_MD_CTX *ctx, | ||
| 576 | unsigned char *sigret, size_t *siglen); | ||
| 577 | |||
| 578 | int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | ||
| 579 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | ||
| 580 | int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, | ||
| 581 | unsigned char *sig, size_t siglen); | ||
| 582 | |||
| 612 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, | 583 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, |
| 613 | const unsigned char *ek, int ekl, const unsigned char *iv, | 584 | const unsigned char *ek, int ekl, const unsigned char *iv, |
| 614 | EVP_PKEY *priv); | 585 | EVP_PKEY *priv); |
| @@ -681,6 +652,9 @@ const EVP_MD *EVP_mdc2(void); | |||
| 681 | #ifndef OPENSSL_NO_RIPEMD | 652 | #ifndef OPENSSL_NO_RIPEMD |
| 682 | const EVP_MD *EVP_ripemd160(void); | 653 | const EVP_MD *EVP_ripemd160(void); |
| 683 | #endif | 654 | #endif |
| 655 | #ifndef OPENSSL_NO_WHIRLPOOL | ||
| 656 | const EVP_MD *EVP_whirlpool(void); | ||
| 657 | #endif | ||
| 684 | const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ | 658 | const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ |
| 685 | #ifndef OPENSSL_NO_DES | 659 | #ifndef OPENSSL_NO_DES |
| 686 | const EVP_CIPHER *EVP_des_ecb(void); | 660 | const EVP_CIPHER *EVP_des_ecb(void); |
| @@ -851,16 +825,31 @@ const EVP_CIPHER *EVP_get_cipherbyname(const char *name); | |||
| 851 | const EVP_MD *EVP_get_digestbyname(const char *name); | 825 | const EVP_MD *EVP_get_digestbyname(const char *name); |
| 852 | void EVP_cleanup(void); | 826 | void EVP_cleanup(void); |
| 853 | 827 | ||
| 854 | int EVP_PKEY_decrypt(unsigned char *dec_key, | 828 | void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph, |
| 829 | const char *from, const char *to, void *x), void *arg); | ||
| 830 | void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph, | ||
| 831 | const char *from, const char *to, void *x), void *arg); | ||
| 832 | |||
| 833 | void EVP_MD_do_all(void (*fn)(const EVP_MD *ciph, | ||
| 834 | const char *from, const char *to, void *x), void *arg); | ||
| 835 | void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *ciph, | ||
| 836 | const char *from, const char *to, void *x), void *arg); | ||
| 837 | |||
| 838 | int EVP_PKEY_decrypt_old(unsigned char *dec_key, | ||
| 855 | const unsigned char *enc_key,int enc_key_len, | 839 | const unsigned char *enc_key,int enc_key_len, |
| 856 | EVP_PKEY *private_key); | 840 | EVP_PKEY *private_key); |
| 857 | int EVP_PKEY_encrypt(unsigned char *enc_key, | 841 | int EVP_PKEY_encrypt_old(unsigned char *enc_key, |
| 858 | const unsigned char *key,int key_len, | 842 | const unsigned char *key,int key_len, |
| 859 | EVP_PKEY *pub_key); | 843 | EVP_PKEY *pub_key); |
| 860 | int EVP_PKEY_type(int type); | 844 | int EVP_PKEY_type(int type); |
| 845 | int EVP_PKEY_id(const EVP_PKEY *pkey); | ||
| 846 | int EVP_PKEY_base_id(const EVP_PKEY *pkey); | ||
| 861 | int EVP_PKEY_bits(EVP_PKEY *pkey); | 847 | int EVP_PKEY_bits(EVP_PKEY *pkey); |
| 862 | int EVP_PKEY_size(EVP_PKEY *pkey); | 848 | int EVP_PKEY_size(EVP_PKEY *pkey); |
| 863 | int EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key); | 849 | int EVP_PKEY_set_type(EVP_PKEY *pkey,int type); |
| 850 | int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); | ||
| 851 | int EVP_PKEY_assign(EVP_PKEY *pkey,int type,void *key); | ||
| 852 | void * EVP_PKEY_get0(EVP_PKEY *pkey); | ||
| 864 | 853 | ||
| 865 | #ifndef OPENSSL_NO_RSA | 854 | #ifndef OPENSSL_NO_RSA |
| 866 | struct rsa_st; | 855 | struct rsa_st; |
| @@ -903,6 +892,15 @@ int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); | |||
| 903 | 892 | ||
| 904 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); | 893 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); |
| 905 | 894 | ||
| 895 | int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, | ||
| 896 | int indent, ASN1_PCTX *pctx); | ||
| 897 | int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, | ||
| 898 | int indent, ASN1_PCTX *pctx); | ||
| 899 | int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, | ||
| 900 | int indent, ASN1_PCTX *pctx); | ||
| 901 | |||
| 902 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); | ||
| 903 | |||
| 906 | int EVP_CIPHER_type(const EVP_CIPHER *ctx); | 904 | int EVP_CIPHER_type(const EVP_CIPHER *ctx); |
| 907 | 905 | ||
| 908 | /* calls methods */ | 906 | /* calls methods */ |
| @@ -920,6 +918,10 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
| 920 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, | 918 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, |
| 921 | const unsigned char *salt, int saltlen, int iter, | 919 | const unsigned char *salt, int saltlen, int iter, |
| 922 | int keylen, unsigned char *out); | 920 | int keylen, unsigned char *out); |
| 921 | int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, | ||
| 922 | const unsigned char *salt, int saltlen, int iter, | ||
| 923 | const EVP_MD *digest, | ||
| 924 | int keylen, unsigned char *out); | ||
| 923 | int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 925 | int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
| 924 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, | 926 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, |
| 925 | int en_de); | 927 | int en_de); |
| @@ -928,27 +930,260 @@ void PKCS5_PBE_add(void); | |||
| 928 | 930 | ||
| 929 | int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | 931 | int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, |
| 930 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); | 932 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); |
| 933 | |||
| 934 | /* PBE type */ | ||
| 935 | |||
| 936 | /* Can appear as the outermost AlgorithmIdentifier */ | ||
| 937 | #define EVP_PBE_TYPE_OUTER 0x0 | ||
| 938 | /* Is an PRF type OID */ | ||
| 939 | #define EVP_PBE_TYPE_PRF 0x1 | ||
| 940 | |||
| 941 | int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid, | ||
| 942 | EVP_PBE_KEYGEN *keygen); | ||
| 931 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, | 943 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, |
| 932 | EVP_PBE_KEYGEN *keygen); | 944 | EVP_PBE_KEYGEN *keygen); |
| 945 | int EVP_PBE_find(int type, int pbe_nid, | ||
| 946 | int *pcnid, int *pmnid, EVP_PBE_KEYGEN **pkeygen); | ||
| 933 | void EVP_PBE_cleanup(void); | 947 | void EVP_PBE_cleanup(void); |
| 934 | 948 | ||
| 935 | #ifdef OPENSSL_FIPS | 949 | #define ASN1_PKEY_ALIAS 0x1 |
| 936 | #ifndef OPENSSL_NO_ENGINE | 950 | #define ASN1_PKEY_DYNAMIC 0x2 |
| 937 | void int_EVP_MD_set_engine_callbacks( | 951 | #define ASN1_PKEY_SIGPARAM_NULL 0x4 |
| 938 | int (*eng_md_init)(ENGINE *impl), | 952 | |
| 939 | int (*eng_md_fin)(ENGINE *impl), | 953 | #define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 |
| 940 | int (*eng_md_evp) | 954 | #define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 |
| 941 | (EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl)); | 955 | #define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 |
| 942 | void int_EVP_MD_init_engine_callbacks(void); | 956 | #define ASN1_PKEY_CTRL_CMS_SIGN 0x5 |
| 943 | void int_EVP_CIPHER_set_engine_callbacks( | 957 | #define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 |
| 944 | int (*eng_ciph_fin)(ENGINE *impl), | 958 | |
| 945 | int (*eng_ciph_evp) | 959 | int EVP_PKEY_asn1_get_count(void); |
| 946 | (EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciph, ENGINE *impl)); | 960 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); |
| 947 | void int_EVP_CIPHER_init_engine_callbacks(void); | 961 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); |
| 948 | #endif | 962 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, |
| 949 | #endif | 963 | const char *str, int len); |
| 964 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); | ||
| 965 | int EVP_PKEY_asn1_add_alias(int to, int from); | ||
| 966 | int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags, | ||
| 967 | const char **pinfo, const char **ppem_str, | ||
| 968 | const EVP_PKEY_ASN1_METHOD *ameth); | ||
| 969 | |||
| 970 | const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey); | ||
| 971 | EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, | ||
| 972 | const char *pem_str, const char *info); | ||
| 973 | void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, | ||
| 974 | const EVP_PKEY_ASN1_METHOD *src); | ||
| 975 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); | ||
| 976 | void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, | ||
| 977 | int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub), | ||
| 978 | int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk), | ||
| 979 | int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), | ||
| 980 | int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent, | ||
| 981 | ASN1_PCTX *pctx), | ||
| 982 | int (*pkey_size)(const EVP_PKEY *pk), | ||
| 983 | int (*pkey_bits)(const EVP_PKEY *pk)); | ||
| 984 | void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, | ||
| 985 | int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf), | ||
| 986 | int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk), | ||
| 987 | int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, | ||
| 988 | ASN1_PCTX *pctx)); | ||
| 989 | void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, | ||
| 990 | int (*param_decode)(EVP_PKEY *pkey, | ||
| 991 | const unsigned char **pder, int derlen), | ||
| 992 | int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder), | ||
| 993 | int (*param_missing)(const EVP_PKEY *pk), | ||
| 994 | int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from), | ||
| 995 | int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), | ||
| 996 | int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, | ||
| 997 | ASN1_PCTX *pctx)); | ||
| 998 | |||
| 999 | void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, | ||
| 1000 | void (*pkey_free)(EVP_PKEY *pkey)); | ||
| 1001 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, | ||
| 1002 | int (*pkey_ctrl)(EVP_PKEY *pkey, int op, | ||
| 1003 | long arg1, void *arg2)); | ||
| 1004 | |||
| 1005 | |||
| 1006 | #define EVP_PKEY_OP_UNDEFINED 0 | ||
| 1007 | #define EVP_PKEY_OP_PARAMGEN (1<<1) | ||
| 1008 | #define EVP_PKEY_OP_KEYGEN (1<<2) | ||
| 1009 | #define EVP_PKEY_OP_SIGN (1<<3) | ||
| 1010 | #define EVP_PKEY_OP_VERIFY (1<<4) | ||
| 1011 | #define EVP_PKEY_OP_VERIFYRECOVER (1<<5) | ||
| 1012 | #define EVP_PKEY_OP_SIGNCTX (1<<6) | ||
| 1013 | #define EVP_PKEY_OP_VERIFYCTX (1<<7) | ||
| 1014 | #define EVP_PKEY_OP_ENCRYPT (1<<8) | ||
| 1015 | #define EVP_PKEY_OP_DECRYPT (1<<9) | ||
| 1016 | #define EVP_PKEY_OP_DERIVE (1<<10) | ||
| 1017 | |||
| 1018 | #define EVP_PKEY_OP_TYPE_SIG \ | ||
| 1019 | (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ | ||
| 1020 | | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) | ||
| 1021 | |||
| 1022 | #define EVP_PKEY_OP_TYPE_CRYPT \ | ||
| 1023 | (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) | ||
| 1024 | |||
| 1025 | #define EVP_PKEY_OP_TYPE_NOGEN \ | ||
| 1026 | (EVP_PKEY_OP_SIG | EVP_PKEY_OP_CRYPT | EVP_PKEY_OP_DERIVE) | ||
| 1027 | |||
| 1028 | #define EVP_PKEY_OP_TYPE_GEN \ | ||
| 1029 | (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) | ||
| 1030 | |||
| 1031 | #define EVP_PKEY_CTX_set_signature_md(ctx, md) \ | ||
| 1032 | EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ | ||
| 1033 | EVP_PKEY_CTRL_MD, 0, (void *)md) | ||
| 1034 | |||
| 1035 | #define EVP_PKEY_CTRL_MD 1 | ||
| 1036 | #define EVP_PKEY_CTRL_PEER_KEY 2 | ||
| 1037 | |||
| 1038 | #define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 | ||
| 1039 | #define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 | ||
| 1040 | |||
| 1041 | #define EVP_PKEY_CTRL_PKCS7_SIGN 5 | ||
| 1042 | |||
| 1043 | #define EVP_PKEY_CTRL_SET_MAC_KEY 6 | ||
| 1044 | |||
| 1045 | #define EVP_PKEY_CTRL_DIGESTINIT 7 | ||
| 1046 | |||
| 1047 | /* Used by GOST key encryption in TLS */ | ||
| 1048 | #define EVP_PKEY_CTRL_SET_IV 8 | ||
| 1049 | |||
| 1050 | #define EVP_PKEY_CTRL_CMS_ENCRYPT 9 | ||
| 1051 | #define EVP_PKEY_CTRL_CMS_DECRYPT 10 | ||
| 1052 | #define EVP_PKEY_CTRL_CMS_SIGN 11 | ||
| 1053 | |||
| 1054 | #define EVP_PKEY_ALG_CTRL 0x1000 | ||
| 1055 | |||
| 1056 | |||
| 1057 | #define EVP_PKEY_FLAG_AUTOARGLEN 2 | ||
| 1058 | |||
| 1059 | const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); | ||
| 1060 | EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags); | ||
| 1061 | void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); | ||
| 1062 | int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); | ||
| 1063 | |||
| 1064 | EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); | ||
| 1065 | EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); | ||
| 1066 | EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); | ||
| 1067 | void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); | ||
| 1068 | |||
| 1069 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, | ||
| 1070 | int cmd, int p1, void *p2); | ||
| 1071 | int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, | ||
| 1072 | const char *value); | ||
| 1073 | |||
| 1074 | int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); | ||
| 1075 | void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); | ||
| 1076 | |||
| 1077 | EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, | ||
| 1078 | unsigned char *key, int keylen); | ||
| 1079 | |||
| 1080 | void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); | ||
| 1081 | void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); | ||
| 1082 | EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); | ||
| 1083 | |||
| 1084 | EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); | ||
| 1085 | |||
| 1086 | void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); | ||
| 1087 | void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); | ||
| 1088 | |||
| 1089 | int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); | ||
| 1090 | int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, | ||
| 1091 | unsigned char *sig, size_t *siglen, | ||
| 1092 | const unsigned char *tbs, size_t tbslen); | ||
| 1093 | int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); | ||
| 1094 | int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, | ||
| 1095 | const unsigned char *sig, size_t siglen, | ||
| 1096 | const unsigned char *tbs, size_t tbslen); | ||
| 1097 | int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); | ||
| 1098 | int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, | ||
| 1099 | unsigned char *rout, size_t *routlen, | ||
| 1100 | const unsigned char *sig, size_t siglen); | ||
| 1101 | int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); | ||
| 1102 | int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, | ||
| 1103 | unsigned char *out, size_t *outlen, | ||
| 1104 | const unsigned char *in, size_t inlen); | ||
| 1105 | int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); | ||
| 1106 | int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, | ||
| 1107 | unsigned char *out, size_t *outlen, | ||
| 1108 | const unsigned char *in, size_t inlen); | ||
| 1109 | |||
| 1110 | int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); | ||
| 1111 | int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); | ||
| 1112 | int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); | ||
| 1113 | |||
| 1114 | typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); | ||
| 1115 | |||
| 1116 | int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); | ||
| 1117 | int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); | ||
| 1118 | int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); | ||
| 1119 | int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); | ||
| 1120 | |||
| 1121 | void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); | ||
| 1122 | EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); | ||
| 1123 | |||
| 1124 | int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); | ||
| 1125 | |||
| 1126 | void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, | ||
| 1127 | int (*init)(EVP_PKEY_CTX *ctx)); | ||
| 1128 | |||
| 1129 | void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, | ||
| 1130 | int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)); | ||
| 1131 | |||
| 1132 | void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, | ||
| 1133 | void (*cleanup)(EVP_PKEY_CTX *ctx)); | ||
| 1134 | |||
| 1135 | void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, | ||
| 1136 | int (*paramgen_init)(EVP_PKEY_CTX *ctx), | ||
| 1137 | int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); | ||
| 1138 | |||
| 1139 | void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, | ||
| 1140 | int (*keygen_init)(EVP_PKEY_CTX *ctx), | ||
| 1141 | int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); | ||
| 950 | 1142 | ||
| 951 | void EVP_add_alg_module(void); | 1143 | void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, |
| 1144 | int (*sign_init)(EVP_PKEY_CTX *ctx), | ||
| 1145 | int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | ||
| 1146 | const unsigned char *tbs, size_t tbslen)); | ||
| 1147 | |||
| 1148 | void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, | ||
| 1149 | int (*verify_init)(EVP_PKEY_CTX *ctx), | ||
| 1150 | int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, | ||
| 1151 | const unsigned char *tbs, size_t tbslen)); | ||
| 1152 | |||
| 1153 | void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, | ||
| 1154 | int (*verify_recover_init)(EVP_PKEY_CTX *ctx), | ||
| 1155 | int (*verify_recover)(EVP_PKEY_CTX *ctx, | ||
| 1156 | unsigned char *sig, size_t *siglen, | ||
| 1157 | const unsigned char *tbs, size_t tbslen)); | ||
| 1158 | |||
| 1159 | void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, | ||
| 1160 | int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), | ||
| 1161 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | ||
| 1162 | EVP_MD_CTX *mctx)); | ||
| 1163 | |||
| 1164 | void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, | ||
| 1165 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), | ||
| 1166 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen, | ||
| 1167 | EVP_MD_CTX *mctx)); | ||
| 1168 | |||
| 1169 | void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, | ||
| 1170 | int (*encrypt_init)(EVP_PKEY_CTX *ctx), | ||
| 1171 | int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | ||
| 1172 | const unsigned char *in, size_t inlen)); | ||
| 1173 | |||
| 1174 | void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, | ||
| 1175 | int (*decrypt_init)(EVP_PKEY_CTX *ctx), | ||
| 1176 | int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | ||
| 1177 | const unsigned char *in, size_t inlen)); | ||
| 1178 | |||
| 1179 | void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, | ||
| 1180 | int (*derive_init)(EVP_PKEY_CTX *ctx), | ||
| 1181 | int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)); | ||
| 1182 | |||
| 1183 | void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, | ||
| 1184 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2), | ||
| 1185 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, | ||
| 1186 | const char *type, const char *value)); | ||
| 952 | 1187 | ||
| 953 | /* BEGIN ERROR CODES */ | 1188 | /* BEGIN ERROR CODES */ |
| 954 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 1189 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| @@ -961,46 +1196,66 @@ void ERR_load_EVP_strings(void); | |||
| 961 | /* Function codes. */ | 1196 | /* Function codes. */ |
| 962 | #define EVP_F_AESNI_INIT_KEY 165 | 1197 | #define EVP_F_AESNI_INIT_KEY 165 |
| 963 | #define EVP_F_AES_INIT_KEY 133 | 1198 | #define EVP_F_AES_INIT_KEY 133 |
| 964 | #define EVP_F_ALG_MODULE_INIT 138 | ||
| 965 | #define EVP_F_CAMELLIA_INIT_KEY 159 | 1199 | #define EVP_F_CAMELLIA_INIT_KEY 159 |
| 966 | #define EVP_F_D2I_PKEY 100 | 1200 | #define EVP_F_D2I_PKEY 100 |
| 967 | #define EVP_F_DO_EVP_ENC_ENGINE 140 | 1201 | #define EVP_F_DO_SIGVER_INIT 161 |
| 968 | #define EVP_F_DO_EVP_ENC_ENGINE_FULL 141 | ||
| 969 | #define EVP_F_DO_EVP_MD_ENGINE 139 | ||
| 970 | #define EVP_F_DO_EVP_MD_ENGINE_FULL 142 | ||
| 971 | #define EVP_F_DSAPKEY2PKCS8 134 | 1202 | #define EVP_F_DSAPKEY2PKCS8 134 |
| 972 | #define EVP_F_DSA_PKEY2PKCS8 135 | 1203 | #define EVP_F_DSA_PKEY2PKCS8 135 |
| 973 | #define EVP_F_ECDSA_PKEY2PKCS8 129 | 1204 | #define EVP_F_ECDSA_PKEY2PKCS8 129 |
| 974 | #define EVP_F_ECKEY_PKEY2PKCS8 132 | 1205 | #define EVP_F_ECKEY_PKEY2PKCS8 132 |
| 975 | #define EVP_F_EVP_CIPHERINIT 137 | ||
| 976 | #define EVP_F_EVP_CIPHERINIT_EX 123 | 1206 | #define EVP_F_EVP_CIPHERINIT_EX 123 |
| 1207 | #define EVP_F_EVP_CIPHER_CTX_COPY 163 | ||
| 977 | #define EVP_F_EVP_CIPHER_CTX_CTRL 124 | 1208 | #define EVP_F_EVP_CIPHER_CTX_CTRL 124 |
| 978 | #define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 | 1209 | #define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 |
| 979 | #define EVP_F_EVP_DECRYPTFINAL_EX 101 | 1210 | #define EVP_F_EVP_DECRYPTFINAL_EX 101 |
| 980 | #define EVP_F_EVP_DIGESTINIT 136 | ||
| 981 | #define EVP_F_EVP_DIGESTINIT_EX 128 | 1211 | #define EVP_F_EVP_DIGESTINIT_EX 128 |
| 982 | #define EVP_F_EVP_ENCRYPTFINAL_EX 127 | 1212 | #define EVP_F_EVP_ENCRYPTFINAL_EX 127 |
| 983 | #define EVP_F_EVP_MD_CTX_COPY_EX 110 | 1213 | #define EVP_F_EVP_MD_CTX_COPY_EX 110 |
| 1214 | #define EVP_F_EVP_MD_SIZE 162 | ||
| 984 | #define EVP_F_EVP_OPENINIT 102 | 1215 | #define EVP_F_EVP_OPENINIT 102 |
| 985 | #define EVP_F_EVP_PBE_ALG_ADD 115 | 1216 | #define EVP_F_EVP_PBE_ALG_ADD 115 |
| 1217 | #define EVP_F_EVP_PBE_ALG_ADD_TYPE 160 | ||
| 986 | #define EVP_F_EVP_PBE_CIPHERINIT 116 | 1218 | #define EVP_F_EVP_PBE_CIPHERINIT 116 |
| 987 | #define EVP_F_EVP_PKCS82PKEY 111 | 1219 | #define EVP_F_EVP_PKCS82PKEY 111 |
| 1220 | #define EVP_F_EVP_PKCS82PKEY_BROKEN 136 | ||
| 988 | #define EVP_F_EVP_PKEY2PKCS8_BROKEN 113 | 1221 | #define EVP_F_EVP_PKEY2PKCS8_BROKEN 113 |
| 989 | #define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 | 1222 | #define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 |
| 1223 | #define EVP_F_EVP_PKEY_CTX_CTRL 137 | ||
| 1224 | #define EVP_F_EVP_PKEY_CTX_CTRL_STR 150 | ||
| 1225 | #define EVP_F_EVP_PKEY_CTX_DUP 156 | ||
| 990 | #define EVP_F_EVP_PKEY_DECRYPT 104 | 1226 | #define EVP_F_EVP_PKEY_DECRYPT 104 |
| 1227 | #define EVP_F_EVP_PKEY_DECRYPT_INIT 138 | ||
| 1228 | #define EVP_F_EVP_PKEY_DECRYPT_OLD 151 | ||
| 1229 | #define EVP_F_EVP_PKEY_DERIVE 153 | ||
| 1230 | #define EVP_F_EVP_PKEY_DERIVE_INIT 154 | ||
| 1231 | #define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155 | ||
| 991 | #define EVP_F_EVP_PKEY_ENCRYPT 105 | 1232 | #define EVP_F_EVP_PKEY_ENCRYPT 105 |
| 1233 | #define EVP_F_EVP_PKEY_ENCRYPT_INIT 139 | ||
| 1234 | #define EVP_F_EVP_PKEY_ENCRYPT_OLD 152 | ||
| 992 | #define EVP_F_EVP_PKEY_GET1_DH 119 | 1235 | #define EVP_F_EVP_PKEY_GET1_DH 119 |
| 993 | #define EVP_F_EVP_PKEY_GET1_DSA 120 | 1236 | #define EVP_F_EVP_PKEY_GET1_DSA 120 |
| 994 | #define EVP_F_EVP_PKEY_GET1_ECDSA 130 | 1237 | #define EVP_F_EVP_PKEY_GET1_ECDSA 130 |
| 995 | #define EVP_F_EVP_PKEY_GET1_EC_KEY 131 | 1238 | #define EVP_F_EVP_PKEY_GET1_EC_KEY 131 |
| 996 | #define EVP_F_EVP_PKEY_GET1_RSA 121 | 1239 | #define EVP_F_EVP_PKEY_GET1_RSA 121 |
| 1240 | #define EVP_F_EVP_PKEY_KEYGEN 146 | ||
| 1241 | #define EVP_F_EVP_PKEY_KEYGEN_INIT 147 | ||
| 997 | #define EVP_F_EVP_PKEY_NEW 106 | 1242 | #define EVP_F_EVP_PKEY_NEW 106 |
| 1243 | #define EVP_F_EVP_PKEY_PARAMGEN 148 | ||
| 1244 | #define EVP_F_EVP_PKEY_PARAMGEN_INIT 149 | ||
| 1245 | #define EVP_F_EVP_PKEY_SIGN 140 | ||
| 1246 | #define EVP_F_EVP_PKEY_SIGN_INIT 141 | ||
| 1247 | #define EVP_F_EVP_PKEY_VERIFY 142 | ||
| 1248 | #define EVP_F_EVP_PKEY_VERIFY_INIT 143 | ||
| 1249 | #define EVP_F_EVP_PKEY_VERIFY_RECOVER 144 | ||
| 1250 | #define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145 | ||
| 998 | #define EVP_F_EVP_RIJNDAEL 126 | 1251 | #define EVP_F_EVP_RIJNDAEL 126 |
| 999 | #define EVP_F_EVP_SIGNFINAL 107 | 1252 | #define EVP_F_EVP_SIGNFINAL 107 |
| 1000 | #define EVP_F_EVP_VERIFYFINAL 108 | 1253 | #define EVP_F_EVP_VERIFYFINAL 108 |
| 1254 | #define EVP_F_INT_CTX_NEW 157 | ||
| 1001 | #define EVP_F_PKCS5_PBE_KEYIVGEN 117 | 1255 | #define EVP_F_PKCS5_PBE_KEYIVGEN 117 |
| 1002 | #define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 | 1256 | #define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 |
| 1003 | #define EVP_F_PKCS8_SET_BROKEN 112 | 1257 | #define EVP_F_PKCS8_SET_BROKEN 112 |
| 1258 | #define EVP_F_PKEY_SET_TYPE 158 | ||
| 1004 | #define EVP_F_RC2_MAGIC_TO_METH 109 | 1259 | #define EVP_F_RC2_MAGIC_TO_METH 109 |
| 1005 | #define EVP_F_RC5_CTRL 125 | 1260 | #define EVP_F_RC5_CTRL 125 |
| 1006 | 1261 | ||
| @@ -1012,41 +1267,52 @@ void ERR_load_EVP_strings(void); | |||
| 1012 | #define EVP_R_BAD_KEY_LENGTH 137 | 1267 | #define EVP_R_BAD_KEY_LENGTH 137 |
| 1013 | #define EVP_R_BN_DECODE_ERROR 112 | 1268 | #define EVP_R_BN_DECODE_ERROR 112 |
| 1014 | #define EVP_R_BN_PUBKEY_ERROR 113 | 1269 | #define EVP_R_BN_PUBKEY_ERROR 113 |
| 1270 | #define EVP_R_BUFFER_TOO_SMALL 155 | ||
| 1015 | #define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 | 1271 | #define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 |
| 1016 | #define EVP_R_CIPHER_PARAMETER_ERROR 122 | 1272 | #define EVP_R_CIPHER_PARAMETER_ERROR 122 |
| 1273 | #define EVP_R_COMMAND_NOT_SUPPORTED 147 | ||
| 1017 | #define EVP_R_CTRL_NOT_IMPLEMENTED 132 | 1274 | #define EVP_R_CTRL_NOT_IMPLEMENTED 132 |
| 1018 | #define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 | 1275 | #define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 |
| 1019 | #define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 | 1276 | #define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 |
| 1020 | #define EVP_R_DECODE_ERROR 114 | 1277 | #define EVP_R_DECODE_ERROR 114 |
| 1021 | #define EVP_R_DIFFERENT_KEY_TYPES 101 | 1278 | #define EVP_R_DIFFERENT_KEY_TYPES 101 |
| 1022 | #define EVP_R_DISABLED_FOR_FIPS 144 | 1279 | #define EVP_R_DIFFERENT_PARAMETERS 153 |
| 1023 | #define EVP_R_ENCODE_ERROR 115 | 1280 | #define EVP_R_ENCODE_ERROR 115 |
| 1024 | #define EVP_R_ERROR_LOADING_SECTION 145 | ||
| 1025 | #define EVP_R_ERROR_SETTING_FIPS_MODE 146 | ||
| 1026 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 | 1281 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 |
| 1027 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 | 1282 | #define EVP_R_EXPECTING_AN_RSA_KEY 127 |
| 1028 | #define EVP_R_EXPECTING_A_DH_KEY 128 | 1283 | #define EVP_R_EXPECTING_A_DH_KEY 128 |
| 1029 | #define EVP_R_EXPECTING_A_DSA_KEY 129 | 1284 | #define EVP_R_EXPECTING_A_DSA_KEY 129 |
| 1030 | #define EVP_R_EXPECTING_A_ECDSA_KEY 141 | 1285 | #define EVP_R_EXPECTING_A_ECDSA_KEY 141 |
| 1031 | #define EVP_R_EXPECTING_A_EC_KEY 142 | 1286 | #define EVP_R_EXPECTING_A_EC_KEY 142 |
| 1032 | #define EVP_R_FIPS_MODE_NOT_SUPPORTED 147 | ||
| 1033 | #define EVP_R_INITIALIZATION_ERROR 134 | 1287 | #define EVP_R_INITIALIZATION_ERROR 134 |
| 1034 | #define EVP_R_INPUT_NOT_INITIALIZED 111 | 1288 | #define EVP_R_INPUT_NOT_INITIALIZED 111 |
| 1035 | #define EVP_R_INVALID_FIPS_MODE 148 | 1289 | #define EVP_R_INVALID_DIGEST 152 |
| 1036 | #define EVP_R_INVALID_KEY_LENGTH 130 | 1290 | #define EVP_R_INVALID_KEY_LENGTH 130 |
| 1291 | #define EVP_R_INVALID_OPERATION 148 | ||
| 1037 | #define EVP_R_IV_TOO_LARGE 102 | 1292 | #define EVP_R_IV_TOO_LARGE 102 |
| 1038 | #define EVP_R_KEYGEN_FAILURE 120 | 1293 | #define EVP_R_KEYGEN_FAILURE 120 |
| 1294 | #define EVP_R_MESSAGE_DIGEST_IS_NULL 159 | ||
| 1295 | #define EVP_R_METHOD_NOT_SUPPORTED 144 | ||
| 1039 | #define EVP_R_MISSING_PARAMETERS 103 | 1296 | #define EVP_R_MISSING_PARAMETERS 103 |
| 1040 | #define EVP_R_NO_CIPHER_SET 131 | 1297 | #define EVP_R_NO_CIPHER_SET 131 |
| 1298 | #define EVP_R_NO_DEFAULT_DIGEST 158 | ||
| 1041 | #define EVP_R_NO_DIGEST_SET 139 | 1299 | #define EVP_R_NO_DIGEST_SET 139 |
| 1042 | #define EVP_R_NO_DSA_PARAMETERS 116 | 1300 | #define EVP_R_NO_DSA_PARAMETERS 116 |
| 1301 | #define EVP_R_NO_KEY_SET 154 | ||
| 1302 | #define EVP_R_NO_OPERATION_SET 149 | ||
| 1043 | #define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 | 1303 | #define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 |
| 1044 | #define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 | 1304 | #define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 |
| 1305 | #define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150 | ||
| 1306 | #define EVP_R_OPERATON_NOT_INITIALIZED 151 | ||
| 1045 | #define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 | 1307 | #define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 |
| 1308 | #define EVP_R_PRIVATE_KEY_DECODE_ERROR 145 | ||
| 1309 | #define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146 | ||
| 1046 | #define EVP_R_PUBLIC_KEY_NOT_RSA 106 | 1310 | #define EVP_R_PUBLIC_KEY_NOT_RSA 106 |
| 1047 | #define EVP_R_UNKNOWN_OPTION 149 | 1311 | #define EVP_R_UNKNOWN_CIPHER 160 |
| 1312 | #define EVP_R_UNKNOWN_DIGEST 161 | ||
| 1048 | #define EVP_R_UNKNOWN_PBE_ALGORITHM 121 | 1313 | #define EVP_R_UNKNOWN_PBE_ALGORITHM 121 |
| 1049 | #define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 | 1314 | #define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 |
| 1315 | #define EVP_R_UNSUPPORTED_ALGORITHM 156 | ||
| 1050 | #define EVP_R_UNSUPPORTED_CIPHER 107 | 1316 | #define EVP_R_UNSUPPORTED_CIPHER 107 |
| 1051 | #define EVP_R_UNSUPPORTED_KEYLENGTH 123 | 1317 | #define EVP_R_UNSUPPORTED_KEYLENGTH 123 |
| 1052 | #define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 | 1318 | #define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 |
| @@ -1056,7 +1322,6 @@ void ERR_load_EVP_strings(void); | |||
| 1056 | #define EVP_R_UNSUPPORTED_SALT_TYPE 126 | 1322 | #define EVP_R_UNSUPPORTED_SALT_TYPE 126 |
| 1057 | #define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 | 1323 | #define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 |
| 1058 | #define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 | 1324 | #define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 |
| 1059 | #define EVP_R_SEED_KEY_SETUP_FAILED 162 | ||
| 1060 | 1325 | ||
| 1061 | #ifdef __cplusplus | 1326 | #ifdef __cplusplus |
| 1062 | } | 1327 | } |
diff --git a/src/lib/libcrypto/evp/evp_cnf.c b/src/lib/libcrypto/evp/evp_cnf.c deleted file mode 100644 index 2e4db30235..0000000000 --- a/src/lib/libcrypto/evp/evp_cnf.c +++ /dev/null | |||
| @@ -1,125 +0,0 @@ | |||
| 1 | /* evp_cnf.c */ | ||
| 2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project 2007. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2007 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 <ctype.h> | ||
| 61 | #include <openssl/crypto.h> | ||
| 62 | #include "cryptlib.h" | ||
| 63 | #include <openssl/conf.h> | ||
| 64 | #include <openssl/dso.h> | ||
| 65 | #include <openssl/x509.h> | ||
| 66 | #include <openssl/x509v3.h> | ||
| 67 | #ifdef OPENSSL_FIPS | ||
| 68 | #include <openssl/fips.h> | ||
| 69 | #endif | ||
| 70 | |||
| 71 | |||
| 72 | /* Algorithm configuration module. */ | ||
| 73 | |||
| 74 | static int alg_module_init(CONF_IMODULE *md, const CONF *cnf) | ||
| 75 | { | ||
| 76 | int i; | ||
| 77 | const char *oid_section; | ||
| 78 | STACK_OF(CONF_VALUE) *sktmp; | ||
| 79 | CONF_VALUE *oval; | ||
| 80 | oid_section = CONF_imodule_get_value(md); | ||
| 81 | if(!(sktmp = NCONF_get_section(cnf, oid_section))) | ||
| 82 | { | ||
| 83 | EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_ERROR_LOADING_SECTION); | ||
| 84 | return 0; | ||
| 85 | } | ||
| 86 | for(i = 0; i < sk_CONF_VALUE_num(sktmp); i++) | ||
| 87 | { | ||
| 88 | oval = sk_CONF_VALUE_value(sktmp, i); | ||
| 89 | if (!strcmp(oval->name, "fips_mode")) | ||
| 90 | { | ||
| 91 | int m; | ||
| 92 | if (!X509V3_get_value_bool(oval, &m)) | ||
| 93 | { | ||
| 94 | EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_INVALID_FIPS_MODE); | ||
| 95 | return 0; | ||
| 96 | } | ||
| 97 | if (m > 0) | ||
| 98 | { | ||
| 99 | #ifdef OPENSSL_FIPS | ||
| 100 | if (!FIPS_mode() && !FIPS_mode_set(1)) | ||
| 101 | { | ||
| 102 | EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_ERROR_SETTING_FIPS_MODE); | ||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | #else | ||
| 106 | EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_FIPS_MODE_NOT_SUPPORTED); | ||
| 107 | return 0; | ||
| 108 | #endif | ||
| 109 | } | ||
| 110 | } | ||
| 111 | else | ||
| 112 | { | ||
| 113 | EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_UNKNOWN_OPTION); | ||
| 114 | ERR_add_error_data(4, "name=", oval->name, | ||
| 115 | ", value=", oval->value); | ||
| 116 | } | ||
| 117 | |||
| 118 | } | ||
| 119 | return 1; | ||
| 120 | } | ||
| 121 | |||
| 122 | void EVP_add_alg_module(void) | ||
| 123 | { | ||
| 124 | CONF_module_add("alg_section", alg_module_init, 0); | ||
| 125 | } | ||
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index 30e0ca4d9f..bead6a2170 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
| @@ -66,16 +66,14 @@ | |||
| 66 | #endif | 66 | #endif |
| 67 | #include "evp_locl.h" | 67 | #include "evp_locl.h" |
| 68 | 68 | ||
| 69 | #ifdef OPENSSL_FIPS | ||
| 70 | #define M_do_cipher(ctx, out, in, inl) \ | ||
| 71 | EVP_Cipher(ctx,out,in,inl) | ||
| 72 | #else | ||
| 73 | #define M_do_cipher(ctx, out, in, inl) \ | ||
| 74 | ctx->cipher->do_cipher(ctx,out,in,inl) | ||
| 75 | #endif | ||
| 76 | |||
| 77 | const char EVP_version[]="EVP" OPENSSL_VERSION_PTEXT; | 69 | const char EVP_version[]="EVP" OPENSSL_VERSION_PTEXT; |
| 78 | 70 | ||
| 71 | void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) | ||
| 72 | { | ||
| 73 | memset(ctx,0,sizeof(EVP_CIPHER_CTX)); | ||
| 74 | /* ctx->cipher=NULL; */ | ||
| 75 | } | ||
| 76 | |||
| 79 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) | 77 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) |
| 80 | { | 78 | { |
| 81 | EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx); | 79 | EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx); |
| @@ -92,6 +90,144 @@ int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | |||
| 92 | return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc); | 90 | return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc); |
| 93 | } | 91 | } |
| 94 | 92 | ||
| 93 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | ||
| 94 | const unsigned char *key, const unsigned char *iv, int enc) | ||
| 95 | { | ||
| 96 | if (enc == -1) | ||
| 97 | enc = ctx->encrypt; | ||
| 98 | else | ||
| 99 | { | ||
| 100 | if (enc) | ||
| 101 | enc = 1; | ||
| 102 | ctx->encrypt = enc; | ||
| 103 | } | ||
| 104 | #ifndef OPENSSL_NO_ENGINE | ||
| 105 | /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts | ||
| 106 | * so this context may already have an ENGINE! Try to avoid releasing | ||
| 107 | * the previous handle, re-querying for an ENGINE, and having a | ||
| 108 | * reinitialisation, when it may all be unecessary. */ | ||
| 109 | if (ctx->engine && ctx->cipher && (!cipher || | ||
| 110 | (cipher && (cipher->nid == ctx->cipher->nid)))) | ||
| 111 | goto skip_to_init; | ||
| 112 | #endif | ||
| 113 | if (cipher) | ||
| 114 | { | ||
| 115 | /* Ensure a context left lying around from last time is cleared | ||
| 116 | * (the previous check attempted to avoid this if the same | ||
| 117 | * ENGINE and EVP_CIPHER could be used). */ | ||
| 118 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 119 | |||
| 120 | /* Restore encrypt field: it is zeroed by cleanup */ | ||
| 121 | ctx->encrypt = enc; | ||
| 122 | #ifndef OPENSSL_NO_ENGINE | ||
| 123 | if(impl) | ||
| 124 | { | ||
| 125 | if (!ENGINE_init(impl)) | ||
| 126 | { | ||
| 127 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); | ||
| 128 | return 0; | ||
| 129 | } | ||
| 130 | } | ||
| 131 | else | ||
| 132 | /* Ask if an ENGINE is reserved for this job */ | ||
| 133 | impl = ENGINE_get_cipher_engine(cipher->nid); | ||
| 134 | if(impl) | ||
| 135 | { | ||
| 136 | /* There's an ENGINE for this job ... (apparently) */ | ||
| 137 | const EVP_CIPHER *c = ENGINE_get_cipher(impl, cipher->nid); | ||
| 138 | if(!c) | ||
| 139 | { | ||
| 140 | /* One positive side-effect of US's export | ||
| 141 | * control history, is that we should at least | ||
| 142 | * be able to avoid using US mispellings of | ||
| 143 | * "initialisation"? */ | ||
| 144 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); | ||
| 145 | return 0; | ||
| 146 | } | ||
| 147 | /* We'll use the ENGINE's private cipher definition */ | ||
| 148 | cipher = c; | ||
| 149 | /* Store the ENGINE functional reference so we know | ||
| 150 | * 'cipher' came from an ENGINE and we need to release | ||
| 151 | * it when done. */ | ||
| 152 | ctx->engine = impl; | ||
| 153 | } | ||
| 154 | else | ||
| 155 | ctx->engine = NULL; | ||
| 156 | #endif | ||
| 157 | |||
| 158 | ctx->cipher=cipher; | ||
| 159 | if (ctx->cipher->ctx_size) | ||
| 160 | { | ||
| 161 | ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); | ||
| 162 | if (!ctx->cipher_data) | ||
| 163 | { | ||
| 164 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE); | ||
| 165 | return 0; | ||
| 166 | } | ||
| 167 | } | ||
| 168 | else | ||
| 169 | { | ||
| 170 | ctx->cipher_data = NULL; | ||
| 171 | } | ||
| 172 | ctx->key_len = cipher->key_len; | ||
| 173 | ctx->flags = 0; | ||
| 174 | if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT) | ||
| 175 | { | ||
| 176 | if(!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) | ||
| 177 | { | ||
| 178 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_INITIALIZATION_ERROR); | ||
| 179 | return 0; | ||
| 180 | } | ||
| 181 | } | ||
| 182 | } | ||
| 183 | else if(!ctx->cipher) | ||
| 184 | { | ||
| 185 | EVPerr(EVP_F_EVP_CIPHERINIT_EX, EVP_R_NO_CIPHER_SET); | ||
| 186 | return 0; | ||
| 187 | } | ||
| 188 | #ifndef OPENSSL_NO_ENGINE | ||
| 189 | skip_to_init: | ||
| 190 | #endif | ||
| 191 | /* we assume block size is a power of 2 in *cryptUpdate */ | ||
| 192 | OPENSSL_assert(ctx->cipher->block_size == 1 | ||
| 193 | || ctx->cipher->block_size == 8 | ||
| 194 | || ctx->cipher->block_size == 16); | ||
| 195 | |||
| 196 | if(!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV)) { | ||
| 197 | switch(EVP_CIPHER_CTX_mode(ctx)) { | ||
| 198 | |||
| 199 | case EVP_CIPH_STREAM_CIPHER: | ||
| 200 | case EVP_CIPH_ECB_MODE: | ||
| 201 | break; | ||
| 202 | |||
| 203 | case EVP_CIPH_CFB_MODE: | ||
| 204 | case EVP_CIPH_OFB_MODE: | ||
| 205 | |||
| 206 | ctx->num = 0; | ||
| 207 | |||
| 208 | case EVP_CIPH_CBC_MODE: | ||
| 209 | |||
| 210 | OPENSSL_assert(EVP_CIPHER_CTX_iv_length(ctx) <= | ||
| 211 | (int)sizeof(ctx->iv)); | ||
| 212 | if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx)); | ||
| 213 | memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx)); | ||
| 214 | break; | ||
| 215 | |||
| 216 | default: | ||
| 217 | return 0; | ||
| 218 | break; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | |||
| 222 | if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { | ||
| 223 | if(!ctx->cipher->init(ctx,key,iv,enc)) return 0; | ||
| 224 | } | ||
| 225 | ctx->buf_len=0; | ||
| 226 | ctx->final_used=0; | ||
| 227 | ctx->block_mask=ctx->cipher->block_size-1; | ||
| 228 | return 1; | ||
| 229 | } | ||
| 230 | |||
| 95 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | 231 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
| 96 | const unsigned char *in, int inl) | 232 | const unsigned char *in, int inl) |
| 97 | { | 233 | { |
| @@ -151,7 +287,7 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | |||
| 151 | 287 | ||
| 152 | if(ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0) | 288 | if(ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0) |
| 153 | { | 289 | { |
| 154 | if(M_do_cipher(ctx,out,in,inl)) | 290 | if(ctx->cipher->do_cipher(ctx,out,in,inl)) |
| 155 | { | 291 | { |
| 156 | *outl=inl; | 292 | *outl=inl; |
| 157 | return 1; | 293 | return 1; |
| @@ -178,7 +314,7 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | |||
| 178 | { | 314 | { |
| 179 | j=bl-i; | 315 | j=bl-i; |
| 180 | memcpy(&(ctx->buf[i]),in,j); | 316 | memcpy(&(ctx->buf[i]),in,j); |
| 181 | if(!M_do_cipher(ctx,out,ctx->buf,bl)) return 0; | 317 | if(!ctx->cipher->do_cipher(ctx,out,ctx->buf,bl)) return 0; |
| 182 | inl-=j; | 318 | inl-=j; |
| 183 | in+=j; | 319 | in+=j; |
| 184 | out+=bl; | 320 | out+=bl; |
| @@ -191,7 +327,7 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | |||
| 191 | inl-=i; | 327 | inl-=i; |
| 192 | if (inl > 0) | 328 | if (inl > 0) |
| 193 | { | 329 | { |
| 194 | if(!M_do_cipher(ctx,out,in,inl)) return 0; | 330 | if(!ctx->cipher->do_cipher(ctx,out,in,inl)) return 0; |
| 195 | *outl+=inl; | 331 | *outl+=inl; |
| 196 | } | 332 | } |
| 197 | 333 | ||
| @@ -235,7 +371,7 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 235 | n=b-bl; | 371 | n=b-bl; |
| 236 | for (i=bl; i<b; i++) | 372 | for (i=bl; i<b; i++) |
| 237 | ctx->buf[i]=n; | 373 | ctx->buf[i]=n; |
| 238 | ret=M_do_cipher(ctx,out,ctx->buf,b); | 374 | ret=ctx->cipher->do_cipher(ctx,out,ctx->buf,b); |
| 239 | 375 | ||
| 240 | 376 | ||
| 241 | if(ret) | 377 | if(ret) |
| @@ -357,6 +493,28 @@ void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) | |||
| 357 | } | 493 | } |
| 358 | } | 494 | } |
| 359 | 495 | ||
| 496 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | ||
| 497 | { | ||
| 498 | if (c->cipher != NULL) | ||
| 499 | { | ||
| 500 | if(c->cipher->cleanup && !c->cipher->cleanup(c)) | ||
| 501 | return 0; | ||
| 502 | /* Cleanse cipher context data */ | ||
| 503 | if (c->cipher_data) | ||
| 504 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); | ||
| 505 | } | ||
| 506 | if (c->cipher_data) | ||
| 507 | OPENSSL_free(c->cipher_data); | ||
| 508 | #ifndef OPENSSL_NO_ENGINE | ||
| 509 | if (c->engine) | ||
| 510 | /* The EVP_CIPHER we used belongs to an ENGINE, release the | ||
| 511 | * functional reference we held for this reason. */ | ||
| 512 | ENGINE_finish(c->engine); | ||
| 513 | #endif | ||
| 514 | memset(c,0,sizeof(EVP_CIPHER_CTX)); | ||
| 515 | return 1; | ||
| 516 | } | ||
| 517 | |||
| 360 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) | 518 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) |
| 361 | { | 519 | { |
| 362 | if(c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH) | 520 | if(c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH) |
| @@ -378,6 +536,27 @@ int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad) | |||
| 378 | return 1; | 536 | return 1; |
| 379 | } | 537 | } |
| 380 | 538 | ||
| 539 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
| 540 | { | ||
| 541 | int ret; | ||
| 542 | if(!ctx->cipher) { | ||
| 543 | EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_NO_CIPHER_SET); | ||
| 544 | return 0; | ||
| 545 | } | ||
| 546 | |||
| 547 | if(!ctx->cipher->ctrl) { | ||
| 548 | EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_CTRL_NOT_IMPLEMENTED); | ||
| 549 | return 0; | ||
| 550 | } | ||
| 551 | |||
| 552 | ret = ctx->cipher->ctrl(ctx, type, arg, ptr); | ||
| 553 | if(ret == -1) { | ||
| 554 | EVPerr(EVP_F_EVP_CIPHER_CTX_CTRL, EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED); | ||
| 555 | return 0; | ||
| 556 | } | ||
| 557 | return ret; | ||
| 558 | } | ||
| 559 | |||
| 381 | int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) | 560 | int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) |
| 382 | { | 561 | { |
| 383 | if (ctx->cipher->flags & EVP_CIPH_RAND_KEY) | 562 | if (ctx->cipher->flags & EVP_CIPH_RAND_KEY) |
| @@ -387,54 +566,38 @@ int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) | |||
| 387 | return 1; | 566 | return 1; |
| 388 | } | 567 | } |
| 389 | 568 | ||
| 390 | #ifndef OPENSSL_NO_ENGINE | 569 | int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) |
| 391 | |||
| 392 | #ifdef OPENSSL_FIPS | ||
| 393 | |||
| 394 | static int do_evp_enc_engine_full(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pcipher, ENGINE *impl) | ||
| 395 | { | 570 | { |
| 396 | if(impl) | 571 | if ((in == NULL) || (in->cipher == NULL)) |
| 397 | { | 572 | { |
| 398 | if (!ENGINE_init(impl)) | 573 | EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,EVP_R_INPUT_NOT_INITIALIZED); |
| 399 | { | 574 | return 0; |
| 400 | EVPerr(EVP_F_DO_EVP_ENC_ENGINE_FULL, EVP_R_INITIALIZATION_ERROR); | ||
| 401 | return 0; | ||
| 402 | } | ||
| 403 | } | 575 | } |
| 404 | else | 576 | #ifndef OPENSSL_NO_ENGINE |
| 405 | /* Ask if an ENGINE is reserved for this job */ | 577 | /* Make sure it's safe to copy a cipher context using an ENGINE */ |
| 406 | impl = ENGINE_get_cipher_engine((*pcipher)->nid); | 578 | if (in->engine && !ENGINE_init(in->engine)) |
| 407 | if(impl) | 579 | { |
| 580 | EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_ENGINE_LIB); | ||
| 581 | return 0; | ||
| 582 | } | ||
| 583 | #endif | ||
| 584 | |||
| 585 | EVP_CIPHER_CTX_cleanup(out); | ||
| 586 | memcpy(out,in,sizeof *out); | ||
| 587 | |||
| 588 | if (in->cipher_data && in->cipher->ctx_size) | ||
| 408 | { | 589 | { |
| 409 | /* There's an ENGINE for this job ... (apparently) */ | 590 | out->cipher_data=OPENSSL_malloc(in->cipher->ctx_size); |
| 410 | const EVP_CIPHER *c = ENGINE_get_cipher(impl, (*pcipher)->nid); | 591 | if (!out->cipher_data) |
| 411 | if(!c) | ||
| 412 | { | 592 | { |
| 413 | /* One positive side-effect of US's export | 593 | EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_MALLOC_FAILURE); |
| 414 | * control history, is that we should at least | ||
| 415 | * be able to avoid using US mispellings of | ||
| 416 | * "initialisation"? */ | ||
| 417 | EVPerr(EVP_F_DO_EVP_ENC_ENGINE_FULL, EVP_R_INITIALIZATION_ERROR); | ||
| 418 | return 0; | 594 | return 0; |
| 419 | } | 595 | } |
| 420 | /* We'll use the ENGINE's private cipher definition */ | 596 | memcpy(out->cipher_data,in->cipher_data,in->cipher->ctx_size); |
| 421 | *pcipher = c; | ||
| 422 | /* Store the ENGINE functional reference so we know | ||
| 423 | * 'cipher' came from an ENGINE and we need to release | ||
| 424 | * it when done. */ | ||
| 425 | ctx->engine = impl; | ||
| 426 | } | 597 | } |
| 427 | else | ||
| 428 | ctx->engine = NULL; | ||
| 429 | return 1; | ||
| 430 | } | ||
| 431 | 598 | ||
| 432 | void int_EVP_CIPHER_init_engine_callbacks(void) | 599 | if (in->cipher->flags & EVP_CIPH_CUSTOM_COPY) |
| 433 | { | 600 | return in->cipher->ctrl((EVP_CIPHER_CTX *)in, EVP_CTRL_COPY, 0, out); |
| 434 | int_EVP_CIPHER_set_engine_callbacks( | 601 | return 1; |
| 435 | ENGINE_finish, do_evp_enc_engine_full); | ||
| 436 | } | 602 | } |
| 437 | 603 | ||
| 438 | #endif | ||
| 439 | |||
| 440 | #endif | ||
diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c index ec2d127cd8..6b585c7483 100644 --- a/src/lib/libcrypto/evp/evp_err.c +++ b/src/lib/libcrypto/evp/evp_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/evp/evp_err.c */ | 1 | /* crypto/evp/evp_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -72,46 +72,66 @@ 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_AESNI_INIT_KEY), "AESNI_INIT_KEY"}, |
| 74 | {ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, | 74 | {ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, |
| 75 | {ERR_FUNC(EVP_F_ALG_MODULE_INIT), "ALG_MODULE_INIT"}, | ||
| 76 | {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, | 75 | {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, |
| 77 | {ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, | 76 | {ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, |
| 78 | {ERR_FUNC(EVP_F_DO_EVP_ENC_ENGINE), "DO_EVP_ENC_ENGINE"}, | 77 | {ERR_FUNC(EVP_F_DO_SIGVER_INIT), "DO_SIGVER_INIT"}, |
| 79 | {ERR_FUNC(EVP_F_DO_EVP_ENC_ENGINE_FULL), "DO_EVP_ENC_ENGINE_FULL"}, | ||
| 80 | {ERR_FUNC(EVP_F_DO_EVP_MD_ENGINE), "DO_EVP_MD_ENGINE"}, | ||
| 81 | {ERR_FUNC(EVP_F_DO_EVP_MD_ENGINE_FULL), "DO_EVP_MD_ENGINE_FULL"}, | ||
| 82 | {ERR_FUNC(EVP_F_DSAPKEY2PKCS8), "DSAPKEY2PKCS8"}, | 78 | {ERR_FUNC(EVP_F_DSAPKEY2PKCS8), "DSAPKEY2PKCS8"}, |
| 83 | {ERR_FUNC(EVP_F_DSA_PKEY2PKCS8), "DSA_PKEY2PKCS8"}, | 79 | {ERR_FUNC(EVP_F_DSA_PKEY2PKCS8), "DSA_PKEY2PKCS8"}, |
| 84 | {ERR_FUNC(EVP_F_ECDSA_PKEY2PKCS8), "ECDSA_PKEY2PKCS8"}, | 80 | {ERR_FUNC(EVP_F_ECDSA_PKEY2PKCS8), "ECDSA_PKEY2PKCS8"}, |
| 85 | {ERR_FUNC(EVP_F_ECKEY_PKEY2PKCS8), "ECKEY_PKEY2PKCS8"}, | 81 | {ERR_FUNC(EVP_F_ECKEY_PKEY2PKCS8), "ECKEY_PKEY2PKCS8"}, |
| 86 | {ERR_FUNC(EVP_F_EVP_CIPHERINIT), "EVP_CipherInit"}, | ||
| 87 | {ERR_FUNC(EVP_F_EVP_CIPHERINIT_EX), "EVP_CipherInit_ex"}, | 82 | {ERR_FUNC(EVP_F_EVP_CIPHERINIT_EX), "EVP_CipherInit_ex"}, |
| 83 | {ERR_FUNC(EVP_F_EVP_CIPHER_CTX_COPY), "EVP_CIPHER_CTX_copy"}, | ||
| 88 | {ERR_FUNC(EVP_F_EVP_CIPHER_CTX_CTRL), "EVP_CIPHER_CTX_ctrl"}, | 84 | {ERR_FUNC(EVP_F_EVP_CIPHER_CTX_CTRL), "EVP_CIPHER_CTX_ctrl"}, |
| 89 | {ERR_FUNC(EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH), "EVP_CIPHER_CTX_set_key_length"}, | 85 | {ERR_FUNC(EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH), "EVP_CIPHER_CTX_set_key_length"}, |
| 90 | {ERR_FUNC(EVP_F_EVP_DECRYPTFINAL_EX), "EVP_DecryptFinal_ex"}, | 86 | {ERR_FUNC(EVP_F_EVP_DECRYPTFINAL_EX), "EVP_DecryptFinal_ex"}, |
| 91 | {ERR_FUNC(EVP_F_EVP_DIGESTINIT), "EVP_DigestInit"}, | ||
| 92 | {ERR_FUNC(EVP_F_EVP_DIGESTINIT_EX), "EVP_DigestInit_ex"}, | 87 | {ERR_FUNC(EVP_F_EVP_DIGESTINIT_EX), "EVP_DigestInit_ex"}, |
| 93 | {ERR_FUNC(EVP_F_EVP_ENCRYPTFINAL_EX), "EVP_EncryptFinal_ex"}, | 88 | {ERR_FUNC(EVP_F_EVP_ENCRYPTFINAL_EX), "EVP_EncryptFinal_ex"}, |
| 94 | {ERR_FUNC(EVP_F_EVP_MD_CTX_COPY_EX), "EVP_MD_CTX_copy_ex"}, | 89 | {ERR_FUNC(EVP_F_EVP_MD_CTX_COPY_EX), "EVP_MD_CTX_copy_ex"}, |
| 90 | {ERR_FUNC(EVP_F_EVP_MD_SIZE), "EVP_MD_SIZE"}, | ||
| 95 | {ERR_FUNC(EVP_F_EVP_OPENINIT), "EVP_OpenInit"}, | 91 | {ERR_FUNC(EVP_F_EVP_OPENINIT), "EVP_OpenInit"}, |
| 96 | {ERR_FUNC(EVP_F_EVP_PBE_ALG_ADD), "EVP_PBE_alg_add"}, | 92 | {ERR_FUNC(EVP_F_EVP_PBE_ALG_ADD), "EVP_PBE_alg_add"}, |
| 93 | {ERR_FUNC(EVP_F_EVP_PBE_ALG_ADD_TYPE), "EVP_PBE_alg_add_type"}, | ||
| 97 | {ERR_FUNC(EVP_F_EVP_PBE_CIPHERINIT), "EVP_PBE_CipherInit"}, | 94 | {ERR_FUNC(EVP_F_EVP_PBE_CIPHERINIT), "EVP_PBE_CipherInit"}, |
| 98 | {ERR_FUNC(EVP_F_EVP_PKCS82PKEY), "EVP_PKCS82PKEY"}, | 95 | {ERR_FUNC(EVP_F_EVP_PKCS82PKEY), "EVP_PKCS82PKEY"}, |
| 96 | {ERR_FUNC(EVP_F_EVP_PKCS82PKEY_BROKEN), "EVP_PKCS82PKEY_BROKEN"}, | ||
| 99 | {ERR_FUNC(EVP_F_EVP_PKEY2PKCS8_BROKEN), "EVP_PKEY2PKCS8_broken"}, | 97 | {ERR_FUNC(EVP_F_EVP_PKEY2PKCS8_BROKEN), "EVP_PKEY2PKCS8_broken"}, |
| 100 | {ERR_FUNC(EVP_F_EVP_PKEY_COPY_PARAMETERS), "EVP_PKEY_copy_parameters"}, | 98 | {ERR_FUNC(EVP_F_EVP_PKEY_COPY_PARAMETERS), "EVP_PKEY_copy_parameters"}, |
| 99 | {ERR_FUNC(EVP_F_EVP_PKEY_CTX_CTRL), "EVP_PKEY_CTX_ctrl"}, | ||
| 100 | {ERR_FUNC(EVP_F_EVP_PKEY_CTX_CTRL_STR), "EVP_PKEY_CTX_ctrl_str"}, | ||
| 101 | {ERR_FUNC(EVP_F_EVP_PKEY_CTX_DUP), "EVP_PKEY_CTX_dup"}, | ||
| 101 | {ERR_FUNC(EVP_F_EVP_PKEY_DECRYPT), "EVP_PKEY_decrypt"}, | 102 | {ERR_FUNC(EVP_F_EVP_PKEY_DECRYPT), "EVP_PKEY_decrypt"}, |
| 103 | {ERR_FUNC(EVP_F_EVP_PKEY_DECRYPT_INIT), "EVP_PKEY_decrypt_init"}, | ||
| 104 | {ERR_FUNC(EVP_F_EVP_PKEY_DECRYPT_OLD), "EVP_PKEY_decrypt_old"}, | ||
| 105 | {ERR_FUNC(EVP_F_EVP_PKEY_DERIVE), "EVP_PKEY_derive"}, | ||
| 106 | {ERR_FUNC(EVP_F_EVP_PKEY_DERIVE_INIT), "EVP_PKEY_derive_init"}, | ||
| 107 | {ERR_FUNC(EVP_F_EVP_PKEY_DERIVE_SET_PEER), "EVP_PKEY_derive_set_peer"}, | ||
| 102 | {ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT), "EVP_PKEY_encrypt"}, | 108 | {ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT), "EVP_PKEY_encrypt"}, |
| 109 | {ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT_INIT), "EVP_PKEY_encrypt_init"}, | ||
| 110 | {ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT_OLD), "EVP_PKEY_encrypt_old"}, | ||
| 103 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_DH), "EVP_PKEY_get1_DH"}, | 111 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_DH), "EVP_PKEY_get1_DH"}, |
| 104 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_DSA), "EVP_PKEY_get1_DSA"}, | 112 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_DSA), "EVP_PKEY_get1_DSA"}, |
| 105 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_ECDSA), "EVP_PKEY_GET1_ECDSA"}, | 113 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_ECDSA), "EVP_PKEY_GET1_ECDSA"}, |
| 106 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_EC_KEY), "EVP_PKEY_get1_EC_KEY"}, | 114 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_EC_KEY), "EVP_PKEY_get1_EC_KEY"}, |
| 107 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_RSA), "EVP_PKEY_get1_RSA"}, | 115 | {ERR_FUNC(EVP_F_EVP_PKEY_GET1_RSA), "EVP_PKEY_get1_RSA"}, |
| 116 | {ERR_FUNC(EVP_F_EVP_PKEY_KEYGEN), "EVP_PKEY_keygen"}, | ||
| 117 | {ERR_FUNC(EVP_F_EVP_PKEY_KEYGEN_INIT), "EVP_PKEY_keygen_init"}, | ||
| 108 | {ERR_FUNC(EVP_F_EVP_PKEY_NEW), "EVP_PKEY_new"}, | 118 | {ERR_FUNC(EVP_F_EVP_PKEY_NEW), "EVP_PKEY_new"}, |
| 119 | {ERR_FUNC(EVP_F_EVP_PKEY_PARAMGEN), "EVP_PKEY_paramgen"}, | ||
| 120 | {ERR_FUNC(EVP_F_EVP_PKEY_PARAMGEN_INIT), "EVP_PKEY_paramgen_init"}, | ||
| 121 | {ERR_FUNC(EVP_F_EVP_PKEY_SIGN), "EVP_PKEY_sign"}, | ||
| 122 | {ERR_FUNC(EVP_F_EVP_PKEY_SIGN_INIT), "EVP_PKEY_sign_init"}, | ||
| 123 | {ERR_FUNC(EVP_F_EVP_PKEY_VERIFY), "EVP_PKEY_verify"}, | ||
| 124 | {ERR_FUNC(EVP_F_EVP_PKEY_VERIFY_INIT), "EVP_PKEY_verify_init"}, | ||
| 125 | {ERR_FUNC(EVP_F_EVP_PKEY_VERIFY_RECOVER), "EVP_PKEY_verify_recover"}, | ||
| 126 | {ERR_FUNC(EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT), "EVP_PKEY_verify_recover_init"}, | ||
| 109 | {ERR_FUNC(EVP_F_EVP_RIJNDAEL), "EVP_RIJNDAEL"}, | 127 | {ERR_FUNC(EVP_F_EVP_RIJNDAEL), "EVP_RIJNDAEL"}, |
| 110 | {ERR_FUNC(EVP_F_EVP_SIGNFINAL), "EVP_SignFinal"}, | 128 | {ERR_FUNC(EVP_F_EVP_SIGNFINAL), "EVP_SignFinal"}, |
| 111 | {ERR_FUNC(EVP_F_EVP_VERIFYFINAL), "EVP_VerifyFinal"}, | 129 | {ERR_FUNC(EVP_F_EVP_VERIFYFINAL), "EVP_VerifyFinal"}, |
| 130 | {ERR_FUNC(EVP_F_INT_CTX_NEW), "INT_CTX_NEW"}, | ||
| 112 | {ERR_FUNC(EVP_F_PKCS5_PBE_KEYIVGEN), "PKCS5_PBE_keyivgen"}, | 131 | {ERR_FUNC(EVP_F_PKCS5_PBE_KEYIVGEN), "PKCS5_PBE_keyivgen"}, |
| 113 | {ERR_FUNC(EVP_F_PKCS5_V2_PBE_KEYIVGEN), "PKCS5_v2_PBE_keyivgen"}, | 132 | {ERR_FUNC(EVP_F_PKCS5_V2_PBE_KEYIVGEN), "PKCS5_v2_PBE_keyivgen"}, |
| 114 | {ERR_FUNC(EVP_F_PKCS8_SET_BROKEN), "PKCS8_set_broken"}, | 133 | {ERR_FUNC(EVP_F_PKCS8_SET_BROKEN), "PKCS8_set_broken"}, |
| 134 | {ERR_FUNC(EVP_F_PKEY_SET_TYPE), "PKEY_SET_TYPE"}, | ||
| 115 | {ERR_FUNC(EVP_F_RC2_MAGIC_TO_METH), "RC2_MAGIC_TO_METH"}, | 135 | {ERR_FUNC(EVP_F_RC2_MAGIC_TO_METH), "RC2_MAGIC_TO_METH"}, |
| 116 | {ERR_FUNC(EVP_F_RC5_CTRL), "RC5_CTRL"}, | 136 | {ERR_FUNC(EVP_F_RC5_CTRL), "RC5_CTRL"}, |
| 117 | {0,NULL} | 137 | {0,NULL} |
| @@ -126,42 +146,52 @@ static ERR_STRING_DATA EVP_str_reasons[]= | |||
| 126 | {ERR_REASON(EVP_R_BAD_KEY_LENGTH) ,"bad key length"}, | 146 | {ERR_REASON(EVP_R_BAD_KEY_LENGTH) ,"bad key length"}, |
| 127 | {ERR_REASON(EVP_R_BN_DECODE_ERROR) ,"bn decode error"}, | 147 | {ERR_REASON(EVP_R_BN_DECODE_ERROR) ,"bn decode error"}, |
| 128 | {ERR_REASON(EVP_R_BN_PUBKEY_ERROR) ,"bn pubkey error"}, | 148 | {ERR_REASON(EVP_R_BN_PUBKEY_ERROR) ,"bn pubkey error"}, |
| 149 | {ERR_REASON(EVP_R_BUFFER_TOO_SMALL) ,"buffer too small"}, | ||
| 129 | {ERR_REASON(EVP_R_CAMELLIA_KEY_SETUP_FAILED),"camellia key setup failed"}, | 150 | {ERR_REASON(EVP_R_CAMELLIA_KEY_SETUP_FAILED),"camellia key setup failed"}, |
| 130 | {ERR_REASON(EVP_R_CIPHER_PARAMETER_ERROR),"cipher parameter error"}, | 151 | {ERR_REASON(EVP_R_CIPHER_PARAMETER_ERROR),"cipher parameter error"}, |
| 152 | {ERR_REASON(EVP_R_COMMAND_NOT_SUPPORTED) ,"command not supported"}, | ||
| 131 | {ERR_REASON(EVP_R_CTRL_NOT_IMPLEMENTED) ,"ctrl not implemented"}, | 153 | {ERR_REASON(EVP_R_CTRL_NOT_IMPLEMENTED) ,"ctrl not implemented"}, |
| 132 | {ERR_REASON(EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED),"ctrl operation not implemented"}, | 154 | {ERR_REASON(EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED),"ctrl operation not implemented"}, |
| 133 | {ERR_REASON(EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH),"data not multiple of block length"}, | 155 | {ERR_REASON(EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH),"data not multiple of block length"}, |
| 134 | {ERR_REASON(EVP_R_DECODE_ERROR) ,"decode error"}, | 156 | {ERR_REASON(EVP_R_DECODE_ERROR) ,"decode error"}, |
| 135 | {ERR_REASON(EVP_R_DIFFERENT_KEY_TYPES) ,"different key types"}, | 157 | {ERR_REASON(EVP_R_DIFFERENT_KEY_TYPES) ,"different key types"}, |
| 136 | {ERR_REASON(EVP_R_DISABLED_FOR_FIPS) ,"disabled for fips"}, | 158 | {ERR_REASON(EVP_R_DIFFERENT_PARAMETERS) ,"different parameters"}, |
| 137 | {ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"}, | 159 | {ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"}, |
| 138 | {ERR_REASON(EVP_R_ERROR_LOADING_SECTION) ,"error loading section"}, | ||
| 139 | {ERR_REASON(EVP_R_ERROR_SETTING_FIPS_MODE),"error setting fips mode"}, | ||
| 140 | {ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"}, | 160 | {ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"}, |
| 141 | {ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"}, | 161 | {ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"}, |
| 142 | {ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"}, | 162 | {ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"}, |
| 143 | {ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"}, | 163 | {ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"}, |
| 144 | {ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"}, | 164 | {ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"}, |
| 145 | {ERR_REASON(EVP_R_EXPECTING_A_EC_KEY) ,"expecting a ec key"}, | 165 | {ERR_REASON(EVP_R_EXPECTING_A_EC_KEY) ,"expecting a ec key"}, |
| 146 | {ERR_REASON(EVP_R_FIPS_MODE_NOT_SUPPORTED),"fips mode not supported"}, | ||
| 147 | {ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"}, | 166 | {ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"}, |
| 148 | {ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"}, | 167 | {ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"}, |
| 149 | {ERR_REASON(EVP_R_INVALID_FIPS_MODE) ,"invalid fips mode"}, | 168 | {ERR_REASON(EVP_R_INVALID_DIGEST) ,"invalid digest"}, |
| 150 | {ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"}, | 169 | {ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"}, |
| 170 | {ERR_REASON(EVP_R_INVALID_OPERATION) ,"invalid operation"}, | ||
| 151 | {ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"}, | 171 | {ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"}, |
| 152 | {ERR_REASON(EVP_R_KEYGEN_FAILURE) ,"keygen failure"}, | 172 | {ERR_REASON(EVP_R_KEYGEN_FAILURE) ,"keygen failure"}, |
| 173 | {ERR_REASON(EVP_R_MESSAGE_DIGEST_IS_NULL),"message digest is null"}, | ||
| 174 | {ERR_REASON(EVP_R_METHOD_NOT_SUPPORTED) ,"method not supported"}, | ||
| 153 | {ERR_REASON(EVP_R_MISSING_PARAMETERS) ,"missing parameters"}, | 175 | {ERR_REASON(EVP_R_MISSING_PARAMETERS) ,"missing parameters"}, |
| 154 | {ERR_REASON(EVP_R_NO_CIPHER_SET) ,"no cipher set"}, | 176 | {ERR_REASON(EVP_R_NO_CIPHER_SET) ,"no cipher set"}, |
| 177 | {ERR_REASON(EVP_R_NO_DEFAULT_DIGEST) ,"no default digest"}, | ||
| 155 | {ERR_REASON(EVP_R_NO_DIGEST_SET) ,"no digest set"}, | 178 | {ERR_REASON(EVP_R_NO_DIGEST_SET) ,"no digest set"}, |
| 156 | {ERR_REASON(EVP_R_NO_DSA_PARAMETERS) ,"no dsa parameters"}, | 179 | {ERR_REASON(EVP_R_NO_DSA_PARAMETERS) ,"no dsa parameters"}, |
| 180 | {ERR_REASON(EVP_R_NO_KEY_SET) ,"no key set"}, | ||
| 181 | {ERR_REASON(EVP_R_NO_OPERATION_SET) ,"no operation set"}, | ||
| 157 | {ERR_REASON(EVP_R_NO_SIGN_FUNCTION_CONFIGURED),"no sign function configured"}, | 182 | {ERR_REASON(EVP_R_NO_SIGN_FUNCTION_CONFIGURED),"no sign function configured"}, |
| 158 | {ERR_REASON(EVP_R_NO_VERIFY_FUNCTION_CONFIGURED),"no verify function configured"}, | 183 | {ERR_REASON(EVP_R_NO_VERIFY_FUNCTION_CONFIGURED),"no verify function configured"}, |
| 184 | {ERR_REASON(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE),"operation not supported for this keytype"}, | ||
| 185 | {ERR_REASON(EVP_R_OPERATON_NOT_INITIALIZED),"operaton not initialized"}, | ||
| 159 | {ERR_REASON(EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE),"pkcs8 unknown broken type"}, | 186 | {ERR_REASON(EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE),"pkcs8 unknown broken type"}, |
| 187 | {ERR_REASON(EVP_R_PRIVATE_KEY_DECODE_ERROR),"private key decode error"}, | ||
| 188 | {ERR_REASON(EVP_R_PRIVATE_KEY_ENCODE_ERROR),"private key encode error"}, | ||
| 160 | {ERR_REASON(EVP_R_PUBLIC_KEY_NOT_RSA) ,"public key not rsa"}, | 189 | {ERR_REASON(EVP_R_PUBLIC_KEY_NOT_RSA) ,"public key not rsa"}, |
| 161 | {ERR_REASON(EVP_R_SEED_KEY_SETUP_FAILED) ,"seed key setup failed"}, | 190 | {ERR_REASON(EVP_R_UNKNOWN_CIPHER) ,"unknown cipher"}, |
| 162 | {ERR_REASON(EVP_R_UNKNOWN_OPTION) ,"unknown option"}, | 191 | {ERR_REASON(EVP_R_UNKNOWN_DIGEST) ,"unknown digest"}, |
| 163 | {ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, | 192 | {ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, |
| 164 | {ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, | 193 | {ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, |
| 194 | {ERR_REASON(EVP_R_UNSUPPORTED_ALGORITHM) ,"unsupported algorithm"}, | ||
| 165 | {ERR_REASON(EVP_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, | 195 | {ERR_REASON(EVP_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, |
| 166 | {ERR_REASON(EVP_R_UNSUPPORTED_KEYLENGTH) ,"unsupported keylength"}, | 196 | {ERR_REASON(EVP_R_UNSUPPORTED_KEYLENGTH) ,"unsupported keylength"}, |
| 167 | {ERR_REASON(EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION),"unsupported key derivation function"}, | 197 | {ERR_REASON(EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION),"unsupported key derivation function"}, |
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c index 361ea69ab6..839d6a3a16 100644 --- a/src/lib/libcrypto/evp/evp_key.c +++ b/src/lib/libcrypto/evp/evp_key.c | |||
| @@ -90,6 +90,11 @@ char *EVP_get_pw_prompt(void) | |||
| 90 | * this function will fail */ | 90 | * this function will fail */ |
| 91 | int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify) | 91 | int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify) |
| 92 | { | 92 | { |
| 93 | return EVP_read_pw_string_min(buf, 0, len, prompt, verify); | ||
| 94 | } | ||
| 95 | |||
| 96 | int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt, int verify) | ||
| 97 | { | ||
| 93 | int ret; | 98 | int ret; |
| 94 | char buff[BUFSIZ]; | 99 | char buff[BUFSIZ]; |
| 95 | UI *ui; | 100 | UI *ui; |
| @@ -97,10 +102,10 @@ int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify) | |||
| 97 | if ((prompt == NULL) && (prompt_string[0] != '\0')) | 102 | if ((prompt == NULL) && (prompt_string[0] != '\0')) |
| 98 | prompt=prompt_string; | 103 | prompt=prompt_string; |
| 99 | ui = UI_new(); | 104 | ui = UI_new(); |
| 100 | UI_add_input_string(ui,prompt,0,buf,0,(len>=BUFSIZ)?BUFSIZ-1:len); | 105 | UI_add_input_string(ui,prompt,0,buf,min,(len>=BUFSIZ)?BUFSIZ-1:len); |
| 101 | if (verify) | 106 | if (verify) |
| 102 | UI_add_verify_string(ui,prompt,0, | 107 | UI_add_verify_string(ui,prompt,0, |
| 103 | buff,0,(len>=BUFSIZ)?BUFSIZ-1:len,buf); | 108 | buff,min,(len>=BUFSIZ)?BUFSIZ-1:len,buf); |
| 104 | ret = UI_process(ui); | 109 | ret = UI_process(ui); |
| 105 | UI_free(ui); | 110 | UI_free(ui); |
| 106 | OPENSSL_cleanse(buff,BUFSIZ); | 111 | OPENSSL_cleanse(buff,BUFSIZ); |
diff --git a/src/lib/libcrypto/evp/evp_lib.c b/src/lib/libcrypto/evp/evp_lib.c index 174cf6c594..40951a04f0 100644 --- a/src/lib/libcrypto/evp/evp_lib.c +++ b/src/lib/libcrypto/evp/evp_lib.c | |||
| @@ -67,8 +67,6 @@ int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | |||
| 67 | 67 | ||
| 68 | if (c->cipher->set_asn1_parameters != NULL) | 68 | if (c->cipher->set_asn1_parameters != NULL) |
| 69 | ret=c->cipher->set_asn1_parameters(c,type); | 69 | ret=c->cipher->set_asn1_parameters(c,type); |
| 70 | else if (c->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) | ||
| 71 | ret=EVP_CIPHER_set_asn1_iv(c, type); | ||
| 72 | else | 70 | else |
| 73 | ret=-1; | 71 | ret=-1; |
| 74 | return(ret); | 72 | return(ret); |
| @@ -80,8 +78,6 @@ int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | |||
| 80 | 78 | ||
| 81 | if (c->cipher->get_asn1_parameters != NULL) | 79 | if (c->cipher->get_asn1_parameters != NULL) |
| 82 | ret=c->cipher->get_asn1_parameters(c,type); | 80 | ret=c->cipher->get_asn1_parameters(c,type); |
| 83 | else if (c->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) | ||
| 84 | ret=EVP_CIPHER_get_asn1_iv(c, type); | ||
| 85 | else | 81 | else |
| 86 | ret=-1; | 82 | ret=-1; |
| 87 | return(ret); | 83 | return(ret); |
| @@ -163,6 +159,12 @@ int EVP_CIPHER_type(const EVP_CIPHER *ctx) | |||
| 163 | 159 | ||
| 164 | return NID_des_cfb64; | 160 | return NID_des_cfb64; |
| 165 | 161 | ||
| 162 | case NID_des_ede3_cfb64: | ||
| 163 | case NID_des_ede3_cfb8: | ||
| 164 | case NID_des_ede3_cfb1: | ||
| 165 | |||
| 166 | return NID_des_cfb64; | ||
| 167 | |||
| 166 | default: | 168 | default: |
| 167 | /* Check it has an OID and it is valid */ | 169 | /* Check it has an OID and it is valid */ |
| 168 | otmp = OBJ_nid2obj(nid); | 170 | otmp = OBJ_nid2obj(nid); |
| @@ -182,6 +184,11 @@ int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) | |||
| 182 | return ctx->cipher->block_size; | 184 | return ctx->cipher->block_size; |
| 183 | } | 185 | } |
| 184 | 186 | ||
| 187 | int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) | ||
| 188 | { | ||
| 189 | return ctx->cipher->do_cipher(ctx,out,in,inl); | ||
| 190 | } | ||
| 191 | |||
| 185 | const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx) | 192 | const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx) |
| 186 | { | 193 | { |
| 187 | return ctx->cipher; | 194 | return ctx->cipher; |
| @@ -192,6 +199,11 @@ unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher) | |||
| 192 | return cipher->flags; | 199 | return cipher->flags; |
| 193 | } | 200 | } |
| 194 | 201 | ||
| 202 | unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) | ||
| 203 | { | ||
| 204 | return ctx->cipher->flags; | ||
| 205 | } | ||
| 206 | |||
| 195 | void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx) | 207 | void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx) |
| 196 | { | 208 | { |
| 197 | return ctx->app_data; | 209 | return ctx->app_data; |
| @@ -207,6 +219,11 @@ int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) | |||
| 207 | return cipher->iv_len; | 219 | return cipher->iv_len; |
| 208 | } | 220 | } |
| 209 | 221 | ||
| 222 | int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) | ||
| 223 | { | ||
| 224 | return ctx->cipher->iv_len; | ||
| 225 | } | ||
| 226 | |||
| 210 | int EVP_CIPHER_key_length(const EVP_CIPHER *cipher) | 227 | int EVP_CIPHER_key_length(const EVP_CIPHER *cipher) |
| 211 | { | 228 | { |
| 212 | return cipher->key_len; | 229 | return cipher->key_len; |
| @@ -217,6 +234,11 @@ int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) | |||
| 217 | return ctx->key_len; | 234 | return ctx->key_len; |
| 218 | } | 235 | } |
| 219 | 236 | ||
| 237 | int EVP_CIPHER_nid(const EVP_CIPHER *cipher) | ||
| 238 | { | ||
| 239 | return cipher->nid; | ||
| 240 | } | ||
| 241 | |||
| 220 | int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) | 242 | int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) |
| 221 | { | 243 | { |
| 222 | return ctx->cipher->nid; | 244 | return ctx->cipher->nid; |
| @@ -239,11 +261,23 @@ int EVP_MD_pkey_type(const EVP_MD *md) | |||
| 239 | 261 | ||
| 240 | int EVP_MD_size(const EVP_MD *md) | 262 | int EVP_MD_size(const EVP_MD *md) |
| 241 | { | 263 | { |
| 264 | if (!md) | ||
| 265 | { | ||
| 266 | EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL); | ||
| 267 | return -1; | ||
| 268 | } | ||
| 242 | return md->md_size; | 269 | return md->md_size; |
| 243 | } | 270 | } |
| 244 | 271 | ||
| 245 | const EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx) | 272 | unsigned long EVP_MD_flags(const EVP_MD *md) |
| 273 | { | ||
| 274 | return md->flags; | ||
| 275 | } | ||
| 276 | |||
| 277 | const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx) | ||
| 246 | { | 278 | { |
| 279 | if (!ctx) | ||
| 280 | return NULL; | ||
| 247 | return ctx->digest; | 281 | return ctx->digest; |
| 248 | } | 282 | } |
| 249 | 283 | ||
diff --git a/src/lib/libcrypto/evp/evp_locl.h b/src/lib/libcrypto/evp/evp_locl.h index eabcc96f30..292d74c188 100644 --- a/src/lib/libcrypto/evp/evp_locl.h +++ b/src/lib/libcrypto/evp/evp_locl.h | |||
| @@ -61,38 +61,66 @@ | |||
| 61 | /* Wrapper functions for each cipher mode */ | 61 | /* Wrapper functions for each cipher mode */ |
| 62 | 62 | ||
| 63 | #define BLOCK_CIPHER_ecb_loop() \ | 63 | #define BLOCK_CIPHER_ecb_loop() \ |
| 64 | unsigned int i, bl; \ | 64 | size_t i, bl; \ |
| 65 | bl = ctx->cipher->block_size;\ | 65 | bl = ctx->cipher->block_size;\ |
| 66 | if(inl < bl) return 1;\ | 66 | if(inl < bl) return 1;\ |
| 67 | inl -= bl; \ | 67 | inl -= bl; \ |
| 68 | for(i=0; i <= inl; i+=bl) | 68 | for(i=0; i <= inl; i+=bl) |
| 69 | 69 | ||
| 70 | #define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \ | 70 | #define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \ |
| 71 | static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ | 71 | static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \ |
| 72 | {\ | 72 | {\ |
| 73 | BLOCK_CIPHER_ecb_loop() \ | 73 | BLOCK_CIPHER_ecb_loop() \ |
| 74 | cprefix##_ecb_encrypt(in + i, out + i, &((kstruct *)ctx->cipher_data)->ksched, ctx->encrypt);\ | 74 | cprefix##_ecb_encrypt(in + i, out + i, &((kstruct *)ctx->cipher_data)->ksched, ctx->encrypt);\ |
| 75 | return 1;\ | 75 | return 1;\ |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | #define EVP_MAXCHUNK ((size_t)1<<(sizeof(long)*8-2)) | ||
| 79 | |||
| 78 | #define BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) \ | 80 | #define BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) \ |
| 79 | static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ | 81 | static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \ |
| 80 | {\ | 82 | {\ |
| 81 | cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num);\ | 83 | while(inl>=EVP_MAXCHUNK)\ |
| 84 | {\ | ||
| 85 | cprefix##_ofb##cbits##_encrypt(in, out, (long)EVP_MAXCHUNK, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num);\ | ||
| 86 | inl-=EVP_MAXCHUNK;\ | ||
| 87 | in +=EVP_MAXCHUNK;\ | ||
| 88 | out+=EVP_MAXCHUNK;\ | ||
| 89 | }\ | ||
| 90 | if (inl)\ | ||
| 91 | cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num);\ | ||
| 82 | return 1;\ | 92 | return 1;\ |
| 83 | } | 93 | } |
| 84 | 94 | ||
| 85 | #define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \ | 95 | #define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \ |
| 86 | static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ | 96 | static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \ |
| 87 | {\ | 97 | {\ |
| 88 | cprefix##_cbc_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, ctx->encrypt);\ | 98 | while(inl>=EVP_MAXCHUNK) \ |
| 99 | {\ | ||
| 100 | cprefix##_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, ctx->encrypt);\ | ||
| 101 | inl-=EVP_MAXCHUNK;\ | ||
| 102 | in +=EVP_MAXCHUNK;\ | ||
| 103 | out+=EVP_MAXCHUNK;\ | ||
| 104 | }\ | ||
| 105 | if (inl)\ | ||
| 106 | cprefix##_cbc_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, ctx->encrypt);\ | ||
| 89 | return 1;\ | 107 | return 1;\ |
| 90 | } | 108 | } |
| 91 | 109 | ||
| 92 | #define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \ | 110 | #define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \ |
| 93 | static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ | 111 | static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \ |
| 94 | {\ | 112 | {\ |
| 95 | cprefix##_cfb##cbits##_encrypt(in, out, (long)((cbits==1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ?inl*8:inl), &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\ | 113 | size_t chunk=EVP_MAXCHUNK;\ |
| 114 | if (cbits==1) chunk>>=3;\ | ||
| 115 | if (inl<chunk) chunk=inl;\ | ||
| 116 | while(inl && inl>=chunk)\ | ||
| 117 | {\ | ||
| 118 | cprefix##_cfb##cbits##_encrypt(in, out, (long)((cbits==1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ?inl*8:inl), &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\ | ||
| 119 | inl-=chunk;\ | ||
| 120 | in +=chunk;\ | ||
| 121 | out+=chunk;\ | ||
| 122 | if(inl<chunk) chunk=inl;\ | ||
| 123 | }\ | ||
| 96 | return 1;\ | 124 | return 1;\ |
| 97 | } | 125 | } |
| 98 | 126 | ||
| @@ -139,10 +167,10 @@ BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, 1, \ | |||
| 139 | get_asn1, ctrl) | 167 | get_asn1, ctrl) |
| 140 | 168 | ||
| 141 | #define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \ | 169 | #define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \ |
| 142 | iv_len, flags, init_key, cleanup, set_asn1, \ | 170 | flags, init_key, cleanup, set_asn1, \ |
| 143 | get_asn1, ctrl) \ | 171 | get_asn1, ctrl) \ |
| 144 | BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \ | 172 | BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \ |
| 145 | iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl) | 173 | 0, flags, init_key, cleanup, set_asn1, get_asn1, ctrl) |
| 146 | 174 | ||
| 147 | #define BLOCK_CIPHER_defs(cname, kstruct, \ | 175 | #define BLOCK_CIPHER_defs(cname, kstruct, \ |
| 148 | nid, block_size, key_len, iv_len, cbits, flags, \ | 176 | nid, block_size, key_len, iv_len, cbits, flags, \ |
| @@ -153,7 +181,7 @@ BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, \ | |||
| 153 | flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \ | 181 | flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \ |
| 154 | BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \ | 182 | BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \ |
| 155 | flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \ | 183 | flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \ |
| 156 | BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, iv_len, flags, \ | 184 | BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags, \ |
| 157 | init_key, cleanup, set_asn1, get_asn1, ctrl) | 185 | init_key, cleanup, set_asn1, get_asn1, ctrl) |
| 158 | 186 | ||
| 159 | 187 | ||
| @@ -226,27 +254,92 @@ const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; } | |||
| 226 | 254 | ||
| 227 | #define EVP_C_DATA(kstruct, ctx) ((kstruct *)(ctx)->cipher_data) | 255 | #define EVP_C_DATA(kstruct, ctx) ((kstruct *)(ctx)->cipher_data) |
| 228 | 256 | ||
| 229 | #define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len,fl) \ | 257 | #define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len) \ |
| 230 | BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \ | 258 | BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \ |
| 231 | BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \ | 259 | BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \ |
| 232 | NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \ | 260 | NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \ |
| 233 | (fl)|EVP_CIPH_FLAG_DEFAULT_ASN1, \ | 261 | 0, cipher##_init_key, NULL, \ |
| 234 | cipher##_init_key, NULL, NULL, NULL, NULL) | 262 | EVP_CIPHER_set_asn1_iv, \ |
| 235 | 263 | EVP_CIPHER_get_asn1_iv, \ | |
| 236 | #ifdef OPENSSL_FIPS | 264 | NULL) |
| 237 | #define RC2_set_key private_RC2_set_key | 265 | |
| 238 | #define RC4_set_key private_RC4_set_key | 266 | struct evp_pkey_ctx_st |
| 239 | #define CAST_set_key private_CAST_set_key | 267 | { |
| 240 | #define RC5_32_set_key private_RC5_32_set_key | 268 | /* Method associated with this operation */ |
| 241 | #define BF_set_key private_BF_set_key | 269 | const EVP_PKEY_METHOD *pmeth; |
| 242 | #define Camellia_set_key private_Camellia_set_key | 270 | /* Engine that implements this method or NULL if builtin */ |
| 243 | #define idea_set_encrypt_key private_idea_set_encrypt_key | 271 | ENGINE *engine; |
| 244 | 272 | /* Key: may be NULL */ | |
| 245 | #define MD5_Init private_MD5_Init | 273 | EVP_PKEY *pkey; |
| 246 | #define MD4_Init private_MD4_Init | 274 | /* Peer key for key agreement, may be NULL */ |
| 247 | #define MD2_Init private_MD2_Init | 275 | EVP_PKEY *peerkey; |
| 248 | #define MDC2_Init private_MDC2_Init | 276 | /* Actual operation */ |
| 249 | #define SHA_Init private_SHA_Init | 277 | int operation; |
| 250 | 278 | /* Algorithm specific data */ | |
| 251 | #endif | 279 | void *data; |
| 280 | /* Application specific data */ | ||
| 281 | void *app_data; | ||
| 282 | /* Keygen callback */ | ||
| 283 | EVP_PKEY_gen_cb *pkey_gencb; | ||
| 284 | /* implementation specific keygen data */ | ||
| 285 | int *keygen_info; | ||
| 286 | int keygen_info_count; | ||
| 287 | } /* EVP_PKEY_CTX */; | ||
| 288 | |||
| 289 | #define EVP_PKEY_FLAG_DYNAMIC 1 | ||
| 290 | |||
| 291 | struct evp_pkey_method_st | ||
| 292 | { | ||
| 293 | int pkey_id; | ||
| 294 | int flags; | ||
| 295 | |||
| 296 | int (*init)(EVP_PKEY_CTX *ctx); | ||
| 297 | int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src); | ||
| 298 | void (*cleanup)(EVP_PKEY_CTX *ctx); | ||
| 299 | |||
| 300 | int (*paramgen_init)(EVP_PKEY_CTX *ctx); | ||
| 301 | int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey); | ||
| 302 | |||
| 303 | int (*keygen_init)(EVP_PKEY_CTX *ctx); | ||
| 304 | int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey); | ||
| 305 | |||
| 306 | int (*sign_init)(EVP_PKEY_CTX *ctx); | ||
| 307 | int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | ||
| 308 | const unsigned char *tbs, size_t tbslen); | ||
| 309 | |||
| 310 | int (*verify_init)(EVP_PKEY_CTX *ctx); | ||
| 311 | int (*verify)(EVP_PKEY_CTX *ctx, | ||
| 312 | const unsigned char *sig, size_t siglen, | ||
| 313 | const unsigned char *tbs, size_t tbslen); | ||
| 314 | |||
| 315 | int (*verify_recover_init)(EVP_PKEY_CTX *ctx); | ||
| 316 | int (*verify_recover)(EVP_PKEY_CTX *ctx, | ||
| 317 | unsigned char *rout, size_t *routlen, | ||
| 318 | const unsigned char *sig, size_t siglen); | ||
| 319 | |||
| 320 | int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); | ||
| 321 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | ||
| 322 | EVP_MD_CTX *mctx); | ||
| 323 | |||
| 324 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); | ||
| 325 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen, | ||
| 326 | EVP_MD_CTX *mctx); | ||
| 327 | |||
| 328 | int (*encrypt_init)(EVP_PKEY_CTX *ctx); | ||
| 329 | int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | ||
| 330 | const unsigned char *in, size_t inlen); | ||
| 331 | |||
| 332 | int (*decrypt_init)(EVP_PKEY_CTX *ctx); | ||
| 333 | int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | ||
| 334 | const unsigned char *in, size_t inlen); | ||
| 335 | |||
| 336 | int (*derive_init)(EVP_PKEY_CTX *ctx); | ||
| 337 | int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); | ||
| 338 | |||
| 339 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2); | ||
| 340 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value); | ||
| 341 | |||
| 342 | |||
| 343 | } /* EVP_PKEY_METHOD */; | ||
| 252 | 344 | ||
| 345 | void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); | ||
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c index 5e830be65f..c9d932d205 100644 --- a/src/lib/libcrypto/evp/evp_pbe.c +++ b/src/lib/libcrypto/evp/evp_pbe.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -59,79 +59,253 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/evp.h> | 61 | #include <openssl/evp.h> |
| 62 | #include <openssl/pkcs12.h> | ||
| 62 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 63 | 64 | ||
| 64 | /* Password based encryption (PBE) functions */ | 65 | /* Password based encryption (PBE) functions */ |
| 65 | 66 | ||
| 66 | static STACK *pbe_algs; | 67 | DECLARE_STACK_OF(EVP_PBE_CTL) |
| 68 | static STACK_OF(EVP_PBE_CTL) *pbe_algs; | ||
| 67 | 69 | ||
| 68 | /* Setup a cipher context from a PBE algorithm */ | 70 | /* Setup a cipher context from a PBE algorithm */ |
| 69 | 71 | ||
| 70 | typedef struct { | 72 | typedef struct |
| 71 | int pbe_nid; | 73 | { |
| 72 | const EVP_CIPHER *cipher; | 74 | int pbe_type; |
| 73 | const EVP_MD *md; | 75 | int pbe_nid; |
| 74 | EVP_PBE_KEYGEN *keygen; | 76 | int cipher_nid; |
| 75 | } EVP_PBE_CTL; | 77 | int md_nid; |
| 78 | EVP_PBE_KEYGEN *keygen; | ||
| 79 | } EVP_PBE_CTL; | ||
| 76 | 80 | ||
| 77 | int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | 81 | static const EVP_PBE_CTL builtin_pbe[] = |
| 78 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de) | 82 | { |
| 79 | { | 83 | {EVP_PBE_TYPE_OUTER, NID_pbeWithMD2AndDES_CBC, |
| 84 | NID_des_cbc, NID_md2, PKCS5_PBE_keyivgen}, | ||
| 85 | {EVP_PBE_TYPE_OUTER, NID_pbeWithMD5AndDES_CBC, | ||
| 86 | NID_des_cbc, NID_md5, PKCS5_PBE_keyivgen}, | ||
| 87 | {EVP_PBE_TYPE_OUTER, NID_pbeWithSHA1AndRC2_CBC, | ||
| 88 | NID_rc2_64_cbc, NID_sha1, PKCS5_PBE_keyivgen}, | ||
| 80 | 89 | ||
| 81 | EVP_PBE_CTL *pbetmp, pbelu; | 90 | {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And128BitRC4, |
| 82 | int i; | 91 | NID_rc4, NID_sha1, PKCS12_PBE_keyivgen}, |
| 83 | pbelu.pbe_nid = OBJ_obj2nid(pbe_obj); | 92 | {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And40BitRC4, |
| 84 | if (pbelu.pbe_nid != NID_undef) i = sk_find(pbe_algs, (char *)&pbelu); | 93 | NID_rc4_40, NID_sha1, PKCS12_PBE_keyivgen}, |
| 85 | else i = -1; | 94 | {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And3_Key_TripleDES_CBC, |
| 95 | NID_des_ede3_cbc, NID_sha1, PKCS12_PBE_keyivgen}, | ||
| 96 | {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And2_Key_TripleDES_CBC, | ||
| 97 | NID_des_ede_cbc, NID_sha1, PKCS12_PBE_keyivgen}, | ||
| 98 | {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And128BitRC2_CBC, | ||
| 99 | NID_rc2_cbc, NID_sha1, PKCS12_PBE_keyivgen}, | ||
| 100 | {EVP_PBE_TYPE_OUTER, NID_pbe_WithSHA1And40BitRC2_CBC, | ||
| 101 | NID_rc2_40_cbc, NID_sha1, PKCS12_PBE_keyivgen}, | ||
| 102 | |||
| 103 | #ifndef OPENSSL_NO_HMAC | ||
| 104 | {EVP_PBE_TYPE_OUTER, NID_pbes2, -1, -1, PKCS5_v2_PBE_keyivgen}, | ||
| 105 | #endif | ||
| 106 | {EVP_PBE_TYPE_OUTER, NID_pbeWithMD2AndRC2_CBC, | ||
| 107 | NID_rc2_64_cbc, NID_md2, PKCS5_PBE_keyivgen}, | ||
| 108 | {EVP_PBE_TYPE_OUTER, NID_pbeWithMD5AndRC2_CBC, | ||
| 109 | NID_rc2_64_cbc, NID_md5, PKCS5_PBE_keyivgen}, | ||
| 110 | {EVP_PBE_TYPE_OUTER, NID_pbeWithSHA1AndDES_CBC, | ||
| 111 | NID_des_cbc, NID_sha1, PKCS5_PBE_keyivgen}, | ||
| 112 | |||
| 113 | |||
| 114 | {EVP_PBE_TYPE_PRF, NID_hmacWithSHA1, -1, NID_sha1, 0}, | ||
| 115 | {EVP_PBE_TYPE_PRF, NID_hmacWithMD5, -1, NID_md5, 0}, | ||
| 116 | {EVP_PBE_TYPE_PRF, NID_hmacWithSHA224, -1, NID_sha224, 0}, | ||
| 117 | {EVP_PBE_TYPE_PRF, NID_hmacWithSHA256, -1, NID_sha256, 0}, | ||
| 118 | {EVP_PBE_TYPE_PRF, NID_hmacWithSHA384, -1, NID_sha384, 0}, | ||
| 119 | {EVP_PBE_TYPE_PRF, NID_hmacWithSHA512, -1, NID_sha512, 0}, | ||
| 120 | {EVP_PBE_TYPE_PRF, NID_id_HMACGostR3411_94, -1, NID_id_GostR3411_94, 0}, | ||
| 121 | }; | ||
| 122 | |||
| 123 | #ifdef TEST | ||
| 124 | int main(int argc, char **argv) | ||
| 125 | { | ||
| 126 | int i, nid_md, nid_cipher; | ||
| 127 | EVP_PBE_CTL *tpbe, *tpbe2; | ||
| 128 | /*OpenSSL_add_all_algorithms();*/ | ||
| 129 | |||
| 130 | for (i = 0; i < sizeof(builtin_pbe)/sizeof(EVP_PBE_CTL); i++) | ||
| 131 | { | ||
| 132 | tpbe = builtin_pbe + i; | ||
| 133 | fprintf(stderr, "%d %d %s ", tpbe->pbe_type, tpbe->pbe_nid, | ||
| 134 | OBJ_nid2sn(tpbe->pbe_nid)); | ||
| 135 | if (EVP_PBE_find(tpbe->pbe_type, tpbe->pbe_nid, | ||
| 136 | &nid_cipher ,&nid_md,0)) | ||
| 137 | fprintf(stderr, "Found %s %s\n", | ||
| 138 | OBJ_nid2sn(nid_cipher), | ||
| 139 | OBJ_nid2sn(nid_md)); | ||
| 140 | else | ||
| 141 | fprintf(stderr, "Find ERROR!!\n"); | ||
| 142 | } | ||
| 143 | |||
| 144 | return 0; | ||
| 145 | } | ||
| 146 | #endif | ||
| 147 | |||
| 148 | |||
| 149 | |||
| 150 | int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | ||
| 151 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de) | ||
| 152 | { | ||
| 153 | const EVP_CIPHER *cipher; | ||
| 154 | const EVP_MD *md; | ||
| 155 | int cipher_nid, md_nid; | ||
| 156 | EVP_PBE_KEYGEN *keygen; | ||
| 86 | 157 | ||
| 87 | if (i == -1) { | 158 | if (!EVP_PBE_find(EVP_PBE_TYPE_OUTER, OBJ_obj2nid(pbe_obj), |
| 159 | &cipher_nid, &md_nid, &keygen)) | ||
| 160 | { | ||
| 88 | char obj_tmp[80]; | 161 | char obj_tmp[80]; |
| 89 | EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM); | 162 | EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM); |
| 90 | if (!pbe_obj) BUF_strlcpy (obj_tmp, "NULL", sizeof obj_tmp); | 163 | if (!pbe_obj) BUF_strlcpy (obj_tmp, "NULL", sizeof obj_tmp); |
| 91 | else i2t_ASN1_OBJECT(obj_tmp, sizeof obj_tmp, pbe_obj); | 164 | else i2t_ASN1_OBJECT(obj_tmp, sizeof obj_tmp, pbe_obj); |
| 92 | ERR_add_error_data(2, "TYPE=", obj_tmp); | 165 | ERR_add_error_data(2, "TYPE=", obj_tmp); |
| 93 | return 0; | 166 | return 0; |
| 94 | } | 167 | } |
| 95 | if(!pass) passlen = 0; | 168 | |
| 96 | else if (passlen == -1) passlen = strlen(pass); | 169 | if(!pass) |
| 97 | pbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i); | 170 | passlen = 0; |
| 98 | i = (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher, | 171 | else if (passlen == -1) |
| 99 | pbetmp->md, en_de); | 172 | passlen = strlen(pass); |
| 100 | if (!i) { | 173 | |
| 174 | if (cipher_nid == -1) | ||
| 175 | cipher = NULL; | ||
| 176 | else | ||
| 177 | { | ||
| 178 | cipher = EVP_get_cipherbynid(cipher_nid); | ||
| 179 | if (!cipher) | ||
| 180 | { | ||
| 181 | EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_CIPHER); | ||
| 182 | return 0; | ||
| 183 | } | ||
| 184 | } | ||
| 185 | |||
| 186 | if (md_nid == -1) | ||
| 187 | md = NULL; | ||
| 188 | else | ||
| 189 | { | ||
| 190 | md = EVP_get_digestbynid(md_nid); | ||
| 191 | if (!md) | ||
| 192 | { | ||
| 193 | EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_DIGEST); | ||
| 194 | return 0; | ||
| 195 | } | ||
| 196 | } | ||
| 197 | |||
| 198 | if (!keygen(ctx, pass, passlen, param, cipher, md, en_de)) | ||
| 199 | { | ||
| 101 | EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_KEYGEN_FAILURE); | 200 | EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_KEYGEN_FAILURE); |
| 102 | return 0; | 201 | return 0; |
| 103 | } | 202 | } |
| 104 | return 1; | 203 | return 1; |
| 105 | } | 204 | } |
| 106 | 205 | ||
| 107 | static int pbe_cmp(const char * const *a, const char * const *b) | 206 | DECLARE_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe2); |
| 108 | { | 207 | |
| 109 | const EVP_PBE_CTL * const *pbe1 = (const EVP_PBE_CTL * const *) a, | 208 | static int pbe2_cmp(const EVP_PBE_CTL *pbe1, const EVP_PBE_CTL *pbe2) |
| 110 | * const *pbe2 = (const EVP_PBE_CTL * const *)b; | 209 | { |
| 111 | return ((*pbe1)->pbe_nid - (*pbe2)->pbe_nid); | 210 | int ret = pbe1->pbe_type - pbe2->pbe_type; |
| 112 | } | 211 | if (ret) |
| 212 | return ret; | ||
| 213 | else | ||
| 214 | return pbe1->pbe_nid - pbe2->pbe_nid; | ||
| 215 | } | ||
| 216 | |||
| 217 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(EVP_PBE_CTL, EVP_PBE_CTL, pbe2); | ||
| 218 | |||
| 219 | static int pbe_cmp(const EVP_PBE_CTL * const *a, const EVP_PBE_CTL * const *b) | ||
| 220 | { | ||
| 221 | int ret = (*a)->pbe_type - (*b)->pbe_type; | ||
| 222 | if (ret) | ||
| 223 | return ret; | ||
| 224 | else | ||
| 225 | return (*a)->pbe_nid - (*b)->pbe_nid; | ||
| 226 | } | ||
| 113 | 227 | ||
| 114 | /* Add a PBE algorithm */ | 228 | /* Add a PBE algorithm */ |
| 115 | 229 | ||
| 116 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, | 230 | int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid, |
| 117 | EVP_PBE_KEYGEN *keygen) | 231 | EVP_PBE_KEYGEN *keygen) |
| 118 | { | 232 | { |
| 119 | EVP_PBE_CTL *pbe_tmp; | 233 | EVP_PBE_CTL *pbe_tmp; |
| 120 | if (!pbe_algs) pbe_algs = sk_new(pbe_cmp); | 234 | if (!pbe_algs) |
| 121 | if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) { | 235 | pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp); |
| 122 | EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE); | 236 | if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL)))) |
| 237 | { | ||
| 238 | EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE,ERR_R_MALLOC_FAILURE); | ||
| 123 | return 0; | 239 | return 0; |
| 124 | } | 240 | } |
| 125 | pbe_tmp->pbe_nid = nid; | 241 | pbe_tmp->pbe_type = pbe_type; |
| 126 | pbe_tmp->cipher = cipher; | 242 | pbe_tmp->pbe_nid = pbe_nid; |
| 127 | pbe_tmp->md = md; | 243 | pbe_tmp->cipher_nid = cipher_nid; |
| 244 | pbe_tmp->md_nid = md_nid; | ||
| 128 | pbe_tmp->keygen = keygen; | 245 | pbe_tmp->keygen = keygen; |
| 129 | sk_push (pbe_algs, (char *)pbe_tmp); | 246 | |
| 247 | |||
| 248 | sk_EVP_PBE_CTL_push (pbe_algs, pbe_tmp); | ||
| 130 | return 1; | 249 | return 1; |
| 131 | } | 250 | } |
| 251 | |||
| 252 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, | ||
| 253 | EVP_PBE_KEYGEN *keygen) | ||
| 254 | { | ||
| 255 | int cipher_nid, md_nid; | ||
| 256 | if (cipher) | ||
| 257 | cipher_nid = EVP_CIPHER_type(cipher); | ||
| 258 | else | ||
| 259 | cipher_nid = -1; | ||
| 260 | if (md) | ||
| 261 | md_nid = EVP_MD_type(md); | ||
| 262 | else | ||
| 263 | md_nid = -1; | ||
| 264 | |||
| 265 | return EVP_PBE_alg_add_type(EVP_PBE_TYPE_OUTER, nid, | ||
| 266 | cipher_nid, md_nid, keygen); | ||
| 267 | } | ||
| 268 | |||
| 269 | int EVP_PBE_find(int type, int pbe_nid, | ||
| 270 | int *pcnid, int *pmnid, EVP_PBE_KEYGEN **pkeygen) | ||
| 271 | { | ||
| 272 | EVP_PBE_CTL *pbetmp = NULL, pbelu; | ||
| 273 | int i; | ||
| 274 | if (pbe_nid == NID_undef) | ||
| 275 | return 0; | ||
| 276 | |||
| 277 | pbelu.pbe_type = type; | ||
| 278 | pbelu.pbe_nid = pbe_nid; | ||
| 279 | |||
| 280 | if (pbe_algs) | ||
| 281 | { | ||
| 282 | i = sk_EVP_PBE_CTL_find(pbe_algs, &pbelu); | ||
| 283 | if (i != -1) | ||
| 284 | pbetmp = sk_EVP_PBE_CTL_value (pbe_algs, i); | ||
| 285 | } | ||
| 286 | if (pbetmp == NULL) | ||
| 287 | { | ||
| 288 | pbetmp = OBJ_bsearch_pbe2(&pbelu, builtin_pbe, | ||
| 289 | sizeof(builtin_pbe)/sizeof(EVP_PBE_CTL)); | ||
| 290 | } | ||
| 291 | if (pbetmp == NULL) | ||
| 292 | return 0; | ||
| 293 | if (pcnid) | ||
| 294 | *pcnid = pbetmp->cipher_nid; | ||
| 295 | if (pmnid) | ||
| 296 | *pmnid = pbetmp->md_nid; | ||
| 297 | if (pkeygen) | ||
| 298 | *pkeygen = pbetmp->keygen; | ||
| 299 | return 1; | ||
| 300 | } | ||
| 301 | |||
| 302 | static void free_evp_pbe_ctl(EVP_PBE_CTL *pbe) | ||
| 303 | { | ||
| 304 | OPENSSL_freeFunc(pbe); | ||
| 305 | } | ||
| 132 | 306 | ||
| 133 | void EVP_PBE_cleanup(void) | 307 | void EVP_PBE_cleanup(void) |
| 134 | { | 308 | { |
| 135 | sk_pop_free(pbe_algs, OPENSSL_freeFunc); | 309 | sk_EVP_PBE_CTL_pop_free(pbe_algs, free_evp_pbe_ctl); |
| 136 | pbe_algs = NULL; | 310 | pbe_algs = NULL; |
| 137 | } | 311 | } |
diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c index 10d9e9e772..ceebf69284 100644 --- a/src/lib/libcrypto/evp/evp_pkey.c +++ b/src/lib/libcrypto/evp/evp_pkey.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -61,287 +61,52 @@ | |||
| 61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 62 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 63 | #include <openssl/rand.h> | 63 | #include <openssl/rand.h> |
| 64 | #ifndef OPENSSL_NO_RSA | 64 | #include "asn1_locl.h" |
| 65 | #include <openssl/rsa.h> | ||
| 66 | #endif | ||
| 67 | #ifndef OPENSSL_NO_DSA | ||
| 68 | #include <openssl/dsa.h> | ||
| 69 | #endif | ||
| 70 | #include <openssl/bn.h> | ||
| 71 | |||
| 72 | #ifndef OPENSSL_NO_DSA | ||
| 73 | static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8inf, EVP_PKEY *pkey); | ||
| 74 | #endif | ||
| 75 | #ifndef OPENSSL_NO_EC | ||
| 76 | static int eckey_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8inf, EVP_PKEY *pkey); | ||
| 77 | #endif | ||
| 78 | 65 | ||
| 79 | /* Extract a private key from a PKCS8 structure */ | 66 | /* Extract a private key from a PKCS8 structure */ |
| 80 | 67 | ||
| 81 | EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8) | 68 | EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8) |
| 82 | { | 69 | { |
| 83 | EVP_PKEY *pkey = NULL; | 70 | EVP_PKEY *pkey = NULL; |
| 84 | #ifndef OPENSSL_NO_RSA | 71 | ASN1_OBJECT *algoid; |
| 85 | RSA *rsa = NULL; | ||
| 86 | #endif | ||
| 87 | #ifndef OPENSSL_NO_DSA | ||
| 88 | DSA *dsa = NULL; | ||
| 89 | ASN1_TYPE *t1, *t2; | ||
| 90 | ASN1_INTEGER *privkey; | ||
| 91 | STACK_OF(ASN1_TYPE) *ndsa = NULL; | ||
| 92 | #endif | ||
| 93 | #ifndef OPENSSL_NO_EC | ||
| 94 | EC_KEY *eckey = NULL; | ||
| 95 | const unsigned char *p_tmp; | ||
| 96 | #endif | ||
| 97 | #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_EC) | ||
| 98 | ASN1_TYPE *param = NULL; | ||
| 99 | BN_CTX *ctx = NULL; | ||
| 100 | int plen; | ||
| 101 | #endif | ||
| 102 | X509_ALGOR *a; | ||
| 103 | const unsigned char *p; | ||
| 104 | const unsigned char *cp; | ||
| 105 | int pkeylen; | ||
| 106 | int nid; | ||
| 107 | char obj_tmp[80]; | 72 | char obj_tmp[80]; |
| 108 | 73 | ||
| 109 | if(p8->pkey->type == V_ASN1_OCTET_STRING) { | 74 | if (!PKCS8_pkey_get0(&algoid, NULL, NULL, NULL, p8)) |
| 110 | p8->broken = PKCS8_OK; | 75 | return NULL; |
| 111 | p = p8->pkey->value.octet_string->data; | 76 | |
| 112 | pkeylen = p8->pkey->value.octet_string->length; | ||
| 113 | } else { | ||
| 114 | p8->broken = PKCS8_NO_OCTET; | ||
| 115 | p = p8->pkey->value.sequence->data; | ||
| 116 | pkeylen = p8->pkey->value.sequence->length; | ||
| 117 | } | ||
| 118 | if (!(pkey = EVP_PKEY_new())) { | 77 | if (!(pkey = EVP_PKEY_new())) { |
| 119 | EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); | 78 | EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); |
| 120 | return NULL; | 79 | return NULL; |
| 121 | } | 80 | } |
| 122 | a = p8->pkeyalg; | ||
| 123 | nid = OBJ_obj2nid(a->algorithm); | ||
| 124 | switch(nid) | ||
| 125 | { | ||
| 126 | #ifndef OPENSSL_NO_RSA | ||
| 127 | case NID_rsaEncryption: | ||
| 128 | cp = p; | ||
| 129 | if (!(rsa = d2i_RSAPrivateKey (NULL,&cp, pkeylen))) { | ||
| 130 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 131 | return NULL; | ||
| 132 | } | ||
| 133 | EVP_PKEY_assign_RSA (pkey, rsa); | ||
| 134 | break; | ||
| 135 | #endif | ||
| 136 | #ifndef OPENSSL_NO_DSA | ||
| 137 | case NID_dsa: | ||
| 138 | /* PKCS#8 DSA is weird: you just get a private key integer | ||
| 139 | * and parameters in the AlgorithmIdentifier the pubkey must | ||
| 140 | * be recalculated. | ||
| 141 | */ | ||
| 142 | |||
| 143 | /* Check for broken DSA PKCS#8, UGH! */ | ||
| 144 | if(*p == (V_ASN1_SEQUENCE|V_ASN1_CONSTRUCTED)) { | ||
| 145 | if(!(ndsa = ASN1_seq_unpack_ASN1_TYPE(p, pkeylen, | ||
| 146 | d2i_ASN1_TYPE, | ||
| 147 | ASN1_TYPE_free))) { | ||
| 148 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 149 | goto dsaerr; | ||
| 150 | } | ||
| 151 | if(sk_ASN1_TYPE_num(ndsa) != 2 ) { | ||
| 152 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 153 | goto dsaerr; | ||
| 154 | } | ||
| 155 | /* Handle Two broken types: | ||
| 156 | * SEQUENCE {parameters, priv_key} | ||
| 157 | * SEQUENCE {pub_key, priv_key} | ||
| 158 | */ | ||
| 159 | |||
| 160 | t1 = sk_ASN1_TYPE_value(ndsa, 0); | ||
| 161 | t2 = sk_ASN1_TYPE_value(ndsa, 1); | ||
| 162 | if(t1->type == V_ASN1_SEQUENCE) { | ||
| 163 | p8->broken = PKCS8_EMBEDDED_PARAM; | ||
| 164 | param = t1; | ||
| 165 | } else if(a->parameter->type == V_ASN1_SEQUENCE) { | ||
| 166 | p8->broken = PKCS8_NS_DB; | ||
| 167 | param = a->parameter; | ||
| 168 | } else { | ||
| 169 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 170 | goto dsaerr; | ||
| 171 | } | ||
| 172 | |||
| 173 | if(t2->type != V_ASN1_INTEGER) { | ||
| 174 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 175 | goto dsaerr; | ||
| 176 | } | ||
| 177 | privkey = t2->value.integer; | ||
| 178 | } else { | ||
| 179 | if (!(privkey=d2i_ASN1_INTEGER (NULL, &p, pkeylen))) { | ||
| 180 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 181 | goto dsaerr; | ||
| 182 | } | ||
| 183 | param = p8->pkeyalg->parameter; | ||
| 184 | } | ||
| 185 | if (!param || (param->type != V_ASN1_SEQUENCE)) { | ||
| 186 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 187 | goto dsaerr; | ||
| 188 | } | ||
| 189 | cp = p = param->value.sequence->data; | ||
| 190 | plen = param->value.sequence->length; | ||
| 191 | if (!(dsa = d2i_DSAparams (NULL, &cp, plen))) { | ||
| 192 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 193 | goto dsaerr; | ||
| 194 | } | ||
| 195 | /* We have parameters now set private key */ | ||
| 196 | if (!(dsa->priv_key = ASN1_INTEGER_to_BN(privkey, NULL))) { | ||
| 197 | EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_DECODE_ERROR); | ||
| 198 | goto dsaerr; | ||
| 199 | } | ||
| 200 | /* Calculate public key (ouch!) */ | ||
| 201 | if (!(dsa->pub_key = BN_new())) { | ||
| 202 | EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); | ||
| 203 | goto dsaerr; | ||
| 204 | } | ||
| 205 | if (!(ctx = BN_CTX_new())) { | ||
| 206 | EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); | ||
| 207 | goto dsaerr; | ||
| 208 | } | ||
| 209 | |||
| 210 | if (!BN_mod_exp(dsa->pub_key, dsa->g, | ||
| 211 | dsa->priv_key, dsa->p, ctx)) { | ||
| 212 | |||
| 213 | EVPerr(EVP_F_EVP_PKCS82PKEY,EVP_R_BN_PUBKEY_ERROR); | ||
| 214 | goto dsaerr; | ||
| 215 | } | ||
| 216 | 81 | ||
| 217 | EVP_PKEY_assign_DSA(pkey, dsa); | 82 | if (!EVP_PKEY_set_type(pkey, OBJ_obj2nid(algoid))) |
| 218 | BN_CTX_free (ctx); | ||
| 219 | if(ndsa) sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
| 220 | else ASN1_INTEGER_free(privkey); | ||
| 221 | break; | ||
| 222 | dsaerr: | ||
| 223 | BN_CTX_free (ctx); | ||
| 224 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
| 225 | DSA_free(dsa); | ||
| 226 | EVP_PKEY_free(pkey); | ||
| 227 | return NULL; | ||
| 228 | break; | ||
| 229 | #endif | ||
| 230 | #ifndef OPENSSL_NO_EC | ||
| 231 | case NID_X9_62_id_ecPublicKey: | ||
| 232 | p_tmp = p; | ||
| 233 | /* extract the ec parameters */ | ||
| 234 | param = p8->pkeyalg->parameter; | ||
| 235 | |||
| 236 | if (!param || ((param->type != V_ASN1_SEQUENCE) && | ||
| 237 | (param->type != V_ASN1_OBJECT))) | ||
| 238 | { | 83 | { |
| 239 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | 84 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM); |
| 240 | goto ecerr; | 85 | i2t_ASN1_OBJECT(obj_tmp, 80, algoid); |
| 86 | ERR_add_error_data(2, "TYPE=", obj_tmp); | ||
| 87 | goto error; | ||
| 241 | } | 88 | } |
| 242 | 89 | ||
| 243 | if (param->type == V_ASN1_SEQUENCE) | 90 | if (pkey->ameth->priv_decode) |
| 244 | { | 91 | { |
| 245 | cp = p = param->value.sequence->data; | 92 | if (!pkey->ameth->priv_decode(pkey, p8)) |
| 246 | plen = param->value.sequence->length; | ||
| 247 | |||
| 248 | if (!(eckey = d2i_ECParameters(NULL, &cp, plen))) | ||
| 249 | { | 93 | { |
| 250 | EVPerr(EVP_F_EVP_PKCS82PKEY, | 94 | EVPerr(EVP_F_EVP_PKCS82PKEY, |
| 251 | EVP_R_DECODE_ERROR); | 95 | EVP_R_PRIVATE_KEY_DECODE_ERROR); |
| 252 | goto ecerr; | 96 | goto error; |
| 253 | } | 97 | } |
| 254 | } | 98 | } |
| 255 | else | 99 | else |
| 256 | { | 100 | { |
| 257 | EC_GROUP *group; | 101 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_METHOD_NOT_SUPPORTED); |
| 258 | cp = p = param->value.object->data; | 102 | goto error; |
| 259 | plen = param->value.object->length; | ||
| 260 | |||
| 261 | /* type == V_ASN1_OBJECT => the parameters are given | ||
| 262 | * by an asn1 OID | ||
| 263 | */ | ||
| 264 | if ((eckey = EC_KEY_new()) == NULL) | ||
| 265 | { | ||
| 266 | EVPerr(EVP_F_EVP_PKCS82PKEY, | ||
| 267 | ERR_R_MALLOC_FAILURE); | ||
| 268 | goto ecerr; | ||
| 269 | } | ||
| 270 | group = EC_GROUP_new_by_curve_name(OBJ_obj2nid(a->parameter->value.object)); | ||
| 271 | if (group == NULL) | ||
| 272 | goto ecerr; | ||
| 273 | EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE); | ||
| 274 | if (EC_KEY_set_group(eckey, group) == 0) | ||
| 275 | goto ecerr; | ||
| 276 | EC_GROUP_free(group); | ||
| 277 | } | ||
| 278 | |||
| 279 | /* We have parameters now set private key */ | ||
| 280 | if (!d2i_ECPrivateKey(&eckey, &p_tmp, pkeylen)) | ||
| 281 | { | ||
| 282 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); | ||
| 283 | goto ecerr; | ||
| 284 | } | ||
| 285 | |||
| 286 | /* calculate public key (if necessary) */ | ||
| 287 | if (EC_KEY_get0_public_key(eckey) == NULL) | ||
| 288 | { | ||
| 289 | const BIGNUM *priv_key; | ||
| 290 | const EC_GROUP *group; | ||
| 291 | EC_POINT *pub_key; | ||
| 292 | /* the public key was not included in the SEC1 private | ||
| 293 | * key => calculate the public key */ | ||
| 294 | group = EC_KEY_get0_group(eckey); | ||
| 295 | pub_key = EC_POINT_new(group); | ||
| 296 | if (pub_key == NULL) | ||
| 297 | { | ||
| 298 | EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB); | ||
| 299 | goto ecerr; | ||
| 300 | } | ||
| 301 | if (!EC_POINT_copy(pub_key, EC_GROUP_get0_generator(group))) | ||
| 302 | { | ||
| 303 | EC_POINT_free(pub_key); | ||
| 304 | EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB); | ||
| 305 | goto ecerr; | ||
| 306 | } | ||
| 307 | priv_key = EC_KEY_get0_private_key(eckey); | ||
| 308 | if (!EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, ctx)) | ||
| 309 | { | ||
| 310 | EC_POINT_free(pub_key); | ||
| 311 | EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB); | ||
| 312 | goto ecerr; | ||
| 313 | } | ||
| 314 | if (EC_KEY_set_public_key(eckey, pub_key) == 0) | ||
| 315 | { | ||
| 316 | EC_POINT_free(pub_key); | ||
| 317 | EVPerr(EVP_F_EVP_PKCS82PKEY, ERR_R_EC_LIB); | ||
| 318 | goto ecerr; | ||
| 319 | } | ||
| 320 | EC_POINT_free(pub_key); | ||
| 321 | } | 103 | } |
| 322 | 104 | ||
| 323 | EVP_PKEY_assign_EC_KEY(pkey, eckey); | ||
| 324 | if (ctx) | ||
| 325 | BN_CTX_free(ctx); | ||
| 326 | break; | ||
| 327 | ecerr: | ||
| 328 | if (ctx) | ||
| 329 | BN_CTX_free(ctx); | ||
| 330 | if (eckey) | ||
| 331 | EC_KEY_free(eckey); | ||
| 332 | if (pkey) | ||
| 333 | EVP_PKEY_free(pkey); | ||
| 334 | return NULL; | ||
| 335 | #endif | ||
| 336 | default: | ||
| 337 | EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM); | ||
| 338 | if (!a->algorithm) BUF_strlcpy (obj_tmp, "NULL", sizeof obj_tmp); | ||
| 339 | else i2t_ASN1_OBJECT(obj_tmp, 80, a->algorithm); | ||
| 340 | ERR_add_error_data(2, "TYPE=", obj_tmp); | ||
| 341 | EVP_PKEY_free (pkey); | ||
| 342 | return NULL; | ||
| 343 | } | ||
| 344 | return pkey; | 105 | return pkey; |
| 106 | |||
| 107 | error: | ||
| 108 | EVP_PKEY_free (pkey); | ||
| 109 | return NULL; | ||
| 345 | } | 110 | } |
| 346 | 111 | ||
| 347 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey) | 112 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey) |
| @@ -360,59 +125,37 @@ PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken) | |||
| 360 | return NULL; | 125 | return NULL; |
| 361 | } | 126 | } |
| 362 | p8->broken = broken; | 127 | p8->broken = broken; |
| 363 | if (!ASN1_INTEGER_set(p8->version, 0)) { | ||
| 364 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,ERR_R_MALLOC_FAILURE); | ||
| 365 | PKCS8_PRIV_KEY_INFO_free (p8); | ||
| 366 | return NULL; | ||
| 367 | } | ||
| 368 | if (!(p8->pkeyalg->parameter = ASN1_TYPE_new ())) { | ||
| 369 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,ERR_R_MALLOC_FAILURE); | ||
| 370 | PKCS8_PRIV_KEY_INFO_free (p8); | ||
| 371 | return NULL; | ||
| 372 | } | ||
| 373 | p8->pkey->type = V_ASN1_OCTET_STRING; | ||
| 374 | switch (EVP_PKEY_type(pkey->type)) { | ||
| 375 | #ifndef OPENSSL_NO_RSA | ||
| 376 | case EVP_PKEY_RSA: | ||
| 377 | 128 | ||
| 378 | if(p8->broken == PKCS8_NO_OCTET) p8->pkey->type = V_ASN1_SEQUENCE; | 129 | if (pkey->ameth) |
| 379 | 130 | { | |
| 380 | p8->pkeyalg->algorithm = OBJ_nid2obj(NID_rsaEncryption); | 131 | if (pkey->ameth->priv_encode) |
| 381 | p8->pkeyalg->parameter->type = V_ASN1_NULL; | 132 | { |
| 382 | if (!ASN1_pack_string_of (EVP_PKEY,pkey, i2d_PrivateKey, | 133 | if (!pkey->ameth->priv_encode(p8, pkey)) |
| 383 | &p8->pkey->value.octet_string)) { | 134 | { |
| 384 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN,ERR_R_MALLOC_FAILURE); | 135 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN, |
| 385 | PKCS8_PRIV_KEY_INFO_free (p8); | 136 | EVP_R_PRIVATE_KEY_ENCODE_ERROR); |
| 386 | return NULL; | 137 | goto error; |
| 387 | } | 138 | } |
| 388 | break; | 139 | } |
| 389 | #endif | 140 | else |
| 390 | #ifndef OPENSSL_NO_DSA | 141 | { |
| 391 | case EVP_PKEY_DSA: | 142 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN, |
| 392 | if(!dsa_pkey2pkcs8(p8, pkey)) { | 143 | EVP_R_METHOD_NOT_SUPPORTED); |
| 393 | PKCS8_PRIV_KEY_INFO_free (p8); | 144 | goto error; |
| 394 | return NULL; | 145 | } |
| 395 | } | 146 | } |
| 396 | 147 | else | |
| 397 | break; | ||
| 398 | #endif | ||
| 399 | #ifndef OPENSSL_NO_EC | ||
| 400 | case EVP_PKEY_EC: | ||
| 401 | if (!eckey_pkey2pkcs8(p8, pkey)) | ||
| 402 | { | 148 | { |
| 403 | PKCS8_PRIV_KEY_INFO_free(p8); | 149 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN, |
| 404 | return(NULL); | 150 | EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM); |
| 151 | goto error; | ||
| 405 | } | 152 | } |
| 406 | break; | ||
| 407 | #endif | ||
| 408 | default: | ||
| 409 | EVPerr(EVP_F_EVP_PKEY2PKCS8_BROKEN, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM); | ||
| 410 | PKCS8_PRIV_KEY_INFO_free (p8); | ||
| 411 | return NULL; | ||
| 412 | } | ||
| 413 | RAND_add(p8->pkey->value.octet_string->data, | 153 | RAND_add(p8->pkey->value.octet_string->data, |
| 414 | p8->pkey->value.octet_string->length, 0.0); | 154 | p8->pkey->value.octet_string->length, 0.0); |
| 415 | return p8; | 155 | return p8; |
| 156 | error: | ||
| 157 | PKCS8_PRIV_KEY_INFO_free(p8); | ||
| 158 | return NULL; | ||
| 416 | } | 159 | } |
| 417 | 160 | ||
| 418 | PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken) | 161 | PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken) |
| @@ -436,301 +179,6 @@ PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken) | |||
| 436 | } | 179 | } |
| 437 | } | 180 | } |
| 438 | 181 | ||
| 439 | #ifndef OPENSSL_NO_DSA | ||
| 440 | static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | ||
| 441 | { | ||
| 442 | ASN1_STRING *params = NULL; | ||
| 443 | ASN1_INTEGER *prkey = NULL; | ||
| 444 | ASN1_TYPE *ttmp = NULL; | ||
| 445 | STACK_OF(ASN1_TYPE) *ndsa = NULL; | ||
| 446 | unsigned char *p = NULL, *q; | ||
| 447 | int len; | ||
| 448 | |||
| 449 | p8->pkeyalg->algorithm = OBJ_nid2obj(NID_dsa); | ||
| 450 | len = i2d_DSAparams (pkey->pkey.dsa, NULL); | ||
| 451 | if (!(p = OPENSSL_malloc(len))) { | ||
| 452 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 453 | goto err; | ||
| 454 | } | ||
| 455 | q = p; | ||
| 456 | i2d_DSAparams (pkey->pkey.dsa, &q); | ||
| 457 | if (!(params = ASN1_STRING_new())) { | ||
| 458 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 459 | goto err; | ||
| 460 | } | ||
| 461 | if (!ASN1_STRING_set(params, p, len)) { | ||
| 462 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 463 | goto err; | ||
| 464 | } | ||
| 465 | OPENSSL_free(p); | ||
| 466 | p = NULL; | ||
| 467 | /* Get private key into integer */ | ||
| 468 | if (!(prkey = BN_to_ASN1_INTEGER (pkey->pkey.dsa->priv_key, NULL))) { | ||
| 469 | EVPerr(EVP_F_DSA_PKEY2PKCS8,EVP_R_ENCODE_ERROR); | ||
| 470 | goto err; | ||
| 471 | } | ||
| 472 | |||
| 473 | switch(p8->broken) { | ||
| 474 | |||
| 475 | case PKCS8_OK: | ||
| 476 | case PKCS8_NO_OCTET: | ||
| 477 | |||
| 478 | if (!ASN1_pack_string_of(ASN1_INTEGER,prkey, i2d_ASN1_INTEGER, | ||
| 479 | &p8->pkey->value.octet_string)) { | ||
| 480 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 481 | goto err; | ||
| 482 | } | ||
| 483 | |||
| 484 | M_ASN1_INTEGER_free (prkey); | ||
| 485 | prkey = NULL; | ||
| 486 | p8->pkeyalg->parameter->value.sequence = params; | ||
| 487 | params = NULL; | ||
| 488 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; | ||
| 489 | |||
| 490 | break; | ||
| 491 | |||
| 492 | case PKCS8_NS_DB: | ||
| 493 | |||
| 494 | p8->pkeyalg->parameter->value.sequence = params; | ||
| 495 | params = NULL; | ||
| 496 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; | ||
| 497 | if (!(ndsa = sk_ASN1_TYPE_new_null())) { | ||
| 498 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 499 | goto err; | ||
| 500 | } | ||
| 501 | if (!(ttmp = ASN1_TYPE_new())) { | ||
| 502 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 503 | goto err; | ||
| 504 | } | ||
| 505 | if (!(ttmp->value.integer = | ||
| 506 | BN_to_ASN1_INTEGER(pkey->pkey.dsa->pub_key, NULL))) { | ||
| 507 | EVPerr(EVP_F_DSA_PKEY2PKCS8,EVP_R_ENCODE_ERROR); | ||
| 508 | goto err; | ||
| 509 | } | ||
| 510 | ttmp->type = V_ASN1_INTEGER; | ||
| 511 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { | ||
| 512 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 513 | goto err; | ||
| 514 | } | ||
| 515 | |||
| 516 | if (!(ttmp = ASN1_TYPE_new())) { | ||
| 517 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 518 | goto err; | ||
| 519 | } | ||
| 520 | ttmp->value.integer = prkey; | ||
| 521 | prkey = NULL; | ||
| 522 | ttmp->type = V_ASN1_INTEGER; | ||
| 523 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { | ||
| 524 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 525 | goto err; | ||
| 526 | } | ||
| 527 | ttmp = NULL; | ||
| 528 | |||
| 529 | if (!(p8->pkey->value.octet_string = ASN1_OCTET_STRING_new())) { | ||
| 530 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 531 | goto err; | ||
| 532 | } | ||
| 533 | |||
| 534 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, | ||
| 535 | &p8->pkey->value.octet_string->data, | ||
| 536 | &p8->pkey->value.octet_string->length)) { | ||
| 537 | |||
| 538 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 539 | goto err; | ||
| 540 | } | ||
| 541 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
| 542 | break; | ||
| 543 | |||
| 544 | case PKCS8_EMBEDDED_PARAM: | ||
| 545 | |||
| 546 | p8->pkeyalg->parameter->type = V_ASN1_NULL; | ||
| 547 | if (!(ndsa = sk_ASN1_TYPE_new_null())) { | ||
| 548 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 549 | goto err; | ||
| 550 | } | ||
| 551 | if (!(ttmp = ASN1_TYPE_new())) { | ||
| 552 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 553 | goto err; | ||
| 554 | } | ||
| 555 | ttmp->value.sequence = params; | ||
| 556 | params = NULL; | ||
| 557 | ttmp->type = V_ASN1_SEQUENCE; | ||
| 558 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { | ||
| 559 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 560 | goto err; | ||
| 561 | } | ||
| 562 | |||
| 563 | if (!(ttmp = ASN1_TYPE_new())) { | ||
| 564 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 565 | goto err; | ||
| 566 | } | ||
| 567 | ttmp->value.integer = prkey; | ||
| 568 | prkey = NULL; | ||
| 569 | ttmp->type = V_ASN1_INTEGER; | ||
| 570 | if (!sk_ASN1_TYPE_push(ndsa, ttmp)) { | ||
| 571 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 572 | goto err; | ||
| 573 | } | ||
| 574 | ttmp = NULL; | ||
| 575 | |||
| 576 | if (!(p8->pkey->value.octet_string = ASN1_OCTET_STRING_new())) { | ||
| 577 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 578 | goto err; | ||
| 579 | } | ||
| 580 | |||
| 581 | if (!ASN1_seq_pack_ASN1_TYPE(ndsa, i2d_ASN1_TYPE, | ||
| 582 | &p8->pkey->value.octet_string->data, | ||
| 583 | &p8->pkey->value.octet_string->length)) { | ||
| 584 | |||
| 585 | EVPerr(EVP_F_DSA_PKEY2PKCS8,ERR_R_MALLOC_FAILURE); | ||
| 586 | goto err; | ||
| 587 | } | ||
| 588 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
| 589 | break; | ||
| 590 | } | ||
| 591 | return 1; | ||
| 592 | err: | ||
| 593 | if (p != NULL) OPENSSL_free(p); | ||
| 594 | if (params != NULL) ASN1_STRING_free(params); | ||
| 595 | if (prkey != NULL) M_ASN1_INTEGER_free(prkey); | ||
| 596 | if (ttmp != NULL) ASN1_TYPE_free(ttmp); | ||
| 597 | if (ndsa != NULL) sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | ||
| 598 | return 0; | ||
| 599 | } | ||
| 600 | #endif | ||
| 601 | |||
| 602 | #ifndef OPENSSL_NO_EC | ||
| 603 | static int eckey_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) | ||
| 604 | { | ||
| 605 | EC_KEY *ec_key; | ||
| 606 | const EC_GROUP *group; | ||
| 607 | unsigned char *p, *pp; | ||
| 608 | int nid, i, ret = 0; | ||
| 609 | unsigned int tmp_flags, old_flags; | ||
| 610 | |||
| 611 | ec_key = pkey->pkey.ec; | ||
| 612 | if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) | ||
| 613 | { | ||
| 614 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, EVP_R_MISSING_PARAMETERS); | ||
| 615 | return 0; | ||
| 616 | } | ||
| 617 | |||
| 618 | /* set the ec parameters OID */ | ||
| 619 | if (p8->pkeyalg->algorithm) | ||
| 620 | ASN1_OBJECT_free(p8->pkeyalg->algorithm); | ||
| 621 | |||
| 622 | p8->pkeyalg->algorithm = OBJ_nid2obj(NID_X9_62_id_ecPublicKey); | ||
| 623 | |||
| 624 | /* set the ec parameters */ | ||
| 625 | |||
| 626 | if (p8->pkeyalg->parameter) | ||
| 627 | { | ||
| 628 | ASN1_TYPE_free(p8->pkeyalg->parameter); | ||
| 629 | p8->pkeyalg->parameter = NULL; | ||
| 630 | } | ||
| 631 | |||
| 632 | if ((p8->pkeyalg->parameter = ASN1_TYPE_new()) == NULL) | ||
| 633 | { | ||
| 634 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE); | ||
| 635 | return 0; | ||
| 636 | } | ||
| 637 | |||
| 638 | if (EC_GROUP_get_asn1_flag(group) | ||
| 639 | && (nid = EC_GROUP_get_curve_name(group))) | ||
| 640 | { | ||
| 641 | /* we have a 'named curve' => just set the OID */ | ||
| 642 | p8->pkeyalg->parameter->type = V_ASN1_OBJECT; | ||
| 643 | p8->pkeyalg->parameter->value.object = OBJ_nid2obj(nid); | ||
| 644 | } | ||
| 645 | else /* explicit parameters */ | ||
| 646 | { | ||
| 647 | if ((i = i2d_ECParameters(ec_key, NULL)) == 0) | ||
| 648 | { | ||
| 649 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB); | ||
| 650 | return 0; | ||
| 651 | } | ||
| 652 | if ((p = (unsigned char *) OPENSSL_malloc(i)) == NULL) | ||
| 653 | { | ||
| 654 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE); | ||
| 655 | return 0; | ||
| 656 | } | ||
| 657 | pp = p; | ||
| 658 | if (!i2d_ECParameters(ec_key, &pp)) | ||
| 659 | { | ||
| 660 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB); | ||
| 661 | OPENSSL_free(p); | ||
| 662 | return 0; | ||
| 663 | } | ||
| 664 | p8->pkeyalg->parameter->type = V_ASN1_SEQUENCE; | ||
| 665 | if ((p8->pkeyalg->parameter->value.sequence | ||
| 666 | = ASN1_STRING_new()) == NULL) | ||
| 667 | { | ||
| 668 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_ASN1_LIB); | ||
| 669 | OPENSSL_free(p); | ||
| 670 | return 0; | ||
| 671 | } | ||
| 672 | ASN1_STRING_set(p8->pkeyalg->parameter->value.sequence, p, i); | ||
| 673 | OPENSSL_free(p); | ||
| 674 | } | ||
| 675 | |||
| 676 | /* set the private key */ | ||
| 677 | |||
| 678 | /* do not include the parameters in the SEC1 private key | ||
| 679 | * see PKCS#11 12.11 */ | ||
| 680 | old_flags = EC_KEY_get_enc_flags(pkey->pkey.ec); | ||
| 681 | tmp_flags = old_flags | EC_PKEY_NO_PARAMETERS; | ||
| 682 | EC_KEY_set_enc_flags(pkey->pkey.ec, tmp_flags); | ||
| 683 | i = i2d_ECPrivateKey(pkey->pkey.ec, NULL); | ||
| 684 | if (!i) | ||
| 685 | { | ||
| 686 | EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags); | ||
| 687 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB); | ||
| 688 | return 0; | ||
| 689 | } | ||
| 690 | p = (unsigned char *) OPENSSL_malloc(i); | ||
| 691 | if (!p) | ||
| 692 | { | ||
| 693 | EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags); | ||
| 694 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE); | ||
| 695 | return 0; | ||
| 696 | } | ||
| 697 | pp = p; | ||
| 698 | if (!i2d_ECPrivateKey(pkey->pkey.ec, &pp)) | ||
| 699 | { | ||
| 700 | EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags); | ||
| 701 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_EC_LIB); | ||
| 702 | OPENSSL_free(p); | ||
| 703 | return 0; | ||
| 704 | } | ||
| 705 | /* restore old encoding flags */ | ||
| 706 | EC_KEY_set_enc_flags(pkey->pkey.ec, old_flags); | ||
| 707 | |||
| 708 | switch(p8->broken) { | ||
| 709 | |||
| 710 | case PKCS8_OK: | ||
| 711 | p8->pkey->value.octet_string = ASN1_OCTET_STRING_new(); | ||
| 712 | if (!p8->pkey->value.octet_string || | ||
| 713 | !M_ASN1_OCTET_STRING_set(p8->pkey->value.octet_string, | ||
| 714 | (const void *)p, i)) | ||
| 715 | |||
| 716 | { | ||
| 717 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8, ERR_R_MALLOC_FAILURE); | ||
| 718 | } | ||
| 719 | else | ||
| 720 | ret = 1; | ||
| 721 | break; | ||
| 722 | case PKCS8_NO_OCTET: /* RSA specific */ | ||
| 723 | case PKCS8_NS_DB: /* DSA specific */ | ||
| 724 | case PKCS8_EMBEDDED_PARAM: /* DSA specific */ | ||
| 725 | default: | ||
| 726 | EVPerr(EVP_F_ECKEY_PKEY2PKCS8,EVP_R_ENCODE_ERROR); | ||
| 727 | } | ||
| 728 | OPENSSL_cleanse(p, (size_t)i); | ||
| 729 | OPENSSL_free(p); | ||
| 730 | return ret; | ||
| 731 | } | ||
| 732 | #endif | ||
| 733 | |||
| 734 | /* EVP_PKEY attribute functions */ | 182 | /* EVP_PKEY attribute functions */ |
| 735 | 183 | ||
| 736 | int EVP_PKEY_get_attr_count(const EVP_PKEY *key) | 184 | int EVP_PKEY_get_attr_count(const EVP_PKEY *key) |
diff --git a/src/lib/libcrypto/evp/evp_test.c b/src/lib/libcrypto/evp/evp_test.c index 436be20bf1..902efac975 100644 --- a/src/lib/libcrypto/evp/evp_test.c +++ b/src/lib/libcrypto/evp/evp_test.c | |||
| @@ -153,8 +153,8 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
| 153 | 153 | ||
| 154 | if(kn != c->key_len) | 154 | if(kn != c->key_len) |
| 155 | { | 155 | { |
| 156 | fprintf(stderr,"Key length doesn't match, got %d expected %d\n",kn, | 156 | fprintf(stderr,"Key length doesn't match, got %d expected %lu\n",kn, |
| 157 | c->key_len); | 157 | (unsigned long)c->key_len); |
| 158 | test1_exit(5); | 158 | test1_exit(5); |
| 159 | } | 159 | } |
| 160 | EVP_CIPHER_CTX_init(&ctx); | 160 | EVP_CIPHER_CTX_init(&ctx); |
| @@ -441,7 +441,7 @@ int main(int argc,char **argv) | |||
| 441 | #endif | 441 | #endif |
| 442 | EVP_cleanup(); | 442 | EVP_cleanup(); |
| 443 | CRYPTO_cleanup_all_ex_data(); | 443 | CRYPTO_cleanup_all_ex_data(); |
| 444 | ERR_remove_state(0); | 444 | ERR_remove_thread_state(NULL); |
| 445 | ERR_free_strings(); | 445 | ERR_free_strings(); |
| 446 | CRYPTO_mem_leaks_fp(stderr); | 446 | CRYPTO_mem_leaks_fp(stderr); |
| 447 | 447 | ||
diff --git a/src/lib/libcrypto/evp/m_dss.c b/src/lib/libcrypto/evp/m_dss.c index 6b0c0aa7a3..48c2689504 100644 --- a/src/lib/libcrypto/evp/m_dss.c +++ b/src/lib/libcrypto/evp/m_dss.c | |||
| @@ -81,7 +81,7 @@ static const EVP_MD dsa_md= | |||
| 81 | NID_dsaWithSHA, | 81 | NID_dsaWithSHA, |
| 82 | NID_dsaWithSHA, | 82 | NID_dsaWithSHA, |
| 83 | SHA_DIGEST_LENGTH, | 83 | SHA_DIGEST_LENGTH, |
| 84 | EVP_MD_FLAG_FIPS, | 84 | EVP_MD_FLAG_PKEY_DIGEST, |
| 85 | init, | 85 | init, |
| 86 | update, | 86 | update, |
| 87 | final, | 87 | final, |
diff --git a/src/lib/libcrypto/evp/m_dss1.c b/src/lib/libcrypto/evp/m_dss1.c index da8babc147..4f03fb70e0 100644 --- a/src/lib/libcrypto/evp/m_dss1.c +++ b/src/lib/libcrypto/evp/m_dss1.c | |||
| @@ -68,8 +68,6 @@ | |||
| 68 | #include <openssl/dsa.h> | 68 | #include <openssl/dsa.h> |
| 69 | #endif | 69 | #endif |
| 70 | 70 | ||
| 71 | #ifndef OPENSSL_FIPS | ||
| 72 | |||
| 73 | static int init(EVP_MD_CTX *ctx) | 71 | static int init(EVP_MD_CTX *ctx) |
| 74 | { return SHA1_Init(ctx->md_data); } | 72 | { return SHA1_Init(ctx->md_data); } |
| 75 | 73 | ||
| @@ -84,7 +82,7 @@ static const EVP_MD dss1_md= | |||
| 84 | NID_dsa, | 82 | NID_dsa, |
| 85 | NID_dsaWithSHA1, | 83 | NID_dsaWithSHA1, |
| 86 | SHA_DIGEST_LENGTH, | 84 | SHA_DIGEST_LENGTH, |
| 87 | 0, | 85 | EVP_MD_FLAG_PKEY_DIGEST, |
| 88 | init, | 86 | init, |
| 89 | update, | 87 | update, |
| 90 | final, | 88 | final, |
| @@ -100,4 +98,3 @@ const EVP_MD *EVP_dss1(void) | |||
| 100 | return(&dss1_md); | 98 | return(&dss1_md); |
| 101 | } | 99 | } |
| 102 | #endif | 100 | #endif |
| 103 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_md2.c b/src/lib/libcrypto/evp/m_md2.c index 8eee6236ba..5ce849f161 100644 --- a/src/lib/libcrypto/evp/m_md2.c +++ b/src/lib/libcrypto/evp/m_md2.c | |||
| @@ -58,7 +58,6 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include "evp_locl.h" | ||
| 62 | 61 | ||
| 63 | #ifndef OPENSSL_NO_MD2 | 62 | #ifndef OPENSSL_NO_MD2 |
| 64 | 63 | ||
diff --git a/src/lib/libcrypto/evp/m_md4.c b/src/lib/libcrypto/evp/m_md4.c index 5cd2ab5ade..1e0b7c5b42 100644 --- a/src/lib/libcrypto/evp/m_md4.c +++ b/src/lib/libcrypto/evp/m_md4.c | |||
| @@ -58,7 +58,6 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include "evp_locl.h" | ||
| 62 | 61 | ||
| 63 | #ifndef OPENSSL_NO_MD4 | 62 | #ifndef OPENSSL_NO_MD4 |
| 64 | 63 | ||
diff --git a/src/lib/libcrypto/evp/m_md5.c b/src/lib/libcrypto/evp/m_md5.c index 6455829671..63c142119e 100644 --- a/src/lib/libcrypto/evp/m_md5.c +++ b/src/lib/libcrypto/evp/m_md5.c | |||
| @@ -62,7 +62,6 @@ | |||
| 62 | #ifndef OPENSSL_NO_MD5 | 62 | #ifndef OPENSSL_NO_MD5 |
| 63 | 63 | ||
| 64 | #include <openssl/evp.h> | 64 | #include <openssl/evp.h> |
| 65 | #include "evp_locl.h" | ||
| 66 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 67 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 68 | #include <openssl/md5.h> | 67 | #include <openssl/md5.h> |
diff --git a/src/lib/libcrypto/evp/m_mdc2.c b/src/lib/libcrypto/evp/m_mdc2.c index 9f9bcf06ed..b08d559803 100644 --- a/src/lib/libcrypto/evp/m_mdc2.c +++ b/src/lib/libcrypto/evp/m_mdc2.c | |||
| @@ -58,7 +58,6 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include "evp_locl.h" | ||
| 62 | 61 | ||
| 63 | #ifndef OPENSSL_NO_MDC2 | 62 | #ifndef OPENSSL_NO_MDC2 |
| 64 | 63 | ||
| @@ -66,7 +65,9 @@ | |||
| 66 | #include <openssl/objects.h> | 65 | #include <openssl/objects.h> |
| 67 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 68 | #include <openssl/mdc2.h> | 67 | #include <openssl/mdc2.h> |
| 68 | #ifndef OPENSSL_NO_RSA | ||
| 69 | #include <openssl/rsa.h> | 69 | #include <openssl/rsa.h> |
| 70 | #endif | ||
| 70 | 71 | ||
| 71 | static int init(EVP_MD_CTX *ctx) | 72 | static int init(EVP_MD_CTX *ctx) |
| 72 | { return MDC2_Init(ctx->md_data); } | 73 | { return MDC2_Init(ctx->md_data); } |
diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c index 3f30dfc579..acccc8f92d 100644 --- a/src/lib/libcrypto/evp/m_sha.c +++ b/src/lib/libcrypto/evp/m_sha.c | |||
| @@ -58,7 +58,6 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include "evp_locl.h" | ||
| 62 | 61 | ||
| 63 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) | 62 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) |
| 64 | 63 | ||
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c index 471ec30be0..9a2790fdea 100644 --- a/src/lib/libcrypto/evp/m_sha1.c +++ b/src/lib/libcrypto/evp/m_sha1.c | |||
| @@ -68,8 +68,6 @@ | |||
| 68 | #include <openssl/rsa.h> | 68 | #include <openssl/rsa.h> |
| 69 | #endif | 69 | #endif |
| 70 | 70 | ||
| 71 | #ifndef OPENSSL_FIPS | ||
| 72 | |||
| 73 | static int init(EVP_MD_CTX *ctx) | 71 | static int init(EVP_MD_CTX *ctx) |
| 74 | { return SHA1_Init(ctx->md_data); } | 72 | { return SHA1_Init(ctx->md_data); } |
| 75 | 73 | ||
| @@ -84,7 +82,7 @@ static const EVP_MD sha1_md= | |||
| 84 | NID_sha1, | 82 | NID_sha1, |
| 85 | NID_sha1WithRSAEncryption, | 83 | NID_sha1WithRSAEncryption, |
| 86 | SHA_DIGEST_LENGTH, | 84 | SHA_DIGEST_LENGTH, |
| 87 | 0, | 85 | EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|EVP_MD_FLAG_DIGALGID_ABSENT, |
| 88 | init, | 86 | init, |
| 89 | update, | 87 | update, |
| 90 | final, | 88 | final, |
| @@ -99,6 +97,7 @@ const EVP_MD *EVP_sha1(void) | |||
| 99 | { | 97 | { |
| 100 | return(&sha1_md); | 98 | return(&sha1_md); |
| 101 | } | 99 | } |
| 100 | #endif | ||
| 102 | 101 | ||
| 103 | #ifndef OPENSSL_NO_SHA256 | 102 | #ifndef OPENSSL_NO_SHA256 |
| 104 | static int init224(EVP_MD_CTX *ctx) | 103 | static int init224(EVP_MD_CTX *ctx) |
| @@ -120,7 +119,7 @@ static const EVP_MD sha224_md= | |||
| 120 | NID_sha224, | 119 | NID_sha224, |
| 121 | NID_sha224WithRSAEncryption, | 120 | NID_sha224WithRSAEncryption, |
| 122 | SHA224_DIGEST_LENGTH, | 121 | SHA224_DIGEST_LENGTH, |
| 123 | 0, | 122 | EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|EVP_MD_FLAG_DIGALGID_ABSENT, |
| 124 | init224, | 123 | init224, |
| 125 | update256, | 124 | update256, |
| 126 | final256, | 125 | final256, |
| @@ -139,7 +138,7 @@ static const EVP_MD sha256_md= | |||
| 139 | NID_sha256, | 138 | NID_sha256, |
| 140 | NID_sha256WithRSAEncryption, | 139 | NID_sha256WithRSAEncryption, |
| 141 | SHA256_DIGEST_LENGTH, | 140 | SHA256_DIGEST_LENGTH, |
| 142 | 0, | 141 | EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|EVP_MD_FLAG_DIGALGID_ABSENT, |
| 143 | init256, | 142 | init256, |
| 144 | update256, | 143 | update256, |
| 145 | final256, | 144 | final256, |
| @@ -170,7 +169,7 @@ static const EVP_MD sha384_md= | |||
| 170 | NID_sha384, | 169 | NID_sha384, |
| 171 | NID_sha384WithRSAEncryption, | 170 | NID_sha384WithRSAEncryption, |
| 172 | SHA384_DIGEST_LENGTH, | 171 | SHA384_DIGEST_LENGTH, |
| 173 | 0, | 172 | EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|EVP_MD_FLAG_DIGALGID_ABSENT, |
| 174 | init384, | 173 | init384, |
| 175 | update512, | 174 | update512, |
| 176 | final512, | 175 | final512, |
| @@ -189,7 +188,7 @@ static const EVP_MD sha512_md= | |||
| 189 | NID_sha512, | 188 | NID_sha512, |
| 190 | NID_sha512WithRSAEncryption, | 189 | NID_sha512WithRSAEncryption, |
| 191 | SHA512_DIGEST_LENGTH, | 190 | SHA512_DIGEST_LENGTH, |
| 192 | 0, | 191 | EVP_MD_FLAG_PKEY_METHOD_SIGNATURE|EVP_MD_FLAG_DIGALGID_ABSENT, |
| 193 | init512, | 192 | init512, |
| 194 | update512, | 193 | update512, |
| 195 | final512, | 194 | final512, |
| @@ -203,7 +202,3 @@ static const EVP_MD sha512_md= | |||
| 203 | const EVP_MD *EVP_sha512(void) | 202 | const EVP_MD *EVP_sha512(void) |
| 204 | { return(&sha512_md); } | 203 | { return(&sha512_md); } |
| 205 | #endif /* ifndef OPENSSL_NO_SHA512 */ | 204 | #endif /* ifndef OPENSSL_NO_SHA512 */ |
| 206 | |||
| 207 | #endif | ||
| 208 | |||
| 209 | #endif | ||
diff --git a/src/lib/libcrypto/evp/names.c b/src/lib/libcrypto/evp/names.c index e2e04c3570..f2869f5c78 100644 --- a/src/lib/libcrypto/evp/names.c +++ b/src/lib/libcrypto/evp/names.c | |||
| @@ -66,35 +66,32 @@ int EVP_add_cipher(const EVP_CIPHER *c) | |||
| 66 | { | 66 | { |
| 67 | int r; | 67 | int r; |
| 68 | 68 | ||
| 69 | #ifdef OPENSSL_FIPS | ||
| 70 | OPENSSL_init(); | ||
| 71 | #endif | ||
| 72 | |||
| 73 | r=OBJ_NAME_add(OBJ_nid2sn(c->nid),OBJ_NAME_TYPE_CIPHER_METH,(const char *)c); | 69 | r=OBJ_NAME_add(OBJ_nid2sn(c->nid),OBJ_NAME_TYPE_CIPHER_METH,(const char *)c); |
| 74 | if (r == 0) return(0); | 70 | if (r == 0) return(0); |
| 71 | check_defer(c->nid); | ||
| 75 | r=OBJ_NAME_add(OBJ_nid2ln(c->nid),OBJ_NAME_TYPE_CIPHER_METH,(const char *)c); | 72 | r=OBJ_NAME_add(OBJ_nid2ln(c->nid),OBJ_NAME_TYPE_CIPHER_METH,(const char *)c); |
| 76 | return(r); | 73 | return(r); |
| 77 | } | 74 | } |
| 78 | 75 | ||
| 76 | |||
| 79 | int EVP_add_digest(const EVP_MD *md) | 77 | int EVP_add_digest(const EVP_MD *md) |
| 80 | { | 78 | { |
| 81 | int r; | 79 | int r; |
| 82 | const char *name; | 80 | const char *name; |
| 83 | 81 | ||
| 84 | #ifdef OPENSSL_FIPS | ||
| 85 | OPENSSL_init(); | ||
| 86 | #endif | ||
| 87 | name=OBJ_nid2sn(md->type); | 82 | name=OBJ_nid2sn(md->type); |
| 88 | r=OBJ_NAME_add(name,OBJ_NAME_TYPE_MD_METH,(const char *)md); | 83 | r=OBJ_NAME_add(name,OBJ_NAME_TYPE_MD_METH,(const char *)md); |
| 89 | if (r == 0) return(0); | 84 | if (r == 0) return(0); |
| 85 | check_defer(md->type); | ||
| 90 | r=OBJ_NAME_add(OBJ_nid2ln(md->type),OBJ_NAME_TYPE_MD_METH,(const char *)md); | 86 | r=OBJ_NAME_add(OBJ_nid2ln(md->type),OBJ_NAME_TYPE_MD_METH,(const char *)md); |
| 91 | if (r == 0) return(0); | 87 | if (r == 0) return(0); |
| 92 | 88 | ||
| 93 | if (md->type != md->pkey_type) | 89 | if (md->pkey_type && md->type != md->pkey_type) |
| 94 | { | 90 | { |
| 95 | r=OBJ_NAME_add(OBJ_nid2sn(md->pkey_type), | 91 | r=OBJ_NAME_add(OBJ_nid2sn(md->pkey_type), |
| 96 | OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,name); | 92 | OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,name); |
| 97 | if (r == 0) return(0); | 93 | if (r == 0) return(0); |
| 94 | check_defer(md->pkey_type); | ||
| 98 | r=OBJ_NAME_add(OBJ_nid2ln(md->pkey_type), | 95 | r=OBJ_NAME_add(OBJ_nid2ln(md->pkey_type), |
| 99 | OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,name); | 96 | OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,name); |
| 100 | } | 97 | } |
| @@ -127,4 +124,78 @@ void EVP_cleanup(void) | |||
| 127 | OBJ_NAME_cleanup(-1); | 124 | OBJ_NAME_cleanup(-1); |
| 128 | 125 | ||
| 129 | EVP_PBE_cleanup(); | 126 | EVP_PBE_cleanup(); |
| 127 | if (obj_cleanup_defer == 2) | ||
| 128 | { | ||
| 129 | obj_cleanup_defer = 0; | ||
| 130 | OBJ_cleanup(); | ||
| 131 | } | ||
| 132 | OBJ_sigid_free(); | ||
| 133 | } | ||
| 134 | |||
| 135 | struct doall_cipher | ||
| 136 | { | ||
| 137 | void *arg; | ||
| 138 | void (*fn)(const EVP_CIPHER *ciph, | ||
| 139 | const char *from, const char *to, void *arg); | ||
| 140 | }; | ||
| 141 | |||
| 142 | static void do_all_cipher_fn(const OBJ_NAME *nm, void *arg) | ||
| 143 | { | ||
| 144 | struct doall_cipher *dc = arg; | ||
| 145 | if (nm->alias) | ||
| 146 | dc->fn(NULL, nm->name, nm->data, dc->arg); | ||
| 147 | else | ||
| 148 | dc->fn((const EVP_CIPHER *)nm->data, nm->name, NULL, dc->arg); | ||
| 149 | } | ||
| 150 | |||
| 151 | void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph, | ||
| 152 | const char *from, const char *to, void *x), void *arg) | ||
| 153 | { | ||
| 154 | struct doall_cipher dc; | ||
| 155 | dc.fn = fn; | ||
| 156 | dc.arg = arg; | ||
| 157 | OBJ_NAME_do_all(OBJ_NAME_TYPE_CIPHER_METH, do_all_cipher_fn, &dc); | ||
| 158 | } | ||
| 159 | |||
| 160 | void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph, | ||
| 161 | const char *from, const char *to, void *x), void *arg) | ||
| 162 | { | ||
| 163 | struct doall_cipher dc; | ||
| 164 | dc.fn = fn; | ||
| 165 | dc.arg = arg; | ||
| 166 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, do_all_cipher_fn,&dc); | ||
| 167 | } | ||
| 168 | |||
| 169 | struct doall_md | ||
| 170 | { | ||
| 171 | void *arg; | ||
| 172 | void (*fn)(const EVP_MD *ciph, | ||
| 173 | const char *from, const char *to, void *arg); | ||
| 174 | }; | ||
| 175 | |||
| 176 | static void do_all_md_fn(const OBJ_NAME *nm, void *arg) | ||
| 177 | { | ||
| 178 | struct doall_md *dc = arg; | ||
| 179 | if (nm->alias) | ||
| 180 | dc->fn(NULL, nm->name, nm->data, dc->arg); | ||
| 181 | else | ||
| 182 | dc->fn((const EVP_MD *)nm->data, nm->name, NULL, dc->arg); | ||
| 183 | } | ||
| 184 | |||
| 185 | void EVP_MD_do_all(void (*fn)(const EVP_MD *md, | ||
| 186 | const char *from, const char *to, void *x), void *arg) | ||
| 187 | { | ||
| 188 | struct doall_md dc; | ||
| 189 | dc.fn = fn; | ||
| 190 | dc.arg = arg; | ||
| 191 | OBJ_NAME_do_all(OBJ_NAME_TYPE_MD_METH, do_all_md_fn, &dc); | ||
| 192 | } | ||
| 193 | |||
| 194 | void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *md, | ||
| 195 | const char *from, const char *to, void *x), void *arg) | ||
| 196 | { | ||
| 197 | struct doall_md dc; | ||
| 198 | dc.fn = fn; | ||
| 199 | dc.arg = arg; | ||
| 200 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_MD_METH, do_all_md_fn, &dc); | ||
| 130 | } | 201 | } |
diff --git a/src/lib/libcrypto/evp/p5_crpt.c b/src/lib/libcrypto/evp/p5_crpt.c index 2a265fdee2..7ecfa8dad9 100644 --- a/src/lib/libcrypto/evp/p5_crpt.c +++ b/src/lib/libcrypto/evp/p5_crpt.c | |||
| @@ -62,42 +62,11 @@ | |||
| 62 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 63 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
| 64 | 64 | ||
| 65 | /* PKCS#5 v1.5 compatible PBE functions: see PKCS#5 v2.0 for more info. | 65 | /* Doesn't do anything now: Builtin PBE algorithms in static table. |
| 66 | */ | 66 | */ |
| 67 | 67 | ||
| 68 | void PKCS5_PBE_add(void) | 68 | void PKCS5_PBE_add(void) |
| 69 | { | 69 | { |
| 70 | #ifndef OPENSSL_NO_DES | ||
| 71 | # ifndef OPENSSL_NO_MD5 | ||
| 72 | EVP_PBE_alg_add(NID_pbeWithMD5AndDES_CBC, EVP_des_cbc(), EVP_md5(), | ||
| 73 | PKCS5_PBE_keyivgen); | ||
| 74 | # endif | ||
| 75 | # ifndef OPENSSL_NO_MD2 | ||
| 76 | EVP_PBE_alg_add(NID_pbeWithMD2AndDES_CBC, EVP_des_cbc(), EVP_md2(), | ||
| 77 | PKCS5_PBE_keyivgen); | ||
| 78 | # endif | ||
| 79 | # ifndef OPENSSL_NO_SHA | ||
| 80 | EVP_PBE_alg_add(NID_pbeWithSHA1AndDES_CBC, EVP_des_cbc(), EVP_sha1(), | ||
| 81 | PKCS5_PBE_keyivgen); | ||
| 82 | # endif | ||
| 83 | #endif | ||
| 84 | #ifndef OPENSSL_NO_RC2 | ||
| 85 | # ifndef OPENSSL_NO_MD5 | ||
| 86 | EVP_PBE_alg_add(NID_pbeWithMD5AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md5(), | ||
| 87 | PKCS5_PBE_keyivgen); | ||
| 88 | # endif | ||
| 89 | # ifndef OPENSSL_NO_MD2 | ||
| 90 | EVP_PBE_alg_add(NID_pbeWithMD2AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md2(), | ||
| 91 | PKCS5_PBE_keyivgen); | ||
| 92 | # endif | ||
| 93 | # ifndef OPENSSL_NO_SHA | ||
| 94 | EVP_PBE_alg_add(NID_pbeWithSHA1AndRC2_CBC, EVP_rc2_64_cbc(), EVP_sha1(), | ||
| 95 | PKCS5_PBE_keyivgen); | ||
| 96 | # endif | ||
| 97 | #endif | ||
| 98 | #ifndef OPENSSL_NO_HMAC | ||
| 99 | EVP_PBE_alg_add(NID_pbes2, NULL, NULL, PKCS5_v2_PBE_keyivgen); | ||
| 100 | #endif | ||
| 101 | } | 70 | } |
| 102 | 71 | ||
| 103 | int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, | 72 | int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, |
| @@ -112,6 +81,7 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, | |||
| 112 | int saltlen, iter; | 81 | int saltlen, iter; |
| 113 | unsigned char *salt; | 82 | unsigned char *salt; |
| 114 | const unsigned char *pbuf; | 83 | const unsigned char *pbuf; |
| 84 | int mdsize; | ||
| 115 | 85 | ||
| 116 | /* Extract useful info from parameter */ | 86 | /* Extract useful info from parameter */ |
| 117 | if (param == NULL || param->type != V_ASN1_SEQUENCE || | 87 | if (param == NULL || param->type != V_ASN1_SEQUENCE || |
| @@ -140,9 +110,12 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, | |||
| 140 | EVP_DigestUpdate(&ctx, salt, saltlen); | 110 | EVP_DigestUpdate(&ctx, salt, saltlen); |
| 141 | PBEPARAM_free(pbe); | 111 | PBEPARAM_free(pbe); |
| 142 | EVP_DigestFinal_ex(&ctx, md_tmp, NULL); | 112 | EVP_DigestFinal_ex(&ctx, md_tmp, NULL); |
| 113 | mdsize = EVP_MD_size(md); | ||
| 114 | if (mdsize < 0) | ||
| 115 | return 0; | ||
| 143 | for (i = 1; i < iter; i++) { | 116 | for (i = 1; i < iter; i++) { |
| 144 | EVP_DigestInit_ex(&ctx, md, NULL); | 117 | EVP_DigestInit_ex(&ctx, md, NULL); |
| 145 | EVP_DigestUpdate(&ctx, md_tmp, EVP_MD_size(md)); | 118 | EVP_DigestUpdate(&ctx, md_tmp, mdsize); |
| 146 | EVP_DigestFinal_ex (&ctx, md_tmp, NULL); | 119 | EVP_DigestFinal_ex (&ctx, md_tmp, NULL); |
| 147 | } | 120 | } |
| 148 | EVP_MD_CTX_cleanup(&ctx); | 121 | EVP_MD_CTX_cleanup(&ctx); |
diff --git a/src/lib/libcrypto/evp/p5_crpt2.c b/src/lib/libcrypto/evp/p5_crpt2.c index 6bec77baf9..334379f310 100644 --- a/src/lib/libcrypto/evp/p5_crpt2.c +++ b/src/lib/libcrypto/evp/p5_crpt2.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -71,28 +71,38 @@ | |||
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | /* This is an implementation of PKCS#5 v2.0 password based encryption key | 73 | /* This is an implementation of PKCS#5 v2.0 password based encryption key |
| 74 | * derivation function PBKDF2 using the only currently defined function HMAC | 74 | * derivation function PBKDF2. |
| 75 | * with SHA1. Verified against test vectors posted by Peter Gutmann | 75 | * SHA1 version verified against test vectors posted by Peter Gutmann |
| 76 | * <pgut001@cs.auckland.ac.nz> to the PKCS-TNG <pkcs-tng@rsa.com> mailing list. | 76 | * <pgut001@cs.auckland.ac.nz> to the PKCS-TNG <pkcs-tng@rsa.com> mailing list. |
| 77 | */ | 77 | */ |
| 78 | 78 | ||
| 79 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, | 79 | int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, |
| 80 | const unsigned char *salt, int saltlen, int iter, | 80 | const unsigned char *salt, int saltlen, int iter, |
| 81 | const EVP_MD *digest, | ||
| 81 | int keylen, unsigned char *out) | 82 | int keylen, unsigned char *out) |
| 82 | { | 83 | { |
| 83 | unsigned char digtmp[SHA_DIGEST_LENGTH], *p, itmp[4]; | 84 | unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4]; |
| 84 | int cplen, j, k, tkeylen; | 85 | int cplen, j, k, tkeylen, mdlen; |
| 85 | unsigned long i = 1; | 86 | unsigned long i = 1; |
| 86 | HMAC_CTX hctx; | 87 | HMAC_CTX hctx; |
| 87 | 88 | ||
| 89 | mdlen = EVP_MD_size(digest); | ||
| 90 | if (mdlen < 0) | ||
| 91 | return 0; | ||
| 92 | |||
| 88 | HMAC_CTX_init(&hctx); | 93 | HMAC_CTX_init(&hctx); |
| 89 | p = out; | 94 | p = out; |
| 90 | tkeylen = keylen; | 95 | tkeylen = keylen; |
| 91 | if(!pass) passlen = 0; | 96 | if(!pass) |
| 92 | else if(passlen == -1) passlen = strlen(pass); | 97 | passlen = 0; |
| 93 | while(tkeylen) { | 98 | else if(passlen == -1) |
| 94 | if(tkeylen > SHA_DIGEST_LENGTH) cplen = SHA_DIGEST_LENGTH; | 99 | passlen = strlen(pass); |
| 95 | else cplen = tkeylen; | 100 | while(tkeylen) |
| 101 | { | ||
| 102 | if(tkeylen > mdlen) | ||
| 103 | cplen = mdlen; | ||
| 104 | else | ||
| 105 | cplen = tkeylen; | ||
| 96 | /* We are unlikely to ever use more than 256 blocks (5120 bits!) | 106 | /* We are unlikely to ever use more than 256 blocks (5120 bits!) |
| 97 | * but just in case... | 107 | * but just in case... |
| 98 | */ | 108 | */ |
| @@ -100,20 +110,22 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, | |||
| 100 | itmp[1] = (unsigned char)((i >> 16) & 0xff); | 110 | itmp[1] = (unsigned char)((i >> 16) & 0xff); |
| 101 | itmp[2] = (unsigned char)((i >> 8) & 0xff); | 111 | itmp[2] = (unsigned char)((i >> 8) & 0xff); |
| 102 | itmp[3] = (unsigned char)(i & 0xff); | 112 | itmp[3] = (unsigned char)(i & 0xff); |
| 103 | HMAC_Init_ex(&hctx, pass, passlen, EVP_sha1(), NULL); | 113 | HMAC_Init_ex(&hctx, pass, passlen, digest, NULL); |
| 104 | HMAC_Update(&hctx, salt, saltlen); | 114 | HMAC_Update(&hctx, salt, saltlen); |
| 105 | HMAC_Update(&hctx, itmp, 4); | 115 | HMAC_Update(&hctx, itmp, 4); |
| 106 | HMAC_Final(&hctx, digtmp, NULL); | 116 | HMAC_Final(&hctx, digtmp, NULL); |
| 107 | memcpy(p, digtmp, cplen); | 117 | memcpy(p, digtmp, cplen); |
| 108 | for(j = 1; j < iter; j++) { | 118 | for(j = 1; j < iter; j++) |
| 109 | HMAC(EVP_sha1(), pass, passlen, | 119 | { |
| 110 | digtmp, SHA_DIGEST_LENGTH, digtmp, NULL); | 120 | HMAC(digest, pass, passlen, |
| 111 | for(k = 0; k < cplen; k++) p[k] ^= digtmp[k]; | 121 | digtmp, mdlen, digtmp, NULL); |
| 112 | } | 122 | for(k = 0; k < cplen; k++) |
| 123 | p[k] ^= digtmp[k]; | ||
| 124 | } | ||
| 113 | tkeylen-= cplen; | 125 | tkeylen-= cplen; |
| 114 | i++; | 126 | i++; |
| 115 | p+= cplen; | 127 | p+= cplen; |
| 116 | } | 128 | } |
| 117 | HMAC_CTX_cleanup(&hctx); | 129 | HMAC_CTX_cleanup(&hctx); |
| 118 | #ifdef DEBUG_PKCS5V2 | 130 | #ifdef DEBUG_PKCS5V2 |
| 119 | fprintf(stderr, "Password:\n"); | 131 | fprintf(stderr, "Password:\n"); |
| @@ -125,7 +137,15 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, | |||
| 125 | h__dump (out, keylen); | 137 | h__dump (out, keylen); |
| 126 | #endif | 138 | #endif |
| 127 | return 1; | 139 | return 1; |
| 128 | } | 140 | } |
| 141 | |||
| 142 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, | ||
| 143 | const unsigned char *salt, int saltlen, int iter, | ||
| 144 | int keylen, unsigned char *out) | ||
| 145 | { | ||
| 146 | return PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, iter, EVP_sha1(), | ||
| 147 | keylen, out); | ||
| 148 | } | ||
| 129 | 149 | ||
| 130 | #ifdef DO_TEST | 150 | #ifdef DO_TEST |
| 131 | main() | 151 | main() |
| @@ -155,6 +175,8 @@ int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
| 155 | PBE2PARAM *pbe2 = NULL; | 175 | PBE2PARAM *pbe2 = NULL; |
| 156 | const EVP_CIPHER *cipher; | 176 | const EVP_CIPHER *cipher; |
| 157 | PBKDF2PARAM *kdf = NULL; | 177 | PBKDF2PARAM *kdf = NULL; |
| 178 | const EVP_MD *prfmd; | ||
| 179 | int prf_nid, hmac_md_nid; | ||
| 158 | 180 | ||
| 159 | if (param == NULL || param->type != V_ASN1_SEQUENCE || | 181 | if (param == NULL || param->type != V_ASN1_SEQUENCE || |
| 160 | param->value.sequence == NULL) { | 182 | param->value.sequence == NULL) { |
| @@ -180,8 +202,7 @@ int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
| 180 | /* lets see if we recognise the encryption algorithm. | 202 | /* lets see if we recognise the encryption algorithm. |
| 181 | */ | 203 | */ |
| 182 | 204 | ||
| 183 | cipher = EVP_get_cipherbyname( | 205 | cipher = EVP_get_cipherbyobj(pbe2->encryption->algorithm); |
| 184 | OBJ_nid2sn(OBJ_obj2nid(pbe2->encryption->algorithm))); | ||
| 185 | 206 | ||
| 186 | if(!cipher) { | 207 | if(!cipher) { |
| 187 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, | 208 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, |
| @@ -226,10 +247,23 @@ int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
| 226 | goto err; | 247 | goto err; |
| 227 | } | 248 | } |
| 228 | 249 | ||
| 229 | if(kdf->prf && (OBJ_obj2nid(kdf->prf->algorithm) != NID_hmacWithSHA1)) { | 250 | if (kdf->prf) |
| 251 | prf_nid = OBJ_obj2nid(kdf->prf->algorithm); | ||
| 252 | else | ||
| 253 | prf_nid = NID_hmacWithSHA1; | ||
| 254 | |||
| 255 | if (!EVP_PBE_find(EVP_PBE_TYPE_PRF, prf_nid, NULL, &hmac_md_nid, 0)) | ||
| 256 | { | ||
| 230 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, EVP_R_UNSUPPORTED_PRF); | 257 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, EVP_R_UNSUPPORTED_PRF); |
| 231 | goto err; | 258 | goto err; |
| 232 | } | 259 | } |
| 260 | |||
| 261 | prfmd = EVP_get_digestbynid(hmac_md_nid); | ||
| 262 | if (prfmd == NULL) | ||
| 263 | { | ||
| 264 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, EVP_R_UNSUPPORTED_PRF); | ||
| 265 | goto err; | ||
| 266 | } | ||
| 233 | 267 | ||
| 234 | if(kdf->salt->type != V_ASN1_OCTET_STRING) { | 268 | if(kdf->salt->type != V_ASN1_OCTET_STRING) { |
| 235 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, | 269 | EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, |
| @@ -241,7 +275,9 @@ int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
| 241 | salt = kdf->salt->value.octet_string->data; | 275 | salt = kdf->salt->value.octet_string->data; |
| 242 | saltlen = kdf->salt->value.octet_string->length; | 276 | saltlen = kdf->salt->value.octet_string->length; |
| 243 | iter = ASN1_INTEGER_get(kdf->iter); | 277 | iter = ASN1_INTEGER_get(kdf->iter); |
| 244 | PKCS5_PBKDF2_HMAC_SHA1(pass, passlen, salt, saltlen, iter, keylen, key); | 278 | if(!PKCS5_PBKDF2_HMAC(pass, passlen, salt, saltlen, iter, prfmd, |
| 279 | keylen, key)) | ||
| 280 | goto err; | ||
| 245 | EVP_CipherInit_ex(ctx, NULL, NULL, key, NULL, en_de); | 281 | EVP_CipherInit_ex(ctx, NULL, NULL, key, NULL, en_de); |
| 246 | OPENSSL_cleanse(key, keylen); | 282 | OPENSSL_cleanse(key, keylen); |
| 247 | PBKDF2PARAM_free(kdf); | 283 | PBKDF2PARAM_free(kdf); |
diff --git a/src/lib/libcrypto/evp/p_dec.c b/src/lib/libcrypto/evp/p_dec.c index f64901f653..4201dcbad9 100644 --- a/src/lib/libcrypto/evp/p_dec.c +++ b/src/lib/libcrypto/evp/p_dec.c | |||
| @@ -66,7 +66,7 @@ | |||
| 66 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
| 67 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
| 68 | 68 | ||
| 69 | int EVP_PKEY_decrypt(unsigned char *key, const unsigned char *ek, int ekl, | 69 | int EVP_PKEY_decrypt_old(unsigned char *key, const unsigned char *ek, int ekl, |
| 70 | EVP_PKEY *priv) | 70 | EVP_PKEY *priv) |
| 71 | { | 71 | { |
| 72 | int ret= -1; | 72 | int ret= -1; |
| @@ -75,7 +75,7 @@ int EVP_PKEY_decrypt(unsigned char *key, const unsigned char *ek, int ekl, | |||
| 75 | if (priv->type != EVP_PKEY_RSA) | 75 | if (priv->type != EVP_PKEY_RSA) |
| 76 | { | 76 | { |
| 77 | #endif | 77 | #endif |
| 78 | EVPerr(EVP_F_EVP_PKEY_DECRYPT,EVP_R_PUBLIC_KEY_NOT_RSA); | 78 | EVPerr(EVP_F_EVP_PKEY_DECRYPT_OLD,EVP_R_PUBLIC_KEY_NOT_RSA); |
| 79 | #ifndef OPENSSL_NO_RSA | 79 | #ifndef OPENSSL_NO_RSA |
| 80 | goto err; | 80 | goto err; |
| 81 | } | 81 | } |
diff --git a/src/lib/libcrypto/evp/p_enc.c b/src/lib/libcrypto/evp/p_enc.c index c2dfdc52ad..b5a3a84c41 100644 --- a/src/lib/libcrypto/evp/p_enc.c +++ b/src/lib/libcrypto/evp/p_enc.c | |||
| @@ -66,7 +66,7 @@ | |||
| 66 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
| 67 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
| 68 | 68 | ||
| 69 | int EVP_PKEY_encrypt(unsigned char *ek, const unsigned char *key, int key_len, | 69 | int EVP_PKEY_encrypt_old(unsigned char *ek, const unsigned char *key, int key_len, |
| 70 | EVP_PKEY *pubk) | 70 | EVP_PKEY *pubk) |
| 71 | { | 71 | { |
| 72 | int ret=0; | 72 | int ret=0; |
| @@ -75,7 +75,7 @@ int EVP_PKEY_encrypt(unsigned char *ek, const unsigned char *key, int key_len, | |||
| 75 | if (pubk->type != EVP_PKEY_RSA) | 75 | if (pubk->type != EVP_PKEY_RSA) |
| 76 | { | 76 | { |
| 77 | #endif | 77 | #endif |
| 78 | EVPerr(EVP_F_EVP_PKEY_ENCRYPT,EVP_R_PUBLIC_KEY_NOT_RSA); | 78 | EVPerr(EVP_F_EVP_PKEY_ENCRYPT_OLD,EVP_R_PUBLIC_KEY_NOT_RSA); |
| 79 | #ifndef OPENSSL_NO_RSA | 79 | #ifndef OPENSSL_NO_RSA |
| 80 | goto err; | 80 | goto err; |
| 81 | } | 81 | } |
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index 22155ecf62..1916c61699 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c | |||
| @@ -74,66 +74,26 @@ | |||
| 74 | #include <openssl/dh.h> | 74 | #include <openssl/dh.h> |
| 75 | #endif | 75 | #endif |
| 76 | 76 | ||
| 77 | #ifndef OPENSSL_NO_ENGINE | ||
| 78 | #include <openssl/engine.h> | ||
| 79 | #endif | ||
| 80 | |||
| 81 | #include "asn1_locl.h" | ||
| 82 | |||
| 77 | static void EVP_PKEY_free_it(EVP_PKEY *x); | 83 | static void EVP_PKEY_free_it(EVP_PKEY *x); |
| 78 | 84 | ||
| 79 | int EVP_PKEY_bits(EVP_PKEY *pkey) | 85 | int EVP_PKEY_bits(EVP_PKEY *pkey) |
| 80 | { | 86 | { |
| 81 | if (0) | 87 | if (pkey && pkey->ameth && pkey->ameth->pkey_bits) |
| 82 | return 0; | 88 | return pkey->ameth->pkey_bits(pkey); |
| 83 | #ifndef OPENSSL_NO_RSA | 89 | return 0; |
| 84 | else if (pkey->type == EVP_PKEY_RSA) | ||
| 85 | return(BN_num_bits(pkey->pkey.rsa->n)); | ||
| 86 | #endif | ||
| 87 | #ifndef OPENSSL_NO_DSA | ||
| 88 | else if (pkey->type == EVP_PKEY_DSA) | ||
| 89 | return(BN_num_bits(pkey->pkey.dsa->p)); | ||
| 90 | #endif | ||
| 91 | #ifndef OPENSSL_NO_EC | ||
| 92 | else if (pkey->type == EVP_PKEY_EC) | ||
| 93 | { | ||
| 94 | BIGNUM *order = BN_new(); | ||
| 95 | const EC_GROUP *group; | ||
| 96 | int ret; | ||
| 97 | |||
| 98 | if (!order) | ||
| 99 | { | ||
| 100 | ERR_clear_error(); | ||
| 101 | return 0; | ||
| 102 | } | ||
| 103 | group = EC_KEY_get0_group(pkey->pkey.ec); | ||
| 104 | if (!EC_GROUP_get_order(group, order, NULL)) | ||
| 105 | { | ||
| 106 | ERR_clear_error(); | ||
| 107 | return 0; | ||
| 108 | } | ||
| 109 | |||
| 110 | ret = BN_num_bits(order); | ||
| 111 | BN_free(order); | ||
| 112 | return ret; | ||
| 113 | } | ||
| 114 | #endif | ||
| 115 | return(0); | ||
| 116 | } | 90 | } |
| 117 | 91 | ||
| 118 | int EVP_PKEY_size(EVP_PKEY *pkey) | 92 | int EVP_PKEY_size(EVP_PKEY *pkey) |
| 119 | { | 93 | { |
| 120 | if (pkey == NULL) | 94 | if (pkey && pkey->ameth && pkey->ameth->pkey_size) |
| 121 | return(0); | 95 | return pkey->ameth->pkey_size(pkey); |
| 122 | #ifndef OPENSSL_NO_RSA | 96 | return 0; |
| 123 | if (pkey->type == EVP_PKEY_RSA) | ||
| 124 | return(RSA_size(pkey->pkey.rsa)); | ||
| 125 | else | ||
| 126 | #endif | ||
| 127 | #ifndef OPENSSL_NO_DSA | ||
| 128 | if (pkey->type == EVP_PKEY_DSA) | ||
| 129 | return(DSA_size(pkey->pkey.dsa)); | ||
| 130 | #endif | ||
| 131 | #ifndef OPENSSL_NO_ECDSA | ||
| 132 | if (pkey->type == EVP_PKEY_EC) | ||
| 133 | return(ECDSA_size(pkey->pkey.ec)); | ||
| 134 | #endif | ||
| 135 | |||
| 136 | return(0); | ||
| 137 | } | 97 | } |
| 138 | 98 | ||
| 139 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode) | 99 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode) |
| @@ -174,88 +134,26 @@ int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) | |||
| 174 | EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_MISSING_PARAMETERS); | 134 | EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_MISSING_PARAMETERS); |
| 175 | goto err; | 135 | goto err; |
| 176 | } | 136 | } |
| 177 | #ifndef OPENSSL_NO_DSA | 137 | if (from->ameth && from->ameth->param_copy) |
| 178 | if (to->type == EVP_PKEY_DSA) | 138 | return from->ameth->param_copy(to, from); |
| 179 | { | ||
| 180 | BIGNUM *a; | ||
| 181 | |||
| 182 | if ((a=BN_dup(from->pkey.dsa->p)) == NULL) goto err; | ||
| 183 | if (to->pkey.dsa->p != NULL) BN_free(to->pkey.dsa->p); | ||
| 184 | to->pkey.dsa->p=a; | ||
| 185 | |||
| 186 | if ((a=BN_dup(from->pkey.dsa->q)) == NULL) goto err; | ||
| 187 | if (to->pkey.dsa->q != NULL) BN_free(to->pkey.dsa->q); | ||
| 188 | to->pkey.dsa->q=a; | ||
| 189 | |||
| 190 | if ((a=BN_dup(from->pkey.dsa->g)) == NULL) goto err; | ||
| 191 | if (to->pkey.dsa->g != NULL) BN_free(to->pkey.dsa->g); | ||
| 192 | to->pkey.dsa->g=a; | ||
| 193 | } | ||
| 194 | #endif | ||
| 195 | #ifndef OPENSSL_NO_EC | ||
| 196 | if (to->type == EVP_PKEY_EC) | ||
| 197 | { | ||
| 198 | EC_GROUP *group = EC_GROUP_dup(EC_KEY_get0_group(from->pkey.ec)); | ||
| 199 | if (group == NULL) | ||
| 200 | goto err; | ||
| 201 | if (EC_KEY_set_group(to->pkey.ec, group) == 0) | ||
| 202 | goto err; | ||
| 203 | EC_GROUP_free(group); | ||
| 204 | } | ||
| 205 | #endif | ||
| 206 | return(1); | ||
| 207 | err: | 139 | err: |
| 208 | return(0); | 140 | return 0; |
| 209 | } | 141 | } |
| 210 | 142 | ||
| 211 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey) | 143 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey) |
| 212 | { | 144 | { |
| 213 | #ifndef OPENSSL_NO_DSA | 145 | if (pkey->ameth && pkey->ameth->param_missing) |
| 214 | if (pkey->type == EVP_PKEY_DSA) | 146 | return pkey->ameth->param_missing(pkey); |
| 215 | { | 147 | return 0; |
| 216 | DSA *dsa; | ||
| 217 | |||
| 218 | dsa=pkey->pkey.dsa; | ||
| 219 | if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL)) | ||
| 220 | return(1); | ||
| 221 | } | ||
| 222 | #endif | ||
| 223 | #ifndef OPENSSL_NO_EC | ||
| 224 | if (pkey->type == EVP_PKEY_EC) | ||
| 225 | { | ||
| 226 | if (EC_KEY_get0_group(pkey->pkey.ec) == NULL) | ||
| 227 | return(1); | ||
| 228 | } | ||
| 229 | #endif | ||
| 230 | |||
| 231 | return(0); | ||
| 232 | } | 148 | } |
| 233 | 149 | ||
| 234 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) | 150 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) |
| 235 | { | 151 | { |
| 236 | #ifndef OPENSSL_NO_DSA | 152 | if (a->type != b->type) |
| 237 | if ((a->type == EVP_PKEY_DSA) && (b->type == EVP_PKEY_DSA)) | 153 | return -1; |
| 238 | { | 154 | if (a->ameth && a->ameth->param_cmp) |
| 239 | if ( BN_cmp(a->pkey.dsa->p,b->pkey.dsa->p) || | 155 | return a->ameth->param_cmp(a, b); |
| 240 | BN_cmp(a->pkey.dsa->q,b->pkey.dsa->q) || | 156 | return -2; |
| 241 | BN_cmp(a->pkey.dsa->g,b->pkey.dsa->g)) | ||
| 242 | return(0); | ||
| 243 | else | ||
| 244 | return(1); | ||
| 245 | } | ||
| 246 | #endif | ||
| 247 | #ifndef OPENSSL_NO_EC | ||
| 248 | if (a->type == EVP_PKEY_EC && b->type == EVP_PKEY_EC) | ||
| 249 | { | ||
| 250 | const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec), | ||
| 251 | *group_b = EC_KEY_get0_group(b->pkey.ec); | ||
| 252 | if (EC_GROUP_cmp(group_a, group_b, NULL)) | ||
| 253 | return 0; | ||
| 254 | else | ||
| 255 | return 1; | ||
| 256 | } | ||
| 257 | #endif | ||
| 258 | return(-1); | ||
| 259 | } | 157 | } |
| 260 | 158 | ||
| 261 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b) | 159 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b) |
| @@ -263,51 +161,22 @@ int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b) | |||
| 263 | if (a->type != b->type) | 161 | if (a->type != b->type) |
| 264 | return -1; | 162 | return -1; |
| 265 | 163 | ||
| 266 | if (EVP_PKEY_cmp_parameters(a, b) == 0) | 164 | if (a->ameth) |
| 267 | return 0; | ||
| 268 | |||
| 269 | switch (a->type) | ||
| 270 | { | 165 | { |
| 271 | #ifndef OPENSSL_NO_RSA | 166 | int ret; |
| 272 | case EVP_PKEY_RSA: | 167 | /* Compare parameters if the algorithm has them */ |
| 273 | if (BN_cmp(b->pkey.rsa->n,a->pkey.rsa->n) != 0 | 168 | if (a->ameth->param_cmp) |
| 274 | || BN_cmp(b->pkey.rsa->e,a->pkey.rsa->e) != 0) | ||
| 275 | return 0; | ||
| 276 | break; | ||
| 277 | #endif | ||
| 278 | #ifndef OPENSSL_NO_DSA | ||
| 279 | case EVP_PKEY_DSA: | ||
| 280 | if (BN_cmp(b->pkey.dsa->pub_key,a->pkey.dsa->pub_key) != 0) | ||
| 281 | return 0; | ||
| 282 | break; | ||
| 283 | #endif | ||
| 284 | #ifndef OPENSSL_NO_EC | ||
| 285 | case EVP_PKEY_EC: | ||
| 286 | { | ||
| 287 | int r; | ||
| 288 | const EC_GROUP *group = EC_KEY_get0_group(b->pkey.ec); | ||
| 289 | const EC_POINT *pa = EC_KEY_get0_public_key(a->pkey.ec), | ||
| 290 | *pb = EC_KEY_get0_public_key(b->pkey.ec); | ||
| 291 | r = EC_POINT_cmp(group, pa, pb, NULL); | ||
| 292 | if (r != 0) | ||
| 293 | { | 169 | { |
| 294 | if (r == 1) | 170 | ret = a->ameth->param_cmp(a, b); |
| 295 | return 0; | 171 | if (ret <= 0) |
| 296 | else | 172 | return ret; |
| 297 | return -2; | ||
| 298 | } | 173 | } |
| 299 | } | 174 | |
| 300 | break; | 175 | if (a->ameth->pub_cmp) |
| 301 | #endif | 176 | return a->ameth->pub_cmp(a, b); |
| 302 | #ifndef OPENSSL_NO_DH | ||
| 303 | case EVP_PKEY_DH: | ||
| 304 | return -2; | ||
| 305 | #endif | ||
| 306 | default: | ||
| 307 | return -2; | ||
| 308 | } | 177 | } |
| 309 | 178 | ||
| 310 | return 1; | 179 | return -2; |
| 311 | } | 180 | } |
| 312 | 181 | ||
| 313 | EVP_PKEY *EVP_PKEY_new(void) | 182 | EVP_PKEY *EVP_PKEY_new(void) |
| @@ -321,22 +190,87 @@ EVP_PKEY *EVP_PKEY_new(void) | |||
| 321 | return(NULL); | 190 | return(NULL); |
| 322 | } | 191 | } |
| 323 | ret->type=EVP_PKEY_NONE; | 192 | ret->type=EVP_PKEY_NONE; |
| 193 | ret->save_type=EVP_PKEY_NONE; | ||
| 324 | ret->references=1; | 194 | ret->references=1; |
| 195 | ret->ameth=NULL; | ||
| 196 | ret->engine=NULL; | ||
| 325 | ret->pkey.ptr=NULL; | 197 | ret->pkey.ptr=NULL; |
| 326 | ret->attributes=NULL; | 198 | ret->attributes=NULL; |
| 327 | ret->save_parameters=1; | 199 | ret->save_parameters=1; |
| 328 | return(ret); | 200 | return(ret); |
| 329 | } | 201 | } |
| 330 | 202 | ||
| 331 | int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key) | 203 | /* Setup a public key ASN1 method and ENGINE from a NID or a string. |
| 204 | * If pkey is NULL just return 1 or 0 if the algorithm exists. | ||
| 205 | */ | ||
| 206 | |||
| 207 | static int pkey_set_type(EVP_PKEY *pkey, int type, const char *str, int len) | ||
| 332 | { | 208 | { |
| 333 | if (pkey == NULL) return(0); | 209 | const EVP_PKEY_ASN1_METHOD *ameth; |
| 334 | if (pkey->pkey.ptr != NULL) | 210 | ENGINE *e = NULL; |
| 335 | EVP_PKEY_free_it(pkey); | 211 | if (pkey) |
| 336 | pkey->type=EVP_PKEY_type(type); | 212 | { |
| 337 | pkey->save_type=type; | 213 | if (pkey->pkey.ptr) |
| 214 | EVP_PKEY_free_it(pkey); | ||
| 215 | /* If key type matches and a method exists then this | ||
| 216 | * lookup has succeeded once so just indicate success. | ||
| 217 | */ | ||
| 218 | if ((type == pkey->save_type) && pkey->ameth) | ||
| 219 | return 1; | ||
| 220 | #ifndef OPENSSL_NO_ENGINE | ||
| 221 | /* If we have an ENGINE release it */ | ||
| 222 | if (pkey->engine) | ||
| 223 | { | ||
| 224 | ENGINE_finish(pkey->engine); | ||
| 225 | pkey->engine = NULL; | ||
| 226 | } | ||
| 227 | #endif | ||
| 228 | } | ||
| 229 | if (str) | ||
| 230 | ameth = EVP_PKEY_asn1_find_str(&e, str, len); | ||
| 231 | else | ||
| 232 | ameth = EVP_PKEY_asn1_find(&e, type); | ||
| 233 | #ifndef OPENSSL_NO_ENGINE | ||
| 234 | if (!pkey && e) | ||
| 235 | ENGINE_finish(e); | ||
| 236 | #endif | ||
| 237 | if (!ameth) | ||
| 238 | { | ||
| 239 | EVPerr(EVP_F_PKEY_SET_TYPE, EVP_R_UNSUPPORTED_ALGORITHM); | ||
| 240 | return 0; | ||
| 241 | } | ||
| 242 | if (pkey) | ||
| 243 | { | ||
| 244 | pkey->ameth = ameth; | ||
| 245 | pkey->engine = e; | ||
| 246 | |||
| 247 | pkey->type = pkey->ameth->pkey_id; | ||
| 248 | pkey->save_type=type; | ||
| 249 | } | ||
| 250 | return 1; | ||
| 251 | } | ||
| 252 | |||
| 253 | int EVP_PKEY_set_type(EVP_PKEY *pkey, int type) | ||
| 254 | { | ||
| 255 | return pkey_set_type(pkey, type, NULL, -1); | ||
| 256 | } | ||
| 257 | |||
| 258 | int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len) | ||
| 259 | { | ||
| 260 | return pkey_set_type(pkey, EVP_PKEY_NONE, str, len); | ||
| 261 | } | ||
| 262 | |||
| 263 | int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) | ||
| 264 | { | ||
| 265 | if (!EVP_PKEY_set_type(pkey, type)) | ||
| 266 | return 0; | ||
| 338 | pkey->pkey.ptr=key; | 267 | pkey->pkey.ptr=key; |
| 339 | return(key != NULL); | 268 | return (key != NULL); |
| 269 | } | ||
| 270 | |||
| 271 | void *EVP_PKEY_get0(EVP_PKEY *pkey) | ||
| 272 | { | ||
| 273 | return pkey->pkey.ptr; | ||
| 340 | } | 274 | } |
| 341 | 275 | ||
| 342 | #ifndef OPENSSL_NO_RSA | 276 | #ifndef OPENSSL_NO_RSA |
| @@ -425,24 +359,29 @@ DH *EVP_PKEY_get1_DH(EVP_PKEY *pkey) | |||
| 425 | 359 | ||
| 426 | int EVP_PKEY_type(int type) | 360 | int EVP_PKEY_type(int type) |
| 427 | { | 361 | { |
| 428 | switch (type) | 362 | int ret; |
| 429 | { | 363 | const EVP_PKEY_ASN1_METHOD *ameth; |
| 430 | case EVP_PKEY_RSA: | 364 | ENGINE *e; |
| 431 | case EVP_PKEY_RSA2: | 365 | ameth = EVP_PKEY_asn1_find(&e, type); |
| 432 | return(EVP_PKEY_RSA); | 366 | if (ameth) |
| 433 | case EVP_PKEY_DSA: | 367 | ret = ameth->pkey_id; |
| 434 | case EVP_PKEY_DSA1: | 368 | else |
| 435 | case EVP_PKEY_DSA2: | 369 | ret = NID_undef; |
| 436 | case EVP_PKEY_DSA3: | 370 | #ifndef OPENSSL_NO_ENGINE |
| 437 | case EVP_PKEY_DSA4: | 371 | if (e) |
| 438 | return(EVP_PKEY_DSA); | 372 | ENGINE_finish(e); |
| 439 | case EVP_PKEY_DH: | 373 | #endif |
| 440 | return(EVP_PKEY_DH); | 374 | return ret; |
| 441 | case EVP_PKEY_EC: | 375 | } |
| 442 | return(EVP_PKEY_EC); | 376 | |
| 443 | default: | 377 | int EVP_PKEY_id(const EVP_PKEY *pkey) |
| 444 | return(NID_undef); | 378 | { |
| 445 | } | 379 | return pkey->type; |
| 380 | } | ||
| 381 | |||
| 382 | int EVP_PKEY_base_id(const EVP_PKEY *pkey) | ||
| 383 | { | ||
| 384 | return EVP_PKEY_type(pkey->type); | ||
| 446 | } | 385 | } |
| 447 | 386 | ||
| 448 | void EVP_PKEY_free(EVP_PKEY *x) | 387 | void EVP_PKEY_free(EVP_PKEY *x) |
| @@ -471,32 +410,57 @@ void EVP_PKEY_free(EVP_PKEY *x) | |||
| 471 | 410 | ||
| 472 | static void EVP_PKEY_free_it(EVP_PKEY *x) | 411 | static void EVP_PKEY_free_it(EVP_PKEY *x) |
| 473 | { | 412 | { |
| 474 | switch (x->type) | 413 | if (x->ameth && x->ameth->pkey_free) |
| 414 | x->ameth->pkey_free(x); | ||
| 415 | #ifndef OPENSSL_NO_ENGINE | ||
| 416 | if (x->engine) | ||
| 475 | { | 417 | { |
| 476 | #ifndef OPENSSL_NO_RSA | 418 | ENGINE_finish(x->engine); |
| 477 | case EVP_PKEY_RSA: | 419 | x->engine = NULL; |
| 478 | case EVP_PKEY_RSA2: | ||
| 479 | RSA_free(x->pkey.rsa); | ||
| 480 | break; | ||
| 481 | #endif | ||
| 482 | #ifndef OPENSSL_NO_DSA | ||
| 483 | case EVP_PKEY_DSA: | ||
| 484 | case EVP_PKEY_DSA2: | ||
| 485 | case EVP_PKEY_DSA3: | ||
| 486 | case EVP_PKEY_DSA4: | ||
| 487 | DSA_free(x->pkey.dsa); | ||
| 488 | break; | ||
| 489 | #endif | ||
| 490 | #ifndef OPENSSL_NO_EC | ||
| 491 | case EVP_PKEY_EC: | ||
| 492 | EC_KEY_free(x->pkey.ec); | ||
| 493 | break; | ||
| 494 | #endif | ||
| 495 | #ifndef OPENSSL_NO_DH | ||
| 496 | case EVP_PKEY_DH: | ||
| 497 | DH_free(x->pkey.dh); | ||
| 498 | break; | ||
| 499 | #endif | ||
| 500 | } | 420 | } |
| 421 | #endif | ||
| 422 | } | ||
| 423 | |||
| 424 | static int unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent, | ||
| 425 | const char *kstr) | ||
| 426 | { | ||
| 427 | BIO_indent(out, indent, 128); | ||
| 428 | BIO_printf(out, "%s algorithm \"%s\" unsupported\n", | ||
| 429 | kstr, OBJ_nid2ln(pkey->type)); | ||
| 430 | return 1; | ||
| 431 | } | ||
| 432 | |||
| 433 | int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, | ||
| 434 | int indent, ASN1_PCTX *pctx) | ||
| 435 | { | ||
| 436 | if (pkey->ameth && pkey->ameth->pub_print) | ||
| 437 | return pkey->ameth->pub_print(out, pkey, indent, pctx); | ||
| 438 | |||
| 439 | return unsup_alg(out, pkey, indent, "Public Key"); | ||
| 440 | } | ||
| 441 | |||
| 442 | int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, | ||
| 443 | int indent, ASN1_PCTX *pctx) | ||
| 444 | { | ||
| 445 | if (pkey->ameth && pkey->ameth->priv_print) | ||
| 446 | return pkey->ameth->priv_print(out, pkey, indent, pctx); | ||
| 447 | |||
| 448 | return unsup_alg(out, pkey, indent, "Private Key"); | ||
| 449 | } | ||
| 450 | |||
| 451 | int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, | ||
| 452 | int indent, ASN1_PCTX *pctx) | ||
| 453 | { | ||
| 454 | if (pkey->ameth && pkey->ameth->param_print) | ||
| 455 | return pkey->ameth->param_print(out, pkey, indent, pctx); | ||
| 456 | return unsup_alg(out, pkey, indent, "Parameters"); | ||
| 457 | } | ||
| 458 | |||
| 459 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid) | ||
| 460 | { | ||
| 461 | if (!pkey->ameth || !pkey->ameth->pkey_ctrl) | ||
| 462 | return -2; | ||
| 463 | return pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_DEFAULT_MD_NID, | ||
| 464 | 0, pnid); | ||
| 501 | } | 465 | } |
| 502 | 466 | ||
diff --git a/src/lib/libcrypto/evp/p_open.c b/src/lib/libcrypto/evp/p_open.c index 9935206d0f..53a59a295c 100644 --- a/src/lib/libcrypto/evp/p_open.c +++ b/src/lib/libcrypto/evp/p_open.c | |||
| @@ -95,7 +95,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | |||
| 95 | goto err; | 95 | goto err; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | i=EVP_PKEY_decrypt(key,ek,ekl,priv); | 98 | i=EVP_PKEY_decrypt_old(key,ek,ekl,priv); |
| 99 | if ((i <= 0) || !EVP_CIPHER_CTX_set_key_length(ctx, i)) | 99 | if ((i <= 0) || !EVP_CIPHER_CTX_set_key_length(ctx, i)) |
| 100 | { | 100 | { |
| 101 | /* ERROR */ | 101 | /* ERROR */ |
diff --git a/src/lib/libcrypto/evp/p_seal.c b/src/lib/libcrypto/evp/p_seal.c index 8cc8fcb0bd..d8324526e7 100644 --- a/src/lib/libcrypto/evp/p_seal.c +++ b/src/lib/libcrypto/evp/p_seal.c | |||
| @@ -87,7 +87,7 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek | |||
| 87 | 87 | ||
| 88 | for (i=0; i<npubk; i++) | 88 | for (i=0; i<npubk; i++) |
| 89 | { | 89 | { |
| 90 | ekl[i]=EVP_PKEY_encrypt(ek[i],key,EVP_CIPHER_CTX_key_length(ctx), | 90 | ekl[i]=EVP_PKEY_encrypt_old(ek[i],key,EVP_CIPHER_CTX_key_length(ctx), |
| 91 | pubk[i]); | 91 | pubk[i]); |
| 92 | if (ekl[i] <= 0) return(-1); | 92 | if (ekl[i] <= 0) return(-1); |
| 93 | } | 93 | } |
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c index bf41a0db68..8df6d48a7e 100644 --- a/src/lib/libcrypto/evp/p_sign.c +++ b/src/lib/libcrypto/evp/p_sign.c | |||
| @@ -84,6 +84,32 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, | |||
| 84 | MS_STATIC 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); | ||
| 88 | EVP_MD_CTX_copy_ex(&tmp_ctx,ctx); | ||
| 89 | EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len); | ||
| 90 | EVP_MD_CTX_cleanup(&tmp_ctx); | ||
| 91 | |||
| 92 | if (ctx->digest->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) | ||
| 93 | { | ||
| 94 | EVP_PKEY_CTX *pkctx = NULL; | ||
| 95 | size_t sltmp = (size_t)EVP_PKEY_size(pkey); | ||
| 96 | i = 0; | ||
| 97 | pkctx = EVP_PKEY_CTX_new(pkey, NULL); | ||
| 98 | if (!pkctx) | ||
| 99 | goto err; | ||
| 100 | if (EVP_PKEY_sign_init(pkctx) <= 0) | ||
| 101 | goto err; | ||
| 102 | if (EVP_PKEY_CTX_set_signature_md(pkctx, ctx->digest) <= 0) | ||
| 103 | goto err; | ||
| 104 | if (EVP_PKEY_sign(pkctx, sigret, &sltmp, m, m_len) <= 0) | ||
| 105 | goto err; | ||
| 106 | *siglen = sltmp; | ||
| 107 | i = 1; | ||
| 108 | err: | ||
| 109 | EVP_PKEY_CTX_free(pkctx); | ||
| 110 | return i; | ||
| 111 | } | ||
| 112 | |||
| 87 | for (i=0; i<4; i++) | 113 | for (i=0; i<4; i++) |
| 88 | { | 114 | { |
| 89 | v=ctx->digest->required_pkey_type[i]; | 115 | v=ctx->digest->required_pkey_type[i]; |
| @@ -99,28 +125,13 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, | |||
| 99 | EVPerr(EVP_F_EVP_SIGNFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE); | 125 | EVPerr(EVP_F_EVP_SIGNFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE); |
| 100 | return(0); | 126 | return(0); |
| 101 | } | 127 | } |
| 128 | |||
| 102 | if (ctx->digest->sign == NULL) | 129 | if (ctx->digest->sign == NULL) |
| 103 | { | 130 | { |
| 104 | EVPerr(EVP_F_EVP_SIGNFINAL,EVP_R_NO_SIGN_FUNCTION_CONFIGURED); | 131 | EVPerr(EVP_F_EVP_SIGNFINAL,EVP_R_NO_SIGN_FUNCTION_CONFIGURED); |
| 105 | return(0); | 132 | return(0); |
| 106 | } | 133 | } |
| 107 | EVP_MD_CTX_init(&tmp_ctx); | 134 | return(ctx->digest->sign(ctx->digest->type,m,m_len,sigret,siglen, |
| 108 | EVP_MD_CTX_copy_ex(&tmp_ctx,ctx); | 135 | pkey->pkey.ptr)); |
| 109 | if (ctx->digest->flags & EVP_MD_FLAG_SVCTX) | ||
| 110 | { | ||
| 111 | EVP_MD_SVCTX sctmp; | ||
| 112 | sctmp.mctx = &tmp_ctx; | ||
| 113 | sctmp.key = pkey->pkey.ptr; | ||
| 114 | i = ctx->digest->sign(ctx->digest->type, | ||
| 115 | NULL, -1, sigret, siglen, &sctmp); | ||
| 116 | } | ||
| 117 | else | ||
| 118 | { | ||
| 119 | EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len); | ||
| 120 | i = ctx->digest->sign(ctx->digest->type,m,m_len,sigret,siglen, | ||
| 121 | pkey->pkey.ptr); | ||
| 122 | } | ||
| 123 | EVP_MD_CTX_cleanup(&tmp_ctx); | ||
| 124 | return i; | ||
| 125 | } | 136 | } |
| 126 | 137 | ||
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c index 2d46dffe7e..8db46412f3 100644 --- a/src/lib/libcrypto/evp/p_verify.c +++ b/src/lib/libcrypto/evp/p_verify.c | |||
| @@ -70,6 +70,28 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, | |||
| 70 | int i,ok=0,v; | 70 | int i,ok=0,v; |
| 71 | MS_STATIC EVP_MD_CTX tmp_ctx; | 71 | MS_STATIC EVP_MD_CTX tmp_ctx; |
| 72 | 72 | ||
| 73 | EVP_MD_CTX_init(&tmp_ctx); | ||
| 74 | EVP_MD_CTX_copy_ex(&tmp_ctx,ctx); | ||
| 75 | EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len); | ||
| 76 | EVP_MD_CTX_cleanup(&tmp_ctx); | ||
| 77 | |||
| 78 | if (ctx->digest->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) | ||
| 79 | { | ||
| 80 | EVP_PKEY_CTX *pkctx = NULL; | ||
| 81 | i = -1; | ||
| 82 | pkctx = EVP_PKEY_CTX_new(pkey, NULL); | ||
| 83 | if (!pkctx) | ||
| 84 | goto err; | ||
| 85 | if (EVP_PKEY_verify_init(pkctx) <= 0) | ||
| 86 | goto err; | ||
| 87 | if (EVP_PKEY_CTX_set_signature_md(pkctx, ctx->digest) <= 0) | ||
| 88 | goto err; | ||
| 89 | i = EVP_PKEY_verify(pkctx, sigbuf, siglen, m, m_len); | ||
| 90 | err: | ||
| 91 | EVP_PKEY_CTX_free(pkctx); | ||
| 92 | return i; | ||
| 93 | } | ||
| 94 | |||
| 73 | for (i=0; i<4; i++) | 95 | for (i=0; i<4; i++) |
| 74 | { | 96 | { |
| 75 | v=ctx->digest->required_pkey_type[i]; | 97 | v=ctx->digest->required_pkey_type[i]; |
| @@ -85,29 +107,13 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, | |||
| 85 | EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE); | 107 | EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE); |
| 86 | return(-1); | 108 | return(-1); |
| 87 | } | 109 | } |
| 88 | if (ctx->digest->verify == NULL) | 110 | if (ctx->digest->verify == NULL) |
| 89 | { | 111 | { |
| 90 | EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_NO_VERIFY_FUNCTION_CONFIGURED); | 112 | EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_NO_VERIFY_FUNCTION_CONFIGURED); |
| 91 | return(0); | 113 | return(0); |
| 92 | } | 114 | } |
| 93 | 115 | ||
| 94 | EVP_MD_CTX_init(&tmp_ctx); | 116 | return(ctx->digest->verify(ctx->digest->type,m,m_len, |
| 95 | EVP_MD_CTX_copy_ex(&tmp_ctx,ctx); | 117 | sigbuf,siglen,pkey->pkey.ptr)); |
| 96 | if (ctx->digest->flags & EVP_MD_FLAG_SVCTX) | ||
| 97 | { | ||
| 98 | EVP_MD_SVCTX sctmp; | ||
| 99 | sctmp.mctx = &tmp_ctx; | ||
| 100 | sctmp.key = pkey->pkey.ptr; | ||
| 101 | i = ctx->digest->verify(ctx->digest->type, | ||
| 102 | NULL, -1, sigbuf, siglen, &sctmp); | ||
| 103 | } | ||
| 104 | else | ||
| 105 | { | ||
| 106 | EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len); | ||
| 107 | i = ctx->digest->verify(ctx->digest->type,m,m_len, | ||
| 108 | sigbuf,siglen,pkey->pkey.ptr); | ||
| 109 | } | ||
| 110 | EVP_MD_CTX_cleanup(&tmp_ctx); | ||
| 111 | return i; | ||
| 112 | } | 118 | } |
| 113 | 119 | ||
diff --git a/src/lib/libcrypto/ex_data.c b/src/lib/libcrypto/ex_data.c index 3b11e7a556..e2bc8298d0 100644 --- a/src/lib/libcrypto/ex_data.c +++ b/src/lib/libcrypto/ex_data.c | |||
| @@ -245,18 +245,21 @@ typedef struct st_ex_class_item { | |||
| 245 | static int ex_class = CRYPTO_EX_INDEX_USER; | 245 | static int ex_class = CRYPTO_EX_INDEX_USER; |
| 246 | 246 | ||
| 247 | /* The global hash table of EX_CLASS_ITEM items */ | 247 | /* The global hash table of EX_CLASS_ITEM items */ |
| 248 | static LHASH *ex_data = NULL; | 248 | DECLARE_LHASH_OF(EX_CLASS_ITEM); |
| 249 | static LHASH_OF(EX_CLASS_ITEM) *ex_data = NULL; | ||
| 249 | 250 | ||
| 250 | /* The callbacks required in the "ex_data" hash table */ | 251 | /* The callbacks required in the "ex_data" hash table */ |
| 251 | static unsigned long ex_hash_cb(const void *a_void) | 252 | static unsigned long ex_class_item_hash(const EX_CLASS_ITEM *a) |
| 252 | { | 253 | { |
| 253 | return ((const EX_CLASS_ITEM *)a_void)->class_index; | 254 | return a->class_index; |
| 254 | } | 255 | } |
| 255 | static int ex_cmp_cb(const void *a_void, const void *b_void) | 256 | static IMPLEMENT_LHASH_HASH_FN(ex_class_item, EX_CLASS_ITEM) |
| 257 | |||
| 258 | static int ex_class_item_cmp(const EX_CLASS_ITEM *a, const EX_CLASS_ITEM *b) | ||
| 256 | { | 259 | { |
| 257 | return (((const EX_CLASS_ITEM *)a_void)->class_index - | 260 | return a->class_index - b->class_index; |
| 258 | ((const EX_CLASS_ITEM *)b_void)->class_index); | ||
| 259 | } | 261 | } |
| 262 | static IMPLEMENT_LHASH_COMP_FN(ex_class_item, EX_CLASS_ITEM) | ||
| 260 | 263 | ||
| 261 | /* Internal functions used by the "impl_default" implementation to access the | 264 | /* Internal functions used by the "impl_default" implementation to access the |
| 262 | * state */ | 265 | * state */ |
| @@ -265,7 +268,8 @@ static int ex_data_check(void) | |||
| 265 | { | 268 | { |
| 266 | int toret = 1; | 269 | int toret = 1; |
| 267 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); | 270 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); |
| 268 | if(!ex_data && ((ex_data = lh_new(ex_hash_cb, ex_cmp_cb)) == NULL)) | 271 | if(!ex_data |
| 272 | && (ex_data = lh_EX_CLASS_ITEM_new()) == NULL) | ||
| 269 | toret = 0; | 273 | toret = 0; |
| 270 | CRYPTO_w_unlock(CRYPTO_LOCK_EX_DATA); | 274 | CRYPTO_w_unlock(CRYPTO_LOCK_EX_DATA); |
| 271 | return toret; | 275 | return toret; |
| @@ -298,7 +302,7 @@ static EX_CLASS_ITEM *def_get_class(int class_index) | |||
| 298 | EX_DATA_CHECK(return NULL;) | 302 | EX_DATA_CHECK(return NULL;) |
| 299 | d.class_index = class_index; | 303 | d.class_index = class_index; |
| 300 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); | 304 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); |
| 301 | p = lh_retrieve(ex_data, &d); | 305 | p = lh_EX_CLASS_ITEM_retrieve(ex_data, &d); |
| 302 | if(!p) | 306 | if(!p) |
| 303 | { | 307 | { |
| 304 | gen = OPENSSL_malloc(sizeof(EX_CLASS_ITEM)); | 308 | gen = OPENSSL_malloc(sizeof(EX_CLASS_ITEM)); |
| @@ -313,7 +317,7 @@ static EX_CLASS_ITEM *def_get_class(int class_index) | |||
| 313 | { | 317 | { |
| 314 | /* Because we're inside the ex_data lock, the | 318 | /* Because we're inside the ex_data lock, the |
| 315 | * return value from the insert will be NULL */ | 319 | * return value from the insert will be NULL */ |
| 316 | lh_insert(ex_data, gen); | 320 | (void)lh_EX_CLASS_ITEM_insert(ex_data, gen); |
| 317 | p = gen; | 321 | p = gen; |
| 318 | } | 322 | } |
| 319 | } | 323 | } |
| @@ -375,8 +379,8 @@ static int int_new_class(void) | |||
| 375 | static void int_cleanup(void) | 379 | static void int_cleanup(void) |
| 376 | { | 380 | { |
| 377 | EX_DATA_CHECK(return;) | 381 | EX_DATA_CHECK(return;) |
| 378 | lh_doall(ex_data, def_cleanup_cb); | 382 | lh_EX_CLASS_ITEM_doall(ex_data, def_cleanup_cb); |
| 379 | lh_free(ex_data); | 383 | lh_EX_CLASS_ITEM_free(ex_data); |
| 380 | ex_data = NULL; | 384 | ex_data = NULL; |
| 381 | impl = NULL; | 385 | impl = NULL; |
| 382 | } | 386 | } |
| @@ -452,7 +456,7 @@ static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, | |||
| 452 | return 0; | 456 | return 0; |
| 453 | CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); | 457 | CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); |
| 454 | mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); | 458 | mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); |
| 455 | j = sk_num(from->sk); | 459 | j = sk_void_num(from->sk); |
| 456 | if(j < mx) | 460 | if(j < mx) |
| 457 | mx = j; | 461 | mx = j; |
| 458 | if(mx > 0) | 462 | if(mx > 0) |
| @@ -523,7 +527,7 @@ skip: | |||
| 523 | OPENSSL_free(storage); | 527 | OPENSSL_free(storage); |
| 524 | if(ad->sk) | 528 | if(ad->sk) |
| 525 | { | 529 | { |
| 526 | sk_free(ad->sk); | 530 | sk_void_free(ad->sk); |
| 527 | ad->sk=NULL; | 531 | ad->sk=NULL; |
| 528 | } | 532 | } |
| 529 | } | 533 | } |
| @@ -596,24 +600,24 @@ int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val) | |||
| 596 | 600 | ||
| 597 | if (ad->sk == NULL) | 601 | if (ad->sk == NULL) |
| 598 | { | 602 | { |
| 599 | if ((ad->sk=sk_new_null()) == NULL) | 603 | if ((ad->sk=sk_void_new_null()) == NULL) |
| 600 | { | 604 | { |
| 601 | CRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA,ERR_R_MALLOC_FAILURE); | 605 | CRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA,ERR_R_MALLOC_FAILURE); |
| 602 | return(0); | 606 | return(0); |
| 603 | } | 607 | } |
| 604 | } | 608 | } |
| 605 | i=sk_num(ad->sk); | 609 | i=sk_void_num(ad->sk); |
| 606 | 610 | ||
| 607 | while (i <= idx) | 611 | while (i <= idx) |
| 608 | { | 612 | { |
| 609 | if (!sk_push(ad->sk,NULL)) | 613 | if (!sk_void_push(ad->sk,NULL)) |
| 610 | { | 614 | { |
| 611 | CRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA,ERR_R_MALLOC_FAILURE); | 615 | CRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA,ERR_R_MALLOC_FAILURE); |
| 612 | return(0); | 616 | return(0); |
| 613 | } | 617 | } |
| 614 | i++; | 618 | i++; |
| 615 | } | 619 | } |
| 616 | sk_set(ad->sk,idx,val); | 620 | sk_void_set(ad->sk,idx,val); |
| 617 | return(1); | 621 | return(1); |
| 618 | } | 622 | } |
| 619 | 623 | ||
| @@ -623,10 +627,10 @@ void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) | |||
| 623 | { | 627 | { |
| 624 | if (ad->sk == NULL) | 628 | if (ad->sk == NULL) |
| 625 | return(0); | 629 | return(0); |
| 626 | else if (idx >= sk_num(ad->sk)) | 630 | else if (idx >= sk_void_num(ad->sk)) |
| 627 | return(0); | 631 | return(0); |
| 628 | else | 632 | else |
| 629 | return(sk_value(ad->sk,idx)); | 633 | return(sk_void_value(ad->sk,idx)); |
| 630 | } | 634 | } |
| 631 | 635 | ||
| 632 | IMPLEMENT_STACK_OF(CRYPTO_EX_DATA_FUNCS) | 636 | IMPLEMENT_STACK_OF(CRYPTO_EX_DATA_FUNCS) |
diff --git a/src/lib/libcrypto/fips_err.c b/src/lib/libcrypto/fips_err.c deleted file mode 100644 index 09f11748f6..0000000000 --- a/src/lib/libcrypto/fips_err.c +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | #include <openssl/opensslconf.h> | ||
| 2 | |||
| 3 | #ifdef OPENSSL_FIPS | ||
| 4 | # include "fips_err.h" | ||
| 5 | #else | ||
| 6 | static void *dummy=&dummy; | ||
| 7 | #endif | ||
diff --git a/src/lib/libcrypto/fips_err.h b/src/lib/libcrypto/fips_err.h deleted file mode 100644 index b328616858..0000000000 --- a/src/lib/libcrypto/fips_err.h +++ /dev/null | |||
| @@ -1,137 +0,0 @@ | |||
| 1 | /* crypto/fips_err.h */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1999-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 | /* 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/fips.h> | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | |||
| 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_FIPS,func,0) | ||
| 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_FIPS,0,reason) | ||
| 70 | |||
| 71 | static ERR_STRING_DATA FIPS_str_functs[]= | ||
| 72 | { | ||
| 73 | {ERR_FUNC(FIPS_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"}, | ||
| 74 | {ERR_FUNC(FIPS_F_DSA_BUILTIN_PARAMGEN), "DSA_BUILTIN_PARAMGEN"}, | ||
| 75 | {ERR_FUNC(FIPS_F_DSA_DO_SIGN), "DSA_do_sign"}, | ||
| 76 | {ERR_FUNC(FIPS_F_DSA_DO_VERIFY), "DSA_do_verify"}, | ||
| 77 | {ERR_FUNC(FIPS_F_EVP_CIPHERINIT_EX), "EVP_CipherInit_ex"}, | ||
| 78 | {ERR_FUNC(FIPS_F_EVP_DIGESTINIT_EX), "EVP_DigestInit_ex"}, | ||
| 79 | {ERR_FUNC(FIPS_F_FIPS_CHECK_DSA), "FIPS_CHECK_DSA"}, | ||
| 80 | {ERR_FUNC(FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT), "FIPS_CHECK_INCORE_FINGERPRINT"}, | ||
| 81 | {ERR_FUNC(FIPS_F_FIPS_CHECK_RSA), "FIPS_CHECK_RSA"}, | ||
| 82 | {ERR_FUNC(FIPS_F_FIPS_DSA_CHECK), "FIPS_DSA_CHECK"}, | ||
| 83 | {ERR_FUNC(FIPS_F_FIPS_MODE_SET), "FIPS_mode_set"}, | ||
| 84 | {ERR_FUNC(FIPS_F_FIPS_PKEY_SIGNATURE_TEST), "fips_pkey_signature_test"}, | ||
| 85 | {ERR_FUNC(FIPS_F_FIPS_SELFTEST_AES), "FIPS_selftest_aes"}, | ||
| 86 | {ERR_FUNC(FIPS_F_FIPS_SELFTEST_DES), "FIPS_selftest_des"}, | ||
| 87 | {ERR_FUNC(FIPS_F_FIPS_SELFTEST_DSA), "FIPS_selftest_dsa"}, | ||
| 88 | {ERR_FUNC(FIPS_F_FIPS_SELFTEST_HMAC), "FIPS_selftest_hmac"}, | ||
| 89 | {ERR_FUNC(FIPS_F_FIPS_SELFTEST_RNG), "FIPS_selftest_rng"}, | ||
| 90 | {ERR_FUNC(FIPS_F_FIPS_SELFTEST_SHA1), "FIPS_selftest_sha1"}, | ||
| 91 | {ERR_FUNC(FIPS_F_HASH_FINAL), "HASH_FINAL"}, | ||
| 92 | {ERR_FUNC(FIPS_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"}, | ||
| 93 | {ERR_FUNC(FIPS_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"}, | ||
| 94 | {ERR_FUNC(FIPS_F_RSA_EAY_PRIVATE_ENCRYPT), "RSA_EAY_PRIVATE_ENCRYPT"}, | ||
| 95 | {ERR_FUNC(FIPS_F_RSA_EAY_PUBLIC_DECRYPT), "RSA_EAY_PUBLIC_DECRYPT"}, | ||
| 96 | {ERR_FUNC(FIPS_F_RSA_EAY_PUBLIC_ENCRYPT), "RSA_EAY_PUBLIC_ENCRYPT"}, | ||
| 97 | {ERR_FUNC(FIPS_F_RSA_X931_GENERATE_KEY_EX), "RSA_X931_generate_key_ex"}, | ||
| 98 | {ERR_FUNC(FIPS_F_SSLEAY_RAND_BYTES), "SSLEAY_RAND_BYTES"}, | ||
| 99 | {0,NULL} | ||
| 100 | }; | ||
| 101 | |||
| 102 | static ERR_STRING_DATA FIPS_str_reasons[]= | ||
| 103 | { | ||
| 104 | {ERR_REASON(FIPS_R_CANNOT_READ_EXE) ,"cannot read exe"}, | ||
| 105 | {ERR_REASON(FIPS_R_CANNOT_READ_EXE_DIGEST),"cannot read exe digest"}, | ||
| 106 | {ERR_REASON(FIPS_R_CONTRADICTING_EVIDENCE),"contradicting evidence"}, | ||
| 107 | {ERR_REASON(FIPS_R_EXE_DIGEST_DOES_NOT_MATCH),"exe digest does not match"}, | ||
| 108 | {ERR_REASON(FIPS_R_FINGERPRINT_DOES_NOT_MATCH),"fingerprint does not match"}, | ||
| 109 | {ERR_REASON(FIPS_R_FINGERPRINT_DOES_NOT_MATCH_NONPIC_RELOCATED),"fingerprint does not match nonpic relocated"}, | ||
| 110 | {ERR_REASON(FIPS_R_FINGERPRINT_DOES_NOT_MATCH_SEGMENT_ALIASING),"fingerprint does not match segment aliasing"}, | ||
| 111 | {ERR_REASON(FIPS_R_FIPS_MODE_ALREADY_SET),"fips mode already set"}, | ||
| 112 | {ERR_REASON(FIPS_R_FIPS_SELFTEST_FAILED) ,"fips selftest failed"}, | ||
| 113 | {ERR_REASON(FIPS_R_INVALID_KEY_LENGTH) ,"invalid key length"}, | ||
| 114 | {ERR_REASON(FIPS_R_KEY_TOO_SHORT) ,"key too short"}, | ||
| 115 | {ERR_REASON(FIPS_R_NON_FIPS_METHOD) ,"non fips method"}, | ||
| 116 | {ERR_REASON(FIPS_R_PAIRWISE_TEST_FAILED) ,"pairwise test failed"}, | ||
| 117 | {ERR_REASON(FIPS_R_RSA_DECRYPT_ERROR) ,"rsa decrypt error"}, | ||
| 118 | {ERR_REASON(FIPS_R_RSA_ENCRYPT_ERROR) ,"rsa encrypt error"}, | ||
| 119 | {ERR_REASON(FIPS_R_SELFTEST_FAILED) ,"selftest failed"}, | ||
| 120 | {ERR_REASON(FIPS_R_TEST_FAILURE) ,"test failure"}, | ||
| 121 | {ERR_REASON(FIPS_R_UNSUPPORTED_PLATFORM) ,"unsupported platform"}, | ||
| 122 | {0,NULL} | ||
| 123 | }; | ||
| 124 | |||
| 125 | #endif | ||
| 126 | |||
| 127 | void ERR_load_FIPS_strings(void) | ||
| 128 | { | ||
| 129 | #ifndef OPENSSL_NO_ERR | ||
| 130 | |||
| 131 | if (ERR_func_error_string(FIPS_str_functs[0].error) == NULL) | ||
| 132 | { | ||
| 133 | ERR_load_strings(0,FIPS_str_functs); | ||
| 134 | ERR_load_strings(0,FIPS_str_reasons); | ||
| 135 | } | ||
| 136 | #endif | ||
| 137 | } | ||
diff --git a/src/lib/libcrypto/hmac/Makefile.ssl b/src/lib/libcrypto/hmac/Makefile.ssl deleted file mode 100644 index f1c07322c4..0000000000 --- a/src/lib/libcrypto/hmac/Makefile.ssl +++ /dev/null | |||
| @@ -1,101 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/md/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= hmac | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST=hmactest.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=hmac.c | ||
| 27 | LIBOBJ=hmac.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= hmac.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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | hmac.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 83 | hmac.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 84 | hmac.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 85 | hmac.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 86 | hmac.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 87 | hmac.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 88 | hmac.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 89 | hmac.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h | ||
| 90 | hmac.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 91 | hmac.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 92 | hmac.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 93 | hmac.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 94 | hmac.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 95 | hmac.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 96 | hmac.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 97 | hmac.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 98 | hmac.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 99 | hmac.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 100 | hmac.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 101 | hmac.o: ../cryptlib.h hmac.c | ||
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index cbc1c76a57..45015fe754 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
| @@ -61,9 +61,7 @@ | |||
| 61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 62 | #include <openssl/hmac.h> | 62 | #include <openssl/hmac.h> |
| 63 | 63 | ||
| 64 | #ifndef OPENSSL_FIPS | 64 | int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, |
| 65 | |||
| 66 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | ||
| 67 | const EVP_MD *md, ENGINE *impl) | 65 | const EVP_MD *md, ENGINE *impl) |
| 68 | { | 66 | { |
| 69 | int i,j,reset=0; | 67 | int i,j,reset=0; |
| @@ -84,10 +82,13 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
| 84 | OPENSSL_assert(j <= (int)sizeof(ctx->key)); | 82 | OPENSSL_assert(j <= (int)sizeof(ctx->key)); |
| 85 | if (j < len) | 83 | if (j < len) |
| 86 | { | 84 | { |
| 87 | EVP_DigestInit_ex(&ctx->md_ctx,md, impl); | 85 | if (!EVP_DigestInit_ex(&ctx->md_ctx,md, impl)) |
| 88 | EVP_DigestUpdate(&ctx->md_ctx,key,len); | 86 | goto err; |
| 89 | EVP_DigestFinal_ex(&(ctx->md_ctx),ctx->key, | 87 | if (!EVP_DigestUpdate(&ctx->md_ctx,key,len)) |
| 90 | &ctx->key_length); | 88 | goto err; |
| 89 | if (!EVP_DigestFinal_ex(&(ctx->md_ctx),ctx->key, | ||
| 90 | &ctx->key_length)) | ||
| 91 | goto err; | ||
| 91 | } | 92 | } |
| 92 | else | 93 | else |
| 93 | { | 94 | { |
| @@ -104,31 +105,38 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
| 104 | { | 105 | { |
| 105 | for (i=0; i<HMAC_MAX_MD_CBLOCK; i++) | 106 | for (i=0; i<HMAC_MAX_MD_CBLOCK; i++) |
| 106 | pad[i]=0x36^ctx->key[i]; | 107 | pad[i]=0x36^ctx->key[i]; |
| 107 | EVP_DigestInit_ex(&ctx->i_ctx,md, impl); | 108 | if (!EVP_DigestInit_ex(&ctx->i_ctx,md, impl)) |
| 108 | EVP_DigestUpdate(&ctx->i_ctx,pad,EVP_MD_block_size(md)); | 109 | goto err; |
| 110 | if (!EVP_DigestUpdate(&ctx->i_ctx,pad,EVP_MD_block_size(md))) | ||
| 111 | goto err; | ||
| 109 | 112 | ||
| 110 | for (i=0; i<HMAC_MAX_MD_CBLOCK; i++) | 113 | for (i=0; i<HMAC_MAX_MD_CBLOCK; i++) |
| 111 | pad[i]=0x5c^ctx->key[i]; | 114 | pad[i]=0x5c^ctx->key[i]; |
| 112 | EVP_DigestInit_ex(&ctx->o_ctx,md, impl); | 115 | if (!EVP_DigestInit_ex(&ctx->o_ctx,md, impl)) |
| 113 | EVP_DigestUpdate(&ctx->o_ctx,pad,EVP_MD_block_size(md)); | 116 | goto err; |
| 117 | if (!EVP_DigestUpdate(&ctx->o_ctx,pad,EVP_MD_block_size(md))) | ||
| 118 | goto err; | ||
| 114 | } | 119 | } |
| 115 | EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->i_ctx); | 120 | if (!EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->i_ctx)) |
| 121 | goto err; | ||
| 122 | return 1; | ||
| 123 | err: | ||
| 124 | return 0; | ||
| 116 | } | 125 | } |
| 117 | 126 | ||
| 118 | void HMAC_Init(HMAC_CTX *ctx, const void *key, int len, | 127 | int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md) |
| 119 | const EVP_MD *md) | ||
| 120 | { | 128 | { |
| 121 | if(key && md) | 129 | if(key && md) |
| 122 | HMAC_CTX_init(ctx); | 130 | HMAC_CTX_init(ctx); |
| 123 | HMAC_Init_ex(ctx,key,len,md, NULL); | 131 | return HMAC_Init_ex(ctx,key,len,md, NULL); |
| 124 | } | 132 | } |
| 125 | 133 | ||
| 126 | void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) | 134 | int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) |
| 127 | { | 135 | { |
| 128 | EVP_DigestUpdate(&ctx->md_ctx,data,len); | 136 | return EVP_DigestUpdate(&ctx->md_ctx,data,len); |
| 129 | } | 137 | } |
| 130 | 138 | ||
| 131 | void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) | 139 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) |
| 132 | { | 140 | { |
| 133 | int j; | 141 | int j; |
| 134 | unsigned int i; | 142 | unsigned int i; |
| @@ -136,10 +144,17 @@ void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) | |||
| 136 | 144 | ||
| 137 | j=EVP_MD_block_size(ctx->md); | 145 | j=EVP_MD_block_size(ctx->md); |
| 138 | 146 | ||
| 139 | EVP_DigestFinal_ex(&ctx->md_ctx,buf,&i); | 147 | if (!EVP_DigestFinal_ex(&ctx->md_ctx,buf,&i)) |
| 140 | EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->o_ctx); | 148 | goto err; |
| 141 | EVP_DigestUpdate(&ctx->md_ctx,buf,i); | 149 | if (!EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->o_ctx)) |
| 142 | EVP_DigestFinal_ex(&ctx->md_ctx,md,len); | 150 | goto err; |
| 151 | if (!EVP_DigestUpdate(&ctx->md_ctx,buf,i)) | ||
| 152 | goto err; | ||
| 153 | if (!EVP_DigestFinal_ex(&ctx->md_ctx,md,len)) | ||
| 154 | goto err; | ||
| 155 | return 1; | ||
| 156 | err: | ||
| 157 | return 0; | ||
| 143 | } | 158 | } |
| 144 | 159 | ||
| 145 | void HMAC_CTX_init(HMAC_CTX *ctx) | 160 | void HMAC_CTX_init(HMAC_CTX *ctx) |
| @@ -149,6 +164,22 @@ void HMAC_CTX_init(HMAC_CTX *ctx) | |||
| 149 | EVP_MD_CTX_init(&ctx->md_ctx); | 164 | EVP_MD_CTX_init(&ctx->md_ctx); |
| 150 | } | 165 | } |
| 151 | 166 | ||
| 167 | int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx) | ||
| 168 | { | ||
| 169 | if (!EVP_MD_CTX_copy(&dctx->i_ctx, &sctx->i_ctx)) | ||
| 170 | goto err; | ||
| 171 | if (!EVP_MD_CTX_copy(&dctx->o_ctx, &sctx->o_ctx)) | ||
| 172 | goto err; | ||
| 173 | if (!EVP_MD_CTX_copy(&dctx->md_ctx, &sctx->md_ctx)) | ||
| 174 | goto err; | ||
| 175 | memcpy(dctx->key, sctx->key, HMAC_MAX_MD_CBLOCK); | ||
| 176 | dctx->key_length = sctx->key_length; | ||
| 177 | dctx->md = sctx->md; | ||
| 178 | return 1; | ||
| 179 | err: | ||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | |||
| 152 | void HMAC_CTX_cleanup(HMAC_CTX *ctx) | 183 | void HMAC_CTX_cleanup(HMAC_CTX *ctx) |
| 153 | { | 184 | { |
| 154 | EVP_MD_CTX_cleanup(&ctx->i_ctx); | 185 | EVP_MD_CTX_cleanup(&ctx->i_ctx); |
| @@ -166,11 +197,16 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | |||
| 166 | 197 | ||
| 167 | if (md == NULL) md=m; | 198 | if (md == NULL) md=m; |
| 168 | HMAC_CTX_init(&c); | 199 | HMAC_CTX_init(&c); |
| 169 | HMAC_Init(&c,key,key_len,evp_md); | 200 | if (!HMAC_Init(&c,key,key_len,evp_md)) |
| 170 | HMAC_Update(&c,d,n); | 201 | goto err; |
| 171 | HMAC_Final(&c,md,md_len); | 202 | if (!HMAC_Update(&c,d,n)) |
| 203 | goto err; | ||
| 204 | if (!HMAC_Final(&c,md,md_len)) | ||
| 205 | goto err; | ||
| 172 | HMAC_CTX_cleanup(&c); | 206 | HMAC_CTX_cleanup(&c); |
| 173 | return(md); | 207 | return md; |
| 208 | err: | ||
| 209 | return NULL; | ||
| 174 | } | 210 | } |
| 175 | 211 | ||
| 176 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags) | 212 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags) |
| @@ -179,5 +215,3 @@ void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags) | |||
| 179 | EVP_MD_CTX_set_flags(&ctx->o_ctx, flags); | 215 | EVP_MD_CTX_set_flags(&ctx->o_ctx, flags); |
| 180 | EVP_MD_CTX_set_flags(&ctx->md_ctx, flags); | 216 | EVP_MD_CTX_set_flags(&ctx->md_ctx, flags); |
| 181 | } | 217 | } |
| 182 | |||
| 183 | #endif | ||
diff --git a/src/lib/libcrypto/hmac/hmac.h b/src/lib/libcrypto/hmac/hmac.h index fc38ffb52b..1be0022190 100644 --- a/src/lib/libcrypto/hmac/hmac.h +++ b/src/lib/libcrypto/hmac/hmac.h | |||
| @@ -90,15 +90,16 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx); | |||
| 90 | 90 | ||
| 91 | #define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ | 91 | #define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ |
| 92 | 92 | ||
| 93 | void HMAC_Init(HMAC_CTX *ctx, const void *key, int len, | 93 | int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, |
| 94 | const EVP_MD *md); /* deprecated */ | 94 | const EVP_MD *md); /* deprecated */ |
| 95 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | 95 | int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, |
| 96 | const EVP_MD *md, ENGINE *impl); | 96 | const EVP_MD *md, ENGINE *impl); |
| 97 | void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); | 97 | int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); |
| 98 | void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); | 98 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); |
| 99 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | 99 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, |
| 100 | const unsigned char *d, size_t n, unsigned char *md, | 100 | const unsigned char *d, size_t n, unsigned char *md, |
| 101 | unsigned int *md_len); | 101 | unsigned int *md_len); |
| 102 | int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); | ||
| 102 | 103 | ||
| 103 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); | 104 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); |
| 104 | 105 | ||
diff --git a/src/lib/libcrypto/idea/Makefile.ssl b/src/lib/libcrypto/idea/Makefile.ssl deleted file mode 100644 index fa016ea399..0000000000 --- a/src/lib/libcrypto/idea/Makefile.ssl +++ /dev/null | |||
| @@ -1,91 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/idea/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= idea | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST=ideatest.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c | ||
| 27 | LIBOBJ=i_cbc.o i_cfb64.o i_ofb64.o i_ecb.o i_skey.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= idea.h | ||
| 32 | HEADER= idea_lcl.h $(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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | i_cbc.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h | ||
| 83 | i_cbc.o: i_cbc.c idea_lcl.h | ||
| 84 | i_cfb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h | ||
| 85 | i_cfb64.o: i_cfb64.c idea_lcl.h | ||
| 86 | i_ecb.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h | ||
| 87 | i_ecb.o: ../../include/openssl/opensslv.h i_ecb.c idea_lcl.h | ||
| 88 | i_ofb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h | ||
| 89 | i_ofb64.o: i_ofb64.c idea_lcl.h | ||
| 90 | i_skey.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h | ||
| 91 | i_skey.o: i_skey.c idea_lcl.h | ||
diff --git a/src/lib/libcrypto/idea/idea.h b/src/lib/libcrypto/idea/idea.h index a137d4cbce..5782e54b0f 100644 --- a/src/lib/libcrypto/idea/idea.h +++ b/src/lib/libcrypto/idea/idea.h | |||
| @@ -83,11 +83,8 @@ typedef struct idea_key_st | |||
| 83 | const char *idea_options(void); | 83 | const char *idea_options(void); |
| 84 | void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, | 84 | void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, |
| 85 | IDEA_KEY_SCHEDULE *ks); | 85 | IDEA_KEY_SCHEDULE *ks); |
| 86 | #ifdef OPENSSL_FIPS | ||
| 87 | void private_idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); | ||
| 88 | #endif | ||
| 89 | void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); | 86 | void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); |
| 90 | void idea_set_decrypt_key(const IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); | 87 | void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); |
| 91 | void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, | 88 | void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, |
| 92 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc); | 89 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc); |
| 93 | void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out, | 90 | void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out, |
diff --git a/src/lib/libcrypto/install.com b/src/lib/libcrypto/install.com index ffad1f97a7..ad3e4d48c7 100644 --- a/src/lib/libcrypto/install.com +++ b/src/lib/libcrypto/install.com | |||
| @@ -3,15 +3,26 @@ $! | |||
| 3 | $! Author: Richard Levitte <richard@levitte.org> | 3 | $! Author: Richard Levitte <richard@levitte.org> |
| 4 | $! Time of creation: 22-MAY-1998 10:13 | 4 | $! Time of creation: 22-MAY-1998 10:13 |
| 5 | $! | 5 | $! |
| 6 | $! Changes by Zoltan Arpadffy <zoli@polarhome.com> | ||
| 7 | $! | ||
| 6 | $! P1 root of the directory tree | 8 | $! P1 root of the directory tree |
| 7 | $! | 9 | $! |
| 8 | $ IF P1 .EQS. "" | 10 | $ IF P1 .EQS. "" |
| 9 | $ THEN | 11 | $ THEN |
| 10 | $ WRITE SYS$OUTPUT "First argument missing." | 12 | $ WRITE SYS$OUTPUT "First argument missing." |
| 11 | $ WRITE SYS$OUTPUT "Should be the directory where you want things installed." | 13 | $ WRITE SYS$OUTPUT - |
| 14 | "It should be the directory where you want things installed." | ||
| 12 | $ EXIT | 15 | $ EXIT |
| 13 | $ ENDIF | 16 | $ ENDIF |
| 14 | $ | 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 | $ | ||
| 15 | $ ROOT = F$PARSE(P1,"[]A.;0",,,"SYNTAX_ONLY,NO_CONCEAL") - "A.;0" | 26 | $ ROOT = F$PARSE(P1,"[]A.;0",,,"SYNTAX_ONLY,NO_CONCEAL") - "A.;0" |
| 16 | $ ROOT_DEV = F$PARSE(ROOT,,,"DEVICE","SYNTAX_ONLY") | 27 | $ ROOT_DEV = F$PARSE(ROOT,,,"DEVICE","SYNTAX_ONLY") |
| 17 | $ ROOT_DIR = F$PARSE(ROOT,,,"DIRECTORY","SYNTAX_ONLY") - | 28 | $ ROOT_DIR = F$PARSE(ROOT,,,"DIRECTORY","SYNTAX_ONLY") - |
| @@ -19,30 +30,28 @@ $ ROOT_DIR = F$PARSE(ROOT,,,"DIRECTORY","SYNTAX_ONLY") - | |||
| 19 | $ ROOT = ROOT_DEV + "[" + ROOT_DIR | 30 | $ ROOT = ROOT_DEV + "[" + ROOT_DIR |
| 20 | $ | 31 | $ |
| 21 | $ DEFINE/NOLOG WRK_SSLROOT 'ROOT'.] /TRANS=CONC | 32 | $ DEFINE/NOLOG WRK_SSLROOT 'ROOT'.] /TRANS=CONC |
| 22 | $ DEFINE/NOLOG WRK_SSLVLIB WRK_SSLROOT:[VAX_LIB] | 33 | $ DEFINE/NOLOG WRK_SSLLIB WRK_SSLROOT:['ARCH'_LIB] |
| 23 | $ DEFINE/NOLOG WRK_SSLALIB WRK_SSLROOT:[ALPHA_LIB] | ||
| 24 | $ DEFINE/NOLOG WRK_SSLINCLUDE WRK_SSLROOT:[INCLUDE] | 34 | $ DEFINE/NOLOG WRK_SSLINCLUDE WRK_SSLROOT:[INCLUDE] |
| 25 | $ | 35 | $ |
| 26 | $ IF F$PARSE("WRK_SSLROOT:[000000]") .EQS. "" THEN - | 36 | $ IF F$PARSE("WRK_SSLROOT:[000000]") .EQS. "" THEN - |
| 27 | CREATE/DIR/LOG WRK_SSLROOT:[000000] | 37 | CREATE/DIR/LOG WRK_SSLROOT:[000000] |
| 28 | $ IF F$PARSE("WRK_SSLVLIB:") .EQS. "" THEN - | 38 | $ IF F$PARSE("WRK_SSLLIB:") .EQS. "" THEN - |
| 29 | CREATE/DIR/LOG WRK_SSLVLIB: | 39 | CREATE/DIR/LOG WRK_SSLLIB: |
| 30 | $ IF F$PARSE("WRK_SSLALIB:") .EQS. "" THEN - | ||
| 31 | CREATE/DIR/LOG WRK_SSLALIB: | ||
| 32 | $ IF F$PARSE("WRK_SSLINCLUDE:") .EQS. "" THEN - | 40 | $ IF F$PARSE("WRK_SSLINCLUDE:") .EQS. "" THEN - |
| 33 | CREATE/DIR/LOG WRK_SSLINCLUDE: | 41 | CREATE/DIR/LOG WRK_SSLINCLUDE: |
| 34 | $ | 42 | $ |
| 35 | $ SDIRS := ,- | 43 | $ SDIRS := ,- |
| 44 | _'ARCH',- | ||
| 36 | OBJECTS,- | 45 | OBJECTS,- |
| 37 | MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,- | 46 | MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,WHRLPOOL,- |
| 38 | DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,- | 47 | DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,- |
| 39 | BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,- | 48 | BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,- |
| 40 | BUFFER,BIO,STACK,LHASH,RAND,ERR,- | 49 | BUFFER,BIO,STACK,LHASH,RAND,ERR,- |
| 41 | EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,- | 50 | EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,- |
| 42 | UI,KRB5,- | 51 | UI,KRB5,- |
| 43 | STORE,PQUEUE,JPAKE | 52 | STORE,CMS,PQUEUE,TS,JPAKE |
| 44 | $ EXHEADER_ := crypto.h,tmdiff.h,opensslv.h,opensslconf.h,ebcdic.h,- | 53 | $ EXHEADER_ := crypto.h,opensslv.h,ebcdic.h,symhacks.h,ossl_typ.h |
| 45 | symhacks.h,ossl_typ.h | 54 | $ EXHEADER__'ARCH' := opensslconf.h |
| 46 | $ EXHEADER_OBJECTS := objects.h,obj_mac.h | 55 | $ EXHEADER_OBJECTS := objects.h,obj_mac.h |
| 47 | $ EXHEADER_MD2 := md2.h | 56 | $ EXHEADER_MD2 := md2.h |
| 48 | $ EXHEADER_MD4 := md4.h | 57 | $ EXHEADER_MD4 := md4.h |
| @@ -51,6 +60,7 @@ $ EXHEADER_SHA := sha.h | |||
| 51 | $ EXHEADER_MDC2 := mdc2.h | 60 | $ EXHEADER_MDC2 := mdc2.h |
| 52 | $ EXHEADER_HMAC := hmac.h | 61 | $ EXHEADER_HMAC := hmac.h |
| 53 | $ EXHEADER_RIPEMD := ripemd.h | 62 | $ EXHEADER_RIPEMD := ripemd.h |
| 63 | $ EXHEADER_WHRLPOOL := whrlpool.h | ||
| 54 | $ EXHEADER_DES := des.h,des_old.h | 64 | $ EXHEADER_DES := des.h,des_old.h |
| 55 | $ EXHEADER_AES := aes.h | 65 | $ EXHEADER_AES := aes.h |
| 56 | $ EXHEADER_RC2 := rc2.h | 66 | $ EXHEADER_RC2 := rc2.h |
| @@ -61,6 +71,7 @@ $ EXHEADER_BF := blowfish.h | |||
| 61 | $ EXHEADER_CAST := cast.h | 71 | $ EXHEADER_CAST := cast.h |
| 62 | $ EXHEADER_CAMELLIA := camellia.h | 72 | $ EXHEADER_CAMELLIA := camellia.h |
| 63 | $ EXHEADER_SEED := seed.h | 73 | $ EXHEADER_SEED := seed.h |
| 74 | $ EXHEADER_MODES := modes.h | ||
| 64 | $ EXHEADER_BN := bn.h | 75 | $ EXHEADER_BN := bn.h |
| 65 | $ EXHEADER_EC := ec.h | 76 | $ EXHEADER_EC := ec.h |
| 66 | $ EXHEADER_RSA := rsa.h | 77 | $ EXHEADER_RSA := rsa.h |
| @@ -91,12 +102,13 @@ $ EXHEADER_UI := ui.h,ui_compat.h | |||
| 91 | $ EXHEADER_KRB5 := krb5_asn.h | 102 | $ EXHEADER_KRB5 := krb5_asn.h |
| 92 | $! EXHEADER_STORE := store.h,str_compat.h | 103 | $! EXHEADER_STORE := store.h,str_compat.h |
| 93 | $ EXHEADER_STORE := store.h | 104 | $ EXHEADER_STORE := store.h |
| 94 | $ EXHEADER_PQUEUE := pqueue.h,pq_compat.h | 105 | $ EXHEADER_CMS := cms.h |
| 106 | $ EXHEADER_PQUEUE := pqueue.h | ||
| 107 | $ EXHEADER_TS := ts.h | ||
| 95 | $ EXHEADER_JPAKE := jpake.h | 108 | $ EXHEADER_JPAKE := jpake.h |
| 96 | $ LIBS := LIBCRYPTO | 109 | $ LIBS := LIBCRYPTO |
| 97 | $ | 110 | $ |
| 98 | $ VEXE_DIR := [-.VAX.EXE.CRYPTO] | 111 | $ EXE_DIR := [-.'ARCH'.EXE.CRYPTO] |
| 99 | $ AEXE_DIR := [-.AXP.EXE.CRYPTO] | ||
| 100 | $ | 112 | $ |
| 101 | $ I = 0 | 113 | $ I = 0 |
| 102 | $ LOOP_SDIRS: | 114 | $ LOOP_SDIRS: |
| @@ -108,7 +120,12 @@ $ IF D .EQS. "" | |||
| 108 | $ THEN | 120 | $ THEN |
| 109 | $ COPY 'tmp' WRK_SSLINCLUDE: /LOG | 121 | $ COPY 'tmp' WRK_SSLINCLUDE: /LOG |
| 110 | $ ELSE | 122 | $ ELSE |
| 111 | $ COPY [.'D']'tmp' WRK_SSLINCLUDE: /LOG | 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 | ||
| 112 | $ ENDIF | 129 | $ ENDIF |
| 113 | $ SET FILE/PROT=WORLD:RE WRK_SSLINCLUDE:'tmp' | 130 | $ SET FILE/PROT=WORLD:RE WRK_SSLINCLUDE:'tmp' |
| 114 | $ GOTO LOOP_SDIRS | 131 | $ GOTO LOOP_SDIRS |
| @@ -120,27 +137,16 @@ $ E = F$EDIT(F$ELEMENT(I, ",", LIBS),"TRIM") | |||
| 120 | $ I = I + 1 | 137 | $ I = I + 1 |
| 121 | $ IF E .EQS. "," THEN GOTO LOOP_LIB_END | 138 | $ IF E .EQS. "," THEN GOTO LOOP_LIB_END |
| 122 | $ SET NOON | 139 | $ SET NOON |
| 123 | $ IF F$SEARCH(VEXE_DIR+E+".OLB") .NES. "" | 140 | $ IF F$SEARCH(EXE_DIR+E+".OLB") .NES. "" |
| 124 | $ THEN | ||
| 125 | $ COPY 'VEXE_DIR''E'.OLB WRK_SSLVLIB:'E'.OLB/log | ||
| 126 | $ SET FILE/PROT=W:RE WRK_SSLVLIB:'E'.OLB | ||
| 127 | $ ENDIF | ||
| 128 | $ ! Preparing for the time when we have shareable images | ||
| 129 | $ IF F$SEARCH(VEXE_DIR+E+".EXE") .NES. "" | ||
| 130 | $ THEN | ||
| 131 | $ COPY 'VEXE_DIR''E'.EXE WRK_SSLVLIB:'E'.EXE/log | ||
| 132 | $ SET FILE/PROT=W:RE WRK_SSLVLIB:'E'.EXE | ||
| 133 | $ ENDIF | ||
| 134 | $ IF F$SEARCH(AEXE_DIR+E+".OLB") .NES. "" | ||
| 135 | $ THEN | 141 | $ THEN |
| 136 | $ COPY 'AEXE_DIR''E'.OLB WRK_SSLALIB:'E'.OLB/log | 142 | $ COPY 'EXE_DIR''E'.OLB WRK_SSLLIB:'E'.OLB/log |
| 137 | $ SET FILE/PROT=W:RE WRK_SSLALIB:'E'.OLB | 143 | $ SET FILE/PROT=W:RE WRK_SSLLIB:'E'.OLB |
| 138 | $ ENDIF | 144 | $ ENDIF |
| 139 | $ ! Preparing for the time when we have shareable images | 145 | $ ! Preparing for the time when we have shareable images |
| 140 | $ IF F$SEARCH(AEXE_DIR+E+".EXE") .NES. "" | 146 | $ IF F$SEARCH(EXE_DIR+E+".EXE") .NES. "" |
| 141 | $ THEN | 147 | $ THEN |
| 142 | $ COPY 'AEXE_DIR''E'.EXE WRK_SSLALIB:'E'.EXE/log | 148 | $ COPY 'EXE_DIR''E'.EXE WRK_SSLLIB:'E'.EXE/log |
| 143 | $ SET FILE/PROT=W:RE WRK_SSLALIB:'E'.EXE | 149 | $ SET FILE/PROT=W:RE WRK_SSLLIB:'E'.EXE |
| 144 | $ ENDIF | 150 | $ ENDIF |
| 145 | $ SET ON | 151 | $ SET ON |
| 146 | $ GOTO LOOP_LIB | 152 | $ GOTO LOOP_LIB |
diff --git a/src/lib/libcrypto/krb5/Makefile.ssl b/src/lib/libcrypto/krb5/Makefile.ssl deleted file mode 100644 index d9224c0f09..0000000000 --- a/src/lib/libcrypto/krb5/Makefile.ssl +++ /dev/null | |||
| @@ -1,90 +0,0 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/krb5/Makefile.ssl | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= krb5 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile README | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= krb5_asn.c | ||
| 27 | |||
| 28 | LIBOBJ= krb5_asn.o | ||
| 29 | |||
| 30 | SRC= $(LIBSRC) | ||
| 31 | |||
| 32 | EXHEADER= krb5_asn.h | ||
| 33 | HEADER= $(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 | files: | ||
| 48 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 49 | |||
| 50 | links: | ||
| 51 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 58 | do \ | ||
| 59 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 60 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 61 | done; | ||
| 62 | |||
| 63 | tags: | ||
| 64 | ctags $(SRC) | ||
| 65 | |||
| 66 | tests: | ||
| 67 | |||
| 68 | lint: | ||
| 69 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 70 | |||
| 71 | depend: | ||
| 72 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 | krb5_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 84 | krb5_asn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 85 | krb5_asn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 86 | krb5_asn.o: ../../include/openssl/krb5_asn.h | ||
| 87 | krb5_asn.o: ../../include/openssl/opensslconf.h | ||
| 88 | krb5_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 89 | krb5_asn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 90 | krb5_asn.o: ../../include/openssl/symhacks.h krb5_asn.c | ||
diff --git a/src/lib/libcrypto/lhash/Makefile.ssl b/src/lib/libcrypto/lhash/Makefile.ssl deleted file mode 100644 index 60e7ee3393..0000000000 --- a/src/lib/libcrypto/lhash/Makefile.ssl +++ /dev/null | |||
| @@ -1,93 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/lhash/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= lhash | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=lhash.c lh_stats.c | ||
| 27 | LIBOBJ=lhash.o lh_stats.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= lhash.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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | lh_stats.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 83 | lh_stats.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 84 | lh_stats.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 85 | lh_stats.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 86 | lh_stats.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 87 | lh_stats.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 88 | lh_stats.o: ../cryptlib.h lh_stats.c | ||
| 89 | lhash.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 90 | lhash.o: ../../include/openssl/e_os2.h ../../include/openssl/lhash.h | ||
| 91 | lhash.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 92 | lhash.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 93 | lhash.o: ../../include/openssl/symhacks.h lhash.c | ||
diff --git a/src/lib/libcrypto/lhash/lh_stats.c b/src/lib/libcrypto/lhash/lh_stats.c index 5aa7766aa6..815615e338 100644 --- a/src/lib/libcrypto/lhash/lh_stats.c +++ b/src/lib/libcrypto/lhash/lh_stats.c | |||
| @@ -139,7 +139,7 @@ void lh_node_usage_stats(LHASH *lh, FILE *out) | |||
| 139 | #else | 139 | #else |
| 140 | 140 | ||
| 141 | #ifndef OPENSSL_NO_FP_API | 141 | #ifndef OPENSSL_NO_FP_API |
| 142 | void lh_stats(const LHASH *lh, FILE *fp) | 142 | void lh_stats(const _LHASH *lh, FILE *fp) |
| 143 | { | 143 | { |
| 144 | BIO *bp; | 144 | BIO *bp; |
| 145 | 145 | ||
| @@ -151,7 +151,7 @@ void lh_stats(const LHASH *lh, FILE *fp) | |||
| 151 | end:; | 151 | end:; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | void lh_node_stats(const LHASH *lh, FILE *fp) | 154 | void lh_node_stats(const _LHASH *lh, FILE *fp) |
| 155 | { | 155 | { |
| 156 | BIO *bp; | 156 | BIO *bp; |
| 157 | 157 | ||
| @@ -163,7 +163,7 @@ void lh_node_stats(const LHASH *lh, FILE *fp) | |||
| 163 | end:; | 163 | end:; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | void lh_node_usage_stats(const LHASH *lh, FILE *fp) | 166 | void lh_node_usage_stats(const _LHASH *lh, FILE *fp) |
| 167 | { | 167 | { |
| 168 | BIO *bp; | 168 | BIO *bp; |
| 169 | 169 | ||
| @@ -177,7 +177,7 @@ end:; | |||
| 177 | 177 | ||
| 178 | #endif | 178 | #endif |
| 179 | 179 | ||
| 180 | void lh_stats_bio(const LHASH *lh, BIO *out) | 180 | void lh_stats_bio(const _LHASH *lh, BIO *out) |
| 181 | { | 181 | { |
| 182 | BIO_printf(out,"num_items = %lu\n",lh->num_items); | 182 | BIO_printf(out,"num_items = %lu\n",lh->num_items); |
| 183 | BIO_printf(out,"num_nodes = %u\n",lh->num_nodes); | 183 | BIO_printf(out,"num_nodes = %u\n",lh->num_nodes); |
| @@ -205,7 +205,7 @@ void lh_stats_bio(const LHASH *lh, BIO *out) | |||
| 205 | #endif | 205 | #endif |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | void lh_node_stats_bio(const LHASH *lh, BIO *out) | 208 | void lh_node_stats_bio(const _LHASH *lh, BIO *out) |
| 209 | { | 209 | { |
| 210 | LHASH_NODE *n; | 210 | LHASH_NODE *n; |
| 211 | unsigned int i,num; | 211 | unsigned int i,num; |
| @@ -218,7 +218,7 @@ void lh_node_stats_bio(const LHASH *lh, BIO *out) | |||
| 218 | } | 218 | } |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | void lh_node_usage_stats_bio(const LHASH *lh, BIO *out) | 221 | void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out) |
| 222 | { | 222 | { |
| 223 | LHASH_NODE *n; | 223 | LHASH_NODE *n; |
| 224 | unsigned long num; | 224 | unsigned long num; |
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c index 04ea80203c..47f748081b 100644 --- a/src/lib/libcrypto/lhash/lhash.c +++ b/src/lib/libcrypto/lhash/lhash.c | |||
| @@ -107,18 +107,18 @@ const char lh_version[]="lhash" OPENSSL_VERSION_PTEXT; | |||
| 107 | #define UP_LOAD (2*LH_LOAD_MULT) /* load times 256 (default 2) */ | 107 | #define UP_LOAD (2*LH_LOAD_MULT) /* load times 256 (default 2) */ |
| 108 | #define DOWN_LOAD (LH_LOAD_MULT) /* load times 256 (default 1) */ | 108 | #define DOWN_LOAD (LH_LOAD_MULT) /* load times 256 (default 1) */ |
| 109 | 109 | ||
| 110 | static void expand(LHASH *lh); | 110 | static void expand(_LHASH *lh); |
| 111 | static void contract(LHASH *lh); | 111 | static void contract(_LHASH *lh); |
| 112 | static LHASH_NODE **getrn(LHASH *lh, const void *data, unsigned long *rhash); | 112 | static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash); |
| 113 | 113 | ||
| 114 | LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) | 114 | _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) |
| 115 | { | 115 | { |
| 116 | LHASH *ret; | 116 | _LHASH *ret; |
| 117 | int i; | 117 | int i; |
| 118 | 118 | ||
| 119 | if ((ret=(LHASH *)OPENSSL_malloc(sizeof(LHASH))) == NULL) | 119 | if ((ret=OPENSSL_malloc(sizeof(_LHASH))) == NULL) |
| 120 | goto err0; | 120 | goto err0; |
| 121 | if ((ret->b=(LHASH_NODE **)OPENSSL_malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL) | 121 | if ((ret->b=OPENSSL_malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL) |
| 122 | goto err1; | 122 | goto err1; |
| 123 | for (i=0; i<MIN_NODES; i++) | 123 | for (i=0; i<MIN_NODES; i++) |
| 124 | ret->b[i]=NULL; | 124 | ret->b[i]=NULL; |
| @@ -154,7 +154,7 @@ err0: | |||
| 154 | return(NULL); | 154 | return(NULL); |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | void lh_free(LHASH *lh) | 157 | void lh_free(_LHASH *lh) |
| 158 | { | 158 | { |
| 159 | unsigned int i; | 159 | unsigned int i; |
| 160 | LHASH_NODE *n,*nn; | 160 | LHASH_NODE *n,*nn; |
| @@ -176,7 +176,7 @@ void lh_free(LHASH *lh) | |||
| 176 | OPENSSL_free(lh); | 176 | OPENSSL_free(lh); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | void *lh_insert(LHASH *lh, void *data) | 179 | void *lh_insert(_LHASH *lh, void *data) |
| 180 | { | 180 | { |
| 181 | unsigned long hash; | 181 | unsigned long hash; |
| 182 | LHASH_NODE *nn,**rn; | 182 | LHASH_NODE *nn,**rn; |
| @@ -214,7 +214,7 @@ void *lh_insert(LHASH *lh, void *data) | |||
| 214 | return(ret); | 214 | return(ret); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | void *lh_delete(LHASH *lh, const void *data) | 217 | void *lh_delete(_LHASH *lh, const void *data) |
| 218 | { | 218 | { |
| 219 | unsigned long hash; | 219 | unsigned long hash; |
| 220 | LHASH_NODE *nn,**rn; | 220 | LHASH_NODE *nn,**rn; |
| @@ -245,7 +245,7 @@ void *lh_delete(LHASH *lh, const void *data) | |||
| 245 | return(ret); | 245 | return(ret); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | void *lh_retrieve(LHASH *lh, const void *data) | 248 | void *lh_retrieve(_LHASH *lh, const void *data) |
| 249 | { | 249 | { |
| 250 | unsigned long hash; | 250 | unsigned long hash; |
| 251 | LHASH_NODE **rn; | 251 | LHASH_NODE **rn; |
| @@ -267,12 +267,15 @@ void *lh_retrieve(LHASH *lh, const void *data) | |||
| 267 | return(ret); | 267 | return(ret); |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, | 270 | static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, |
| 271 | LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) | 271 | LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) |
| 272 | { | 272 | { |
| 273 | int i; | 273 | int i; |
| 274 | LHASH_NODE *a,*n; | 274 | LHASH_NODE *a,*n; |
| 275 | 275 | ||
| 276 | if (lh == NULL) | ||
| 277 | return; | ||
| 278 | |||
| 276 | /* reverse the order so we search from 'top to bottom' | 279 | /* reverse the order so we search from 'top to bottom' |
| 277 | * We were having memory leaks otherwise */ | 280 | * We were having memory leaks otherwise */ |
| 278 | for (i=lh->num_nodes-1; i>=0; i--) | 281 | for (i=lh->num_nodes-1; i>=0; i--) |
| @@ -282,6 +285,8 @@ static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, | |||
| 282 | { | 285 | { |
| 283 | /* 28/05/91 - eay - n added so items can be deleted | 286 | /* 28/05/91 - eay - n added so items can be deleted |
| 284 | * via lh_doall */ | 287 | * via lh_doall */ |
| 288 | /* 22/05/08 - ben - eh? since a is not passed, | ||
| 289 | * this should not be needed */ | ||
| 285 | n=a->next; | 290 | n=a->next; |
| 286 | if(use_arg) | 291 | if(use_arg) |
| 287 | func_arg(a->data,arg); | 292 | func_arg(a->data,arg); |
| @@ -292,17 +297,17 @@ static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, | |||
| 292 | } | 297 | } |
| 293 | } | 298 | } |
| 294 | 299 | ||
| 295 | void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func) | 300 | void lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func) |
| 296 | { | 301 | { |
| 297 | doall_util_fn(lh, 0, func, (LHASH_DOALL_ARG_FN_TYPE)0, NULL); | 302 | doall_util_fn(lh, 0, func, (LHASH_DOALL_ARG_FN_TYPE)0, NULL); |
| 298 | } | 303 | } |
| 299 | 304 | ||
| 300 | void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) | 305 | void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) |
| 301 | { | 306 | { |
| 302 | doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); | 307 | doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); |
| 303 | } | 308 | } |
| 304 | 309 | ||
| 305 | static void expand(LHASH *lh) | 310 | static void expand(_LHASH *lh) |
| 306 | { | 311 | { |
| 307 | LHASH_NODE **n,**n1,**n2,*np; | 312 | LHASH_NODE **n,**n1,**n2,*np; |
| 308 | unsigned int p,i,j; | 313 | unsigned int p,i,j; |
| @@ -358,7 +363,7 @@ static void expand(LHASH *lh) | |||
| 358 | } | 363 | } |
| 359 | } | 364 | } |
| 360 | 365 | ||
| 361 | static void contract(LHASH *lh) | 366 | static void contract(_LHASH *lh) |
| 362 | { | 367 | { |
| 363 | LHASH_NODE **n,*n1,*np; | 368 | LHASH_NODE **n,*n1,*np; |
| 364 | 369 | ||
| @@ -397,7 +402,7 @@ static void contract(LHASH *lh) | |||
| 397 | } | 402 | } |
| 398 | } | 403 | } |
| 399 | 404 | ||
| 400 | static LHASH_NODE **getrn(LHASH *lh, const void *data, unsigned long *rhash) | 405 | static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash) |
| 401 | { | 406 | { |
| 402 | LHASH_NODE **ret,*n1; | 407 | LHASH_NODE **ret,*n1; |
| 403 | unsigned long hash,nn; | 408 | unsigned long hash,nn; |
| @@ -464,7 +469,7 @@ unsigned long lh_strhash(const char *c) | |||
| 464 | return((ret>>16)^ret); | 469 | return((ret>>16)^ret); |
| 465 | } | 470 | } |
| 466 | 471 | ||
| 467 | unsigned long lh_num_items(const LHASH *lh) | 472 | unsigned long lh_num_items(const _LHASH *lh) |
| 468 | { | 473 | { |
| 469 | return lh ? lh->num_items : 0; | 474 | return lh ? lh->num_items : 0; |
| 470 | } | 475 | } |
diff --git a/src/lib/libcrypto/lhash/lhash.h b/src/lib/libcrypto/lhash/lhash.h index d392d0cd80..e7d8763591 100644 --- a/src/lib/libcrypto/lhash/lhash.h +++ b/src/lib/libcrypto/lhash/lhash.h | |||
| @@ -98,42 +98,42 @@ typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *); | |||
| 98 | * macros if the functions are strictly internal. */ | 98 | * macros if the functions are strictly internal. */ |
| 99 | 99 | ||
| 100 | /* First: "hash" functions */ | 100 | /* First: "hash" functions */ |
| 101 | #define DECLARE_LHASH_HASH_FN(f_name,o_type) \ | 101 | #define DECLARE_LHASH_HASH_FN(name, o_type) \ |
| 102 | unsigned long f_name##_LHASH_HASH(const void *); | 102 | unsigned long name##_LHASH_HASH(const void *); |
| 103 | #define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \ | 103 | #define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ |
| 104 | unsigned long f_name##_LHASH_HASH(const void *arg) { \ | 104 | unsigned long name##_LHASH_HASH(const void *arg) { \ |
| 105 | o_type a = (o_type)arg; \ | 105 | const o_type *a = arg; \ |
| 106 | return f_name(a); } | 106 | return name##_hash(a); } |
| 107 | #define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH | 107 | #define LHASH_HASH_FN(name) name##_LHASH_HASH |
| 108 | 108 | ||
| 109 | /* Second: "compare" functions */ | 109 | /* Second: "compare" functions */ |
| 110 | #define DECLARE_LHASH_COMP_FN(f_name,o_type) \ | 110 | #define DECLARE_LHASH_COMP_FN(name, o_type) \ |
| 111 | int f_name##_LHASH_COMP(const void *, const void *); | 111 | int name##_LHASH_COMP(const void *, const void *); |
| 112 | #define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \ | 112 | #define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ |
| 113 | int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \ | 113 | int name##_LHASH_COMP(const void *arg1, const void *arg2) { \ |
| 114 | o_type a = (o_type)arg1; \ | 114 | const o_type *a = arg1; \ |
| 115 | o_type b = (o_type)arg2; \ | 115 | const o_type *b = arg2; \ |
| 116 | return f_name(a,b); } | 116 | return name##_cmp(a,b); } |
| 117 | #define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP | 117 | #define LHASH_COMP_FN(name) name##_LHASH_COMP |
| 118 | 118 | ||
| 119 | /* Third: "doall" functions */ | 119 | /* Third: "doall" functions */ |
| 120 | #define DECLARE_LHASH_DOALL_FN(f_name,o_type) \ | 120 | #define DECLARE_LHASH_DOALL_FN(name, o_type) \ |
| 121 | void f_name##_LHASH_DOALL(void *); | 121 | void name##_LHASH_DOALL(void *); |
| 122 | #define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \ | 122 | #define IMPLEMENT_LHASH_DOALL_FN(name, o_type) \ |
| 123 | void f_name##_LHASH_DOALL(void *arg) { \ | 123 | void name##_LHASH_DOALL(void *arg) { \ |
| 124 | o_type a = (o_type)arg; \ | 124 | o_type *a = arg; \ |
| 125 | f_name(a); } | 125 | name##_doall(a); } |
| 126 | #define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL | 126 | #define LHASH_DOALL_FN(name) name##_LHASH_DOALL |
| 127 | 127 | ||
| 128 | /* Fourth: "doall_arg" functions */ | 128 | /* Fourth: "doall_arg" functions */ |
| 129 | #define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ | 129 | #define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ |
| 130 | void f_name##_LHASH_DOALL_ARG(void *, void *); | 130 | void name##_LHASH_DOALL_ARG(void *, void *); |
| 131 | #define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ | 131 | #define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ |
| 132 | void f_name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ | 132 | void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ |
| 133 | o_type a = (o_type)arg1; \ | 133 | o_type *a = arg1; \ |
| 134 | a_type b = (a_type)arg2; \ | 134 | a_type *b = arg2; \ |
| 135 | f_name(a,b); } | 135 | name##_doall_arg(a, b); } |
| 136 | #define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG | 136 | #define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG |
| 137 | 137 | ||
| 138 | typedef struct lhash_st | 138 | typedef struct lhash_st |
| 139 | { | 139 | { |
| @@ -163,7 +163,8 @@ typedef struct lhash_st | |||
| 163 | unsigned long num_hash_comps; | 163 | unsigned long num_hash_comps; |
| 164 | 164 | ||
| 165 | int error; | 165 | int error; |
| 166 | } LHASH; | 166 | } _LHASH; /* Do not use _LHASH directly, use LHASH_OF |
| 167 | * and friends */ | ||
| 167 | 168 | ||
| 168 | #define LH_LOAD_MULT 256 | 169 | #define LH_LOAD_MULT 256 |
| 169 | 170 | ||
| @@ -171,27 +172,67 @@ typedef struct lhash_st | |||
| 171 | * in lh_insert(). */ | 172 | * in lh_insert(). */ |
| 172 | #define lh_error(lh) ((lh)->error) | 173 | #define lh_error(lh) ((lh)->error) |
| 173 | 174 | ||
| 174 | LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c); | 175 | _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c); |
| 175 | void lh_free(LHASH *lh); | 176 | void lh_free(_LHASH *lh); |
| 176 | void *lh_insert(LHASH *lh, void *data); | 177 | void *lh_insert(_LHASH *lh, void *data); |
| 177 | void *lh_delete(LHASH *lh, const void *data); | 178 | void *lh_delete(_LHASH *lh, const void *data); |
| 178 | void *lh_retrieve(LHASH *lh, const void *data); | 179 | void *lh_retrieve(_LHASH *lh, const void *data); |
| 179 | void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func); | 180 | void lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func); |
| 180 | void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg); | 181 | void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg); |
| 181 | unsigned long lh_strhash(const char *c); | 182 | unsigned long lh_strhash(const char *c); |
| 182 | unsigned long lh_num_items(const LHASH *lh); | 183 | unsigned long lh_num_items(const _LHASH *lh); |
| 183 | 184 | ||
| 184 | #ifndef OPENSSL_NO_FP_API | 185 | #ifndef OPENSSL_NO_FP_API |
| 185 | void lh_stats(const LHASH *lh, FILE *out); | 186 | void lh_stats(const _LHASH *lh, FILE *out); |
| 186 | void lh_node_stats(const LHASH *lh, FILE *out); | 187 | void lh_node_stats(const _LHASH *lh, FILE *out); |
| 187 | void lh_node_usage_stats(const LHASH *lh, FILE *out); | 188 | void lh_node_usage_stats(const _LHASH *lh, FILE *out); |
| 188 | #endif | 189 | #endif |
| 189 | 190 | ||
| 190 | #ifndef OPENSSL_NO_BIO | 191 | #ifndef OPENSSL_NO_BIO |
| 191 | void lh_stats_bio(const LHASH *lh, BIO *out); | 192 | void lh_stats_bio(const _LHASH *lh, BIO *out); |
| 192 | void lh_node_stats_bio(const LHASH *lh, BIO *out); | 193 | void lh_node_stats_bio(const _LHASH *lh, BIO *out); |
| 193 | void lh_node_usage_stats_bio(const LHASH *lh, BIO *out); | 194 | void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out); |
| 194 | #endif | 195 | #endif |
| 196 | |||
| 197 | /* Type checking... */ | ||
| 198 | |||
| 199 | #define LHASH_OF(type) struct lhash_st_##type | ||
| 200 | |||
| 201 | #define DECLARE_LHASH_OF(type) LHASH_OF(type) { int dummy; } | ||
| 202 | |||
| 203 | #define CHECKED_LHASH_OF(type,lh) \ | ||
| 204 | ((_LHASH *)CHECKED_PTR_OF(LHASH_OF(type),lh)) | ||
| 205 | |||
| 206 | /* Define wrapper functions. */ | ||
| 207 | #define LHM_lh_new(type, name) \ | ||
| 208 | ((LHASH_OF(type) *)lh_new(LHASH_HASH_FN(name), LHASH_COMP_FN(name))) | ||
| 209 | #define LHM_lh_error(type, lh) \ | ||
| 210 | lh_error(CHECKED_LHASH_OF(type,lh)) | ||
| 211 | #define LHM_lh_insert(type, lh, inst) \ | ||
| 212 | ((type *)lh_insert(CHECKED_LHASH_OF(type, lh), \ | ||
| 213 | CHECKED_PTR_OF(type, inst))) | ||
| 214 | #define LHM_lh_retrieve(type, lh, inst) \ | ||
| 215 | ((type *)lh_retrieve(CHECKED_LHASH_OF(type, lh), \ | ||
| 216 | CHECKED_PTR_OF(type, inst))) | ||
| 217 | #define LHM_lh_delete(type, lh, inst) \ | ||
| 218 | ((type *)lh_delete(CHECKED_LHASH_OF(type, lh), \ | ||
| 219 | CHECKED_PTR_OF(type, inst))) | ||
| 220 | #define LHM_lh_doall(type, lh,fn) lh_doall(CHECKED_LHASH_OF(type, lh), fn) | ||
| 221 | #define LHM_lh_doall_arg(type, lh, fn, arg_type, arg) \ | ||
| 222 | lh_doall_arg(CHECKED_LHASH_OF(type, lh), fn, CHECKED_PTR_OF(arg_type, arg)) | ||
| 223 | #define LHM_lh_num_items(type, lh) lh_num_items(CHECKED_LHASH_OF(type, lh)) | ||
| 224 | #define LHM_lh_down_load(type, lh) (CHECKED_LHASH_OF(type, lh)->down_load) | ||
| 225 | #define LHM_lh_node_stats_bio(type, lh, out) \ | ||
| 226 | lh_node_stats_bio(CHECKED_LHASH_OF(type, lh), out) | ||
| 227 | #define LHM_lh_node_usage_stats_bio(type, lh, out) \ | ||
| 228 | lh_node_usage_stats_bio(CHECKED_LHASH_OF(type, lh), out) | ||
| 229 | #define LHM_lh_stats_bio(type, lh, out) \ | ||
| 230 | lh_stats_bio(CHECKED_LHASH_OF(type, lh), out) | ||
| 231 | #define LHM_lh_free(type, lh) lh_free(CHECKED_LHASH_OF(type, lh)) | ||
| 232 | |||
| 233 | DECLARE_LHASH_OF(OPENSSL_STRING); | ||
| 234 | DECLARE_LHASH_OF(OPENSSL_CSTRING); | ||
| 235 | |||
| 195 | #ifdef __cplusplus | 236 | #ifdef __cplusplus |
| 196 | } | 237 | } |
| 197 | #endif | 238 | #endif |
diff --git a/src/lib/libcrypto/md2/Makefile.ssl b/src/lib/libcrypto/md2/Makefile.ssl deleted file mode 100644 index 3206924c90..0000000000 --- a/src/lib/libcrypto/md2/Makefile.ssl +++ /dev/null | |||
| @@ -1,93 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/md/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= md2 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST=md2test.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=md2_dgst.c md2_one.c | ||
| 27 | LIBOBJ=md2_dgst.o md2_one.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= md2.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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | md2_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 83 | md2_dgst.o: ../../include/openssl/md2.h ../../include/openssl/opensslconf.h | ||
| 84 | md2_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 85 | md2_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 86 | md2_dgst.o: md2_dgst.c | ||
| 87 | md2_one.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 88 | md2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 89 | md2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 90 | md2_one.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 91 | md2_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 92 | md2_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 93 | md2_one.o: ../../include/openssl/symhacks.h ../cryptlib.h md2_one.c | ||
diff --git a/src/lib/libcrypto/md2/md2.h b/src/lib/libcrypto/md2/md2.h index d59c9f2593..a46120e7d4 100644 --- a/src/lib/libcrypto/md2/md2.h +++ b/src/lib/libcrypto/md2/md2.h | |||
| @@ -81,9 +81,6 @@ typedef struct MD2state_st | |||
| 81 | } MD2_CTX; | 81 | } MD2_CTX; |
| 82 | 82 | ||
| 83 | const char *MD2_options(void); | 83 | const char *MD2_options(void); |
| 84 | #ifdef OPENSSL_FIPS | ||
| 85 | int private_MD2_Init(MD2_CTX *c); | ||
| 86 | #endif | ||
| 87 | int MD2_Init(MD2_CTX *c); | 84 | int MD2_Init(MD2_CTX *c); |
| 88 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); | 85 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); |
| 89 | int MD2_Final(unsigned char *md, MD2_CTX *c); | 86 | int MD2_Final(unsigned char *md, MD2_CTX *c); |
diff --git a/src/lib/libcrypto/md2/md2_dgst.c b/src/lib/libcrypto/md2/md2_dgst.c index cc4eeaf7a7..c57b3da288 100644 --- a/src/lib/libcrypto/md2/md2_dgst.c +++ b/src/lib/libcrypto/md2/md2_dgst.c | |||
| @@ -62,11 +62,6 @@ | |||
| 62 | #include <openssl/md2.h> | 62 | #include <openssl/md2.h> |
| 63 | #include <openssl/opensslv.h> | 63 | #include <openssl/opensslv.h> |
| 64 | #include <openssl/crypto.h> | 64 | #include <openssl/crypto.h> |
| 65 | #ifdef OPENSSL_FIPS | ||
| 66 | #include <openssl/fips.h> | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #include <openssl/err.h> | ||
| 70 | 65 | ||
| 71 | const char MD2_version[]="MD2" OPENSSL_VERSION_PTEXT; | 66 | const char MD2_version[]="MD2" OPENSSL_VERSION_PTEXT; |
| 72 | 67 | ||
| @@ -78,7 +73,7 @@ const char MD2_version[]="MD2" OPENSSL_VERSION_PTEXT; | |||
| 78 | static void md2_block(MD2_CTX *c, const unsigned char *d); | 73 | static void md2_block(MD2_CTX *c, const unsigned char *d); |
| 79 | /* The magic S table - I have converted it to hex since it is | 74 | /* The magic S table - I have converted it to hex since it is |
| 80 | * basically just a random byte string. */ | 75 | * basically just a random byte string. */ |
| 81 | static MD2_INT S[256]={ | 76 | static const MD2_INT S[256]={ |
| 82 | 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, | 77 | 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, |
| 83 | 0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13, | 78 | 0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13, |
| 84 | 0x62, 0xA7, 0x05, 0xF3, 0xC0, 0xC7, 0x73, 0x8C, | 79 | 0x62, 0xA7, 0x05, 0xF3, 0xC0, 0xC7, 0x73, 0x8C, |
| @@ -121,7 +116,7 @@ const char *MD2_options(void) | |||
| 121 | return("md2(int)"); | 116 | return("md2(int)"); |
| 122 | } | 117 | } |
| 123 | 118 | ||
| 124 | FIPS_NON_FIPS_MD_Init(MD2) | 119 | int MD2_Init(MD2_CTX *c) |
| 125 | { | 120 | { |
| 126 | c->num=0; | 121 | c->num=0; |
| 127 | memset(c->state,0,sizeof c->state); | 122 | memset(c->state,0,sizeof c->state); |
diff --git a/src/lib/libcrypto/md32_common.h b/src/lib/libcrypto/md32_common.h index 61bcd9786f..1cb783944e 100644 --- a/src/lib/libcrypto/md32_common.h +++ b/src/lib/libcrypto/md32_common.h | |||
| @@ -241,11 +241,11 @@ | |||
| 241 | #ifndef PEDANTIC | 241 | #ifndef PEDANTIC |
| 242 | # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) | 242 | # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) |
| 243 | # if defined(__s390x__) | 243 | # if defined(__s390x__) |
| 244 | # define HOST_c2l(c,l) ({ asm ("lrv %0,0(%1)" \ | 244 | # define HOST_c2l(c,l) ({ asm ("lrv %0,%1" \ |
| 245 | :"=r"(l) : "r"(c)); \ | 245 | :"=d"(l) :"m"(*(const unsigned int *)(c)));\ |
| 246 | (c)+=4; (l); }) | 246 | (c)+=4; (l); }) |
| 247 | # define HOST_l2c(l,c) ({ asm ("strv %0,0(%1)" \ | 247 | # define HOST_l2c(l,c) ({ asm ("strv %1,%0" \ |
| 248 | : : "r"(l),"r"(c) : "memory"); \ | 248 | :"=m"(*(unsigned int *)(c)) :"d"(l));\ |
| 249 | (c)+=4; (l); }) | 249 | (c)+=4; (l); }) |
| 250 | # endif | 250 | # endif |
| 251 | # endif | 251 | # endif |
| @@ -293,7 +293,7 @@ int HASH_UPDATE (HASH_CTX *c, const void *data_, size_t len) | |||
| 293 | * Wei Dai <weidai@eskimo.com> for pointing it out. */ | 293 | * Wei Dai <weidai@eskimo.com> for pointing it out. */ |
| 294 | if (l < c->Nl) /* overflow */ | 294 | if (l < c->Nl) /* overflow */ |
| 295 | c->Nh++; | 295 | c->Nh++; |
| 296 | c->Nh+=(len>>29); /* might cause compiler warning on 16-bit */ | 296 | c->Nh+=(HASH_LONG)(len>>29); /* might cause compiler warning on 16-bit */ |
| 297 | c->Nl=l; | 297 | c->Nl=l; |
| 298 | 298 | ||
| 299 | n = c->num; | 299 | n = c->num; |
| @@ -331,7 +331,7 @@ int HASH_UPDATE (HASH_CTX *c, const void *data_, size_t len) | |||
| 331 | if (len != 0) | 331 | if (len != 0) |
| 332 | { | 332 | { |
| 333 | p = (unsigned char *)c->data; | 333 | p = (unsigned char *)c->data; |
| 334 | c->num = len; | 334 | c->num = (unsigned int)len; |
| 335 | memcpy (p,data,len); | 335 | memcpy (p,data,len); |
| 336 | } | 336 | } |
| 337 | return 1; | 337 | return 1; |
diff --git a/src/lib/libcrypto/md4/Makefile.ssl b/src/lib/libcrypto/md4/Makefile.ssl deleted file mode 100644 index 7d2e8d8d3b..0000000000 --- a/src/lib/libcrypto/md4/Makefile.ssl +++ /dev/null | |||
| @@ -1,91 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/md4/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= md4 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 21 | |||
| 22 | GENERAL=Makefile | ||
| 23 | TEST=md4test.c | ||
| 24 | APPS=md4.c | ||
| 25 | |||
| 26 | LIB=$(TOP)/libcrypto.a | ||
| 27 | LIBSRC=md4_dgst.c md4_one.c | ||
| 28 | LIBOBJ=md4_dgst.o md4_one.o | ||
| 29 | |||
| 30 | SRC= $(LIBSRC) | ||
| 31 | |||
| 32 | EXHEADER= md4.h | ||
| 33 | HEADER= md4_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 | files: | ||
| 48 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 49 | |||
| 50 | links: | ||
| 51 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 58 | do \ | ||
| 59 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 60 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 61 | done; | ||
| 62 | |||
| 63 | tags: | ||
| 64 | ctags $(SRC) | ||
| 65 | |||
| 66 | tests: | ||
| 67 | |||
| 68 | lint: | ||
| 69 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 70 | |||
| 71 | depend: | ||
| 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 asm/mx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 80 | |||
| 81 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 82 | |||
| 83 | md4_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md4.h | ||
| 84 | md4_dgst.o: ../../include/openssl/opensslconf.h | ||
| 85 | md4_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md4_dgst.c | ||
| 86 | md4_dgst.o: md4_locl.h | ||
| 87 | md4_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 88 | md4_one.o: ../../include/openssl/md4.h ../../include/openssl/opensslconf.h | ||
| 89 | md4_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 90 | md4_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 91 | md4_one.o: md4_one.c | ||
diff --git a/src/lib/libcrypto/md4/md4.h b/src/lib/libcrypto/md4/md4.h index ba1fe4a6ee..c3ed9b3f75 100644 --- a/src/lib/libcrypto/md4/md4.h +++ b/src/lib/libcrypto/md4/md4.h | |||
| @@ -77,7 +77,7 @@ extern "C" { | |||
| 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 78 | */ | 78 | */ |
| 79 | 79 | ||
| 80 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | 80 | #if defined(__LP32__) |
| 81 | #define MD4_LONG unsigned long | 81 | #define MD4_LONG unsigned long |
| 82 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | 82 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) |
| 83 | #define MD4_LONG unsigned long | 83 | #define MD4_LONG unsigned long |
| @@ -105,9 +105,6 @@ typedef struct MD4state_st | |||
| 105 | unsigned int num; | 105 | unsigned int num; |
| 106 | } MD4_CTX; | 106 | } MD4_CTX; |
| 107 | 107 | ||
| 108 | #ifdef OPENSSL_FIPS | ||
| 109 | int private_MD4_Init(MD4_CTX *c); | ||
| 110 | #endif | ||
| 111 | int MD4_Init(MD4_CTX *c); | 108 | int MD4_Init(MD4_CTX *c); |
| 112 | int MD4_Update(MD4_CTX *c, const void *data, size_t len); | 109 | int MD4_Update(MD4_CTX *c, const void *data, size_t len); |
| 113 | int MD4_Final(unsigned char *md, MD4_CTX *c); | 110 | int MD4_Final(unsigned char *md, MD4_CTX *c); |
diff --git a/src/lib/libcrypto/md4/md4_dgst.c b/src/lib/libcrypto/md4/md4_dgst.c index 0f5448601d..e0c42e8596 100644 --- a/src/lib/libcrypto/md4/md4_dgst.c +++ b/src/lib/libcrypto/md4/md4_dgst.c | |||
| @@ -59,11 +59,6 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "md4_locl.h" | 60 | #include "md4_locl.h" |
| 61 | #include <openssl/opensslv.h> | 61 | #include <openssl/opensslv.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #ifdef OPENSSL_FIPS | ||
| 64 | #include <openssl/fips.h> | ||
| 65 | #endif | ||
| 66 | |||
| 67 | 62 | ||
| 68 | const char MD4_version[]="MD4" OPENSSL_VERSION_PTEXT; | 63 | const char MD4_version[]="MD4" OPENSSL_VERSION_PTEXT; |
| 69 | 64 | ||
| @@ -75,15 +70,13 @@ const char MD4_version[]="MD4" OPENSSL_VERSION_PTEXT; | |||
| 75 | #define INIT_DATA_C (unsigned long)0x98badcfeL | 70 | #define INIT_DATA_C (unsigned long)0x98badcfeL |
| 76 | #define INIT_DATA_D (unsigned long)0x10325476L | 71 | #define INIT_DATA_D (unsigned long)0x10325476L |
| 77 | 72 | ||
| 78 | FIPS_NON_FIPS_MD_Init(MD4) | 73 | int MD4_Init(MD4_CTX *c) |
| 79 | { | 74 | { |
| 75 | memset (c,0,sizeof(*c)); | ||
| 80 | c->A=INIT_DATA_A; | 76 | c->A=INIT_DATA_A; |
| 81 | c->B=INIT_DATA_B; | 77 | c->B=INIT_DATA_B; |
| 82 | c->C=INIT_DATA_C; | 78 | c->C=INIT_DATA_C; |
| 83 | c->D=INIT_DATA_D; | 79 | c->D=INIT_DATA_D; |
| 84 | c->Nl=0; | ||
| 85 | c->Nh=0; | ||
| 86 | c->num=0; | ||
| 87 | return 1; | 80 | return 1; |
| 88 | } | 81 | } |
| 89 | 82 | ||
diff --git a/src/lib/libcrypto/md5/Makefile.ssl b/src/lib/libcrypto/md5/Makefile.ssl deleted file mode 100644 index 2361775a2d..0000000000 --- a/src/lib/libcrypto/md5/Makefile.ssl +++ /dev/null | |||
| @@ -1,127 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/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 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | MD5_ASM_OBJ= | ||
| 21 | |||
| 22 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 23 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 24 | |||
| 25 | GENERAL=Makefile | ||
| 26 | TEST=md5test.c | ||
| 27 | APPS= | ||
| 28 | |||
| 29 | LIB=$(TOP)/libcrypto.a | ||
| 30 | LIBSRC=md5_dgst.c md5_one.c | ||
| 31 | LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) | ||
| 32 | |||
| 33 | SRC= $(LIBSRC) | ||
| 34 | |||
| 35 | EXHEADER= md5.h | ||
| 36 | HEADER= md5_locl.h $(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 | # elf | ||
| 51 | asm/mx86-elf.s: asm/md5-586.pl ../perlasm/x86asm.pl | ||
| 52 | (cd asm; $(PERL) md5-586.pl elf $(CFLAGS) > mx86-elf.s) | ||
| 53 | |||
| 54 | # a.out | ||
| 55 | asm/mx86-out.o: asm/mx86unix.cpp | ||
| 56 | $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o | ||
| 57 | |||
| 58 | # bsdi | ||
| 59 | asm/mx86bsdi.o: asm/mx86unix.cpp | ||
| 60 | $(CPP) -DBSDI asm/mx86unix.cpp | sed 's/ :/:/' | as -o asm/mx86bsdi.o | ||
| 61 | |||
| 62 | asm/mx86unix.cpp: asm/md5-586.pl ../perlasm/x86asm.pl | ||
| 63 | (cd asm; $(PERL) md5-586.pl cpp >mx86unix.cpp) | ||
| 64 | |||
| 65 | asm/md5-sparcv8plus.o: asm/md5-sparcv9.S | ||
| 66 | $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -c \ | ||
| 67 | -o asm/md5-sparcv8plus.o asm/md5-sparcv9.S | ||
| 68 | |||
| 69 | # Old GNU assembler doesn't understand V9 instructions, so we | ||
| 70 | # hire /usr/ccs/bin/as to do the job. Note that option is called | ||
| 71 | # *-gcc27, but even gcc 2>=8 users may experience similar problem | ||
| 72 | # if they didn't bother to upgrade GNU assembler. Such users should | ||
| 73 | # not choose this option, but be adviced to *remove* GNU assembler | ||
| 74 | # or upgrade it. | ||
| 75 | asm/md5-sparcv8plus-gcc27.o: asm/md5-sparcv9.S | ||
| 76 | $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -E asm/md5-sparcv9.S | \ | ||
| 77 | /usr/ccs/bin/as -xarch=v8plus - -o asm/md5-sparcv8plus-gcc27.o | ||
| 78 | |||
| 79 | asm/md5-sparcv9.o: asm/md5-sparcv9.S | ||
| 80 | $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -c \ | ||
| 81 | -o asm/md5-sparcv9.o asm/md5-sparcv9.S | ||
| 82 | |||
| 83 | files: | ||
| 84 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 85 | |||
| 86 | links: | ||
| 87 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 88 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 89 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 90 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 91 | |||
| 92 | install: | ||
| 93 | @for i in $(EXHEADER) ; \ | ||
| 94 | do \ | ||
| 95 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 96 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 97 | done; | ||
| 98 | |||
| 99 | tags: | ||
| 100 | ctags $(SRC) | ||
| 101 | |||
| 102 | tests: | ||
| 103 | |||
| 104 | lint: | ||
| 105 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 106 | |||
| 107 | depend: | ||
| 108 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 109 | |||
| 110 | dclean: | ||
| 111 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 112 | mv -f Makefile.new $(MAKEFILE) | ||
| 113 | |||
| 114 | clean: | ||
| 115 | rm -f asm/mx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 116 | |||
| 117 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 118 | |||
| 119 | md5_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md5.h | ||
| 120 | md5_dgst.o: ../../include/openssl/opensslconf.h | ||
| 121 | md5_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md5_dgst.c | ||
| 122 | md5_dgst.o: md5_locl.h | ||
| 123 | md5_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 124 | md5_one.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h | ||
| 125 | md5_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 126 | md5_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 127 | md5_one.o: md5_one.c | ||
diff --git a/src/lib/libcrypto/md5/asm/md5-586.pl b/src/lib/libcrypto/md5/asm/md5-586.pl index 76ac235f7d..6cb66bb499 100644 --- a/src/lib/libcrypto/md5/asm/md5-586.pl +++ b/src/lib/libcrypto/md5/asm/md5-586.pl | |||
| @@ -7,7 +7,8 @@ | |||
| 7 | 7 | ||
| 8 | $normal=0; | 8 | $normal=0; |
| 9 | 9 | ||
| 10 | push(@INC,"perlasm","../../perlasm"); | 10 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 11 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 11 | require "x86asm.pl"; | 12 | require "x86asm.pl"; |
| 12 | 13 | ||
| 13 | &asm_init($ARGV[0],$0); | 14 | &asm_init($ARGV[0],$0); |
diff --git a/src/lib/libcrypto/md5/asm/md5-sparcv9.S b/src/lib/libcrypto/md5/asm/md5-sparcv9.S deleted file mode 100644 index db45aa4c97..0000000000 --- a/src/lib/libcrypto/md5/asm/md5-sparcv9.S +++ /dev/null | |||
| @@ -1,1031 +0,0 @@ | |||
| 1 | .ident "md5-sparcv9.S, Version 1.0" | ||
| 2 | .ident "SPARC V9 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>" | ||
| 3 | .file "md5-sparcv9.S" | ||
| 4 | |||
| 5 | /* | ||
| 6 | * ==================================================================== | ||
| 7 | * Copyright (c) 1999 Andy Polyakov <appro@fy.chalmers.se>. | ||
| 8 | * | ||
| 9 | * Rights for redistribution and usage in source and binary forms are | ||
| 10 | * granted as long as above copyright notices are retained. Warranty | ||
| 11 | * of any kind is (of course:-) disclaimed. | ||
| 12 | * ==================================================================== | ||
| 13 | */ | ||
| 14 | |||
| 15 | /* | ||
| 16 | * This is my modest contribution to OpenSSL project (see | ||
| 17 | * http://www.openssl.org/ for more information about it) and is an | ||
| 18 | * assembler implementation of MD5 block hash function. I've hand-coded | ||
| 19 | * this for the sole reason to reach UltraSPARC-specific "load in | ||
| 20 | * little-endian byte order" instruction. This gives up to 15% | ||
| 21 | * performance improvement for cases when input message is aligned at | ||
| 22 | * 32 bits boundary. The module was tested under both 32 *and* 64 bit | ||
| 23 | * kernels. For updates see http://fy.chalmers.se/~appro/hpe/. | ||
| 24 | * | ||
| 25 | * To compile with SC4.x/SC5.x: | ||
| 26 | * | ||
| 27 | * cc -xarch=v[9|8plus] -DOPENSSL_SYSNAME_ULTRASPARC -DMD5_BLOCK_DATA_ORDER \ | ||
| 28 | * -c md5-sparcv9.S | ||
| 29 | * | ||
| 30 | * and with gcc: | ||
| 31 | * | ||
| 32 | * gcc -mcpu=ultrasparc -DOPENSSL_SYSNAME_ULTRASPARC -DMD5_BLOCK_DATA_ORDER \ | ||
| 33 | * -c md5-sparcv9.S | ||
| 34 | * | ||
| 35 | * or if above fails (it does if you have gas): | ||
| 36 | * | ||
| 37 | * gcc -E -DOPENSSL_SYSNAMEULTRASPARC -DMD5_BLOCK_DATA_ORDER md5_block.sparc.S | \ | ||
| 38 | * as -xarch=v8plus /dev/fd/0 -o md5-sparcv9.o | ||
| 39 | */ | ||
| 40 | |||
| 41 | #include <openssl/e_os2.h> | ||
| 42 | |||
| 43 | #define A %o0 | ||
| 44 | #define B %o1 | ||
| 45 | #define C %o2 | ||
| 46 | #define D %o3 | ||
| 47 | #define T1 %o4 | ||
| 48 | #define T2 %o5 | ||
| 49 | |||
| 50 | #define R0 %l0 | ||
| 51 | #define R1 %l1 | ||
| 52 | #define R2 %l2 | ||
| 53 | #define R3 %l3 | ||
| 54 | #define R4 %l4 | ||
| 55 | #define R5 %l5 | ||
| 56 | #define R6 %l6 | ||
| 57 | #define R7 %l7 | ||
| 58 | #define R8 %i3 | ||
| 59 | #define R9 %i4 | ||
| 60 | #define R10 %i5 | ||
| 61 | #define R11 %g1 | ||
| 62 | #define R12 %g2 | ||
| 63 | #define R13 %g3 | ||
| 64 | #define RX %g4 | ||
| 65 | |||
| 66 | #define Aptr %i0+0 | ||
| 67 | #define Bptr %i0+4 | ||
| 68 | #define Cptr %i0+8 | ||
| 69 | #define Dptr %i0+12 | ||
| 70 | |||
| 71 | #define Aval R5 /* those not used at the end of the last round */ | ||
| 72 | #define Bval R6 | ||
| 73 | #define Cval R7 | ||
| 74 | #define Dval R8 | ||
| 75 | |||
| 76 | #if defined(MD5_BLOCK_DATA_ORDER) | ||
| 77 | # if defined(OPENSSL_SYSNAME_ULTRASPARC) | ||
| 78 | # define LOAD lda | ||
| 79 | # define X(i) [%i1+i*4]%asi | ||
| 80 | # define md5_block md5_block_asm_data_order_aligned | ||
| 81 | # define ASI_PRIMARY_LITTLE 0x88 | ||
| 82 | # else | ||
| 83 | # error "MD5_BLOCK_DATA_ORDER is supported only on UltraSPARC!" | ||
| 84 | # endif | ||
| 85 | #else | ||
| 86 | # define LOAD ld | ||
| 87 | # define X(i) [%i1+i*4] | ||
| 88 | # define md5_block md5_block_asm_host_order | ||
| 89 | #endif | ||
| 90 | |||
| 91 | .section ".text",#alloc,#execinstr | ||
| 92 | |||
| 93 | #if defined(__SUNPRO_C) && defined(__sparcv9) | ||
| 94 | /* They've said -xarch=v9 at command line */ | ||
| 95 | .register %g2,#scratch | ||
| 96 | .register %g3,#scratch | ||
| 97 | # define FRAME -192 | ||
| 98 | #elif defined(__GNUC__) && defined(__arch64__) | ||
| 99 | /* They've said -m64 at command line */ | ||
| 100 | .register %g2,#scratch | ||
| 101 | .register %g3,#scratch | ||
| 102 | # define FRAME -192 | ||
| 103 | #else | ||
| 104 | # define FRAME -96 | ||
| 105 | #endif | ||
| 106 | |||
| 107 | .align 32 | ||
| 108 | |||
| 109 | .global md5_block | ||
| 110 | md5_block: | ||
| 111 | save %sp,FRAME,%sp | ||
| 112 | |||
| 113 | ld [Dptr],D | ||
| 114 | ld [Cptr],C | ||
| 115 | ld [Bptr],B | ||
| 116 | ld [Aptr],A | ||
| 117 | #ifdef ASI_PRIMARY_LITTLE | ||
| 118 | rd %asi,%o7 ! How dare I? Well, I just do:-) | ||
| 119 | wr %g0,ASI_PRIMARY_LITTLE,%asi | ||
| 120 | #endif | ||
| 121 | LOAD X(0),R0 | ||
| 122 | |||
| 123 | .Lmd5_block_loop: | ||
| 124 | |||
| 125 | !!!!!!!!Round 0 | ||
| 126 | |||
| 127 | xor C,D,T1 | ||
| 128 | sethi %hi(0xd76aa478),T2 | ||
| 129 | and T1,B,T1 | ||
| 130 | or T2,%lo(0xd76aa478),T2 != | ||
| 131 | xor T1,D,T1 | ||
| 132 | add T1,R0,T1 | ||
| 133 | LOAD X(1),R1 | ||
| 134 | add T1,T2,T1 != | ||
| 135 | add A,T1,A | ||
| 136 | sll A,7,T2 | ||
| 137 | srl A,32-7,A | ||
| 138 | or A,T2,A != | ||
| 139 | xor B,C,T1 | ||
| 140 | add A,B,A | ||
| 141 | |||
| 142 | sethi %hi(0xe8c7b756),T2 | ||
| 143 | and T1,A,T1 != | ||
| 144 | or T2,%lo(0xe8c7b756),T2 | ||
| 145 | xor T1,C,T1 | ||
| 146 | LOAD X(2),R2 | ||
| 147 | add T1,R1,T1 != | ||
| 148 | add T1,T2,T1 | ||
| 149 | add D,T1,D | ||
| 150 | sll D,12,T2 | ||
| 151 | srl D,32-12,D != | ||
| 152 | or D,T2,D | ||
| 153 | xor A,B,T1 | ||
| 154 | add D,A,D | ||
| 155 | |||
| 156 | sethi %hi(0x242070db),T2 != | ||
| 157 | and T1,D,T1 | ||
| 158 | or T2,%lo(0x242070db),T2 | ||
| 159 | xor T1,B,T1 | ||
| 160 | add T1,R2,T1 != | ||
| 161 | LOAD X(3),R3 | ||
| 162 | add T1,T2,T1 | ||
| 163 | add C,T1,C | ||
| 164 | sll C,17,T2 != | ||
| 165 | srl C,32-17,C | ||
| 166 | or C,T2,C | ||
| 167 | xor D,A,T1 | ||
| 168 | add C,D,C != | ||
| 169 | |||
| 170 | sethi %hi(0xc1bdceee),T2 | ||
| 171 | and T1,C,T1 | ||
| 172 | or T2,%lo(0xc1bdceee),T2 | ||
| 173 | xor T1,A,T1 != | ||
| 174 | add T1,R3,T1 | ||
| 175 | LOAD X(4),R4 | ||
| 176 | add T1,T2,T1 | ||
| 177 | add B,T1,B != | ||
| 178 | sll B,22,T2 | ||
| 179 | srl B,32-22,B | ||
| 180 | or B,T2,B | ||
| 181 | xor C,D,T1 != | ||
| 182 | add B,C,B | ||
| 183 | |||
| 184 | sethi %hi(0xf57c0faf),T2 | ||
| 185 | and T1,B,T1 | ||
| 186 | or T2,%lo(0xf57c0faf),T2 != | ||
| 187 | xor T1,D,T1 | ||
| 188 | add T1,R4,T1 | ||
| 189 | LOAD X(5),R5 | ||
| 190 | add T1,T2,T1 != | ||
| 191 | add A,T1,A | ||
| 192 | sll A,7,T2 | ||
| 193 | srl A,32-7,A | ||
| 194 | or A,T2,A != | ||
| 195 | xor B,C,T1 | ||
| 196 | add A,B,A | ||
| 197 | |||
| 198 | sethi %hi(0x4787c62a),T2 | ||
| 199 | and T1,A,T1 != | ||
| 200 | or T2,%lo(0x4787c62a),T2 | ||
| 201 | xor T1,C,T1 | ||
| 202 | LOAD X(6),R6 | ||
| 203 | add T1,R5,T1 != | ||
| 204 | add T1,T2,T1 | ||
| 205 | add D,T1,D | ||
| 206 | sll D,12,T2 | ||
| 207 | srl D,32-12,D != | ||
| 208 | or D,T2,D | ||
| 209 | xor A,B,T1 | ||
| 210 | add D,A,D | ||
| 211 | |||
| 212 | sethi %hi(0xa8304613),T2 != | ||
| 213 | and T1,D,T1 | ||
| 214 | or T2,%lo(0xa8304613),T2 | ||
| 215 | xor T1,B,T1 | ||
| 216 | add T1,R6,T1 != | ||
| 217 | LOAD X(7),R7 | ||
| 218 | add T1,T2,T1 | ||
| 219 | add C,T1,C | ||
| 220 | sll C,17,T2 != | ||
| 221 | srl C,32-17,C | ||
| 222 | or C,T2,C | ||
| 223 | xor D,A,T1 | ||
| 224 | add C,D,C != | ||
| 225 | |||
| 226 | sethi %hi(0xfd469501),T2 | ||
| 227 | and T1,C,T1 | ||
| 228 | or T2,%lo(0xfd469501),T2 | ||
| 229 | xor T1,A,T1 != | ||
| 230 | add T1,R7,T1 | ||
| 231 | LOAD X(8),R8 | ||
| 232 | add T1,T2,T1 | ||
| 233 | add B,T1,B != | ||
| 234 | sll B,22,T2 | ||
| 235 | srl B,32-22,B | ||
| 236 | or B,T2,B | ||
| 237 | xor C,D,T1 != | ||
| 238 | add B,C,B | ||
| 239 | |||
| 240 | sethi %hi(0x698098d8),T2 | ||
| 241 | and T1,B,T1 | ||
| 242 | or T2,%lo(0x698098d8),T2 != | ||
| 243 | xor T1,D,T1 | ||
| 244 | add T1,R8,T1 | ||
| 245 | LOAD X(9),R9 | ||
| 246 | add T1,T2,T1 != | ||
| 247 | add A,T1,A | ||
| 248 | sll A,7,T2 | ||
| 249 | srl A,32-7,A | ||
| 250 | or A,T2,A != | ||
| 251 | xor B,C,T1 | ||
| 252 | add A,B,A | ||
| 253 | |||
| 254 | sethi %hi(0x8b44f7af),T2 | ||
| 255 | and T1,A,T1 != | ||
| 256 | or T2,%lo(0x8b44f7af),T2 | ||
| 257 | xor T1,C,T1 | ||
| 258 | LOAD X(10),R10 | ||
| 259 | add T1,R9,T1 != | ||
| 260 | add T1,T2,T1 | ||
| 261 | add D,T1,D | ||
| 262 | sll D,12,T2 | ||
| 263 | srl D,32-12,D != | ||
| 264 | or D,T2,D | ||
| 265 | xor A,B,T1 | ||
| 266 | add D,A,D | ||
| 267 | |||
| 268 | sethi %hi(0xffff5bb1),T2 != | ||
| 269 | and T1,D,T1 | ||
| 270 | or T2,%lo(0xffff5bb1),T2 | ||
| 271 | xor T1,B,T1 | ||
| 272 | add T1,R10,T1 != | ||
| 273 | LOAD X(11),R11 | ||
| 274 | add T1,T2,T1 | ||
| 275 | add C,T1,C | ||
| 276 | sll C,17,T2 != | ||
| 277 | srl C,32-17,C | ||
| 278 | or C,T2,C | ||
| 279 | xor D,A,T1 | ||
| 280 | add C,D,C != | ||
| 281 | |||
| 282 | sethi %hi(0x895cd7be),T2 | ||
| 283 | and T1,C,T1 | ||
| 284 | or T2,%lo(0x895cd7be),T2 | ||
| 285 | xor T1,A,T1 != | ||
| 286 | add T1,R11,T1 | ||
| 287 | LOAD X(12),R12 | ||
| 288 | add T1,T2,T1 | ||
| 289 | add B,T1,B != | ||
| 290 | sll B,22,T2 | ||
| 291 | srl B,32-22,B | ||
| 292 | or B,T2,B | ||
| 293 | xor C,D,T1 != | ||
| 294 | add B,C,B | ||
| 295 | |||
| 296 | sethi %hi(0x6b901122),T2 | ||
| 297 | and T1,B,T1 | ||
| 298 | or T2,%lo(0x6b901122),T2 != | ||
| 299 | xor T1,D,T1 | ||
| 300 | add T1,R12,T1 | ||
| 301 | LOAD X(13),R13 | ||
| 302 | add T1,T2,T1 != | ||
| 303 | add A,T1,A | ||
| 304 | sll A,7,T2 | ||
| 305 | srl A,32-7,A | ||
| 306 | or A,T2,A != | ||
| 307 | xor B,C,T1 | ||
| 308 | add A,B,A | ||
| 309 | |||
| 310 | sethi %hi(0xfd987193),T2 | ||
| 311 | and T1,A,T1 != | ||
| 312 | or T2,%lo(0xfd987193),T2 | ||
| 313 | xor T1,C,T1 | ||
| 314 | LOAD X(14),RX | ||
| 315 | add T1,R13,T1 != | ||
| 316 | add T1,T2,T1 | ||
| 317 | add D,T1,D | ||
| 318 | sll D,12,T2 | ||
| 319 | srl D,32-12,D != | ||
| 320 | or D,T2,D | ||
| 321 | xor A,B,T1 | ||
| 322 | add D,A,D | ||
| 323 | |||
| 324 | sethi %hi(0xa679438e),T2 != | ||
| 325 | and T1,D,T1 | ||
| 326 | or T2,%lo(0xa679438e),T2 | ||
| 327 | xor T1,B,T1 | ||
| 328 | add T1,RX,T1 != | ||
| 329 | LOAD X(15),RX | ||
| 330 | add T1,T2,T1 | ||
| 331 | add C,T1,C | ||
| 332 | sll C,17,T2 != | ||
| 333 | srl C,32-17,C | ||
| 334 | or C,T2,C | ||
| 335 | xor D,A,T1 | ||
| 336 | add C,D,C != | ||
| 337 | |||
| 338 | sethi %hi(0x49b40821),T2 | ||
| 339 | and T1,C,T1 | ||
| 340 | or T2,%lo(0x49b40821),T2 | ||
| 341 | xor T1,A,T1 != | ||
| 342 | add T1,RX,T1 | ||
| 343 | !pre-LOADed X(1),R1 | ||
| 344 | add T1,T2,T1 | ||
| 345 | add B,T1,B | ||
| 346 | sll B,22,T2 != | ||
| 347 | srl B,32-22,B | ||
| 348 | or B,T2,B | ||
| 349 | add B,C,B | ||
| 350 | |||
| 351 | !!!!!!!!Round 1 | ||
| 352 | |||
| 353 | xor B,C,T1 != | ||
| 354 | sethi %hi(0xf61e2562),T2 | ||
| 355 | and T1,D,T1 | ||
| 356 | or T2,%lo(0xf61e2562),T2 | ||
| 357 | xor T1,C,T1 != | ||
| 358 | add T1,R1,T1 | ||
| 359 | !pre-LOADed X(6),R6 | ||
| 360 | add T1,T2,T1 | ||
| 361 | add A,T1,A | ||
| 362 | sll A,5,T2 != | ||
| 363 | srl A,32-5,A | ||
| 364 | or A,T2,A | ||
| 365 | add A,B,A | ||
| 366 | |||
| 367 | xor A,B,T1 != | ||
| 368 | sethi %hi(0xc040b340),T2 | ||
| 369 | and T1,C,T1 | ||
| 370 | or T2,%lo(0xc040b340),T2 | ||
| 371 | xor T1,B,T1 != | ||
| 372 | add T1,R6,T1 | ||
| 373 | !pre-LOADed X(11),R11 | ||
| 374 | add T1,T2,T1 | ||
| 375 | add D,T1,D | ||
| 376 | sll D,9,T2 != | ||
| 377 | srl D,32-9,D | ||
| 378 | or D,T2,D | ||
| 379 | add D,A,D | ||
| 380 | |||
| 381 | xor D,A,T1 != | ||
| 382 | sethi %hi(0x265e5a51),T2 | ||
| 383 | and T1,B,T1 | ||
| 384 | or T2,%lo(0x265e5a51),T2 | ||
| 385 | xor T1,A,T1 != | ||
| 386 | add T1,R11,T1 | ||
| 387 | !pre-LOADed X(0),R0 | ||
| 388 | add T1,T2,T1 | ||
| 389 | add C,T1,C | ||
| 390 | sll C,14,T2 != | ||
| 391 | srl C,32-14,C | ||
| 392 | or C,T2,C | ||
| 393 | add C,D,C | ||
| 394 | |||
| 395 | xor C,D,T1 != | ||
| 396 | sethi %hi(0xe9b6c7aa),T2 | ||
| 397 | and T1,A,T1 | ||
| 398 | or T2,%lo(0xe9b6c7aa),T2 | ||
| 399 | xor T1,D,T1 != | ||
| 400 | add T1,R0,T1 | ||
| 401 | !pre-LOADed X(5),R5 | ||
| 402 | add T1,T2,T1 | ||
| 403 | add B,T1,B | ||
| 404 | sll B,20,T2 != | ||
| 405 | srl B,32-20,B | ||
| 406 | or B,T2,B | ||
| 407 | add B,C,B | ||
| 408 | |||
| 409 | xor B,C,T1 != | ||
| 410 | sethi %hi(0xd62f105d),T2 | ||
| 411 | and T1,D,T1 | ||
| 412 | or T2,%lo(0xd62f105d),T2 | ||
| 413 | xor T1,C,T1 != | ||
| 414 | add T1,R5,T1 | ||
| 415 | !pre-LOADed X(10),R10 | ||
| 416 | add T1,T2,T1 | ||
| 417 | add A,T1,A | ||
| 418 | sll A,5,T2 != | ||
| 419 | srl A,32-5,A | ||
| 420 | or A,T2,A | ||
| 421 | add A,B,A | ||
| 422 | |||
| 423 | xor A,B,T1 != | ||
| 424 | sethi %hi(0x02441453),T2 | ||
| 425 | and T1,C,T1 | ||
| 426 | or T2,%lo(0x02441453),T2 | ||
| 427 | xor T1,B,T1 != | ||
| 428 | add T1,R10,T1 | ||
| 429 | LOAD X(15),RX | ||
| 430 | add T1,T2,T1 | ||
| 431 | add D,T1,D != | ||
| 432 | sll D,9,T2 | ||
| 433 | srl D,32-9,D | ||
| 434 | or D,T2,D | ||
| 435 | add D,A,D != | ||
| 436 | |||
| 437 | xor D,A,T1 | ||
| 438 | sethi %hi(0xd8a1e681),T2 | ||
| 439 | and T1,B,T1 | ||
| 440 | or T2,%lo(0xd8a1e681),T2 != | ||
| 441 | xor T1,A,T1 | ||
| 442 | add T1,RX,T1 | ||
| 443 | !pre-LOADed X(4),R4 | ||
| 444 | add T1,T2,T1 | ||
| 445 | add C,T1,C != | ||
| 446 | sll C,14,T2 | ||
| 447 | srl C,32-14,C | ||
| 448 | or C,T2,C | ||
| 449 | add C,D,C != | ||
| 450 | |||
| 451 | xor C,D,T1 | ||
| 452 | sethi %hi(0xe7d3fbc8),T2 | ||
| 453 | and T1,A,T1 | ||
| 454 | or T2,%lo(0xe7d3fbc8),T2 != | ||
| 455 | xor T1,D,T1 | ||
| 456 | add T1,R4,T1 | ||
| 457 | !pre-LOADed X(9),R9 | ||
| 458 | add T1,T2,T1 | ||
| 459 | add B,T1,B != | ||
| 460 | sll B,20,T2 | ||
| 461 | srl B,32-20,B | ||
| 462 | or B,T2,B | ||
| 463 | add B,C,B != | ||
| 464 | |||
| 465 | xor B,C,T1 | ||
| 466 | sethi %hi(0x21e1cde6),T2 | ||
| 467 | and T1,D,T1 | ||
| 468 | or T2,%lo(0x21e1cde6),T2 != | ||
| 469 | xor T1,C,T1 | ||
| 470 | add T1,R9,T1 | ||
| 471 | LOAD X(14),RX | ||
| 472 | add T1,T2,T1 != | ||
| 473 | add A,T1,A | ||
| 474 | sll A,5,T2 | ||
| 475 | srl A,32-5,A | ||
| 476 | or A,T2,A != | ||
| 477 | add A,B,A | ||
| 478 | |||
| 479 | xor A,B,T1 | ||
| 480 | sethi %hi(0xc33707d6),T2 | ||
| 481 | and T1,C,T1 != | ||
| 482 | or T2,%lo(0xc33707d6),T2 | ||
| 483 | xor T1,B,T1 | ||
| 484 | add T1,RX,T1 | ||
| 485 | !pre-LOADed X(3),R3 | ||
| 486 | add T1,T2,T1 != | ||
| 487 | add D,T1,D | ||
| 488 | sll D,9,T2 | ||
| 489 | srl D,32-9,D | ||
| 490 | or D,T2,D != | ||
| 491 | add D,A,D | ||
| 492 | |||
| 493 | xor D,A,T1 | ||
| 494 | sethi %hi(0xf4d50d87),T2 | ||
| 495 | and T1,B,T1 != | ||
| 496 | or T2,%lo(0xf4d50d87),T2 | ||
| 497 | xor T1,A,T1 | ||
| 498 | add T1,R3,T1 | ||
| 499 | !pre-LOADed X(8),R8 | ||
| 500 | add T1,T2,T1 != | ||
| 501 | add C,T1,C | ||
| 502 | sll C,14,T2 | ||
| 503 | srl C,32-14,C | ||
| 504 | or C,T2,C != | ||
| 505 | add C,D,C | ||
| 506 | |||
| 507 | xor C,D,T1 | ||
| 508 | sethi %hi(0x455a14ed),T2 | ||
| 509 | and T1,A,T1 != | ||
| 510 | or T2,%lo(0x455a14ed),T2 | ||
| 511 | xor T1,D,T1 | ||
| 512 | add T1,R8,T1 | ||
| 513 | !pre-LOADed X(13),R13 | ||
| 514 | add T1,T2,T1 != | ||
| 515 | add B,T1,B | ||
| 516 | sll B,20,T2 | ||
| 517 | srl B,32-20,B | ||
| 518 | or B,T2,B != | ||
| 519 | add B,C,B | ||
| 520 | |||
| 521 | xor B,C,T1 | ||
| 522 | sethi %hi(0xa9e3e905),T2 | ||
| 523 | and T1,D,T1 != | ||
| 524 | or T2,%lo(0xa9e3e905),T2 | ||
| 525 | xor T1,C,T1 | ||
| 526 | add T1,R13,T1 | ||
| 527 | !pre-LOADed X(2),R2 | ||
| 528 | add T1,T2,T1 != | ||
| 529 | add A,T1,A | ||
| 530 | sll A,5,T2 | ||
| 531 | srl A,32-5,A | ||
| 532 | or A,T2,A != | ||
| 533 | add A,B,A | ||
| 534 | |||
| 535 | xor A,B,T1 | ||
| 536 | sethi %hi(0xfcefa3f8),T2 | ||
| 537 | and T1,C,T1 != | ||
| 538 | or T2,%lo(0xfcefa3f8),T2 | ||
| 539 | xor T1,B,T1 | ||
| 540 | add T1,R2,T1 | ||
| 541 | !pre-LOADed X(7),R7 | ||
| 542 | add T1,T2,T1 != | ||
| 543 | add D,T1,D | ||
| 544 | sll D,9,T2 | ||
| 545 | srl D,32-9,D | ||
| 546 | or D,T2,D != | ||
| 547 | add D,A,D | ||
| 548 | |||
| 549 | xor D,A,T1 | ||
| 550 | sethi %hi(0x676f02d9),T2 | ||
| 551 | and T1,B,T1 != | ||
| 552 | or T2,%lo(0x676f02d9),T2 | ||
| 553 | xor T1,A,T1 | ||
| 554 | add T1,R7,T1 | ||
| 555 | !pre-LOADed X(12),R12 | ||
| 556 | add T1,T2,T1 != | ||
| 557 | add C,T1,C | ||
| 558 | sll C,14,T2 | ||
| 559 | srl C,32-14,C | ||
| 560 | or C,T2,C != | ||
| 561 | add C,D,C | ||
| 562 | |||
| 563 | xor C,D,T1 | ||
| 564 | sethi %hi(0x8d2a4c8a),T2 | ||
| 565 | and T1,A,T1 != | ||
| 566 | or T2,%lo(0x8d2a4c8a),T2 | ||
| 567 | xor T1,D,T1 | ||
| 568 | add T1,R12,T1 | ||
| 569 | !pre-LOADed X(5),R5 | ||
| 570 | add T1,T2,T1 != | ||
| 571 | add B,T1,B | ||
| 572 | sll B,20,T2 | ||
| 573 | srl B,32-20,B | ||
| 574 | or B,T2,B != | ||
| 575 | add B,C,B | ||
| 576 | |||
| 577 | !!!!!!!!Round 2 | ||
| 578 | |||
| 579 | xor B,C,T1 | ||
| 580 | sethi %hi(0xfffa3942),T2 | ||
| 581 | xor T1,D,T1 != | ||
| 582 | or T2,%lo(0xfffa3942),T2 | ||
| 583 | add T1,R5,T1 | ||
| 584 | !pre-LOADed X(8),R8 | ||
| 585 | add T1,T2,T1 | ||
| 586 | add A,T1,A != | ||
| 587 | sll A,4,T2 | ||
| 588 | srl A,32-4,A | ||
| 589 | or A,T2,A | ||
| 590 | add A,B,A != | ||
| 591 | |||
| 592 | xor A,B,T1 | ||
| 593 | sethi %hi(0x8771f681),T2 | ||
| 594 | xor T1,C,T1 | ||
| 595 | or T2,%lo(0x8771f681),T2 != | ||
| 596 | add T1,R8,T1 | ||
| 597 | !pre-LOADed X(11),R11 | ||
| 598 | add T1,T2,T1 | ||
| 599 | add D,T1,D | ||
| 600 | sll D,11,T2 != | ||
| 601 | srl D,32-11,D | ||
| 602 | or D,T2,D | ||
| 603 | add D,A,D | ||
| 604 | |||
| 605 | xor D,A,T1 != | ||
| 606 | sethi %hi(0x6d9d6122),T2 | ||
| 607 | xor T1,B,T1 | ||
| 608 | or T2,%lo(0x6d9d6122),T2 | ||
| 609 | add T1,R11,T1 != | ||
| 610 | LOAD X(14),RX | ||
| 611 | add T1,T2,T1 | ||
| 612 | add C,T1,C | ||
| 613 | sll C,16,T2 != | ||
| 614 | srl C,32-16,C | ||
| 615 | or C,T2,C | ||
| 616 | add C,D,C | ||
| 617 | |||
| 618 | xor C,D,T1 != | ||
| 619 | sethi %hi(0xfde5380c),T2 | ||
| 620 | xor T1,A,T1 | ||
| 621 | or T2,%lo(0xfde5380c),T2 | ||
| 622 | add T1,RX,T1 != | ||
| 623 | !pre-LOADed X(1),R1 | ||
| 624 | add T1,T2,T1 | ||
| 625 | add B,T1,B | ||
| 626 | sll B,23,T2 | ||
| 627 | srl B,32-23,B != | ||
| 628 | or B,T2,B | ||
| 629 | add B,C,B | ||
| 630 | |||
| 631 | xor B,C,T1 | ||
| 632 | sethi %hi(0xa4beea44),T2 != | ||
| 633 | xor T1,D,T1 | ||
| 634 | or T2,%lo(0xa4beea44),T2 | ||
| 635 | add T1,R1,T1 | ||
| 636 | !pre-LOADed X(4),R4 | ||
| 637 | add T1,T2,T1 != | ||
| 638 | add A,T1,A | ||
| 639 | sll A,4,T2 | ||
| 640 | srl A,32-4,A | ||
| 641 | or A,T2,A != | ||
| 642 | add A,B,A | ||
| 643 | |||
| 644 | xor A,B,T1 | ||
| 645 | sethi %hi(0x4bdecfa9),T2 | ||
| 646 | xor T1,C,T1 != | ||
| 647 | or T2,%lo(0x4bdecfa9),T2 | ||
| 648 | add T1,R4,T1 | ||
| 649 | !pre-LOADed X(7),R7 | ||
| 650 | add T1,T2,T1 | ||
| 651 | add D,T1,D != | ||
| 652 | sll D,11,T2 | ||
| 653 | srl D,32-11,D | ||
| 654 | or D,T2,D | ||
| 655 | add D,A,D != | ||
| 656 | |||
| 657 | xor D,A,T1 | ||
| 658 | sethi %hi(0xf6bb4b60),T2 | ||
| 659 | xor T1,B,T1 | ||
| 660 | or T2,%lo(0xf6bb4b60),T2 != | ||
| 661 | add T1,R7,T1 | ||
| 662 | !pre-LOADed X(10),R10 | ||
| 663 | add T1,T2,T1 | ||
| 664 | add C,T1,C | ||
| 665 | sll C,16,T2 != | ||
| 666 | srl C,32-16,C | ||
| 667 | or C,T2,C | ||
| 668 | add C,D,C | ||
| 669 | |||
| 670 | xor C,D,T1 != | ||
| 671 | sethi %hi(0xbebfbc70),T2 | ||
| 672 | xor T1,A,T1 | ||
| 673 | or T2,%lo(0xbebfbc70),T2 | ||
| 674 | add T1,R10,T1 != | ||
| 675 | !pre-LOADed X(13),R13 | ||
| 676 | add T1,T2,T1 | ||
| 677 | add B,T1,B | ||
| 678 | sll B,23,T2 | ||
| 679 | srl B,32-23,B != | ||
| 680 | or B,T2,B | ||
| 681 | add B,C,B | ||
| 682 | |||
| 683 | xor B,C,T1 | ||
| 684 | sethi %hi(0x289b7ec6),T2 != | ||
| 685 | xor T1,D,T1 | ||
| 686 | or T2,%lo(0x289b7ec6),T2 | ||
| 687 | add T1,R13,T1 | ||
| 688 | !pre-LOADed X(0),R0 | ||
| 689 | add T1,T2,T1 != | ||
| 690 | add A,T1,A | ||
| 691 | sll A,4,T2 | ||
| 692 | srl A,32-4,A | ||
| 693 | or A,T2,A != | ||
| 694 | add A,B,A | ||
| 695 | |||
| 696 | xor A,B,T1 | ||
| 697 | sethi %hi(0xeaa127fa),T2 | ||
| 698 | xor T1,C,T1 != | ||
| 699 | or T2,%lo(0xeaa127fa),T2 | ||
| 700 | add T1,R0,T1 | ||
| 701 | !pre-LOADed X(3),R3 | ||
| 702 | add T1,T2,T1 | ||
| 703 | add D,T1,D != | ||
| 704 | sll D,11,T2 | ||
| 705 | srl D,32-11,D | ||
| 706 | or D,T2,D | ||
| 707 | add D,A,D != | ||
| 708 | |||
| 709 | xor D,A,T1 | ||
| 710 | sethi %hi(0xd4ef3085),T2 | ||
| 711 | xor T1,B,T1 | ||
| 712 | or T2,%lo(0xd4ef3085),T2 != | ||
| 713 | add T1,R3,T1 | ||
| 714 | !pre-LOADed X(6),R6 | ||
| 715 | add T1,T2,T1 | ||
| 716 | add C,T1,C | ||
| 717 | sll C,16,T2 != | ||
| 718 | srl C,32-16,C | ||
| 719 | or C,T2,C | ||
| 720 | add C,D,C | ||
| 721 | |||
| 722 | xor C,D,T1 != | ||
| 723 | sethi %hi(0x04881d05),T2 | ||
| 724 | xor T1,A,T1 | ||
| 725 | or T2,%lo(0x04881d05),T2 | ||
| 726 | add T1,R6,T1 != | ||
| 727 | !pre-LOADed X(9),R9 | ||
| 728 | add T1,T2,T1 | ||
| 729 | add B,T1,B | ||
| 730 | sll B,23,T2 | ||
| 731 | srl B,32-23,B != | ||
| 732 | or B,T2,B | ||
| 733 | add B,C,B | ||
| 734 | |||
| 735 | xor B,C,T1 | ||
| 736 | sethi %hi(0xd9d4d039),T2 != | ||
| 737 | xor T1,D,T1 | ||
| 738 | or T2,%lo(0xd9d4d039),T2 | ||
| 739 | add T1,R9,T1 | ||
| 740 | !pre-LOADed X(12),R12 | ||
| 741 | add T1,T2,T1 != | ||
| 742 | add A,T1,A | ||
| 743 | sll A,4,T2 | ||
| 744 | srl A,32-4,A | ||
| 745 | or A,T2,A != | ||
| 746 | add A,B,A | ||
| 747 | |||
| 748 | xor A,B,T1 | ||
| 749 | sethi %hi(0xe6db99e5),T2 | ||
| 750 | xor T1,C,T1 != | ||
| 751 | or T2,%lo(0xe6db99e5),T2 | ||
| 752 | add T1,R12,T1 | ||
| 753 | LOAD X(15),RX | ||
| 754 | add T1,T2,T1 != | ||
| 755 | add D,T1,D | ||
| 756 | sll D,11,T2 | ||
| 757 | srl D,32-11,D | ||
| 758 | or D,T2,D != | ||
| 759 | add D,A,D | ||
| 760 | |||
| 761 | xor D,A,T1 | ||
| 762 | sethi %hi(0x1fa27cf8),T2 | ||
| 763 | xor T1,B,T1 != | ||
| 764 | or T2,%lo(0x1fa27cf8),T2 | ||
| 765 | add T1,RX,T1 | ||
| 766 | !pre-LOADed X(2),R2 | ||
| 767 | add T1,T2,T1 | ||
| 768 | add C,T1,C != | ||
| 769 | sll C,16,T2 | ||
| 770 | srl C,32-16,C | ||
| 771 | or C,T2,C | ||
| 772 | add C,D,C != | ||
| 773 | |||
| 774 | xor C,D,T1 | ||
| 775 | sethi %hi(0xc4ac5665),T2 | ||
| 776 | xor T1,A,T1 | ||
| 777 | or T2,%lo(0xc4ac5665),T2 != | ||
| 778 | add T1,R2,T1 | ||
| 779 | !pre-LOADed X(0),R0 | ||
| 780 | add T1,T2,T1 | ||
| 781 | add B,T1,B | ||
| 782 | sll B,23,T2 != | ||
| 783 | srl B,32-23,B | ||
| 784 | or B,T2,B | ||
| 785 | add B,C,B | ||
| 786 | |||
| 787 | !!!!!!!!Round 3 | ||
| 788 | |||
| 789 | orn B,D,T1 != | ||
| 790 | sethi %hi(0xf4292244),T2 | ||
| 791 | xor T1,C,T1 | ||
| 792 | or T2,%lo(0xf4292244),T2 | ||
| 793 | add T1,R0,T1 != | ||
| 794 | !pre-LOADed X(7),R7 | ||
| 795 | add T1,T2,T1 | ||
| 796 | add A,T1,A | ||
| 797 | sll A,6,T2 | ||
| 798 | srl A,32-6,A != | ||
| 799 | or A,T2,A | ||
| 800 | add A,B,A | ||
| 801 | |||
| 802 | orn A,C,T1 | ||
| 803 | sethi %hi(0x432aff97),T2 != | ||
| 804 | xor T1,B,T1 | ||
| 805 | or T2,%lo(0x432aff97),T2 | ||
| 806 | LOAD X(14),RX | ||
| 807 | add T1,R7,T1 != | ||
| 808 | add T1,T2,T1 | ||
| 809 | add D,T1,D | ||
| 810 | sll D,10,T2 | ||
| 811 | srl D,32-10,D != | ||
| 812 | or D,T2,D | ||
| 813 | add D,A,D | ||
| 814 | |||
| 815 | orn D,B,T1 | ||
| 816 | sethi %hi(0xab9423a7),T2 != | ||
| 817 | xor T1,A,T1 | ||
| 818 | or T2,%lo(0xab9423a7),T2 | ||
| 819 | add T1,RX,T1 | ||
| 820 | !pre-LOADed X(5),R5 | ||
| 821 | add T1,T2,T1 != | ||
| 822 | add C,T1,C | ||
| 823 | sll C,15,T2 | ||
| 824 | srl C,32-15,C | ||
| 825 | or C,T2,C != | ||
| 826 | add C,D,C | ||
| 827 | |||
| 828 | orn C,A,T1 | ||
| 829 | sethi %hi(0xfc93a039),T2 | ||
| 830 | xor T1,D,T1 != | ||
| 831 | or T2,%lo(0xfc93a039),T2 | ||
| 832 | add T1,R5,T1 | ||
| 833 | !pre-LOADed X(12),R12 | ||
| 834 | add T1,T2,T1 | ||
| 835 | add B,T1,B != | ||
| 836 | sll B,21,T2 | ||
| 837 | srl B,32-21,B | ||
| 838 | or B,T2,B | ||
| 839 | add B,C,B != | ||
| 840 | |||
| 841 | orn B,D,T1 | ||
| 842 | sethi %hi(0x655b59c3),T2 | ||
| 843 | xor T1,C,T1 | ||
| 844 | or T2,%lo(0x655b59c3),T2 != | ||
| 845 | add T1,R12,T1 | ||
| 846 | !pre-LOADed X(3),R3 | ||
| 847 | add T1,T2,T1 | ||
| 848 | add A,T1,A | ||
| 849 | sll A,6,T2 != | ||
| 850 | srl A,32-6,A | ||
| 851 | or A,T2,A | ||
| 852 | add A,B,A | ||
| 853 | |||
| 854 | orn A,C,T1 != | ||
| 855 | sethi %hi(0x8f0ccc92),T2 | ||
| 856 | xor T1,B,T1 | ||
| 857 | or T2,%lo(0x8f0ccc92),T2 | ||
| 858 | add T1,R3,T1 != | ||
| 859 | !pre-LOADed X(10),R10 | ||
| 860 | add T1,T2,T1 | ||
| 861 | add D,T1,D | ||
| 862 | sll D,10,T2 | ||
| 863 | srl D,32-10,D != | ||
| 864 | or D,T2,D | ||
| 865 | add D,A,D | ||
| 866 | |||
| 867 | orn D,B,T1 | ||
| 868 | sethi %hi(0xffeff47d),T2 != | ||
| 869 | xor T1,A,T1 | ||
| 870 | or T2,%lo(0xffeff47d),T2 | ||
| 871 | add T1,R10,T1 | ||
| 872 | !pre-LOADed X(1),R1 | ||
| 873 | add T1,T2,T1 != | ||
| 874 | add C,T1,C | ||
| 875 | sll C,15,T2 | ||
| 876 | srl C,32-15,C | ||
| 877 | or C,T2,C != | ||
| 878 | add C,D,C | ||
| 879 | |||
| 880 | orn C,A,T1 | ||
| 881 | sethi %hi(0x85845dd1),T2 | ||
| 882 | xor T1,D,T1 != | ||
| 883 | or T2,%lo(0x85845dd1),T2 | ||
| 884 | add T1,R1,T1 | ||
| 885 | !pre-LOADed X(8),R8 | ||
| 886 | add T1,T2,T1 | ||
| 887 | add B,T1,B != | ||
| 888 | sll B,21,T2 | ||
| 889 | srl B,32-21,B | ||
| 890 | or B,T2,B | ||
| 891 | add B,C,B != | ||
| 892 | |||
| 893 | orn B,D,T1 | ||
| 894 | sethi %hi(0x6fa87e4f),T2 | ||
| 895 | xor T1,C,T1 | ||
| 896 | or T2,%lo(0x6fa87e4f),T2 != | ||
| 897 | add T1,R8,T1 | ||
| 898 | LOAD X(15),RX | ||
| 899 | add T1,T2,T1 | ||
| 900 | add A,T1,A != | ||
| 901 | sll A,6,T2 | ||
| 902 | srl A,32-6,A | ||
| 903 | or A,T2,A | ||
| 904 | add A,B,A != | ||
| 905 | |||
| 906 | orn A,C,T1 | ||
| 907 | sethi %hi(0xfe2ce6e0),T2 | ||
| 908 | xor T1,B,T1 | ||
| 909 | or T2,%lo(0xfe2ce6e0),T2 != | ||
| 910 | add T1,RX,T1 | ||
| 911 | !pre-LOADed X(6),R6 | ||
| 912 | add T1,T2,T1 | ||
| 913 | add D,T1,D | ||
| 914 | sll D,10,T2 != | ||
| 915 | srl D,32-10,D | ||
| 916 | or D,T2,D | ||
| 917 | add D,A,D | ||
| 918 | |||
| 919 | orn D,B,T1 != | ||
| 920 | sethi %hi(0xa3014314),T2 | ||
| 921 | xor T1,A,T1 | ||
| 922 | or T2,%lo(0xa3014314),T2 | ||
| 923 | add T1,R6,T1 != | ||
| 924 | !pre-LOADed X(13),R13 | ||
| 925 | add T1,T2,T1 | ||
| 926 | add C,T1,C | ||
| 927 | sll C,15,T2 | ||
| 928 | srl C,32-15,C != | ||
| 929 | or C,T2,C | ||
| 930 | add C,D,C | ||
| 931 | |||
| 932 | orn C,A,T1 | ||
| 933 | sethi %hi(0x4e0811a1),T2 != | ||
| 934 | xor T1,D,T1 | ||
| 935 | or T2,%lo(0x4e0811a1),T2 | ||
| 936 | !pre-LOADed X(4),R4 | ||
| 937 | ld [Aptr],Aval | ||
| 938 | add T1,R13,T1 != | ||
| 939 | add T1,T2,T1 | ||
| 940 | add B,T1,B | ||
| 941 | sll B,21,T2 | ||
| 942 | srl B,32-21,B != | ||
| 943 | or B,T2,B | ||
| 944 | add B,C,B | ||
| 945 | |||
| 946 | orn B,D,T1 | ||
| 947 | sethi %hi(0xf7537e82),T2 != | ||
| 948 | xor T1,C,T1 | ||
| 949 | or T2,%lo(0xf7537e82),T2 | ||
| 950 | !pre-LOADed X(11),R11 | ||
| 951 | ld [Dptr],Dval | ||
| 952 | add T1,R4,T1 != | ||
| 953 | add T1,T2,T1 | ||
| 954 | add A,T1,A | ||
| 955 | sll A,6,T2 | ||
| 956 | srl A,32-6,A != | ||
| 957 | or A,T2,A | ||
| 958 | add A,B,A | ||
| 959 | |||
| 960 | orn A,C,T1 | ||
| 961 | sethi %hi(0xbd3af235),T2 != | ||
| 962 | xor T1,B,T1 | ||
| 963 | or T2,%lo(0xbd3af235),T2 | ||
| 964 | !pre-LOADed X(2),R2 | ||
| 965 | ld [Cptr],Cval | ||
| 966 | add T1,R11,T1 != | ||
| 967 | add T1,T2,T1 | ||
| 968 | add D,T1,D | ||
| 969 | sll D,10,T2 | ||
| 970 | srl D,32-10,D != | ||
| 971 | or D,T2,D | ||
| 972 | add D,A,D | ||
| 973 | |||
| 974 | orn D,B,T1 | ||
| 975 | sethi %hi(0x2ad7d2bb),T2 != | ||
| 976 | xor T1,A,T1 | ||
| 977 | or T2,%lo(0x2ad7d2bb),T2 | ||
| 978 | !pre-LOADed X(9),R9 | ||
| 979 | ld [Bptr],Bval | ||
| 980 | add T1,R2,T1 != | ||
| 981 | add Aval,A,Aval | ||
| 982 | add T1,T2,T1 | ||
| 983 | st Aval,[Aptr] | ||
| 984 | add C,T1,C != | ||
| 985 | sll C,15,T2 | ||
| 986 | add Dval,D,Dval | ||
| 987 | srl C,32-15,C | ||
| 988 | or C,T2,C != | ||
| 989 | st Dval,[Dptr] | ||
| 990 | add C,D,C | ||
| 991 | |||
| 992 | orn C,A,T1 | ||
| 993 | sethi %hi(0xeb86d391),T2 != | ||
| 994 | xor T1,D,T1 | ||
| 995 | or T2,%lo(0xeb86d391),T2 | ||
| 996 | add T1,R9,T1 | ||
| 997 | !pre-LOADed X(0),R0 | ||
| 998 | mov Aval,A != | ||
| 999 | add T1,T2,T1 | ||
| 1000 | mov Dval,D | ||
| 1001 | add B,T1,B | ||
| 1002 | sll B,21,T2 != | ||
| 1003 | add Cval,C,Cval | ||
| 1004 | srl B,32-21,B | ||
| 1005 | st Cval,[Cptr] | ||
| 1006 | or B,T2,B != | ||
| 1007 | add B,C,B | ||
| 1008 | |||
| 1009 | deccc %i2 | ||
| 1010 | mov Cval,C | ||
| 1011 | add B,Bval,B != | ||
| 1012 | inc 64,%i1 | ||
| 1013 | nop | ||
| 1014 | st B,[Bptr] | ||
| 1015 | nop != | ||
| 1016 | |||
| 1017 | #ifdef OPENSSL_SYSNAME_ULTRASPARC | ||
| 1018 | bg,a,pt %icc,.Lmd5_block_loop | ||
| 1019 | #else | ||
| 1020 | bg,a .Lmd5_block_loop | ||
| 1021 | #endif | ||
| 1022 | LOAD X(0),R0 | ||
| 1023 | |||
| 1024 | #ifdef ASI_PRIMARY_LITTLE | ||
| 1025 | wr %g0,%o7,%asi | ||
| 1026 | #endif | ||
| 1027 | ret | ||
| 1028 | restore %g0,0,%o0 | ||
| 1029 | |||
| 1030 | .type md5_block,#function | ||
| 1031 | .size md5_block,(.-md5_block) | ||
diff --git a/src/lib/libcrypto/md5/md5.h b/src/lib/libcrypto/md5/md5.h index 0761f84a27..4cbf84386b 100644 --- a/src/lib/libcrypto/md5/md5.h +++ b/src/lib/libcrypto/md5/md5.h | |||
| @@ -77,7 +77,7 @@ extern "C" { | |||
| 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 78 | */ | 78 | */ |
| 79 | 79 | ||
| 80 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | 80 | #if defined(__LP32__) |
| 81 | #define MD5_LONG unsigned long | 81 | #define MD5_LONG unsigned long |
| 82 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | 82 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) |
| 83 | #define MD5_LONG unsigned long | 83 | #define MD5_LONG unsigned long |
| @@ -105,9 +105,6 @@ typedef struct MD5state_st | |||
| 105 | unsigned int num; | 105 | unsigned int num; |
| 106 | } MD5_CTX; | 106 | } MD5_CTX; |
| 107 | 107 | ||
| 108 | #ifdef OPENSSL_FIPS | ||
| 109 | int private_MD5_Init(MD5_CTX *c); | ||
| 110 | #endif | ||
| 111 | int MD5_Init(MD5_CTX *c); | 108 | int MD5_Init(MD5_CTX *c); |
| 112 | int MD5_Update(MD5_CTX *c, const void *data, size_t len); | 109 | int MD5_Update(MD5_CTX *c, const void *data, size_t len); |
| 113 | int MD5_Final(unsigned char *md, MD5_CTX *c); | 110 | int MD5_Final(unsigned char *md, MD5_CTX *c); |
diff --git a/src/lib/libcrypto/md5/md5_dgst.c b/src/lib/libcrypto/md5/md5_dgst.c index 47bb9020ee..beace632e3 100644 --- a/src/lib/libcrypto/md5/md5_dgst.c +++ b/src/lib/libcrypto/md5/md5_dgst.c | |||
| @@ -59,11 +59,6 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "md5_locl.h" | 60 | #include "md5_locl.h" |
| 61 | #include <openssl/opensslv.h> | 61 | #include <openssl/opensslv.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #ifdef OPENSSL_FIPS | ||
| 64 | #include <openssl/fips.h> | ||
| 65 | #endif | ||
| 66 | |||
| 67 | 62 | ||
| 68 | const char MD5_version[]="MD5" OPENSSL_VERSION_PTEXT; | 63 | const char MD5_version[]="MD5" OPENSSL_VERSION_PTEXT; |
| 69 | 64 | ||
| @@ -75,15 +70,13 @@ const char MD5_version[]="MD5" OPENSSL_VERSION_PTEXT; | |||
| 75 | #define INIT_DATA_C (unsigned long)0x98badcfeL | 70 | #define INIT_DATA_C (unsigned long)0x98badcfeL |
| 76 | #define INIT_DATA_D (unsigned long)0x10325476L | 71 | #define INIT_DATA_D (unsigned long)0x10325476L |
| 77 | 72 | ||
| 78 | FIPS_NON_FIPS_MD_Init(MD5) | 73 | int MD5_Init(MD5_CTX *c) |
| 79 | { | 74 | { |
| 75 | memset (c,0,sizeof(*c)); | ||
| 80 | c->A=INIT_DATA_A; | 76 | c->A=INIT_DATA_A; |
| 81 | c->B=INIT_DATA_B; | 77 | c->B=INIT_DATA_B; |
| 82 | c->C=INIT_DATA_C; | 78 | c->C=INIT_DATA_C; |
| 83 | c->D=INIT_DATA_D; | 79 | c->D=INIT_DATA_D; |
| 84 | c->Nl=0; | ||
| 85 | c->Nh=0; | ||
| 86 | c->num=0; | ||
| 87 | return 1; | 80 | return 1; |
| 88 | } | 81 | } |
| 89 | 82 | ||
diff --git a/src/lib/libcrypto/md5/md5_locl.h b/src/lib/libcrypto/md5/md5_locl.h index 84e81b960d..968d577995 100644 --- a/src/lib/libcrypto/md5/md5_locl.h +++ b/src/lib/libcrypto/md5/md5_locl.h | |||
| @@ -69,6 +69,8 @@ | |||
| 69 | # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) || \ | 69 | # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) || \ |
| 70 | defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64) | 70 | defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64) |
| 71 | # define md5_block_data_order md5_block_asm_data_order | 71 | # define md5_block_data_order md5_block_asm_data_order |
| 72 | # elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) | ||
| 73 | # define md5_block_data_order md5_block_asm_data_order | ||
| 72 | # endif | 74 | # endif |
| 73 | #endif | 75 | #endif |
| 74 | 76 | ||
diff --git a/src/lib/libcrypto/mdc2/Makefile b/src/lib/libcrypto/mdc2/Makefile index ea25688d88..1d064f17a6 100644 --- a/src/lib/libcrypto/mdc2/Makefile +++ b/src/lib/libcrypto/mdc2/Makefile | |||
| @@ -33,7 +33,7 @@ top: | |||
| 33 | all: lib | 33 | all: lib |
| 34 | 34 | ||
| 35 | lib: $(LIBOBJ) | 35 | lib: $(LIBOBJ) |
| 36 | $(ARX) $(LIB) $(LIBOBJ) | 36 | $(AR) $(LIB) $(LIBOBJ) |
| 37 | $(RANLIB) $(LIB) || echo Never mind. | 37 | $(RANLIB) $(LIB) || echo Never mind. |
| 38 | @touch lib | 38 | @touch lib |
| 39 | 39 | ||
diff --git a/src/lib/libcrypto/mdc2/Makefile.ssl b/src/lib/libcrypto/mdc2/Makefile.ssl deleted file mode 100644 index 33f366fb08..0000000000 --- a/src/lib/libcrypto/mdc2/Makefile.ssl +++ /dev/null | |||
| @@ -1,98 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/mdc2/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= mdc2 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= mdc2test.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=mdc2dgst.c mdc2_one.c | ||
| 27 | LIBOBJ=mdc2dgst.o mdc2_one.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= mdc2.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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | mdc2_one.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 83 | mdc2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 84 | mdc2_one.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 85 | mdc2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 86 | mdc2_one.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h | ||
| 87 | mdc2_one.o: ../../include/openssl/opensslconf.h | ||
| 88 | mdc2_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 89 | mdc2_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 90 | mdc2_one.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 91 | mdc2_one.o: ../cryptlib.h mdc2_one.c | ||
| 92 | mdc2dgst.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 93 | mdc2dgst.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 94 | mdc2dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/opensslconf.h | ||
| 95 | mdc2dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 96 | mdc2dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 97 | mdc2dgst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 98 | mdc2dgst.o: mdc2dgst.c | ||
diff --git a/src/lib/libcrypto/mdc2/mdc2.h b/src/lib/libcrypto/mdc2/mdc2.h index 7e1354116a..72778a5212 100644 --- a/src/lib/libcrypto/mdc2/mdc2.h +++ b/src/lib/libcrypto/mdc2/mdc2.h | |||
| @@ -80,9 +80,7 @@ typedef struct mdc2_ctx_st | |||
| 80 | int pad_type; /* either 1 or 2, default 1 */ | 80 | int pad_type; /* either 1 or 2, default 1 */ |
| 81 | } MDC2_CTX; | 81 | } MDC2_CTX; |
| 82 | 82 | ||
| 83 | #ifdef OPENSSL_FIPS | 83 | |
| 84 | int private_MDC2_Init(MDC2_CTX *c); | ||
| 85 | #endif | ||
| 86 | int MDC2_Init(MDC2_CTX *c); | 84 | int MDC2_Init(MDC2_CTX *c); |
| 87 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); | 85 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); |
| 88 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); | 86 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); |
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c index 00ebaf0b9b..8f06d190a1 100644 --- a/src/lib/libcrypto/mem.c +++ b/src/lib/libcrypto/mem.c | |||
| @@ -101,7 +101,7 @@ static void (*free_locked_func)(void *) = free; | |||
| 101 | 101 | ||
| 102 | /* may be changed as long as 'allow_customize_debug' is set */ | 102 | /* may be changed as long as 'allow_customize_debug' is set */ |
| 103 | /* XXX use correct function pointer types */ | 103 | /* XXX use correct function pointer types */ |
| 104 | #if defined(CRYPTO_MDEBUG) && !defined(OPENSSL_FIPS) | 104 | #ifdef CRYPTO_MDEBUG |
| 105 | /* use default functions from mem_dbg.c */ | 105 | /* use default functions from mem_dbg.c */ |
| 106 | static void (*malloc_debug_func)(void *,int,const char *,int,int) | 106 | static void (*malloc_debug_func)(void *,int,const char *,int,int) |
| 107 | = CRYPTO_dbg_malloc; | 107 | = CRYPTO_dbg_malloc; |
| @@ -110,14 +110,6 @@ static void (*realloc_debug_func)(void *,void *,int,const char *,int,int) | |||
| 110 | static void (*free_debug_func)(void *,int) = CRYPTO_dbg_free; | 110 | static void (*free_debug_func)(void *,int) = CRYPTO_dbg_free; |
| 111 | static void (*set_debug_options_func)(long) = CRYPTO_dbg_set_options; | 111 | static void (*set_debug_options_func)(long) = CRYPTO_dbg_set_options; |
| 112 | static long (*get_debug_options_func)(void) = CRYPTO_dbg_get_options; | 112 | static long (*get_debug_options_func)(void) = CRYPTO_dbg_get_options; |
| 113 | |||
| 114 | static int (*push_info_func)(const char *info, const char *file, int line) | ||
| 115 | = CRYPTO_dbg_push_info; | ||
| 116 | static int (*pop_info_func)(void) | ||
| 117 | = CRYPTO_dbg_pop_info; | ||
| 118 | static int (*remove_all_info_func)(void) | ||
| 119 | = CRYPTO_dbg_remove_all_info; | ||
| 120 | |||
| 121 | #else | 113 | #else |
| 122 | /* applications can use CRYPTO_malloc_debug_init() to select above case | 114 | /* applications can use CRYPTO_malloc_debug_init() to select above case |
| 123 | * at run-time */ | 115 | * at run-time */ |
| @@ -127,13 +119,6 @@ static void (*realloc_debug_func)(void *,void *,int,const char *,int,int) | |||
| 127 | static void (*free_debug_func)(void *,int) = NULL; | 119 | static void (*free_debug_func)(void *,int) = NULL; |
| 128 | static void (*set_debug_options_func)(long) = NULL; | 120 | static void (*set_debug_options_func)(long) = NULL; |
| 129 | static long (*get_debug_options_func)(void) = NULL; | 121 | static long (*get_debug_options_func)(void) = NULL; |
| 130 | |||
| 131 | |||
| 132 | static int (*push_info_func)(const char *info, const char *file, int line) | ||
| 133 | = NULL; | ||
| 134 | static int (*pop_info_func)(void) = NULL; | ||
| 135 | static int (*remove_all_info_func)(void) = NULL; | ||
| 136 | |||
| 137 | #endif | 122 | #endif |
| 138 | 123 | ||
| 139 | 124 | ||
| @@ -209,15 +194,6 @@ int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), | |||
| 209 | return 1; | 194 | return 1; |
| 210 | } | 195 | } |
| 211 | 196 | ||
| 212 | void CRYPTO_set_mem_info_functions( | ||
| 213 | int (*push_info_fn)(const char *info, const char *file, int line), | ||
| 214 | int (*pop_info_fn)(void), | ||
| 215 | int (*remove_all_info_fn)(void)) | ||
| 216 | { | ||
| 217 | push_info_func = push_info_fn; | ||
| 218 | pop_info_func = pop_info_fn; | ||
| 219 | remove_all_info_func = remove_all_info_fn; | ||
| 220 | } | ||
| 221 | 197 | ||
| 222 | void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t), | 198 | void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t), |
| 223 | void (**f)(void *)) | 199 | void (**f)(void *)) |
| @@ -274,7 +250,6 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), | |||
| 274 | void *CRYPTO_malloc_locked(int num, const char *file, int line) | 250 | void *CRYPTO_malloc_locked(int num, const char *file, int line) |
| 275 | { | 251 | { |
| 276 | void *ret = NULL; | 252 | void *ret = NULL; |
| 277 | extern unsigned char cleanse_ctr; | ||
| 278 | 253 | ||
| 279 | if (num <= 0) return NULL; | 254 | if (num <= 0) return NULL; |
| 280 | 255 | ||
| @@ -291,11 +266,15 @@ void *CRYPTO_malloc_locked(int num, const char *file, int line) | |||
| 291 | if (malloc_debug_func != NULL) | 266 | if (malloc_debug_func != NULL) |
| 292 | malloc_debug_func(ret, num, file, line, 1); | 267 | malloc_debug_func(ret, num, file, line, 1); |
| 293 | 268 | ||
| 269 | #ifndef OPENSSL_CPUID_OBJ | ||
| 294 | /* Create a dependency on the value of 'cleanse_ctr' so our memory | 270 | /* Create a dependency on the value of 'cleanse_ctr' so our memory |
| 295 | * sanitisation function can't be optimised out. NB: We only do | 271 | * sanitisation function can't be optimised out. NB: We only do |
| 296 | * this for >2Kb so the overhead doesn't bother us. */ | 272 | * this for >2Kb so the overhead doesn't bother us. */ |
| 297 | if(ret && (num > 2048)) | 273 | if(ret && (num > 2048)) |
| 274 | { extern unsigned char cleanse_ctr; | ||
| 298 | ((unsigned char *)ret)[0] = cleanse_ctr; | 275 | ((unsigned char *)ret)[0] = cleanse_ctr; |
| 276 | } | ||
| 277 | #endif | ||
| 299 | 278 | ||
| 300 | return ret; | 279 | return ret; |
| 301 | } | 280 | } |
| @@ -315,7 +294,6 @@ void CRYPTO_free_locked(void *str) | |||
| 315 | void *CRYPTO_malloc(int num, const char *file, int line) | 294 | void *CRYPTO_malloc(int num, const char *file, int line) |
| 316 | { | 295 | { |
| 317 | void *ret = NULL; | 296 | void *ret = NULL; |
| 318 | extern unsigned char cleanse_ctr; | ||
| 319 | 297 | ||
| 320 | if (num <= 0) return NULL; | 298 | if (num <= 0) return NULL; |
| 321 | 299 | ||
| @@ -332,12 +310,24 @@ void *CRYPTO_malloc(int num, const char *file, int line) | |||
| 332 | if (malloc_debug_func != NULL) | 310 | if (malloc_debug_func != NULL) |
| 333 | malloc_debug_func(ret, num, file, line, 1); | 311 | malloc_debug_func(ret, num, file, line, 1); |
| 334 | 312 | ||
| 313 | #ifndef OPENSSL_CPUID_OBJ | ||
| 335 | /* Create a dependency on the value of 'cleanse_ctr' so our memory | 314 | /* Create a dependency on the value of 'cleanse_ctr' so our memory |
| 336 | * sanitisation function can't be optimised out. NB: We only do | 315 | * sanitisation function can't be optimised out. NB: We only do |
| 337 | * this for >2Kb so the overhead doesn't bother us. */ | 316 | * this for >2Kb so the overhead doesn't bother us. */ |
| 338 | if(ret && (num > 2048)) | 317 | if(ret && (num > 2048)) |
| 318 | { extern unsigned char cleanse_ctr; | ||
| 339 | ((unsigned char *)ret)[0] = 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); | ||
| 340 | 329 | ||
| 330 | memcpy(ret, str, len); | ||
| 341 | return ret; | 331 | return ret; |
| 342 | } | 332 | } |
| 343 | 333 | ||
| @@ -423,24 +413,3 @@ long CRYPTO_get_mem_debug_options(void) | |||
| 423 | return get_debug_options_func(); | 413 | return get_debug_options_func(); |
| 424 | return 0; | 414 | return 0; |
| 425 | } | 415 | } |
| 426 | |||
| 427 | int CRYPTO_push_info_(const char *info, const char *file, int line) | ||
| 428 | { | ||
| 429 | if (push_info_func) | ||
| 430 | return push_info_func(info, file, line); | ||
| 431 | return 1; | ||
| 432 | } | ||
| 433 | |||
| 434 | int CRYPTO_pop_info(void) | ||
| 435 | { | ||
| 436 | if (pop_info_func) | ||
| 437 | return pop_info_func(); | ||
| 438 | return 1; | ||
| 439 | } | ||
| 440 | |||
| 441 | int CRYPTO_remove_all_info(void) | ||
| 442 | { | ||
| 443 | if (remove_all_info_func) | ||
| 444 | return remove_all_info_func(); | ||
| 445 | return 1; | ||
| 446 | } | ||
diff --git a/src/lib/libcrypto/mem_dbg.c b/src/lib/libcrypto/mem_dbg.c index c6dee9a92b..ac793397f1 100644 --- a/src/lib/libcrypto/mem_dbg.c +++ b/src/lib/libcrypto/mem_dbg.c | |||
| @@ -55,6 +55,59 @@ | |||
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 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 | */ | ||
| 58 | 111 | ||
| 59 | #include <stdio.h> | 112 | #include <stdio.h> |
| 60 | #include <stdlib.h> | 113 | #include <stdlib.h> |
| @@ -81,8 +134,11 @@ static int mh_mode=CRYPTO_MEM_CHECK_OFF; | |||
| 81 | */ | 134 | */ |
| 82 | 135 | ||
| 83 | static unsigned long order = 0; /* number of memory requests */ | 136 | static unsigned long order = 0; /* number of memory requests */ |
| 84 | static LHASH *mh=NULL; /* hash-table of memory requests (address as key); | 137 | |
| 85 | * access requires MALLOC2 lock */ | 138 | DECLARE_LHASH_OF(MEM); |
| 139 | static LHASH_OF(MEM) *mh=NULL; /* hash-table of memory requests | ||
| 140 | * (address as key); access requires | ||
| 141 | * MALLOC2 lock */ | ||
| 86 | 142 | ||
| 87 | 143 | ||
| 88 | typedef struct app_mem_info_st | 144 | typedef struct app_mem_info_st |
| @@ -93,8 +149,8 @@ typedef struct app_mem_info_st | |||
| 93 | * CRYPTO_pop_info() to pop an entry, | 149 | * CRYPTO_pop_info() to pop an entry, |
| 94 | * CRYPTO_remove_all_info() to pop all entries. | 150 | * CRYPTO_remove_all_info() to pop all entries. |
| 95 | */ | 151 | */ |
| 96 | { | 152 | { |
| 97 | unsigned long thread; | 153 | CRYPTO_THREADID threadid; |
| 98 | const char *file; | 154 | const char *file; |
| 99 | int line; | 155 | int line; |
| 100 | const char *info; | 156 | const char *info; |
| @@ -104,10 +160,13 @@ typedef struct app_mem_info_st | |||
| 104 | 160 | ||
| 105 | static void app_info_free(APP_INFO *); | 161 | static void app_info_free(APP_INFO *); |
| 106 | 162 | ||
| 107 | static LHASH *amih=NULL; /* hash-table with those app_mem_info_st's | 163 | DECLARE_LHASH_OF(APP_INFO); |
| 108 | * that are at the top of their thread's stack | 164 | static LHASH_OF(APP_INFO) *amih=NULL; /* hash-table with those |
| 109 | * (with `thread' as key); | 165 | * app_mem_info_st's that are at |
| 110 | * access requires MALLOC2 lock */ | 166 | * the top of their thread's |
| 167 | * stack (with `thread' as key); | ||
| 168 | * access requires MALLOC2 | ||
| 169 | * lock */ | ||
| 111 | 170 | ||
| 112 | typedef struct mem_st | 171 | typedef struct mem_st |
| 113 | /* memory-block description */ | 172 | /* memory-block description */ |
| @@ -116,7 +175,7 @@ typedef struct mem_st | |||
| 116 | int num; | 175 | int num; |
| 117 | const char *file; | 176 | const char *file; |
| 118 | int line; | 177 | int line; |
| 119 | unsigned long thread; | 178 | CRYPTO_THREADID threadid; |
| 120 | unsigned long order; | 179 | unsigned long order; |
| 121 | time_t time; | 180 | time_t time; |
| 122 | APP_INFO *app_info; | 181 | APP_INFO *app_info; |
| @@ -136,11 +195,11 @@ static unsigned int num_disable = 0; /* num_disable > 0 | |||
| 136 | * iff | 195 | * iff |
| 137 | * mh_mode == CRYPTO_MEM_CHECK_ON (w/o ..._ENABLE) | 196 | * mh_mode == CRYPTO_MEM_CHECK_ON (w/o ..._ENABLE) |
| 138 | */ | 197 | */ |
| 139 | static unsigned long disabling_thread = 0; /* Valid iff num_disable > 0. | 198 | |
| 140 | * CRYPTO_LOCK_MALLOC2 is locked | 199 | /* Valid iff num_disable > 0. CRYPTO_LOCK_MALLOC2 is locked exactly in this |
| 141 | * exactly in this case (by the | 200 | * case (by the thread named in disabling_thread). |
| 142 | * thread named in disabling_thread). | 201 | */ |
| 143 | */ | 202 | static CRYPTO_THREADID disabling_threadid; |
| 144 | 203 | ||
| 145 | static void app_info_free(APP_INFO *inf) | 204 | static void app_info_free(APP_INFO *inf) |
| 146 | { | 205 | { |
| @@ -177,7 +236,9 @@ int CRYPTO_mem_ctrl(int mode) | |||
| 177 | case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */ | 236 | case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */ |
| 178 | if (mh_mode & CRYPTO_MEM_CHECK_ON) | 237 | if (mh_mode & CRYPTO_MEM_CHECK_ON) |
| 179 | { | 238 | { |
| 180 | if (!num_disable || (disabling_thread != CRYPTO_thread_id())) /* otherwise we already have the MALLOC2 lock */ | 239 | CRYPTO_THREADID cur; |
| 240 | CRYPTO_THREADID_current(&cur); | ||
| 241 | if (!num_disable || CRYPTO_THREADID_cmp(&disabling_threadid, &cur)) /* otherwise we already have the MALLOC2 lock */ | ||
| 181 | { | 242 | { |
| 182 | /* Long-time lock CRYPTO_LOCK_MALLOC2 must not be claimed while | 243 | /* Long-time lock CRYPTO_LOCK_MALLOC2 must not be claimed while |
| 183 | * we're holding CRYPTO_LOCK_MALLOC, or we'll deadlock if | 244 | * we're holding CRYPTO_LOCK_MALLOC, or we'll deadlock if |
| @@ -195,7 +256,7 @@ int CRYPTO_mem_ctrl(int mode) | |||
| 195 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2); | 256 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2); |
| 196 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); | 257 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); |
| 197 | mh_mode &= ~CRYPTO_MEM_CHECK_ENABLE; | 258 | mh_mode &= ~CRYPTO_MEM_CHECK_ENABLE; |
| 198 | disabling_thread=CRYPTO_thread_id(); | 259 | CRYPTO_THREADID_cpy(&disabling_threadid, &cur); |
| 199 | } | 260 | } |
| 200 | num_disable++; | 261 | num_disable++; |
| 201 | } | 262 | } |
| @@ -228,10 +289,12 @@ int CRYPTO_is_mem_check_on(void) | |||
| 228 | 289 | ||
| 229 | if (mh_mode & CRYPTO_MEM_CHECK_ON) | 290 | if (mh_mode & CRYPTO_MEM_CHECK_ON) |
| 230 | { | 291 | { |
| 292 | CRYPTO_THREADID cur; | ||
| 293 | CRYPTO_THREADID_current(&cur); | ||
| 231 | CRYPTO_r_lock(CRYPTO_LOCK_MALLOC); | 294 | CRYPTO_r_lock(CRYPTO_LOCK_MALLOC); |
| 232 | 295 | ||
| 233 | ret = (mh_mode & CRYPTO_MEM_CHECK_ENABLE) | 296 | ret = (mh_mode & CRYPTO_MEM_CHECK_ENABLE) |
| 234 | || (disabling_thread != CRYPTO_thread_id()); | 297 | || CRYPTO_THREADID_cmp(&disabling_threadid, &cur); |
| 235 | 298 | ||
| 236 | CRYPTO_r_unlock(CRYPTO_LOCK_MALLOC); | 299 | CRYPTO_r_unlock(CRYPTO_LOCK_MALLOC); |
| 237 | } | 300 | } |
| @@ -249,49 +312,49 @@ long CRYPTO_dbg_get_options(void) | |||
| 249 | return options; | 312 | return options; |
| 250 | } | 313 | } |
| 251 | 314 | ||
| 252 | /* static int mem_cmp(MEM *a, MEM *b) */ | 315 | static int mem_cmp(const MEM *a, const MEM *b) |
| 253 | static int mem_cmp(const void *a_void, const void *b_void) | ||
| 254 | { | 316 | { |
| 255 | #ifdef _WIN64 | 317 | #ifdef _WIN64 |
| 256 | const char *a=(const char *)((const MEM *)a_void)->addr, | 318 | const char *ap=(const char *)a->addr, |
| 257 | *b=(const char *)((const MEM *)b_void)->addr; | 319 | *bp=(const char *)b->addr; |
| 258 | if (a==b) return 0; | 320 | if (ap==bp) return 0; |
| 259 | else if (a>b) return 1; | 321 | else if (ap>bp) return 1; |
| 260 | else return -1; | 322 | else return -1; |
| 261 | #else | 323 | #else |
| 262 | return((const char *)((const MEM *)a_void)->addr | 324 | return (const char *)a->addr - (const char *)b->addr; |
| 263 | - (const char *)((const MEM *)b_void)->addr); | ||
| 264 | #endif | 325 | #endif |
| 265 | } | 326 | } |
| 327 | static IMPLEMENT_LHASH_COMP_FN(mem, MEM) | ||
| 266 | 328 | ||
| 267 | /* static unsigned long mem_hash(MEM *a) */ | 329 | static unsigned long mem_hash(const MEM *a) |
| 268 | static unsigned long mem_hash(const void *a_void) | ||
| 269 | { | 330 | { |
| 270 | unsigned long ret; | 331 | unsigned long ret; |
| 271 | 332 | ||
| 272 | ret=(unsigned long)((const MEM *)a_void)->addr; | 333 | ret=(unsigned long)a->addr; |
| 273 | 334 | ||
| 274 | ret=ret*17851+(ret>>14)*7+(ret>>4)*251; | 335 | ret=ret*17851+(ret>>14)*7+(ret>>4)*251; |
| 275 | return(ret); | 336 | return(ret); |
| 276 | } | 337 | } |
| 338 | static IMPLEMENT_LHASH_HASH_FN(mem, MEM) | ||
| 277 | 339 | ||
| 278 | /* static int app_info_cmp(APP_INFO *a, APP_INFO *b) */ | 340 | /* static int app_info_cmp(APP_INFO *a, APP_INFO *b) */ |
| 279 | static int app_info_cmp(const void *a_void, const void *b_void) | 341 | static int app_info_cmp(const void *a_void, const void *b_void) |
| 280 | { | 342 | { |
| 281 | return(((const APP_INFO *)a_void)->thread | 343 | return CRYPTO_THREADID_cmp(&((const APP_INFO *)a_void)->threadid, |
| 282 | != ((const APP_INFO *)b_void)->thread); | 344 | &((const APP_INFO *)b_void)->threadid); |
| 283 | } | 345 | } |
| 346 | static IMPLEMENT_LHASH_COMP_FN(app_info, APP_INFO) | ||
| 284 | 347 | ||
| 285 | /* static unsigned long app_info_hash(APP_INFO *a) */ | 348 | static unsigned long app_info_hash(const APP_INFO *a) |
| 286 | static unsigned long app_info_hash(const void *a_void) | ||
| 287 | { | 349 | { |
| 288 | unsigned long ret; | 350 | unsigned long ret; |
| 289 | 351 | ||
| 290 | ret=(unsigned long)((const APP_INFO *)a_void)->thread; | 352 | ret = CRYPTO_THREADID_hash(&a->threadid); |
| 291 | 353 | /* This is left in as a "who am I to question legacy?" measure */ | |
| 292 | ret=ret*17851+(ret>>14)*7+(ret>>4)*251; | 354 | ret=ret*17851+(ret>>14)*7+(ret>>4)*251; |
| 293 | return(ret); | 355 | return(ret); |
| 294 | } | 356 | } |
| 357 | static IMPLEMENT_LHASH_HASH_FN(app_info, APP_INFO) | ||
| 295 | 358 | ||
| 296 | static APP_INFO *pop_info(void) | 359 | static APP_INFO *pop_info(void) |
| 297 | { | 360 | { |
| @@ -300,21 +363,22 @@ static APP_INFO *pop_info(void) | |||
| 300 | 363 | ||
| 301 | if (amih != NULL) | 364 | if (amih != NULL) |
| 302 | { | 365 | { |
| 303 | tmp.thread=CRYPTO_thread_id(); | 366 | CRYPTO_THREADID_current(&tmp.threadid); |
| 304 | if ((ret=(APP_INFO *)lh_delete(amih,&tmp)) != NULL) | 367 | if ((ret=lh_APP_INFO_delete(amih,&tmp)) != NULL) |
| 305 | { | 368 | { |
| 306 | APP_INFO *next=ret->next; | 369 | APP_INFO *next=ret->next; |
| 307 | 370 | ||
| 308 | if (next != NULL) | 371 | if (next != NULL) |
| 309 | { | 372 | { |
| 310 | next->references++; | 373 | next->references++; |
| 311 | lh_insert(amih,(char *)next); | 374 | (void)lh_APP_INFO_insert(amih,next); |
| 312 | } | 375 | } |
| 313 | #ifdef LEVITTE_DEBUG_MEM | 376 | #ifdef LEVITTE_DEBUG_MEM |
| 314 | if (ret->thread != tmp.thread) | 377 | if (CRYPTO_THREADID_cmp(&ret->threadid, &tmp.threadid)) |
| 315 | { | 378 | { |
| 316 | fprintf(stderr, "pop_info(): deleted info has other thread ID (%lu) than the current thread (%lu)!!!!\n", | 379 | fprintf(stderr, "pop_info(): deleted info has other thread ID (%lu) than the current thread (%lu)!!!!\n", |
| 317 | ret->thread, tmp.thread); | 380 | CRYPTO_THREADID_hash(&ret->threadid), |
| 381 | CRYPTO_THREADID_hash(&tmp.threadid)); | ||
| 318 | abort(); | 382 | abort(); |
| 319 | } | 383 | } |
| 320 | #endif | 384 | #endif |
| @@ -330,7 +394,7 @@ static APP_INFO *pop_info(void) | |||
| 330 | return(ret); | 394 | return(ret); |
| 331 | } | 395 | } |
| 332 | 396 | ||
| 333 | int CRYPTO_dbg_push_info(const char *info, const char *file, int line) | 397 | int CRYPTO_push_info_(const char *info, const char *file, int line) |
| 334 | { | 398 | { |
| 335 | APP_INFO *ami, *amim; | 399 | APP_INFO *ami, *amim; |
| 336 | int ret=0; | 400 | int ret=0; |
| @@ -346,7 +410,7 @@ int CRYPTO_dbg_push_info(const char *info, const char *file, int line) | |||
| 346 | } | 410 | } |
| 347 | if (amih == NULL) | 411 | if (amih == NULL) |
| 348 | { | 412 | { |
| 349 | if ((amih=lh_new(app_info_hash, app_info_cmp)) == NULL) | 413 | if ((amih=lh_APP_INFO_new()) == NULL) |
| 350 | { | 414 | { |
| 351 | OPENSSL_free(ami); | 415 | OPENSSL_free(ami); |
| 352 | ret=0; | 416 | ret=0; |
| @@ -354,20 +418,21 @@ int CRYPTO_dbg_push_info(const char *info, const char *file, int line) | |||
| 354 | } | 418 | } |
| 355 | } | 419 | } |
| 356 | 420 | ||
| 357 | ami->thread=CRYPTO_thread_id(); | 421 | CRYPTO_THREADID_current(&ami->threadid); |
| 358 | ami->file=file; | 422 | ami->file=file; |
| 359 | ami->line=line; | 423 | ami->line=line; |
| 360 | ami->info=info; | 424 | ami->info=info; |
| 361 | ami->references=1; | 425 | ami->references=1; |
| 362 | ami->next=NULL; | 426 | ami->next=NULL; |
| 363 | 427 | ||
| 364 | if ((amim=(APP_INFO *)lh_insert(amih,(char *)ami)) != NULL) | 428 | if ((amim=lh_APP_INFO_insert(amih,ami)) != NULL) |
| 365 | { | 429 | { |
| 366 | #ifdef LEVITTE_DEBUG_MEM | 430 | #ifdef LEVITTE_DEBUG_MEM |
| 367 | if (ami->thread != amim->thread) | 431 | if (CRYPTO_THREADID_cmp(&ami->threadid, &amim->threadid)) |
| 368 | { | 432 | { |
| 369 | fprintf(stderr, "CRYPTO_push_info(): previous info has other thread ID (%lu) than the current thread (%lu)!!!!\n", | 433 | fprintf(stderr, "CRYPTO_push_info(): previous info has other thread ID (%lu) than the current thread (%lu)!!!!\n", |
| 370 | amim->thread, ami->thread); | 434 | CRYPTO_THREADID_hash(&amim->threadid), |
| 435 | CRYPTO_THREADID_hash(&ami->threadid)); | ||
| 371 | abort(); | 436 | abort(); |
| 372 | } | 437 | } |
| 373 | #endif | 438 | #endif |
| @@ -380,7 +445,7 @@ int CRYPTO_dbg_push_info(const char *info, const char *file, int line) | |||
| 380 | return(ret); | 445 | return(ret); |
| 381 | } | 446 | } |
| 382 | 447 | ||
| 383 | int CRYPTO_dbg_pop_info(void) | 448 | int CRYPTO_pop_info(void) |
| 384 | { | 449 | { |
| 385 | int ret=0; | 450 | int ret=0; |
| 386 | 451 | ||
| @@ -395,7 +460,7 @@ int CRYPTO_dbg_pop_info(void) | |||
| 395 | return(ret); | 460 | return(ret); |
| 396 | } | 461 | } |
| 397 | 462 | ||
| 398 | int CRYPTO_dbg_remove_all_info(void) | 463 | int CRYPTO_remove_all_info(void) |
| 399 | { | 464 | { |
| 400 | int ret=0; | 465 | int ret=0; |
| 401 | 466 | ||
| @@ -439,7 +504,7 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, | |||
| 439 | } | 504 | } |
| 440 | if (mh == NULL) | 505 | if (mh == NULL) |
| 441 | { | 506 | { |
| 442 | if ((mh=lh_new(mem_hash, mem_cmp)) == NULL) | 507 | if ((mh=lh_MEM_new()) == NULL) |
| 443 | { | 508 | { |
| 444 | OPENSSL_free(addr); | 509 | OPENSSL_free(addr); |
| 445 | OPENSSL_free(m); | 510 | OPENSSL_free(m); |
| @@ -453,9 +518,9 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, | |||
| 453 | m->line=line; | 518 | m->line=line; |
| 454 | m->num=num; | 519 | m->num=num; |
| 455 | if (options & V_CRYPTO_MDEBUG_THREAD) | 520 | if (options & V_CRYPTO_MDEBUG_THREAD) |
| 456 | m->thread=CRYPTO_thread_id(); | 521 | CRYPTO_THREADID_current(&m->threadid); |
| 457 | else | 522 | else |
| 458 | m->thread=0; | 523 | memset(&m->threadid, 0, sizeof(m->threadid)); |
| 459 | 524 | ||
| 460 | if (order == break_order_num) | 525 | if (order == break_order_num) |
| 461 | { | 526 | { |
| @@ -464,7 +529,7 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, | |||
| 464 | } | 529 | } |
| 465 | m->order=order++; | 530 | m->order=order++; |
| 466 | #ifdef LEVITTE_DEBUG_MEM | 531 | #ifdef LEVITTE_DEBUG_MEM |
| 467 | fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5d] %c 0x%p (%d)\n", | 532 | fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5ld] %c 0x%p (%d)\n", |
| 468 | m->order, | 533 | m->order, |
| 469 | (before_p & 128) ? '*' : '+', | 534 | (before_p & 128) ? '*' : '+', |
| 470 | m->addr, m->num); | 535 | m->addr, m->num); |
| @@ -474,16 +539,16 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, | |||
| 474 | else | 539 | else |
| 475 | m->time=0; | 540 | m->time=0; |
| 476 | 541 | ||
| 477 | tmp.thread=CRYPTO_thread_id(); | 542 | CRYPTO_THREADID_current(&tmp.threadid); |
| 478 | m->app_info=NULL; | 543 | m->app_info=NULL; |
| 479 | if (amih != NULL | 544 | if (amih != NULL |
| 480 | && (amim=(APP_INFO *)lh_retrieve(amih,(char *)&tmp)) != NULL) | 545 | && (amim=lh_APP_INFO_retrieve(amih,&tmp)) != NULL) |
| 481 | { | 546 | { |
| 482 | m->app_info = amim; | 547 | m->app_info = amim; |
| 483 | amim->references++; | 548 | amim->references++; |
| 484 | } | 549 | } |
| 485 | 550 | ||
| 486 | if ((mm=(MEM *)lh_insert(mh,(char *)m)) != NULL) | 551 | if ((mm=lh_MEM_insert(mh, m)) != NULL) |
| 487 | { | 552 | { |
| 488 | /* Not good, but don't sweat it */ | 553 | /* Not good, but don't sweat it */ |
| 489 | if (mm->app_info != NULL) | 554 | if (mm->app_info != NULL) |
| @@ -516,11 +581,11 @@ void CRYPTO_dbg_free(void *addr, int before_p) | |||
| 516 | MemCheck_off(); /* make sure we hold MALLOC2 lock */ | 581 | MemCheck_off(); /* make sure we hold MALLOC2 lock */ |
| 517 | 582 | ||
| 518 | m.addr=addr; | 583 | m.addr=addr; |
| 519 | mp=(MEM *)lh_delete(mh,(char *)&m); | 584 | mp=lh_MEM_delete(mh,&m); |
| 520 | if (mp != NULL) | 585 | if (mp != NULL) |
| 521 | { | 586 | { |
| 522 | #ifdef LEVITTE_DEBUG_MEM | 587 | #ifdef LEVITTE_DEBUG_MEM |
| 523 | fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5d] - 0x%p (%d)\n", | 588 | fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5ld] - 0x%p (%d)\n", |
| 524 | mp->order, mp->addr, mp->num); | 589 | mp->order, mp->addr, mp->num); |
| 525 | #endif | 590 | #endif |
| 526 | if (mp->app_info != NULL) | 591 | if (mp->app_info != NULL) |
| @@ -566,18 +631,18 @@ void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, | |||
| 566 | MemCheck_off(); /* make sure we hold MALLOC2 lock */ | 631 | MemCheck_off(); /* make sure we hold MALLOC2 lock */ |
| 567 | 632 | ||
| 568 | m.addr=addr1; | 633 | m.addr=addr1; |
| 569 | mp=(MEM *)lh_delete(mh,(char *)&m); | 634 | mp=lh_MEM_delete(mh,&m); |
| 570 | if (mp != NULL) | 635 | if (mp != NULL) |
| 571 | { | 636 | { |
| 572 | #ifdef LEVITTE_DEBUG_MEM | 637 | #ifdef LEVITTE_DEBUG_MEM |
| 573 | fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5d] * 0x%p (%d) -> 0x%p (%d)\n", | 638 | fprintf(stderr, "LEVITTE_DEBUG_MEM: [%5ld] * 0x%p (%d) -> 0x%p (%d)\n", |
| 574 | mp->order, | 639 | mp->order, |
| 575 | mp->addr, mp->num, | 640 | mp->addr, mp->num, |
| 576 | addr2, num); | 641 | addr2, num); |
| 577 | #endif | 642 | #endif |
| 578 | mp->addr=addr2; | 643 | mp->addr=addr2; |
| 579 | mp->num=num; | 644 | mp->num=num; |
| 580 | lh_insert(mh,(char *)mp); | 645 | (void)lh_MEM_insert(mh,mp); |
| 581 | } | 646 | } |
| 582 | 647 | ||
| 583 | MemCheck_on(); /* release MALLOC2 lock | 648 | MemCheck_on(); /* release MALLOC2 lock |
| @@ -596,14 +661,14 @@ typedef struct mem_leak_st | |||
| 596 | long bytes; | 661 | long bytes; |
| 597 | } MEM_LEAK; | 662 | } MEM_LEAK; |
| 598 | 663 | ||
| 599 | static void print_leak(const MEM *m, MEM_LEAK *l) | 664 | static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l) |
| 600 | { | 665 | { |
| 601 | char buf[1024]; | 666 | char buf[1024]; |
| 602 | char *bufp = buf; | 667 | char *bufp = buf; |
| 603 | APP_INFO *amip; | 668 | APP_INFO *amip; |
| 604 | int ami_cnt; | 669 | int ami_cnt; |
| 605 | struct tm *lcl = NULL; | 670 | struct tm *lcl = NULL; |
| 606 | unsigned long ti; | 671 | CRYPTO_THREADID ti; |
| 607 | 672 | ||
| 608 | #define BUF_REMAIN (sizeof buf - (size_t)(bufp - buf)) | 673 | #define BUF_REMAIN (sizeof buf - (size_t)(bufp - buf)) |
| 609 | 674 | ||
| @@ -625,7 +690,8 @@ static void print_leak(const MEM *m, MEM_LEAK *l) | |||
| 625 | 690 | ||
| 626 | if (options & V_CRYPTO_MDEBUG_THREAD) | 691 | if (options & V_CRYPTO_MDEBUG_THREAD) |
| 627 | { | 692 | { |
| 628 | BIO_snprintf(bufp, BUF_REMAIN, "thread=%lu, ", m->thread); | 693 | BIO_snprintf(bufp, BUF_REMAIN, "thread=%lu, ", |
| 694 | CRYPTO_THREADID_hash(&m->threadid)); | ||
| 629 | bufp += strlen(bufp); | 695 | bufp += strlen(bufp); |
| 630 | } | 696 | } |
| 631 | 697 | ||
| @@ -642,8 +708,8 @@ static void print_leak(const MEM *m, MEM_LEAK *l) | |||
| 642 | ami_cnt=0; | 708 | ami_cnt=0; |
| 643 | if (!amip) | 709 | if (!amip) |
| 644 | return; | 710 | return; |
| 645 | ti=amip->thread; | 711 | CRYPTO_THREADID_cpy(&ti, &amip->threadid); |
| 646 | 712 | ||
| 647 | do | 713 | do |
| 648 | { | 714 | { |
| 649 | int buf_len; | 715 | int buf_len; |
| @@ -653,7 +719,8 @@ static void print_leak(const MEM *m, MEM_LEAK *l) | |||
| 653 | memset(buf,'>',ami_cnt); | 719 | memset(buf,'>',ami_cnt); |
| 654 | BIO_snprintf(buf + ami_cnt, sizeof buf - ami_cnt, | 720 | BIO_snprintf(buf + ami_cnt, sizeof buf - ami_cnt, |
| 655 | " thread=%lu, file=%s, line=%d, info=\"", | 721 | " thread=%lu, file=%s, line=%d, info=\"", |
| 656 | amip->thread, amip->file, amip->line); | 722 | CRYPTO_THREADID_hash(&amip->threadid), amip->file, |
| 723 | amip->line); | ||
| 657 | buf_len=strlen(buf); | 724 | buf_len=strlen(buf); |
| 658 | info_len=strlen(amip->info); | 725 | info_len=strlen(amip->info); |
| 659 | if (128 - buf_len - 3 < info_len) | 726 | if (128 - buf_len - 3 < info_len) |
| @@ -673,8 +740,8 @@ static void print_leak(const MEM *m, MEM_LEAK *l) | |||
| 673 | 740 | ||
| 674 | amip = amip->next; | 741 | amip = amip->next; |
| 675 | } | 742 | } |
| 676 | while(amip && amip->thread == ti); | 743 | while(amip && !CRYPTO_THREADID_cmp(&amip->threadid, &ti)); |
| 677 | 744 | ||
| 678 | #ifdef LEVITTE_DEBUG_MEM | 745 | #ifdef LEVITTE_DEBUG_MEM |
| 679 | if (amip) | 746 | if (amip) |
| 680 | { | 747 | { |
| @@ -684,7 +751,7 @@ static void print_leak(const MEM *m, MEM_LEAK *l) | |||
| 684 | #endif | 751 | #endif |
| 685 | } | 752 | } |
| 686 | 753 | ||
| 687 | static IMPLEMENT_LHASH_DOALL_ARG_FN(print_leak, const MEM *, MEM_LEAK *) | 754 | static IMPLEMENT_LHASH_DOALL_ARG_FN(print_leak, const MEM, MEM_LEAK) |
| 688 | 755 | ||
| 689 | void CRYPTO_mem_leaks(BIO *b) | 756 | void CRYPTO_mem_leaks(BIO *b) |
| 690 | { | 757 | { |
| @@ -699,12 +766,15 @@ void CRYPTO_mem_leaks(BIO *b) | |||
| 699 | ml.bytes=0; | 766 | ml.bytes=0; |
| 700 | ml.chunks=0; | 767 | ml.chunks=0; |
| 701 | if (mh != NULL) | 768 | if (mh != NULL) |
| 702 | lh_doall_arg(mh, LHASH_DOALL_ARG_FN(print_leak), | 769 | lh_MEM_doall_arg(mh, LHASH_DOALL_ARG_FN(print_leak), MEM_LEAK, |
| 703 | (char *)&ml); | 770 | &ml); |
| 704 | if (ml.chunks != 0) | 771 | if (ml.chunks != 0) |
| 705 | { | 772 | { |
| 706 | BIO_printf(b,"%ld bytes leaked in %d chunks\n", | 773 | BIO_printf(b,"%ld bytes leaked in %d chunks\n", |
| 707 | ml.bytes,ml.chunks); | 774 | ml.bytes,ml.chunks); |
| 775 | #ifdef CRYPTO_MDEBUG_ABORT | ||
| 776 | abort(); | ||
| 777 | #endif | ||
| 708 | } | 778 | } |
| 709 | else | 779 | else |
| 710 | { | 780 | { |
| @@ -717,7 +787,7 @@ void CRYPTO_mem_leaks(BIO *b) | |||
| 717 | * XXX This should be in CRYPTO_mem_leaks_cb, | 787 | * XXX This should be in CRYPTO_mem_leaks_cb, |
| 718 | * and CRYPTO_mem_leaks should be implemented by | 788 | * and CRYPTO_mem_leaks should be implemented by |
| 719 | * using CRYPTO_mem_leaks_cb. | 789 | * using CRYPTO_mem_leaks_cb. |
| 720 | * (Also their should be a variant of lh_doall_arg | 790 | * (Also there should be a variant of lh_doall_arg |
| 721 | * that takes a function pointer instead of a void *; | 791 | * that takes a function pointer instead of a void *; |
| 722 | * this would obviate the ugly and illegal | 792 | * this would obviate the ugly and illegal |
| 723 | * void_fn_to_char kludge in CRYPTO_mem_leaks_cb. | 793 | * void_fn_to_char kludge in CRYPTO_mem_leaks_cb. |
| @@ -734,14 +804,14 @@ void CRYPTO_mem_leaks(BIO *b) | |||
| 734 | 804 | ||
| 735 | if (mh != NULL) | 805 | if (mh != NULL) |
| 736 | { | 806 | { |
| 737 | lh_free(mh); | 807 | lh_MEM_free(mh); |
| 738 | mh = NULL; | 808 | mh = NULL; |
| 739 | } | 809 | } |
| 740 | if (amih != NULL) | 810 | if (amih != NULL) |
| 741 | { | 811 | { |
| 742 | if (lh_num_items(amih) == 0) | 812 | if (lh_APP_INFO_num_items(amih) == 0) |
| 743 | { | 813 | { |
| 744 | lh_free(amih); | 814 | lh_APP_INFO_free(amih); |
| 745 | amih = NULL; | 815 | amih = NULL; |
| 746 | } | 816 | } |
| 747 | } | 817 | } |
| @@ -779,40 +849,26 @@ void CRYPTO_mem_leaks_fp(FILE *fp) | |||
| 779 | /* NB: The prototypes have been typedef'd to CRYPTO_MEM_LEAK_CB inside crypto.h | 849 | /* NB: The prototypes have been typedef'd to CRYPTO_MEM_LEAK_CB inside crypto.h |
| 780 | * If this code is restructured, remove the callback type if it is no longer | 850 | * If this code is restructured, remove the callback type if it is no longer |
| 781 | * needed. -- Geoff Thorpe */ | 851 | * needed. -- Geoff Thorpe */ |
| 782 | static void cb_leak(const MEM *m, CRYPTO_MEM_LEAK_CB **cb) | 852 | |
| 853 | /* Can't pass CRYPTO_MEM_LEAK_CB directly to lh_MEM_doall_arg because it | ||
| 854 | * is a function pointer and conversion to void * is prohibited. Instead | ||
| 855 | * pass its address | ||
| 856 | */ | ||
| 857 | |||
| 858 | typedef CRYPTO_MEM_LEAK_CB *PCRYPTO_MEM_LEAK_CB; | ||
| 859 | |||
| 860 | static void cb_leak_doall_arg(const MEM *m, PCRYPTO_MEM_LEAK_CB *cb) | ||
| 783 | { | 861 | { |
| 784 | (**cb)(m->order,m->file,m->line,m->num,m->addr); | 862 | (*cb)(m->order,m->file,m->line,m->num,m->addr); |
| 785 | } | 863 | } |
| 786 | 864 | ||
| 787 | static IMPLEMENT_LHASH_DOALL_ARG_FN(cb_leak, const MEM *, CRYPTO_MEM_LEAK_CB **) | 865 | static IMPLEMENT_LHASH_DOALL_ARG_FN(cb_leak, const MEM, PCRYPTO_MEM_LEAK_CB) |
| 788 | 866 | ||
| 789 | void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb) | 867 | void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb) |
| 790 | { | 868 | { |
| 791 | if (mh == NULL) return; | 869 | if (mh == NULL) return; |
| 792 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2); | 870 | CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2); |
| 793 | lh_doall_arg(mh, LHASH_DOALL_ARG_FN(cb_leak), &cb); | 871 | lh_MEM_doall_arg(mh, LHASH_DOALL_ARG_FN(cb_leak), PCRYPTO_MEM_LEAK_CB, |
| 872 | &cb); | ||
| 794 | CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2); | 873 | CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2); |
| 795 | } | 874 | } |
| 796 | |||
| 797 | void CRYPTO_malloc_debug_init(void) | ||
| 798 | { | ||
| 799 | CRYPTO_set_mem_debug_functions( | ||
| 800 | CRYPTO_dbg_malloc, | ||
| 801 | CRYPTO_dbg_realloc, | ||
| 802 | CRYPTO_dbg_free, | ||
| 803 | CRYPTO_dbg_set_options, | ||
| 804 | CRYPTO_dbg_get_options); | ||
| 805 | CRYPTO_set_mem_info_functions( | ||
| 806 | CRYPTO_dbg_push_info, | ||
| 807 | CRYPTO_dbg_pop_info, | ||
| 808 | CRYPTO_dbg_remove_all_info); | ||
| 809 | } | ||
| 810 | |||
| 811 | char *CRYPTO_strdup(const char *str, const char *file, int line) | ||
| 812 | { | ||
| 813 | size_t len = strlen(str)+1; | ||
| 814 | char *ret = CRYPTO_malloc(len, file, line); | ||
| 815 | |||
| 816 | memcpy(ret, str, len); | ||
| 817 | return ret; | ||
| 818 | } | ||
diff --git a/src/lib/libcrypto/o_init.c b/src/lib/libcrypto/o_init.c deleted file mode 100644 index 00ed65a6cf..0000000000 --- a/src/lib/libcrypto/o_init.c +++ /dev/null | |||
| @@ -1,86 +0,0 @@ | |||
| 1 | /* o_init.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2007 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 <e_os.h> | ||
| 60 | #include <openssl/err.h> | ||
| 61 | |||
| 62 | /* Perform any essential OpenSSL initialization operations. | ||
| 63 | * Currently only sets FIPS callbacks | ||
| 64 | */ | ||
| 65 | |||
| 66 | void OPENSSL_init(void) | ||
| 67 | { | ||
| 68 | #ifdef OPENSSL_FIPS | ||
| 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 | } | ||
| 85 | |||
| 86 | |||
diff --git a/src/lib/libcrypto/o_time.c b/src/lib/libcrypto/o_time.c index e29091d650..eecbdd19f0 100644 --- a/src/lib/libcrypto/o_time.c +++ b/src/lib/libcrypto/o_time.c | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| 5 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 6 | * project 2008. | ||
| 7 | */ | ||
| 5 | /* ==================================================================== | 8 | /* ==================================================================== |
| 6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | 9 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. |
| 7 | * | 10 | * |
| @@ -73,7 +76,7 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | |||
| 73 | { | 76 | { |
| 74 | struct tm *ts = NULL; | 77 | struct tm *ts = NULL; |
| 75 | 78 | ||
| 76 | #if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_OS2) && !defined(__CYGWIN32__) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r)) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_SUNOS) | 79 | #if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_OS2) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r)) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_SUNOS) |
| 77 | /* should return &data, but doesn't on some systems, | 80 | /* should return &data, but doesn't on some systems, |
| 78 | so we don't even look at the return value */ | 81 | so we don't even look at the return value */ |
| 79 | gmtime_r(timer,result); | 82 | gmtime_r(timer,result); |
| @@ -214,4 +217,150 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | |||
| 214 | } | 217 | } |
| 215 | #endif | 218 | #endif |
| 216 | return ts; | 219 | return ts; |
| 217 | } | 220 | } |
| 221 | |||
| 222 | /* Take a tm structure and add an offset to it. This avoids any OS issues | ||
| 223 | * with restricted date types and overflows which cause the year 2038 | ||
| 224 | * problem. | ||
| 225 | */ | ||
| 226 | |||
| 227 | #define SECS_PER_DAY (24 * 60 * 60) | ||
| 228 | |||
| 229 | static long date_to_julian(int y, int m, int d); | ||
| 230 | static void julian_to_date(long jd, int *y, int *m, int *d); | ||
| 231 | |||
| 232 | int OPENSSL_gmtime_adj(struct tm *tm, int off_day, long offset_sec) | ||
| 233 | { | ||
| 234 | int offset_hms, offset_day; | ||
| 235 | long time_jd; | ||
| 236 | int time_year, time_month, time_day; | ||
| 237 | /* split offset into days and day seconds */ | ||
| 238 | offset_day = offset_sec / SECS_PER_DAY; | ||
| 239 | /* Avoid sign issues with % operator */ | ||
| 240 | offset_hms = offset_sec - (offset_day * SECS_PER_DAY); | ||
| 241 | offset_day += off_day; | ||
| 242 | /* Add current time seconds to offset */ | ||
| 243 | offset_hms += tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec; | ||
| 244 | /* Adjust day seconds if overflow */ | ||
| 245 | if (offset_hms >= SECS_PER_DAY) | ||
| 246 | { | ||
| 247 | offset_day++; | ||
| 248 | offset_hms -= SECS_PER_DAY; | ||
| 249 | } | ||
| 250 | else if (offset_hms < 0) | ||
| 251 | { | ||
| 252 | offset_day--; | ||
| 253 | offset_hms += SECS_PER_DAY; | ||
| 254 | } | ||
| 255 | |||
| 256 | /* Convert date of time structure into a Julian day number. | ||
| 257 | */ | ||
| 258 | |||
| 259 | time_year = tm->tm_year + 1900; | ||
| 260 | time_month = tm->tm_mon + 1; | ||
| 261 | time_day = tm->tm_mday; | ||
| 262 | |||
| 263 | time_jd = date_to_julian(time_year, time_month, time_day); | ||
| 264 | |||
| 265 | /* Work out Julian day of new date */ | ||
| 266 | time_jd += offset_day; | ||
| 267 | |||
| 268 | if (time_jd < 0) | ||
| 269 | return 0; | ||
| 270 | |||
| 271 | /* Convert Julian day back to date */ | ||
| 272 | |||
| 273 | julian_to_date(time_jd, &time_year, &time_month, &time_day); | ||
| 274 | |||
| 275 | if (time_year < 1900 || time_year > 9999) | ||
| 276 | return 0; | ||
| 277 | |||
| 278 | /* Update tm structure */ | ||
| 279 | |||
| 280 | tm->tm_year = time_year - 1900; | ||
| 281 | tm->tm_mon = time_month - 1; | ||
| 282 | tm->tm_mday = time_day; | ||
| 283 | |||
| 284 | tm->tm_hour = offset_hms / 3600; | ||
| 285 | tm->tm_min = (offset_hms / 60) % 60; | ||
| 286 | tm->tm_sec = offset_hms % 60; | ||
| 287 | |||
| 288 | return 1; | ||
| 289 | |||
| 290 | } | ||
| 291 | |||
| 292 | /* Convert date to and from julian day | ||
| 293 | * Uses Fliegel & Van Flandern algorithm | ||
| 294 | */ | ||
| 295 | static long date_to_julian(int y, int m, int d) | ||
| 296 | { | ||
| 297 | return (1461 * (y + 4800 + (m - 14) / 12)) / 4 + | ||
| 298 | (367 * (m - 2 - 12 * ((m - 14) / 12))) / 12 - | ||
| 299 | (3 * ((y + 4900 + (m - 14) / 12) / 100)) / 4 + | ||
| 300 | d - 32075; | ||
| 301 | } | ||
| 302 | |||
| 303 | static void julian_to_date(long jd, int *y, int *m, int *d) | ||
| 304 | { | ||
| 305 | long L = jd + 68569; | ||
| 306 | long n = (4 * L) / 146097; | ||
| 307 | long i, j; | ||
| 308 | |||
| 309 | L = L - (146097 * n + 3) / 4; | ||
| 310 | i = (4000 * (L + 1)) / 1461001; | ||
| 311 | L = L - (1461 * i) / 4 + 31; | ||
| 312 | j = (80 * L) / 2447; | ||
| 313 | *d = L - (2447 * j) / 80; | ||
| 314 | L = j / 11; | ||
| 315 | *m = j + 2 - (12 * L); | ||
| 316 | *y = 100 * (n - 49) + i + L; | ||
| 317 | } | ||
| 318 | |||
| 319 | #ifdef OPENSSL_TIME_TEST | ||
| 320 | |||
| 321 | #include <stdio.h> | ||
| 322 | |||
| 323 | /* Time checking test code. Check times are identical for a wide range of | ||
| 324 | * offsets. This should be run on a machine with 64 bit time_t or it will | ||
| 325 | * trigger the very errors the routines fix. | ||
| 326 | */ | ||
| 327 | |||
| 328 | int main(int argc, char **argv) | ||
| 329 | { | ||
| 330 | long offset; | ||
| 331 | for (offset = 0; offset < 1000000; offset++) | ||
| 332 | { | ||
| 333 | check_time(offset); | ||
| 334 | check_time(-offset); | ||
| 335 | check_time(offset * 1000); | ||
| 336 | check_time(-offset * 1000); | ||
| 337 | } | ||
| 338 | } | ||
| 339 | |||
| 340 | int check_time(long offset) | ||
| 341 | { | ||
| 342 | struct tm tm1, tm2; | ||
| 343 | time_t t1, t2; | ||
| 344 | time(&t1); | ||
| 345 | t2 = t1 + offset; | ||
| 346 | OPENSSL_gmtime(&t2, &tm2); | ||
| 347 | OPENSSL_gmtime(&t1, &tm1); | ||
| 348 | OPENSSL_gmtime_adj(&tm1, 0, offset); | ||
| 349 | if ((tm1.tm_year == tm2.tm_year) && | ||
| 350 | (tm1.tm_mon == tm2.tm_mon) && | ||
| 351 | (tm1.tm_mday == tm2.tm_mday) && | ||
| 352 | (tm1.tm_hour == tm2.tm_hour) && | ||
| 353 | (tm1.tm_min == tm2.tm_min) && | ||
| 354 | (tm1.tm_sec == tm2.tm_sec)) | ||
| 355 | return 1; | ||
| 356 | fprintf(stderr, "TIME ERROR!!\n"); | ||
| 357 | fprintf(stderr, "Time1: %d/%d/%d, %d:%02d:%02d\n", | ||
| 358 | tm2.tm_mday, tm2.tm_mon + 1, tm2.tm_year + 1900, | ||
| 359 | tm2.tm_hour, tm2.tm_min, tm2.tm_sec); | ||
| 360 | fprintf(stderr, "Time2: %d/%d/%d, %d:%02d:%02d\n", | ||
| 361 | tm1.tm_mday, tm1.tm_mon + 1, tm1.tm_year + 1900, | ||
| 362 | tm1.tm_hour, tm1.tm_min, tm1.tm_sec); | ||
| 363 | return 0; | ||
| 364 | } | ||
| 365 | |||
| 366 | #endif | ||
diff --git a/src/lib/libcrypto/o_time.h b/src/lib/libcrypto/o_time.h index e66044626d..e391da7508 100644 --- a/src/lib/libcrypto/o_time.h +++ b/src/lib/libcrypto/o_time.h | |||
| @@ -62,5 +62,6 @@ | |||
| 62 | #include <time.h> | 62 | #include <time.h> |
| 63 | 63 | ||
| 64 | struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); | 64 | struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); |
| 65 | int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); | ||
| 65 | 66 | ||
| 66 | #endif | 67 | #endif |
diff --git a/src/lib/libcrypto/objects/Makefile.ssl b/src/lib/libcrypto/objects/Makefile.ssl deleted file mode 100644 index 3e7a194cf9..0000000000 --- a/src/lib/libcrypto/objects/Makefile.ssl +++ /dev/null | |||
| @@ -1,123 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/objects/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= objects | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | PERL= perl | ||
| 19 | |||
| 20 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 21 | |||
| 22 | GENERAL=Makefile README | ||
| 23 | TEST= | ||
| 24 | APPS= | ||
| 25 | |||
| 26 | LIB=$(TOP)/libcrypto.a | ||
| 27 | LIBSRC= o_names.c obj_dat.c obj_lib.c obj_err.c | ||
| 28 | LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o | ||
| 29 | |||
| 30 | SRC= $(LIBSRC) | ||
| 31 | |||
| 32 | EXHEADER= objects.h obj_mac.h | ||
| 33 | HEADER= $(EXHEADER) obj_dat.h | ||
| 34 | |||
| 35 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 36 | |||
| 37 | top: | ||
| 38 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 39 | |||
| 40 | all: obj_dat.h lib | ||
| 41 | |||
| 42 | lib: $(LIBOBJ) | ||
| 43 | $(AR) $(LIB) $(LIBOBJ) | ||
| 44 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 45 | @touch lib | ||
| 46 | |||
| 47 | obj_dat.h: obj_dat.pl obj_mac.h | ||
| 48 | $(PERL) obj_dat.pl obj_mac.h obj_dat.h | ||
| 49 | |||
| 50 | # objects.pl both reads and writes obj_mac.num | ||
| 51 | obj_mac.h: objects.pl objects.txt obj_mac.num | ||
| 52 | $(PERL) objects.pl objects.txt obj_mac.num obj_mac.h | ||
| 53 | |||
| 54 | files: | ||
| 55 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 56 | |||
| 57 | links: | ||
| 58 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 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 | tests: | ||
| 74 | |||
| 75 | lint: | ||
| 76 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 77 | |||
| 78 | depend: | ||
| 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/bn.h ../../include/openssl/crypto.h | ||
| 92 | o_names.o: ../../include/openssl/e_os2.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/bn.h ../../include/openssl/crypto.h | ||
| 109 | obj_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 110 | obj_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 111 | obj_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 112 | obj_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 113 | obj_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 114 | obj_err.o: ../../include/openssl/symhacks.h obj_err.c | ||
| 115 | obj_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 116 | obj_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 117 | obj_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 118 | obj_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 119 | obj_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 120 | obj_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 121 | obj_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 122 | obj_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 123 | obj_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h obj_lib.c | ||
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c index adb5731f76..84380a96a9 100644 --- a/src/lib/libcrypto/objects/o_names.c +++ b/src/lib/libcrypto/objects/o_names.c | |||
| @@ -22,7 +22,8 @@ | |||
| 22 | /* I use the ex_data stuff to manage the identifiers for the obj_name_types | 22 | /* I use the ex_data stuff to manage the identifiers for the obj_name_types |
| 23 | * that applications may define. I only really use the free function field. | 23 | * that applications may define. I only really use the free function field. |
| 24 | */ | 24 | */ |
| 25 | static LHASH *names_lh=NULL; | 25 | DECLARE_LHASH_OF(OBJ_NAME); |
| 26 | static LHASH_OF(OBJ_NAME) *names_lh=NULL; | ||
| 26 | static int names_type_num=OBJ_NAME_TYPE_NUM; | 27 | static int names_type_num=OBJ_NAME_TYPE_NUM; |
| 27 | 28 | ||
| 28 | typedef struct name_funcs_st | 29 | typedef struct name_funcs_st |
| @@ -46,11 +47,14 @@ static unsigned long obj_name_hash(const void *a_void); | |||
| 46 | /* static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b); */ | 47 | /* static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b); */ |
| 47 | static int obj_name_cmp(const void *a_void,const void *b_void); | 48 | static int obj_name_cmp(const void *a_void,const void *b_void); |
| 48 | 49 | ||
| 50 | static IMPLEMENT_LHASH_HASH_FN(obj_name, OBJ_NAME) | ||
| 51 | static IMPLEMENT_LHASH_COMP_FN(obj_name, OBJ_NAME) | ||
| 52 | |||
| 49 | int OBJ_NAME_init(void) | 53 | int OBJ_NAME_init(void) |
| 50 | { | 54 | { |
| 51 | if (names_lh != NULL) return(1); | 55 | if (names_lh != NULL) return(1); |
| 52 | MemCheck_off(); | 56 | MemCheck_off(); |
| 53 | names_lh=lh_new(obj_name_hash, obj_name_cmp); | 57 | names_lh=lh_OBJ_NAME_new(); |
| 54 | MemCheck_on(); | 58 | MemCheck_on(); |
| 55 | return(names_lh != NULL); | 59 | return(names_lh != NULL); |
| 56 | } | 60 | } |
| @@ -164,7 +168,7 @@ const char *OBJ_NAME_get(const char *name, int type) | |||
| 164 | 168 | ||
| 165 | for (;;) | 169 | for (;;) |
| 166 | { | 170 | { |
| 167 | ret=(OBJ_NAME *)lh_retrieve(names_lh,&on); | 171 | ret=lh_OBJ_NAME_retrieve(names_lh,&on); |
| 168 | if (ret == NULL) return(NULL); | 172 | if (ret == NULL) return(NULL); |
| 169 | if ((ret->alias) && !alias) | 173 | if ((ret->alias) && !alias) |
| 170 | { | 174 | { |
| @@ -200,7 +204,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data) | |||
| 200 | onp->type=type; | 204 | onp->type=type; |
| 201 | onp->data=data; | 205 | onp->data=data; |
| 202 | 206 | ||
| 203 | ret=(OBJ_NAME *)lh_insert(names_lh,onp); | 207 | ret=lh_OBJ_NAME_insert(names_lh,onp); |
| 204 | if (ret != NULL) | 208 | if (ret != NULL) |
| 205 | { | 209 | { |
| 206 | /* free things */ | 210 | /* free things */ |
| @@ -217,7 +221,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data) | |||
| 217 | } | 221 | } |
| 218 | else | 222 | else |
| 219 | { | 223 | { |
| 220 | if (lh_error(names_lh)) | 224 | if (lh_OBJ_NAME_error(names_lh)) |
| 221 | { | 225 | { |
| 222 | /* ERROR */ | 226 | /* ERROR */ |
| 223 | return(0); | 227 | return(0); |
| @@ -235,7 +239,7 @@ int OBJ_NAME_remove(const char *name, int type) | |||
| 235 | type&= ~OBJ_NAME_ALIAS; | 239 | type&= ~OBJ_NAME_ALIAS; |
| 236 | on.name=name; | 240 | on.name=name; |
| 237 | on.type=type; | 241 | on.type=type; |
| 238 | ret=(OBJ_NAME *)lh_delete(names_lh,&on); | 242 | ret=lh_OBJ_NAME_delete(names_lh,&on); |
| 239 | if (ret != NULL) | 243 | if (ret != NULL) |
| 240 | { | 244 | { |
| 241 | /* free things */ | 245 | /* free things */ |
| @@ -262,13 +266,13 @@ struct doall | |||
| 262 | void *arg; | 266 | void *arg; |
| 263 | }; | 267 | }; |
| 264 | 268 | ||
| 265 | static void do_all_fn(const OBJ_NAME *name,struct doall *d) | 269 | static void do_all_fn_doall_arg(const OBJ_NAME *name,struct doall *d) |
| 266 | { | 270 | { |
| 267 | if(name->type == d->type) | 271 | if(name->type == d->type) |
| 268 | d->fn(name,d->arg); | 272 | d->fn(name,d->arg); |
| 269 | } | 273 | } |
| 270 | 274 | ||
| 271 | static IMPLEMENT_LHASH_DOALL_ARG_FN(do_all_fn, const OBJ_NAME *, struct doall *) | 275 | static IMPLEMENT_LHASH_DOALL_ARG_FN(do_all_fn, const OBJ_NAME, struct doall) |
| 272 | 276 | ||
| 273 | void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),void *arg) | 277 | void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),void *arg) |
| 274 | { | 278 | { |
| @@ -278,7 +282,8 @@ void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),void *arg) | |||
| 278 | d.fn=fn; | 282 | d.fn=fn; |
| 279 | d.arg=arg; | 283 | d.arg=arg; |
| 280 | 284 | ||
| 281 | lh_doall_arg(names_lh,LHASH_DOALL_ARG_FN(do_all_fn),&d); | 285 | lh_OBJ_NAME_doall_arg(names_lh, LHASH_DOALL_ARG_FN(do_all_fn), |
| 286 | struct doall, &d); | ||
| 282 | } | 287 | } |
| 283 | 288 | ||
| 284 | struct doall_sorted | 289 | struct doall_sorted |
| @@ -313,7 +318,7 @@ void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), | |||
| 313 | int n; | 318 | int n; |
| 314 | 319 | ||
| 315 | d.type=type; | 320 | d.type=type; |
| 316 | d.names=OPENSSL_malloc(lh_num_items(names_lh)*sizeof *d.names); | 321 | d.names=OPENSSL_malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names); |
| 317 | d.n=0; | 322 | d.n=0; |
| 318 | OBJ_NAME_do_all(type,do_all_sorted_fn,&d); | 323 | OBJ_NAME_do_all(type,do_all_sorted_fn,&d); |
| 319 | 324 | ||
| @@ -327,18 +332,16 @@ void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), | |||
| 327 | 332 | ||
| 328 | static int free_type; | 333 | static int free_type; |
| 329 | 334 | ||
| 330 | static void names_lh_free(OBJ_NAME *onp) | 335 | static void names_lh_free_doall(OBJ_NAME *onp) |
| 331 | { | 336 | { |
| 332 | if(onp == NULL) | 337 | if (onp == NULL) |
| 333 | return; | 338 | return; |
| 334 | 339 | ||
| 335 | if ((free_type < 0) || (free_type == onp->type)) | 340 | if (free_type < 0 || free_type == onp->type) |
| 336 | { | ||
| 337 | OBJ_NAME_remove(onp->name,onp->type); | 341 | OBJ_NAME_remove(onp->name,onp->type); |
| 338 | } | ||
| 339 | } | 342 | } |
| 340 | 343 | ||
| 341 | static IMPLEMENT_LHASH_DOALL_FN(names_lh_free, OBJ_NAME *) | 344 | static IMPLEMENT_LHASH_DOALL_FN(names_lh_free, OBJ_NAME) |
| 342 | 345 | ||
| 343 | static void name_funcs_free(NAME_FUNCS *ptr) | 346 | static void name_funcs_free(NAME_FUNCS *ptr) |
| 344 | { | 347 | { |
| @@ -352,18 +355,18 @@ void OBJ_NAME_cleanup(int type) | |||
| 352 | if (names_lh == NULL) return; | 355 | if (names_lh == NULL) return; |
| 353 | 356 | ||
| 354 | free_type=type; | 357 | free_type=type; |
| 355 | down_load=names_lh->down_load; | 358 | down_load=lh_OBJ_NAME_down_load(names_lh); |
| 356 | names_lh->down_load=0; | 359 | lh_OBJ_NAME_down_load(names_lh)=0; |
| 357 | 360 | ||
| 358 | lh_doall(names_lh,LHASH_DOALL_FN(names_lh_free)); | 361 | lh_OBJ_NAME_doall(names_lh,LHASH_DOALL_FN(names_lh_free)); |
| 359 | if (type < 0) | 362 | if (type < 0) |
| 360 | { | 363 | { |
| 361 | lh_free(names_lh); | 364 | lh_OBJ_NAME_free(names_lh); |
| 362 | sk_NAME_FUNCS_pop_free(name_funcs_stack,name_funcs_free); | 365 | sk_NAME_FUNCS_pop_free(name_funcs_stack,name_funcs_free); |
| 363 | names_lh=NULL; | 366 | names_lh=NULL; |
| 364 | name_funcs_stack = NULL; | 367 | name_funcs_stack = NULL; |
| 365 | } | 368 | } |
| 366 | else | 369 | else |
| 367 | names_lh->down_load=down_load; | 370 | lh_OBJ_NAME_down_load(names_lh)=down_load; |
| 368 | } | 371 | } |
| 369 | 372 | ||
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index 7fd7433241..8a342ba3eb 100644 --- a/src/lib/libcrypto/objects/obj_dat.c +++ b/src/lib/libcrypto/objects/obj_dat.c | |||
| @@ -74,16 +74,17 @@ | |||
| 74 | #define NUM_SN 0 | 74 | #define NUM_SN 0 |
| 75 | #define NUM_LN 0 | 75 | #define NUM_LN 0 |
| 76 | #define NUM_OBJ 0 | 76 | #define NUM_OBJ 0 |
| 77 | static unsigned char lvalues[1]; | 77 | static const unsigned char lvalues[1]; |
| 78 | static ASN1_OBJECT nid_objs[1]; | 78 | static const ASN1_OBJECT nid_objs[1]; |
| 79 | static ASN1_OBJECT *sn_objs[1]; | 79 | static const unsigned int sn_objs[1]; |
| 80 | static ASN1_OBJECT *ln_objs[1]; | 80 | static const unsigned int ln_objs[1]; |
| 81 | static ASN1_OBJECT *obj_objs[1]; | 81 | static const unsigned int obj_objs[1]; |
| 82 | #endif | 82 | #endif |
| 83 | 83 | ||
| 84 | static int sn_cmp(const void *a, const void *b); | 84 | DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn); |
| 85 | static int ln_cmp(const void *a, const void *b); | 85 | DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln); |
| 86 | static int obj_cmp(const void *a, const void *b); | 86 | DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); |
| 87 | |||
| 87 | #define ADDED_DATA 0 | 88 | #define ADDED_DATA 0 |
| 88 | #define ADDED_SNAME 1 | 89 | #define ADDED_SNAME 1 |
| 89 | #define ADDED_LNAME 2 | 90 | #define ADDED_LNAME 2 |
| @@ -94,30 +95,27 @@ typedef struct added_obj_st | |||
| 94 | int type; | 95 | int type; |
| 95 | ASN1_OBJECT *obj; | 96 | ASN1_OBJECT *obj; |
| 96 | } ADDED_OBJ; | 97 | } ADDED_OBJ; |
| 98 | DECLARE_LHASH_OF(ADDED_OBJ); | ||
| 97 | 99 | ||
| 98 | static int new_nid=NUM_NID; | 100 | static int new_nid=NUM_NID; |
| 99 | static LHASH *added=NULL; | 101 | static LHASH_OF(ADDED_OBJ) *added=NULL; |
| 100 | 102 | ||
| 101 | static int sn_cmp(const void *a, const void *b) | 103 | static int sn_cmp(const ASN1_OBJECT * const *a, const unsigned int *b) |
| 102 | { | 104 | { return(strcmp((*a)->sn,nid_objs[*b].sn)); } |
| 103 | const ASN1_OBJECT * const *ap = a, * const *bp = b; | ||
| 104 | return(strcmp((*ap)->sn,(*bp)->sn)); | ||
| 105 | } | ||
| 106 | 105 | ||
| 107 | static int ln_cmp(const void *a, const void *b) | 106 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn); |
| 108 | { | 107 | |
| 109 | const ASN1_OBJECT * const *ap = a, * const *bp = b; | 108 | static int ln_cmp(const ASN1_OBJECT * const *a, const unsigned int *b) |
| 110 | return(strcmp((*ap)->ln,(*bp)->ln)); | 109 | { return(strcmp((*a)->ln,nid_objs[*b].ln)); } |
| 111 | } | ||
| 112 | 110 | ||
| 113 | /* static unsigned long add_hash(ADDED_OBJ *ca) */ | 111 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln); |
| 114 | static unsigned long add_hash(const void *ca_void) | 112 | |
| 113 | static unsigned long added_obj_hash(const ADDED_OBJ *ca) | ||
| 115 | { | 114 | { |
| 116 | const ASN1_OBJECT *a; | 115 | const ASN1_OBJECT *a; |
| 117 | int i; | 116 | int i; |
| 118 | unsigned long ret=0; | 117 | unsigned long ret=0; |
| 119 | unsigned char *p; | 118 | unsigned char *p; |
| 120 | const ADDED_OBJ *ca = (const ADDED_OBJ *)ca_void; | ||
| 121 | 119 | ||
| 122 | a=ca->obj; | 120 | a=ca->obj; |
| 123 | switch (ca->type) | 121 | switch (ca->type) |
| @@ -145,14 +143,12 @@ static unsigned long add_hash(const void *ca_void) | |||
| 145 | ret|=ca->type<<30L; | 143 | ret|=ca->type<<30L; |
| 146 | return(ret); | 144 | return(ret); |
| 147 | } | 145 | } |
| 146 | static IMPLEMENT_LHASH_HASH_FN(added_obj, ADDED_OBJ) | ||
| 148 | 147 | ||
| 149 | /* static int add_cmp(ADDED_OBJ *ca, ADDED_OBJ *cb) */ | 148 | static int added_obj_cmp(const ADDED_OBJ *ca, const ADDED_OBJ *cb) |
| 150 | static int add_cmp(const void *ca_void, const void *cb_void) | ||
| 151 | { | 149 | { |
| 152 | ASN1_OBJECT *a,*b; | 150 | ASN1_OBJECT *a,*b; |
| 153 | int i; | 151 | int i; |
| 154 | const ADDED_OBJ *ca = (const ADDED_OBJ *)ca_void; | ||
| 155 | const ADDED_OBJ *cb = (const ADDED_OBJ *)cb_void; | ||
| 156 | 152 | ||
| 157 | i=ca->type-cb->type; | 153 | i=ca->type-cb->type; |
| 158 | if (i) return(i); | 154 | if (i) return(i); |
| @@ -179,15 +175,16 @@ static int add_cmp(const void *ca_void, const void *cb_void) | |||
| 179 | return 0; | 175 | return 0; |
| 180 | } | 176 | } |
| 181 | } | 177 | } |
| 178 | static IMPLEMENT_LHASH_COMP_FN(added_obj, ADDED_OBJ) | ||
| 182 | 179 | ||
| 183 | static int init_added(void) | 180 | static int init_added(void) |
| 184 | { | 181 | { |
| 185 | if (added != NULL) return(1); | 182 | if (added != NULL) return(1); |
| 186 | added=lh_new(add_hash,add_cmp); | 183 | added=lh_ADDED_OBJ_new(); |
| 187 | return(added != NULL); | 184 | return(added != NULL); |
| 188 | } | 185 | } |
| 189 | 186 | ||
| 190 | static void cleanup1(ADDED_OBJ *a) | 187 | static void cleanup1_doall(ADDED_OBJ *a) |
| 191 | { | 188 | { |
| 192 | a->obj->nid=0; | 189 | a->obj->nid=0; |
| 193 | a->obj->flags|=ASN1_OBJECT_FLAG_DYNAMIC| | 190 | a->obj->flags|=ASN1_OBJECT_FLAG_DYNAMIC| |
| @@ -195,28 +192,46 @@ static void cleanup1(ADDED_OBJ *a) | |||
| 195 | ASN1_OBJECT_FLAG_DYNAMIC_DATA; | 192 | ASN1_OBJECT_FLAG_DYNAMIC_DATA; |
| 196 | } | 193 | } |
| 197 | 194 | ||
| 198 | static void cleanup2(ADDED_OBJ *a) | 195 | static void cleanup2_doall(ADDED_OBJ *a) |
| 199 | { a->obj->nid++; } | 196 | { a->obj->nid++; } |
| 200 | 197 | ||
| 201 | static void cleanup3(ADDED_OBJ *a) | 198 | static void cleanup3_doall(ADDED_OBJ *a) |
| 202 | { | 199 | { |
| 203 | if (--a->obj->nid == 0) | 200 | if (--a->obj->nid == 0) |
| 204 | ASN1_OBJECT_free(a->obj); | 201 | ASN1_OBJECT_free(a->obj); |
| 205 | OPENSSL_free(a); | 202 | OPENSSL_free(a); |
| 206 | } | 203 | } |
| 207 | 204 | ||
| 208 | static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ *) | 205 | static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ) |
| 209 | static IMPLEMENT_LHASH_DOALL_FN(cleanup2, ADDED_OBJ *) | 206 | static IMPLEMENT_LHASH_DOALL_FN(cleanup2, ADDED_OBJ) |
| 210 | static IMPLEMENT_LHASH_DOALL_FN(cleanup3, ADDED_OBJ *) | 207 | static IMPLEMENT_LHASH_DOALL_FN(cleanup3, ADDED_OBJ) |
| 208 | |||
| 209 | /* The purpose of obj_cleanup_defer is to avoid EVP_cleanup() attempting | ||
| 210 | * to use freed up OIDs. If neccessary the actual freeing up of OIDs is | ||
| 211 | * delayed. | ||
| 212 | */ | ||
| 213 | |||
| 214 | int obj_cleanup_defer = 0; | ||
| 215 | |||
| 216 | void check_defer(int nid) | ||
| 217 | { | ||
| 218 | if (!obj_cleanup_defer && nid >= NUM_NID) | ||
| 219 | obj_cleanup_defer = 1; | ||
| 220 | } | ||
| 211 | 221 | ||
| 212 | void OBJ_cleanup(void) | 222 | void OBJ_cleanup(void) |
| 213 | { | 223 | { |
| 224 | if (obj_cleanup_defer) | ||
| 225 | { | ||
| 226 | obj_cleanup_defer = 2; | ||
| 227 | return ; | ||
| 228 | } | ||
| 214 | if (added == NULL) return; | 229 | if (added == NULL) return; |
| 215 | added->down_load=0; | 230 | lh_ADDED_OBJ_down_load(added) = 0; |
| 216 | lh_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */ | 231 | lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */ |
| 217 | lh_doall(added,LHASH_DOALL_FN(cleanup2)); /* set counters */ | 232 | lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup2)); /* set counters */ |
| 218 | lh_doall(added,LHASH_DOALL_FN(cleanup3)); /* free objects */ | 233 | lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup3)); /* free objects */ |
| 219 | lh_free(added); | 234 | lh_ADDED_OBJ_free(added); |
| 220 | added=NULL; | 235 | added=NULL; |
| 221 | } | 236 | } |
| 222 | 237 | ||
| @@ -252,7 +267,7 @@ int OBJ_add_object(const ASN1_OBJECT *obj) | |||
| 252 | { | 267 | { |
| 253 | ao[i]->type=i; | 268 | ao[i]->type=i; |
| 254 | ao[i]->obj=o; | 269 | ao[i]->obj=o; |
| 255 | aop=(ADDED_OBJ *)lh_insert(added,ao[i]); | 270 | aop=lh_ADDED_OBJ_insert(added,ao[i]); |
| 256 | /* memory leak, buit should not normally matter */ | 271 | /* memory leak, buit should not normally matter */ |
| 257 | if (aop != NULL) | 272 | if (aop != NULL) |
| 258 | OPENSSL_free(aop); | 273 | OPENSSL_free(aop); |
| @@ -292,7 +307,7 @@ ASN1_OBJECT *OBJ_nid2obj(int n) | |||
| 292 | ad.type=ADDED_NID; | 307 | ad.type=ADDED_NID; |
| 293 | ad.obj= &ob; | 308 | ad.obj= &ob; |
| 294 | ob.nid=n; | 309 | ob.nid=n; |
| 295 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); | 310 | adp=lh_ADDED_OBJ_retrieve(added,&ad); |
| 296 | if (adp != NULL) | 311 | if (adp != NULL) |
| 297 | return(adp->obj); | 312 | return(adp->obj); |
| 298 | else | 313 | else |
| @@ -324,7 +339,7 @@ const char *OBJ_nid2sn(int n) | |||
| 324 | ad.type=ADDED_NID; | 339 | ad.type=ADDED_NID; |
| 325 | ad.obj= &ob; | 340 | ad.obj= &ob; |
| 326 | ob.nid=n; | 341 | ob.nid=n; |
| 327 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); | 342 | adp=lh_ADDED_OBJ_retrieve(added,&ad); |
| 328 | if (adp != NULL) | 343 | if (adp != NULL) |
| 329 | return(adp->obj->sn); | 344 | return(adp->obj->sn); |
| 330 | else | 345 | else |
| @@ -356,7 +371,7 @@ const char *OBJ_nid2ln(int n) | |||
| 356 | ad.type=ADDED_NID; | 371 | ad.type=ADDED_NID; |
| 357 | ad.obj= &ob; | 372 | ad.obj= &ob; |
| 358 | ob.nid=n; | 373 | ob.nid=n; |
| 359 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); | 374 | adp=lh_ADDED_OBJ_retrieve(added,&ad); |
| 360 | if (adp != NULL) | 375 | if (adp != NULL) |
| 361 | return(adp->obj->ln); | 376 | return(adp->obj->ln); |
| 362 | else | 377 | else |
| @@ -367,9 +382,22 @@ const char *OBJ_nid2ln(int n) | |||
| 367 | } | 382 | } |
| 368 | } | 383 | } |
| 369 | 384 | ||
| 385 | static int obj_cmp(const ASN1_OBJECT * const *ap, const unsigned int *bp) | ||
| 386 | { | ||
| 387 | int j; | ||
| 388 | const ASN1_OBJECT *a= *ap; | ||
| 389 | const ASN1_OBJECT *b= &nid_objs[*bp]; | ||
| 390 | |||
| 391 | j=(a->length - b->length); | ||
| 392 | if (j) return(j); | ||
| 393 | return(memcmp(a->data,b->data,a->length)); | ||
| 394 | } | ||
| 395 | |||
| 396 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); | ||
| 397 | |||
| 370 | int OBJ_obj2nid(const ASN1_OBJECT *a) | 398 | int OBJ_obj2nid(const ASN1_OBJECT *a) |
| 371 | { | 399 | { |
| 372 | ASN1_OBJECT **op; | 400 | const unsigned int *op; |
| 373 | ADDED_OBJ ad,*adp; | 401 | ADDED_OBJ ad,*adp; |
| 374 | 402 | ||
| 375 | if (a == NULL) | 403 | if (a == NULL) |
| @@ -381,14 +409,13 @@ int OBJ_obj2nid(const ASN1_OBJECT *a) | |||
| 381 | { | 409 | { |
| 382 | ad.type=ADDED_DATA; | 410 | ad.type=ADDED_DATA; |
| 383 | ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ | 411 | ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ |
| 384 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); | 412 | adp=lh_ADDED_OBJ_retrieve(added,&ad); |
| 385 | if (adp != NULL) return (adp->obj->nid); | 413 | if (adp != NULL) return (adp->obj->nid); |
| 386 | } | 414 | } |
| 387 | op=(ASN1_OBJECT **)OBJ_bsearch((const char *)&a,(const char *)obj_objs, | 415 | op=OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ); |
| 388 | NUM_OBJ, sizeof(ASN1_OBJECT *),obj_cmp); | ||
| 389 | if (op == NULL) | 416 | if (op == NULL) |
| 390 | return(NID_undef); | 417 | return(NID_undef); |
| 391 | return((*op)->nid); | 418 | return(nid_objs[*op].nid); |
| 392 | } | 419 | } |
| 393 | 420 | ||
| 394 | /* Convert an object name into an ASN1_OBJECT | 421 | /* Convert an object name into an ASN1_OBJECT |
| @@ -441,7 +468,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
| 441 | int i,n=0,len,nid, first, use_bn; | 468 | int i,n=0,len,nid, first, use_bn; |
| 442 | BIGNUM *bl; | 469 | BIGNUM *bl; |
| 443 | unsigned long l; | 470 | unsigned long l; |
| 444 | unsigned char *p; | 471 | const unsigned char *p; |
| 445 | char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2]; | 472 | char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2]; |
| 446 | 473 | ||
| 447 | if ((a == NULL) || (a->data == NULL)) { | 474 | if ((a == NULL) || (a->data == NULL)) { |
| @@ -456,10 +483,13 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) | |||
| 456 | s=OBJ_nid2ln(nid); | 483 | s=OBJ_nid2ln(nid); |
| 457 | if (s == NULL) | 484 | if (s == NULL) |
| 458 | s=OBJ_nid2sn(nid); | 485 | s=OBJ_nid2sn(nid); |
| 459 | if (buf) | 486 | if (s) |
| 460 | BUF_strlcpy(buf,s,buf_len); | 487 | { |
| 461 | n=strlen(s); | 488 | if (buf) |
| 462 | return n; | 489 | BUF_strlcpy(buf,s,buf_len); |
| 490 | n=strlen(s); | ||
| 491 | return n; | ||
| 492 | } | ||
| 463 | } | 493 | } |
| 464 | 494 | ||
| 465 | 495 | ||
| @@ -607,62 +637,56 @@ int OBJ_txt2nid(const char *s) | |||
| 607 | 637 | ||
| 608 | int OBJ_ln2nid(const char *s) | 638 | int OBJ_ln2nid(const char *s) |
| 609 | { | 639 | { |
| 610 | ASN1_OBJECT o,*oo= &o,**op; | 640 | ASN1_OBJECT o; |
| 641 | const ASN1_OBJECT *oo= &o; | ||
| 611 | ADDED_OBJ ad,*adp; | 642 | ADDED_OBJ ad,*adp; |
| 643 | const unsigned int *op; | ||
| 612 | 644 | ||
| 613 | o.ln=s; | 645 | o.ln=s; |
| 614 | if (added != NULL) | 646 | if (added != NULL) |
| 615 | { | 647 | { |
| 616 | ad.type=ADDED_LNAME; | 648 | ad.type=ADDED_LNAME; |
| 617 | ad.obj= &o; | 649 | ad.obj= &o; |
| 618 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); | 650 | adp=lh_ADDED_OBJ_retrieve(added,&ad); |
| 619 | if (adp != NULL) return (adp->obj->nid); | 651 | if (adp != NULL) return (adp->obj->nid); |
| 620 | } | 652 | } |
| 621 | op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)ln_objs, NUM_LN, | 653 | op=OBJ_bsearch_ln(&oo, ln_objs, NUM_LN); |
| 622 | sizeof(ASN1_OBJECT *),ln_cmp); | ||
| 623 | if (op == NULL) return(NID_undef); | 654 | if (op == NULL) return(NID_undef); |
| 624 | return((*op)->nid); | 655 | return(nid_objs[*op].nid); |
| 625 | } | 656 | } |
| 626 | 657 | ||
| 627 | int OBJ_sn2nid(const char *s) | 658 | int OBJ_sn2nid(const char *s) |
| 628 | { | 659 | { |
| 629 | ASN1_OBJECT o,*oo= &o,**op; | 660 | ASN1_OBJECT o; |
| 661 | const ASN1_OBJECT *oo= &o; | ||
| 630 | ADDED_OBJ ad,*adp; | 662 | ADDED_OBJ ad,*adp; |
| 663 | const unsigned int *op; | ||
| 631 | 664 | ||
| 632 | o.sn=s; | 665 | o.sn=s; |
| 633 | if (added != NULL) | 666 | if (added != NULL) |
| 634 | { | 667 | { |
| 635 | ad.type=ADDED_SNAME; | 668 | ad.type=ADDED_SNAME; |
| 636 | ad.obj= &o; | 669 | ad.obj= &o; |
| 637 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); | 670 | adp=lh_ADDED_OBJ_retrieve(added,&ad); |
| 638 | if (adp != NULL) return (adp->obj->nid); | 671 | if (adp != NULL) return (adp->obj->nid); |
| 639 | } | 672 | } |
| 640 | op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)sn_objs,NUM_SN, | 673 | op=OBJ_bsearch_sn(&oo, sn_objs, NUM_SN); |
| 641 | sizeof(ASN1_OBJECT *),sn_cmp); | ||
| 642 | if (op == NULL) return(NID_undef); | 674 | if (op == NULL) return(NID_undef); |
| 643 | return((*op)->nid); | 675 | return(nid_objs[*op].nid); |
| 644 | } | 676 | } |
| 645 | 677 | ||
| 646 | static int obj_cmp(const void *ap, const void *bp) | 678 | const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, |
| 647 | { | 679 | int (*cmp)(const void *, const void *)) |
| 648 | int j; | ||
| 649 | const ASN1_OBJECT *a= *(ASN1_OBJECT * const *)ap; | ||
| 650 | const ASN1_OBJECT *b= *(ASN1_OBJECT * const *)bp; | ||
| 651 | |||
| 652 | j=(a->length - b->length); | ||
| 653 | if (j) return(j); | ||
| 654 | return(memcmp(a->data,b->data,a->length)); | ||
| 655 | } | ||
| 656 | |||
| 657 | const char *OBJ_bsearch(const char *key, const char *base, int num, int size, | ||
| 658 | int (*cmp)(const void *, const void *)) | ||
| 659 | { | 680 | { |
| 660 | return OBJ_bsearch_ex(key, base, num, size, cmp, 0); | 681 | return OBJ_bsearch_ex_(key, base, num, size, cmp, 0); |
| 661 | } | 682 | } |
| 662 | 683 | ||
| 663 | const char *OBJ_bsearch_ex(const char *key, const char *base, int num, | 684 | const void *OBJ_bsearch_ex_(const void *key, const void *base_, int num, |
| 664 | int size, int (*cmp)(const void *, const void *), int flags) | 685 | int size, |
| 686 | int (*cmp)(const void *, const void *), | ||
| 687 | int flags) | ||
| 665 | { | 688 | { |
| 689 | const char *base=base_; | ||
| 666 | int l,h,i=0,c=0; | 690 | int l,h,i=0,c=0; |
| 667 | const char *p = NULL; | 691 | const char *p = NULL; |
| 668 | 692 | ||
diff --git a/src/lib/libcrypto/objects/obj_dat.pl b/src/lib/libcrypto/objects/obj_dat.pl index 7de2f77afd..c67f71c327 100644 --- a/src/lib/libcrypto/objects/obj_dat.pl +++ b/src/lib/libcrypto/objects/obj_dat.pl | |||
| @@ -2,9 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | # fixes bug in floating point emulation on sparc64 when | 3 | # fixes bug in floating point emulation on sparc64 when |
| 4 | # this script produces off-by-one output on sparc64 | 4 | # this script produces off-by-one output on sparc64 |
| 5 | eval 'use integer;'; | 5 | use integer; |
| 6 | |||
| 7 | print STDERR "Warning: perl module integer not found.\n" if ($@); | ||
| 8 | 6 | ||
| 9 | sub obj_cmp | 7 | sub obj_cmp |
| 10 | { | 8 | { |
| @@ -150,13 +148,13 @@ for ($i=0; $i<$n; $i++) | |||
| 150 | @a=grep(defined($sn{$nid{$_}}),0 .. $n); | 148 | @a=grep(defined($sn{$nid{$_}}),0 .. $n); |
| 151 | foreach (sort { $sn{$nid{$a}} cmp $sn{$nid{$b}} } @a) | 149 | foreach (sort { $sn{$nid{$a}} cmp $sn{$nid{$b}} } @a) |
| 152 | { | 150 | { |
| 153 | push(@sn,sprintf("&(nid_objs[%2d]),/* \"$sn{$nid{$_}}\" */\n",$_)); | 151 | push(@sn,sprintf("%2d,\t/* \"$sn{$nid{$_}}\" */\n",$_)); |
| 154 | } | 152 | } |
| 155 | 153 | ||
| 156 | @a=grep(defined($ln{$nid{$_}}),0 .. $n); | 154 | @a=grep(defined($ln{$nid{$_}}),0 .. $n); |
| 157 | foreach (sort { $ln{$nid{$a}} cmp $ln{$nid{$b}} } @a) | 155 | foreach (sort { $ln{$nid{$a}} cmp $ln{$nid{$b}} } @a) |
| 158 | { | 156 | { |
| 159 | push(@ln,sprintf("&(nid_objs[%2d]),/* \"$ln{$nid{$_}}\" */\n",$_)); | 157 | push(@ln,sprintf("%2d,\t/* \"$ln{$nid{$_}}\" */\n",$_)); |
| 160 | } | 158 | } |
| 161 | 159 | ||
| 162 | @a=grep(defined($obj{$nid{$_}}),0 .. $n); | 160 | @a=grep(defined($obj{$nid{$_}}),0 .. $n); |
| @@ -166,7 +164,7 @@ foreach (sort obj_cmp @a) | |||
| 166 | $v=$objd{$m}; | 164 | $v=$objd{$m}; |
| 167 | $v =~ s/L//g; | 165 | $v =~ s/L//g; |
| 168 | $v =~ s/,/ /g; | 166 | $v =~ s/,/ /g; |
| 169 | push(@ob,sprintf("&(nid_objs[%2d]),/* %-32s %s */\n",$_,$m,$v)); | 167 | push(@ob,sprintf("%2d,\t/* %-32s %s */\n",$_,$m,$v)); |
| 170 | } | 168 | } |
| 171 | 169 | ||
| 172 | print OUT <<'EOF'; | 170 | print OUT <<'EOF'; |
| @@ -241,11 +239,11 @@ printf OUT "#define NUM_SN %d\n",$#sn+1; | |||
| 241 | printf OUT "#define NUM_LN %d\n",$#ln+1; | 239 | printf OUT "#define NUM_LN %d\n",$#ln+1; |
| 242 | printf OUT "#define NUM_OBJ %d\n\n",$#ob+1; | 240 | printf OUT "#define NUM_OBJ %d\n\n",$#ob+1; |
| 243 | 241 | ||
| 244 | printf OUT "static unsigned char lvalues[%d]={\n",$lvalues+1; | 242 | printf OUT "static const unsigned char lvalues[%d]={\n",$lvalues+1; |
| 245 | print OUT @lvalues; | 243 | print OUT @lvalues; |
| 246 | print OUT "};\n\n"; | 244 | print OUT "};\n\n"; |
| 247 | 245 | ||
| 248 | printf OUT "static ASN1_OBJECT nid_objs[NUM_NID]={\n"; | 246 | printf OUT "static const ASN1_OBJECT nid_objs[NUM_NID]={\n"; |
| 249 | foreach (@out) | 247 | foreach (@out) |
| 250 | { | 248 | { |
| 251 | if (length($_) > 75) | 249 | if (length($_) > 75) |
| @@ -269,15 +267,15 @@ foreach (@out) | |||
| 269 | } | 267 | } |
| 270 | print OUT "};\n\n"; | 268 | print OUT "};\n\n"; |
| 271 | 269 | ||
| 272 | printf OUT "static ASN1_OBJECT *sn_objs[NUM_SN]={\n"; | 270 | printf OUT "static const unsigned int sn_objs[NUM_SN]={\n"; |
| 273 | print OUT @sn; | 271 | print OUT @sn; |
| 274 | print OUT "};\n\n"; | 272 | print OUT "};\n\n"; |
| 275 | 273 | ||
| 276 | printf OUT "static ASN1_OBJECT *ln_objs[NUM_LN]={\n"; | 274 | printf OUT "static const unsigned int ln_objs[NUM_LN]={\n"; |
| 277 | print OUT @ln; | 275 | print OUT @ln; |
| 278 | print OUT "};\n\n"; | 276 | print OUT "};\n\n"; |
| 279 | 277 | ||
| 280 | printf OUT "static ASN1_OBJECT *obj_objs[NUM_OBJ]={\n"; | 278 | printf OUT "static const unsigned int obj_objs[NUM_OBJ]={\n"; |
| 281 | print OUT @ob; | 279 | print OUT @ob; |
| 282 | print OUT "};\n\n"; | 280 | print OUT "};\n\n"; |
| 283 | 281 | ||
diff --git a/src/lib/libcrypto/objects/obj_err.c b/src/lib/libcrypto/objects/obj_err.c index 12b48850c6..2e7a034c3f 100644 --- a/src/lib/libcrypto/objects/obj_err.c +++ b/src/lib/libcrypto/objects/obj_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/objects/obj_err.c */ | 1 | /* crypto/objects/obj_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/objects/obj_lib.c b/src/lib/libcrypto/objects/obj_lib.c index 706fa0b0e7..23e9d48cdf 100644 --- a/src/lib/libcrypto/objects/obj_lib.c +++ b/src/lib/libcrypto/objects/obj_lib.c | |||
| @@ -66,7 +66,8 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) | |||
| 66 | { | 66 | { |
| 67 | ASN1_OBJECT *r; | 67 | ASN1_OBJECT *r; |
| 68 | int i; | 68 | int i; |
| 69 | char *ln=NULL; | 69 | char *ln=NULL,*sn=NULL; |
| 70 | unsigned char *data=NULL; | ||
| 70 | 71 | ||
| 71 | if (o == NULL) return(NULL); | 72 | if (o == NULL) return(NULL); |
| 72 | if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC)) | 73 | if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC)) |
| @@ -79,42 +80,42 @@ ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o) | |||
| 79 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB); | 80 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB); |
| 80 | return(NULL); | 81 | return(NULL); |
| 81 | } | 82 | } |
| 82 | r->data=OPENSSL_malloc(o->length); | 83 | data=OPENSSL_malloc(o->length); |
| 83 | if (r->data == NULL) | 84 | if (data == NULL) |
| 84 | goto err; | 85 | goto err; |
| 85 | if (o->data != NULL) | 86 | if (o->data != NULL) |
| 86 | memcpy(r->data,o->data,o->length); | 87 | memcpy(data,o->data,o->length); |
| 88 | /* once data attached to object it remains const */ | ||
| 89 | r->data = data; | ||
| 87 | r->length=o->length; | 90 | r->length=o->length; |
| 88 | r->nid=o->nid; | 91 | r->nid=o->nid; |
| 89 | r->ln=r->sn=NULL; | 92 | r->ln=r->sn=NULL; |
| 90 | if (o->ln != NULL) | 93 | if (o->ln != NULL) |
| 91 | { | 94 | { |
| 92 | i=strlen(o->ln)+1; | 95 | i=strlen(o->ln)+1; |
| 93 | r->ln=ln=OPENSSL_malloc(i); | 96 | ln=OPENSSL_malloc(i); |
| 94 | if (r->ln == NULL) goto err; | 97 | if (ln == NULL) goto err; |
| 95 | memcpy(ln,o->ln,i); | 98 | memcpy(ln,o->ln,i); |
| 99 | r->ln=ln; | ||
| 96 | } | 100 | } |
| 97 | 101 | ||
| 98 | if (o->sn != NULL) | 102 | if (o->sn != NULL) |
| 99 | { | 103 | { |
| 100 | char *s; | ||
| 101 | |||
| 102 | i=strlen(o->sn)+1; | 104 | i=strlen(o->sn)+1; |
| 103 | r->sn=s=OPENSSL_malloc(i); | 105 | sn=OPENSSL_malloc(i); |
| 104 | if (r->sn == NULL) goto err; | 106 | if (sn == NULL) goto err; |
| 105 | memcpy(s,o->sn,i); | 107 | memcpy(sn,o->sn,i); |
| 108 | r->sn=sn; | ||
| 106 | } | 109 | } |
| 107 | r->flags=o->flags|(ASN1_OBJECT_FLAG_DYNAMIC| | 110 | r->flags=o->flags|(ASN1_OBJECT_FLAG_DYNAMIC| |
| 108 | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|ASN1_OBJECT_FLAG_DYNAMIC_DATA); | 111 | ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|ASN1_OBJECT_FLAG_DYNAMIC_DATA); |
| 109 | return(r); | 112 | return(r); |
| 110 | err: | 113 | err: |
| 111 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE); | 114 | OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE); |
| 112 | if (r != NULL) | 115 | if (ln != NULL) OPENSSL_free(ln); |
| 113 | { | 116 | if (sn != NULL) OPENSSL_free(sn); |
| 114 | if (ln != NULL) OPENSSL_free(ln); | 117 | if (data != NULL) OPENSSL_free(data); |
| 115 | if (r->data != NULL) OPENSSL_free(r->data); | 118 | if (r != NULL) OPENSSL_free(r); |
| 116 | OPENSSL_free(r); | ||
| 117 | } | ||
| 118 | return(NULL); | 119 | return(NULL); |
| 119 | } | 120 | } |
| 120 | 121 | ||
diff --git a/src/lib/libcrypto/objects/obj_mac.num b/src/lib/libcrypto/objects/obj_mac.num index e3f56bc52c..8c50aac27f 100644 --- a/src/lib/libcrypto/objects/obj_mac.num +++ b/src/lib/libcrypto/objects/obj_mac.num | |||
| @@ -856,3 +856,37 @@ hmac 855 | |||
| 856 | LocalKeySet 856 | 856 | LocalKeySet 856 |
| 857 | freshest_crl 857 | 857 | freshest_crl 857 |
| 858 | id_on_permanentIdentifier 858 | 858 | id_on_permanentIdentifier 858 |
| 859 | searchGuide 859 | ||
| 860 | businessCategory 860 | ||
| 861 | postalAddress 861 | ||
| 862 | postOfficeBox 862 | ||
| 863 | physicalDeliveryOfficeName 863 | ||
| 864 | telephoneNumber 864 | ||
| 865 | telexNumber 865 | ||
| 866 | teletexTerminalIdentifier 866 | ||
| 867 | facsimileTelephoneNumber 867 | ||
| 868 | x121Address 868 | ||
| 869 | internationaliSDNNumber 869 | ||
| 870 | registeredAddress 870 | ||
| 871 | destinationIndicator 871 | ||
| 872 | preferredDeliveryMethod 872 | ||
| 873 | presentationAddress 873 | ||
| 874 | supportedApplicationContext 874 | ||
| 875 | member 875 | ||
| 876 | owner 876 | ||
| 877 | roleOccupant 877 | ||
| 878 | seeAlso 878 | ||
| 879 | userPassword 879 | ||
| 880 | userCertificate 880 | ||
| 881 | cACertificate 881 | ||
| 882 | authorityRevocationList 882 | ||
| 883 | certificateRevocationList 883 | ||
| 884 | crossCertificatePair 884 | ||
| 885 | enhancedSearchGuide 885 | ||
| 886 | protocolInformation 886 | ||
| 887 | distinguishedName 887 | ||
| 888 | uniqueMember 888 | ||
| 889 | houseIdentifier 889 | ||
| 890 | supportedAlgorithms 890 | ||
| 891 | deltaRevocationList 891 | ||
| 892 | dmdName 892 | ||
diff --git a/src/lib/libcrypto/objects/objects.h b/src/lib/libcrypto/objects/objects.h index 7242f76fb0..bd0ee52feb 100644 --- a/src/lib/libcrypto/objects/objects.h +++ b/src/lib/libcrypto/objects/objects.h | |||
| @@ -1011,10 +1011,91 @@ int OBJ_txt2nid(const char *s); | |||
| 1011 | int OBJ_ln2nid(const char *s); | 1011 | int OBJ_ln2nid(const char *s); |
| 1012 | int OBJ_sn2nid(const char *s); | 1012 | int OBJ_sn2nid(const char *s); |
| 1013 | int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b); | 1013 | int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b); |
| 1014 | const char * OBJ_bsearch(const char *key,const char *base,int num,int size, | 1014 | const void * OBJ_bsearch_(const void *key,const void *base,int num,int size, |
| 1015 | int (*cmp)(const void *, const void *)); | 1015 | int (*cmp)(const void *, const void *)); |
| 1016 | const char * OBJ_bsearch_ex(const char *key,const char *base,int num, | 1016 | const void * OBJ_bsearch_ex_(const void *key,const void *base,int num, |
| 1017 | int size, int (*cmp)(const void *, const void *), int flags); | 1017 | int size, |
| 1018 | int (*cmp)(const void *, const void *), | ||
| 1019 | int flags); | ||
| 1020 | |||
| 1021 | #define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ | ||
| 1022 | static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ | ||
| 1023 | static int nm##_cmp(type1 const *, type2 const *); \ | ||
| 1024 | scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) | ||
| 1025 | |||
| 1026 | #define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ | ||
| 1027 | _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) | ||
| 1028 | #define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ | ||
| 1029 | type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) | ||
| 1030 | |||
| 1031 | /* | ||
| 1032 | * Unsolved problem: if a type is actually a pointer type, like | ||
| 1033 | * nid_triple is, then its impossible to get a const where you need | ||
| 1034 | * it. Consider: | ||
| 1035 | * | ||
| 1036 | * typedef int nid_triple[3]; | ||
| 1037 | * const void *a_; | ||
| 1038 | * const nid_triple const *a = a_; | ||
| 1039 | * | ||
| 1040 | * The assignement discards a const because what you really want is: | ||
| 1041 | * | ||
| 1042 | * const int const * const *a = a_; | ||
| 1043 | * | ||
| 1044 | * But if you do that, you lose the fact that a is an array of 3 ints, | ||
| 1045 | * which breaks comparison functions. | ||
| 1046 | * | ||
| 1047 | * Thus we end up having to cast, sadly, or unpack the | ||
| 1048 | * declarations. Or, as I finally did in this case, delcare nid_triple | ||
| 1049 | * to be a struct, which it should have been in the first place. | ||
| 1050 | * | ||
| 1051 | * Ben, August 2008. | ||
| 1052 | * | ||
| 1053 | * Also, strictly speaking not all types need be const, but handling | ||
| 1054 | * the non-constness means a lot of complication, and in practice | ||
| 1055 | * comparison routines do always not touch their arguments. | ||
| 1056 | */ | ||
| 1057 | |||
| 1058 | #define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ | ||
| 1059 | static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ | ||
| 1060 | { \ | ||
| 1061 | type1 const *a = a_; \ | ||
| 1062 | type2 const *b = b_; \ | ||
| 1063 | return nm##_cmp(a,b); \ | ||
| 1064 | } \ | ||
| 1065 | static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ | ||
| 1066 | { \ | ||
| 1067 | return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ | ||
| 1068 | nm##_cmp_BSEARCH_CMP_FN); \ | ||
| 1069 | } \ | ||
| 1070 | extern void dummy_prototype(void) | ||
| 1071 | |||
| 1072 | #define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ | ||
| 1073 | static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ | ||
| 1074 | { \ | ||
| 1075 | type1 const *a = a_; \ | ||
| 1076 | type2 const *b = b_; \ | ||
| 1077 | return nm##_cmp(a,b); \ | ||
| 1078 | } \ | ||
| 1079 | type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ | ||
| 1080 | { \ | ||
| 1081 | return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ | ||
| 1082 | nm##_cmp_BSEARCH_CMP_FN); \ | ||
| 1083 | } \ | ||
| 1084 | extern void dummy_prototype(void) | ||
| 1085 | |||
| 1086 | #define OBJ_bsearch(type1,key,type2,base,num,cmp) \ | ||
| 1087 | ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ | ||
| 1088 | num,sizeof(type2), \ | ||
| 1089 | ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ | ||
| 1090 | (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ | ||
| 1091 | cmp##_BSEARCH_CMP_FN))) | ||
| 1092 | |||
| 1093 | #define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ | ||
| 1094 | ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ | ||
| 1095 | num,sizeof(type2), \ | ||
| 1096 | ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ | ||
| 1097 | (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ | ||
| 1098 | cmp##_BSEARCH_CMP_FN)),flags) | ||
| 1018 | 1099 | ||
| 1019 | int OBJ_new_nid(int num); | 1100 | int OBJ_new_nid(int num); |
| 1020 | int OBJ_add_object(const ASN1_OBJECT *obj); | 1101 | int OBJ_add_object(const ASN1_OBJECT *obj); |
| @@ -1022,6 +1103,14 @@ int OBJ_create(const char *oid,const char *sn,const char *ln); | |||
| 1022 | void OBJ_cleanup(void ); | 1103 | void OBJ_cleanup(void ); |
| 1023 | int OBJ_create_objects(BIO *in); | 1104 | int OBJ_create_objects(BIO *in); |
| 1024 | 1105 | ||
| 1106 | int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); | ||
| 1107 | int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); | ||
| 1108 | int OBJ_add_sigid(int signid, int dig_id, int pkey_id); | ||
| 1109 | void OBJ_sigid_free(void); | ||
| 1110 | |||
| 1111 | extern int obj_cleanup_defer; | ||
| 1112 | void check_defer(int nid); | ||
| 1113 | |||
| 1025 | /* BEGIN ERROR CODES */ | 1114 | /* BEGIN ERROR CODES */ |
| 1026 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 1115 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 1027 | * made after this point may be overwritten when the script is next run. | 1116 | * made after this point may be overwritten when the script is next run. |
diff --git a/src/lib/libcrypto/objects/objects.pl b/src/lib/libcrypto/objects/objects.pl index 76bb8da677..d2bf659d88 100644 --- a/src/lib/libcrypto/objects/objects.pl +++ b/src/lib/libcrypto/objects/objects.pl | |||
| @@ -14,6 +14,8 @@ while(<NUMIN>) | |||
| 14 | $Cname =~ s/^X//; | 14 | $Cname =~ s/^X//; |
| 15 | if (defined($nidn{$mynum})) | 15 | if (defined($nidn{$mynum})) |
| 16 | { die "$ARGV[1]:$o:There's already an object with NID ",$mynum," on line ",$order{$mynum},"\n"; } | 16 | { die "$ARGV[1]:$o:There's already an object with NID ",$mynum," on line ",$order{$mynum},"\n"; } |
| 17 | if (defined($nid{$Cname})) | ||
| 18 | { die "$ARGV[1]:$o:There's already an object with name ",$Cname," on line ",$order{$nid{$Cname}},"\n"; } | ||
| 17 | $nid{$Cname} = $mynum; | 19 | $nid{$Cname} = $mynum; |
| 18 | $nidn{$mynum} = $Cname; | 20 | $nidn{$mynum} = $Cname; |
| 19 | $order{$mynum} = $o; | 21 | $order{$mynum} = $o; |
| @@ -102,6 +104,7 @@ while (<IN>) | |||
| 102 | $max_nid++; | 104 | $max_nid++; |
| 103 | $nid{$Cname} = $max_nid; | 105 | $nid{$Cname} = $max_nid; |
| 104 | $nidn{$max_nid} = $Cname; | 106 | $nidn{$max_nid} = $Cname; |
| 107 | print STDERR "Added OID $Cname\n"; | ||
| 105 | } | 108 | } |
| 106 | $Cname=""; | 109 | $Cname=""; |
| 107 | } | 110 | } |
diff --git a/src/lib/libcrypto/objects/objects.txt b/src/lib/libcrypto/objects/objects.txt index a6a811b8e7..e61fe60cbf 100644 --- a/src/lib/libcrypto/objects/objects.txt +++ b/src/lib/libcrypto/objects/objects.txt | |||
| @@ -20,7 +20,7 @@ identified-organization 132 : certicom-arc | |||
| 20 | joint-iso-itu-t 23 : international-organizations : International Organizations | 20 | joint-iso-itu-t 23 : international-organizations : International Organizations |
| 21 | 21 | ||
| 22 | international-organizations 43 : wap | 22 | international-organizations 43 : wap |
| 23 | wap 13 : wap-wsg | 23 | wap 1 : wap-wsg |
| 24 | 24 | ||
| 25 | joint-iso-itu-t 5 1 5 : selected-attribute-types : Selected Attribute Types | 25 | joint-iso-itu-t 5 1 5 : selected-attribute-types : Selected Attribute Types |
| 26 | 26 | ||
| @@ -664,18 +664,52 @@ X509 5 : : serialNumber | |||
| 664 | X509 6 : C : countryName | 664 | X509 6 : C : countryName |
| 665 | X509 7 : L : localityName | 665 | X509 7 : L : localityName |
| 666 | X509 8 : ST : stateOrProvinceName | 666 | X509 8 : ST : stateOrProvinceName |
| 667 | X509 9 : : streetAddress | 667 | X509 9 : street : streetAddress |
| 668 | X509 10 : O : organizationName | 668 | X509 10 : O : organizationName |
| 669 | X509 11 : OU : organizationalUnitName | 669 | X509 11 : OU : organizationalUnitName |
| 670 | X509 12 : : title | 670 | X509 12 : title : title |
| 671 | X509 13 : : description | 671 | X509 13 : : description |
| 672 | X509 17 : : postalCode | 672 | X509 14 : : searchGuide |
| 673 | X509 15 : : businessCategory | ||
| 674 | X509 16 : : postalAddress | ||
| 675 | X509 17 : : postalCode | ||
| 676 | X509 18 : : postOfficeBox | ||
| 677 | X509 19 : : physicalDeliveryOfficeName | ||
| 678 | X509 20 : : telephoneNumber | ||
| 679 | X509 21 : : telexNumber | ||
| 680 | X509 22 : : teletexTerminalIdentifier | ||
| 681 | X509 23 : : facsimileTelephoneNumber | ||
| 682 | X509 24 : : x121Address | ||
| 683 | X509 25 : : internationaliSDNNumber | ||
| 684 | X509 26 : : registeredAddress | ||
| 685 | X509 27 : : destinationIndicator | ||
| 686 | X509 28 : : preferredDeliveryMethod | ||
| 687 | X509 29 : : presentationAddress | ||
| 688 | X509 30 : : supportedApplicationContext | ||
| 689 | X509 31 : member : | ||
| 690 | X509 32 : owner : | ||
| 691 | X509 33 : : roleOccupant | ||
| 692 | X509 34 : seeAlso : | ||
| 693 | X509 35 : : userPassword | ||
| 694 | X509 36 : : userCertificate | ||
| 695 | X509 37 : : cACertificate | ||
| 696 | X509 38 : : authorityRevocationList | ||
| 697 | X509 39 : : certificateRevocationList | ||
| 698 | X509 40 : : crossCertificatePair | ||
| 673 | X509 41 : name : name | 699 | X509 41 : name : name |
| 674 | X509 42 : GN : givenName | 700 | X509 42 : GN : givenName |
| 675 | X509 43 : : initials | 701 | X509 43 : initials : initials |
| 676 | X509 44 : : generationQualifier | 702 | X509 44 : : generationQualifier |
| 677 | X509 45 : : x500UniqueIdentifier | 703 | X509 45 : : x500UniqueIdentifier |
| 678 | X509 46 : dnQualifier : dnQualifier | 704 | X509 46 : dnQualifier : dnQualifier |
| 705 | X509 47 : : enhancedSearchGuide | ||
| 706 | X509 48 : : protocolInformation | ||
| 707 | X509 49 : : distinguishedName | ||
| 708 | X509 50 : : uniqueMember | ||
| 709 | X509 51 : : houseIdentifier | ||
| 710 | X509 52 : : supportedAlgorithms | ||
| 711 | X509 53 : : deltaRevocationList | ||
| 712 | X509 54 : dmdName : | ||
| 679 | X509 65 : : pseudonym | 713 | X509 65 : : pseudonym |
| 680 | X509 72 : role : role | 714 | X509 72 : role : role |
| 681 | 715 | ||
diff --git a/src/lib/libcrypto/ocsp/Makefile.ssl b/src/lib/libcrypto/ocsp/Makefile.ssl deleted file mode 100644 index 02477be538..0000000000 --- a/src/lib/libcrypto/ocsp/Makefile.ssl +++ /dev/null | |||
| @@ -1,293 +0,0 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/ocsp/Makefile.ssl | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= ocsp | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile README | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= ocsp_asn.c ocsp_ext.c ocsp_ht.c ocsp_lib.c ocsp_cl.c \ | ||
| 27 | ocsp_srv.c ocsp_prn.c ocsp_vfy.c ocsp_err.c | ||
| 28 | |||
| 29 | LIBOBJ= ocsp_asn.o ocsp_ext.o ocsp_ht.o ocsp_lib.o ocsp_cl.o \ | ||
| 30 | ocsp_srv.o ocsp_prn.o ocsp_vfy.o ocsp_err.o | ||
| 31 | |||
| 32 | SRC= $(LIBSRC) | ||
| 33 | |||
| 34 | EXHEADER= ocsp.h | ||
| 35 | HEADER= $(EXHEADER) | ||
| 36 | |||
| 37 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 38 | |||
| 39 | top: | ||
| 40 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 41 | |||
| 42 | all: lib | ||
| 43 | |||
| 44 | lib: $(LIBOBJ) | ||
| 45 | $(AR) $(LIB) $(LIBOBJ) | ||
| 46 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 47 | @touch lib | ||
| 48 | |||
| 49 | files: | ||
| 50 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 51 | |||
| 52 | links: | ||
| 53 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile ; | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 60 | do \ | ||
| 61 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 62 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 63 | done; | ||
| 64 | |||
| 65 | tags: | ||
| 66 | ctags $(SRC) | ||
| 67 | |||
| 68 | tests: | ||
| 69 | |||
| 70 | lint: | ||
| 71 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 72 | |||
| 73 | depend: | ||
| 74 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 82 | |||
| 83 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 84 | |||
| 85 | ocsp_asn.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 86 | ocsp_asn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 87 | ocsp_asn.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 88 | ocsp_asn.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 89 | ocsp_asn.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 90 | ocsp_asn.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 91 | ocsp_asn.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 92 | ocsp_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h | ||
| 93 | ocsp_asn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 94 | ocsp_asn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 95 | ocsp_asn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 96 | ocsp_asn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 97 | ocsp_asn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h | ||
| 98 | ocsp_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 99 | ocsp_asn.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 100 | ocsp_asn.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 101 | ocsp_asn.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 102 | ocsp_asn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 103 | ocsp_asn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 104 | ocsp_asn.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 105 | ocsp_asn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 106 | ocsp_asn.o: ../../include/openssl/x509v3.h ocsp_asn.c | ||
| 107 | ocsp_cl.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 108 | ocsp_cl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 109 | ocsp_cl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 110 | ocsp_cl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 111 | ocsp_cl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 112 | ocsp_cl.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 113 | ocsp_cl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 114 | ocsp_cl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 115 | ocsp_cl.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 116 | ocsp_cl.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 117 | ocsp_cl.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 118 | ocsp_cl.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 119 | ocsp_cl.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 120 | ocsp_cl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 121 | ocsp_cl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 122 | ocsp_cl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 123 | ocsp_cl.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 124 | ocsp_cl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 125 | ocsp_cl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 126 | ocsp_cl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 127 | ocsp_cl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 128 | ocsp_cl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 129 | ocsp_cl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 130 | ocsp_cl.o: ../../include/openssl/x509v3.h ../cryptlib.h ocsp_cl.c | ||
| 131 | ocsp_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 132 | ocsp_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 133 | ocsp_err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 134 | ocsp_err.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 135 | ocsp_err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 136 | ocsp_err.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 137 | ocsp_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 138 | ocsp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 139 | ocsp_err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 140 | ocsp_err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 141 | ocsp_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 142 | ocsp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 143 | ocsp_err.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h | ||
| 144 | ocsp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 145 | ocsp_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 146 | ocsp_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 147 | ocsp_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 148 | ocsp_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 149 | ocsp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 150 | ocsp_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 151 | ocsp_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 152 | ocsp_err.o: ../../include/openssl/x509v3.h ocsp_err.c | ||
| 153 | ocsp_ext.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 154 | ocsp_ext.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 155 | ocsp_ext.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 156 | ocsp_ext.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 157 | ocsp_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 158 | ocsp_ext.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 159 | ocsp_ext.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 160 | ocsp_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 161 | ocsp_ext.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 162 | ocsp_ext.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 163 | ocsp_ext.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 164 | ocsp_ext.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 165 | ocsp_ext.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 166 | ocsp_ext.o: ../../include/openssl/opensslconf.h | ||
| 167 | ocsp_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 168 | ocsp_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 169 | ocsp_ext.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 170 | ocsp_ext.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 171 | ocsp_ext.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 172 | ocsp_ext.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 173 | ocsp_ext.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 174 | ocsp_ext.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 175 | ocsp_ext.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 176 | ocsp_ext.o: ../cryptlib.h ocsp_ext.c | ||
| 177 | ocsp_ht.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 178 | ocsp_ht.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 179 | ocsp_ht.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 180 | ocsp_ht.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 181 | ocsp_ht.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 182 | ocsp_ht.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 183 | ocsp_ht.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 184 | ocsp_ht.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 185 | ocsp_ht.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 186 | ocsp_ht.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 187 | ocsp_ht.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 188 | ocsp_ht.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 189 | ocsp_ht.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h | ||
| 190 | ocsp_ht.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 191 | ocsp_ht.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 192 | ocsp_ht.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 193 | ocsp_ht.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 194 | ocsp_ht.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 195 | ocsp_ht.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 196 | ocsp_ht.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 197 | ocsp_ht.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 198 | ocsp_ht.o: ../../include/openssl/x509v3.h ocsp_ht.c | ||
| 199 | ocsp_lib.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 200 | ocsp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 201 | ocsp_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 202 | ocsp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 203 | ocsp_lib.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 204 | ocsp_lib.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 205 | ocsp_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 206 | ocsp_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 207 | ocsp_lib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 208 | ocsp_lib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 209 | ocsp_lib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 210 | ocsp_lib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 211 | ocsp_lib.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 212 | ocsp_lib.o: ../../include/openssl/opensslconf.h | ||
| 213 | ocsp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 214 | ocsp_lib.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 215 | ocsp_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 216 | ocsp_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 217 | ocsp_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 218 | ocsp_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 219 | ocsp_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 220 | ocsp_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 221 | ocsp_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 222 | ocsp_lib.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 223 | ocsp_lib.o: ../cryptlib.h ocsp_lib.c | ||
| 224 | ocsp_prn.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 225 | ocsp_prn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 226 | ocsp_prn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 227 | ocsp_prn.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 228 | ocsp_prn.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 229 | ocsp_prn.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 230 | ocsp_prn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 231 | ocsp_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 232 | ocsp_prn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 233 | ocsp_prn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 234 | ocsp_prn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 235 | ocsp_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 236 | ocsp_prn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h | ||
| 237 | ocsp_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 238 | ocsp_prn.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 239 | ocsp_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 240 | ocsp_prn.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 241 | ocsp_prn.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 242 | ocsp_prn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 243 | ocsp_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 244 | ocsp_prn.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 245 | ocsp_prn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 246 | ocsp_prn.o: ../../include/openssl/x509v3.h ocsp_prn.c | ||
| 247 | ocsp_srv.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 248 | ocsp_srv.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 249 | ocsp_srv.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 250 | ocsp_srv.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 251 | ocsp_srv.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 252 | ocsp_srv.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 253 | ocsp_srv.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 254 | ocsp_srv.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 255 | ocsp_srv.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 256 | ocsp_srv.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 257 | ocsp_srv.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 258 | ocsp_srv.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 259 | ocsp_srv.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 260 | ocsp_srv.o: ../../include/openssl/opensslconf.h | ||
| 261 | ocsp_srv.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 262 | ocsp_srv.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 263 | ocsp_srv.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 264 | ocsp_srv.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 265 | ocsp_srv.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 266 | ocsp_srv.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 267 | ocsp_srv.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 268 | ocsp_srv.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 269 | ocsp_srv.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 270 | ocsp_srv.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 271 | ocsp_srv.o: ../cryptlib.h ocsp_srv.c | ||
| 272 | ocsp_vfy.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 273 | ocsp_vfy.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 274 | ocsp_vfy.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 275 | ocsp_vfy.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 276 | ocsp_vfy.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 277 | ocsp_vfy.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 278 | ocsp_vfy.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 279 | ocsp_vfy.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 280 | ocsp_vfy.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 281 | ocsp_vfy.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 282 | ocsp_vfy.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 283 | ocsp_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 284 | ocsp_vfy.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h | ||
| 285 | ocsp_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 286 | ocsp_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 287 | ocsp_vfy.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 288 | ocsp_vfy.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 289 | ocsp_vfy.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 290 | ocsp_vfy.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 291 | ocsp_vfy.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 292 | ocsp_vfy.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 293 | ocsp_vfy.o: ../../include/openssl/x509v3.h ocsp_vfy.c | ||
diff --git a/src/lib/libcrypto/ocsp/ocsp.h b/src/lib/libcrypto/ocsp/ocsp.h index a0577a717e..31e45744ba 100644 --- a/src/lib/libcrypto/ocsp/ocsp.h +++ b/src/lib/libcrypto/ocsp/ocsp.h | |||
| @@ -64,6 +64,7 @@ | |||
| 64 | #ifndef HEADER_OCSP_H | 64 | #ifndef HEADER_OCSP_H |
| 65 | #define HEADER_OCSP_H | 65 | #define HEADER_OCSP_H |
| 66 | 66 | ||
| 67 | #include <openssl/ossl_typ.h> | ||
| 67 | #include <openssl/x509.h> | 68 | #include <openssl/x509.h> |
| 68 | #include <openssl/x509v3.h> | 69 | #include <openssl/x509v3.h> |
| 69 | #include <openssl/safestack.h> | 70 | #include <openssl/safestack.h> |
| @@ -394,17 +395,20 @@ typedef struct ocsp_service_locator_st | |||
| 394 | #define ASN1_BIT_STRING_digest(data,type,md,len) \ | 395 | #define ASN1_BIT_STRING_digest(data,type,md,len) \ |
| 395 | ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) | 396 | ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) |
| 396 | 397 | ||
| 397 | #define OCSP_CERTID_dup(cid) ASN1_dup_of(OCSP_CERTID,i2d_OCSP_CERTID,d2i_OCSP_CERTID,cid) | ||
| 398 | |||
| 399 | #define OCSP_CERTSTATUS_dup(cs)\ | 398 | #define OCSP_CERTSTATUS_dup(cs)\ |
| 400 | (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ | 399 | (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ |
| 401 | (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) | 400 | (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) |
| 402 | 401 | ||
| 402 | OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id); | ||
| 403 | |||
| 403 | OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req); | 404 | OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req); |
| 404 | OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, | 405 | OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, |
| 405 | int maxline); | 406 | int maxline); |
| 406 | int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); | 407 | int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); |
| 407 | void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); | 408 | void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); |
| 409 | int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); | ||
| 410 | int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, | ||
| 411 | const char *name, const char *value); | ||
| 408 | 412 | ||
| 409 | OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer); | 413 | OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer); |
| 410 | 414 | ||
| @@ -474,11 +478,6 @@ int OCSP_basic_sign(OCSP_BASICRESP *brsp, | |||
| 474 | X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, | 478 | X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, |
| 475 | STACK_OF(X509) *certs, unsigned long flags); | 479 | STACK_OF(X509) *certs, unsigned long flags); |
| 476 | 480 | ||
| 477 | ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, | ||
| 478 | void *data, STACK_OF(ASN1_OBJECT) *sk); | ||
| 479 | #define ASN1_STRING_encode_of(type,s,i2d,data,sk) \ | ||
| 480 | ASN1_STRING_encode(s, CHECKED_I2D_OF(type, i2d), data, sk) | ||
| 481 | |||
| 482 | X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim); | 481 | X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim); |
| 483 | 482 | ||
| 484 | X509_EXTENSION *OCSP_accept_responses_new(char **oids); | 483 | X509_EXTENSION *OCSP_accept_responses_new(char **oids); |
| @@ -547,9 +546,9 @@ DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) | |||
| 547 | DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) | 546 | DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) |
| 548 | DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) | 547 | DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) |
| 549 | 548 | ||
| 550 | char *OCSP_response_status_str(long s); | 549 | const char *OCSP_response_status_str(long s); |
| 551 | char *OCSP_cert_status_str(long s); | 550 | const char *OCSP_cert_status_str(long s); |
| 552 | char *OCSP_crl_reason_str(long s); | 551 | const char *OCSP_crl_reason_str(long s); |
| 553 | 552 | ||
| 554 | int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags); | 553 | int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags); |
| 555 | int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags); | 554 | int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags); |
| @@ -582,7 +581,8 @@ void ERR_load_OCSP_strings(void); | |||
| 582 | #define OCSP_F_OCSP_REQUEST_VERIFY 116 | 581 | #define OCSP_F_OCSP_REQUEST_VERIFY 116 |
| 583 | #define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 | 582 | #define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 |
| 584 | #define OCSP_F_OCSP_SENDREQ_BIO 112 | 583 | #define OCSP_F_OCSP_SENDREQ_BIO 112 |
| 585 | #define OCSP_F_PARSE_HTTP_LINE1 117 | 584 | #define OCSP_F_OCSP_SENDREQ_NBIO 117 |
| 585 | #define OCSP_F_PARSE_HTTP_LINE1 118 | ||
| 586 | #define OCSP_F_REQUEST_VERIFY 113 | 586 | #define OCSP_F_REQUEST_VERIFY 113 |
| 587 | 587 | ||
| 588 | /* Reason codes. */ | 588 | /* Reason codes. */ |
diff --git a/src/lib/libcrypto/ocsp/ocsp_cl.c b/src/lib/libcrypto/ocsp/ocsp_cl.c index 17bab5fc59..9c14d9da27 100644 --- a/src/lib/libcrypto/ocsp/ocsp_cl.c +++ b/src/lib/libcrypto/ocsp/ocsp_cl.c | |||
| @@ -155,7 +155,6 @@ int OCSP_request_sign(OCSP_REQUEST *req, | |||
| 155 | goto err; | 155 | goto err; |
| 156 | 156 | ||
| 157 | if (!(req->optionalSignature = sig = OCSP_SIGNATURE_new())) goto err; | 157 | if (!(req->optionalSignature = sig = OCSP_SIGNATURE_new())) goto err; |
| 158 | if (!dgst) dgst = EVP_sha1(); | ||
| 159 | if (key) | 158 | if (key) |
| 160 | { | 159 | { |
| 161 | if (!X509_check_private_key(signer, key)) | 160 | if (!X509_check_private_key(signer, key)) |
diff --git a/src/lib/libcrypto/ocsp/ocsp_err.c b/src/lib/libcrypto/ocsp/ocsp_err.c index d2f2e79f44..0cedcea682 100644 --- a/src/lib/libcrypto/ocsp/ocsp_err.c +++ b/src/lib/libcrypto/ocsp/ocsp_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/ocsp/ocsp_err.c */ | 1 | /* crypto/ocsp/ocsp_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -86,6 +86,7 @@ static ERR_STRING_DATA OCSP_str_functs[]= | |||
| 86 | {ERR_FUNC(OCSP_F_OCSP_REQUEST_VERIFY), "OCSP_request_verify"}, | 86 | {ERR_FUNC(OCSP_F_OCSP_REQUEST_VERIFY), "OCSP_request_verify"}, |
| 87 | {ERR_FUNC(OCSP_F_OCSP_RESPONSE_GET1_BASIC), "OCSP_response_get1_basic"}, | 87 | {ERR_FUNC(OCSP_F_OCSP_RESPONSE_GET1_BASIC), "OCSP_response_get1_basic"}, |
| 88 | {ERR_FUNC(OCSP_F_OCSP_SENDREQ_BIO), "OCSP_sendreq_bio"}, | 88 | {ERR_FUNC(OCSP_F_OCSP_SENDREQ_BIO), "OCSP_sendreq_bio"}, |
| 89 | {ERR_FUNC(OCSP_F_OCSP_SENDREQ_NBIO), "OCSP_sendreq_nbio"}, | ||
| 89 | {ERR_FUNC(OCSP_F_PARSE_HTTP_LINE1), "PARSE_HTTP_LINE1"}, | 90 | {ERR_FUNC(OCSP_F_PARSE_HTTP_LINE1), "PARSE_HTTP_LINE1"}, |
| 90 | {ERR_FUNC(OCSP_F_REQUEST_VERIFY), "REQUEST_VERIFY"}, | 91 | {ERR_FUNC(OCSP_F_REQUEST_VERIFY), "REQUEST_VERIFY"}, |
| 91 | {0,NULL} | 92 | {0,NULL} |
diff --git a/src/lib/libcrypto/ocsp/ocsp_ext.c b/src/lib/libcrypto/ocsp/ocsp_ext.c index 815cc29d58..ec884cb08f 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ext.c +++ b/src/lib/libcrypto/ocsp/ocsp_ext.c | |||
| @@ -264,7 +264,7 @@ int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc) | |||
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | /* also CRL Entry Extensions */ | 266 | /* also CRL Entry Extensions */ |
| 267 | 267 | #if 0 | |
| 268 | ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, | 268 | ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, |
| 269 | void *data, STACK_OF(ASN1_OBJECT) *sk) | 269 | void *data, STACK_OF(ASN1_OBJECT) *sk) |
| 270 | { | 270 | { |
| @@ -305,6 +305,7 @@ err: | |||
| 305 | if (b) OPENSSL_free(b); | 305 | if (b) OPENSSL_free(b); |
| 306 | return NULL; | 306 | return NULL; |
| 307 | } | 307 | } |
| 308 | #endif | ||
| 308 | 309 | ||
| 309 | /* Nonce handling functions */ | 310 | /* Nonce handling functions */ |
| 310 | 311 | ||
| @@ -442,17 +443,10 @@ X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim) | |||
| 442 | if (!(ASN1_GENERALIZEDTIME_set_string(cid->crlTime, tim))) | 443 | if (!(ASN1_GENERALIZEDTIME_set_string(cid->crlTime, tim))) |
| 443 | goto err; | 444 | goto err; |
| 444 | } | 445 | } |
| 445 | if (!(x = X509_EXTENSION_new())) goto err; | 446 | x = X509V3_EXT_i2d(NID_id_pkix_OCSP_CrlID, 0, cid); |
| 446 | if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_CrlID))) goto err; | ||
| 447 | if (!(ASN1_STRING_encode_of(OCSP_CRLID,x->value,i2d_OCSP_CRLID,cid, | ||
| 448 | NULL))) | ||
| 449 | goto err; | ||
| 450 | OCSP_CRLID_free(cid); | ||
| 451 | return x; | ||
| 452 | err: | 447 | err: |
| 453 | if (x) X509_EXTENSION_free(x); | ||
| 454 | if (cid) OCSP_CRLID_free(cid); | 448 | if (cid) OCSP_CRLID_free(cid); |
| 455 | return NULL; | 449 | return x; |
| 456 | } | 450 | } |
| 457 | 451 | ||
| 458 | /* AcceptableResponses ::= SEQUENCE OF OBJECT IDENTIFIER */ | 452 | /* AcceptableResponses ::= SEQUENCE OF OBJECT IDENTIFIER */ |
| @@ -470,18 +464,10 @@ X509_EXTENSION *OCSP_accept_responses_new(char **oids) | |||
| 470 | sk_ASN1_OBJECT_push(sk, o); | 464 | sk_ASN1_OBJECT_push(sk, o); |
| 471 | oids++; | 465 | oids++; |
| 472 | } | 466 | } |
| 473 | if (!(x = X509_EXTENSION_new())) goto err; | 467 | x = X509V3_EXT_i2d(NID_id_pkix_OCSP_acceptableResponses, 0, sk); |
| 474 | if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_acceptableResponses))) | ||
| 475 | goto err; | ||
| 476 | if (!(ASN1_STRING_encode_of(ASN1_OBJECT,x->value,i2d_ASN1_OBJECT,NULL, | ||
| 477 | sk))) | ||
| 478 | goto err; | ||
| 479 | sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free); | ||
| 480 | return x; | ||
| 481 | err: | 468 | err: |
| 482 | if (x) X509_EXTENSION_free(x); | ||
| 483 | if (sk) sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free); | 469 | if (sk) sk_ASN1_OBJECT_pop_free(sk, ASN1_OBJECT_free); |
| 484 | return NULL; | 470 | return x; |
| 485 | } | 471 | } |
| 486 | 472 | ||
| 487 | /* ArchiveCutoff ::= GeneralizedTime */ | 473 | /* ArchiveCutoff ::= GeneralizedTime */ |
| @@ -492,16 +478,10 @@ X509_EXTENSION *OCSP_archive_cutoff_new(char* tim) | |||
| 492 | 478 | ||
| 493 | if (!(gt = ASN1_GENERALIZEDTIME_new())) goto err; | 479 | if (!(gt = ASN1_GENERALIZEDTIME_new())) goto err; |
| 494 | if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim))) goto err; | 480 | if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim))) goto err; |
| 495 | if (!(x = X509_EXTENSION_new())) goto err; | 481 | x = X509V3_EXT_i2d(NID_id_pkix_OCSP_archiveCutoff, 0, gt); |
| 496 | if (!(x->object=OBJ_nid2obj(NID_id_pkix_OCSP_archiveCutoff)))goto err; | ||
| 497 | if (!(ASN1_STRING_encode_of(ASN1_GENERALIZEDTIME,x->value, | ||
| 498 | i2d_ASN1_GENERALIZEDTIME,gt,NULL))) goto err; | ||
| 499 | ASN1_GENERALIZEDTIME_free(gt); | ||
| 500 | return x; | ||
| 501 | err: | 482 | err: |
| 502 | if (gt) ASN1_GENERALIZEDTIME_free(gt); | 483 | if (gt) ASN1_GENERALIZEDTIME_free(gt); |
| 503 | if (x) X509_EXTENSION_free(x); | 484 | return x; |
| 504 | return NULL; | ||
| 505 | } | 485 | } |
| 506 | 486 | ||
| 507 | /* per ACCESS_DESCRIPTION parameter are oids, of which there are currently | 487 | /* per ACCESS_DESCRIPTION parameter are oids, of which there are currently |
| @@ -530,16 +510,9 @@ X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls) | |||
| 530 | if (!sk_ACCESS_DESCRIPTION_push(sloc->locator, ad)) goto err; | 510 | if (!sk_ACCESS_DESCRIPTION_push(sloc->locator, ad)) goto err; |
| 531 | urls++; | 511 | urls++; |
| 532 | } | 512 | } |
| 533 | if (!(x = X509_EXTENSION_new())) goto err; | 513 | x = X509V3_EXT_i2d(NID_id_pkix_OCSP_serviceLocator, 0, sloc); |
| 534 | if (!(x->object = OBJ_nid2obj(NID_id_pkix_OCSP_serviceLocator))) | ||
| 535 | goto err; | ||
| 536 | if (!(ASN1_STRING_encode_of(OCSP_SERVICELOC,x->value, | ||
| 537 | i2d_OCSP_SERVICELOC,sloc,NULL))) goto err; | ||
| 538 | OCSP_SERVICELOC_free(sloc); | ||
| 539 | return x; | ||
| 540 | err: | 514 | err: |
| 541 | if (x) X509_EXTENSION_free(x); | ||
| 542 | if (sloc) OCSP_SERVICELOC_free(sloc); | 515 | if (sloc) OCSP_SERVICELOC_free(sloc); |
| 543 | return NULL; | 516 | return x; |
| 544 | } | 517 | } |
| 545 | 518 | ||
diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c index 6abb30b2c0..12bbfcffd1 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ht.c +++ b/src/lib/libcrypto/ocsp/ocsp_ht.c | |||
| @@ -118,39 +118,65 @@ void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) | |||
| 118 | OPENSSL_free(rctx); | 118 | OPENSSL_free(rctx); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, | 121 | int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req) |
| 122 | int maxline) | ||
| 123 | { | 122 | { |
| 124 | static char post_hdr[] = "POST %s HTTP/1.0\r\n" | 123 | static const char req_hdr[] = |
| 125 | "Content-Type: application/ocsp-request\r\n" | 124 | "Content-Type: application/ocsp-request\r\n" |
| 126 | "Content-Length: %d\r\n\r\n"; | 125 | "Content-Length: %d\r\n\r\n"; |
| 126 | if (BIO_printf(rctx->mem, req_hdr, i2d_OCSP_REQUEST(req, NULL)) <= 0) | ||
| 127 | return 0; | ||
| 128 | if (i2d_OCSP_REQUEST_bio(rctx->mem, req) <= 0) | ||
| 129 | return 0; | ||
| 130 | rctx->state = OHS_ASN1_WRITE; | ||
| 131 | rctx->asn1_len = BIO_get_mem_data(rctx->mem, NULL); | ||
| 132 | return 1; | ||
| 133 | } | ||
| 134 | |||
| 135 | int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, | ||
| 136 | const char *name, const char *value) | ||
| 137 | { | ||
| 138 | if (!name) | ||
| 139 | return 0; | ||
| 140 | if (BIO_puts(rctx->mem, name) <= 0) | ||
| 141 | return 0; | ||
| 142 | if (value) | ||
| 143 | { | ||
| 144 | if (BIO_write(rctx->mem, ": ", 2) != 2) | ||
| 145 | return 0; | ||
| 146 | if (BIO_puts(rctx->mem, value) <= 0) | ||
| 147 | return 0; | ||
| 148 | } | ||
| 149 | if (BIO_write(rctx->mem, "\r\n", 2) != 2) | ||
| 150 | return 0; | ||
| 151 | return 1; | ||
| 152 | } | ||
| 153 | |||
| 154 | OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, | ||
| 155 | int maxline) | ||
| 156 | { | ||
| 157 | static const char post_hdr[] = "POST %s HTTP/1.0\r\n"; | ||
| 127 | 158 | ||
| 128 | OCSP_REQ_CTX *rctx; | 159 | OCSP_REQ_CTX *rctx; |
| 129 | rctx = OPENSSL_malloc(sizeof(OCSP_REQ_CTX)); | 160 | rctx = OPENSSL_malloc(sizeof(OCSP_REQ_CTX)); |
| 130 | rctx->state = OHS_FIRSTLINE; | 161 | rctx->state = OHS_ERROR; |
| 131 | rctx->mem = BIO_new(BIO_s_mem()); | 162 | rctx->mem = BIO_new(BIO_s_mem()); |
| 132 | rctx->io = io; | 163 | rctx->io = io; |
| 164 | rctx->asn1_len = 0; | ||
| 133 | if (maxline > 0) | 165 | if (maxline > 0) |
| 134 | rctx->iobuflen = maxline; | 166 | rctx->iobuflen = maxline; |
| 135 | else | 167 | else |
| 136 | rctx->iobuflen = OCSP_MAX_LINE_LEN; | 168 | rctx->iobuflen = OCSP_MAX_LINE_LEN; |
| 137 | rctx->iobuf = OPENSSL_malloc(rctx->iobuflen); | 169 | rctx->iobuf = OPENSSL_malloc(rctx->iobuflen); |
| 170 | if (!rctx->iobuf) | ||
| 171 | return 0; | ||
| 138 | if (!path) | 172 | if (!path) |
| 139 | path = "/"; | 173 | path = "/"; |
| 140 | 174 | ||
| 141 | if (BIO_printf(rctx->mem, post_hdr, path, | 175 | if (BIO_printf(rctx->mem, post_hdr, path) <= 0) |
| 142 | i2d_OCSP_REQUEST(req, NULL)) <= 0) | ||
| 143 | { | ||
| 144 | rctx->state = OHS_ERROR; | ||
| 145 | return 0; | 176 | return 0; |
| 146 | } | 177 | |
| 147 | if (i2d_OCSP_REQUEST_bio(rctx->mem, req) <= 0) | 178 | if (req && !OCSP_REQ_CTX_set1_req(rctx, req)) |
| 148 | { | ||
| 149 | rctx->state = OHS_ERROR; | ||
| 150 | return 0; | 179 | return 0; |
| 151 | } | ||
| 152 | rctx->state = OHS_ASN1_WRITE; | ||
| 153 | rctx->asn1_len = BIO_get_mem_data(rctx->mem, NULL); | ||
| 154 | 180 | ||
| 155 | return rctx; | 181 | return rctx; |
| 156 | } | 182 | } |
diff --git a/src/lib/libcrypto/ocsp/ocsp_lib.c b/src/lib/libcrypto/ocsp/ocsp_lib.c index 27450811d7..36905d76cd 100644 --- a/src/lib/libcrypto/ocsp/ocsp_lib.c +++ b/src/lib/libcrypto/ocsp/ocsp_lib.c | |||
| @@ -69,6 +69,7 @@ | |||
| 69 | #include <openssl/pem.h> | 69 | #include <openssl/pem.h> |
| 70 | #include <openssl/x509v3.h> | 70 | #include <openssl/x509v3.h> |
| 71 | #include <openssl/ocsp.h> | 71 | #include <openssl/ocsp.h> |
| 72 | #include <openssl/asn1t.h> | ||
| 72 | 73 | ||
| 73 | /* Convert a certificate and its issuer to an OCSP_CERTID */ | 74 | /* Convert a certificate and its issuer to an OCSP_CERTID */ |
| 74 | 75 | ||
| @@ -260,3 +261,5 @@ int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pss | |||
| 260 | return 0; | 261 | return 0; |
| 261 | 262 | ||
| 262 | } | 263 | } |
| 264 | |||
| 265 | IMPLEMENT_ASN1_DUP_FUNCTION(OCSP_CERTID) | ||
diff --git a/src/lib/libcrypto/ocsp/ocsp_prn.c b/src/lib/libcrypto/ocsp/ocsp_prn.c index 3dfb51c1e4..1695c9c4ad 100644 --- a/src/lib/libcrypto/ocsp/ocsp_prn.c +++ b/src/lib/libcrypto/ocsp/ocsp_prn.c | |||
| @@ -85,21 +85,21 @@ static int ocsp_certid_print(BIO *bp, OCSP_CERTID* a, int indent) | |||
| 85 | typedef struct | 85 | typedef struct |
| 86 | { | 86 | { |
| 87 | long t; | 87 | long t; |
| 88 | char *m; | 88 | const char *m; |
| 89 | } OCSP_TBLSTR; | 89 | } OCSP_TBLSTR; |
| 90 | 90 | ||
| 91 | static char *table2string(long s, OCSP_TBLSTR *ts, int len) | 91 | static const char *table2string(long s, const OCSP_TBLSTR *ts, int len) |
| 92 | { | 92 | { |
| 93 | OCSP_TBLSTR *p; | 93 | const OCSP_TBLSTR *p; |
| 94 | for (p=ts; p < ts + len; p++) | 94 | for (p=ts; p < ts + len; p++) |
| 95 | if (p->t == s) | 95 | if (p->t == s) |
| 96 | return p->m; | 96 | return p->m; |
| 97 | return "(UNKNOWN)"; | 97 | return "(UNKNOWN)"; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | char *OCSP_response_status_str(long s) | 100 | const char *OCSP_response_status_str(long s) |
| 101 | { | 101 | { |
| 102 | static OCSP_TBLSTR rstat_tbl[] = { | 102 | static const OCSP_TBLSTR rstat_tbl[] = { |
| 103 | { OCSP_RESPONSE_STATUS_SUCCESSFUL, "successful" }, | 103 | { OCSP_RESPONSE_STATUS_SUCCESSFUL, "successful" }, |
| 104 | { OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, "malformedrequest" }, | 104 | { OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, "malformedrequest" }, |
| 105 | { OCSP_RESPONSE_STATUS_INTERNALERROR, "internalerror" }, | 105 | { OCSP_RESPONSE_STATUS_INTERNALERROR, "internalerror" }, |
| @@ -109,18 +109,18 @@ char *OCSP_response_status_str(long s) | |||
| 109 | return table2string(s, rstat_tbl, 6); | 109 | return table2string(s, rstat_tbl, 6); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | char *OCSP_cert_status_str(long s) | 112 | const char *OCSP_cert_status_str(long s) |
| 113 | { | 113 | { |
| 114 | static OCSP_TBLSTR cstat_tbl[] = { | 114 | static const OCSP_TBLSTR cstat_tbl[] = { |
| 115 | { V_OCSP_CERTSTATUS_GOOD, "good" }, | 115 | { V_OCSP_CERTSTATUS_GOOD, "good" }, |
| 116 | { V_OCSP_CERTSTATUS_REVOKED, "revoked" }, | 116 | { V_OCSP_CERTSTATUS_REVOKED, "revoked" }, |
| 117 | { V_OCSP_CERTSTATUS_UNKNOWN, "unknown" } }; | 117 | { V_OCSP_CERTSTATUS_UNKNOWN, "unknown" } }; |
| 118 | return table2string(s, cstat_tbl, 3); | 118 | return table2string(s, cstat_tbl, 3); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | char *OCSP_crl_reason_str(long s) | 121 | const char *OCSP_crl_reason_str(long s) |
| 122 | { | 122 | { |
| 123 | OCSP_TBLSTR reason_tbl[] = { | 123 | static const OCSP_TBLSTR reason_tbl[] = { |
| 124 | { OCSP_REVOKED_STATUS_UNSPECIFIED, "unspecified" }, | 124 | { OCSP_REVOKED_STATUS_UNSPECIFIED, "unspecified" }, |
| 125 | { OCSP_REVOKED_STATUS_KEYCOMPROMISE, "keyCompromise" }, | 125 | { OCSP_REVOKED_STATUS_KEYCOMPROMISE, "keyCompromise" }, |
| 126 | { OCSP_REVOKED_STATUS_CACOMPROMISE, "cACompromise" }, | 126 | { OCSP_REVOKED_STATUS_CACOMPROMISE, "cACompromise" }, |
| @@ -266,15 +266,16 @@ int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags) | |||
| 266 | if (!ASN1_GENERALIZEDTIME_print(bp,single->nextUpdate)) | 266 | if (!ASN1_GENERALIZEDTIME_print(bp,single->nextUpdate)) |
| 267 | goto err; | 267 | goto err; |
| 268 | } | 268 | } |
| 269 | if (!BIO_write(bp,"\n",1)) goto err; | 269 | if (BIO_write(bp,"\n",1) <= 0) goto err; |
| 270 | if (!X509V3_extensions_print(bp, | 270 | if (!X509V3_extensions_print(bp, |
| 271 | "Response Single Extensions", | 271 | "Response Single Extensions", |
| 272 | single->singleExtensions, flags, 8)) | 272 | single->singleExtensions, flags, 8)) |
| 273 | goto err; | 273 | goto err; |
| 274 | if (!BIO_write(bp,"\n",1)) goto err; | 274 | if (BIO_write(bp,"\n",1) <= 0) goto err; |
| 275 | } | 275 | } |
| 276 | if (!X509V3_extensions_print(bp, "Response Extensions", | 276 | if (!X509V3_extensions_print(bp, "Response Extensions", |
| 277 | rd->responseExtensions, flags, 4)) | 277 | rd->responseExtensions, flags, 4)) |
| 278 | goto err; | ||
| 278 | if(X509_signature_print(bp, br->signatureAlgorithm, br->signature) <= 0) | 279 | if(X509_signature_print(bp, br->signatureAlgorithm, br->signature) <= 0) |
| 279 | goto err; | 280 | goto err; |
| 280 | 281 | ||
diff --git a/src/lib/libcrypto/ocsp/ocsp_vfy.c b/src/lib/libcrypto/ocsp/ocsp_vfy.c index 4a0c3870d8..415d67e61c 100644 --- a/src/lib/libcrypto/ocsp/ocsp_vfy.c +++ b/src/lib/libcrypto/ocsp/ocsp_vfy.c | |||
| @@ -308,6 +308,8 @@ static int ocsp_match_issuerid(X509 *cert, OCSP_CERTID *cid, | |||
| 308 | } | 308 | } |
| 309 | 309 | ||
| 310 | mdlen = EVP_MD_size(dgst); | 310 | mdlen = EVP_MD_size(dgst); |
| 311 | if (mdlen < 0) | ||
| 312 | return -1; | ||
| 311 | if ((cid->issuerNameHash->length != mdlen) || | 313 | if ((cid->issuerNameHash->length != mdlen) || |
| 312 | (cid->issuerKeyHash->length != mdlen)) | 314 | (cid->issuerKeyHash->length != mdlen)) |
| 313 | return 0; | 315 | return 0; |
| @@ -316,7 +318,7 @@ static int ocsp_match_issuerid(X509 *cert, OCSP_CERTID *cid, | |||
| 316 | return -1; | 318 | return -1; |
| 317 | if (memcmp(md, cid->issuerNameHash->data, mdlen)) | 319 | if (memcmp(md, cid->issuerNameHash->data, mdlen)) |
| 318 | return 0; | 320 | return 0; |
| 319 | X509_pubkey_digest(cert, EVP_sha1(), md, NULL); | 321 | X509_pubkey_digest(cert, dgst, md, NULL); |
| 320 | if (memcmp(md, cid->issuerKeyHash->data, mdlen)) | 322 | if (memcmp(md, cid->issuerKeyHash->data, mdlen)) |
| 321 | return 0; | 323 | return 0; |
| 322 | 324 | ||
diff --git a/src/lib/libcrypto/opensslconf.h.in b/src/lib/libcrypto/opensslconf.h.in index 1c77f03c3d..97e3745563 100644 --- a/src/lib/libcrypto/opensslconf.h.in +++ b/src/lib/libcrypto/opensslconf.h.in | |||
| @@ -1,20 +1,5 @@ | |||
| 1 | /* crypto/opensslconf.h.in */ | 1 | /* crypto/opensslconf.h.in */ |
| 2 | 2 | ||
| 3 | #ifdef OPENSSL_DOING_MAKEDEPEND | ||
| 4 | |||
| 5 | /* Include any symbols here that have to be explicitly set to enable a feature | ||
| 6 | * that should be visible to makedepend. | ||
| 7 | * | ||
| 8 | * [Our "make depend" doesn't actually look at this, we use actual build settings | ||
| 9 | * instead; we want to make it easy to remove subdirectories with disabled algorithms.] | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef OPENSSL_FIPS | ||
| 13 | #define OPENSSL_FIPS | ||
| 14 | #endif | ||
| 15 | |||
| 16 | #endif | ||
| 17 | |||
| 18 | /* Generate 80386 code? */ | 3 | /* Generate 80386 code? */ |
| 19 | #undef I386_ONLY | 4 | #undef I386_ONLY |
| 20 | 5 | ||
| @@ -78,14 +63,9 @@ | |||
| 78 | /* Should we define BN_DIV2W here? */ | 63 | /* Should we define BN_DIV2W here? */ |
| 79 | 64 | ||
| 80 | /* Only one for the following should be defined */ | 65 | /* Only one for the following should be defined */ |
| 81 | /* The prime number generation stuff may not work when | ||
| 82 | * EIGHT_BIT but I don't care since I've only used this mode | ||
| 83 | * for debuging the bignum libraries */ | ||
| 84 | #undef SIXTY_FOUR_BIT_LONG | 66 | #undef SIXTY_FOUR_BIT_LONG |
| 85 | #undef SIXTY_FOUR_BIT | 67 | #undef SIXTY_FOUR_BIT |
| 86 | #define THIRTY_TWO_BIT | 68 | #define THIRTY_TWO_BIT |
| 87 | #undef SIXTEEN_BIT | ||
| 88 | #undef EIGHT_BIT | ||
| 89 | #endif | 69 | #endif |
| 90 | 70 | ||
| 91 | #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) | 71 | #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) |
diff --git a/src/lib/libcrypto/opensslv.h b/src/lib/libcrypto/opensslv.h index c6207f76b2..2fb110fa0e 100644 --- a/src/lib/libcrypto/opensslv.h +++ b/src/lib/libcrypto/opensslv.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) | 12 | * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) |
| 13 | * 0.9.3 0x0090300f | 13 | * 0.9.3 0x0090300f |
| 14 | * 0.9.3a 0x0090301f | 14 | * 0.9.3a 0x0090301f |
| 15 | * 0.9.4 0x0090400f | 15 | * 0.9.4 0x0090400f |
| 16 | * 1.2.3z 0x102031af | 16 | * 1.2.3z 0x102031af |
| 17 | * | 17 | * |
| 18 | * For continuity reasons (because 0.9.5 is already out, and is coded | 18 | * For continuity reasons (because 0.9.5 is already out, and is coded |
| @@ -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 0x009080bfL | 28 | #define OPENSSL_VERSION_NUMBER 0x1000001fL |
| 29 | #ifdef OPENSSL_FIPS | 29 | #ifdef OPENSSL_FIPS |
| 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8k-fips 25 Mar 2009" | 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0a-fips 1 Jun 2010" |
| 31 | #else | 31 | #else |
| 32 | #define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8k 25 Mar 2009" | 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 | ||
| @@ -83,7 +83,7 @@ | |||
| 83 | * should only keep the versions that are binary compatible with the current. | 83 | * should only keep the versions that are binary compatible with the current. |
| 84 | */ | 84 | */ |
| 85 | #define SHLIB_VERSION_HISTORY "" | 85 | #define SHLIB_VERSION_HISTORY "" |
| 86 | #define SHLIB_VERSION_NUMBER "0.9.8" | 86 | #define SHLIB_VERSION_NUMBER "1.0.0" |
| 87 | 87 | ||
| 88 | 88 | ||
| 89 | #endif /* HEADER_OPENSSLV_H */ | 89 | #endif /* HEADER_OPENSSLV_H */ |
diff --git a/src/lib/libcrypto/ossl_typ.h b/src/lib/libcrypto/ossl_typ.h index 0e7a380880..12bd7014de 100644 --- a/src/lib/libcrypto/ossl_typ.h +++ b/src/lib/libcrypto/ossl_typ.h | |||
| @@ -95,6 +95,8 @@ typedef int ASN1_BOOLEAN; | |||
| 95 | typedef int ASN1_NULL; | 95 | typedef int ASN1_NULL; |
| 96 | #endif | 96 | #endif |
| 97 | 97 | ||
| 98 | typedef struct asn1_pctx_st ASN1_PCTX; | ||
| 99 | |||
| 98 | #ifdef OPENSSL_SYS_WIN32 | 100 | #ifdef OPENSSL_SYS_WIN32 |
| 99 | #undef X509_NAME | 101 | #undef X509_NAME |
| 100 | #undef X509_EXTENSIONS | 102 | #undef X509_EXTENSIONS |
| @@ -122,6 +124,11 @@ typedef struct env_md_st EVP_MD; | |||
| 122 | typedef struct env_md_ctx_st EVP_MD_CTX; | 124 | typedef struct env_md_ctx_st EVP_MD_CTX; |
| 123 | typedef struct evp_pkey_st EVP_PKEY; | 125 | typedef struct evp_pkey_st EVP_PKEY; |
| 124 | 126 | ||
| 127 | typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; | ||
| 128 | |||
| 129 | typedef struct evp_pkey_method_st EVP_PKEY_METHOD; | ||
| 130 | typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; | ||
| 131 | |||
| 125 | typedef struct dh_st DH; | 132 | typedef struct dh_st DH; |
| 126 | typedef struct dh_method DH_METHOD; | 133 | typedef struct dh_method DH_METHOD; |
| 127 | 134 | ||
| @@ -139,11 +146,14 @@ typedef struct ecdsa_method ECDSA_METHOD; | |||
| 139 | typedef struct x509_st X509; | 146 | typedef struct x509_st X509; |
| 140 | typedef struct X509_algor_st X509_ALGOR; | 147 | typedef struct X509_algor_st X509_ALGOR; |
| 141 | typedef struct X509_crl_st X509_CRL; | 148 | typedef struct X509_crl_st X509_CRL; |
| 149 | typedef struct x509_crl_method_st X509_CRL_METHOD; | ||
| 150 | typedef struct x509_revoked_st X509_REVOKED; | ||
| 142 | typedef struct X509_name_st X509_NAME; | 151 | typedef struct X509_name_st X509_NAME; |
| 152 | typedef struct X509_pubkey_st X509_PUBKEY; | ||
| 143 | typedef struct x509_store_st X509_STORE; | 153 | typedef struct x509_store_st X509_STORE; |
| 144 | typedef struct x509_store_ctx_st X509_STORE_CTX; | 154 | typedef struct x509_store_ctx_st X509_STORE_CTX; |
| 145 | typedef struct ssl_st SSL; | 155 | |
| 146 | typedef struct ssl_ctx_st SSL_CTX; | 156 | typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; |
| 147 | 157 | ||
| 148 | typedef struct v3_ext_ctx X509V3_CTX; | 158 | typedef struct v3_ext_ctx X509V3_CTX; |
| 149 | typedef struct conf_st CONF; | 159 | typedef struct conf_st CONF; |
| @@ -157,12 +167,19 @@ typedef struct ui_method_st UI_METHOD; | |||
| 157 | typedef struct st_ERR_FNS ERR_FNS; | 167 | typedef struct st_ERR_FNS ERR_FNS; |
| 158 | 168 | ||
| 159 | typedef struct engine_st ENGINE; | 169 | typedef struct engine_st ENGINE; |
| 170 | typedef struct ssl_st SSL; | ||
| 171 | typedef struct ssl_ctx_st SSL_CTX; | ||
| 160 | 172 | ||
| 161 | typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; | 173 | typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; |
| 162 | typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; | 174 | typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; |
| 163 | typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; | 175 | typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; |
| 164 | typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; | 176 | typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; |
| 165 | 177 | ||
| 178 | typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; | ||
| 179 | typedef struct DIST_POINT_st DIST_POINT; | ||
| 180 | typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; | ||
| 181 | typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; | ||
| 182 | |||
| 166 | /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */ | 183 | /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */ |
| 167 | #define DECLARE_PKCS12_STACK_OF(type) /* Nothing */ | 184 | #define DECLARE_PKCS12_STACK_OF(type) /* Nothing */ |
| 168 | #define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */ | 185 | #define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */ |
diff --git a/src/lib/libcrypto/pem/Makefile.ssl b/src/lib/libcrypto/pem/Makefile.ssl deleted file mode 100644 index d3043eb401..0000000000 --- a/src/lib/libcrypto/pem/Makefile.ssl +++ /dev/null | |||
| @@ -1,336 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/pem/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= pem | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c pem_err.c \ | ||
| 27 | pem_x509.c pem_xaux.c pem_oth.c pem_pk8.c pem_pkey.c | ||
| 28 | |||
| 29 | LIBOBJ= pem_sign.o pem_seal.o pem_info.o pem_lib.o pem_all.o pem_err.o \ | ||
| 30 | pem_x509.o pem_xaux.o pem_oth.o pem_pk8.o pem_pkey.o | ||
| 31 | |||
| 32 | SRC= $(LIBSRC) | ||
| 33 | |||
| 34 | EXHEADER= pem.h pem2.h | ||
| 35 | HEADER= $(EXHEADER) | ||
| 36 | |||
| 37 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 38 | |||
| 39 | top: | ||
| 40 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 41 | |||
| 42 | all: lib | ||
| 43 | |||
| 44 | lib: $(LIBOBJ) | ||
| 45 | $(AR) $(LIB) $(LIBOBJ) | ||
| 46 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 47 | @touch lib | ||
| 48 | |||
| 49 | files: | ||
| 50 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 51 | |||
| 52 | links: $(EXHEADER) | ||
| 53 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 60 | do \ | ||
| 61 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 62 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 63 | done; | ||
| 64 | |||
| 65 | tags: | ||
| 66 | ctags $(SRC) | ||
| 67 | |||
| 68 | tests: | ||
| 69 | |||
| 70 | lint: | ||
| 71 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 72 | |||
| 73 | depend: | ||
| 74 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 82 | |||
| 83 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 84 | |||
| 85 | pem_all.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 86 | pem_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 87 | pem_all.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 88 | pem_all.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 89 | pem_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 90 | pem_all.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 91 | pem_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 92 | pem_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 93 | pem_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 94 | pem_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 95 | pem_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 96 | pem_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 97 | pem_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 98 | pem_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 99 | pem_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 100 | pem_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 101 | pem_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 102 | pem_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 103 | pem_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 104 | pem_all.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 105 | pem_all.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 106 | pem_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_all.c | ||
| 107 | pem_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 108 | pem_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 109 | pem_err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 110 | pem_err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 111 | pem_err.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 112 | pem_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 113 | pem_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 114 | pem_err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 115 | pem_err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 116 | pem_err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 117 | pem_err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 118 | pem_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 119 | pem_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 120 | pem_err.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 121 | pem_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 122 | pem_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 123 | pem_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 124 | pem_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 125 | pem_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 126 | pem_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 127 | pem_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 128 | pem_err.o: pem_err.c | ||
| 129 | pem_info.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 130 | pem_info.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 131 | pem_info.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 132 | pem_info.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 133 | pem_info.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 134 | pem_info.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 135 | pem_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 136 | pem_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 137 | pem_info.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 138 | pem_info.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 139 | pem_info.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 140 | pem_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 141 | pem_info.o: ../../include/openssl/opensslconf.h | ||
| 142 | pem_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 143 | pem_info.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 144 | pem_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 145 | pem_info.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 146 | pem_info.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 147 | pem_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 148 | pem_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 149 | pem_info.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 150 | pem_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 151 | pem_info.o: ../cryptlib.h pem_info.c | ||
| 152 | pem_lib.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 153 | pem_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 154 | pem_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 155 | pem_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 156 | pem_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 157 | pem_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 158 | pem_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 159 | pem_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 160 | pem_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 161 | pem_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 162 | pem_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 163 | pem_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 164 | pem_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 165 | pem_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 166 | pem_lib.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h | ||
| 167 | pem_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 168 | pem_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 169 | pem_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 170 | pem_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 171 | pem_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 172 | pem_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 173 | pem_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 174 | pem_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_lib.c | ||
| 175 | pem_oth.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 176 | pem_oth.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 177 | pem_oth.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 178 | pem_oth.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 179 | pem_oth.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 180 | pem_oth.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 181 | pem_oth.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 182 | pem_oth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 183 | pem_oth.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 184 | pem_oth.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 185 | pem_oth.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 186 | pem_oth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 187 | pem_oth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 188 | pem_oth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 189 | pem_oth.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 190 | pem_oth.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 191 | pem_oth.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 192 | pem_oth.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 193 | pem_oth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 194 | pem_oth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 195 | pem_oth.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 196 | pem_oth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 197 | pem_oth.o: ../cryptlib.h pem_oth.c | ||
| 198 | pem_pk8.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 199 | pem_pk8.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 200 | pem_pk8.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 201 | pem_pk8.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 202 | pem_pk8.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 203 | pem_pk8.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 204 | pem_pk8.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 205 | pem_pk8.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 206 | pem_pk8.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 207 | pem_pk8.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 208 | pem_pk8.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 209 | pem_pk8.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 210 | pem_pk8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 211 | pem_pk8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 212 | pem_pk8.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h | ||
| 213 | pem_pk8.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 214 | pem_pk8.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 215 | pem_pk8.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 216 | pem_pk8.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 217 | pem_pk8.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 218 | pem_pk8.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 219 | pem_pk8.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 220 | pem_pk8.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_pk8.c | ||
| 221 | pem_pkey.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 222 | pem_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 223 | pem_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 224 | pem_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 225 | pem_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 226 | pem_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 227 | pem_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 228 | pem_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 229 | pem_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 230 | pem_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 231 | pem_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 232 | pem_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 233 | pem_pkey.o: ../../include/openssl/opensslconf.h | ||
| 234 | pem_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 235 | pem_pkey.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 236 | pem_pkey.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 237 | pem_pkey.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 238 | pem_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 239 | pem_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 240 | pem_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 241 | pem_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 242 | pem_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 243 | pem_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 244 | pem_pkey.o: ../cryptlib.h pem_pkey.c | ||
| 245 | pem_seal.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 246 | pem_seal.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 247 | pem_seal.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 248 | pem_seal.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 249 | pem_seal.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 250 | pem_seal.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 251 | pem_seal.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 252 | pem_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 253 | pem_seal.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 254 | pem_seal.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 255 | pem_seal.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 256 | pem_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 257 | pem_seal.o: ../../include/openssl/opensslconf.h | ||
| 258 | pem_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 259 | pem_seal.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 260 | pem_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 261 | pem_seal.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 262 | pem_seal.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 263 | pem_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 264 | pem_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 265 | pem_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 266 | pem_seal.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 267 | pem_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_seal.c | ||
| 268 | pem_sign.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 269 | pem_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 270 | pem_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 271 | pem_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 272 | pem_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 273 | pem_sign.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 274 | pem_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 275 | pem_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 276 | pem_sign.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 277 | pem_sign.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 278 | pem_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 279 | pem_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 280 | pem_sign.o: ../../include/openssl/opensslconf.h | ||
| 281 | pem_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 282 | pem_sign.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 283 | pem_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 284 | pem_sign.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 285 | pem_sign.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 286 | pem_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 287 | pem_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 288 | pem_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 289 | pem_sign.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 290 | pem_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_sign.c | ||
| 291 | pem_x509.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 292 | pem_x509.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 293 | pem_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 294 | pem_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 295 | pem_x509.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 296 | pem_x509.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 297 | pem_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 298 | pem_x509.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 299 | pem_x509.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 300 | pem_x509.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 301 | pem_x509.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 302 | pem_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 303 | pem_x509.o: ../../include/openssl/opensslconf.h | ||
| 304 | pem_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 305 | pem_x509.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 306 | pem_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 307 | pem_x509.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 308 | pem_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 309 | pem_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 310 | pem_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 311 | pem_x509.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 312 | pem_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 313 | pem_x509.o: ../cryptlib.h pem_x509.c | ||
| 314 | pem_xaux.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 315 | pem_xaux.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 316 | pem_xaux.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 317 | pem_xaux.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 318 | pem_xaux.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 319 | pem_xaux.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 320 | pem_xaux.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 321 | pem_xaux.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 322 | pem_xaux.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 323 | pem_xaux.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 324 | pem_xaux.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 325 | pem_xaux.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 326 | pem_xaux.o: ../../include/openssl/opensslconf.h | ||
| 327 | pem_xaux.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 328 | pem_xaux.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 329 | pem_xaux.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 330 | pem_xaux.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 331 | pem_xaux.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 332 | pem_xaux.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 333 | pem_xaux.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 334 | pem_xaux.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 335 | pem_xaux.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 336 | pem_xaux.o: ../cryptlib.h pem_xaux.c | ||
diff --git a/src/lib/libcrypto/pem/pem.h b/src/lib/libcrypto/pem/pem.h index 6c193f1cbf..8a6ababe3a 100644 --- a/src/lib/libcrypto/pem/pem.h +++ b/src/lib/libcrypto/pem/pem.h | |||
| @@ -134,6 +134,7 @@ extern "C" { | |||
| 134 | #define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" | 134 | #define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" |
| 135 | #define PEM_STRING_ECPARAMETERS "EC PARAMETERS" | 135 | #define PEM_STRING_ECPARAMETERS "EC PARAMETERS" |
| 136 | #define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" | 136 | #define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" |
| 137 | #define PEM_STRING_PARAMETERS "PARAMETERS" | ||
| 137 | #define PEM_STRING_CMS "CMS" | 138 | #define PEM_STRING_CMS "CMS" |
| 138 | 139 | ||
| 139 | /* Note that this structure is initialised by PEM_SealInit and cleaned up | 140 | /* Note that this structure is initialised by PEM_SealInit and cleaned up |
| @@ -183,11 +184,8 @@ typedef struct pem_ctx_st | |||
| 183 | int num_recipient; | 184 | int num_recipient; |
| 184 | PEM_USER **recipient; | 185 | PEM_USER **recipient; |
| 185 | 186 | ||
| 186 | #ifndef OPENSSL_NO_STACK | 187 | /* XXX(ben): don#t think this is used! |
| 187 | STACK *x509_chain; /* certificate chain */ | 188 | STACK *x509_chain; / * certificate chain */ |
| 188 | #else | ||
| 189 | char *x509_chain; /* certificate chain */ | ||
| 190 | #endif | ||
| 191 | EVP_MD *md; /* signature type */ | 189 | EVP_MD *md; /* signature type */ |
| 192 | 190 | ||
| 193 | int md_enc; /* is the md encrypted or not? */ | 191 | int md_enc; /* is the md encrypted or not? */ |
| @@ -224,28 +222,19 @@ typedef struct pem_ctx_st | |||
| 224 | #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ | 222 | #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ |
| 225 | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ | 223 | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ |
| 226 | { \ | 224 | { \ |
| 227 | return (type*)PEM_ASN1_read(CHECKED_D2I_OF(type, d2i_##asn1), \ | 225 | return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ |
| 228 | str, fp, \ | ||
| 229 | CHECKED_PPTR_OF(type, x), \ | ||
| 230 | cb, u); \ | ||
| 231 | } | 226 | } |
| 232 | 227 | ||
| 233 | #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ | 228 | #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ |
| 234 | int PEM_write_##name(FILE *fp, type *x) \ | 229 | int PEM_write_##name(FILE *fp, type *x) \ |
| 235 | { \ | 230 | { \ |
| 236 | return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \ | 231 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ |
| 237 | str, fp, \ | ||
| 238 | CHECKED_PTR_OF(type, x), \ | ||
| 239 | NULL, NULL, 0, NULL, NULL); \ | ||
| 240 | } | 232 | } |
| 241 | 233 | ||
| 242 | #define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ | 234 | #define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ |
| 243 | int PEM_write_##name(FILE *fp, const type *x) \ | 235 | int PEM_write_##name(FILE *fp, const type *x) \ |
| 244 | { \ | 236 | { \ |
| 245 | return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \ | 237 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ |
| 246 | str, fp, \ | ||
| 247 | CHECKED_PTR_OF(const type, x), \ | ||
| 248 | NULL, NULL, 0, NULL, NULL); \ | ||
| 249 | } | 238 | } |
| 250 | 239 | ||
| 251 | #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ | 240 | #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ |
| @@ -253,10 +242,7 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | |||
| 253 | unsigned char *kstr, int klen, pem_password_cb *cb, \ | 242 | unsigned char *kstr, int klen, pem_password_cb *cb, \ |
| 254 | void *u) \ | 243 | void *u) \ |
| 255 | { \ | 244 | { \ |
| 256 | return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \ | 245 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ |
| 257 | str, fp, \ | ||
| 258 | CHECKED_PTR_OF(type, x), \ | ||
| 259 | enc, kstr, klen, cb, u); \ | ||
| 260 | } | 246 | } |
| 261 | 247 | ||
| 262 | #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ | 248 | #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ |
| @@ -264,10 +250,7 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | |||
| 264 | unsigned char *kstr, int klen, pem_password_cb *cb, \ | 250 | unsigned char *kstr, int klen, pem_password_cb *cb, \ |
| 265 | void *u) \ | 251 | void *u) \ |
| 266 | { \ | 252 | { \ |
| 267 | return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \ | 253 | return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ |
| 268 | str, fp, \ | ||
| 269 | CHECKED_PTR_OF(const type, x), \ | ||
| 270 | enc, kstr, klen, cb, u); \ | ||
| 271 | } | 254 | } |
| 272 | 255 | ||
| 273 | #endif | 256 | #endif |
| @@ -275,48 +258,33 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | |||
| 275 | #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ | 258 | #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ |
| 276 | type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ | 259 | type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ |
| 277 | { \ | 260 | { \ |
| 278 | return (type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i_##asn1), \ | 261 | return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ |
| 279 | str, bp, \ | ||
| 280 | CHECKED_PPTR_OF(type, x), \ | ||
| 281 | cb, u); \ | ||
| 282 | } | 262 | } |
| 283 | 263 | ||
| 284 | #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ | 264 | #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ |
| 285 | int PEM_write_bio_##name(BIO *bp, type *x) \ | 265 | int PEM_write_bio_##name(BIO *bp, type *x) \ |
| 286 | { \ | 266 | { \ |
| 287 | return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \ | 267 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ |
| 288 | str, bp, \ | ||
| 289 | CHECKED_PTR_OF(type, x), \ | ||
| 290 | NULL, NULL, 0, NULL, NULL); \ | ||
| 291 | } | 268 | } |
| 292 | 269 | ||
| 293 | #define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ | 270 | #define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ |
| 294 | int PEM_write_bio_##name(BIO *bp, const type *x) \ | 271 | int PEM_write_bio_##name(BIO *bp, const type *x) \ |
| 295 | { \ | 272 | { \ |
| 296 | return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \ | 273 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ |
| 297 | str, bp, \ | ||
| 298 | CHECKED_PTR_OF(const type, x), \ | ||
| 299 | NULL, NULL, 0, NULL, NULL); \ | ||
| 300 | } | 274 | } |
| 301 | 275 | ||
| 302 | #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ | 276 | #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ |
| 303 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | 277 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ |
| 304 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ | 278 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ |
| 305 | { \ | 279 | { \ |
| 306 | return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \ | 280 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ |
| 307 | str, bp, \ | ||
| 308 | CHECKED_PTR_OF(type, x), \ | ||
| 309 | enc, kstr, klen, cb, u); \ | ||
| 310 | } | 281 | } |
| 311 | 282 | ||
| 312 | #define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ | 283 | #define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ |
| 313 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | 284 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ |
| 314 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ | 285 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ |
| 315 | { \ | 286 | { \ |
| 316 | return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \ | 287 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ |
| 317 | str, bp, \ | ||
| 318 | CHECKED_PTR_OF(const type, x), \ | ||
| 319 | enc, kstr, klen, cb, u); \ | ||
| 320 | } | 288 | } |
| 321 | 289 | ||
| 322 | #define IMPLEMENT_PEM_write(name, type, str, asn1) \ | 290 | #define IMPLEMENT_PEM_write(name, type, str, asn1) \ |
| @@ -353,11 +321,10 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | |||
| 353 | 321 | ||
| 354 | /* These are the same except they are for the declarations */ | 322 | /* These are the same except they are for the declarations */ |
| 355 | 323 | ||
| 356 | #if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_NO_FP_API) | 324 | #if defined(OPENSSL_NO_FP_API) |
| 357 | 325 | ||
| 358 | #define DECLARE_PEM_read_fp(name, type) /**/ | 326 | #define DECLARE_PEM_read_fp(name, type) /**/ |
| 359 | #define DECLARE_PEM_write_fp(name, type) /**/ | 327 | #define DECLARE_PEM_write_fp(name, type) /**/ |
| 360 | #define DECLARE_PEM_write_fp_const(name, type) /**/ | ||
| 361 | #define DECLARE_PEM_write_cb_fp(name, type) /**/ | 328 | #define DECLARE_PEM_write_cb_fp(name, type) /**/ |
| 362 | 329 | ||
| 363 | #else | 330 | #else |
| @@ -428,138 +395,6 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | |||
| 428 | DECLARE_PEM_read(name, type) \ | 395 | DECLARE_PEM_read(name, type) \ |
| 429 | DECLARE_PEM_write_cb(name, type) | 396 | DECLARE_PEM_write_cb(name, type) |
| 430 | 397 | ||
| 431 | #ifdef SSLEAY_MACROS | ||
| 432 | |||
| 433 | #define PEM_write_SSL_SESSION(fp,x) \ | ||
| 434 | PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \ | ||
| 435 | PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL) | ||
| 436 | #define PEM_write_X509(fp,x) \ | ||
| 437 | PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \ | ||
| 438 | (char *)x, NULL,NULL,0,NULL,NULL) | ||
| 439 | #define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \ | ||
| 440 | (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \ | ||
| 441 | NULL,NULL,0,NULL,NULL) | ||
| 442 | #define PEM_write_X509_CRL(fp,x) \ | ||
| 443 | PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \ | ||
| 444 | fp,(char *)x, NULL,NULL,0,NULL,NULL) | ||
| 445 | #define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \ | ||
| 446 | PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\ | ||
| 447 | (char *)x,enc,kstr,klen,cb,u) | ||
| 448 | #define PEM_write_RSAPublicKey(fp,x) \ | ||
| 449 | PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\ | ||
| 450 | PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL,NULL) | ||
| 451 | #define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \ | ||
| 452 | PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\ | ||
| 453 | (char *)x,enc,kstr,klen,cb,u) | ||
| 454 | #define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb,u) \ | ||
| 455 | PEM_ASN1_write((int (*)())i2d_PrivateKey,\ | ||
| 456 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ | ||
| 457 | bp,(char *)x,enc,kstr,klen,cb,u) | ||
| 458 | #define PEM_write_PKCS7(fp,x) \ | ||
| 459 | PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \ | ||
| 460 | (char *)x, NULL,NULL,0,NULL,NULL) | ||
| 461 | #define PEM_write_DHparams(fp,x) \ | ||
| 462 | PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\ | ||
| 463 | (char *)x,NULL,NULL,0,NULL,NULL) | ||
| 464 | |||
| 465 | #define PEM_write_NETSCAPE_CERT_SEQUENCE(fp,x) \ | ||
| 466 | PEM_ASN1_write((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \ | ||
| 467 | PEM_STRING_X509,fp, \ | ||
| 468 | (char *)x, NULL,NULL,0,NULL,NULL) | ||
| 469 | |||
| 470 | #define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \ | ||
| 471 | (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u) | ||
| 472 | #define PEM_read_X509(fp,x,cb,u) (X509 *)PEM_ASN1_read( \ | ||
| 473 | (char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb,u) | ||
| 474 | #define PEM_read_X509_REQ(fp,x,cb,u) (X509_REQ *)PEM_ASN1_read( \ | ||
| 475 | (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb,u) | ||
| 476 | #define PEM_read_X509_CRL(fp,x,cb,u) (X509_CRL *)PEM_ASN1_read( \ | ||
| 477 | (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb,u) | ||
| 478 | #define PEM_read_RSAPrivateKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \ | ||
| 479 | (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb,u) | ||
| 480 | #define PEM_read_RSAPublicKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \ | ||
| 481 | (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb,u) | ||
| 482 | #define PEM_read_DSAPrivateKey(fp,x,cb,u) (DSA *)PEM_ASN1_read( \ | ||
| 483 | (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb,u) | ||
| 484 | #define PEM_read_PrivateKey(fp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read( \ | ||
| 485 | (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb,u) | ||
| 486 | #define PEM_read_PKCS7(fp,x,cb,u) (PKCS7 *)PEM_ASN1_read( \ | ||
| 487 | (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb,u) | ||
| 488 | #define PEM_read_DHparams(fp,x,cb,u) (DH *)PEM_ASN1_read( \ | ||
| 489 | (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb,u) | ||
| 490 | |||
| 491 | #define PEM_read_NETSCAPE_CERT_SEQUENCE(fp,x,cb,u) \ | ||
| 492 | (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read( \ | ||
| 493 | (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\ | ||
| 494 | (char **)x,cb,u) | ||
| 495 | |||
| 496 | #define PEM_write_bio_X509(bp,x) \ | ||
| 497 | PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \ | ||
| 498 | (char *)x, NULL,NULL,0,NULL,NULL) | ||
| 499 | #define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \ | ||
| 500 | (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \ | ||
| 501 | NULL,NULL,0,NULL,NULL) | ||
| 502 | #define PEM_write_bio_X509_CRL(bp,x) \ | ||
| 503 | PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\ | ||
| 504 | bp,(char *)x, NULL,NULL,0,NULL,NULL) | ||
| 505 | #define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ | ||
| 506 | PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\ | ||
| 507 | bp,(char *)x,enc,kstr,klen,cb,u) | ||
| 508 | #define PEM_write_bio_RSAPublicKey(bp,x) \ | ||
| 509 | PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \ | ||
| 510 | PEM_STRING_RSA_PUBLIC,\ | ||
| 511 | bp,(char *)x,NULL,NULL,0,NULL,NULL) | ||
| 512 | #define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ | ||
| 513 | PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\ | ||
| 514 | bp,(char *)x,enc,kstr,klen,cb,u) | ||
| 515 | #define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb,u) \ | ||
| 516 | PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\ | ||
| 517 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ | ||
| 518 | bp,(char *)x,enc,kstr,klen,cb,u) | ||
| 519 | #define PEM_write_bio_PKCS7(bp,x) \ | ||
| 520 | PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \ | ||
| 521 | (char *)x, NULL,NULL,0,NULL,NULL) | ||
| 522 | #define PEM_write_bio_DHparams(bp,x) \ | ||
| 523 | PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\ | ||
| 524 | bp,(char *)x,NULL,NULL,0,NULL,NULL) | ||
| 525 | #define PEM_write_bio_DSAparams(bp,x) \ | ||
| 526 | PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \ | ||
| 527 | PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL,NULL) | ||
| 528 | |||
| 529 | #define PEM_write_bio_NETSCAPE_CERT_SEQUENCE(bp,x) \ | ||
| 530 | PEM_ASN1_write_bio((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \ | ||
| 531 | PEM_STRING_X509,bp, \ | ||
| 532 | (char *)x, NULL,NULL,0,NULL,NULL) | ||
| 533 | |||
| 534 | #define PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \ | ||
| 535 | (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u) | ||
| 536 | #define PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \ | ||
| 537 | (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb,u) | ||
| 538 | #define PEM_read_bio_X509_CRL(bp,x,cb,u) (X509_CRL *)PEM_ASN1_read_bio( \ | ||
| 539 | (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb,u) | ||
| 540 | #define PEM_read_bio_RSAPrivateKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \ | ||
| 541 | (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb,u) | ||
| 542 | #define PEM_read_bio_RSAPublicKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \ | ||
| 543 | (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb,u) | ||
| 544 | #define PEM_read_bio_DSAPrivateKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ | ||
| 545 | (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb,u) | ||
| 546 | #define PEM_read_bio_PrivateKey(bp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read_bio( \ | ||
| 547 | (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb,u) | ||
| 548 | |||
| 549 | #define PEM_read_bio_PKCS7(bp,x,cb,u) (PKCS7 *)PEM_ASN1_read_bio( \ | ||
| 550 | (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb,u) | ||
| 551 | #define PEM_read_bio_DHparams(bp,x,cb,u) (DH *)PEM_ASN1_read_bio( \ | ||
| 552 | (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb,u) | ||
| 553 | #define PEM_read_bio_DSAparams(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ | ||
| 554 | (char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb,u) | ||
| 555 | |||
| 556 | #define PEM_read_bio_NETSCAPE_CERT_SEQUENCE(bp,x,cb,u) \ | ||
| 557 | (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read_bio( \ | ||
| 558 | (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,bp,\ | ||
| 559 | (char **)x,cb,u) | ||
| 560 | |||
| 561 | #endif | ||
| 562 | |||
| 563 | #if 1 | 398 | #if 1 |
| 564 | /* "userdata": new with OpenSSL 0.9.4 */ | 399 | /* "userdata": new with OpenSSL 0.9.4 */ |
| 565 | typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); | 400 | typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); |
| @@ -581,40 +416,25 @@ int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char | |||
| 581 | pem_password_cb *cb, void *u); | 416 | pem_password_cb *cb, void *u); |
| 582 | void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, | 417 | void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, |
| 583 | void **x, pem_password_cb *cb, void *u); | 418 | void **x, pem_password_cb *cb, void *u); |
| 584 | 419 | int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp, void *x, | |
| 585 | #define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \ | ||
| 586 | ((type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i), \ | ||
| 587 | name, bp, \ | ||
| 588 | CHECKED_PPTR_OF(type, x), \ | ||
| 589 | cb, u)) | ||
| 590 | |||
| 591 | int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x, | ||
| 592 | const EVP_CIPHER *enc,unsigned char *kstr,int klen, | 420 | const EVP_CIPHER *enc,unsigned char *kstr,int klen, |
| 593 | pem_password_cb *cb, void *u); | 421 | pem_password_cb *cb, void *u); |
| 594 | 422 | ||
| 595 | #define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \ | ||
| 596 | (PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d), \ | ||
| 597 | name, bp, \ | ||
| 598 | CHECKED_PTR_OF(type, x), \ | ||
| 599 | enc, kstr, klen, cb, u)) | ||
| 600 | |||
| 601 | STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); | 423 | STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); |
| 602 | int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, | 424 | int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, |
| 603 | unsigned char *kstr, int klen, pem_password_cb *cd, void *u); | 425 | unsigned char *kstr, int klen, pem_password_cb *cd, void *u); |
| 604 | #endif | 426 | #endif |
| 605 | 427 | ||
| 606 | #ifndef OPENSSL_SYS_WIN16 | ||
| 607 | int PEM_read(FILE *fp, char **name, char **header, | 428 | int PEM_read(FILE *fp, char **name, char **header, |
| 608 | unsigned char **data,long *len); | 429 | unsigned char **data,long *len); |
| 609 | int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); | 430 | int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); |
| 610 | void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, | 431 | void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, |
| 611 | pem_password_cb *cb, void *u); | 432 | pem_password_cb *cb, void *u); |
| 612 | int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp, | 433 | int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp, |
| 613 | char *x,const EVP_CIPHER *enc,unsigned char *kstr, | 434 | void *x,const EVP_CIPHER *enc,unsigned char *kstr, |
| 614 | int klen,pem_password_cb *callback, void *u); | 435 | int klen,pem_password_cb *callback, void *u); |
| 615 | STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, | 436 | STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, |
| 616 | pem_password_cb *cb, void *u); | 437 | pem_password_cb *cb, void *u); |
| 617 | #endif | ||
| 618 | 438 | ||
| 619 | int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, | 439 | int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, |
| 620 | EVP_MD *md_type, unsigned char **ek, int *ekl, | 440 | EVP_MD *md_type, unsigned char **ek, int *ekl, |
| @@ -633,7 +453,6 @@ int PEM_def_callback(char *buf, int num, int w, void *key); | |||
| 633 | void PEM_proc_type(char *buf, int type); | 453 | void PEM_proc_type(char *buf, int type); |
| 634 | void PEM_dek_info(char *buf, const char *type, int len, char *str); | 454 | void PEM_dek_info(char *buf, const char *type, int len, char *str); |
| 635 | 455 | ||
| 636 | #ifndef SSLEAY_MACROS | ||
| 637 | 456 | ||
| 638 | #include <openssl/symhacks.h> | 457 | #include <openssl/symhacks.h> |
| 639 | 458 | ||
| @@ -719,7 +538,21 @@ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, vo | |||
| 719 | int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc, | 538 | int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc, |
| 720 | char *kstr,int klen, pem_password_cb *cd, void *u); | 539 | char *kstr,int klen, pem_password_cb *cd, void *u); |
| 721 | 540 | ||
| 722 | #endif /* SSLEAY_MACROS */ | 541 | EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); |
| 542 | int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); | ||
| 543 | |||
| 544 | |||
| 545 | EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); | ||
| 546 | EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); | ||
| 547 | EVP_PKEY *b2i_PrivateKey_bio(BIO *in); | ||
| 548 | EVP_PKEY *b2i_PublicKey_bio(BIO *in); | ||
| 549 | int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); | ||
| 550 | int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); | ||
| 551 | #ifndef OPENSSL_NO_RC4 | ||
| 552 | EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); | ||
| 553 | int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, | ||
| 554 | pem_password_cb *cb, void *u); | ||
| 555 | #endif | ||
| 723 | 556 | ||
| 724 | 557 | ||
| 725 | /* BEGIN ERROR CODES */ | 558 | /* BEGIN ERROR CODES */ |
| @@ -731,10 +564,22 @@ void ERR_load_PEM_strings(void); | |||
| 731 | /* Error codes for the PEM functions. */ | 564 | /* Error codes for the PEM functions. */ |
| 732 | 565 | ||
| 733 | /* Function codes. */ | 566 | /* Function codes. */ |
| 567 | #define PEM_F_B2I_DSS 127 | ||
| 568 | #define PEM_F_B2I_PVK_BIO 128 | ||
| 569 | #define PEM_F_B2I_RSA 129 | ||
| 570 | #define PEM_F_CHECK_BITLEN_DSA 130 | ||
| 571 | #define PEM_F_CHECK_BITLEN_RSA 131 | ||
| 734 | #define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 | 572 | #define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 |
| 735 | #define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 | 573 | #define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 |
| 574 | #define PEM_F_DO_B2I 132 | ||
| 575 | #define PEM_F_DO_B2I_BIO 133 | ||
| 576 | #define PEM_F_DO_BLOB_HEADER 134 | ||
| 736 | #define PEM_F_DO_PK8PKEY 126 | 577 | #define PEM_F_DO_PK8PKEY 126 |
| 737 | #define PEM_F_DO_PK8PKEY_FP 125 | 578 | #define PEM_F_DO_PK8PKEY_FP 125 |
| 579 | #define PEM_F_DO_PVK_BODY 135 | ||
| 580 | #define PEM_F_DO_PVK_HEADER 136 | ||
| 581 | #define PEM_F_I2B_PVK 137 | ||
| 582 | #define PEM_F_I2B_PVK_BIO 138 | ||
| 738 | #define PEM_F_LOAD_IV 101 | 583 | #define PEM_F_LOAD_IV 101 |
| 739 | #define PEM_F_PEM_ASN1_READ 102 | 584 | #define PEM_F_PEM_ASN1_READ 102 |
| 740 | #define PEM_F_PEM_ASN1_READ_BIO 103 | 585 | #define PEM_F_PEM_ASN1_READ_BIO 103 |
| @@ -747,6 +592,7 @@ void ERR_load_PEM_strings(void); | |||
| 747 | #define PEM_F_PEM_PK8PKEY 119 | 592 | #define PEM_F_PEM_PK8PKEY 119 |
| 748 | #define PEM_F_PEM_READ 108 | 593 | #define PEM_F_PEM_READ 108 |
| 749 | #define PEM_F_PEM_READ_BIO 109 | 594 | #define PEM_F_PEM_READ_BIO 109 |
| 595 | #define PEM_F_PEM_READ_BIO_PARAMETERS 140 | ||
| 750 | #define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 | 596 | #define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 |
| 751 | #define PEM_F_PEM_READ_PRIVATEKEY 124 | 597 | #define PEM_F_PEM_READ_PRIVATEKEY 124 |
| 752 | #define PEM_F_PEM_SEALFINAL 110 | 598 | #define PEM_F_PEM_SEALFINAL 110 |
| @@ -754,6 +600,7 @@ void ERR_load_PEM_strings(void); | |||
| 754 | #define PEM_F_PEM_SIGNFINAL 112 | 600 | #define PEM_F_PEM_SIGNFINAL 112 |
| 755 | #define PEM_F_PEM_WRITE 113 | 601 | #define PEM_F_PEM_WRITE 113 |
| 756 | #define PEM_F_PEM_WRITE_BIO 114 | 602 | #define PEM_F_PEM_WRITE_BIO 114 |
| 603 | #define PEM_F_PEM_WRITE_PRIVATEKEY 139 | ||
| 757 | #define PEM_F_PEM_X509_INFO_READ 115 | 604 | #define PEM_F_PEM_X509_INFO_READ 115 |
| 758 | #define PEM_F_PEM_X509_INFO_READ_BIO 116 | 605 | #define PEM_F_PEM_X509_INFO_READ_BIO 116 |
| 759 | #define PEM_F_PEM_X509_INFO_WRITE_BIO 117 | 606 | #define PEM_F_PEM_X509_INFO_WRITE_BIO 117 |
| @@ -763,18 +610,30 @@ void ERR_load_PEM_strings(void); | |||
| 763 | #define PEM_R_BAD_DECRYPT 101 | 610 | #define PEM_R_BAD_DECRYPT 101 |
| 764 | #define PEM_R_BAD_END_LINE 102 | 611 | #define PEM_R_BAD_END_LINE 102 |
| 765 | #define PEM_R_BAD_IV_CHARS 103 | 612 | #define PEM_R_BAD_IV_CHARS 103 |
| 613 | #define PEM_R_BAD_MAGIC_NUMBER 116 | ||
| 766 | #define PEM_R_BAD_PASSWORD_READ 104 | 614 | #define PEM_R_BAD_PASSWORD_READ 104 |
| 615 | #define PEM_R_BAD_VERSION_NUMBER 117 | ||
| 616 | #define PEM_R_BIO_WRITE_FAILURE 118 | ||
| 617 | #define PEM_R_CIPHER_IS_NULL 127 | ||
| 767 | #define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 | 618 | #define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 |
| 619 | #define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 | ||
| 620 | #define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 | ||
| 621 | #define PEM_R_INCONSISTENT_HEADER 121 | ||
| 622 | #define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 | ||
| 623 | #define PEM_R_KEYBLOB_TOO_SHORT 123 | ||
| 768 | #define PEM_R_NOT_DEK_INFO 105 | 624 | #define PEM_R_NOT_DEK_INFO 105 |
| 769 | #define PEM_R_NOT_ENCRYPTED 106 | 625 | #define PEM_R_NOT_ENCRYPTED 106 |
| 770 | #define PEM_R_NOT_PROC_TYPE 107 | 626 | #define PEM_R_NOT_PROC_TYPE 107 |
| 771 | #define PEM_R_NO_START_LINE 108 | 627 | #define PEM_R_NO_START_LINE 108 |
| 772 | #define PEM_R_PROBLEMS_GETTING_PASSWORD 109 | 628 | #define PEM_R_PROBLEMS_GETTING_PASSWORD 109 |
| 773 | #define PEM_R_PUBLIC_KEY_NO_RSA 110 | 629 | #define PEM_R_PUBLIC_KEY_NO_RSA 110 |
| 630 | #define PEM_R_PVK_DATA_TOO_SHORT 124 | ||
| 631 | #define PEM_R_PVK_TOO_SHORT 125 | ||
| 774 | #define PEM_R_READ_KEY 111 | 632 | #define PEM_R_READ_KEY 111 |
| 775 | #define PEM_R_SHORT_HEADER 112 | 633 | #define PEM_R_SHORT_HEADER 112 |
| 776 | #define PEM_R_UNSUPPORTED_CIPHER 113 | 634 | #define PEM_R_UNSUPPORTED_CIPHER 113 |
| 777 | #define PEM_R_UNSUPPORTED_ENCRYPTION 114 | 635 | #define PEM_R_UNSUPPORTED_ENCRYPTION 114 |
| 636 | #define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 | ||
| 778 | 637 | ||
| 779 | #ifdef __cplusplus | 638 | #ifdef __cplusplus |
| 780 | } | 639 | } |
diff --git a/src/lib/libcrypto/pem/pem_all.c b/src/lib/libcrypto/pem/pem_all.c index 69dd19bf2e..3e7a6093ad 100644 --- a/src/lib/libcrypto/pem/pem_all.c +++ b/src/lib/libcrypto/pem/pem_all.c | |||
| @@ -110,7 +110,6 @@ | |||
| 110 | */ | 110 | */ |
| 111 | 111 | ||
| 112 | #include <stdio.h> | 112 | #include <stdio.h> |
| 113 | #undef SSLEAY_MACROS | ||
| 114 | #include "cryptlib.h" | 113 | #include "cryptlib.h" |
| 115 | #include <openssl/bio.h> | 114 | #include <openssl/bio.h> |
| 116 | #include <openssl/evp.h> | 115 | #include <openssl/evp.h> |
| @@ -194,49 +193,7 @@ RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb, | |||
| 194 | 193 | ||
| 195 | #endif | 194 | #endif |
| 196 | 195 | ||
| 197 | #ifdef OPENSSL_FIPS | ||
| 198 | |||
| 199 | int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, | ||
| 200 | unsigned char *kstr, int klen, | ||
| 201 | pem_password_cb *cb, void *u) | ||
| 202 | { | ||
| 203 | EVP_PKEY *k; | ||
| 204 | int ret; | ||
| 205 | k = EVP_PKEY_new(); | ||
| 206 | if (!k) | ||
| 207 | return 0; | ||
| 208 | EVP_PKEY_set1_RSA(k, x); | ||
| 209 | |||
| 210 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
| 211 | EVP_PKEY_free(k); | ||
| 212 | return ret; | ||
| 213 | } | ||
| 214 | |||
| 215 | #ifndef OPENSSL_NO_FP_API | ||
| 216 | int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, | ||
| 217 | unsigned char *kstr, int klen, | ||
| 218 | pem_password_cb *cb, void *u) | ||
| 219 | { | ||
| 220 | EVP_PKEY *k; | ||
| 221 | int ret; | ||
| 222 | k = EVP_PKEY_new(); | ||
| 223 | if (!k) | ||
| 224 | return 0; | ||
| 225 | |||
| 226 | EVP_PKEY_set1_RSA(k, x); | ||
| 227 | |||
| 228 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
| 229 | EVP_PKEY_free(k); | ||
| 230 | return ret; | ||
| 231 | } | ||
| 232 | #endif | ||
| 233 | |||
| 234 | #else | ||
| 235 | |||
| 236 | IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) | 196 | IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) |
| 237 | |||
| 238 | #endif | ||
| 239 | |||
| 240 | IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) | 197 | IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) |
| 241 | IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) | 198 | IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) |
| 242 | 199 | ||
| @@ -263,50 +220,10 @@ DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb, | |||
| 263 | { | 220 | { |
| 264 | EVP_PKEY *pktmp; | 221 | EVP_PKEY *pktmp; |
| 265 | pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u); | 222 | pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u); |
| 266 | return pkey_get_dsa(pktmp, dsa); | 223 | return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ |
| 267 | } | 224 | } |
| 268 | 225 | ||
| 269 | #ifdef OPENSSL_FIPS | ||
| 270 | |||
| 271 | int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, | ||
| 272 | unsigned char *kstr, int klen, | ||
| 273 | pem_password_cb *cb, void *u) | ||
| 274 | { | ||
| 275 | EVP_PKEY *k; | ||
| 276 | int ret; | ||
| 277 | k = EVP_PKEY_new(); | ||
| 278 | if (!k) | ||
| 279 | return 0; | ||
| 280 | EVP_PKEY_set1_DSA(k, x); | ||
| 281 | |||
| 282 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
| 283 | EVP_PKEY_free(k); | ||
| 284 | return ret; | ||
| 285 | } | ||
| 286 | |||
| 287 | #ifndef OPENSSL_NO_FP_API | ||
| 288 | int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, | ||
| 289 | unsigned char *kstr, int klen, | ||
| 290 | pem_password_cb *cb, void *u) | ||
| 291 | { | ||
| 292 | EVP_PKEY *k; | ||
| 293 | int ret; | ||
| 294 | k = EVP_PKEY_new(); | ||
| 295 | if (!k) | ||
| 296 | return 0; | ||
| 297 | EVP_PKEY_set1_DSA(k, x); | ||
| 298 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
| 299 | EVP_PKEY_free(k); | ||
| 300 | return ret; | ||
| 301 | } | ||
| 302 | #endif | ||
| 303 | |||
| 304 | #else | ||
| 305 | |||
| 306 | IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) | 226 | IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) |
| 307 | |||
| 308 | #endif | ||
| 309 | |||
| 310 | IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) | 227 | IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) |
| 311 | 228 | ||
| 312 | #ifndef OPENSSL_NO_FP_API | 229 | #ifndef OPENSSL_NO_FP_API |
| @@ -316,7 +233,7 @@ DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **dsa, pem_password_cb *cb, | |||
| 316 | { | 233 | { |
| 317 | EVP_PKEY *pktmp; | 234 | EVP_PKEY *pktmp; |
| 318 | pktmp = PEM_read_PrivateKey(fp, NULL, cb, u); | 235 | pktmp = PEM_read_PrivateKey(fp, NULL, cb, u); |
| 319 | return pkey_get_dsa(pktmp, dsa); | 236 | return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ |
| 320 | } | 237 | } |
| 321 | 238 | ||
| 322 | #endif | 239 | #endif |
| @@ -347,54 +264,13 @@ EC_KEY *PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **key, pem_password_cb *cb, | |||
| 347 | { | 264 | { |
| 348 | EVP_PKEY *pktmp; | 265 | EVP_PKEY *pktmp; |
| 349 | pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u); | 266 | pktmp = PEM_read_bio_PrivateKey(bp, NULL, cb, u); |
| 350 | return pkey_get_eckey(pktmp, key); | 267 | return pkey_get_eckey(pktmp, key); /* will free pktmp */ |
| 351 | } | 268 | } |
| 352 | 269 | ||
| 353 | IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters) | 270 | IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters) |
| 354 | 271 | ||
| 355 | |||
| 356 | |||
| 357 | #ifdef OPENSSL_FIPS | ||
| 358 | |||
| 359 | int PEM_write_bio_ECPrivateKey(BIO *bp, EC_KEY *x, const EVP_CIPHER *enc, | ||
| 360 | unsigned char *kstr, int klen, | ||
| 361 | pem_password_cb *cb, void *u) | ||
| 362 | { | ||
| 363 | EVP_PKEY *k; | ||
| 364 | int ret; | ||
| 365 | k = EVP_PKEY_new(); | ||
| 366 | if (!k) | ||
| 367 | return 0; | ||
| 368 | EVP_PKEY_set1_EC_KEY(k, x); | ||
| 369 | |||
| 370 | ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u); | ||
| 371 | EVP_PKEY_free(k); | ||
| 372 | return ret; | ||
| 373 | } | ||
| 374 | |||
| 375 | #ifndef OPENSSL_NO_FP_API | ||
| 376 | int PEM_write_ECPrivateKey(FILE *fp, EC_KEY *x, const EVP_CIPHER *enc, | ||
| 377 | unsigned char *kstr, int klen, | ||
| 378 | pem_password_cb *cb, void *u) | ||
| 379 | { | ||
| 380 | EVP_PKEY *k; | ||
| 381 | int ret; | ||
| 382 | k = EVP_PKEY_new(); | ||
| 383 | if (!k) | ||
| 384 | return 0; | ||
| 385 | EVP_PKEY_set1_EC_KEY(k, x); | ||
| 386 | ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u); | ||
| 387 | EVP_PKEY_free(k); | ||
| 388 | return ret; | ||
| 389 | } | ||
| 390 | #endif | ||
| 391 | |||
| 392 | #else | ||
| 393 | |||
| 394 | IMPLEMENT_PEM_write_cb(ECPrivateKey, EC_KEY, PEM_STRING_ECPRIVATEKEY, ECPrivateKey) | 272 | IMPLEMENT_PEM_write_cb(ECPrivateKey, EC_KEY, PEM_STRING_ECPRIVATEKEY, ECPrivateKey) |
| 395 | 273 | ||
| 396 | #endif | ||
| 397 | |||
| 398 | IMPLEMENT_PEM_rw(EC_PUBKEY, EC_KEY, PEM_STRING_PUBLIC, EC_PUBKEY) | 274 | IMPLEMENT_PEM_rw(EC_PUBKEY, EC_KEY, PEM_STRING_PUBLIC, EC_PUBKEY) |
| 399 | 275 | ||
| 400 | #ifndef OPENSSL_NO_FP_API | 276 | #ifndef OPENSSL_NO_FP_API |
| @@ -404,7 +280,7 @@ EC_KEY *PEM_read_ECPrivateKey(FILE *fp, EC_KEY **eckey, pem_password_cb *cb, | |||
| 404 | { | 280 | { |
| 405 | EVP_PKEY *pktmp; | 281 | EVP_PKEY *pktmp; |
| 406 | pktmp = PEM_read_PrivateKey(fp, NULL, cb, u); | 282 | pktmp = PEM_read_PrivateKey(fp, NULL, cb, u); |
| 407 | return pkey_get_eckey(pktmp, eckey); | 283 | return pkey_get_eckey(pktmp, eckey); /* will free pktmp */ |
| 408 | } | 284 | } |
| 409 | 285 | ||
| 410 | #endif | 286 | #endif |
| @@ -417,66 +293,4 @@ IMPLEMENT_PEM_rw_const(DHparams, DH, PEM_STRING_DHPARAMS, DHparams) | |||
| 417 | 293 | ||
| 418 | #endif | 294 | #endif |
| 419 | 295 | ||
| 420 | |||
| 421 | /* The PrivateKey case is not that straightforward. | ||
| 422 | * IMPLEMENT_PEM_rw_cb(PrivateKey, EVP_PKEY, PEM_STRING_EVP_PKEY, PrivateKey) | ||
| 423 | * does not work, RSA and DSA keys have specific strings. | ||
| 424 | * (When reading, parameter PEM_STRING_EVP_PKEY is a wildcard for anything | ||
| 425 | * appropriate.) | ||
| 426 | */ | ||
| 427 | |||
| 428 | #ifdef OPENSSL_FIPS | ||
| 429 | |||
| 430 | static const char *pkey_str(EVP_PKEY *x) | ||
| 431 | { | ||
| 432 | switch (x->type) | ||
| 433 | { | ||
| 434 | case EVP_PKEY_RSA: | ||
| 435 | return PEM_STRING_RSA; | ||
| 436 | |||
| 437 | case EVP_PKEY_DSA: | ||
| 438 | return PEM_STRING_DSA; | ||
| 439 | |||
| 440 | case EVP_PKEY_EC: | ||
| 441 | return PEM_STRING_ECPRIVATEKEY; | ||
| 442 | |||
| 443 | default: | ||
| 444 | return NULL; | ||
| 445 | } | ||
| 446 | } | ||
| 447 | |||
| 448 | |||
| 449 | int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
| 450 | unsigned char *kstr, int klen, | ||
| 451 | pem_password_cb *cb, void *u) | ||
| 452 | { | ||
| 453 | if (FIPS_mode()) | ||
| 454 | return PEM_write_bio_PKCS8PrivateKey(bp, x, enc, | ||
| 455 | (char *)kstr, klen, cb, u); | ||
| 456 | else | ||
| 457 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey, | ||
| 458 | pkey_str(x), bp,(char *)x,enc,kstr,klen,cb,u); | ||
| 459 | } | ||
| 460 | |||
| 461 | #ifndef OPENSSL_NO_FP_API | ||
| 462 | int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
| 463 | unsigned char *kstr, int klen, | ||
| 464 | pem_password_cb *cb, void *u) | ||
| 465 | { | ||
| 466 | if (FIPS_mode()) | ||
| 467 | return PEM_write_PKCS8PrivateKey(fp, x, enc, | ||
| 468 | (char *)kstr, klen, cb, u); | ||
| 469 | else | ||
| 470 | return PEM_ASN1_write((i2d_of_void *)i2d_PrivateKey, | ||
| 471 | pkey_str(x), fp,(char *)x,enc,kstr,klen,cb,u); | ||
| 472 | } | ||
| 473 | #endif | ||
| 474 | |||
| 475 | #else | ||
| 476 | IMPLEMENT_PEM_write_cb(PrivateKey, EVP_PKEY, ((x->type == EVP_PKEY_DSA)?PEM_STRING_DSA:\ | ||
| 477 | (x->type == EVP_PKEY_RSA)?PEM_STRING_RSA:PEM_STRING_ECPRIVATEKEY), PrivateKey) | ||
| 478 | |||
| 479 | #endif | ||
| 480 | |||
| 481 | IMPLEMENT_PEM_rw(PUBKEY, EVP_PKEY, PEM_STRING_PUBLIC, PUBKEY) | 296 | IMPLEMENT_PEM_rw(PUBKEY, EVP_PKEY, PEM_STRING_PUBLIC, PUBKEY) |
| 482 | |||
diff --git a/src/lib/libcrypto/pem/pem_err.c b/src/lib/libcrypto/pem/pem_err.c index 3133563d77..d644aeedd4 100644 --- a/src/lib/libcrypto/pem/pem_err.c +++ b/src/lib/libcrypto/pem/pem_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/pem/pem_err.c */ | 1 | /* crypto/pem/pem_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -70,10 +70,22 @@ | |||
| 70 | 70 | ||
| 71 | static ERR_STRING_DATA PEM_str_functs[]= | 71 | static ERR_STRING_DATA PEM_str_functs[]= |
| 72 | { | 72 | { |
| 73 | {ERR_FUNC(PEM_F_B2I_DSS), "B2I_DSS"}, | ||
| 74 | {ERR_FUNC(PEM_F_B2I_PVK_BIO), "b2i_PVK_bio"}, | ||
| 75 | {ERR_FUNC(PEM_F_B2I_RSA), "B2I_RSA"}, | ||
| 76 | {ERR_FUNC(PEM_F_CHECK_BITLEN_DSA), "CHECK_BITLEN_DSA"}, | ||
| 77 | {ERR_FUNC(PEM_F_CHECK_BITLEN_RSA), "CHECK_BITLEN_RSA"}, | ||
| 73 | {ERR_FUNC(PEM_F_D2I_PKCS8PRIVATEKEY_BIO), "d2i_PKCS8PrivateKey_bio"}, | 78 | {ERR_FUNC(PEM_F_D2I_PKCS8PRIVATEKEY_BIO), "d2i_PKCS8PrivateKey_bio"}, |
| 74 | {ERR_FUNC(PEM_F_D2I_PKCS8PRIVATEKEY_FP), "d2i_PKCS8PrivateKey_fp"}, | 79 | {ERR_FUNC(PEM_F_D2I_PKCS8PRIVATEKEY_FP), "d2i_PKCS8PrivateKey_fp"}, |
| 80 | {ERR_FUNC(PEM_F_DO_B2I), "DO_B2I"}, | ||
| 81 | {ERR_FUNC(PEM_F_DO_B2I_BIO), "DO_B2I_BIO"}, | ||
| 82 | {ERR_FUNC(PEM_F_DO_BLOB_HEADER), "DO_BLOB_HEADER"}, | ||
| 75 | {ERR_FUNC(PEM_F_DO_PK8PKEY), "DO_PK8PKEY"}, | 83 | {ERR_FUNC(PEM_F_DO_PK8PKEY), "DO_PK8PKEY"}, |
| 76 | {ERR_FUNC(PEM_F_DO_PK8PKEY_FP), "DO_PK8PKEY_FP"}, | 84 | {ERR_FUNC(PEM_F_DO_PK8PKEY_FP), "DO_PK8PKEY_FP"}, |
| 85 | {ERR_FUNC(PEM_F_DO_PVK_BODY), "DO_PVK_BODY"}, | ||
| 86 | {ERR_FUNC(PEM_F_DO_PVK_HEADER), "DO_PVK_HEADER"}, | ||
| 87 | {ERR_FUNC(PEM_F_I2B_PVK), "I2B_PVK"}, | ||
| 88 | {ERR_FUNC(PEM_F_I2B_PVK_BIO), "i2b_PVK_bio"}, | ||
| 77 | {ERR_FUNC(PEM_F_LOAD_IV), "LOAD_IV"}, | 89 | {ERR_FUNC(PEM_F_LOAD_IV), "LOAD_IV"}, |
| 78 | {ERR_FUNC(PEM_F_PEM_ASN1_READ), "PEM_ASN1_read"}, | 90 | {ERR_FUNC(PEM_F_PEM_ASN1_READ), "PEM_ASN1_read"}, |
| 79 | {ERR_FUNC(PEM_F_PEM_ASN1_READ_BIO), "PEM_ASN1_read_bio"}, | 91 | {ERR_FUNC(PEM_F_PEM_ASN1_READ_BIO), "PEM_ASN1_read_bio"}, |
| @@ -86,6 +98,7 @@ static ERR_STRING_DATA PEM_str_functs[]= | |||
| 86 | {ERR_FUNC(PEM_F_PEM_PK8PKEY), "PEM_PK8PKEY"}, | 98 | {ERR_FUNC(PEM_F_PEM_PK8PKEY), "PEM_PK8PKEY"}, |
| 87 | {ERR_FUNC(PEM_F_PEM_READ), "PEM_read"}, | 99 | {ERR_FUNC(PEM_F_PEM_READ), "PEM_read"}, |
| 88 | {ERR_FUNC(PEM_F_PEM_READ_BIO), "PEM_read_bio"}, | 100 | {ERR_FUNC(PEM_F_PEM_READ_BIO), "PEM_read_bio"}, |
| 101 | {ERR_FUNC(PEM_F_PEM_READ_BIO_PARAMETERS), "PEM_read_bio_Parameters"}, | ||
| 89 | {ERR_FUNC(PEM_F_PEM_READ_BIO_PRIVATEKEY), "PEM_READ_BIO_PRIVATEKEY"}, | 102 | {ERR_FUNC(PEM_F_PEM_READ_BIO_PRIVATEKEY), "PEM_READ_BIO_PRIVATEKEY"}, |
| 90 | {ERR_FUNC(PEM_F_PEM_READ_PRIVATEKEY), "PEM_READ_PRIVATEKEY"}, | 103 | {ERR_FUNC(PEM_F_PEM_READ_PRIVATEKEY), "PEM_READ_PRIVATEKEY"}, |
| 91 | {ERR_FUNC(PEM_F_PEM_SEALFINAL), "PEM_SealFinal"}, | 104 | {ERR_FUNC(PEM_F_PEM_SEALFINAL), "PEM_SealFinal"}, |
| @@ -93,6 +106,7 @@ static ERR_STRING_DATA PEM_str_functs[]= | |||
| 93 | {ERR_FUNC(PEM_F_PEM_SIGNFINAL), "PEM_SignFinal"}, | 106 | {ERR_FUNC(PEM_F_PEM_SIGNFINAL), "PEM_SignFinal"}, |
| 94 | {ERR_FUNC(PEM_F_PEM_WRITE), "PEM_write"}, | 107 | {ERR_FUNC(PEM_F_PEM_WRITE), "PEM_write"}, |
| 95 | {ERR_FUNC(PEM_F_PEM_WRITE_BIO), "PEM_write_bio"}, | 108 | {ERR_FUNC(PEM_F_PEM_WRITE_BIO), "PEM_write_bio"}, |
| 109 | {ERR_FUNC(PEM_F_PEM_WRITE_PRIVATEKEY), "PEM_WRITE_PRIVATEKEY"}, | ||
| 96 | {ERR_FUNC(PEM_F_PEM_X509_INFO_READ), "PEM_X509_INFO_read"}, | 110 | {ERR_FUNC(PEM_F_PEM_X509_INFO_READ), "PEM_X509_INFO_read"}, |
| 97 | {ERR_FUNC(PEM_F_PEM_X509_INFO_READ_BIO), "PEM_X509_INFO_read_bio"}, | 111 | {ERR_FUNC(PEM_F_PEM_X509_INFO_READ_BIO), "PEM_X509_INFO_read_bio"}, |
| 98 | {ERR_FUNC(PEM_F_PEM_X509_INFO_WRITE_BIO), "PEM_X509_INFO_write_bio"}, | 112 | {ERR_FUNC(PEM_F_PEM_X509_INFO_WRITE_BIO), "PEM_X509_INFO_write_bio"}, |
| @@ -105,18 +119,30 @@ static ERR_STRING_DATA PEM_str_reasons[]= | |||
| 105 | {ERR_REASON(PEM_R_BAD_DECRYPT) ,"bad decrypt"}, | 119 | {ERR_REASON(PEM_R_BAD_DECRYPT) ,"bad decrypt"}, |
| 106 | {ERR_REASON(PEM_R_BAD_END_LINE) ,"bad end line"}, | 120 | {ERR_REASON(PEM_R_BAD_END_LINE) ,"bad end line"}, |
| 107 | {ERR_REASON(PEM_R_BAD_IV_CHARS) ,"bad iv chars"}, | 121 | {ERR_REASON(PEM_R_BAD_IV_CHARS) ,"bad iv chars"}, |
| 122 | {ERR_REASON(PEM_R_BAD_MAGIC_NUMBER) ,"bad magic number"}, | ||
| 108 | {ERR_REASON(PEM_R_BAD_PASSWORD_READ) ,"bad password read"}, | 123 | {ERR_REASON(PEM_R_BAD_PASSWORD_READ) ,"bad password read"}, |
| 124 | {ERR_REASON(PEM_R_BAD_VERSION_NUMBER) ,"bad version number"}, | ||
| 125 | {ERR_REASON(PEM_R_BIO_WRITE_FAILURE) ,"bio write failure"}, | ||
| 126 | {ERR_REASON(PEM_R_CIPHER_IS_NULL) ,"cipher is null"}, | ||
| 109 | {ERR_REASON(PEM_R_ERROR_CONVERTING_PRIVATE_KEY),"error converting private key"}, | 127 | {ERR_REASON(PEM_R_ERROR_CONVERTING_PRIVATE_KEY),"error converting private key"}, |
| 128 | {ERR_REASON(PEM_R_EXPECTING_PRIVATE_KEY_BLOB),"expecting private key blob"}, | ||
| 129 | {ERR_REASON(PEM_R_EXPECTING_PUBLIC_KEY_BLOB),"expecting public key blob"}, | ||
| 130 | {ERR_REASON(PEM_R_INCONSISTENT_HEADER) ,"inconsistent header"}, | ||
| 131 | {ERR_REASON(PEM_R_KEYBLOB_HEADER_PARSE_ERROR),"keyblob header parse error"}, | ||
| 132 | {ERR_REASON(PEM_R_KEYBLOB_TOO_SHORT) ,"keyblob too short"}, | ||
| 110 | {ERR_REASON(PEM_R_NOT_DEK_INFO) ,"not dek info"}, | 133 | {ERR_REASON(PEM_R_NOT_DEK_INFO) ,"not dek info"}, |
| 111 | {ERR_REASON(PEM_R_NOT_ENCRYPTED) ,"not encrypted"}, | 134 | {ERR_REASON(PEM_R_NOT_ENCRYPTED) ,"not encrypted"}, |
| 112 | {ERR_REASON(PEM_R_NOT_PROC_TYPE) ,"not proc type"}, | 135 | {ERR_REASON(PEM_R_NOT_PROC_TYPE) ,"not proc type"}, |
| 113 | {ERR_REASON(PEM_R_NO_START_LINE) ,"no start line"}, | 136 | {ERR_REASON(PEM_R_NO_START_LINE) ,"no start line"}, |
| 114 | {ERR_REASON(PEM_R_PROBLEMS_GETTING_PASSWORD),"problems getting password"}, | 137 | {ERR_REASON(PEM_R_PROBLEMS_GETTING_PASSWORD),"problems getting password"}, |
| 115 | {ERR_REASON(PEM_R_PUBLIC_KEY_NO_RSA) ,"public key no rsa"}, | 138 | {ERR_REASON(PEM_R_PUBLIC_KEY_NO_RSA) ,"public key no rsa"}, |
| 139 | {ERR_REASON(PEM_R_PVK_DATA_TOO_SHORT) ,"pvk data too short"}, | ||
| 140 | {ERR_REASON(PEM_R_PVK_TOO_SHORT) ,"pvk too short"}, | ||
| 116 | {ERR_REASON(PEM_R_READ_KEY) ,"read key"}, | 141 | {ERR_REASON(PEM_R_READ_KEY) ,"read key"}, |
| 117 | {ERR_REASON(PEM_R_SHORT_HEADER) ,"short header"}, | 142 | {ERR_REASON(PEM_R_SHORT_HEADER) ,"short header"}, |
| 118 | {ERR_REASON(PEM_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, | 143 | {ERR_REASON(PEM_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, |
| 119 | {ERR_REASON(PEM_R_UNSUPPORTED_ENCRYPTION),"unsupported encryption"}, | 144 | {ERR_REASON(PEM_R_UNSUPPORTED_ENCRYPTION),"unsupported encryption"}, |
| 145 | {ERR_REASON(PEM_R_UNSUPPORTED_KEY_COMPONENTS),"unsupported key components"}, | ||
| 120 | {0,NULL} | 146 | {0,NULL} |
| 121 | }; | 147 | }; |
| 122 | 148 | ||
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c index 3a273f6f70..1b2be527ed 100644 --- a/src/lib/libcrypto/pem/pem_info.c +++ b/src/lib/libcrypto/pem/pem_info.c | |||
| @@ -98,8 +98,8 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pe | |||
| 98 | long len,error=0; | 98 | long len,error=0; |
| 99 | int ok=0; | 99 | int ok=0; |
| 100 | STACK_OF(X509_INFO) *ret=NULL; | 100 | STACK_OF(X509_INFO) *ret=NULL; |
| 101 | unsigned int i,raw; | 101 | unsigned int i,raw,ptype; |
| 102 | d2i_of_void *d2i; | 102 | d2i_of_void *d2i = 0; |
| 103 | 103 | ||
| 104 | if (sk == NULL) | 104 | if (sk == NULL) |
| 105 | { | 105 | { |
| @@ -116,6 +116,7 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pe | |||
| 116 | for (;;) | 116 | for (;;) |
| 117 | { | 117 | { |
| 118 | raw=0; | 118 | raw=0; |
| 119 | ptype = 0; | ||
| 119 | i=PEM_read_bio(bp,&name,&header,&data,&len); | 120 | i=PEM_read_bio(bp,&name,&header,&data,&len); |
| 120 | if (i == 0) | 121 | if (i == 0) |
| 121 | { | 122 | { |
| @@ -166,7 +167,6 @@ start: | |||
| 166 | #ifndef OPENSSL_NO_RSA | 167 | #ifndef OPENSSL_NO_RSA |
| 167 | if (strcmp(name,PEM_STRING_RSA) == 0) | 168 | if (strcmp(name,PEM_STRING_RSA) == 0) |
| 168 | { | 169 | { |
| 169 | d2i=(D2I_OF(void))d2i_RSAPrivateKey; | ||
| 170 | if (xi->x_pkey != NULL) | 170 | if (xi->x_pkey != NULL) |
| 171 | { | 171 | { |
| 172 | if (!sk_X509_INFO_push(ret,xi)) goto err; | 172 | if (!sk_X509_INFO_push(ret,xi)) goto err; |
| @@ -178,10 +178,8 @@ start: | |||
| 178 | xi->enc_len=0; | 178 | xi->enc_len=0; |
| 179 | 179 | ||
| 180 | xi->x_pkey=X509_PKEY_new(); | 180 | xi->x_pkey=X509_PKEY_new(); |
| 181 | if ((xi->x_pkey->dec_pkey=EVP_PKEY_new()) == NULL) | 181 | ptype=EVP_PKEY_RSA; |
| 182 | goto err; | 182 | pp=&xi->x_pkey->dec_pkey; |
| 183 | xi->x_pkey->dec_pkey->type=EVP_PKEY_RSA; | ||
| 184 | pp=&(xi->x_pkey->dec_pkey->pkey.rsa); | ||
| 185 | if ((int)strlen(header) > 10) /* assume encrypted */ | 183 | if ((int)strlen(header) > 10) /* assume encrypted */ |
| 186 | raw=1; | 184 | raw=1; |
| 187 | } | 185 | } |
| @@ -202,10 +200,8 @@ start: | |||
| 202 | xi->enc_len=0; | 200 | xi->enc_len=0; |
| 203 | 201 | ||
| 204 | xi->x_pkey=X509_PKEY_new(); | 202 | xi->x_pkey=X509_PKEY_new(); |
| 205 | if ((xi->x_pkey->dec_pkey=EVP_PKEY_new()) == NULL) | 203 | ptype = EVP_PKEY_DSA; |
| 206 | goto err; | 204 | pp=&xi->x_pkey->dec_pkey; |
| 207 | xi->x_pkey->dec_pkey->type=EVP_PKEY_DSA; | ||
| 208 | pp=&xi->x_pkey->dec_pkey->pkey.dsa; | ||
| 209 | if ((int)strlen(header) > 10) /* assume encrypted */ | 205 | if ((int)strlen(header) > 10) /* assume encrypted */ |
| 210 | raw=1; | 206 | raw=1; |
| 211 | } | 207 | } |
| @@ -226,10 +222,8 @@ start: | |||
| 226 | xi->enc_len=0; | 222 | xi->enc_len=0; |
| 227 | 223 | ||
| 228 | xi->x_pkey=X509_PKEY_new(); | 224 | xi->x_pkey=X509_PKEY_new(); |
| 229 | if ((xi->x_pkey->dec_pkey=EVP_PKEY_new()) == NULL) | 225 | ptype = EVP_PKEY_EC; |
| 230 | goto err; | 226 | pp=&xi->x_pkey->dec_pkey; |
| 231 | xi->x_pkey->dec_pkey->type=EVP_PKEY_EC; | ||
| 232 | pp=&(xi->x_pkey->dec_pkey->pkey.ec); | ||
| 233 | if ((int)strlen(header) > 10) /* assume encrypted */ | 227 | if ((int)strlen(header) > 10) /* assume encrypted */ |
| 234 | raw=1; | 228 | raw=1; |
| 235 | } | 229 | } |
| @@ -251,7 +245,15 @@ start: | |||
| 251 | if (!PEM_do_header(&cipher,data,&len,cb,u)) | 245 | if (!PEM_do_header(&cipher,data,&len,cb,u)) |
| 252 | goto err; | 246 | goto err; |
| 253 | p=data; | 247 | p=data; |
| 254 | if (d2i(pp,&p,len) == NULL) | 248 | if (ptype) |
| 249 | { | ||
| 250 | if (!d2i_PrivateKey(ptype, pp, &p, len)) | ||
| 251 | { | ||
| 252 | PEMerr(PEM_F_PEM_X509_INFO_READ_BIO,ERR_R_ASN1_LIB); | ||
| 253 | goto err; | ||
| 254 | } | ||
| 255 | } | ||
| 256 | else if (d2i(pp,&p,len) == NULL) | ||
| 255 | { | 257 | { |
| 256 | PEMerr(PEM_F_PEM_X509_INFO_READ_BIO,ERR_R_ASN1_LIB); | 258 | PEMerr(PEM_F_PEM_X509_INFO_READ_BIO,ERR_R_ASN1_LIB); |
| 257 | goto err; | 259 | goto err; |
| @@ -337,6 +339,12 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, | |||
| 337 | { | 339 | { |
| 338 | if ( (xi->enc_data!=NULL) && (xi->enc_len>0) ) | 340 | if ( (xi->enc_data!=NULL) && (xi->enc_len>0) ) |
| 339 | { | 341 | { |
| 342 | if (enc == NULL) | ||
| 343 | { | ||
| 344 | PEMerr(PEM_F_PEM_X509_INFO_WRITE_BIO,PEM_R_CIPHER_IS_NULL); | ||
| 345 | goto err; | ||
| 346 | } | ||
| 347 | |||
| 340 | /* copy from weirdo names into more normal things */ | 348 | /* copy from weirdo names into more normal things */ |
| 341 | iv=xi->enc_cipher.iv; | 349 | iv=xi->enc_cipher.iv; |
| 342 | data=(unsigned char *)xi->enc_data; | 350 | data=(unsigned char *)xi->enc_data; |
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index cbafefe416..42e4861bc1 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c | |||
| @@ -57,6 +57,7 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <ctype.h> | ||
| 60 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 61 | #include <openssl/buffer.h> | 62 | #include <openssl/buffer.h> |
| 62 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| @@ -65,9 +66,13 @@ | |||
| 65 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| 66 | #include <openssl/pem.h> | 67 | #include <openssl/pem.h> |
| 67 | #include <openssl/pkcs12.h> | 68 | #include <openssl/pkcs12.h> |
| 69 | #include "asn1_locl.h" | ||
| 68 | #ifndef OPENSSL_NO_DES | 70 | #ifndef OPENSSL_NO_DES |
| 69 | #include <openssl/des.h> | 71 | #include <openssl/des.h> |
| 70 | #endif | 72 | #endif |
| 73 | #ifndef OPENSSL_NO_ENGINE | ||
| 74 | #include <openssl/engine.h> | ||
| 75 | #endif | ||
| 71 | 76 | ||
| 72 | const char PEM_version[]="PEM" OPENSSL_VERSION_PTEXT; | 77 | const char PEM_version[]="PEM" OPENSSL_VERSION_PTEXT; |
| 73 | 78 | ||
| @@ -75,6 +80,7 @@ const char PEM_version[]="PEM" OPENSSL_VERSION_PTEXT; | |||
| 75 | 80 | ||
| 76 | static int load_iv(char **fromp,unsigned char *to, int num); | 81 | static int load_iv(char **fromp,unsigned char *to, int num); |
| 77 | static int check_pem(const char *nm, const char *name); | 82 | static int check_pem(const char *nm, const char *name); |
| 83 | int pem_check_suffix(const char *pem_str, const char *suffix); | ||
| 78 | 84 | ||
| 79 | int PEM_def_callback(char *buf, int num, int w, void *key) | 85 | int PEM_def_callback(char *buf, int num, int w, void *key) |
| 80 | { | 86 | { |
| @@ -99,7 +105,7 @@ int PEM_def_callback(char *buf, int num, int w, void *key) | |||
| 99 | 105 | ||
| 100 | for (;;) | 106 | for (;;) |
| 101 | { | 107 | { |
| 102 | i=EVP_read_pw_string(buf,num,prompt,w); | 108 | i=EVP_read_pw_string_min(buf,MIN_LENGTH,num,prompt,w); |
| 103 | if (i != 0) | 109 | if (i != 0) |
| 104 | { | 110 | { |
| 105 | PEMerr(PEM_F_PEM_DEF_CALLBACK,PEM_R_PROBLEMS_GETTING_PASSWORD); | 111 | PEMerr(PEM_F_PEM_DEF_CALLBACK,PEM_R_PROBLEMS_GETTING_PASSWORD); |
| @@ -183,20 +189,54 @@ static int check_pem(const char *nm, const char *name) | |||
| 183 | 189 | ||
| 184 | /* Make PEM_STRING_EVP_PKEY match any private key */ | 190 | /* Make PEM_STRING_EVP_PKEY match any private key */ |
| 185 | 191 | ||
| 186 | if(!strcmp(nm,PEM_STRING_PKCS8) && | 192 | if(!strcmp(name,PEM_STRING_EVP_PKEY)) |
| 187 | !strcmp(name,PEM_STRING_EVP_PKEY)) return 1; | 193 | { |
| 188 | 194 | int slen; | |
| 189 | if(!strcmp(nm,PEM_STRING_PKCS8INF) && | 195 | const EVP_PKEY_ASN1_METHOD *ameth; |
| 190 | !strcmp(name,PEM_STRING_EVP_PKEY)) return 1; | 196 | if(!strcmp(nm,PEM_STRING_PKCS8)) |
| 191 | 197 | return 1; | |
| 192 | if(!strcmp(nm,PEM_STRING_RSA) && | 198 | if(!strcmp(nm,PEM_STRING_PKCS8INF)) |
| 193 | !strcmp(name,PEM_STRING_EVP_PKEY)) return 1; | 199 | return 1; |
| 200 | slen = pem_check_suffix(nm, "PRIVATE KEY"); | ||
| 201 | if (slen > 0) | ||
| 202 | { | ||
| 203 | /* NB: ENGINE implementations wont contain | ||
| 204 | * a deprecated old private key decode function | ||
| 205 | * so don't look for them. | ||
| 206 | */ | ||
| 207 | ameth = EVP_PKEY_asn1_find_str(NULL, nm, slen); | ||
| 208 | if (ameth && ameth->old_priv_decode) | ||
| 209 | return 1; | ||
| 210 | } | ||
| 211 | return 0; | ||
| 212 | } | ||
| 194 | 213 | ||
| 195 | if(!strcmp(nm,PEM_STRING_DSA) && | 214 | if(!strcmp(name,PEM_STRING_PARAMETERS)) |
| 196 | !strcmp(name,PEM_STRING_EVP_PKEY)) return 1; | 215 | { |
| 216 | int slen; | ||
| 217 | const EVP_PKEY_ASN1_METHOD *ameth; | ||
| 218 | slen = pem_check_suffix(nm, "PARAMETERS"); | ||
| 219 | if (slen > 0) | ||
| 220 | { | ||
| 221 | ENGINE *e; | ||
| 222 | ameth = EVP_PKEY_asn1_find_str(&e, nm, slen); | ||
| 223 | if (ameth) | ||
| 224 | { | ||
| 225 | int r; | ||
| 226 | if (ameth->param_decode) | ||
| 227 | r = 1; | ||
| 228 | else | ||
| 229 | r = 0; | ||
| 230 | #ifndef OPENSSL_NO_ENGINE | ||
| 231 | if (e) | ||
| 232 | ENGINE_finish(e); | ||
| 233 | #endif | ||
| 234 | return r; | ||
| 235 | } | ||
| 236 | } | ||
| 237 | return 0; | ||
| 238 | } | ||
| 197 | 239 | ||
| 198 | if(!strcmp(nm,PEM_STRING_ECPRIVATEKEY) && | ||
| 199 | !strcmp(name,PEM_STRING_EVP_PKEY)) return 1; | ||
| 200 | /* Permit older strings */ | 240 | /* Permit older strings */ |
| 201 | 241 | ||
| 202 | if(!strcmp(nm,PEM_STRING_X509_OLD) && | 242 | if(!strcmp(nm,PEM_STRING_X509_OLD) && |
| @@ -219,6 +259,14 @@ static int check_pem(const char *nm, const char *name) | |||
| 219 | if(!strcmp(nm, PEM_STRING_PKCS7_SIGNED) && | 259 | if(!strcmp(nm, PEM_STRING_PKCS7_SIGNED) && |
| 220 | !strcmp(name, PEM_STRING_PKCS7)) return 1; | 260 | !strcmp(name, PEM_STRING_PKCS7)) return 1; |
| 221 | 261 | ||
| 262 | #ifndef OPENSSL_NO_CMS | ||
| 263 | if(!strcmp(nm, PEM_STRING_X509) && | ||
| 264 | !strcmp(name, PEM_STRING_CMS)) return 1; | ||
| 265 | /* Allow CMS to be read from PKCS#7 headers */ | ||
| 266 | if(!strcmp(nm, PEM_STRING_PKCS7) && | ||
| 267 | !strcmp(name, PEM_STRING_CMS)) return 1; | ||
| 268 | #endif | ||
| 269 | |||
| 222 | return 0; | 270 | return 0; |
| 223 | } | 271 | } |
| 224 | 272 | ||
| @@ -264,7 +312,7 @@ err: | |||
| 264 | 312 | ||
| 265 | #ifndef OPENSSL_NO_FP_API | 313 | #ifndef OPENSSL_NO_FP_API |
| 266 | int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, | 314 | int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, |
| 267 | char *x, const EVP_CIPHER *enc, unsigned char *kstr, | 315 | void *x, const EVP_CIPHER *enc, unsigned char *kstr, |
| 268 | int klen, pem_password_cb *callback, void *u) | 316 | int klen, pem_password_cb *callback, void *u) |
| 269 | { | 317 | { |
| 270 | BIO *b; | 318 | BIO *b; |
| @@ -283,7 +331,7 @@ int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, | |||
| 283 | #endif | 331 | #endif |
| 284 | 332 | ||
| 285 | int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, | 333 | int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, |
| 286 | char *x, const EVP_CIPHER *enc, unsigned char *kstr, | 334 | void *x, const EVP_CIPHER *enc, unsigned char *kstr, |
| 287 | int klen, pem_password_cb *callback, void *u) | 335 | int klen, pem_password_cb *callback, void *u) |
| 288 | { | 336 | { |
| 289 | EVP_CIPHER_CTX ctx; | 337 | EVP_CIPHER_CTX ctx; |
| @@ -782,3 +830,25 @@ err: | |||
| 782 | BUF_MEM_free(dataB); | 830 | BUF_MEM_free(dataB); |
| 783 | return(0); | 831 | return(0); |
| 784 | } | 832 | } |
| 833 | |||
| 834 | /* Check pem string and return prefix length. | ||
| 835 | * If for example the pem_str == "RSA PRIVATE KEY" and suffix = "PRIVATE KEY" | ||
| 836 | * the return value is 3 for the string "RSA". | ||
| 837 | */ | ||
| 838 | |||
| 839 | int pem_check_suffix(const char *pem_str, const char *suffix) | ||
| 840 | { | ||
| 841 | int pem_len = strlen(pem_str); | ||
| 842 | int suffix_len = strlen(suffix); | ||
| 843 | const char *p; | ||
| 844 | if (suffix_len + 1 >= pem_len) | ||
| 845 | return 0; | ||
| 846 | p = pem_str + pem_len - suffix_len; | ||
| 847 | if (strcmp(p, suffix)) | ||
| 848 | return 0; | ||
| 849 | p--; | ||
| 850 | if (*p != ' ') | ||
| 851 | return 0; | ||
| 852 | return p - pem_str; | ||
| 853 | } | ||
| 854 | |||
diff --git a/src/lib/libcrypto/pem/pem_pkey.c b/src/lib/libcrypto/pem/pem_pkey.c index 4da4c31ce5..8ecf24903b 100644 --- a/src/lib/libcrypto/pem/pem_pkey.c +++ b/src/lib/libcrypto/pem/pem_pkey.c | |||
| @@ -65,7 +65,12 @@ | |||
| 65 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 66 | #include <openssl/pkcs12.h> | 66 | #include <openssl/pkcs12.h> |
| 67 | #include <openssl/pem.h> | 67 | #include <openssl/pem.h> |
| 68 | #ifndef OPENSSL_NO_ENGINE | ||
| 69 | #include <openssl/engine.h> | ||
| 70 | #endif | ||
| 71 | #include "asn1_locl.h" | ||
| 68 | 72 | ||
| 73 | int pem_check_suffix(const char *pem_str, const char *suffix); | ||
| 69 | 74 | ||
| 70 | EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u) | 75 | EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u) |
| 71 | { | 76 | { |
| @@ -73,19 +78,14 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, vo | |||
| 73 | const unsigned char *p=NULL; | 78 | const unsigned char *p=NULL; |
| 74 | unsigned char *data=NULL; | 79 | unsigned char *data=NULL; |
| 75 | long len; | 80 | long len; |
| 81 | int slen; | ||
| 76 | EVP_PKEY *ret=NULL; | 82 | EVP_PKEY *ret=NULL; |
| 77 | 83 | ||
| 78 | if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp, cb, u)) | 84 | if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp, cb, u)) |
| 79 | return NULL; | 85 | return NULL; |
| 80 | p = data; | 86 | p = data; |
| 81 | 87 | ||
| 82 | if (strcmp(nm,PEM_STRING_RSA) == 0) | 88 | if (strcmp(nm,PEM_STRING_PKCS8INF) == 0) { |
| 83 | ret=d2i_PrivateKey(EVP_PKEY_RSA,x,&p,len); | ||
| 84 | else if (strcmp(nm,PEM_STRING_DSA) == 0) | ||
| 85 | ret=d2i_PrivateKey(EVP_PKEY_DSA,x,&p,len); | ||
| 86 | else if (strcmp(nm,PEM_STRING_ECPRIVATEKEY) == 0) | ||
| 87 | ret=d2i_PrivateKey(EVP_PKEY_EC,x,&p,len); | ||
| 88 | else if (strcmp(nm,PEM_STRING_PKCS8INF) == 0) { | ||
| 89 | PKCS8_PRIV_KEY_INFO *p8inf; | 89 | PKCS8_PRIV_KEY_INFO *p8inf; |
| 90 | p8inf=d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len); | 90 | p8inf=d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len); |
| 91 | if(!p8inf) goto p8err; | 91 | if(!p8inf) goto p8err; |
| @@ -119,7 +119,14 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, vo | |||
| 119 | *x = ret; | 119 | *x = ret; |
| 120 | } | 120 | } |
| 121 | PKCS8_PRIV_KEY_INFO_free(p8inf); | 121 | PKCS8_PRIV_KEY_INFO_free(p8inf); |
| 122 | } | 122 | } else if ((slen = pem_check_suffix(nm, "PRIVATE KEY")) > 0) |
| 123 | { | ||
| 124 | const EVP_PKEY_ASN1_METHOD *ameth; | ||
| 125 | ameth = EVP_PKEY_asn1_find_str(NULL, nm, slen); | ||
| 126 | if (!ameth || !ameth->old_priv_decode) | ||
| 127 | goto p8err; | ||
| 128 | ret=d2i_PrivateKey(ameth->pkey_id,x,&p,len); | ||
| 129 | } | ||
| 123 | p8err: | 130 | p8err: |
| 124 | if (ret == NULL) | 131 | if (ret == NULL) |
| 125 | PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY,ERR_R_ASN1_LIB); | 132 | PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY,ERR_R_ASN1_LIB); |
| @@ -130,6 +137,74 @@ err: | |||
| 130 | return(ret); | 137 | return(ret); |
| 131 | } | 138 | } |
| 132 | 139 | ||
| 140 | int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
| 141 | unsigned char *kstr, int klen, | ||
| 142 | pem_password_cb *cb, void *u) | ||
| 143 | { | ||
| 144 | char pem_str[80]; | ||
| 145 | if (!x->ameth || x->ameth->priv_encode) | ||
| 146 | return PEM_write_bio_PKCS8PrivateKey(bp, x, enc, | ||
| 147 | (char *)kstr, klen, | ||
| 148 | cb, u); | ||
| 149 | |||
| 150 | BIO_snprintf(pem_str, 80, "%s PRIVATE KEY", x->ameth->pem_str); | ||
| 151 | return PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey, | ||
| 152 | pem_str,bp,x,enc,kstr,klen,cb,u); | ||
| 153 | } | ||
| 154 | |||
| 155 | EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x) | ||
| 156 | { | ||
| 157 | char *nm=NULL; | ||
| 158 | const unsigned char *p=NULL; | ||
| 159 | unsigned char *data=NULL; | ||
| 160 | long len; | ||
| 161 | int slen; | ||
| 162 | EVP_PKEY *ret=NULL; | ||
| 163 | |||
| 164 | if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_PARAMETERS, | ||
| 165 | bp, 0, NULL)) | ||
| 166 | return NULL; | ||
| 167 | p = data; | ||
| 168 | |||
| 169 | if ((slen = pem_check_suffix(nm, "PARAMETERS")) > 0) | ||
| 170 | { | ||
| 171 | ret = EVP_PKEY_new(); | ||
| 172 | if (!ret) | ||
| 173 | goto err; | ||
| 174 | if (!EVP_PKEY_set_type_str(ret, nm, slen) | ||
| 175 | || !ret->ameth->param_decode | ||
| 176 | || !ret->ameth->param_decode(ret, &p, len)) | ||
| 177 | { | ||
| 178 | EVP_PKEY_free(ret); | ||
| 179 | ret = NULL; | ||
| 180 | goto err; | ||
| 181 | } | ||
| 182 | if(x) | ||
| 183 | { | ||
| 184 | if(*x) EVP_PKEY_free((EVP_PKEY *)*x); | ||
| 185 | *x = ret; | ||
| 186 | } | ||
| 187 | } | ||
| 188 | err: | ||
| 189 | if (ret == NULL) | ||
| 190 | PEMerr(PEM_F_PEM_READ_BIO_PARAMETERS,ERR_R_ASN1_LIB); | ||
| 191 | OPENSSL_free(nm); | ||
| 192 | OPENSSL_free(data); | ||
| 193 | return(ret); | ||
| 194 | } | ||
| 195 | |||
| 196 | int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x) | ||
| 197 | { | ||
| 198 | char pem_str[80]; | ||
| 199 | if (!x->ameth || !x->ameth->param_encode) | ||
| 200 | return 0; | ||
| 201 | |||
| 202 | BIO_snprintf(pem_str, 80, "%s PARAMETERS", x->ameth->pem_str); | ||
| 203 | return PEM_ASN1_write_bio( | ||
| 204 | (i2d_of_void *)x->ameth->param_encode, | ||
| 205 | pem_str,bp,x,NULL,NULL,0,0,NULL); | ||
| 206 | } | ||
| 207 | |||
| 133 | #ifndef OPENSSL_NO_FP_API | 208 | #ifndef OPENSSL_NO_FP_API |
| 134 | EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u) | 209 | EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u) |
| 135 | { | 210 | { |
| @@ -146,4 +221,22 @@ EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void | |||
| 146 | BIO_free(b); | 221 | BIO_free(b); |
| 147 | return(ret); | 222 | return(ret); |
| 148 | } | 223 | } |
| 224 | |||
| 225 | int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
| 226 | unsigned char *kstr, int klen, | ||
| 227 | pem_password_cb *cb, void *u) | ||
| 228 | { | ||
| 229 | BIO *b; | ||
| 230 | int ret; | ||
| 231 | |||
| 232 | if ((b=BIO_new_fp(fp, BIO_NOCLOSE)) == NULL) | ||
| 233 | { | ||
| 234 | PEMerr(PEM_F_PEM_WRITE_PRIVATEKEY,ERR_R_BUF_LIB); | ||
| 235 | return 0; | ||
| 236 | } | ||
| 237 | ret=PEM_write_bio_PrivateKey(b, x, enc, kstr, klen, cb, u); | ||
| 238 | BIO_free(b); | ||
| 239 | return ret; | ||
| 240 | } | ||
| 241 | |||
| 149 | #endif | 242 | #endif |
diff --git a/src/lib/libcrypto/pem/pem_seal.c b/src/lib/libcrypto/pem/pem_seal.c index 4e554e5481..59690b56ae 100644 --- a/src/lib/libcrypto/pem/pem_seal.c +++ b/src/lib/libcrypto/pem/pem_seal.c | |||
| @@ -100,7 +100,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, | |||
| 100 | 100 | ||
| 101 | EVP_CIPHER_CTX_init(&ctx->cipher); | 101 | EVP_CIPHER_CTX_init(&ctx->cipher); |
| 102 | ret=EVP_SealInit(&ctx->cipher,type,ek,ekl,iv,pubk,npubk); | 102 | ret=EVP_SealInit(&ctx->cipher,type,ek,ekl,iv,pubk,npubk); |
| 103 | if (!ret) goto err; | 103 | if (ret <= 0) goto err; |
| 104 | 104 | ||
| 105 | /* base64 encode the keys */ | 105 | /* base64 encode the keys */ |
| 106 | for (i=0; i<npubk; i++) | 106 | for (i=0; i<npubk; i++) |
diff --git a/src/lib/libcrypto/pem/pem_x509.c b/src/lib/libcrypto/pem/pem_x509.c index 3f709f13e6..b531057dc9 100644 --- a/src/lib/libcrypto/pem/pem_x509.c +++ b/src/lib/libcrypto/pem/pem_x509.c | |||
| @@ -57,7 +57,6 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #undef SSLEAY_MACROS | ||
| 61 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 62 | #include <openssl/bio.h> | 61 | #include <openssl/bio.h> |
| 63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
diff --git a/src/lib/libcrypto/pem/pem_xaux.c b/src/lib/libcrypto/pem/pem_xaux.c index 7cc7491009..328f796200 100644 --- a/src/lib/libcrypto/pem/pem_xaux.c +++ b/src/lib/libcrypto/pem/pem_xaux.c | |||
| @@ -57,7 +57,6 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #undef SSLEAY_MACROS | ||
| 61 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 62 | #include <openssl/bio.h> | 61 | #include <openssl/bio.h> |
| 63 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
diff --git a/src/lib/libcrypto/perlasm/alpha.pl b/src/lib/libcrypto/perlasm/alpha.pl deleted file mode 100644 index 3dac571743..0000000000 --- a/src/lib/libcrypto/perlasm/alpha.pl +++ /dev/null | |||
| @@ -1,434 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | package alpha; | ||
| 4 | use Carp qw(croak cluck); | ||
| 5 | |||
| 6 | $label="100"; | ||
| 7 | |||
| 8 | $n_debug=0; | ||
| 9 | $smear_regs=1; | ||
| 10 | $reg_alloc=1; | ||
| 11 | |||
| 12 | $align="3"; | ||
| 13 | $com_start="#"; | ||
| 14 | |||
| 15 | sub main'asm_init_output { @out=(); } | ||
| 16 | sub main'asm_get_output { return(@out); } | ||
| 17 | sub main'get_labels { return(@labels); } | ||
| 18 | sub main'external_label { push(@labels,@_); } | ||
| 19 | |||
| 20 | # General registers | ||
| 21 | |||
| 22 | %regs=( 'r0', '$0', | ||
| 23 | 'r1', '$1', | ||
| 24 | 'r2', '$2', | ||
| 25 | 'r3', '$3', | ||
| 26 | 'r4', '$4', | ||
| 27 | 'r5', '$5', | ||
| 28 | 'r6', '$6', | ||
| 29 | 'r7', '$7', | ||
| 30 | 'r8', '$8', | ||
| 31 | 'r9', '$22', | ||
| 32 | 'r10', '$23', | ||
| 33 | 'r11', '$24', | ||
| 34 | 'r12', '$25', | ||
| 35 | 'r13', '$27', | ||
| 36 | 'r14', '$28', | ||
| 37 | 'r15', '$21', # argc == 5 | ||
| 38 | 'r16', '$20', # argc == 4 | ||
| 39 | 'r17', '$19', # argc == 3 | ||
| 40 | 'r18', '$18', # argc == 2 | ||
| 41 | 'r19', '$17', # argc == 1 | ||
| 42 | 'r20', '$16', # argc == 0 | ||
| 43 | 'r21', '$9', # save 0 | ||
| 44 | 'r22', '$10', # save 1 | ||
| 45 | 'r23', '$11', # save 2 | ||
| 46 | 'r24', '$12', # save 3 | ||
| 47 | 'r25', '$13', # save 4 | ||
| 48 | 'r26', '$14', # save 5 | ||
| 49 | |||
| 50 | 'a0', '$16', | ||
| 51 | 'a1', '$17', | ||
| 52 | 'a2', '$18', | ||
| 53 | 'a3', '$19', | ||
| 54 | 'a4', '$20', | ||
| 55 | 'a5', '$21', | ||
| 56 | |||
| 57 | 's0', '$9', | ||
| 58 | 's1', '$10', | ||
| 59 | 's2', '$11', | ||
| 60 | 's3', '$12', | ||
| 61 | 's4', '$13', | ||
| 62 | 's5', '$14', | ||
| 63 | 'zero', '$31', | ||
| 64 | 'sp', '$30', | ||
| 65 | ); | ||
| 66 | |||
| 67 | $main'reg_s0="r21"; | ||
| 68 | $main'reg_s1="r22"; | ||
| 69 | $main'reg_s2="r23"; | ||
| 70 | $main'reg_s3="r24"; | ||
| 71 | $main'reg_s4="r25"; | ||
| 72 | $main'reg_s5="r26"; | ||
| 73 | |||
| 74 | @reg=( '$0', '$1' ,'$2' ,'$3' ,'$4' ,'$5' ,'$6' ,'$7' ,'$8', | ||
| 75 | '$22','$23','$24','$25','$20','$21','$27','$28'); | ||
| 76 | |||
| 77 | |||
| 78 | sub main'sub { &out3("subq",@_); } | ||
| 79 | sub main'add { &out3("addq",@_); } | ||
| 80 | sub main'mov { &out3("bis",$_[0],$_[0],$_[1]); } | ||
| 81 | sub main'or { &out3("bis",@_); } | ||
| 82 | sub main'bis { &out3("bis",@_); } | ||
| 83 | sub main'br { &out1("br",@_); } | ||
| 84 | sub main'ld { &out2("ldq",@_); } | ||
| 85 | sub main'st { &out2("stq",@_); } | ||
| 86 | sub main'cmpult { &out3("cmpult",@_); } | ||
| 87 | sub main'cmplt { &out3("cmplt",@_); } | ||
| 88 | sub main'bgt { &out2("bgt",@_); } | ||
| 89 | sub main'ble { &out2("ble",@_); } | ||
| 90 | sub main'blt { &out2("blt",@_); } | ||
| 91 | sub main'mul { &out3("mulq",@_); } | ||
| 92 | sub main'muh { &out3("umulh",@_); } | ||
| 93 | |||
| 94 | $main'QWS=8; | ||
| 95 | |||
| 96 | sub main'asm_add | ||
| 97 | { | ||
| 98 | push(@out,@_); | ||
| 99 | } | ||
| 100 | |||
| 101 | sub main'asm_finish | ||
| 102 | { | ||
| 103 | &main'file_end(); | ||
| 104 | print &main'asm_get_output(); | ||
| 105 | } | ||
| 106 | |||
| 107 | sub main'asm_init | ||
| 108 | { | ||
| 109 | ($type,$fn)=@_; | ||
| 110 | $filename=$fn; | ||
| 111 | |||
| 112 | &main'asm_init_output(); | ||
| 113 | &main'comment("Don't even think of reading this code"); | ||
| 114 | &main'comment("It was automatically generated by $filename"); | ||
| 115 | &main'comment("Which is a perl program used to generate the alpha assember."); | ||
| 116 | &main'comment("eric <eay\@cryptsoft.com>"); | ||
| 117 | &main'comment(""); | ||
| 118 | |||
| 119 | $filename =~ s/\.pl$//; | ||
| 120 | &main'file($filename); | ||
| 121 | } | ||
| 122 | |||
| 123 | sub conv | ||
| 124 | { | ||
| 125 | local($r)=@_; | ||
| 126 | local($v); | ||
| 127 | |||
| 128 | return($regs{$r}) if defined($regs{$r}); | ||
| 129 | return($r); | ||
| 130 | } | ||
| 131 | |||
| 132 | sub main'QWPw | ||
| 133 | { | ||
| 134 | local($off,$reg)=@_; | ||
| 135 | |||
| 136 | return(&main'QWP($off*8,$reg)); | ||
| 137 | } | ||
| 138 | |||
| 139 | sub main'QWP | ||
| 140 | { | ||
| 141 | local($off,$reg)=@_; | ||
| 142 | |||
| 143 | $ret="$off(".&conv($reg).")"; | ||
| 144 | return($ret); | ||
| 145 | } | ||
| 146 | |||
| 147 | sub out3 | ||
| 148 | { | ||
| 149 | local($name,$p1,$p2,$p3)=@_; | ||
| 150 | |||
| 151 | $p1=&conv($p1); | ||
| 152 | $p2=&conv($p2); | ||
| 153 | $p3=&conv($p3); | ||
| 154 | push(@out,"\t$name\t"); | ||
| 155 | $l=length($p1)+1; | ||
| 156 | push(@out,$p1.","); | ||
| 157 | $ll=3-($l+9)/8; | ||
| 158 | $tmp1=sprintf("\t" x $ll); | ||
| 159 | push(@out,$tmp1); | ||
| 160 | |||
| 161 | $l=length($p2)+1; | ||
| 162 | push(@out,$p2.","); | ||
| 163 | $ll=3-($l+9)/8; | ||
| 164 | $tmp1=sprintf("\t" x $ll); | ||
| 165 | push(@out,$tmp1); | ||
| 166 | |||
| 167 | push(@out,&conv($p3)."\n"); | ||
| 168 | } | ||
| 169 | |||
| 170 | sub out2 | ||
| 171 | { | ||
| 172 | local($name,$p1,$p2,$p3)=@_; | ||
| 173 | |||
| 174 | $p1=&conv($p1); | ||
| 175 | $p2=&conv($p2); | ||
| 176 | push(@out,"\t$name\t"); | ||
| 177 | $l=length($p1)+1; | ||
| 178 | push(@out,$p1.","); | ||
| 179 | $ll=3-($l+9)/8; | ||
| 180 | $tmp1=sprintf("\t" x $ll); | ||
| 181 | push(@out,$tmp1); | ||
| 182 | |||
| 183 | push(@out,&conv($p2)."\n"); | ||
| 184 | } | ||
| 185 | |||
| 186 | sub out1 | ||
| 187 | { | ||
| 188 | local($name,$p1)=@_; | ||
| 189 | |||
| 190 | $p1=&conv($p1); | ||
| 191 | push(@out,"\t$name\t".$p1."\n"); | ||
| 192 | } | ||
| 193 | |||
| 194 | sub out0 | ||
| 195 | { | ||
| 196 | push(@out,"\t$_[0]\n"); | ||
| 197 | } | ||
| 198 | |||
| 199 | sub main'file | ||
| 200 | { | ||
| 201 | local($file)=@_; | ||
| 202 | |||
| 203 | local($tmp)=<<"EOF"; | ||
| 204 | # DEC Alpha assember | ||
| 205 | # Generated from perl scripts contains in SSLeay | ||
| 206 | .file 1 "$file.s" | ||
| 207 | .set noat | ||
| 208 | EOF | ||
| 209 | push(@out,$tmp); | ||
| 210 | } | ||
| 211 | |||
| 212 | sub main'function_begin | ||
| 213 | { | ||
| 214 | local($func)=@_; | ||
| 215 | |||
| 216 | print STDERR "$func\n"; | ||
| 217 | local($tmp)=<<"EOF"; | ||
| 218 | .text | ||
| 219 | .align $align | ||
| 220 | .globl $func | ||
| 221 | .ent $func | ||
| 222 | ${func}: | ||
| 223 | ${func}..ng: | ||
| 224 | .frame \$30,0,\$26,0 | ||
| 225 | .prologue 0 | ||
| 226 | EOF | ||
| 227 | push(@out,$tmp); | ||
| 228 | $stack=0; | ||
| 229 | } | ||
| 230 | |||
| 231 | sub main'function_end | ||
| 232 | { | ||
| 233 | local($func)=@_; | ||
| 234 | |||
| 235 | local($tmp)=<<"EOF"; | ||
| 236 | ret \$31,(\$26),1 | ||
| 237 | .end $func | ||
| 238 | EOF | ||
| 239 | push(@out,$tmp); | ||
| 240 | $stack=0; | ||
| 241 | %label=(); | ||
| 242 | } | ||
| 243 | |||
| 244 | sub main'function_end_A | ||
| 245 | { | ||
| 246 | local($func)=@_; | ||
| 247 | |||
| 248 | local($tmp)=<<"EOF"; | ||
| 249 | ret \$31,(\$26),1 | ||
| 250 | EOF | ||
| 251 | push(@out,$tmp); | ||
| 252 | } | ||
| 253 | |||
| 254 | sub main'function_end_B | ||
| 255 | { | ||
| 256 | local($func)=@_; | ||
| 257 | |||
| 258 | $func=$under.$func; | ||
| 259 | |||
| 260 | push(@out,"\t.end $func\n"); | ||
| 261 | $stack=0; | ||
| 262 | %label=(); | ||
| 263 | } | ||
| 264 | |||
| 265 | sub main'wparam | ||
| 266 | { | ||
| 267 | local($num)=@_; | ||
| 268 | |||
| 269 | if ($num < 6) | ||
| 270 | { | ||
| 271 | $num=20-$num; | ||
| 272 | return("r$num"); | ||
| 273 | } | ||
| 274 | else | ||
| 275 | { return(&main'QWP($stack+$num*8,"sp")); } | ||
| 276 | } | ||
| 277 | |||
| 278 | sub main'stack_push | ||
| 279 | { | ||
| 280 | local($num)=@_; | ||
| 281 | $stack+=$num*8; | ||
| 282 | &main'sub("sp",$num*8,"sp"); | ||
| 283 | } | ||
| 284 | |||
| 285 | sub main'stack_pop | ||
| 286 | { | ||
| 287 | local($num)=@_; | ||
| 288 | $stack-=$num*8; | ||
| 289 | &main'add("sp",$num*8,"sp"); | ||
| 290 | } | ||
| 291 | |||
| 292 | sub main'swtmp | ||
| 293 | { | ||
| 294 | return(&main'QWP(($_[0])*8,"sp")); | ||
| 295 | } | ||
| 296 | |||
| 297 | # Should use swtmp, which is above sp. Linix can trash the stack above esp | ||
| 298 | #sub main'wtmp | ||
| 299 | # { | ||
| 300 | # local($num)=@_; | ||
| 301 | # | ||
| 302 | # return(&main'QWP(-($num+1)*4,"esp","",0)); | ||
| 303 | # } | ||
| 304 | |||
| 305 | sub main'comment | ||
| 306 | { | ||
| 307 | foreach (@_) | ||
| 308 | { | ||
| 309 | if (/^\s*$/) | ||
| 310 | { push(@out,"\n"); } | ||
| 311 | else | ||
| 312 | { push(@out,"\t$com_start $_ $com_end\n"); } | ||
| 313 | } | ||
| 314 | } | ||
| 315 | |||
| 316 | sub main'label | ||
| 317 | { | ||
| 318 | if (!defined($label{$_[0]})) | ||
| 319 | { | ||
| 320 | $label{$_[0]}=$label; | ||
| 321 | $label++; | ||
| 322 | } | ||
| 323 | return('$'.$label{$_[0]}); | ||
| 324 | } | ||
| 325 | |||
| 326 | sub main'set_label | ||
| 327 | { | ||
| 328 | if (!defined($label{$_[0]})) | ||
| 329 | { | ||
| 330 | $label{$_[0]}=$label; | ||
| 331 | $label++; | ||
| 332 | } | ||
| 333 | # push(@out,".align $align\n") if ($_[1] != 0); | ||
| 334 | push(@out,'$'."$label{$_[0]}:\n"); | ||
| 335 | } | ||
| 336 | |||
| 337 | sub main'file_end | ||
| 338 | { | ||
| 339 | } | ||
| 340 | |||
| 341 | sub main'data_word | ||
| 342 | { | ||
| 343 | push(@out,"\t.long $_[0]\n"); | ||
| 344 | } | ||
| 345 | |||
| 346 | @pool_free=(); | ||
| 347 | @pool_taken=(); | ||
| 348 | $curr_num=0; | ||
| 349 | $max=0; | ||
| 350 | |||
| 351 | sub main'init_pool | ||
| 352 | { | ||
| 353 | local($args)=@_; | ||
| 354 | local($i); | ||
| 355 | |||
| 356 | @pool_free=(); | ||
| 357 | for ($i=(14+(6-$args)); $i >= 0; $i--) | ||
| 358 | { | ||
| 359 | push(@pool_free,"r$i"); | ||
| 360 | } | ||
| 361 | print STDERR "START :register pool:@pool_free\n"; | ||
| 362 | $curr_num=$max=0; | ||
| 363 | } | ||
| 364 | |||
| 365 | sub main'fin_pool | ||
| 366 | { | ||
| 367 | printf STDERR "END %2d:register pool:@pool_free\n",$max; | ||
| 368 | } | ||
| 369 | |||
| 370 | sub main'GR | ||
| 371 | { | ||
| 372 | local($r)=@_; | ||
| 373 | local($i,@n,$_); | ||
| 374 | |||
| 375 | foreach (@pool_free) | ||
| 376 | { | ||
| 377 | if ($r ne $_) | ||
| 378 | { push(@n,$_); } | ||
| 379 | else | ||
| 380 | { | ||
| 381 | $curr_num++; | ||
| 382 | $max=$curr_num if ($curr_num > $max); | ||
| 383 | } | ||
| 384 | } | ||
| 385 | @pool_free=@n; | ||
| 386 | print STDERR "GR:@pool_free\n" if $reg_alloc; | ||
| 387 | return(@_); | ||
| 388 | } | ||
| 389 | |||
| 390 | sub main'NR | ||
| 391 | { | ||
| 392 | local($num)=@_; | ||
| 393 | local(@ret); | ||
| 394 | |||
| 395 | $num=1 if $num == 0; | ||
| 396 | ($#pool_free >= ($num-1)) || croak "out of registers: want $num, have @pool_free"; | ||
| 397 | while ($num > 0) | ||
| 398 | { | ||
| 399 | push(@ret,pop @pool_free); | ||
| 400 | $curr_num++; | ||
| 401 | $max=$curr_num if ($curr_num > $max); | ||
| 402 | $num-- | ||
| 403 | } | ||
| 404 | print STDERR "nr @ret\n" if $n_debug; | ||
| 405 | print STDERR "NR:@pool_free\n" if $reg_alloc; | ||
| 406 | return(@ret); | ||
| 407 | |||
| 408 | } | ||
| 409 | |||
| 410 | sub main'FR | ||
| 411 | { | ||
| 412 | local(@r)=@_; | ||
| 413 | local(@a,$v,$w); | ||
| 414 | |||
| 415 | print STDERR "fr @r\n" if $n_debug; | ||
| 416 | # cluck "fr @r"; | ||
| 417 | for $w (@pool_free) | ||
| 418 | { | ||
| 419 | foreach $v (@r) | ||
| 420 | { | ||
| 421 | croak "double register free of $v (@pool_free)" if $w eq $v; | ||
| 422 | } | ||
| 423 | } | ||
| 424 | foreach $v (@r) | ||
| 425 | { | ||
| 426 | croak "bad argument to FR" if ($v !~ /^r\d+$/); | ||
| 427 | if ($smear_regs) | ||
| 428 | { unshift(@pool_free,$v); } | ||
| 429 | else { push(@pool_free,$v); } | ||
| 430 | $curr_num--; | ||
| 431 | } | ||
| 432 | print STDERR "FR:@pool_free\n" if $reg_alloc; | ||
| 433 | } | ||
| 434 | 1; | ||
diff --git a/src/lib/libcrypto/perlasm/x86_64-xlate.pl b/src/lib/libcrypto/perlasm/x86_64-xlate.pl index 74153b017d..8153a92a7b 100755 --- a/src/lib/libcrypto/perlasm/x86_64-xlate.pl +++ b/src/lib/libcrypto/perlasm/x86_64-xlate.pl | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/usr/bin/env perl | 1 | #!/usr/bin/env perl |
| 2 | 2 | ||
| 3 | # Ascetic x86_64 AT&T to MASM assembler translator by <appro>. | 3 | # Ascetic x86_64 AT&T to MASM/NASM assembler translator by <appro>. |
| 4 | # | 4 | # |
| 5 | # Why AT&T to MASM and not vice versa? Several reasons. Because AT&T | 5 | # Why AT&T to MASM and not vice versa? Several reasons. Because AT&T |
| 6 | # format is way easier to parse. Because it's simpler to "gear" from | 6 | # format is way easier to parse. Because it's simpler to "gear" from |
| @@ -20,12 +20,11 @@ | |||
| 20 | # Currently recognized limitations: | 20 | # Currently recognized limitations: |
| 21 | # | 21 | # |
| 22 | # - can't use multiple ops per line; | 22 | # - can't use multiple ops per line; |
| 23 | # - indirect calls and jumps are not supported; | ||
| 24 | # | 23 | # |
| 25 | # Dual-ABI styling rules. | 24 | # Dual-ABI styling rules. |
| 26 | # | 25 | # |
| 27 | # 1. Adhere to Unix register and stack layout [see the end for | 26 | # 1. Adhere to Unix register and stack layout [see cross-reference |
| 28 | # explanation]. | 27 | # ABI "card" at the end for explanation]. |
| 29 | # 2. Forget about "red zone," stick to more traditional blended | 28 | # 2. Forget about "red zone," stick to more traditional blended |
| 30 | # stack frame allocation. If volatile storage is actually required | 29 | # stack frame allocation. If volatile storage is actually required |
| 31 | # that is. If not, just leave the stack as is. | 30 | # that is. If not, just leave the stack as is. |
| @@ -42,21 +41,26 @@ | |||
| 42 | # 6. Don't use [or hand-code with .byte] "rep ret." "ret" mnemonic is | 41 | # 6. Don't use [or hand-code with .byte] "rep ret." "ret" mnemonic is |
| 43 | # required to identify the spots, where to inject Win64 epilogue! | 42 | # required to identify the spots, where to inject Win64 epilogue! |
| 44 | # But on the pros, it's then prefixed with rep automatically:-) | 43 | # But on the pros, it's then prefixed with rep automatically:-) |
| 45 | # 7. Due to MASM limitations [and certain general counter-intuitivity | 44 | # 7. Stick to explicit ip-relative addressing. If you have to use |
| 46 | # of ip-relative addressing] generation of position-independent | 45 | # GOTPCREL addressing, stick to mov symbol@GOTPCREL(%rip),%r??. |
| 47 | # code is assisted by synthetic directive, .picmeup, which puts | 46 | # Both are recognized and translated to proper Win64 addressing |
| 48 | # address of the *next* instruction into target register. | 47 | # modes. To support legacy code a synthetic directive, .picmeup, |
| 48 | # is implemented. It puts address of the *next* instruction into | ||
| 49 | # target register, e.g.: | ||
| 49 | # | 50 | # |
| 50 | # Example 1: | ||
| 51 | # .picmeup %rax | 51 | # .picmeup %rax |
| 52 | # lea .Label-.(%rax),%rax | 52 | # lea .Label-.(%rax),%rax |
| 53 | # Example 2: | 53 | # |
| 54 | # .picmeup %rcx | 54 | # 8. In order to provide for structured exception handling unified |
| 55 | # .Lpic_point: | 55 | # Win64 prologue copies %rsp value to %rax. For further details |
| 56 | # ... | 56 | # see SEH paragraph at the end. |
| 57 | # lea .Label-.Lpic_point(%rcx),%rbp | 57 | # 9. .init segment is allowed to contain calls to functions only. |
| 58 | 58 | # a. If function accepts more than 4 arguments *and* >4th argument | |
| 59 | my $output = shift; | 59 | # is declared as non 64-bit value, do clear its upper part. |
| 60 | |||
| 61 | my $flavour = shift; | ||
| 62 | my $output = shift; | ||
| 63 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | ||
| 60 | 64 | ||
| 61 | { my ($stddev,$stdino,@junk)=stat(STDOUT); | 65 | { my ($stddev,$stdino,@junk)=stat(STDOUT); |
| 62 | my ($outdev,$outino,@junk)=stat($output); | 66 | my ($outdev,$outino,@junk)=stat($output); |
| @@ -65,13 +69,40 @@ my $output = shift; | |||
| 65 | if ($stddev!=$outdev || $stdino!=$outino); | 69 | if ($stddev!=$outdev || $stdino!=$outino); |
| 66 | } | 70 | } |
| 67 | 71 | ||
| 72 | my $gas=1; $gas=0 if ($output =~ /\.asm$/); | ||
| 73 | my $elf=1; $elf=0 if (!$gas); | ||
| 74 | my $win64=0; | ||
| 75 | my $prefix=""; | ||
| 76 | my $decor=".L"; | ||
| 77 | |||
| 68 | my $masmref=8 + 50727*2**-32; # 8.00.50727 shipped with VS2005 | 78 | my $masmref=8 + 50727*2**-32; # 8.00.50727 shipped with VS2005 |
| 69 | my $masm=$masmref if ($output =~ /\.asm/); | 79 | my $masm=0; |
| 70 | if ($masm && `ml64 2>&1` =~ m/Version ([0-9]+)\.([0-9]+)(\.([0-9]+))?/) | 80 | my $PTR=" PTR"; |
| 71 | { $masm=$1 + $2*2**-16 + $4*2**-32; } | 81 | |
| 82 | my $nasmref=2.03; | ||
| 83 | my $nasm=0; | ||
| 84 | |||
| 85 | if ($flavour eq "mingw64") { $gas=1; $elf=0; $win64=1; | ||
| 86 | $prefix=`echo __USER_LABEL_PREFIX__ | $ENV{CC} -E -P -`; | ||
| 87 | chomp($prefix); | ||
| 88 | } | ||
| 89 | elsif ($flavour eq "macosx") { $gas=1; $elf=0; $prefix="_"; $decor="L\$"; } | ||
| 90 | elsif ($flavour eq "masm") { $gas=0; $elf=0; $masm=$masmref; $win64=1; $decor="\$L\$"; } | ||
| 91 | elsif ($flavour eq "nasm") { $gas=0; $elf=0; $nasm=$nasmref; $win64=1; $decor="\$L\$"; $PTR=""; } | ||
| 92 | elsif (!$gas) | ||
| 93 | { if ($ENV{ASM} =~ m/nasm/ && `nasm -v` =~ m/version ([0-9]+)\.([0-9]+)/i) | ||
| 94 | { $nasm = $1 + $2*0.01; $PTR=""; } | ||
| 95 | elsif (`ml64 2>&1` =~ m/Version ([0-9]+)\.([0-9]+)(\.([0-9]+))?/) | ||
| 96 | { $masm = $1 + $2*2**-16 + $4*2**-32; } | ||
| 97 | die "no assembler found on %PATH" if (!($nasm || $masm)); | ||
| 98 | $win64=1; | ||
| 99 | $elf=0; | ||
| 100 | $decor="\$L\$"; | ||
| 101 | } | ||
| 72 | 102 | ||
| 73 | my $current_segment; | 103 | my $current_segment; |
| 74 | my $current_function; | 104 | my $current_function; |
| 105 | my %globals; | ||
| 75 | 106 | ||
| 76 | { package opcode; # pick up opcodes | 107 | { package opcode; # pick up opcodes |
| 77 | sub re { | 108 | sub re { |
| @@ -88,8 +119,10 @@ my $current_function; | |||
| 88 | if ($self->{op} =~ /^(movz)b.*/) { # movz is pain... | 119 | if ($self->{op} =~ /^(movz)b.*/) { # movz is pain... |
| 89 | $self->{op} = $1; | 120 | $self->{op} = $1; |
| 90 | $self->{sz} = "b"; | 121 | $self->{sz} = "b"; |
| 91 | } elsif ($self->{op} =~ /call/) { | 122 | } elsif ($self->{op} =~ /call|jmp/) { |
| 92 | $self->{sz} = "" | 123 | $self->{sz} = ""; |
| 124 | } elsif ($self->{op} =~ /^p/ && $' !~ /^(ush|op)/) { # SSEn | ||
| 125 | $self->{sz} = ""; | ||
| 93 | } elsif ($self->{op} =~ /([a-z]{3,})([qlwb])$/) { | 126 | } elsif ($self->{op} =~ /([a-z]{3,})([qlwb])$/) { |
| 94 | $self->{op} = $1; | 127 | $self->{op} = $1; |
| 95 | $self->{sz} = $2; | 128 | $self->{sz} = $2; |
| @@ -105,13 +138,20 @@ my $current_function; | |||
| 105 | } | 138 | } |
| 106 | sub out { | 139 | sub out { |
| 107 | my $self = shift; | 140 | my $self = shift; |
| 108 | if (!$masm) { | 141 | if ($gas) { |
| 109 | if ($self->{op} eq "movz") { # movz is pain... | 142 | if ($self->{op} eq "movz") { # movz is pain... |
| 110 | sprintf "%s%s%s",$self->{op},$self->{sz},shift; | 143 | sprintf "%s%s%s",$self->{op},$self->{sz},shift; |
| 111 | } elsif ($self->{op} =~ /^set/) { | 144 | } elsif ($self->{op} =~ /^set/) { |
| 112 | "$self->{op}"; | 145 | "$self->{op}"; |
| 113 | } elsif ($self->{op} eq "ret") { | 146 | } elsif ($self->{op} eq "ret") { |
| 114 | ".byte 0xf3,0xc3"; | 147 | my $epilogue = ""; |
| 148 | if ($win64 && $current_function->{abi} eq "svr4") { | ||
| 149 | $epilogue = "movq 8(%rsp),%rdi\n\t" . | ||
| 150 | "movq 16(%rsp),%rsi\n\t"; | ||
| 151 | } | ||
| 152 | $epilogue . ".byte 0xf3,0xc3"; | ||
| 153 | } elsif ($self->{op} eq "call" && !$elf && $current_segment eq ".init") { | ||
| 154 | ".p2align\t3\n\t.quad"; | ||
| 115 | } else { | 155 | } else { |
| 116 | "$self->{op}$self->{sz}"; | 156 | "$self->{op}$self->{sz}"; |
| 117 | } | 157 | } |
| @@ -119,15 +159,25 @@ my $current_function; | |||
| 119 | $self->{op} =~ s/^movz/movzx/; | 159 | $self->{op} =~ s/^movz/movzx/; |
| 120 | if ($self->{op} eq "ret") { | 160 | if ($self->{op} eq "ret") { |
| 121 | $self->{op} = ""; | 161 | $self->{op} = ""; |
| 122 | if ($current_function->{abi} eq "svr4") { | 162 | if ($win64 && $current_function->{abi} eq "svr4") { |
| 123 | $self->{op} = "mov rdi,QWORD PTR 8[rsp]\t;WIN64 epilogue\n\t". | 163 | $self->{op} = "mov rdi,QWORD${PTR}[8+rsp]\t;WIN64 epilogue\n\t". |
| 124 | "mov rsi,QWORD PTR 16[rsp]\n\t"; | 164 | "mov rsi,QWORD${PTR}[16+rsp]\n\t"; |
| 125 | } | 165 | } |
| 126 | $self->{op} .= "DB\t0F3h,0C3h\t\t;repret"; | 166 | $self->{op} .= "DB\t0F3h,0C3h\t\t;repret"; |
| 127 | } | 167 | } elsif ($self->{op} =~ /^(pop|push)f/) { |
| 168 | $self->{op} .= $self->{sz}; | ||
| 169 | } elsif ($self->{op} eq "call" && $current_segment eq ".CRT\$XCU") { | ||
| 170 | $self->{op} = "ALIGN\t8\n\tDQ"; | ||
| 171 | } | ||
| 128 | $self->{op}; | 172 | $self->{op}; |
| 129 | } | 173 | } |
| 130 | } | 174 | } |
| 175 | sub mnemonic { | ||
| 176 | my $self=shift; | ||
| 177 | my $op=shift; | ||
| 178 | $self->{op}=$op if (defined($op)); | ||
| 179 | $self->{op}; | ||
| 180 | } | ||
| 131 | } | 181 | } |
| 132 | { package const; # pick up constants, which start with $ | 182 | { package const; # pick up constants, which start with $ |
| 133 | sub re { | 183 | sub re { |
| @@ -145,14 +195,15 @@ my $current_function; | |||
| 145 | sub out { | 195 | sub out { |
| 146 | my $self = shift; | 196 | my $self = shift; |
| 147 | 197 | ||
| 148 | if (!$masm) { | 198 | if ($gas) { |
| 149 | # Solaris /usr/ccs/bin/as can't handle multiplications | 199 | # Solaris /usr/ccs/bin/as can't handle multiplications |
| 150 | # in $self->{value} | 200 | # in $self->{value} |
| 151 | $self->{value} =~ s/(?<![0-9a-f])(0[x0-9a-f]+)/oct($1)/egi; | 201 | $self->{value} =~ s/(?<![\w\$\.])(0x?[0-9a-f]+)/oct($1)/egi; |
| 152 | $self->{value} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg; | 202 | $self->{value} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg; |
| 153 | sprintf "\$%s",$self->{value}; | 203 | sprintf "\$%s",$self->{value}; |
| 154 | } else { | 204 | } else { |
| 155 | $self->{value} =~ s/0x([0-9a-f]+)/0$1h/ig; | 205 | $self->{value} =~ s/(0b[0-1]+)/oct($1)/eig; |
| 206 | $self->{value} =~ s/0x([0-9a-f]+)/0$1h/ig if ($masm); | ||
| 156 | sprintf "%s",$self->{value}; | 207 | sprintf "%s",$self->{value}; |
| 157 | } | 208 | } |
| 158 | } | 209 | } |
| @@ -163,14 +214,20 @@ my $current_function; | |||
| 163 | local *line = shift; | 214 | local *line = shift; |
| 164 | undef $ret; | 215 | undef $ret; |
| 165 | 216 | ||
| 166 | if ($line =~ /^([^\(,]*)\(([%\w,]+)\)/ && | 217 | # optional * ---vvv--- appears in indirect jmp/call |
| 218 | if ($line =~ /^(\*?)([^\(,]*)\(([%\w,]+)\)/ && | ||
| 167 | !($line =~ /^PIC_(GOT|PLT)/)) { | 219 | !($line =~ /^PIC_(GOT|PLT)/)) { |
| 168 | $self->{label} = $1; | 220 | $self->{asterisk} = $1; |
| 169 | ($self->{base},$self->{index},$self->{scale})=split(/,/,$2); | 221 | $self->{label} = $2; |
| 222 | ($self->{base},$self->{index},$self->{scale})=split(/,/,$3); | ||
| 170 | $self->{scale} = 1 if (!defined($self->{scale})); | 223 | $self->{scale} = 1 if (!defined($self->{scale})); |
| 171 | $ret = $self; | 224 | $ret = $self; |
| 172 | $line = substr($line,@+[0]); $line =~ s/^\s+//; | 225 | $line = substr($line,@+[0]); $line =~ s/^\s+//; |
| 173 | 226 | ||
| 227 | if ($win64 && $self->{label} =~ s/\@GOTPCREL//) { | ||
| 228 | die if (opcode->mnemonic() ne "mov"); | ||
| 229 | opcode->mnemonic("lea"); | ||
| 230 | } | ||
| 174 | $self->{base} =~ s/^%//; | 231 | $self->{base} =~ s/^%//; |
| 175 | $self->{index} =~ s/^%// if (defined($self->{index})); | 232 | $self->{index} =~ s/^%// if (defined($self->{index})); |
| 176 | } | 233 | } |
| @@ -181,42 +238,50 @@ my $current_function; | |||
| 181 | my $self = shift; | 238 | my $self = shift; |
| 182 | my $sz = shift; | 239 | my $sz = shift; |
| 183 | 240 | ||
| 241 | $self->{label} =~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei; | ||
| 242 | $self->{label} =~ s/\.L/$decor/g; | ||
| 243 | |||
| 184 | # Silently convert all EAs to 64-bit. This is required for | 244 | # Silently convert all EAs to 64-bit. This is required for |
| 185 | # elder GNU assembler and results in more compact code, | 245 | # elder GNU assembler and results in more compact code, |
| 186 | # *but* most importantly AES module depends on this feature! | 246 | # *but* most importantly AES module depends on this feature! |
| 187 | $self->{index} =~ s/^[er](.?[0-9xpi])[d]?$/r\1/; | 247 | $self->{index} =~ s/^[er](.?[0-9xpi])[d]?$/r\1/; |
| 188 | $self->{base} =~ s/^[er](.?[0-9xpi])[d]?$/r\1/; | 248 | $self->{base} =~ s/^[er](.?[0-9xpi])[d]?$/r\1/; |
| 189 | 249 | ||
| 190 | if (!$masm) { | 250 | if ($gas) { |
| 191 | # Solaris /usr/ccs/bin/as can't handle multiplications | 251 | # Solaris /usr/ccs/bin/as can't handle multiplications |
| 192 | # in $self->{label} | 252 | # in $self->{label}, new gas requires sign extension... |
| 193 | $self->{label} =~ s/(?<![0-9a-f])(0[x0-9a-f]+)/oct($1)/egi; | 253 | use integer; |
| 254 | $self->{label} =~ s/(?<![\w\$\.])(0x?[0-9a-f]+)/oct($1)/egi; | ||
| 194 | $self->{label} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg; | 255 | $self->{label} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg; |
| 256 | $self->{label} =~ s/([0-9]+)/$1<<32>>32/eg; | ||
| 257 | $self->{label} =~ s/^___imp_/__imp__/ if ($flavour eq "mingw64"); | ||
| 195 | 258 | ||
| 196 | if (defined($self->{index})) { | 259 | if (defined($self->{index})) { |
| 197 | sprintf "%s(%%%s,%%%s,%d)", | 260 | sprintf "%s%s(%%%s,%%%s,%d)",$self->{asterisk}, |
| 198 | $self->{label},$self->{base}, | 261 | $self->{label},$self->{base}, |
| 199 | $self->{index},$self->{scale}; | 262 | $self->{index},$self->{scale}; |
| 200 | } else { | 263 | } else { |
| 201 | sprintf "%s(%%%s)", $self->{label},$self->{base}; | 264 | sprintf "%s%s(%%%s)", $self->{asterisk},$self->{label},$self->{base}; |
| 202 | } | 265 | } |
| 203 | } else { | 266 | } else { |
| 204 | %szmap = ( b=>"BYTE", w=>"WORD", l=>"DWORD", q=>"QWORD" ); | 267 | %szmap = ( b=>"BYTE$PTR", w=>"WORD$PTR", l=>"DWORD$PTR", q=>"QWORD$PTR" ); |
| 205 | 268 | ||
| 206 | $self->{label} =~ s/\./\$/g; | 269 | $self->{label} =~ s/\./\$/g; |
| 207 | $self->{label} =~ s/0x([0-9a-f]+)/0$1h/ig; | 270 | $self->{label} =~ s/(?<![\w\$\.])0x([0-9a-f]+)/0$1h/ig; |
| 208 | $self->{label} = "($self->{label})" if ($self->{label} =~ /[\*\+\-\/]/); | 271 | $self->{label} = "($self->{label})" if ($self->{label} =~ /[\*\+\-\/]/); |
| 272 | $sz="q" if ($self->{asterisk}); | ||
| 209 | 273 | ||
| 210 | if (defined($self->{index})) { | 274 | if (defined($self->{index})) { |
| 211 | sprintf "%s PTR %s[%s*%d+%s]",$szmap{$sz}, | 275 | sprintf "%s[%s%s*%d+%s]",$szmap{$sz}, |
| 212 | $self->{label}, | 276 | $self->{label}?"$self->{label}+":"", |
| 213 | $self->{index},$self->{scale}, | 277 | $self->{index},$self->{scale}, |
| 214 | $self->{base}; | 278 | $self->{base}; |
| 215 | } elsif ($self->{base} eq "rip") { | 279 | } elsif ($self->{base} eq "rip") { |
| 216 | sprintf "%s PTR %s",$szmap{$sz},$self->{label}; | 280 | sprintf "%s[%s]",$szmap{$sz},$self->{label}; |
| 217 | } else { | 281 | } else { |
| 218 | sprintf "%s PTR %s[%s]",$szmap{$sz}, | 282 | sprintf "%s[%s%s]",$szmap{$sz}, |
| 219 | $self->{label},$self->{base}; | 283 | $self->{label}?"$self->{label}+":"", |
| 284 | $self->{base}; | ||
| 220 | } | 285 | } |
| 221 | } | 286 | } |
| 222 | } | 287 | } |
| @@ -228,9 +293,11 @@ my $current_function; | |||
| 228 | local *line = shift; | 293 | local *line = shift; |
| 229 | undef $ret; | 294 | undef $ret; |
| 230 | 295 | ||
| 231 | if ($line =~ /^%(\w+)/) { | 296 | # optional * ---vvv--- appears in indirect jmp/call |
| 297 | if ($line =~ /^(\*?)%(\w+)/) { | ||
| 232 | bless $self,$class; | 298 | bless $self,$class; |
| 233 | $self->{value} = $1; | 299 | $self->{asterisk} = $1; |
| 300 | $self->{value} = $2; | ||
| 234 | $ret = $self; | 301 | $ret = $self; |
| 235 | $line = substr($line,@+[0]); $line =~ s/^\s+//; | 302 | $line = substr($line,@+[0]); $line =~ s/^\s+//; |
| 236 | } | 303 | } |
| @@ -253,7 +320,8 @@ my $current_function; | |||
| 253 | } | 320 | } |
| 254 | sub out { | 321 | sub out { |
| 255 | my $self = shift; | 322 | my $self = shift; |
| 256 | sprintf $masm?"%s":"%%%s",$self->{value}; | 323 | if ($gas) { sprintf "%s%%%s",$self->{asterisk},$self->{value}; } |
| 324 | else { $self->{value}; } | ||
| 257 | } | 325 | } |
| 258 | } | 326 | } |
| 259 | { package label; # pick up labels, which end with : | 327 | { package label; # pick up labels, which end with : |
| @@ -262,37 +330,63 @@ my $current_function; | |||
| 262 | local *line = shift; | 330 | local *line = shift; |
| 263 | undef $ret; | 331 | undef $ret; |
| 264 | 332 | ||
| 265 | if ($line =~ /(^[\.\w]+\:)/) { | 333 | if ($line =~ /(^[\.\w]+)\:/) { |
| 266 | $self->{value} = $1; | 334 | $self->{value} = $1; |
| 267 | $ret = $self; | 335 | $ret = $self; |
| 268 | $line = substr($line,@+[0]); $line =~ s/^\s+//; | 336 | $line = substr($line,@+[0]); $line =~ s/^\s+//; |
| 269 | 337 | ||
| 270 | $self->{value} =~ s/\.L/\$L/ if ($masm); | 338 | $self->{value} =~ s/^\.L/$decor/; |
| 271 | } | 339 | } |
| 272 | $ret; | 340 | $ret; |
| 273 | } | 341 | } |
| 274 | sub out { | 342 | sub out { |
| 275 | my $self = shift; | 343 | my $self = shift; |
| 276 | 344 | ||
| 277 | if (!$masm) { | 345 | if ($gas) { |
| 278 | $self->{value}; | 346 | my $func = ($globals{$self->{value}} or $self->{value}) . ":"; |
| 279 | } elsif ($self->{value} ne "$current_function->{name}:") { | 347 | if ($win64 && |
| 280 | $self->{value}; | 348 | $current_function->{name} eq $self->{value} && |
| 281 | } elsif ($current_function->{abi} eq "svr4") { | 349 | $current_function->{abi} eq "svr4") { |
| 282 | my $func = "$current_function->{name} PROC\n". | 350 | $func .= "\n"; |
| 283 | " mov QWORD PTR 8[rsp],rdi\t;WIN64 prologue\n". | 351 | $func .= " movq %rdi,8(%rsp)\n"; |
| 284 | " mov QWORD PTR 16[rsp],rsi\n"; | 352 | $func .= " movq %rsi,16(%rsp)\n"; |
| 353 | $func .= " movq %rsp,%rax\n"; | ||
| 354 | $func .= "${decor}SEH_begin_$current_function->{name}:\n"; | ||
| 355 | my $narg = $current_function->{narg}; | ||
| 356 | $narg=6 if (!defined($narg)); | ||
| 357 | $func .= " movq %rcx,%rdi\n" if ($narg>0); | ||
| 358 | $func .= " movq %rdx,%rsi\n" if ($narg>1); | ||
| 359 | $func .= " movq %r8,%rdx\n" if ($narg>2); | ||
| 360 | $func .= " movq %r9,%rcx\n" if ($narg>3); | ||
| 361 | $func .= " movq 40(%rsp),%r8\n" if ($narg>4); | ||
| 362 | $func .= " movq 48(%rsp),%r9\n" if ($narg>5); | ||
| 363 | } | ||
| 364 | $func; | ||
| 365 | } elsif ($self->{value} ne "$current_function->{name}") { | ||
| 366 | $self->{value} .= ":" if ($masm && $ret!~m/^\$/); | ||
| 367 | $self->{value} . ":"; | ||
| 368 | } elsif ($win64 && $current_function->{abi} eq "svr4") { | ||
| 369 | my $func = "$current_function->{name}" . | ||
| 370 | ($nasm ? ":" : "\tPROC $current_function->{scope}") . | ||
| 371 | "\n"; | ||
| 372 | $func .= " mov QWORD${PTR}[8+rsp],rdi\t;WIN64 prologue\n"; | ||
| 373 | $func .= " mov QWORD${PTR}[16+rsp],rsi\n"; | ||
| 374 | $func .= " mov rax,rsp\n"; | ||
| 375 | $func .= "${decor}SEH_begin_$current_function->{name}:"; | ||
| 376 | $func .= ":" if ($masm); | ||
| 377 | $func .= "\n"; | ||
| 285 | my $narg = $current_function->{narg}; | 378 | my $narg = $current_function->{narg}; |
| 286 | $narg=6 if (!defined($narg)); | 379 | $narg=6 if (!defined($narg)); |
| 287 | $func .= " mov rdi,rcx\n" if ($narg>0); | 380 | $func .= " mov rdi,rcx\n" if ($narg>0); |
| 288 | $func .= " mov rsi,rdx\n" if ($narg>1); | 381 | $func .= " mov rsi,rdx\n" if ($narg>1); |
| 289 | $func .= " mov rdx,r8\n" if ($narg>2); | 382 | $func .= " mov rdx,r8\n" if ($narg>2); |
| 290 | $func .= " mov rcx,r9\n" if ($narg>3); | 383 | $func .= " mov rcx,r9\n" if ($narg>3); |
| 291 | $func .= " mov r8,QWORD PTR 40[rsp]\n" if ($narg>4); | 384 | $func .= " mov r8,QWORD${PTR}[40+rsp]\n" if ($narg>4); |
| 292 | $func .= " mov r9,QWORD PTR 48[rsp]\n" if ($narg>5); | 385 | $func .= " mov r9,QWORD${PTR}[48+rsp]\n" if ($narg>5); |
| 293 | $func .= "\n"; | 386 | $func .= "\n"; |
| 294 | } else { | 387 | } else { |
| 295 | "$current_function->{name} PROC"; | 388 | "$current_function->{name}". |
| 389 | ($nasm ? ":" : "\tPROC $current_function->{scope}"); | ||
| 296 | } | 390 | } |
| 297 | } | 391 | } |
| 298 | } | 392 | } |
| @@ -307,13 +401,19 @@ my $current_function; | |||
| 307 | $ret = $self; | 401 | $ret = $self; |
| 308 | $line = substr($line,@+[0]); $line =~ s/^\s+//; | 402 | $line = substr($line,@+[0]); $line =~ s/^\s+//; |
| 309 | 403 | ||
| 310 | $self->{value} =~ s/\.L/\$L/g if ($masm); | 404 | $self->{value} =~ s/\@PLT// if (!$elf); |
| 405 | $self->{value} =~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei; | ||
| 406 | $self->{value} =~ s/\.L/$decor/g; | ||
| 311 | } | 407 | } |
| 312 | $ret; | 408 | $ret; |
| 313 | } | 409 | } |
| 314 | sub out { | 410 | sub out { |
| 315 | my $self = shift; | 411 | my $self = shift; |
| 316 | $self->{value}; | 412 | if ($nasm && opcode->mnemonic()=~m/^j/) { |
| 413 | "NEAR ".$self->{value}; | ||
| 414 | } else { | ||
| 415 | $self->{value}; | ||
| 416 | } | ||
| 317 | } | 417 | } |
| 318 | } | 418 | } |
| 319 | { package directive; # pick up directives, which start with . | 419 | { package directive; # pick up directives, which start with . |
| @@ -333,89 +433,181 @@ my $current_function; | |||
| 333 | "%r14"=>0x01358d4c, "%r15"=>0x013d8d4c ); | 433 | "%r14"=>0x01358d4c, "%r15"=>0x013d8d4c ); |
| 334 | 434 | ||
| 335 | if ($line =~ /^\s*(\.\w+)/) { | 435 | if ($line =~ /^\s*(\.\w+)/) { |
| 336 | if (!$masm) { | ||
| 337 | $self->{value} = $1; | ||
| 338 | $line =~ s/\@abi\-omnipotent/\@function/; | ||
| 339 | $line =~ s/\@function.*/\@function/; | ||
| 340 | if ($line =~ /\.picmeup\s+(%r[\w]+)/i) { | ||
| 341 | $self->{value} = sprintf "\t.long\t0x%x,0x90000000",$opcode{$1}; | ||
| 342 | } elsif ($line =~ /\.asciz\s+"(.*)"$/) { | ||
| 343 | $self->{value} = ".byte\t".join(",",unpack("C*",$1),0); | ||
| 344 | } elsif ($line =~ /\.extern/) { | ||
| 345 | $self->{value} = ""; # swallow extern | ||
| 346 | } else { | ||
| 347 | $self->{value} = $line; | ||
| 348 | } | ||
| 349 | $line = ""; | ||
| 350 | return $self; | ||
| 351 | } | ||
| 352 | |||
| 353 | $dir = $1; | 436 | $dir = $1; |
| 354 | $ret = $self; | 437 | $ret = $self; |
| 355 | undef $self->{value}; | 438 | undef $self->{value}; |
| 356 | $line = substr($line,@+[0]); $line =~ s/^\s+//; | 439 | $line = substr($line,@+[0]); $line =~ s/^\s+//; |
| 440 | |||
| 357 | SWITCH: for ($dir) { | 441 | SWITCH: for ($dir) { |
| 358 | /\.(text)/ | 442 | /\.picmeup/ && do { if ($line =~ /(%r[\w]+)/i) { |
| 359 | && do { my $v=undef; | 443 | $dir="\t.long"; |
| 360 | $v="$current_segment\tENDS\n" if ($current_segment); | 444 | $line=sprintf "0x%x,0x90000000",$opcode{$1}; |
| 361 | $current_segment = "_$1\$"; | 445 | } |
| 362 | $current_segment =~ tr/[a-z]/[A-Z]/; | 446 | last; |
| 363 | $v.="$current_segment\tSEGMENT "; | 447 | }; |
| 364 | $v.=$masm>=$masmref ? "ALIGN(64)" : "PAGE"; | 448 | /\.global|\.globl|\.extern/ |
| 365 | $v.=" 'CODE'"; | 449 | && do { $globals{$line} = $prefix . $line; |
| 366 | $self->{value} = $v; | 450 | $line = $globals{$line} if ($prefix); |
| 367 | last; | 451 | last; |
| 368 | }; | 452 | }; |
| 369 | /\.extern/ && do { $self->{value} = "EXTRN\t".$line.":BYTE"; last; }; | ||
| 370 | /\.globl/ && do { $self->{value} = "PUBLIC\t".$line; last; }; | ||
| 371 | /\.type/ && do { ($sym,$type,$narg) = split(',',$line); | 453 | /\.type/ && do { ($sym,$type,$narg) = split(',',$line); |
| 372 | if ($type eq "\@function") { | 454 | if ($type eq "\@function") { |
| 373 | undef $current_function; | 455 | undef $current_function; |
| 374 | $current_function->{name} = $sym; | 456 | $current_function->{name} = $sym; |
| 375 | $current_function->{abi} = "svr4"; | 457 | $current_function->{abi} = "svr4"; |
| 376 | $current_function->{narg} = $narg; | 458 | $current_function->{narg} = $narg; |
| 459 | $current_function->{scope} = defined($globals{$sym})?"PUBLIC":"PRIVATE"; | ||
| 377 | } elsif ($type eq "\@abi-omnipotent") { | 460 | } elsif ($type eq "\@abi-omnipotent") { |
| 378 | undef $current_function; | 461 | undef $current_function; |
| 379 | $current_function->{name} = $sym; | 462 | $current_function->{name} = $sym; |
| 463 | $current_function->{scope} = defined($globals{$sym})?"PUBLIC":"PRIVATE"; | ||
| 464 | } | ||
| 465 | $line =~ s/\@abi\-omnipotent/\@function/; | ||
| 466 | $line =~ s/\@function.*/\@function/; | ||
| 467 | last; | ||
| 468 | }; | ||
| 469 | /\.asciz/ && do { if ($line =~ /^"(.*)"$/) { | ||
| 470 | $dir = ".byte"; | ||
| 471 | $line = join(",",unpack("C*",$1),0); | ||
| 380 | } | 472 | } |
| 381 | last; | 473 | last; |
| 382 | }; | 474 | }; |
| 475 | /\.rva|\.long|\.quad/ | ||
| 476 | && do { $line =~ s/([_a-z][_a-z0-9]*)/$globals{$1} or $1/gei; | ||
| 477 | $line =~ s/\.L/$decor/g; | ||
| 478 | last; | ||
| 479 | }; | ||
| 480 | } | ||
| 481 | |||
| 482 | if ($gas) { | ||
| 483 | $self->{value} = $dir . "\t" . $line; | ||
| 484 | |||
| 485 | if ($dir =~ /\.extern/) { | ||
| 486 | $self->{value} = ""; # swallow extern | ||
| 487 | } elsif (!$elf && $dir =~ /\.type/) { | ||
| 488 | $self->{value} = ""; | ||
| 489 | $self->{value} = ".def\t" . ($globals{$1} or $1) . ";\t" . | ||
| 490 | (defined($globals{$1})?".scl 2;":".scl 3;") . | ||
| 491 | "\t.type 32;\t.endef" | ||
| 492 | if ($win64 && $line =~ /([^,]+),\@function/); | ||
| 493 | } elsif (!$elf && $dir =~ /\.size/) { | ||
| 494 | $self->{value} = ""; | ||
| 495 | if (defined($current_function)) { | ||
| 496 | $self->{value} .= "${decor}SEH_end_$current_function->{name}:" | ||
| 497 | if ($win64 && $current_function->{abi} eq "svr4"); | ||
| 498 | undef $current_function; | ||
| 499 | } | ||
| 500 | } elsif (!$elf && $dir =~ /\.align/) { | ||
| 501 | $self->{value} = ".p2align\t" . (log($line)/log(2)); | ||
| 502 | } elsif ($dir eq ".section") { | ||
| 503 | $current_segment=$line; | ||
| 504 | if (!$elf && $current_segment eq ".init") { | ||
| 505 | if ($flavour eq "macosx") { $self->{value} = ".mod_init_func"; } | ||
| 506 | elsif ($flavour eq "mingw64") { $self->{value} = ".section\t.ctors"; } | ||
| 507 | } | ||
| 508 | } elsif ($dir =~ /\.(text|data)/) { | ||
| 509 | $current_segment=".$1"; | ||
| 510 | } | ||
| 511 | $line = ""; | ||
| 512 | return $self; | ||
| 513 | } | ||
| 514 | |||
| 515 | # non-gas case or nasm/masm | ||
| 516 | SWITCH: for ($dir) { | ||
| 517 | /\.text/ && do { my $v=undef; | ||
| 518 | if ($nasm) { | ||
| 519 | $v="section .text code align=64\n"; | ||
| 520 | } else { | ||
| 521 | $v="$current_segment\tENDS\n" if ($current_segment); | ||
| 522 | $current_segment = ".text\$"; | ||
| 523 | $v.="$current_segment\tSEGMENT "; | ||
| 524 | $v.=$masm>=$masmref ? "ALIGN(64)" : "PAGE"; | ||
| 525 | $v.=" 'CODE'"; | ||
| 526 | } | ||
| 527 | $self->{value} = $v; | ||
| 528 | last; | ||
| 529 | }; | ||
| 530 | /\.data/ && do { my $v=undef; | ||
| 531 | if ($nasm) { | ||
| 532 | $v="section .data data align=8\n"; | ||
| 533 | } else { | ||
| 534 | $v="$current_segment\tENDS\n" if ($current_segment); | ||
| 535 | $current_segment = "_DATA"; | ||
| 536 | $v.="$current_segment\tSEGMENT"; | ||
| 537 | } | ||
| 538 | $self->{value} = $v; | ||
| 539 | last; | ||
| 540 | }; | ||
| 541 | /\.section/ && do { my $v=undef; | ||
| 542 | $line =~ s/([^,]*).*/$1/; | ||
| 543 | $line = ".CRT\$XCU" if ($line eq ".init"); | ||
| 544 | if ($nasm) { | ||
| 545 | $v="section $line"; | ||
| 546 | if ($line=~/\.([px])data/) { | ||
| 547 | $v.=" rdata align="; | ||
| 548 | $v.=$1 eq "p"? 4 : 8; | ||
| 549 | } | ||
| 550 | } else { | ||
| 551 | $v="$current_segment\tENDS\n" if ($current_segment); | ||
| 552 | $v.="$line\tSEGMENT"; | ||
| 553 | if ($line=~/\.([px])data/) { | ||
| 554 | $v.=" READONLY"; | ||
| 555 | $v.=" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=$masmref); | ||
| 556 | } | ||
| 557 | } | ||
| 558 | $current_segment = $line; | ||
| 559 | $self->{value} = $v; | ||
| 560 | last; | ||
| 561 | }; | ||
| 562 | /\.extern/ && do { $self->{value} = "EXTERN\t".$line; | ||
| 563 | $self->{value} .= ":NEAR" if ($masm); | ||
| 564 | last; | ||
| 565 | }; | ||
| 566 | /\.globl|.global/ | ||
| 567 | && do { $self->{value} = $masm?"PUBLIC":"global"; | ||
| 568 | $self->{value} .= "\t".$line; | ||
| 569 | last; | ||
| 570 | }; | ||
| 383 | /\.size/ && do { if (defined($current_function)) { | 571 | /\.size/ && do { if (defined($current_function)) { |
| 384 | $self->{value}="$current_function->{name}\tENDP"; | 572 | undef $self->{value}; |
| 573 | if ($current_function->{abi} eq "svr4") { | ||
| 574 | $self->{value}="${decor}SEH_end_$current_function->{name}:"; | ||
| 575 | $self->{value}.=":\n" if($masm); | ||
| 576 | } | ||
| 577 | $self->{value}.="$current_function->{name}\tENDP" if($masm); | ||
| 385 | undef $current_function; | 578 | undef $current_function; |
| 386 | } | 579 | } |
| 387 | last; | 580 | last; |
| 388 | }; | 581 | }; |
| 389 | /\.align/ && do { $self->{value} = "ALIGN\t".$line; last; }; | 582 | /\.align/ && do { $self->{value} = "ALIGN\t".$line; last; }; |
| 390 | /\.(byte|value|long|quad)/ | 583 | /\.(value|long|rva|quad)/ |
| 391 | && do { my @arr = split(',',$line); | 584 | && do { my $sz = substr($1,0,1); |
| 392 | my $sz = substr($1,0,1); | 585 | my @arr = split(/,\s*/,$line); |
| 393 | my $last = pop(@arr); | 586 | my $last = pop(@arr); |
| 394 | my $conv = sub { my $var=shift; | 587 | my $conv = sub { my $var=shift; |
| 395 | if ($var=~s/0x([0-9a-f]+)/0$1h/i) { $var; } | 588 | $var=~s/^(0b[0-1]+)/oct($1)/eig; |
| 396 | else { sprintf"0%Xh",$var; } | 589 | $var=~s/^0x([0-9a-f]+)/0$1h/ig if ($masm); |
| 590 | if ($sz eq "D" && ($current_segment=~/.[px]data/ || $dir eq ".rva")) | ||
| 591 | { $var=~s/([_a-z\$\@][_a-z0-9\$\@]*)/$nasm?"$1 wrt ..imagebase":"imagerel $1"/egi; } | ||
| 592 | $var; | ||
| 397 | }; | 593 | }; |
| 398 | 594 | ||
| 399 | $sz =~ tr/bvlq/BWDQ/; | 595 | $sz =~ tr/bvlrq/BWDDQ/; |
| 400 | $self->{value} = "\tD$sz\t"; | 596 | $self->{value} = "\tD$sz\t"; |
| 401 | for (@arr) { $self->{value} .= &$conv($_).","; } | 597 | for (@arr) { $self->{value} .= &$conv($_).","; } |
| 402 | $self->{value} .= &$conv($last); | 598 | $self->{value} .= &$conv($last); |
| 403 | last; | 599 | last; |
| 404 | }; | 600 | }; |
| 405 | /\.picmeup/ && do { $self->{value} = sprintf"\tDD\t 0%Xh,090000000h",$opcode{$line}; | 601 | /\.byte/ && do { my @str=split(/,\s*/,$line); |
| 406 | last; | 602 | map(s/(0b[0-1]+)/oct($1)/eig,@str); |
| 407 | }; | 603 | map(s/0x([0-9a-f]+)/0$1h/ig,@str) if ($masm); |
| 408 | /\.asciz/ && do { if ($line =~ /^"(.*)"$/) { | 604 | while ($#str>15) { |
| 409 | my @str=unpack("C*",$1); | ||
| 410 | push @str,0; | ||
| 411 | while ($#str>15) { | ||
| 412 | $self->{value}.="DB\t" | ||
| 413 | .join(",",@str[0..15])."\n"; | ||
| 414 | foreach (0..15) { shift @str; } | ||
| 415 | } | ||
| 416 | $self->{value}.="DB\t" | 605 | $self->{value}.="DB\t" |
| 417 | .join(",",@str) if (@str); | 606 | .join(",",@str[0..15])."\n"; |
| 607 | foreach (0..15) { shift @str; } | ||
| 418 | } | 608 | } |
| 609 | $self->{value}.="DB\t" | ||
| 610 | .join(",",@str) if (@str); | ||
| 419 | last; | 611 | last; |
| 420 | }; | 612 | }; |
| 421 | } | 613 | } |
| @@ -432,6 +624,15 @@ my $current_function; | |||
| 432 | 624 | ||
| 433 | print "#include <machine/asm.h>\n"; | 625 | print "#include <machine/asm.h>\n"; |
| 434 | 626 | ||
| 627 | if ($nasm) { | ||
| 628 | print <<___; | ||
| 629 | default rel | ||
| 630 | ___ | ||
| 631 | } elsif ($masm) { | ||
| 632 | print <<___; | ||
| 633 | OPTION DOTNAME | ||
| 634 | ___ | ||
| 635 | } | ||
| 435 | while($line=<>) { | 636 | while($line=<>) { |
| 436 | 637 | ||
| 437 | chomp($line); | 638 | chomp($line); |
| @@ -442,43 +643,42 @@ while($line=<>) { | |||
| 442 | 643 | ||
| 443 | undef $label; | 644 | undef $label; |
| 444 | undef $opcode; | 645 | undef $opcode; |
| 445 | undef $dst; | ||
| 446 | undef $src; | ||
| 447 | undef $sz; | 646 | undef $sz; |
| 647 | undef @args; | ||
| 448 | 648 | ||
| 449 | if ($label=label->re(\$line)) { print $label->out(); } | 649 | if ($label=label->re(\$line)) { print $label->out(); } |
| 450 | 650 | ||
| 451 | if (directive->re(\$line)) { | 651 | if (directive->re(\$line)) { |
| 452 | printf "%s",directive->out(); | 652 | printf "%s",directive->out(); |
| 453 | } elsif ($opcode=opcode->re(\$line)) { ARGUMENT: { | 653 | } elsif ($opcode=opcode->re(\$line)) { ARGUMENT: while (1) { |
| 454 | 654 | my $arg; | |
| 455 | if ($src=register->re(\$line)) { opcode->size($src->size()); } | ||
| 456 | elsif ($src=const->re(\$line)) { } | ||
| 457 | elsif ($src=ea->re(\$line)) { } | ||
| 458 | elsif ($src=expr->re(\$line)) { } | ||
| 459 | 655 | ||
| 460 | last ARGUMENT if ($line !~ /^,/); | 656 | if ($arg=register->re(\$line)) { opcode->size($arg->size()); } |
| 657 | elsif ($arg=const->re(\$line)) { } | ||
| 658 | elsif ($arg=ea->re(\$line)) { } | ||
| 659 | elsif ($arg=expr->re(\$line)) { } | ||
| 660 | else { last ARGUMENT; } | ||
| 461 | 661 | ||
| 462 | $line = substr($line,1); $line =~ s/^\s+//; | 662 | push @args,$arg; |
| 463 | 663 | ||
| 464 | if ($dst=register->re(\$line)) { opcode->size($dst->size()); } | 664 | last ARGUMENT if ($line !~ /^,/); |
| 465 | elsif ($dst=const->re(\$line)) { } | ||
| 466 | elsif ($dst=ea->re(\$line)) { } | ||
| 467 | 665 | ||
| 666 | $line =~ s/^,\s*//; | ||
| 468 | } # ARGUMENT: | 667 | } # ARGUMENT: |
| 469 | 668 | ||
| 470 | $sz=opcode->size(); | 669 | $sz=opcode->size(); |
| 471 | 670 | ||
| 472 | if (defined($dst)) { | 671 | if ($#args>=0) { |
| 473 | if (!$masm) { | 672 | my $insn; |
| 474 | printf "\t%s\t%s,%s", $opcode->out($dst->size()), | 673 | if ($gas) { |
| 475 | $src->out($sz),$dst->out($sz); | 674 | $insn = $opcode->out($#args>=1?$args[$#args]->size():$sz); |
| 476 | } else { | 675 | } else { |
| 477 | printf "\t%s\t%s,%s", $opcode->out(), | 676 | $insn = $opcode->out(); |
| 478 | $dst->out($sz),$src->out($sz); | 677 | $insn .= $sz if (map($_->out() =~ /x?mm/,@args)); |
| 678 | @args = reverse(@args); | ||
| 679 | undef $sz if ($nasm && $opcode->mnemonic() eq "lea"); | ||
| 479 | } | 680 | } |
| 480 | } elsif (defined($src)) { | 681 | printf "\t%s\t%s",$insn,join(",",map($_->out($sz),@args)); |
| 481 | printf "\t%s\t%s",$opcode->out(),$src->out($sz); | ||
| 482 | } else { | 682 | } else { |
| 483 | printf "\t%s",$opcode->out(); | 683 | printf "\t%s",$opcode->out(); |
| 484 | } | 684 | } |
| @@ -487,11 +687,12 @@ while($line=<>) { | |||
| 487 | print $line,"\n"; | 687 | print $line,"\n"; |
| 488 | } | 688 | } |
| 489 | 689 | ||
| 490 | print "\n$current_segment\tENDS\nEND\n" if ($masm); | 690 | print "\n$current_segment\tENDS\n" if ($current_segment && $masm); |
| 691 | print "END\n" if ($masm); | ||
| 491 | 692 | ||
| 492 | close STDOUT; | 693 | close STDOUT; |
| 493 | 694 | ||
| 494 | ################################################# | 695 | ################################################# |
| 495 | # Cross-reference x86_64 ABI "card" | 696 | # Cross-reference x86_64 ABI "card" |
| 496 | # | 697 | # |
| 497 | # Unix Win64 | 698 | # Unix Win64 |
| @@ -555,3 +756,161 @@ close STDOUT; | |||
| 555 | # movq 16(%rsp),%rsi | 756 | # movq 16(%rsp),%rsi |
| 556 | # endif | 757 | # endif |
| 557 | # ret | 758 | # ret |
| 759 | # | ||
| 760 | ################################################# | ||
| 761 | # Win64 SEH, Structured Exception Handling. | ||
| 762 | # | ||
| 763 | # Unlike on Unix systems(*) lack of Win64 stack unwinding information | ||
| 764 | # has undesired side-effect at run-time: if an exception is raised in | ||
| 765 | # assembler subroutine such as those in question (basically we're | ||
| 766 | # referring to segmentation violations caused by malformed input | ||
| 767 | # parameters), the application is briskly terminated without invoking | ||
| 768 | # any exception handlers, most notably without generating memory dump | ||
| 769 | # or any user notification whatsoever. This poses a problem. It's | ||
| 770 | # possible to address it by registering custom language-specific | ||
| 771 | # handler that would restore processor context to the state at | ||
| 772 | # subroutine entry point and return "exception is not handled, keep | ||
| 773 | # unwinding" code. Writing such handler can be a challenge... But it's | ||
| 774 | # doable, though requires certain coding convention. Consider following | ||
| 775 | # snippet: | ||
| 776 | # | ||
| 777 | # .type function,@function | ||
| 778 | # function: | ||
| 779 | # movq %rsp,%rax # copy rsp to volatile register | ||
| 780 | # pushq %r15 # save non-volatile registers | ||
| 781 | # pushq %rbx | ||
| 782 | # pushq %rbp | ||
| 783 | # movq %rsp,%r11 | ||
| 784 | # subq %rdi,%r11 # prepare [variable] stack frame | ||
| 785 | # andq $-64,%r11 | ||
| 786 | # movq %rax,0(%r11) # check for exceptions | ||
| 787 | # movq %r11,%rsp # allocate [variable] stack frame | ||
| 788 | # movq %rax,0(%rsp) # save original rsp value | ||
| 789 | # magic_point: | ||
| 790 | # ... | ||
| 791 | # movq 0(%rsp),%rcx # pull original rsp value | ||
| 792 | # movq -24(%rcx),%rbp # restore non-volatile registers | ||
| 793 | # movq -16(%rcx),%rbx | ||
| 794 | # movq -8(%rcx),%r15 | ||
| 795 | # movq %rcx,%rsp # restore original rsp | ||
| 796 | # ret | ||
| 797 | # .size function,.-function | ||
| 798 | # | ||
| 799 | # The key is that up to magic_point copy of original rsp value remains | ||
| 800 | # in chosen volatile register and no non-volatile register, except for | ||
| 801 | # rsp, is modified. While past magic_point rsp remains constant till | ||
| 802 | # the very end of the function. In this case custom language-specific | ||
| 803 | # exception handler would look like this: | ||
| 804 | # | ||
| 805 | # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, | ||
| 806 | # CONTEXT *context,DISPATCHER_CONTEXT *disp) | ||
| 807 | # { ULONG64 *rsp = (ULONG64 *)context->Rax; | ||
| 808 | # if (context->Rip >= magic_point) | ||
| 809 | # { rsp = ((ULONG64 **)context->Rsp)[0]; | ||
| 810 | # context->Rbp = rsp[-3]; | ||
| 811 | # context->Rbx = rsp[-2]; | ||
| 812 | # context->R15 = rsp[-1]; | ||
| 813 | # } | ||
| 814 | # context->Rsp = (ULONG64)rsp; | ||
| 815 | # context->Rdi = rsp[1]; | ||
| 816 | # context->Rsi = rsp[2]; | ||
| 817 | # | ||
| 818 | # memcpy (disp->ContextRecord,context,sizeof(CONTEXT)); | ||
| 819 | # RtlVirtualUnwind(UNW_FLAG_NHANDLER,disp->ImageBase, | ||
| 820 | # dips->ControlPc,disp->FunctionEntry,disp->ContextRecord, | ||
| 821 | # &disp->HandlerData,&disp->EstablisherFrame,NULL); | ||
| 822 | # return ExceptionContinueSearch; | ||
| 823 | # } | ||
| 824 | # | ||
| 825 | # It's appropriate to implement this handler in assembler, directly in | ||
| 826 | # function's module. In order to do that one has to know members' | ||
| 827 | # offsets in CONTEXT and DISPATCHER_CONTEXT structures and some constant | ||
| 828 | # values. Here they are: | ||
| 829 | # | ||
| 830 | # CONTEXT.Rax 120 | ||
| 831 | # CONTEXT.Rcx 128 | ||
| 832 | # CONTEXT.Rdx 136 | ||
| 833 | # CONTEXT.Rbx 144 | ||
| 834 | # CONTEXT.Rsp 152 | ||
| 835 | # CONTEXT.Rbp 160 | ||
| 836 | # CONTEXT.Rsi 168 | ||
| 837 | # CONTEXT.Rdi 176 | ||
| 838 | # CONTEXT.R8 184 | ||
| 839 | # CONTEXT.R9 192 | ||
| 840 | # CONTEXT.R10 200 | ||
| 841 | # CONTEXT.R11 208 | ||
| 842 | # CONTEXT.R12 216 | ||
| 843 | # CONTEXT.R13 224 | ||
| 844 | # CONTEXT.R14 232 | ||
| 845 | # CONTEXT.R15 240 | ||
| 846 | # CONTEXT.Rip 248 | ||
| 847 | # CONTEXT.Xmm6 512 | ||
| 848 | # sizeof(CONTEXT) 1232 | ||
| 849 | # DISPATCHER_CONTEXT.ControlPc 0 | ||
| 850 | # DISPATCHER_CONTEXT.ImageBase 8 | ||
| 851 | # DISPATCHER_CONTEXT.FunctionEntry 16 | ||
| 852 | # DISPATCHER_CONTEXT.EstablisherFrame 24 | ||
| 853 | # DISPATCHER_CONTEXT.TargetIp 32 | ||
| 854 | # DISPATCHER_CONTEXT.ContextRecord 40 | ||
| 855 | # DISPATCHER_CONTEXT.LanguageHandler 48 | ||
| 856 | # DISPATCHER_CONTEXT.HandlerData 56 | ||
| 857 | # UNW_FLAG_NHANDLER 0 | ||
| 858 | # ExceptionContinueSearch 1 | ||
| 859 | # | ||
| 860 | # In order to tie the handler to the function one has to compose | ||
| 861 | # couple of structures: one for .xdata segment and one for .pdata. | ||
| 862 | # | ||
| 863 | # UNWIND_INFO structure for .xdata segment would be | ||
| 864 | # | ||
| 865 | # function_unwind_info: | ||
| 866 | # .byte 9,0,0,0 | ||
| 867 | # .rva handler | ||
| 868 | # | ||
| 869 | # This structure designates exception handler for a function with | ||
| 870 | # zero-length prologue, no stack frame or frame register. | ||
| 871 | # | ||
| 872 | # To facilitate composing of .pdata structures, auto-generated "gear" | ||
| 873 | # prologue copies rsp value to rax and denotes next instruction with | ||
| 874 | # .LSEH_begin_{function_name} label. This essentially defines the SEH | ||
| 875 | # styling rule mentioned in the beginning. Position of this label is | ||
| 876 | # chosen in such manner that possible exceptions raised in the "gear" | ||
| 877 | # prologue would be accounted to caller and unwound from latter's frame. | ||
| 878 | # End of function is marked with respective .LSEH_end_{function_name} | ||
| 879 | # label. To summarize, .pdata segment would contain | ||
| 880 | # | ||
| 881 | # .rva .LSEH_begin_function | ||
| 882 | # .rva .LSEH_end_function | ||
| 883 | # .rva function_unwind_info | ||
| 884 | # | ||
| 885 | # Reference to functon_unwind_info from .xdata segment is the anchor. | ||
| 886 | # In case you wonder why references are 32-bit .rvas and not 64-bit | ||
| 887 | # .quads. References put into these two segments are required to be | ||
| 888 | # *relative* to the base address of the current binary module, a.k.a. | ||
| 889 | # image base. No Win64 module, be it .exe or .dll, can be larger than | ||
| 890 | # 2GB and thus such relative references can be and are accommodated in | ||
| 891 | # 32 bits. | ||
| 892 | # | ||
| 893 | # Having reviewed the example function code, one can argue that "movq | ||
| 894 | # %rsp,%rax" above is redundant. It is not! Keep in mind that on Unix | ||
| 895 | # rax would contain an undefined value. If this "offends" you, use | ||
| 896 | # another register and refrain from modifying rax till magic_point is | ||
| 897 | # reached, i.e. as if it was a non-volatile register. If more registers | ||
| 898 | # are required prior [variable] frame setup is completed, note that | ||
| 899 | # nobody says that you can have only one "magic point." You can | ||
| 900 | # "liberate" non-volatile registers by denoting last stack off-load | ||
| 901 | # instruction and reflecting it in finer grade unwind logic in handler. | ||
| 902 | # After all, isn't it why it's called *language-specific* handler... | ||
| 903 | # | ||
| 904 | # Attentive reader can notice that exceptions would be mishandled in | ||
| 905 | # auto-generated "gear" epilogue. Well, exception effectively can't | ||
| 906 | # occur there, because if memory area used by it was subject to | ||
| 907 | # segmentation violation, then it would be raised upon call to the | ||
| 908 | # function (and as already mentioned be accounted to caller, which is | ||
| 909 | # not a problem). If you're still not comfortable, then define tail | ||
| 910 | # "magic point" just prior ret instruction and have handler treat it... | ||
| 911 | # | ||
| 912 | # (*) Note that we're talking about run-time, not debug-time. Lack of | ||
| 913 | # unwind information makes debugging hard on both Windows and | ||
| 914 | # Unix. "Unlike" referes to the fact that on Unix signal handler | ||
| 915 | # will always be invoked, core dumped and appropriate exit code | ||
| 916 | # returned to parent (for user notification). | ||
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl index f535c9c7fa..4756a28e59 100644 --- a/src/lib/libcrypto/perlasm/x86asm.pl +++ b/src/lib/libcrypto/perlasm/x86asm.pl | |||
| @@ -1,136 +1,221 @@ | |||
| 1 | #!/usr/local/bin/perl | 1 | #!/usr/bin/env perl |
| 2 | 2 | ||
| 3 | # require 'x86asm.pl'; | 3 | # require 'x86asm.pl'; |
| 4 | # &asm_init("cpp","des-586.pl"); | 4 | # &asm_init(<flavor>,"des-586.pl"[,$i386only]); |
| 5 | # XXX | 5 | # &function_begin("foo"); |
| 6 | # XXX | 6 | # ... |
| 7 | # main'asm_finish | 7 | # &function_end("foo"); |
| 8 | 8 | # &asm_finish | |
| 9 | sub main'asm_finish | 9 | |
| 10 | { | 10 | $out=(); |
| 11 | &file_end(); | 11 | $i386=0; |
| 12 | &asm_finish_cpp() if $cpp; | 12 | |
| 13 | print &asm_get_output(); | 13 | # AUTOLOAD is this context has quite unpleasant side effect, namely |
| 14 | } | 14 | # that typos in function calls effectively go to assembler output, |
| 15 | 15 | # but on the pros side we don't have to implement one subroutine per | |
| 16 | sub main'asm_init | 16 | # each opcode... |
| 17 | { | 17 | sub ::AUTOLOAD |
| 18 | ($type,$fn,$i386)=@_; | 18 | { my $opcode = $AUTOLOAD; |
| 19 | $filename=$fn; | 19 | |
| 20 | 20 | die "more than 4 arguments passed to $opcode" if ($#_>3); | |
| 21 | $elf=$cpp=$coff=$aout=$win32=$netware=$mwerks=$openbsd=0; | 21 | |
| 22 | if ( ($type eq "elf")) | 22 | $opcode =~ s/.*:://; |
| 23 | { $elf=1; require "x86unix.pl"; } | 23 | if ($opcode =~ /^push/) { $stack+=4; } |
| 24 | elsif ( ($type eq "openbsd-elf")) | 24 | elsif ($opcode =~ /^pop/) { $stack-=4; } |
| 25 | { $openbsd=$elf=1; require "x86unix.pl"; } | 25 | |
| 26 | elsif ( ($type eq "openbsd-a.out")) | 26 | &generic($opcode,@_) or die "undefined subroutine \&$AUTOLOAD"; |
| 27 | { $openbsd=1; require "x86unix.pl"; } | 27 | } |
| 28 | elsif ( ($type eq "a.out")) | 28 | |
| 29 | { $aout=1; require "x86unix.pl"; } | 29 | sub ::emit |
| 30 | elsif ( ($type eq "coff" or $type eq "gaswin")) | 30 | { my $opcode=shift; |
| 31 | { $coff=1; require "x86unix.pl"; } | 31 | |
| 32 | elsif ( ($type eq "cpp")) | 32 | if ($#_==-1) { push(@out,"\t$opcode\n"); } |
| 33 | { $cpp=1; require "x86unix.pl"; } | 33 | else { push(@out,"\t$opcode\t".join(',',@_)."\n"); } |
| 34 | elsif ( ($type eq "win32")) | 34 | } |
| 35 | { $win32=1; require "x86ms.pl"; } | 35 | |
| 36 | elsif ( ($type eq "win32n")) | 36 | sub ::emitraw |
| 37 | { $win32=1; require "x86nasm.pl"; } | 37 | { my $opcode=shift; |
| 38 | elsif ( ($type eq "nw-nasm")) | 38 | |
| 39 | { $netware=1; require "x86nasm.pl"; } | 39 | if ($#_==-1) { push(@out,"$opcode\n"); } |
| 40 | elsif ( ($type eq "nw-mwasm")) | 40 | else { push(@out,"$opcode\t".join(',',@_)."\n"); } |
| 41 | { $netware=1; $mwerks=1; require "x86nasm.pl"; } | 41 | } |
| 42 | else | 42 | |
| 43 | { | 43 | sub ::LB |
| 44 | print STDERR <<"EOF"; | 44 | { $_[0] =~ m/^e?([a-d])x$/o or die "$_[0] does not have a 'low byte'"; |
| 45 | $1."l"; | ||
| 46 | } | ||
| 47 | sub ::HB | ||
| 48 | { $_[0] =~ m/^e?([a-d])x$/o or die "$_[0] does not have a 'high byte'"; | ||
| 49 | $1."h"; | ||
| 50 | } | ||
| 51 | sub ::stack_push{ my $num=$_[0]*4; $stack+=$num; &sub("esp",$num); } | ||
| 52 | sub ::stack_pop { my $num=$_[0]*4; $stack-=$num; &add("esp",$num); } | ||
| 53 | sub ::blindpop { &pop($_[0]); $stack+=4; } | ||
| 54 | sub ::wparam { &DWP($stack+4*$_[0],"esp"); } | ||
| 55 | sub ::swtmp { &DWP(4*$_[0],"esp"); } | ||
| 56 | |||
| 57 | sub ::bswap | ||
| 58 | { if ($i386) # emulate bswap for i386 | ||
| 59 | { &comment("bswap @_"); | ||
| 60 | &xchg(&HB(@_),&LB(@_)); | ||
| 61 | &ror (@_,16); | ||
| 62 | &xchg(&HB(@_),&LB(@_)); | ||
| 63 | } | ||
| 64 | else | ||
| 65 | { &generic("bswap",@_); } | ||
| 66 | } | ||
| 67 | # These are made-up opcodes introduced over the years essentially | ||
| 68 | # by ignorance, just alias them to real ones... | ||
| 69 | sub ::movb { &mov(@_); } | ||
| 70 | sub ::xorb { &xor(@_); } | ||
| 71 | sub ::rotl { &rol(@_); } | ||
| 72 | sub ::rotr { &ror(@_); } | ||
| 73 | sub ::exch { &xchg(@_); } | ||
| 74 | sub ::halt { &hlt; } | ||
| 75 | sub ::movz { &movzx(@_); } | ||
| 76 | sub ::pushf { &pushfd; } | ||
| 77 | sub ::popf { &popfd; } | ||
| 78 | |||
| 79 | # 3 argument instructions | ||
| 80 | sub ::movq | ||
| 81 | { my($p1,$p2,$optimize)=@_; | ||
| 82 | |||
| 83 | if ($optimize && $p1=~/^mm[0-7]$/ && $p2=~/^mm[0-7]$/) | ||
| 84 | # movq between mmx registers can sink Intel CPUs | ||
| 85 | { &::pshufw($p1,$p2,0xe4); } | ||
| 86 | else | ||
| 87 | { &::generic("movq",@_); } | ||
| 88 | } | ||
| 89 | |||
| 90 | # label management | ||
| 91 | $lbdecor="L"; # local label decoration, set by package | ||
| 92 | $label="000"; | ||
| 93 | |||
| 94 | sub ::islabel # see is argument is a known label | ||
| 95 | { my $i; | ||
| 96 | foreach $i (values %label) { return $i if ($i eq $_[0]); } | ||
| 97 | $label{$_[0]}; # can be undef | ||
| 98 | } | ||
| 99 | |||
| 100 | sub ::label # instantiate a function-scope label | ||
| 101 | { if (!defined($label{$_[0]})) | ||
| 102 | { $label{$_[0]}="${lbdecor}${label}${_[0]}"; $label++; } | ||
| 103 | $label{$_[0]}; | ||
| 104 | } | ||
| 105 | |||
| 106 | sub ::LABEL # instantiate a file-scope label | ||
| 107 | { $label{$_[0]}=$_[1] if (!defined($label{$_[0]})); | ||
| 108 | $label{$_[0]}; | ||
| 109 | } | ||
| 110 | |||
| 111 | sub ::static_label { &::LABEL($_[0],$lbdecor.$_[0]); } | ||
| 112 | |||
| 113 | sub ::set_label_B { push(@out,"@_:\n"); } | ||
| 114 | sub ::set_label | ||
| 115 | { my $label=&::label($_[0]); | ||
| 116 | &::align($_[1]) if ($_[1]>1); | ||
| 117 | &::set_label_B($label); | ||
| 118 | $label; | ||
| 119 | } | ||
| 120 | |||
| 121 | sub ::wipe_labels # wipes function-scope labels | ||
| 122 | { foreach $i (keys %label) | ||
| 123 | { delete $label{$i} if ($label{$i} =~ /^\Q${lbdecor}\E[0-9]{3}/); } | ||
| 124 | } | ||
| 125 | |||
| 126 | # subroutine management | ||
| 127 | sub ::function_begin | ||
| 128 | { &function_begin_B(@_); | ||
| 129 | $stack=4; | ||
| 130 | &push("ebp"); | ||
| 131 | &push("ebx"); | ||
| 132 | &push("esi"); | ||
| 133 | &push("edi"); | ||
| 134 | } | ||
| 135 | |||
| 136 | sub ::function_end | ||
| 137 | { &pop("edi"); | ||
| 138 | &pop("esi"); | ||
| 139 | &pop("ebx"); | ||
| 140 | &pop("ebp"); | ||
| 141 | &ret(); | ||
| 142 | &function_end_B(@_); | ||
| 143 | $stack=0; | ||
| 144 | &wipe_labels(); | ||
| 145 | } | ||
| 146 | |||
| 147 | sub ::function_end_A | ||
| 148 | { &pop("edi"); | ||
| 149 | &pop("esi"); | ||
| 150 | &pop("ebx"); | ||
| 151 | &pop("ebp"); | ||
| 152 | &ret(); | ||
| 153 | $stack+=16; # readjust esp as if we didn't pop anything | ||
| 154 | } | ||
| 155 | |||
| 156 | sub ::asciz | ||
| 157 | { my @str=unpack("C*",shift); | ||
| 158 | push @str,0; | ||
| 159 | while ($#str>15) { | ||
| 160 | &data_byte(@str[0..15]); | ||
| 161 | foreach (0..15) { shift @str; } | ||
| 162 | } | ||
| 163 | &data_byte(@str) if (@str); | ||
| 164 | } | ||
| 165 | |||
| 166 | sub ::asm_finish | ||
| 167 | { &file_end(); | ||
| 168 | print @out; | ||
| 169 | } | ||
| 170 | |||
| 171 | sub ::asm_init | ||
| 172 | { my ($type,$fn,$cpu)=@_; | ||
| 173 | |||
| 174 | $filename=$fn; | ||
| 175 | $i386=$cpu; | ||
| 176 | |||
| 177 | $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$openbsd=0; | ||
| 178 | if (($type eq "elf")) | ||
| 179 | { $elf=1; require "x86gas.pl"; } | ||
| 180 | elsif (($type eq "a\.out")) | ||
| 181 | { $aout=1; require "x86gas.pl"; } | ||
| 182 | elsif (($type eq "coff" or $type eq "gaswin")) | ||
| 183 | { $coff=1; require "x86gas.pl"; } | ||
| 184 | elsif (($type eq "win32n")) | ||
| 185 | { $win32=1; require "x86nasm.pl"; } | ||
| 186 | elsif (($type eq "nw-nasm")) | ||
| 187 | { $netware=1; require "x86nasm.pl"; } | ||
| 188 | #elsif (($type eq "nw-mwasm")) | ||
| 189 | #{ $netware=1; $mwerks=1; require "x86nasm.pl"; } | ||
| 190 | elsif (($type eq "win32")) | ||
| 191 | { $win32=1; require "x86masm.pl"; } | ||
| 192 | elsif (($type eq "macosx")) | ||
| 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"; } | ||
| 198 | else | ||
| 199 | { print STDERR <<"EOF"; | ||
| 45 | Pick one target type from | 200 | Pick one target type from |
| 46 | elf - Linux, FreeBSD, Solaris x86, etc. | 201 | elf - Linux, FreeBSD, Solaris x86, etc. |
| 47 | a.out - OpenBSD, DJGPP, etc. | 202 | a.out - DJGPP, elder OpenBSD, etc. |
| 48 | coff - GAS/COFF such as Win32 targets | 203 | coff - GAS/COFF such as Win32 targets |
| 49 | win32 - Windows 95/Windows NT | ||
| 50 | win32n - Windows 95/Windows NT NASM format | 204 | win32n - Windows 95/Windows NT NASM format |
| 51 | openbsd-elf - OpenBSD elf | 205 | openbsd-elf - OpenBSD elf |
| 52 | openbsd-a.out - OpenBSD a.out | 206 | openbsd-a.out - OpenBSD a.out |
| 53 | nw-nasm - NetWare NASM format | 207 | nw-nasm - NetWare NASM format |
| 54 | nw-mwasm- NetWare Metrowerks Assembler | 208 | macosx - Mac OS X |
| 55 | EOF | 209 | EOF |
| 56 | exit(1); | 210 | exit(1); |
| 57 | } | 211 | } |
| 58 | 212 | ||
| 59 | $pic=0; | 213 | $pic=0; |
| 60 | for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); } | 214 | for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); } |
| 61 | 215 | ||
| 62 | &asm_init_output(); | 216 | ::emitraw("#include <machine/asm.h>\n") if $openbsd; |
| 63 | 217 | $filename =~ s/\.pl$//; | |
| 64 | &comment("Don't even think of reading this code"); | 218 | &file($filename); |
| 65 | &comment("It was automatically generated by $filename"); | 219 | } |
| 66 | &comment("Which is a perl program used to generate the x86 assember for"); | ||
| 67 | &comment("any of ELF, a.out, COFF, Win32, ..."); | ||
| 68 | &comment("eric <eay\@cryptsoft.com>"); | ||
| 69 | &comment(""); | ||
| 70 | |||
| 71 | $filename =~ s/\.pl$//; | ||
| 72 | &file($filename); | ||
| 73 | } | ||
| 74 | |||
| 75 | sub asm_finish_cpp | ||
| 76 | { | ||
| 77 | return unless $cpp; | ||
| 78 | |||
| 79 | local($tmp,$i); | ||
| 80 | foreach $i (&get_labels()) | ||
| 81 | { | ||
| 82 | $tmp.="#define $i _$i\n"; | ||
| 83 | } | ||
| 84 | print <<"EOF"; | ||
| 85 | /* Run the C pre-processor over this file with one of the following defined | ||
| 86 | * ELF - elf object files, | ||
| 87 | * OUT - a.out object files, | ||
| 88 | * BSDI - BSDI style a.out object files | ||
| 89 | * SOL - Solaris style elf | ||
| 90 | */ | ||
| 91 | |||
| 92 | #define TYPE(a,b) .type a,b | ||
| 93 | #define SIZE(a,b) .size a,b | ||
| 94 | |||
| 95 | #if defined(OUT) || (defined(BSDI) && !defined(ELF)) | ||
| 96 | $tmp | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifdef OUT | ||
| 100 | #define OK 1 | ||
| 101 | #define ALIGN 4 | ||
| 102 | #if defined(__CYGWIN__) || defined(__DJGPP__) || (__MINGW32__) | ||
| 103 | #undef SIZE | ||
| 104 | #undef TYPE | ||
| 105 | #define SIZE(a,b) | ||
| 106 | #define TYPE(a,b) .def a; .scl 2; .type 32; .endef | ||
| 107 | #endif /* __CYGWIN || __DJGPP */ | ||
| 108 | #endif | ||
| 109 | |||
| 110 | #if defined(BSDI) && !defined(ELF) | ||
| 111 | #define OK 1 | ||
| 112 | #define ALIGN 4 | ||
| 113 | #undef SIZE | ||
| 114 | #undef TYPE | ||
| 115 | #define SIZE(a,b) | ||
| 116 | #define TYPE(a,b) | ||
| 117 | #endif | ||
| 118 | |||
| 119 | #if defined(ELF) || defined(SOL) | ||
| 120 | #define OK 1 | ||
| 121 | #define ALIGN 16 | ||
| 122 | #endif | ||
| 123 | |||
| 124 | #ifndef OK | ||
| 125 | You need to define one of | ||
| 126 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
| 127 | OUT - a.out systems - linux-a.out and FreeBSD | ||
| 128 | SOL - solaris systems, which are elf with strange comment lines | ||
| 129 | BSDI - a.out with a very primative version of as. | ||
| 130 | #endif | ||
| 131 | |||
| 132 | /* Let the Assembler begin :-) */ | ||
| 133 | EOF | ||
| 134 | } | ||
| 135 | 220 | ||
| 136 | 1; | 221 | 1; |
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/x86ms.pl b/src/lib/libcrypto/perlasm/x86ms.pl deleted file mode 100644 index a0be2934c2..0000000000 --- a/src/lib/libcrypto/perlasm/x86ms.pl +++ /dev/null | |||
| @@ -1,472 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | package x86ms; | ||
| 4 | |||
| 5 | $label="L000"; | ||
| 6 | |||
| 7 | %lb=( 'eax', 'al', | ||
| 8 | 'ebx', 'bl', | ||
| 9 | 'ecx', 'cl', | ||
| 10 | 'edx', 'dl', | ||
| 11 | 'ax', 'al', | ||
| 12 | 'bx', 'bl', | ||
| 13 | 'cx', 'cl', | ||
| 14 | 'dx', 'dl', | ||
| 15 | ); | ||
| 16 | |||
| 17 | %hb=( 'eax', 'ah', | ||
| 18 | 'ebx', 'bh', | ||
| 19 | 'ecx', 'ch', | ||
| 20 | 'edx', 'dh', | ||
| 21 | 'ax', 'ah', | ||
| 22 | 'bx', 'bh', | ||
| 23 | 'cx', 'ch', | ||
| 24 | 'dx', 'dh', | ||
| 25 | ); | ||
| 26 | |||
| 27 | sub main'asm_init_output { @out=(); } | ||
| 28 | sub main'asm_get_output { return(@out); } | ||
| 29 | sub main'get_labels { return(@labels); } | ||
| 30 | sub main'external_label | ||
| 31 | { | ||
| 32 | push(@labels,@_); | ||
| 33 | foreach (@_) { | ||
| 34 | push(@out, "EXTRN\t_$_:DWORD\n"); | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | sub main'LB | ||
| 39 | { | ||
| 40 | (defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n"; | ||
| 41 | return($lb{$_[0]}); | ||
| 42 | } | ||
| 43 | |||
| 44 | sub main'HB | ||
| 45 | { | ||
| 46 | (defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n"; | ||
| 47 | return($hb{$_[0]}); | ||
| 48 | } | ||
| 49 | |||
| 50 | sub main'BP | ||
| 51 | { | ||
| 52 | &get_mem("BYTE",@_); | ||
| 53 | } | ||
| 54 | |||
| 55 | sub main'DWP | ||
| 56 | { | ||
| 57 | &get_mem("DWORD",@_); | ||
| 58 | } | ||
| 59 | |||
| 60 | sub main'QWP | ||
| 61 | { | ||
| 62 | &get_mem("QWORD",@_); | ||
| 63 | } | ||
| 64 | |||
| 65 | sub main'BC | ||
| 66 | { | ||
| 67 | return @_; | ||
| 68 | } | ||
| 69 | |||
| 70 | sub main'DWC | ||
| 71 | { | ||
| 72 | return @_; | ||
| 73 | } | ||
| 74 | |||
| 75 | sub main'stack_push | ||
| 76 | { | ||
| 77 | local($num)=@_; | ||
| 78 | $stack+=$num*4; | ||
| 79 | &main'sub("esp",$num*4); | ||
| 80 | } | ||
| 81 | |||
| 82 | sub main'stack_pop | ||
| 83 | { | ||
| 84 | local($num)=@_; | ||
| 85 | $stack-=$num*4; | ||
| 86 | &main'add("esp",$num*4); | ||
| 87 | } | ||
| 88 | |||
| 89 | sub get_mem | ||
| 90 | { | ||
| 91 | local($size,$addr,$reg1,$reg2,$idx)=@_; | ||
| 92 | local($t,$post); | ||
| 93 | local($ret)="$size PTR "; | ||
| 94 | |||
| 95 | $addr =~ s/^\s+//; | ||
| 96 | if ($addr =~ /^(.+)\+(.+)$/) | ||
| 97 | { | ||
| 98 | $reg2=&conv($1); | ||
| 99 | $addr="_$2"; | ||
| 100 | } | ||
| 101 | elsif ($addr =~ /^[_a-z][_a-z0-9]*$/i) | ||
| 102 | { | ||
| 103 | $addr="_$addr"; | ||
| 104 | } | ||
| 105 | |||
| 106 | if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; } | ||
| 107 | |||
| 108 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); | ||
| 109 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); | ||
| 110 | if (($addr ne "") && ($addr ne 0)) | ||
| 111 | { | ||
| 112 | if ($addr !~ /^-/) | ||
| 113 | { $ret.=$addr; } | ||
| 114 | else { $post=$addr; } | ||
| 115 | } | ||
| 116 | if ($reg2 ne "") | ||
| 117 | { | ||
| 118 | $t=""; | ||
| 119 | $t="*$idx" if ($idx != 0); | ||
| 120 | $reg1="+".$reg1 if ("$reg1$post" ne ""); | ||
| 121 | $ret.="[$reg2$t$reg1$post]"; | ||
| 122 | } | ||
| 123 | else | ||
| 124 | { | ||
| 125 | $ret.="[$reg1$post]" | ||
| 126 | } | ||
| 127 | $ret =~ s/\[\]//; # in case $addr was the only argument | ||
| 128 | return($ret); | ||
| 129 | } | ||
| 130 | |||
| 131 | sub main'mov { &out2("mov",@_); } | ||
| 132 | sub main'movb { &out2("mov",@_); } | ||
| 133 | sub main'and { &out2("and",@_); } | ||
| 134 | sub main'or { &out2("or",@_); } | ||
| 135 | sub main'shl { &out2("shl",@_); } | ||
| 136 | sub main'shr { &out2("shr",@_); } | ||
| 137 | sub main'xor { &out2("xor",@_); } | ||
| 138 | sub main'xorb { &out2("xor",@_); } | ||
| 139 | sub main'add { &out2("add",@_); } | ||
| 140 | sub main'adc { &out2("adc",@_); } | ||
| 141 | sub main'sub { &out2("sub",@_); } | ||
| 142 | sub main'sbb { &out2("sbb",@_); } | ||
| 143 | sub main'rotl { &out2("rol",@_); } | ||
| 144 | sub main'rotr { &out2("ror",@_); } | ||
| 145 | sub main'exch { &out2("xchg",@_); } | ||
| 146 | sub main'cmp { &out2("cmp",@_); } | ||
| 147 | sub main'lea { &out2("lea",@_); } | ||
| 148 | sub main'mul { &out1("mul",@_); } | ||
| 149 | sub main'imul { &out2("imul",@_); } | ||
| 150 | sub main'div { &out1("div",@_); } | ||
| 151 | sub main'dec { &out1("dec",@_); } | ||
| 152 | sub main'inc { &out1("inc",@_); } | ||
| 153 | sub main'jmp { &out1("jmp",@_); } | ||
| 154 | sub main'jmp_ptr { &out1p("jmp",@_); } | ||
| 155 | sub main'je { &out1("je",@_); } | ||
| 156 | sub main'jle { &out1("jle",@_); } | ||
| 157 | sub main'jz { &out1("jz",@_); } | ||
| 158 | sub main'jge { &out1("jge",@_); } | ||
| 159 | sub main'jl { &out1("jl",@_); } | ||
| 160 | sub main'ja { &out1("ja",@_); } | ||
| 161 | sub main'jae { &out1("jae",@_); } | ||
| 162 | sub main'jb { &out1("jb",@_); } | ||
| 163 | sub main'jbe { &out1("jbe",@_); } | ||
| 164 | sub main'jc { &out1("jc",@_); } | ||
| 165 | sub main'jnc { &out1("jnc",@_); } | ||
| 166 | sub main'jnz { &out1("jnz",@_); } | ||
| 167 | sub main'jne { &out1("jne",@_); } | ||
| 168 | sub main'jno { &out1("jno",@_); } | ||
| 169 | sub main'push { &out1("push",@_); $stack+=4; } | ||
| 170 | sub main'pop { &out1("pop",@_); $stack-=4; } | ||
| 171 | sub main'pushf { &out0("pushfd"); $stack+=4; } | ||
| 172 | sub main'popf { &out0("popfd"); $stack-=4; } | ||
| 173 | sub main'bswap { &out1("bswap",@_); &using486(); } | ||
| 174 | sub main'not { &out1("not",@_); } | ||
| 175 | sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); } | ||
| 176 | sub main'call_ptr { &out1p("call",@_); } | ||
| 177 | sub main'ret { &out0("ret"); } | ||
| 178 | sub main'nop { &out0("nop"); } | ||
| 179 | sub main'test { &out2("test",@_); } | ||
| 180 | sub main'bt { &out2("bt",@_); } | ||
| 181 | sub main'leave { &out0("leave"); } | ||
| 182 | sub main'cpuid { &out0("DW\t0A20Fh"); } | ||
| 183 | sub main'rdtsc { &out0("DW\t0310Fh"); } | ||
| 184 | sub main'halt { &out0("hlt"); } | ||
| 185 | sub main'movz { &out2("movzx",@_); } | ||
| 186 | sub main'neg { &out1("neg",@_); } | ||
| 187 | sub main'cld { &out0("cld"); } | ||
| 188 | |||
| 189 | # SSE2 | ||
| 190 | sub main'emms { &out0("emms"); } | ||
| 191 | sub main'movd { &out2("movd",@_); } | ||
| 192 | sub main'movq { &out2("movq",@_); } | ||
| 193 | sub main'movdqu { &out2("movdqu",@_); } | ||
| 194 | sub main'movdqa { &out2("movdqa",@_); } | ||
| 195 | sub main'movdq2q{ &out2("movdq2q",@_); } | ||
| 196 | sub main'movq2dq{ &out2("movq2dq",@_); } | ||
| 197 | sub main'paddq { &out2("paddq",@_); } | ||
| 198 | sub main'pmuludq{ &out2("pmuludq",@_); } | ||
| 199 | sub main'psrlq { &out2("psrlq",@_); } | ||
| 200 | sub main'psllq { &out2("psllq",@_); } | ||
| 201 | sub main'pxor { &out2("pxor",@_); } | ||
| 202 | sub main'por { &out2("por",@_); } | ||
| 203 | sub main'pand { &out2("pand",@_); } | ||
| 204 | |||
| 205 | sub out2 | ||
| 206 | { | ||
| 207 | local($name,$p1,$p2)=@_; | ||
| 208 | local($l,$t,$line); | ||
| 209 | |||
| 210 | $line="\t$name\t"; | ||
| 211 | $t=&conv($p1).","; | ||
| 212 | $l=length($t); | ||
| 213 | $line.="$t"; | ||
| 214 | $l=4-($l+9)/8; | ||
| 215 | $line.="\t" x $l; | ||
| 216 | $line.=&conv($p2); | ||
| 217 | if ($line=~/\bxmm[0-7]\b/i) { $line=~s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i; } | ||
| 218 | push(@out,$line."\n"); | ||
| 219 | } | ||
| 220 | |||
| 221 | sub out0 | ||
| 222 | { | ||
| 223 | local($name)=@_; | ||
| 224 | |||
| 225 | push(@out,"\t$name\n"); | ||
| 226 | } | ||
| 227 | |||
| 228 | sub out1 | ||
| 229 | { | ||
| 230 | local($name,$p1)=@_; | ||
| 231 | local($l,$t); | ||
| 232 | |||
| 233 | push(@out,"\t$name\t".&conv($p1)."\n"); | ||
| 234 | } | ||
| 235 | |||
| 236 | sub conv | ||
| 237 | { | ||
| 238 | local($p)=@_; | ||
| 239 | |||
| 240 | $p =~ s/0x([0-9A-Fa-f]+)/0$1h/; | ||
| 241 | return $p; | ||
| 242 | } | ||
| 243 | |||
| 244 | sub using486 | ||
| 245 | { | ||
| 246 | return if $using486; | ||
| 247 | $using486++; | ||
| 248 | grep(s/\.386/\.486/,@out); | ||
| 249 | } | ||
| 250 | |||
| 251 | sub main'file | ||
| 252 | { | ||
| 253 | local($file)=@_; | ||
| 254 | |||
| 255 | local($tmp)=<<"EOF"; | ||
| 256 | TITLE $file.asm | ||
| 257 | .386 | ||
| 258 | .model FLAT | ||
| 259 | _TEXT\$ SEGMENT PAGE 'CODE' | ||
| 260 | |||
| 261 | EOF | ||
| 262 | push(@out,$tmp); | ||
| 263 | } | ||
| 264 | |||
| 265 | sub main'function_begin | ||
| 266 | { | ||
| 267 | local($func,$extra)=@_; | ||
| 268 | |||
| 269 | push(@labels,$func); | ||
| 270 | |||
| 271 | local($tmp)=<<"EOF"; | ||
| 272 | PUBLIC _$func | ||
| 273 | $extra | ||
| 274 | _$func PROC NEAR | ||
| 275 | push ebp | ||
| 276 | push ebx | ||
| 277 | push esi | ||
| 278 | push edi | ||
| 279 | EOF | ||
| 280 | push(@out,$tmp); | ||
| 281 | $stack=20; | ||
| 282 | } | ||
| 283 | |||
| 284 | sub main'function_begin_B | ||
| 285 | { | ||
| 286 | local($func,$extra)=@_; | ||
| 287 | |||
| 288 | local($tmp)=<<"EOF"; | ||
| 289 | PUBLIC _$func | ||
| 290 | $extra | ||
| 291 | _$func PROC NEAR | ||
| 292 | EOF | ||
| 293 | push(@out,$tmp); | ||
| 294 | $stack=4; | ||
| 295 | } | ||
| 296 | |||
| 297 | sub main'function_end | ||
| 298 | { | ||
| 299 | local($func)=@_; | ||
| 300 | |||
| 301 | local($tmp)=<<"EOF"; | ||
| 302 | pop edi | ||
| 303 | pop esi | ||
| 304 | pop ebx | ||
| 305 | pop ebp | ||
| 306 | ret | ||
| 307 | _$func ENDP | ||
| 308 | EOF | ||
| 309 | push(@out,$tmp); | ||
| 310 | $stack=0; | ||
| 311 | %label=(); | ||
| 312 | } | ||
| 313 | |||
| 314 | sub main'function_end_B | ||
| 315 | { | ||
| 316 | local($func)=@_; | ||
| 317 | |||
| 318 | local($tmp)=<<"EOF"; | ||
| 319 | _$func ENDP | ||
| 320 | EOF | ||
| 321 | push(@out,$tmp); | ||
| 322 | $stack=0; | ||
| 323 | %label=(); | ||
| 324 | } | ||
| 325 | |||
| 326 | sub main'function_end_A | ||
| 327 | { | ||
| 328 | local($func)=@_; | ||
| 329 | |||
| 330 | local($tmp)=<<"EOF"; | ||
| 331 | pop edi | ||
| 332 | pop esi | ||
| 333 | pop ebx | ||
| 334 | pop ebp | ||
| 335 | ret | ||
| 336 | EOF | ||
| 337 | push(@out,$tmp); | ||
| 338 | } | ||
| 339 | |||
| 340 | sub main'file_end | ||
| 341 | { | ||
| 342 | # try to detect if SSE2 or MMX extensions were used... | ||
| 343 | my $xmmheader=<<___; | ||
| 344 | .686 | ||
| 345 | .XMM | ||
| 346 | IF \@Version LT 800 | ||
| 347 | XMMWORD STRUCT 16 | ||
| 348 | DQ 2 dup (?) | ||
| 349 | XMMWORD ENDS | ||
| 350 | ENDIF | ||
| 351 | ___ | ||
| 352 | if (grep {/\b[x]?mm[0-7]\b/i} @out) { | ||
| 353 | grep {s/\.[3-7]86/$xmmheader/} @out; | ||
| 354 | } | ||
| 355 | push(@out,"_TEXT\$ ENDS\n"); | ||
| 356 | push(@out,"END\n"); | ||
| 357 | } | ||
| 358 | |||
| 359 | sub main'wparam | ||
| 360 | { | ||
| 361 | local($num)=@_; | ||
| 362 | |||
| 363 | return(&main'DWP($stack+$num*4,"esp","",0)); | ||
| 364 | } | ||
| 365 | |||
| 366 | sub main'swtmp | ||
| 367 | { | ||
| 368 | return(&main'DWP($_[0]*4,"esp","",0)); | ||
| 369 | } | ||
| 370 | |||
| 371 | # Should use swtmp, which is above esp. Linix can trash the stack above esp | ||
| 372 | #sub main'wtmp | ||
| 373 | # { | ||
| 374 | # local($num)=@_; | ||
| 375 | # | ||
| 376 | # return(&main'DWP(-(($num+1)*4),"esp","",0)); | ||
| 377 | # } | ||
| 378 | |||
| 379 | sub main'comment | ||
| 380 | { | ||
| 381 | foreach (@_) | ||
| 382 | { | ||
| 383 | push(@out,"\t; $_\n"); | ||
| 384 | } | ||
| 385 | } | ||
| 386 | |||
| 387 | sub main'public_label | ||
| 388 | { | ||
| 389 | $label{$_[0]}="_$_[0]" if (!defined($label{$_[0]})); | ||
| 390 | push(@out,"PUBLIC\t$label{$_[0]}\n"); | ||
| 391 | } | ||
| 392 | |||
| 393 | sub main'label | ||
| 394 | { | ||
| 395 | if (!defined($label{$_[0]})) | ||
| 396 | { | ||
| 397 | $label{$_[0]}="\$${label}${_[0]}"; | ||
| 398 | $label++; | ||
| 399 | } | ||
| 400 | return($label{$_[0]}); | ||
| 401 | } | ||
| 402 | |||
| 403 | sub main'set_label | ||
| 404 | { | ||
| 405 | if (!defined($label{$_[0]})) | ||
| 406 | { | ||
| 407 | $label{$_[0]}="\$${label}${_[0]}"; | ||
| 408 | $label++; | ||
| 409 | } | ||
| 410 | if ($_[1]!=0 && $_[1]>1) | ||
| 411 | { | ||
| 412 | main'align($_[1]); | ||
| 413 | } | ||
| 414 | if((defined $_[2]) && ($_[2] == 1)) | ||
| 415 | { | ||
| 416 | push(@out,"$label{$_[0]}::\n"); | ||
| 417 | } | ||
| 418 | elsif ($label{$_[0]} !~ /^\$/) | ||
| 419 | { | ||
| 420 | push(@out,"$label{$_[0]}\tLABEL PTR\n"); | ||
| 421 | } | ||
| 422 | else | ||
| 423 | { | ||
| 424 | push(@out,"$label{$_[0]}:\n"); | ||
| 425 | } | ||
| 426 | } | ||
| 427 | |||
| 428 | sub main'data_byte | ||
| 429 | { | ||
| 430 | push(@out,"\tDB\t".join(',',@_)."\n"); | ||
| 431 | } | ||
| 432 | |||
| 433 | sub main'data_word | ||
| 434 | { | ||
| 435 | push(@out,"\tDD\t".join(',',@_)."\n"); | ||
| 436 | } | ||
| 437 | |||
| 438 | sub main'align | ||
| 439 | { | ||
| 440 | push(@out,"\tALIGN\t$_[0]\n"); | ||
| 441 | } | ||
| 442 | |||
| 443 | sub out1p | ||
| 444 | { | ||
| 445 | local($name,$p1)=@_; | ||
| 446 | local($l,$t); | ||
| 447 | |||
| 448 | push(@out,"\t$name\t".&conv($p1)."\n"); | ||
| 449 | } | ||
| 450 | |||
| 451 | sub main'picmeup | ||
| 452 | { | ||
| 453 | local($dst,$sym)=@_; | ||
| 454 | &main'lea($dst,&main'DWP($sym)); | ||
| 455 | } | ||
| 456 | |||
| 457 | sub main'blindpop { &out1("pop",@_); } | ||
| 458 | |||
| 459 | sub main'initseg | ||
| 460 | { | ||
| 461 | local($f)=@_; | ||
| 462 | local($tmp)=<<___; | ||
| 463 | OPTION DOTNAME | ||
| 464 | .CRT\$XCU SEGMENT DWORD PUBLIC 'DATA' | ||
| 465 | EXTRN _$f:NEAR | ||
| 466 | DD _$f | ||
| 467 | .CRT\$XCU ENDS | ||
| 468 | ___ | ||
| 469 | push(@out,$tmp); | ||
| 470 | } | ||
| 471 | |||
| 472 | 1; | ||
diff --git a/src/lib/libcrypto/perlasm/x86nasm.pl b/src/lib/libcrypto/perlasm/x86nasm.pl index fa38f89c09..ce2bed9bb2 100644 --- a/src/lib/libcrypto/perlasm/x86nasm.pl +++ b/src/lib/libcrypto/perlasm/x86nasm.pl | |||
| @@ -1,455 +1,166 @@ | |||
| 1 | #!/usr/local/bin/perl | 1 | #!/usr/bin/env perl |
| 2 | 2 | ||
| 3 | package x86nasm; | 3 | package x86nasm; |
| 4 | 4 | ||
| 5 | $label="L000"; | 5 | *out=\@::out; |
| 6 | $under=($main'netware)?'':'_'; | ||
| 7 | 6 | ||
| 8 | %lb=( 'eax', 'al', | 7 | $::lbdecor="L\$"; # local label decoration |
| 9 | 'ebx', 'bl', | 8 | $nmdecor=$::netware?"":"_"; # external name decoration |
| 10 | 'ecx', 'cl', | 9 | $drdecor=$::mwerks?".":""; # directive decoration |
| 11 | 'edx', 'dl', | ||
| 12 | 'ax', 'al', | ||
| 13 | 'bx', 'bl', | ||
| 14 | 'cx', 'cl', | ||
| 15 | 'dx', 'dl', | ||
| 16 | ); | ||
| 17 | 10 | ||
| 18 | %hb=( 'eax', 'ah', | 11 | $initseg=""; |
| 19 | 'ebx', 'bh', | ||
| 20 | 'ecx', 'ch', | ||
| 21 | 'edx', 'dh', | ||
| 22 | 'ax', 'ah', | ||
| 23 | 'bx', 'bh', | ||
| 24 | 'cx', 'ch', | ||
| 25 | 'dx', 'dh', | ||
| 26 | ); | ||
| 27 | 12 | ||
| 28 | sub main'asm_init_output { @out=(); } | 13 | sub ::generic |
| 29 | sub main'asm_get_output { return(@out); } | 14 | { my $opcode=shift; |
| 30 | sub main'get_labels { return(@labels); } | 15 | my $tmp; |
| 31 | 16 | ||
| 32 | sub main'external_label | 17 | if (!$::mwerks) |
| 33 | { | 18 | { if ($opcode =~ m/^j/o && $#_==0) # optimize jumps |
| 34 | push(@labels,@_); | 19 | { $_[0] = "NEAR $_[0]"; } |
| 35 | foreach (@_) { | 20 | elsif ($opcode eq "lea" && $#_==1) # wipe storage qualifier from lea |
| 36 | push(@out,".") if ($main'mwerks); | 21 | { $_[1] =~ s/^[^\[]*\[/\[/o; } |
| 37 | push(@out, "extern\t${under}$_\n"); | 22 | } |
| 38 | } | 23 | &::emit($opcode,@_); |
| 24 | 1; | ||
| 39 | } | 25 | } |
| 40 | 26 | # | |
| 41 | sub main'LB | 27 | # opcodes not covered by ::generic above, mostly inconsistent namings... |
| 42 | { | 28 | # |
| 43 | (defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n"; | 29 | sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); } |
| 44 | return($lb{$_[0]}); | 30 | sub ::call_ptr { &::emit("call",@_); } |
| 45 | } | 31 | sub ::jmp_ptr { &::emit("jmp",@_); } |
| 46 | |||
| 47 | sub main'HB | ||
| 48 | { | ||
| 49 | (defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n"; | ||
| 50 | return($hb{$_[0]}); | ||
| 51 | } | ||
| 52 | |||
| 53 | sub main'BP | ||
| 54 | { | ||
| 55 | &get_mem("BYTE",@_); | ||
| 56 | } | ||
| 57 | |||
| 58 | sub main'DWP | ||
| 59 | { | ||
| 60 | &get_mem("DWORD",@_); | ||
| 61 | } | ||
| 62 | |||
| 63 | sub main'QWP | ||
| 64 | { | ||
| 65 | &get_mem("",@_); | ||
| 66 | } | ||
| 67 | |||
| 68 | sub main'BC | ||
| 69 | { | ||
| 70 | return (($main'mwerks)?"":"BYTE ")."@_"; | ||
| 71 | } | ||
| 72 | |||
| 73 | sub main'DWC | ||
| 74 | { | ||
| 75 | return (($main'mwerks)?"":"DWORD ")."@_"; | ||
| 76 | } | ||
| 77 | |||
| 78 | sub main'stack_push | ||
| 79 | { | ||
| 80 | my($num)=@_; | ||
| 81 | $stack+=$num*4; | ||
| 82 | &main'sub("esp",$num*4); | ||
| 83 | } | ||
| 84 | |||
| 85 | sub main'stack_pop | ||
| 86 | { | ||
| 87 | my($num)=@_; | ||
| 88 | $stack-=$num*4; | ||
| 89 | &main'add("esp",$num*4); | ||
| 90 | } | ||
| 91 | 32 | ||
| 92 | sub get_mem | 33 | sub get_mem |
| 93 | { | 34 | { my($size,$addr,$reg1,$reg2,$idx)=@_; |
| 94 | my($size,$addr,$reg1,$reg2,$idx)=@_; | 35 | my($post,$ret); |
| 95 | my($t,$post); | 36 | |
| 96 | my($ret)=$size; | 37 | if ($size ne "") |
| 97 | if ($ret ne "") | 38 | { $ret .= "$size"; |
| 98 | { | 39 | $ret .= " PTR" if ($::mwerks); |
| 99 | $ret .= " PTR" if ($main'mwerks); | 40 | $ret .= " "; |
| 100 | $ret .= " "; | 41 | } |
| 101 | } | 42 | $ret .= "["; |
| 102 | $ret .= "["; | 43 | |
| 103 | $addr =~ s/^\s+//; | 44 | $addr =~ s/^\s+//; |
| 104 | if ($addr =~ /^(.+)\+(.+)$/) | 45 | # prepend global references with optional underscore |
| 105 | { | 46 | $addr =~ s/^([^\+\-0-9][^\+\-]*)/::islabel($1) or "$nmdecor$1"/ige; |
| 106 | $reg2=&conv($1); | 47 | # put address arithmetic expression in parenthesis |
| 107 | $addr="$under$2"; | 48 | $addr="($addr)" if ($addr =~ /^.+[\-\+].+$/); |
| 108 | } | 49 | |
| 109 | elsif ($addr =~ /^[_a-z][_a-z0-9]*$/i) | 50 | if (($addr ne "") && ($addr ne 0)) |
| 110 | { | 51 | { if ($addr !~ /^-/) { $ret .= "$addr+"; } |
| 111 | $addr="$under$addr"; | 52 | else { $post=$addr; } |
| 112 | } | 53 | } |
| 113 | 54 | ||
| 114 | if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; } | 55 | if ($reg2 ne "") |
| 115 | 56 | { $idx!=0 or $idx=1; | |
| 116 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); | 57 | $ret .= "$reg2*$idx"; |
| 117 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); | 58 | $ret .= "+$reg1" if ($reg1 ne ""); |
| 118 | if (($addr ne "") && ($addr ne 0)) | 59 | } |
| 119 | { | 60 | else |
| 120 | if ($addr !~ /^-/) | 61 | { $ret .= "$reg1"; } |
| 121 | { $ret.="${addr}+"; } | 62 | |
| 122 | else { $post=$addr; } | 63 | $ret .= "$post]"; |
| 123 | } | 64 | $ret =~ s/\+\]/]/; # in case $addr was the only argument |
| 124 | if ($reg2 ne "") | 65 | |
| 125 | { | 66 | $ret; |
| 126 | $t=""; | 67 | } |
| 127 | $t="*$idx" if ($idx != 0); | 68 | sub ::BP { &get_mem("BYTE",@_); } |
| 128 | $reg1="+".$reg1 if ("$reg1$post" ne ""); | 69 | sub ::DWP { &get_mem("DWORD",@_); } |
| 129 | $ret.="$reg2$t$reg1$post]"; | 70 | sub ::QWP { &get_mem("",@_); } |
| 130 | } | 71 | sub ::BC { (($::mwerks)?"":"BYTE ")."@_"; } |
| 131 | else | 72 | sub ::DWC { (($::mwerks)?"":"DWORD ")."@_"; } |
| 132 | { | 73 | |
| 133 | $ret.="$reg1$post]" | 74 | sub ::file |
| 134 | } | 75 | { if ($::mwerks) { push(@out,".section\t.text,64\n"); } |
| 135 | $ret =~ s/\+\]/]/; # in case $addr was the only argument | 76 | else |
| 136 | return($ret); | 77 | { my $tmp=<<___; |
| 137 | } | 78 | %ifidn __OUTPUT_FORMAT__,obj |
| 138 | 79 | section code use32 class=code align=64 | |
| 139 | sub main'mov { &out2("mov",@_); } | 80 | %elifidn __OUTPUT_FORMAT__,win32 |
| 140 | sub main'movb { &out2("mov",@_); } | 81 | \$\@feat.00 equ 1 |
| 141 | sub main'and { &out2("and",@_); } | 82 | section .text code align=64 |
| 142 | sub main'or { &out2("or",@_); } | ||
| 143 | sub main'shl { &out2("shl",@_); } | ||
| 144 | sub main'shr { &out2("shr",@_); } | ||
| 145 | sub main'xor { &out2("xor",@_); } | ||
| 146 | sub main'xorb { &out2("xor",@_); } | ||
| 147 | sub main'add { &out2("add",@_); } | ||
| 148 | sub main'adc { &out2("adc",@_); } | ||
| 149 | sub main'sub { &out2("sub",@_); } | ||
| 150 | sub main'sbb { &out2("sbb",@_); } | ||
| 151 | sub main'rotl { &out2("rol",@_); } | ||
| 152 | sub main'rotr { &out2("ror",@_); } | ||
| 153 | sub main'exch { &out2("xchg",@_); } | ||
| 154 | sub main'cmp { &out2("cmp",@_); } | ||
| 155 | sub main'lea { &out2("lea",@_); } | ||
| 156 | sub main'mul { &out1("mul",@_); } | ||
| 157 | sub main'imul { &out2("imul",@_); } | ||
| 158 | sub main'div { &out1("div",@_); } | ||
| 159 | sub main'dec { &out1("dec",@_); } | ||
| 160 | sub main'inc { &out1("inc",@_); } | ||
| 161 | sub main'jmp { &out1("jmp",@_); } | ||
| 162 | sub main'jmp_ptr { &out1p("jmp",@_); } | ||
| 163 | |||
| 164 | # This is a bit of a kludge: declare all branches as NEAR. | ||
| 165 | $near=($main'mwerks)?'':'NEAR'; | ||
| 166 | sub main'je { &out1("je $near",@_); } | ||
| 167 | sub main'jle { &out1("jle $near",@_); } | ||
| 168 | sub main'jz { &out1("jz $near",@_); } | ||
| 169 | sub main'jge { &out1("jge $near",@_); } | ||
| 170 | sub main'jl { &out1("jl $near",@_); } | ||
| 171 | sub main'ja { &out1("ja $near",@_); } | ||
| 172 | sub main'jae { &out1("jae $near",@_); } | ||
| 173 | sub main'jb { &out1("jb $near",@_); } | ||
| 174 | sub main'jbe { &out1("jbe $near",@_); } | ||
| 175 | sub main'jc { &out1("jc $near",@_); } | ||
| 176 | sub main'jnc { &out1("jnc $near",@_); } | ||
| 177 | sub main'jnz { &out1("jnz $near",@_); } | ||
| 178 | sub main'jne { &out1("jne $near",@_); } | ||
| 179 | sub main'jno { &out1("jno $near",@_); } | ||
| 180 | |||
| 181 | sub main'push { &out1("push",@_); $stack+=4; } | ||
| 182 | sub main'pop { &out1("pop",@_); $stack-=4; } | ||
| 183 | sub main'pushf { &out0("pushfd"); $stack+=4; } | ||
| 184 | sub main'popf { &out0("popfd"); $stack-=4; } | ||
| 185 | sub main'bswap { &out1("bswap",@_); &using486(); } | ||
| 186 | sub main'not { &out1("not",@_); } | ||
| 187 | sub main'call { &out1("call",($_[0]=~/^\@L/?'':$under).$_[0]); } | ||
| 188 | sub main'call_ptr { &out1p("call",@_); } | ||
| 189 | sub main'ret { &out0("ret"); } | ||
| 190 | sub main'nop { &out0("nop"); } | ||
| 191 | sub main'test { &out2("test",@_); } | ||
| 192 | sub main'bt { &out2("bt",@_); } | ||
| 193 | sub main'leave { &out0("leave"); } | ||
| 194 | sub main'cpuid { &out0("cpuid"); } | ||
| 195 | sub main'rdtsc { &out0("rdtsc"); } | ||
| 196 | sub main'halt { &out0("hlt"); } | ||
| 197 | sub main'movz { &out2("movzx",@_); } | ||
| 198 | sub main'neg { &out1("neg",@_); } | ||
| 199 | sub main'cld { &out0("cld"); } | ||
| 200 | |||
| 201 | # SSE2 | ||
| 202 | sub main'emms { &out0("emms"); } | ||
| 203 | sub main'movd { &out2("movd",@_); } | ||
| 204 | sub main'movq { &out2("movq",@_); } | ||
| 205 | sub main'movdqu { &out2("movdqu",@_); } | ||
| 206 | sub main'movdqa { &out2("movdqa",@_); } | ||
| 207 | sub main'movdq2q{ &out2("movdq2q",@_); } | ||
| 208 | sub main'movq2dq{ &out2("movq2dq",@_); } | ||
| 209 | sub main'paddq { &out2("paddq",@_); } | ||
| 210 | sub main'pmuludq{ &out2("pmuludq",@_); } | ||
| 211 | sub main'psrlq { &out2("psrlq",@_); } | ||
| 212 | sub main'psllq { &out2("psllq",@_); } | ||
| 213 | sub main'pxor { &out2("pxor",@_); } | ||
| 214 | sub main'por { &out2("por",@_); } | ||
| 215 | sub main'pand { &out2("pand",@_); } | ||
| 216 | |||
| 217 | sub out2 | ||
| 218 | { | ||
| 219 | my($name,$p1,$p2)=@_; | ||
| 220 | my($l,$t); | ||
| 221 | |||
| 222 | push(@out,"\t$name\t"); | ||
| 223 | if (!$main'mwerks and $name eq "lea") | ||
| 224 | { | ||
| 225 | $p1 =~ s/^[^\[]*\[/\[/; | ||
| 226 | $p2 =~ s/^[^\[]*\[/\[/; | ||
| 227 | } | ||
| 228 | $t=&conv($p1).","; | ||
| 229 | $l=length($t); | ||
| 230 | push(@out,$t); | ||
| 231 | $l=4-($l+9)/8; | ||
| 232 | push(@out,"\t" x $l); | ||
| 233 | push(@out,&conv($p2)); | ||
| 234 | push(@out,"\n"); | ||
| 235 | } | ||
| 236 | |||
| 237 | sub out0 | ||
| 238 | { | ||
| 239 | my($name)=@_; | ||
| 240 | |||
| 241 | push(@out,"\t$name\n"); | ||
| 242 | } | ||
| 243 | |||
| 244 | sub out1 | ||
| 245 | { | ||
| 246 | my($name,$p1)=@_; | ||
| 247 | my($l,$t); | ||
| 248 | push(@out,"\t$name\t".&conv($p1)."\n"); | ||
| 249 | } | ||
| 250 | |||
| 251 | sub conv | ||
| 252 | { | ||
| 253 | my($p)=@_; | ||
| 254 | $p =~ s/0x([0-9A-Fa-f]+)/0$1h/; | ||
| 255 | return $p; | ||
| 256 | } | ||
| 257 | |||
| 258 | sub using486 | ||
| 259 | { | ||
| 260 | return if $using486; | ||
| 261 | $using486++; | ||
| 262 | grep(s/\.386/\.486/,@out); | ||
| 263 | } | ||
| 264 | |||
| 265 | sub main'file | ||
| 266 | { | ||
| 267 | if ($main'mwerks) { push(@out,".section\t.text\n"); } | ||
| 268 | else { | ||
| 269 | local $tmp=<<___; | ||
| 270 | %ifdef __omf__ | ||
| 271 | section code use32 class=code | ||
| 272 | %else | 83 | %else |
| 273 | section .text | 84 | section .text code |
| 274 | %endif | 85 | %endif |
| 275 | ___ | 86 | ___ |
| 276 | push(@out,$tmp); | ||
| 277 | } | ||
| 278 | } | ||
| 279 | |||
| 280 | sub main'function_begin | ||
| 281 | { | ||
| 282 | my($func,$extra)=@_; | ||
| 283 | |||
| 284 | push(@labels,$func); | ||
| 285 | push(@out,".") if ($main'mwerks); | ||
| 286 | my($tmp)=<<"EOF"; | ||
| 287 | global $under$func | ||
| 288 | $under$func: | ||
| 289 | push ebp | ||
| 290 | push ebx | ||
| 291 | push esi | ||
| 292 | push edi | ||
| 293 | EOF | ||
| 294 | push(@out,$tmp); | ||
| 295 | $stack=20; | ||
| 296 | } | ||
| 297 | |||
| 298 | sub main'function_begin_B | ||
| 299 | { | ||
| 300 | my($func,$extra)=@_; | ||
| 301 | push(@out,".") if ($main'mwerks); | ||
| 302 | my($tmp)=<<"EOF"; | ||
| 303 | global $under$func | ||
| 304 | $under$func: | ||
| 305 | EOF | ||
| 306 | push(@out,$tmp); | ||
| 307 | $stack=4; | ||
| 308 | } | ||
| 309 | |||
| 310 | sub main'function_end | ||
| 311 | { | ||
| 312 | my($func)=@_; | ||
| 313 | |||
| 314 | my($tmp)=<<"EOF"; | ||
| 315 | pop edi | ||
| 316 | pop esi | ||
| 317 | pop ebx | ||
| 318 | pop ebp | ||
| 319 | ret | ||
| 320 | EOF | ||
| 321 | push(@out,$tmp); | 87 | push(@out,$tmp); |
| 322 | $stack=0; | 88 | } |
| 323 | %label=(); | 89 | } |
| 324 | } | ||
| 325 | |||
| 326 | sub main'function_end_B | ||
| 327 | { | ||
| 328 | $stack=0; | ||
| 329 | %label=(); | ||
| 330 | } | ||
| 331 | |||
| 332 | sub main'function_end_A | ||
| 333 | { | ||
| 334 | my($func)=@_; | ||
| 335 | |||
| 336 | my($tmp)=<<"EOF"; | ||
| 337 | pop edi | ||
| 338 | pop esi | ||
| 339 | pop ebx | ||
| 340 | pop ebp | ||
| 341 | ret | ||
| 342 | EOF | ||
| 343 | push(@out,$tmp); | ||
| 344 | } | ||
| 345 | |||
| 346 | sub main'file_end | ||
| 347 | { | ||
| 348 | } | ||
| 349 | |||
| 350 | sub main'wparam | ||
| 351 | { | ||
| 352 | my($num)=@_; | ||
| 353 | |||
| 354 | return(&main'DWP($stack+$num*4,"esp","",0)); | ||
| 355 | } | ||
| 356 | 90 | ||
| 357 | sub main'swtmp | 91 | sub ::function_begin_B |
| 358 | { | 92 | { my $func=shift; |
| 359 | return(&main'DWP($_[0]*4,"esp","",0)); | 93 | my $global=($func !~ /^_/); |
| 360 | } | 94 | my $begin="${::lbdecor}_${func}_begin"; |
| 361 | 95 | ||
| 362 | # Should use swtmp, which is above esp. Linix can trash the stack above esp | 96 | $begin =~ s/^\@/./ if ($::mwerks); # the torture never stops |
| 363 | #sub main'wtmp | ||
| 364 | # { | ||
| 365 | # my($num)=@_; | ||
| 366 | # | ||
| 367 | # return(&main'DWP(-(($num+1)*4),"esp","",0)); | ||
| 368 | # } | ||
| 369 | 97 | ||
| 370 | sub main'comment | 98 | &::LABEL($func,$global?"$begin":"$nmdecor$func"); |
| 371 | { | 99 | $func=$nmdecor.$func; |
| 372 | foreach (@_) | ||
| 373 | { | ||
| 374 | push(@out,"\t; $_\n"); | ||
| 375 | } | ||
| 376 | } | ||
| 377 | 100 | ||
| 378 | sub main'public_label | 101 | push(@out,"${drdecor}global $func\n") if ($global); |
| 379 | { | 102 | push(@out,"${drdecor}align 16\n"); |
| 380 | $label{$_[0]}="${under}${_[0]}" if (!defined($label{$_[0]})); | 103 | push(@out,"$func:\n"); |
| 381 | push(@out,".") if ($main'mwerks); | 104 | push(@out,"$begin:\n") if ($global); |
| 382 | push(@out,"global\t$label{$_[0]}\n"); | 105 | $::stack=4; |
| 383 | } | 106 | } |
| 384 | 107 | ||
| 385 | sub main'label | 108 | sub ::function_end_B |
| 386 | { | 109 | { $::stack=0; |
| 387 | if (!defined($label{$_[0]})) | 110 | &::wipe_labels(); |
| 388 | { | 111 | } |
| 389 | $label{$_[0]}="\@${label}${_[0]}"; | ||
| 390 | $label++; | ||
| 391 | } | ||
| 392 | return($label{$_[0]}); | ||
| 393 | } | ||
| 394 | 112 | ||
| 395 | sub main'set_label | 113 | sub ::file_end |
| 396 | { | 114 | { if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) |
| 397 | if (!defined($label{$_[0]})) | 115 | { my $comm=<<___; |
| 398 | { | 116 | ${drdecor}segment .bss |
| 399 | $label{$_[0]}="\@${label}${_[0]}"; | 117 | ${drdecor}common ${nmdecor}OPENSSL_ia32cap_P 4 |
| 400 | $label++; | 118 | ___ |
| 401 | } | 119 | # comment out OPENSSL_ia32cap_P declarations |
| 402 | if ($_[1]!=0 && $_[1]>1) | 120 | grep {s/(^extern\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out; |
| 403 | { | 121 | push (@out,$comm) |
| 404 | main'align($_[1]); | 122 | } |
| 405 | } | 123 | push (@out,$initseg) if ($initseg); |
| 406 | push(@out,"$label{$_[0]}:\n"); | 124 | } |
| 407 | } | ||
| 408 | 125 | ||
| 409 | sub main'data_byte | 126 | sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } } |
| 410 | { | ||
| 411 | push(@out,(($main'mwerks)?".byte\t":"DB\t").join(',',@_)."\n"); | ||
| 412 | } | ||
| 413 | 127 | ||
| 414 | sub main'data_word | 128 | sub ::external_label |
| 415 | { | 129 | { foreach(@_) |
| 416 | push(@out,(($main'mwerks)?".long\t":"DD\t").join(',',@_)."\n"); | 130 | { push(@out,"${drdecor}extern\t".&::LABEL($_,$nmdecor.$_)."\n"); } |
| 417 | } | 131 | } |
| 418 | 132 | ||
| 419 | sub main'align | 133 | sub ::public_label |
| 420 | { | 134 | { push(@out,"${drdecor}global\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); } |
| 421 | push(@out,".") if ($main'mwerks); | ||
| 422 | push(@out,"align\t$_[0]\n"); | ||
| 423 | } | ||
| 424 | 135 | ||
| 425 | sub out1p | 136 | sub ::data_byte |
| 426 | { | 137 | { push(@out,(($::mwerks)?".byte\t":"db\t").join(',',@_)."\n"); } |
| 427 | my($name,$p1)=@_; | ||
| 428 | my($l,$t); | ||
| 429 | 138 | ||
| 430 | push(@out,"\t$name\t".&conv($p1)."\n"); | 139 | sub ::data_word |
| 431 | } | 140 | { push(@out,(($::mwerks)?".long\t":"dd\t").join(',',@_)."\n"); } |
| 432 | 141 | ||
| 433 | sub main'picmeup | 142 | sub ::align |
| 434 | { | 143 | { push(@out,"${drdecor}align\t$_[0]\n"); } |
| 435 | local($dst,$sym)=@_; | ||
| 436 | &main'lea($dst,&main'DWP($sym)); | ||
| 437 | } | ||
| 438 | 144 | ||
| 439 | sub main'blindpop { &out1("pop",@_); } | 145 | sub ::picmeup |
| 146 | { my($dst,$sym)=@_; | ||
| 147 | &::lea($dst,&::DWP($sym)); | ||
| 148 | } | ||
| 440 | 149 | ||
| 441 | sub main'initseg | 150 | sub ::initseg |
| 442 | { | 151 | { my $f=$nmdecor.shift; |
| 443 | local($f)=@_; | 152 | if ($::win32) |
| 444 | if ($main'win32) | 153 | { $initseg=<<___; |
| 445 | { | 154 | segment .CRT\$XCU data align=4 |
| 446 | local($tmp)=<<___; | 155 | extern $f |
| 447 | segment .CRT\$XCU data | 156 | dd $f |
| 448 | extern $under$f | ||
| 449 | DD $under$f | ||
| 450 | ___ | 157 | ___ |
| 451 | push(@out,$tmp); | 158 | } |
| 452 | } | 159 | } |
| 453 | } | 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 | } | ||
| 454 | 165 | ||
| 455 | 1; | 166 | 1; |
diff --git a/src/lib/libcrypto/perlasm/x86unix.pl b/src/lib/libcrypto/perlasm/x86unix.pl deleted file mode 100644 index ae8f0964dc..0000000000 --- a/src/lib/libcrypto/perlasm/x86unix.pl +++ /dev/null | |||
| @@ -1,808 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | package x86unix; # GAS actually... | ||
| 4 | |||
| 5 | $label="L000"; | ||
| 6 | $const=""; | ||
| 7 | $constl=0; | ||
| 8 | |||
| 9 | $align=($main'aout)?"4":"16"; | ||
| 10 | $under=($main'aout or $main'coff)?"_":""; | ||
| 11 | $dot=($main'aout)?"":"."; | ||
| 12 | $com_start="#" if ($main'aout or $main'coff); | ||
| 13 | |||
| 14 | sub main'asm_init_output { @out=(); } | ||
| 15 | sub main'asm_get_output { return(@out); } | ||
| 16 | sub main'get_labels { return(@labels); } | ||
| 17 | sub main'external_label { push(@labels,@_); } | ||
| 18 | |||
| 19 | if ($main'openbsd) | ||
| 20 | { | ||
| 21 | $com_start='/*'; | ||
| 22 | $com_end='*/'; | ||
| 23 | } | ||
| 24 | |||
| 25 | if ($main'cpp) | ||
| 26 | { | ||
| 27 | $align="ALIGN"; | ||
| 28 | $under=""; | ||
| 29 | $com_start='/*'; | ||
| 30 | $com_end='*/'; | ||
| 31 | } | ||
| 32 | |||
| 33 | %lb=( 'eax', '%al', | ||
| 34 | 'ebx', '%bl', | ||
| 35 | 'ecx', '%cl', | ||
| 36 | 'edx', '%dl', | ||
| 37 | 'ax', '%al', | ||
| 38 | 'bx', '%bl', | ||
| 39 | 'cx', '%cl', | ||
| 40 | 'dx', '%dl', | ||
| 41 | ); | ||
| 42 | |||
| 43 | %hb=( 'eax', '%ah', | ||
| 44 | 'ebx', '%bh', | ||
| 45 | 'ecx', '%ch', | ||
| 46 | 'edx', '%dh', | ||
| 47 | 'ax', '%ah', | ||
| 48 | 'bx', '%bh', | ||
| 49 | 'cx', '%ch', | ||
| 50 | 'dx', '%dh', | ||
| 51 | ); | ||
| 52 | |||
| 53 | %regs=( 'eax', '%eax', | ||
| 54 | 'ebx', '%ebx', | ||
| 55 | 'ecx', '%ecx', | ||
| 56 | 'edx', '%edx', | ||
| 57 | 'esi', '%esi', | ||
| 58 | 'edi', '%edi', | ||
| 59 | 'ebp', '%ebp', | ||
| 60 | 'esp', '%esp', | ||
| 61 | |||
| 62 | 'mm0', '%mm0', | ||
| 63 | 'mm1', '%mm1', | ||
| 64 | 'mm2', '%mm2', | ||
| 65 | 'mm3', '%mm3', | ||
| 66 | 'mm4', '%mm4', | ||
| 67 | 'mm5', '%mm5', | ||
| 68 | 'mm6', '%mm6', | ||
| 69 | 'mm7', '%mm7', | ||
| 70 | |||
| 71 | 'xmm0', '%xmm0', | ||
| 72 | 'xmm1', '%xmm1', | ||
| 73 | 'xmm2', '%xmm2', | ||
| 74 | 'xmm3', '%xmm3', | ||
| 75 | 'xmm4', '%xmm4', | ||
| 76 | 'xmm5', '%xmm5', | ||
| 77 | 'xmm6', '%xmm6', | ||
| 78 | 'xmm7', '%xmm7', | ||
| 79 | ); | ||
| 80 | |||
| 81 | %reg_val=( | ||
| 82 | 'eax', 0x00, | ||
| 83 | 'ebx', 0x03, | ||
| 84 | 'ecx', 0x01, | ||
| 85 | 'edx', 0x02, | ||
| 86 | 'esi', 0x06, | ||
| 87 | 'edi', 0x07, | ||
| 88 | 'ebp', 0x05, | ||
| 89 | 'esp', 0x04, | ||
| 90 | ); | ||
| 91 | |||
| 92 | sub main'LB | ||
| 93 | { | ||
| 94 | (defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n"; | ||
| 95 | return($lb{$_[0]}); | ||
| 96 | } | ||
| 97 | |||
| 98 | sub main'HB | ||
| 99 | { | ||
| 100 | (defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n"; | ||
| 101 | return($hb{$_[0]}); | ||
| 102 | } | ||
| 103 | |||
| 104 | sub main'DWP | ||
| 105 | { | ||
| 106 | local($addr,$reg1,$reg2,$idx)=@_; | ||
| 107 | |||
| 108 | $ret=""; | ||
| 109 | $addr =~ s/(^|[+ \t])([A-Za-z_]+[A-Za-z0-9_]+)($|[+ \t])/$1$under$2$3/; | ||
| 110 | $reg1="$regs{$reg1}" if defined($regs{$reg1}); | ||
| 111 | $reg2="$regs{$reg2}" if defined($regs{$reg2}); | ||
| 112 | $ret.=$addr if ($addr ne "") && ($addr ne 0); | ||
| 113 | if ($reg2 ne "") | ||
| 114 | { | ||
| 115 | if($idx ne "" && $idx != 0) | ||
| 116 | { $ret.="($reg1,$reg2,$idx)"; } | ||
| 117 | else | ||
| 118 | { $ret.="($reg1,$reg2)"; } | ||
| 119 | } | ||
| 120 | elsif ($reg1 ne "") | ||
| 121 | { $ret.="($reg1)" } | ||
| 122 | return($ret); | ||
| 123 | } | ||
| 124 | |||
| 125 | sub main'QWP | ||
| 126 | { | ||
| 127 | return(&main'DWP(@_)); | ||
| 128 | } | ||
| 129 | |||
| 130 | sub main'BP | ||
| 131 | { | ||
| 132 | return(&main'DWP(@_)); | ||
| 133 | } | ||
| 134 | |||
| 135 | sub main'BC | ||
| 136 | { | ||
| 137 | return @_; | ||
| 138 | } | ||
| 139 | |||
| 140 | sub main'DWC | ||
| 141 | { | ||
| 142 | return @_; | ||
| 143 | } | ||
| 144 | |||
| 145 | #sub main'BP | ||
| 146 | # { | ||
| 147 | # local($addr,$reg1,$reg2,$idx)=@_; | ||
| 148 | # | ||
| 149 | # $ret=""; | ||
| 150 | # | ||
| 151 | # $addr =~ s/(^|[+ \t])([A-Za-z_]+)($|[+ \t])/$1$under$2$3/; | ||
| 152 | # $reg1="$regs{$reg1}" if defined($regs{$reg1}); | ||
| 153 | # $reg2="$regs{$reg2}" if defined($regs{$reg2}); | ||
| 154 | # $ret.=$addr if ($addr ne "") && ($addr ne 0); | ||
| 155 | # if ($reg2 ne "") | ||
| 156 | # { $ret.="($reg1,$reg2,$idx)"; } | ||
| 157 | # else | ||
| 158 | # { $ret.="($reg1)" } | ||
| 159 | # return($ret); | ||
| 160 | # } | ||
| 161 | |||
| 162 | sub main'mov { &out2("movl",@_); } | ||
| 163 | sub main'movb { &out2("movb",@_); } | ||
| 164 | sub main'and { &out2("andl",@_); } | ||
| 165 | sub main'or { &out2("orl",@_); } | ||
| 166 | sub main'shl { &out2("sall",@_); } | ||
| 167 | sub main'shr { &out2("shrl",@_); } | ||
| 168 | sub main'xor { &out2("xorl",@_); } | ||
| 169 | sub main'xorb { &out2("xorb",@_); } | ||
| 170 | sub main'add { &out2($_[0]=~/%[a-d][lh]/?"addb":"addl",@_); } | ||
| 171 | sub main'adc { &out2("adcl",@_); } | ||
| 172 | sub main'sub { &out2("subl",@_); } | ||
| 173 | sub main'sbb { &out2("sbbl",@_); } | ||
| 174 | sub main'rotl { &out2("roll",@_); } | ||
| 175 | sub main'rotr { &out2("rorl",@_); } | ||
| 176 | sub main'exch { &out2($_[0]=~/%[a-d][lh]/?"xchgb":"xchgl",@_); } | ||
| 177 | sub main'cmp { &out2("cmpl",@_); } | ||
| 178 | sub main'lea { &out2("leal",@_); } | ||
| 179 | sub main'mul { &out1("mull",@_); } | ||
| 180 | sub main'imul { &out2("imull",@_); } | ||
| 181 | sub main'div { &out1("divl",@_); } | ||
| 182 | sub main'jmp { &out1("jmp",@_); } | ||
| 183 | sub main'jmp_ptr { &out1p("jmp",@_); } | ||
| 184 | sub main'je { &out1("je",@_); } | ||
| 185 | sub main'jle { &out1("jle",@_); } | ||
| 186 | sub main'jne { &out1("jne",@_); } | ||
| 187 | sub main'jnz { &out1("jnz",@_); } | ||
| 188 | sub main'jz { &out1("jz",@_); } | ||
| 189 | sub main'jge { &out1("jge",@_); } | ||
| 190 | sub main'jl { &out1("jl",@_); } | ||
| 191 | sub main'ja { &out1("ja",@_); } | ||
| 192 | sub main'jae { &out1("jae",@_); } | ||
| 193 | sub main'jb { &out1("jb",@_); } | ||
| 194 | sub main'jbe { &out1("jbe",@_); } | ||
| 195 | sub main'jc { &out1("jc",@_); } | ||
| 196 | sub main'jnc { &out1("jnc",@_); } | ||
| 197 | sub main'jno { &out1("jno",@_); } | ||
| 198 | sub main'dec { &out1("decl",@_); } | ||
| 199 | sub main'inc { &out1($_[0]=~/%[a-d][hl]/?"incb":"incl",@_); } | ||
| 200 | sub main'push { &out1("pushl",@_); $stack+=4; } | ||
| 201 | sub main'pop { &out1("popl",@_); $stack-=4; } | ||
| 202 | sub main'pushf { &out0("pushfl"); $stack+=4; } | ||
| 203 | sub main'popf { &out0("popfl"); $stack-=4; } | ||
| 204 | sub main'not { &out1("notl",@_); } | ||
| 205 | sub main'call { my $pre=$under; | ||
| 206 | foreach $i (%label) | ||
| 207 | { if ($label{$i} eq $_[0]) { $pre=''; last; } } | ||
| 208 | &out1("call",$pre.$_[0]); | ||
| 209 | } | ||
| 210 | sub main'call_ptr { &out1p("call",@_); } | ||
| 211 | sub main'ret { &out0("ret"); } | ||
| 212 | sub main'nop { &out0("nop"); } | ||
| 213 | sub main'test { &out2("testl",@_); } | ||
| 214 | sub main'bt { &out2("btl",@_); } | ||
| 215 | sub main'leave { &out0("leave"); } | ||
| 216 | sub main'cpuid { &out0(".byte\t0x0f,0xa2"); } | ||
| 217 | sub main'rdtsc { &out0(".byte\t0x0f,0x31"); } | ||
| 218 | sub main'halt { &out0("hlt"); } | ||
| 219 | sub main'movz { &out2("movzbl",@_); } | ||
| 220 | sub main'neg { &out1("negl",@_); } | ||
| 221 | sub main'cld { &out0("cld"); } | ||
| 222 | |||
| 223 | # SSE2 | ||
| 224 | sub main'emms { &out0("emms"); } | ||
| 225 | sub main'movd { &out2("movd",@_); } | ||
| 226 | sub main'movdqu { &out2("movdqu",@_); } | ||
| 227 | sub main'movdqa { &out2("movdqa",@_); } | ||
| 228 | sub main'movdq2q{ &out2("movdq2q",@_); } | ||
| 229 | sub main'movq2dq{ &out2("movq2dq",@_); } | ||
| 230 | sub main'paddq { &out2("paddq",@_); } | ||
| 231 | sub main'pmuludq{ &out2("pmuludq",@_); } | ||
| 232 | sub main'psrlq { &out2("psrlq",@_); } | ||
| 233 | sub main'psllq { &out2("psllq",@_); } | ||
| 234 | sub main'pxor { &out2("pxor",@_); } | ||
| 235 | sub main'por { &out2("por",@_); } | ||
| 236 | sub main'pand { &out2("pand",@_); } | ||
| 237 | sub main'movq { | ||
| 238 | local($p1,$p2,$optimize)=@_; | ||
| 239 | if ($optimize && $p1=~/^mm[0-7]$/ && $p2=~/^mm[0-7]$/) | ||
| 240 | # movq between mmx registers can sink Intel CPUs | ||
| 241 | { push(@out,"\tpshufw\t\$0xe4,%$p2,%$p1\n"); } | ||
| 242 | else { &out2("movq",@_); } | ||
| 243 | } | ||
| 244 | |||
| 245 | # The bswapl instruction is new for the 486. Emulate if i386. | ||
| 246 | sub main'bswap | ||
| 247 | { | ||
| 248 | if ($main'i386) | ||
| 249 | { | ||
| 250 | &main'comment("bswapl @_"); | ||
| 251 | &main'exch(main'HB(@_),main'LB(@_)); | ||
| 252 | &main'rotr(@_,16); | ||
| 253 | &main'exch(main'HB(@_),main'LB(@_)); | ||
| 254 | } | ||
| 255 | else | ||
| 256 | { | ||
| 257 | &out1("bswapl",@_); | ||
| 258 | } | ||
| 259 | } | ||
| 260 | |||
| 261 | sub out2 | ||
| 262 | { | ||
| 263 | local($name,$p1,$p2)=@_; | ||
| 264 | local($l,$ll,$t); | ||
| 265 | local(%special)=( "roll",0xD1C0,"rorl",0xD1C8, | ||
| 266 | "rcll",0xD1D0,"rcrl",0xD1D8, | ||
| 267 | "shll",0xD1E0,"shrl",0xD1E8, | ||
| 268 | "sarl",0xD1F8); | ||
| 269 | |||
| 270 | if ((defined($special{$name})) && defined($regs{$p1}) && ($p2 == 1)) | ||
| 271 | { | ||
| 272 | $op=$special{$name}|$reg_val{$p1}; | ||
| 273 | $tmp1=sprintf(".byte %d\n",($op>>8)&0xff); | ||
| 274 | $tmp2=sprintf(".byte %d\t",$op &0xff); | ||
| 275 | push(@out,$tmp1); | ||
| 276 | push(@out,$tmp2); | ||
| 277 | |||
| 278 | $p2=&conv($p2); | ||
| 279 | $p1=&conv($p1); | ||
| 280 | &main'comment("$name $p2 $p1"); | ||
| 281 | return; | ||
| 282 | } | ||
| 283 | |||
| 284 | push(@out,"\t$name\t"); | ||
| 285 | $t=&conv($p2).","; | ||
| 286 | $l=length($t); | ||
| 287 | push(@out,$t); | ||
| 288 | $ll=4-($l+9)/8; | ||
| 289 | $tmp1=sprintf("\t" x $ll); | ||
| 290 | push(@out,$tmp1); | ||
| 291 | push(@out,&conv($p1)."\n"); | ||
| 292 | } | ||
| 293 | |||
| 294 | sub out1 | ||
| 295 | { | ||
| 296 | local($name,$p1)=@_; | ||
| 297 | local($l,$t); | ||
| 298 | local(%special)=("bswapl",0x0FC8); | ||
| 299 | |||
| 300 | if ((defined($special{$name})) && defined($regs{$p1})) | ||
| 301 | { | ||
| 302 | $op=$special{$name}|$reg_val{$p1}; | ||
| 303 | $tmp1=sprintf(".byte %d\n",($op>>8)&0xff); | ||
| 304 | $tmp2=sprintf(".byte %d\t",$op &0xff); | ||
| 305 | push(@out,$tmp1); | ||
| 306 | push(@out,$tmp2); | ||
| 307 | |||
| 308 | $p2=&conv($p2); | ||
| 309 | $p1=&conv($p1); | ||
| 310 | &main'comment("$name $p2 $p1"); | ||
| 311 | return; | ||
| 312 | } | ||
| 313 | |||
| 314 | push(@out,"\t$name\t".&conv($p1)."\n"); | ||
| 315 | } | ||
| 316 | |||
| 317 | sub out1p | ||
| 318 | { | ||
| 319 | local($name,$p1)=@_; | ||
| 320 | local($l,$t); | ||
| 321 | |||
| 322 | push(@out,"\t$name\t*".&conv($p1)."\n"); | ||
| 323 | } | ||
| 324 | |||
| 325 | sub out0 | ||
| 326 | { | ||
| 327 | push(@out,"\t$_[0]\n"); | ||
| 328 | } | ||
| 329 | |||
| 330 | sub conv | ||
| 331 | { | ||
| 332 | local($p)=@_; | ||
| 333 | |||
| 334 | # $p =~ s/0x([0-9A-Fa-f]+)/0$1h/; | ||
| 335 | |||
| 336 | $p=$regs{$p} if (defined($regs{$p})); | ||
| 337 | |||
| 338 | $p =~ s/^(-{0,1}[0-9A-Fa-f]+)$/\$$1/; | ||
| 339 | $p =~ s/^(0x[0-9A-Fa-f]+)$/\$$1/; | ||
| 340 | return $p; | ||
| 341 | } | ||
| 342 | |||
| 343 | sub main'file | ||
| 344 | { | ||
| 345 | local($file)=@_; | ||
| 346 | |||
| 347 | if ($main'openbsd) | ||
| 348 | { push(@out,"#include <machine/asm.h>\n"); } | ||
| 349 | |||
| 350 | local($tmp)=<<"EOF"; | ||
| 351 | .file "$file.s" | ||
| 352 | EOF | ||
| 353 | push(@out,$tmp); | ||
| 354 | } | ||
| 355 | |||
| 356 | sub main'function_begin | ||
| 357 | { | ||
| 358 | local($func,$junk,$llabel)=@_; | ||
| 359 | |||
| 360 | &main'external_label($func); | ||
| 361 | $func=$under.$func; | ||
| 362 | |||
| 363 | if ($main'openbsd) | ||
| 364 | { | ||
| 365 | push (@out, "\nENTRY($func)\n"); | ||
| 366 | push (@out, "$llabel:\n") if $llabel; | ||
| 367 | goto skip; | ||
| 368 | } | ||
| 369 | |||
| 370 | local($tmp)=<<"EOF"; | ||
| 371 | .text | ||
| 372 | .globl $func | ||
| 373 | EOF | ||
| 374 | push(@out,$tmp); | ||
| 375 | if ($main'cpp) | ||
| 376 | { $tmp=push(@out,"TYPE($func,\@function)\n"); } | ||
| 377 | elsif ($main'coff) | ||
| 378 | { $tmp=push(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } | ||
| 379 | elsif ($main'aout and !$main'pic) | ||
| 380 | { } | ||
| 381 | else { $tmp=push(@out,".type\t$func,\@function\n"); } | ||
| 382 | push(@out,".align\t$align\n"); | ||
| 383 | push(@out,"$func:\n"); | ||
| 384 | skip: | ||
| 385 | $tmp=<<"EOF"; | ||
| 386 | pushl %ebp | ||
| 387 | pushl %ebx | ||
| 388 | pushl %esi | ||
| 389 | pushl %edi | ||
| 390 | |||
| 391 | EOF | ||
| 392 | push(@out,$tmp); | ||
| 393 | $stack=20; | ||
| 394 | } | ||
| 395 | |||
| 396 | sub main'function_begin_B | ||
| 397 | { | ||
| 398 | local($func,$extra)=@_; | ||
| 399 | |||
| 400 | &main'external_label($func); | ||
| 401 | $func=$under.$func; | ||
| 402 | |||
| 403 | if ($main'openbsd) | ||
| 404 | { push(@out, "\nENTRY($func)\n"); goto skip; } | ||
| 405 | |||
| 406 | local($tmp)=<<"EOF"; | ||
| 407 | .text | ||
| 408 | .globl $func | ||
| 409 | EOF | ||
| 410 | push(@out,$tmp); | ||
| 411 | if ($main'cpp) | ||
| 412 | { push(@out,"TYPE($func,\@function)\n"); } | ||
| 413 | elsif ($main'coff) | ||
| 414 | { $tmp=push(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } | ||
| 415 | elsif ($main'aout and !$main'pic) | ||
| 416 | { } | ||
| 417 | else { push(@out,".type $func,\@function\n"); } | ||
| 418 | push(@out,".align\t$align\n"); | ||
| 419 | push(@out,"$func:\n"); | ||
| 420 | skip: | ||
| 421 | $stack=4; | ||
| 422 | } | ||
| 423 | |||
| 424 | # Like function_begin_B but with static linkage | ||
| 425 | sub main'function_begin_C | ||
| 426 | { | ||
| 427 | local($func,$extra)=@_; | ||
| 428 | |||
| 429 | &main'external_label($func); | ||
| 430 | $func=$under.$func; | ||
| 431 | |||
| 432 | if ($main'openbsd) | ||
| 433 | { | ||
| 434 | local($tmp)=<<"EOF"; | ||
| 435 | .text | ||
| 436 | _ALIGN_TEXT | ||
| 437 | .type $func,\@function | ||
| 438 | $func: | ||
| 439 | EOF | ||
| 440 | push(@out, $tmp); | ||
| 441 | goto skip; | ||
| 442 | } | ||
| 443 | |||
| 444 | local($tmp)=<<"EOF"; | ||
| 445 | .text | ||
| 446 | .globl $func | ||
| 447 | EOF | ||
| 448 | push(@out,$tmp); | ||
| 449 | if ($main'cpp) | ||
| 450 | { push(@out,"TYPE($func,\@function)\n"); } | ||
| 451 | elsif ($main'coff) | ||
| 452 | { $tmp=push(@out,".def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); } | ||
| 453 | elsif ($main'aout and !$main'pic) | ||
| 454 | { } | ||
| 455 | else { push(@out,".type $func,\@function\n"); } | ||
| 456 | push(@out,".align\t$align\n"); | ||
| 457 | push(@out,"$func:\n"); | ||
| 458 | skip: | ||
| 459 | $stack=4; | ||
| 460 | } | ||
| 461 | |||
| 462 | sub main'function_end | ||
| 463 | { | ||
| 464 | local($func)=@_; | ||
| 465 | |||
| 466 | $func=$under.$func; | ||
| 467 | |||
| 468 | local($tmp)=<<"EOF"; | ||
| 469 | popl %edi | ||
| 470 | popl %esi | ||
| 471 | popl %ebx | ||
| 472 | popl %ebp | ||
| 473 | ret | ||
| 474 | ${dot}L_${func}_end: | ||
| 475 | EOF | ||
| 476 | push(@out,$tmp); | ||
| 477 | |||
| 478 | if ($main'cpp) | ||
| 479 | { push(@out,"SIZE($func,${dot}L_${func}_end-$func)\n"); } | ||
| 480 | elsif ($main'coff or $main'aout) | ||
| 481 | { } | ||
| 482 | else { push(@out,".size\t$func,${dot}L_${func}_end-$func\n"); } | ||
| 483 | push(@out,".ident \"$func\"\n"); | ||
| 484 | $stack=0; | ||
| 485 | %label=(); | ||
| 486 | } | ||
| 487 | |||
| 488 | sub main'function_end_A | ||
| 489 | { | ||
| 490 | local($func)=@_; | ||
| 491 | |||
| 492 | local($tmp)=<<"EOF"; | ||
| 493 | popl %edi | ||
| 494 | popl %esi | ||
| 495 | popl %ebx | ||
| 496 | popl %ebp | ||
| 497 | ret | ||
| 498 | EOF | ||
| 499 | push(@out,$tmp); | ||
| 500 | } | ||
| 501 | |||
| 502 | sub main'function_end_B | ||
| 503 | { | ||
| 504 | local($func)=@_; | ||
| 505 | |||
| 506 | $func=$under.$func; | ||
| 507 | |||
| 508 | push(@out,"${dot}L_${func}_end:\n"); | ||
| 509 | if ($main'cpp) | ||
| 510 | { push(@out,"SIZE($func,${dot}L_${func}_end-$func)\n"); } | ||
| 511 | elsif ($main'coff or $main'aout) | ||
| 512 | { } | ||
| 513 | else { push(@out,".size\t$func,${dot}L_${func}_end-$func\n"); } | ||
| 514 | push(@out,".ident \"$func\"\n"); | ||
| 515 | $stack=0; | ||
| 516 | %label=(); | ||
| 517 | } | ||
| 518 | |||
| 519 | sub main'function_end_C { function_end_B(@_); } | ||
| 520 | |||
| 521 | sub main'wparam | ||
| 522 | { | ||
| 523 | local($num)=@_; | ||
| 524 | |||
| 525 | return(&main'DWP($stack+$num*4,"esp","",0)); | ||
| 526 | } | ||
| 527 | |||
| 528 | sub main'stack_push | ||
| 529 | { | ||
| 530 | local($num)=@_; | ||
| 531 | $stack+=$num*4; | ||
| 532 | &main'sub("esp",$num*4); | ||
| 533 | } | ||
| 534 | |||
| 535 | sub main'stack_pop | ||
| 536 | { | ||
| 537 | local($num)=@_; | ||
| 538 | $stack-=$num*4; | ||
| 539 | &main'add("esp",$num*4); | ||
| 540 | } | ||
| 541 | |||
| 542 | sub main'swtmp | ||
| 543 | { | ||
| 544 | return(&main'DWP($_[0]*4,"esp","",0)); | ||
| 545 | } | ||
| 546 | |||
| 547 | # Should use swtmp, which is above esp. Linix can trash the stack above esp | ||
| 548 | #sub main'wtmp | ||
| 549 | # { | ||
| 550 | # local($num)=@_; | ||
| 551 | # | ||
| 552 | # return(&main'DWP(-($num+1)*4,"esp","",0)); | ||
| 553 | # } | ||
| 554 | |||
| 555 | sub main'comment | ||
| 556 | { | ||
| 557 | if (!defined($com_start) or (!$main'openbsd && $main'elf)) | ||
| 558 | { # Regarding $main'elf above... | ||
| 559 | # GNU and SVR4 as'es use different comment delimiters, | ||
| 560 | push(@out,"\n"); # so we just skip ELF comments... | ||
| 561 | return; | ||
| 562 | } | ||
| 563 | foreach (@_) | ||
| 564 | { | ||
| 565 | if (/^\s*$/) | ||
| 566 | { push(@out,"\n"); } | ||
| 567 | else | ||
| 568 | { push(@out,"\t$com_start $_ $com_end\n"); } | ||
| 569 | } | ||
| 570 | } | ||
| 571 | |||
| 572 | sub main'public_label | ||
| 573 | { | ||
| 574 | $label{$_[0]}="${under}${_[0]}" if (!defined($label{$_[0]})); | ||
| 575 | push(@out,".globl\t$label{$_[0]}\n"); | ||
| 576 | } | ||
| 577 | |||
| 578 | sub main'label | ||
| 579 | { | ||
| 580 | if (!defined($label{$_[0]})) | ||
| 581 | { | ||
| 582 | $label{$_[0]}="${dot}${label}${_[0]}"; | ||
| 583 | $label++; | ||
| 584 | } | ||
| 585 | return($label{$_[0]}); | ||
| 586 | } | ||
| 587 | |||
| 588 | sub main'set_label | ||
| 589 | { | ||
| 590 | if (!defined($label{$_[0]})) | ||
| 591 | { | ||
| 592 | $label{$_[0]}="${dot}${label}${_[0]}"; | ||
| 593 | $label++; | ||
| 594 | } | ||
| 595 | if ($_[1]!=0) | ||
| 596 | { | ||
| 597 | if ($_[1]>1) { main'align($_[1]); } | ||
| 598 | else | ||
| 599 | { | ||
| 600 | if ($main'openbsd) | ||
| 601 | { push(@out,"_ALIGN_TEXT\n"); } | ||
| 602 | else | ||
| 603 | { push(@out,".align $align\n"); } | ||
| 604 | } | ||
| 605 | } | ||
| 606 | push(@out,"$label{$_[0]}:\n"); | ||
| 607 | } | ||
| 608 | |||
| 609 | sub main'file_end | ||
| 610 | { | ||
| 611 | # try to detect if SSE2 or MMX extensions were used on ELF platform... | ||
| 612 | if ($main'elf && grep {/\b%[x]*mm[0-7]\b|OPENSSL_ia32cap_P\b/i} @out) { | ||
| 613 | local($tmp); | ||
| 614 | |||
| 615 | push (@out,"\n.section\t.bss\n"); | ||
| 616 | push (@out,".comm\t${under}OPENSSL_ia32cap_P,4,4\n"); | ||
| 617 | |||
| 618 | return; | ||
| 619 | } | ||
| 620 | |||
| 621 | if ($const ne "") | ||
| 622 | { | ||
| 623 | push(@out,".section .rodata\n"); | ||
| 624 | push(@out,$const); | ||
| 625 | $const=""; | ||
| 626 | } | ||
| 627 | } | ||
| 628 | |||
| 629 | sub main'data_byte | ||
| 630 | { | ||
| 631 | push(@out,"\t.byte\t".join(',',@_)."\n"); | ||
| 632 | } | ||
| 633 | |||
| 634 | sub main'data_word | ||
| 635 | { | ||
| 636 | push(@out,"\t.long\t".join(',',@_)."\n"); | ||
| 637 | } | ||
| 638 | |||
| 639 | sub main'align | ||
| 640 | { | ||
| 641 | my $val=$_[0],$p2,$i; | ||
| 642 | if ($main'aout) { | ||
| 643 | for ($p2=0;$val!=0;$val>>=1) { $p2++; } | ||
| 644 | $val=$p2-1; | ||
| 645 | $val.=",0x90"; | ||
| 646 | } | ||
| 647 | push(@out,".align\t$val\n"); | ||
| 648 | if ($main'openbsd) | ||
| 649 | { push(@out,"_ALIGN_TEXT\n"); } | ||
| 650 | else | ||
| 651 | { push(@out,".align $tval\n"); } | ||
| 652 | } | ||
| 653 | |||
| 654 | # debug output functions: puts, putx, printf | ||
| 655 | |||
| 656 | sub main'puts | ||
| 657 | { | ||
| 658 | &pushvars(); | ||
| 659 | &main'push('$Lstring' . ++$constl); | ||
| 660 | &main'call('puts'); | ||
| 661 | $stack-=4; | ||
| 662 | &main'add("esp",4); | ||
| 663 | &popvars(); | ||
| 664 | |||
| 665 | $const .= "Lstring$constl:\n\t.string \"@_[0]\"\n"; | ||
| 666 | } | ||
| 667 | |||
| 668 | sub main'putx | ||
| 669 | { | ||
| 670 | &pushvars(); | ||
| 671 | &main'push($_[0]); | ||
| 672 | &main'push('$Lstring' . ++$constl); | ||
| 673 | &main'call('printf'); | ||
| 674 | &main'add("esp",8); | ||
| 675 | $stack-=8; | ||
| 676 | &popvars(); | ||
| 677 | |||
| 678 | $const .= "Lstring$constl:\n\t.string \"\%X\"\n"; | ||
| 679 | } | ||
| 680 | |||
| 681 | sub main'printf | ||
| 682 | { | ||
| 683 | $ostack = $stack; | ||
| 684 | &pushvars(); | ||
| 685 | for ($i = @_ - 1; $i >= 0; $i--) | ||
| 686 | { | ||
| 687 | if ($i == 0) # change this to support %s format strings | ||
| 688 | { | ||
| 689 | &main'push('$Lstring' . ++$constl); | ||
| 690 | $const .= "Lstring$constl:\n\t.string \"@_[$i]\"\n"; | ||
| 691 | } | ||
| 692 | else | ||
| 693 | { | ||
| 694 | if ($_[$i] =~ /([0-9]*)\(%esp\)/) | ||
| 695 | { | ||
| 696 | &main'push(($1 + $stack - $ostack) . '(%esp)'); | ||
| 697 | } | ||
| 698 | else | ||
| 699 | { | ||
| 700 | &main'push($_[$i]); | ||
| 701 | } | ||
| 702 | } | ||
| 703 | } | ||
| 704 | &main'call('printf'); | ||
| 705 | $stack-=4*@_; | ||
| 706 | &main'add("esp",4*@_); | ||
| 707 | &popvars(); | ||
| 708 | } | ||
| 709 | |||
| 710 | sub pushvars | ||
| 711 | { | ||
| 712 | &main'pushf(); | ||
| 713 | &main'push("edx"); | ||
| 714 | &main'push("ecx"); | ||
| 715 | &main'push("eax"); | ||
| 716 | } | ||
| 717 | |||
| 718 | sub popvars | ||
| 719 | { | ||
| 720 | &main'pop("eax"); | ||
| 721 | &main'pop("ecx"); | ||
| 722 | &main'pop("edx"); | ||
| 723 | &main'popf(); | ||
| 724 | } | ||
| 725 | |||
| 726 | sub main'picmeup | ||
| 727 | { | ||
| 728 | local($dst,$sym)=@_; | ||
| 729 | if ($main'cpp) | ||
| 730 | { | ||
| 731 | local($tmp)=<<___; | ||
| 732 | #if (defined(ELF) || defined(SOL)) && defined(PIC) | ||
| 733 | call 1f | ||
| 734 | 1: popl $regs{$dst} | ||
| 735 | addl \$_GLOBAL_OFFSET_TABLE_+[.-1b],$regs{$dst} | ||
| 736 | movl $sym\@GOT($regs{$dst}),$regs{$dst} | ||
| 737 | #else | ||
| 738 | leal $sym,$regs{$dst} | ||
| 739 | #endif | ||
| 740 | ___ | ||
| 741 | push(@out,$tmp); | ||
| 742 | } | ||
| 743 | elsif ($main'openbsd) | ||
| 744 | { | ||
| 745 | push(@out, "#ifdef PIC\n"); | ||
| 746 | push(@out, "\tPIC_PROLOGUE\n"); | ||
| 747 | &main'mov($dst,"PIC_GOT($sym)"); | ||
| 748 | push(@out, "\tPIC_EPILOGUE\n"); | ||
| 749 | push(@out, "#else\n"); | ||
| 750 | &main'lea($dst,&main'DWP($sym)); | ||
| 751 | push(@out, "#endif\n"); | ||
| 752 | } | ||
| 753 | elsif ($main'pic && ($main'elf || $main'aout)) | ||
| 754 | { | ||
| 755 | &main'call(&main'label("PIC_me_up")); | ||
| 756 | &main'set_label("PIC_me_up"); | ||
| 757 | &main'blindpop($dst); | ||
| 758 | &main'add($dst,"\$${under}_GLOBAL_OFFSET_TABLE_+[.-". | ||
| 759 | &main'label("PIC_me_up") . "]"); | ||
| 760 | &main'mov($dst,&main'DWP($under.$sym."\@GOT",$dst)); | ||
| 761 | } | ||
| 762 | else | ||
| 763 | { | ||
| 764 | &main'lea($dst,&main'DWP($sym)); | ||
| 765 | } | ||
| 766 | } | ||
| 767 | |||
| 768 | sub main'blindpop { &out1("popl",@_); } | ||
| 769 | |||
| 770 | sub main'initseg | ||
| 771 | { | ||
| 772 | local($f)=@_; | ||
| 773 | local($tmp); | ||
| 774 | if ($main'elf) | ||
| 775 | { | ||
| 776 | $tmp=<<___; | ||
| 777 | .section .init | ||
| 778 | PIC_PROLOGUE | ||
| 779 | call PIC_PLT($under$f) | ||
| 780 | PIC_EPILOGUE | ||
| 781 | jmp .Linitalign | ||
| 782 | .align $align | ||
| 783 | .Linitalign: | ||
| 784 | ___ | ||
| 785 | } | ||
| 786 | elsif ($main'coff) | ||
| 787 | { | ||
| 788 | $tmp=<<___; # applies to both Cygwin and Mingw | ||
| 789 | .section .ctors | ||
| 790 | .long $under$f | ||
| 791 | ___ | ||
| 792 | } | ||
| 793 | elsif ($main'aout) | ||
| 794 | { | ||
| 795 | local($ctor)="${under}_GLOBAL_\$I\$$f"; | ||
| 796 | $tmp=".text\n"; | ||
| 797 | $tmp.=".type $ctor,\@function\n" if ($main'pic); | ||
| 798 | $tmp.=<<___; # OpenBSD way... | ||
| 799 | .globl $ctor | ||
| 800 | .align 2 | ||
| 801 | $ctor: | ||
| 802 | jmp $under$f | ||
| 803 | ___ | ||
| 804 | } | ||
| 805 | push(@out,$tmp) if ($tmp); | ||
| 806 | } | ||
| 807 | |||
| 808 | 1; | ||
diff --git a/src/lib/libcrypto/pkcs12/Makefile.ssl b/src/lib/libcrypto/pkcs12/Makefile.ssl deleted file mode 100644 index a6e47b4085..0000000000 --- a/src/lib/libcrypto/pkcs12/Makefile.ssl +++ /dev/null | |||
| @@ -1,417 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/pkcs12/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= pkcs12 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c \ | ||
| 27 | p12_init.c p12_key.c p12_kiss.c p12_mutl.c\ | ||
| 28 | p12_utl.c p12_npas.c pk12err.c p12_p8d.c p12_p8e.c | ||
| 29 | LIBOBJ= p12_add.o p12_asn.o p12_attr.o p12_crpt.o p12_crt.o p12_decr.o \ | ||
| 30 | p12_init.o p12_key.o p12_kiss.o p12_mutl.o\ | ||
| 31 | p12_utl.o p12_npas.o pk12err.o p12_p8d.o p12_p8e.o | ||
| 32 | |||
| 33 | SRC= $(LIBSRC) | ||
| 34 | |||
| 35 | EXHEADER= pkcs12.h | ||
| 36 | HEADER= $(EXHEADER) | ||
| 37 | |||
| 38 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 39 | |||
| 40 | top: | ||
| 41 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 42 | |||
| 43 | test: | ||
| 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.ssl >> $(TOP)/MINFO | ||
| 54 | |||
| 55 | links: | ||
| 56 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 85 | |||
| 86 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 87 | |||
| 88 | p12_add.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 89 | p12_add.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 90 | p12_add.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 91 | p12_add.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 92 | p12_add.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 93 | p12_add.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 94 | p12_add.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 95 | p12_add.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 96 | p12_add.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 97 | p12_add.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 98 | p12_add.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 99 | p12_add.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 100 | p12_add.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 101 | p12_add.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 102 | p12_add.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 103 | p12_add.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 104 | p12_add.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 105 | p12_add.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 106 | p12_add.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 107 | p12_add.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 108 | p12_add.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 109 | p12_add.o: ../cryptlib.h p12_add.c | ||
| 110 | p12_asn.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 111 | p12_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 112 | p12_asn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 113 | p12_asn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 114 | p12_asn.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 115 | p12_asn.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 116 | p12_asn.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 117 | p12_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 118 | p12_asn.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 119 | p12_asn.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 120 | p12_asn.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 121 | p12_asn.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 122 | p12_asn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 123 | p12_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 124 | p12_asn.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 125 | p12_asn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 126 | p12_asn.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 127 | p12_asn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 128 | p12_asn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 129 | p12_asn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 130 | p12_asn.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 131 | p12_asn.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_asn.c | ||
| 132 | p12_attr.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 133 | p12_attr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 134 | p12_attr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 135 | p12_attr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 136 | p12_attr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 137 | p12_attr.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 138 | p12_attr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 139 | p12_attr.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 140 | p12_attr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 141 | p12_attr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 142 | p12_attr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 143 | p12_attr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 144 | p12_attr.o: ../../include/openssl/opensslconf.h | ||
| 145 | p12_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 146 | p12_attr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 147 | p12_attr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 148 | p12_attr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 149 | p12_attr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 150 | p12_attr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 151 | p12_attr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 152 | p12_attr.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 153 | p12_attr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_attr.c | ||
| 154 | p12_crpt.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 155 | p12_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 156 | p12_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 157 | p12_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 158 | p12_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 159 | p12_crpt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 160 | p12_crpt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 161 | p12_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 162 | p12_crpt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 163 | p12_crpt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 164 | p12_crpt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 165 | p12_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 166 | p12_crpt.o: ../../include/openssl/opensslconf.h | ||
| 167 | p12_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 168 | p12_crpt.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 169 | p12_crpt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 170 | p12_crpt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 171 | p12_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 172 | p12_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 173 | p12_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 174 | p12_crpt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 175 | p12_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_crpt.c | ||
| 176 | p12_crt.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 177 | p12_crt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 178 | p12_crt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 179 | p12_crt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 180 | p12_crt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 181 | p12_crt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 182 | p12_crt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 183 | p12_crt.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 184 | p12_crt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 185 | p12_crt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 186 | p12_crt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 187 | p12_crt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 188 | p12_crt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 189 | p12_crt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 190 | p12_crt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 191 | p12_crt.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 192 | p12_crt.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 193 | p12_crt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 194 | p12_crt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 195 | p12_crt.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 196 | p12_crt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 197 | p12_crt.o: ../cryptlib.h p12_crt.c | ||
| 198 | p12_decr.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 199 | p12_decr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 200 | p12_decr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 201 | p12_decr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 202 | p12_decr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 203 | p12_decr.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 204 | p12_decr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 205 | p12_decr.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 206 | p12_decr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 207 | p12_decr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 208 | p12_decr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 209 | p12_decr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 210 | p12_decr.o: ../../include/openssl/opensslconf.h | ||
| 211 | p12_decr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 212 | p12_decr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 213 | p12_decr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 214 | p12_decr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 215 | p12_decr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 216 | p12_decr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 217 | p12_decr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 218 | p12_decr.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 219 | p12_decr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_decr.c | ||
| 220 | p12_init.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 221 | p12_init.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 222 | p12_init.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 223 | p12_init.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 224 | p12_init.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 225 | p12_init.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 226 | p12_init.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 227 | p12_init.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 228 | p12_init.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 229 | p12_init.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 230 | p12_init.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 231 | p12_init.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 232 | p12_init.o: ../../include/openssl/opensslconf.h | ||
| 233 | p12_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 234 | p12_init.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 235 | p12_init.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 236 | p12_init.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 237 | p12_init.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 238 | p12_init.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 239 | p12_init.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 240 | p12_init.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 241 | p12_init.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_init.c | ||
| 242 | p12_key.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 243 | p12_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 244 | p12_key.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 245 | p12_key.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 246 | p12_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 247 | p12_key.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 248 | p12_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 249 | p12_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 250 | p12_key.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 251 | p12_key.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 252 | p12_key.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 253 | p12_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 254 | p12_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 255 | p12_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 256 | p12_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 257 | p12_key.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 258 | p12_key.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 259 | p12_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 260 | p12_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 261 | p12_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 262 | p12_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 263 | p12_key.o: ../cryptlib.h p12_key.c | ||
| 264 | p12_kiss.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 265 | p12_kiss.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 266 | p12_kiss.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 267 | p12_kiss.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 268 | p12_kiss.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 269 | p12_kiss.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 270 | p12_kiss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 271 | p12_kiss.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 272 | p12_kiss.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 273 | p12_kiss.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 274 | p12_kiss.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 275 | p12_kiss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 276 | p12_kiss.o: ../../include/openssl/opensslconf.h | ||
| 277 | p12_kiss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 278 | p12_kiss.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 279 | p12_kiss.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 280 | p12_kiss.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 281 | p12_kiss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 282 | p12_kiss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 283 | p12_kiss.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 284 | p12_kiss.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 285 | p12_kiss.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_kiss.c | ||
| 286 | p12_mutl.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 287 | p12_mutl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 288 | p12_mutl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 289 | p12_mutl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 290 | p12_mutl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 291 | p12_mutl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 292 | p12_mutl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 293 | p12_mutl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 294 | p12_mutl.o: ../../include/openssl/hmac.h ../../include/openssl/idea.h | ||
| 295 | p12_mutl.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 296 | p12_mutl.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 297 | p12_mutl.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 298 | p12_mutl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 299 | p12_mutl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 300 | p12_mutl.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 301 | p12_mutl.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 302 | p12_mutl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 303 | p12_mutl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 304 | p12_mutl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 305 | p12_mutl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 306 | p12_mutl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 307 | p12_mutl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 308 | p12_mutl.o: ../cryptlib.h p12_mutl.c | ||
| 309 | p12_npas.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 310 | p12_npas.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 311 | p12_npas.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 312 | p12_npas.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 313 | p12_npas.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 314 | p12_npas.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 315 | p12_npas.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 316 | p12_npas.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 317 | p12_npas.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 318 | p12_npas.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 319 | p12_npas.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 320 | p12_npas.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 321 | p12_npas.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 322 | p12_npas.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 323 | p12_npas.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 324 | p12_npas.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 325 | p12_npas.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 326 | p12_npas.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 327 | p12_npas.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 328 | p12_npas.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 329 | p12_npas.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 330 | p12_npas.o: ../../include/openssl/x509_vfy.h p12_npas.c | ||
| 331 | p12_p8d.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 332 | p12_p8d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 333 | p12_p8d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 334 | p12_p8d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 335 | p12_p8d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 336 | p12_p8d.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 337 | p12_p8d.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 338 | p12_p8d.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 339 | p12_p8d.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 340 | p12_p8d.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 341 | p12_p8d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 342 | p12_p8d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 343 | p12_p8d.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 344 | p12_p8d.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 345 | p12_p8d.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 346 | p12_p8d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 347 | p12_p8d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 348 | p12_p8d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 349 | p12_p8d.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 350 | p12_p8d.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 351 | p12_p8d.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 352 | p12_p8d.o: ../cryptlib.h p12_p8d.c | ||
| 353 | p12_p8e.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 354 | p12_p8e.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 355 | p12_p8e.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 356 | p12_p8e.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 357 | p12_p8e.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 358 | p12_p8e.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 359 | p12_p8e.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 360 | p12_p8e.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 361 | p12_p8e.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 362 | p12_p8e.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 363 | p12_p8e.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 364 | p12_p8e.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 365 | p12_p8e.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 366 | p12_p8e.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 367 | p12_p8e.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 368 | p12_p8e.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 369 | p12_p8e.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 370 | p12_p8e.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 371 | p12_p8e.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 372 | p12_p8e.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 373 | p12_p8e.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 374 | p12_p8e.o: ../cryptlib.h p12_p8e.c | ||
| 375 | p12_utl.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 376 | p12_utl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 377 | p12_utl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 378 | p12_utl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 379 | p12_utl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 380 | p12_utl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 381 | p12_utl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 382 | p12_utl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 383 | p12_utl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 384 | p12_utl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 385 | p12_utl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 386 | p12_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 387 | p12_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 388 | p12_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 389 | p12_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 390 | p12_utl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 391 | p12_utl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 392 | p12_utl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 393 | p12_utl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 394 | p12_utl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 395 | p12_utl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 396 | p12_utl.o: ../cryptlib.h p12_utl.c | ||
| 397 | pk12err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 398 | pk12err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 399 | pk12err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 400 | pk12err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 401 | pk12err.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 402 | pk12err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 403 | pk12err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 404 | pk12err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 405 | pk12err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 406 | pk12err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 407 | pk12err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 408 | pk12err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 409 | pk12err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 410 | pk12err.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 411 | pk12err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 412 | pk12err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 413 | pk12err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 414 | pk12err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 415 | pk12err.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 416 | pk12err.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 417 | pk12err.o: ../../include/openssl/x509_vfy.h pk12err.c | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_add.c b/src/lib/libcrypto/pkcs12/p12_add.c index 1f3e378f5c..27ac5facfa 100644 --- a/src/lib/libcrypto/pkcs12/p12_add.c +++ b/src/lib/libcrypto/pkcs12/p12_add.c | |||
| @@ -106,6 +106,7 @@ PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, | |||
| 106 | PKCS8_PRIV_KEY_INFO *p8) | 106 | PKCS8_PRIV_KEY_INFO *p8) |
| 107 | { | 107 | { |
| 108 | PKCS12_SAFEBAG *bag; | 108 | PKCS12_SAFEBAG *bag; |
| 109 | const EVP_CIPHER *pbe_ciph; | ||
| 109 | 110 | ||
| 110 | /* Set up the safe bag */ | 111 | /* Set up the safe bag */ |
| 111 | if (!(bag = PKCS12_SAFEBAG_new())) { | 112 | if (!(bag = PKCS12_SAFEBAG_new())) { |
| @@ -114,8 +115,14 @@ PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, | |||
| 114 | } | 115 | } |
| 115 | 116 | ||
| 116 | bag->type = OBJ_nid2obj(NID_pkcs8ShroudedKeyBag); | 117 | bag->type = OBJ_nid2obj(NID_pkcs8ShroudedKeyBag); |
| 118 | |||
| 119 | pbe_ciph = EVP_get_cipherbynid(pbe_nid); | ||
| 120 | |||
| 121 | if (pbe_ciph) | ||
| 122 | pbe_nid = -1; | ||
| 123 | |||
| 117 | if (!(bag->value.shkeybag = | 124 | if (!(bag->value.shkeybag = |
| 118 | PKCS8_encrypt(pbe_nid, NULL, pass, passlen, salt, saltlen, iter, | 125 | PKCS8_encrypt(pbe_nid, pbe_ciph, pass, passlen, salt, saltlen, iter, |
| 119 | p8))) { | 126 | p8))) { |
| 120 | PKCS12err(PKCS12_F_PKCS12_MAKE_SHKEYBAG, ERR_R_MALLOC_FAILURE); | 127 | PKCS12err(PKCS12_F_PKCS12_MAKE_SHKEYBAG, ERR_R_MALLOC_FAILURE); |
| 121 | return NULL; | 128 | return NULL; |
| @@ -164,6 +171,7 @@ PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, | |||
| 164 | { | 171 | { |
| 165 | PKCS7 *p7; | 172 | PKCS7 *p7; |
| 166 | X509_ALGOR *pbe; | 173 | X509_ALGOR *pbe; |
| 174 | const EVP_CIPHER *pbe_ciph; | ||
| 167 | if (!(p7 = PKCS7_new())) { | 175 | if (!(p7 = PKCS7_new())) { |
| 168 | PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE); | 176 | PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE); |
| 169 | return NULL; | 177 | return NULL; |
| @@ -173,7 +181,15 @@ PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, | |||
| 173 | PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE); | 181 | PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE); |
| 174 | return NULL; | 182 | return NULL; |
| 175 | } | 183 | } |
| 176 | if (!(pbe = PKCS5_pbe_set(pbe_nid, iter, salt, saltlen))) { | 184 | |
| 185 | pbe_ciph = EVP_get_cipherbynid(pbe_nid); | ||
| 186 | |||
| 187 | if (pbe_ciph) | ||
| 188 | pbe = PKCS5_pbe2_set(pbe_ciph, iter, salt, saltlen); | ||
| 189 | else | ||
| 190 | pbe = PKCS5_pbe_set(pbe_nid, iter, salt, saltlen); | ||
| 191 | |||
| 192 | if (!pbe) { | ||
| 177 | PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE); | 193 | PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE); |
| 178 | return NULL; | 194 | return NULL; |
| 179 | } | 195 | } |
diff --git a/src/lib/libcrypto/pkcs12/p12_attr.c b/src/lib/libcrypto/pkcs12/p12_attr.c index 68d6c5ad15..e4d9c25647 100644 --- a/src/lib/libcrypto/pkcs12/p12_attr.c +++ b/src/lib/libcrypto/pkcs12/p12_attr.c | |||
| @@ -139,7 +139,7 @@ char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag) | |||
| 139 | ASN1_TYPE *atype; | 139 | ASN1_TYPE *atype; |
| 140 | if (!(atype = PKCS12_get_attr(bag, NID_friendlyName))) return NULL; | 140 | if (!(atype = PKCS12_get_attr(bag, NID_friendlyName))) return NULL; |
| 141 | if (atype->type != V_ASN1_BMPSTRING) return NULL; | 141 | if (atype->type != V_ASN1_BMPSTRING) return NULL; |
| 142 | return uni2asc(atype->value.bmpstring->data, | 142 | return OPENSSL_uni2asc(atype->value.bmpstring->data, |
| 143 | atype->value.bmpstring->length); | 143 | atype->value.bmpstring->length); |
| 144 | } | 144 | } |
| 145 | 145 | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_crpt.c b/src/lib/libcrypto/pkcs12/p12_crpt.c index f8b952e27e..b71d07b4d0 100644 --- a/src/lib/libcrypto/pkcs12/p12_crpt.c +++ b/src/lib/libcrypto/pkcs12/p12_crpt.c | |||
| @@ -60,28 +60,10 @@ | |||
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/pkcs12.h> | 61 | #include <openssl/pkcs12.h> |
| 62 | 62 | ||
| 63 | /* PKCS#12 specific PBE functions */ | 63 | /* PKCS#12 PBE algorithms now in static table */ |
| 64 | 64 | ||
| 65 | void PKCS12_PBE_add(void) | 65 | void PKCS12_PBE_add(void) |
| 66 | { | 66 | { |
| 67 | #ifndef OPENSSL_NO_RC4 | ||
| 68 | EVP_PBE_alg_add(NID_pbe_WithSHA1And128BitRC4, EVP_rc4(), EVP_sha1(), | ||
| 69 | PKCS12_PBE_keyivgen); | ||
| 70 | EVP_PBE_alg_add(NID_pbe_WithSHA1And40BitRC4, EVP_rc4_40(), EVP_sha1(), | ||
| 71 | PKCS12_PBE_keyivgen); | ||
| 72 | #endif | ||
| 73 | #ifndef OPENSSL_NO_DES | ||
| 74 | EVP_PBE_alg_add(NID_pbe_WithSHA1And3_Key_TripleDES_CBC, | ||
| 75 | EVP_des_ede3_cbc(), EVP_sha1(), PKCS12_PBE_keyivgen); | ||
| 76 | EVP_PBE_alg_add(NID_pbe_WithSHA1And2_Key_TripleDES_CBC, | ||
| 77 | EVP_des_ede_cbc(), EVP_sha1(), PKCS12_PBE_keyivgen); | ||
| 78 | #endif | ||
| 79 | #ifndef OPENSSL_NO_RC2 | ||
| 80 | EVP_PBE_alg_add(NID_pbe_WithSHA1And128BitRC2_CBC, EVP_rc2_cbc(), | ||
| 81 | EVP_sha1(), PKCS12_PBE_keyivgen); | ||
| 82 | EVP_PBE_alg_add(NID_pbe_WithSHA1And40BitRC2_CBC, EVP_rc2_40_cbc(), | ||
| 83 | EVP_sha1(), PKCS12_PBE_keyivgen); | ||
| 84 | #endif | ||
| 85 | } | 67 | } |
| 86 | 68 | ||
| 87 | int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 69 | int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
diff --git a/src/lib/libcrypto/pkcs12/p12_crt.c b/src/lib/libcrypto/pkcs12/p12_crt.c index 9522342fa5..96b131defa 100644 --- a/src/lib/libcrypto/pkcs12/p12_crt.c +++ b/src/lib/libcrypto/pkcs12/p12_crt.c | |||
| @@ -59,10 +59,6 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/pkcs12.h> | 61 | #include <openssl/pkcs12.h> |
| 62 | #ifdef OPENSSL_FIPS | ||
| 63 | #include <openssl/fips.h> | ||
| 64 | #endif | ||
| 65 | |||
| 66 | 62 | ||
| 67 | 63 | ||
| 68 | static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags, PKCS12_SAFEBAG *bag); | 64 | static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags, PKCS12_SAFEBAG *bag); |
| @@ -94,14 +90,7 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, | |||
| 94 | 90 | ||
| 95 | /* Set defaults */ | 91 | /* Set defaults */ |
| 96 | if (!nid_cert) | 92 | if (!nid_cert) |
| 97 | { | ||
| 98 | #ifdef OPENSSL_FIPS | ||
| 99 | if (FIPS_mode()) | ||
| 100 | nid_cert = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | ||
| 101 | else | ||
| 102 | #endif | ||
| 103 | nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC; | 93 | nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC; |
| 104 | } | ||
| 105 | if (!nid_key) | 94 | if (!nid_key) |
| 106 | nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | 95 | nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; |
| 107 | if (!iter) | 96 | if (!iter) |
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c index 9e57eee4a4..a29794bbbc 100644 --- a/src/lib/libcrypto/pkcs12/p12_key.c +++ b/src/lib/libcrypto/pkcs12/p12_key.c | |||
| @@ -81,15 +81,18 @@ int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, | |||
| 81 | int ret; | 81 | int ret; |
| 82 | unsigned char *unipass; | 82 | unsigned char *unipass; |
| 83 | int uniplen; | 83 | int uniplen; |
| 84 | |||
| 84 | if(!pass) { | 85 | if(!pass) { |
| 85 | unipass = NULL; | 86 | unipass = NULL; |
| 86 | uniplen = 0; | 87 | uniplen = 0; |
| 87 | } else if (!asc2uni(pass, passlen, &unipass, &uniplen)) { | 88 | } else if (!OPENSSL_asc2uni(pass, passlen, &unipass, &uniplen)) { |
| 88 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_ASC,ERR_R_MALLOC_FAILURE); | 89 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_ASC,ERR_R_MALLOC_FAILURE); |
| 89 | return 0; | 90 | return 0; |
| 90 | } | 91 | } |
| 91 | ret = PKCS12_key_gen_uni(unipass, uniplen, salt, saltlen, | 92 | ret = PKCS12_key_gen_uni(unipass, uniplen, salt, saltlen, |
| 92 | id, iter, n, out, md_type); | 93 | id, iter, n, out, md_type); |
| 94 | if (ret <= 0) | ||
| 95 | return 0; | ||
| 93 | if(unipass) { | 96 | if(unipass) { |
| 94 | OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */ | 97 | OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */ |
| 95 | OPENSSL_free(unipass); | 98 | OPENSSL_free(unipass); |
| @@ -129,6 +132,8 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
| 129 | #endif | 132 | #endif |
| 130 | v = EVP_MD_block_size (md_type); | 133 | v = EVP_MD_block_size (md_type); |
| 131 | u = EVP_MD_size (md_type); | 134 | u = EVP_MD_size (md_type); |
| 135 | if (u < 0) | ||
| 136 | return 0; | ||
| 132 | D = OPENSSL_malloc (v); | 137 | D = OPENSSL_malloc (v); |
| 133 | Ai = OPENSSL_malloc (u); | 138 | Ai = OPENSSL_malloc (u); |
| 134 | B = OPENSSL_malloc (v + 1); | 139 | B = OPENSSL_malloc (v + 1); |
diff --git a/src/lib/libcrypto/pkcs12/p12_kiss.c b/src/lib/libcrypto/pkcs12/p12_kiss.c index 5c4c6ec988..292cc3ed4a 100644 --- a/src/lib/libcrypto/pkcs12/p12_kiss.c +++ b/src/lib/libcrypto/pkcs12/p12_kiss.c | |||
| @@ -63,16 +63,13 @@ | |||
| 63 | /* Simplified PKCS#12 routines */ | 63 | /* Simplified PKCS#12 routines */ |
| 64 | 64 | ||
| 65 | static int parse_pk12( PKCS12 *p12, const char *pass, int passlen, | 65 | static int parse_pk12( PKCS12 *p12, const char *pass, int passlen, |
| 66 | EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca); | 66 | EVP_PKEY **pkey, STACK_OF(X509) *ocerts); |
| 67 | 67 | ||
| 68 | static int parse_bags( STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass, | 68 | static int parse_bags( STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass, |
| 69 | int passlen, EVP_PKEY **pkey, X509 **cert, | 69 | int passlen, EVP_PKEY **pkey, STACK_OF(X509) *ocerts); |
| 70 | STACK_OF(X509) **ca, ASN1_OCTET_STRING **keyid, | ||
| 71 | char *keymatch); | ||
| 72 | 70 | ||
| 73 | static int parse_bag( PKCS12_SAFEBAG *bag, const char *pass, int passlen, | 71 | static int parse_bag( PKCS12_SAFEBAG *bag, const char *pass, int passlen, |
| 74 | EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca, | 72 | EVP_PKEY **pkey, STACK_OF(X509) *ocerts); |
| 75 | ASN1_OCTET_STRING **keyid, char *keymatch); | ||
| 76 | 73 | ||
| 77 | /* Parse and decrypt a PKCS#12 structure returning user key, user cert | 74 | /* Parse and decrypt a PKCS#12 structure returning user key, user cert |
| 78 | * and other (CA) certs. Note either ca should be NULL, *ca should be NULL, | 75 | * and other (CA) certs. Note either ca should be NULL, *ca should be NULL, |
| @@ -83,24 +80,20 @@ static int parse_bag( PKCS12_SAFEBAG *bag, const char *pass, int passlen, | |||
| 83 | int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, | 80 | int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, |
| 84 | STACK_OF(X509) **ca) | 81 | STACK_OF(X509) **ca) |
| 85 | { | 82 | { |
| 86 | 83 | STACK_OF(X509) *ocerts = NULL; | |
| 84 | X509 *x = NULL; | ||
| 87 | /* Check for NULL PKCS12 structure */ | 85 | /* Check for NULL PKCS12 structure */ |
| 88 | 86 | ||
| 89 | if(!p12) { | 87 | if(!p12) |
| 88 | { | ||
| 90 | PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_INVALID_NULL_PKCS12_POINTER); | 89 | PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_INVALID_NULL_PKCS12_POINTER); |
| 91 | return 0; | 90 | return 0; |
| 92 | } | ||
| 93 | |||
| 94 | /* Allocate stack for ca certificates if needed */ | ||
| 95 | if ((ca != NULL) && (*ca == NULL)) { | ||
| 96 | if (!(*ca = sk_X509_new_null())) { | ||
| 97 | PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE); | ||
| 98 | return 0; | ||
| 99 | } | 91 | } |
| 100 | } | ||
| 101 | 92 | ||
| 102 | if(pkey) *pkey = NULL; | 93 | if(pkey) |
| 103 | if(cert) *cert = NULL; | 94 | *pkey = NULL; |
| 95 | if(cert) | ||
| 96 | *cert = NULL; | ||
| 104 | 97 | ||
| 105 | /* Check the mac */ | 98 | /* Check the mac */ |
| 106 | 99 | ||
| @@ -122,19 +115,61 @@ int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, | |||
| 122 | goto err; | 115 | goto err; |
| 123 | } | 116 | } |
| 124 | 117 | ||
| 125 | if (!parse_pk12 (p12, pass, -1, pkey, cert, ca)) | 118 | /* Allocate stack for other certificates */ |
| 119 | ocerts = sk_X509_new_null(); | ||
| 120 | |||
| 121 | if (!ocerts) | ||
| 122 | { | ||
| 123 | PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE); | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 127 | if (!parse_pk12 (p12, pass, -1, pkey, ocerts)) | ||
| 126 | { | 128 | { |
| 127 | PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_PARSE_ERROR); | 129 | PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_PARSE_ERROR); |
| 128 | goto err; | 130 | goto err; |
| 129 | } | 131 | } |
| 130 | 132 | ||
| 133 | while ((x = sk_X509_pop(ocerts))) | ||
| 134 | { | ||
| 135 | if (pkey && *pkey && cert && !*cert) | ||
| 136 | { | ||
| 137 | if (X509_check_private_key(x, *pkey)) | ||
| 138 | { | ||
| 139 | *cert = x; | ||
| 140 | x = NULL; | ||
| 141 | } | ||
| 142 | } | ||
| 143 | |||
| 144 | if (ca && x) | ||
| 145 | { | ||
| 146 | if (!*ca) | ||
| 147 | *ca = sk_X509_new_null(); | ||
| 148 | if (!*ca) | ||
| 149 | goto err; | ||
| 150 | if (!sk_X509_push(*ca, x)) | ||
| 151 | goto err; | ||
| 152 | x = NULL; | ||
| 153 | } | ||
| 154 | if (x) | ||
| 155 | X509_free(x); | ||
| 156 | } | ||
| 157 | |||
| 158 | if (ocerts) | ||
| 159 | sk_X509_pop_free(ocerts, X509_free); | ||
| 160 | |||
| 131 | return 1; | 161 | return 1; |
| 132 | 162 | ||
| 133 | err: | 163 | err: |
| 134 | 164 | ||
| 135 | if (pkey && *pkey) EVP_PKEY_free(*pkey); | 165 | if (pkey && *pkey) |
| 136 | if (cert && *cert) X509_free(*cert); | 166 | EVP_PKEY_free(*pkey); |
| 137 | if (ca) sk_X509_pop_free(*ca, X509_free); | 167 | if (cert && *cert) |
| 168 | X509_free(*cert); | ||
| 169 | if (x) | ||
| 170 | X509_free(*cert); | ||
| 171 | if (ocerts) | ||
| 172 | sk_X509_pop_free(ocerts, X509_free); | ||
| 138 | return 0; | 173 | return 0; |
| 139 | 174 | ||
| 140 | } | 175 | } |
| @@ -142,15 +177,13 @@ int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, | |||
| 142 | /* Parse the outer PKCS#12 structure */ | 177 | /* Parse the outer PKCS#12 structure */ |
| 143 | 178 | ||
| 144 | static int parse_pk12(PKCS12 *p12, const char *pass, int passlen, | 179 | static int parse_pk12(PKCS12 *p12, const char *pass, int passlen, |
| 145 | EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca) | 180 | EVP_PKEY **pkey, STACK_OF(X509) *ocerts) |
| 146 | { | 181 | { |
| 147 | STACK_OF(PKCS7) *asafes; | 182 | STACK_OF(PKCS7) *asafes; |
| 148 | STACK_OF(PKCS12_SAFEBAG) *bags; | 183 | STACK_OF(PKCS12_SAFEBAG) *bags; |
| 149 | int i, bagnid; | 184 | int i, bagnid; |
| 150 | PKCS7 *p7; | 185 | PKCS7 *p7; |
| 151 | ASN1_OCTET_STRING *keyid = NULL; | ||
| 152 | 186 | ||
| 153 | char keymatch = 0; | ||
| 154 | if (!(asafes = PKCS12_unpack_authsafes (p12))) return 0; | 187 | if (!(asafes = PKCS12_unpack_authsafes (p12))) return 0; |
| 155 | for (i = 0; i < sk_PKCS7_num (asafes); i++) { | 188 | for (i = 0; i < sk_PKCS7_num (asafes); i++) { |
| 156 | p7 = sk_PKCS7_value (asafes, i); | 189 | p7 = sk_PKCS7_value (asafes, i); |
| @@ -164,8 +197,7 @@ static int parse_pk12(PKCS12 *p12, const char *pass, int passlen, | |||
| 164 | sk_PKCS7_pop_free(asafes, PKCS7_free); | 197 | sk_PKCS7_pop_free(asafes, PKCS7_free); |
| 165 | return 0; | 198 | return 0; |
| 166 | } | 199 | } |
| 167 | if (!parse_bags(bags, pass, passlen, pkey, cert, ca, | 200 | if (!parse_bags(bags, pass, passlen, pkey, ocerts)) { |
| 168 | &keyid, &keymatch)) { | ||
| 169 | sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); | 201 | sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); |
| 170 | sk_PKCS7_pop_free(asafes, PKCS7_free); | 202 | sk_PKCS7_pop_free(asafes, PKCS7_free); |
| 171 | return 0; | 203 | return 0; |
| @@ -173,89 +205,65 @@ static int parse_pk12(PKCS12 *p12, const char *pass, int passlen, | |||
| 173 | sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); | 205 | sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); |
| 174 | } | 206 | } |
| 175 | sk_PKCS7_pop_free(asafes, PKCS7_free); | 207 | sk_PKCS7_pop_free(asafes, PKCS7_free); |
| 176 | if (keyid) M_ASN1_OCTET_STRING_free(keyid); | ||
| 177 | return 1; | 208 | return 1; |
| 178 | } | 209 | } |
| 179 | 210 | ||
| 180 | 211 | ||
| 181 | static int parse_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass, | 212 | static int parse_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass, |
| 182 | int passlen, EVP_PKEY **pkey, X509 **cert, | 213 | int passlen, EVP_PKEY **pkey, STACK_OF(X509) *ocerts) |
| 183 | STACK_OF(X509) **ca, ASN1_OCTET_STRING **keyid, | ||
| 184 | char *keymatch) | ||
| 185 | { | 214 | { |
| 186 | int i; | 215 | int i; |
| 187 | for (i = 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) { | 216 | for (i = 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) { |
| 188 | if (!parse_bag(sk_PKCS12_SAFEBAG_value (bags, i), | 217 | if (!parse_bag(sk_PKCS12_SAFEBAG_value (bags, i), |
| 189 | pass, passlen, pkey, cert, ca, keyid, | 218 | pass, passlen, pkey, ocerts)) |
| 190 | keymatch)) return 0; | 219 | return 0; |
| 191 | } | 220 | } |
| 192 | return 1; | 221 | return 1; |
| 193 | } | 222 | } |
| 194 | 223 | ||
| 195 | #define MATCH_KEY 0x1 | ||
| 196 | #define MATCH_CERT 0x2 | ||
| 197 | #define MATCH_ALL 0x3 | ||
| 198 | |||
| 199 | static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, | 224 | static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, |
| 200 | EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca, | 225 | EVP_PKEY **pkey, STACK_OF(X509) *ocerts) |
| 201 | ASN1_OCTET_STRING **keyid, | ||
| 202 | char *keymatch) | ||
| 203 | { | 226 | { |
| 204 | PKCS8_PRIV_KEY_INFO *p8; | 227 | PKCS8_PRIV_KEY_INFO *p8; |
| 205 | X509 *x509; | 228 | X509 *x509; |
| 206 | ASN1_OCTET_STRING *lkey = NULL, *ckid = NULL; | ||
| 207 | ASN1_TYPE *attrib; | 229 | ASN1_TYPE *attrib; |
| 208 | ASN1_BMPSTRING *fname = NULL; | 230 | ASN1_BMPSTRING *fname = NULL; |
| 231 | ASN1_OCTET_STRING *lkid = NULL; | ||
| 209 | 232 | ||
| 210 | if ((attrib = PKCS12_get_attr (bag, NID_friendlyName))) | 233 | if ((attrib = PKCS12_get_attr (bag, NID_friendlyName))) |
| 211 | fname = attrib->value.bmpstring; | 234 | fname = attrib->value.bmpstring; |
| 212 | 235 | ||
| 213 | if ((attrib = PKCS12_get_attr (bag, NID_localKeyID))) { | 236 | if ((attrib = PKCS12_get_attr (bag, NID_localKeyID))) |
| 214 | lkey = attrib->value.octet_string; | 237 | lkid = attrib->value.octet_string; |
| 215 | ckid = lkey; | ||
| 216 | } | ||
| 217 | 238 | ||
| 218 | /* Check for any local key id matching (if needed) */ | ||
| 219 | if (lkey && ((*keymatch & MATCH_ALL) != MATCH_ALL)) { | ||
| 220 | if (*keyid) { | ||
| 221 | if (M_ASN1_OCTET_STRING_cmp(*keyid, lkey)) lkey = NULL; | ||
| 222 | } else { | ||
| 223 | if (!(*keyid = M_ASN1_OCTET_STRING_dup(lkey))) { | ||
| 224 | PKCS12err(PKCS12_F_PARSE_BAG,ERR_R_MALLOC_FAILURE); | ||
| 225 | return 0; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | } | ||
| 229 | |||
| 230 | switch (M_PKCS12_bag_type(bag)) | 239 | switch (M_PKCS12_bag_type(bag)) |
| 231 | { | 240 | { |
| 232 | case NID_keyBag: | 241 | case NID_keyBag: |
| 233 | if (!lkey || !pkey) return 1; | 242 | if (!pkey || *pkey) |
| 234 | if (!(*pkey = EVP_PKCS82PKEY(bag->value.keybag))) return 0; | 243 | return 1; |
| 235 | *keymatch |= MATCH_KEY; | 244 | if (!(*pkey = EVP_PKCS82PKEY(bag->value.keybag))) |
| 245 | return 0; | ||
| 236 | break; | 246 | break; |
| 237 | 247 | ||
| 238 | case NID_pkcs8ShroudedKeyBag: | 248 | case NID_pkcs8ShroudedKeyBag: |
| 239 | if (!lkey || !pkey) return 1; | 249 | if (!pkey || *pkey) |
| 250 | return 1; | ||
| 240 | if (!(p8 = PKCS12_decrypt_skey(bag, pass, passlen))) | 251 | if (!(p8 = PKCS12_decrypt_skey(bag, pass, passlen))) |
| 241 | return 0; | 252 | return 0; |
| 242 | *pkey = EVP_PKCS82PKEY(p8); | 253 | *pkey = EVP_PKCS82PKEY(p8); |
| 243 | PKCS8_PRIV_KEY_INFO_free(p8); | 254 | PKCS8_PRIV_KEY_INFO_free(p8); |
| 244 | if (!(*pkey)) return 0; | 255 | if (!(*pkey)) return 0; |
| 245 | *keymatch |= MATCH_KEY; | ||
| 246 | break; | 256 | break; |
| 247 | 257 | ||
| 248 | case NID_certBag: | 258 | case NID_certBag: |
| 249 | if (M_PKCS12_cert_bag_type(bag) != NID_x509Certificate ) | 259 | if (M_PKCS12_cert_bag_type(bag) != NID_x509Certificate ) |
| 250 | return 1; | 260 | return 1; |
| 251 | if (!(x509 = PKCS12_certbag2x509(bag))) return 0; | 261 | if (!(x509 = PKCS12_certbag2x509(bag))) |
| 252 | if(ckid) | 262 | return 0; |
| 263 | if(lkid && !X509_keyid_set1(x509, lkid->data, lkid->length)) | ||
| 253 | { | 264 | { |
| 254 | if (!X509_keyid_set1(x509, ckid->data, ckid->length)) | 265 | X509_free(x509); |
| 255 | { | 266 | return 0; |
| 256 | X509_free(x509); | ||
| 257 | return 0; | ||
| 258 | } | ||
| 259 | } | 267 | } |
| 260 | if(fname) { | 268 | if(fname) { |
| 261 | int len, r; | 269 | int len, r; |
| @@ -272,20 +280,17 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, | |||
| 272 | } | 280 | } |
| 273 | } | 281 | } |
| 274 | 282 | ||
| 283 | if(!sk_X509_push(ocerts, x509)) | ||
| 284 | { | ||
| 285 | X509_free(x509); | ||
| 286 | return 0; | ||
| 287 | } | ||
| 275 | 288 | ||
| 276 | if (lkey) { | ||
| 277 | *keymatch |= MATCH_CERT; | ||
| 278 | if (cert) *cert = x509; | ||
| 279 | else X509_free(x509); | ||
| 280 | } else { | ||
| 281 | if(ca) sk_X509_push (*ca, x509); | ||
| 282 | else X509_free(x509); | ||
| 283 | } | ||
| 284 | break; | 289 | break; |
| 285 | 290 | ||
| 286 | case NID_safeContentsBag: | 291 | case NID_safeContentsBag: |
| 287 | return parse_bags(bag->value.safes, pass, passlen, | 292 | return parse_bags(bag->value.safes, pass, passlen, |
| 288 | pkey, cert, ca, keyid, keymatch); | 293 | pkey, ocerts); |
| 289 | break; | 294 | break; |
| 290 | 295 | ||
| 291 | default: | 296 | default: |
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c index 70bfef6e5d..9ab740d51f 100644 --- a/src/lib/libcrypto/pkcs12/p12_mutl.c +++ b/src/lib/libcrypto/pkcs12/p12_mutl.c | |||
| @@ -71,6 +71,7 @@ int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, | |||
| 71 | HMAC_CTX hmac; | 71 | HMAC_CTX hmac; |
| 72 | unsigned char key[EVP_MAX_MD_SIZE], *salt; | 72 | unsigned char key[EVP_MAX_MD_SIZE], *salt; |
| 73 | int saltlen, iter; | 73 | int saltlen, iter; |
| 74 | int md_size; | ||
| 74 | 75 | ||
| 75 | if (!PKCS7_type_is_data(p12->authsafes)) | 76 | if (!PKCS7_type_is_data(p12->authsafes)) |
| 76 | { | 77 | { |
| @@ -87,13 +88,16 @@ int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, | |||
| 87 | PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_UNKNOWN_DIGEST_ALGORITHM); | 88 | PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_UNKNOWN_DIGEST_ALGORITHM); |
| 88 | return 0; | 89 | return 0; |
| 89 | } | 90 | } |
| 91 | md_size = EVP_MD_size(md_type); | ||
| 92 | if (md_size < 0) | ||
| 93 | return 0; | ||
| 90 | if(!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_MAC_ID, iter, | 94 | if(!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_MAC_ID, iter, |
| 91 | EVP_MD_size(md_type), key, md_type)) { | 95 | md_size, key, md_type)) { |
| 92 | PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_KEY_GEN_ERROR); | 96 | PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_KEY_GEN_ERROR); |
| 93 | return 0; | 97 | return 0; |
| 94 | } | 98 | } |
| 95 | HMAC_CTX_init(&hmac); | 99 | HMAC_CTX_init(&hmac); |
| 96 | HMAC_Init_ex(&hmac, key, EVP_MD_size(md_type), md_type, NULL); | 100 | HMAC_Init_ex(&hmac, key, md_size, md_type, NULL); |
| 97 | HMAC_Update(&hmac, p12->authsafes->d.data->data, | 101 | HMAC_Update(&hmac, p12->authsafes->d.data->data, |
| 98 | p12->authsafes->d.data->length); | 102 | p12->authsafes->d.data->length); |
| 99 | HMAC_Final(&hmac, mac, maclen); | 103 | HMAC_Final(&hmac, mac, maclen); |
diff --git a/src/lib/libcrypto/pkcs12/p12_npas.c b/src/lib/libcrypto/pkcs12/p12_npas.c index 47e5e9c377..2f71355150 100644 --- a/src/lib/libcrypto/pkcs12/p12_npas.c +++ b/src/lib/libcrypto/pkcs12/p12_npas.c | |||
| @@ -120,8 +120,13 @@ static int newpass_p12(PKCS12 *p12, char *oldpass, char *newpass) | |||
| 120 | bags = PKCS12_unpack_p7data(p7); | 120 | bags = PKCS12_unpack_p7data(p7); |
| 121 | } else if (bagnid == NID_pkcs7_encrypted) { | 121 | } else if (bagnid == NID_pkcs7_encrypted) { |
| 122 | bags = PKCS12_unpack_p7encdata(p7, oldpass, -1); | 122 | bags = PKCS12_unpack_p7encdata(p7, oldpass, -1); |
| 123 | alg_get(p7->d.encrypted->enc_data->algorithm, | 123 | if (!alg_get(p7->d.encrypted->enc_data->algorithm, |
| 124 | &pbe_nid, &pbe_iter, &pbe_saltlen); | 124 | &pbe_nid, &pbe_iter, &pbe_saltlen)) |
| 125 | { | ||
| 126 | sk_PKCS12_SAFEBAG_pop_free(bags, | ||
| 127 | PKCS12_SAFEBAG_free); | ||
| 128 | bags = NULL; | ||
| 129 | } | ||
| 125 | } else continue; | 130 | } else continue; |
| 126 | if (!bags) { | 131 | if (!bags) { |
| 127 | sk_PKCS7_pop_free(asafes, PKCS7_free); | 132 | sk_PKCS7_pop_free(asafes, PKCS7_free); |
| @@ -193,7 +198,9 @@ static int newpass_bag(PKCS12_SAFEBAG *bag, char *oldpass, char *newpass) | |||
| 193 | if(M_PKCS12_bag_type(bag) != NID_pkcs8ShroudedKeyBag) return 1; | 198 | if(M_PKCS12_bag_type(bag) != NID_pkcs8ShroudedKeyBag) return 1; |
| 194 | 199 | ||
| 195 | if (!(p8 = PKCS8_decrypt(bag->value.shkeybag, oldpass, -1))) return 0; | 200 | if (!(p8 = PKCS8_decrypt(bag->value.shkeybag, oldpass, -1))) return 0; |
| 196 | alg_get(bag->value.shkeybag->algor, &p8_nid, &p8_iter, &p8_saltlen); | 201 | if (!alg_get(bag->value.shkeybag->algor, &p8_nid, &p8_iter, |
| 202 | &p8_saltlen)) | ||
| 203 | return 0; | ||
| 197 | if(!(p8new = PKCS8_encrypt(p8_nid, NULL, newpass, -1, NULL, p8_saltlen, | 204 | if(!(p8new = PKCS8_encrypt(p8_nid, NULL, newpass, -1, NULL, p8_saltlen, |
| 198 | p8_iter, p8))) return 0; | 205 | p8_iter, p8))) return 0; |
| 199 | X509_SIG_free(bag->value.shkeybag); | 206 | X509_SIG_free(bag->value.shkeybag); |
| @@ -208,9 +215,11 @@ static int alg_get(X509_ALGOR *alg, int *pnid, int *piter, int *psaltlen) | |||
| 208 | 215 | ||
| 209 | p = alg->parameter->value.sequence->data; | 216 | p = alg->parameter->value.sequence->data; |
| 210 | pbe = d2i_PBEPARAM(NULL, &p, alg->parameter->value.sequence->length); | 217 | pbe = d2i_PBEPARAM(NULL, &p, alg->parameter->value.sequence->length); |
| 218 | if (!pbe) | ||
| 219 | return 0; | ||
| 211 | *pnid = OBJ_obj2nid(alg->algorithm); | 220 | *pnid = OBJ_obj2nid(alg->algorithm); |
| 212 | *piter = ASN1_INTEGER_get(pbe->iter); | 221 | *piter = ASN1_INTEGER_get(pbe->iter); |
| 213 | *psaltlen = pbe->salt->length; | 222 | *psaltlen = pbe->salt->length; |
| 214 | PBEPARAM_free(pbe); | 223 | PBEPARAM_free(pbe); |
| 215 | return 0; | 224 | return 1; |
| 216 | } | 225 | } |
diff --git a/src/lib/libcrypto/pkcs12/p12_utl.c b/src/lib/libcrypto/pkcs12/p12_utl.c index ca30ac4f6d..59c6f453f6 100644 --- a/src/lib/libcrypto/pkcs12/p12_utl.c +++ b/src/lib/libcrypto/pkcs12/p12_utl.c | |||
| @@ -62,7 +62,7 @@ | |||
| 62 | 62 | ||
| 63 | /* Cheap and nasty Unicode stuff */ | 63 | /* Cheap and nasty Unicode stuff */ |
| 64 | 64 | ||
| 65 | unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen) | 65 | unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen) |
| 66 | { | 66 | { |
| 67 | int ulen, i; | 67 | int ulen, i; |
| 68 | unsigned char *unitmp; | 68 | unsigned char *unitmp; |
| @@ -81,7 +81,7 @@ unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *un | |||
| 81 | return unitmp; | 81 | return unitmp; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | char *uni2asc(unsigned char *uni, int unilen) | 84 | char *OPENSSL_uni2asc(unsigned char *uni, int unilen) |
| 85 | { | 85 | { |
| 86 | int asclen, i; | 86 | int asclen, i; |
| 87 | char *asctmp; | 87 | char *asctmp; |
diff --git a/src/lib/libcrypto/pkcs12/pk12err.c b/src/lib/libcrypto/pkcs12/pk12err.c index 07a1fb6907..f6ddf2df12 100644 --- a/src/lib/libcrypto/pkcs12/pk12err.c +++ b/src/lib/libcrypto/pkcs12/pk12err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/pkcs12/pk12err.c */ | 1 | /* crypto/pkcs12/pk12err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h index 4bee605dc0..b17eb9f42b 100644 --- a/src/lib/libcrypto/pkcs12/pkcs12.h +++ b/src/lib/libcrypto/pkcs12/pkcs12.h | |||
| @@ -108,8 +108,6 @@ PKCS12_MAC_DATA *mac; | |||
| 108 | PKCS7 *authsafes; | 108 | PKCS7 *authsafes; |
| 109 | } PKCS12; | 109 | } PKCS12; |
| 110 | 110 | ||
| 111 | PREDECLARE_STACK_OF(PKCS12_SAFEBAG) | ||
| 112 | |||
| 113 | typedef struct { | 111 | typedef struct { |
| 114 | ASN1_OBJECT *type; | 112 | ASN1_OBJECT *type; |
| 115 | union { | 113 | union { |
| @@ -232,8 +230,8 @@ int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, | |||
| 232 | const EVP_MD *md_type); | 230 | const EVP_MD *md_type); |
| 233 | int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, | 231 | int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, |
| 234 | int saltlen, const EVP_MD *md_type); | 232 | int saltlen, const EVP_MD *md_type); |
| 235 | unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen); | 233 | unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen); |
| 236 | char *uni2asc(unsigned char *uni, int unilen); | 234 | char *OPENSSL_uni2asc(unsigned char *uni, int unilen); |
| 237 | 235 | ||
| 238 | DECLARE_ASN1_FUNCTIONS(PKCS12) | 236 | DECLARE_ASN1_FUNCTIONS(PKCS12) |
| 239 | DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) | 237 | DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) |
diff --git a/src/lib/libcrypto/pkcs7/Makefile.ssl b/src/lib/libcrypto/pkcs7/Makefile.ssl deleted file mode 100644 index c3bfc7d560..0000000000 --- a/src/lib/libcrypto/pkcs7/Makefile.ssl +++ /dev/null | |||
| @@ -1,243 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/pkcs7/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= pkcs7 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | PEX_LIBS= | ||
| 20 | EX_LIBS= | ||
| 21 | |||
| 22 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 23 | |||
| 24 | GENERAL=Makefile README | ||
| 25 | TEST= | ||
| 26 | APPS= | ||
| 27 | |||
| 28 | LIB=$(TOP)/libcrypto.a | ||
| 29 | LIBSRC= pk7_asn1.c pk7_lib.c pkcs7err.c pk7_doit.c pk7_smime.c pk7_attr.c \ | ||
| 30 | pk7_mime.c | ||
| 31 | LIBOBJ= pk7_asn1.o pk7_lib.o pkcs7err.o pk7_doit.o pk7_smime.o pk7_attr.o \ | ||
| 32 | pk7_mime.o | ||
| 33 | |||
| 34 | SRC= $(LIBSRC) | ||
| 35 | |||
| 36 | EXHEADER= pkcs7.h | ||
| 37 | HEADER= $(EXHEADER) | ||
| 38 | |||
| 39 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 40 | |||
| 41 | top: | ||
| 42 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 43 | |||
| 44 | test: | ||
| 45 | |||
| 46 | all: lib | ||
| 47 | |||
| 48 | testapps: enc dec sign verify | ||
| 49 | |||
| 50 | enc: enc.o lib | ||
| 51 | $(CC) $(CFLAGS) -o enc enc.o $(PEX_LIBS) $(LIB) $(EX_LIBS) | ||
| 52 | |||
| 53 | dec: dec.o lib | ||
| 54 | $(CC) $(CFLAGS) -o dec dec.o $(PEX_LIBS) $(LIB) $(EX_LIBS) | ||
| 55 | |||
| 56 | sign: sign.o lib | ||
| 57 | $(CC) $(CFLAGS) -o sign sign.o $(PEX_LIBS) $(LIB) $(EX_LIBS) | ||
| 58 | |||
| 59 | verify: verify.o example.o lib | ||
| 60 | $(CC) $(CFLAGS) -o verify verify.o $(PEX_LIBS) example.o $(LIB) $(EX_LIBS) | ||
| 61 | |||
| 62 | lib: $(LIBOBJ) | ||
| 63 | $(AR) $(LIB) $(LIBOBJ) | ||
| 64 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 65 | @touch lib | ||
| 66 | |||
| 67 | files: | ||
| 68 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 69 | |||
| 70 | links: | ||
| 71 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 72 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 73 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 74 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 75 | |||
| 76 | install: | ||
| 77 | @for i in $(EXHEADER) ; \ | ||
| 78 | do \ | ||
| 79 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 80 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 81 | done; | ||
| 82 | |||
| 83 | tags: | ||
| 84 | ctags $(SRC) | ||
| 85 | |||
| 86 | tests: | ||
| 87 | |||
| 88 | lint: | ||
| 89 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 90 | |||
| 91 | depend: | ||
| 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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff enc dec sign verify | ||
| 100 | |||
| 101 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 102 | |||
| 103 | pk7_asn1.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 104 | pk7_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 105 | pk7_asn1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 106 | pk7_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 107 | pk7_asn1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 108 | pk7_asn1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 109 | pk7_asn1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 110 | pk7_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 111 | pk7_asn1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 112 | pk7_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 113 | pk7_asn1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 114 | pk7_asn1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 115 | pk7_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 116 | pk7_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 117 | pk7_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 118 | pk7_asn1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 119 | pk7_asn1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 120 | pk7_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 121 | pk7_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 122 | pk7_asn1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 123 | pk7_asn1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 124 | pk7_asn1.o: ../cryptlib.h pk7_asn1.c | ||
| 125 | pk7_attr.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 126 | pk7_attr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 127 | pk7_attr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 128 | pk7_attr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 129 | pk7_attr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 130 | pk7_attr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 131 | pk7_attr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 132 | pk7_attr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 133 | pk7_attr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 134 | pk7_attr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 135 | pk7_attr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 136 | pk7_attr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 137 | pk7_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 138 | pk7_attr.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 139 | pk7_attr.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 140 | pk7_attr.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 141 | pk7_attr.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 142 | pk7_attr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 143 | pk7_attr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 144 | pk7_attr.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 145 | pk7_attr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 146 | pk7_attr.o: pk7_attr.c | ||
| 147 | pk7_doit.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 148 | pk7_doit.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 149 | pk7_doit.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 150 | pk7_doit.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 151 | pk7_doit.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 152 | pk7_doit.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 153 | pk7_doit.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 154 | pk7_doit.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 155 | pk7_doit.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 156 | pk7_doit.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 157 | pk7_doit.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 158 | pk7_doit.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 159 | pk7_doit.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 160 | pk7_doit.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 161 | pk7_doit.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 162 | pk7_doit.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 163 | pk7_doit.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 164 | pk7_doit.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 165 | pk7_doit.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 166 | pk7_doit.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 167 | pk7_doit.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 168 | pk7_doit.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 169 | pk7_doit.o: ../cryptlib.h pk7_doit.c | ||
| 170 | pk7_lib.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 171 | pk7_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 172 | pk7_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 173 | pk7_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 174 | pk7_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 175 | pk7_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 176 | pk7_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 177 | pk7_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 178 | pk7_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 179 | pk7_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 180 | pk7_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 181 | pk7_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 182 | pk7_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 183 | pk7_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 184 | pk7_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 185 | pk7_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 186 | pk7_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 187 | pk7_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 188 | pk7_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 189 | pk7_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 190 | pk7_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_lib.c | ||
| 191 | pk7_mime.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 192 | pk7_mime.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 193 | pk7_mime.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 194 | pk7_mime.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 195 | pk7_mime.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 196 | pk7_mime.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 197 | pk7_mime.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 198 | pk7_mime.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 199 | pk7_mime.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 200 | pk7_mime.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 201 | pk7_mime.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 202 | pk7_mime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 203 | pk7_mime.o: ../../include/openssl/opensslconf.h | ||
| 204 | pk7_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 205 | pk7_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 206 | pk7_mime.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 207 | pk7_mime.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 208 | pk7_mime.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 209 | pk7_mime.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 210 | pk7_mime.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 211 | pk7_mime.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 212 | pk7_mime.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_mime.c | ||
| 213 | pk7_smime.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 214 | pk7_smime.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 215 | pk7_smime.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 216 | pk7_smime.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 217 | pk7_smime.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 218 | pk7_smime.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 219 | pk7_smime.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 220 | pk7_smime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 221 | pk7_smime.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 222 | pk7_smime.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 223 | pk7_smime.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 224 | pk7_smime.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 225 | pk7_smime.o: ../../include/openssl/objects.h | ||
| 226 | pk7_smime.o: ../../include/openssl/opensslconf.h | ||
| 227 | pk7_smime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 228 | pk7_smime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 229 | pk7_smime.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 230 | pk7_smime.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 231 | pk7_smime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 232 | pk7_smime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 233 | pk7_smime.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 234 | pk7_smime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 235 | pk7_smime.o: ../../include/openssl/x509v3.h ../cryptlib.h pk7_smime.c | ||
| 236 | pkcs7err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 237 | pkcs7err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 238 | pkcs7err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 239 | pkcs7err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 240 | pkcs7err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 241 | pkcs7err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 242 | pkcs7err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 243 | pkcs7err.o: pkcs7err.c | ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_asn1.c b/src/lib/libcrypto/pkcs7/pk7_asn1.c index 1f70d31386..b7ec2883cb 100644 --- a/src/lib/libcrypto/pkcs7/pk7_asn1.c +++ b/src/lib/libcrypto/pkcs7/pk7_asn1.c | |||
| @@ -77,10 +77,39 @@ ASN1_ADB(PKCS7) = { | |||
| 77 | ADB_ENTRY(NID_pkcs7_encrypted, ASN1_NDEF_EXP_OPT(PKCS7, d.encrypted, PKCS7_ENCRYPT, 0)) | 77 | ADB_ENTRY(NID_pkcs7_encrypted, ASN1_NDEF_EXP_OPT(PKCS7, d.encrypted, PKCS7_ENCRYPT, 0)) |
| 78 | } ASN1_ADB_END(PKCS7, 0, type, 0, &p7default_tt, NULL); | 78 | } ASN1_ADB_END(PKCS7, 0, type, 0, &p7default_tt, NULL); |
| 79 | 79 | ||
| 80 | ASN1_NDEF_SEQUENCE(PKCS7) = { | 80 | /* PKCS#7 streaming support */ |
| 81 | static int pk7_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | ||
| 82 | void *exarg) | ||
| 83 | { | ||
| 84 | ASN1_STREAM_ARG *sarg = exarg; | ||
| 85 | PKCS7 **pp7 = (PKCS7 **)pval; | ||
| 86 | |||
| 87 | switch(operation) | ||
| 88 | { | ||
| 89 | |||
| 90 | case ASN1_OP_STREAM_PRE: | ||
| 91 | if (PKCS7_stream(&sarg->boundary, *pp7) <= 0) | ||
| 92 | return 0; | ||
| 93 | case ASN1_OP_DETACHED_PRE: | ||
| 94 | sarg->ndef_bio = PKCS7_dataInit(*pp7, sarg->out); | ||
| 95 | if (!sarg->ndef_bio) | ||
| 96 | return 0; | ||
| 97 | break; | ||
| 98 | |||
| 99 | case ASN1_OP_STREAM_POST: | ||
| 100 | case ASN1_OP_DETACHED_POST: | ||
| 101 | if (PKCS7_dataFinal(*pp7, sarg->ndef_bio) <= 0) | ||
| 102 | return 0; | ||
| 103 | break; | ||
| 104 | |||
| 105 | } | ||
| 106 | return 1; | ||
| 107 | } | ||
| 108 | |||
| 109 | ASN1_NDEF_SEQUENCE_cb(PKCS7, pk7_cb) = { | ||
| 81 | ASN1_SIMPLE(PKCS7, type, ASN1_OBJECT), | 110 | ASN1_SIMPLE(PKCS7, type, ASN1_OBJECT), |
| 82 | ASN1_ADB_OBJECT(PKCS7) | 111 | ASN1_ADB_OBJECT(PKCS7) |
| 83 | }ASN1_NDEF_SEQUENCE_END(PKCS7) | 112 | }ASN1_NDEF_SEQUENCE_END_cb(PKCS7, PKCS7) |
| 84 | 113 | ||
| 85 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7) | 114 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7) |
| 86 | IMPLEMENT_ASN1_NDEF_FUNCTION(PKCS7) | 115 | IMPLEMENT_ASN1_NDEF_FUNCTION(PKCS7) |
| @@ -98,7 +127,8 @@ ASN1_NDEF_SEQUENCE(PKCS7_SIGNED) = { | |||
| 98 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_SIGNED) | 127 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_SIGNED) |
| 99 | 128 | ||
| 100 | /* Minor tweak to operation: free up EVP_PKEY */ | 129 | /* Minor tweak to operation: free up EVP_PKEY */ |
| 101 | static int si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 130 | static int si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 131 | void *exarg) | ||
| 102 | { | 132 | { |
| 103 | if(operation == ASN1_OP_FREE_POST) { | 133 | if(operation == ASN1_OP_FREE_POST) { |
| 104 | PKCS7_SIGNER_INFO *si = (PKCS7_SIGNER_INFO *)*pval; | 134 | PKCS7_SIGNER_INFO *si = (PKCS7_SIGNER_INFO *)*pval; |
| @@ -140,7 +170,8 @@ ASN1_NDEF_SEQUENCE(PKCS7_ENVELOPE) = { | |||
| 140 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENVELOPE) | 170 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENVELOPE) |
| 141 | 171 | ||
| 142 | /* Minor tweak to operation: free up X509 */ | 172 | /* Minor tweak to operation: free up X509 */ |
| 143 | static int ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 173 | static int ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 174 | void *exarg) | ||
| 144 | { | 175 | { |
| 145 | if(operation == ASN1_OP_FREE_POST) { | 176 | if(operation == ASN1_OP_FREE_POST) { |
| 146 | PKCS7_RECIP_INFO *ri = (PKCS7_RECIP_INFO *)*pval; | 177 | PKCS7_RECIP_INFO *ri = (PKCS7_RECIP_INFO *)*pval; |
| @@ -161,7 +192,7 @@ IMPLEMENT_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) | |||
| 161 | ASN1_NDEF_SEQUENCE(PKCS7_ENC_CONTENT) = { | 192 | ASN1_NDEF_SEQUENCE(PKCS7_ENC_CONTENT) = { |
| 162 | ASN1_SIMPLE(PKCS7_ENC_CONTENT, content_type, ASN1_OBJECT), | 193 | ASN1_SIMPLE(PKCS7_ENC_CONTENT, content_type, ASN1_OBJECT), |
| 163 | ASN1_SIMPLE(PKCS7_ENC_CONTENT, algorithm, X509_ALGOR), | 194 | ASN1_SIMPLE(PKCS7_ENC_CONTENT, algorithm, X509_ALGOR), |
| 164 | ASN1_IMP_OPT(PKCS7_ENC_CONTENT, enc_data, ASN1_OCTET_STRING, 0) | 195 | ASN1_IMP_OPT(PKCS7_ENC_CONTENT, enc_data, ASN1_OCTET_STRING_NDEF, 0) |
| 165 | } ASN1_NDEF_SEQUENCE_END(PKCS7_ENC_CONTENT) | 196 | } ASN1_NDEF_SEQUENCE_END(PKCS7_ENC_CONTENT) |
| 166 | 197 | ||
| 167 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) | 198 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) |
| @@ -212,3 +243,5 @@ ASN1_ITEM_TEMPLATE(PKCS7_ATTR_VERIFY) = | |||
| 212 | ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_IMPTAG | ASN1_TFLG_UNIVERSAL, | 243 | ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_IMPTAG | ASN1_TFLG_UNIVERSAL, |
| 213 | V_ASN1_SET, PKCS7_ATTRIBUTES, X509_ATTRIBUTE) | 244 | V_ASN1_SET, PKCS7_ATTRIBUTES, X509_ATTRIBUTE) |
| 214 | ASN1_ITEM_TEMPLATE_END(PKCS7_ATTR_VERIFY) | 245 | ASN1_ITEM_TEMPLATE_END(PKCS7_ATTR_VERIFY) |
| 246 | |||
| 247 | IMPLEMENT_ASN1_PRINT_FUNCTION(PKCS7) | ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_attr.c b/src/lib/libcrypto/pkcs7/pk7_attr.c index d549717169..a97db51210 100644 --- a/src/lib/libcrypto/pkcs7/pk7_attr.c +++ b/src/lib/libcrypto/pkcs7/pk7_attr.c | |||
| @@ -60,6 +60,7 @@ | |||
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include <openssl/bio.h> | 61 | #include <openssl/bio.h> |
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1t.h> | ||
| 63 | #include <openssl/pem.h> | 64 | #include <openssl/pem.h> |
| 64 | #include <openssl/pkcs7.h> | 65 | #include <openssl/pkcs7.h> |
| 65 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
| @@ -68,27 +69,12 @@ | |||
| 68 | int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap) | 69 | int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK_OF(X509_ALGOR) *cap) |
| 69 | { | 70 | { |
| 70 | ASN1_STRING *seq; | 71 | ASN1_STRING *seq; |
| 71 | unsigned char *p, *pp; | ||
| 72 | int len; | ||
| 73 | len=i2d_ASN1_SET_OF_X509_ALGOR(cap,NULL,i2d_X509_ALGOR, | ||
| 74 | V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, | ||
| 75 | IS_SEQUENCE); | ||
| 76 | if(!(pp=(unsigned char *)OPENSSL_malloc(len))) { | ||
| 77 | PKCS7err(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP,ERR_R_MALLOC_FAILURE); | ||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | p=pp; | ||
| 81 | i2d_ASN1_SET_OF_X509_ALGOR(cap,&p,i2d_X509_ALGOR, V_ASN1_SEQUENCE, | ||
| 82 | V_ASN1_UNIVERSAL, IS_SEQUENCE); | ||
| 83 | if(!(seq = ASN1_STRING_new())) { | 72 | if(!(seq = ASN1_STRING_new())) { |
| 84 | PKCS7err(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP,ERR_R_MALLOC_FAILURE); | 73 | PKCS7err(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP,ERR_R_MALLOC_FAILURE); |
| 85 | return 0; | 74 | return 0; |
| 86 | } | 75 | } |
| 87 | if(!ASN1_STRING_set (seq, pp, len)) { | 76 | seq->length = ASN1_item_i2d((ASN1_VALUE *)cap,&seq->data, |
| 88 | PKCS7err(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP,ERR_R_MALLOC_FAILURE); | 77 | ASN1_ITEM_rptr(X509_ALGORS)); |
| 89 | return 0; | ||
| 90 | } | ||
| 91 | OPENSSL_free (pp); | ||
| 92 | return PKCS7_add_signed_attribute(si, NID_SMIMECapabilities, | 78 | return PKCS7_add_signed_attribute(si, NID_SMIMECapabilities, |
| 93 | V_ASN1_SEQUENCE, seq); | 79 | V_ASN1_SEQUENCE, seq); |
| 94 | } | 80 | } |
| @@ -102,10 +88,9 @@ STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si) | |||
| 102 | if (!cap || (cap->type != V_ASN1_SEQUENCE)) | 88 | if (!cap || (cap->type != V_ASN1_SEQUENCE)) |
| 103 | return NULL; | 89 | return NULL; |
| 104 | p = cap->value.sequence->data; | 90 | p = cap->value.sequence->data; |
| 105 | return d2i_ASN1_SET_OF_X509_ALGOR(NULL, &p, | 91 | return (STACK_OF(X509_ALGOR) *) |
| 106 | cap->value.sequence->length, | 92 | ASN1_item_d2i(NULL, &p, cap->value.sequence->length, |
| 107 | d2i_X509_ALGOR, X509_ALGOR_free, | 93 | ASN1_ITEM_rptr(X509_ALGORS)); |
| 108 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); | ||
| 109 | } | 94 | } |
| 110 | 95 | ||
| 111 | /* Basic smime-capabilities OID and optional integer arg */ | 96 | /* Basic smime-capabilities OID and optional integer arg */ |
| @@ -139,3 +124,42 @@ int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) | |||
| 139 | sk_X509_ALGOR_push (sk, alg); | 124 | sk_X509_ALGOR_push (sk, alg); |
| 140 | return 1; | 125 | return 1; |
| 141 | } | 126 | } |
| 127 | |||
| 128 | int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid) | ||
| 129 | { | ||
| 130 | if (PKCS7_get_signed_attribute(si, NID_pkcs9_contentType)) | ||
| 131 | return 0; | ||
| 132 | if (!coid) | ||
| 133 | coid = OBJ_nid2obj(NID_pkcs7_data); | ||
| 134 | return PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, | ||
| 135 | V_ASN1_OBJECT, coid); | ||
| 136 | } | ||
| 137 | |||
| 138 | int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t) | ||
| 139 | { | ||
| 140 | if (!t && !(t=X509_gmtime_adj(NULL,0))) | ||
| 141 | { | ||
| 142 | PKCS7err(PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME, | ||
| 143 | ERR_R_MALLOC_FAILURE); | ||
| 144 | return 0; | ||
| 145 | } | ||
| 146 | return PKCS7_add_signed_attribute(si, NID_pkcs9_signingTime, | ||
| 147 | V_ASN1_UTCTIME, t); | ||
| 148 | } | ||
| 149 | |||
| 150 | int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, | ||
| 151 | const unsigned char *md, int mdlen) | ||
| 152 | { | ||
| 153 | ASN1_OCTET_STRING *os; | ||
| 154 | os = ASN1_OCTET_STRING_new(); | ||
| 155 | if (!os) | ||
| 156 | return 0; | ||
| 157 | if (!ASN1_STRING_set(os, md, mdlen) | ||
| 158 | || !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, | ||
| 159 | V_ASN1_OCTET_STRING, os)) | ||
| 160 | { | ||
| 161 | ASN1_OCTET_STRING_free(os); | ||
| 162 | return 0; | ||
| 163 | } | ||
| 164 | return 1; | ||
| 165 | } | ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index a03d7ebedf..451de84489 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
| @@ -138,6 +138,121 @@ static int PKCS7_bio_add_digest(BIO **pbio, X509_ALGOR *alg) | |||
| 138 | 138 | ||
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | static int pkcs7_encode_rinfo(PKCS7_RECIP_INFO *ri, | ||
| 142 | unsigned char *key, int keylen) | ||
| 143 | { | ||
| 144 | EVP_PKEY_CTX *pctx = NULL; | ||
| 145 | EVP_PKEY *pkey = NULL; | ||
| 146 | unsigned char *ek = NULL; | ||
| 147 | int ret = 0; | ||
| 148 | size_t eklen; | ||
| 149 | |||
| 150 | pkey = X509_get_pubkey(ri->cert); | ||
| 151 | |||
| 152 | if (!pkey) | ||
| 153 | return 0; | ||
| 154 | |||
| 155 | pctx = EVP_PKEY_CTX_new(pkey, NULL); | ||
| 156 | if (!pctx) | ||
| 157 | return 0; | ||
| 158 | |||
| 159 | if (EVP_PKEY_encrypt_init(pctx) <= 0) | ||
| 160 | goto err; | ||
| 161 | |||
| 162 | if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_ENCRYPT, | ||
| 163 | EVP_PKEY_CTRL_PKCS7_ENCRYPT, 0, ri) <= 0) | ||
| 164 | { | ||
| 165 | PKCS7err(PKCS7_F_PKCS7_ENCODE_RINFO, PKCS7_R_CTRL_ERROR); | ||
| 166 | goto err; | ||
| 167 | } | ||
| 168 | |||
| 169 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, key, keylen) <= 0) | ||
| 170 | goto err; | ||
| 171 | |||
| 172 | ek = OPENSSL_malloc(eklen); | ||
| 173 | |||
| 174 | if (ek == NULL) | ||
| 175 | { | ||
| 176 | PKCS7err(PKCS7_F_PKCS7_ENCODE_RINFO, ERR_R_MALLOC_FAILURE); | ||
| 177 | goto err; | ||
| 178 | } | ||
| 179 | |||
| 180 | if (EVP_PKEY_encrypt(pctx, ek, &eklen, key, keylen) <= 0) | ||
| 181 | goto err; | ||
| 182 | |||
| 183 | ASN1_STRING_set0(ri->enc_key, ek, eklen); | ||
| 184 | ek = NULL; | ||
| 185 | |||
| 186 | ret = 1; | ||
| 187 | |||
| 188 | err: | ||
| 189 | if (pkey) | ||
| 190 | EVP_PKEY_free(pkey); | ||
| 191 | if (pctx) | ||
| 192 | EVP_PKEY_CTX_free(pctx); | ||
| 193 | if (ek) | ||
| 194 | OPENSSL_free(ek); | ||
| 195 | return ret; | ||
| 196 | |||
| 197 | } | ||
| 198 | |||
| 199 | |||
| 200 | static int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen, | ||
| 201 | PKCS7_RECIP_INFO *ri, EVP_PKEY *pkey) | ||
| 202 | { | ||
| 203 | EVP_PKEY_CTX *pctx = NULL; | ||
| 204 | unsigned char *ek = NULL; | ||
| 205 | size_t eklen; | ||
| 206 | |||
| 207 | int ret = 0; | ||
| 208 | |||
| 209 | pctx = EVP_PKEY_CTX_new(pkey, NULL); | ||
| 210 | if (!pctx) | ||
| 211 | return 0; | ||
| 212 | |||
| 213 | if (EVP_PKEY_decrypt_init(pctx) <= 0) | ||
| 214 | goto err; | ||
| 215 | |||
| 216 | if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DECRYPT, | ||
| 217 | EVP_PKEY_CTRL_PKCS7_DECRYPT, 0, ri) <= 0) | ||
| 218 | { | ||
| 219 | PKCS7err(PKCS7_F_PKCS7_DECRYPT_RINFO, PKCS7_R_CTRL_ERROR); | ||
| 220 | goto err; | ||
| 221 | } | ||
| 222 | |||
| 223 | if (EVP_PKEY_decrypt(pctx, NULL, &eklen, | ||
| 224 | ri->enc_key->data, ri->enc_key->length) <= 0) | ||
| 225 | goto err; | ||
| 226 | |||
| 227 | ek = OPENSSL_malloc(eklen); | ||
| 228 | |||
| 229 | if (ek == NULL) | ||
| 230 | { | ||
| 231 | PKCS7err(PKCS7_F_PKCS7_DECRYPT_RINFO, ERR_R_MALLOC_FAILURE); | ||
| 232 | goto err; | ||
| 233 | } | ||
| 234 | |||
| 235 | if (EVP_PKEY_decrypt(pctx, ek, &eklen, | ||
| 236 | ri->enc_key->data, ri->enc_key->length) <= 0) | ||
| 237 | { | ||
| 238 | PKCS7err(PKCS7_F_PKCS7_DECRYPT_RINFO, ERR_R_EVP_LIB); | ||
| 239 | goto err; | ||
| 240 | } | ||
| 241 | |||
| 242 | ret = 1; | ||
| 243 | |||
| 244 | *pek = ek; | ||
| 245 | *peklen = eklen; | ||
| 246 | |||
| 247 | err: | ||
| 248 | if (pctx) | ||
| 249 | EVP_PKEY_CTX_free(pctx); | ||
| 250 | if (!ret && ek) | ||
| 251 | OPENSSL_free(ek); | ||
| 252 | |||
| 253 | return ret; | ||
| 254 | } | ||
| 255 | |||
| 141 | BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | 256 | BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) |
| 142 | { | 257 | { |
| 143 | int i; | 258 | int i; |
| @@ -148,7 +263,6 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | |||
| 148 | STACK_OF(PKCS7_RECIP_INFO) *rsk=NULL; | 263 | STACK_OF(PKCS7_RECIP_INFO) *rsk=NULL; |
| 149 | X509_ALGOR *xalg=NULL; | 264 | X509_ALGOR *xalg=NULL; |
| 150 | PKCS7_RECIP_INFO *ri=NULL; | 265 | PKCS7_RECIP_INFO *ri=NULL; |
| 151 | EVP_PKEY *pkey; | ||
| 152 | ASN1_OCTET_STRING *os=NULL; | 266 | ASN1_OCTET_STRING *os=NULL; |
| 153 | 267 | ||
| 154 | i=OBJ_obj2nid(p7->type); | 268 | i=OBJ_obj2nid(p7->type); |
| @@ -187,6 +301,8 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | |||
| 187 | xa = p7->d.digest->md; | 301 | xa = p7->d.digest->md; |
| 188 | os = PKCS7_get_octet_string(p7->d.digest->contents); | 302 | os = PKCS7_get_octet_string(p7->d.digest->contents); |
| 189 | break; | 303 | break; |
| 304 | case NID_pkcs7_data: | ||
| 305 | break; | ||
| 190 | default: | 306 | default: |
| 191 | PKCS7err(PKCS7_F_PKCS7_DATAINIT,PKCS7_R_UNSUPPORTED_CONTENT_TYPE); | 307 | PKCS7err(PKCS7_F_PKCS7_DATAINIT,PKCS7_R_UNSUPPORTED_CONTENT_TYPE); |
| 192 | goto err; | 308 | goto err; |
| @@ -204,8 +320,6 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | |||
| 204 | unsigned char key[EVP_MAX_KEY_LENGTH]; | 320 | unsigned char key[EVP_MAX_KEY_LENGTH]; |
| 205 | unsigned char iv[EVP_MAX_IV_LENGTH]; | 321 | unsigned char iv[EVP_MAX_IV_LENGTH]; |
| 206 | int keylen,ivlen; | 322 | int keylen,ivlen; |
| 207 | int jj,max; | ||
| 208 | unsigned char *tmp; | ||
| 209 | EVP_CIPHER_CTX *ctx; | 323 | EVP_CIPHER_CTX *ctx; |
| 210 | 324 | ||
| 211 | if ((btmp=BIO_new(BIO_f_cipher())) == NULL) | 325 | if ((btmp=BIO_new(BIO_f_cipher())) == NULL) |
| @@ -234,52 +348,16 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | |||
| 234 | goto err; | 348 | goto err; |
| 235 | } | 349 | } |
| 236 | if(EVP_CIPHER_param_to_asn1(ctx, xalg->parameter) < 0) | 350 | if(EVP_CIPHER_param_to_asn1(ctx, xalg->parameter) < 0) |
| 237 | goto err; | 351 | goto err; |
| 238 | } | 352 | } |
| 239 | 353 | ||
| 240 | /* Lets do the pub key stuff :-) */ | 354 | /* Lets do the pub key stuff :-) */ |
| 241 | max=0; | ||
| 242 | for (i=0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++) | 355 | for (i=0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++) |
| 243 | { | 356 | { |
| 244 | ri=sk_PKCS7_RECIP_INFO_value(rsk,i); | 357 | ri=sk_PKCS7_RECIP_INFO_value(rsk,i); |
| 245 | if (ri->cert == NULL) | 358 | if (pkcs7_encode_rinfo(ri, key, keylen) <= 0) |
| 246 | { | ||
| 247 | PKCS7err(PKCS7_F_PKCS7_DATAINIT,PKCS7_R_MISSING_CERIPEND_INFO); | ||
| 248 | goto err; | ||
| 249 | } | ||
| 250 | if ((pkey=X509_get_pubkey(ri->cert)) == NULL) | ||
| 251 | goto err; | ||
| 252 | jj=EVP_PKEY_size(pkey); | ||
| 253 | EVP_PKEY_free(pkey); | ||
| 254 | if (max < jj) max=jj; | ||
| 255 | } | ||
| 256 | if ((tmp=(unsigned char *)OPENSSL_malloc(max)) == NULL) | ||
| 257 | { | ||
| 258 | PKCS7err(PKCS7_F_PKCS7_DATAINIT,ERR_R_MALLOC_FAILURE); | ||
| 259 | goto err; | ||
| 260 | } | ||
| 261 | for (i=0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++) | ||
| 262 | { | ||
| 263 | ri=sk_PKCS7_RECIP_INFO_value(rsk,i); | ||
| 264 | if ((pkey=X509_get_pubkey(ri->cert)) == NULL) | ||
| 265 | goto err; | ||
| 266 | jj=EVP_PKEY_encrypt(tmp,key,keylen,pkey); | ||
| 267 | EVP_PKEY_free(pkey); | ||
| 268 | if (jj <= 0) | ||
| 269 | { | ||
| 270 | PKCS7err(PKCS7_F_PKCS7_DATAINIT,ERR_R_EVP_LIB); | ||
| 271 | OPENSSL_free(tmp); | ||
| 272 | goto err; | 359 | goto err; |
| 273 | } | ||
| 274 | if (!M_ASN1_OCTET_STRING_set(ri->enc_key,tmp,jj)) | ||
| 275 | { | ||
| 276 | PKCS7err(PKCS7_F_PKCS7_DATAINIT, | ||
| 277 | ERR_R_MALLOC_FAILURE); | ||
| 278 | OPENSSL_free(tmp); | ||
| 279 | goto err; | ||
| 280 | } | ||
| 281 | } | 360 | } |
| 282 | OPENSSL_free(tmp); | ||
| 283 | OPENSSL_cleanse(key, keylen); | 361 | OPENSSL_cleanse(key, keylen); |
| 284 | 362 | ||
| 285 | if (out == NULL) | 363 | if (out == NULL) |
| @@ -303,7 +381,10 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | |||
| 303 | BIO_set_mem_eof_return(bio,0); | 381 | BIO_set_mem_eof_return(bio,0); |
| 304 | } | 382 | } |
| 305 | } | 383 | } |
| 306 | BIO_push(out,bio); | 384 | if (out) |
| 385 | BIO_push(out,bio); | ||
| 386 | else | ||
| 387 | out = bio; | ||
| 307 | bio=NULL; | 388 | bio=NULL; |
| 308 | if (0) | 389 | if (0) |
| 309 | { | 390 | { |
| @@ -333,7 +414,6 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 333 | { | 414 | { |
| 334 | int i,j; | 415 | int i,j; |
| 335 | BIO *out=NULL,*btmp=NULL,*etmp=NULL,*bio=NULL; | 416 | BIO *out=NULL,*btmp=NULL,*etmp=NULL,*bio=NULL; |
| 336 | unsigned char *tmp=NULL; | ||
| 337 | X509_ALGOR *xa; | 417 | X509_ALGOR *xa; |
| 338 | ASN1_OCTET_STRING *data_body=NULL; | 418 | ASN1_OCTET_STRING *data_body=NULL; |
| 339 | const EVP_MD *evp_md; | 419 | const EVP_MD *evp_md; |
| @@ -423,7 +503,8 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 423 | int max; | 503 | int max; |
| 424 | X509_OBJECT ret; | 504 | X509_OBJECT ret; |
| 425 | #endif | 505 | #endif |
| 426 | int jj; | 506 | unsigned char *ek = NULL; |
| 507 | int eklen; | ||
| 427 | 508 | ||
| 428 | if ((etmp=BIO_new(BIO_f_cipher())) == NULL) | 509 | if ((etmp=BIO_new(BIO_f_cipher())) == NULL) |
| 429 | { | 510 | { |
| @@ -438,26 +519,21 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 438 | * (if any) | 519 | * (if any) |
| 439 | */ | 520 | */ |
| 440 | 521 | ||
| 441 | if (pcert) { | 522 | if (pcert) |
| 442 | for (i=0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++) { | 523 | { |
| 524 | for (i=0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++) | ||
| 525 | { | ||
| 443 | ri=sk_PKCS7_RECIP_INFO_value(rsk,i); | 526 | ri=sk_PKCS7_RECIP_INFO_value(rsk,i); |
| 444 | if (!pkcs7_cmp_ri(ri, pcert)) | 527 | if (!pkcs7_cmp_ri(ri, pcert)) |
| 445 | break; | 528 | break; |
| 446 | ri=NULL; | 529 | ri=NULL; |
| 447 | } | 530 | } |
| 448 | if (ri == NULL) { | 531 | if (ri == NULL) |
| 532 | { | ||
| 449 | PKCS7err(PKCS7_F_PKCS7_DATADECODE, | 533 | PKCS7err(PKCS7_F_PKCS7_DATADECODE, |
| 450 | PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE); | 534 | PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE); |
| 451 | goto err; | 535 | goto err; |
| 452 | } | 536 | } |
| 453 | } | ||
| 454 | |||
| 455 | jj=EVP_PKEY_size(pkey); | ||
| 456 | tmp=(unsigned char *)OPENSSL_malloc(jj+10); | ||
| 457 | if (tmp == NULL) | ||
| 458 | { | ||
| 459 | PKCS7err(PKCS7_F_PKCS7_DATADECODE,ERR_R_MALLOC_FAILURE); | ||
| 460 | goto err; | ||
| 461 | } | 537 | } |
| 462 | 538 | ||
| 463 | /* If we haven't got a certificate try each ri in turn */ | 539 | /* If we haven't got a certificate try each ri in turn */ |
| @@ -467,11 +543,8 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 467 | for (i=0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++) | 543 | for (i=0; i<sk_PKCS7_RECIP_INFO_num(rsk); i++) |
| 468 | { | 544 | { |
| 469 | ri=sk_PKCS7_RECIP_INFO_value(rsk,i); | 545 | ri=sk_PKCS7_RECIP_INFO_value(rsk,i); |
| 470 | jj=EVP_PKEY_decrypt(tmp, | 546 | if (pkcs7_decrypt_rinfo(&ek, &eklen, |
| 471 | M_ASN1_STRING_data(ri->enc_key), | 547 | ri, pkey) > 0) |
| 472 | M_ASN1_STRING_length(ri->enc_key), | ||
| 473 | pkey); | ||
| 474 | if (jj > 0) | ||
| 475 | break; | 548 | break; |
| 476 | ERR_clear_error(); | 549 | ERR_clear_error(); |
| 477 | ri = NULL; | 550 | ri = NULL; |
| @@ -485,15 +558,8 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 485 | } | 558 | } |
| 486 | else | 559 | else |
| 487 | { | 560 | { |
| 488 | jj=EVP_PKEY_decrypt(tmp, | 561 | if (pkcs7_decrypt_rinfo(&ek, &eklen, ri, pkey) <= 0) |
| 489 | M_ASN1_STRING_data(ri->enc_key), | ||
| 490 | M_ASN1_STRING_length(ri->enc_key), pkey); | ||
| 491 | if (jj <= 0) | ||
| 492 | { | ||
| 493 | PKCS7err(PKCS7_F_PKCS7_DATADECODE, | ||
| 494 | ERR_R_EVP_LIB); | ||
| 495 | goto err; | 562 | goto err; |
| 496 | } | ||
| 497 | } | 563 | } |
| 498 | 564 | ||
| 499 | evp_ctx=NULL; | 565 | evp_ctx=NULL; |
| @@ -503,22 +569,26 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 503 | if (EVP_CIPHER_asn1_to_param(evp_ctx,enc_alg->parameter) < 0) | 569 | if (EVP_CIPHER_asn1_to_param(evp_ctx,enc_alg->parameter) < 0) |
| 504 | goto err; | 570 | goto err; |
| 505 | 571 | ||
| 506 | if (jj != EVP_CIPHER_CTX_key_length(evp_ctx)) { | 572 | if (eklen != EVP_CIPHER_CTX_key_length(evp_ctx)) { |
| 507 | /* Some S/MIME clients don't use the same key | 573 | /* Some S/MIME clients don't use the same key |
| 508 | * and effective key length. The key length is | 574 | * and effective key length. The key length is |
| 509 | * determined by the size of the decrypted RSA key. | 575 | * determined by the size of the decrypted RSA key. |
| 510 | */ | 576 | */ |
| 511 | if(!EVP_CIPHER_CTX_set_key_length(evp_ctx, jj)) | 577 | if(!EVP_CIPHER_CTX_set_key_length(evp_ctx, eklen)) |
| 512 | { | 578 | { |
| 513 | PKCS7err(PKCS7_F_PKCS7_DATADECODE, | 579 | PKCS7err(PKCS7_F_PKCS7_DATADECODE, |
| 514 | PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH); | 580 | PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH); |
| 515 | goto err; | 581 | goto err; |
| 516 | } | 582 | } |
| 517 | } | 583 | } |
| 518 | if (EVP_CipherInit_ex(evp_ctx,NULL,NULL,tmp,NULL,0) <= 0) | 584 | if (EVP_CipherInit_ex(evp_ctx,NULL,NULL,ek,NULL,0) <= 0) |
| 519 | goto err; | 585 | goto err; |
| 520 | 586 | ||
| 521 | OPENSSL_cleanse(tmp,jj); | 587 | if (ek) |
| 588 | { | ||
| 589 | OPENSSL_cleanse(ek,eklen); | ||
| 590 | OPENSSL_free(ek); | ||
| 591 | } | ||
| 522 | 592 | ||
| 523 | if (out == NULL) | 593 | if (out == NULL) |
| 524 | out=etmp; | 594 | out=etmp; |
| @@ -566,8 +636,6 @@ err: | |||
| 566 | if (bio != NULL) BIO_free_all(bio); | 636 | if (bio != NULL) BIO_free_all(bio); |
| 567 | out=NULL; | 637 | out=NULL; |
| 568 | } | 638 | } |
| 569 | if (tmp != NULL) | ||
| 570 | OPENSSL_free(tmp); | ||
| 571 | return(out); | 639 | return(out); |
| 572 | } | 640 | } |
| 573 | 641 | ||
| @@ -594,13 +662,43 @@ static BIO *PKCS7_find_digest(EVP_MD_CTX **pmd, BIO *bio, int nid) | |||
| 594 | return NULL; | 662 | return NULL; |
| 595 | } | 663 | } |
| 596 | 664 | ||
| 665 | static int do_pkcs7_signed_attrib(PKCS7_SIGNER_INFO *si, EVP_MD_CTX *mctx) | ||
| 666 | { | ||
| 667 | unsigned char md_data[EVP_MAX_MD_SIZE]; | ||
| 668 | unsigned int md_len; | ||
| 669 | |||
| 670 | /* Add signing time if not already present */ | ||
| 671 | if (!PKCS7_get_signed_attribute(si, NID_pkcs9_signingTime)) | ||
| 672 | { | ||
| 673 | if (!PKCS7_add0_attrib_signing_time(si, NULL)) | ||
| 674 | { | ||
| 675 | PKCS7err(PKCS7_F_DO_PKCS7_SIGNED_ATTRIB, | ||
| 676 | ERR_R_MALLOC_FAILURE); | ||
| 677 | return 0; | ||
| 678 | } | ||
| 679 | } | ||
| 680 | |||
| 681 | /* Add digest */ | ||
| 682 | EVP_DigestFinal_ex(mctx, md_data,&md_len); | ||
| 683 | if (!PKCS7_add1_attrib_digest(si, md_data, md_len)) | ||
| 684 | { | ||
| 685 | PKCS7err(PKCS7_F_DO_PKCS7_SIGNED_ATTRIB, ERR_R_MALLOC_FAILURE); | ||
| 686 | return 0; | ||
| 687 | } | ||
| 688 | |||
| 689 | /* Now sign the attributes */ | ||
| 690 | if (!PKCS7_SIGNER_INFO_sign(si)) | ||
| 691 | return 0; | ||
| 692 | |||
| 693 | return 1; | ||
| 694 | } | ||
| 695 | |||
| 696 | |||
| 597 | int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | 697 | int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) |
| 598 | { | 698 | { |
| 599 | int ret=0; | 699 | int ret=0; |
| 600 | int i,j; | 700 | int i,j; |
| 601 | BIO *btmp; | 701 | BIO *btmp; |
| 602 | BUF_MEM *buf_mem=NULL; | ||
| 603 | BUF_MEM *buf=NULL; | ||
| 604 | PKCS7_SIGNER_INFO *si; | 702 | PKCS7_SIGNER_INFO *si; |
| 605 | EVP_MD_CTX *mdc,ctx_tmp; | 703 | EVP_MD_CTX *mdc,ctx_tmp; |
| 606 | STACK_OF(X509_ATTRIBUTE) *sk; | 704 | STACK_OF(X509_ATTRIBUTE) *sk; |
| @@ -613,24 +711,37 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 613 | 711 | ||
| 614 | switch (i) | 712 | switch (i) |
| 615 | { | 713 | { |
| 714 | case NID_pkcs7_data: | ||
| 715 | os = p7->d.data; | ||
| 716 | break; | ||
| 616 | case NID_pkcs7_signedAndEnveloped: | 717 | case NID_pkcs7_signedAndEnveloped: |
| 617 | /* XXXXXXXXXXXXXXXX */ | 718 | /* XXXXXXXXXXXXXXXX */ |
| 618 | si_sk=p7->d.signed_and_enveloped->signer_info; | 719 | si_sk=p7->d.signed_and_enveloped->signer_info; |
| 619 | if (!(os=M_ASN1_OCTET_STRING_new())) | 720 | os = p7->d.signed_and_enveloped->enc_data->enc_data; |
| 721 | if (!os) | ||
| 620 | { | 722 | { |
| 621 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_MALLOC_FAILURE); | 723 | os=M_ASN1_OCTET_STRING_new(); |
| 622 | goto err; | 724 | if (!os) |
| 725 | { | ||
| 726 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_MALLOC_FAILURE); | ||
| 727 | goto err; | ||
| 728 | } | ||
| 729 | p7->d.signed_and_enveloped->enc_data->enc_data=os; | ||
| 623 | } | 730 | } |
| 624 | p7->d.signed_and_enveloped->enc_data->enc_data=os; | ||
| 625 | break; | 731 | break; |
| 626 | case NID_pkcs7_enveloped: | 732 | case NID_pkcs7_enveloped: |
| 627 | /* XXXXXXXXXXXXXXXX */ | 733 | /* XXXXXXXXXXXXXXXX */ |
| 628 | if (!(os=M_ASN1_OCTET_STRING_new())) | 734 | os = p7->d.enveloped->enc_data->enc_data; |
| 735 | if (!os) | ||
| 629 | { | 736 | { |
| 630 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_MALLOC_FAILURE); | 737 | os=M_ASN1_OCTET_STRING_new(); |
| 631 | goto err; | 738 | if (!os) |
| 739 | { | ||
| 740 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_MALLOC_FAILURE); | ||
| 741 | goto err; | ||
| 742 | } | ||
| 743 | p7->d.enveloped->enc_data->enc_data=os; | ||
| 632 | } | 744 | } |
| 633 | p7->d.enveloped->enc_data->enc_data=os; | ||
| 634 | break; | 745 | break; |
| 635 | case NID_pkcs7_signed: | 746 | case NID_pkcs7_signed: |
| 636 | si_sk=p7->d.sign->signer_info; | 747 | si_sk=p7->d.sign->signer_info; |
| @@ -652,21 +763,20 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 652 | } | 763 | } |
| 653 | break; | 764 | break; |
| 654 | 765 | ||
| 766 | default: | ||
| 767 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,PKCS7_R_UNSUPPORTED_CONTENT_TYPE); | ||
| 768 | goto err; | ||
| 655 | } | 769 | } |
| 656 | 770 | ||
| 657 | if (si_sk != NULL) | 771 | if (si_sk != NULL) |
| 658 | { | 772 | { |
| 659 | if ((buf=BUF_MEM_new()) == NULL) | ||
| 660 | { | ||
| 661 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_BIO_LIB); | ||
| 662 | goto err; | ||
| 663 | } | ||
| 664 | for (i=0; i<sk_PKCS7_SIGNER_INFO_num(si_sk); i++) | 773 | for (i=0; i<sk_PKCS7_SIGNER_INFO_num(si_sk); i++) |
| 665 | { | 774 | { |
| 666 | si=sk_PKCS7_SIGNER_INFO_value(si_sk,i); | 775 | si=sk_PKCS7_SIGNER_INFO_value(si_sk,i); |
| 667 | if (si->pkey == NULL) continue; | 776 | if (si->pkey == NULL) |
| 777 | continue; | ||
| 668 | 778 | ||
| 669 | j=OBJ_obj2nid(si->digest_alg->algorithm); | 779 | j = OBJ_obj2nid(si->digest_alg->algorithm); |
| 670 | 780 | ||
| 671 | btmp=bio; | 781 | btmp=bio; |
| 672 | 782 | ||
| @@ -678,97 +788,33 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 678 | /* We now have the EVP_MD_CTX, lets do the | 788 | /* We now have the EVP_MD_CTX, lets do the |
| 679 | * signing. */ | 789 | * signing. */ |
| 680 | EVP_MD_CTX_copy_ex(&ctx_tmp,mdc); | 790 | EVP_MD_CTX_copy_ex(&ctx_tmp,mdc); |
| 681 | if (!BUF_MEM_grow_clean(buf,EVP_PKEY_size(si->pkey))) | ||
| 682 | { | ||
| 683 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_BIO_LIB); | ||
| 684 | goto err; | ||
| 685 | } | ||
| 686 | 791 | ||
| 687 | sk=si->auth_attr; | 792 | sk=si->auth_attr; |
| 688 | 793 | ||
| 689 | /* If there are attributes, we add the digest | 794 | /* If there are attributes, we add the digest |
| 690 | * attribute and only sign the attributes */ | 795 | * attribute and only sign the attributes */ |
| 691 | if ((sk != NULL) && (sk_X509_ATTRIBUTE_num(sk) != 0)) | 796 | if (sk_X509_ATTRIBUTE_num(sk) > 0) |
| 692 | { | 797 | { |
| 693 | unsigned char md_data[EVP_MAX_MD_SIZE], *abuf=NULL; | 798 | if (!do_pkcs7_signed_attrib(si, &ctx_tmp)) |
| 694 | unsigned int md_len, alen; | ||
| 695 | ASN1_OCTET_STRING *digest; | ||
| 696 | ASN1_UTCTIME *sign_time; | ||
| 697 | const EVP_MD *md_tmp; | ||
| 698 | |||
| 699 | /* Add signing time if not already present */ | ||
| 700 | if (!PKCS7_get_signed_attribute(si, | ||
| 701 | NID_pkcs9_signingTime)) | ||
| 702 | { | ||
| 703 | if (!(sign_time=X509_gmtime_adj(NULL,0))) | ||
| 704 | { | ||
| 705 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL, | ||
| 706 | ERR_R_MALLOC_FAILURE); | ||
| 707 | goto err; | ||
| 708 | } | ||
| 709 | if (!PKCS7_add_signed_attribute(si, | ||
| 710 | NID_pkcs9_signingTime, | ||
| 711 | V_ASN1_UTCTIME,sign_time)) | ||
| 712 | { | ||
| 713 | M_ASN1_UTCTIME_free(sign_time); | ||
| 714 | goto err; | ||
| 715 | } | ||
| 716 | } | ||
| 717 | |||
| 718 | /* Add digest */ | ||
| 719 | md_tmp=EVP_MD_CTX_md(&ctx_tmp); | ||
| 720 | EVP_DigestFinal_ex(&ctx_tmp,md_data,&md_len); | ||
| 721 | if (!(digest=M_ASN1_OCTET_STRING_new())) | ||
| 722 | { | ||
| 723 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL, | ||
| 724 | ERR_R_MALLOC_FAILURE); | ||
| 725 | goto err; | 799 | goto err; |
| 726 | } | 800 | } |
| 727 | if (!M_ASN1_OCTET_STRING_set(digest,md_data, | 801 | else |
| 728 | md_len)) | 802 | { |
| 729 | { | 803 | unsigned char *abuf = NULL; |
| 730 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL, | 804 | unsigned int abuflen; |
| 731 | ERR_R_MALLOC_FAILURE); | 805 | abuflen = EVP_PKEY_size(si->pkey); |
| 732 | M_ASN1_OCTET_STRING_free(digest); | 806 | abuf = OPENSSL_malloc(abuflen); |
| 807 | if (!abuf) | ||
| 733 | goto err; | 808 | goto err; |
| 734 | } | 809 | |
| 735 | if (!PKCS7_add_signed_attribute(si, | 810 | if (!EVP_SignFinal(&ctx_tmp, abuf, &abuflen, |
| 736 | NID_pkcs9_messageDigest, | 811 | si->pkey)) |
| 737 | V_ASN1_OCTET_STRING,digest)) | ||
| 738 | { | 812 | { |
| 739 | M_ASN1_OCTET_STRING_free(digest); | 813 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL, |
| 814 | ERR_R_EVP_LIB); | ||
| 740 | goto err; | 815 | goto err; |
| 741 | } | 816 | } |
| 742 | 817 | ASN1_STRING_set0(si->enc_digest, abuf, abuflen); | |
| 743 | /* Now sign the attributes */ | ||
| 744 | EVP_SignInit_ex(&ctx_tmp,md_tmp,NULL); | ||
| 745 | alen = ASN1_item_i2d((ASN1_VALUE *)sk,&abuf, | ||
| 746 | ASN1_ITEM_rptr(PKCS7_ATTR_SIGN)); | ||
| 747 | if(!abuf) goto err; | ||
| 748 | EVP_SignUpdate(&ctx_tmp,abuf,alen); | ||
| 749 | OPENSSL_free(abuf); | ||
| 750 | } | ||
| 751 | |||
| 752 | #ifndef OPENSSL_NO_DSA | ||
| 753 | if (si->pkey->type == EVP_PKEY_DSA) | ||
| 754 | ctx_tmp.digest=EVP_dss1(); | ||
| 755 | #endif | ||
| 756 | #ifndef OPENSSL_NO_ECDSA | ||
| 757 | if (si->pkey->type == EVP_PKEY_EC) | ||
| 758 | ctx_tmp.digest=EVP_ecdsa(); | ||
| 759 | #endif | ||
| 760 | |||
| 761 | if (!EVP_SignFinal(&ctx_tmp,(unsigned char *)buf->data, | ||
| 762 | (unsigned int *)&buf->length,si->pkey)) | ||
| 763 | { | ||
| 764 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_EVP_LIB); | ||
| 765 | goto err; | ||
| 766 | } | ||
| 767 | if (!ASN1_STRING_set(si->enc_digest, | ||
| 768 | (unsigned char *)buf->data,buf->length)) | ||
| 769 | { | ||
| 770 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,ERR_R_ASN1_LIB); | ||
| 771 | goto err; | ||
| 772 | } | 818 | } |
| 773 | } | 819 | } |
| 774 | } | 820 | } |
| @@ -783,34 +829,90 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 783 | M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len); | 829 | M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len); |
| 784 | } | 830 | } |
| 785 | 831 | ||
| 786 | if (!PKCS7_is_detached(p7)) | 832 | if (!PKCS7_is_detached(p7) && !(os->flags & ASN1_STRING_FLAG_NDEF)) |
| 787 | { | 833 | { |
| 834 | char *cont; | ||
| 835 | long contlen; | ||
| 788 | btmp=BIO_find_type(bio,BIO_TYPE_MEM); | 836 | btmp=BIO_find_type(bio,BIO_TYPE_MEM); |
| 789 | if (btmp == NULL) | 837 | if (btmp == NULL) |
| 790 | { | 838 | { |
| 791 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,PKCS7_R_UNABLE_TO_FIND_MEM_BIO); | 839 | PKCS7err(PKCS7_F_PKCS7_DATAFINAL,PKCS7_R_UNABLE_TO_FIND_MEM_BIO); |
| 792 | goto err; | 840 | goto err; |
| 793 | } | 841 | } |
| 794 | BIO_get_mem_ptr(btmp,&buf_mem); | 842 | contlen = BIO_get_mem_data(btmp, &cont); |
| 795 | /* Mark the BIO read only then we can use its copy of the data | 843 | /* Mark the BIO read only then we can use its copy of the data |
| 796 | * instead of making an extra copy. | 844 | * instead of making an extra copy. |
| 797 | */ | 845 | */ |
| 798 | BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY); | 846 | BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY); |
| 799 | BIO_set_mem_eof_return(btmp, 0); | 847 | BIO_set_mem_eof_return(btmp, 0); |
| 800 | os->data = (unsigned char *)buf_mem->data; | 848 | ASN1_STRING_set0(os, (unsigned char *)cont, contlen); |
| 801 | os->length = buf_mem->length; | ||
| 802 | #if 0 | ||
| 803 | M_ASN1_OCTET_STRING_set(os, | ||
| 804 | (unsigned char *)buf_mem->data,buf_mem->length); | ||
| 805 | #endif | ||
| 806 | } | 849 | } |
| 807 | ret=1; | 850 | ret=1; |
| 808 | err: | 851 | err: |
| 809 | EVP_MD_CTX_cleanup(&ctx_tmp); | 852 | EVP_MD_CTX_cleanup(&ctx_tmp); |
| 810 | if (buf != NULL) BUF_MEM_free(buf); | ||
| 811 | return(ret); | 853 | return(ret); |
| 812 | } | 854 | } |
| 813 | 855 | ||
| 856 | int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) | ||
| 857 | { | ||
| 858 | EVP_MD_CTX mctx; | ||
| 859 | EVP_PKEY_CTX *pctx; | ||
| 860 | unsigned char *abuf = NULL; | ||
| 861 | int alen; | ||
| 862 | size_t siglen; | ||
| 863 | const EVP_MD *md = NULL; | ||
| 864 | |||
| 865 | md = EVP_get_digestbyobj(si->digest_alg->algorithm); | ||
| 866 | if (md == NULL) | ||
| 867 | return 0; | ||
| 868 | |||
| 869 | EVP_MD_CTX_init(&mctx); | ||
| 870 | if (EVP_DigestSignInit(&mctx, &pctx, md,NULL, si->pkey) <= 0) | ||
| 871 | goto err; | ||
| 872 | |||
| 873 | if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN, | ||
| 874 | EVP_PKEY_CTRL_PKCS7_SIGN, 0, si) <= 0) | ||
| 875 | { | ||
| 876 | PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SIGN, PKCS7_R_CTRL_ERROR); | ||
| 877 | goto err; | ||
| 878 | } | ||
| 879 | |||
| 880 | alen = ASN1_item_i2d((ASN1_VALUE *)si->auth_attr,&abuf, | ||
| 881 | ASN1_ITEM_rptr(PKCS7_ATTR_SIGN)); | ||
| 882 | if(!abuf) | ||
| 883 | goto err; | ||
| 884 | if (EVP_DigestSignUpdate(&mctx,abuf,alen) <= 0) | ||
| 885 | goto err; | ||
| 886 | OPENSSL_free(abuf); | ||
| 887 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) | ||
| 888 | goto err; | ||
| 889 | abuf = OPENSSL_malloc(siglen); | ||
| 890 | if(!abuf) | ||
| 891 | goto err; | ||
| 892 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) | ||
| 893 | goto err; | ||
| 894 | |||
| 895 | if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN, | ||
| 896 | EVP_PKEY_CTRL_PKCS7_SIGN, 1, si) <= 0) | ||
| 897 | { | ||
| 898 | PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SIGN, PKCS7_R_CTRL_ERROR); | ||
| 899 | goto err; | ||
| 900 | } | ||
| 901 | |||
| 902 | EVP_MD_CTX_cleanup(&mctx); | ||
| 903 | |||
| 904 | ASN1_STRING_set0(si->enc_digest, abuf, siglen); | ||
| 905 | |||
| 906 | return 1; | ||
| 907 | |||
| 908 | err: | ||
| 909 | if (abuf) | ||
| 910 | OPENSSL_free(abuf); | ||
| 911 | EVP_MD_CTX_cleanup(&mctx); | ||
| 912 | return 0; | ||
| 913 | |||
| 914 | } | ||
| 915 | |||
| 814 | int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio, | 916 | int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio, |
| 815 | PKCS7 *p7, PKCS7_SIGNER_INFO *si) | 917 | PKCS7 *p7, PKCS7_SIGNER_INFO *si) |
| 816 | { | 918 | { |
| @@ -922,7 +1024,8 @@ int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, | |||
| 922 | if ((sk != NULL) && (sk_X509_ATTRIBUTE_num(sk) != 0)) | 1024 | if ((sk != NULL) && (sk_X509_ATTRIBUTE_num(sk) != 0)) |
| 923 | { | 1025 | { |
| 924 | unsigned char md_dat[EVP_MAX_MD_SIZE], *abuf = NULL; | 1026 | unsigned char md_dat[EVP_MAX_MD_SIZE], *abuf = NULL; |
| 925 | unsigned int md_len, alen; | 1027 | unsigned int md_len; |
| 1028 | int alen; | ||
| 926 | ASN1_OCTET_STRING *message_digest; | 1029 | ASN1_OCTET_STRING *message_digest; |
| 927 | 1030 | ||
| 928 | EVP_DigestFinal_ex(&mdc_tmp,md_dat,&md_len); | 1031 | EVP_DigestFinal_ex(&mdc_tmp,md_dat,&md_len); |
| @@ -954,6 +1057,12 @@ for (ii=0; ii<md_len; ii++) printf("%02X",md_dat[ii]); printf(" calc\n"); | |||
| 954 | 1057 | ||
| 955 | alen = ASN1_item_i2d((ASN1_VALUE *)sk, &abuf, | 1058 | alen = ASN1_item_i2d((ASN1_VALUE *)sk, &abuf, |
| 956 | ASN1_ITEM_rptr(PKCS7_ATTR_VERIFY)); | 1059 | ASN1_ITEM_rptr(PKCS7_ATTR_VERIFY)); |
| 1060 | if (alen <= 0) | ||
| 1061 | { | ||
| 1062 | PKCS7err(PKCS7_F_PKCS7_SIGNATUREVERIFY,ERR_R_ASN1_LIB); | ||
| 1063 | ret = -1; | ||
| 1064 | goto err; | ||
| 1065 | } | ||
| 957 | EVP_VerifyUpdate(&mdc_tmp, abuf, alen); | 1066 | EVP_VerifyUpdate(&mdc_tmp, abuf, alen); |
| 958 | 1067 | ||
| 959 | OPENSSL_free(abuf); | 1068 | OPENSSL_free(abuf); |
| @@ -966,12 +1075,6 @@ for (ii=0; ii<md_len; ii++) printf("%02X",md_dat[ii]); printf(" calc\n"); | |||
| 966 | ret = -1; | 1075 | ret = -1; |
| 967 | goto err; | 1076 | goto err; |
| 968 | } | 1077 | } |
| 969 | #ifndef OPENSSL_NO_DSA | ||
| 970 | if(pkey->type == EVP_PKEY_DSA) mdc_tmp.digest=EVP_dss1(); | ||
| 971 | #endif | ||
| 972 | #ifndef OPENSSL_NO_ECDSA | ||
| 973 | if (pkey->type == EVP_PKEY_EC) mdc_tmp.digest=EVP_ecdsa(); | ||
| 974 | #endif | ||
| 975 | 1078 | ||
| 976 | i=EVP_VerifyFinal(&mdc_tmp,os->data,os->length, pkey); | 1079 | i=EVP_VerifyFinal(&mdc_tmp,os->data,os->length, pkey); |
| 977 | EVP_PKEY_free(pkey); | 1080 | EVP_PKEY_free(pkey); |
| @@ -1107,8 +1210,9 @@ static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, | |||
| 1107 | 1210 | ||
| 1108 | if (*sk == NULL) | 1211 | if (*sk == NULL) |
| 1109 | { | 1212 | { |
| 1110 | if (!(*sk = sk_X509_ATTRIBUTE_new_null())) | 1213 | *sk = sk_X509_ATTRIBUTE_new_null(); |
| 1111 | return 0; | 1214 | if (*sk == NULL) |
| 1215 | return 0; | ||
| 1112 | new_attrib: | 1216 | new_attrib: |
| 1113 | if (!(attr=X509_ATTRIBUTE_create(nid,atrtype,value))) | 1217 | if (!(attr=X509_ATTRIBUTE_create(nid,atrtype,value))) |
| 1114 | return 0; | 1218 | return 0; |
diff --git a/src/lib/libcrypto/pkcs7/pk7_lib.c b/src/lib/libcrypto/pkcs7/pk7_lib.c index f2490941a3..3ca0952792 100644 --- a/src/lib/libcrypto/pkcs7/pk7_lib.c +++ b/src/lib/libcrypto/pkcs7/pk7_lib.c | |||
| @@ -60,6 +60,7 @@ | |||
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/objects.h> | 61 | #include <openssl/objects.h> |
| 62 | #include <openssl/x509.h> | 62 | #include <openssl/x509.h> |
| 63 | #include "asn1_locl.h" | ||
| 63 | 64 | ||
| 64 | long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg) | 65 | long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg) |
| 65 | { | 66 | { |
| @@ -314,7 +315,7 @@ int PKCS7_add_certificate(PKCS7 *p7, X509 *x509) | |||
| 314 | *sk=sk_X509_new_null(); | 315 | *sk=sk_X509_new_null(); |
| 315 | if (*sk == NULL) | 316 | if (*sk == NULL) |
| 316 | { | 317 | { |
| 317 | PKCS7err(PKCS7_F_PKCS7_ADD_CERTIFICATE,ERR_R_MALLOC_FAILURE); | 318 | PKCS7err(PKCS7_F_PKCS7_ADD_CERTIFICATE, ERR_R_MALLOC_FAILURE); |
| 318 | return 0; | 319 | return 0; |
| 319 | } | 320 | } |
| 320 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); | 321 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); |
| @@ -365,13 +366,8 @@ int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl) | |||
| 365 | int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, | 366 | int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, |
| 366 | const EVP_MD *dgst) | 367 | const EVP_MD *dgst) |
| 367 | { | 368 | { |
| 368 | int nid; | 369 | int ret; |
| 369 | char is_dsa; | ||
| 370 | 370 | ||
| 371 | if (pkey->type == EVP_PKEY_DSA || pkey->type == EVP_PKEY_EC) | ||
| 372 | is_dsa = 1; | ||
| 373 | else | ||
| 374 | is_dsa = 0; | ||
| 375 | /* We now need to add another PKCS7_SIGNER_INFO entry */ | 371 | /* We now need to add another PKCS7_SIGNER_INFO entry */ |
| 376 | if (!ASN1_INTEGER_set(p7i->version,1)) | 372 | if (!ASN1_INTEGER_set(p7i->version,1)) |
| 377 | goto err; | 373 | goto err; |
| @@ -391,65 +387,55 @@ int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, | |||
| 391 | p7i->pkey=pkey; | 387 | p7i->pkey=pkey; |
| 392 | 388 | ||
| 393 | /* Set the algorithms */ | 389 | /* Set the algorithms */ |
| 394 | if (is_dsa) p7i->digest_alg->algorithm=OBJ_nid2obj(NID_sha1); | ||
| 395 | else | ||
| 396 | p7i->digest_alg->algorithm=OBJ_nid2obj(EVP_MD_type(dgst)); | ||
| 397 | 390 | ||
| 398 | if (p7i->digest_alg->parameter != NULL) | 391 | X509_ALGOR_set0(p7i->digest_alg, OBJ_nid2obj(EVP_MD_type(dgst)), |
| 399 | ASN1_TYPE_free(p7i->digest_alg->parameter); | 392 | V_ASN1_NULL, NULL); |
| 400 | if ((p7i->digest_alg->parameter=ASN1_TYPE_new()) == NULL) | ||
| 401 | goto err; | ||
| 402 | p7i->digest_alg->parameter->type=V_ASN1_NULL; | ||
| 403 | 393 | ||
| 404 | if (p7i->digest_enc_alg->parameter != NULL) | 394 | if (pkey->ameth && pkey->ameth->pkey_ctrl) |
| 405 | ASN1_TYPE_free(p7i->digest_enc_alg->parameter); | ||
| 406 | nid = EVP_PKEY_type(pkey->type); | ||
| 407 | if (nid == EVP_PKEY_RSA) | ||
| 408 | { | 395 | { |
| 409 | p7i->digest_enc_alg->algorithm=OBJ_nid2obj(NID_rsaEncryption); | 396 | ret = pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_PKCS7_SIGN, |
| 410 | if (!(p7i->digest_enc_alg->parameter=ASN1_TYPE_new())) | 397 | 0, p7i); |
| 411 | goto err; | 398 | if (ret > 0) |
| 412 | p7i->digest_enc_alg->parameter->type=V_ASN1_NULL; | 399 | return 1; |
| 413 | } | 400 | if (ret != -2) |
| 414 | else if (nid == EVP_PKEY_DSA) | 401 | { |
| 415 | { | 402 | PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SET, |
| 416 | #if 1 | 403 | PKCS7_R_SIGNING_CTRL_FAILURE); |
| 417 | /* use 'dsaEncryption' OID for compatibility with other software | 404 | return 0; |
| 418 | * (PKCS #7 v1.5 does specify how to handle DSA) ... */ | 405 | } |
| 419 | p7i->digest_enc_alg->algorithm=OBJ_nid2obj(NID_dsa); | ||
| 420 | #else | ||
| 421 | /* ... although the 'dsaWithSHA1' OID (as required by RFC 2630 for CMS) | ||
| 422 | * would make more sense. */ | ||
| 423 | p7i->digest_enc_alg->algorithm=OBJ_nid2obj(NID_dsaWithSHA1); | ||
| 424 | #endif | ||
| 425 | p7i->digest_enc_alg->parameter = NULL; /* special case for DSA: omit 'parameter'! */ | ||
| 426 | } | ||
| 427 | else if (nid == EVP_PKEY_EC) | ||
| 428 | { | ||
| 429 | p7i->digest_enc_alg->algorithm=OBJ_nid2obj(NID_ecdsa_with_SHA1); | ||
| 430 | if (!(p7i->digest_enc_alg->parameter=ASN1_TYPE_new())) | ||
| 431 | goto err; | ||
| 432 | p7i->digest_enc_alg->parameter->type=V_ASN1_NULL; | ||
| 433 | } | 406 | } |
| 434 | else | 407 | PKCS7err(PKCS7_F_PKCS7_SIGNER_INFO_SET, |
| 435 | return(0); | 408 | PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE); |
| 436 | |||
| 437 | return(1); | ||
| 438 | err: | 409 | err: |
| 439 | return(0); | 410 | return 0; |
| 440 | } | 411 | } |
| 441 | 412 | ||
| 442 | PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, EVP_PKEY *pkey, | 413 | PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, EVP_PKEY *pkey, |
| 443 | const EVP_MD *dgst) | 414 | const EVP_MD *dgst) |
| 444 | { | 415 | { |
| 445 | PKCS7_SIGNER_INFO *si; | 416 | PKCS7_SIGNER_INFO *si = NULL; |
| 417 | |||
| 418 | if (dgst == NULL) | ||
| 419 | { | ||
| 420 | int def_nid; | ||
| 421 | if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) <= 0) | ||
| 422 | goto err; | ||
| 423 | dgst = EVP_get_digestbynid(def_nid); | ||
| 424 | if (dgst == NULL) | ||
| 425 | { | ||
| 426 | PKCS7err(PKCS7_F_PKCS7_ADD_SIGNATURE, | ||
| 427 | PKCS7_R_NO_DEFAULT_DIGEST); | ||
| 428 | goto err; | ||
| 429 | } | ||
| 430 | } | ||
| 446 | 431 | ||
| 447 | if ((si=PKCS7_SIGNER_INFO_new()) == NULL) goto err; | 432 | if ((si=PKCS7_SIGNER_INFO_new()) == NULL) goto err; |
| 448 | if (!PKCS7_SIGNER_INFO_set(si,x509,pkey,dgst)) goto err; | 433 | if (!PKCS7_SIGNER_INFO_set(si,x509,pkey,dgst)) goto err; |
| 449 | if (!PKCS7_add_signer(p7,si)) goto err; | 434 | if (!PKCS7_add_signer(p7,si)) goto err; |
| 450 | return(si); | 435 | return(si); |
| 451 | err: | 436 | err: |
| 452 | PKCS7_SIGNER_INFO_free(si); | 437 | if (si) |
| 438 | PKCS7_SIGNER_INFO_free(si); | ||
| 453 | return(NULL); | 439 | return(NULL); |
| 454 | } | 440 | } |
| 455 | 441 | ||
| @@ -485,6 +471,23 @@ STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7) | |||
| 485 | return(NULL); | 471 | return(NULL); |
| 486 | } | 472 | } |
| 487 | 473 | ||
| 474 | void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, | ||
| 475 | X509_ALGOR **pdig, X509_ALGOR **psig) | ||
| 476 | { | ||
| 477 | if (pk) | ||
| 478 | *pk = si->pkey; | ||
| 479 | if (pdig) | ||
| 480 | *pdig = si->digest_alg; | ||
| 481 | if (psig) | ||
| 482 | *psig = si->digest_enc_alg; | ||
| 483 | } | ||
| 484 | |||
| 485 | void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc) | ||
| 486 | { | ||
| 487 | if (penc) | ||
| 488 | *penc = ri->key_enc_algor; | ||
| 489 | } | ||
| 490 | |||
| 488 | PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509) | 491 | PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509) |
| 489 | { | 492 | { |
| 490 | PKCS7_RECIP_INFO *ri; | 493 | PKCS7_RECIP_INFO *ri; |
| @@ -492,10 +495,11 @@ PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509) | |||
| 492 | if ((ri=PKCS7_RECIP_INFO_new()) == NULL) goto err; | 495 | if ((ri=PKCS7_RECIP_INFO_new()) == NULL) goto err; |
| 493 | if (!PKCS7_RECIP_INFO_set(ri,x509)) goto err; | 496 | if (!PKCS7_RECIP_INFO_set(ri,x509)) goto err; |
| 494 | if (!PKCS7_add_recipient_info(p7,ri)) goto err; | 497 | if (!PKCS7_add_recipient_info(p7,ri)) goto err; |
| 495 | return(ri); | 498 | return ri; |
| 496 | err: | 499 | err: |
| 497 | PKCS7_RECIP_INFO_free(ri); | 500 | if (ri) |
| 498 | return(NULL); | 501 | PKCS7_RECIP_INFO_free(ri); |
| 502 | return NULL; | ||
| 499 | } | 503 | } |
| 500 | 504 | ||
| 501 | int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri) | 505 | int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri) |
| @@ -524,6 +528,8 @@ int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri) | |||
| 524 | 528 | ||
| 525 | int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) | 529 | int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) |
| 526 | { | 530 | { |
| 531 | int ret; | ||
| 532 | EVP_PKEY *pkey = NULL; | ||
| 527 | if (!ASN1_INTEGER_set(p7i->version,0)) | 533 | if (!ASN1_INTEGER_set(p7i->version,0)) |
| 528 | return 0; | 534 | return 0; |
| 529 | if (!X509_NAME_set(&p7i->issuer_and_serial->issuer, | 535 | if (!X509_NAME_set(&p7i->issuer_and_serial->issuer, |
| @@ -535,14 +541,41 @@ int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) | |||
| 535 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)))) | 541 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)))) |
| 536 | return 0; | 542 | return 0; |
| 537 | 543 | ||
| 538 | X509_ALGOR_free(p7i->key_enc_algor); | 544 | pkey = X509_get_pubkey(x509); |
| 539 | if (!(p7i->key_enc_algor= X509_ALGOR_dup(x509->cert_info->key->algor))) | 545 | |
| 540 | return 0; | 546 | if (!pkey || !pkey->ameth || !pkey->ameth->pkey_ctrl) |
| 547 | { | ||
| 548 | PKCS7err(PKCS7_F_PKCS7_RECIP_INFO_SET, | ||
| 549 | PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE); | ||
| 550 | goto err; | ||
| 551 | } | ||
| 552 | |||
| 553 | ret = pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_PKCS7_ENCRYPT, | ||
| 554 | 0, p7i); | ||
| 555 | if (ret == -2) | ||
| 556 | { | ||
| 557 | PKCS7err(PKCS7_F_PKCS7_RECIP_INFO_SET, | ||
| 558 | PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE); | ||
| 559 | goto err; | ||
| 560 | } | ||
| 561 | if (ret <= 0) | ||
| 562 | { | ||
| 563 | PKCS7err(PKCS7_F_PKCS7_RECIP_INFO_SET, | ||
| 564 | PKCS7_R_ENCRYPTION_CTRL_FAILURE); | ||
| 565 | goto err; | ||
| 566 | } | ||
| 567 | |||
| 568 | EVP_PKEY_free(pkey); | ||
| 541 | 569 | ||
| 542 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); | 570 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); |
| 543 | p7i->cert=x509; | 571 | p7i->cert=x509; |
| 544 | 572 | ||
| 545 | return(1); | 573 | return 1; |
| 574 | |||
| 575 | err: | ||
| 576 | if (pkey) | ||
| 577 | EVP_PKEY_free(pkey); | ||
| 578 | return 0; | ||
| 546 | } | 579 | } |
| 547 | 580 | ||
| 548 | X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si) | 581 | X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si) |
| @@ -587,3 +620,48 @@ int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher) | |||
| 587 | return 1; | 620 | return 1; |
| 588 | } | 621 | } |
| 589 | 622 | ||
| 623 | int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7) | ||
| 624 | { | ||
| 625 | ASN1_OCTET_STRING *os = NULL; | ||
| 626 | |||
| 627 | switch (OBJ_obj2nid(p7->type)) | ||
| 628 | { | ||
| 629 | case NID_pkcs7_data: | ||
| 630 | os = p7->d.data; | ||
| 631 | break; | ||
| 632 | |||
| 633 | case NID_pkcs7_signedAndEnveloped: | ||
| 634 | os = p7->d.signed_and_enveloped->enc_data->enc_data; | ||
| 635 | if (os == NULL) | ||
| 636 | { | ||
| 637 | os=M_ASN1_OCTET_STRING_new(); | ||
| 638 | p7->d.signed_and_enveloped->enc_data->enc_data=os; | ||
| 639 | } | ||
| 640 | break; | ||
| 641 | |||
| 642 | case NID_pkcs7_enveloped: | ||
| 643 | os = p7->d.enveloped->enc_data->enc_data; | ||
| 644 | if (os == NULL) | ||
| 645 | { | ||
| 646 | os=M_ASN1_OCTET_STRING_new(); | ||
| 647 | p7->d.enveloped->enc_data->enc_data=os; | ||
| 648 | } | ||
| 649 | break; | ||
| 650 | |||
| 651 | case NID_pkcs7_signed: | ||
| 652 | os=p7->d.sign->contents->d.data; | ||
| 653 | break; | ||
| 654 | |||
| 655 | default: | ||
| 656 | os = NULL; | ||
| 657 | break; | ||
| 658 | } | ||
| 659 | |||
| 660 | if (os == NULL) | ||
| 661 | return 0; | ||
| 662 | |||
| 663 | os->flags |= ASN1_STRING_FLAG_NDEF; | ||
| 664 | *boundary = &os->data; | ||
| 665 | |||
| 666 | return 1; | ||
| 667 | } | ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_mime.c b/src/lib/libcrypto/pkcs7/pk7_mime.c index bf190360d7..938f79a646 100644 --- a/src/lib/libcrypto/pkcs7/pk7_mime.c +++ b/src/lib/libcrypto/pkcs7/pk7_mime.c | |||
| @@ -50,10 +50,6 @@ | |||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | * ==================================================================== | 51 | * ==================================================================== |
| 52 | * | 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 | */ | 53 | */ |
| 58 | 54 | ||
| 59 | #include <stdio.h> | 55 | #include <stdio.h> |
| @@ -61,662 +57,41 @@ | |||
| 61 | #include "cryptlib.h" | 57 | #include "cryptlib.h" |
| 62 | #include <openssl/rand.h> | 58 | #include <openssl/rand.h> |
| 63 | #include <openssl/x509.h> | 59 | #include <openssl/x509.h> |
| 60 | #include <openssl/asn1.h> | ||
| 64 | 61 | ||
| 65 | /* MIME and related routines */ | 62 | /* PKCS#7 wrappers round generalised stream and MIME routines */ |
| 66 | |||
| 67 | /* MIME format structures | ||
| 68 | * Note that all are translated to lower case apart from | ||
| 69 | * parameter values. Quotes are stripped off | ||
| 70 | */ | ||
| 71 | |||
| 72 | typedef struct { | ||
| 73 | char *param_name; /* Param name e.g. "micalg" */ | ||
| 74 | char *param_value; /* Param value e.g. "sha1" */ | ||
| 75 | } MIME_PARAM; | ||
| 76 | |||
| 77 | DECLARE_STACK_OF(MIME_PARAM) | ||
| 78 | IMPLEMENT_STACK_OF(MIME_PARAM) | ||
| 79 | |||
| 80 | typedef struct { | ||
| 81 | char *name; /* Name of line e.g. "content-type" */ | ||
| 82 | char *value; /* Value of line e.g. "text/plain" */ | ||
| 83 | STACK_OF(MIME_PARAM) *params; /* Zero or more parameters */ | ||
| 84 | } MIME_HEADER; | ||
| 85 | 63 | ||
| 86 | DECLARE_STACK_OF(MIME_HEADER) | 64 | int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags) |
| 87 | IMPLEMENT_STACK_OF(MIME_HEADER) | 65 | { |
| 88 | 66 | return i2d_ASN1_bio_stream(out, (ASN1_VALUE *)p7, in, flags, | |
| 89 | static int pkcs7_output_data(BIO *bio, BIO *data, PKCS7 *p7, int flags); | 67 | ASN1_ITEM_rptr(PKCS7)); |
| 90 | static int B64_write_PKCS7(BIO *bio, PKCS7 *p7); | ||
| 91 | static PKCS7 *B64_read_PKCS7(BIO *bio); | ||
| 92 | static char * strip_ends(char *name); | ||
| 93 | static char * strip_start(char *name); | ||
| 94 | static char * strip_end(char *name); | ||
| 95 | static MIME_HEADER *mime_hdr_new(char *name, char *value); | ||
| 96 | static int mime_hdr_addparam(MIME_HEADER *mhdr, char *name, char *value); | ||
| 97 | static STACK_OF(MIME_HEADER) *mime_parse_hdr(BIO *bio); | ||
| 98 | static int mime_hdr_cmp(const MIME_HEADER * const *a, | ||
| 99 | const MIME_HEADER * const *b); | ||
| 100 | static int mime_param_cmp(const MIME_PARAM * const *a, | ||
| 101 | const MIME_PARAM * const *b); | ||
| 102 | static void mime_param_free(MIME_PARAM *param); | ||
| 103 | static int mime_bound_check(char *line, int linelen, char *bound, int blen); | ||
| 104 | static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret); | ||
| 105 | static int strip_eol(char *linebuf, int *plen); | ||
| 106 | static MIME_HEADER *mime_hdr_find(STACK_OF(MIME_HEADER) *hdrs, char *name); | ||
| 107 | static MIME_PARAM *mime_param_find(MIME_HEADER *hdr, char *name); | ||
| 108 | static void mime_hdr_free(MIME_HEADER *hdr); | ||
| 109 | |||
| 110 | #define MAX_SMLEN 1024 | ||
| 111 | #define mime_debug(x) /* x */ | ||
| 112 | |||
| 113 | /* Base 64 read and write of PKCS#7 structure */ | ||
| 114 | |||
| 115 | static int B64_write_PKCS7(BIO *bio, PKCS7 *p7) | ||
| 116 | { | ||
| 117 | BIO *b64; | ||
| 118 | if(!(b64 = BIO_new(BIO_f_base64()))) { | ||
| 119 | PKCS7err(PKCS7_F_B64_WRITE_PKCS7,ERR_R_MALLOC_FAILURE); | ||
| 120 | return 0; | ||
| 121 | } | 68 | } |
| 122 | bio = BIO_push(b64, bio); | ||
| 123 | i2d_PKCS7_bio(bio, p7); | ||
| 124 | (void)BIO_flush(bio); | ||
| 125 | bio = BIO_pop(bio); | ||
| 126 | BIO_free(b64); | ||
| 127 | return 1; | ||
| 128 | } | ||
| 129 | 69 | ||
| 130 | static PKCS7 *B64_read_PKCS7(BIO *bio) | 70 | int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags) |
| 131 | { | 71 | { |
| 132 | BIO *b64; | 72 | return PEM_write_bio_ASN1_stream(out, (ASN1_VALUE *) p7, in, flags, |
| 133 | PKCS7 *p7; | 73 | "PKCS7", |
| 134 | if(!(b64 = BIO_new(BIO_f_base64()))) { | 74 | ASN1_ITEM_rptr(PKCS7)); |
| 135 | PKCS7err(PKCS7_F_B64_READ_PKCS7,ERR_R_MALLOC_FAILURE); | ||
| 136 | return 0; | ||
| 137 | } | 75 | } |
| 138 | bio = BIO_push(b64, bio); | ||
| 139 | if(!(p7 = d2i_PKCS7_bio(bio, NULL))) | ||
| 140 | PKCS7err(PKCS7_F_B64_READ_PKCS7,PKCS7_R_DECODE_ERROR); | ||
| 141 | (void)BIO_flush(bio); | ||
| 142 | bio = BIO_pop(bio); | ||
| 143 | BIO_free(b64); | ||
| 144 | return p7; | ||
| 145 | } | ||
| 146 | |||
| 147 | /* SMIME sender */ | ||
| 148 | 76 | ||
| 149 | int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags) | 77 | int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags) |
| 150 | { | ||
| 151 | char bound[33], c; | ||
| 152 | int i; | ||
| 153 | char *mime_prefix, *mime_eol, *msg_type=NULL; | ||
| 154 | if (flags & PKCS7_NOOLDMIMETYPE) | ||
| 155 | mime_prefix = "application/pkcs7-"; | ||
| 156 | else | ||
| 157 | mime_prefix = "application/x-pkcs7-"; | ||
| 158 | |||
| 159 | if (flags & PKCS7_CRLFEOL) | ||
| 160 | mime_eol = "\r\n"; | ||
| 161 | else | ||
| 162 | mime_eol = "\n"; | ||
| 163 | if((flags & PKCS7_DETACHED) && data) { | ||
| 164 | /* We want multipart/signed */ | ||
| 165 | /* Generate a random boundary */ | ||
| 166 | RAND_pseudo_bytes((unsigned char *)bound, 32); | ||
| 167 | for(i = 0; i < 32; i++) { | ||
| 168 | c = bound[i] & 0xf; | ||
| 169 | if(c < 10) c += '0'; | ||
| 170 | else c += 'A' - 10; | ||
| 171 | bound[i] = c; | ||
| 172 | } | ||
| 173 | bound[32] = 0; | ||
| 174 | BIO_printf(bio, "MIME-Version: 1.0%s", mime_eol); | ||
| 175 | BIO_printf(bio, "Content-Type: multipart/signed;"); | ||
| 176 | BIO_printf(bio, " protocol=\"%ssignature\";", mime_prefix); | ||
| 177 | BIO_printf(bio, " micalg=sha1; boundary=\"----%s\"%s%s", | ||
| 178 | bound, mime_eol, mime_eol); | ||
| 179 | BIO_printf(bio, "This is an S/MIME signed message%s%s", | ||
| 180 | mime_eol, mime_eol); | ||
| 181 | /* Now write out the first part */ | ||
| 182 | BIO_printf(bio, "------%s%s", bound, mime_eol); | ||
| 183 | pkcs7_output_data(bio, data, p7, flags); | ||
| 184 | BIO_printf(bio, "%s------%s%s", mime_eol, bound, mime_eol); | ||
| 185 | |||
| 186 | /* Headers for signature */ | ||
| 187 | |||
| 188 | BIO_printf(bio, "Content-Type: %ssignature;", mime_prefix); | ||
| 189 | BIO_printf(bio, " name=\"smime.p7s\"%s", mime_eol); | ||
| 190 | BIO_printf(bio, "Content-Transfer-Encoding: base64%s", | ||
| 191 | mime_eol); | ||
| 192 | BIO_printf(bio, "Content-Disposition: attachment;"); | ||
| 193 | BIO_printf(bio, " filename=\"smime.p7s\"%s%s", | ||
| 194 | mime_eol, mime_eol); | ||
| 195 | B64_write_PKCS7(bio, p7); | ||
| 196 | BIO_printf(bio,"%s------%s--%s%s", mime_eol, bound, | ||
| 197 | mime_eol, mime_eol); | ||
| 198 | return 1; | ||
| 199 | } | ||
| 200 | |||
| 201 | /* Determine smime-type header */ | ||
| 202 | |||
| 203 | if (PKCS7_type_is_enveloped(p7)) | ||
| 204 | msg_type = "enveloped-data"; | ||
| 205 | else if (PKCS7_type_is_signed(p7)) | ||
| 206 | { | ||
| 207 | /* If we have any signers it is signed-data othewise | ||
| 208 | * certs-only. | ||
| 209 | */ | ||
| 210 | STACK_OF(PKCS7_SIGNER_INFO) *sinfos; | ||
| 211 | sinfos = PKCS7_get_signer_info(p7); | ||
| 212 | if (sk_PKCS7_SIGNER_INFO_num(sinfos) > 0) | ||
| 213 | msg_type = "signed-data"; | ||
| 214 | else | ||
| 215 | msg_type = "certs-only"; | ||
| 216 | } | ||
| 217 | /* MIME headers */ | ||
| 218 | BIO_printf(bio, "MIME-Version: 1.0%s", mime_eol); | ||
| 219 | BIO_printf(bio, "Content-Disposition: attachment;"); | ||
| 220 | BIO_printf(bio, " filename=\"smime.p7m\"%s", mime_eol); | ||
| 221 | BIO_printf(bio, "Content-Type: %smime;", mime_prefix); | ||
| 222 | if (msg_type) | ||
| 223 | BIO_printf(bio, " smime-type=%s;", msg_type); | ||
| 224 | BIO_printf(bio, " name=\"smime.p7m\"%s", mime_eol); | ||
| 225 | BIO_printf(bio, "Content-Transfer-Encoding: base64%s%s", | ||
| 226 | mime_eol, mime_eol); | ||
| 227 | B64_write_PKCS7(bio, p7); | ||
| 228 | BIO_printf(bio, "%s", mime_eol); | ||
| 229 | return 1; | ||
| 230 | } | ||
| 231 | |||
| 232 | /* Handle output of PKCS#7 data */ | ||
| 233 | |||
| 234 | |||
| 235 | static int pkcs7_output_data(BIO *out, BIO *data, PKCS7 *p7, int flags) | ||
| 236 | { | 78 | { |
| 237 | BIO *tmpbio, *p7bio; | 79 | STACK_OF(X509_ALGOR) *mdalgs; |
| 238 | 80 | int ctype_nid = OBJ_obj2nid(p7->type); | |
| 239 | if (!(flags & PKCS7_STREAM)) | 81 | if (ctype_nid == NID_pkcs7_signed) |
| 240 | { | 82 | mdalgs = p7->d.sign->md_algs; |
| 241 | SMIME_crlf_copy(data, out, flags); | 83 | else |
| 242 | return 1; | 84 | mdalgs = NULL; |
| 243 | } | ||
| 244 | |||
| 245 | /* Partial sign operation */ | ||
| 246 | |||
| 247 | /* Initialize sign operation */ | ||
| 248 | p7bio = PKCS7_dataInit(p7, out); | ||
| 249 | |||
| 250 | /* Copy data across, computing digests etc */ | ||
| 251 | SMIME_crlf_copy(data, p7bio, flags); | ||
| 252 | |||
| 253 | /* Must be detached */ | ||
| 254 | PKCS7_set_detached(p7, 1); | ||
| 255 | |||
| 256 | /* Finalize signatures */ | ||
| 257 | PKCS7_dataFinal(p7, p7bio); | ||
| 258 | |||
| 259 | /* Now remove any digests prepended to the BIO */ | ||
| 260 | 85 | ||
| 261 | while (p7bio != out) | 86 | flags ^= SMIME_OLDMIME; |
| 262 | { | ||
| 263 | tmpbio = BIO_pop(p7bio); | ||
| 264 | BIO_free(p7bio); | ||
| 265 | p7bio = tmpbio; | ||
| 266 | } | ||
| 267 | 87 | ||
| 268 | return 1; | ||
| 269 | 88 | ||
| 89 | return SMIME_write_ASN1(bio, (ASN1_VALUE *)p7, data, flags, | ||
| 90 | ctype_nid, NID_undef, mdalgs, | ||
| 91 | ASN1_ITEM_rptr(PKCS7)); | ||
| 270 | } | 92 | } |
| 271 | 93 | ||
| 272 | /* SMIME reader: handle multipart/signed and opaque signing. | ||
| 273 | * in multipart case the content is placed in a memory BIO | ||
| 274 | * pointed to by "bcont". In opaque this is set to NULL | ||
| 275 | */ | ||
| 276 | |||
| 277 | PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont) | 94 | PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont) |
| 278 | { | ||
| 279 | BIO *p7in; | ||
| 280 | STACK_OF(MIME_HEADER) *headers = NULL; | ||
| 281 | STACK_OF(BIO) *parts = NULL; | ||
| 282 | MIME_HEADER *hdr; | ||
| 283 | MIME_PARAM *prm; | ||
| 284 | PKCS7 *p7; | ||
| 285 | int ret; | ||
| 286 | |||
| 287 | if(bcont) *bcont = NULL; | ||
| 288 | |||
| 289 | if (!(headers = mime_parse_hdr(bio))) { | ||
| 290 | PKCS7err(PKCS7_F_SMIME_READ_PKCS7,PKCS7_R_MIME_PARSE_ERROR); | ||
| 291 | return NULL; | ||
| 292 | } | ||
| 293 | |||
| 294 | if(!(hdr = mime_hdr_find(headers, "content-type")) || !hdr->value) { | ||
| 295 | sk_MIME_HEADER_pop_free(headers, mime_hdr_free); | ||
| 296 | PKCS7err(PKCS7_F_SMIME_READ_PKCS7, PKCS7_R_NO_CONTENT_TYPE); | ||
| 297 | return NULL; | ||
| 298 | } | ||
| 299 | |||
| 300 | /* Handle multipart/signed */ | ||
| 301 | |||
| 302 | if(!strcmp(hdr->value, "multipart/signed")) { | ||
| 303 | /* Split into two parts */ | ||
| 304 | prm = mime_param_find(hdr, "boundary"); | ||
| 305 | if(!prm || !prm->param_value) { | ||
| 306 | sk_MIME_HEADER_pop_free(headers, mime_hdr_free); | ||
| 307 | PKCS7err(PKCS7_F_SMIME_READ_PKCS7, PKCS7_R_NO_MULTIPART_BOUNDARY); | ||
| 308 | return NULL; | ||
| 309 | } | ||
| 310 | ret = multi_split(bio, prm->param_value, &parts); | ||
| 311 | sk_MIME_HEADER_pop_free(headers, mime_hdr_free); | ||
| 312 | if(!ret || (sk_BIO_num(parts) != 2) ) { | ||
| 313 | PKCS7err(PKCS7_F_SMIME_READ_PKCS7, PKCS7_R_NO_MULTIPART_BODY_FAILURE); | ||
| 314 | sk_BIO_pop_free(parts, BIO_vfree); | ||
| 315 | return NULL; | ||
| 316 | } | ||
| 317 | |||
| 318 | /* Parse the signature piece */ | ||
| 319 | p7in = sk_BIO_value(parts, 1); | ||
| 320 | |||
| 321 | if (!(headers = mime_parse_hdr(p7in))) { | ||
| 322 | PKCS7err(PKCS7_F_SMIME_READ_PKCS7,PKCS7_R_MIME_SIG_PARSE_ERROR); | ||
| 323 | sk_BIO_pop_free(parts, BIO_vfree); | ||
| 324 | return NULL; | ||
| 325 | } | ||
| 326 | |||
| 327 | /* Get content type */ | ||
| 328 | |||
| 329 | if(!(hdr = mime_hdr_find(headers, "content-type")) || | ||
| 330 | !hdr->value) { | ||
| 331 | sk_MIME_HEADER_pop_free(headers, mime_hdr_free); | ||
| 332 | PKCS7err(PKCS7_F_SMIME_READ_PKCS7, PKCS7_R_NO_SIG_CONTENT_TYPE); | ||
| 333 | return NULL; | ||
| 334 | } | ||
| 335 | |||
| 336 | if(strcmp(hdr->value, "application/x-pkcs7-signature") && | ||
| 337 | strcmp(hdr->value, "application/pkcs7-signature")) { | ||
| 338 | sk_MIME_HEADER_pop_free(headers, mime_hdr_free); | ||
| 339 | PKCS7err(PKCS7_F_SMIME_READ_PKCS7,PKCS7_R_SIG_INVALID_MIME_TYPE); | ||
| 340 | ERR_add_error_data(2, "type: ", hdr->value); | ||
| 341 | sk_BIO_pop_free(parts, BIO_vfree); | ||
| 342 | return NULL; | ||
| 343 | } | ||
| 344 | sk_MIME_HEADER_pop_free(headers, mime_hdr_free); | ||
| 345 | /* Read in PKCS#7 */ | ||
| 346 | if(!(p7 = B64_read_PKCS7(p7in))) { | ||
| 347 | PKCS7err(PKCS7_F_SMIME_READ_PKCS7,PKCS7_R_PKCS7_SIG_PARSE_ERROR); | ||
| 348 | sk_BIO_pop_free(parts, BIO_vfree); | ||
| 349 | return NULL; | ||
| 350 | } | ||
| 351 | |||
| 352 | if(bcont) { | ||
| 353 | *bcont = sk_BIO_value(parts, 0); | ||
| 354 | BIO_free(p7in); | ||
| 355 | sk_BIO_free(parts); | ||
| 356 | } else sk_BIO_pop_free(parts, BIO_vfree); | ||
| 357 | return p7; | ||
| 358 | } | ||
| 359 | |||
| 360 | /* OK, if not multipart/signed try opaque signature */ | ||
| 361 | |||
| 362 | if (strcmp (hdr->value, "application/x-pkcs7-mime") && | ||
| 363 | strcmp (hdr->value, "application/pkcs7-mime")) { | ||
| 364 | PKCS7err(PKCS7_F_SMIME_READ_PKCS7,PKCS7_R_INVALID_MIME_TYPE); | ||
| 365 | ERR_add_error_data(2, "type: ", hdr->value); | ||
| 366 | sk_MIME_HEADER_pop_free(headers, mime_hdr_free); | ||
| 367 | return NULL; | ||
| 368 | } | ||
| 369 | |||
| 370 | sk_MIME_HEADER_pop_free(headers, mime_hdr_free); | ||
| 371 | |||
| 372 | if(!(p7 = B64_read_PKCS7(bio))) { | ||
| 373 | PKCS7err(PKCS7_F_SMIME_READ_PKCS7, PKCS7_R_PKCS7_PARSE_ERROR); | ||
| 374 | return NULL; | ||
| 375 | } | ||
| 376 | return p7; | ||
| 377 | |||
| 378 | } | ||
| 379 | |||
| 380 | /* Split a multipart/XXX message body into component parts: result is | ||
| 381 | * canonical parts in a STACK of bios | ||
| 382 | */ | ||
| 383 | |||
| 384 | static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret) | ||
| 385 | { | ||
| 386 | char linebuf[MAX_SMLEN]; | ||
| 387 | int len, blen; | ||
| 388 | int eol = 0, next_eol = 0; | ||
| 389 | BIO *bpart = NULL; | ||
| 390 | STACK_OF(BIO) *parts; | ||
| 391 | char state, part, first; | ||
| 392 | |||
| 393 | blen = strlen(bound); | ||
| 394 | part = 0; | ||
| 395 | state = 0; | ||
| 396 | first = 1; | ||
| 397 | parts = sk_BIO_new_null(); | ||
| 398 | *ret = parts; | ||
| 399 | while ((len = BIO_gets(bio, linebuf, MAX_SMLEN)) > 0) { | ||
| 400 | state = mime_bound_check(linebuf, len, bound, blen); | ||
| 401 | if(state == 1) { | ||
| 402 | first = 1; | ||
| 403 | part++; | ||
| 404 | } else if(state == 2) { | ||
| 405 | sk_BIO_push(parts, bpart); | ||
| 406 | return 1; | ||
| 407 | } else if(part) { | ||
| 408 | /* Strip CR+LF from linebuf */ | ||
| 409 | next_eol = strip_eol(linebuf, &len); | ||
| 410 | if(first) { | ||
| 411 | first = 0; | ||
| 412 | if(bpart) sk_BIO_push(parts, bpart); | ||
| 413 | bpart = BIO_new(BIO_s_mem()); | ||
| 414 | BIO_set_mem_eof_return(bpart, 0); | ||
| 415 | } else if (eol) | ||
| 416 | BIO_write(bpart, "\r\n", 2); | ||
| 417 | eol = next_eol; | ||
| 418 | if (len) | ||
| 419 | BIO_write(bpart, linebuf, len); | ||
| 420 | } | ||
| 421 | } | ||
| 422 | return 0; | ||
| 423 | } | ||
| 424 | |||
| 425 | /* This is the big one: parse MIME header lines up to message body */ | ||
| 426 | |||
| 427 | #define MIME_INVALID 0 | ||
| 428 | #define MIME_START 1 | ||
| 429 | #define MIME_TYPE 2 | ||
| 430 | #define MIME_NAME 3 | ||
| 431 | #define MIME_VALUE 4 | ||
| 432 | #define MIME_QUOTE 5 | ||
| 433 | #define MIME_COMMENT 6 | ||
| 434 | |||
| 435 | |||
| 436 | static STACK_OF(MIME_HEADER) *mime_parse_hdr(BIO *bio) | ||
| 437 | { | ||
| 438 | char *p, *q, c; | ||
| 439 | char *ntmp; | ||
| 440 | char linebuf[MAX_SMLEN]; | ||
| 441 | MIME_HEADER *mhdr = NULL; | ||
| 442 | STACK_OF(MIME_HEADER) *headers; | ||
| 443 | int len, state, save_state = 0; | ||
| 444 | |||
| 445 | headers = sk_MIME_HEADER_new(mime_hdr_cmp); | ||
| 446 | while ((len = BIO_gets(bio, linebuf, MAX_SMLEN)) > 0) { | ||
| 447 | /* If whitespace at line start then continuation line */ | ||
| 448 | if(mhdr && isspace((unsigned char)linebuf[0])) state = MIME_NAME; | ||
| 449 | else state = MIME_START; | ||
| 450 | ntmp = NULL; | ||
| 451 | /* Go through all characters */ | ||
| 452 | for(p = linebuf, q = linebuf; (c = *p) && (c!='\r') && (c!='\n'); p++) { | ||
| 453 | |||
| 454 | /* State machine to handle MIME headers | ||
| 455 | * if this looks horrible that's because it *is* | ||
| 456 | */ | ||
| 457 | |||
| 458 | switch(state) { | ||
| 459 | case MIME_START: | ||
| 460 | if(c == ':') { | ||
| 461 | state = MIME_TYPE; | ||
| 462 | *p = 0; | ||
| 463 | ntmp = strip_ends(q); | ||
| 464 | q = p + 1; | ||
| 465 | } | ||
| 466 | break; | ||
| 467 | |||
| 468 | case MIME_TYPE: | ||
| 469 | if(c == ';') { | ||
| 470 | mime_debug("Found End Value\n"); | ||
| 471 | *p = 0; | ||
| 472 | mhdr = mime_hdr_new(ntmp, strip_ends(q)); | ||
| 473 | sk_MIME_HEADER_push(headers, mhdr); | ||
| 474 | ntmp = NULL; | ||
| 475 | q = p + 1; | ||
| 476 | state = MIME_NAME; | ||
| 477 | } else if(c == '(') { | ||
| 478 | save_state = state; | ||
| 479 | state = MIME_COMMENT; | ||
| 480 | } | ||
| 481 | break; | ||
| 482 | |||
| 483 | case MIME_COMMENT: | ||
| 484 | if(c == ')') { | ||
| 485 | state = save_state; | ||
| 486 | } | ||
| 487 | break; | ||
| 488 | |||
| 489 | case MIME_NAME: | ||
| 490 | if(c == '=') { | ||
| 491 | state = MIME_VALUE; | ||
| 492 | *p = 0; | ||
| 493 | ntmp = strip_ends(q); | ||
| 494 | q = p + 1; | ||
| 495 | } | ||
| 496 | break ; | ||
| 497 | |||
| 498 | case MIME_VALUE: | ||
| 499 | if(c == ';') { | ||
| 500 | state = MIME_NAME; | ||
| 501 | *p = 0; | ||
| 502 | mime_hdr_addparam(mhdr, ntmp, strip_ends(q)); | ||
| 503 | ntmp = NULL; | ||
| 504 | q = p + 1; | ||
| 505 | } else if (c == '"') { | ||
| 506 | mime_debug("Found Quote\n"); | ||
| 507 | state = MIME_QUOTE; | ||
| 508 | } else if(c == '(') { | ||
| 509 | save_state = state; | ||
| 510 | state = MIME_COMMENT; | ||
| 511 | } | ||
| 512 | break; | ||
| 513 | |||
| 514 | case MIME_QUOTE: | ||
| 515 | if(c == '"') { | ||
| 516 | mime_debug("Found Match Quote\n"); | ||
| 517 | state = MIME_VALUE; | ||
| 518 | } | ||
| 519 | break; | ||
| 520 | } | ||
| 521 | } | ||
| 522 | |||
| 523 | if(state == MIME_TYPE) { | ||
| 524 | mhdr = mime_hdr_new(ntmp, strip_ends(q)); | ||
| 525 | sk_MIME_HEADER_push(headers, mhdr); | ||
| 526 | } else if(state == MIME_VALUE) | ||
| 527 | mime_hdr_addparam(mhdr, ntmp, strip_ends(q)); | ||
| 528 | if(p == linebuf) break; /* Blank line means end of headers */ | ||
| 529 | } | ||
| 530 | |||
| 531 | return headers; | ||
| 532 | |||
| 533 | } | ||
| 534 | |||
| 535 | static char *strip_ends(char *name) | ||
| 536 | { | ||
| 537 | return strip_end(strip_start(name)); | ||
| 538 | } | ||
| 539 | |||
| 540 | /* Strip a parameter of whitespace from start of param */ | ||
| 541 | static char *strip_start(char *name) | ||
| 542 | { | ||
| 543 | char *p, c; | ||
| 544 | /* Look for first non white space or quote */ | ||
| 545 | for(p = name; (c = *p) ;p++) { | ||
| 546 | if(c == '"') { | ||
| 547 | /* Next char is start of string if non null */ | ||
| 548 | if(p[1]) return p + 1; | ||
| 549 | /* Else null string */ | ||
| 550 | return NULL; | ||
| 551 | } | ||
| 552 | if(!isspace((unsigned char)c)) return p; | ||
| 553 | } | ||
| 554 | return NULL; | ||
| 555 | } | ||
| 556 | |||
| 557 | /* As above but strip from end of string : maybe should handle brackets? */ | ||
| 558 | static char *strip_end(char *name) | ||
| 559 | { | ||
| 560 | char *p, c; | ||
| 561 | if(!name) return NULL; | ||
| 562 | /* Look for first non white space or quote */ | ||
| 563 | for(p = name + strlen(name) - 1; p >= name ;p--) { | ||
| 564 | c = *p; | ||
| 565 | if(c == '"') { | ||
| 566 | if(p - 1 == name) return NULL; | ||
| 567 | *p = 0; | ||
| 568 | return name; | ||
| 569 | } | ||
| 570 | if(isspace((unsigned char)c)) *p = 0; | ||
| 571 | else return name; | ||
| 572 | } | ||
| 573 | return NULL; | ||
| 574 | } | ||
| 575 | |||
| 576 | static MIME_HEADER *mime_hdr_new(char *name, char *value) | ||
| 577 | { | ||
| 578 | MIME_HEADER *mhdr; | ||
| 579 | char *tmpname, *tmpval, *p; | ||
| 580 | int c; | ||
| 581 | if(name) { | ||
| 582 | if(!(tmpname = BUF_strdup(name))) return NULL; | ||
| 583 | for(p = tmpname ; *p; p++) { | ||
| 584 | c = *p; | ||
| 585 | if(isupper(c)) { | ||
| 586 | c = tolower(c); | ||
| 587 | *p = c; | ||
| 588 | } | ||
| 589 | } | ||
| 590 | } else tmpname = NULL; | ||
| 591 | if(value) { | ||
| 592 | if(!(tmpval = BUF_strdup(value))) return NULL; | ||
| 593 | for(p = tmpval ; *p; p++) { | ||
| 594 | c = *p; | ||
| 595 | if(isupper(c)) { | ||
| 596 | c = tolower(c); | ||
| 597 | *p = c; | ||
| 598 | } | ||
| 599 | } | ||
| 600 | } else tmpval = NULL; | ||
| 601 | mhdr = (MIME_HEADER *) OPENSSL_malloc(sizeof(MIME_HEADER)); | ||
| 602 | if(!mhdr) return NULL; | ||
| 603 | mhdr->name = tmpname; | ||
| 604 | mhdr->value = tmpval; | ||
| 605 | if(!(mhdr->params = sk_MIME_PARAM_new(mime_param_cmp))) return NULL; | ||
| 606 | return mhdr; | ||
| 607 | } | ||
| 608 | |||
| 609 | static int mime_hdr_addparam(MIME_HEADER *mhdr, char *name, char *value) | ||
| 610 | { | ||
| 611 | char *tmpname, *tmpval, *p; | ||
| 612 | int c; | ||
| 613 | MIME_PARAM *mparam; | ||
| 614 | if(name) { | ||
| 615 | tmpname = BUF_strdup(name); | ||
| 616 | if(!tmpname) return 0; | ||
| 617 | for(p = tmpname ; *p; p++) { | ||
| 618 | c = *p; | ||
| 619 | if(isupper(c)) { | ||
| 620 | c = tolower(c); | ||
| 621 | *p = c; | ||
| 622 | } | ||
| 623 | } | ||
| 624 | } else tmpname = NULL; | ||
| 625 | if(value) { | ||
| 626 | tmpval = BUF_strdup(value); | ||
| 627 | if(!tmpval) return 0; | ||
| 628 | } else tmpval = NULL; | ||
| 629 | /* Parameter values are case sensitive so leave as is */ | ||
| 630 | mparam = (MIME_PARAM *) OPENSSL_malloc(sizeof(MIME_PARAM)); | ||
| 631 | if(!mparam) return 0; | ||
| 632 | mparam->param_name = tmpname; | ||
| 633 | mparam->param_value = tmpval; | ||
| 634 | sk_MIME_PARAM_push(mhdr->params, mparam); | ||
| 635 | return 1; | ||
| 636 | } | ||
| 637 | |||
| 638 | static int mime_hdr_cmp(const MIME_HEADER * const *a, | ||
| 639 | const MIME_HEADER * const *b) | ||
| 640 | { | ||
| 641 | return(strcmp((*a)->name, (*b)->name)); | ||
| 642 | } | ||
| 643 | |||
| 644 | static int mime_param_cmp(const MIME_PARAM * const *a, | ||
| 645 | const MIME_PARAM * const *b) | ||
| 646 | { | ||
| 647 | return(strcmp((*a)->param_name, (*b)->param_name)); | ||
| 648 | } | ||
| 649 | |||
| 650 | /* Find a header with a given name (if possible) */ | ||
| 651 | |||
| 652 | static MIME_HEADER *mime_hdr_find(STACK_OF(MIME_HEADER) *hdrs, char *name) | ||
| 653 | { | ||
| 654 | MIME_HEADER htmp; | ||
| 655 | int idx; | ||
| 656 | htmp.name = name; | ||
| 657 | idx = sk_MIME_HEADER_find(hdrs, &htmp); | ||
| 658 | if(idx < 0) return NULL; | ||
| 659 | return sk_MIME_HEADER_value(hdrs, idx); | ||
| 660 | } | ||
| 661 | |||
| 662 | static MIME_PARAM *mime_param_find(MIME_HEADER *hdr, char *name) | ||
| 663 | { | ||
| 664 | MIME_PARAM param; | ||
| 665 | int idx; | ||
| 666 | param.param_name = name; | ||
| 667 | idx = sk_MIME_PARAM_find(hdr->params, ¶m); | ||
| 668 | if(idx < 0) return NULL; | ||
| 669 | return sk_MIME_PARAM_value(hdr->params, idx); | ||
| 670 | } | ||
| 671 | |||
| 672 | static void mime_hdr_free(MIME_HEADER *hdr) | ||
| 673 | { | ||
| 674 | if(hdr->name) OPENSSL_free(hdr->name); | ||
| 675 | if(hdr->value) OPENSSL_free(hdr->value); | ||
| 676 | if(hdr->params) sk_MIME_PARAM_pop_free(hdr->params, mime_param_free); | ||
| 677 | OPENSSL_free(hdr); | ||
| 678 | } | ||
| 679 | |||
| 680 | static void mime_param_free(MIME_PARAM *param) | ||
| 681 | { | ||
| 682 | if(param->param_name) OPENSSL_free(param->param_name); | ||
| 683 | if(param->param_value) OPENSSL_free(param->param_value); | ||
| 684 | OPENSSL_free(param); | ||
| 685 | } | ||
| 686 | |||
| 687 | /* Check for a multipart boundary. Returns: | ||
| 688 | * 0 : no boundary | ||
| 689 | * 1 : part boundary | ||
| 690 | * 2 : final boundary | ||
| 691 | */ | ||
| 692 | static int mime_bound_check(char *line, int linelen, char *bound, int blen) | ||
| 693 | { | ||
| 694 | if(linelen == -1) linelen = strlen(line); | ||
| 695 | if(blen == -1) blen = strlen(bound); | ||
| 696 | /* Quickly eliminate if line length too short */ | ||
| 697 | if(blen + 2 > linelen) return 0; | ||
| 698 | /* Check for part boundary */ | ||
| 699 | if(!strncmp(line, "--", 2) && !strncmp(line + 2, bound, blen)) { | ||
| 700 | if(!strncmp(line + blen + 2, "--", 2)) return 2; | ||
| 701 | else return 1; | ||
| 702 | } | ||
| 703 | return 0; | ||
| 704 | } | ||
| 705 | |||
| 706 | static int strip_eol(char *linebuf, int *plen) | ||
| 707 | { | 95 | { |
| 708 | int len = *plen; | 96 | return (PKCS7 *)SMIME_read_ASN1(bio, bcont, ASN1_ITEM_rptr(PKCS7)); |
| 709 | char *p, c; | ||
| 710 | int is_eol = 0; | ||
| 711 | p = linebuf + len - 1; | ||
| 712 | for (p = linebuf + len - 1; len > 0; len--, p--) | ||
| 713 | { | ||
| 714 | c = *p; | ||
| 715 | if (c == '\n') | ||
| 716 | is_eol = 1; | ||
| 717 | else if (c != '\r') | ||
| 718 | break; | ||
| 719 | } | ||
| 720 | *plen = len; | ||
| 721 | return is_eol; | ||
| 722 | } | 97 | } |
diff --git a/src/lib/libcrypto/pkcs7/pk7_smime.c b/src/lib/libcrypto/pkcs7/pk7_smime.c index fd18ec3d95..86742d0dcd 100644 --- a/src/lib/libcrypto/pkcs7/pk7_smime.c +++ b/src/lib/libcrypto/pkcs7/pk7_smime.c | |||
| @@ -63,24 +63,19 @@ | |||
| 63 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 64 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 65 | 65 | ||
| 66 | static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si); | ||
| 67 | |||
| 66 | PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, | 68 | PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, |
| 67 | BIO *data, int flags) | 69 | BIO *data, int flags) |
| 68 | { | 70 | { |
| 69 | PKCS7 *p7 = NULL; | 71 | PKCS7 *p7; |
| 70 | PKCS7_SIGNER_INFO *si; | ||
| 71 | BIO *p7bio = NULL; | ||
| 72 | STACK_OF(X509_ALGOR) *smcap = NULL; | ||
| 73 | int i; | 72 | int i; |
| 74 | 73 | ||
| 75 | if(!X509_check_private_key(signcert, pkey)) { | 74 | if(!(p7 = PKCS7_new())) |
| 76 | PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE); | 75 | { |
| 77 | return NULL; | ||
| 78 | } | ||
| 79 | |||
| 80 | if(!(p7 = PKCS7_new())) { | ||
| 81 | PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE); | 76 | PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE); |
| 82 | return NULL; | 77 | return NULL; |
| 83 | } | 78 | } |
| 84 | 79 | ||
| 85 | if (!PKCS7_set_type(p7, NID_pkcs7_signed)) | 80 | if (!PKCS7_set_type(p7, NID_pkcs7_signed)) |
| 86 | goto err; | 81 | goto err; |
| @@ -88,82 +83,185 @@ PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, | |||
| 88 | if (!PKCS7_content_new(p7, NID_pkcs7_data)) | 83 | if (!PKCS7_content_new(p7, NID_pkcs7_data)) |
| 89 | goto err; | 84 | goto err; |
| 90 | 85 | ||
| 91 | if (!(si = PKCS7_add_signature(p7,signcert,pkey,EVP_sha1()))) { | 86 | if (pkey && !PKCS7_sign_add_signer(p7, signcert, pkey, NULL, flags)) |
| 92 | PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR); | 87 | { |
| 88 | PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PKCS7_ADD_SIGNER_ERROR); | ||
| 93 | goto err; | 89 | goto err; |
| 94 | } | 90 | } |
| 95 | 91 | ||
| 96 | if(!(flags & PKCS7_NOCERTS)) { | 92 | if(!(flags & PKCS7_NOCERTS)) |
| 97 | if (!PKCS7_add_certificate(p7, signcert)) | 93 | { |
| 98 | goto err; | 94 | for(i = 0; i < sk_X509_num(certs); i++) |
| 99 | if(certs) for(i = 0; i < sk_X509_num(certs); i++) | 95 | { |
| 100 | if (!PKCS7_add_certificate(p7, sk_X509_value(certs, i))) | 96 | if (!PKCS7_add_certificate(p7, sk_X509_value(certs, i))) |
| 101 | goto err; | 97 | goto err; |
| 102 | } | 98 | } |
| 99 | } | ||
| 103 | 100 | ||
| 104 | if(!(flags & PKCS7_NOATTR)) { | 101 | if(flags & PKCS7_DETACHED) |
| 105 | if (!PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, | 102 | PKCS7_set_detached(p7, 1); |
| 106 | V_ASN1_OBJECT, OBJ_nid2obj(NID_pkcs7_data))) | 103 | |
| 107 | goto err; | 104 | if (flags & (PKCS7_STREAM|PKCS7_PARTIAL)) |
| 108 | /* Add SMIMECapabilities */ | 105 | return p7; |
| 109 | if(!(flags & PKCS7_NOSMIMECAP)) | 106 | |
| 107 | if (PKCS7_final(p7, data, flags)) | ||
| 108 | return p7; | ||
| 109 | |||
| 110 | err: | ||
| 111 | PKCS7_free(p7); | ||
| 112 | return NULL; | ||
| 113 | } | ||
| 114 | |||
| 115 | int PKCS7_final(PKCS7 *p7, BIO *data, int flags) | ||
| 116 | { | ||
| 117 | BIO *p7bio; | ||
| 118 | int ret = 0; | ||
| 119 | if (!(p7bio = PKCS7_dataInit(p7, NULL))) | ||
| 110 | { | 120 | { |
| 111 | if(!(smcap = sk_X509_ALGOR_new_null())) { | 121 | PKCS7err(PKCS7_F_PKCS7_FINAL,ERR_R_MALLOC_FAILURE); |
| 112 | PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE); | 122 | return 0; |
| 113 | goto err; | ||
| 114 | } | ||
| 115 | #ifndef OPENSSL_NO_DES | ||
| 116 | if (!PKCS7_simple_smimecap (smcap, NID_des_ede3_cbc, -1)) | ||
| 117 | goto err; | ||
| 118 | #endif | ||
| 119 | #ifndef OPENSSL_NO_RC2 | ||
| 120 | if (!PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 128)) | ||
| 121 | goto err; | ||
| 122 | if (!PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 64)) | ||
| 123 | goto err; | ||
| 124 | #endif | ||
| 125 | #ifndef OPENSSL_NO_DES | ||
| 126 | if (!PKCS7_simple_smimecap (smcap, NID_des_cbc, -1)) | ||
| 127 | goto err; | ||
| 128 | #endif | ||
| 129 | #ifndef OPENSSL_NO_RC2 | ||
| 130 | if (!PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 40)) | ||
| 131 | goto err; | ||
| 132 | #endif | ||
| 133 | if (!PKCS7_add_attrib_smimecap (si, smcap)) | ||
| 134 | goto err; | ||
| 135 | sk_X509_ALGOR_pop_free(smcap, X509_ALGOR_free); | ||
| 136 | smcap = NULL; | ||
| 137 | } | 123 | } |
| 138 | } | ||
| 139 | 124 | ||
| 140 | if(flags & PKCS7_DETACHED)PKCS7_set_detached(p7, 1); | 125 | SMIME_crlf_copy(data, p7bio, flags); |
| 141 | 126 | ||
| 142 | if (flags & PKCS7_STREAM) | 127 | (void)BIO_flush(p7bio); |
| 143 | return p7; | ||
| 144 | 128 | ||
| 145 | 129 | ||
| 146 | if (!(p7bio = PKCS7_dataInit(p7, NULL))) { | 130 | if (!PKCS7_dataFinal(p7,p7bio)) |
| 147 | PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE); | 131 | { |
| 132 | PKCS7err(PKCS7_F_PKCS7_FINAL,PKCS7_R_PKCS7_DATASIGN); | ||
| 148 | goto err; | 133 | goto err; |
| 134 | } | ||
| 135 | |||
| 136 | ret = 1; | ||
| 137 | |||
| 138 | err: | ||
| 139 | BIO_free_all(p7bio); | ||
| 140 | |||
| 141 | return ret; | ||
| 142 | |||
| 149 | } | 143 | } |
| 150 | 144 | ||
| 151 | SMIME_crlf_copy(data, p7bio, flags); | 145 | /* Check to see if a cipher exists and if so add S/MIME capabilities */ |
| 152 | 146 | ||
| 147 | static int add_cipher_smcap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) | ||
| 148 | { | ||
| 149 | if (EVP_get_cipherbynid(nid)) | ||
| 150 | return PKCS7_simple_smimecap(sk, nid, arg); | ||
| 151 | return 1; | ||
| 152 | } | ||
| 153 | 153 | ||
| 154 | if (!PKCS7_dataFinal(p7,p7bio)) { | 154 | static int add_digest_smcap(STACK_OF(X509_ALGOR) *sk, int nid, int arg) |
| 155 | PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PKCS7_DATASIGN); | 155 | { |
| 156 | goto err; | 156 | if (EVP_get_digestbynid(nid)) |
| 157 | return PKCS7_simple_smimecap(sk, nid, arg); | ||
| 158 | return 1; | ||
| 157 | } | 159 | } |
| 158 | 160 | ||
| 159 | BIO_free_all(p7bio); | 161 | PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert, |
| 160 | return p7; | 162 | EVP_PKEY *pkey, const EVP_MD *md, |
| 161 | err: | 163 | int flags) |
| 162 | sk_X509_ALGOR_pop_free(smcap, X509_ALGOR_free); | 164 | { |
| 163 | BIO_free_all(p7bio); | 165 | PKCS7_SIGNER_INFO *si = NULL; |
| 164 | PKCS7_free(p7); | 166 | STACK_OF(X509_ALGOR) *smcap = NULL; |
| 167 | if(!X509_check_private_key(signcert, pkey)) | ||
| 168 | { | ||
| 169 | PKCS7err(PKCS7_F_PKCS7_SIGN_ADD_SIGNER, | ||
| 170 | PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE); | ||
| 171 | return NULL; | ||
| 172 | } | ||
| 173 | |||
| 174 | if (!(si = PKCS7_add_signature(p7,signcert,pkey, md))) | ||
| 175 | { | ||
| 176 | PKCS7err(PKCS7_F_PKCS7_SIGN_ADD_SIGNER, | ||
| 177 | PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR); | ||
| 178 | return NULL; | ||
| 179 | } | ||
| 180 | |||
| 181 | if(!(flags & PKCS7_NOCERTS)) | ||
| 182 | { | ||
| 183 | if (!PKCS7_add_certificate(p7, signcert)) | ||
| 184 | goto err; | ||
| 185 | } | ||
| 186 | |||
| 187 | if(!(flags & PKCS7_NOATTR)) | ||
| 188 | { | ||
| 189 | if (!PKCS7_add_attrib_content_type(si, NULL)) | ||
| 190 | goto err; | ||
| 191 | /* Add SMIMECapabilities */ | ||
| 192 | if(!(flags & PKCS7_NOSMIMECAP)) | ||
| 193 | { | ||
| 194 | if(!(smcap = sk_X509_ALGOR_new_null())) | ||
| 195 | { | ||
| 196 | PKCS7err(PKCS7_F_PKCS7_SIGN_ADD_SIGNER, | ||
| 197 | ERR_R_MALLOC_FAILURE); | ||
| 198 | goto err; | ||
| 199 | } | ||
| 200 | if (!add_cipher_smcap(smcap, NID_aes_256_cbc, -1) | ||
| 201 | || !add_digest_smcap(smcap, NID_id_GostR3411_94, -1) | ||
| 202 | || !add_cipher_smcap(smcap, NID_id_Gost28147_89, -1) | ||
| 203 | || !add_cipher_smcap(smcap, NID_aes_192_cbc, -1) | ||
| 204 | || !add_cipher_smcap(smcap, NID_aes_128_cbc, -1) | ||
| 205 | || !add_cipher_smcap(smcap, NID_des_ede3_cbc, -1) | ||
| 206 | || !add_cipher_smcap(smcap, NID_rc2_cbc, 128) | ||
| 207 | || !add_cipher_smcap(smcap, NID_rc2_cbc, 64) | ||
| 208 | || !add_cipher_smcap(smcap, NID_des_cbc, -1) | ||
| 209 | || !add_cipher_smcap(smcap, NID_rc2_cbc, 40) | ||
| 210 | || !PKCS7_add_attrib_smimecap (si, smcap)) | ||
| 211 | goto err; | ||
| 212 | sk_X509_ALGOR_pop_free(smcap, X509_ALGOR_free); | ||
| 213 | smcap = NULL; | ||
| 214 | } | ||
| 215 | if (flags & PKCS7_REUSE_DIGEST) | ||
| 216 | { | ||
| 217 | if (!pkcs7_copy_existing_digest(p7, si)) | ||
| 218 | goto err; | ||
| 219 | if (!(flags & PKCS7_PARTIAL) && | ||
| 220 | !PKCS7_SIGNER_INFO_sign(si)) | ||
| 221 | goto err; | ||
| 222 | } | ||
| 223 | } | ||
| 224 | return si; | ||
| 225 | err: | ||
| 226 | if (smcap) | ||
| 227 | sk_X509_ALGOR_pop_free(smcap, X509_ALGOR_free); | ||
| 165 | return NULL; | 228 | return NULL; |
| 166 | } | 229 | } |
| 230 | |||
| 231 | /* Search for a digest matching SignerInfo digest type and if found | ||
| 232 | * copy across. | ||
| 233 | */ | ||
| 234 | |||
| 235 | static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si) | ||
| 236 | { | ||
| 237 | int i; | ||
| 238 | STACK_OF(PKCS7_SIGNER_INFO) *sinfos; | ||
| 239 | PKCS7_SIGNER_INFO *sitmp; | ||
| 240 | ASN1_OCTET_STRING *osdig = NULL; | ||
| 241 | sinfos = PKCS7_get_signer_info(p7); | ||
| 242 | for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++) | ||
| 243 | { | ||
| 244 | sitmp = sk_PKCS7_SIGNER_INFO_value(sinfos, i); | ||
| 245 | if (si == sitmp) | ||
| 246 | break; | ||
| 247 | if (sk_X509_ATTRIBUTE_num(sitmp->auth_attr) <= 0) | ||
| 248 | continue; | ||
| 249 | if (!OBJ_cmp(si->digest_alg->algorithm, | ||
| 250 | sitmp->digest_alg->algorithm)) | ||
| 251 | { | ||
| 252 | osdig = PKCS7_digest_from_attributes(sitmp->auth_attr); | ||
| 253 | break; | ||
| 254 | } | ||
| 255 | |||
| 256 | } | ||
| 257 | |||
| 258 | if (osdig) | ||
| 259 | return PKCS7_add1_attrib_digest(si, osdig->data, osdig->length); | ||
| 260 | |||
| 261 | PKCS7err(PKCS7_F_PKCS7_COPY_EXISTING_DIGEST, | ||
| 262 | PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND); | ||
| 263 | return 0; | ||
| 264 | } | ||
| 167 | 265 | ||
| 168 | int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | 266 | int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, |
| 169 | BIO *indata, BIO *out, int flags) | 267 | BIO *indata, BIO *out, int flags) |
| @@ -354,7 +452,7 @@ STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) | |||
| 354 | 452 | ||
| 355 | if(sk_PKCS7_SIGNER_INFO_num(sinfos) <= 0) { | 453 | if(sk_PKCS7_SIGNER_INFO_num(sinfos) <= 0) { |
| 356 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_NO_SIGNERS); | 454 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_NO_SIGNERS); |
| 357 | return NULL; | 455 | return 0; |
| 358 | } | 456 | } |
| 359 | 457 | ||
| 360 | if(!(signers = sk_X509_new_null())) { | 458 | if(!(signers = sk_X509_new_null())) { |
| @@ -377,12 +475,12 @@ STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) | |||
| 377 | if (!signer) { | 475 | if (!signer) { |
| 378 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND); | 476 | PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND); |
| 379 | sk_X509_free(signers); | 477 | sk_X509_free(signers); |
| 380 | return NULL; | 478 | return 0; |
| 381 | } | 479 | } |
| 382 | 480 | ||
| 383 | if (!sk_X509_push(signers, signer)) { | 481 | if (!sk_X509_push(signers, signer)) { |
| 384 | sk_X509_free(signers); | 482 | sk_X509_free(signers); |
| 385 | return NULL; | 483 | return NULL; |
| 386 | } | 484 | } |
| 387 | } | 485 | } |
| 388 | return signers; | 486 | return signers; |
| @@ -405,7 +503,7 @@ PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, | |||
| 405 | 503 | ||
| 406 | if (!PKCS7_set_type(p7, NID_pkcs7_enveloped)) | 504 | if (!PKCS7_set_type(p7, NID_pkcs7_enveloped)) |
| 407 | goto err; | 505 | goto err; |
| 408 | if(!PKCS7_set_cipher(p7, cipher)) { | 506 | if (!PKCS7_set_cipher(p7, cipher)) { |
| 409 | PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_ERROR_SETTING_CIPHER); | 507 | PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_ERROR_SETTING_CIPHER); |
| 410 | goto err; | 508 | goto err; |
| 411 | } | 509 | } |
| @@ -419,22 +517,11 @@ PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, | |||
| 419 | } | 517 | } |
| 420 | } | 518 | } |
| 421 | 519 | ||
| 422 | if(!(p7bio = PKCS7_dataInit(p7, NULL))) { | 520 | if (flags & PKCS7_STREAM) |
| 423 | PKCS7err(PKCS7_F_PKCS7_ENCRYPT,ERR_R_MALLOC_FAILURE); | 521 | return p7; |
| 424 | goto err; | ||
| 425 | } | ||
| 426 | |||
| 427 | SMIME_crlf_copy(in, p7bio, flags); | ||
| 428 | |||
| 429 | (void)BIO_flush(p7bio); | ||
| 430 | |||
| 431 | if (!PKCS7_dataFinal(p7,p7bio)) { | ||
| 432 | PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_PKCS7_DATAFINAL_ERROR); | ||
| 433 | goto err; | ||
| 434 | } | ||
| 435 | BIO_free_all(p7bio); | ||
| 436 | 522 | ||
| 437 | return p7; | 523 | if (PKCS7_final(p7, in, flags)) |
| 524 | return p7; | ||
| 438 | 525 | ||
| 439 | err: | 526 | err: |
| 440 | 527 | ||
diff --git a/src/lib/libcrypto/pkcs7/pkcs7.h b/src/lib/libcrypto/pkcs7/pkcs7.h index cc092d262d..e4d443193c 100644 --- a/src/lib/libcrypto/pkcs7/pkcs7.h +++ b/src/lib/libcrypto/pkcs7/pkcs7.h | |||
| @@ -232,6 +232,9 @@ DECLARE_PKCS12_STACK_OF(PKCS7) | |||
| 232 | #define PKCS7_type_is_signedAndEnveloped(a) \ | 232 | #define PKCS7_type_is_signedAndEnveloped(a) \ |
| 233 | (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) | 233 | (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) |
| 234 | #define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) | 234 | #define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) |
| 235 | #define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) | ||
| 236 | #define PKCS7_type_is_encrypted(a) \ | ||
| 237 | (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) | ||
| 235 | 238 | ||
| 236 | #define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) | 239 | #define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) |
| 237 | 240 | ||
| @@ -242,14 +245,6 @@ DECLARE_PKCS12_STACK_OF(PKCS7) | |||
| 242 | 245 | ||
| 243 | #define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) | 246 | #define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) |
| 244 | 247 | ||
| 245 | #ifdef SSLEAY_MACROS | ||
| 246 | #ifndef PKCS7_ISSUER_AND_SERIAL_digest | ||
| 247 | #define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \ | ||
| 248 | ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\ | ||
| 249 | (char *)data,md,len) | ||
| 250 | #endif | ||
| 251 | #endif | ||
| 252 | |||
| 253 | /* S/MIME related flags */ | 248 | /* S/MIME related flags */ |
| 254 | 249 | ||
| 255 | #define PKCS7_TEXT 0x1 | 250 | #define PKCS7_TEXT 0x1 |
| @@ -266,6 +261,8 @@ DECLARE_PKCS12_STACK_OF(PKCS7) | |||
| 266 | #define PKCS7_CRLFEOL 0x800 | 261 | #define PKCS7_CRLFEOL 0x800 |
| 267 | #define PKCS7_STREAM 0x1000 | 262 | #define PKCS7_STREAM 0x1000 |
| 268 | #define PKCS7_NOCRL 0x2000 | 263 | #define PKCS7_NOCRL 0x2000 |
| 264 | #define PKCS7_PARTIAL 0x4000 | ||
| 265 | #define PKCS7_REUSE_DIGEST 0x8000 | ||
| 269 | 266 | ||
| 270 | /* Flags: for compatibility with older code */ | 267 | /* Flags: for compatibility with older code */ |
| 271 | 268 | ||
| @@ -281,7 +278,6 @@ DECLARE_PKCS12_STACK_OF(PKCS7) | |||
| 281 | 278 | ||
| 282 | DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) | 279 | DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) |
| 283 | 280 | ||
| 284 | #ifndef SSLEAY_MACROS | ||
| 285 | int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type, | 281 | int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type, |
| 286 | unsigned char *md,unsigned int *len); | 282 | unsigned char *md,unsigned int *len); |
| 287 | #ifndef OPENSSL_NO_FP_API | 283 | #ifndef OPENSSL_NO_FP_API |
| @@ -291,7 +287,8 @@ int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7); | |||
| 291 | PKCS7 *PKCS7_dup(PKCS7 *p7); | 287 | PKCS7 *PKCS7_dup(PKCS7 *p7); |
| 292 | PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7); | 288 | PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7); |
| 293 | int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7); | 289 | int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7); |
| 294 | #endif | 290 | int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); |
| 291 | int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); | ||
| 295 | 292 | ||
| 296 | DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) | 293 | DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) |
| 297 | DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) | 294 | DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) |
| @@ -307,6 +304,7 @@ DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) | |||
| 307 | DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) | 304 | DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) |
| 308 | 305 | ||
| 309 | DECLARE_ASN1_NDEF_FUNCTION(PKCS7) | 306 | DECLARE_ASN1_NDEF_FUNCTION(PKCS7) |
| 307 | DECLARE_ASN1_PRINT_FUNCTION(PKCS7) | ||
| 310 | 308 | ||
| 311 | long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); | 309 | long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); |
| 312 | 310 | ||
| @@ -315,6 +313,7 @@ int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); | |||
| 315 | int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); | 313 | int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); |
| 316 | int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, | 314 | int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, |
| 317 | const EVP_MD *dgst); | 315 | const EVP_MD *dgst); |
| 316 | int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si); | ||
| 318 | int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); | 317 | int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); |
| 319 | int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); | 318 | int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); |
| 320 | int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); | 319 | int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); |
| @@ -336,9 +335,13 @@ int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); | |||
| 336 | STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); | 335 | STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); |
| 337 | 336 | ||
| 338 | PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); | 337 | PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); |
| 338 | void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, | ||
| 339 | X509_ALGOR **pdig, X509_ALGOR **psig); | ||
| 340 | void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc); | ||
| 339 | int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); | 341 | int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); |
| 340 | int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); | 342 | int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); |
| 341 | int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); | 343 | int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); |
| 344 | int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7); | ||
| 342 | 345 | ||
| 343 | PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); | 346 | PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); |
| 344 | ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); | 347 | ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); |
| @@ -355,6 +358,12 @@ int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,STACK_OF(X509_ATTRIBUTE) *sk); | |||
| 355 | 358 | ||
| 356 | PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, | 359 | PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, |
| 357 | BIO *data, int flags); | 360 | BIO *data, int flags); |
| 361 | |||
| 362 | PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, | ||
| 363 | X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md, | ||
| 364 | int flags); | ||
| 365 | |||
| 366 | int PKCS7_final(PKCS7 *p7, BIO *data, int flags); | ||
| 358 | int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | 367 | int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, |
| 359 | BIO *indata, BIO *out, int flags); | 368 | BIO *indata, BIO *out, int flags); |
| 360 | STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags); | 369 | STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags); |
| @@ -367,10 +376,16 @@ int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, | |||
| 367 | STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); | 376 | STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); |
| 368 | int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); | 377 | int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); |
| 369 | 378 | ||
| 379 | int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid); | ||
| 380 | int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t); | ||
| 381 | int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, | ||
| 382 | const unsigned char *md, int mdlen); | ||
| 383 | |||
| 370 | int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); | 384 | int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); |
| 371 | PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); | 385 | PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); |
| 372 | int SMIME_crlf_copy(BIO *in, BIO *out, int flags); | 386 | |
| 373 | int SMIME_text(BIO *in, BIO *out); | 387 | BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); |
| 388 | |||
| 374 | 389 | ||
| 375 | /* BEGIN ERROR CODES */ | 390 | /* BEGIN ERROR CODES */ |
| 376 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 391 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| @@ -383,12 +398,17 @@ void ERR_load_PKCS7_strings(void); | |||
| 383 | /* Function codes. */ | 398 | /* Function codes. */ |
| 384 | #define PKCS7_F_B64_READ_PKCS7 120 | 399 | #define PKCS7_F_B64_READ_PKCS7 120 |
| 385 | #define PKCS7_F_B64_WRITE_PKCS7 121 | 400 | #define PKCS7_F_B64_WRITE_PKCS7 121 |
| 401 | #define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136 | ||
| 402 | #define PKCS7_F_I2D_PKCS7_BIO_STREAM 140 | ||
| 403 | #define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135 | ||
| 386 | #define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 | 404 | #define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 |
| 387 | #define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 | 405 | #define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 |
| 388 | #define PKCS7_F_PKCS7_ADD_CRL 101 | 406 | #define PKCS7_F_PKCS7_ADD_CRL 101 |
| 389 | #define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 | 407 | #define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 |
| 408 | #define PKCS7_F_PKCS7_ADD_SIGNATURE 131 | ||
| 390 | #define PKCS7_F_PKCS7_ADD_SIGNER 103 | 409 | #define PKCS7_F_PKCS7_ADD_SIGNER 103 |
| 391 | #define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 | 410 | #define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 |
| 411 | #define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138 | ||
| 392 | #define PKCS7_F_PKCS7_CTRL 104 | 412 | #define PKCS7_F_PKCS7_CTRL 104 |
| 393 | #define PKCS7_F_PKCS7_DATADECODE 112 | 413 | #define PKCS7_F_PKCS7_DATADECODE 112 |
| 394 | #define PKCS7_F_PKCS7_DATAFINAL 128 | 414 | #define PKCS7_F_PKCS7_DATAFINAL 128 |
| @@ -396,15 +416,22 @@ void ERR_load_PKCS7_strings(void); | |||
| 396 | #define PKCS7_F_PKCS7_DATASIGN 106 | 416 | #define PKCS7_F_PKCS7_DATASIGN 106 |
| 397 | #define PKCS7_F_PKCS7_DATAVERIFY 107 | 417 | #define PKCS7_F_PKCS7_DATAVERIFY 107 |
| 398 | #define PKCS7_F_PKCS7_DECRYPT 114 | 418 | #define PKCS7_F_PKCS7_DECRYPT 114 |
| 419 | #define PKCS7_F_PKCS7_DECRYPT_RINFO 133 | ||
| 420 | #define PKCS7_F_PKCS7_ENCODE_RINFO 132 | ||
| 399 | #define PKCS7_F_PKCS7_ENCRYPT 115 | 421 | #define PKCS7_F_PKCS7_ENCRYPT 115 |
| 422 | #define PKCS7_F_PKCS7_FINAL 134 | ||
| 400 | #define PKCS7_F_PKCS7_FIND_DIGEST 127 | 423 | #define PKCS7_F_PKCS7_FIND_DIGEST 127 |
| 401 | #define PKCS7_F_PKCS7_GET0_SIGNERS 124 | 424 | #define PKCS7_F_PKCS7_GET0_SIGNERS 124 |
| 425 | #define PKCS7_F_PKCS7_RECIP_INFO_SET 130 | ||
| 402 | #define PKCS7_F_PKCS7_SET_CIPHER 108 | 426 | #define PKCS7_F_PKCS7_SET_CIPHER 108 |
| 403 | #define PKCS7_F_PKCS7_SET_CONTENT 109 | 427 | #define PKCS7_F_PKCS7_SET_CONTENT 109 |
| 404 | #define PKCS7_F_PKCS7_SET_DIGEST 126 | 428 | #define PKCS7_F_PKCS7_SET_DIGEST 126 |
| 405 | #define PKCS7_F_PKCS7_SET_TYPE 110 | 429 | #define PKCS7_F_PKCS7_SET_TYPE 110 |
| 406 | #define PKCS7_F_PKCS7_SIGN 116 | 430 | #define PKCS7_F_PKCS7_SIGN 116 |
| 407 | #define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 | 431 | #define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 |
| 432 | #define PKCS7_F_PKCS7_SIGNER_INFO_SET 129 | ||
| 433 | #define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139 | ||
| 434 | #define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137 | ||
| 408 | #define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 | 435 | #define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 |
| 409 | #define PKCS7_F_PKCS7_VERIFY 117 | 436 | #define PKCS7_F_PKCS7_VERIFY 117 |
| 410 | #define PKCS7_F_SMIME_READ_PKCS7 122 | 437 | #define PKCS7_F_SMIME_READ_PKCS7 122 |
| @@ -415,10 +442,13 @@ void ERR_load_PKCS7_strings(void); | |||
| 415 | #define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 | 442 | #define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 |
| 416 | #define PKCS7_R_CIPHER_NOT_INITIALIZED 116 | 443 | #define PKCS7_R_CIPHER_NOT_INITIALIZED 116 |
| 417 | #define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 | 444 | #define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 |
| 445 | #define PKCS7_R_CTRL_ERROR 152 | ||
| 418 | #define PKCS7_R_DECODE_ERROR 130 | 446 | #define PKCS7_R_DECODE_ERROR 130 |
| 419 | #define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH 100 | 447 | #define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH 100 |
| 420 | #define PKCS7_R_DECRYPT_ERROR 119 | 448 | #define PKCS7_R_DECRYPT_ERROR 119 |
| 421 | #define PKCS7_R_DIGEST_FAILURE 101 | 449 | #define PKCS7_R_DIGEST_FAILURE 101 |
| 450 | #define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 | ||
| 451 | #define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 | ||
| 422 | #define PKCS7_R_ERROR_ADDING_RECIPIENT 120 | 452 | #define PKCS7_R_ERROR_ADDING_RECIPIENT 120 |
| 423 | #define PKCS7_R_ERROR_SETTING_CIPHER 121 | 453 | #define PKCS7_R_ERROR_SETTING_CIPHER 121 |
| 424 | #define PKCS7_R_INVALID_MIME_TYPE 131 | 454 | #define PKCS7_R_INVALID_MIME_TYPE 131 |
| @@ -429,6 +459,8 @@ void ERR_load_PKCS7_strings(void); | |||
| 429 | #define PKCS7_R_MISSING_CERIPEND_INFO 103 | 459 | #define PKCS7_R_MISSING_CERIPEND_INFO 103 |
| 430 | #define PKCS7_R_NO_CONTENT 122 | 460 | #define PKCS7_R_NO_CONTENT 122 |
| 431 | #define PKCS7_R_NO_CONTENT_TYPE 135 | 461 | #define PKCS7_R_NO_CONTENT_TYPE 135 |
| 462 | #define PKCS7_R_NO_DEFAULT_DIGEST 151 | ||
| 463 | #define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 | ||
| 432 | #define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136 | 464 | #define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136 |
| 433 | #define PKCS7_R_NO_MULTIPART_BOUNDARY 137 | 465 | #define PKCS7_R_NO_MULTIPART_BOUNDARY 137 |
| 434 | #define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 | 466 | #define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 |
| @@ -438,6 +470,7 @@ void ERR_load_PKCS7_strings(void); | |||
| 438 | #define PKCS7_R_NO_SIG_CONTENT_TYPE 138 | 470 | #define PKCS7_R_NO_SIG_CONTENT_TYPE 138 |
| 439 | #define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 | 471 | #define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 |
| 440 | #define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 | 472 | #define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 |
| 473 | #define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 | ||
| 441 | #define PKCS7_R_PKCS7_DATAFINAL 126 | 474 | #define PKCS7_R_PKCS7_DATAFINAL 126 |
| 442 | #define PKCS7_R_PKCS7_DATAFINAL_ERROR 125 | 475 | #define PKCS7_R_PKCS7_DATAFINAL_ERROR 125 |
| 443 | #define PKCS7_R_PKCS7_DATASIGN 145 | 476 | #define PKCS7_R_PKCS7_DATASIGN 145 |
| @@ -446,6 +479,8 @@ void ERR_load_PKCS7_strings(void); | |||
| 446 | #define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 | 479 | #define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 |
| 447 | #define PKCS7_R_SIGNATURE_FAILURE 105 | 480 | #define PKCS7_R_SIGNATURE_FAILURE 105 |
| 448 | #define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 | 481 | #define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 |
| 482 | #define PKCS7_R_SIGNING_CTRL_FAILURE 147 | ||
| 483 | #define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 | ||
| 449 | #define PKCS7_R_SIG_INVALID_MIME_TYPE 141 | 484 | #define PKCS7_R_SIG_INVALID_MIME_TYPE 141 |
| 450 | #define PKCS7_R_SMIME_TEXT_ERROR 129 | 485 | #define PKCS7_R_SMIME_TEXT_ERROR 129 |
| 451 | #define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 | 486 | #define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 |
diff --git a/src/lib/libcrypto/pkcs7/pkcs7err.c b/src/lib/libcrypto/pkcs7/pkcs7err.c index c0e3d4cd33..d0af32a265 100644 --- a/src/lib/libcrypto/pkcs7/pkcs7err.c +++ b/src/lib/libcrypto/pkcs7/pkcs7err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/pkcs7/pkcs7err.c */ | 1 | /* crypto/pkcs7/pkcs7err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -72,12 +72,17 @@ static ERR_STRING_DATA PKCS7_str_functs[]= | |||
| 72 | { | 72 | { |
| 73 | {ERR_FUNC(PKCS7_F_B64_READ_PKCS7), "B64_READ_PKCS7"}, | 73 | {ERR_FUNC(PKCS7_F_B64_READ_PKCS7), "B64_READ_PKCS7"}, |
| 74 | {ERR_FUNC(PKCS7_F_B64_WRITE_PKCS7), "B64_WRITE_PKCS7"}, | 74 | {ERR_FUNC(PKCS7_F_B64_WRITE_PKCS7), "B64_WRITE_PKCS7"}, |
| 75 | {ERR_FUNC(PKCS7_F_DO_PKCS7_SIGNED_ATTRIB), "DO_PKCS7_SIGNED_ATTRIB"}, | ||
| 76 | {ERR_FUNC(PKCS7_F_I2D_PKCS7_BIO_STREAM), "i2d_PKCS7_bio_stream"}, | ||
| 77 | {ERR_FUNC(PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME), "PKCS7_add0_attrib_signing_time"}, | ||
| 75 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP), "PKCS7_add_attrib_smimecap"}, | 78 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP), "PKCS7_add_attrib_smimecap"}, |
| 76 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_CERTIFICATE), "PKCS7_add_certificate"}, | 79 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_CERTIFICATE), "PKCS7_add_certificate"}, |
| 77 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_CRL), "PKCS7_add_crl"}, | 80 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_CRL), "PKCS7_add_crl"}, |
| 78 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_RECIPIENT_INFO), "PKCS7_add_recipient_info"}, | 81 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_RECIPIENT_INFO), "PKCS7_add_recipient_info"}, |
| 82 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_SIGNATURE), "PKCS7_add_signature"}, | ||
| 79 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_SIGNER), "PKCS7_add_signer"}, | 83 | {ERR_FUNC(PKCS7_F_PKCS7_ADD_SIGNER), "PKCS7_add_signer"}, |
| 80 | {ERR_FUNC(PKCS7_F_PKCS7_BIO_ADD_DIGEST), "PKCS7_BIO_ADD_DIGEST"}, | 84 | {ERR_FUNC(PKCS7_F_PKCS7_BIO_ADD_DIGEST), "PKCS7_BIO_ADD_DIGEST"}, |
| 85 | {ERR_FUNC(PKCS7_F_PKCS7_COPY_EXISTING_DIGEST), "PKCS7_COPY_EXISTING_DIGEST"}, | ||
| 81 | {ERR_FUNC(PKCS7_F_PKCS7_CTRL), "PKCS7_ctrl"}, | 86 | {ERR_FUNC(PKCS7_F_PKCS7_CTRL), "PKCS7_ctrl"}, |
| 82 | {ERR_FUNC(PKCS7_F_PKCS7_DATADECODE), "PKCS7_dataDecode"}, | 87 | {ERR_FUNC(PKCS7_F_PKCS7_DATADECODE), "PKCS7_dataDecode"}, |
| 83 | {ERR_FUNC(PKCS7_F_PKCS7_DATAFINAL), "PKCS7_dataFinal"}, | 88 | {ERR_FUNC(PKCS7_F_PKCS7_DATAFINAL), "PKCS7_dataFinal"}, |
| @@ -85,15 +90,22 @@ static ERR_STRING_DATA PKCS7_str_functs[]= | |||
| 85 | {ERR_FUNC(PKCS7_F_PKCS7_DATASIGN), "PKCS7_DATASIGN"}, | 90 | {ERR_FUNC(PKCS7_F_PKCS7_DATASIGN), "PKCS7_DATASIGN"}, |
| 86 | {ERR_FUNC(PKCS7_F_PKCS7_DATAVERIFY), "PKCS7_dataVerify"}, | 91 | {ERR_FUNC(PKCS7_F_PKCS7_DATAVERIFY), "PKCS7_dataVerify"}, |
| 87 | {ERR_FUNC(PKCS7_F_PKCS7_DECRYPT), "PKCS7_decrypt"}, | 92 | {ERR_FUNC(PKCS7_F_PKCS7_DECRYPT), "PKCS7_decrypt"}, |
| 93 | {ERR_FUNC(PKCS7_F_PKCS7_DECRYPT_RINFO), "PKCS7_DECRYPT_RINFO"}, | ||
| 94 | {ERR_FUNC(PKCS7_F_PKCS7_ENCODE_RINFO), "PKCS7_ENCODE_RINFO"}, | ||
| 88 | {ERR_FUNC(PKCS7_F_PKCS7_ENCRYPT), "PKCS7_encrypt"}, | 95 | {ERR_FUNC(PKCS7_F_PKCS7_ENCRYPT), "PKCS7_encrypt"}, |
| 96 | {ERR_FUNC(PKCS7_F_PKCS7_FINAL), "PKCS7_final"}, | ||
| 89 | {ERR_FUNC(PKCS7_F_PKCS7_FIND_DIGEST), "PKCS7_FIND_DIGEST"}, | 97 | {ERR_FUNC(PKCS7_F_PKCS7_FIND_DIGEST), "PKCS7_FIND_DIGEST"}, |
| 90 | {ERR_FUNC(PKCS7_F_PKCS7_GET0_SIGNERS), "PKCS7_get0_signers"}, | 98 | {ERR_FUNC(PKCS7_F_PKCS7_GET0_SIGNERS), "PKCS7_get0_signers"}, |
| 99 | {ERR_FUNC(PKCS7_F_PKCS7_RECIP_INFO_SET), "PKCS7_RECIP_INFO_set"}, | ||
| 91 | {ERR_FUNC(PKCS7_F_PKCS7_SET_CIPHER), "PKCS7_set_cipher"}, | 100 | {ERR_FUNC(PKCS7_F_PKCS7_SET_CIPHER), "PKCS7_set_cipher"}, |
| 92 | {ERR_FUNC(PKCS7_F_PKCS7_SET_CONTENT), "PKCS7_set_content"}, | 101 | {ERR_FUNC(PKCS7_F_PKCS7_SET_CONTENT), "PKCS7_set_content"}, |
| 93 | {ERR_FUNC(PKCS7_F_PKCS7_SET_DIGEST), "PKCS7_set_digest"}, | 102 | {ERR_FUNC(PKCS7_F_PKCS7_SET_DIGEST), "PKCS7_set_digest"}, |
| 94 | {ERR_FUNC(PKCS7_F_PKCS7_SET_TYPE), "PKCS7_set_type"}, | 103 | {ERR_FUNC(PKCS7_F_PKCS7_SET_TYPE), "PKCS7_set_type"}, |
| 95 | {ERR_FUNC(PKCS7_F_PKCS7_SIGN), "PKCS7_sign"}, | 104 | {ERR_FUNC(PKCS7_F_PKCS7_SIGN), "PKCS7_sign"}, |
| 96 | {ERR_FUNC(PKCS7_F_PKCS7_SIGNATUREVERIFY), "PKCS7_signatureVerify"}, | 105 | {ERR_FUNC(PKCS7_F_PKCS7_SIGNATUREVERIFY), "PKCS7_signatureVerify"}, |
| 106 | {ERR_FUNC(PKCS7_F_PKCS7_SIGNER_INFO_SET), "PKCS7_SIGNER_INFO_set"}, | ||
| 107 | {ERR_FUNC(PKCS7_F_PKCS7_SIGNER_INFO_SIGN), "PKCS7_SIGNER_INFO_sign"}, | ||
| 108 | {ERR_FUNC(PKCS7_F_PKCS7_SIGN_ADD_SIGNER), "PKCS7_sign_add_signer"}, | ||
| 97 | {ERR_FUNC(PKCS7_F_PKCS7_SIMPLE_SMIMECAP), "PKCS7_simple_smimecap"}, | 109 | {ERR_FUNC(PKCS7_F_PKCS7_SIMPLE_SMIMECAP), "PKCS7_simple_smimecap"}, |
| 98 | {ERR_FUNC(PKCS7_F_PKCS7_VERIFY), "PKCS7_verify"}, | 110 | {ERR_FUNC(PKCS7_F_PKCS7_VERIFY), "PKCS7_verify"}, |
| 99 | {ERR_FUNC(PKCS7_F_SMIME_READ_PKCS7), "SMIME_read_PKCS7"}, | 111 | {ERR_FUNC(PKCS7_F_SMIME_READ_PKCS7), "SMIME_read_PKCS7"}, |
| @@ -107,10 +119,13 @@ static ERR_STRING_DATA PKCS7_str_reasons[]= | |||
| 107 | {ERR_REASON(PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER),"cipher has no object identifier"}, | 119 | {ERR_REASON(PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER),"cipher has no object identifier"}, |
| 108 | {ERR_REASON(PKCS7_R_CIPHER_NOT_INITIALIZED),"cipher not initialized"}, | 120 | {ERR_REASON(PKCS7_R_CIPHER_NOT_INITIALIZED),"cipher not initialized"}, |
| 109 | {ERR_REASON(PKCS7_R_CONTENT_AND_DATA_PRESENT),"content and data present"}, | 121 | {ERR_REASON(PKCS7_R_CONTENT_AND_DATA_PRESENT),"content and data present"}, |
| 122 | {ERR_REASON(PKCS7_R_CTRL_ERROR) ,"ctrl error"}, | ||
| 110 | {ERR_REASON(PKCS7_R_DECODE_ERROR) ,"decode error"}, | 123 | {ERR_REASON(PKCS7_R_DECODE_ERROR) ,"decode error"}, |
| 111 | {ERR_REASON(PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH),"decrypted key is wrong length"}, | 124 | {ERR_REASON(PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH),"decrypted key is wrong length"}, |
| 112 | {ERR_REASON(PKCS7_R_DECRYPT_ERROR) ,"decrypt error"}, | 125 | {ERR_REASON(PKCS7_R_DECRYPT_ERROR) ,"decrypt error"}, |
| 113 | {ERR_REASON(PKCS7_R_DIGEST_FAILURE) ,"digest failure"}, | 126 | {ERR_REASON(PKCS7_R_DIGEST_FAILURE) ,"digest failure"}, |
| 127 | {ERR_REASON(PKCS7_R_ENCRYPTION_CTRL_FAILURE),"encryption ctrl failure"}, | ||
| 128 | {ERR_REASON(PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE),"encryption not supported for this key type"}, | ||
| 114 | {ERR_REASON(PKCS7_R_ERROR_ADDING_RECIPIENT),"error adding recipient"}, | 129 | {ERR_REASON(PKCS7_R_ERROR_ADDING_RECIPIENT),"error adding recipient"}, |
| 115 | {ERR_REASON(PKCS7_R_ERROR_SETTING_CIPHER),"error setting cipher"}, | 130 | {ERR_REASON(PKCS7_R_ERROR_SETTING_CIPHER),"error setting cipher"}, |
| 116 | {ERR_REASON(PKCS7_R_INVALID_MIME_TYPE) ,"invalid mime type"}, | 131 | {ERR_REASON(PKCS7_R_INVALID_MIME_TYPE) ,"invalid mime type"}, |
| @@ -121,6 +136,8 @@ static ERR_STRING_DATA PKCS7_str_reasons[]= | |||
| 121 | {ERR_REASON(PKCS7_R_MISSING_CERIPEND_INFO),"missing ceripend info"}, | 136 | {ERR_REASON(PKCS7_R_MISSING_CERIPEND_INFO),"missing ceripend info"}, |
| 122 | {ERR_REASON(PKCS7_R_NO_CONTENT) ,"no content"}, | 137 | {ERR_REASON(PKCS7_R_NO_CONTENT) ,"no content"}, |
| 123 | {ERR_REASON(PKCS7_R_NO_CONTENT_TYPE) ,"no content type"}, | 138 | {ERR_REASON(PKCS7_R_NO_CONTENT_TYPE) ,"no content type"}, |
| 139 | {ERR_REASON(PKCS7_R_NO_DEFAULT_DIGEST) ,"no default digest"}, | ||
| 140 | {ERR_REASON(PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND),"no matching digest type found"}, | ||
| 124 | {ERR_REASON(PKCS7_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"}, | 141 | {ERR_REASON(PKCS7_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"}, |
| 125 | {ERR_REASON(PKCS7_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"}, | 142 | {ERR_REASON(PKCS7_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"}, |
| 126 | {ERR_REASON(PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE),"no recipient matches certificate"}, | 143 | {ERR_REASON(PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE),"no recipient matches certificate"}, |
| @@ -130,6 +147,7 @@ static ERR_STRING_DATA PKCS7_str_reasons[]= | |||
| 130 | {ERR_REASON(PKCS7_R_NO_SIG_CONTENT_TYPE) ,"no sig content type"}, | 147 | {ERR_REASON(PKCS7_R_NO_SIG_CONTENT_TYPE) ,"no sig content type"}, |
| 131 | {ERR_REASON(PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE),"operation not supported on this type"}, | 148 | {ERR_REASON(PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE),"operation not supported on this type"}, |
| 132 | {ERR_REASON(PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR),"pkcs7 add signature error"}, | 149 | {ERR_REASON(PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR),"pkcs7 add signature error"}, |
| 150 | {ERR_REASON(PKCS7_R_PKCS7_ADD_SIGNER_ERROR),"pkcs7 add signer error"}, | ||
| 133 | {ERR_REASON(PKCS7_R_PKCS7_DATAFINAL) ,"pkcs7 datafinal"}, | 151 | {ERR_REASON(PKCS7_R_PKCS7_DATAFINAL) ,"pkcs7 datafinal"}, |
| 134 | {ERR_REASON(PKCS7_R_PKCS7_DATAFINAL_ERROR),"pkcs7 datafinal error"}, | 152 | {ERR_REASON(PKCS7_R_PKCS7_DATAFINAL_ERROR),"pkcs7 datafinal error"}, |
| 135 | {ERR_REASON(PKCS7_R_PKCS7_DATASIGN) ,"pkcs7 datasign"}, | 153 | {ERR_REASON(PKCS7_R_PKCS7_DATASIGN) ,"pkcs7 datasign"}, |
| @@ -138,6 +156,8 @@ static ERR_STRING_DATA PKCS7_str_reasons[]= | |||
| 138 | {ERR_REASON(PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE),"private key does not match certificate"}, | 156 | {ERR_REASON(PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE),"private key does not match certificate"}, |
| 139 | {ERR_REASON(PKCS7_R_SIGNATURE_FAILURE) ,"signature failure"}, | 157 | {ERR_REASON(PKCS7_R_SIGNATURE_FAILURE) ,"signature failure"}, |
| 140 | {ERR_REASON(PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND),"signer certificate not found"}, | 158 | {ERR_REASON(PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND),"signer certificate not found"}, |
| 159 | {ERR_REASON(PKCS7_R_SIGNING_CTRL_FAILURE),"signing ctrl failure"}, | ||
| 160 | {ERR_REASON(PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE),"signing not supported for this key type"}, | ||
| 141 | {ERR_REASON(PKCS7_R_SIG_INVALID_MIME_TYPE),"sig invalid mime type"}, | 161 | {ERR_REASON(PKCS7_R_SIG_INVALID_MIME_TYPE),"sig invalid mime type"}, |
| 142 | {ERR_REASON(PKCS7_R_SMIME_TEXT_ERROR) ,"smime text error"}, | 162 | {ERR_REASON(PKCS7_R_SMIME_TEXT_ERROR) ,"smime text error"}, |
| 143 | {ERR_REASON(PKCS7_R_UNABLE_TO_FIND_CERTIFICATE),"unable to find certificate"}, | 163 | {ERR_REASON(PKCS7_R_UNABLE_TO_FIND_CERTIFICATE),"unable to find certificate"}, |
diff --git a/src/lib/libcrypto/pqueue/pq_compat.h b/src/lib/libcrypto/pqueue/pq_compat.h deleted file mode 100644 index 7b2c32725c..0000000000 --- a/src/lib/libcrypto/pqueue/pq_compat.h +++ /dev/null | |||
| @@ -1,152 +0,0 @@ | |||
| 1 | /* crypto/pqueue/pqueue_compat.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_PQ_COMPAT_H | ||
| 61 | #define HEADER_PQ_COMPAT_H | ||
| 62 | |||
| 63 | #include <openssl/opensslconf.h> | ||
| 64 | #include <openssl/bn.h> | ||
| 65 | |||
| 66 | /* | ||
| 67 | * The purpose of this header file is for supporting 64-bit integer | ||
| 68 | * manipulation on 32-bit (and lower) machines. Currently the only | ||
| 69 | * such environment is VMS, Utrix and those with smaller default integer | ||
| 70 | * sizes than 32 bits. For all such environment, we fall back to using | ||
| 71 | * BIGNUM. We may need to fine tune the conditions for systems that | ||
| 72 | * are incorrectly configured. | ||
| 73 | * | ||
| 74 | * The only clients of this code are (1) pqueue for priority, and | ||
| 75 | * (2) DTLS, for sequence number manipulation. | ||
| 76 | */ | ||
| 77 | |||
| 78 | #if (defined(THIRTY_TWO_BIT) && !defined(BN_LLONG)) || defined(SIXTEEN_BIT) || defined(EIGHT_BIT) | ||
| 79 | |||
| 80 | #define PQ_64BIT_IS_INTEGER 0 | ||
| 81 | #define PQ_64BIT_IS_BIGNUM 1 | ||
| 82 | |||
| 83 | #define PQ_64BIT BIGNUM | ||
| 84 | #define PQ_64BIT_CTX BN_CTX | ||
| 85 | |||
| 86 | #define pq_64bit_init(x) BN_init(x) | ||
| 87 | #define pq_64bit_free(x) BN_free(x) | ||
| 88 | |||
| 89 | #define pq_64bit_ctx_new(ctx) BN_CTX_new() | ||
| 90 | #define pq_64bit_ctx_free(x) BN_CTX_free(x) | ||
| 91 | |||
| 92 | #define pq_64bit_assign(x, y) BN_copy(x, y) | ||
| 93 | #define pq_64bit_assign_word(x, y) BN_set_word(x, y) | ||
| 94 | #define pq_64bit_gt(x, y) BN_ucmp(x, y) >= 1 ? 1 : 0 | ||
| 95 | #define pq_64bit_eq(x, y) BN_ucmp(x, y) == 0 ? 1 : 0 | ||
| 96 | #define pq_64bit_add_word(x, w) BN_add_word(x, w) | ||
| 97 | #define pq_64bit_sub(r, x, y) BN_sub(r, x, y) | ||
| 98 | #define pq_64bit_sub_word(x, w) BN_sub_word(x, w) | ||
| 99 | #define pq_64bit_mod(r, x, n, ctx) BN_mod(r, x, n, ctx) | ||
| 100 | |||
| 101 | #define pq_64bit_bin2num(bn, bytes, len) BN_bin2bn(bytes, len, bn) | ||
| 102 | #define pq_64bit_num2bin(bn, bytes) BN_bn2bin(bn, bytes) | ||
| 103 | #define pq_64bit_get_word(x) BN_get_word(x) | ||
| 104 | #define pq_64bit_is_bit_set(x, offset) BN_is_bit_set(x, offset) | ||
| 105 | #define pq_64bit_lshift(r, x, shift) BN_lshift(r, x, shift) | ||
| 106 | #define pq_64bit_set_bit(x, num) BN_set_bit(x, num) | ||
| 107 | #define pq_64bit_get_length(x) BN_num_bits((x)) | ||
| 108 | |||
| 109 | #else | ||
| 110 | |||
| 111 | #define PQ_64BIT_IS_INTEGER 1 | ||
| 112 | #define PQ_64BIT_IS_BIGNUM 0 | ||
| 113 | |||
| 114 | #if defined(SIXTY_FOUR_BIT) | ||
| 115 | #define PQ_64BIT BN_ULONG | ||
| 116 | #define PQ_64BIT_PRINT "%lld" | ||
| 117 | #elif defined(SIXTY_FOUR_BIT_LONG) | ||
| 118 | #define PQ_64BIT BN_ULONG | ||
| 119 | #define PQ_64BIT_PRINT "%ld" | ||
| 120 | #elif defined(THIRTY_TWO_BIT) | ||
| 121 | #define PQ_64BIT BN_ULLONG | ||
| 122 | #define PQ_64BIT_PRINT "%lld" | ||
| 123 | #endif | ||
| 124 | |||
| 125 | #define PQ_64BIT_CTX void | ||
| 126 | |||
| 127 | #define pq_64bit_init(x) | ||
| 128 | #define pq_64bit_free(x) | ||
| 129 | #define pq_64bit_ctx_new(ctx) (ctx) | ||
| 130 | #define pq_64bit_ctx_free(x) | ||
| 131 | |||
| 132 | #define pq_64bit_assign(x, y) (*(x) = *(y)) | ||
| 133 | #define pq_64bit_assign_word(x, y) (*(x) = y) | ||
| 134 | #define pq_64bit_gt(x, y) (*(x) > *(y)) | ||
| 135 | #define pq_64bit_eq(x, y) (*(x) == *(y)) | ||
| 136 | #define pq_64bit_add_word(x, w) (*(x) = (*(x) + (w))) | ||
| 137 | #define pq_64bit_sub(r, x, y) (*(r) = (*(x) - *(y))) | ||
| 138 | #define pq_64bit_sub_word(x, w) (*(x) = (*(x) - (w))) | ||
| 139 | #define pq_64bit_mod(r, x, n, ctx) | ||
| 140 | |||
| 141 | #define pq_64bit_bin2num(num, bytes, len) bytes_to_long_long(bytes, num) | ||
| 142 | #define pq_64bit_num2bin(num, bytes) long_long_to_bytes(num, bytes) | ||
| 143 | #define pq_64bit_get_word(x) *(x) | ||
| 144 | #define pq_64bit_lshift(r, x, shift) (*(r) = (*(x) << (shift))) | ||
| 145 | #define pq_64bit_set_bit(x, num) do { \ | ||
| 146 | PQ_64BIT mask = 1; \ | ||
| 147 | mask = mask << (num); \ | ||
| 148 | *(x) |= mask; \ | ||
| 149 | } while(0) | ||
| 150 | #endif /* OPENSSL_SYS_VMS */ | ||
| 151 | |||
| 152 | #endif | ||
diff --git a/src/lib/libcrypto/rand/Makefile b/src/lib/libcrypto/rand/Makefile index 30794305cb..27694aa664 100644 --- a/src/lib/libcrypto/rand/Makefile +++ b/src/lib/libcrypto/rand/Makefile | |||
| @@ -17,9 +17,9 @@ TEST= randtest.c | |||
| 17 | APPS= | 17 | APPS= |
| 18 | 18 | ||
| 19 | LIB=$(TOP)/libcrypto.a | 19 | LIB=$(TOP)/libcrypto.a |
| 20 | LIBSRC=md_rand.c randfile.c rand_lib.c rand_eng.c rand_err.c rand_egd.c \ | 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 | 21 | rand_win.c rand_unix.c rand_os2.c rand_nw.c |
| 22 | LIBOBJ=md_rand.o randfile.o rand_lib.o rand_eng.o rand_err.o rand_egd.o \ | 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 | 23 | rand_win.o rand_unix.o rand_os2.o rand_nw.o |
| 24 | 24 | ||
| 25 | SRC= $(LIBSRC) | 25 | SRC= $(LIBSRC) |
| @@ -35,7 +35,7 @@ top: | |||
| 35 | all: lib | 35 | all: lib |
| 36 | 36 | ||
| 37 | lib: $(LIBOBJ) | 37 | lib: $(LIBOBJ) |
| 38 | $(ARX) $(LIB) $(LIBOBJ) | 38 | $(AR) $(LIB) $(LIBOBJ) |
| 39 | $(RANLIB) $(LIB) || echo Never mind. | 39 | $(RANLIB) $(LIB) || echo Never mind. |
| 40 | @touch lib | 40 | @touch lib |
| 41 | 41 | ||
| @@ -79,34 +79,17 @@ clean: | |||
| 79 | md_rand.o: ../../e_os.h ../../include/openssl/asn1.h | 79 | md_rand.o: ../../e_os.h ../../include/openssl/asn1.h |
| 80 | md_rand.o: ../../include/openssl/bio.h ../../include/openssl/crypto.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 | 81 | md_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 82 | md_rand.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 82 | md_rand.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 83 | md_rand.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 83 | md_rand.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 84 | md_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 84 | md_rand.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 85 | md_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 85 | md_rand.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
| 86 | md_rand.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 86 | md_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 87 | md_rand.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 87 | md_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 88 | md_rand.o: ../../include/openssl/symhacks.h md_rand.c rand_lcl.h | 88 | md_rand.o: md_rand.c rand_lcl.h |
| 89 | rand_egd.o: ../../include/openssl/buffer.h ../../include/openssl/e_os2.h | 89 | rand_egd.o: ../../include/openssl/buffer.h ../../include/openssl/e_os2.h |
| 90 | rand_egd.o: ../../include/openssl/opensslconf.h | 90 | rand_egd.o: ../../include/openssl/opensslconf.h |
| 91 | rand_egd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | 91 | rand_egd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
| 92 | rand_egd.o: rand_egd.c | 92 | rand_egd.o: rand_egd.c |
| 93 | rand_eng.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 94 | rand_eng.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 95 | rand_eng.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 96 | rand_eng.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 97 | rand_eng.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 98 | rand_eng.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 99 | rand_eng.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 100 | rand_eng.o: ../../include/openssl/fips.h ../../include/openssl/fips_rand.h | ||
| 101 | rand_eng.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 102 | rand_eng.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 103 | rand_eng.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 104 | rand_eng.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 105 | rand_eng.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 106 | rand_eng.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 107 | rand_eng.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 108 | rand_eng.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 109 | rand_eng.o: ../cryptlib.h rand_eng.c rand_lcl.h | ||
| 110 | rand_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | 93 | rand_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h |
| 111 | rand_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 94 | rand_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 112 | rand_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 95 | rand_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
| @@ -116,39 +99,34 @@ rand_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | |||
| 116 | rand_err.o: rand_err.c | 99 | rand_err.o: rand_err.c |
| 117 | rand_lib.o: ../../e_os.h ../../include/openssl/asn1.h | 100 | rand_lib.o: ../../e_os.h ../../include/openssl/asn1.h |
| 118 | rand_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 101 | rand_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 119 | rand_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 102 | rand_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 120 | rand_lib.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 121 | rand_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 103 | rand_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 122 | rand_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 104 | rand_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 123 | rand_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 105 | rand_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 124 | rand_lib.o: ../../include/openssl/fips.h ../../include/openssl/fips_rand.h | ||
| 125 | rand_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 106 | rand_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 126 | rand_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 107 | rand_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 127 | rand_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 108 | rand_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 128 | rand_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | 109 | rand_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 129 | rand_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 110 | rand_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 130 | rand_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 111 | rand_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 131 | rand_lib.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 132 | rand_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 112 | rand_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 133 | rand_lib.o: ../cryptlib.h rand_lcl.h rand_lib.c | 113 | rand_lib.o: ../cryptlib.h rand_lib.c |
| 134 | rand_nw.o: ../../e_os.h ../../include/openssl/asn1.h | 114 | rand_nw.o: ../../e_os.h ../../include/openssl/asn1.h |
| 135 | rand_nw.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 115 | rand_nw.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 136 | rand_nw.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 116 | rand_nw.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 137 | rand_nw.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 117 | rand_nw.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 138 | rand_nw.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 118 | rand_nw.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 139 | rand_nw.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 119 | rand_nw.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 140 | rand_nw.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 120 | rand_nw.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 141 | rand_nw.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | 121 | rand_nw.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
| 142 | rand_nw.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 122 | rand_nw.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 143 | rand_nw.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 123 | rand_nw.o: ../../include/openssl/symhacks.h ../cryptlib.h rand_lcl.h rand_nw.c |
| 144 | rand_nw.o: ../cryptlib.h rand_lcl.h rand_nw.c | ||
| 145 | rand_os2.o: ../../e_os.h ../../include/openssl/asn1.h | 124 | rand_os2.o: ../../e_os.h ../../include/openssl/asn1.h |
| 146 | rand_os2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 125 | rand_os2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 147 | rand_os2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 126 | rand_os2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 148 | rand_os2.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 127 | rand_os2.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 149 | rand_os2.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 128 | rand_os2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 150 | rand_os2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 129 | rand_os2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 151 | rand_os2.o: ../../include/openssl/opensslconf.h | ||
| 152 | rand_os2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 130 | rand_os2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 153 | rand_os2.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 131 | rand_os2.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
| 154 | rand_os2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 132 | rand_os2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| @@ -158,8 +136,8 @@ rand_unix.o: ../../e_os.h ../../include/openssl/asn1.h | |||
| 158 | rand_unix.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 136 | rand_unix.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 159 | rand_unix.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 137 | rand_unix.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 160 | rand_unix.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 138 | rand_unix.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 161 | rand_unix.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 139 | rand_unix.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 162 | rand_unix.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 140 | rand_unix.o: ../../include/openssl/objects.h |
| 163 | rand_unix.o: ../../include/openssl/opensslconf.h | 141 | rand_unix.o: ../../include/openssl/opensslconf.h |
| 164 | rand_unix.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 142 | rand_unix.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 165 | rand_unix.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 143 | rand_unix.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
| @@ -170,9 +148,8 @@ rand_win.o: ../../e_os.h ../../include/openssl/asn1.h | |||
| 170 | rand_win.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 148 | rand_win.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 171 | rand_win.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 149 | rand_win.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 172 | rand_win.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 150 | rand_win.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 173 | rand_win.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 151 | rand_win.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 174 | rand_win.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 152 | rand_win.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 175 | rand_win.o: ../../include/openssl/opensslconf.h | ||
| 176 | rand_win.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 153 | rand_win.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 177 | rand_win.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | 154 | rand_win.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
| 178 | rand_win.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 155 | rand_win.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
diff --git a/src/lib/libcrypto/rand/Makefile.ssl b/src/lib/libcrypto/rand/Makefile.ssl deleted file mode 100644 index e5cbe5319c..0000000000 --- a/src/lib/libcrypto/rand/Makefile.ssl +++ /dev/null | |||
| @@ -1,196 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/rand/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= rand | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= randtest.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=md_rand.c randfile.c rand_lib.c rand_err.c rand_egd.c \ | ||
| 27 | rand_win.c rand_unix.c rand_os2.c | ||
| 28 | LIBOBJ=md_rand.o randfile.o rand_lib.o rand_err.o rand_egd.o \ | ||
| 29 | rand_win.o rand_unix.o rand_os2.o | ||
| 30 | |||
| 31 | SRC= $(LIBSRC) | ||
| 32 | |||
| 33 | EXHEADER= rand.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.ssl >> $(TOP)/MINFO | ||
| 50 | |||
| 51 | links: | ||
| 52 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 55 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 56 | |||
| 57 | install: | ||
| 58 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 74 | |||
| 75 | dclean: | ||
| 76 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 77 | mv -f Makefile.new $(MAKEFILE) | ||
| 78 | |||
| 79 | clean: | ||
| 80 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 81 | |||
| 82 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 83 | |||
| 84 | md_rand.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 85 | md_rand.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 86 | md_rand.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 87 | md_rand.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 88 | md_rand.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 89 | md_rand.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 90 | md_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 91 | md_rand.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 92 | md_rand.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 93 | md_rand.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 94 | md_rand.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 95 | md_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 96 | md_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 97 | md_rand.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 98 | md_rand.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 99 | md_rand.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 100 | md_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 101 | md_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 102 | md_rand.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 103 | md_rand.o: md_rand.c rand_lcl.h | ||
| 104 | rand_egd.o: ../../include/openssl/buffer.h ../../include/openssl/e_os2.h | ||
| 105 | rand_egd.o: ../../include/openssl/opensslconf.h | ||
| 106 | rand_egd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 107 | rand_egd.o: rand_egd.c | ||
| 108 | rand_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 109 | rand_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 110 | rand_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 111 | rand_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 112 | rand_err.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 113 | rand_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 114 | rand_err.o: rand_err.c | ||
| 115 | rand_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 116 | rand_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 117 | rand_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 118 | rand_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 119 | rand_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 120 | rand_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 121 | rand_lib.o: ../../include/openssl/opensslconf.h | ||
| 122 | rand_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 123 | rand_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 124 | rand_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 125 | rand_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 126 | rand_lib.o: ../cryptlib.h rand_lib.c | ||
| 127 | rand_os2.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 128 | rand_os2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 129 | rand_os2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 130 | rand_os2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 131 | rand_os2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 132 | rand_os2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 133 | rand_os2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 134 | rand_os2.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 135 | rand_os2.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 136 | rand_os2.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 137 | rand_os2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 138 | rand_os2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 139 | rand_os2.o: ../../include/openssl/opensslconf.h | ||
| 140 | rand_os2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 141 | rand_os2.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 142 | rand_os2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 143 | rand_os2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 144 | rand_os2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 145 | rand_os2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 146 | rand_os2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 147 | rand_os2.o: ../cryptlib.h rand_lcl.h rand_os2.c | ||
| 148 | rand_unix.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 149 | rand_unix.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 150 | rand_unix.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 151 | rand_unix.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 152 | rand_unix.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 153 | rand_unix.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 154 | rand_unix.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 155 | rand_unix.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 156 | rand_unix.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 157 | rand_unix.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 158 | rand_unix.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 159 | rand_unix.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 160 | rand_unix.o: ../../include/openssl/opensslconf.h | ||
| 161 | rand_unix.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 162 | rand_unix.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 163 | rand_unix.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 164 | rand_unix.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 165 | rand_unix.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 166 | rand_unix.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 167 | rand_unix.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 168 | rand_unix.o: ../cryptlib.h rand_lcl.h rand_unix.c | ||
| 169 | rand_win.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 170 | rand_win.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 171 | rand_win.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 172 | rand_win.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 173 | rand_win.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 174 | rand_win.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 175 | rand_win.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 176 | rand_win.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 177 | rand_win.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 178 | rand_win.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 179 | rand_win.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 180 | rand_win.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 181 | rand_win.o: ../../include/openssl/opensslconf.h | ||
| 182 | rand_win.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 183 | rand_win.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 184 | rand_win.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 185 | rand_win.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 186 | rand_win.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 187 | rand_win.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 188 | rand_win.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 189 | rand_win.o: ../cryptlib.h rand_lcl.h rand_win.c | ||
| 190 | randfile.o: ../../e_os.h ../../include/openssl/buffer.h | ||
| 191 | randfile.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 192 | randfile.o: ../../include/openssl/opensslconf.h | ||
| 193 | randfile.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 194 | randfile.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 195 | randfile.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 196 | randfile.o: randfile.c | ||
diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c index 0f8dd3e00f..88088ce73c 100644 --- a/src/lib/libcrypto/rand/md_rand.c +++ b/src/lib/libcrypto/rand/md_rand.c | |||
| @@ -126,10 +126,6 @@ | |||
| 126 | 126 | ||
| 127 | #include <openssl/crypto.h> | 127 | #include <openssl/crypto.h> |
| 128 | #include <openssl/err.h> | 128 | #include <openssl/err.h> |
| 129 | #ifdef OPENSSL_FIPS | ||
| 130 | #include <openssl/fips.h> | ||
| 131 | #endif | ||
| 132 | |||
| 133 | 129 | ||
| 134 | #ifdef BN_DEBUG | 130 | #ifdef BN_DEBUG |
| 135 | # define PREDICT | 131 | # define PREDICT |
| @@ -149,7 +145,7 @@ static unsigned int crypto_lock_rand = 0; /* may be set only when a thread | |||
| 149 | * holds CRYPTO_LOCK_RAND | 145 | * holds CRYPTO_LOCK_RAND |
| 150 | * (to prevent double locking) */ | 146 | * (to prevent double locking) */ |
| 151 | /* access to lockin_thread is synchronized by CRYPTO_LOCK_RAND2 */ | 147 | /* access to lockin_thread is synchronized by CRYPTO_LOCK_RAND2 */ |
| 152 | static unsigned long locking_thread = 0; /* valid iff crypto_lock_rand is set */ | 148 | static CRYPTO_THREADID locking_threadid; /* valid iff crypto_lock_rand is set */ |
| 153 | 149 | ||
| 154 | 150 | ||
| 155 | #ifdef PREDICT | 151 | #ifdef PREDICT |
| @@ -217,8 +213,10 @@ static void ssleay_rand_add(const void *buf, int num, double add) | |||
| 217 | /* check if we already have the lock */ | 213 | /* check if we already have the lock */ |
| 218 | if (crypto_lock_rand) | 214 | if (crypto_lock_rand) |
| 219 | { | 215 | { |
| 216 | CRYPTO_THREADID cur; | ||
| 217 | CRYPTO_THREADID_current(&cur); | ||
| 220 | CRYPTO_r_lock(CRYPTO_LOCK_RAND2); | 218 | CRYPTO_r_lock(CRYPTO_LOCK_RAND2); |
| 221 | do_not_lock = (locking_thread == CRYPTO_thread_id()); | 219 | do_not_lock = !CRYPTO_THREADID_cmp(&locking_threadid, &cur); |
| 222 | CRYPTO_r_unlock(CRYPTO_LOCK_RAND2); | 220 | CRYPTO_r_unlock(CRYPTO_LOCK_RAND2); |
| 223 | } | 221 | } |
| 224 | else | 222 | else |
| @@ -274,8 +272,16 @@ static void ssleay_rand_add(const void *buf, int num, double add) | |||
| 274 | } | 272 | } |
| 275 | else | 273 | else |
| 276 | MD_Update(&m,&(state[st_idx]),j); | 274 | MD_Update(&m,&(state[st_idx]),j); |
| 277 | 275 | ||
| 276 | /* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */ | ||
| 278 | MD_Update(&m,buf,j); | 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 | |||
| 279 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); | 285 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); |
| 280 | MD_Final(&m,local_md); | 286 | MD_Final(&m,local_md); |
| 281 | md_c[1]++; | 287 | md_c[1]++; |
| @@ -336,14 +342,6 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) | |||
| 336 | #endif | 342 | #endif |
| 337 | int do_stir_pool = 0; | 343 | int do_stir_pool = 0; |
| 338 | 344 | ||
| 339 | #ifdef OPENSSL_FIPS | ||
| 340 | if(FIPS_mode()) | ||
| 341 | { | ||
| 342 | FIPSerr(FIPS_F_SSLEAY_RAND_BYTES,FIPS_R_NON_FIPS_METHOD); | ||
| 343 | return 0; | ||
| 344 | } | ||
| 345 | #endif | ||
| 346 | |||
| 347 | #ifdef PREDICT | 345 | #ifdef PREDICT |
| 348 | if (rand_predictable) | 346 | if (rand_predictable) |
| 349 | { | 347 | { |
| @@ -384,7 +382,7 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) | |||
| 384 | 382 | ||
| 385 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ | 383 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ |
| 386 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); | 384 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); |
| 387 | locking_thread = CRYPTO_thread_id(); | 385 | CRYPTO_THREADID_current(&locking_threadid); |
| 388 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND2); | 386 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND2); |
| 389 | crypto_lock_rand = 1; | 387 | crypto_lock_rand = 1; |
| 390 | 388 | ||
| @@ -476,9 +474,15 @@ static int ssleay_rand_bytes(unsigned char *buf, int num) | |||
| 476 | #endif | 474 | #endif |
| 477 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); | 475 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); |
| 478 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); | 476 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); |
| 479 | #ifndef PURIFY | 477 | |
| 480 | MD_Update(&m,buf,j); /* purify complains */ | 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. */ | ||
| 481 | #endif | 484 | #endif |
| 485 | |||
| 482 | k=(st_idx+MD_DIGEST_LENGTH/2)-st_num; | 486 | k=(st_idx+MD_DIGEST_LENGTH/2)-st_num; |
| 483 | if (k > 0) | 487 | if (k > 0) |
| 484 | { | 488 | { |
| @@ -539,15 +543,17 @@ static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num) | |||
| 539 | 543 | ||
| 540 | static int ssleay_rand_status(void) | 544 | static int ssleay_rand_status(void) |
| 541 | { | 545 | { |
| 546 | CRYPTO_THREADID cur; | ||
| 542 | int ret; | 547 | int ret; |
| 543 | int do_not_lock; | 548 | int do_not_lock; |
| 544 | 549 | ||
| 550 | CRYPTO_THREADID_current(&cur); | ||
| 545 | /* check if we already have the lock | 551 | /* check if we already have the lock |
| 546 | * (could happen if a RAND_poll() implementation calls RAND_status()) */ | 552 | * (could happen if a RAND_poll() implementation calls RAND_status()) */ |
| 547 | if (crypto_lock_rand) | 553 | if (crypto_lock_rand) |
| 548 | { | 554 | { |
| 549 | CRYPTO_r_lock(CRYPTO_LOCK_RAND2); | 555 | CRYPTO_r_lock(CRYPTO_LOCK_RAND2); |
| 550 | do_not_lock = (locking_thread == CRYPTO_thread_id()); | 556 | do_not_lock = !CRYPTO_THREADID_cmp(&locking_threadid, &cur); |
| 551 | CRYPTO_r_unlock(CRYPTO_LOCK_RAND2); | 557 | CRYPTO_r_unlock(CRYPTO_LOCK_RAND2); |
| 552 | } | 558 | } |
| 553 | else | 559 | else |
| @@ -559,7 +565,7 @@ static int ssleay_rand_status(void) | |||
| 559 | 565 | ||
| 560 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ | 566 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ |
| 561 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); | 567 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); |
| 562 | locking_thread = CRYPTO_thread_id(); | 568 | CRYPTO_THREADID_cpy(&locking_threadid, &cur); |
| 563 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND2); | 569 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND2); |
| 564 | crypto_lock_rand = 1; | 570 | crypto_lock_rand = 1; |
| 565 | } | 571 | } |
diff --git a/src/lib/libcrypto/rand/rand.h b/src/lib/libcrypto/rand/rand.h index ea89153cba..ac6c021763 100644 --- a/src/lib/libcrypto/rand/rand.h +++ b/src/lib/libcrypto/rand/rand.h | |||
| @@ -72,7 +72,7 @@ extern "C" { | |||
| 72 | #endif | 72 | #endif |
| 73 | 73 | ||
| 74 | #if defined(OPENSSL_FIPS) | 74 | #if defined(OPENSSL_FIPS) |
| 75 | #define FIPS_RAND_SIZE_T int | 75 | #define FIPS_RAND_SIZE_T size_t |
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| 78 | /* Already defined in ossl_typ.h */ | 78 | /* Already defined in ossl_typ.h */ |
| @@ -111,15 +111,6 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); | |||
| 111 | int RAND_egd(const char *path); | 111 | int RAND_egd(const char *path); |
| 112 | int RAND_egd_bytes(const char *path,int bytes); | 112 | int RAND_egd_bytes(const char *path,int bytes); |
| 113 | int RAND_poll(void); | 113 | int RAND_poll(void); |
| 114 | #ifndef OPENSSL_NO_ENGINE | ||
| 115 | #ifdef OPENSSL_FIPS | ||
| 116 | void int_RAND_init_engine_callbacks(void); | ||
| 117 | void int_RAND_set_callbacks( | ||
| 118 | int (*set_rand_func)(const RAND_METHOD *meth, | ||
| 119 | const RAND_METHOD **pmeth), | ||
| 120 | const RAND_METHOD *(*get_rand_func)(const RAND_METHOD **pmeth)); | ||
| 121 | #endif | ||
| 122 | #endif | ||
| 123 | 114 | ||
| 124 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | 115 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) |
| 125 | 116 | ||
| @@ -137,29 +128,11 @@ void ERR_load_RAND_strings(void); | |||
| 137 | /* Error codes for the RAND functions. */ | 128 | /* Error codes for the RAND functions. */ |
| 138 | 129 | ||
| 139 | /* Function codes. */ | 130 | /* Function codes. */ |
| 140 | #define RAND_F_ENG_RAND_GET_RAND_METHOD 108 | ||
| 141 | #define RAND_F_FIPS_RAND 103 | ||
| 142 | #define RAND_F_FIPS_RAND_BYTES 102 | ||
| 143 | #define RAND_F_FIPS_RAND_GET_RAND_METHOD 109 | ||
| 144 | #define RAND_F_FIPS_RAND_SET_DT 106 | ||
| 145 | #define RAND_F_FIPS_SET_DT 104 | ||
| 146 | #define RAND_F_FIPS_SET_PRNG_SEED 107 | ||
| 147 | #define RAND_F_FIPS_SET_TEST_MODE 105 | ||
| 148 | #define RAND_F_RAND_GET_RAND_METHOD 101 | 131 | #define RAND_F_RAND_GET_RAND_METHOD 101 |
| 149 | #define RAND_F_SSLEAY_RAND_BYTES 100 | 132 | #define RAND_F_SSLEAY_RAND_BYTES 100 |
| 150 | 133 | ||
| 151 | /* Reason codes. */ | 134 | /* Reason codes. */ |
| 152 | #define RAND_R_NON_FIPS_METHOD 105 | ||
| 153 | #define RAND_R_NOT_IN_TEST_MODE 106 | ||
| 154 | #define RAND_R_NO_KEY_SET 107 | ||
| 155 | #define RAND_R_PRNG_ASKING_FOR_TOO_MUCH 101 | ||
| 156 | #define RAND_R_PRNG_ERROR 108 | ||
| 157 | #define RAND_R_PRNG_KEYED 109 | ||
| 158 | #define RAND_R_PRNG_NOT_REKEYED 102 | ||
| 159 | #define RAND_R_PRNG_NOT_RESEEDED 103 | ||
| 160 | #define RAND_R_PRNG_NOT_SEEDED 100 | 135 | #define RAND_R_PRNG_NOT_SEEDED 100 |
| 161 | #define RAND_R_PRNG_SEED_MUST_NOT_MATCH_KEY 110 | ||
| 162 | #define RAND_R_PRNG_STUCK 104 | ||
| 163 | 136 | ||
| 164 | #ifdef __cplusplus | 137 | #ifdef __cplusplus |
| 165 | } | 138 | } |
diff --git a/src/lib/libcrypto/rand/rand_egd.c b/src/lib/libcrypto/rand/rand_egd.c index 50bce6caba..d53b916ebe 100644 --- a/src/lib/libcrypto/rand/rand_egd.c +++ b/src/lib/libcrypto/rand/rand_egd.c | |||
| @@ -95,7 +95,7 @@ | |||
| 95 | * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. | 95 | * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. |
| 96 | */ | 96 | */ |
| 97 | 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) | 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) | 99 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) |
| 100 | { | 100 | { |
| 101 | return(-1); | 101 | return(-1); |
diff --git a/src/lib/libcrypto/rand/rand_eng.c b/src/lib/libcrypto/rand/rand_eng.c deleted file mode 100644 index 1669cef43c..0000000000 --- a/src/lib/libcrypto/rand/rand_eng.c +++ /dev/null | |||
| @@ -1,152 +0,0 @@ | |||
| 1 | /* crypto/rand/rand_lib.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 "rand_lcl.h" | ||
| 63 | #include <openssl/rand.h> | ||
| 64 | #ifdef OPENSSL_FIPS | ||
| 65 | #include <openssl/fips.h> | ||
| 66 | #include <openssl/fips_rand.h> | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #ifndef OPENSSL_NO_ENGINE | ||
| 70 | #include <openssl/engine.h> | ||
| 71 | #endif | ||
| 72 | |||
| 73 | #if defined(OPENSSL_FIPS) && !defined(OPENSSL_NO_ENGINE) | ||
| 74 | |||
| 75 | /* non-NULL if default_RAND_meth is ENGINE-provided */ | ||
| 76 | static ENGINE *funct_ref =NULL; | ||
| 77 | |||
| 78 | int eng_RAND_set_rand_method(const RAND_METHOD *meth, const RAND_METHOD **pmeth) | ||
| 79 | { | ||
| 80 | if(funct_ref) | ||
| 81 | { | ||
| 82 | ENGINE_finish(funct_ref); | ||
| 83 | funct_ref = NULL; | ||
| 84 | } | ||
| 85 | *pmeth = meth; | ||
| 86 | return 1; | ||
| 87 | } | ||
| 88 | |||
| 89 | const RAND_METHOD *eng_RAND_get_rand_method(const RAND_METHOD **pmeth) | ||
| 90 | { | ||
| 91 | if (!*pmeth) | ||
| 92 | { | ||
| 93 | ENGINE *e = ENGINE_get_default_RAND(); | ||
| 94 | if(e) | ||
| 95 | { | ||
| 96 | *pmeth = ENGINE_get_RAND(e); | ||
| 97 | if(!*pmeth) | ||
| 98 | { | ||
| 99 | ENGINE_finish(e); | ||
| 100 | e = NULL; | ||
| 101 | } | ||
| 102 | } | ||
| 103 | if(e) | ||
| 104 | funct_ref = e; | ||
| 105 | else | ||
| 106 | if(FIPS_mode()) | ||
| 107 | *pmeth=FIPS_rand_method(); | ||
| 108 | else | ||
| 109 | *pmeth = RAND_SSLeay(); | ||
| 110 | } | ||
| 111 | |||
| 112 | if(FIPS_mode() | ||
| 113 | && *pmeth != FIPS_rand_check()) | ||
| 114 | { | ||
| 115 | RANDerr(RAND_F_ENG_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD); | ||
| 116 | return 0; | ||
| 117 | } | ||
| 118 | |||
| 119 | return *pmeth; | ||
| 120 | } | ||
| 121 | |||
| 122 | int RAND_set_rand_engine(ENGINE *engine) | ||
| 123 | { | ||
| 124 | const RAND_METHOD *tmp_meth = NULL; | ||
| 125 | if(engine) | ||
| 126 | { | ||
| 127 | if(!ENGINE_init(engine)) | ||
| 128 | return 0; | ||
| 129 | tmp_meth = ENGINE_get_RAND(engine); | ||
| 130 | if(!tmp_meth) | ||
| 131 | { | ||
| 132 | ENGINE_finish(engine); | ||
| 133 | return 0; | ||
| 134 | } | ||
| 135 | } | ||
| 136 | /* This function releases any prior ENGINE so call it first */ | ||
| 137 | RAND_set_rand_method(tmp_meth); | ||
| 138 | funct_ref = engine; | ||
| 139 | return 1; | ||
| 140 | } | ||
| 141 | |||
| 142 | void int_RAND_init_engine_callbacks(void) | ||
| 143 | { | ||
| 144 | static int done = 0; | ||
| 145 | if (done) | ||
| 146 | return; | ||
| 147 | int_RAND_set_callbacks(eng_RAND_set_rand_method, | ||
| 148 | eng_RAND_get_rand_method); | ||
| 149 | done = 1; | ||
| 150 | } | ||
| 151 | |||
| 152 | #endif | ||
diff --git a/src/lib/libcrypto/rand/rand_err.c b/src/lib/libcrypto/rand/rand_err.c index 829fb44d77..03cda4dd92 100644 --- a/src/lib/libcrypto/rand/rand_err.c +++ b/src/lib/libcrypto/rand/rand_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/rand/rand_err.c */ | 1 | /* crypto/rand/rand_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -70,14 +70,6 @@ | |||
| 70 | 70 | ||
| 71 | static ERR_STRING_DATA RAND_str_functs[]= | 71 | static ERR_STRING_DATA RAND_str_functs[]= |
| 72 | { | 72 | { |
| 73 | {ERR_FUNC(RAND_F_ENG_RAND_GET_RAND_METHOD), "ENG_RAND_GET_RAND_METHOD"}, | ||
| 74 | {ERR_FUNC(RAND_F_FIPS_RAND), "FIPS_RAND"}, | ||
| 75 | {ERR_FUNC(RAND_F_FIPS_RAND_BYTES), "FIPS_RAND_BYTES"}, | ||
| 76 | {ERR_FUNC(RAND_F_FIPS_RAND_GET_RAND_METHOD), "FIPS_RAND_GET_RAND_METHOD"}, | ||
| 77 | {ERR_FUNC(RAND_F_FIPS_RAND_SET_DT), "FIPS_RAND_SET_DT"}, | ||
| 78 | {ERR_FUNC(RAND_F_FIPS_SET_DT), "FIPS_SET_DT"}, | ||
| 79 | {ERR_FUNC(RAND_F_FIPS_SET_PRNG_SEED), "FIPS_SET_PRNG_SEED"}, | ||
| 80 | {ERR_FUNC(RAND_F_FIPS_SET_TEST_MODE), "FIPS_SET_TEST_MODE"}, | ||
| 81 | {ERR_FUNC(RAND_F_RAND_GET_RAND_METHOD), "RAND_get_rand_method"}, | 73 | {ERR_FUNC(RAND_F_RAND_GET_RAND_METHOD), "RAND_get_rand_method"}, |
| 82 | {ERR_FUNC(RAND_F_SSLEAY_RAND_BYTES), "SSLEAY_RAND_BYTES"}, | 74 | {ERR_FUNC(RAND_F_SSLEAY_RAND_BYTES), "SSLEAY_RAND_BYTES"}, |
| 83 | {0,NULL} | 75 | {0,NULL} |
| @@ -85,17 +77,7 @@ static ERR_STRING_DATA RAND_str_functs[]= | |||
| 85 | 77 | ||
| 86 | static ERR_STRING_DATA RAND_str_reasons[]= | 78 | static ERR_STRING_DATA RAND_str_reasons[]= |
| 87 | { | 79 | { |
| 88 | {ERR_REASON(RAND_R_NON_FIPS_METHOD) ,"non fips method"}, | ||
| 89 | {ERR_REASON(RAND_R_NOT_IN_TEST_MODE) ,"not in test mode"}, | ||
| 90 | {ERR_REASON(RAND_R_NO_KEY_SET) ,"no key set"}, | ||
| 91 | {ERR_REASON(RAND_R_PRNG_ASKING_FOR_TOO_MUCH),"prng asking for too much"}, | ||
| 92 | {ERR_REASON(RAND_R_PRNG_ERROR) ,"prng error"}, | ||
| 93 | {ERR_REASON(RAND_R_PRNG_KEYED) ,"prng keyed"}, | ||
| 94 | {ERR_REASON(RAND_R_PRNG_NOT_REKEYED) ,"prng not rekeyed"}, | ||
| 95 | {ERR_REASON(RAND_R_PRNG_NOT_RESEEDED) ,"prng not reseeded"}, | ||
| 96 | {ERR_REASON(RAND_R_PRNG_NOT_SEEDED) ,"PRNG not seeded"}, | 80 | {ERR_REASON(RAND_R_PRNG_NOT_SEEDED) ,"PRNG not seeded"}, |
| 97 | {ERR_REASON(RAND_R_PRNG_SEED_MUST_NOT_MATCH_KEY),"prng seed must not match key"}, | ||
| 98 | {ERR_REASON(RAND_R_PRNG_STUCK) ,"prng stuck"}, | ||
| 99 | {0,NULL} | 81 | {0,NULL} |
| 100 | }; | 82 | }; |
| 101 | 83 | ||
diff --git a/src/lib/libcrypto/rand/rand_lcl.h b/src/lib/libcrypto/rand/rand_lcl.h index 18cc9b1e4a..618a8ec899 100644 --- a/src/lib/libcrypto/rand/rand_lcl.h +++ b/src/lib/libcrypto/rand/rand_lcl.h | |||
| @@ -154,16 +154,5 @@ | |||
| 154 | #define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md2(), NULL) | 154 | #define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md2(), NULL) |
| 155 | #endif | 155 | #endif |
| 156 | 156 | ||
| 157 | #ifndef OPENSSL_NO_ENGINE | ||
| 158 | void int_RAND_set_callbacks( | ||
| 159 | int (*set_rand_func)(const RAND_METHOD *meth, | ||
| 160 | const RAND_METHOD **pmeth), | ||
| 161 | const RAND_METHOD *(*get_rand_func) | ||
| 162 | (const RAND_METHOD **pmeth)); | ||
| 163 | int eng_RAND_set_rand_method(const RAND_METHOD *meth, | ||
| 164 | const RAND_METHOD **pmeth); | ||
| 165 | const RAND_METHOD *eng_RAND_get_rand_method(const RAND_METHOD **pmeth); | ||
| 166 | #endif | ||
| 167 | |||
| 168 | 157 | ||
| 169 | #endif | 158 | #endif |
diff --git a/src/lib/libcrypto/rand/rand_lib.c b/src/lib/libcrypto/rand/rand_lib.c index da6b4e0e86..513e338985 100644 --- a/src/lib/libcrypto/rand/rand_lib.c +++ b/src/lib/libcrypto/rand/rand_lib.c | |||
| @@ -60,82 +60,15 @@ | |||
| 60 | #include <time.h> | 60 | #include <time.h> |
| 61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 62 | #include <openssl/rand.h> | 62 | #include <openssl/rand.h> |
| 63 | #include "rand_lcl.h" | ||
| 64 | #ifdef OPENSSL_FIPS | ||
| 65 | #include <openssl/fips.h> | ||
| 66 | #include <openssl/fips_rand.h> | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #ifndef OPENSSL_NO_ENGINE | 63 | #ifndef OPENSSL_NO_ENGINE |
| 70 | #include <openssl/engine.h> | 64 | #include <openssl/engine.h> |
| 71 | #endif | 65 | #endif |
| 72 | 66 | ||
| 73 | static const RAND_METHOD *default_RAND_meth = NULL; | ||
| 74 | |||
| 75 | #ifdef OPENSSL_FIPS | ||
| 76 | |||
| 77 | static int fips_RAND_set_rand_method(const RAND_METHOD *meth, | ||
| 78 | const RAND_METHOD **pmeth) | ||
| 79 | { | ||
| 80 | *pmeth = meth; | ||
| 81 | return 1; | ||
| 82 | } | ||
| 83 | |||
| 84 | static const RAND_METHOD *fips_RAND_get_rand_method(const RAND_METHOD **pmeth) | ||
| 85 | { | ||
| 86 | if (!*pmeth) | ||
| 87 | { | ||
| 88 | if(FIPS_mode()) | ||
| 89 | *pmeth=FIPS_rand_method(); | ||
| 90 | else | ||
| 91 | *pmeth = RAND_SSLeay(); | ||
| 92 | } | ||
| 93 | |||
| 94 | if(FIPS_mode() | ||
| 95 | && *pmeth != FIPS_rand_check()) | ||
| 96 | { | ||
| 97 | RANDerr(RAND_F_FIPS_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD); | ||
| 98 | return 0; | ||
| 99 | } | ||
| 100 | |||
| 101 | return *pmeth; | ||
| 102 | } | ||
| 103 | |||
| 104 | static int (*RAND_set_rand_method_func)(const RAND_METHOD *meth, | ||
| 105 | const RAND_METHOD **pmeth) | ||
| 106 | = fips_RAND_set_rand_method; | ||
| 107 | static const RAND_METHOD *(*RAND_get_rand_method_func) | ||
| 108 | (const RAND_METHOD **pmeth) | ||
| 109 | = fips_RAND_get_rand_method; | ||
| 110 | |||
| 111 | #ifndef OPENSSL_NO_ENGINE | ||
| 112 | void int_RAND_set_callbacks( | ||
| 113 | int (*set_rand_func)(const RAND_METHOD *meth, | ||
| 114 | const RAND_METHOD **pmeth), | ||
| 115 | const RAND_METHOD *(*get_rand_func) | ||
| 116 | (const RAND_METHOD **pmeth)) | ||
| 117 | { | ||
| 118 | RAND_set_rand_method_func = set_rand_func; | ||
| 119 | RAND_get_rand_method_func = get_rand_func; | ||
| 120 | } | ||
| 121 | #endif | ||
| 122 | |||
| 123 | int RAND_set_rand_method(const RAND_METHOD *meth) | ||
| 124 | { | ||
| 125 | return RAND_set_rand_method_func(meth, &default_RAND_meth); | ||
| 126 | } | ||
| 127 | |||
| 128 | const RAND_METHOD *RAND_get_rand_method(void) | ||
| 129 | { | ||
| 130 | return RAND_get_rand_method_func(&default_RAND_meth); | ||
| 131 | } | ||
| 132 | |||
| 133 | #else | ||
| 134 | |||
| 135 | #ifndef OPENSSL_NO_ENGINE | 67 | #ifndef OPENSSL_NO_ENGINE |
| 136 | /* non-NULL if default_RAND_meth is ENGINE-provided */ | 68 | /* non-NULL if default_RAND_meth is ENGINE-provided */ |
| 137 | static ENGINE *funct_ref =NULL; | 69 | static ENGINE *funct_ref =NULL; |
| 138 | #endif | 70 | #endif |
| 71 | static const RAND_METHOD *default_RAND_meth = NULL; | ||
| 139 | 72 | ||
| 140 | int RAND_set_rand_method(const RAND_METHOD *meth) | 73 | int RAND_set_rand_method(const RAND_METHOD *meth) |
| 141 | { | 74 | { |
| @@ -196,8 +129,6 @@ int RAND_set_rand_engine(ENGINE *engine) | |||
| 196 | } | 129 | } |
| 197 | #endif | 130 | #endif |
| 198 | 131 | ||
| 199 | #endif | ||
| 200 | |||
| 201 | void RAND_cleanup(void) | 132 | void RAND_cleanup(void) |
| 202 | { | 133 | { |
| 203 | const RAND_METHOD *meth = RAND_get_rand_method(); | 134 | const RAND_METHOD *meth = RAND_get_rand_method(); |
diff --git a/src/lib/libcrypto/rand/rand_os2.c b/src/lib/libcrypto/rand/rand_os2.c index c3e36d4e5e..fc1e78b179 100644 --- a/src/lib/libcrypto/rand/rand_os2.c +++ b/src/lib/libcrypto/rand/rand_os2.c | |||
| @@ -78,8 +78,10 @@ typedef struct _CPUUTIL { | |||
| 78 | ULONG ulIntrHigh; /* High 32 bits of interrupt time */ | 78 | ULONG ulIntrHigh; /* High 32 bits of interrupt time */ |
| 79 | } CPUUTIL; | 79 | } CPUUTIL; |
| 80 | 80 | ||
| 81 | #ifndef __KLIBC__ | ||
| 81 | APIRET APIENTRY(*DosPerfSysCall) (ULONG ulCommand, ULONG ulParm1, ULONG ulParm2, ULONG ulParm3) = NULL; | 82 | APIRET APIENTRY(*DosPerfSysCall) (ULONG ulCommand, ULONG ulParm1, ULONG ulParm2, ULONG ulParm3) = NULL; |
| 82 | APIRET APIENTRY(*DosQuerySysState) (ULONG func, ULONG arg1, ULONG pid, ULONG _res_, PVOID buf, ULONG bufsz) = NULL; | 83 | APIRET APIENTRY(*DosQuerySysState) (ULONG func, ULONG arg1, ULONG pid, ULONG _res_, PVOID buf, ULONG bufsz) = NULL; |
| 84 | #endif | ||
| 83 | HMODULE hDoscalls = 0; | 85 | HMODULE hDoscalls = 0; |
| 84 | 86 | ||
| 85 | int RAND_poll(void) | 87 | int RAND_poll(void) |
| @@ -91,6 +93,7 @@ int RAND_poll(void) | |||
| 91 | if (hDoscalls == 0) { | 93 | if (hDoscalls == 0) { |
| 92 | ULONG rc = DosLoadModule(failed_module, sizeof(failed_module), "DOSCALLS", &hDoscalls); | 94 | ULONG rc = DosLoadModule(failed_module, sizeof(failed_module), "DOSCALLS", &hDoscalls); |
| 93 | 95 | ||
| 96 | #ifndef __KLIBC__ | ||
| 94 | if (rc == 0) { | 97 | if (rc == 0) { |
| 95 | rc = DosQueryProcAddr(hDoscalls, 976, NULL, (PFN *)&DosPerfSysCall); | 98 | rc = DosQueryProcAddr(hDoscalls, 976, NULL, (PFN *)&DosPerfSysCall); |
| 96 | 99 | ||
| @@ -102,6 +105,7 @@ int RAND_poll(void) | |||
| 102 | if (rc) | 105 | if (rc) |
| 103 | DosQuerySysState = NULL; | 106 | DosQuerySysState = NULL; |
| 104 | } | 107 | } |
| 108 | #endif | ||
| 105 | } | 109 | } |
| 106 | 110 | ||
| 107 | /* Sample the hi-res timer, runs at around 1.1 MHz */ | 111 | /* Sample the hi-res timer, runs at around 1.1 MHz */ |
| @@ -122,7 +126,9 @@ int RAND_poll(void) | |||
| 122 | RAND_add(&util, sizeof(util), 10); | 126 | RAND_add(&util, sizeof(util), 10); |
| 123 | } | 127 | } |
| 124 | else { | 128 | else { |
| 129 | #ifndef __KLIBC__ | ||
| 125 | DosPerfSysCall = NULL; | 130 | DosPerfSysCall = NULL; |
| 131 | #endif | ||
| 126 | } | 132 | } |
| 127 | } | 133 | } |
| 128 | 134 | ||
diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c index 58c6173094..4bb9666e49 100644 --- a/src/lib/libcrypto/rand/rand_unix.c +++ b/src/lib/libcrypto/rand/rand_unix.c | |||
| @@ -133,7 +133,50 @@ | |||
| 133 | # define FD_SETSIZE (8*sizeof(fd_set)) | 133 | # define FD_SETSIZE (8*sizeof(fd_set)) |
| 134 | #endif | 134 | #endif |
| 135 | 135 | ||
| 136 | #ifdef __OpenBSD__ | 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__ | ||
| 137 | int RAND_poll(void) | 180 | int RAND_poll(void) |
| 138 | { | 181 | { |
| 139 | unsigned char buf[ENTROPY_NEEDED]; | 182 | unsigned char buf[ENTROPY_NEEDED]; |
| @@ -157,7 +200,7 @@ int RAND_poll(void) | |||
| 157 | static const char *randomfiles[] = { DEVRANDOM }; | 200 | static const char *randomfiles[] = { DEVRANDOM }; |
| 158 | struct stat randomstats[sizeof(randomfiles)/sizeof(randomfiles[0])]; | 201 | struct stat randomstats[sizeof(randomfiles)/sizeof(randomfiles[0])]; |
| 159 | int fd; | 202 | int fd; |
| 160 | size_t i; | 203 | unsigned int i; |
| 161 | #endif | 204 | #endif |
| 162 | #ifdef DEVRANDOM_EGD | 205 | #ifdef DEVRANDOM_EGD |
| 163 | static const char *egdsockets[] = { DEVRANDOM_EGD, NULL }; | 206 | static const char *egdsockets[] = { DEVRANDOM_EGD, NULL }; |
| @@ -170,7 +213,8 @@ int RAND_poll(void) | |||
| 170 | * have this. Use /dev/urandom if you can as /dev/random may block | 213 | * have this. Use /dev/urandom if you can as /dev/random may block |
| 171 | * if it runs out of random entries. */ | 214 | * if it runs out of random entries. */ |
| 172 | 215 | ||
| 173 | for (i=0; i<sizeof(randomfiles)/sizeof(randomfiles[0]) && n < ENTROPY_NEEDED; i++) | 216 | for (i = 0; (i < sizeof(randomfiles)/sizeof(randomfiles[0])) && |
| 217 | (n < ENTROPY_NEEDED); i++) | ||
| 174 | { | 218 | { |
| 175 | if ((fd = open(randomfiles[i], O_RDONLY | 219 | if ((fd = open(randomfiles[i], O_RDONLY |
| 176 | #ifdef O_NONBLOCK | 220 | #ifdef O_NONBLOCK |
| @@ -187,7 +231,7 @@ int RAND_poll(void) | |||
| 187 | { | 231 | { |
| 188 | int usec = 10*1000; /* spend 10ms on each file */ | 232 | int usec = 10*1000; /* spend 10ms on each file */ |
| 189 | int r; | 233 | int r; |
| 190 | size_t j; | 234 | unsigned int j; |
| 191 | struct stat *st=&randomstats[i]; | 235 | struct stat *st=&randomstats[i]; |
| 192 | 236 | ||
| 193 | /* Avoid using same input... Used to be O_NOFOLLOW | 237 | /* Avoid using same input... Used to be O_NOFOLLOW |
| @@ -205,7 +249,12 @@ int RAND_poll(void) | |||
| 205 | { | 249 | { |
| 206 | int try_read = 0; | 250 | int try_read = 0; |
| 207 | 251 | ||
| 208 | #if defined(OPENSSL_SYS_LINUX) | 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) | ||
| 209 | /* use poll() */ | 258 | /* use poll() */ |
| 210 | struct pollfd pset; | 259 | struct pollfd pset; |
| 211 | 260 | ||
| @@ -252,6 +301,10 @@ int RAND_poll(void) | |||
| 252 | r = read(fd,(unsigned char *)tmpbuf+n, ENTROPY_NEEDED-n); | 301 | r = read(fd,(unsigned char *)tmpbuf+n, ENTROPY_NEEDED-n); |
| 253 | if (r > 0) | 302 | if (r > 0) |
| 254 | n += r; | 303 | n += r; |
| 304 | #if defined(OPENSSL_SYS_BEOS_R5) | ||
| 305 | if (r == 0) | ||
| 306 | snooze(t.tv_usec); | ||
| 307 | #endif | ||
| 255 | } | 308 | } |
| 256 | else | 309 | else |
| 257 | r = -1; | 310 | r = -1; |
| @@ -305,6 +358,14 @@ int RAND_poll(void) | |||
| 305 | l=time(NULL); | 358 | l=time(NULL); |
| 306 | RAND_add(&l,sizeof(l),0.0); | 359 | RAND_add(&l,sizeof(l),0.0); |
| 307 | 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 | |||
| 308 | #if defined(DEVRANDOM) || defined(DEVRANDOM_EGD) | 369 | #if defined(DEVRANDOM) || defined(DEVRANDOM_EGD) |
| 309 | return 1; | 370 | return 1; |
| 310 | #else | 371 | #else |
diff --git a/src/lib/libcrypto/rand/rand_win.c b/src/lib/libcrypto/rand/rand_win.c index 00dbe4232c..5d134e186b 100644 --- a/src/lib/libcrypto/rand/rand_win.c +++ b/src/lib/libcrypto/rand/rand_win.c | |||
| @@ -463,7 +463,7 @@ int RAND_poll(void) | |||
| 463 | PROCESSENTRY32 p; | 463 | PROCESSENTRY32 p; |
| 464 | THREADENTRY32 t; | 464 | THREADENTRY32 t; |
| 465 | MODULEENTRY32 m; | 465 | MODULEENTRY32 m; |
| 466 | DWORD stoptime = 0; | 466 | DWORD starttime = 0; |
| 467 | 467 | ||
| 468 | snap = (CREATETOOLHELP32SNAPSHOT) | 468 | snap = (CREATETOOLHELP32SNAPSHOT) |
| 469 | GetProcAddress(kernel, "CreateToolhelp32Snapshot"); | 469 | GetProcAddress(kernel, "CreateToolhelp32Snapshot"); |
| @@ -494,12 +494,29 @@ int RAND_poll(void) | |||
| 494 | * each entry. Consider each field a source of 1 byte | 494 | * each entry. Consider each field a source of 1 byte |
| 495 | * of entropy. | 495 | * of entropy. |
| 496 | */ | 496 | */ |
| 497 | ZeroMemory(&hlist, sizeof(HEAPLIST32)); | ||
| 497 | hlist.dwSize = sizeof(HEAPLIST32); | 498 | hlist.dwSize = sizeof(HEAPLIST32); |
| 498 | if (good) stoptime = GetTickCount() + MAXDELAY; | 499 | if (good) starttime = GetTickCount(); |
| 500 | #ifdef _MSC_VER | ||
| 499 | if (heaplist_first(handle, &hlist)) | 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; | ||
| 500 | do | 514 | do |
| 501 | { | 515 | { |
| 502 | RAND_add(&hlist, hlist.dwSize, 3); | 516 | RAND_add(&hlist, hlist.dwSize, 3); |
| 517 | __try | ||
| 518 | { | ||
| 519 | ZeroMemory(&hentry, sizeof(HEAPENTRY32)); | ||
| 503 | hentry.dwSize = sizeof(HEAPENTRY32); | 520 | hentry.dwSize = sizeof(HEAPENTRY32); |
| 504 | if (heap_first(&hentry, | 521 | if (heap_first(&hentry, |
| 505 | hlist.th32ProcessID, | 522 | hlist.th32ProcessID, |
| @@ -510,10 +527,42 @@ int RAND_poll(void) | |||
| 510 | RAND_add(&hentry, | 527 | RAND_add(&hentry, |
| 511 | hentry.dwSize, 5); | 528 | hentry.dwSize, 5); |
| 512 | while (heap_next(&hentry) | 529 | while (heap_next(&hentry) |
| 530 | && (!good || (GetTickCount()-starttime)<MAXDELAY) | ||
| 513 | && --entrycnt > 0); | 531 | && --entrycnt > 0); |
| 514 | } | 532 | } |
| 515 | } while (heaplist_next(handle, | 533 | } |
| 516 | &hlist) && GetTickCount() < stoptime); | 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 | ||
| 517 | 566 | ||
| 518 | /* process walking */ | 567 | /* process walking */ |
| 519 | /* PROCESSENTRY32 contains 9 fields that will change | 568 | /* PROCESSENTRY32 contains 9 fields that will change |
| @@ -522,11 +571,11 @@ int RAND_poll(void) | |||
| 522 | */ | 571 | */ |
| 523 | p.dwSize = sizeof(PROCESSENTRY32); | 572 | p.dwSize = sizeof(PROCESSENTRY32); |
| 524 | 573 | ||
| 525 | if (good) stoptime = GetTickCount() + MAXDELAY; | 574 | if (good) starttime = GetTickCount(); |
| 526 | if (process_first(handle, &p)) | 575 | if (process_first(handle, &p)) |
| 527 | do | 576 | do |
| 528 | RAND_add(&p, p.dwSize, 9); | 577 | RAND_add(&p, p.dwSize, 9); |
| 529 | while (process_next(handle, &p) && GetTickCount() < stoptime); | 578 | while (process_next(handle, &p) && (!good || (GetTickCount()-starttime)<MAXDELAY)); |
| 530 | 579 | ||
| 531 | /* thread walking */ | 580 | /* thread walking */ |
| 532 | /* THREADENTRY32 contains 6 fields that will change | 581 | /* THREADENTRY32 contains 6 fields that will change |
| @@ -534,11 +583,11 @@ int RAND_poll(void) | |||
| 534 | * 1 byte of entropy. | 583 | * 1 byte of entropy. |
| 535 | */ | 584 | */ |
| 536 | t.dwSize = sizeof(THREADENTRY32); | 585 | t.dwSize = sizeof(THREADENTRY32); |
| 537 | if (good) stoptime = GetTickCount() + MAXDELAY; | 586 | if (good) starttime = GetTickCount(); |
| 538 | if (thread_first(handle, &t)) | 587 | if (thread_first(handle, &t)) |
| 539 | do | 588 | do |
| 540 | RAND_add(&t, t.dwSize, 6); | 589 | RAND_add(&t, t.dwSize, 6); |
| 541 | while (thread_next(handle, &t) && GetTickCount() < stoptime); | 590 | while (thread_next(handle, &t) && (!good || (GetTickCount()-starttime)<MAXDELAY)); |
| 542 | 591 | ||
| 543 | /* module walking */ | 592 | /* module walking */ |
| 544 | /* MODULEENTRY32 contains 9 fields that will change | 593 | /* MODULEENTRY32 contains 9 fields that will change |
| @@ -546,12 +595,12 @@ int RAND_poll(void) | |||
| 546 | * 1 byte of entropy. | 595 | * 1 byte of entropy. |
| 547 | */ | 596 | */ |
| 548 | m.dwSize = sizeof(MODULEENTRY32); | 597 | m.dwSize = sizeof(MODULEENTRY32); |
| 549 | if (good) stoptime = GetTickCount() + MAXDELAY; | 598 | if (good) starttime = GetTickCount(); |
| 550 | if (module_first(handle, &m)) | 599 | if (module_first(handle, &m)) |
| 551 | do | 600 | do |
| 552 | RAND_add(&m, m.dwSize, 9); | 601 | RAND_add(&m, m.dwSize, 9); |
| 553 | while (module_next(handle, &m) | 602 | while (module_next(handle, &m) |
| 554 | && (GetTickCount() < stoptime)); | 603 | && (!good || (GetTickCount()-starttime)<MAXDELAY)); |
| 555 | if (close_snap) | 604 | if (close_snap) |
| 556 | close_snap(handle); | 605 | close_snap(handle); |
| 557 | else | 606 | else |
| @@ -701,7 +750,7 @@ static void readscreen(void) | |||
| 701 | int y; /* y-coordinate of screen lines to grab */ | 750 | int y; /* y-coordinate of screen lines to grab */ |
| 702 | int n = 16; /* number of screen lines to grab at a time */ | 751 | int n = 16; /* number of screen lines to grab at a time */ |
| 703 | 752 | ||
| 704 | if (GetVersion() >= 0x80000000 || !OPENSSL_isservice()) | 753 | if (GetVersion() < 0x80000000 && OPENSSL_isservice()>0) |
| 705 | return; | 754 | return; |
| 706 | 755 | ||
| 707 | /* Create a screen DC and a memory DC compatible to screen DC */ | 756 | /* Create a screen DC and a memory DC compatible to screen DC */ |
diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c index d108353bbc..4ed40b7b70 100644 --- a/src/lib/libcrypto/rand/randfile.c +++ b/src/lib/libcrypto/rand/randfile.c | |||
| @@ -75,9 +75,7 @@ | |||
| 75 | #ifndef NO_SYS_TYPES_H | 75 | #ifndef NO_SYS_TYPES_H |
| 76 | # include <sys/types.h> | 76 | # include <sys/types.h> |
| 77 | #endif | 77 | #endif |
| 78 | #ifdef MAC_OS_pre_X | 78 | #ifndef OPENSSL_NO_POSIX_IO |
| 79 | # include <stat.h> | ||
| 80 | #else | ||
| 81 | # include <sys/stat.h> | 79 | # include <sys/stat.h> |
| 82 | #endif | 80 | #endif |
| 83 | 81 | ||
| @@ -111,14 +109,26 @@ int RAND_load_file(const char *file, long bytes) | |||
| 111 | * if bytes == -1, read complete file. */ | 109 | * if bytes == -1, read complete file. */ |
| 112 | 110 | ||
| 113 | MS_STATIC unsigned char buf[BUFSIZE]; | 111 | MS_STATIC unsigned char buf[BUFSIZE]; |
| 112 | #ifndef OPENSSL_NO_POSIX_IO | ||
| 114 | struct stat sb; | 113 | struct stat sb; |
| 114 | #endif | ||
| 115 | int i,ret=0,n; | 115 | int i,ret=0,n; |
| 116 | FILE *in; | 116 | FILE *in; |
| 117 | 117 | ||
| 118 | if (file == NULL) return(0); | 118 | if (file == NULL) return(0); |
| 119 | 119 | ||
| 120 | #ifndef OPENSSL_NO_POSIX_IO | ||
| 121 | #ifdef PURIFY | ||
| 122 | /* struct stat can have padding and unused fields that may not be | ||
| 123 | * initialized in the call to stat(). We need to clear the entire | ||
| 124 | * structure before calling RAND_add() to avoid complaints from | ||
| 125 | * applications such as Valgrind. | ||
| 126 | */ | ||
| 127 | memset(&sb, 0, sizeof(sb)); | ||
| 128 | #endif | ||
| 120 | if (stat(file,&sb) < 0) return(0); | 129 | if (stat(file,&sb) < 0) return(0); |
| 121 | RAND_add(&sb,sizeof(sb),0.0); | 130 | RAND_add(&sb,sizeof(sb),0.0); |
| 131 | #endif | ||
| 122 | if (bytes == 0) return(ret); | 132 | if (bytes == 0) return(ret); |
| 123 | 133 | ||
| 124 | #ifdef OPENSSL_SYS_VMS | 134 | #ifdef OPENSSL_SYS_VMS |
| @@ -127,7 +137,7 @@ int RAND_load_file(const char *file, long bytes) | |||
| 127 | in=fopen(file,"rb"); | 137 | in=fopen(file,"rb"); |
| 128 | #endif | 138 | #endif |
| 129 | if (in == NULL) goto err; | 139 | if (in == NULL) goto err; |
| 130 | #if defined(S_IFBLK) && defined(S_IFCHR) | 140 | #if defined(S_IFBLK) && defined(S_IFCHR) && !defined(OPNESSL_NO_POSIX_IO) |
| 131 | if (sb.st_mode & (S_IFBLK | S_IFCHR)) { | 141 | if (sb.st_mode & (S_IFBLK | S_IFCHR)) { |
| 132 | /* this file is a device. we don't want read an infinite number | 142 | /* this file is a device. we don't want read an infinite number |
| 133 | * of bytes from a random device, nor do we want to use buffered | 143 | * of bytes from a random device, nor do we want to use buffered |
| @@ -170,12 +180,13 @@ int RAND_write_file(const char *file) | |||
| 170 | int i,ret=0,rand_err=0; | 180 | int i,ret=0,rand_err=0; |
| 171 | FILE *out = NULL; | 181 | FILE *out = NULL; |
| 172 | int n; | 182 | int n; |
| 183 | #ifndef OPENSSL_NO_POSIX_IO | ||
| 173 | struct stat sb; | 184 | struct stat sb; |
| 174 | 185 | ||
| 175 | i=stat(file,&sb); | 186 | i=stat(file,&sb); |
| 176 | if (i != -1) { | 187 | if (i != -1) { |
| 177 | #if defined(S_IFBLK) && defined(S_IFCHR) | 188 | #if defined(S_ISBLK) && defined(S_ISCHR) |
| 178 | if (sb.st_mode & (S_IFBLK | S_IFCHR)) { | 189 | if (S_ISBLK(sb.st_mode) || S_ISCHR(sb.st_mode)) { |
| 179 | /* this file is a device. we don't write back to it. | 190 | /* this file is a device. we don't write back to it. |
| 180 | * we "succeed" on the assumption this is some sort | 191 | * we "succeed" on the assumption this is some sort |
| 181 | * of random device. Otherwise attempting to write to | 192 | * of random device. Otherwise attempting to write to |
| @@ -185,14 +196,16 @@ int RAND_write_file(const char *file) | |||
| 185 | } | 196 | } |
| 186 | #endif | 197 | #endif |
| 187 | } | 198 | } |
| 199 | #endif | ||
| 188 | 200 | ||
| 189 | #if defined(O_CREAT) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_VMS) | 201 | #if defined(O_CREAT) && !defined(OPENSSL_NO_POSIX_IO) && !defined(OPENSSL_SYS_VMS) |
| 190 | { | 202 | { |
| 191 | /* For some reason Win32 can't write to files created this way */ | 203 | #ifndef O_BINARY |
| 192 | 204 | #define O_BINARY 0 | |
| 205 | #endif | ||
| 193 | /* chmod(..., 0600) is too late to protect the file, | 206 | /* chmod(..., 0600) is too late to protect the file, |
| 194 | * permissions should be restrictive from the start */ | 207 | * permissions should be restrictive from the start */ |
| 195 | int fd = open(file, O_CREAT, 0600); | 208 | int fd = open(file, O_WRONLY|O_CREAT|O_BINARY, 0600); |
| 196 | if (fd != -1) | 209 | if (fd != -1) |
| 197 | out = fdopen(fd, "wb"); | 210 | out = fdopen(fd, "wb"); |
| 198 | } | 211 | } |
diff --git a/src/lib/libcrypto/rc2/Makefile.ssl b/src/lib/libcrypto/rc2/Makefile.ssl deleted file mode 100644 index 98d5960d5d..0000000000 --- a/src/lib/libcrypto/rc2/Makefile.ssl +++ /dev/null | |||
| @@ -1,91 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/rc2/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= rc2 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST=rc2test.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c | ||
| 27 | LIBOBJ=rc2_ecb.o rc2_skey.o rc2_cbc.o rc2cfb64.o rc2ofb64.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= rc2.h | ||
| 32 | HEADER= rc2_locl.h $(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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | rc2_cbc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 83 | rc2_cbc.o: rc2_cbc.c rc2_locl.h | ||
| 84 | rc2_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 85 | rc2_ecb.o: ../../include/openssl/rc2.h rc2_ecb.c rc2_locl.h | ||
| 86 | rc2_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 87 | rc2_skey.o: rc2_locl.h rc2_skey.c | ||
| 88 | rc2cfb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 89 | rc2cfb64.o: rc2_locl.h rc2cfb64.c | ||
| 90 | rc2ofb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 91 | rc2ofb64.o: rc2_locl.h rc2ofb64.c | ||
diff --git a/src/lib/libcrypto/rc2/rc2.h b/src/lib/libcrypto/rc2/rc2.h index e542ec94ff..34c8362317 100644 --- a/src/lib/libcrypto/rc2/rc2.h +++ b/src/lib/libcrypto/rc2/rc2.h | |||
| @@ -79,9 +79,7 @@ typedef struct rc2_key_st | |||
| 79 | RC2_INT data[64]; | 79 | RC2_INT data[64]; |
| 80 | } RC2_KEY; | 80 | } RC2_KEY; |
| 81 | 81 | ||
| 82 | #ifdef OPENSSL_FIPS | 82 | |
| 83 | void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); | ||
| 84 | #endif | ||
| 85 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); | 83 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); |
| 86 | void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, | 84 | void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, |
| 87 | int enc); | 85 | int enc); |
diff --git a/src/lib/libcrypto/rc2/rc2_skey.c b/src/lib/libcrypto/rc2/rc2_skey.c index 4e000e5b99..0150b0e035 100644 --- a/src/lib/libcrypto/rc2/rc2_skey.c +++ b/src/lib/libcrypto/rc2/rc2_skey.c | |||
| @@ -57,14 +57,9 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <openssl/rc2.h> | 59 | #include <openssl/rc2.h> |
| 60 | #include <openssl/crypto.h> | ||
| 61 | #ifdef OPENSSL_FIPS | ||
| 62 | #include <openssl/fips.h> | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #include "rc2_locl.h" | 60 | #include "rc2_locl.h" |
| 66 | 61 | ||
| 67 | static unsigned char key_table[256]={ | 62 | static const unsigned char key_table[256]={ |
| 68 | 0xd9,0x78,0xf9,0xc4,0x19,0xdd,0xb5,0xed,0x28,0xe9,0xfd,0x79, | 63 | 0xd9,0x78,0xf9,0xc4,0x19,0xdd,0xb5,0xed,0x28,0xe9,0xfd,0x79, |
| 69 | 0x4a,0xa0,0xd8,0x9d,0xc6,0x7e,0x37,0x83,0x2b,0x76,0x53,0x8e, | 64 | 0x4a,0xa0,0xd8,0x9d,0xc6,0x7e,0x37,0x83,0x2b,0x76,0x53,0x8e, |
| 70 | 0x62,0x4c,0x64,0x88,0x44,0x8b,0xfb,0xa2,0x17,0x9a,0x59,0xf5, | 65 | 0x62,0x4c,0x64,0x88,0x44,0x8b,0xfb,0xa2,0x17,0x9a,0x59,0xf5, |
| @@ -99,20 +94,8 @@ static unsigned char key_table[256]={ | |||
| 99 | * BSAFE uses the 'retarded' version. What I previously shipped is | 94 | * BSAFE uses the 'retarded' version. What I previously shipped is |
| 100 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses | 95 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses |
| 101 | * a version where the bits parameter is the same as len*8 */ | 96 | * a version where the bits parameter is the same as len*8 */ |
| 102 | |||
| 103 | #ifdef OPENSSL_FIPS | ||
| 104 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) | 97 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) |
| 105 | { | 98 | { |
| 106 | if (FIPS_mode()) | ||
| 107 | FIPS_BAD_ABORT(RC2) | ||
| 108 | private_RC2_set_key(key, len, data, bits); | ||
| 109 | } | ||
| 110 | void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, | ||
| 111 | int bits) | ||
| 112 | #else | ||
| 113 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) | ||
| 114 | #endif | ||
| 115 | { | ||
| 116 | int i,j; | 99 | int i,j; |
| 117 | unsigned char *k; | 100 | unsigned char *k; |
| 118 | RC2_INT *ki; | 101 | RC2_INT *ki; |
diff --git a/src/lib/libcrypto/rc4/Makefile.ssl b/src/lib/libcrypto/rc4/Makefile.ssl deleted file mode 100644 index 3e602662be..0000000000 --- a/src/lib/libcrypto/rc4/Makefile.ssl +++ /dev/null | |||
| @@ -1,110 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/rc4/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= rc4 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | RC4_ENC=rc4_enc.o | ||
| 21 | # or use | ||
| 22 | #RC4_ENC=asm/rx86-elf.o | ||
| 23 | #RC4_ENC=asm/rx86-out.o | ||
| 24 | #RC4_ENC=asm/rx86-sol.o | ||
| 25 | #RC4_ENC=asm/rx86bdsi.o | ||
| 26 | |||
| 27 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 28 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 29 | |||
| 30 | GENERAL=Makefile | ||
| 31 | TEST=rc4test.c | ||
| 32 | APPS= | ||
| 33 | |||
| 34 | LIB=$(TOP)/libcrypto.a | ||
| 35 | LIBSRC=rc4_skey.c rc4_enc.c | ||
| 36 | LIBOBJ=rc4_skey.o $(RC4_ENC) | ||
| 37 | |||
| 38 | SRC= $(LIBSRC) | ||
| 39 | |||
| 40 | EXHEADER= rc4.h | ||
| 41 | HEADER= $(EXHEADER) rc4_locl.h | ||
| 42 | |||
| 43 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 44 | |||
| 45 | top: | ||
| 46 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 47 | |||
| 48 | all: lib | ||
| 49 | |||
| 50 | lib: $(LIBOBJ) | ||
| 51 | $(AR) $(LIB) $(LIBOBJ) | ||
| 52 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 53 | @touch lib | ||
| 54 | |||
| 55 | # elf | ||
| 56 | asm/rx86-elf.s: asm/rc4-586.pl ../perlasm/x86asm.pl | ||
| 57 | (cd asm; $(PERL) rc4-586.pl elf $(CFLAGS) > rx86-elf.s) | ||
| 58 | |||
| 59 | # a.out | ||
| 60 | asm/rx86-out.o: asm/rx86unix.cpp | ||
| 61 | $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o | ||
| 62 | |||
| 63 | # bsdi | ||
| 64 | asm/rx86bsdi.o: asm/rx86unix.cpp | ||
| 65 | $(CPP) -DBSDI asm/rx86unix.cpp | sed 's/ :/:/' | as -o asm/rx86bsdi.o | ||
| 66 | |||
| 67 | asm/rx86unix.cpp: asm/rc4-586.pl ../perlasm/x86asm.pl | ||
| 68 | (cd asm; $(PERL) rc4-586.pl cpp >rx86unix.cpp) | ||
| 69 | |||
| 70 | files: | ||
| 71 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 72 | |||
| 73 | links: | ||
| 74 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 75 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 76 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 77 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 78 | |||
| 79 | install: | ||
| 80 | @for i in $(EXHEADER) ; \ | ||
| 81 | do \ | ||
| 82 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 83 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 84 | done; | ||
| 85 | |||
| 86 | tags: | ||
| 87 | ctags $(SRC) | ||
| 88 | |||
| 89 | tests: | ||
| 90 | |||
| 91 | lint: | ||
| 92 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 93 | |||
| 94 | depend: | ||
| 95 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 96 | |||
| 97 | dclean: | ||
| 98 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 99 | mv -f Makefile.new $(MAKEFILE) | ||
| 100 | |||
| 101 | clean: | ||
| 102 | rm -f asm/rx86unix.cpp asm/*-elf.* *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o | ||
| 103 | |||
| 104 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 105 | |||
| 106 | rc4_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc4.h | ||
| 107 | rc4_enc.o: rc4_enc.c rc4_locl.h | ||
| 108 | rc4_skey.o: ../../include/openssl/opensslconf.h | ||
| 109 | rc4_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc4.h | ||
| 110 | rc4_skey.o: rc4_locl.h rc4_skey.c | ||
diff --git a/src/lib/libcrypto/rc4/asm/rc4-586.pl b/src/lib/libcrypto/rc4/asm/rc4-586.pl index ef7eee766c..38a44a70ef 100644 --- a/src/lib/libcrypto/rc4/asm/rc4-586.pl +++ b/src/lib/libcrypto/rc4/asm/rc4-586.pl | |||
| @@ -1,14 +1,21 @@ | |||
| 1 | #!/usr/local/bin/perl | 1 | #!/usr/bin/env perl |
| 2 | |||
| 3 | # ==================================================================== | ||
| 4 | # [Re]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 | # ==================================================================== | ||
| 2 | 9 | ||
| 3 | # At some point it became apparent that the original SSLeay RC4 | 10 | # At some point it became apparent that the original SSLeay RC4 |
| 4 | # assembler implementation performs suboptimaly on latest IA-32 | 11 | # assembler implementation performs suboptimally on latest IA-32 |
| 5 | # microarchitectures. After re-tuning performance has changed as | 12 | # microarchitectures. After re-tuning performance has changed as |
| 6 | # following: | 13 | # following: |
| 7 | # | 14 | # |
| 8 | # Pentium +0% | 15 | # Pentium -10% |
| 9 | # Pentium III +17% | 16 | # Pentium III +12% |
| 10 | # AMD +52%(*) | 17 | # AMD +50%(*) |
| 11 | # P4 +180%(**) | 18 | # P4 +250%(**) |
| 12 | # | 19 | # |
| 13 | # (*) This number is actually a trade-off:-) It's possible to | 20 | # (*) This number is actually a trade-off:-) It's possible to |
| 14 | # achieve +72%, but at the cost of -48% off PIII performance. | 21 | # achieve +72%, but at the cost of -48% off PIII performance. |
| @@ -17,214 +24,247 @@ | |||
| 17 | # For reference! This code delivers ~80% of rc4-amd64.pl | 24 | # For reference! This code delivers ~80% of rc4-amd64.pl |
| 18 | # performance on the same Opteron machine. | 25 | # performance on the same Opteron machine. |
| 19 | # (**) This number requires compressed key schedule set up by | 26 | # (**) This number requires compressed key schedule set up by |
| 20 | # RC4_set_key and therefore doesn't apply to 0.9.7 [option for | 27 | # RC4_set_key [see commentary below for further details]. |
| 21 | # compressed key schedule is implemented in 0.9.8 and later, | ||
| 22 | # see commentary section in rc4_skey.c for further details]. | ||
| 23 | # | 28 | # |
| 24 | # <appro@fy.chalmers.se> | 29 | # <appro@fy.chalmers.se> |
| 25 | 30 | ||
| 26 | push(@INC,"perlasm","../../perlasm"); | 31 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 32 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 27 | require "x86asm.pl"; | 33 | require "x86asm.pl"; |
| 28 | 34 | ||
| 29 | &asm_init($ARGV[0],"rc4-586.pl"); | 35 | &asm_init($ARGV[0],"rc4-586.pl"); |
| 30 | 36 | ||
| 31 | $x="eax"; | 37 | $xx="eax"; |
| 32 | $y="ebx"; | 38 | $yy="ebx"; |
| 33 | $tx="ecx"; | 39 | $tx="ecx"; |
| 34 | $ty="edx"; | 40 | $ty="edx"; |
| 35 | $in="esi"; | 41 | $inp="esi"; |
| 36 | $out="edi"; | 42 | $out="ebp"; |
| 37 | $d="ebp"; | 43 | $dat="edi"; |
| 38 | 44 | ||
| 39 | &RC4("RC4"); | 45 | sub RC4_loop { |
| 40 | 46 | my $i=shift; | |
| 41 | &asm_finish(); | 47 | my $func = ($i==0)?*mov:*or; |
| 42 | 48 | ||
| 43 | sub RC4_loop | 49 | &add (&LB($yy),&LB($tx)); |
| 44 | { | 50 | &mov ($ty,&DWP(0,$dat,$yy,4)); |
| 45 | local($n,$p,$char)=@_; | 51 | &mov (&DWP(0,$dat,$yy,4),$tx); |
| 46 | 52 | &mov (&DWP(0,$dat,$xx,4),$ty); | |
| 47 | &comment("Round $n"); | 53 | &add ($ty,$tx); |
| 48 | 54 | &inc (&LB($xx)); | |
| 49 | if ($char) | 55 | &and ($ty,0xff); |
| 50 | { | 56 | &ror ($out,8) if ($i!=0); |
| 51 | if ($p >= 0) | 57 | if ($i<3) { |
| 52 | { | 58 | &mov ($tx,&DWP(0,$dat,$xx,4)); |
| 53 | &mov($ty, &swtmp(2)); | 59 | } else { |
| 54 | &cmp($ty, $in); | 60 | &mov ($tx,&wparam(3)); # reload [re-biased] out |
| 55 | &jbe(&label("finished")); | ||
| 56 | &inc($in); | ||
| 57 | } | ||
| 58 | else | ||
| 59 | { | ||
| 60 | &add($ty, 8); | ||
| 61 | &inc($in); | ||
| 62 | &cmp($ty, $in); | ||
| 63 | &jb(&label("finished")); | ||
| 64 | &mov(&swtmp(2), $ty); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | # Moved out | ||
| 68 | # &mov( $tx, &DWP(0,$d,$x,4)) if $p < 0; | ||
| 69 | |||
| 70 | &add( &LB($y), &LB($tx)); | ||
| 71 | &mov( $ty, &DWP(0,$d,$y,4)); | ||
| 72 | # XXX | ||
| 73 | &mov( &DWP(0,$d,$x,4),$ty); | ||
| 74 | &add( $ty, $tx); | ||
| 75 | &mov( &DWP(0,$d,$y,4),$tx); | ||
| 76 | &and( $ty, 0xff); | ||
| 77 | &inc( &LB($x)); # NEXT ROUND | ||
| 78 | &mov( $tx, &DWP(0,$d,$x,4)) if $p < 1; # NEXT ROUND | ||
| 79 | &mov( $ty, &DWP(0,$d,$ty,4)); | ||
| 80 | |||
| 81 | if (!$char) | ||
| 82 | { | ||
| 83 | #moved up into last round | ||
| 84 | if ($p >= 1) | ||
| 85 | { | ||
| 86 | &add( $out, 8) | ||
| 87 | } | ||
| 88 | &movb( &BP($n,"esp","",0), &LB($ty)); | ||
| 89 | } | ||
| 90 | else | ||
| 91 | { | ||
| 92 | # Note in+=8 has occured | ||
| 93 | &movb( &HB($ty), &BP(-1,$in,"",0)); | ||
| 94 | # XXX | ||
| 95 | &xorb(&LB($ty), &HB($ty)); | ||
| 96 | # XXX | ||
| 97 | &movb(&BP($n,$out,"",0),&LB($ty)); | ||
| 98 | } | ||
| 99 | } | 61 | } |
| 100 | 62 | &$func ($out,&DWP(0,$dat,$ty,4)); | |
| 101 | 63 | } | |
| 102 | sub RC4 | 64 | |
| 103 | { | 65 | # void RC4(RC4_KEY *key,size_t len,const unsigned char *inp,unsigned char *out); |
| 104 | local($name)=@_; | 66 | &function_begin("RC4"); |
| 105 | 67 | &mov ($dat,&wparam(0)); # load key schedule pointer | |
| 106 | &function_begin_B($name,""); | 68 | &mov ($ty, &wparam(1)); # load len |
| 107 | 69 | &mov ($inp,&wparam(2)); # load inp | |
| 108 | &mov($ty,&wparam(1)); # len | 70 | &mov ($out,&wparam(3)); # load out |
| 109 | &cmp($ty,0); | 71 | |
| 110 | &jne(&label("proceed")); | 72 | &xor ($xx,$xx); # avoid partial register stalls |
| 111 | &ret(); | 73 | &xor ($yy,$yy); |
| 112 | &set_label("proceed"); | 74 | |
| 113 | 75 | &cmp ($ty,0); # safety net | |
| 114 | &comment(""); | 76 | &je (&label("abort")); |
| 115 | 77 | ||
| 116 | &push("ebp"); | 78 | &mov (&LB($xx),&BP(0,$dat)); # load key->x |
| 117 | &push("ebx"); | 79 | &mov (&LB($yy),&BP(4,$dat)); # load key->y |
| 118 | &push("esi"); | 80 | &add ($dat,8); |
| 119 | &xor( $x, $x); # avoid partial register stalls | 81 | |
| 120 | &push("edi"); | 82 | &lea ($tx,&DWP(0,$inp,$ty)); |
| 121 | &xor( $y, $y); # avoid partial register stalls | 83 | &sub ($out,$inp); # re-bias out |
| 122 | &mov( $d, &wparam(0)); # key | 84 | &mov (&wparam(1),$tx); # save input+len |
| 123 | &mov( $in, &wparam(2)); | 85 | |
| 124 | 86 | &inc (&LB($xx)); | |
| 125 | &movb( &LB($x), &BP(0,$d,"",1)); | 87 | |
| 126 | &movb( &LB($y), &BP(4,$d,"",1)); | 88 | # detect compressed key schedule... |
| 127 | 89 | &cmp (&DWP(256,$dat),-1); | |
| 128 | &mov( $out, &wparam(3)); | 90 | &je (&label("RC4_CHAR")); |
| 129 | &inc( &LB($x)); | 91 | |
| 130 | 92 | &mov ($tx,&DWP(0,$dat,$xx,4)); | |
| 131 | &stack_push(3); # 3 temp variables | 93 | |
| 132 | &add( $d, 8); | 94 | &and ($ty,-4); # how many 4-byte chunks? |
| 133 | 95 | &jz (&label("loop1")); | |
| 134 | # detect compressed schedule, see commentary section in rc4_skey.c... | 96 | |
| 135 | # in 0.9.7 context ~50 bytes below RC4_CHAR label remain redundant, | 97 | &lea ($ty,&DWP(-4,$inp,$ty)); |
| 136 | # as compressed key schedule is set up in 0.9.8 and later. | 98 | &mov (&wparam(2),$ty); # save input+(len/4)*4-4 |
| 137 | &cmp(&DWP(256,$d),-1); | 99 | &mov (&wparam(3),$out); # $out as accumulator in this loop |
| 138 | &je(&label("RC4_CHAR")); | 100 | |
| 139 | 101 | &set_label("loop4",16); | |
| 140 | &lea( $ty, &DWP(-8,$ty,$in)); | 102 | for ($i=0;$i<4;$i++) { RC4_loop($i); } |
| 141 | 103 | &ror ($out,8); | |
| 142 | # check for 0 length input | 104 | &xor ($out,&DWP(0,$inp)); |
| 143 | 105 | &cmp ($inp,&wparam(2)); # compare to input+(len/4)*4-4 | |
| 144 | &mov( &swtmp(2), $ty); # this is now address to exit at | 106 | &mov (&DWP(0,$tx,$inp),$out);# $tx holds re-biased out here |
| 145 | &mov( $tx, &DWP(0,$d,$x,4)); | 107 | &lea ($inp,&DWP(4,$inp)); |
| 146 | 108 | &mov ($tx,&DWP(0,$dat,$xx,4)); | |
| 147 | &cmp( $ty, $in); | 109 | &jb (&label("loop4")); |
| 148 | &jb( &label("end")); # less than 8 bytes | 110 | |
| 149 | 111 | &cmp ($inp,&wparam(1)); # compare to input+len | |
| 150 | &set_label("start"); | 112 | &je (&label("done")); |
| 151 | 113 | &mov ($out,&wparam(3)); # restore $out | |
| 152 | # filling DELAY SLOT | 114 | |
| 153 | &add( $in, 8); | 115 | &set_label("loop1",16); |
| 154 | 116 | &add (&LB($yy),&LB($tx)); | |
| 155 | &RC4_loop(0,-1,0); | 117 | &mov ($ty,&DWP(0,$dat,$yy,4)); |
| 156 | &RC4_loop(1,0,0); | 118 | &mov (&DWP(0,$dat,$yy,4),$tx); |
| 157 | &RC4_loop(2,0,0); | 119 | &mov (&DWP(0,$dat,$xx,4),$ty); |
| 158 | &RC4_loop(3,0,0); | 120 | &add ($ty,$tx); |
| 159 | &RC4_loop(4,0,0); | 121 | &inc (&LB($xx)); |
| 160 | &RC4_loop(5,0,0); | 122 | &and ($ty,0xff); |
| 161 | &RC4_loop(6,0,0); | 123 | &mov ($ty,&DWP(0,$dat,$ty,4)); |
| 162 | &RC4_loop(7,1,0); | 124 | &xor (&LB($ty),&BP(0,$inp)); |
| 163 | 125 | &lea ($inp,&DWP(1,$inp)); | |
| 164 | &comment("apply the cipher text"); | 126 | &mov ($tx,&DWP(0,$dat,$xx,4)); |
| 165 | # xor the cipher data with input | 127 | &cmp ($inp,&wparam(1)); # compare to input+len |
| 166 | 128 | &mov (&BP(-1,$out,$inp),&LB($ty)); | |
| 167 | #&add( $out, 8); #moved up into last round | 129 | &jb (&label("loop1")); |
| 168 | 130 | ||
| 169 | &mov( $tx, &swtmp(0)); | 131 | &jmp (&label("done")); |
| 170 | &mov( $ty, &DWP(-8,$in,"",0)); | 132 | |
| 171 | &xor( $tx, $ty); | 133 | # this is essentially Intel P4 specific codepath... |
| 172 | &mov( $ty, &DWP(-4,$in,"",0)); | 134 | &set_label("RC4_CHAR",16); |
| 173 | &mov( &DWP(-8,$out,"",0), $tx); | 135 | &movz ($tx,&BP(0,$dat,$xx)); |
| 174 | &mov( $tx, &swtmp(1)); | ||
| 175 | &xor( $tx, $ty); | ||
| 176 | &mov( $ty, &swtmp(2)); # load end ptr; | ||
| 177 | &mov( &DWP(-4,$out,"",0), $tx); | ||
| 178 | &mov( $tx, &DWP(0,$d,$x,4)); | ||
| 179 | &cmp($in, $ty); | ||
| 180 | &jbe(&label("start")); | ||
| 181 | |||
| 182 | &set_label("end"); | ||
| 183 | |||
| 184 | # There is quite a bit of extra crap in RC4_loop() for this | ||
| 185 | # first round | ||
| 186 | &RC4_loop(0,-1,1); | ||
| 187 | &RC4_loop(1,0,1); | ||
| 188 | &RC4_loop(2,0,1); | ||
| 189 | &RC4_loop(3,0,1); | ||
| 190 | &RC4_loop(4,0,1); | ||
| 191 | &RC4_loop(5,0,1); | ||
| 192 | &RC4_loop(6,1,1); | ||
| 193 | |||
| 194 | &jmp(&label("finished")); | ||
| 195 | |||
| 196 | &align(16); | ||
| 197 | # this is essentially Intel P4 specific codepath, see rc4_skey.c, | ||
| 198 | # and is engaged in 0.9.8 and later context... | ||
| 199 | &set_label("RC4_CHAR"); | ||
| 200 | |||
| 201 | &lea ($ty,&DWP(0,$in,$ty)); | ||
| 202 | &mov (&swtmp(2),$ty); | ||
| 203 | &movz ($tx,&BP(0,$d,$x)); | ||
| 204 | |||
| 205 | # strangely enough unrolled loop performs over 20% slower... | 136 | # strangely enough unrolled loop performs over 20% slower... |
| 206 | &set_label("RC4_CHAR_loop"); | 137 | &set_label("cloop1"); |
| 207 | &add (&LB($y),&LB($tx)); | 138 | &add (&LB($yy),&LB($tx)); |
| 208 | &movz ($ty,&BP(0,$d,$y)); | 139 | &movz ($ty,&BP(0,$dat,$yy)); |
| 209 | &movb (&BP(0,$d,$y),&LB($tx)); | 140 | &mov (&BP(0,$dat,$yy),&LB($tx)); |
| 210 | &movb (&BP(0,$d,$x),&LB($ty)); | 141 | &mov (&BP(0,$dat,$xx),&LB($ty)); |
| 211 | &add (&LB($ty),&LB($tx)); | 142 | &add (&LB($ty),&LB($tx)); |
| 212 | &movz ($ty,&BP(0,$d,$ty)); | 143 | &movz ($ty,&BP(0,$dat,$ty)); |
| 213 | &add (&LB($x),1); | 144 | &add (&LB($xx),1); |
| 214 | &xorb (&LB($ty),&BP(0,$in)); | 145 | &xor (&LB($ty),&BP(0,$inp)); |
| 215 | &lea ($in,&DWP(1,$in)); | 146 | &lea ($inp,&DWP(1,$inp)); |
| 216 | &movz ($tx,&BP(0,$d,$x)); | 147 | &movz ($tx,&BP(0,$dat,$xx)); |
| 217 | &cmp ($in,&swtmp(2)); | 148 | &cmp ($inp,&wparam(1)); |
| 218 | &movb (&BP(0,$out),&LB($ty)); | 149 | &mov (&BP(-1,$out,$inp),&LB($ty)); |
| 219 | &lea ($out,&DWP(1,$out)); | 150 | &jb (&label("cloop1")); |
| 220 | &jb (&label("RC4_CHAR_loop")); | 151 | |
| 221 | 152 | &set_label("done"); | |
| 222 | &set_label("finished"); | 153 | &dec (&LB($xx)); |
| 223 | &dec( $x); | 154 | &mov (&BP(-4,$dat),&LB($yy)); # save key->y |
| 224 | &stack_pop(3); | 155 | &mov (&BP(-8,$dat),&LB($xx)); # save key->x |
| 225 | &movb( &BP(-4,$d,"",0),&LB($y)); | 156 | &set_label("abort"); |
| 226 | &movb( &BP(-8,$d,"",0),&LB($x)); | 157 | &function_end("RC4"); |
| 227 | 158 | ||
| 228 | &function_end($name); | 159 | ######################################################################## |
| 229 | } | 160 | |
| 161 | $inp="esi"; | ||
| 162 | $out="edi"; | ||
| 163 | $idi="ebp"; | ||
| 164 | $ido="ecx"; | ||
| 165 | $idx="edx"; | ||
| 166 | |||
| 167 | &external_label("OPENSSL_ia32cap_P"); | ||
| 168 | |||
| 169 | # void RC4_set_key(RC4_KEY *key,int len,const unsigned char *data); | ||
| 170 | &function_begin("RC4_set_key"); | ||
| 171 | &mov ($out,&wparam(0)); # load key | ||
| 172 | &mov ($idi,&wparam(1)); # load len | ||
| 173 | &mov ($inp,&wparam(2)); # load data | ||
| 174 | &picmeup($idx,"OPENSSL_ia32cap_P"); | ||
| 175 | |||
| 176 | &lea ($out,&DWP(2*4,$out)); # &key->data | ||
| 177 | &lea ($inp,&DWP(0,$inp,$idi)); # $inp to point at the end | ||
| 178 | &neg ($idi); | ||
| 179 | &xor ("eax","eax"); | ||
| 180 | &mov (&DWP(-4,$out),$idi); # borrow key->y | ||
| 181 | |||
| 182 | &bt (&DWP(0,$idx),20); # check for bit#20 | ||
| 183 | &jc (&label("c1stloop")); | ||
| 184 | |||
| 185 | &set_label("w1stloop",16); | ||
| 186 | &mov (&DWP(0,$out,"eax",4),"eax"); # key->data[i]=i; | ||
| 187 | &add (&LB("eax"),1); # i++; | ||
| 188 | &jnc (&label("w1stloop")); | ||
| 189 | |||
| 190 | &xor ($ido,$ido); | ||
| 191 | &xor ($idx,$idx); | ||
| 192 | |||
| 193 | &set_label("w2ndloop",16); | ||
| 194 | &mov ("eax",&DWP(0,$out,$ido,4)); | ||
| 195 | &add (&LB($idx),&BP(0,$inp,$idi)); | ||
| 196 | &add (&LB($idx),&LB("eax")); | ||
| 197 | &add ($idi,1); | ||
| 198 | &mov ("ebx",&DWP(0,$out,$idx,4)); | ||
| 199 | &jnz (&label("wnowrap")); | ||
| 200 | &mov ($idi,&DWP(-4,$out)); | ||
| 201 | &set_label("wnowrap"); | ||
| 202 | &mov (&DWP(0,$out,$idx,4),"eax"); | ||
| 203 | &mov (&DWP(0,$out,$ido,4),"ebx"); | ||
| 204 | &add (&LB($ido),1); | ||
| 205 | &jnc (&label("w2ndloop")); | ||
| 206 | &jmp (&label("exit")); | ||
| 207 | |||
| 208 | # Unlike all other x86 [and x86_64] implementations, Intel P4 core | ||
| 209 | # [including EM64T] was found to perform poorly with above "32-bit" key | ||
| 210 | # schedule, a.k.a. RC4_INT. Performance improvement for IA-32 hand-coded | ||
| 211 | # assembler turned out to be 3.5x if re-coded for compressed 8-bit one, | ||
| 212 | # a.k.a. RC4_CHAR! It's however inappropriate to just switch to 8-bit | ||
| 213 | # schedule for x86[_64], because non-P4 implementations suffer from | ||
| 214 | # significant performance losses then, e.g. PIII exhibits >2x | ||
| 215 | # deterioration, and so does Opteron. In order to assure optimal | ||
| 216 | # all-round performance, we detect P4 at run-time and set up compressed | ||
| 217 | # key schedule, which is recognized by RC4 procedure. | ||
| 218 | |||
| 219 | &set_label("c1stloop",16); | ||
| 220 | &mov (&BP(0,$out,"eax"),&LB("eax")); # key->data[i]=i; | ||
| 221 | &add (&LB("eax"),1); # i++; | ||
| 222 | &jnc (&label("c1stloop")); | ||
| 223 | |||
| 224 | &xor ($ido,$ido); | ||
| 225 | &xor ($idx,$idx); | ||
| 226 | &xor ("ebx","ebx"); | ||
| 227 | |||
| 228 | &set_label("c2ndloop",16); | ||
| 229 | &mov (&LB("eax"),&BP(0,$out,$ido)); | ||
| 230 | &add (&LB($idx),&BP(0,$inp,$idi)); | ||
| 231 | &add (&LB($idx),&LB("eax")); | ||
| 232 | &add ($idi,1); | ||
| 233 | &mov (&LB("ebx"),&BP(0,$out,$idx)); | ||
| 234 | &jnz (&label("cnowrap")); | ||
| 235 | &mov ($idi,&DWP(-4,$out)); | ||
| 236 | &set_label("cnowrap"); | ||
| 237 | &mov (&BP(0,$out,$idx),&LB("eax")); | ||
| 238 | &mov (&BP(0,$out,$ido),&LB("ebx")); | ||
| 239 | &add (&LB($ido),1); | ||
| 240 | &jnc (&label("c2ndloop")); | ||
| 241 | |||
| 242 | &mov (&DWP(256,$out),-1); # mark schedule as compressed | ||
| 243 | |||
| 244 | &set_label("exit"); | ||
| 245 | &xor ("eax","eax"); | ||
| 246 | &mov (&DWP(-8,$out),"eax"); # key->x=0; | ||
| 247 | &mov (&DWP(-4,$out),"eax"); # key->y=0; | ||
| 248 | &function_end("RC4_set_key"); | ||
| 249 | |||
| 250 | # const char *RC4_options(void); | ||
| 251 | &function_begin_B("RC4_options"); | ||
| 252 | &call (&label("pic_point")); | ||
| 253 | &set_label("pic_point"); | ||
| 254 | &blindpop("eax"); | ||
| 255 | &lea ("eax",&DWP(&label("opts")."-".&label("pic_point"),"eax")); | ||
| 256 | &picmeup("edx","OPENSSL_ia32cap_P"); | ||
| 257 | &bt (&DWP(0,"edx"),20); | ||
| 258 | &jnc (&label("skip")); | ||
| 259 | &add ("eax",12); | ||
| 260 | &set_label("skip"); | ||
| 261 | &ret (); | ||
| 262 | &set_label("opts",64); | ||
| 263 | &asciz ("rc4(4x,int)"); | ||
| 264 | &asciz ("rc4(1x,char)"); | ||
| 265 | &asciz ("RC4 for x86, CRYPTOGAMS by <appro\@openssl.org>"); | ||
| 266 | &align (64); | ||
| 267 | &function_end_B("RC4_options"); | ||
| 268 | |||
| 269 | &asm_finish(); | ||
| 230 | 270 | ||
diff --git a/src/lib/libcrypto/rc4/asm/rc4-amd64.pl b/src/lib/libcrypto/rc4/asm/rc4-amd64.pl deleted file mode 100755 index 9e0da8af99..0000000000 --- a/src/lib/libcrypto/rc4/asm/rc4-amd64.pl +++ /dev/null | |||
| @@ -1,227 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | # | ||
| 3 | # ==================================================================== | ||
| 4 | # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL | ||
| 5 | # project. Rights for redistribution and usage in source and binary | ||
| 6 | # forms are granted according to the OpenSSL license. | ||
| 7 | # ==================================================================== | ||
| 8 | # | ||
| 9 | # 2.22x RC4 tune-up:-) It should be noted though that my hand [as in | ||
| 10 | # "hand-coded assembler"] doesn't stand for the whole improvement | ||
| 11 | # coefficient. It turned out that eliminating RC4_CHAR from config | ||
| 12 | # line results in ~40% improvement (yes, even for C implementation). | ||
| 13 | # Presumably it has everything to do with AMD cache architecture and | ||
| 14 | # RAW or whatever penalties. Once again! The module *requires* config | ||
| 15 | # line *without* RC4_CHAR! As for coding "secret," I bet on partial | ||
| 16 | # register arithmetics. For example instead of 'inc %r8; and $255,%r8' | ||
| 17 | # I simply 'inc %r8b'. Even though optimization manual discourages | ||
| 18 | # to operate on partial registers, it turned out to be the best bet. | ||
| 19 | # At least for AMD... How IA32E would perform remains to be seen... | ||
| 20 | |||
| 21 | # As was shown by Marc Bevand reordering of couple of load operations | ||
| 22 | # results in even higher performance gain of 3.3x:-) At least on | ||
| 23 | # Opteron... For reference, 1x in this case is RC4_CHAR C-code | ||
| 24 | # compiled with gcc 3.3.2, which performs at ~54MBps per 1GHz clock. | ||
| 25 | # Latter means that if you want to *estimate* what to expect from | ||
| 26 | # *your* CPU, then multiply 54 by 3.3 and clock frequency in GHz. | ||
| 27 | |||
| 28 | # Intel P4 EM64T core was found to run the AMD64 code really slow... | ||
| 29 | # The only way to achieve comparable performance on P4 is to keep | ||
| 30 | # RC4_CHAR. Kind of ironic, huh? As it's apparently impossible to | ||
| 31 | # compose blended code, which would perform even within 30% marginal | ||
| 32 | # on either AMD and Intel platforms, I implement both cases. See | ||
| 33 | # rc4_skey.c for further details... This applies to 0.9.8 and later. | ||
| 34 | # In 0.9.7 context RC4_CHAR codepath is never engaged and ~70 bytes | ||
| 35 | # of code remain redundant. | ||
| 36 | |||
| 37 | $output=shift; | ||
| 38 | |||
| 39 | $win64a=1 if ($output =~ /win64a.[s|asm]/); | ||
| 40 | |||
| 41 | open STDOUT,">$output" || die "can't open $output: $!"; | ||
| 42 | |||
| 43 | if (defined($win64a)) { | ||
| 44 | $dat="%rcx"; # arg1 | ||
| 45 | $len="%rdx"; # arg2 | ||
| 46 | $inp="%rsi"; # r8, arg3 moves here | ||
| 47 | $out="%rdi"; # r9, arg4 moves here | ||
| 48 | } else { | ||
| 49 | $dat="%rdi"; # arg1 | ||
| 50 | $len="%rsi"; # arg2 | ||
| 51 | $inp="%rdx"; # arg3 | ||
| 52 | $out="%rcx"; # arg4 | ||
| 53 | } | ||
| 54 | |||
| 55 | $XX="%r10"; | ||
| 56 | $TX="%r8"; | ||
| 57 | $YY="%r11"; | ||
| 58 | $TY="%r9"; | ||
| 59 | |||
| 60 | sub PTR() { | ||
| 61 | my $ret=shift; | ||
| 62 | if (defined($win64a)) { | ||
| 63 | $ret =~ s/\[([\S]+)\+([\S]+)\]/[$2+$1]/g; # [%rN+%rM*4]->[%rM*4+%rN] | ||
| 64 | $ret =~ s/:([^\[]+)\[([^\]]+)\]/:[$2+$1]/g; # :off[ea]->:[ea+off] | ||
| 65 | } else { | ||
| 66 | $ret =~ s/[\+\*]/,/g; # [%rN+%rM*4]->[%rN,%rM,4] | ||
| 67 | $ret =~ s/\[([^\]]+)\]/($1)/g; # [%rN]->(%rN) | ||
| 68 | } | ||
| 69 | $ret; | ||
| 70 | } | ||
| 71 | |||
| 72 | $code=<<___ if (!defined($win64a)); | ||
| 73 | .text | ||
| 74 | |||
| 75 | .globl RC4 | ||
| 76 | .type RC4,\@function | ||
| 77 | .align 16 | ||
| 78 | RC4: or $len,$len | ||
| 79 | jne .Lentry | ||
| 80 | repret | ||
| 81 | .Lentry: | ||
| 82 | ___ | ||
| 83 | $code=<<___ if (defined($win64a)); | ||
| 84 | _TEXT SEGMENT | ||
| 85 | PUBLIC RC4 | ||
| 86 | ALIGN 16 | ||
| 87 | RC4 PROC | ||
| 88 | or $len,$len | ||
| 89 | jne .Lentry | ||
| 90 | repret | ||
| 91 | .Lentry: | ||
| 92 | push %rdi | ||
| 93 | push %rsi | ||
| 94 | sub \$40,%rsp | ||
| 95 | mov %r8,$inp | ||
| 96 | mov %r9,$out | ||
| 97 | ___ | ||
| 98 | $code.=<<___; | ||
| 99 | add \$8,$dat | ||
| 100 | movl `&PTR("DWORD:-8[$dat]")`,$XX#d | ||
| 101 | movl `&PTR("DWORD:-4[$dat]")`,$YY#d | ||
| 102 | cmpl \$-1,`&PTR("DWORD:256[$dat]")` | ||
| 103 | je .LRC4_CHAR | ||
| 104 | test \$-8,$len | ||
| 105 | jz .Lloop1 | ||
| 106 | .align 16 | ||
| 107 | .Lloop8: | ||
| 108 | inc $XX#b | ||
| 109 | movl `&PTR("DWORD:[$dat+$XX*4]")`,$TX#d | ||
| 110 | add $TX#b,$YY#b | ||
| 111 | movl `&PTR("DWORD:[$dat+$YY*4]")`,$TY#d | ||
| 112 | movl $TX#d,`&PTR("DWORD:[$dat+$YY*4]")` | ||
| 113 | movl $TY#d,`&PTR("DWORD:[$dat+$XX*4]")` | ||
| 114 | add $TX#b,$TY#b | ||
| 115 | inc $XX#b | ||
| 116 | movl `&PTR("DWORD:[$dat+$XX*4]")`,$TX#d | ||
| 117 | movb `&PTR("BYTE:[$dat+$TY*4]")`,%al | ||
| 118 | ___ | ||
| 119 | for ($i=1;$i<=6;$i++) { | ||
| 120 | $code.=<<___; | ||
| 121 | add $TX#b,$YY#b | ||
| 122 | ror \$8,%rax | ||
| 123 | movl `&PTR("DWORD:[$dat+$YY*4]")`,$TY#d | ||
| 124 | movl $TX#d,`&PTR("DWORD:[$dat+$YY*4]")` | ||
| 125 | movl $TY#d,`&PTR("DWORD:[$dat+$XX*4]")` | ||
| 126 | add $TX#b,$TY#b | ||
| 127 | inc $XX#b | ||
| 128 | movl `&PTR("DWORD:[$dat+$XX*4]")`,$TX#d | ||
| 129 | movb `&PTR("BYTE:[$dat+$TY*4]")`,%al | ||
| 130 | ___ | ||
| 131 | } | ||
| 132 | $code.=<<___; | ||
| 133 | add $TX#b,$YY#b | ||
| 134 | ror \$8,%rax | ||
| 135 | movl `&PTR("DWORD:[$dat+$YY*4]")`,$TY#d | ||
| 136 | movl $TX#d,`&PTR("DWORD:[$dat+$YY*4]")` | ||
| 137 | movl $TY#d,`&PTR("DWORD:[$dat+$XX*4]")` | ||
| 138 | sub \$8,$len | ||
| 139 | add $TY#b,$TX#b | ||
| 140 | movb `&PTR("BYTE:[$dat+$TX*4]")`,%al | ||
| 141 | ror \$8,%rax | ||
| 142 | add \$8,$inp | ||
| 143 | add \$8,$out | ||
| 144 | |||
| 145 | xor `&PTR("QWORD:-8[$inp]")`,%rax | ||
| 146 | mov %rax,`&PTR("QWORD:-8[$out]")` | ||
| 147 | |||
| 148 | test \$-8,$len | ||
| 149 | jnz .Lloop8 | ||
| 150 | cmp \$0,$len | ||
| 151 | jne .Lloop1 | ||
| 152 | .Lexit: | ||
| 153 | movl $XX#d,`&PTR("DWORD:-8[$dat]")` | ||
| 154 | movl $YY#d,`&PTR("DWORD:-4[$dat]")` | ||
| 155 | ___ | ||
| 156 | $code.=<<___ if (defined($win64a)); | ||
| 157 | add \$40,%rsp | ||
| 158 | pop %rsi | ||
| 159 | pop %rdi | ||
| 160 | ___ | ||
| 161 | $code.=<<___; | ||
| 162 | repret | ||
| 163 | .align 16 | ||
| 164 | .Lloop1: | ||
| 165 | movzb `&PTR("BYTE:[$inp]")`,%eax | ||
| 166 | inc $XX#b | ||
| 167 | movl `&PTR("DWORD:[$dat+$XX*4]")`,$TX#d | ||
| 168 | add $TX#b,$YY#b | ||
| 169 | movl `&PTR("DWORD:[$dat+$YY*4]")`,$TY#d | ||
| 170 | movl $TX#d,`&PTR("DWORD:[$dat+$YY*4]")` | ||
| 171 | movl $TY#d,`&PTR("DWORD:[$dat+$XX*4]")` | ||
| 172 | add $TY#b,$TX#b | ||
| 173 | movl `&PTR("DWORD:[$dat+$TX*4]")`,$TY#d | ||
| 174 | xor $TY,%rax | ||
| 175 | inc $inp | ||
| 176 | movb %al,`&PTR("BYTE:[$out]")` | ||
| 177 | inc $out | ||
| 178 | dec $len | ||
| 179 | jnz .Lloop1 | ||
| 180 | jmp .Lexit | ||
| 181 | |||
| 182 | .align 16 | ||
| 183 | .LRC4_CHAR: | ||
| 184 | inc $XX#b | ||
| 185 | movzb `&PTR("BYTE:[$dat+$XX]")`,$TX#d | ||
| 186 | add $TX#b,$YY#b | ||
| 187 | movzb `&PTR("BYTE:[$dat+$YY]")`,$TY#d | ||
| 188 | movb $TX#b,`&PTR("BYTE:[$dat+$YY]")` | ||
| 189 | movb $TY#b,`&PTR("BYTE:[$dat+$XX]")` | ||
| 190 | add $TX#b,$TY#b | ||
| 191 | movzb `&PTR("BYTE:[$dat+$TY]")`,$TY#d | ||
| 192 | xorb `&PTR("BYTE:[$inp]")`,$TY#b | ||
| 193 | movb $TY#b,`&PTR("BYTE:[$out]")` | ||
| 194 | inc $inp | ||
| 195 | inc $out | ||
| 196 | dec $len | ||
| 197 | jnz .LRC4_CHAR | ||
| 198 | jmp .Lexit | ||
| 199 | ___ | ||
| 200 | $code.=<<___ if (defined($win64a)); | ||
| 201 | RC4 ENDP | ||
| 202 | _TEXT ENDS | ||
| 203 | END | ||
| 204 | ___ | ||
| 205 | $code.=<<___ if (!defined($win64a)); | ||
| 206 | .size RC4,.-RC4 | ||
| 207 | ___ | ||
| 208 | |||
| 209 | $code =~ s/#([bwd])/$1/gm; | ||
| 210 | $code =~ s/\`([^\`]*)\`/eval $1/gem; | ||
| 211 | |||
| 212 | if (defined($win64a)) { | ||
| 213 | $code =~ s/\.align/ALIGN/gm; | ||
| 214 | $code =~ s/[\$%]//gm; | ||
| 215 | $code =~ s/\.L/\$L/gm; | ||
| 216 | $code =~ s/([\w]+)([\s]+)([\S]+),([\S]+)/$1$2$4,$3/gm; | ||
| 217 | $code =~ s/([QD]*WORD|BYTE):/$1 PTR/gm; | ||
| 218 | $code =~ s/mov[bwlq]/mov/gm; | ||
| 219 | $code =~ s/movzb/movzx/gm; | ||
| 220 | $code =~ s/repret/DB\t0F3h,0C3h/gm; | ||
| 221 | $code =~ s/cmpl/cmp/gm; | ||
| 222 | $code =~ s/xorb/xor/gm; | ||
| 223 | } else { | ||
| 224 | $code =~ s/([QD]*WORD|BYTE)://gm; | ||
| 225 | $code =~ s/repret/.byte\t0xF3,0xC3/gm; | ||
| 226 | } | ||
| 227 | print $code; | ||
diff --git a/src/lib/libcrypto/rc4/asm/rc4-ia64.S b/src/lib/libcrypto/rc4/asm/rc4-ia64.S deleted file mode 100644 index 8210c47d04..0000000000 --- a/src/lib/libcrypto/rc4/asm/rc4-ia64.S +++ /dev/null | |||
| @@ -1,159 +0,0 @@ | |||
| 1 | // ==================================================================== | ||
| 2 | // Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL | ||
| 3 | // project. | ||
| 4 | // | ||
| 5 | // Rights for redistribution and usage in source and binary forms are | ||
| 6 | // granted according to the OpenSSL license. Warranty of any kind is | ||
| 7 | // disclaimed. | ||
| 8 | // ==================================================================== | ||
| 9 | |||
| 10 | .ident "rc4-ia64.S, Version 2.0" | ||
| 11 | .ident "IA-64 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>" | ||
| 12 | |||
| 13 | // What's wrong with compiler generated code? Because of the nature of | ||
| 14 | // C language, compiler doesn't [dare to] reorder load and stores. But | ||
| 15 | // being memory-bound, RC4 should benefit from reorder [on in-order- | ||
| 16 | // execution core such as IA-64]. But what can we reorder? At the very | ||
| 17 | // least we can safely reorder references to key schedule in respect | ||
| 18 | // to input and output streams. Secondly, from the first [close] glance | ||
| 19 | // it appeared that it's possible to pull up some references to | ||
| 20 | // elements of the key schedule itself. Original rationale ["prior | ||
| 21 | // loads are not safe only for "degenerated" key schedule, when some | ||
| 22 | // elements equal to the same value"] was kind of sloppy. I should have | ||
| 23 | // formulated as it really was: if we assume that pulling up reference | ||
| 24 | // to key[x+1] is not safe, then it would mean that key schedule would | ||
| 25 | // "degenerate," which is never the case. The problem is that this | ||
| 26 | // holds true in respect to references to key[x], but not to key[y]. | ||
| 27 | // Legitimate "collisions" do occur within every 256^2 bytes window. | ||
| 28 | // Fortunately there're enough free instruction slots to keep prior | ||
| 29 | // reference to key[x+1], detect "collision" and compensate for it. | ||
| 30 | // All this without sacrificing a single clock cycle:-) Throughput is | ||
| 31 | // ~210MBps on 900MHz CPU, which is is >3x faster than gcc generated | ||
| 32 | // code and +30% - if compared to HP-UX C. Unrolling loop below should | ||
| 33 | // give >30% on top of that... | ||
| 34 | |||
| 35 | .text | ||
| 36 | .explicit | ||
| 37 | |||
| 38 | #if defined(_HPUX_SOURCE) && !defined(_LP64) | ||
| 39 | # define ADDP addp4 | ||
| 40 | #else | ||
| 41 | # define ADDP add | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #ifndef SZ | ||
| 45 | #define SZ 4 // this is set to sizeof(RC4_INT) | ||
| 46 | #endif | ||
| 47 | // SZ==4 seems to be optimal. At least SZ==8 is not any faster, not for | ||
| 48 | // assembler implementation, while SZ==1 code is ~30% slower. | ||
| 49 | #if SZ==1 // RC4_INT is unsigned char | ||
| 50 | # define LDKEY ld1 | ||
| 51 | # define STKEY st1 | ||
| 52 | # define OFF 0 | ||
| 53 | #elif SZ==4 // RC4_INT is unsigned int | ||
| 54 | # define LDKEY ld4 | ||
| 55 | # define STKEY st4 | ||
| 56 | # define OFF 2 | ||
| 57 | #elif SZ==8 // RC4_INT is unsigned long | ||
| 58 | # define LDKEY ld8 | ||
| 59 | # define STKEY st8 | ||
| 60 | # define OFF 3 | ||
| 61 | #endif | ||
| 62 | |||
| 63 | out=r8; // [expanded] output pointer | ||
| 64 | inp=r9; // [expanded] output pointer | ||
| 65 | prsave=r10; | ||
| 66 | key=r28; // [expanded] pointer to RC4_KEY | ||
| 67 | ksch=r29; // (key->data+255)[&~(sizeof(key->data)-1)] | ||
| 68 | xx=r30; | ||
| 69 | yy=r31; | ||
| 70 | |||
| 71 | // void RC4(RC4_KEY *key,size_t len,const void *inp,void *out); | ||
| 72 | .global RC4# | ||
| 73 | .proc RC4# | ||
| 74 | .align 32 | ||
| 75 | .skip 16 | ||
| 76 | RC4: | ||
| 77 | .prologue | ||
| 78 | .save ar.pfs,r2 | ||
| 79 | { .mii; alloc r2=ar.pfs,4,12,0,16 | ||
| 80 | .save pr,prsave | ||
| 81 | mov prsave=pr | ||
| 82 | ADDP key=0,in0 };; | ||
| 83 | { .mib; cmp.eq p6,p0=0,in1 // len==0? | ||
| 84 | .save ar.lc,r3 | ||
| 85 | mov r3=ar.lc | ||
| 86 | (p6) br.ret.spnt.many b0 };; // emergency exit | ||
| 87 | |||
| 88 | .body | ||
| 89 | .rotr dat[4],key_x[4],tx[2],rnd[2],key_y[2],ty[1]; | ||
| 90 | |||
| 91 | { .mib; LDKEY xx=[key],SZ // load key->x | ||
| 92 | add in1=-1,in1 // adjust len for loop counter | ||
| 93 | nop.b 0 } | ||
| 94 | { .mib; ADDP inp=0,in2 | ||
| 95 | ADDP out=0,in3 | ||
| 96 | brp.loop.imp .Ltop,.Lexit-16 };; | ||
| 97 | { .mmi; LDKEY yy=[key] // load key->y | ||
| 98 | add ksch=SZ,key | ||
| 99 | mov ar.lc=in1 } | ||
| 100 | { .mmi; mov key_y[1]=r0 // guarantee inequality | ||
| 101 | // in first iteration | ||
| 102 | add xx=1,xx | ||
| 103 | mov pr.rot=1<<16 };; | ||
| 104 | { .mii; nop.m 0 | ||
| 105 | dep key_x[1]=xx,r0,OFF,8 | ||
| 106 | mov ar.ec=3 };; // note that epilogue counter | ||
| 107 | // is off by 1. I compensate | ||
| 108 | // for this at exit... | ||
| 109 | .Ltop: | ||
| 110 | // The loop is scheduled for 4*(n+2) spin-rate on Itanium 2, which | ||
| 111 | // theoretically gives asymptotic performance of clock frequency | ||
| 112 | // divided by 4 bytes per seconds, or 400MBps on 1.6GHz CPU. This is | ||
| 113 | // for sizeof(RC4_INT)==4. For smaller RC4_INT STKEY inadvertently | ||
| 114 | // splits the last bundle and you end up with 5*n spin-rate:-( | ||
| 115 | // Originally the loop was scheduled for 3*n and relied on key | ||
| 116 | // schedule to be aligned at 256*sizeof(RC4_INT) boundary. But | ||
| 117 | // *(out++)=dat, which maps to st1, had same effect [inadvertent | ||
| 118 | // bundle split] and holded the loop back. Rescheduling for 4*n | ||
| 119 | // made it possible to eliminate dependence on specific alignment | ||
| 120 | // and allow OpenSSH keep "abusing" our API. Reaching for 3*n would | ||
| 121 | // require unrolling, sticking to variable shift instruction for | ||
| 122 | // collecting output [to avoid starvation for integer shifter] and | ||
| 123 | // copying of key schedule to controlled place in stack [so that | ||
| 124 | // deposit instruction can serve as substitute for whole | ||
| 125 | // key->data+((x&255)<<log2(sizeof(key->data[0])))]... | ||
| 126 | { .mmi; (p19) st1 [out]=dat[3],1 // *(out++)=dat | ||
| 127 | (p16) add xx=1,xx // x++ | ||
| 128 | (p18) dep rnd[1]=rnd[1],r0,OFF,8 } // ((tx+ty)&255)<<OFF | ||
| 129 | { .mmi; (p16) add key_x[1]=ksch,key_x[1] // &key[xx&255] | ||
| 130 | (p17) add key_y[1]=ksch,key_y[1] };; // &key[yy&255] | ||
| 131 | { .mmi; (p16) LDKEY tx[0]=[key_x[1]] // tx=key[xx] | ||
| 132 | (p17) LDKEY ty[0]=[key_y[1]] // ty=key[yy] | ||
| 133 | (p16) dep key_x[0]=xx,r0,OFF,8 } // (xx&255)<<OFF | ||
| 134 | { .mmi; (p18) add rnd[1]=ksch,rnd[1] // &key[(tx+ty)&255] | ||
| 135 | (p16) cmp.ne.unc p20,p21=key_x[1],key_y[1] };; | ||
| 136 | { .mmi; (p18) LDKEY rnd[1]=[rnd[1]] // rnd=key[(tx+ty)&255] | ||
| 137 | (p16) ld1 dat[0]=[inp],1 } // dat=*(inp++) | ||
| 138 | .pred.rel "mutex",p20,p21 | ||
| 139 | { .mmi; (p21) add yy=yy,tx[1] // (p16) | ||
| 140 | (p20) add yy=yy,tx[0] // (p16) y+=tx | ||
| 141 | (p21) mov tx[0]=tx[1] };; // (p16) | ||
| 142 | { .mmi; (p17) STKEY [key_y[1]]=tx[1] // key[yy]=tx | ||
| 143 | (p17) STKEY [key_x[2]]=ty[0] // key[xx]=ty | ||
| 144 | (p16) dep key_y[0]=yy,r0,OFF,8 } // &key[yy&255] | ||
| 145 | { .mmb; (p17) add rnd[0]=tx[1],ty[0] // tx+=ty | ||
| 146 | (p18) xor dat[2]=dat[2],rnd[1] // dat^=rnd | ||
| 147 | br.ctop.sptk .Ltop };; | ||
| 148 | .Lexit: | ||
| 149 | { .mib; STKEY [key]=yy,-SZ // save key->y | ||
| 150 | mov pr=prsave,0x1ffff | ||
| 151 | nop.b 0 } | ||
| 152 | { .mib; st1 [out]=dat[3],1 // compensate for truncated | ||
| 153 | // epilogue counter | ||
| 154 | add xx=-1,xx | ||
| 155 | nop.b 0 };; | ||
| 156 | { .mib; STKEY [key]=xx // save key->x | ||
| 157 | mov ar.lc=r3 | ||
| 158 | br.ret.sptk.many b0 };; | ||
| 159 | .endp RC4# | ||
diff --git a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl index 3a54623495..544386bf53 100755 --- a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl +++ b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | |||
| @@ -58,14 +58,18 @@ | |||
| 58 | # fit for Core2 and therefore the code was modified to skip cloop8 on | 58 | # fit for Core2 and therefore the code was modified to skip cloop8 on |
| 59 | # this CPU. | 59 | # this CPU. |
| 60 | 60 | ||
| 61 | $output=shift; | 61 | $flavour = shift; |
| 62 | $output = shift; | ||
| 63 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | ||
| 64 | |||
| 65 | $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); | ||
| 62 | 66 | ||
| 63 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | 67 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 64 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or | 68 | ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or |
| 65 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or | 69 | ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or |
| 66 | die "can't locate x86_64-xlate.pl"; | 70 | die "can't locate x86_64-xlate.pl"; |
| 67 | 71 | ||
| 68 | open STDOUT,"| $^X $xlate $output"; | 72 | open STDOUT,"| $^X $xlate $flavour $output"; |
| 69 | 73 | ||
| 70 | $dat="%rdi"; # arg1 | 74 | $dat="%rdi"; # arg1 |
| 71 | $len="%rsi"; # arg2 | 75 | $len="%rsi"; # arg2 |
| @@ -87,8 +91,10 @@ RC4: or $len,$len | |||
| 87 | jne .Lentry | 91 | jne .Lentry |
| 88 | ret | 92 | ret |
| 89 | .Lentry: | 93 | .Lentry: |
| 94 | push %rbx | ||
| 90 | push %r12 | 95 | push %r12 |
| 91 | push %r13 | 96 | push %r13 |
| 97 | .Lprologue: | ||
| 92 | 98 | ||
| 93 | add \$8,$dat | 99 | add \$8,$dat |
| 94 | movl -8($dat),$XX[0]#d | 100 | movl -8($dat),$XX[0]#d |
| @@ -133,16 +139,8 @@ $code.=<<___; | |||
| 133 | jnz .Lloop8 | 139 | jnz .Lloop8 |
| 134 | cmp \$0,$len | 140 | cmp \$0,$len |
| 135 | jne .Lloop1 | 141 | jne .Lloop1 |
| 136 | ___ | 142 | jmp .Lexit |
| 137 | $code.=<<___; | ||
| 138 | .Lexit: | ||
| 139 | sub \$1,$XX[0]#b | ||
| 140 | movl $XX[0]#d,-8($dat) | ||
| 141 | movl $YY#d,-4($dat) | ||
| 142 | 143 | ||
| 143 | pop %r13 | ||
| 144 | pop %r12 | ||
| 145 | ret | ||
| 146 | .align 16 | 144 | .align 16 |
| 147 | .Lloop1: | 145 | .Lloop1: |
| 148 | add $TX[0]#b,$YY#b | 146 | add $TX[0]#b,$YY#b |
| @@ -167,9 +165,8 @@ $code.=<<___; | |||
| 167 | movzb ($dat,$XX[0]),$TX[0]#d | 165 | movzb ($dat,$XX[0]),$TX[0]#d |
| 168 | test \$-8,$len | 166 | test \$-8,$len |
| 169 | jz .Lcloop1 | 167 | jz .Lcloop1 |
| 170 | cmp \$0,260($dat) | 168 | cmpl \$0,260($dat) |
| 171 | jnz .Lcloop1 | 169 | jnz .Lcloop1 |
| 172 | push %rbx | ||
| 173 | jmp .Lcloop8 | 170 | jmp .Lcloop8 |
| 174 | .align 16 | 171 | .align 16 |
| 175 | .Lcloop8: | 172 | .Lcloop8: |
| @@ -224,7 +221,6 @@ $code.=<<___; | |||
| 224 | 221 | ||
| 225 | test \$-8,$len | 222 | test \$-8,$len |
| 226 | jnz .Lcloop8 | 223 | jnz .Lcloop8 |
| 227 | pop %rbx | ||
| 228 | cmp \$0,$len | 224 | cmp \$0,$len |
| 229 | jne .Lcloop1 | 225 | jne .Lcloop1 |
| 230 | jmp .Lexit | 226 | jmp .Lexit |
| @@ -249,6 +245,19 @@ $code.=<<___; | |||
| 249 | sub \$1,$len | 245 | sub \$1,$len |
| 250 | jnz .Lcloop1 | 246 | jnz .Lcloop1 |
| 251 | jmp .Lexit | 247 | jmp .Lexit |
| 248 | |||
| 249 | .align 16 | ||
| 250 | .Lexit: | ||
| 251 | sub \$1,$XX[0]#b | ||
| 252 | movl $XX[0]#d,-8($dat) | ||
| 253 | movl $YY#d,-4($dat) | ||
| 254 | |||
| 255 | mov (%rsp),%r13 | ||
| 256 | mov 8(%rsp),%r12 | ||
| 257 | mov 16(%rsp),%rbx | ||
| 258 | add \$24,%rsp | ||
| 259 | .Lepilogue: | ||
| 260 | ret | ||
| 252 | .size RC4,.-RC4 | 261 | .size RC4,.-RC4 |
| 253 | ___ | 262 | ___ |
| 254 | 263 | ||
| @@ -269,6 +278,7 @@ RC4_set_key: | |||
| 269 | xor $ido,$ido | 278 | xor $ido,$ido |
| 270 | xor %r10,%r10 | 279 | xor %r10,%r10 |
| 271 | xor %r11,%r11 | 280 | xor %r11,%r11 |
| 281 | |||
| 272 | mov PIC_GOT(OPENSSL_ia32cap_P),$idx#d | 282 | mov PIC_GOT(OPENSSL_ia32cap_P),$idx#d |
| 273 | bt \$20,$idx#d | 283 | bt \$20,$idx#d |
| 274 | jnc .Lw1stloop | 284 | jnc .Lw1stloop |
| @@ -332,11 +342,10 @@ RC4_set_key: | |||
| 332 | .size RC4_set_key,.-RC4_set_key | 342 | .size RC4_set_key,.-RC4_set_key |
| 333 | 343 | ||
| 334 | .globl RC4_options | 344 | .globl RC4_options |
| 335 | .type RC4_options,\@function,0 | 345 | .type RC4_options,\@abi-omnipotent |
| 336 | .align 16 | 346 | .align 16 |
| 337 | RC4_options: | 347 | RC4_options: |
| 338 | .picmeup %rax | 348 | lea .Lopts(%rip),%rax |
| 339 | lea .Lopts-.(%rax),%rax | ||
| 340 | mov PIC_GOT(OPENSSL_ia32cap_P),%edx | 349 | mov PIC_GOT(OPENSSL_ia32cap_P),%edx |
| 341 | bt \$20,%edx | 350 | bt \$20,%edx |
| 342 | jnc .Ldone | 351 | jnc .Ldone |
| @@ -356,9 +365,139 @@ RC4_options: | |||
| 356 | .size RC4_options,.-RC4_options | 365 | .size RC4_options,.-RC4_options |
| 357 | ___ | 366 | ___ |
| 358 | 367 | ||
| 359 | $code =~ s/#([bwd])/$1/gm; | 368 | # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, |
| 369 | # CONTEXT *context,DISPATCHER_CONTEXT *disp) | ||
| 370 | if ($win64) { | ||
| 371 | $rec="%rcx"; | ||
| 372 | $frame="%rdx"; | ||
| 373 | $context="%r8"; | ||
| 374 | $disp="%r9"; | ||
| 375 | |||
| 376 | $code.=<<___; | ||
| 377 | .extern __imp_RtlVirtualUnwind | ||
| 378 | .type stream_se_handler,\@abi-omnipotent | ||
| 379 | .align 16 | ||
| 380 | stream_se_handler: | ||
| 381 | push %rsi | ||
| 382 | push %rdi | ||
| 383 | push %rbx | ||
| 384 | push %rbp | ||
| 385 | push %r12 | ||
| 386 | push %r13 | ||
| 387 | push %r14 | ||
| 388 | push %r15 | ||
| 389 | pushfq | ||
| 390 | sub \$64,%rsp | ||
| 391 | |||
| 392 | mov 120($context),%rax # pull context->Rax | ||
| 393 | mov 248($context),%rbx # pull context->Rip | ||
| 394 | |||
| 395 | lea .Lprologue(%rip),%r10 | ||
| 396 | cmp %r10,%rbx # context->Rip<prologue label | ||
| 397 | jb .Lin_prologue | ||
| 398 | |||
| 399 | mov 152($context),%rax # pull context->Rsp | ||
| 400 | |||
| 401 | lea .Lepilogue(%rip),%r10 | ||
| 402 | cmp %r10,%rbx # context->Rip>=epilogue label | ||
| 403 | jae .Lin_prologue | ||
| 404 | |||
| 405 | lea 24(%rax),%rax | ||
| 406 | |||
| 407 | mov -8(%rax),%rbx | ||
| 408 | mov -16(%rax),%r12 | ||
| 409 | mov -24(%rax),%r13 | ||
| 410 | mov %rbx,144($context) # restore context->Rbx | ||
| 411 | mov %r12,216($context) # restore context->R12 | ||
| 412 | mov %r13,224($context) # restore context->R13 | ||
| 413 | |||
| 414 | .Lin_prologue: | ||
| 415 | mov 8(%rax),%rdi | ||
| 416 | mov 16(%rax),%rsi | ||
| 417 | mov %rax,152($context) # restore context->Rsp | ||
| 418 | mov %rsi,168($context) # restore context->Rsi | ||
| 419 | mov %rdi,176($context) # restore context->Rdi | ||
| 420 | |||
| 421 | jmp .Lcommon_seh_exit | ||
| 422 | .size stream_se_handler,.-stream_se_handler | ||
| 423 | |||
| 424 | .type key_se_handler,\@abi-omnipotent | ||
| 425 | .align 16 | ||
| 426 | key_se_handler: | ||
| 427 | push %rsi | ||
| 428 | push %rdi | ||
| 429 | push %rbx | ||
| 430 | push %rbp | ||
| 431 | push %r12 | ||
| 432 | push %r13 | ||
| 433 | push %r14 | ||
| 434 | push %r15 | ||
| 435 | pushfq | ||
| 436 | sub \$64,%rsp | ||
| 437 | |||
| 438 | mov 152($context),%rax # pull context->Rsp | ||
| 439 | mov 8(%rax),%rdi | ||
| 440 | mov 16(%rax),%rsi | ||
| 441 | mov %rsi,168($context) # restore context->Rsi | ||
| 442 | mov %rdi,176($context) # restore context->Rdi | ||
| 360 | 443 | ||
| 361 | $code =~ s/RC4_set_key/private_RC4_set_key/g if ($ENV{FIPSCANLIB} ne ""); | 444 | .Lcommon_seh_exit: |
| 445 | |||
| 446 | mov 40($disp),%rdi # disp->ContextRecord | ||
| 447 | mov $context,%rsi # context | ||
| 448 | mov \$154,%ecx # sizeof(CONTEXT) | ||
| 449 | .long 0xa548f3fc # cld; rep movsq | ||
| 450 | |||
| 451 | mov $disp,%rsi | ||
| 452 | xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER | ||
| 453 | mov 8(%rsi),%rdx # arg2, disp->ImageBase | ||
| 454 | mov 0(%rsi),%r8 # arg3, disp->ControlPc | ||
| 455 | mov 16(%rsi),%r9 # arg4, disp->FunctionEntry | ||
| 456 | mov 40(%rsi),%r10 # disp->ContextRecord | ||
| 457 | lea 56(%rsi),%r11 # &disp->HandlerData | ||
| 458 | lea 24(%rsi),%r12 # &disp->EstablisherFrame | ||
| 459 | mov %r10,32(%rsp) # arg5 | ||
| 460 | mov %r11,40(%rsp) # arg6 | ||
| 461 | mov %r12,48(%rsp) # arg7 | ||
| 462 | mov %rcx,56(%rsp) # arg8, (NULL) | ||
| 463 | call *__imp_RtlVirtualUnwind(%rip) | ||
| 464 | |||
| 465 | mov \$1,%eax # ExceptionContinueSearch | ||
| 466 | add \$64,%rsp | ||
| 467 | popfq | ||
| 468 | pop %r15 | ||
| 469 | pop %r14 | ||
| 470 | pop %r13 | ||
| 471 | pop %r12 | ||
| 472 | pop %rbp | ||
| 473 | pop %rbx | ||
| 474 | pop %rdi | ||
| 475 | pop %rsi | ||
| 476 | ret | ||
| 477 | .size key_se_handler,.-key_se_handler | ||
| 478 | |||
| 479 | .section .pdata | ||
| 480 | .align 4 | ||
| 481 | .rva .LSEH_begin_RC4 | ||
| 482 | .rva .LSEH_end_RC4 | ||
| 483 | .rva .LSEH_info_RC4 | ||
| 484 | |||
| 485 | .rva .LSEH_begin_RC4_set_key | ||
| 486 | .rva .LSEH_end_RC4_set_key | ||
| 487 | .rva .LSEH_info_RC4_set_key | ||
| 488 | |||
| 489 | .section .xdata | ||
| 490 | .align 8 | ||
| 491 | .LSEH_info_RC4: | ||
| 492 | .byte 9,0,0,0 | ||
| 493 | .rva stream_se_handler | ||
| 494 | .LSEH_info_RC4_set_key: | ||
| 495 | .byte 9,0,0,0 | ||
| 496 | .rva key_se_handler | ||
| 497 | ___ | ||
| 498 | } | ||
| 499 | |||
| 500 | $code =~ s/#([bwd])/$1/gm; | ||
| 362 | 501 | ||
| 363 | print $code; | 502 | print $code; |
| 364 | 503 | ||
diff --git a/src/lib/libcrypto/rc4/rc4.h b/src/lib/libcrypto/rc4/rc4.h index 2d8620d33b..29d1acccf5 100644 --- a/src/lib/libcrypto/rc4/rc4.h +++ b/src/lib/libcrypto/rc4/rc4.h | |||
| @@ -64,6 +64,8 @@ | |||
| 64 | #error RC4 is disabled. | 64 | #error RC4 is disabled. |
| 65 | #endif | 65 | #endif |
| 66 | 66 | ||
| 67 | #include <stddef.h> | ||
| 68 | |||
| 67 | #ifdef __cplusplus | 69 | #ifdef __cplusplus |
| 68 | extern "C" { | 70 | extern "C" { |
| 69 | #endif | 71 | #endif |
| @@ -76,11 +78,8 @@ typedef struct rc4_key_st | |||
| 76 | 78 | ||
| 77 | 79 | ||
| 78 | const char *RC4_options(void); | 80 | const char *RC4_options(void); |
| 79 | #ifdef OPENSSL_FIPS | ||
| 80 | void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); | ||
| 81 | #endif | ||
| 82 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); | 81 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); |
| 83 | void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | 82 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, |
| 84 | unsigned char *outdata); | 83 | unsigned char *outdata); |
| 85 | 84 | ||
| 86 | #ifdef __cplusplus | 85 | #ifdef __cplusplus |
diff --git a/src/lib/libcrypto/rc4/rc4_enc.c b/src/lib/libcrypto/rc4/rc4_enc.c index 0660ea60a2..8c4fc6c7a3 100644 --- a/src/lib/libcrypto/rc4/rc4_enc.c +++ b/src/lib/libcrypto/rc4/rc4_enc.c | |||
| @@ -67,12 +67,12 @@ | |||
| 67 | * Date: Wed, 14 Sep 1994 06:35:31 GMT | 67 | * Date: Wed, 14 Sep 1994 06:35:31 GMT |
| 68 | */ | 68 | */ |
| 69 | 69 | ||
| 70 | void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | 70 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, |
| 71 | unsigned char *outdata) | 71 | unsigned char *outdata) |
| 72 | { | 72 | { |
| 73 | register RC4_INT *d; | 73 | register RC4_INT *d; |
| 74 | register RC4_INT x,y,tx,ty; | 74 | register RC4_INT x,y,tx,ty; |
| 75 | int i; | 75 | size_t i; |
| 76 | 76 | ||
| 77 | x=key->x; | 77 | x=key->x; |
| 78 | y=key->y; | 78 | y=key->y; |
| @@ -120,8 +120,8 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | |||
| 120 | (RC4_CHUNK)d[(tx+ty)&0xff]\ | 120 | (RC4_CHUNK)d[(tx+ty)&0xff]\ |
| 121 | ) | 121 | ) |
| 122 | 122 | ||
| 123 | if ( ( ((unsigned long)indata & (sizeof(RC4_CHUNK)-1)) | | 123 | if ( ( ((size_t)indata & (sizeof(RC4_CHUNK)-1)) | |
| 124 | ((unsigned long)outdata & (sizeof(RC4_CHUNK)-1)) ) == 0 ) | 124 | ((size_t)outdata & (sizeof(RC4_CHUNK)-1)) ) == 0 ) |
| 125 | { | 125 | { |
| 126 | RC4_CHUNK ichunk,otp; | 126 | RC4_CHUNK ichunk,otp; |
| 127 | const union { long one; char little; } is_endian = {1}; | 127 | const union { long one; char little; } is_endian = {1}; |
| @@ -157,7 +157,7 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | |||
| 157 | if (!is_endian.little) | 157 | if (!is_endian.little) |
| 158 | { /* BIG-ENDIAN CASE */ | 158 | { /* BIG-ENDIAN CASE */ |
| 159 | # define BESHFT(c) (((sizeof(RC4_CHUNK)-(c)-1)*8)&(sizeof(RC4_CHUNK)*8-1)) | 159 | # define BESHFT(c) (((sizeof(RC4_CHUNK)-(c)-1)*8)&(sizeof(RC4_CHUNK)*8-1)) |
| 160 | for (;len&~(sizeof(RC4_CHUNK)-1);len-=sizeof(RC4_CHUNK)) | 160 | for (;len&(0-sizeof(RC4_CHUNK));len-=sizeof(RC4_CHUNK)) |
| 161 | { | 161 | { |
| 162 | ichunk = *(RC4_CHUNK *)indata; | 162 | ichunk = *(RC4_CHUNK *)indata; |
| 163 | otp = RC4_STEP<<BESHFT(0); | 163 | otp = RC4_STEP<<BESHFT(0); |
| @@ -210,7 +210,7 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | |||
| 210 | else | 210 | else |
| 211 | { /* LITTLE-ENDIAN CASE */ | 211 | { /* LITTLE-ENDIAN CASE */ |
| 212 | # define LESHFT(c) (((c)*8)&(sizeof(RC4_CHUNK)*8-1)) | 212 | # define LESHFT(c) (((c)*8)&(sizeof(RC4_CHUNK)*8-1)) |
| 213 | for (;len&~(sizeof(RC4_CHUNK)-1);len-=sizeof(RC4_CHUNK)) | 213 | for (;len&(0-sizeof(RC4_CHUNK));len-=sizeof(RC4_CHUNK)) |
| 214 | { | 214 | { |
| 215 | ichunk = *(RC4_CHUNK *)indata; | 215 | ichunk = *(RC4_CHUNK *)indata; |
| 216 | otp = RC4_STEP; | 216 | otp = RC4_STEP; |
| @@ -276,7 +276,7 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | |||
| 276 | #define RC4_LOOP(a,b,i) LOOP(a[i],b[i]) | 276 | #define RC4_LOOP(a,b,i) LOOP(a[i],b[i]) |
| 277 | #endif | 277 | #endif |
| 278 | 278 | ||
| 279 | i=(int)(len>>3L); | 279 | i=len>>3; |
| 280 | if (i) | 280 | if (i) |
| 281 | { | 281 | { |
| 282 | for (;;) | 282 | for (;;) |
| @@ -296,7 +296,7 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | |||
| 296 | if (--i == 0) break; | 296 | if (--i == 0) break; |
| 297 | } | 297 | } |
| 298 | } | 298 | } |
| 299 | i=(int)len&0x07; | 299 | i=len&0x07; |
| 300 | if (i) | 300 | if (i) |
| 301 | { | 301 | { |
| 302 | for (;;) | 302 | for (;;) |
diff --git a/src/lib/libcrypto/rc4/rc4_fblk.c b/src/lib/libcrypto/rc4/rc4_fblk.c deleted file mode 100644 index 1b2a42979b..0000000000 --- a/src/lib/libcrypto/rc4/rc4_fblk.c +++ /dev/null | |||
| @@ -1,75 +0,0 @@ | |||
| 1 | /* crypto/rc4/rc4_fblk.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2008 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 | |||
| 54 | |||
| 55 | #include <openssl/rc4.h> | ||
| 56 | #include "rc4_locl.h" | ||
| 57 | #include <openssl/opensslv.h> | ||
| 58 | #include <openssl/crypto.h> | ||
| 59 | #ifdef OPENSSL_FIPS | ||
| 60 | #include <openssl/fips.h> | ||
| 61 | #endif | ||
| 62 | |||
| 63 | /* FIPS mode blocking for RC4 has to be done separately since RC4_set_key | ||
| 64 | * may be implemented in an assembly language file. | ||
| 65 | */ | ||
| 66 | |||
| 67 | #ifdef OPENSSL_FIPS | ||
| 68 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) | ||
| 69 | { | ||
| 70 | if (FIPS_mode()) | ||
| 71 | FIPS_BAD_ABORT(RC4) | ||
| 72 | private_RC4_set_key(key, len, data); | ||
| 73 | } | ||
| 74 | #endif | ||
| 75 | |||
diff --git a/src/lib/libcrypto/rc4/rc4_skey.c b/src/lib/libcrypto/rc4/rc4_skey.c index 4478d1a4b3..b22c40b0bd 100644 --- a/src/lib/libcrypto/rc4/rc4_skey.c +++ b/src/lib/libcrypto/rc4/rc4_skey.c | |||
| @@ -59,11 +59,6 @@ | |||
| 59 | #include <openssl/rc4.h> | 59 | #include <openssl/rc4.h> |
| 60 | #include "rc4_locl.h" | 60 | #include "rc4_locl.h" |
| 61 | #include <openssl/opensslv.h> | 61 | #include <openssl/opensslv.h> |
| 62 | #include <openssl/crypto.h> | ||
| 63 | #ifdef OPENSSL_FIPS | ||
| 64 | #include <openssl/fips.h> | ||
| 65 | #endif | ||
| 66 | |||
| 67 | 62 | ||
| 68 | const char RC4_version[]="RC4" OPENSSL_VERSION_PTEXT; | 63 | const char RC4_version[]="RC4" OPENSSL_VERSION_PTEXT; |
| 69 | 64 | ||
| @@ -90,11 +85,7 @@ const char *RC4_options(void) | |||
| 90 | * Date: Wed, 14 Sep 1994 06:35:31 GMT | 85 | * Date: Wed, 14 Sep 1994 06:35:31 GMT |
| 91 | */ | 86 | */ |
| 92 | 87 | ||
| 93 | #ifdef OPENSSL_FIPS | ||
| 94 | void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) | ||
| 95 | #else | ||
| 96 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) | 88 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) |
| 97 | #endif | ||
| 98 | { | 89 | { |
| 99 | register RC4_INT tmp; | 90 | register RC4_INT tmp; |
| 100 | register int id1,id2; | 91 | register int id1,id2; |
| @@ -128,20 +119,14 @@ void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) | |||
| 128 | * implementations suffer from significant performance | 119 | * implementations suffer from significant performance |
| 129 | * losses then, e.g. PIII exhibits >2x deterioration, | 120 | * losses then, e.g. PIII exhibits >2x deterioration, |
| 130 | * and so does Opteron. In order to assure optimal | 121 | * and so does Opteron. In order to assure optimal |
| 131 | * all-round performance, we detect P4 at run-time by | 122 | * all-round performance, let us [try to] detect P4 at |
| 132 | * checking upon reserved bit 20 in CPU capability | 123 | * run-time by checking upon HTT bit in CPU capability |
| 133 | * vector and set up compressed key schedule, which is | 124 | * vector and set up compressed key schedule, which is |
| 134 | * recognized by correspondingly updated assembler | 125 | * recognized by correspondingly updated assembler |
| 135 | * module... Bit 20 is set up by OPENSSL_ia32_cpuid. | 126 | * module... |
| 136 | * | ||
| 137 | * <appro@fy.chalmers.se> | 127 | * <appro@fy.chalmers.se> |
| 138 | */ | 128 | */ |
| 139 | #ifdef OPENSSL_FIPS | ||
| 140 | unsigned long *ia32cap_ptr = OPENSSL_ia32cap_loc(); | ||
| 141 | if (ia32cap_ptr && (*ia32cap_ptr & (1<<28))) { | ||
| 142 | #else | ||
| 143 | if (OPENSSL_ia32cap_P & (1<<28)) { | 129 | if (OPENSSL_ia32cap_P & (1<<28)) { |
| 144 | #endif | ||
| 145 | unsigned char *cp=(unsigned char *)d; | 130 | unsigned char *cp=(unsigned char *)d; |
| 146 | 131 | ||
| 147 | for (i=0;i<256;i++) cp[i]=i; | 132 | for (i=0;i<256;i++) cp[i]=i; |
diff --git a/src/lib/libcrypto/rc4/rc4test.c b/src/lib/libcrypto/rc4/rc4test.c index 54b597fa26..633a79e758 100644 --- a/src/lib/libcrypto/rc4/rc4test.c +++ b/src/lib/libcrypto/rc4/rc4test.c | |||
| @@ -114,8 +114,8 @@ static unsigned char output[7][30]={ | |||
| 114 | 114 | ||
| 115 | int main(int argc, char *argv[]) | 115 | int main(int argc, char *argv[]) |
| 116 | { | 116 | { |
| 117 | int err=0; | 117 | int i,err=0; |
| 118 | unsigned int i, j; | 118 | int j; |
| 119 | unsigned char *p; | 119 | unsigned char *p; |
| 120 | RC4_KEY key; | 120 | RC4_KEY key; |
| 121 | unsigned char obuf[512]; | 121 | unsigned char obuf[512]; |
| @@ -129,12 +129,12 @@ int main(int argc, char *argv[]) | |||
| 129 | { | 129 | { |
| 130 | printf("error calculating RC4\n"); | 130 | printf("error calculating RC4\n"); |
| 131 | printf("output:"); | 131 | printf("output:"); |
| 132 | for (j=0; j<data_len[i]+1U; j++) | 132 | for (j=0; j<data_len[i]+1; j++) |
| 133 | printf(" %02x",obuf[j]); | 133 | printf(" %02x",obuf[j]); |
| 134 | printf("\n"); | 134 | printf("\n"); |
| 135 | printf("expect:"); | 135 | printf("expect:"); |
| 136 | p= &(output[i][0]); | 136 | p= &(output[i][0]); |
| 137 | for (j=0; j<data_len[i]+1U; j++) | 137 | for (j=0; j<data_len[i]+1; j++) |
| 138 | printf(" %02x",*(p++)); | 138 | printf(" %02x",*(p++)); |
| 139 | printf("\n"); | 139 | printf("\n"); |
| 140 | err++; | 140 | err++; |
| @@ -180,12 +180,12 @@ int main(int argc, char *argv[]) | |||
| 180 | { | 180 | { |
| 181 | printf("error in RC4 multi-call processing\n"); | 181 | printf("error in RC4 multi-call processing\n"); |
| 182 | printf("output:"); | 182 | printf("output:"); |
| 183 | for (j=0; j<data_len[3]+1U; j++) | 183 | for (j=0; j<data_len[3]+1; j++) |
| 184 | printf(" %02x",obuf[j]); | 184 | printf(" %02x",obuf[j]); |
| 185 | printf("\n"); | 185 | printf("\n"); |
| 186 | printf("expect:"); | 186 | printf("expect:"); |
| 187 | p= &(output[3][0]); | 187 | p= &(output[3][0]); |
| 188 | for (j=0; j<data_len[3]+1U; j++) | 188 | for (j=0; j<data_len[3]+1; j++) |
| 189 | printf(" %02x",*(p++)); | 189 | printf(" %02x",*(p++)); |
| 190 | err++; | 190 | err++; |
| 191 | } | 191 | } |
| @@ -216,11 +216,11 @@ int main(int argc, char *argv[]) | |||
| 216 | if (memcmp(md,expected,sizeof(md))) { | 216 | if (memcmp(md,expected,sizeof(md))) { |
| 217 | printf("error in RC4 bulk test\n"); | 217 | printf("error in RC4 bulk test\n"); |
| 218 | printf("output:"); | 218 | printf("output:"); |
| 219 | for (j=0; j<sizeof(md); j++) | 219 | for (j=0; j<(int)sizeof(md); j++) |
| 220 | printf(" %02x",md[j]); | 220 | printf(" %02x",md[j]); |
| 221 | printf("\n"); | 221 | printf("\n"); |
| 222 | printf("expect:"); | 222 | printf("expect:"); |
| 223 | for (j=0; j<sizeof(md); j++) | 223 | for (j=0; j<(int)sizeof(md); j++) |
| 224 | printf(" %02x",expected[j]); | 224 | printf(" %02x",expected[j]); |
| 225 | printf("\n"); | 225 | printf("\n"); |
| 226 | err++; | 226 | err++; |
diff --git a/src/lib/libcrypto/rc5/Makefile.ssl b/src/lib/libcrypto/rc5/Makefile.ssl deleted file mode 100644 index 3f9632f8f7..0000000000 --- a/src/lib/libcrypto/rc5/Makefile.ssl +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/rc5/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= rc5 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | RC5_ENC= rc5_enc.o | ||
| 21 | # or use | ||
| 22 | #DES_ENC= r586-elf.o | ||
| 23 | |||
| 24 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 25 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 26 | |||
| 27 | GENERAL=Makefile | ||
| 28 | TEST=rc5test.c | ||
| 29 | APPS= | ||
| 30 | |||
| 31 | LIB=$(TOP)/libcrypto.a | ||
| 32 | LIBSRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c | ||
| 33 | LIBOBJ=rc5_skey.o rc5_ecb.o $(RC5_ENC) rc5cfb64.o rc5ofb64.o | ||
| 34 | |||
| 35 | SRC= $(LIBSRC) | ||
| 36 | |||
| 37 | EXHEADER= rc5.h | ||
| 38 | HEADER= rc5_locl.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 | # elf | ||
| 53 | asm/r586-elf.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 54 | (cd asm; $(PERL) rc5-586.pl elf $(CFLAGS) > r586-elf.s) | ||
| 55 | |||
| 56 | # a.out | ||
| 57 | asm/r586-out.o: asm/r586unix.cpp | ||
| 58 | $(CPP) -DOUT asm/r586unix.cpp | as -o asm/r586-out.o | ||
| 59 | |||
| 60 | # bsdi | ||
| 61 | asm/r586bsdi.o: asm/r586unix.cpp | ||
| 62 | $(CPP) -DBSDI asm/r586unix.cpp | sed 's/ :/:/' | as -o asm/r586bsdi.o | ||
| 63 | |||
| 64 | asm/r586unix.cpp: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 65 | (cd asm; $(PERL) rc5-586.pl cpp >r586unix.cpp) | ||
| 66 | |||
| 67 | files: | ||
| 68 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 69 | |||
| 70 | links: | ||
| 71 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 72 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 73 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 74 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 75 | |||
| 76 | install: | ||
| 77 | @for i in $(EXHEADER) ; \ | ||
| 78 | do \ | ||
| 79 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 80 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 81 | done; | ||
| 82 | |||
| 83 | tags: | ||
| 84 | ctags $(SRC) | ||
| 85 | |||
| 86 | tests: | ||
| 87 | |||
| 88 | lint: | ||
| 89 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 90 | |||
| 91 | depend: | ||
| 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 asm/r586unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 100 | |||
| 101 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 102 | |||
| 103 | rc5_ecb.o: ../../include/openssl/opensslv.h ../../include/openssl/rc5.h | ||
| 104 | rc5_ecb.o: rc5_ecb.c rc5_locl.h | ||
| 105 | rc5_enc.o: ../../include/openssl/rc5.h rc5_enc.c rc5_locl.h | ||
| 106 | rc5_skey.o: ../../include/openssl/rc5.h rc5_locl.h rc5_skey.c | ||
| 107 | rc5cfb64.o: ../../include/openssl/rc5.h rc5_locl.h rc5cfb64.c | ||
| 108 | rc5ofb64.o: ../../include/openssl/rc5.h rc5_locl.h rc5ofb64.c | ||
diff --git a/src/lib/libcrypto/rc5/rc5.h b/src/lib/libcrypto/rc5/rc5.h index f73a2a02a4..4b3c153b50 100644 --- a/src/lib/libcrypto/rc5/rc5.h +++ b/src/lib/libcrypto/rc5/rc5.h | |||
| @@ -94,10 +94,7 @@ typedef struct rc5_key_st | |||
| 94 | RC5_32_INT data[2*(RC5_16_ROUNDS+1)]; | 94 | RC5_32_INT data[2*(RC5_16_ROUNDS+1)]; |
| 95 | } RC5_32_KEY; | 95 | } RC5_32_KEY; |
| 96 | 96 | ||
| 97 | #ifdef OPENSSL_FIPS | 97 | |
| 98 | void private_RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, | ||
| 99 | int rounds); | ||
| 100 | #endif | ||
| 101 | void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, | 98 | void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, |
| 102 | int rounds); | 99 | int rounds); |
| 103 | void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key, | 100 | void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key, |
diff --git a/src/lib/libcrypto/ripemd/Makefile.ssl b/src/lib/libcrypto/ripemd/Makefile.ssl deleted file mode 100644 index f22ac790ae..0000000000 --- a/src/lib/libcrypto/ripemd/Makefile.ssl +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/ripemd/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= ripemd | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | RIP_ASM_OBJ= | ||
| 21 | |||
| 22 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 23 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 24 | |||
| 25 | GENERAL=Makefile | ||
| 26 | TEST=rmdtest.c | ||
| 27 | APPS= | ||
| 28 | |||
| 29 | LIB=$(TOP)/libcrypto.a | ||
| 30 | LIBSRC=rmd_dgst.c rmd_one.c | ||
| 31 | LIBOBJ=rmd_dgst.o rmd_one.o $(RMD160_ASM_OBJ) | ||
| 32 | |||
| 33 | SRC= $(LIBSRC) | ||
| 34 | |||
| 35 | EXHEADER= ripemd.h | ||
| 36 | HEADER= rmd_locl.h rmdconst.h $(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 | # elf | ||
| 51 | asm/rm86-elf.s: asm/rmd-586.pl ../perlasm/x86asm.pl | ||
| 52 | (cd asm; $(PERL) rmd-586.pl elf $(CFLAGS) > rm86-elf.s) | ||
| 53 | |||
| 54 | # a.out | ||
| 55 | asm/rm86-out.o: asm/rm86unix.cpp | ||
| 56 | $(CPP) -DOUT asm/rm86unix.cpp | as -o asm/rm86-out.o | ||
| 57 | |||
| 58 | # bsdi | ||
| 59 | asm/rm86bsdi.o: asm/rm86unix.cpp | ||
| 60 | $(CPP) -DBSDI asm/rm86unix.cpp | sed 's/ :/:/' | as -o asm/rm86bsdi.o | ||
| 61 | |||
| 62 | asm/rm86unix.cpp: asm/rmd-586.pl ../perlasm/x86asm.pl | ||
| 63 | (cd asm; $(PERL) rmd-586.pl cpp >rm86unix.cpp) | ||
| 64 | |||
| 65 | files: | ||
| 66 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 67 | |||
| 68 | links: | ||
| 69 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 76 | do \ | ||
| 77 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 78 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 79 | done; | ||
| 80 | |||
| 81 | tags: | ||
| 82 | ctags $(SRC) | ||
| 83 | |||
| 84 | tests: | ||
| 85 | |||
| 86 | lint: | ||
| 87 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 88 | |||
| 89 | depend: | ||
| 90 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 91 | |||
| 92 | dclean: | ||
| 93 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 94 | mv -f Makefile.new $(MAKEFILE) | ||
| 95 | |||
| 96 | clean: | ||
| 97 | rm -f asm/rm86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 98 | |||
| 99 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 100 | |||
| 101 | rmd_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 102 | rmd_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ripemd.h | ||
| 103 | rmd_dgst.o: ../md32_common.h rmd_dgst.c rmd_locl.h rmdconst.h | ||
| 104 | rmd_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 105 | rmd_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 106 | rmd_one.o: ../../include/openssl/ripemd.h ../../include/openssl/safestack.h | ||
| 107 | rmd_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 108 | rmd_one.o: rmd_one.c | ||
diff --git a/src/lib/libcrypto/ripemd/asm/rmd-586.pl b/src/lib/libcrypto/ripemd/asm/rmd-586.pl index 4f3c4c967f..e8b2bc2db2 100644 --- a/src/lib/libcrypto/ripemd/asm/rmd-586.pl +++ b/src/lib/libcrypto/ripemd/asm/rmd-586.pl | |||
| @@ -5,7 +5,8 @@ | |||
| 5 | 5 | ||
| 6 | $normal=0; | 6 | $normal=0; |
| 7 | 7 | ||
| 8 | push(@INC,"perlasm","../../perlasm"); | 8 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 9 | push(@INC,"${dir}","${dir}../../perlasm"); | ||
| 9 | require "x86asm.pl"; | 10 | require "x86asm.pl"; |
| 10 | 11 | ||
| 11 | &asm_init($ARGV[0],$0); | 12 | &asm_init($ARGV[0],$0); |
diff --git a/src/lib/libcrypto/ripemd/ripemd.h b/src/lib/libcrypto/ripemd/ripemd.h index 3b6d04386d..5942eb6180 100644 --- a/src/lib/libcrypto/ripemd/ripemd.h +++ b/src/lib/libcrypto/ripemd/ripemd.h | |||
| @@ -70,7 +70,7 @@ extern "C" { | |||
| 70 | #error RIPEMD is disabled. | 70 | #error RIPEMD is disabled. |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | 73 | #if defined(__LP32__) |
| 74 | #define RIPEMD160_LONG unsigned long | 74 | #define RIPEMD160_LONG unsigned long |
| 75 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | 75 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) |
| 76 | #define RIPEMD160_LONG unsigned long | 76 | #define RIPEMD160_LONG unsigned long |
| @@ -90,9 +90,7 @@ typedef struct RIPEMD160state_st | |||
| 90 | RIPEMD160_LONG data[RIPEMD160_LBLOCK]; | 90 | RIPEMD160_LONG data[RIPEMD160_LBLOCK]; |
| 91 | unsigned int num; | 91 | unsigned int num; |
| 92 | } RIPEMD160_CTX; | 92 | } RIPEMD160_CTX; |
| 93 | #ifdef OPENSSL_FIPS | 93 | |
| 94 | int private_RIPEMD160_Init(RIPEMD160_CTX *c); | ||
| 95 | #endif | ||
| 96 | int RIPEMD160_Init(RIPEMD160_CTX *c); | 94 | int RIPEMD160_Init(RIPEMD160_CTX *c); |
| 97 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); | 95 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); |
| 98 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); | 96 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); |
diff --git a/src/lib/libcrypto/ripemd/rmd_dgst.c b/src/lib/libcrypto/ripemd/rmd_dgst.c index a845e17ed8..2097a66c03 100644 --- a/src/lib/libcrypto/ripemd/rmd_dgst.c +++ b/src/lib/libcrypto/ripemd/rmd_dgst.c | |||
| @@ -59,11 +59,6 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "rmd_locl.h" | 60 | #include "rmd_locl.h" |
| 61 | #include <openssl/opensslv.h> | 61 | #include <openssl/opensslv.h> |
| 62 | #include <openssl/err.h> | ||
| 63 | #ifdef OPENSSL_FIPS | ||
| 64 | #include <openssl/fips.h> | ||
| 65 | #endif | ||
| 66 | |||
| 67 | 62 | ||
| 68 | const char RMD160_version[]="RIPE-MD160" OPENSSL_VERSION_PTEXT; | 63 | const char RMD160_version[]="RIPE-MD160" OPENSSL_VERSION_PTEXT; |
| 69 | 64 | ||
| @@ -74,16 +69,14 @@ const char RMD160_version[]="RIPE-MD160" OPENSSL_VERSION_PTEXT; | |||
| 74 | void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num); | 69 | void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num); |
| 75 | # endif | 70 | # endif |
| 76 | 71 | ||
| 77 | FIPS_NON_FIPS_MD_Init(RIPEMD160) | 72 | int RIPEMD160_Init(RIPEMD160_CTX *c) |
| 78 | { | 73 | { |
| 74 | memset (c,0,sizeof(*c)); | ||
| 79 | c->A=RIPEMD160_A; | 75 | c->A=RIPEMD160_A; |
| 80 | c->B=RIPEMD160_B; | 76 | c->B=RIPEMD160_B; |
| 81 | c->C=RIPEMD160_C; | 77 | c->C=RIPEMD160_C; |
| 82 | c->D=RIPEMD160_D; | 78 | c->D=RIPEMD160_D; |
| 83 | c->E=RIPEMD160_E; | 79 | c->E=RIPEMD160_E; |
| 84 | c->Nl=0; | ||
| 85 | c->Nh=0; | ||
| 86 | c->num=0; | ||
| 87 | return 1; | 80 | return 1; |
| 88 | } | 81 | } |
| 89 | 82 | ||
diff --git a/src/lib/libcrypto/ripemd/rmd_locl.h b/src/lib/libcrypto/ripemd/rmd_locl.h index ce12a8000e..f14b346e66 100644 --- a/src/lib/libcrypto/ripemd/rmd_locl.h +++ b/src/lib/libcrypto/ripemd/rmd_locl.h | |||
| @@ -72,7 +72,7 @@ | |||
| 72 | */ | 72 | */ |
| 73 | #ifdef RMD160_ASM | 73 | #ifdef RMD160_ASM |
| 74 | # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) | 74 | # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) |
| 75 | # define ripemd160_block_host_order ripemd160_block_asm_data_order | 75 | # define ripemd160_block_data_order ripemd160_block_asm_data_order |
| 76 | # endif | 76 | # endif |
| 77 | #endif | 77 | #endif |
| 78 | 78 | ||
diff --git a/src/lib/libcrypto/rsa/Makefile b/src/lib/libcrypto/rsa/Makefile index 7b1fd6428c..bb64223e05 100644 --- a/src/lib/libcrypto/rsa/Makefile +++ b/src/lib/libcrypto/rsa/Makefile | |||
| @@ -19,10 +19,12 @@ APPS= | |||
| 19 | LIB=$(TOP)/libcrypto.a | 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 \ | 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 \ | 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_x931g.c rsa_asn1.c rsa_depr.c rsa_eng.c | 22 | rsa_pss.c rsa_x931.c rsa_asn1.c rsa_depr.c rsa_ameth.c rsa_prn.c \ |
| 23 | rsa_pmeth.c | ||
| 23 | LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o \ | 24 | LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o \ |
| 24 | rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o rsa_chk.o rsa_null.o \ | 25 | rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o rsa_chk.o rsa_null.o \ |
| 25 | rsa_pss.o rsa_x931.o rsa_x931g.o rsa_asn1.o rsa_depr.o rsa_eng.o | 26 | rsa_pss.o rsa_x931.o rsa_asn1.o rsa_depr.o rsa_ameth.o rsa_prn.o \ |
| 27 | rsa_pmeth.o | ||
| 26 | 28 | ||
| 27 | SRC= $(LIBSRC) | 29 | SRC= $(LIBSRC) |
| 28 | 30 | ||
| @@ -37,7 +39,7 @@ top: | |||
| 37 | all: lib | 39 | all: lib |
| 38 | 40 | ||
| 39 | lib: $(LIBOBJ) | 41 | lib: $(LIBOBJ) |
| 40 | $(ARX) $(LIB) $(LIBOBJ) | 42 | $(AR) $(LIB) $(LIBOBJ) |
| 41 | $(RANLIB) $(LIB) || echo Never mind. | 43 | $(RANLIB) $(LIB) || echo Never mind. |
| 42 | @touch lib | 44 | @touch lib |
| 43 | 45 | ||
| @@ -78,6 +80,22 @@ clean: | |||
| 78 | 80 | ||
| 79 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 81 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 80 | 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 | ||
| 81 | rsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | 99 | rsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h |
| 82 | rsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | 100 | rsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h |
| 83 | rsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | 101 | rsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h |
| @@ -114,21 +132,6 @@ rsa_eay.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | |||
| 114 | rsa_eay.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 132 | rsa_eay.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h |
| 115 | rsa_eay.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 133 | rsa_eay.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 116 | rsa_eay.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_eay.c | 134 | rsa_eay.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_eay.c |
| 117 | rsa_eng.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 118 | rsa_eng.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 119 | rsa_eng.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 120 | rsa_eng.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 121 | rsa_eng.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 122 | rsa_eng.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 123 | rsa_eng.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | ||
| 124 | rsa_eng.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 125 | rsa_eng.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 126 | rsa_eng.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 127 | rsa_eng.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 128 | rsa_eng.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 129 | rsa_eng.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 130 | rsa_eng.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 131 | rsa_eng.o: ../../include/openssl/x509_vfy.h ../cryptlib.h rsa_eng.c | ||
| 132 | rsa_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 135 | rsa_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 133 | rsa_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 136 | rsa_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 134 | rsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | 137 | rsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h |
| @@ -151,15 +154,15 @@ rsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 151 | rsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 154 | rsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 152 | rsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 155 | rsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 153 | rsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | 156 | rsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h |
| 154 | rsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 157 | rsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 155 | rsa_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 158 | rsa_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 156 | rsa_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 159 | rsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 157 | rsa_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 160 | rsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 158 | rsa_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | 161 | rsa_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h |
| 159 | rsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 162 | rsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 160 | rsa_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 163 | rsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 161 | rsa_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 164 | rsa_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 162 | rsa_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h rsa_lib.c | 165 | rsa_lib.o: ../cryptlib.h rsa_lib.c |
| 163 | rsa_none.o: ../../e_os.h ../../include/openssl/asn1.h | 166 | rsa_none.o: ../../e_os.h ../../include/openssl/asn1.h |
| 164 | rsa_none.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 167 | rsa_none.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 165 | rsa_none.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 168 | rsa_none.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| @@ -182,9 +185,9 @@ rsa_oaep.o: ../../e_os.h ../../include/openssl/asn1.h | |||
| 182 | rsa_oaep.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 185 | rsa_oaep.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 183 | rsa_oaep.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 186 | rsa_oaep.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 184 | rsa_oaep.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 187 | rsa_oaep.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 185 | rsa_oaep.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 188 | rsa_oaep.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 186 | rsa_oaep.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 189 | rsa_oaep.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 187 | rsa_oaep.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 190 | rsa_oaep.o: ../../include/openssl/opensslconf.h |
| 188 | rsa_oaep.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 191 | rsa_oaep.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 189 | rsa_oaep.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 192 | rsa_oaep.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h |
| 190 | rsa_oaep.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 193 | rsa_oaep.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| @@ -199,27 +202,50 @@ rsa_pk1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | |||
| 199 | rsa_pk1.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 202 | rsa_pk1.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h |
| 200 | rsa_pk1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 203 | rsa_pk1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 201 | rsa_pk1.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pk1.c | 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 | ||
| 202 | rsa_pss.o: ../../e_os.h ../../include/openssl/asn1.h | 230 | rsa_pss.o: ../../e_os.h ../../include/openssl/asn1.h |
| 203 | rsa_pss.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 231 | rsa_pss.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 204 | rsa_pss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 232 | rsa_pss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 205 | rsa_pss.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 233 | rsa_pss.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 206 | rsa_pss.o: ../../include/openssl/evp.h ../../include/openssl/fips.h | 234 | rsa_pss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 207 | rsa_pss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | 235 | rsa_pss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 208 | rsa_pss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 236 | rsa_pss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 209 | rsa_pss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 237 | rsa_pss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h |
| 210 | rsa_pss.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 238 | rsa_pss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 211 | rsa_pss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 239 | rsa_pss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 212 | rsa_pss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 240 | rsa_pss.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pss.c |
| 213 | rsa_pss.o: ../cryptlib.h rsa_pss.c | ||
| 214 | rsa_saos.o: ../../e_os.h ../../include/openssl/asn1.h | 241 | rsa_saos.o: ../../e_os.h ../../include/openssl/asn1.h |
| 215 | rsa_saos.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 242 | rsa_saos.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 216 | rsa_saos.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 243 | rsa_saos.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 217 | rsa_saos.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 244 | rsa_saos.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 218 | rsa_saos.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 245 | rsa_saos.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 219 | rsa_saos.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 246 | rsa_saos.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 220 | rsa_saos.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 247 | rsa_saos.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 221 | rsa_saos.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 248 | rsa_saos.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 222 | rsa_saos.o: ../../include/openssl/opensslconf.h | ||
| 223 | rsa_saos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 249 | rsa_saos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 224 | rsa_saos.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | 250 | rsa_saos.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h |
| 225 | rsa_saos.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 251 | rsa_saos.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| @@ -232,15 +258,14 @@ rsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 232 | rsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | 258 | rsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h |
| 233 | rsa_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | 259 | rsa_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h |
| 234 | rsa_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 260 | rsa_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 235 | rsa_sign.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 261 | rsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 236 | rsa_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 262 | rsa_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 237 | rsa_sign.o: ../../include/openssl/opensslconf.h | ||
| 238 | rsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 263 | rsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 239 | rsa_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | 264 | rsa_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h |
| 240 | rsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 265 | rsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 241 | rsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 266 | rsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 242 | rsa_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 267 | rsa_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 243 | rsa_sign.o: ../cryptlib.h rsa_sign.c | 268 | rsa_sign.o: ../cryptlib.h rsa_locl.h rsa_sign.c |
| 244 | rsa_ssl.o: ../../e_os.h ../../include/openssl/asn1.h | 269 | rsa_ssl.o: ../../e_os.h ../../include/openssl/asn1.h |
| 245 | rsa_ssl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | 270 | rsa_ssl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 246 | rsa_ssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | 271 | rsa_ssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| @@ -260,11 +285,3 @@ rsa_x931.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | |||
| 260 | rsa_x931.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | 285 | rsa_x931.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h |
| 261 | rsa_x931.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 286 | rsa_x931.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 262 | rsa_x931.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_x931.c | 287 | rsa_x931.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_x931.c |
| 263 | rsa_x931g.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 264 | rsa_x931g.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 265 | rsa_x931g.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 266 | rsa_x931g.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 267 | rsa_x931g.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 268 | rsa_x931g.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 269 | rsa_x931g.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 270 | rsa_x931g.o: rsa_x931g.c | ||
diff --git a/src/lib/libcrypto/rsa/Makefile.ssl b/src/lib/libcrypto/rsa/Makefile.ssl deleted file mode 100644 index 8089344a04..0000000000 --- a/src/lib/libcrypto/rsa/Makefile.ssl +++ /dev/null | |||
| @@ -1,241 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/rsa/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= rsa | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST=rsa_test.c | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c \ | ||
| 27 | rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c rsa_chk.c rsa_null.c \ | ||
| 28 | rsa_asn1.c | ||
| 29 | LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o \ | ||
| 30 | rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o rsa_chk.o rsa_null.o \ | ||
| 31 | rsa_asn1.o | ||
| 32 | |||
| 33 | SRC= $(LIBSRC) | ||
| 34 | |||
| 35 | EXHEADER= rsa.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.ssl >> $(TOP)/MINFO | ||
| 52 | |||
| 53 | links: | ||
| 54 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 55 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 56 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 57 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 58 | |||
| 59 | install: | ||
| 60 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 76 | |||
| 77 | dclean: | ||
| 78 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 79 | mv -f Makefile.new $(MAKEFILE) | ||
| 80 | |||
| 81 | clean: | ||
| 82 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 83 | |||
| 84 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 85 | |||
| 86 | rsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 87 | rsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 88 | rsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 89 | rsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 90 | rsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 91 | rsa_asn1.o: ../../include/openssl/opensslconf.h | ||
| 92 | rsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 93 | rsa_asn1.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 94 | rsa_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 95 | rsa_asn1.o: ../cryptlib.h rsa_asn1.c | ||
| 96 | rsa_chk.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 97 | rsa_chk.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 98 | rsa_chk.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 99 | rsa_chk.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 100 | rsa_chk.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 101 | rsa_chk.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 102 | rsa_chk.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 103 | rsa_chk.o: rsa_chk.c | ||
| 104 | rsa_eay.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 105 | rsa_eay.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 106 | rsa_eay.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 107 | rsa_eay.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 108 | rsa_eay.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 109 | rsa_eay.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 110 | rsa_eay.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 111 | rsa_eay.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 112 | rsa_eay.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_eay.c | ||
| 113 | rsa_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 114 | rsa_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 115 | rsa_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 116 | rsa_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 117 | rsa_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 118 | rsa_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 119 | rsa_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 120 | rsa_err.o: rsa_err.c | ||
| 121 | rsa_gen.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 122 | rsa_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 123 | rsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 124 | rsa_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 125 | rsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 126 | rsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 127 | rsa_gen.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 128 | rsa_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 129 | rsa_gen.o: ../cryptlib.h rsa_gen.c | ||
| 130 | rsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 131 | rsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 132 | rsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 133 | rsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 134 | rsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
| 135 | rsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 136 | rsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 137 | rsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 138 | rsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 139 | rsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 140 | rsa_lib.o: ../../include/openssl/ui.h ../cryptlib.h rsa_lib.c | ||
| 141 | rsa_none.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 142 | rsa_none.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 143 | rsa_none.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 144 | rsa_none.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 145 | rsa_none.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 146 | rsa_none.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 147 | rsa_none.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 148 | rsa_none.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 149 | rsa_none.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_none.c | ||
| 150 | rsa_null.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 151 | rsa_null.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 152 | rsa_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 153 | rsa_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 154 | rsa_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 155 | rsa_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 156 | rsa_null.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 157 | rsa_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 158 | rsa_null.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_null.c | ||
| 159 | rsa_oaep.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 160 | rsa_oaep.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 161 | rsa_oaep.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 162 | rsa_oaep.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 163 | rsa_oaep.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 164 | rsa_oaep.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 165 | rsa_oaep.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 166 | rsa_oaep.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 167 | rsa_oaep.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 168 | rsa_oaep.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 169 | rsa_oaep.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 170 | rsa_oaep.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 171 | rsa_oaep.o: ../../include/openssl/opensslconf.h | ||
| 172 | rsa_oaep.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 173 | rsa_oaep.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 174 | rsa_oaep.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 175 | rsa_oaep.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 176 | rsa_oaep.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 177 | rsa_oaep.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 178 | rsa_oaep.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 179 | rsa_oaep.o: ../cryptlib.h rsa_oaep.c | ||
| 180 | rsa_pk1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 181 | rsa_pk1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 182 | rsa_pk1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 183 | rsa_pk1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 184 | rsa_pk1.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 185 | rsa_pk1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 186 | rsa_pk1.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 187 | rsa_pk1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 188 | rsa_pk1.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pk1.c | ||
| 189 | rsa_saos.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 190 | rsa_saos.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 191 | rsa_saos.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 192 | rsa_saos.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 193 | rsa_saos.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 194 | rsa_saos.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 195 | rsa_saos.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 196 | rsa_saos.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 197 | rsa_saos.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 198 | rsa_saos.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 199 | rsa_saos.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 200 | rsa_saos.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 201 | rsa_saos.o: ../../include/openssl/opensslconf.h | ||
| 202 | rsa_saos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 203 | rsa_saos.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 204 | rsa_saos.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 205 | rsa_saos.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 206 | rsa_saos.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 207 | rsa_saos.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 208 | rsa_saos.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 209 | rsa_saos.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 210 | rsa_saos.o: ../cryptlib.h rsa_saos.c | ||
| 211 | rsa_sign.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 212 | rsa_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 213 | rsa_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 214 | rsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 215 | rsa_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 216 | rsa_sign.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 217 | rsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 218 | rsa_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 219 | rsa_sign.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 220 | rsa_sign.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 221 | rsa_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 222 | rsa_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 223 | rsa_sign.o: ../../include/openssl/opensslconf.h | ||
| 224 | rsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 225 | rsa_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 226 | rsa_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 227 | rsa_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 228 | rsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 229 | rsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 230 | rsa_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 231 | rsa_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 232 | rsa_sign.o: ../cryptlib.h rsa_sign.c | ||
| 233 | rsa_ssl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 234 | rsa_ssl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 235 | rsa_ssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 236 | rsa_ssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 237 | rsa_ssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 238 | rsa_ssl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 239 | rsa_ssl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 240 | rsa_ssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 241 | rsa_ssl.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_ssl.c | ||
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h index 5bb932ae15..cf74343657 100644 --- a/src/lib/libcrypto/rsa/rsa.h +++ b/src/lib/libcrypto/rsa/rsa.h | |||
| @@ -74,25 +74,6 @@ | |||
| 74 | #error RSA is disabled. | 74 | #error RSA is disabled. |
| 75 | #endif | 75 | #endif |
| 76 | 76 | ||
| 77 | /* If this flag is set the RSA method is FIPS compliant and can be used | ||
| 78 | * in FIPS mode. This is set in the validated module method. If an | ||
| 79 | * application sets this flag in its own methods it is its reposibility | ||
| 80 | * to ensure the result is compliant. | ||
| 81 | */ | ||
| 82 | |||
| 83 | #define RSA_FLAG_FIPS_METHOD 0x0400 | ||
| 84 | |||
| 85 | /* If this flag is set the operations normally disabled in FIPS mode are | ||
| 86 | * permitted it is then the applications responsibility to ensure that the | ||
| 87 | * usage is compliant. | ||
| 88 | */ | ||
| 89 | |||
| 90 | #define RSA_FLAG_NON_FIPS_ALLOW 0x0400 | ||
| 91 | |||
| 92 | #ifdef OPENSSL_FIPS | ||
| 93 | #define FIPS_RSA_SIZE_T int | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #ifdef __cplusplus | 77 | #ifdef __cplusplus |
| 97 | extern "C" { | 78 | extern "C" { |
| 98 | #endif | 79 | #endif |
| @@ -136,7 +117,8 @@ struct rsa_meth_st | |||
| 136 | unsigned char *sigret, unsigned int *siglen, const RSA *rsa); | 117 | unsigned char *sigret, unsigned int *siglen, const RSA *rsa); |
| 137 | int (*rsa_verify)(int dtype, | 118 | int (*rsa_verify)(int dtype, |
| 138 | const unsigned char *m, unsigned int m_length, | 119 | const unsigned char *m, unsigned int m_length, |
| 139 | unsigned char *sigbuf, unsigned int siglen, const RSA *rsa); | 120 | const unsigned char *sigbuf, unsigned int siglen, |
| 121 | const RSA *rsa); | ||
| 140 | /* If this callback is NULL, the builtin software RSA key-gen will be used. This | 122 | /* If this callback is NULL, the builtin software RSA key-gen will be used. This |
| 141 | * is for behavioural compatibility whilst the code gets rewired, but one day | 123 | * is for behavioural compatibility whilst the code gets rewired, but one day |
| 142 | * it would be nice to assume there are no such things as "builtin software" | 124 | * it would be nice to assume there are no such things as "builtin software" |
| @@ -182,8 +164,6 @@ struct rsa_st | |||
| 182 | # define OPENSSL_RSA_MAX_MODULUS_BITS 16384 | 164 | # define OPENSSL_RSA_MAX_MODULUS_BITS 16384 |
| 183 | #endif | 165 | #endif |
| 184 | 166 | ||
| 185 | #define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024 | ||
| 186 | |||
| 187 | #ifndef OPENSSL_RSA_SMALL_MODULUS_BITS | 167 | #ifndef OPENSSL_RSA_SMALL_MODULUS_BITS |
| 188 | # define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 | 168 | # define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 |
| 189 | #endif | 169 | #endif |
| @@ -238,11 +218,37 @@ struct rsa_st | |||
| 238 | #endif | 218 | #endif |
| 239 | 219 | ||
| 240 | 220 | ||
| 221 | #define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \ | ||
| 222 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, EVP_PKEY_CTRL_RSA_PADDING, \ | ||
| 223 | pad, NULL) | ||
| 224 | |||
| 225 | #define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \ | ||
| 226 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \ | ||
| 227 | (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ | ||
| 228 | EVP_PKEY_CTRL_RSA_PSS_SALTLEN, \ | ||
| 229 | len, NULL) | ||
| 230 | |||
| 231 | #define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ | ||
| 232 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \ | ||
| 233 | EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL) | ||
| 234 | |||
| 235 | #define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \ | ||
| 236 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \ | ||
| 237 | EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp) | ||
| 238 | |||
| 239 | #define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) | ||
| 240 | #define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) | ||
| 241 | |||
| 242 | #define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) | ||
| 243 | #define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) | ||
| 244 | |||
| 241 | #define RSA_PKCS1_PADDING 1 | 245 | #define RSA_PKCS1_PADDING 1 |
| 242 | #define RSA_SSLV23_PADDING 2 | 246 | #define RSA_SSLV23_PADDING 2 |
| 243 | #define RSA_NO_PADDING 3 | 247 | #define RSA_NO_PADDING 3 |
| 244 | #define RSA_PKCS1_OAEP_PADDING 4 | 248 | #define RSA_PKCS1_OAEP_PADDING 4 |
| 245 | #define RSA_X931_PADDING 5 | 249 | #define RSA_X931_PADDING 5 |
| 250 | /* EVP_PKEY_ only */ | ||
| 251 | #define RSA_PKCS1_PSS_PADDING 6 | ||
| 246 | 252 | ||
| 247 | #define RSA_PKCS1_PADDING_SIZE 11 | 253 | #define RSA_PKCS1_PADDING_SIZE 11 |
| 248 | 254 | ||
| @@ -261,11 +267,6 @@ RSA * RSA_generate_key(int bits, unsigned long e,void | |||
| 261 | 267 | ||
| 262 | /* New version */ | 268 | /* New version */ |
| 263 | int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); | 269 | int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); |
| 264 | int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNUM *q2, | ||
| 265 | const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *Xp, | ||
| 266 | const BIGNUM *Xq1, const BIGNUM *Xq2, const BIGNUM *Xq, | ||
| 267 | const BIGNUM *e, BN_GENCB *cb); | ||
| 268 | int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB *cb); | ||
| 269 | 270 | ||
| 270 | int RSA_check_key(const RSA *); | 271 | int RSA_check_key(const RSA *); |
| 271 | /* next 4 return -1 on error */ | 272 | /* next 4 return -1 on error */ |
| @@ -283,11 +284,6 @@ int RSA_up_ref(RSA *r); | |||
| 283 | 284 | ||
| 284 | int RSA_flags(const RSA *r); | 285 | int RSA_flags(const RSA *r); |
| 285 | 286 | ||
| 286 | #ifdef OPENSSL_FIPS | ||
| 287 | RSA *FIPS_rsa_new(void); | ||
| 288 | void FIPS_rsa_free(RSA *r); | ||
| 289 | #endif | ||
| 290 | |||
| 291 | void RSA_set_default_method(const RSA_METHOD *meth); | 287 | void RSA_set_default_method(const RSA_METHOD *meth); |
| 292 | const RSA_METHOD *RSA_get_default_method(void); | 288 | const RSA_METHOD *RSA_get_default_method(void); |
| 293 | const RSA_METHOD *RSA_get_method(const RSA *rsa); | 289 | const RSA_METHOD *RSA_get_method(const RSA *rsa); |
| @@ -333,7 +329,7 @@ RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, | |||
| 333 | int RSA_sign(int type, const unsigned char *m, unsigned int m_length, | 329 | int RSA_sign(int type, const unsigned char *m, unsigned int m_length, |
| 334 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); | 330 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); |
| 335 | int RSA_verify(int type, const unsigned char *m, unsigned int m_length, | 331 | int RSA_verify(int type, const unsigned char *m, unsigned int m_length, |
| 336 | unsigned char *sigbuf, unsigned int siglen, RSA *rsa); | 332 | const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); |
| 337 | 333 | ||
| 338 | /* The following 2 function sign and verify a ASN1_OCTET_STRING | 334 | /* The following 2 function sign and verify a ASN1_OCTET_STRING |
| 339 | * object inside PKCS#1 padded RSA encryption */ | 335 | * object inside PKCS#1 padded RSA encryption */ |
| @@ -401,9 +397,15 @@ void ERR_load_RSA_strings(void); | |||
| 401 | /* Error codes for the RSA functions. */ | 397 | /* Error codes for the RSA functions. */ |
| 402 | 398 | ||
| 403 | /* Function codes. */ | 399 | /* Function codes. */ |
| 404 | #define RSA_F_FIPS_RSA_SIGN 140 | 400 | #define RSA_F_CHECK_PADDING_MD 140 |
| 405 | #define RSA_F_FIPS_RSA_VERIFY 141 | 401 | #define RSA_F_DO_RSA_PRINT 146 |
| 402 | #define RSA_F_INT_RSA_VERIFY 145 | ||
| 406 | #define RSA_F_MEMORY_LOCK 100 | 403 | #define RSA_F_MEMORY_LOCK 100 |
| 404 | #define RSA_F_OLD_RSA_PRIV_DECODE 147 | ||
| 405 | #define RSA_F_PKEY_RSA_CTRL 143 | ||
| 406 | #define RSA_F_PKEY_RSA_CTRL_STR 144 | ||
| 407 | #define RSA_F_PKEY_RSA_SIGN 142 | ||
| 408 | #define RSA_F_PKEY_RSA_VERIFYRECOVER 141 | ||
| 407 | #define RSA_F_RSA_BUILTIN_KEYGEN 129 | 409 | #define RSA_F_RSA_BUILTIN_KEYGEN 129 |
| 408 | #define RSA_F_RSA_CHECK_KEY 123 | 410 | #define RSA_F_RSA_CHECK_KEY 123 |
| 409 | #define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101 | 411 | #define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101 |
| @@ -434,11 +436,10 @@ void ERR_load_RSA_strings(void); | |||
| 434 | #define RSA_F_RSA_PADDING_CHECK_X931 128 | 436 | #define RSA_F_RSA_PADDING_CHECK_X931 128 |
| 435 | #define RSA_F_RSA_PRINT 115 | 437 | #define RSA_F_RSA_PRINT 115 |
| 436 | #define RSA_F_RSA_PRINT_FP 116 | 438 | #define RSA_F_RSA_PRINT_FP 116 |
| 437 | #define RSA_F_RSA_PRIVATE_ENCRYPT 137 | 439 | #define RSA_F_RSA_PRIV_DECODE 137 |
| 438 | #define RSA_F_RSA_PUBLIC_DECRYPT 138 | 440 | #define RSA_F_RSA_PRIV_ENCODE 138 |
| 441 | #define RSA_F_RSA_PUB_DECODE 139 | ||
| 439 | #define RSA_F_RSA_SETUP_BLINDING 136 | 442 | #define RSA_F_RSA_SETUP_BLINDING 136 |
| 440 | #define RSA_F_RSA_SET_DEFAULT_METHOD 139 | ||
| 441 | #define RSA_F_RSA_SET_METHOD 142 | ||
| 442 | #define RSA_F_RSA_SIGN 117 | 443 | #define RSA_F_RSA_SIGN 117 |
| 443 | #define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 | 444 | #define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 |
| 444 | #define RSA_F_RSA_VERIFY 119 | 445 | #define RSA_F_RSA_VERIFY 119 |
| @@ -464,20 +465,25 @@ void ERR_load_RSA_strings(void); | |||
| 464 | #define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 | 465 | #define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 |
| 465 | #define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 | 466 | #define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 |
| 466 | #define RSA_R_FIRST_OCTET_INVALID 133 | 467 | #define RSA_R_FIRST_OCTET_INVALID 133 |
| 468 | #define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 | ||
| 469 | #define RSA_R_INVALID_DIGEST_LENGTH 143 | ||
| 467 | #define RSA_R_INVALID_HEADER 137 | 470 | #define RSA_R_INVALID_HEADER 137 |
| 471 | #define RSA_R_INVALID_KEYBITS 145 | ||
| 468 | #define RSA_R_INVALID_MESSAGE_LENGTH 131 | 472 | #define RSA_R_INVALID_MESSAGE_LENGTH 131 |
| 469 | #define RSA_R_INVALID_PADDING 138 | 473 | #define RSA_R_INVALID_PADDING 138 |
| 474 | #define RSA_R_INVALID_PADDING_MODE 141 | ||
| 475 | #define RSA_R_INVALID_PSS_SALTLEN 146 | ||
| 470 | #define RSA_R_INVALID_TRAILER 139 | 476 | #define RSA_R_INVALID_TRAILER 139 |
| 477 | #define RSA_R_INVALID_X931_DIGEST 142 | ||
| 471 | #define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 | 478 | #define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 |
| 472 | #define RSA_R_KEY_SIZE_TOO_SMALL 120 | 479 | #define RSA_R_KEY_SIZE_TOO_SMALL 120 |
| 473 | #define RSA_R_LAST_OCTET_INVALID 134 | 480 | #define RSA_R_LAST_OCTET_INVALID 134 |
| 474 | #define RSA_R_MODULUS_TOO_LARGE 105 | 481 | #define RSA_R_MODULUS_TOO_LARGE 105 |
| 475 | #define RSA_R_NON_FIPS_METHOD 141 | ||
| 476 | #define RSA_R_NO_PUBLIC_EXPONENT 140 | 482 | #define RSA_R_NO_PUBLIC_EXPONENT 140 |
| 477 | #define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 | 483 | #define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 |
| 478 | #define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 | 484 | #define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 |
| 479 | #define RSA_R_OAEP_DECODING_ERROR 121 | 485 | #define RSA_R_OAEP_DECODING_ERROR 121 |
| 480 | #define RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE 142 | 486 | #define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 |
| 481 | #define RSA_R_PADDING_CHECK_FAILED 114 | 487 | #define RSA_R_PADDING_CHECK_FAILED 114 |
| 482 | #define RSA_R_P_NOT_PRIME 128 | 488 | #define RSA_R_P_NOT_PRIME 128 |
| 483 | #define RSA_R_Q_NOT_PRIME 129 | 489 | #define RSA_R_Q_NOT_PRIME 129 |
| @@ -488,6 +494,7 @@ void ERR_load_RSA_strings(void); | |||
| 488 | #define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 | 494 | #define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 |
| 489 | #define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 | 495 | #define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 |
| 490 | #define RSA_R_UNKNOWN_PADDING_TYPE 118 | 496 | #define RSA_R_UNKNOWN_PADDING_TYPE 118 |
| 497 | #define RSA_R_VALUE_MISSING 147 | ||
| 491 | #define RSA_R_WRONG_SIGNATURE_LENGTH 119 | 498 | #define RSA_R_WRONG_SIGNATURE_LENGTH 119 |
| 492 | 499 | ||
| 493 | #ifdef __cplusplus | 500 | #ifdef __cplusplus |
diff --git a/src/lib/libcrypto/rsa/rsa_asn1.c b/src/lib/libcrypto/rsa/rsa_asn1.c index 6e8a803e81..4efca8cdc8 100644 --- a/src/lib/libcrypto/rsa/rsa_asn1.c +++ b/src/lib/libcrypto/rsa/rsa_asn1.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -62,19 +62,9 @@ | |||
| 62 | #include <openssl/rsa.h> | 62 | #include <openssl/rsa.h> |
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | 64 | ||
| 65 | static ASN1_METHOD method={ | ||
| 66 | (I2D_OF(void)) i2d_RSAPrivateKey, | ||
| 67 | (D2I_OF(void)) d2i_RSAPrivateKey, | ||
| 68 | (void *(*)(void)) RSA_new, | ||
| 69 | (void (*)(void *)) RSA_free}; | ||
| 70 | |||
| 71 | ASN1_METHOD *RSAPrivateKey_asn1_meth(void) | ||
| 72 | { | ||
| 73 | return(&method); | ||
| 74 | } | ||
| 75 | |||
| 76 | /* Override the default free and new methods */ | 65 | /* Override the default free and new methods */ |
| 77 | static int rsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | 66 | static int rsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, |
| 67 | void *exarg) | ||
| 78 | { | 68 | { |
| 79 | if(operation == ASN1_OP_NEW_PRE) { | 69 | if(operation == ASN1_OP_NEW_PRE) { |
| 80 | *pval = (ASN1_VALUE *)RSA_new(); | 70 | *pval = (ASN1_VALUE *)RSA_new(); |
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index 04ec789ee9..c5eaeeae6b 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
| @@ -115,7 +115,7 @@ | |||
| 115 | #include <openssl/rsa.h> | 115 | #include <openssl/rsa.h> |
| 116 | #include <openssl/rand.h> | 116 | #include <openssl/rand.h> |
| 117 | 117 | ||
| 118 | #if !defined(RSA_NULL) && !defined(OPENSSL_FIPS) | 118 | #ifndef RSA_NULL |
| 119 | 119 | ||
| 120 | static int RSA_eay_public_encrypt(int flen, const unsigned char *from, | 120 | static int RSA_eay_public_encrypt(int flen, const unsigned char *from, |
| 121 | unsigned char *to, RSA *rsa,int padding); | 121 | unsigned char *to, RSA *rsa,int padding); |
| @@ -256,6 +256,7 @@ static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx) | |||
| 256 | { | 256 | { |
| 257 | BN_BLINDING *ret; | 257 | BN_BLINDING *ret; |
| 258 | int got_write_lock = 0; | 258 | int got_write_lock = 0; |
| 259 | CRYPTO_THREADID cur; | ||
| 259 | 260 | ||
| 260 | CRYPTO_r_lock(CRYPTO_LOCK_RSA); | 261 | CRYPTO_r_lock(CRYPTO_LOCK_RSA); |
| 261 | 262 | ||
| @@ -273,7 +274,8 @@ static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx) | |||
| 273 | if (ret == NULL) | 274 | if (ret == NULL) |
| 274 | goto err; | 275 | goto err; |
| 275 | 276 | ||
| 276 | if (BN_BLINDING_get_thread_id(ret) == CRYPTO_thread_id()) | 277 | CRYPTO_THREADID_current(&cur); |
| 278 | if (!CRYPTO_THREADID_cmp(&cur, BN_BLINDING_thread_id(ret))) | ||
| 277 | { | 279 | { |
| 278 | /* rsa->blinding is ours! */ | 280 | /* rsa->blinding is ours! */ |
| 279 | 281 | ||
| @@ -353,28 +355,6 @@ static int RSA_eay_private_encrypt(int flen, const unsigned char *from, | |||
| 353 | int local_blinding = 0; | 355 | int local_blinding = 0; |
| 354 | BN_BLINDING *blinding = NULL; | 356 | BN_BLINDING *blinding = NULL; |
| 355 | 357 | ||
| 356 | if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS) | ||
| 357 | { | ||
| 358 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_MODULUS_TOO_LARGE); | ||
| 359 | return -1; | ||
| 360 | } | ||
| 361 | |||
| 362 | if (BN_ucmp(rsa->n, rsa->e) <= 0) | ||
| 363 | { | ||
| 364 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_BAD_E_VALUE); | ||
| 365 | return -1; | ||
| 366 | } | ||
| 367 | |||
| 368 | /* for large moduli, enforce exponent limit */ | ||
| 369 | if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS) | ||
| 370 | { | ||
| 371 | if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS) | ||
| 372 | { | ||
| 373 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_BAD_E_VALUE); | ||
| 374 | return -1; | ||
| 375 | } | ||
| 376 | } | ||
| 377 | |||
| 378 | if ((ctx=BN_CTX_new()) == NULL) goto err; | 358 | if ((ctx=BN_CTX_new()) == NULL) goto err; |
| 379 | BN_CTX_start(ctx); | 359 | BN_CTX_start(ctx); |
| 380 | f = BN_CTX_get(ctx); | 360 | f = BN_CTX_get(ctx); |
diff --git a/src/lib/libcrypto/rsa/rsa_eng.c b/src/lib/libcrypto/rsa/rsa_eng.c deleted file mode 100644 index 383a7045b2..0000000000 --- a/src/lib/libcrypto/rsa/rsa_eng.c +++ /dev/null | |||
| @@ -1,348 +0,0 @@ | |||
| 1 | /* crypto/rsa/rsa_lib.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/crypto.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/lhash.h> | ||
| 63 | #include <openssl/bn.h> | ||
| 64 | #include <openssl/rsa.h> | ||
| 65 | #include <openssl/rand.h> | ||
| 66 | #ifndef OPENSSL_NO_ENGINE | ||
| 67 | #include <openssl/engine.h> | ||
| 68 | #endif | ||
| 69 | |||
| 70 | const char RSA_version[]="RSA" OPENSSL_VERSION_PTEXT; | ||
| 71 | |||
| 72 | static const RSA_METHOD *default_RSA_meth=NULL; | ||
| 73 | |||
| 74 | RSA *RSA_new(void) | ||
| 75 | { | ||
| 76 | RSA *r=RSA_new_method(NULL); | ||
| 77 | |||
| 78 | return r; | ||
| 79 | } | ||
| 80 | |||
| 81 | void RSA_set_default_method(const RSA_METHOD *meth) | ||
| 82 | { | ||
| 83 | #ifdef OPENSSL_FIPS | ||
| 84 | if (FIPS_mode() && !(meth->flags & RSA_FLAG_FIPS_METHOD)) | ||
| 85 | { | ||
| 86 | RSAerr(RSA_F_RSA_SET_DEFAULT_METHOD, RSA_R_NON_FIPS_METHOD); | ||
| 87 | return; | ||
| 88 | } | ||
| 89 | #endif | ||
| 90 | default_RSA_meth = meth; | ||
| 91 | } | ||
| 92 | |||
| 93 | const RSA_METHOD *RSA_get_default_method(void) | ||
| 94 | { | ||
| 95 | if (default_RSA_meth == NULL) | ||
| 96 | { | ||
| 97 | #ifdef RSA_NULL | ||
| 98 | default_RSA_meth=RSA_null_method(); | ||
| 99 | #else | ||
| 100 | #if 0 /* was: #ifdef RSAref */ | ||
| 101 | default_RSA_meth=RSA_PKCS1_RSAref(); | ||
| 102 | #else | ||
| 103 | default_RSA_meth=RSA_PKCS1_SSLeay(); | ||
| 104 | #endif | ||
| 105 | #endif | ||
| 106 | } | ||
| 107 | |||
| 108 | return default_RSA_meth; | ||
| 109 | } | ||
| 110 | |||
| 111 | const RSA_METHOD *RSA_get_method(const RSA *rsa) | ||
| 112 | { | ||
| 113 | return rsa->meth; | ||
| 114 | } | ||
| 115 | |||
| 116 | int RSA_set_method(RSA *rsa, const RSA_METHOD *meth) | ||
| 117 | { | ||
| 118 | /* NB: The caller is specifically setting a method, so it's not up to us | ||
| 119 | * to deal with which ENGINE it comes from. */ | ||
| 120 | const RSA_METHOD *mtmp; | ||
| 121 | #ifdef OPENSSL_FIPS | ||
| 122 | if (FIPS_mode() && !(meth->flags & RSA_FLAG_FIPS_METHOD)) | ||
| 123 | { | ||
| 124 | RSAerr(RSA_F_RSA_SET_METHOD, RSA_R_NON_FIPS_METHOD); | ||
| 125 | return 0; | ||
| 126 | } | ||
| 127 | #endif | ||
| 128 | mtmp = rsa->meth; | ||
| 129 | if (mtmp->finish) mtmp->finish(rsa); | ||
| 130 | #ifndef OPENSSL_NO_ENGINE | ||
| 131 | if (rsa->engine) | ||
| 132 | { | ||
| 133 | ENGINE_finish(rsa->engine); | ||
| 134 | rsa->engine = NULL; | ||
| 135 | } | ||
| 136 | #endif | ||
| 137 | rsa->meth = meth; | ||
| 138 | if (meth->init) meth->init(rsa); | ||
| 139 | return 1; | ||
| 140 | } | ||
| 141 | |||
| 142 | RSA *RSA_new_method(ENGINE *engine) | ||
| 143 | { | ||
| 144 | RSA *ret; | ||
| 145 | |||
| 146 | ret=(RSA *)OPENSSL_malloc(sizeof(RSA)); | ||
| 147 | if (ret == NULL) | ||
| 148 | { | ||
| 149 | RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); | ||
| 150 | return NULL; | ||
| 151 | } | ||
| 152 | |||
| 153 | ret->meth = RSA_get_default_method(); | ||
| 154 | #ifndef OPENSSL_NO_ENGINE | ||
| 155 | if (engine) | ||
| 156 | { | ||
| 157 | if (!ENGINE_init(engine)) | ||
| 158 | { | ||
| 159 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); | ||
| 160 | OPENSSL_free(ret); | ||
| 161 | return NULL; | ||
| 162 | } | ||
| 163 | ret->engine = engine; | ||
| 164 | } | ||
| 165 | else | ||
| 166 | ret->engine = ENGINE_get_default_RSA(); | ||
| 167 | if(ret->engine) | ||
| 168 | { | ||
| 169 | ret->meth = ENGINE_get_RSA(ret->engine); | ||
| 170 | if(!ret->meth) | ||
| 171 | { | ||
| 172 | RSAerr(RSA_F_RSA_NEW_METHOD, | ||
| 173 | ERR_R_ENGINE_LIB); | ||
| 174 | ENGINE_finish(ret->engine); | ||
| 175 | OPENSSL_free(ret); | ||
| 176 | return NULL; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | #endif | ||
| 180 | #ifdef OPENSSL_FIPS | ||
| 181 | if (FIPS_mode() && !(ret->meth->flags & RSA_FLAG_FIPS_METHOD)) | ||
| 182 | { | ||
| 183 | RSAerr(RSA_F_RSA_NEW_METHOD, RSA_R_NON_FIPS_METHOD); | ||
| 184 | #ifndef OPENSSL_NO_ENGINE | ||
| 185 | if (ret->engine) | ||
| 186 | ENGINE_finish(ret->engine); | ||
| 187 | #endif | ||
| 188 | OPENSSL_free(ret); | ||
| 189 | return NULL; | ||
| 190 | } | ||
| 191 | #endif | ||
| 192 | |||
| 193 | ret->pad=0; | ||
| 194 | ret->version=0; | ||
| 195 | ret->n=NULL; | ||
| 196 | ret->e=NULL; | ||
| 197 | ret->d=NULL; | ||
| 198 | ret->p=NULL; | ||
| 199 | ret->q=NULL; | ||
| 200 | ret->dmp1=NULL; | ||
| 201 | ret->dmq1=NULL; | ||
| 202 | ret->iqmp=NULL; | ||
| 203 | ret->references=1; | ||
| 204 | ret->_method_mod_n=NULL; | ||
| 205 | ret->_method_mod_p=NULL; | ||
| 206 | ret->_method_mod_q=NULL; | ||
| 207 | ret->blinding=NULL; | ||
| 208 | ret->mt_blinding=NULL; | ||
| 209 | ret->bignum_data=NULL; | ||
| 210 | ret->flags=ret->meth->flags; | ||
| 211 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); | ||
| 212 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) | ||
| 213 | { | ||
| 214 | #ifndef OPENSSL_NO_ENGINE | ||
| 215 | if (ret->engine) | ||
| 216 | ENGINE_finish(ret->engine); | ||
| 217 | #endif | ||
| 218 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); | ||
| 219 | OPENSSL_free(ret); | ||
| 220 | ret=NULL; | ||
| 221 | } | ||
| 222 | return(ret); | ||
| 223 | } | ||
| 224 | |||
| 225 | void RSA_free(RSA *r) | ||
| 226 | { | ||
| 227 | int i; | ||
| 228 | |||
| 229 | if (r == NULL) return; | ||
| 230 | |||
| 231 | i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_RSA); | ||
| 232 | #ifdef REF_PRINT | ||
| 233 | REF_PRINT("RSA",r); | ||
| 234 | #endif | ||
| 235 | if (i > 0) return; | ||
| 236 | #ifdef REF_CHECK | ||
| 237 | if (i < 0) | ||
| 238 | { | ||
| 239 | fprintf(stderr,"RSA_free, bad reference count\n"); | ||
| 240 | abort(); | ||
| 241 | } | ||
| 242 | #endif | ||
| 243 | |||
| 244 | if (r->meth->finish) | ||
| 245 | r->meth->finish(r); | ||
| 246 | #ifndef OPENSSL_NO_ENGINE | ||
| 247 | if (r->engine) | ||
| 248 | ENGINE_finish(r->engine); | ||
| 249 | #endif | ||
| 250 | |||
| 251 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data); | ||
| 252 | |||
| 253 | if (r->n != NULL) BN_clear_free(r->n); | ||
| 254 | if (r->e != NULL) BN_clear_free(r->e); | ||
| 255 | if (r->d != NULL) BN_clear_free(r->d); | ||
| 256 | if (r->p != NULL) BN_clear_free(r->p); | ||
| 257 | if (r->q != NULL) BN_clear_free(r->q); | ||
| 258 | if (r->dmp1 != NULL) BN_clear_free(r->dmp1); | ||
| 259 | if (r->dmq1 != NULL) BN_clear_free(r->dmq1); | ||
| 260 | if (r->iqmp != NULL) BN_clear_free(r->iqmp); | ||
| 261 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); | ||
| 262 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); | ||
| 263 | if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); | ||
| 264 | OPENSSL_free(r); | ||
| 265 | } | ||
| 266 | |||
| 267 | int RSA_up_ref(RSA *r) | ||
| 268 | { | ||
| 269 | int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA); | ||
| 270 | #ifdef REF_PRINT | ||
| 271 | REF_PRINT("RSA",r); | ||
| 272 | #endif | ||
| 273 | #ifdef REF_CHECK | ||
| 274 | if (i < 2) | ||
| 275 | { | ||
| 276 | fprintf(stderr, "RSA_up_ref, bad reference count\n"); | ||
| 277 | abort(); | ||
| 278 | } | ||
| 279 | #endif | ||
| 280 | return ((i > 1) ? 1 : 0); | ||
| 281 | } | ||
| 282 | |||
| 283 | int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | ||
| 284 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | ||
| 285 | { | ||
| 286 | return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, argl, argp, | ||
| 287 | new_func, dup_func, free_func); | ||
| 288 | } | ||
| 289 | |||
| 290 | int RSA_set_ex_data(RSA *r, int idx, void *arg) | ||
| 291 | { | ||
| 292 | return(CRYPTO_set_ex_data(&r->ex_data,idx,arg)); | ||
| 293 | } | ||
| 294 | |||
| 295 | void *RSA_get_ex_data(const RSA *r, int idx) | ||
| 296 | { | ||
| 297 | return(CRYPTO_get_ex_data(&r->ex_data,idx)); | ||
| 298 | } | ||
| 299 | |||
| 300 | int RSA_flags(const RSA *r) | ||
| 301 | { | ||
| 302 | return((r == NULL)?0:r->meth->flags); | ||
| 303 | } | ||
| 304 | |||
| 305 | int RSA_memory_lock(RSA *r) | ||
| 306 | { | ||
| 307 | int i,j,k,off; | ||
| 308 | char *p; | ||
| 309 | BIGNUM *bn,**t[6],*b; | ||
| 310 | BN_ULONG *ul; | ||
| 311 | |||
| 312 | if (r->d == NULL) return(1); | ||
| 313 | t[0]= &r->d; | ||
| 314 | t[1]= &r->p; | ||
| 315 | t[2]= &r->q; | ||
| 316 | t[3]= &r->dmp1; | ||
| 317 | t[4]= &r->dmq1; | ||
| 318 | t[5]= &r->iqmp; | ||
| 319 | k=sizeof(BIGNUM)*6; | ||
| 320 | off=k/sizeof(BN_ULONG)+1; | ||
| 321 | j=1; | ||
| 322 | for (i=0; i<6; i++) | ||
| 323 | j+= (*t[i])->top; | ||
| 324 | if ((p=OPENSSL_malloc_locked((off+j)*sizeof(BN_ULONG))) == NULL) | ||
| 325 | { | ||
| 326 | RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE); | ||
| 327 | return(0); | ||
| 328 | } | ||
| 329 | bn=(BIGNUM *)p; | ||
| 330 | ul=(BN_ULONG *)&(p[off]); | ||
| 331 | for (i=0; i<6; i++) | ||
| 332 | { | ||
| 333 | b= *(t[i]); | ||
| 334 | *(t[i])= &(bn[i]); | ||
| 335 | memcpy((char *)&(bn[i]),(char *)b,sizeof(BIGNUM)); | ||
| 336 | bn[i].flags=BN_FLG_STATIC_DATA; | ||
| 337 | bn[i].d=ul; | ||
| 338 | memcpy((char *)ul,b->d,sizeof(BN_ULONG)*b->top); | ||
| 339 | ul+=b->top; | ||
| 340 | BN_clear_free(b); | ||
| 341 | } | ||
| 342 | |||
| 343 | /* I should fix this so it can still be done */ | ||
| 344 | r->flags&= ~(RSA_FLAG_CACHE_PRIVATE|RSA_FLAG_CACHE_PUBLIC); | ||
| 345 | |||
| 346 | r->bignum_data=p; | ||
| 347 | return(1); | ||
| 348 | } | ||
diff --git a/src/lib/libcrypto/rsa/rsa_err.c b/src/lib/libcrypto/rsa/rsa_err.c index 501f5ea389..cf9f1106b0 100644 --- a/src/lib/libcrypto/rsa/rsa_err.c +++ b/src/lib/libcrypto/rsa/rsa_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/rsa/rsa_err.c */ | 1 | /* crypto/rsa/rsa_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -70,9 +70,15 @@ | |||
| 70 | 70 | ||
| 71 | static ERR_STRING_DATA RSA_str_functs[]= | 71 | static ERR_STRING_DATA RSA_str_functs[]= |
| 72 | { | 72 | { |
| 73 | {ERR_FUNC(RSA_F_FIPS_RSA_SIGN), "FIPS_RSA_SIGN"}, | 73 | {ERR_FUNC(RSA_F_CHECK_PADDING_MD), "CHECK_PADDING_MD"}, |
| 74 | {ERR_FUNC(RSA_F_FIPS_RSA_VERIFY), "FIPS_RSA_VERIFY"}, | 74 | {ERR_FUNC(RSA_F_DO_RSA_PRINT), "DO_RSA_PRINT"}, |
| 75 | {ERR_FUNC(RSA_F_INT_RSA_VERIFY), "INT_RSA_VERIFY"}, | ||
| 75 | {ERR_FUNC(RSA_F_MEMORY_LOCK), "MEMORY_LOCK"}, | 76 | {ERR_FUNC(RSA_F_MEMORY_LOCK), "MEMORY_LOCK"}, |
| 77 | {ERR_FUNC(RSA_F_OLD_RSA_PRIV_DECODE), "OLD_RSA_PRIV_DECODE"}, | ||
| 78 | {ERR_FUNC(RSA_F_PKEY_RSA_CTRL), "PKEY_RSA_CTRL"}, | ||
| 79 | {ERR_FUNC(RSA_F_PKEY_RSA_CTRL_STR), "PKEY_RSA_CTRL_STR"}, | ||
| 80 | {ERR_FUNC(RSA_F_PKEY_RSA_SIGN), "PKEY_RSA_SIGN"}, | ||
| 81 | {ERR_FUNC(RSA_F_PKEY_RSA_VERIFYRECOVER), "PKEY_RSA_VERIFYRECOVER"}, | ||
| 76 | {ERR_FUNC(RSA_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"}, | 82 | {ERR_FUNC(RSA_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"}, |
| 77 | {ERR_FUNC(RSA_F_RSA_CHECK_KEY), "RSA_check_key"}, | 83 | {ERR_FUNC(RSA_F_RSA_CHECK_KEY), "RSA_check_key"}, |
| 78 | {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"}, | 84 | {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"}, |
| @@ -103,11 +109,10 @@ static ERR_STRING_DATA RSA_str_functs[]= | |||
| 103 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_X931), "RSA_padding_check_X931"}, | 109 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_X931), "RSA_padding_check_X931"}, |
| 104 | {ERR_FUNC(RSA_F_RSA_PRINT), "RSA_print"}, | 110 | {ERR_FUNC(RSA_F_RSA_PRINT), "RSA_print"}, |
| 105 | {ERR_FUNC(RSA_F_RSA_PRINT_FP), "RSA_print_fp"}, | 111 | {ERR_FUNC(RSA_F_RSA_PRINT_FP), "RSA_print_fp"}, |
| 106 | {ERR_FUNC(RSA_F_RSA_PRIVATE_ENCRYPT), "RSA_private_encrypt"}, | 112 | {ERR_FUNC(RSA_F_RSA_PRIV_DECODE), "RSA_PRIV_DECODE"}, |
| 107 | {ERR_FUNC(RSA_F_RSA_PUBLIC_DECRYPT), "RSA_public_decrypt"}, | 113 | {ERR_FUNC(RSA_F_RSA_PRIV_ENCODE), "RSA_PRIV_ENCODE"}, |
| 114 | {ERR_FUNC(RSA_F_RSA_PUB_DECODE), "RSA_PUB_DECODE"}, | ||
| 108 | {ERR_FUNC(RSA_F_RSA_SETUP_BLINDING), "RSA_setup_blinding"}, | 115 | {ERR_FUNC(RSA_F_RSA_SETUP_BLINDING), "RSA_setup_blinding"}, |
| 109 | {ERR_FUNC(RSA_F_RSA_SET_DEFAULT_METHOD), "RSA_set_default_method"}, | ||
| 110 | {ERR_FUNC(RSA_F_RSA_SET_METHOD), "RSA_set_method"}, | ||
| 111 | {ERR_FUNC(RSA_F_RSA_SIGN), "RSA_sign"}, | 116 | {ERR_FUNC(RSA_F_RSA_SIGN), "RSA_sign"}, |
| 112 | {ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"}, | 117 | {ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"}, |
| 113 | {ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"}, | 118 | {ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"}, |
| @@ -136,20 +141,25 @@ static ERR_STRING_DATA RSA_str_reasons[]= | |||
| 136 | {ERR_REASON(RSA_R_DMQ1_NOT_CONGRUENT_TO_D),"dmq1 not congruent to d"}, | 141 | {ERR_REASON(RSA_R_DMQ1_NOT_CONGRUENT_TO_D),"dmq1 not congruent to d"}, |
| 137 | {ERR_REASON(RSA_R_D_E_NOT_CONGRUENT_TO_1),"d e not congruent to 1"}, | 142 | {ERR_REASON(RSA_R_D_E_NOT_CONGRUENT_TO_1),"d e not congruent to 1"}, |
| 138 | {ERR_REASON(RSA_R_FIRST_OCTET_INVALID) ,"first octet invalid"}, | 143 | {ERR_REASON(RSA_R_FIRST_OCTET_INVALID) ,"first octet invalid"}, |
| 144 | {ERR_REASON(RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE),"illegal or unsupported padding mode"}, | ||
| 145 | {ERR_REASON(RSA_R_INVALID_DIGEST_LENGTH) ,"invalid digest length"}, | ||
| 139 | {ERR_REASON(RSA_R_INVALID_HEADER) ,"invalid header"}, | 146 | {ERR_REASON(RSA_R_INVALID_HEADER) ,"invalid header"}, |
| 147 | {ERR_REASON(RSA_R_INVALID_KEYBITS) ,"invalid keybits"}, | ||
| 140 | {ERR_REASON(RSA_R_INVALID_MESSAGE_LENGTH),"invalid message length"}, | 148 | {ERR_REASON(RSA_R_INVALID_MESSAGE_LENGTH),"invalid message length"}, |
| 141 | {ERR_REASON(RSA_R_INVALID_PADDING) ,"invalid padding"}, | 149 | {ERR_REASON(RSA_R_INVALID_PADDING) ,"invalid padding"}, |
| 150 | {ERR_REASON(RSA_R_INVALID_PADDING_MODE) ,"invalid padding mode"}, | ||
| 151 | {ERR_REASON(RSA_R_INVALID_PSS_SALTLEN) ,"invalid pss saltlen"}, | ||
| 142 | {ERR_REASON(RSA_R_INVALID_TRAILER) ,"invalid trailer"}, | 152 | {ERR_REASON(RSA_R_INVALID_TRAILER) ,"invalid trailer"}, |
| 153 | {ERR_REASON(RSA_R_INVALID_X931_DIGEST) ,"invalid x931 digest"}, | ||
| 143 | {ERR_REASON(RSA_R_IQMP_NOT_INVERSE_OF_Q) ,"iqmp not inverse of q"}, | 154 | {ERR_REASON(RSA_R_IQMP_NOT_INVERSE_OF_Q) ,"iqmp not inverse of q"}, |
| 144 | {ERR_REASON(RSA_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, | 155 | {ERR_REASON(RSA_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, |
| 145 | {ERR_REASON(RSA_R_LAST_OCTET_INVALID) ,"last octet invalid"}, | 156 | {ERR_REASON(RSA_R_LAST_OCTET_INVALID) ,"last octet invalid"}, |
| 146 | {ERR_REASON(RSA_R_MODULUS_TOO_LARGE) ,"modulus too large"}, | 157 | {ERR_REASON(RSA_R_MODULUS_TOO_LARGE) ,"modulus too large"}, |
| 147 | {ERR_REASON(RSA_R_NON_FIPS_METHOD) ,"non fips method"}, | ||
| 148 | {ERR_REASON(RSA_R_NO_PUBLIC_EXPONENT) ,"no public exponent"}, | 158 | {ERR_REASON(RSA_R_NO_PUBLIC_EXPONENT) ,"no public exponent"}, |
| 149 | {ERR_REASON(RSA_R_NULL_BEFORE_BLOCK_MISSING),"null before block missing"}, | 159 | {ERR_REASON(RSA_R_NULL_BEFORE_BLOCK_MISSING),"null before block missing"}, |
| 150 | {ERR_REASON(RSA_R_N_DOES_NOT_EQUAL_P_Q) ,"n does not equal p q"}, | 160 | {ERR_REASON(RSA_R_N_DOES_NOT_EQUAL_P_Q) ,"n does not equal p q"}, |
| 151 | {ERR_REASON(RSA_R_OAEP_DECODING_ERROR) ,"oaep decoding error"}, | 161 | {ERR_REASON(RSA_R_OAEP_DECODING_ERROR) ,"oaep decoding error"}, |
| 152 | {ERR_REASON(RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE),"operation not allowed in fips mode"}, | 162 | {ERR_REASON(RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE),"operation not supported for this keytype"}, |
| 153 | {ERR_REASON(RSA_R_PADDING_CHECK_FAILED) ,"padding check failed"}, | 163 | {ERR_REASON(RSA_R_PADDING_CHECK_FAILED) ,"padding check failed"}, |
| 154 | {ERR_REASON(RSA_R_P_NOT_PRIME) ,"p not prime"}, | 164 | {ERR_REASON(RSA_R_P_NOT_PRIME) ,"p not prime"}, |
| 155 | {ERR_REASON(RSA_R_Q_NOT_PRIME) ,"q not prime"}, | 165 | {ERR_REASON(RSA_R_Q_NOT_PRIME) ,"q not prime"}, |
| @@ -160,6 +170,7 @@ static ERR_STRING_DATA RSA_str_reasons[]= | |||
| 160 | {ERR_REASON(RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"the asn1 object identifier is not known for this md"}, | 170 | {ERR_REASON(RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"the asn1 object identifier is not known for this md"}, |
| 161 | {ERR_REASON(RSA_R_UNKNOWN_ALGORITHM_TYPE),"unknown algorithm type"}, | 171 | {ERR_REASON(RSA_R_UNKNOWN_ALGORITHM_TYPE),"unknown algorithm type"}, |
| 162 | {ERR_REASON(RSA_R_UNKNOWN_PADDING_TYPE) ,"unknown padding type"}, | 172 | {ERR_REASON(RSA_R_UNKNOWN_PADDING_TYPE) ,"unknown padding type"}, |
| 173 | {ERR_REASON(RSA_R_VALUE_MISSING) ,"value missing"}, | ||
| 163 | {ERR_REASON(RSA_R_WRONG_SIGNATURE_LENGTH),"wrong signature length"}, | 174 | {ERR_REASON(RSA_R_WRONG_SIGNATURE_LENGTH),"wrong signature length"}, |
| 164 | {0,NULL} | 175 | {0,NULL} |
| 165 | }; | 176 | }; |
diff --git a/src/lib/libcrypto/rsa/rsa_gen.c b/src/lib/libcrypto/rsa/rsa_gen.c index 41278f83c6..767f7ab682 100644 --- a/src/lib/libcrypto/rsa/rsa_gen.c +++ b/src/lib/libcrypto/rsa/rsa_gen.c | |||
| @@ -68,8 +68,6 @@ | |||
| 68 | #include <openssl/bn.h> | 68 | #include <openssl/bn.h> |
| 69 | #include <openssl/rsa.h> | 69 | #include <openssl/rsa.h> |
| 70 | 70 | ||
| 71 | #ifndef OPENSSL_FIPS | ||
| 72 | |||
| 73 | static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb); | 71 | static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb); |
| 74 | 72 | ||
| 75 | /* NB: this wrapper would normally be placed in rsa_lib.c and the static | 73 | /* NB: this wrapper would normally be placed in rsa_lib.c and the static |
| @@ -219,4 +217,3 @@ err: | |||
| 219 | return ok; | 217 | return ok; |
| 220 | } | 218 | } |
| 221 | 219 | ||
| 222 | #endif | ||
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 5714841f4c..de45088d76 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
| @@ -67,6 +67,224 @@ | |||
| 67 | #include <openssl/engine.h> | 67 | #include <openssl/engine.h> |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | const char RSA_version[]="RSA" OPENSSL_VERSION_PTEXT; | ||
| 71 | |||
| 72 | static const RSA_METHOD *default_RSA_meth=NULL; | ||
| 73 | |||
| 74 | RSA *RSA_new(void) | ||
| 75 | { | ||
| 76 | RSA *r=RSA_new_method(NULL); | ||
| 77 | |||
| 78 | return r; | ||
| 79 | } | ||
| 80 | |||
| 81 | void RSA_set_default_method(const RSA_METHOD *meth) | ||
| 82 | { | ||
| 83 | default_RSA_meth = meth; | ||
| 84 | } | ||
| 85 | |||
| 86 | const RSA_METHOD *RSA_get_default_method(void) | ||
| 87 | { | ||
| 88 | if (default_RSA_meth == NULL) | ||
| 89 | { | ||
| 90 | #ifdef RSA_NULL | ||
| 91 | default_RSA_meth=RSA_null_method(); | ||
| 92 | #else | ||
| 93 | #if 0 /* was: #ifdef RSAref */ | ||
| 94 | default_RSA_meth=RSA_PKCS1_RSAref(); | ||
| 95 | #else | ||
| 96 | default_RSA_meth=RSA_PKCS1_SSLeay(); | ||
| 97 | #endif | ||
| 98 | #endif | ||
| 99 | } | ||
| 100 | |||
| 101 | return default_RSA_meth; | ||
| 102 | } | ||
| 103 | |||
| 104 | const RSA_METHOD *RSA_get_method(const RSA *rsa) | ||
| 105 | { | ||
| 106 | return rsa->meth; | ||
| 107 | } | ||
| 108 | |||
| 109 | int RSA_set_method(RSA *rsa, const RSA_METHOD *meth) | ||
| 110 | { | ||
| 111 | /* NB: The caller is specifically setting a method, so it's not up to us | ||
| 112 | * to deal with which ENGINE it comes from. */ | ||
| 113 | const RSA_METHOD *mtmp; | ||
| 114 | mtmp = rsa->meth; | ||
| 115 | if (mtmp->finish) mtmp->finish(rsa); | ||
| 116 | #ifndef OPENSSL_NO_ENGINE | ||
| 117 | if (rsa->engine) | ||
| 118 | { | ||
| 119 | ENGINE_finish(rsa->engine); | ||
| 120 | rsa->engine = NULL; | ||
| 121 | } | ||
| 122 | #endif | ||
| 123 | rsa->meth = meth; | ||
| 124 | if (meth->init) meth->init(rsa); | ||
| 125 | return 1; | ||
| 126 | } | ||
| 127 | |||
| 128 | RSA *RSA_new_method(ENGINE *engine) | ||
| 129 | { | ||
| 130 | RSA *ret; | ||
| 131 | |||
| 132 | ret=(RSA *)OPENSSL_malloc(sizeof(RSA)); | ||
| 133 | if (ret == NULL) | ||
| 134 | { | ||
| 135 | RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE); | ||
| 136 | return NULL; | ||
| 137 | } | ||
| 138 | |||
| 139 | ret->meth = RSA_get_default_method(); | ||
| 140 | #ifndef OPENSSL_NO_ENGINE | ||
| 141 | if (engine) | ||
| 142 | { | ||
| 143 | if (!ENGINE_init(engine)) | ||
| 144 | { | ||
| 145 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); | ||
| 146 | OPENSSL_free(ret); | ||
| 147 | return NULL; | ||
| 148 | } | ||
| 149 | ret->engine = engine; | ||
| 150 | } | ||
| 151 | else | ||
| 152 | ret->engine = ENGINE_get_default_RSA(); | ||
| 153 | if(ret->engine) | ||
| 154 | { | ||
| 155 | ret->meth = ENGINE_get_RSA(ret->engine); | ||
| 156 | if(!ret->meth) | ||
| 157 | { | ||
| 158 | RSAerr(RSA_F_RSA_NEW_METHOD, | ||
| 159 | ERR_R_ENGINE_LIB); | ||
| 160 | ENGINE_finish(ret->engine); | ||
| 161 | OPENSSL_free(ret); | ||
| 162 | return NULL; | ||
| 163 | } | ||
| 164 | } | ||
| 165 | #endif | ||
| 166 | |||
| 167 | ret->pad=0; | ||
| 168 | ret->version=0; | ||
| 169 | ret->n=NULL; | ||
| 170 | ret->e=NULL; | ||
| 171 | ret->d=NULL; | ||
| 172 | ret->p=NULL; | ||
| 173 | ret->q=NULL; | ||
| 174 | ret->dmp1=NULL; | ||
| 175 | ret->dmq1=NULL; | ||
| 176 | ret->iqmp=NULL; | ||
| 177 | ret->references=1; | ||
| 178 | ret->_method_mod_n=NULL; | ||
| 179 | ret->_method_mod_p=NULL; | ||
| 180 | ret->_method_mod_q=NULL; | ||
| 181 | ret->blinding=NULL; | ||
| 182 | ret->mt_blinding=NULL; | ||
| 183 | ret->bignum_data=NULL; | ||
| 184 | ret->flags=ret->meth->flags; | ||
| 185 | if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data)) | ||
| 186 | { | ||
| 187 | #ifndef OPENSSL_NO_ENGINE | ||
| 188 | if (ret->engine) | ||
| 189 | ENGINE_finish(ret->engine); | ||
| 190 | #endif | ||
| 191 | OPENSSL_free(ret); | ||
| 192 | return(NULL); | ||
| 193 | } | ||
| 194 | |||
| 195 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) | ||
| 196 | { | ||
| 197 | #ifndef OPENSSL_NO_ENGINE | ||
| 198 | if (ret->engine) | ||
| 199 | ENGINE_finish(ret->engine); | ||
| 200 | #endif | ||
| 201 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); | ||
| 202 | OPENSSL_free(ret); | ||
| 203 | ret=NULL; | ||
| 204 | } | ||
| 205 | return(ret); | ||
| 206 | } | ||
| 207 | |||
| 208 | void RSA_free(RSA *r) | ||
| 209 | { | ||
| 210 | int i; | ||
| 211 | |||
| 212 | if (r == NULL) return; | ||
| 213 | |||
| 214 | i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_RSA); | ||
| 215 | #ifdef REF_PRINT | ||
| 216 | REF_PRINT("RSA",r); | ||
| 217 | #endif | ||
| 218 | if (i > 0) return; | ||
| 219 | #ifdef REF_CHECK | ||
| 220 | if (i < 0) | ||
| 221 | { | ||
| 222 | fprintf(stderr,"RSA_free, bad reference count\n"); | ||
| 223 | abort(); | ||
| 224 | } | ||
| 225 | #endif | ||
| 226 | |||
| 227 | if (r->meth->finish) | ||
| 228 | r->meth->finish(r); | ||
| 229 | #ifndef OPENSSL_NO_ENGINE | ||
| 230 | if (r->engine) | ||
| 231 | ENGINE_finish(r->engine); | ||
| 232 | #endif | ||
| 233 | |||
| 234 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data); | ||
| 235 | |||
| 236 | if (r->n != NULL) BN_clear_free(r->n); | ||
| 237 | if (r->e != NULL) BN_clear_free(r->e); | ||
| 238 | if (r->d != NULL) BN_clear_free(r->d); | ||
| 239 | if (r->p != NULL) BN_clear_free(r->p); | ||
| 240 | if (r->q != NULL) BN_clear_free(r->q); | ||
| 241 | if (r->dmp1 != NULL) BN_clear_free(r->dmp1); | ||
| 242 | if (r->dmq1 != NULL) BN_clear_free(r->dmq1); | ||
| 243 | if (r->iqmp != NULL) BN_clear_free(r->iqmp); | ||
| 244 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); | ||
| 245 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); | ||
| 246 | if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); | ||
| 247 | OPENSSL_free(r); | ||
| 248 | } | ||
| 249 | |||
| 250 | int RSA_up_ref(RSA *r) | ||
| 251 | { | ||
| 252 | int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA); | ||
| 253 | #ifdef REF_PRINT | ||
| 254 | REF_PRINT("RSA",r); | ||
| 255 | #endif | ||
| 256 | #ifdef REF_CHECK | ||
| 257 | if (i < 2) | ||
| 258 | { | ||
| 259 | fprintf(stderr, "RSA_up_ref, bad reference count\n"); | ||
| 260 | abort(); | ||
| 261 | } | ||
| 262 | #endif | ||
| 263 | return ((i > 1) ? 1 : 0); | ||
| 264 | } | ||
| 265 | |||
| 266 | int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | ||
| 267 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | ||
| 268 | { | ||
| 269 | return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, argl, argp, | ||
| 270 | new_func, dup_func, free_func); | ||
| 271 | } | ||
| 272 | |||
| 273 | int RSA_set_ex_data(RSA *r, int idx, void *arg) | ||
| 274 | { | ||
| 275 | return(CRYPTO_set_ex_data(&r->ex_data,idx,arg)); | ||
| 276 | } | ||
| 277 | |||
| 278 | void *RSA_get_ex_data(const RSA *r, int idx) | ||
| 279 | { | ||
| 280 | return(CRYPTO_get_ex_data(&r->ex_data,idx)); | ||
| 281 | } | ||
| 282 | |||
| 283 | int RSA_size(const RSA *r) | ||
| 284 | { | ||
| 285 | return(BN_num_bytes(r->n)); | ||
| 286 | } | ||
| 287 | |||
| 70 | int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | 288 | int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to, |
| 71 | RSA *rsa, int padding) | 289 | RSA *rsa, int padding) |
| 72 | { | 290 | { |
| @@ -76,13 +294,6 @@ int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
| 76 | int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | 294 | int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to, |
| 77 | RSA *rsa, int padding) | 295 | RSA *rsa, int padding) |
| 78 | { | 296 | { |
| 79 | #ifdef OPENSSL_FIPS | ||
| 80 | if(FIPS_mode() && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW)) | ||
| 81 | { | ||
| 82 | RSAerr(RSA_F_RSA_PRIVATE_ENCRYPT, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
| 83 | return 0; | ||
| 84 | } | ||
| 85 | #endif | ||
| 86 | return(rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding)); | 297 | return(rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding)); |
| 87 | } | 298 | } |
| 88 | 299 | ||
| @@ -95,19 +306,12 @@ int RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
| 95 | int RSA_public_decrypt(int flen, const unsigned char *from, unsigned char *to, | 306 | int RSA_public_decrypt(int flen, const unsigned char *from, unsigned char *to, |
| 96 | RSA *rsa, int padding) | 307 | RSA *rsa, int padding) |
| 97 | { | 308 | { |
| 98 | #ifdef OPENSSL_FIPS | ||
| 99 | if(FIPS_mode() && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW)) | ||
| 100 | { | ||
| 101 | RSAerr(RSA_F_RSA_PUBLIC_DECRYPT, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
| 102 | return 0; | ||
| 103 | } | ||
| 104 | #endif | ||
| 105 | return(rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding)); | 309 | return(rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding)); |
| 106 | } | 310 | } |
| 107 | 311 | ||
| 108 | int RSA_size(const RSA *r) | 312 | int RSA_flags(const RSA *r) |
| 109 | { | 313 | { |
| 110 | return(BN_num_bytes(r->n)); | 314 | return((r == NULL)?0:r->meth->flags); |
| 111 | } | 315 | } |
| 112 | 316 | ||
| 113 | void RSA_blinding_off(RSA *rsa) | 317 | void RSA_blinding_off(RSA *rsa) |
| @@ -222,7 +426,7 @@ BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx) | |||
| 222 | RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_BN_LIB); | 426 | RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_BN_LIB); |
| 223 | goto err; | 427 | goto err; |
| 224 | } | 428 | } |
| 225 | BN_BLINDING_set_thread_id(ret, CRYPTO_thread_id()); | 429 | CRYPTO_THREADID_current(BN_BLINDING_thread_id(ret)); |
| 226 | err: | 430 | err: |
| 227 | BN_CTX_end(ctx); | 431 | BN_CTX_end(ctx); |
| 228 | if (in_ctx == NULL) | 432 | if (in_ctx == NULL) |
| @@ -232,3 +436,48 @@ err: | |||
| 232 | 436 | ||
| 233 | return ret; | 437 | return ret; |
| 234 | } | 438 | } |
| 439 | |||
| 440 | int RSA_memory_lock(RSA *r) | ||
| 441 | { | ||
| 442 | int i,j,k,off; | ||
| 443 | char *p; | ||
| 444 | BIGNUM *bn,**t[6],*b; | ||
| 445 | BN_ULONG *ul; | ||
| 446 | |||
| 447 | if (r->d == NULL) return(1); | ||
| 448 | t[0]= &r->d; | ||
| 449 | t[1]= &r->p; | ||
| 450 | t[2]= &r->q; | ||
| 451 | t[3]= &r->dmp1; | ||
| 452 | t[4]= &r->dmq1; | ||
| 453 | t[5]= &r->iqmp; | ||
| 454 | k=sizeof(BIGNUM)*6; | ||
| 455 | off=k/sizeof(BN_ULONG)+1; | ||
| 456 | j=1; | ||
| 457 | for (i=0; i<6; i++) | ||
| 458 | j+= (*t[i])->top; | ||
| 459 | if ((p=OPENSSL_malloc_locked((off+j)*sizeof(BN_ULONG))) == NULL) | ||
| 460 | { | ||
| 461 | RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE); | ||
| 462 | return(0); | ||
| 463 | } | ||
| 464 | bn=(BIGNUM *)p; | ||
| 465 | ul=(BN_ULONG *)&(p[off]); | ||
| 466 | for (i=0; i<6; i++) | ||
| 467 | { | ||
| 468 | b= *(t[i]); | ||
| 469 | *(t[i])= &(bn[i]); | ||
| 470 | memcpy((char *)&(bn[i]),(char *)b,sizeof(BIGNUM)); | ||
| 471 | bn[i].flags=BN_FLG_STATIC_DATA; | ||
| 472 | bn[i].d=ul; | ||
| 473 | memcpy((char *)ul,b->d,sizeof(BN_ULONG)*b->top); | ||
| 474 | ul+=b->top; | ||
| 475 | BN_clear_free(b); | ||
| 476 | } | ||
| 477 | |||
| 478 | /* I should fix this so it can still be done */ | ||
| 479 | r->flags&= ~(RSA_FLAG_CACHE_PRIVATE|RSA_FLAG_CACHE_PUBLIC); | ||
| 480 | |||
| 481 | r->bignum_data=p; | ||
| 482 | return(1); | ||
| 483 | } | ||
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c index 4d30c9d2d3..e238d10e5c 100644 --- a/src/lib/libcrypto/rsa/rsa_oaep.c +++ b/src/lib/libcrypto/rsa/rsa_oaep.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include <openssl/rand.h> | 28 | #include <openssl/rand.h> |
| 29 | #include <openssl/sha.h> | 29 | #include <openssl/sha.h> |
| 30 | 30 | ||
| 31 | int MGF1(unsigned char *mask, long len, | 31 | static int MGF1(unsigned char *mask, long len, |
| 32 | const unsigned char *seed, long seedlen); | 32 | const unsigned char *seed, long seedlen); |
| 33 | 33 | ||
| 34 | int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | 34 | int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, |
| @@ -52,13 +52,6 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | |||
| 52 | return 0; | 52 | return 0; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | dbmask = OPENSSL_malloc(emlen - SHA_DIGEST_LENGTH); | ||
| 56 | if (dbmask == NULL) | ||
| 57 | { | ||
| 58 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); | ||
| 59 | return 0; | ||
| 60 | } | ||
| 61 | |||
| 62 | to[0] = 0; | 55 | to[0] = 0; |
| 63 | seed = to + 1; | 56 | seed = to + 1; |
| 64 | db = to + SHA_DIGEST_LENGTH + 1; | 57 | db = to + SHA_DIGEST_LENGTH + 1; |
| @@ -76,11 +69,20 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | |||
| 76 | 20); | 69 | 20); |
| 77 | #endif | 70 | #endif |
| 78 | 71 | ||
| 79 | MGF1(dbmask, emlen - SHA_DIGEST_LENGTH, seed, SHA_DIGEST_LENGTH); | 72 | dbmask = OPENSSL_malloc(emlen - SHA_DIGEST_LENGTH); |
| 73 | if (dbmask == NULL) | ||
| 74 | { | ||
| 75 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE); | ||
| 76 | return 0; | ||
| 77 | } | ||
| 78 | |||
| 79 | if (MGF1(dbmask, emlen - SHA_DIGEST_LENGTH, seed, SHA_DIGEST_LENGTH) < 0) | ||
| 80 | return 0; | ||
| 80 | for (i = 0; i < emlen - SHA_DIGEST_LENGTH; i++) | 81 | for (i = 0; i < emlen - SHA_DIGEST_LENGTH; i++) |
| 81 | db[i] ^= dbmask[i]; | 82 | db[i] ^= dbmask[i]; |
| 82 | 83 | ||
| 83 | MGF1(seedmask, SHA_DIGEST_LENGTH, db, emlen - SHA_DIGEST_LENGTH); | 84 | if (MGF1(seedmask, SHA_DIGEST_LENGTH, db, emlen - SHA_DIGEST_LENGTH) < 0) |
| 85 | return 0; | ||
| 84 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) | 86 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) |
| 85 | seed[i] ^= seedmask[i]; | 87 | seed[i] ^= seedmask[i]; |
| 86 | 88 | ||
| @@ -133,11 +135,13 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
| 133 | 135 | ||
| 134 | maskeddb = padded_from + SHA_DIGEST_LENGTH; | 136 | maskeddb = padded_from + SHA_DIGEST_LENGTH; |
| 135 | 137 | ||
| 136 | MGF1(seed, SHA_DIGEST_LENGTH, maskeddb, dblen); | 138 | if (MGF1(seed, SHA_DIGEST_LENGTH, maskeddb, dblen)) |
| 139 | return -1; | ||
| 137 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) | 140 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) |
| 138 | seed[i] ^= padded_from[i]; | 141 | seed[i] ^= padded_from[i]; |
| 139 | 142 | ||
| 140 | MGF1(db, dblen, seed, SHA_DIGEST_LENGTH); | 143 | if (MGF1(db, dblen, seed, SHA_DIGEST_LENGTH)) |
| 144 | return -1; | ||
| 141 | for (i = 0; i < dblen; i++) | 145 | for (i = 0; i < dblen; i++) |
| 142 | db[i] ^= maskeddb[i]; | 146 | db[i] ^= maskeddb[i]; |
| 143 | 147 | ||
| @@ -187,7 +191,9 @@ int PKCS1_MGF1(unsigned char *mask, long len, | |||
| 187 | int mdlen; | 191 | int mdlen; |
| 188 | 192 | ||
| 189 | EVP_MD_CTX_init(&c); | 193 | EVP_MD_CTX_init(&c); |
| 190 | mdlen = M_EVP_MD_size(dgst); | 194 | mdlen = EVP_MD_size(dgst); |
| 195 | if (mdlen < 0) | ||
| 196 | return -1; | ||
| 191 | for (i = 0; outlen < len; i++) | 197 | for (i = 0; outlen < len; i++) |
| 192 | { | 198 | { |
| 193 | cnt[0] = (unsigned char)((i >> 24) & 255); | 199 | cnt[0] = (unsigned char)((i >> 24) & 255); |
| @@ -213,7 +219,8 @@ int PKCS1_MGF1(unsigned char *mask, long len, | |||
| 213 | return 0; | 219 | return 0; |
| 214 | } | 220 | } |
| 215 | 221 | ||
| 216 | int MGF1(unsigned char *mask, long len, const unsigned char *seed, long seedlen) | 222 | static int MGF1(unsigned char *mask, long len, const unsigned char *seed, |
| 223 | long seedlen) | ||
| 217 | { | 224 | { |
| 218 | return PKCS1_MGF1(mask, len, seed, seedlen, EVP_sha1()); | 225 | return PKCS1_MGF1(mask, len, seed, seedlen, EVP_sha1()); |
| 219 | } | 226 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c index 5488c06f6d..0be4ec7fb0 100644 --- a/src/lib/libcrypto/rsa/rsa_sign.c +++ b/src/lib/libcrypto/rsa/rsa_sign.c | |||
| @@ -62,6 +62,7 @@ | |||
| 62 | #include <openssl/rsa.h> | 62 | #include <openssl/rsa.h> |
| 63 | #include <openssl/objects.h> | 63 | #include <openssl/objects.h> |
| 64 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
| 65 | #include "rsa_locl.h" | ||
| 65 | 66 | ||
| 66 | /* Size of an SSL signature: MD5+SHA1 */ | 67 | /* Size of an SSL signature: MD5+SHA1 */ |
| 67 | #define SSL_SIG_LENGTH 36 | 68 | #define SSL_SIG_LENGTH 36 |
| @@ -90,14 +91,6 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
| 90 | i = SSL_SIG_LENGTH; | 91 | i = SSL_SIG_LENGTH; |
| 91 | s = m; | 92 | s = m; |
| 92 | } else { | 93 | } else { |
| 93 | /* NB: in FIPS mode block anything that isn't a TLS signature */ | ||
| 94 | #ifdef OPENSSL_FIPS | ||
| 95 | if(FIPS_mode() && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW)) | ||
| 96 | { | ||
| 97 | RSAerr(RSA_F_RSA_SIGN, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
| 98 | return 0; | ||
| 99 | } | ||
| 100 | #endif | ||
| 101 | sig.algor= &algor; | 94 | sig.algor= &algor; |
| 102 | sig.algor->algorithm=OBJ_nid2obj(type); | 95 | sig.algor->algorithm=OBJ_nid2obj(type); |
| 103 | if (sig.algor->algorithm == NULL) | 96 | if (sig.algor->algorithm == NULL) |
| @@ -150,8 +143,11 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
| 150 | return(ret); | 143 | return(ret); |
| 151 | } | 144 | } |
| 152 | 145 | ||
| 153 | int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | 146 | int int_rsa_verify(int dtype, const unsigned char *m, |
| 154 | unsigned char *sigbuf, unsigned int siglen, RSA *rsa) | 147 | unsigned int m_len, |
| 148 | unsigned char *rm, size_t *prm_len, | ||
| 149 | const unsigned char *sigbuf, size_t siglen, | ||
| 150 | RSA *rsa) | ||
| 155 | { | 151 | { |
| 156 | int i,ret=0,sigtype; | 152 | int i,ret=0,sigtype; |
| 157 | unsigned char *s; | 153 | unsigned char *s; |
| @@ -159,38 +155,30 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
| 159 | 155 | ||
| 160 | if (siglen != (unsigned int)RSA_size(rsa)) | 156 | if (siglen != (unsigned int)RSA_size(rsa)) |
| 161 | { | 157 | { |
| 162 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_WRONG_SIGNATURE_LENGTH); | 158 | RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_WRONG_SIGNATURE_LENGTH); |
| 163 | return(0); | 159 | return(0); |
| 164 | } | 160 | } |
| 165 | 161 | ||
| 166 | if((rsa->flags & RSA_FLAG_SIGN_VER) && rsa->meth->rsa_verify) | 162 | if((dtype == NID_md5_sha1) && rm) |
| 167 | { | 163 | { |
| 168 | return rsa->meth->rsa_verify(dtype, m, m_len, | 164 | i = RSA_public_decrypt((int)siglen, |
| 169 | sigbuf, siglen, rsa); | 165 | sigbuf,rm,rsa,RSA_PKCS1_PADDING); |
| 166 | if (i <= 0) | ||
| 167 | return 0; | ||
| 168 | *prm_len = i; | ||
| 169 | return 1; | ||
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen); | 172 | s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen); |
| 173 | if (s == NULL) | 173 | if (s == NULL) |
| 174 | { | 174 | { |
| 175 | RSAerr(RSA_F_RSA_VERIFY,ERR_R_MALLOC_FAILURE); | 175 | RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE); |
| 176 | goto err; | 176 | goto err; |
| 177 | } | 177 | } |
| 178 | if(dtype == NID_md5_sha1) | 178 | if((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH) ) { |
| 179 | { | 179 | RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH); |
| 180 | if (m_len != SSL_SIG_LENGTH) | ||
| 181 | { | ||
| 182 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH); | ||
| 183 | goto err; | 180 | goto err; |
| 184 | } | 181 | } |
| 185 | } | ||
| 186 | /* NB: in FIPS mode block anything that isn't a TLS signature */ | ||
| 187 | #ifdef OPENSSL_FIPS | ||
| 188 | else if(FIPS_mode() && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW)) | ||
| 189 | { | ||
| 190 | RSAerr(RSA_F_RSA_VERIFY, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
| 191 | return 0; | ||
| 192 | } | ||
| 193 | #endif | ||
| 194 | i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING); | 182 | i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING); |
| 195 | 183 | ||
| 196 | if (i <= 0) goto err; | 184 | if (i <= 0) goto err; |
| @@ -198,7 +186,7 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
| 198 | /* Special case: SSL signature */ | 186 | /* Special case: SSL signature */ |
| 199 | if(dtype == NID_md5_sha1) { | 187 | if(dtype == NID_md5_sha1) { |
| 200 | if((i != SSL_SIG_LENGTH) || memcmp(s, m, SSL_SIG_LENGTH)) | 188 | if((i != SSL_SIG_LENGTH) || memcmp(s, m, SSL_SIG_LENGTH)) |
| 201 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_BAD_SIGNATURE); | 189 | RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_BAD_SIGNATURE); |
| 202 | else ret = 1; | 190 | else ret = 1; |
| 203 | } else { | 191 | } else { |
| 204 | const unsigned char *p=s; | 192 | const unsigned char *p=s; |
| @@ -209,7 +197,7 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
| 209 | /* Excess data can be used to create forgeries */ | 197 | /* Excess data can be used to create forgeries */ |
| 210 | if(p != s+i) | 198 | if(p != s+i) |
| 211 | { | 199 | { |
| 212 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_BAD_SIGNATURE); | 200 | RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_BAD_SIGNATURE); |
| 213 | goto err; | 201 | goto err; |
| 214 | } | 202 | } |
| 215 | 203 | ||
| @@ -218,7 +206,7 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
| 218 | if(sig->algor->parameter | 206 | if(sig->algor->parameter |
| 219 | && ASN1_TYPE_get(sig->algor->parameter) != V_ASN1_NULL) | 207 | && ASN1_TYPE_get(sig->algor->parameter) != V_ASN1_NULL) |
| 220 | { | 208 | { |
| 221 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_BAD_SIGNATURE); | 209 | RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_BAD_SIGNATURE); |
| 222 | goto err; | 210 | goto err; |
| 223 | } | 211 | } |
| 224 | 212 | ||
| @@ -244,15 +232,30 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
| 244 | } | 232 | } |
| 245 | else | 233 | else |
| 246 | { | 234 | { |
| 247 | RSAerr(RSA_F_RSA_VERIFY, | 235 | RSAerr(RSA_F_INT_RSA_VERIFY, |
| 248 | RSA_R_ALGORITHM_MISMATCH); | 236 | RSA_R_ALGORITHM_MISMATCH); |
| 249 | goto err; | 237 | goto err; |
| 250 | } | 238 | } |
| 251 | } | 239 | } |
| 252 | if ( ((unsigned int)sig->digest->length != m_len) || | 240 | if (rm) |
| 241 | { | ||
| 242 | const EVP_MD *md; | ||
| 243 | md = EVP_get_digestbynid(dtype); | ||
| 244 | if (md && (EVP_MD_size(md) != sig->digest->length)) | ||
| 245 | RSAerr(RSA_F_INT_RSA_VERIFY, | ||
| 246 | RSA_R_INVALID_DIGEST_LENGTH); | ||
| 247 | else | ||
| 248 | { | ||
| 249 | memcpy(rm, sig->digest->data, | ||
| 250 | sig->digest->length); | ||
| 251 | *prm_len = sig->digest->length; | ||
| 252 | ret = 1; | ||
| 253 | } | ||
| 254 | } | ||
| 255 | else if (((unsigned int)sig->digest->length != m_len) || | ||
| 253 | (memcmp(m,sig->digest->data,m_len) != 0)) | 256 | (memcmp(m,sig->digest->data,m_len) != 0)) |
| 254 | { | 257 | { |
| 255 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_BAD_SIGNATURE); | 258 | RSAerr(RSA_F_INT_RSA_VERIFY,RSA_R_BAD_SIGNATURE); |
| 256 | } | 259 | } |
| 257 | else | 260 | else |
| 258 | ret=1; | 261 | ret=1; |
| @@ -267,3 +270,16 @@ err: | |||
| 267 | return(ret); | 270 | return(ret); |
| 268 | } | 271 | } |
| 269 | 272 | ||
| 273 | int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | ||
| 274 | const unsigned char *sigbuf, unsigned int siglen, | ||
| 275 | RSA *rsa) | ||
| 276 | { | ||
| 277 | |||
| 278 | if((rsa->flags & RSA_FLAG_SIGN_VER) && rsa->meth->rsa_verify) | ||
| 279 | { | ||
| 280 | return rsa->meth->rsa_verify(dtype, m, m_len, | ||
| 281 | sigbuf, siglen, rsa); | ||
| 282 | } | ||
| 283 | |||
| 284 | return int_rsa_verify(dtype, m, m_len, NULL, NULL, sigbuf, siglen, rsa); | ||
| 285 | } | ||
diff --git a/src/lib/libcrypto/rsa/rsa_test.c b/src/lib/libcrypto/rsa/rsa_test.c index 4080de8bcf..c8705a0f6e 100644 --- a/src/lib/libcrypto/rsa/rsa_test.c +++ b/src/lib/libcrypto/rsa/rsa_test.c | |||
| @@ -328,7 +328,7 @@ int main(int argc, char *argv[]) | |||
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | CRYPTO_cleanup_all_ex_data(); | 330 | CRYPTO_cleanup_all_ex_data(); |
| 331 | ERR_remove_state(0); | 331 | ERR_remove_thread_state(NULL); |
| 332 | 332 | ||
| 333 | CRYPTO_mem_leaks_fp(stderr); | 333 | CRYPTO_mem_leaks_fp(stderr); |
| 334 | 334 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_x931g.c b/src/lib/libcrypto/rsa/rsa_x931g.c deleted file mode 100644 index bf94f8be7a..0000000000 --- a/src/lib/libcrypto/rsa/rsa_x931g.c +++ /dev/null | |||
| @@ -1,255 +0,0 @@ | |||
| 1 | /* crypto/rsa/rsa_gen.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 <time.h> | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/bn.h> | ||
| 64 | #include <openssl/rsa.h> | ||
| 65 | |||
| 66 | #ifndef OPENSSL_FIPS | ||
| 67 | |||
| 68 | /* X9.31 RSA key derivation and generation */ | ||
| 69 | |||
| 70 | int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNUM *q2, | ||
| 71 | const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *Xp, | ||
| 72 | const BIGNUM *Xq1, const BIGNUM *Xq2, const BIGNUM *Xq, | ||
| 73 | const BIGNUM *e, BN_GENCB *cb) | ||
| 74 | { | ||
| 75 | BIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL; | ||
| 76 | BN_CTX *ctx=NULL,*ctx2=NULL; | ||
| 77 | |||
| 78 | if (!rsa) | ||
| 79 | goto err; | ||
| 80 | |||
| 81 | ctx = BN_CTX_new(); | ||
| 82 | if (!ctx) | ||
| 83 | goto err; | ||
| 84 | BN_CTX_start(ctx); | ||
| 85 | |||
| 86 | r0 = BN_CTX_get(ctx); | ||
| 87 | r1 = BN_CTX_get(ctx); | ||
| 88 | r2 = BN_CTX_get(ctx); | ||
| 89 | r3 = BN_CTX_get(ctx); | ||
| 90 | |||
| 91 | if (r3 == NULL) | ||
| 92 | goto err; | ||
| 93 | if (!rsa->e) | ||
| 94 | { | ||
| 95 | rsa->e = BN_dup(e); | ||
| 96 | if (!rsa->e) | ||
| 97 | goto err; | ||
| 98 | } | ||
| 99 | else | ||
| 100 | e = rsa->e; | ||
| 101 | |||
| 102 | /* If not all parameters present only calculate what we can. | ||
| 103 | * This allows test programs to output selective parameters. | ||
| 104 | */ | ||
| 105 | |||
| 106 | if (Xp && !rsa->p) | ||
| 107 | { | ||
| 108 | rsa->p = BN_new(); | ||
| 109 | if (!rsa->p) | ||
| 110 | goto err; | ||
| 111 | |||
| 112 | if (!BN_X931_derive_prime_ex(rsa->p, p1, p2, | ||
| 113 | Xp, Xp1, Xp2, e, ctx, cb)) | ||
| 114 | goto err; | ||
| 115 | } | ||
| 116 | |||
| 117 | if (Xq && !rsa->q) | ||
| 118 | { | ||
| 119 | rsa->q = BN_new(); | ||
| 120 | if (!rsa->q) | ||
| 121 | goto err; | ||
| 122 | if (!BN_X931_derive_prime_ex(rsa->q, q1, q2, | ||
| 123 | Xq, Xq1, Xq2, e, ctx, cb)) | ||
| 124 | goto err; | ||
| 125 | } | ||
| 126 | |||
| 127 | if (!rsa->p || !rsa->q) | ||
| 128 | { | ||
| 129 | BN_CTX_end(ctx); | ||
| 130 | BN_CTX_free(ctx); | ||
| 131 | return 2; | ||
| 132 | } | ||
| 133 | |||
| 134 | /* Since both primes are set we can now calculate all remaining | ||
| 135 | * components. | ||
| 136 | */ | ||
| 137 | |||
| 138 | /* calculate n */ | ||
| 139 | rsa->n=BN_new(); | ||
| 140 | if (rsa->n == NULL) | ||
| 141 | goto err; | ||
| 142 | if (!BN_mul(rsa->n,rsa->p,rsa->q,ctx)) | ||
| 143 | goto err; | ||
| 144 | |||
| 145 | /* calculate d */ | ||
| 146 | if (!BN_sub(r1,rsa->p,BN_value_one())) | ||
| 147 | goto err; /* p-1 */ | ||
| 148 | if (!BN_sub(r2,rsa->q,BN_value_one())) | ||
| 149 | goto err; /* q-1 */ | ||
| 150 | if (!BN_mul(r0,r1,r2,ctx)) | ||
| 151 | goto err; /* (p-1)(q-1) */ | ||
| 152 | |||
| 153 | if (!BN_gcd(r3, r1, r2, ctx)) | ||
| 154 | goto err; | ||
| 155 | |||
| 156 | if (!BN_div(r0, NULL, r0, r3, ctx)) | ||
| 157 | goto err; /* LCM((p-1)(q-1)) */ | ||
| 158 | |||
| 159 | ctx2 = BN_CTX_new(); | ||
| 160 | if (!ctx2) | ||
| 161 | goto err; | ||
| 162 | |||
| 163 | rsa->d=BN_mod_inverse(NULL,rsa->e,r0,ctx2); /* d */ | ||
| 164 | if (rsa->d == NULL) | ||
| 165 | goto err; | ||
| 166 | |||
| 167 | /* calculate d mod (p-1) */ | ||
| 168 | rsa->dmp1=BN_new(); | ||
| 169 | if (rsa->dmp1 == NULL) | ||
| 170 | goto err; | ||
| 171 | if (!BN_mod(rsa->dmp1,rsa->d,r1,ctx)) | ||
| 172 | goto err; | ||
| 173 | |||
| 174 | /* calculate d mod (q-1) */ | ||
| 175 | rsa->dmq1=BN_new(); | ||
| 176 | if (rsa->dmq1 == NULL) | ||
| 177 | goto err; | ||
| 178 | if (!BN_mod(rsa->dmq1,rsa->d,r2,ctx)) | ||
| 179 | goto err; | ||
| 180 | |||
| 181 | /* calculate inverse of q mod p */ | ||
| 182 | rsa->iqmp=BN_mod_inverse(NULL,rsa->q,rsa->p,ctx2); | ||
| 183 | |||
| 184 | err: | ||
| 185 | if (ctx) | ||
| 186 | { | ||
| 187 | BN_CTX_end(ctx); | ||
| 188 | BN_CTX_free(ctx); | ||
| 189 | } | ||
| 190 | if (ctx2) | ||
| 191 | BN_CTX_free(ctx2); | ||
| 192 | /* If this is set all calls successful */ | ||
| 193 | if (rsa && rsa->iqmp != NULL) | ||
| 194 | return 1; | ||
| 195 | |||
| 196 | return 0; | ||
| 197 | |||
| 198 | } | ||
| 199 | |||
| 200 | int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB *cb) | ||
| 201 | { | ||
| 202 | int ok = 0; | ||
| 203 | BIGNUM *Xp = NULL, *Xq = NULL; | ||
| 204 | BN_CTX *ctx = NULL; | ||
| 205 | |||
| 206 | ctx = BN_CTX_new(); | ||
| 207 | if (!ctx) | ||
| 208 | goto error; | ||
| 209 | |||
| 210 | BN_CTX_start(ctx); | ||
| 211 | Xp = BN_CTX_get(ctx); | ||
| 212 | Xq = BN_CTX_get(ctx); | ||
| 213 | if (!BN_X931_generate_Xpq(Xp, Xq, bits, ctx)) | ||
| 214 | goto error; | ||
| 215 | |||
| 216 | rsa->p = BN_new(); | ||
| 217 | rsa->q = BN_new(); | ||
| 218 | if (!rsa->p || !rsa->q) | ||
| 219 | goto error; | ||
| 220 | |||
| 221 | /* Generate two primes from Xp, Xq */ | ||
| 222 | |||
| 223 | if (!BN_X931_generate_prime_ex(rsa->p, NULL, NULL, NULL, NULL, Xp, | ||
| 224 | e, ctx, cb)) | ||
| 225 | goto error; | ||
| 226 | |||
| 227 | if (!BN_X931_generate_prime_ex(rsa->q, NULL, NULL, NULL, NULL, Xq, | ||
| 228 | e, ctx, cb)) | ||
| 229 | goto error; | ||
| 230 | |||
| 231 | /* Since rsa->p and rsa->q are valid this call will just derive | ||
| 232 | * remaining RSA components. | ||
| 233 | */ | ||
| 234 | |||
| 235 | if (!RSA_X931_derive_ex(rsa, NULL, NULL, NULL, NULL, | ||
| 236 | NULL, NULL, NULL, NULL, NULL, NULL, e, cb)) | ||
| 237 | goto error; | ||
| 238 | |||
| 239 | ok = 1; | ||
| 240 | |||
| 241 | error: | ||
| 242 | if (ctx) | ||
| 243 | { | ||
| 244 | BN_CTX_end(ctx); | ||
| 245 | BN_CTX_free(ctx); | ||
| 246 | } | ||
| 247 | |||
| 248 | if (ok) | ||
| 249 | return 1; | ||
| 250 | |||
| 251 | return 0; | ||
| 252 | |||
| 253 | } | ||
| 254 | |||
| 255 | #endif | ||
diff --git a/src/lib/libcrypto/sha/Makefile.ssl b/src/lib/libcrypto/sha/Makefile.ssl deleted file mode 100644 index 4ba201c787..0000000000 --- a/src/lib/libcrypto/sha/Makefile.ssl +++ /dev/null | |||
| @@ -1,116 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/sha/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= sha | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | INSTALL_PREFIX= | ||
| 12 | OPENSSLDIR= /usr/local/ssl | ||
| 13 | INSTALLTOP=/usr/local/ssl | ||
| 14 | MAKE= make -f Makefile.ssl | ||
| 15 | MAKEDEPPROG= makedepend | ||
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 17 | MAKEFILE= Makefile.ssl | ||
| 18 | AR= ar r | ||
| 19 | |||
| 20 | SHA1_ASM_OBJ= | ||
| 21 | |||
| 22 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 23 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 24 | |||
| 25 | GENERAL=Makefile | ||
| 26 | TEST=shatest.c sha1test.c | ||
| 27 | APPS= | ||
| 28 | |||
| 29 | LIB=$(TOP)/libcrypto.a | ||
| 30 | LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c | ||
| 31 | LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o $(SHA1_ASM_OBJ) | ||
| 32 | |||
| 33 | SRC= $(LIBSRC) | ||
| 34 | |||
| 35 | EXHEADER= sha.h | ||
| 36 | HEADER= sha_locl.h $(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 | # elf | ||
| 51 | asm/sx86-elf.s: asm/sha1-586.pl ../perlasm/x86asm.pl | ||
| 52 | (cd asm; $(PERL) sha1-586.pl elf $(CFLAGS) $(PROCESSOR) > sx86-elf.s) | ||
| 53 | |||
| 54 | # a.out | ||
| 55 | asm/sx86-out.o: asm/sx86unix.cpp | ||
| 56 | $(CPP) -DOUT asm/sx86unix.cpp | as -o asm/sx86-out.o | ||
| 57 | |||
| 58 | # bsdi | ||
| 59 | asm/sx86bsdi.o: asm/sx86unix.cpp | ||
| 60 | $(CPP) -DBSDI asm/sx86unix.cpp | sed 's/ :/:/' | as -o asm/sx86bsdi.o | ||
| 61 | |||
| 62 | asm/sx86unix.cpp: asm/sha1-586.pl ../perlasm/x86asm.pl | ||
| 63 | (cd asm; $(PERL) sha1-586.pl cpp $(PROCESSOR) >sx86unix.cpp) | ||
| 64 | |||
| 65 | files: | ||
| 66 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 67 | |||
| 68 | links: | ||
| 69 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 76 | do \ | ||
| 77 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 78 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 79 | done; | ||
| 80 | |||
| 81 | tags: | ||
| 82 | ctags $(SRC) | ||
| 83 | |||
| 84 | tests: | ||
| 85 | |||
| 86 | lint: | ||
| 87 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 88 | |||
| 89 | depend: | ||
| 90 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 91 | |||
| 92 | dclean: | ||
| 93 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 94 | mv -f Makefile.new $(MAKEFILE) | ||
| 95 | |||
| 96 | clean: | ||
| 97 | rm -f asm/sx86unix.cpp asm/*-elf.* *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o | ||
| 98 | |||
| 99 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 100 | |||
| 101 | sha1_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 102 | sha1_one.o: ../../include/openssl/opensslconf.h | ||
| 103 | sha1_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 104 | sha1_one.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 105 | sha1_one.o: ../../include/openssl/symhacks.h sha1_one.c | ||
| 106 | sha1dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 107 | sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h | ||
| 108 | sha1dgst.o: ../md32_common.h sha1dgst.c sha_locl.h | ||
| 109 | sha_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 110 | sha_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h | ||
| 111 | sha_dgst.o: ../md32_common.h sha_dgst.c sha_locl.h | ||
| 112 | sha_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 113 | sha_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 114 | sha_one.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 115 | sha_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 116 | sha_one.o: sha_one.c | ||
diff --git a/src/lib/libcrypto/sha/asm/sha1-586.pl b/src/lib/libcrypto/sha/asm/sha1-586.pl index a787dd37da..a1f876281a 100644 --- a/src/lib/libcrypto/sha/asm/sha1-586.pl +++ b/src/lib/libcrypto/sha/asm/sha1-586.pl | |||
| @@ -215,5 +215,6 @@ sub BODY_40_59 | |||
| 215 | 215 | ||
| 216 | &stack_pop(16); | 216 | &stack_pop(16); |
| 217 | &function_end("sha1_block_data_order"); | 217 | &function_end("sha1_block_data_order"); |
| 218 | &asciz("SHA1 block transform for x86, CRYPTOGAMS by <appro\@openssl.org>"); | ||
| 218 | 219 | ||
| 219 | &asm_finish(); | 220 | &asm_finish(); |
diff --git a/src/lib/libcrypto/sha/asm/sha512-sse2.pl b/src/lib/libcrypto/sha/asm/sha512-sse2.pl deleted file mode 100644 index 10902bf673..0000000000 --- a/src/lib/libcrypto/sha/asm/sha512-sse2.pl +++ /dev/null | |||
| @@ -1,404 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | # | ||
| 3 | # ==================================================================== | ||
| 4 | # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL | ||
| 5 | # project. Rights for redistribution and usage in source and binary | ||
| 6 | # forms are granted according to the OpenSSL license. | ||
| 7 | # ==================================================================== | ||
| 8 | # | ||
| 9 | # SHA512_Transform_SSE2. | ||
| 10 | # | ||
| 11 | # As the name suggests, this is an IA-32 SSE2 implementation of | ||
| 12 | # SHA512_Transform. Motivating factor for the undertaken effort was that | ||
| 13 | # SHA512 was observed to *consistently* perform *significantly* poorer | ||
| 14 | # than SHA256 [2x and slower is common] on 32-bit platforms. On 64-bit | ||
| 15 | # platforms on the other hand SHA512 tend to outperform SHA256 [~50% | ||
| 16 | # seem to be common improvement factor]. All this is perfectly natural, | ||
| 17 | # as SHA512 is a 64-bit algorithm. But isn't IA-32 SSE2 essentially | ||
| 18 | # a 64-bit instruction set? Is it rich enough to implement SHA512? | ||
| 19 | # If answer was "no," then you wouldn't have been reading this... | ||
| 20 | # | ||
| 21 | # Throughput performance in MBps (larger is better): | ||
| 22 | # | ||
| 23 | # 2.4GHz P4 1.4GHz AMD32 1.4GHz AMD64(*) | ||
| 24 | # SHA256/gcc(*) 54 43 59 | ||
| 25 | # SHA512/gcc 17 23 92 | ||
| 26 | # SHA512/sse2 61(**) 57(**) | ||
| 27 | # SHA512/icc 26 28 | ||
| 28 | # SHA256/icc(*) 65 54 | ||
| 29 | # | ||
| 30 | # (*) AMD64 and SHA256 numbers are presented mostly for amusement or | ||
| 31 | # reference purposes. | ||
| 32 | # (**) I.e. it gives ~2-3x speed-up if compared with compiler generated | ||
| 33 | # code. One can argue that hand-coded *non*-SSE2 implementation | ||
| 34 | # would perform better than compiler generated one as well, and | ||
| 35 | # that comparison is therefore not exactly fair. Well, as SHA512 | ||
| 36 | # puts enormous pressure on IA-32 GP register bank, I reckon that | ||
| 37 | # hand-coded version wouldn't perform significantly better than | ||
| 38 | # one compiled with icc, ~20% perhaps... So that this code would | ||
| 39 | # still outperform it with distinguishing marginal. But feel free | ||
| 40 | # to prove me wrong:-) | ||
| 41 | # <appro@fy.chalmers.se> | ||
| 42 | push(@INC,"perlasm","../../perlasm"); | ||
| 43 | require "x86asm.pl"; | ||
| 44 | |||
| 45 | &asm_init($ARGV[0],"sha512-sse2.pl",$ARGV[$#ARGV] eq "386"); | ||
| 46 | |||
| 47 | $K512="esi"; # K512[80] table, found at the end... | ||
| 48 | #$W512="esp"; # $W512 is not just W512[16]: it comprises *two* copies | ||
| 49 | # of W512[16] and a copy of A-H variables... | ||
| 50 | $W512_SZ=8*(16+16+8); # see above... | ||
| 51 | #$Kidx="ebx"; # index in K512 table, advances from 0 to 80... | ||
| 52 | $Widx="edx"; # index in W512, wraps around at 16... | ||
| 53 | $data="edi"; # 16 qwords of input data... | ||
| 54 | $A="mm0"; # B-D and | ||
| 55 | $E="mm1"; # F-H are allocated dynamically... | ||
| 56 | $Aoff=256+0; # A-H offsets relative to $W512... | ||
| 57 | $Boff=256+8; | ||
| 58 | $Coff=256+16; | ||
| 59 | $Doff=256+24; | ||
| 60 | $Eoff=256+32; | ||
| 61 | $Foff=256+40; | ||
| 62 | $Goff=256+48; | ||
| 63 | $Hoff=256+56; | ||
| 64 | |||
| 65 | sub SHA2_ROUND() | ||
| 66 | { local ($kidx,$widx)=@_; | ||
| 67 | |||
| 68 | # One can argue that one could reorder instructions for better | ||
| 69 | # performance. Well, I tried and it doesn't seem to make any | ||
| 70 | # noticeable difference. Modern out-of-order execution cores | ||
| 71 | # reorder instructions to their liking in either case and they | ||
| 72 | # apparently do decent job. So we can keep the code more | ||
| 73 | # readable/regular/comprehensible:-) | ||
| 74 | |||
| 75 | # I adhere to 64-bit %mmX registers in order to avoid/not care | ||
| 76 | # about #GP exceptions on misaligned 128-bit access, most | ||
| 77 | # notably in paddq with memory operand. Not to mention that | ||
| 78 | # SSE2 intructions operating on %mmX can be scheduled every | ||
| 79 | # cycle [and not every second one if operating on %xmmN]. | ||
| 80 | |||
| 81 | &movq ("mm4",&QWP($Foff,$W512)); # load f | ||
| 82 | &movq ("mm5",&QWP($Goff,$W512)); # load g | ||
| 83 | &movq ("mm6",&QWP($Hoff,$W512)); # load h | ||
| 84 | |||
| 85 | &movq ("mm2",$E); # %mm2 is sliding right | ||
| 86 | &movq ("mm3",$E); # %mm3 is sliding left | ||
| 87 | &psrlq ("mm2",14); | ||
| 88 | &psllq ("mm3",23); | ||
| 89 | &movq ("mm7","mm2"); # %mm7 is T1 | ||
| 90 | &pxor ("mm7","mm3"); | ||
| 91 | &psrlq ("mm2",4); | ||
| 92 | &psllq ("mm3",23); | ||
| 93 | &pxor ("mm7","mm2"); | ||
| 94 | &pxor ("mm7","mm3"); | ||
| 95 | &psrlq ("mm2",23); | ||
| 96 | &psllq ("mm3",4); | ||
| 97 | &pxor ("mm7","mm2"); | ||
| 98 | &pxor ("mm7","mm3"); # T1=Sigma1_512(e) | ||
| 99 | |||
| 100 | &movq (&QWP($Foff,$W512),$E); # f = e | ||
| 101 | &movq (&QWP($Goff,$W512),"mm4"); # g = f | ||
| 102 | &movq (&QWP($Hoff,$W512),"mm5"); # h = g | ||
| 103 | |||
| 104 | &pxor ("mm4","mm5"); # f^=g | ||
| 105 | &pand ("mm4",$E); # f&=e | ||
| 106 | &pxor ("mm4","mm5"); # f^=g | ||
| 107 | &paddq ("mm7","mm4"); # T1+=Ch(e,f,g) | ||
| 108 | |||
| 109 | &movq ("mm2",&QWP($Boff,$W512)); # load b | ||
| 110 | &movq ("mm3",&QWP($Coff,$W512)); # load c | ||
| 111 | &movq ($E,&QWP($Doff,$W512)); # e = d | ||
| 112 | |||
| 113 | &paddq ("mm7","mm6"); # T1+=h | ||
| 114 | &paddq ("mm7",&QWP(0,$K512,$kidx,8)); # T1+=K512[i] | ||
| 115 | &paddq ("mm7",&QWP(0,$W512,$widx,8)); # T1+=W512[i] | ||
| 116 | &paddq ($E,"mm7"); # e += T1 | ||
| 117 | |||
| 118 | &movq ("mm4",$A); # %mm4 is sliding right | ||
| 119 | &movq ("mm5",$A); # %mm5 is sliding left | ||
| 120 | &psrlq ("mm4",28); | ||
| 121 | &psllq ("mm5",25); | ||
| 122 | &movq ("mm6","mm4"); # %mm6 is T2 | ||
| 123 | &pxor ("mm6","mm5"); | ||
| 124 | &psrlq ("mm4",6); | ||
| 125 | &psllq ("mm5",5); | ||
| 126 | &pxor ("mm6","mm4"); | ||
| 127 | &pxor ("mm6","mm5"); | ||
| 128 | &psrlq ("mm4",5); | ||
| 129 | &psllq ("mm5",6); | ||
| 130 | &pxor ("mm6","mm4"); | ||
| 131 | &pxor ("mm6","mm5"); # T2=Sigma0_512(a) | ||
| 132 | |||
| 133 | &movq (&QWP($Boff,$W512),$A); # b = a | ||
| 134 | &movq (&QWP($Coff,$W512),"mm2"); # c = b | ||
| 135 | &movq (&QWP($Doff,$W512),"mm3"); # d = c | ||
| 136 | |||
| 137 | &movq ("mm4",$A); # %mm4=a | ||
| 138 | &por ($A,"mm3"); # a=a|c | ||
| 139 | &pand ("mm4","mm3"); # %mm4=a&c | ||
| 140 | &pand ($A,"mm2"); # a=(a|c)&b | ||
| 141 | &por ("mm4",$A); # %mm4=(a&c)|((a|c)&b) | ||
| 142 | &paddq ("mm6","mm4"); # T2+=Maj(a,b,c) | ||
| 143 | |||
| 144 | &movq ($A,"mm7"); # a=T1 | ||
| 145 | &paddq ($A,"mm6"); # a+=T2 | ||
| 146 | } | ||
| 147 | |||
| 148 | $func="sha512_block_sse2"; | ||
| 149 | |||
| 150 | &function_begin_B($func); | ||
| 151 | if (0) {# Caller is expected to check if it's appropriate to | ||
| 152 | # call this routine. Below 3 lines are retained for | ||
| 153 | # debugging purposes... | ||
| 154 | &picmeup("eax","OPENSSL_ia32cap"); | ||
| 155 | &bt (&DWP(0,"eax"),26); | ||
| 156 | &jnc ("SHA512_Transform"); | ||
| 157 | } | ||
| 158 | |||
| 159 | &push ("ebp"); | ||
| 160 | &mov ("ebp","esp"); | ||
| 161 | &push ("ebx"); | ||
| 162 | &push ("esi"); | ||
| 163 | &push ("edi"); | ||
| 164 | |||
| 165 | &mov ($Widx,&DWP(8,"ebp")); # A-H state, 1st arg | ||
| 166 | &mov ($data,&DWP(12,"ebp")); # input data, 2nd arg | ||
| 167 | &call (&label("pic_point")); # make it PIC! | ||
| 168 | &set_label("pic_point"); | ||
| 169 | &blindpop($K512); | ||
| 170 | &lea ($K512,&DWP(&label("K512")."-".&label("pic_point"),$K512)); | ||
| 171 | |||
| 172 | $W512 = "esp"; # start using %esp as W512 | ||
| 173 | &sub ($W512,$W512_SZ); | ||
| 174 | &and ($W512,-16); # ensure 128-bit alignment | ||
| 175 | |||
| 176 | # make private copy of A-H | ||
| 177 | # v assume the worst and stick to unaligned load | ||
| 178 | &movdqu ("xmm0",&QWP(0,$Widx)); | ||
| 179 | &movdqu ("xmm1",&QWP(16,$Widx)); | ||
| 180 | &movdqu ("xmm2",&QWP(32,$Widx)); | ||
| 181 | &movdqu ("xmm3",&QWP(48,$Widx)); | ||
| 182 | |||
| 183 | &align(8); | ||
| 184 | &set_label("_chunk_loop"); | ||
| 185 | |||
| 186 | &movdqa (&QWP($Aoff,$W512),"xmm0"); # a,b | ||
| 187 | &movdqa (&QWP($Coff,$W512),"xmm1"); # c,d | ||
| 188 | &movdqa (&QWP($Eoff,$W512),"xmm2"); # e,f | ||
| 189 | &movdqa (&QWP($Goff,$W512),"xmm3"); # g,h | ||
| 190 | |||
| 191 | &xor ($Widx,$Widx); | ||
| 192 | |||
| 193 | &movdq2q($A,"xmm0"); # load a | ||
| 194 | &movdq2q($E,"xmm2"); # load e | ||
| 195 | |||
| 196 | # Why aren't loops unrolled? It makes sense to unroll if | ||
| 197 | # execution time for loop body is comparable with branch | ||
| 198 | # penalties and/or if whole data-set resides in register bank. | ||
| 199 | # Neither is case here... Well, it would be possible to | ||
| 200 | # eliminate few store operations, but it would hardly affect | ||
| 201 | # so to say stop-watch performance, as there is a lot of | ||
| 202 | # available memory slots to fill. It will only relieve some | ||
| 203 | # pressure off memory bus... | ||
| 204 | |||
| 205 | # flip input stream byte order... | ||
| 206 | &mov ("eax",&DWP(0,$data,$Widx,8)); | ||
| 207 | &mov ("ebx",&DWP(4,$data,$Widx,8)); | ||
| 208 | &bswap ("eax"); | ||
| 209 | &bswap ("ebx"); | ||
| 210 | &mov (&DWP(0,$W512,$Widx,8),"ebx"); # W512[i] | ||
| 211 | &mov (&DWP(4,$W512,$Widx,8),"eax"); | ||
| 212 | &mov (&DWP(128+0,$W512,$Widx,8),"ebx"); # copy of W512[i] | ||
| 213 | &mov (&DWP(128+4,$W512,$Widx,8),"eax"); | ||
| 214 | |||
| 215 | &align(8); | ||
| 216 | &set_label("_1st_loop"); # 0-15 | ||
| 217 | # flip input stream byte order... | ||
| 218 | &mov ("eax",&DWP(0+8,$data,$Widx,8)); | ||
| 219 | &mov ("ebx",&DWP(4+8,$data,$Widx,8)); | ||
| 220 | &bswap ("eax"); | ||
| 221 | &bswap ("ebx"); | ||
| 222 | &mov (&DWP(0+8,$W512,$Widx,8),"ebx"); # W512[i] | ||
| 223 | &mov (&DWP(4+8,$W512,$Widx,8),"eax"); | ||
| 224 | &mov (&DWP(128+0+8,$W512,$Widx,8),"ebx"); # copy of W512[i] | ||
| 225 | &mov (&DWP(128+4+8,$W512,$Widx,8),"eax"); | ||
| 226 | &set_label("_1st_looplet"); | ||
| 227 | &SHA2_ROUND($Widx,$Widx); &inc($Widx); | ||
| 228 | |||
| 229 | &cmp ($Widx,15) | ||
| 230 | &jl (&label("_1st_loop")); | ||
| 231 | &je (&label("_1st_looplet")); # playing similar trick on 2nd loop | ||
| 232 | # does not improve performance... | ||
| 233 | |||
| 234 | $Kidx = "ebx"; # start using %ebx as Kidx | ||
| 235 | &mov ($Kidx,$Widx); | ||
| 236 | |||
| 237 | &align(8); | ||
| 238 | &set_label("_2nd_loop"); # 16-79 | ||
| 239 | &and($Widx,0xf); | ||
| 240 | |||
| 241 | # 128-bit fragment! I update W512[i] and W512[i+1] in | ||
| 242 | # parallel:-) Note that I refer to W512[(i&0xf)+N] and not to | ||
| 243 | # W512[(i+N)&0xf]! This is exactly what I maintain the second | ||
| 244 | # copy of W512[16] for... | ||
| 245 | &movdqu ("xmm0",&QWP(8*1,$W512,$Widx,8)); # s0=W512[i+1] | ||
| 246 | &movdqa ("xmm2","xmm0"); # %xmm2 is sliding right | ||
| 247 | &movdqa ("xmm3","xmm0"); # %xmm3 is sliding left | ||
| 248 | &psrlq ("xmm2",1); | ||
| 249 | &psllq ("xmm3",56); | ||
| 250 | &movdqa ("xmm0","xmm2"); | ||
| 251 | &pxor ("xmm0","xmm3"); | ||
| 252 | &psrlq ("xmm2",6); | ||
| 253 | &psllq ("xmm3",7); | ||
| 254 | &pxor ("xmm0","xmm2"); | ||
| 255 | &pxor ("xmm0","xmm3"); | ||
| 256 | &psrlq ("xmm2",1); | ||
| 257 | &pxor ("xmm0","xmm2"); # s0 = sigma0_512(s0); | ||
| 258 | |||
| 259 | &movdqa ("xmm1",&QWP(8*14,$W512,$Widx,8)); # s1=W512[i+14] | ||
| 260 | &movdqa ("xmm4","xmm1"); # %xmm4 is sliding right | ||
| 261 | &movdqa ("xmm5","xmm1"); # %xmm5 is sliding left | ||
| 262 | &psrlq ("xmm4",6); | ||
| 263 | &psllq ("xmm5",3); | ||
| 264 | &movdqa ("xmm1","xmm4"); | ||
| 265 | &pxor ("xmm1","xmm5"); | ||
| 266 | &psrlq ("xmm4",13); | ||
| 267 | &psllq ("xmm5",42); | ||
| 268 | &pxor ("xmm1","xmm4"); | ||
| 269 | &pxor ("xmm1","xmm5"); | ||
| 270 | &psrlq ("xmm4",42); | ||
| 271 | &pxor ("xmm1","xmm4"); # s1 = sigma1_512(s1); | ||
| 272 | |||
| 273 | # + have to explictly load W512[i+9] as it's not 128-bit | ||
| 274 | # v aligned and paddq would throw an exception... | ||
| 275 | &movdqu ("xmm6",&QWP(8*9,$W512,$Widx,8)); | ||
| 276 | &paddq ("xmm0","xmm1"); # s0 += s1 | ||
| 277 | &paddq ("xmm0","xmm6"); # s0 += W512[i+9] | ||
| 278 | &paddq ("xmm0",&QWP(0,$W512,$Widx,8)); # s0 += W512[i] | ||
| 279 | |||
| 280 | &movdqa (&QWP(0,$W512,$Widx,8),"xmm0"); # W512[i] = s0 | ||
| 281 | &movdqa (&QWP(16*8,$W512,$Widx,8),"xmm0"); # copy of W512[i] | ||
| 282 | |||
| 283 | # as the above fragment was 128-bit, we "owe" 2 rounds... | ||
| 284 | &SHA2_ROUND($Kidx,$Widx); &inc($Kidx); &inc($Widx); | ||
| 285 | &SHA2_ROUND($Kidx,$Widx); &inc($Kidx); &inc($Widx); | ||
| 286 | |||
| 287 | &cmp ($Kidx,80); | ||
| 288 | &jl (&label("_2nd_loop")); | ||
| 289 | |||
| 290 | # update A-H state | ||
| 291 | &mov ($Widx,&DWP(8,"ebp")); # A-H state, 1st arg | ||
| 292 | &movq (&QWP($Aoff,$W512),$A); # write out a | ||
| 293 | &movq (&QWP($Eoff,$W512),$E); # write out e | ||
| 294 | &movdqu ("xmm0",&QWP(0,$Widx)); | ||
| 295 | &movdqu ("xmm1",&QWP(16,$Widx)); | ||
| 296 | &movdqu ("xmm2",&QWP(32,$Widx)); | ||
| 297 | &movdqu ("xmm3",&QWP(48,$Widx)); | ||
| 298 | &paddq ("xmm0",&QWP($Aoff,$W512)); # 128-bit additions... | ||
| 299 | &paddq ("xmm1",&QWP($Coff,$W512)); | ||
| 300 | &paddq ("xmm2",&QWP($Eoff,$W512)); | ||
| 301 | &paddq ("xmm3",&QWP($Goff,$W512)); | ||
| 302 | &movdqu (&QWP(0,$Widx),"xmm0"); | ||
| 303 | &movdqu (&QWP(16,$Widx),"xmm1"); | ||
| 304 | &movdqu (&QWP(32,$Widx),"xmm2"); | ||
| 305 | &movdqu (&QWP(48,$Widx),"xmm3"); | ||
| 306 | |||
| 307 | &add ($data,16*8); # advance input data pointer | ||
| 308 | &dec (&DWP(16,"ebp")); # decrement 3rd arg | ||
| 309 | &jnz (&label("_chunk_loop")); | ||
| 310 | |||
| 311 | # epilogue | ||
| 312 | &emms (); # required for at least ELF and Win32 ABIs | ||
| 313 | &mov ("edi",&DWP(-12,"ebp")); | ||
| 314 | &mov ("esi",&DWP(-8,"ebp")); | ||
| 315 | &mov ("ebx",&DWP(-4,"ebp")); | ||
| 316 | &leave (); | ||
| 317 | &ret (); | ||
| 318 | |||
| 319 | &align(64); | ||
| 320 | &set_label("K512"); # Yes! I keep it in the code segment! | ||
| 321 | &data_word(0xd728ae22,0x428a2f98); # u64 | ||
| 322 | &data_word(0x23ef65cd,0x71374491); # u64 | ||
| 323 | &data_word(0xec4d3b2f,0xb5c0fbcf); # u64 | ||
| 324 | &data_word(0x8189dbbc,0xe9b5dba5); # u64 | ||
| 325 | &data_word(0xf348b538,0x3956c25b); # u64 | ||
| 326 | &data_word(0xb605d019,0x59f111f1); # u64 | ||
| 327 | &data_word(0xaf194f9b,0x923f82a4); # u64 | ||
| 328 | &data_word(0xda6d8118,0xab1c5ed5); # u64 | ||
| 329 | &data_word(0xa3030242,0xd807aa98); # u64 | ||
| 330 | &data_word(0x45706fbe,0x12835b01); # u64 | ||
| 331 | &data_word(0x4ee4b28c,0x243185be); # u64 | ||
| 332 | &data_word(0xd5ffb4e2,0x550c7dc3); # u64 | ||
| 333 | &data_word(0xf27b896f,0x72be5d74); # u64 | ||
| 334 | &data_word(0x3b1696b1,0x80deb1fe); # u64 | ||
| 335 | &data_word(0x25c71235,0x9bdc06a7); # u64 | ||
| 336 | &data_word(0xcf692694,0xc19bf174); # u64 | ||
| 337 | &data_word(0x9ef14ad2,0xe49b69c1); # u64 | ||
| 338 | &data_word(0x384f25e3,0xefbe4786); # u64 | ||
| 339 | &data_word(0x8b8cd5b5,0x0fc19dc6); # u64 | ||
| 340 | &data_word(0x77ac9c65,0x240ca1cc); # u64 | ||
| 341 | &data_word(0x592b0275,0x2de92c6f); # u64 | ||
| 342 | &data_word(0x6ea6e483,0x4a7484aa); # u64 | ||
| 343 | &data_word(0xbd41fbd4,0x5cb0a9dc); # u64 | ||
| 344 | &data_word(0x831153b5,0x76f988da); # u64 | ||
| 345 | &data_word(0xee66dfab,0x983e5152); # u64 | ||
| 346 | &data_word(0x2db43210,0xa831c66d); # u64 | ||
| 347 | &data_word(0x98fb213f,0xb00327c8); # u64 | ||
| 348 | &data_word(0xbeef0ee4,0xbf597fc7); # u64 | ||
| 349 | &data_word(0x3da88fc2,0xc6e00bf3); # u64 | ||
| 350 | &data_word(0x930aa725,0xd5a79147); # u64 | ||
| 351 | &data_word(0xe003826f,0x06ca6351); # u64 | ||
| 352 | &data_word(0x0a0e6e70,0x14292967); # u64 | ||
| 353 | &data_word(0x46d22ffc,0x27b70a85); # u64 | ||
| 354 | &data_word(0x5c26c926,0x2e1b2138); # u64 | ||
| 355 | &data_word(0x5ac42aed,0x4d2c6dfc); # u64 | ||
| 356 | &data_word(0x9d95b3df,0x53380d13); # u64 | ||
| 357 | &data_word(0x8baf63de,0x650a7354); # u64 | ||
| 358 | &data_word(0x3c77b2a8,0x766a0abb); # u64 | ||
| 359 | &data_word(0x47edaee6,0x81c2c92e); # u64 | ||
| 360 | &data_word(0x1482353b,0x92722c85); # u64 | ||
| 361 | &data_word(0x4cf10364,0xa2bfe8a1); # u64 | ||
| 362 | &data_word(0xbc423001,0xa81a664b); # u64 | ||
| 363 | &data_word(0xd0f89791,0xc24b8b70); # u64 | ||
| 364 | &data_word(0x0654be30,0xc76c51a3); # u64 | ||
| 365 | &data_word(0xd6ef5218,0xd192e819); # u64 | ||
| 366 | &data_word(0x5565a910,0xd6990624); # u64 | ||
| 367 | &data_word(0x5771202a,0xf40e3585); # u64 | ||
| 368 | &data_word(0x32bbd1b8,0x106aa070); # u64 | ||
| 369 | &data_word(0xb8d2d0c8,0x19a4c116); # u64 | ||
| 370 | &data_word(0x5141ab53,0x1e376c08); # u64 | ||
| 371 | &data_word(0xdf8eeb99,0x2748774c); # u64 | ||
| 372 | &data_word(0xe19b48a8,0x34b0bcb5); # u64 | ||
| 373 | &data_word(0xc5c95a63,0x391c0cb3); # u64 | ||
| 374 | &data_word(0xe3418acb,0x4ed8aa4a); # u64 | ||
| 375 | &data_word(0x7763e373,0x5b9cca4f); # u64 | ||
| 376 | &data_word(0xd6b2b8a3,0x682e6ff3); # u64 | ||
| 377 | &data_word(0x5defb2fc,0x748f82ee); # u64 | ||
| 378 | &data_word(0x43172f60,0x78a5636f); # u64 | ||
| 379 | &data_word(0xa1f0ab72,0x84c87814); # u64 | ||
| 380 | &data_word(0x1a6439ec,0x8cc70208); # u64 | ||
| 381 | &data_word(0x23631e28,0x90befffa); # u64 | ||
| 382 | &data_word(0xde82bde9,0xa4506ceb); # u64 | ||
| 383 | &data_word(0xb2c67915,0xbef9a3f7); # u64 | ||
| 384 | &data_word(0xe372532b,0xc67178f2); # u64 | ||
| 385 | &data_word(0xea26619c,0xca273ece); # u64 | ||
| 386 | &data_word(0x21c0c207,0xd186b8c7); # u64 | ||
| 387 | &data_word(0xcde0eb1e,0xeada7dd6); # u64 | ||
| 388 | &data_word(0xee6ed178,0xf57d4f7f); # u64 | ||
| 389 | &data_word(0x72176fba,0x06f067aa); # u64 | ||
| 390 | &data_word(0xa2c898a6,0x0a637dc5); # u64 | ||
| 391 | &data_word(0xbef90dae,0x113f9804); # u64 | ||
| 392 | &data_word(0x131c471b,0x1b710b35); # u64 | ||
| 393 | &data_word(0x23047d84,0x28db77f5); # u64 | ||
| 394 | &data_word(0x40c72493,0x32caab7b); # u64 | ||
| 395 | &data_word(0x15c9bebc,0x3c9ebe0a); # u64 | ||
| 396 | &data_word(0x9c100d4c,0x431d67c4); # u64 | ||
| 397 | &data_word(0xcb3e42b6,0x4cc5d4be); # u64 | ||
| 398 | &data_word(0xfc657e2a,0x597f299c); # u64 | ||
| 399 | &data_word(0x3ad6faec,0x5fcb6fab); # u64 | ||
| 400 | &data_word(0x4a475817,0x6c44198c); # u64 | ||
| 401 | |||
| 402 | &function_end_B($func); | ||
| 403 | |||
| 404 | &asm_finish(); | ||
diff --git a/src/lib/libcrypto/sha/sha.h b/src/lib/libcrypto/sha/sha.h index 47a2c29f66..16cacf9fc0 100644 --- a/src/lib/libcrypto/sha/sha.h +++ b/src/lib/libcrypto/sha/sha.h | |||
| @@ -81,7 +81,7 @@ extern "C" { | |||
| 81 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 81 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 82 | */ | 82 | */ |
| 83 | 83 | ||
| 84 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | 84 | #if defined(__LP32__) |
| 85 | #define SHA_LONG unsigned long | 85 | #define SHA_LONG unsigned long |
| 86 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | 86 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) |
| 87 | #define SHA_LONG unsigned long | 87 | #define SHA_LONG unsigned long |
| @@ -106,9 +106,6 @@ typedef struct SHAstate_st | |||
| 106 | } SHA_CTX; | 106 | } SHA_CTX; |
| 107 | 107 | ||
| 108 | #ifndef OPENSSL_NO_SHA0 | 108 | #ifndef OPENSSL_NO_SHA0 |
| 109 | #ifdef OPENSSL_FIPS | ||
| 110 | int private_SHA_Init(SHA_CTX *c); | ||
| 111 | #endif | ||
| 112 | int SHA_Init(SHA_CTX *c); | 109 | int SHA_Init(SHA_CTX *c); |
| 113 | int SHA_Update(SHA_CTX *c, const void *data, size_t len); | 110 | int SHA_Update(SHA_CTX *c, const void *data, size_t len); |
| 114 | int SHA_Final(unsigned char *md, SHA_CTX *c); | 111 | int SHA_Final(unsigned char *md, SHA_CTX *c); |
diff --git a/src/lib/libcrypto/sha/sha1_one.c b/src/lib/libcrypto/sha/sha1_one.c index 4831174198..7c65b60276 100644 --- a/src/lib/libcrypto/sha/sha1_one.c +++ b/src/lib/libcrypto/sha/sha1_one.c | |||
| @@ -61,7 +61,7 @@ | |||
| 61 | #include <openssl/sha.h> | 61 | #include <openssl/sha.h> |
| 62 | #include <openssl/crypto.h> | 62 | #include <openssl/crypto.h> |
| 63 | 63 | ||
| 64 | #if !defined(OPENSSL_NO_SHA1) | 64 | #ifndef OPENSSL_NO_SHA1 |
| 65 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) | 65 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) |
| 66 | { | 66 | { |
| 67 | SHA_CTX c; | 67 | SHA_CTX c; |
diff --git a/src/lib/libcrypto/sha/sha1dgst.c b/src/lib/libcrypto/sha/sha1dgst.c index d31f0781a0..50d1925cde 100644 --- a/src/lib/libcrypto/sha/sha1dgst.c +++ b/src/lib/libcrypto/sha/sha1dgst.c | |||
| @@ -63,10 +63,6 @@ | |||
| 63 | #define SHA_1 | 63 | #define SHA_1 |
| 64 | 64 | ||
| 65 | #include <openssl/opensslv.h> | 65 | #include <openssl/opensslv.h> |
| 66 | #ifdef OPENSSL_FIPS | ||
| 67 | #include <openssl/fips.h> | ||
| 68 | #endif | ||
| 69 | |||
| 70 | 66 | ||
| 71 | const char SHA1_version[]="SHA1" OPENSSL_VERSION_PTEXT; | 67 | const char SHA1_version[]="SHA1" OPENSSL_VERSION_PTEXT; |
| 72 | 68 | ||
diff --git a/src/lib/libcrypto/sha/sha1s.cpp b/src/lib/libcrypto/sha/sha1s.cpp deleted file mode 100644 index af23d1e0f2..0000000000 --- a/src/lib/libcrypto/sha/sha1s.cpp +++ /dev/null | |||
| @@ -1,82 +0,0 @@ | |||
| 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/sha.h> | ||
| 36 | |||
| 37 | #define sha1_block_x86 sha1_block_asm_data_order | ||
| 38 | extern "C" { | ||
| 39 | void sha1_block_x86(SHA_CTX *ctx, unsigned char *buffer,int num); | ||
| 40 | } | ||
| 41 | |||
| 42 | void main(int argc,char *argv[]) | ||
| 43 | { | ||
| 44 | unsigned char buffer[64*256]; | ||
| 45 | SHA_CTX ctx; | ||
| 46 | unsigned long s1,s2,e1,e2; | ||
| 47 | unsigned char k[16]; | ||
| 48 | unsigned long data[2]; | ||
| 49 | unsigned char iv[8]; | ||
| 50 | int i,num=0,numm; | ||
| 51 | int j=0; | ||
| 52 | |||
| 53 | if (argc >= 2) | ||
| 54 | num=atoi(argv[1]); | ||
| 55 | |||
| 56 | if (num == 0) num=16; | ||
| 57 | if (num > 250) num=16; | ||
| 58 | numm=num+2; | ||
| 59 | #if 0 | ||
| 60 | num*=64; | ||
| 61 | numm*=64; | ||
| 62 | #endif | ||
| 63 | |||
| 64 | for (j=0; j<6; j++) | ||
| 65 | { | ||
| 66 | for (i=0; i<10; i++) /**/ | ||
| 67 | { | ||
| 68 | sha1_block_x86(&ctx,buffer,numm); | ||
| 69 | GetTSC(s1); | ||
| 70 | sha1_block_x86(&ctx,buffer,numm); | ||
| 71 | GetTSC(e1); | ||
| 72 | GetTSC(s2); | ||
| 73 | sha1_block_x86(&ctx,buffer,num); | ||
| 74 | GetTSC(e2); | ||
| 75 | sha1_block_x86(&ctx,buffer,num); | ||
| 76 | } | ||
| 77 | |||
| 78 | printf("sha1 (%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/sha/sha_dgst.c b/src/lib/libcrypto/sha/sha_dgst.c index 598f4d721a..70eb56032c 100644 --- a/src/lib/libcrypto/sha/sha_dgst.c +++ b/src/lib/libcrypto/sha/sha_dgst.c | |||
| @@ -57,12 +57,6 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <openssl/opensslconf.h> | 59 | #include <openssl/opensslconf.h> |
| 60 | #include <openssl/crypto.h> | ||
| 61 | #ifdef OPENSSL_FIPS | ||
| 62 | #include <openssl/fips.h> | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #include <openssl/err.h> | ||
| 66 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) | 60 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) |
| 67 | 61 | ||
| 68 | #undef SHA_1 | 62 | #undef SHA_1 |
diff --git a/src/lib/libcrypto/sha/sha_locl.h b/src/lib/libcrypto/sha/sha_locl.h index da46ddfe79..672c26eee1 100644 --- a/src/lib/libcrypto/sha/sha_locl.h +++ b/src/lib/libcrypto/sha/sha_locl.h | |||
| @@ -122,23 +122,14 @@ void sha1_block_data_order (SHA_CTX *c, const void *p,size_t num); | |||
| 122 | #define INIT_DATA_h3 0x10325476UL | 122 | #define INIT_DATA_h3 0x10325476UL |
| 123 | #define INIT_DATA_h4 0xc3d2e1f0UL | 123 | #define INIT_DATA_h4 0xc3d2e1f0UL |
| 124 | 124 | ||
| 125 | #if defined(SHA_0) && defined(OPENSSL_FIPS) | ||
| 126 | FIPS_NON_FIPS_MD_Init(SHA) | ||
| 127 | #else | ||
| 128 | int HASH_INIT (SHA_CTX *c) | 125 | int HASH_INIT (SHA_CTX *c) |
| 129 | #endif | ||
| 130 | { | 126 | { |
| 131 | #if defined(SHA_1) && defined(OPENSSL_FIPS) | 127 | memset (c,0,sizeof(*c)); |
| 132 | FIPS_selftest_check(); | ||
| 133 | #endif | ||
| 134 | c->h0=INIT_DATA_h0; | 128 | c->h0=INIT_DATA_h0; |
| 135 | c->h1=INIT_DATA_h1; | 129 | c->h1=INIT_DATA_h1; |
| 136 | c->h2=INIT_DATA_h2; | 130 | c->h2=INIT_DATA_h2; |
| 137 | c->h3=INIT_DATA_h3; | 131 | c->h3=INIT_DATA_h3; |
| 138 | c->h4=INIT_DATA_h4; | 132 | c->h4=INIT_DATA_h4; |
| 139 | c->Nl=0; | ||
| 140 | c->Nh=0; | ||
| 141 | c->num=0; | ||
| 142 | return 1; | 133 | return 1; |
| 143 | } | 134 | } |
| 144 | 135 | ||
diff --git a/src/lib/libcrypto/sha/shatest.c b/src/lib/libcrypto/sha/shatest.c index ed0fe06a7b..27614646d1 100644 --- a/src/lib/libcrypto/sha/shatest.c +++ b/src/lib/libcrypto/sha/shatest.c | |||
| @@ -123,9 +123,9 @@ int main(int argc, char *argv[]) | |||
| 123 | i=1; | 123 | i=1; |
| 124 | while (*P != NULL) | 124 | while (*P != NULL) |
| 125 | { | 125 | { |
| 126 | EVP_Digest(*P,strlen((char *)*P),md,NULL,EVP_sha(), NULL); | 126 | EVP_Digest(*P,strlen(*P),md,NULL,EVP_sha(), NULL); |
| 127 | p=pt(md); | 127 | p=pt(md); |
| 128 | if (strcmp(p,(char *)*R) != 0) | 128 | if (strcmp(p,*R) != 0) |
| 129 | { | 129 | { |
| 130 | printf("error calculating SHA on '%s'\n",*P); | 130 | printf("error calculating SHA on '%s'\n",*P); |
| 131 | printf("got %s instead of %s\n",p,*R); | 131 | printf("got %s instead of %s\n",p,*R); |
diff --git a/src/lib/libcrypto/stack/Makefile.ssl b/src/lib/libcrypto/stack/Makefile.ssl deleted file mode 100644 index 7120fb804a..0000000000 --- a/src/lib/libcrypto/stack/Makefile.ssl +++ /dev/null | |||
| @@ -1,88 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/stack/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= stack | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=stack.c | ||
| 27 | LIBOBJ=stack.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= stack.h safestack.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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | stack.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 83 | stack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 84 | stack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 85 | stack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 86 | stack.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 87 | stack.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 88 | stack.o: ../cryptlib.h stack.c | ||
diff --git a/src/lib/libcrypto/stack/safestack.h b/src/lib/libcrypto/stack/safestack.h index 40b17902e0..891cb84a51 100644 --- a/src/lib/libcrypto/stack/safestack.h +++ b/src/lib/libcrypto/stack/safestack.h | |||
| @@ -57,18 +57,27 @@ | |||
| 57 | 57 | ||
| 58 | #include <openssl/stack.h> | 58 | #include <openssl/stack.h> |
| 59 | 59 | ||
| 60 | #ifdef DEBUG_SAFESTACK | ||
| 61 | |||
| 62 | #ifndef CHECKED_PTR_OF | 60 | #ifndef CHECKED_PTR_OF |
| 63 | #define CHECKED_PTR_OF(type, p) \ | 61 | #define CHECKED_PTR_OF(type, p) \ |
| 64 | ((void*) (1 ? p : (type*)0)) | 62 | ((void*) (1 ? p : (type*)0)) |
| 65 | #endif | 63 | #endif |
| 66 | 64 | ||
| 65 | /* In C++ we get problems because an explicit cast is needed from (void *) | ||
| 66 | * we use CHECKED_STACK_OF to ensure the correct type is passed in the macros | ||
| 67 | * below. | ||
| 68 | */ | ||
| 69 | |||
| 70 | #define CHECKED_STACK_OF(type, p) \ | ||
| 71 | ((_STACK*) (1 ? p : (STACK_OF(type)*)0)) | ||
| 72 | |||
| 67 | #define CHECKED_SK_FREE_FUNC(type, p) \ | 73 | #define CHECKED_SK_FREE_FUNC(type, p) \ |
| 68 | ((void (*)(void *)) ((1 ? p : (void (*)(type *))0))) | 74 | ((void (*)(void *)) ((1 ? p : (void (*)(type *))0))) |
| 69 | 75 | ||
| 76 | #define CHECKED_SK_FREE_FUNC2(type, p) \ | ||
| 77 | ((void (*)(void *)) ((1 ? p : (void (*)(type))0))) | ||
| 78 | |||
| 70 | #define CHECKED_SK_CMP_FUNC(type, p) \ | 79 | #define CHECKED_SK_CMP_FUNC(type, p) \ |
| 71 | ((int (*)(const char * const *, const char * const *)) \ | 80 | ((int (*)(const void *, const void *)) \ |
| 72 | ((1 ? p : (int (*)(const type * const *, const type * const *))0))) | 81 | ((1 ? p : (int (*)(const type * const *, const type * const *))0))) |
| 73 | 82 | ||
| 74 | #define STACK_OF(type) struct stack_st_##type | 83 | #define STACK_OF(type) struct stack_st_##type |
| @@ -77,11 +86,51 @@ | |||
| 77 | #define DECLARE_STACK_OF(type) \ | 86 | #define DECLARE_STACK_OF(type) \ |
| 78 | STACK_OF(type) \ | 87 | STACK_OF(type) \ |
| 79 | { \ | 88 | { \ |
| 80 | STACK stack; \ | 89 | _STACK stack; \ |
| 90 | }; | ||
| 91 | #define DECLARE_SPECIAL_STACK_OF(type, type2) \ | ||
| 92 | STACK_OF(type) \ | ||
| 93 | { \ | ||
| 94 | _STACK stack; \ | ||
| 81 | }; | 95 | }; |
| 82 | 96 | ||
| 83 | #define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*/ | 97 | #define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*/ |
| 84 | 98 | ||
| 99 | |||
| 100 | /* Strings are special: normally an lhash entry will point to a single | ||
| 101 | * (somewhat) mutable object. In the case of strings: | ||
| 102 | * | ||
| 103 | * a) Instead of a single char, there is an array of chars, NUL-terminated. | ||
| 104 | * b) The string may have be immutable. | ||
| 105 | * | ||
| 106 | * So, they need their own declarations. Especially important for | ||
| 107 | * type-checking tools, such as Deputy. | ||
| 108 | * | ||
| 109 | o * In practice, however, it appears to be hard to have a const | ||
| 110 | * string. For now, I'm settling for dealing with the fact it is a | ||
| 111 | * string at all. | ||
| 112 | */ | ||
| 113 | typedef char *OPENSSL_STRING; | ||
| 114 | |||
| 115 | typedef const char *OPENSSL_CSTRING; | ||
| 116 | |||
| 117 | /* Confusingly, LHASH_OF(STRING) deals with char ** throughout, but | ||
| 118 | * STACK_OF(STRING) is really more like STACK_OF(char), only, as | ||
| 119 | * mentioned above, instead of a single char each entry is a | ||
| 120 | * NUL-terminated array of chars. So, we have to implement STRING | ||
| 121 | * specially for STACK_OF. This is dealt with in the autogenerated | ||
| 122 | * macros below. | ||
| 123 | */ | ||
| 124 | |||
| 125 | DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char) | ||
| 126 | |||
| 127 | /* Similarly, we sometimes use a block of characters, NOT | ||
| 128 | * nul-terminated. These should also be distinguished from "normal" | ||
| 129 | * stacks. */ | ||
| 130 | |||
| 131 | typedef void *OPENSSL_BLOCK; | ||
| 132 | DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) | ||
| 133 | |||
| 85 | /* SKM_sk_... stack macros are internal to safestack.h: | 134 | /* SKM_sk_... stack macros are internal to safestack.h: |
| 86 | * never use them directly, use sk_<type>_... instead */ | 135 | * never use them directly, use sk_<type>_... instead */ |
| 87 | #define SKM_sk_new(type, cmp) \ | 136 | #define SKM_sk_new(type, cmp) \ |
| @@ -89,52 +138,55 @@ STACK_OF(type) \ | |||
| 89 | #define SKM_sk_new_null(type) \ | 138 | #define SKM_sk_new_null(type) \ |
| 90 | ((STACK_OF(type) *)sk_new_null()) | 139 | ((STACK_OF(type) *)sk_new_null()) |
| 91 | #define SKM_sk_free(type, st) \ | 140 | #define SKM_sk_free(type, st) \ |
| 92 | sk_free(CHECKED_PTR_OF(STACK_OF(type), st)) | 141 | sk_free(CHECKED_STACK_OF(type, st)) |
| 93 | #define SKM_sk_num(type, st) \ | 142 | #define SKM_sk_num(type, st) \ |
| 94 | sk_num(CHECKED_PTR_OF(STACK_OF(type), st)) | 143 | sk_num(CHECKED_STACK_OF(type, st)) |
| 95 | #define SKM_sk_value(type, st,i) \ | 144 | #define SKM_sk_value(type, st,i) \ |
| 96 | ((type *)sk_value(CHECKED_PTR_OF(STACK_OF(type), st), i)) | 145 | ((type *)sk_value(CHECKED_STACK_OF(type, st), i)) |
| 97 | #define SKM_sk_set(type, st,i,val) \ | 146 | #define SKM_sk_set(type, st,i,val) \ |
| 98 | sk_set(CHECKED_PTR_OF(STACK_OF(type), st), i, CHECKED_PTR_OF(type, val)) | 147 | sk_set(CHECKED_STACK_OF(type, st), i, CHECKED_PTR_OF(type, val)) |
| 99 | #define SKM_sk_zero(type, st) \ | 148 | #define SKM_sk_zero(type, st) \ |
| 100 | sk_zero(CHECKED_PTR_OF(STACK_OF(type), st)) | 149 | sk_zero(CHECKED_STACK_OF(type, st)) |
| 101 | #define SKM_sk_push(type, st,val) \ | 150 | #define SKM_sk_push(type, st, val) \ |
| 102 | sk_push(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val)) | 151 | sk_push(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)) |
| 103 | #define SKM_sk_unshift(type, st,val) \ | 152 | #define SKM_sk_unshift(type, st, val) \ |
| 104 | sk_unshift(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val)) | 153 | sk_unshift(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)) |
| 105 | #define SKM_sk_find(type, st,val) \ | 154 | #define SKM_sk_find(type, st, val) \ |
| 106 | sk_find(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val)) | 155 | sk_find(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)) |
| 107 | #define SKM_sk_delete(type, st,i) \ | 156 | #define SKM_sk_find_ex(type, st, val) \ |
| 108 | (type *)sk_delete(CHECKED_PTR_OF(STACK_OF(type), st), i) | 157 | sk_find_ex(CHECKED_STACK_OF(type, st), \ |
| 109 | #define SKM_sk_delete_ptr(type, st,ptr) \ | 158 | CHECKED_PTR_OF(type, val)) |
| 110 | (type *)sk_delete_ptr(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, ptr)) | 159 | #define SKM_sk_delete(type, st, i) \ |
| 111 | #define SKM_sk_insert(type, st,val,i) \ | 160 | (type *)sk_delete(CHECKED_STACK_OF(type, st), i) |
| 112 | sk_insert(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val), i) | 161 | #define SKM_sk_delete_ptr(type, st, ptr) \ |
| 113 | #define SKM_sk_set_cmp_func(type, st,cmp) \ | 162 | (type *)sk_delete_ptr(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, ptr)) |
| 163 | #define SKM_sk_insert(type, st,val, i) \ | ||
| 164 | sk_insert(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val), i) | ||
| 165 | #define SKM_sk_set_cmp_func(type, st, cmp) \ | ||
| 114 | ((int (*)(const type * const *,const type * const *)) \ | 166 | ((int (*)(const type * const *,const type * const *)) \ |
| 115 | sk_set_cmp_func(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_SK_CMP_FUNC(type, cmp))) | 167 | sk_set_cmp_func(CHECKED_STACK_OF(type, st), CHECKED_SK_CMP_FUNC(type, cmp))) |
| 116 | #define SKM_sk_dup(type, st) \ | 168 | #define SKM_sk_dup(type, st) \ |
| 117 | (STACK_OF(type) *)sk_dup(CHECKED_PTR_OF(STACK_OF(type), st)) | 169 | (STACK_OF(type) *)sk_dup(CHECKED_STACK_OF(type, st)) |
| 118 | #define SKM_sk_pop_free(type, st,free_func) \ | 170 | #define SKM_sk_pop_free(type, st, free_func) \ |
| 119 | sk_pop_free(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_SK_FREE_FUNC(type, free_func)) | 171 | sk_pop_free(CHECKED_STACK_OF(type, st), CHECKED_SK_FREE_FUNC(type, free_func)) |
| 120 | #define SKM_sk_shift(type, st) \ | 172 | #define SKM_sk_shift(type, st) \ |
| 121 | (type *)sk_shift(CHECKED_PTR_OF(STACK_OF(type), st)) | 173 | (type *)sk_shift(CHECKED_STACK_OF(type, st)) |
| 122 | #define SKM_sk_pop(type, st) \ | 174 | #define SKM_sk_pop(type, st) \ |
| 123 | (type *)sk_pop(CHECKED_PTR_OF(STACK_OF(type), st)) | 175 | (type *)sk_pop(CHECKED_STACK_OF(type, st)) |
| 124 | #define SKM_sk_sort(type, st) \ | 176 | #define SKM_sk_sort(type, st) \ |
| 125 | sk_sort(CHECKED_PTR_OF(STACK_OF(type), st)) | 177 | sk_sort(CHECKED_STACK_OF(type, st)) |
| 126 | #define SKM_sk_is_sorted(type, st) \ | 178 | #define SKM_sk_is_sorted(type, st) \ |
| 127 | sk_is_sorted(CHECKED_PTR_OF(STACK_OF(type), st)) | 179 | sk_is_sorted(CHECKED_STACK_OF(type, st)) |
| 128 | 180 | ||
| 129 | #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) \ |
| 130 | (STACK_OF(type) *)d2i_ASN1_SET(CHECKED_PTR_OF(STACK_OF(type), st), \ | 182 | (STACK_OF(type) *)d2i_ASN1_SET((STACK_OF(OPENSSL_BLOCK) **)CHECKED_STACK_OF(type, st), \ |
| 131 | pp, length, \ | 183 | pp, length, \ |
| 132 | CHECKED_D2I_OF(type, d2i_func), \ | 184 | CHECKED_D2I_OF(type, d2i_func), \ |
| 133 | CHECKED_SK_FREE_FUNC(type, free_func), \ | 185 | CHECKED_SK_FREE_FUNC(type, free_func), \ |
| 134 | ex_tag, ex_class) | 186 | ex_tag, ex_class) |
| 135 | 187 | ||
| 136 | #define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ | 188 | #define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ |
| 137 | i2d_ASN1_SET(CHECKED_PTR_OF(STACK_OF(type), st), pp, \ | 189 | i2d_ASN1_SET((STACK_OF(OPENSSL_BLOCK) *)CHECKED_STACK_OF(type, st), pp, \ |
| 138 | CHECKED_I2D_OF(type, i2d_func), \ | 190 | CHECKED_I2D_OF(type, i2d_func), \ |
| 139 | ex_tag, ex_class, is_set) | 191 | ex_tag, ex_class, is_set) |
| 140 | 192 | ||
| @@ -151,72 +203,8 @@ STACK_OF(type) \ | |||
| 151 | CHECKED_SK_FREE_FUNC(type, free_func), \ | 203 | CHECKED_SK_FREE_FUNC(type, free_func), \ |
| 152 | pass, passlen, oct, seq) | 204 | pass, passlen, oct, seq) |
| 153 | 205 | ||
| 154 | #else | ||
| 155 | |||
| 156 | #define STACK_OF(type) STACK | ||
| 157 | #define PREDECLARE_STACK_OF(type) /* nada */ | ||
| 158 | #define DECLARE_STACK_OF(type) /* nada */ | ||
| 159 | #define IMPLEMENT_STACK_OF(type) /* nada */ | ||
| 160 | |||
| 161 | #define SKM_sk_new(type, cmp) \ | ||
| 162 | sk_new((int (*)(const char * const *, const char * const *))(cmp)) | ||
| 163 | #define SKM_sk_new_null(type) \ | ||
| 164 | sk_new_null() | ||
| 165 | #define SKM_sk_free(type, st) \ | ||
| 166 | sk_free(st) | ||
| 167 | #define SKM_sk_num(type, st) \ | ||
| 168 | sk_num(st) | ||
| 169 | #define SKM_sk_value(type, st,i) \ | ||
| 170 | ((type *)sk_value(st, i)) | ||
| 171 | #define SKM_sk_set(type, st,i,val) \ | ||
| 172 | ((type *)sk_set(st, i,(char *)val)) | ||
| 173 | #define SKM_sk_zero(type, st) \ | ||
| 174 | sk_zero(st) | ||
| 175 | #define SKM_sk_push(type, st,val) \ | ||
| 176 | sk_push(st, (char *)val) | ||
| 177 | #define SKM_sk_unshift(type, st,val) \ | ||
| 178 | sk_unshift(st, (char *)val) | ||
| 179 | #define SKM_sk_find(type, st,val) \ | ||
| 180 | sk_find(st, (char *)val) | ||
| 181 | #define SKM_sk_delete(type, st,i) \ | ||
| 182 | ((type *)sk_delete(st, i)) | ||
| 183 | #define SKM_sk_delete_ptr(type, st,ptr) \ | ||
| 184 | ((type *)sk_delete_ptr(st,(char *)ptr)) | ||
| 185 | #define SKM_sk_insert(type, st,val,i) \ | ||
| 186 | sk_insert(st, (char *)val, i) | ||
| 187 | #define SKM_sk_set_cmp_func(type, st,cmp) \ | ||
| 188 | ((int (*)(const type * const *,const type * const *)) \ | ||
| 189 | sk_set_cmp_func(st, (int (*)(const char * const *, const char * const *))(cmp))) | ||
| 190 | #define SKM_sk_dup(type, st) \ | ||
| 191 | sk_dup(st) | ||
| 192 | #define SKM_sk_pop_free(type, st,free_func) \ | ||
| 193 | sk_pop_free(st, (void (*)(void *))free_func) | ||
| 194 | #define SKM_sk_shift(type, st) \ | ||
| 195 | ((type *)sk_shift(st)) | ||
| 196 | #define SKM_sk_pop(type, st) \ | ||
| 197 | ((type *)sk_pop(st)) | ||
| 198 | #define SKM_sk_sort(type, st) \ | ||
| 199 | sk_sort(st) | ||
| 200 | #define SKM_sk_is_sorted(type, st) \ | ||
| 201 | sk_is_sorted(st) | ||
| 202 | |||
| 203 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | ||
| 204 | d2i_ASN1_SET(st,pp,length, (void *(*)(void ** ,const unsigned char ** ,long))d2i_func, (void (*)(void *))free_func, ex_tag,ex_class) | ||
| 205 | #define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ | ||
| 206 | i2d_ASN1_SET(st,pp,(int (*)(void *, unsigned char **))i2d_func,ex_tag,ex_class,is_set) | ||
| 207 | |||
| 208 | #define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \ | ||
| 209 | ASN1_seq_pack(st, (int (*)(void *, unsigned char **))i2d_func, buf, len) | ||
| 210 | #define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \ | ||
| 211 | ASN1_seq_unpack(buf,len,(void *(*)(void **,const unsigned char **,long))d2i_func, (void(*)(void *))free_func) | ||
| 212 | |||
| 213 | #define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \ | ||
| 214 | ((STACK *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i_func, (void(*)(void *))free_func,pass,passlen,oct,seq)) | ||
| 215 | |||
| 216 | #endif | ||
| 217 | |||
| 218 | /* This block of defines is updated by util/mkstack.pl, please do not touch! */ | 206 | /* This block of defines is updated by util/mkstack.pl, please do not touch! */ |
| 219 | #define sk_ACCESS_DESCRIPTION_new(st) SKM_sk_new(ACCESS_DESCRIPTION, (st)) | 207 | #define sk_ACCESS_DESCRIPTION_new(cmp) SKM_sk_new(ACCESS_DESCRIPTION, (cmp)) |
| 220 | #define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTION) | 208 | #define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTION) |
| 221 | #define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st)) | 209 | #define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st)) |
| 222 | #define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st)) | 210 | #define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st)) |
| @@ -238,7 +226,7 @@ STACK_OF(type) \ | |||
| 238 | #define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) | 226 | #define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) |
| 239 | #define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st)) | 227 | #define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st)) |
| 240 | 228 | ||
| 241 | #define sk_ASIdOrRange_new(st) SKM_sk_new(ASIdOrRange, (st)) | 229 | #define sk_ASIdOrRange_new(cmp) SKM_sk_new(ASIdOrRange, (cmp)) |
| 242 | #define sk_ASIdOrRange_new_null() SKM_sk_new_null(ASIdOrRange) | 230 | #define sk_ASIdOrRange_new_null() SKM_sk_new_null(ASIdOrRange) |
| 243 | #define sk_ASIdOrRange_free(st) SKM_sk_free(ASIdOrRange, (st)) | 231 | #define sk_ASIdOrRange_free(st) SKM_sk_free(ASIdOrRange, (st)) |
| 244 | #define sk_ASIdOrRange_num(st) SKM_sk_num(ASIdOrRange, (st)) | 232 | #define sk_ASIdOrRange_num(st) SKM_sk_num(ASIdOrRange, (st)) |
| @@ -260,7 +248,7 @@ STACK_OF(type) \ | |||
| 260 | #define sk_ASIdOrRange_sort(st) SKM_sk_sort(ASIdOrRange, (st)) | 248 | #define sk_ASIdOrRange_sort(st) SKM_sk_sort(ASIdOrRange, (st)) |
| 261 | #define sk_ASIdOrRange_is_sorted(st) SKM_sk_is_sorted(ASIdOrRange, (st)) | 249 | #define sk_ASIdOrRange_is_sorted(st) SKM_sk_is_sorted(ASIdOrRange, (st)) |
| 262 | 250 | ||
| 263 | #define sk_ASN1_GENERALSTRING_new(st) SKM_sk_new(ASN1_GENERALSTRING, (st)) | 251 | #define sk_ASN1_GENERALSTRING_new(cmp) SKM_sk_new(ASN1_GENERALSTRING, (cmp)) |
| 264 | #define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING) | 252 | #define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING) |
| 265 | #define sk_ASN1_GENERALSTRING_free(st) SKM_sk_free(ASN1_GENERALSTRING, (st)) | 253 | #define sk_ASN1_GENERALSTRING_free(st) SKM_sk_free(ASN1_GENERALSTRING, (st)) |
| 266 | #define sk_ASN1_GENERALSTRING_num(st) SKM_sk_num(ASN1_GENERALSTRING, (st)) | 254 | #define sk_ASN1_GENERALSTRING_num(st) SKM_sk_num(ASN1_GENERALSTRING, (st)) |
| @@ -282,7 +270,7 @@ STACK_OF(type) \ | |||
| 282 | #define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st)) | 270 | #define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st)) |
| 283 | #define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st)) | 271 | #define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st)) |
| 284 | 272 | ||
| 285 | #define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st)) | 273 | #define sk_ASN1_INTEGER_new(cmp) SKM_sk_new(ASN1_INTEGER, (cmp)) |
| 286 | #define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) | 274 | #define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) |
| 287 | #define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st)) | 275 | #define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st)) |
| 288 | #define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st)) | 276 | #define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st)) |
| @@ -304,7 +292,7 @@ STACK_OF(type) \ | |||
| 304 | #define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) | 292 | #define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) |
| 305 | #define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st)) | 293 | #define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st)) |
| 306 | 294 | ||
| 307 | #define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st)) | 295 | #define sk_ASN1_OBJECT_new(cmp) SKM_sk_new(ASN1_OBJECT, (cmp)) |
| 308 | #define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) | 296 | #define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) |
| 309 | #define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st)) | 297 | #define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st)) |
| 310 | #define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st)) | 298 | #define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st)) |
| @@ -326,7 +314,7 @@ STACK_OF(type) \ | |||
| 326 | #define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) | 314 | #define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) |
| 327 | #define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st)) | 315 | #define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st)) |
| 328 | 316 | ||
| 329 | #define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st)) | 317 | #define sk_ASN1_STRING_TABLE_new(cmp) SKM_sk_new(ASN1_STRING_TABLE, (cmp)) |
| 330 | #define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) | 318 | #define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) |
| 331 | #define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st)) | 319 | #define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st)) |
| 332 | #define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st)) | 320 | #define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st)) |
| @@ -348,7 +336,7 @@ STACK_OF(type) \ | |||
| 348 | #define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) | 336 | #define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) |
| 349 | #define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st)) | 337 | #define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st)) |
| 350 | 338 | ||
| 351 | #define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st)) | 339 | #define sk_ASN1_TYPE_new(cmp) SKM_sk_new(ASN1_TYPE, (cmp)) |
| 352 | #define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) | 340 | #define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) |
| 353 | #define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st)) | 341 | #define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st)) |
| 354 | #define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st)) | 342 | #define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st)) |
| @@ -370,7 +358,29 @@ STACK_OF(type) \ | |||
| 370 | #define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) | 358 | #define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) |
| 371 | #define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st)) | 359 | #define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st)) |
| 372 | 360 | ||
| 373 | #define sk_ASN1_VALUE_new(st) SKM_sk_new(ASN1_VALUE, (st)) | 361 | #define sk_ASN1_UTF8STRING_new(cmp) SKM_sk_new(ASN1_UTF8STRING, (cmp)) |
| 362 | #define sk_ASN1_UTF8STRING_new_null() SKM_sk_new_null(ASN1_UTF8STRING) | ||
| 363 | #define sk_ASN1_UTF8STRING_free(st) SKM_sk_free(ASN1_UTF8STRING, (st)) | ||
| 364 | #define sk_ASN1_UTF8STRING_num(st) SKM_sk_num(ASN1_UTF8STRING, (st)) | ||
| 365 | #define sk_ASN1_UTF8STRING_value(st, i) SKM_sk_value(ASN1_UTF8STRING, (st), (i)) | ||
| 366 | #define sk_ASN1_UTF8STRING_set(st, i, val) SKM_sk_set(ASN1_UTF8STRING, (st), (i), (val)) | ||
| 367 | #define sk_ASN1_UTF8STRING_zero(st) SKM_sk_zero(ASN1_UTF8STRING, (st)) | ||
| 368 | #define sk_ASN1_UTF8STRING_push(st, val) SKM_sk_push(ASN1_UTF8STRING, (st), (val)) | ||
| 369 | #define sk_ASN1_UTF8STRING_unshift(st, val) SKM_sk_unshift(ASN1_UTF8STRING, (st), (val)) | ||
| 370 | #define sk_ASN1_UTF8STRING_find(st, val) SKM_sk_find(ASN1_UTF8STRING, (st), (val)) | ||
| 371 | #define sk_ASN1_UTF8STRING_find_ex(st, val) SKM_sk_find_ex(ASN1_UTF8STRING, (st), (val)) | ||
| 372 | #define sk_ASN1_UTF8STRING_delete(st, i) SKM_sk_delete(ASN1_UTF8STRING, (st), (i)) | ||
| 373 | #define sk_ASN1_UTF8STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_UTF8STRING, (st), (ptr)) | ||
| 374 | #define sk_ASN1_UTF8STRING_insert(st, val, i) SKM_sk_insert(ASN1_UTF8STRING, (st), (val), (i)) | ||
| 375 | #define sk_ASN1_UTF8STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_UTF8STRING, (st), (cmp)) | ||
| 376 | #define sk_ASN1_UTF8STRING_dup(st) SKM_sk_dup(ASN1_UTF8STRING, st) | ||
| 377 | #define sk_ASN1_UTF8STRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_UTF8STRING, (st), (free_func)) | ||
| 378 | #define sk_ASN1_UTF8STRING_shift(st) SKM_sk_shift(ASN1_UTF8STRING, (st)) | ||
| 379 | #define sk_ASN1_UTF8STRING_pop(st) SKM_sk_pop(ASN1_UTF8STRING, (st)) | ||
| 380 | #define sk_ASN1_UTF8STRING_sort(st) SKM_sk_sort(ASN1_UTF8STRING, (st)) | ||
| 381 | #define sk_ASN1_UTF8STRING_is_sorted(st) SKM_sk_is_sorted(ASN1_UTF8STRING, (st)) | ||
| 382 | |||
| 383 | #define sk_ASN1_VALUE_new(cmp) SKM_sk_new(ASN1_VALUE, (cmp)) | ||
| 374 | #define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE) | 384 | #define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE) |
| 375 | #define sk_ASN1_VALUE_free(st) SKM_sk_free(ASN1_VALUE, (st)) | 385 | #define sk_ASN1_VALUE_free(st) SKM_sk_free(ASN1_VALUE, (st)) |
| 376 | #define sk_ASN1_VALUE_num(st) SKM_sk_num(ASN1_VALUE, (st)) | 386 | #define sk_ASN1_VALUE_num(st) SKM_sk_num(ASN1_VALUE, (st)) |
| @@ -392,7 +402,7 @@ STACK_OF(type) \ | |||
| 392 | #define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st)) | 402 | #define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st)) |
| 393 | #define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st)) | 403 | #define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st)) |
| 394 | 404 | ||
| 395 | #define sk_BIO_new(st) SKM_sk_new(BIO, (st)) | 405 | #define sk_BIO_new(cmp) SKM_sk_new(BIO, (cmp)) |
| 396 | #define sk_BIO_new_null() SKM_sk_new_null(BIO) | 406 | #define sk_BIO_new_null() SKM_sk_new_null(BIO) |
| 397 | #define sk_BIO_free(st) SKM_sk_free(BIO, (st)) | 407 | #define sk_BIO_free(st) SKM_sk_free(BIO, (st)) |
| 398 | #define sk_BIO_num(st) SKM_sk_num(BIO, (st)) | 408 | #define sk_BIO_num(st) SKM_sk_num(BIO, (st)) |
| @@ -414,7 +424,51 @@ STACK_OF(type) \ | |||
| 414 | #define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) | 424 | #define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) |
| 415 | #define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st)) | 425 | #define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st)) |
| 416 | 426 | ||
| 417 | #define sk_CMS_CertificateChoices_new(st) SKM_sk_new(CMS_CertificateChoices, (st)) | 427 | #define sk_BY_DIR_ENTRY_new(cmp) SKM_sk_new(BY_DIR_ENTRY, (cmp)) |
| 428 | #define sk_BY_DIR_ENTRY_new_null() SKM_sk_new_null(BY_DIR_ENTRY) | ||
| 429 | #define sk_BY_DIR_ENTRY_free(st) SKM_sk_free(BY_DIR_ENTRY, (st)) | ||
| 430 | #define sk_BY_DIR_ENTRY_num(st) SKM_sk_num(BY_DIR_ENTRY, (st)) | ||
| 431 | #define sk_BY_DIR_ENTRY_value(st, i) SKM_sk_value(BY_DIR_ENTRY, (st), (i)) | ||
| 432 | #define sk_BY_DIR_ENTRY_set(st, i, val) SKM_sk_set(BY_DIR_ENTRY, (st), (i), (val)) | ||
| 433 | #define sk_BY_DIR_ENTRY_zero(st) SKM_sk_zero(BY_DIR_ENTRY, (st)) | ||
| 434 | #define sk_BY_DIR_ENTRY_push(st, val) SKM_sk_push(BY_DIR_ENTRY, (st), (val)) | ||
| 435 | #define sk_BY_DIR_ENTRY_unshift(st, val) SKM_sk_unshift(BY_DIR_ENTRY, (st), (val)) | ||
| 436 | #define sk_BY_DIR_ENTRY_find(st, val) SKM_sk_find(BY_DIR_ENTRY, (st), (val)) | ||
| 437 | #define sk_BY_DIR_ENTRY_find_ex(st, val) SKM_sk_find_ex(BY_DIR_ENTRY, (st), (val)) | ||
| 438 | #define sk_BY_DIR_ENTRY_delete(st, i) SKM_sk_delete(BY_DIR_ENTRY, (st), (i)) | ||
| 439 | #define sk_BY_DIR_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(BY_DIR_ENTRY, (st), (ptr)) | ||
| 440 | #define sk_BY_DIR_ENTRY_insert(st, val, i) SKM_sk_insert(BY_DIR_ENTRY, (st), (val), (i)) | ||
| 441 | #define sk_BY_DIR_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BY_DIR_ENTRY, (st), (cmp)) | ||
| 442 | #define sk_BY_DIR_ENTRY_dup(st) SKM_sk_dup(BY_DIR_ENTRY, st) | ||
| 443 | #define sk_BY_DIR_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(BY_DIR_ENTRY, (st), (free_func)) | ||
| 444 | #define sk_BY_DIR_ENTRY_shift(st) SKM_sk_shift(BY_DIR_ENTRY, (st)) | ||
| 445 | #define sk_BY_DIR_ENTRY_pop(st) SKM_sk_pop(BY_DIR_ENTRY, (st)) | ||
| 446 | #define sk_BY_DIR_ENTRY_sort(st) SKM_sk_sort(BY_DIR_ENTRY, (st)) | ||
| 447 | #define sk_BY_DIR_ENTRY_is_sorted(st) SKM_sk_is_sorted(BY_DIR_ENTRY, (st)) | ||
| 448 | |||
| 449 | #define sk_BY_DIR_HASH_new(cmp) SKM_sk_new(BY_DIR_HASH, (cmp)) | ||
| 450 | #define sk_BY_DIR_HASH_new_null() SKM_sk_new_null(BY_DIR_HASH) | ||
| 451 | #define sk_BY_DIR_HASH_free(st) SKM_sk_free(BY_DIR_HASH, (st)) | ||
| 452 | #define sk_BY_DIR_HASH_num(st) SKM_sk_num(BY_DIR_HASH, (st)) | ||
| 453 | #define sk_BY_DIR_HASH_value(st, i) SKM_sk_value(BY_DIR_HASH, (st), (i)) | ||
| 454 | #define sk_BY_DIR_HASH_set(st, i, val) SKM_sk_set(BY_DIR_HASH, (st), (i), (val)) | ||
| 455 | #define sk_BY_DIR_HASH_zero(st) SKM_sk_zero(BY_DIR_HASH, (st)) | ||
| 456 | #define sk_BY_DIR_HASH_push(st, val) SKM_sk_push(BY_DIR_HASH, (st), (val)) | ||
| 457 | #define sk_BY_DIR_HASH_unshift(st, val) SKM_sk_unshift(BY_DIR_HASH, (st), (val)) | ||
| 458 | #define sk_BY_DIR_HASH_find(st, val) SKM_sk_find(BY_DIR_HASH, (st), (val)) | ||
| 459 | #define sk_BY_DIR_HASH_find_ex(st, val) SKM_sk_find_ex(BY_DIR_HASH, (st), (val)) | ||
| 460 | #define sk_BY_DIR_HASH_delete(st, i) SKM_sk_delete(BY_DIR_HASH, (st), (i)) | ||
| 461 | #define sk_BY_DIR_HASH_delete_ptr(st, ptr) SKM_sk_delete_ptr(BY_DIR_HASH, (st), (ptr)) | ||
| 462 | #define sk_BY_DIR_HASH_insert(st, val, i) SKM_sk_insert(BY_DIR_HASH, (st), (val), (i)) | ||
| 463 | #define sk_BY_DIR_HASH_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BY_DIR_HASH, (st), (cmp)) | ||
| 464 | #define sk_BY_DIR_HASH_dup(st) SKM_sk_dup(BY_DIR_HASH, st) | ||
| 465 | #define sk_BY_DIR_HASH_pop_free(st, free_func) SKM_sk_pop_free(BY_DIR_HASH, (st), (free_func)) | ||
| 466 | #define sk_BY_DIR_HASH_shift(st) SKM_sk_shift(BY_DIR_HASH, (st)) | ||
| 467 | #define sk_BY_DIR_HASH_pop(st) SKM_sk_pop(BY_DIR_HASH, (st)) | ||
| 468 | #define sk_BY_DIR_HASH_sort(st) SKM_sk_sort(BY_DIR_HASH, (st)) | ||
| 469 | #define sk_BY_DIR_HASH_is_sorted(st) SKM_sk_is_sorted(BY_DIR_HASH, (st)) | ||
| 470 | |||
| 471 | #define sk_CMS_CertificateChoices_new(cmp) SKM_sk_new(CMS_CertificateChoices, (cmp)) | ||
| 418 | #define sk_CMS_CertificateChoices_new_null() SKM_sk_new_null(CMS_CertificateChoices) | 472 | #define sk_CMS_CertificateChoices_new_null() SKM_sk_new_null(CMS_CertificateChoices) |
| 419 | #define sk_CMS_CertificateChoices_free(st) SKM_sk_free(CMS_CertificateChoices, (st)) | 473 | #define sk_CMS_CertificateChoices_free(st) SKM_sk_free(CMS_CertificateChoices, (st)) |
| 420 | #define sk_CMS_CertificateChoices_num(st) SKM_sk_num(CMS_CertificateChoices, (st)) | 474 | #define sk_CMS_CertificateChoices_num(st) SKM_sk_num(CMS_CertificateChoices, (st)) |
| @@ -436,7 +490,7 @@ STACK_OF(type) \ | |||
| 436 | #define sk_CMS_CertificateChoices_sort(st) SKM_sk_sort(CMS_CertificateChoices, (st)) | 490 | #define sk_CMS_CertificateChoices_sort(st) SKM_sk_sort(CMS_CertificateChoices, (st)) |
| 437 | #define sk_CMS_CertificateChoices_is_sorted(st) SKM_sk_is_sorted(CMS_CertificateChoices, (st)) | 491 | #define sk_CMS_CertificateChoices_is_sorted(st) SKM_sk_is_sorted(CMS_CertificateChoices, (st)) |
| 438 | 492 | ||
| 439 | #define sk_CMS_RecipientInfo_new(st) SKM_sk_new(CMS_RecipientInfo, (st)) | 493 | #define sk_CMS_RecipientInfo_new(cmp) SKM_sk_new(CMS_RecipientInfo, (cmp)) |
| 440 | #define sk_CMS_RecipientInfo_new_null() SKM_sk_new_null(CMS_RecipientInfo) | 494 | #define sk_CMS_RecipientInfo_new_null() SKM_sk_new_null(CMS_RecipientInfo) |
| 441 | #define sk_CMS_RecipientInfo_free(st) SKM_sk_free(CMS_RecipientInfo, (st)) | 495 | #define sk_CMS_RecipientInfo_free(st) SKM_sk_free(CMS_RecipientInfo, (st)) |
| 442 | #define sk_CMS_RecipientInfo_num(st) SKM_sk_num(CMS_RecipientInfo, (st)) | 496 | #define sk_CMS_RecipientInfo_num(st) SKM_sk_num(CMS_RecipientInfo, (st)) |
| @@ -458,7 +512,7 @@ STACK_OF(type) \ | |||
| 458 | #define sk_CMS_RecipientInfo_sort(st) SKM_sk_sort(CMS_RecipientInfo, (st)) | 512 | #define sk_CMS_RecipientInfo_sort(st) SKM_sk_sort(CMS_RecipientInfo, (st)) |
| 459 | #define sk_CMS_RecipientInfo_is_sorted(st) SKM_sk_is_sorted(CMS_RecipientInfo, (st)) | 513 | #define sk_CMS_RecipientInfo_is_sorted(st) SKM_sk_is_sorted(CMS_RecipientInfo, (st)) |
| 460 | 514 | ||
| 461 | #define sk_CMS_RevocationInfoChoice_new(st) SKM_sk_new(CMS_RevocationInfoChoice, (st)) | 515 | #define sk_CMS_RevocationInfoChoice_new(cmp) SKM_sk_new(CMS_RevocationInfoChoice, (cmp)) |
| 462 | #define sk_CMS_RevocationInfoChoice_new_null() SKM_sk_new_null(CMS_RevocationInfoChoice) | 516 | #define sk_CMS_RevocationInfoChoice_new_null() SKM_sk_new_null(CMS_RevocationInfoChoice) |
| 463 | #define sk_CMS_RevocationInfoChoice_free(st) SKM_sk_free(CMS_RevocationInfoChoice, (st)) | 517 | #define sk_CMS_RevocationInfoChoice_free(st) SKM_sk_free(CMS_RevocationInfoChoice, (st)) |
| 464 | #define sk_CMS_RevocationInfoChoice_num(st) SKM_sk_num(CMS_RevocationInfoChoice, (st)) | 518 | #define sk_CMS_RevocationInfoChoice_num(st) SKM_sk_num(CMS_RevocationInfoChoice, (st)) |
| @@ -480,7 +534,7 @@ STACK_OF(type) \ | |||
| 480 | #define sk_CMS_RevocationInfoChoice_sort(st) SKM_sk_sort(CMS_RevocationInfoChoice, (st)) | 534 | #define sk_CMS_RevocationInfoChoice_sort(st) SKM_sk_sort(CMS_RevocationInfoChoice, (st)) |
| 481 | #define sk_CMS_RevocationInfoChoice_is_sorted(st) SKM_sk_is_sorted(CMS_RevocationInfoChoice, (st)) | 535 | #define sk_CMS_RevocationInfoChoice_is_sorted(st) SKM_sk_is_sorted(CMS_RevocationInfoChoice, (st)) |
| 482 | 536 | ||
| 483 | #define sk_CMS_SignerInfo_new(st) SKM_sk_new(CMS_SignerInfo, (st)) | 537 | #define sk_CMS_SignerInfo_new(cmp) SKM_sk_new(CMS_SignerInfo, (cmp)) |
| 484 | #define sk_CMS_SignerInfo_new_null() SKM_sk_new_null(CMS_SignerInfo) | 538 | #define sk_CMS_SignerInfo_new_null() SKM_sk_new_null(CMS_SignerInfo) |
| 485 | #define sk_CMS_SignerInfo_free(st) SKM_sk_free(CMS_SignerInfo, (st)) | 539 | #define sk_CMS_SignerInfo_free(st) SKM_sk_free(CMS_SignerInfo, (st)) |
| 486 | #define sk_CMS_SignerInfo_num(st) SKM_sk_num(CMS_SignerInfo, (st)) | 540 | #define sk_CMS_SignerInfo_num(st) SKM_sk_num(CMS_SignerInfo, (st)) |
| @@ -502,7 +556,7 @@ STACK_OF(type) \ | |||
| 502 | #define sk_CMS_SignerInfo_sort(st) SKM_sk_sort(CMS_SignerInfo, (st)) | 556 | #define sk_CMS_SignerInfo_sort(st) SKM_sk_sort(CMS_SignerInfo, (st)) |
| 503 | #define sk_CMS_SignerInfo_is_sorted(st) SKM_sk_is_sorted(CMS_SignerInfo, (st)) | 557 | #define sk_CMS_SignerInfo_is_sorted(st) SKM_sk_is_sorted(CMS_SignerInfo, (st)) |
| 504 | 558 | ||
| 505 | #define sk_CONF_IMODULE_new(st) SKM_sk_new(CONF_IMODULE, (st)) | 559 | #define sk_CONF_IMODULE_new(cmp) SKM_sk_new(CONF_IMODULE, (cmp)) |
| 506 | #define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE) | 560 | #define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE) |
| 507 | #define sk_CONF_IMODULE_free(st) SKM_sk_free(CONF_IMODULE, (st)) | 561 | #define sk_CONF_IMODULE_free(st) SKM_sk_free(CONF_IMODULE, (st)) |
| 508 | #define sk_CONF_IMODULE_num(st) SKM_sk_num(CONF_IMODULE, (st)) | 562 | #define sk_CONF_IMODULE_num(st) SKM_sk_num(CONF_IMODULE, (st)) |
| @@ -524,7 +578,7 @@ STACK_OF(type) \ | |||
| 524 | #define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st)) | 578 | #define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st)) |
| 525 | #define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st)) | 579 | #define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st)) |
| 526 | 580 | ||
| 527 | #define sk_CONF_MODULE_new(st) SKM_sk_new(CONF_MODULE, (st)) | 581 | #define sk_CONF_MODULE_new(cmp) SKM_sk_new(CONF_MODULE, (cmp)) |
| 528 | #define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE) | 582 | #define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE) |
| 529 | #define sk_CONF_MODULE_free(st) SKM_sk_free(CONF_MODULE, (st)) | 583 | #define sk_CONF_MODULE_free(st) SKM_sk_free(CONF_MODULE, (st)) |
| 530 | #define sk_CONF_MODULE_num(st) SKM_sk_num(CONF_MODULE, (st)) | 584 | #define sk_CONF_MODULE_num(st) SKM_sk_num(CONF_MODULE, (st)) |
| @@ -546,7 +600,7 @@ STACK_OF(type) \ | |||
| 546 | #define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st)) | 600 | #define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st)) |
| 547 | #define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st)) | 601 | #define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st)) |
| 548 | 602 | ||
| 549 | #define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st)) | 603 | #define sk_CONF_VALUE_new(cmp) SKM_sk_new(CONF_VALUE, (cmp)) |
| 550 | #define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) | 604 | #define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) |
| 551 | #define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st)) | 605 | #define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st)) |
| 552 | #define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st)) | 606 | #define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st)) |
| @@ -568,7 +622,7 @@ STACK_OF(type) \ | |||
| 568 | #define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) | 622 | #define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) |
| 569 | #define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st)) | 623 | #define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st)) |
| 570 | 624 | ||
| 571 | #define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (st)) | 625 | #define sk_CRYPTO_EX_DATA_FUNCS_new(cmp) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (cmp)) |
| 572 | #define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) | 626 | #define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) |
| 573 | #define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS, (st)) | 627 | #define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS, (st)) |
| 574 | #define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (st)) | 628 | #define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (st)) |
| @@ -590,7 +644,7 @@ STACK_OF(type) \ | |||
| 590 | #define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) | 644 | #define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) |
| 591 | #define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st)) | 645 | #define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st)) |
| 592 | 646 | ||
| 593 | #define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st)) | 647 | #define sk_CRYPTO_dynlock_new(cmp) SKM_sk_new(CRYPTO_dynlock, (cmp)) |
| 594 | #define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) | 648 | #define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) |
| 595 | #define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st)) | 649 | #define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st)) |
| 596 | #define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st)) | 650 | #define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st)) |
| @@ -612,7 +666,7 @@ STACK_OF(type) \ | |||
| 612 | #define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) | 666 | #define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) |
| 613 | #define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st)) | 667 | #define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st)) |
| 614 | 668 | ||
| 615 | #define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st)) | 669 | #define sk_DIST_POINT_new(cmp) SKM_sk_new(DIST_POINT, (cmp)) |
| 616 | #define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) | 670 | #define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) |
| 617 | #define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st)) | 671 | #define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st)) |
| 618 | #define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st)) | 672 | #define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st)) |
| @@ -634,7 +688,7 @@ STACK_OF(type) \ | |||
| 634 | #define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) | 688 | #define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) |
| 635 | #define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st)) | 689 | #define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st)) |
| 636 | 690 | ||
| 637 | #define sk_ENGINE_new(st) SKM_sk_new(ENGINE, (st)) | 691 | #define sk_ENGINE_new(cmp) SKM_sk_new(ENGINE, (cmp)) |
| 638 | #define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE) | 692 | #define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE) |
| 639 | #define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st)) | 693 | #define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st)) |
| 640 | #define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st)) | 694 | #define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st)) |
| @@ -656,7 +710,7 @@ STACK_OF(type) \ | |||
| 656 | #define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st)) | 710 | #define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st)) |
| 657 | #define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st)) | 711 | #define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st)) |
| 658 | 712 | ||
| 659 | #define sk_ENGINE_CLEANUP_ITEM_new(st) SKM_sk_new(ENGINE_CLEANUP_ITEM, (st)) | 713 | #define sk_ENGINE_CLEANUP_ITEM_new(cmp) SKM_sk_new(ENGINE_CLEANUP_ITEM, (cmp)) |
| 660 | #define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM) | 714 | #define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM) |
| 661 | #define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (st)) | 715 | #define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (st)) |
| 662 | #define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st)) | 716 | #define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st)) |
| @@ -678,7 +732,117 @@ STACK_OF(type) \ | |||
| 678 | #define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st)) | 732 | #define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st)) |
| 679 | #define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st)) | 733 | #define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st)) |
| 680 | 734 | ||
| 681 | #define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st)) | 735 | #define sk_ESS_CERT_ID_new(cmp) SKM_sk_new(ESS_CERT_ID, (cmp)) |
| 736 | #define sk_ESS_CERT_ID_new_null() SKM_sk_new_null(ESS_CERT_ID) | ||
| 737 | #define sk_ESS_CERT_ID_free(st) SKM_sk_free(ESS_CERT_ID, (st)) | ||
| 738 | #define sk_ESS_CERT_ID_num(st) SKM_sk_num(ESS_CERT_ID, (st)) | ||
| 739 | #define sk_ESS_CERT_ID_value(st, i) SKM_sk_value(ESS_CERT_ID, (st), (i)) | ||
| 740 | #define sk_ESS_CERT_ID_set(st, i, val) SKM_sk_set(ESS_CERT_ID, (st), (i), (val)) | ||
| 741 | #define sk_ESS_CERT_ID_zero(st) SKM_sk_zero(ESS_CERT_ID, (st)) | ||
| 742 | #define sk_ESS_CERT_ID_push(st, val) SKM_sk_push(ESS_CERT_ID, (st), (val)) | ||
| 743 | #define sk_ESS_CERT_ID_unshift(st, val) SKM_sk_unshift(ESS_CERT_ID, (st), (val)) | ||
| 744 | #define sk_ESS_CERT_ID_find(st, val) SKM_sk_find(ESS_CERT_ID, (st), (val)) | ||
| 745 | #define sk_ESS_CERT_ID_find_ex(st, val) SKM_sk_find_ex(ESS_CERT_ID, (st), (val)) | ||
| 746 | #define sk_ESS_CERT_ID_delete(st, i) SKM_sk_delete(ESS_CERT_ID, (st), (i)) | ||
| 747 | #define sk_ESS_CERT_ID_delete_ptr(st, ptr) SKM_sk_delete_ptr(ESS_CERT_ID, (st), (ptr)) | ||
| 748 | #define sk_ESS_CERT_ID_insert(st, val, i) SKM_sk_insert(ESS_CERT_ID, (st), (val), (i)) | ||
| 749 | #define sk_ESS_CERT_ID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ESS_CERT_ID, (st), (cmp)) | ||
| 750 | #define sk_ESS_CERT_ID_dup(st) SKM_sk_dup(ESS_CERT_ID, st) | ||
| 751 | #define sk_ESS_CERT_ID_pop_free(st, free_func) SKM_sk_pop_free(ESS_CERT_ID, (st), (free_func)) | ||
| 752 | #define sk_ESS_CERT_ID_shift(st) SKM_sk_shift(ESS_CERT_ID, (st)) | ||
| 753 | #define sk_ESS_CERT_ID_pop(st) SKM_sk_pop(ESS_CERT_ID, (st)) | ||
| 754 | #define sk_ESS_CERT_ID_sort(st) SKM_sk_sort(ESS_CERT_ID, (st)) | ||
| 755 | #define sk_ESS_CERT_ID_is_sorted(st) SKM_sk_is_sorted(ESS_CERT_ID, (st)) | ||
| 756 | |||
| 757 | #define sk_EVP_MD_new(cmp) SKM_sk_new(EVP_MD, (cmp)) | ||
| 758 | #define sk_EVP_MD_new_null() SKM_sk_new_null(EVP_MD) | ||
| 759 | #define sk_EVP_MD_free(st) SKM_sk_free(EVP_MD, (st)) | ||
| 760 | #define sk_EVP_MD_num(st) SKM_sk_num(EVP_MD, (st)) | ||
| 761 | #define sk_EVP_MD_value(st, i) SKM_sk_value(EVP_MD, (st), (i)) | ||
| 762 | #define sk_EVP_MD_set(st, i, val) SKM_sk_set(EVP_MD, (st), (i), (val)) | ||
| 763 | #define sk_EVP_MD_zero(st) SKM_sk_zero(EVP_MD, (st)) | ||
| 764 | #define sk_EVP_MD_push(st, val) SKM_sk_push(EVP_MD, (st), (val)) | ||
| 765 | #define sk_EVP_MD_unshift(st, val) SKM_sk_unshift(EVP_MD, (st), (val)) | ||
| 766 | #define sk_EVP_MD_find(st, val) SKM_sk_find(EVP_MD, (st), (val)) | ||
| 767 | #define sk_EVP_MD_find_ex(st, val) SKM_sk_find_ex(EVP_MD, (st), (val)) | ||
| 768 | #define sk_EVP_MD_delete(st, i) SKM_sk_delete(EVP_MD, (st), (i)) | ||
| 769 | #define sk_EVP_MD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_MD, (st), (ptr)) | ||
| 770 | #define sk_EVP_MD_insert(st, val, i) SKM_sk_insert(EVP_MD, (st), (val), (i)) | ||
| 771 | #define sk_EVP_MD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_MD, (st), (cmp)) | ||
| 772 | #define sk_EVP_MD_dup(st) SKM_sk_dup(EVP_MD, st) | ||
| 773 | #define sk_EVP_MD_pop_free(st, free_func) SKM_sk_pop_free(EVP_MD, (st), (free_func)) | ||
| 774 | #define sk_EVP_MD_shift(st) SKM_sk_shift(EVP_MD, (st)) | ||
| 775 | #define sk_EVP_MD_pop(st) SKM_sk_pop(EVP_MD, (st)) | ||
| 776 | #define sk_EVP_MD_sort(st) SKM_sk_sort(EVP_MD, (st)) | ||
| 777 | #define sk_EVP_MD_is_sorted(st) SKM_sk_is_sorted(EVP_MD, (st)) | ||
| 778 | |||
| 779 | #define sk_EVP_PBE_CTL_new(cmp) SKM_sk_new(EVP_PBE_CTL, (cmp)) | ||
| 780 | #define sk_EVP_PBE_CTL_new_null() SKM_sk_new_null(EVP_PBE_CTL) | ||
| 781 | #define sk_EVP_PBE_CTL_free(st) SKM_sk_free(EVP_PBE_CTL, (st)) | ||
| 782 | #define sk_EVP_PBE_CTL_num(st) SKM_sk_num(EVP_PBE_CTL, (st)) | ||
| 783 | #define sk_EVP_PBE_CTL_value(st, i) SKM_sk_value(EVP_PBE_CTL, (st), (i)) | ||
| 784 | #define sk_EVP_PBE_CTL_set(st, i, val) SKM_sk_set(EVP_PBE_CTL, (st), (i), (val)) | ||
| 785 | #define sk_EVP_PBE_CTL_zero(st) SKM_sk_zero(EVP_PBE_CTL, (st)) | ||
| 786 | #define sk_EVP_PBE_CTL_push(st, val) SKM_sk_push(EVP_PBE_CTL, (st), (val)) | ||
| 787 | #define sk_EVP_PBE_CTL_unshift(st, val) SKM_sk_unshift(EVP_PBE_CTL, (st), (val)) | ||
| 788 | #define sk_EVP_PBE_CTL_find(st, val) SKM_sk_find(EVP_PBE_CTL, (st), (val)) | ||
| 789 | #define sk_EVP_PBE_CTL_find_ex(st, val) SKM_sk_find_ex(EVP_PBE_CTL, (st), (val)) | ||
| 790 | #define sk_EVP_PBE_CTL_delete(st, i) SKM_sk_delete(EVP_PBE_CTL, (st), (i)) | ||
| 791 | #define sk_EVP_PBE_CTL_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PBE_CTL, (st), (ptr)) | ||
| 792 | #define sk_EVP_PBE_CTL_insert(st, val, i) SKM_sk_insert(EVP_PBE_CTL, (st), (val), (i)) | ||
| 793 | #define sk_EVP_PBE_CTL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PBE_CTL, (st), (cmp)) | ||
| 794 | #define sk_EVP_PBE_CTL_dup(st) SKM_sk_dup(EVP_PBE_CTL, st) | ||
| 795 | #define sk_EVP_PBE_CTL_pop_free(st, free_func) SKM_sk_pop_free(EVP_PBE_CTL, (st), (free_func)) | ||
| 796 | #define sk_EVP_PBE_CTL_shift(st) SKM_sk_shift(EVP_PBE_CTL, (st)) | ||
| 797 | #define sk_EVP_PBE_CTL_pop(st) SKM_sk_pop(EVP_PBE_CTL, (st)) | ||
| 798 | #define sk_EVP_PBE_CTL_sort(st) SKM_sk_sort(EVP_PBE_CTL, (st)) | ||
| 799 | #define sk_EVP_PBE_CTL_is_sorted(st) SKM_sk_is_sorted(EVP_PBE_CTL, (st)) | ||
| 800 | |||
| 801 | #define sk_EVP_PKEY_ASN1_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_ASN1_METHOD, (cmp)) | ||
| 802 | #define sk_EVP_PKEY_ASN1_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_ASN1_METHOD) | ||
| 803 | #define sk_EVP_PKEY_ASN1_METHOD_free(st) SKM_sk_free(EVP_PKEY_ASN1_METHOD, (st)) | ||
| 804 | #define sk_EVP_PKEY_ASN1_METHOD_num(st) SKM_sk_num(EVP_PKEY_ASN1_METHOD, (st)) | ||
| 805 | #define sk_EVP_PKEY_ASN1_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_ASN1_METHOD, (st), (i)) | ||
| 806 | #define sk_EVP_PKEY_ASN1_METHOD_set(st, i, val) SKM_sk_set(EVP_PKEY_ASN1_METHOD, (st), (i), (val)) | ||
| 807 | #define sk_EVP_PKEY_ASN1_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_ASN1_METHOD, (st)) | ||
| 808 | #define sk_EVP_PKEY_ASN1_METHOD_push(st, val) SKM_sk_push(EVP_PKEY_ASN1_METHOD, (st), (val)) | ||
| 809 | #define sk_EVP_PKEY_ASN1_METHOD_unshift(st, val) SKM_sk_unshift(EVP_PKEY_ASN1_METHOD, (st), (val)) | ||
| 810 | #define sk_EVP_PKEY_ASN1_METHOD_find(st, val) SKM_sk_find(EVP_PKEY_ASN1_METHOD, (st), (val)) | ||
| 811 | #define sk_EVP_PKEY_ASN1_METHOD_find_ex(st, val) SKM_sk_find_ex(EVP_PKEY_ASN1_METHOD, (st), (val)) | ||
| 812 | #define sk_EVP_PKEY_ASN1_METHOD_delete(st, i) SKM_sk_delete(EVP_PKEY_ASN1_METHOD, (st), (i)) | ||
| 813 | #define sk_EVP_PKEY_ASN1_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PKEY_ASN1_METHOD, (st), (ptr)) | ||
| 814 | #define sk_EVP_PKEY_ASN1_METHOD_insert(st, val, i) SKM_sk_insert(EVP_PKEY_ASN1_METHOD, (st), (val), (i)) | ||
| 815 | #define sk_EVP_PKEY_ASN1_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PKEY_ASN1_METHOD, (st), (cmp)) | ||
| 816 | #define sk_EVP_PKEY_ASN1_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_ASN1_METHOD, st) | ||
| 817 | #define sk_EVP_PKEY_ASN1_METHOD_pop_free(st, free_func) SKM_sk_pop_free(EVP_PKEY_ASN1_METHOD, (st), (free_func)) | ||
| 818 | #define sk_EVP_PKEY_ASN1_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_ASN1_METHOD, (st)) | ||
| 819 | #define sk_EVP_PKEY_ASN1_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_ASN1_METHOD, (st)) | ||
| 820 | #define sk_EVP_PKEY_ASN1_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_ASN1_METHOD, (st)) | ||
| 821 | #define sk_EVP_PKEY_ASN1_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_ASN1_METHOD, (st)) | ||
| 822 | |||
| 823 | #define sk_EVP_PKEY_METHOD_new(cmp) SKM_sk_new(EVP_PKEY_METHOD, (cmp)) | ||
| 824 | #define sk_EVP_PKEY_METHOD_new_null() SKM_sk_new_null(EVP_PKEY_METHOD) | ||
| 825 | #define sk_EVP_PKEY_METHOD_free(st) SKM_sk_free(EVP_PKEY_METHOD, (st)) | ||
| 826 | #define sk_EVP_PKEY_METHOD_num(st) SKM_sk_num(EVP_PKEY_METHOD, (st)) | ||
| 827 | #define sk_EVP_PKEY_METHOD_value(st, i) SKM_sk_value(EVP_PKEY_METHOD, (st), (i)) | ||
| 828 | #define sk_EVP_PKEY_METHOD_set(st, i, val) SKM_sk_set(EVP_PKEY_METHOD, (st), (i), (val)) | ||
| 829 | #define sk_EVP_PKEY_METHOD_zero(st) SKM_sk_zero(EVP_PKEY_METHOD, (st)) | ||
| 830 | #define sk_EVP_PKEY_METHOD_push(st, val) SKM_sk_push(EVP_PKEY_METHOD, (st), (val)) | ||
| 831 | #define sk_EVP_PKEY_METHOD_unshift(st, val) SKM_sk_unshift(EVP_PKEY_METHOD, (st), (val)) | ||
| 832 | #define sk_EVP_PKEY_METHOD_find(st, val) SKM_sk_find(EVP_PKEY_METHOD, (st), (val)) | ||
| 833 | #define sk_EVP_PKEY_METHOD_find_ex(st, val) SKM_sk_find_ex(EVP_PKEY_METHOD, (st), (val)) | ||
| 834 | #define sk_EVP_PKEY_METHOD_delete(st, i) SKM_sk_delete(EVP_PKEY_METHOD, (st), (i)) | ||
| 835 | #define sk_EVP_PKEY_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(EVP_PKEY_METHOD, (st), (ptr)) | ||
| 836 | #define sk_EVP_PKEY_METHOD_insert(st, val, i) SKM_sk_insert(EVP_PKEY_METHOD, (st), (val), (i)) | ||
| 837 | #define sk_EVP_PKEY_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(EVP_PKEY_METHOD, (st), (cmp)) | ||
| 838 | #define sk_EVP_PKEY_METHOD_dup(st) SKM_sk_dup(EVP_PKEY_METHOD, st) | ||
| 839 | #define sk_EVP_PKEY_METHOD_pop_free(st, free_func) SKM_sk_pop_free(EVP_PKEY_METHOD, (st), (free_func)) | ||
| 840 | #define sk_EVP_PKEY_METHOD_shift(st) SKM_sk_shift(EVP_PKEY_METHOD, (st)) | ||
| 841 | #define sk_EVP_PKEY_METHOD_pop(st) SKM_sk_pop(EVP_PKEY_METHOD, (st)) | ||
| 842 | #define sk_EVP_PKEY_METHOD_sort(st) SKM_sk_sort(EVP_PKEY_METHOD, (st)) | ||
| 843 | #define sk_EVP_PKEY_METHOD_is_sorted(st) SKM_sk_is_sorted(EVP_PKEY_METHOD, (st)) | ||
| 844 | |||
| 845 | #define sk_GENERAL_NAME_new(cmp) SKM_sk_new(GENERAL_NAME, (cmp)) | ||
| 682 | #define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) | 846 | #define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) |
| 683 | #define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st)) | 847 | #define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st)) |
| 684 | #define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st)) | 848 | #define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st)) |
| @@ -700,7 +864,7 @@ STACK_OF(type) \ | |||
| 700 | #define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) | 864 | #define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) |
| 701 | #define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st)) | 865 | #define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st)) |
| 702 | 866 | ||
| 703 | #define sk_GENERAL_NAMES_new(st) SKM_sk_new(GENERAL_NAMES, (st)) | 867 | #define sk_GENERAL_NAMES_new(cmp) SKM_sk_new(GENERAL_NAMES, (cmp)) |
| 704 | #define sk_GENERAL_NAMES_new_null() SKM_sk_new_null(GENERAL_NAMES) | 868 | #define sk_GENERAL_NAMES_new_null() SKM_sk_new_null(GENERAL_NAMES) |
| 705 | #define sk_GENERAL_NAMES_free(st) SKM_sk_free(GENERAL_NAMES, (st)) | 869 | #define sk_GENERAL_NAMES_free(st) SKM_sk_free(GENERAL_NAMES, (st)) |
| 706 | #define sk_GENERAL_NAMES_num(st) SKM_sk_num(GENERAL_NAMES, (st)) | 870 | #define sk_GENERAL_NAMES_num(st) SKM_sk_num(GENERAL_NAMES, (st)) |
| @@ -722,7 +886,7 @@ STACK_OF(type) \ | |||
| 722 | #define sk_GENERAL_NAMES_sort(st) SKM_sk_sort(GENERAL_NAMES, (st)) | 886 | #define sk_GENERAL_NAMES_sort(st) SKM_sk_sort(GENERAL_NAMES, (st)) |
| 723 | #define sk_GENERAL_NAMES_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAMES, (st)) | 887 | #define sk_GENERAL_NAMES_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAMES, (st)) |
| 724 | 888 | ||
| 725 | #define sk_GENERAL_SUBTREE_new(st) SKM_sk_new(GENERAL_SUBTREE, (st)) | 889 | #define sk_GENERAL_SUBTREE_new(cmp) SKM_sk_new(GENERAL_SUBTREE, (cmp)) |
| 726 | #define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE) | 890 | #define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE) |
| 727 | #define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st)) | 891 | #define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st)) |
| 728 | #define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st)) | 892 | #define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st)) |
| @@ -744,7 +908,7 @@ STACK_OF(type) \ | |||
| 744 | #define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st)) | 908 | #define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st)) |
| 745 | #define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE, (st)) | 909 | #define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE, (st)) |
| 746 | 910 | ||
| 747 | #define sk_IPAddressFamily_new(st) SKM_sk_new(IPAddressFamily, (st)) | 911 | #define sk_IPAddressFamily_new(cmp) SKM_sk_new(IPAddressFamily, (cmp)) |
| 748 | #define sk_IPAddressFamily_new_null() SKM_sk_new_null(IPAddressFamily) | 912 | #define sk_IPAddressFamily_new_null() SKM_sk_new_null(IPAddressFamily) |
| 749 | #define sk_IPAddressFamily_free(st) SKM_sk_free(IPAddressFamily, (st)) | 913 | #define sk_IPAddressFamily_free(st) SKM_sk_free(IPAddressFamily, (st)) |
| 750 | #define sk_IPAddressFamily_num(st) SKM_sk_num(IPAddressFamily, (st)) | 914 | #define sk_IPAddressFamily_num(st) SKM_sk_num(IPAddressFamily, (st)) |
| @@ -766,7 +930,7 @@ STACK_OF(type) \ | |||
| 766 | #define sk_IPAddressFamily_sort(st) SKM_sk_sort(IPAddressFamily, (st)) | 930 | #define sk_IPAddressFamily_sort(st) SKM_sk_sort(IPAddressFamily, (st)) |
| 767 | #define sk_IPAddressFamily_is_sorted(st) SKM_sk_is_sorted(IPAddressFamily, (st)) | 931 | #define sk_IPAddressFamily_is_sorted(st) SKM_sk_is_sorted(IPAddressFamily, (st)) |
| 768 | 932 | ||
| 769 | #define sk_IPAddressOrRange_new(st) SKM_sk_new(IPAddressOrRange, (st)) | 933 | #define sk_IPAddressOrRange_new(cmp) SKM_sk_new(IPAddressOrRange, (cmp)) |
| 770 | #define sk_IPAddressOrRange_new_null() SKM_sk_new_null(IPAddressOrRange) | 934 | #define sk_IPAddressOrRange_new_null() SKM_sk_new_null(IPAddressOrRange) |
| 771 | #define sk_IPAddressOrRange_free(st) SKM_sk_free(IPAddressOrRange, (st)) | 935 | #define sk_IPAddressOrRange_free(st) SKM_sk_free(IPAddressOrRange, (st)) |
| 772 | #define sk_IPAddressOrRange_num(st) SKM_sk_num(IPAddressOrRange, (st)) | 936 | #define sk_IPAddressOrRange_num(st) SKM_sk_num(IPAddressOrRange, (st)) |
| @@ -788,7 +952,7 @@ STACK_OF(type) \ | |||
| 788 | #define sk_IPAddressOrRange_sort(st) SKM_sk_sort(IPAddressOrRange, (st)) | 952 | #define sk_IPAddressOrRange_sort(st) SKM_sk_sort(IPAddressOrRange, (st)) |
| 789 | #define sk_IPAddressOrRange_is_sorted(st) SKM_sk_is_sorted(IPAddressOrRange, (st)) | 953 | #define sk_IPAddressOrRange_is_sorted(st) SKM_sk_is_sorted(IPAddressOrRange, (st)) |
| 790 | 954 | ||
| 791 | #define sk_KRB5_APREQBODY_new(st) SKM_sk_new(KRB5_APREQBODY, (st)) | 955 | #define sk_KRB5_APREQBODY_new(cmp) SKM_sk_new(KRB5_APREQBODY, (cmp)) |
| 792 | #define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY) | 956 | #define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY) |
| 793 | #define sk_KRB5_APREQBODY_free(st) SKM_sk_free(KRB5_APREQBODY, (st)) | 957 | #define sk_KRB5_APREQBODY_free(st) SKM_sk_free(KRB5_APREQBODY, (st)) |
| 794 | #define sk_KRB5_APREQBODY_num(st) SKM_sk_num(KRB5_APREQBODY, (st)) | 958 | #define sk_KRB5_APREQBODY_num(st) SKM_sk_num(KRB5_APREQBODY, (st)) |
| @@ -810,7 +974,7 @@ STACK_OF(type) \ | |||
| 810 | #define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st)) | 974 | #define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st)) |
| 811 | #define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st)) | 975 | #define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st)) |
| 812 | 976 | ||
| 813 | #define sk_KRB5_AUTHDATA_new(st) SKM_sk_new(KRB5_AUTHDATA, (st)) | 977 | #define sk_KRB5_AUTHDATA_new(cmp) SKM_sk_new(KRB5_AUTHDATA, (cmp)) |
| 814 | #define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA) | 978 | #define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA) |
| 815 | #define sk_KRB5_AUTHDATA_free(st) SKM_sk_free(KRB5_AUTHDATA, (st)) | 979 | #define sk_KRB5_AUTHDATA_free(st) SKM_sk_free(KRB5_AUTHDATA, (st)) |
| 816 | #define sk_KRB5_AUTHDATA_num(st) SKM_sk_num(KRB5_AUTHDATA, (st)) | 980 | #define sk_KRB5_AUTHDATA_num(st) SKM_sk_num(KRB5_AUTHDATA, (st)) |
| @@ -832,7 +996,7 @@ STACK_OF(type) \ | |||
| 832 | #define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st)) | 996 | #define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st)) |
| 833 | #define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st)) | 997 | #define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st)) |
| 834 | 998 | ||
| 835 | #define sk_KRB5_AUTHENTBODY_new(st) SKM_sk_new(KRB5_AUTHENTBODY, (st)) | 999 | #define sk_KRB5_AUTHENTBODY_new(cmp) SKM_sk_new(KRB5_AUTHENTBODY, (cmp)) |
| 836 | #define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY) | 1000 | #define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY) |
| 837 | #define sk_KRB5_AUTHENTBODY_free(st) SKM_sk_free(KRB5_AUTHENTBODY, (st)) | 1001 | #define sk_KRB5_AUTHENTBODY_free(st) SKM_sk_free(KRB5_AUTHENTBODY, (st)) |
| 838 | #define sk_KRB5_AUTHENTBODY_num(st) SKM_sk_num(KRB5_AUTHENTBODY, (st)) | 1002 | #define sk_KRB5_AUTHENTBODY_num(st) SKM_sk_num(KRB5_AUTHENTBODY, (st)) |
| @@ -854,7 +1018,7 @@ STACK_OF(type) \ | |||
| 854 | #define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st)) | 1018 | #define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st)) |
| 855 | #define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st)) | 1019 | #define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st)) |
| 856 | 1020 | ||
| 857 | #define sk_KRB5_CHECKSUM_new(st) SKM_sk_new(KRB5_CHECKSUM, (st)) | 1021 | #define sk_KRB5_CHECKSUM_new(cmp) SKM_sk_new(KRB5_CHECKSUM, (cmp)) |
| 858 | #define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM) | 1022 | #define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM) |
| 859 | #define sk_KRB5_CHECKSUM_free(st) SKM_sk_free(KRB5_CHECKSUM, (st)) | 1023 | #define sk_KRB5_CHECKSUM_free(st) SKM_sk_free(KRB5_CHECKSUM, (st)) |
| 860 | #define sk_KRB5_CHECKSUM_num(st) SKM_sk_num(KRB5_CHECKSUM, (st)) | 1024 | #define sk_KRB5_CHECKSUM_num(st) SKM_sk_num(KRB5_CHECKSUM, (st)) |
| @@ -876,7 +1040,7 @@ STACK_OF(type) \ | |||
| 876 | #define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st)) | 1040 | #define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st)) |
| 877 | #define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st)) | 1041 | #define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st)) |
| 878 | 1042 | ||
| 879 | #define sk_KRB5_ENCDATA_new(st) SKM_sk_new(KRB5_ENCDATA, (st)) | 1043 | #define sk_KRB5_ENCDATA_new(cmp) SKM_sk_new(KRB5_ENCDATA, (cmp)) |
| 880 | #define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA) | 1044 | #define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA) |
| 881 | #define sk_KRB5_ENCDATA_free(st) SKM_sk_free(KRB5_ENCDATA, (st)) | 1045 | #define sk_KRB5_ENCDATA_free(st) SKM_sk_free(KRB5_ENCDATA, (st)) |
| 882 | #define sk_KRB5_ENCDATA_num(st) SKM_sk_num(KRB5_ENCDATA, (st)) | 1046 | #define sk_KRB5_ENCDATA_num(st) SKM_sk_num(KRB5_ENCDATA, (st)) |
| @@ -898,7 +1062,7 @@ STACK_OF(type) \ | |||
| 898 | #define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st)) | 1062 | #define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st)) |
| 899 | #define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st)) | 1063 | #define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st)) |
| 900 | 1064 | ||
| 901 | #define sk_KRB5_ENCKEY_new(st) SKM_sk_new(KRB5_ENCKEY, (st)) | 1065 | #define sk_KRB5_ENCKEY_new(cmp) SKM_sk_new(KRB5_ENCKEY, (cmp)) |
| 902 | #define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY) | 1066 | #define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY) |
| 903 | #define sk_KRB5_ENCKEY_free(st) SKM_sk_free(KRB5_ENCKEY, (st)) | 1067 | #define sk_KRB5_ENCKEY_free(st) SKM_sk_free(KRB5_ENCKEY, (st)) |
| 904 | #define sk_KRB5_ENCKEY_num(st) SKM_sk_num(KRB5_ENCKEY, (st)) | 1068 | #define sk_KRB5_ENCKEY_num(st) SKM_sk_num(KRB5_ENCKEY, (st)) |
| @@ -920,7 +1084,7 @@ STACK_OF(type) \ | |||
| 920 | #define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st)) | 1084 | #define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st)) |
| 921 | #define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st)) | 1085 | #define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st)) |
| 922 | 1086 | ||
| 923 | #define sk_KRB5_PRINCNAME_new(st) SKM_sk_new(KRB5_PRINCNAME, (st)) | 1087 | #define sk_KRB5_PRINCNAME_new(cmp) SKM_sk_new(KRB5_PRINCNAME, (cmp)) |
| 924 | #define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME) | 1088 | #define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME) |
| 925 | #define sk_KRB5_PRINCNAME_free(st) SKM_sk_free(KRB5_PRINCNAME, (st)) | 1089 | #define sk_KRB5_PRINCNAME_free(st) SKM_sk_free(KRB5_PRINCNAME, (st)) |
| 926 | #define sk_KRB5_PRINCNAME_num(st) SKM_sk_num(KRB5_PRINCNAME, (st)) | 1090 | #define sk_KRB5_PRINCNAME_num(st) SKM_sk_num(KRB5_PRINCNAME, (st)) |
| @@ -942,7 +1106,7 @@ STACK_OF(type) \ | |||
| 942 | #define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st)) | 1106 | #define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st)) |
| 943 | #define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st)) | 1107 | #define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st)) |
| 944 | 1108 | ||
| 945 | #define sk_KRB5_TKTBODY_new(st) SKM_sk_new(KRB5_TKTBODY, (st)) | 1109 | #define sk_KRB5_TKTBODY_new(cmp) SKM_sk_new(KRB5_TKTBODY, (cmp)) |
| 946 | #define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY) | 1110 | #define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY) |
| 947 | #define sk_KRB5_TKTBODY_free(st) SKM_sk_free(KRB5_TKTBODY, (st)) | 1111 | #define sk_KRB5_TKTBODY_free(st) SKM_sk_free(KRB5_TKTBODY, (st)) |
| 948 | #define sk_KRB5_TKTBODY_num(st) SKM_sk_num(KRB5_TKTBODY, (st)) | 1112 | #define sk_KRB5_TKTBODY_num(st) SKM_sk_num(KRB5_TKTBODY, (st)) |
| @@ -964,7 +1128,29 @@ STACK_OF(type) \ | |||
| 964 | #define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st)) | 1128 | #define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st)) |
| 965 | #define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st)) | 1129 | #define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st)) |
| 966 | 1130 | ||
| 967 | #define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st)) | 1131 | #define sk_MEM_OBJECT_DATA_new(cmp) SKM_sk_new(MEM_OBJECT_DATA, (cmp)) |
| 1132 | #define sk_MEM_OBJECT_DATA_new_null() SKM_sk_new_null(MEM_OBJECT_DATA) | ||
| 1133 | #define sk_MEM_OBJECT_DATA_free(st) SKM_sk_free(MEM_OBJECT_DATA, (st)) | ||
| 1134 | #define sk_MEM_OBJECT_DATA_num(st) SKM_sk_num(MEM_OBJECT_DATA, (st)) | ||
| 1135 | #define sk_MEM_OBJECT_DATA_value(st, i) SKM_sk_value(MEM_OBJECT_DATA, (st), (i)) | ||
| 1136 | #define sk_MEM_OBJECT_DATA_set(st, i, val) SKM_sk_set(MEM_OBJECT_DATA, (st), (i), (val)) | ||
| 1137 | #define sk_MEM_OBJECT_DATA_zero(st) SKM_sk_zero(MEM_OBJECT_DATA, (st)) | ||
| 1138 | #define sk_MEM_OBJECT_DATA_push(st, val) SKM_sk_push(MEM_OBJECT_DATA, (st), (val)) | ||
| 1139 | #define sk_MEM_OBJECT_DATA_unshift(st, val) SKM_sk_unshift(MEM_OBJECT_DATA, (st), (val)) | ||
| 1140 | #define sk_MEM_OBJECT_DATA_find(st, val) SKM_sk_find(MEM_OBJECT_DATA, (st), (val)) | ||
| 1141 | #define sk_MEM_OBJECT_DATA_find_ex(st, val) SKM_sk_find_ex(MEM_OBJECT_DATA, (st), (val)) | ||
| 1142 | #define sk_MEM_OBJECT_DATA_delete(st, i) SKM_sk_delete(MEM_OBJECT_DATA, (st), (i)) | ||
| 1143 | #define sk_MEM_OBJECT_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(MEM_OBJECT_DATA, (st), (ptr)) | ||
| 1144 | #define sk_MEM_OBJECT_DATA_insert(st, val, i) SKM_sk_insert(MEM_OBJECT_DATA, (st), (val), (i)) | ||
| 1145 | #define sk_MEM_OBJECT_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MEM_OBJECT_DATA, (st), (cmp)) | ||
| 1146 | #define sk_MEM_OBJECT_DATA_dup(st) SKM_sk_dup(MEM_OBJECT_DATA, st) | ||
| 1147 | #define sk_MEM_OBJECT_DATA_pop_free(st, free_func) SKM_sk_pop_free(MEM_OBJECT_DATA, (st), (free_func)) | ||
| 1148 | #define sk_MEM_OBJECT_DATA_shift(st) SKM_sk_shift(MEM_OBJECT_DATA, (st)) | ||
| 1149 | #define sk_MEM_OBJECT_DATA_pop(st) SKM_sk_pop(MEM_OBJECT_DATA, (st)) | ||
| 1150 | #define sk_MEM_OBJECT_DATA_sort(st) SKM_sk_sort(MEM_OBJECT_DATA, (st)) | ||
| 1151 | #define sk_MEM_OBJECT_DATA_is_sorted(st) SKM_sk_is_sorted(MEM_OBJECT_DATA, (st)) | ||
| 1152 | |||
| 1153 | #define sk_MIME_HEADER_new(cmp) SKM_sk_new(MIME_HEADER, (cmp)) | ||
| 968 | #define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) | 1154 | #define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) |
| 969 | #define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st)) | 1155 | #define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st)) |
| 970 | #define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st)) | 1156 | #define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st)) |
| @@ -986,51 +1172,7 @@ STACK_OF(type) \ | |||
| 986 | #define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) | 1172 | #define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) |
| 987 | #define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st)) | 1173 | #define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st)) |
| 988 | 1174 | ||
| 989 | #define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st)) | 1175 | #define sk_MIME_PARAM_new(cmp) SKM_sk_new(MIME_PARAM, (cmp)) |
| 990 | #define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) | ||
| 991 | #define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st)) | ||
| 992 | #define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st)) | ||
| 993 | #define sk_MIME_HEADER_value(st, i) SKM_sk_value(MIME_HEADER, (st), (i)) | ||
| 994 | #define sk_MIME_HEADER_set(st, i, val) SKM_sk_set(MIME_HEADER, (st), (i), (val)) | ||
| 995 | #define sk_MIME_HEADER_zero(st) SKM_sk_zero(MIME_HEADER, (st)) | ||
| 996 | #define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val)) | ||
| 997 | #define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val)) | ||
| 998 | #define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val)) | ||
| 999 | #define sk_MIME_HEADER_find_ex(st, val) SKM_sk_find_ex(MIME_HEADER, (st), (val)) | ||
| 1000 | #define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i)) | ||
| 1001 | #define sk_MIME_HEADER_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr)) | ||
| 1002 | #define sk_MIME_HEADER_insert(st, val, i) SKM_sk_insert(MIME_HEADER, (st), (val), (i)) | ||
| 1003 | #define sk_MIME_HEADER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_HEADER, (st), (cmp)) | ||
| 1004 | #define sk_MIME_HEADER_dup(st) SKM_sk_dup(MIME_HEADER, st) | ||
| 1005 | #define sk_MIME_HEADER_pop_free(st, free_func) SKM_sk_pop_free(MIME_HEADER, (st), (free_func)) | ||
| 1006 | #define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) | ||
| 1007 | #define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) | ||
| 1008 | #define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) | ||
| 1009 | #define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st)) | ||
| 1010 | |||
| 1011 | #define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st)) | ||
| 1012 | #define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) | ||
| 1013 | #define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st)) | ||
| 1014 | #define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st)) | ||
| 1015 | #define sk_MIME_PARAM_value(st, i) SKM_sk_value(MIME_PARAM, (st), (i)) | ||
| 1016 | #define sk_MIME_PARAM_set(st, i, val) SKM_sk_set(MIME_PARAM, (st), (i), (val)) | ||
| 1017 | #define sk_MIME_PARAM_zero(st) SKM_sk_zero(MIME_PARAM, (st)) | ||
| 1018 | #define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val)) | ||
| 1019 | #define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val)) | ||
| 1020 | #define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val)) | ||
| 1021 | #define sk_MIME_PARAM_find_ex(st, val) SKM_sk_find_ex(MIME_PARAM, (st), (val)) | ||
| 1022 | #define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i)) | ||
| 1023 | #define sk_MIME_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr)) | ||
| 1024 | #define sk_MIME_PARAM_insert(st, val, i) SKM_sk_insert(MIME_PARAM, (st), (val), (i)) | ||
| 1025 | #define sk_MIME_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_PARAM, (st), (cmp)) | ||
| 1026 | #define sk_MIME_PARAM_dup(st) SKM_sk_dup(MIME_PARAM, st) | ||
| 1027 | #define sk_MIME_PARAM_pop_free(st, free_func) SKM_sk_pop_free(MIME_PARAM, (st), (free_func)) | ||
| 1028 | #define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) | ||
| 1029 | #define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) | ||
| 1030 | #define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) | ||
| 1031 | #define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st)) | ||
| 1032 | |||
| 1033 | #define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st)) | ||
| 1034 | #define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) | 1176 | #define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) |
| 1035 | #define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st)) | 1177 | #define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st)) |
| 1036 | #define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st)) | 1178 | #define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st)) |
| @@ -1052,7 +1194,7 @@ STACK_OF(type) \ | |||
| 1052 | #define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) | 1194 | #define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) |
| 1053 | #define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st)) | 1195 | #define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st)) |
| 1054 | 1196 | ||
| 1055 | #define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st)) | 1197 | #define sk_NAME_FUNCS_new(cmp) SKM_sk_new(NAME_FUNCS, (cmp)) |
| 1056 | #define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) | 1198 | #define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) |
| 1057 | #define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st)) | 1199 | #define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st)) |
| 1058 | #define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st)) | 1200 | #define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st)) |
| @@ -1074,7 +1216,7 @@ STACK_OF(type) \ | |||
| 1074 | #define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) | 1216 | #define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) |
| 1075 | #define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st)) | 1217 | #define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st)) |
| 1076 | 1218 | ||
| 1077 | #define sk_OCSP_CERTID_new(st) SKM_sk_new(OCSP_CERTID, (st)) | 1219 | #define sk_OCSP_CERTID_new(cmp) SKM_sk_new(OCSP_CERTID, (cmp)) |
| 1078 | #define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID) | 1220 | #define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID) |
| 1079 | #define sk_OCSP_CERTID_free(st) SKM_sk_free(OCSP_CERTID, (st)) | 1221 | #define sk_OCSP_CERTID_free(st) SKM_sk_free(OCSP_CERTID, (st)) |
| 1080 | #define sk_OCSP_CERTID_num(st) SKM_sk_num(OCSP_CERTID, (st)) | 1222 | #define sk_OCSP_CERTID_num(st) SKM_sk_num(OCSP_CERTID, (st)) |
| @@ -1096,7 +1238,7 @@ STACK_OF(type) \ | |||
| 1096 | #define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st)) | 1238 | #define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st)) |
| 1097 | #define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st)) | 1239 | #define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st)) |
| 1098 | 1240 | ||
| 1099 | #define sk_OCSP_ONEREQ_new(st) SKM_sk_new(OCSP_ONEREQ, (st)) | 1241 | #define sk_OCSP_ONEREQ_new(cmp) SKM_sk_new(OCSP_ONEREQ, (cmp)) |
| 1100 | #define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ) | 1242 | #define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ) |
| 1101 | #define sk_OCSP_ONEREQ_free(st) SKM_sk_free(OCSP_ONEREQ, (st)) | 1243 | #define sk_OCSP_ONEREQ_free(st) SKM_sk_free(OCSP_ONEREQ, (st)) |
| 1102 | #define sk_OCSP_ONEREQ_num(st) SKM_sk_num(OCSP_ONEREQ, (st)) | 1244 | #define sk_OCSP_ONEREQ_num(st) SKM_sk_num(OCSP_ONEREQ, (st)) |
| @@ -1118,7 +1260,7 @@ STACK_OF(type) \ | |||
| 1118 | #define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st)) | 1260 | #define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st)) |
| 1119 | #define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st)) | 1261 | #define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st)) |
| 1120 | 1262 | ||
| 1121 | #define sk_OCSP_RESPID_new(st) SKM_sk_new(OCSP_RESPID, (st)) | 1263 | #define sk_OCSP_RESPID_new(cmp) SKM_sk_new(OCSP_RESPID, (cmp)) |
| 1122 | #define sk_OCSP_RESPID_new_null() SKM_sk_new_null(OCSP_RESPID) | 1264 | #define sk_OCSP_RESPID_new_null() SKM_sk_new_null(OCSP_RESPID) |
| 1123 | #define sk_OCSP_RESPID_free(st) SKM_sk_free(OCSP_RESPID, (st)) | 1265 | #define sk_OCSP_RESPID_free(st) SKM_sk_free(OCSP_RESPID, (st)) |
| 1124 | #define sk_OCSP_RESPID_num(st) SKM_sk_num(OCSP_RESPID, (st)) | 1266 | #define sk_OCSP_RESPID_num(st) SKM_sk_num(OCSP_RESPID, (st)) |
| @@ -1140,7 +1282,7 @@ STACK_OF(type) \ | |||
| 1140 | #define sk_OCSP_RESPID_sort(st) SKM_sk_sort(OCSP_RESPID, (st)) | 1282 | #define sk_OCSP_RESPID_sort(st) SKM_sk_sort(OCSP_RESPID, (st)) |
| 1141 | #define sk_OCSP_RESPID_is_sorted(st) SKM_sk_is_sorted(OCSP_RESPID, (st)) | 1283 | #define sk_OCSP_RESPID_is_sorted(st) SKM_sk_is_sorted(OCSP_RESPID, (st)) |
| 1142 | 1284 | ||
| 1143 | #define sk_OCSP_SINGLERESP_new(st) SKM_sk_new(OCSP_SINGLERESP, (st)) | 1285 | #define sk_OCSP_SINGLERESP_new(cmp) SKM_sk_new(OCSP_SINGLERESP, (cmp)) |
| 1144 | #define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP) | 1286 | #define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP) |
| 1145 | #define sk_OCSP_SINGLERESP_free(st) SKM_sk_free(OCSP_SINGLERESP, (st)) | 1287 | #define sk_OCSP_SINGLERESP_free(st) SKM_sk_free(OCSP_SINGLERESP, (st)) |
| 1146 | #define sk_OCSP_SINGLERESP_num(st) SKM_sk_num(OCSP_SINGLERESP, (st)) | 1288 | #define sk_OCSP_SINGLERESP_num(st) SKM_sk_num(OCSP_SINGLERESP, (st)) |
| @@ -1162,7 +1304,7 @@ STACK_OF(type) \ | |||
| 1162 | #define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st)) | 1304 | #define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st)) |
| 1163 | #define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st)) | 1305 | #define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st)) |
| 1164 | 1306 | ||
| 1165 | #define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st)) | 1307 | #define sk_PKCS12_SAFEBAG_new(cmp) SKM_sk_new(PKCS12_SAFEBAG, (cmp)) |
| 1166 | #define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) | 1308 | #define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) |
| 1167 | #define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st)) | 1309 | #define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st)) |
| 1168 | #define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st)) | 1310 | #define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st)) |
| @@ -1184,7 +1326,7 @@ STACK_OF(type) \ | |||
| 1184 | #define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) | 1326 | #define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) |
| 1185 | #define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st)) | 1327 | #define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st)) |
| 1186 | 1328 | ||
| 1187 | #define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st)) | 1329 | #define sk_PKCS7_new(cmp) SKM_sk_new(PKCS7, (cmp)) |
| 1188 | #define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) | 1330 | #define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) |
| 1189 | #define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st)) | 1331 | #define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st)) |
| 1190 | #define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st)) | 1332 | #define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st)) |
| @@ -1206,7 +1348,7 @@ STACK_OF(type) \ | |||
| 1206 | #define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) | 1348 | #define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) |
| 1207 | #define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st)) | 1349 | #define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st)) |
| 1208 | 1350 | ||
| 1209 | #define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st)) | 1351 | #define sk_PKCS7_RECIP_INFO_new(cmp) SKM_sk_new(PKCS7_RECIP_INFO, (cmp)) |
| 1210 | #define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) | 1352 | #define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) |
| 1211 | #define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st)) | 1353 | #define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st)) |
| 1212 | #define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st)) | 1354 | #define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st)) |
| @@ -1228,7 +1370,7 @@ STACK_OF(type) \ | |||
| 1228 | #define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) | 1370 | #define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) |
| 1229 | #define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st)) | 1371 | #define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st)) |
| 1230 | 1372 | ||
| 1231 | #define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st)) | 1373 | #define sk_PKCS7_SIGNER_INFO_new(cmp) SKM_sk_new(PKCS7_SIGNER_INFO, (cmp)) |
| 1232 | #define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) | 1374 | #define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) |
| 1233 | #define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st)) | 1375 | #define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st)) |
| 1234 | #define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st)) | 1376 | #define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st)) |
| @@ -1250,7 +1392,7 @@ STACK_OF(type) \ | |||
| 1250 | #define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) | 1392 | #define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) |
| 1251 | #define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st)) | 1393 | #define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st)) |
| 1252 | 1394 | ||
| 1253 | #define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st)) | 1395 | #define sk_POLICYINFO_new(cmp) SKM_sk_new(POLICYINFO, (cmp)) |
| 1254 | #define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) | 1396 | #define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) |
| 1255 | #define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st)) | 1397 | #define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st)) |
| 1256 | #define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st)) | 1398 | #define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st)) |
| @@ -1272,7 +1414,7 @@ STACK_OF(type) \ | |||
| 1272 | #define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) | 1414 | #define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) |
| 1273 | #define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st)) | 1415 | #define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st)) |
| 1274 | 1416 | ||
| 1275 | #define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st)) | 1417 | #define sk_POLICYQUALINFO_new(cmp) SKM_sk_new(POLICYQUALINFO, (cmp)) |
| 1276 | #define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) | 1418 | #define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) |
| 1277 | #define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st)) | 1419 | #define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st)) |
| 1278 | #define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st)) | 1420 | #define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st)) |
| @@ -1294,7 +1436,7 @@ STACK_OF(type) \ | |||
| 1294 | #define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) | 1436 | #define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) |
| 1295 | #define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st)) | 1437 | #define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st)) |
| 1296 | 1438 | ||
| 1297 | #define sk_POLICY_MAPPING_new(st) SKM_sk_new(POLICY_MAPPING, (st)) | 1439 | #define sk_POLICY_MAPPING_new(cmp) SKM_sk_new(POLICY_MAPPING, (cmp)) |
| 1298 | #define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING) | 1440 | #define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING) |
| 1299 | #define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st)) | 1441 | #define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st)) |
| 1300 | #define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st)) | 1442 | #define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st)) |
| @@ -1316,7 +1458,7 @@ STACK_OF(type) \ | |||
| 1316 | #define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st)) | 1458 | #define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st)) |
| 1317 | #define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (st)) | 1459 | #define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (st)) |
| 1318 | 1460 | ||
| 1319 | #define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st)) | 1461 | #define sk_SSL_CIPHER_new(cmp) SKM_sk_new(SSL_CIPHER, (cmp)) |
| 1320 | #define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) | 1462 | #define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) |
| 1321 | #define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st)) | 1463 | #define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st)) |
| 1322 | #define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st)) | 1464 | #define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st)) |
| @@ -1338,7 +1480,7 @@ STACK_OF(type) \ | |||
| 1338 | #define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) | 1480 | #define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) |
| 1339 | #define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st)) | 1481 | #define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st)) |
| 1340 | 1482 | ||
| 1341 | #define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st)) | 1483 | #define sk_SSL_COMP_new(cmp) SKM_sk_new(SSL_COMP, (cmp)) |
| 1342 | #define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) | 1484 | #define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) |
| 1343 | #define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st)) | 1485 | #define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st)) |
| 1344 | #define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st)) | 1486 | #define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st)) |
| @@ -1360,7 +1502,51 @@ STACK_OF(type) \ | |||
| 1360 | #define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) | 1502 | #define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) |
| 1361 | #define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st)) | 1503 | #define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st)) |
| 1362 | 1504 | ||
| 1363 | #define sk_STORE_OBJECT_new(st) SKM_sk_new(STORE_OBJECT, (st)) | 1505 | #define sk_STACK_OF_X509_NAME_ENTRY_new(cmp) SKM_sk_new(STACK_OF_X509_NAME_ENTRY, (cmp)) |
| 1506 | #define sk_STACK_OF_X509_NAME_ENTRY_new_null() SKM_sk_new_null(STACK_OF_X509_NAME_ENTRY) | ||
| 1507 | #define sk_STACK_OF_X509_NAME_ENTRY_free(st) SKM_sk_free(STACK_OF_X509_NAME_ENTRY, (st)) | ||
| 1508 | #define sk_STACK_OF_X509_NAME_ENTRY_num(st) SKM_sk_num(STACK_OF_X509_NAME_ENTRY, (st)) | ||
| 1509 | #define sk_STACK_OF_X509_NAME_ENTRY_value(st, i) SKM_sk_value(STACK_OF_X509_NAME_ENTRY, (st), (i)) | ||
| 1510 | #define sk_STACK_OF_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(STACK_OF_X509_NAME_ENTRY, (st), (i), (val)) | ||
| 1511 | #define sk_STACK_OF_X509_NAME_ENTRY_zero(st) SKM_sk_zero(STACK_OF_X509_NAME_ENTRY, (st)) | ||
| 1512 | #define sk_STACK_OF_X509_NAME_ENTRY_push(st, val) SKM_sk_push(STACK_OF_X509_NAME_ENTRY, (st), (val)) | ||
| 1513 | #define sk_STACK_OF_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(STACK_OF_X509_NAME_ENTRY, (st), (val)) | ||
| 1514 | #define sk_STACK_OF_X509_NAME_ENTRY_find(st, val) SKM_sk_find(STACK_OF_X509_NAME_ENTRY, (st), (val)) | ||
| 1515 | #define sk_STACK_OF_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(STACK_OF_X509_NAME_ENTRY, (st), (val)) | ||
| 1516 | #define sk_STACK_OF_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(STACK_OF_X509_NAME_ENTRY, (st), (i)) | ||
| 1517 | #define sk_STACK_OF_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(STACK_OF_X509_NAME_ENTRY, (st), (ptr)) | ||
| 1518 | #define sk_STACK_OF_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(STACK_OF_X509_NAME_ENTRY, (st), (val), (i)) | ||
| 1519 | #define sk_STACK_OF_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STACK_OF_X509_NAME_ENTRY, (st), (cmp)) | ||
| 1520 | #define sk_STACK_OF_X509_NAME_ENTRY_dup(st) SKM_sk_dup(STACK_OF_X509_NAME_ENTRY, st) | ||
| 1521 | #define sk_STACK_OF_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(STACK_OF_X509_NAME_ENTRY, (st), (free_func)) | ||
| 1522 | #define sk_STACK_OF_X509_NAME_ENTRY_shift(st) SKM_sk_shift(STACK_OF_X509_NAME_ENTRY, (st)) | ||
| 1523 | #define sk_STACK_OF_X509_NAME_ENTRY_pop(st) SKM_sk_pop(STACK_OF_X509_NAME_ENTRY, (st)) | ||
| 1524 | #define sk_STACK_OF_X509_NAME_ENTRY_sort(st) SKM_sk_sort(STACK_OF_X509_NAME_ENTRY, (st)) | ||
| 1525 | #define sk_STACK_OF_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(STACK_OF_X509_NAME_ENTRY, (st)) | ||
| 1526 | |||
| 1527 | #define sk_STORE_ATTR_INFO_new(cmp) SKM_sk_new(STORE_ATTR_INFO, (cmp)) | ||
| 1528 | #define sk_STORE_ATTR_INFO_new_null() SKM_sk_new_null(STORE_ATTR_INFO) | ||
| 1529 | #define sk_STORE_ATTR_INFO_free(st) SKM_sk_free(STORE_ATTR_INFO, (st)) | ||
| 1530 | #define sk_STORE_ATTR_INFO_num(st) SKM_sk_num(STORE_ATTR_INFO, (st)) | ||
| 1531 | #define sk_STORE_ATTR_INFO_value(st, i) SKM_sk_value(STORE_ATTR_INFO, (st), (i)) | ||
| 1532 | #define sk_STORE_ATTR_INFO_set(st, i, val) SKM_sk_set(STORE_ATTR_INFO, (st), (i), (val)) | ||
| 1533 | #define sk_STORE_ATTR_INFO_zero(st) SKM_sk_zero(STORE_ATTR_INFO, (st)) | ||
| 1534 | #define sk_STORE_ATTR_INFO_push(st, val) SKM_sk_push(STORE_ATTR_INFO, (st), (val)) | ||
| 1535 | #define sk_STORE_ATTR_INFO_unshift(st, val) SKM_sk_unshift(STORE_ATTR_INFO, (st), (val)) | ||
| 1536 | #define sk_STORE_ATTR_INFO_find(st, val) SKM_sk_find(STORE_ATTR_INFO, (st), (val)) | ||
| 1537 | #define sk_STORE_ATTR_INFO_find_ex(st, val) SKM_sk_find_ex(STORE_ATTR_INFO, (st), (val)) | ||
| 1538 | #define sk_STORE_ATTR_INFO_delete(st, i) SKM_sk_delete(STORE_ATTR_INFO, (st), (i)) | ||
| 1539 | #define sk_STORE_ATTR_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_ATTR_INFO, (st), (ptr)) | ||
| 1540 | #define sk_STORE_ATTR_INFO_insert(st, val, i) SKM_sk_insert(STORE_ATTR_INFO, (st), (val), (i)) | ||
| 1541 | #define sk_STORE_ATTR_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_ATTR_INFO, (st), (cmp)) | ||
| 1542 | #define sk_STORE_ATTR_INFO_dup(st) SKM_sk_dup(STORE_ATTR_INFO, st) | ||
| 1543 | #define sk_STORE_ATTR_INFO_pop_free(st, free_func) SKM_sk_pop_free(STORE_ATTR_INFO, (st), (free_func)) | ||
| 1544 | #define sk_STORE_ATTR_INFO_shift(st) SKM_sk_shift(STORE_ATTR_INFO, (st)) | ||
| 1545 | #define sk_STORE_ATTR_INFO_pop(st) SKM_sk_pop(STORE_ATTR_INFO, (st)) | ||
| 1546 | #define sk_STORE_ATTR_INFO_sort(st) SKM_sk_sort(STORE_ATTR_INFO, (st)) | ||
| 1547 | #define sk_STORE_ATTR_INFO_is_sorted(st) SKM_sk_is_sorted(STORE_ATTR_INFO, (st)) | ||
| 1548 | |||
| 1549 | #define sk_STORE_OBJECT_new(cmp) SKM_sk_new(STORE_OBJECT, (cmp)) | ||
| 1364 | #define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT) | 1550 | #define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT) |
| 1365 | #define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st)) | 1551 | #define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st)) |
| 1366 | #define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st)) | 1552 | #define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st)) |
| @@ -1382,7 +1568,7 @@ STACK_OF(type) \ | |||
| 1382 | #define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st)) | 1568 | #define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st)) |
| 1383 | #define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st)) | 1569 | #define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st)) |
| 1384 | 1570 | ||
| 1385 | #define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st)) | 1571 | #define sk_SXNETID_new(cmp) SKM_sk_new(SXNETID, (cmp)) |
| 1386 | #define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) | 1572 | #define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) |
| 1387 | #define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st)) | 1573 | #define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st)) |
| 1388 | #define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st)) | 1574 | #define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st)) |
| @@ -1404,7 +1590,7 @@ STACK_OF(type) \ | |||
| 1404 | #define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) | 1590 | #define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) |
| 1405 | #define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st)) | 1591 | #define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st)) |
| 1406 | 1592 | ||
| 1407 | #define sk_UI_STRING_new(st) SKM_sk_new(UI_STRING, (st)) | 1593 | #define sk_UI_STRING_new(cmp) SKM_sk_new(UI_STRING, (cmp)) |
| 1408 | #define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) | 1594 | #define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) |
| 1409 | #define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st)) | 1595 | #define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st)) |
| 1410 | #define sk_UI_STRING_num(st) SKM_sk_num(UI_STRING, (st)) | 1596 | #define sk_UI_STRING_num(st) SKM_sk_num(UI_STRING, (st)) |
| @@ -1426,7 +1612,7 @@ STACK_OF(type) \ | |||
| 1426 | #define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st)) | 1612 | #define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st)) |
| 1427 | #define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st)) | 1613 | #define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st)) |
| 1428 | 1614 | ||
| 1429 | #define sk_X509_new(st) SKM_sk_new(X509, (st)) | 1615 | #define sk_X509_new(cmp) SKM_sk_new(X509, (cmp)) |
| 1430 | #define sk_X509_new_null() SKM_sk_new_null(X509) | 1616 | #define sk_X509_new_null() SKM_sk_new_null(X509) |
| 1431 | #define sk_X509_free(st) SKM_sk_free(X509, (st)) | 1617 | #define sk_X509_free(st) SKM_sk_free(X509, (st)) |
| 1432 | #define sk_X509_num(st) SKM_sk_num(X509, (st)) | 1618 | #define sk_X509_num(st) SKM_sk_num(X509, (st)) |
| @@ -1448,7 +1634,7 @@ STACK_OF(type) \ | |||
| 1448 | #define sk_X509_sort(st) SKM_sk_sort(X509, (st)) | 1634 | #define sk_X509_sort(st) SKM_sk_sort(X509, (st)) |
| 1449 | #define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st)) | 1635 | #define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st)) |
| 1450 | 1636 | ||
| 1451 | #define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st)) | 1637 | #define sk_X509V3_EXT_METHOD_new(cmp) SKM_sk_new(X509V3_EXT_METHOD, (cmp)) |
| 1452 | #define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) | 1638 | #define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) |
| 1453 | #define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st)) | 1639 | #define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st)) |
| 1454 | #define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st)) | 1640 | #define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st)) |
| @@ -1470,7 +1656,7 @@ STACK_OF(type) \ | |||
| 1470 | #define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) | 1656 | #define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) |
| 1471 | #define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st)) | 1657 | #define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st)) |
| 1472 | 1658 | ||
| 1473 | #define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st)) | 1659 | #define sk_X509_ALGOR_new(cmp) SKM_sk_new(X509_ALGOR, (cmp)) |
| 1474 | #define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) | 1660 | #define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) |
| 1475 | #define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st)) | 1661 | #define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st)) |
| 1476 | #define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st)) | 1662 | #define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st)) |
| @@ -1492,7 +1678,7 @@ STACK_OF(type) \ | |||
| 1492 | #define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) | 1678 | #define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) |
| 1493 | #define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st)) | 1679 | #define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st)) |
| 1494 | 1680 | ||
| 1495 | #define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st)) | 1681 | #define sk_X509_ATTRIBUTE_new(cmp) SKM_sk_new(X509_ATTRIBUTE, (cmp)) |
| 1496 | #define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) | 1682 | #define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) |
| 1497 | #define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st)) | 1683 | #define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st)) |
| 1498 | #define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st)) | 1684 | #define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st)) |
| @@ -1514,7 +1700,7 @@ STACK_OF(type) \ | |||
| 1514 | #define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) | 1700 | #define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) |
| 1515 | #define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st)) | 1701 | #define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st)) |
| 1516 | 1702 | ||
| 1517 | #define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st)) | 1703 | #define sk_X509_CRL_new(cmp) SKM_sk_new(X509_CRL, (cmp)) |
| 1518 | #define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) | 1704 | #define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) |
| 1519 | #define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st)) | 1705 | #define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st)) |
| 1520 | #define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st)) | 1706 | #define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st)) |
| @@ -1536,7 +1722,7 @@ STACK_OF(type) \ | |||
| 1536 | #define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) | 1722 | #define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) |
| 1537 | #define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st)) | 1723 | #define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st)) |
| 1538 | 1724 | ||
| 1539 | #define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st)) | 1725 | #define sk_X509_EXTENSION_new(cmp) SKM_sk_new(X509_EXTENSION, (cmp)) |
| 1540 | #define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) | 1726 | #define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) |
| 1541 | #define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st)) | 1727 | #define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st)) |
| 1542 | #define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st)) | 1728 | #define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st)) |
| @@ -1558,7 +1744,7 @@ STACK_OF(type) \ | |||
| 1558 | #define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) | 1744 | #define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) |
| 1559 | #define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st)) | 1745 | #define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st)) |
| 1560 | 1746 | ||
| 1561 | #define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st)) | 1747 | #define sk_X509_INFO_new(cmp) SKM_sk_new(X509_INFO, (cmp)) |
| 1562 | #define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) | 1748 | #define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) |
| 1563 | #define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st)) | 1749 | #define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st)) |
| 1564 | #define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st)) | 1750 | #define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st)) |
| @@ -1580,7 +1766,7 @@ STACK_OF(type) \ | |||
| 1580 | #define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) | 1766 | #define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) |
| 1581 | #define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st)) | 1767 | #define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st)) |
| 1582 | 1768 | ||
| 1583 | #define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st)) | 1769 | #define sk_X509_LOOKUP_new(cmp) SKM_sk_new(X509_LOOKUP, (cmp)) |
| 1584 | #define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) | 1770 | #define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) |
| 1585 | #define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st)) | 1771 | #define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st)) |
| 1586 | #define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st)) | 1772 | #define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st)) |
| @@ -1602,7 +1788,7 @@ STACK_OF(type) \ | |||
| 1602 | #define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) | 1788 | #define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) |
| 1603 | #define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st)) | 1789 | #define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st)) |
| 1604 | 1790 | ||
| 1605 | #define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st)) | 1791 | #define sk_X509_NAME_new(cmp) SKM_sk_new(X509_NAME, (cmp)) |
| 1606 | #define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) | 1792 | #define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) |
| 1607 | #define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st)) | 1793 | #define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st)) |
| 1608 | #define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st)) | 1794 | #define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st)) |
| @@ -1624,7 +1810,7 @@ STACK_OF(type) \ | |||
| 1624 | #define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) | 1810 | #define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) |
| 1625 | #define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st)) | 1811 | #define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st)) |
| 1626 | 1812 | ||
| 1627 | #define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st)) | 1813 | #define sk_X509_NAME_ENTRY_new(cmp) SKM_sk_new(X509_NAME_ENTRY, (cmp)) |
| 1628 | #define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) | 1814 | #define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) |
| 1629 | #define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st)) | 1815 | #define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st)) |
| 1630 | #define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st)) | 1816 | #define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st)) |
| @@ -1646,7 +1832,7 @@ STACK_OF(type) \ | |||
| 1646 | #define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) | 1832 | #define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) |
| 1647 | #define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st)) | 1833 | #define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st)) |
| 1648 | 1834 | ||
| 1649 | #define sk_X509_OBJECT_new(st) SKM_sk_new(X509_OBJECT, (st)) | 1835 | #define sk_X509_OBJECT_new(cmp) SKM_sk_new(X509_OBJECT, (cmp)) |
| 1650 | #define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT) | 1836 | #define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT) |
| 1651 | #define sk_X509_OBJECT_free(st) SKM_sk_free(X509_OBJECT, (st)) | 1837 | #define sk_X509_OBJECT_free(st) SKM_sk_free(X509_OBJECT, (st)) |
| 1652 | #define sk_X509_OBJECT_num(st) SKM_sk_num(X509_OBJECT, (st)) | 1838 | #define sk_X509_OBJECT_num(st) SKM_sk_num(X509_OBJECT, (st)) |
| @@ -1668,7 +1854,7 @@ STACK_OF(type) \ | |||
| 1668 | #define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st)) | 1854 | #define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st)) |
| 1669 | #define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st)) | 1855 | #define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st)) |
| 1670 | 1856 | ||
| 1671 | #define sk_X509_POLICY_DATA_new(st) SKM_sk_new(X509_POLICY_DATA, (st)) | 1857 | #define sk_X509_POLICY_DATA_new(cmp) SKM_sk_new(X509_POLICY_DATA, (cmp)) |
| 1672 | #define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA) | 1858 | #define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA) |
| 1673 | #define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st)) | 1859 | #define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st)) |
| 1674 | #define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st)) | 1860 | #define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st)) |
| @@ -1690,7 +1876,7 @@ STACK_OF(type) \ | |||
| 1690 | #define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st)) | 1876 | #define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st)) |
| 1691 | #define sk_X509_POLICY_DATA_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_DATA, (st)) | 1877 | #define sk_X509_POLICY_DATA_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_DATA, (st)) |
| 1692 | 1878 | ||
| 1693 | #define sk_X509_POLICY_NODE_new(st) SKM_sk_new(X509_POLICY_NODE, (st)) | 1879 | #define sk_X509_POLICY_NODE_new(cmp) SKM_sk_new(X509_POLICY_NODE, (cmp)) |
| 1694 | #define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE) | 1880 | #define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE) |
| 1695 | #define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st)) | 1881 | #define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st)) |
| 1696 | #define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st)) | 1882 | #define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st)) |
| @@ -1712,29 +1898,7 @@ STACK_OF(type) \ | |||
| 1712 | #define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st)) | 1898 | #define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st)) |
| 1713 | #define sk_X509_POLICY_NODE_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_NODE, (st)) | 1899 | #define sk_X509_POLICY_NODE_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_NODE, (st)) |
| 1714 | 1900 | ||
| 1715 | #define sk_X509_POLICY_REF_new(st) SKM_sk_new(X509_POLICY_REF, (st)) | 1901 | #define sk_X509_PURPOSE_new(cmp) SKM_sk_new(X509_PURPOSE, (cmp)) |
| 1716 | #define sk_X509_POLICY_REF_new_null() SKM_sk_new_null(X509_POLICY_REF) | ||
| 1717 | #define sk_X509_POLICY_REF_free(st) SKM_sk_free(X509_POLICY_REF, (st)) | ||
| 1718 | #define sk_X509_POLICY_REF_num(st) SKM_sk_num(X509_POLICY_REF, (st)) | ||
| 1719 | #define sk_X509_POLICY_REF_value(st, i) SKM_sk_value(X509_POLICY_REF, (st), (i)) | ||
| 1720 | #define sk_X509_POLICY_REF_set(st, i, val) SKM_sk_set(X509_POLICY_REF, (st), (i), (val)) | ||
| 1721 | #define sk_X509_POLICY_REF_zero(st) SKM_sk_zero(X509_POLICY_REF, (st)) | ||
| 1722 | #define sk_X509_POLICY_REF_push(st, val) SKM_sk_push(X509_POLICY_REF, (st), (val)) | ||
| 1723 | #define sk_X509_POLICY_REF_unshift(st, val) SKM_sk_unshift(X509_POLICY_REF, (st), (val)) | ||
| 1724 | #define sk_X509_POLICY_REF_find(st, val) SKM_sk_find(X509_POLICY_REF, (st), (val)) | ||
| 1725 | #define sk_X509_POLICY_REF_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_REF, (st), (val)) | ||
| 1726 | #define sk_X509_POLICY_REF_delete(st, i) SKM_sk_delete(X509_POLICY_REF, (st), (i)) | ||
| 1727 | #define sk_X509_POLICY_REF_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_REF, (st), (ptr)) | ||
| 1728 | #define sk_X509_POLICY_REF_insert(st, val, i) SKM_sk_insert(X509_POLICY_REF, (st), (val), (i)) | ||
| 1729 | #define sk_X509_POLICY_REF_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_REF, (st), (cmp)) | ||
| 1730 | #define sk_X509_POLICY_REF_dup(st) SKM_sk_dup(X509_POLICY_REF, st) | ||
| 1731 | #define sk_X509_POLICY_REF_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_REF, (st), (free_func)) | ||
| 1732 | #define sk_X509_POLICY_REF_shift(st) SKM_sk_shift(X509_POLICY_REF, (st)) | ||
| 1733 | #define sk_X509_POLICY_REF_pop(st) SKM_sk_pop(X509_POLICY_REF, (st)) | ||
| 1734 | #define sk_X509_POLICY_REF_sort(st) SKM_sk_sort(X509_POLICY_REF, (st)) | ||
| 1735 | #define sk_X509_POLICY_REF_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_REF, (st)) | ||
| 1736 | |||
| 1737 | #define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st)) | ||
| 1738 | #define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) | 1902 | #define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) |
| 1739 | #define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st)) | 1903 | #define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st)) |
| 1740 | #define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st)) | 1904 | #define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st)) |
| @@ -1756,7 +1920,7 @@ STACK_OF(type) \ | |||
| 1756 | #define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) | 1920 | #define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) |
| 1757 | #define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st)) | 1921 | #define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st)) |
| 1758 | 1922 | ||
| 1759 | #define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st)) | 1923 | #define sk_X509_REVOKED_new(cmp) SKM_sk_new(X509_REVOKED, (cmp)) |
| 1760 | #define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) | 1924 | #define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) |
| 1761 | #define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st)) | 1925 | #define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st)) |
| 1762 | #define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st)) | 1926 | #define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st)) |
| @@ -1778,7 +1942,7 @@ STACK_OF(type) \ | |||
| 1778 | #define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) | 1942 | #define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) |
| 1779 | #define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st)) | 1943 | #define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st)) |
| 1780 | 1944 | ||
| 1781 | #define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st)) | 1945 | #define sk_X509_TRUST_new(cmp) SKM_sk_new(X509_TRUST, (cmp)) |
| 1782 | #define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) | 1946 | #define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) |
| 1783 | #define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st)) | 1947 | #define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st)) |
| 1784 | #define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st)) | 1948 | #define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st)) |
| @@ -1800,7 +1964,7 @@ STACK_OF(type) \ | |||
| 1800 | #define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) | 1964 | #define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) |
| 1801 | #define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st)) | 1965 | #define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st)) |
| 1802 | 1966 | ||
| 1803 | #define sk_X509_VERIFY_PARAM_new(st) SKM_sk_new(X509_VERIFY_PARAM, (st)) | 1967 | #define sk_X509_VERIFY_PARAM_new(cmp) SKM_sk_new(X509_VERIFY_PARAM, (cmp)) |
| 1804 | #define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM) | 1968 | #define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM) |
| 1805 | #define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st)) | 1969 | #define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st)) |
| 1806 | #define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st)) | 1970 | #define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st)) |
| @@ -1822,6 +1986,125 @@ STACK_OF(type) \ | |||
| 1822 | #define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st)) | 1986 | #define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st)) |
| 1823 | #define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PARAM, (st)) | 1987 | #define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PARAM, (st)) |
| 1824 | 1988 | ||
| 1989 | #define sk_nid_triple_new(cmp) SKM_sk_new(nid_triple, (cmp)) | ||
| 1990 | #define sk_nid_triple_new_null() SKM_sk_new_null(nid_triple) | ||
| 1991 | #define sk_nid_triple_free(st) SKM_sk_free(nid_triple, (st)) | ||
| 1992 | #define sk_nid_triple_num(st) SKM_sk_num(nid_triple, (st)) | ||
| 1993 | #define sk_nid_triple_value(st, i) SKM_sk_value(nid_triple, (st), (i)) | ||
| 1994 | #define sk_nid_triple_set(st, i, val) SKM_sk_set(nid_triple, (st), (i), (val)) | ||
| 1995 | #define sk_nid_triple_zero(st) SKM_sk_zero(nid_triple, (st)) | ||
| 1996 | #define sk_nid_triple_push(st, val) SKM_sk_push(nid_triple, (st), (val)) | ||
| 1997 | #define sk_nid_triple_unshift(st, val) SKM_sk_unshift(nid_triple, (st), (val)) | ||
| 1998 | #define sk_nid_triple_find(st, val) SKM_sk_find(nid_triple, (st), (val)) | ||
| 1999 | #define sk_nid_triple_find_ex(st, val) SKM_sk_find_ex(nid_triple, (st), (val)) | ||
| 2000 | #define sk_nid_triple_delete(st, i) SKM_sk_delete(nid_triple, (st), (i)) | ||
| 2001 | #define sk_nid_triple_delete_ptr(st, ptr) SKM_sk_delete_ptr(nid_triple, (st), (ptr)) | ||
| 2002 | #define sk_nid_triple_insert(st, val, i) SKM_sk_insert(nid_triple, (st), (val), (i)) | ||
| 2003 | #define sk_nid_triple_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(nid_triple, (st), (cmp)) | ||
| 2004 | #define sk_nid_triple_dup(st) SKM_sk_dup(nid_triple, st) | ||
| 2005 | #define sk_nid_triple_pop_free(st, free_func) SKM_sk_pop_free(nid_triple, (st), (free_func)) | ||
| 2006 | #define sk_nid_triple_shift(st) SKM_sk_shift(nid_triple, (st)) | ||
| 2007 | #define sk_nid_triple_pop(st) SKM_sk_pop(nid_triple, (st)) | ||
| 2008 | #define sk_nid_triple_sort(st) SKM_sk_sort(nid_triple, (st)) | ||
| 2009 | #define sk_nid_triple_is_sorted(st) SKM_sk_is_sorted(nid_triple, (st)) | ||
| 2010 | |||
| 2011 | #define sk_void_new(cmp) SKM_sk_new(void, (cmp)) | ||
| 2012 | #define sk_void_new_null() SKM_sk_new_null(void) | ||
| 2013 | #define sk_void_free(st) SKM_sk_free(void, (st)) | ||
| 2014 | #define sk_void_num(st) SKM_sk_num(void, (st)) | ||
| 2015 | #define sk_void_value(st, i) SKM_sk_value(void, (st), (i)) | ||
| 2016 | #define sk_void_set(st, i, val) SKM_sk_set(void, (st), (i), (val)) | ||
| 2017 | #define sk_void_zero(st) SKM_sk_zero(void, (st)) | ||
| 2018 | #define sk_void_push(st, val) SKM_sk_push(void, (st), (val)) | ||
| 2019 | #define sk_void_unshift(st, val) SKM_sk_unshift(void, (st), (val)) | ||
| 2020 | #define sk_void_find(st, val) SKM_sk_find(void, (st), (val)) | ||
| 2021 | #define sk_void_find_ex(st, val) SKM_sk_find_ex(void, (st), (val)) | ||
| 2022 | #define sk_void_delete(st, i) SKM_sk_delete(void, (st), (i)) | ||
| 2023 | #define sk_void_delete_ptr(st, ptr) SKM_sk_delete_ptr(void, (st), (ptr)) | ||
| 2024 | #define sk_void_insert(st, val, i) SKM_sk_insert(void, (st), (val), (i)) | ||
| 2025 | #define sk_void_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(void, (st), (cmp)) | ||
| 2026 | #define sk_void_dup(st) SKM_sk_dup(void, st) | ||
| 2027 | #define sk_void_pop_free(st, free_func) SKM_sk_pop_free(void, (st), (free_func)) | ||
| 2028 | #define sk_void_shift(st) SKM_sk_shift(void, (st)) | ||
| 2029 | #define sk_void_pop(st) SKM_sk_pop(void, (st)) | ||
| 2030 | #define sk_void_sort(st) SKM_sk_sort(void, (st)) | ||
| 2031 | #define sk_void_is_sorted(st) SKM_sk_is_sorted(void, (st)) | ||
| 2032 | |||
| 2033 | #define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_SK_CMP_FUNC(void, cmp))) | ||
| 2034 | #define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null()) | ||
| 2035 | #define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val)) | ||
| 2036 | #define sk_OPENSSL_BLOCK_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val)) | ||
| 2037 | #define sk_OPENSSL_BLOCK_value(st, i) ((OPENSSL_BLOCK)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), i)) | ||
| 2038 | #define sk_OPENSSL_BLOCK_num(st) SKM_sk_num(OPENSSL_BLOCK, st) | ||
| 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)) | ||
| 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) | ||
| 2041 | #define sk_OPENSSL_BLOCK_free(st) SKM_sk_free(OPENSSL_BLOCK, st) | ||
| 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)) | ||
| 2043 | #define sk_OPENSSL_BLOCK_zero(st) SKM_sk_zero(OPENSSL_BLOCK, (st)) | ||
| 2044 | #define sk_OPENSSL_BLOCK_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, 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)) | ||
| 2046 | #define sk_OPENSSL_BLOCK_delete(st, i) SKM_sk_delete(OPENSSL_BLOCK, (st), (i)) | ||
| 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)) | ||
| 2048 | #define sk_OPENSSL_BLOCK_set_cmp_func(st, cmp) \ | ||
| 2049 | ((int (*)(const void * const *,const void * const *)) \ | ||
| 2050 | sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_SK_CMP_FUNC(void, cmp))) | ||
| 2051 | #define sk_OPENSSL_BLOCK_dup(st) SKM_sk_dup(OPENSSL_BLOCK, st) | ||
| 2052 | #define sk_OPENSSL_BLOCK_shift(st) SKM_sk_shift(OPENSSL_BLOCK, (st)) | ||
| 2053 | #define sk_OPENSSL_BLOCK_pop(st) (void *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st)) | ||
| 2054 | #define sk_OPENSSL_BLOCK_sort(st) SKM_sk_sort(OPENSSL_BLOCK, (st)) | ||
| 2055 | #define sk_OPENSSL_BLOCK_is_sorted(st) SKM_sk_is_sorted(OPENSSL_BLOCK, (st)) | ||
| 2056 | |||
| 2057 | |||
| 2058 | #define sk_OPENSSL_PSTRING_new(cmp) ((STACK_OF(OPENSSL_PSTRING) *)sk_new(CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp))) | ||
| 2059 | #define sk_OPENSSL_PSTRING_new_null() ((STACK_OF(OPENSSL_PSTRING) *)sk_new_null()) | ||
| 2060 | #define sk_OPENSSL_PSTRING_push(st, val) sk_push(CHECKED_PTR_OF(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)) | ||
| 2062 | #define sk_OPENSSL_PSTRING_value(st, i) ((OPENSSL_PSTRING)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), i)) | ||
| 2063 | #define sk_OPENSSL_PSTRING_num(st) SKM_sk_num(OPENSSL_PSTRING, st) | ||
| 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)) | ||
| 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) | ||
| 2066 | #define sk_OPENSSL_PSTRING_free(st) SKM_sk_free(OPENSSL_PSTRING, st) | ||
| 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)) | ||
| 2068 | #define sk_OPENSSL_PSTRING_zero(st) SKM_sk_zero(OPENSSL_PSTRING, (st)) | ||
| 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)) | ||
| 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)) | ||
| 2071 | #define sk_OPENSSL_PSTRING_delete(st, i) SKM_sk_delete(OPENSSL_PSTRING, (st), (i)) | ||
| 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)) | ||
| 2073 | #define sk_OPENSSL_PSTRING_set_cmp_func(st, cmp) \ | ||
| 2074 | ((int (*)(const OPENSSL_STRING * const *,const OPENSSL_STRING * const *)) \ | ||
| 2075 | sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp))) | ||
| 2076 | #define sk_OPENSSL_PSTRING_dup(st) SKM_sk_dup(OPENSSL_PSTRING, st) | ||
| 2077 | #define sk_OPENSSL_PSTRING_shift(st) SKM_sk_shift(OPENSSL_PSTRING, (st)) | ||
| 2078 | #define sk_OPENSSL_PSTRING_pop(st) (OPENSSL_STRING *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st)) | ||
| 2079 | #define sk_OPENSSL_PSTRING_sort(st) SKM_sk_sort(OPENSSL_PSTRING, (st)) | ||
| 2080 | #define sk_OPENSSL_PSTRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_PSTRING, (st)) | ||
| 2081 | |||
| 2082 | |||
| 2083 | #define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_SK_CMP_FUNC(char, cmp))) | ||
| 2084 | #define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null()) | ||
| 2085 | #define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val)) | ||
| 2086 | #define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val)) | ||
| 2087 | #define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), i)) | ||
| 2088 | #define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st) | ||
| 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)) | ||
| 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) | ||
| 2091 | #define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st) | ||
| 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)) | ||
| 2093 | #define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st)) | ||
| 2094 | #define sk_OPENSSL_STRING_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, 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)) | ||
| 2096 | #define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i)) | ||
| 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)) | ||
| 2098 | #define sk_OPENSSL_STRING_set_cmp_func(st, cmp) \ | ||
| 2099 | ((int (*)(const char * const *,const char * const *)) \ | ||
| 2100 | sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_SK_CMP_FUNC(char, cmp))) | ||
| 2101 | #define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st) | ||
| 2102 | #define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st)) | ||
| 2103 | #define sk_OPENSSL_STRING_pop(st) (char *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st)) | ||
| 2104 | #define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st)) | ||
| 2105 | #define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st)) | ||
| 2106 | |||
| 2107 | |||
| 1825 | #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) \ |
| 1826 | SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) | 2109 | SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) |
| 1827 | #define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \ | 2110 | #define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \ |
| @@ -1858,6 +2141,15 @@ STACK_OF(type) \ | |||
| 1858 | #define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \ | 2141 | #define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \ |
| 1859 | SKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func)) | 2142 | SKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func)) |
| 1860 | 2143 | ||
| 2144 | #define d2i_ASN1_SET_OF_ASN1_UTF8STRING(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | ||
| 2145 | SKM_ASN1_SET_OF_d2i(ASN1_UTF8STRING, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) | ||
| 2146 | #define i2d_ASN1_SET_OF_ASN1_UTF8STRING(st, pp, i2d_func, ex_tag, ex_class, is_set) \ | ||
| 2147 | SKM_ASN1_SET_OF_i2d(ASN1_UTF8STRING, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) | ||
| 2148 | #define ASN1_seq_pack_ASN1_UTF8STRING(st, i2d_func, buf, len) \ | ||
| 2149 | SKM_ASN1_seq_pack(ASN1_UTF8STRING, (st), (i2d_func), (buf), (len)) | ||
| 2150 | #define ASN1_seq_unpack_ASN1_UTF8STRING(buf, len, d2i_func, free_func) \ | ||
| 2151 | SKM_ASN1_seq_unpack(ASN1_UTF8STRING, (buf), (len), (d2i_func), (free_func)) | ||
| 2152 | |||
| 1861 | #define d2i_ASN1_SET_OF_DIST_POINT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | 2153 | #define d2i_ASN1_SET_OF_DIST_POINT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ |
| 1862 | SKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) | 2154 | SKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) |
| 1863 | #define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_set) \ | 2155 | #define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_set) \ |
| @@ -1867,6 +2159,24 @@ STACK_OF(type) \ | |||
| 1867 | #define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \ | 2159 | #define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \ |
| 1868 | SKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func)) | 2160 | SKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func)) |
| 1869 | 2161 | ||
| 2162 | #define d2i_ASN1_SET_OF_ESS_CERT_ID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | ||
| 2163 | SKM_ASN1_SET_OF_d2i(ESS_CERT_ID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) | ||
| 2164 | #define i2d_ASN1_SET_OF_ESS_CERT_ID(st, pp, i2d_func, ex_tag, ex_class, is_set) \ | ||
| 2165 | SKM_ASN1_SET_OF_i2d(ESS_CERT_ID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) | ||
| 2166 | #define ASN1_seq_pack_ESS_CERT_ID(st, i2d_func, buf, len) \ | ||
| 2167 | SKM_ASN1_seq_pack(ESS_CERT_ID, (st), (i2d_func), (buf), (len)) | ||
| 2168 | #define ASN1_seq_unpack_ESS_CERT_ID(buf, len, d2i_func, free_func) \ | ||
| 2169 | SKM_ASN1_seq_unpack(ESS_CERT_ID, (buf), (len), (d2i_func), (free_func)) | ||
| 2170 | |||
| 2171 | #define d2i_ASN1_SET_OF_EVP_MD(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | ||
| 2172 | SKM_ASN1_SET_OF_d2i(EVP_MD, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) | ||
| 2173 | #define i2d_ASN1_SET_OF_EVP_MD(st, pp, i2d_func, ex_tag, ex_class, is_set) \ | ||
| 2174 | SKM_ASN1_SET_OF_i2d(EVP_MD, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) | ||
| 2175 | #define ASN1_seq_pack_EVP_MD(st, i2d_func, buf, len) \ | ||
| 2176 | SKM_ASN1_seq_pack(EVP_MD, (st), (i2d_func), (buf), (len)) | ||
| 2177 | #define ASN1_seq_unpack_EVP_MD(buf, len, d2i_func, free_func) \ | ||
| 2178 | SKM_ASN1_seq_unpack(EVP_MD, (buf), (len), (d2i_func), (free_func)) | ||
| 2179 | |||
| 1870 | #define d2i_ASN1_SET_OF_GENERAL_NAME(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | 2180 | #define d2i_ASN1_SET_OF_GENERAL_NAME(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ |
| 1871 | SKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) | 2181 | SKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) |
| 1872 | #define i2d_ASN1_SET_OF_GENERAL_NAME(st, pp, i2d_func, ex_tag, ex_class, is_set) \ | 2182 | #define i2d_ASN1_SET_OF_GENERAL_NAME(st, pp, i2d_func, ex_tag, ex_class, is_set) \ |
| @@ -2025,6 +2335,240 @@ STACK_OF(type) \ | |||
| 2025 | 2335 | ||
| 2026 | #define PKCS12_decrypt_d2i_PKCS7(algor, d2i_func, free_func, pass, passlen, oct, seq) \ | 2336 | #define PKCS12_decrypt_d2i_PKCS7(algor, d2i_func, free_func, pass, passlen, oct, seq) \ |
| 2027 | SKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) | 2337 | SKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) |
| 2338 | |||
| 2339 | #define lh_ADDED_OBJ_new() LHM_lh_new(ADDED_OBJ,added_obj) | ||
| 2340 | #define lh_ADDED_OBJ_insert(lh,inst) LHM_lh_insert(ADDED_OBJ,lh,inst) | ||
| 2341 | #define lh_ADDED_OBJ_retrieve(lh,inst) LHM_lh_retrieve(ADDED_OBJ,lh,inst) | ||
| 2342 | #define lh_ADDED_OBJ_delete(lh,inst) LHM_lh_delete(ADDED_OBJ,lh,inst) | ||
| 2343 | #define lh_ADDED_OBJ_doall(lh,fn) LHM_lh_doall(ADDED_OBJ,lh,fn) | ||
| 2344 | #define lh_ADDED_OBJ_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2345 | LHM_lh_doall_arg(ADDED_OBJ,lh,fn,arg_type,arg) | ||
| 2346 | #define lh_ADDED_OBJ_error(lh) LHM_lh_error(ADDED_OBJ,lh) | ||
| 2347 | #define lh_ADDED_OBJ_num_items(lh) LHM_lh_num_items(ADDED_OBJ,lh) | ||
| 2348 | #define lh_ADDED_OBJ_down_load(lh) LHM_lh_down_load(ADDED_OBJ,lh) | ||
| 2349 | #define lh_ADDED_OBJ_node_stats_bio(lh,out) \ | ||
| 2350 | LHM_lh_node_stats_bio(ADDED_OBJ,lh,out) | ||
| 2351 | #define lh_ADDED_OBJ_node_usage_stats_bio(lh,out) \ | ||
| 2352 | LHM_lh_node_usage_stats_bio(ADDED_OBJ,lh,out) | ||
| 2353 | #define lh_ADDED_OBJ_stats_bio(lh,out) \ | ||
| 2354 | LHM_lh_stats_bio(ADDED_OBJ,lh,out) | ||
| 2355 | #define lh_ADDED_OBJ_free(lh) LHM_lh_free(ADDED_OBJ,lh) | ||
| 2356 | |||
| 2357 | #define lh_APP_INFO_new() LHM_lh_new(APP_INFO,app_info) | ||
| 2358 | #define lh_APP_INFO_insert(lh,inst) LHM_lh_insert(APP_INFO,lh,inst) | ||
| 2359 | #define lh_APP_INFO_retrieve(lh,inst) LHM_lh_retrieve(APP_INFO,lh,inst) | ||
| 2360 | #define lh_APP_INFO_delete(lh,inst) LHM_lh_delete(APP_INFO,lh,inst) | ||
| 2361 | #define lh_APP_INFO_doall(lh,fn) LHM_lh_doall(APP_INFO,lh,fn) | ||
| 2362 | #define lh_APP_INFO_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2363 | LHM_lh_doall_arg(APP_INFO,lh,fn,arg_type,arg) | ||
| 2364 | #define lh_APP_INFO_error(lh) LHM_lh_error(APP_INFO,lh) | ||
| 2365 | #define lh_APP_INFO_num_items(lh) LHM_lh_num_items(APP_INFO,lh) | ||
| 2366 | #define lh_APP_INFO_down_load(lh) LHM_lh_down_load(APP_INFO,lh) | ||
| 2367 | #define lh_APP_INFO_node_stats_bio(lh,out) \ | ||
| 2368 | LHM_lh_node_stats_bio(APP_INFO,lh,out) | ||
| 2369 | #define lh_APP_INFO_node_usage_stats_bio(lh,out) \ | ||
| 2370 | LHM_lh_node_usage_stats_bio(APP_INFO,lh,out) | ||
| 2371 | #define lh_APP_INFO_stats_bio(lh,out) \ | ||
| 2372 | LHM_lh_stats_bio(APP_INFO,lh,out) | ||
| 2373 | #define lh_APP_INFO_free(lh) LHM_lh_free(APP_INFO,lh) | ||
| 2374 | |||
| 2375 | #define lh_CONF_VALUE_new() LHM_lh_new(CONF_VALUE,conf_value) | ||
| 2376 | #define lh_CONF_VALUE_insert(lh,inst) LHM_lh_insert(CONF_VALUE,lh,inst) | ||
| 2377 | #define lh_CONF_VALUE_retrieve(lh,inst) LHM_lh_retrieve(CONF_VALUE,lh,inst) | ||
| 2378 | #define lh_CONF_VALUE_delete(lh,inst) LHM_lh_delete(CONF_VALUE,lh,inst) | ||
| 2379 | #define lh_CONF_VALUE_doall(lh,fn) LHM_lh_doall(CONF_VALUE,lh,fn) | ||
| 2380 | #define lh_CONF_VALUE_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2381 | LHM_lh_doall_arg(CONF_VALUE,lh,fn,arg_type,arg) | ||
| 2382 | #define lh_CONF_VALUE_error(lh) LHM_lh_error(CONF_VALUE,lh) | ||
| 2383 | #define lh_CONF_VALUE_num_items(lh) LHM_lh_num_items(CONF_VALUE,lh) | ||
| 2384 | #define lh_CONF_VALUE_down_load(lh) LHM_lh_down_load(CONF_VALUE,lh) | ||
| 2385 | #define lh_CONF_VALUE_node_stats_bio(lh,out) \ | ||
| 2386 | LHM_lh_node_stats_bio(CONF_VALUE,lh,out) | ||
| 2387 | #define lh_CONF_VALUE_node_usage_stats_bio(lh,out) \ | ||
| 2388 | LHM_lh_node_usage_stats_bio(CONF_VALUE,lh,out) | ||
| 2389 | #define lh_CONF_VALUE_stats_bio(lh,out) \ | ||
| 2390 | LHM_lh_stats_bio(CONF_VALUE,lh,out) | ||
| 2391 | #define lh_CONF_VALUE_free(lh) LHM_lh_free(CONF_VALUE,lh) | ||
| 2392 | |||
| 2393 | #define lh_ENGINE_PILE_new() LHM_lh_new(ENGINE_PILE,engine_pile) | ||
| 2394 | #define lh_ENGINE_PILE_insert(lh,inst) LHM_lh_insert(ENGINE_PILE,lh,inst) | ||
| 2395 | #define lh_ENGINE_PILE_retrieve(lh,inst) LHM_lh_retrieve(ENGINE_PILE,lh,inst) | ||
| 2396 | #define lh_ENGINE_PILE_delete(lh,inst) LHM_lh_delete(ENGINE_PILE,lh,inst) | ||
| 2397 | #define lh_ENGINE_PILE_doall(lh,fn) LHM_lh_doall(ENGINE_PILE,lh,fn) | ||
| 2398 | #define lh_ENGINE_PILE_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2399 | LHM_lh_doall_arg(ENGINE_PILE,lh,fn,arg_type,arg) | ||
| 2400 | #define lh_ENGINE_PILE_error(lh) LHM_lh_error(ENGINE_PILE,lh) | ||
| 2401 | #define lh_ENGINE_PILE_num_items(lh) LHM_lh_num_items(ENGINE_PILE,lh) | ||
| 2402 | #define lh_ENGINE_PILE_down_load(lh) LHM_lh_down_load(ENGINE_PILE,lh) | ||
| 2403 | #define lh_ENGINE_PILE_node_stats_bio(lh,out) \ | ||
| 2404 | LHM_lh_node_stats_bio(ENGINE_PILE,lh,out) | ||
| 2405 | #define lh_ENGINE_PILE_node_usage_stats_bio(lh,out) \ | ||
| 2406 | LHM_lh_node_usage_stats_bio(ENGINE_PILE,lh,out) | ||
| 2407 | #define lh_ENGINE_PILE_stats_bio(lh,out) \ | ||
| 2408 | LHM_lh_stats_bio(ENGINE_PILE,lh,out) | ||
| 2409 | #define lh_ENGINE_PILE_free(lh) LHM_lh_free(ENGINE_PILE,lh) | ||
| 2410 | |||
| 2411 | #define lh_ERR_STATE_new() LHM_lh_new(ERR_STATE,err_state) | ||
| 2412 | #define lh_ERR_STATE_insert(lh,inst) LHM_lh_insert(ERR_STATE,lh,inst) | ||
| 2413 | #define lh_ERR_STATE_retrieve(lh,inst) LHM_lh_retrieve(ERR_STATE,lh,inst) | ||
| 2414 | #define lh_ERR_STATE_delete(lh,inst) LHM_lh_delete(ERR_STATE,lh,inst) | ||
| 2415 | #define lh_ERR_STATE_doall(lh,fn) LHM_lh_doall(ERR_STATE,lh,fn) | ||
| 2416 | #define lh_ERR_STATE_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2417 | LHM_lh_doall_arg(ERR_STATE,lh,fn,arg_type,arg) | ||
| 2418 | #define lh_ERR_STATE_error(lh) LHM_lh_error(ERR_STATE,lh) | ||
| 2419 | #define lh_ERR_STATE_num_items(lh) LHM_lh_num_items(ERR_STATE,lh) | ||
| 2420 | #define lh_ERR_STATE_down_load(lh) LHM_lh_down_load(ERR_STATE,lh) | ||
| 2421 | #define lh_ERR_STATE_node_stats_bio(lh,out) \ | ||
| 2422 | LHM_lh_node_stats_bio(ERR_STATE,lh,out) | ||
| 2423 | #define lh_ERR_STATE_node_usage_stats_bio(lh,out) \ | ||
| 2424 | LHM_lh_node_usage_stats_bio(ERR_STATE,lh,out) | ||
| 2425 | #define lh_ERR_STATE_stats_bio(lh,out) \ | ||
| 2426 | LHM_lh_stats_bio(ERR_STATE,lh,out) | ||
| 2427 | #define lh_ERR_STATE_free(lh) LHM_lh_free(ERR_STATE,lh) | ||
| 2428 | |||
| 2429 | #define lh_ERR_STRING_DATA_new() LHM_lh_new(ERR_STRING_DATA,err_string_data) | ||
| 2430 | #define lh_ERR_STRING_DATA_insert(lh,inst) LHM_lh_insert(ERR_STRING_DATA,lh,inst) | ||
| 2431 | #define lh_ERR_STRING_DATA_retrieve(lh,inst) LHM_lh_retrieve(ERR_STRING_DATA,lh,inst) | ||
| 2432 | #define lh_ERR_STRING_DATA_delete(lh,inst) LHM_lh_delete(ERR_STRING_DATA,lh,inst) | ||
| 2433 | #define lh_ERR_STRING_DATA_doall(lh,fn) LHM_lh_doall(ERR_STRING_DATA,lh,fn) | ||
| 2434 | #define lh_ERR_STRING_DATA_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2435 | LHM_lh_doall_arg(ERR_STRING_DATA,lh,fn,arg_type,arg) | ||
| 2436 | #define lh_ERR_STRING_DATA_error(lh) LHM_lh_error(ERR_STRING_DATA,lh) | ||
| 2437 | #define lh_ERR_STRING_DATA_num_items(lh) LHM_lh_num_items(ERR_STRING_DATA,lh) | ||
| 2438 | #define lh_ERR_STRING_DATA_down_load(lh) LHM_lh_down_load(ERR_STRING_DATA,lh) | ||
| 2439 | #define lh_ERR_STRING_DATA_node_stats_bio(lh,out) \ | ||
| 2440 | LHM_lh_node_stats_bio(ERR_STRING_DATA,lh,out) | ||
| 2441 | #define lh_ERR_STRING_DATA_node_usage_stats_bio(lh,out) \ | ||
| 2442 | LHM_lh_node_usage_stats_bio(ERR_STRING_DATA,lh,out) | ||
| 2443 | #define lh_ERR_STRING_DATA_stats_bio(lh,out) \ | ||
| 2444 | LHM_lh_stats_bio(ERR_STRING_DATA,lh,out) | ||
| 2445 | #define lh_ERR_STRING_DATA_free(lh) LHM_lh_free(ERR_STRING_DATA,lh) | ||
| 2446 | |||
| 2447 | #define lh_EX_CLASS_ITEM_new() LHM_lh_new(EX_CLASS_ITEM,ex_class_item) | ||
| 2448 | #define lh_EX_CLASS_ITEM_insert(lh,inst) LHM_lh_insert(EX_CLASS_ITEM,lh,inst) | ||
| 2449 | #define lh_EX_CLASS_ITEM_retrieve(lh,inst) LHM_lh_retrieve(EX_CLASS_ITEM,lh,inst) | ||
| 2450 | #define lh_EX_CLASS_ITEM_delete(lh,inst) LHM_lh_delete(EX_CLASS_ITEM,lh,inst) | ||
| 2451 | #define lh_EX_CLASS_ITEM_doall(lh,fn) LHM_lh_doall(EX_CLASS_ITEM,lh,fn) | ||
| 2452 | #define lh_EX_CLASS_ITEM_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2453 | LHM_lh_doall_arg(EX_CLASS_ITEM,lh,fn,arg_type,arg) | ||
| 2454 | #define lh_EX_CLASS_ITEM_error(lh) LHM_lh_error(EX_CLASS_ITEM,lh) | ||
| 2455 | #define lh_EX_CLASS_ITEM_num_items(lh) LHM_lh_num_items(EX_CLASS_ITEM,lh) | ||
| 2456 | #define lh_EX_CLASS_ITEM_down_load(lh) LHM_lh_down_load(EX_CLASS_ITEM,lh) | ||
| 2457 | #define lh_EX_CLASS_ITEM_node_stats_bio(lh,out) \ | ||
| 2458 | LHM_lh_node_stats_bio(EX_CLASS_ITEM,lh,out) | ||
| 2459 | #define lh_EX_CLASS_ITEM_node_usage_stats_bio(lh,out) \ | ||
| 2460 | LHM_lh_node_usage_stats_bio(EX_CLASS_ITEM,lh,out) | ||
| 2461 | #define lh_EX_CLASS_ITEM_stats_bio(lh,out) \ | ||
| 2462 | LHM_lh_stats_bio(EX_CLASS_ITEM,lh,out) | ||
| 2463 | #define lh_EX_CLASS_ITEM_free(lh) LHM_lh_free(EX_CLASS_ITEM,lh) | ||
| 2464 | |||
| 2465 | #define lh_FUNCTION_new() LHM_lh_new(FUNCTION,function) | ||
| 2466 | #define lh_FUNCTION_insert(lh,inst) LHM_lh_insert(FUNCTION,lh,inst) | ||
| 2467 | #define lh_FUNCTION_retrieve(lh,inst) LHM_lh_retrieve(FUNCTION,lh,inst) | ||
| 2468 | #define lh_FUNCTION_delete(lh,inst) LHM_lh_delete(FUNCTION,lh,inst) | ||
| 2469 | #define lh_FUNCTION_doall(lh,fn) LHM_lh_doall(FUNCTION,lh,fn) | ||
| 2470 | #define lh_FUNCTION_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2471 | LHM_lh_doall_arg(FUNCTION,lh,fn,arg_type,arg) | ||
| 2472 | #define lh_FUNCTION_error(lh) LHM_lh_error(FUNCTION,lh) | ||
| 2473 | #define lh_FUNCTION_num_items(lh) LHM_lh_num_items(FUNCTION,lh) | ||
| 2474 | #define lh_FUNCTION_down_load(lh) LHM_lh_down_load(FUNCTION,lh) | ||
| 2475 | #define lh_FUNCTION_node_stats_bio(lh,out) \ | ||
| 2476 | LHM_lh_node_stats_bio(FUNCTION,lh,out) | ||
| 2477 | #define lh_FUNCTION_node_usage_stats_bio(lh,out) \ | ||
| 2478 | LHM_lh_node_usage_stats_bio(FUNCTION,lh,out) | ||
| 2479 | #define lh_FUNCTION_stats_bio(lh,out) \ | ||
| 2480 | LHM_lh_stats_bio(FUNCTION,lh,out) | ||
| 2481 | #define lh_FUNCTION_free(lh) LHM_lh_free(FUNCTION,lh) | ||
| 2482 | |||
| 2483 | #define lh_MEM_new() LHM_lh_new(MEM,mem) | ||
| 2484 | #define lh_MEM_insert(lh,inst) LHM_lh_insert(MEM,lh,inst) | ||
| 2485 | #define lh_MEM_retrieve(lh,inst) LHM_lh_retrieve(MEM,lh,inst) | ||
| 2486 | #define lh_MEM_delete(lh,inst) LHM_lh_delete(MEM,lh,inst) | ||
| 2487 | #define lh_MEM_doall(lh,fn) LHM_lh_doall(MEM,lh,fn) | ||
| 2488 | #define lh_MEM_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2489 | LHM_lh_doall_arg(MEM,lh,fn,arg_type,arg) | ||
| 2490 | #define lh_MEM_error(lh) LHM_lh_error(MEM,lh) | ||
| 2491 | #define lh_MEM_num_items(lh) LHM_lh_num_items(MEM,lh) | ||
| 2492 | #define lh_MEM_down_load(lh) LHM_lh_down_load(MEM,lh) | ||
| 2493 | #define lh_MEM_node_stats_bio(lh,out) \ | ||
| 2494 | LHM_lh_node_stats_bio(MEM,lh,out) | ||
| 2495 | #define lh_MEM_node_usage_stats_bio(lh,out) \ | ||
| 2496 | LHM_lh_node_usage_stats_bio(MEM,lh,out) | ||
| 2497 | #define lh_MEM_stats_bio(lh,out) \ | ||
| 2498 | LHM_lh_stats_bio(MEM,lh,out) | ||
| 2499 | #define lh_MEM_free(lh) LHM_lh_free(MEM,lh) | ||
| 2500 | |||
| 2501 | #define lh_OBJ_NAME_new() LHM_lh_new(OBJ_NAME,obj_name) | ||
| 2502 | #define lh_OBJ_NAME_insert(lh,inst) LHM_lh_insert(OBJ_NAME,lh,inst) | ||
| 2503 | #define lh_OBJ_NAME_retrieve(lh,inst) LHM_lh_retrieve(OBJ_NAME,lh,inst) | ||
| 2504 | #define lh_OBJ_NAME_delete(lh,inst) LHM_lh_delete(OBJ_NAME,lh,inst) | ||
| 2505 | #define lh_OBJ_NAME_doall(lh,fn) LHM_lh_doall(OBJ_NAME,lh,fn) | ||
| 2506 | #define lh_OBJ_NAME_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2507 | LHM_lh_doall_arg(OBJ_NAME,lh,fn,arg_type,arg) | ||
| 2508 | #define lh_OBJ_NAME_error(lh) LHM_lh_error(OBJ_NAME,lh) | ||
| 2509 | #define lh_OBJ_NAME_num_items(lh) LHM_lh_num_items(OBJ_NAME,lh) | ||
| 2510 | #define lh_OBJ_NAME_down_load(lh) LHM_lh_down_load(OBJ_NAME,lh) | ||
| 2511 | #define lh_OBJ_NAME_node_stats_bio(lh,out) \ | ||
| 2512 | LHM_lh_node_stats_bio(OBJ_NAME,lh,out) | ||
| 2513 | #define lh_OBJ_NAME_node_usage_stats_bio(lh,out) \ | ||
| 2514 | LHM_lh_node_usage_stats_bio(OBJ_NAME,lh,out) | ||
| 2515 | #define lh_OBJ_NAME_stats_bio(lh,out) \ | ||
| 2516 | LHM_lh_stats_bio(OBJ_NAME,lh,out) | ||
| 2517 | #define lh_OBJ_NAME_free(lh) LHM_lh_free(OBJ_NAME,lh) | ||
| 2518 | |||
| 2519 | #define lh_OPENSSL_CSTRING_new() LHM_lh_new(OPENSSL_CSTRING,openssl_cstring) | ||
| 2520 | #define lh_OPENSSL_CSTRING_insert(lh,inst) LHM_lh_insert(OPENSSL_CSTRING,lh,inst) | ||
| 2521 | #define lh_OPENSSL_CSTRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_CSTRING,lh,inst) | ||
| 2522 | #define lh_OPENSSL_CSTRING_delete(lh,inst) LHM_lh_delete(OPENSSL_CSTRING,lh,inst) | ||
| 2523 | #define lh_OPENSSL_CSTRING_doall(lh,fn) LHM_lh_doall(OPENSSL_CSTRING,lh,fn) | ||
| 2524 | #define lh_OPENSSL_CSTRING_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2525 | LHM_lh_doall_arg(OPENSSL_CSTRING,lh,fn,arg_type,arg) | ||
| 2526 | #define lh_OPENSSL_CSTRING_error(lh) LHM_lh_error(OPENSSL_CSTRING,lh) | ||
| 2527 | #define lh_OPENSSL_CSTRING_num_items(lh) LHM_lh_num_items(OPENSSL_CSTRING,lh) | ||
| 2528 | #define lh_OPENSSL_CSTRING_down_load(lh) LHM_lh_down_load(OPENSSL_CSTRING,lh) | ||
| 2529 | #define lh_OPENSSL_CSTRING_node_stats_bio(lh,out) \ | ||
| 2530 | LHM_lh_node_stats_bio(OPENSSL_CSTRING,lh,out) | ||
| 2531 | #define lh_OPENSSL_CSTRING_node_usage_stats_bio(lh,out) \ | ||
| 2532 | LHM_lh_node_usage_stats_bio(OPENSSL_CSTRING,lh,out) | ||
| 2533 | #define lh_OPENSSL_CSTRING_stats_bio(lh,out) \ | ||
| 2534 | LHM_lh_stats_bio(OPENSSL_CSTRING,lh,out) | ||
| 2535 | #define lh_OPENSSL_CSTRING_free(lh) LHM_lh_free(OPENSSL_CSTRING,lh) | ||
| 2536 | |||
| 2537 | #define lh_OPENSSL_STRING_new() LHM_lh_new(OPENSSL_STRING,openssl_string) | ||
| 2538 | #define lh_OPENSSL_STRING_insert(lh,inst) LHM_lh_insert(OPENSSL_STRING,lh,inst) | ||
| 2539 | #define lh_OPENSSL_STRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_STRING,lh,inst) | ||
| 2540 | #define lh_OPENSSL_STRING_delete(lh,inst) LHM_lh_delete(OPENSSL_STRING,lh,inst) | ||
| 2541 | #define lh_OPENSSL_STRING_doall(lh,fn) LHM_lh_doall(OPENSSL_STRING,lh,fn) | ||
| 2542 | #define lh_OPENSSL_STRING_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2543 | LHM_lh_doall_arg(OPENSSL_STRING,lh,fn,arg_type,arg) | ||
| 2544 | #define lh_OPENSSL_STRING_error(lh) LHM_lh_error(OPENSSL_STRING,lh) | ||
| 2545 | #define lh_OPENSSL_STRING_num_items(lh) LHM_lh_num_items(OPENSSL_STRING,lh) | ||
| 2546 | #define lh_OPENSSL_STRING_down_load(lh) LHM_lh_down_load(OPENSSL_STRING,lh) | ||
| 2547 | #define lh_OPENSSL_STRING_node_stats_bio(lh,out) \ | ||
| 2548 | LHM_lh_node_stats_bio(OPENSSL_STRING,lh,out) | ||
| 2549 | #define lh_OPENSSL_STRING_node_usage_stats_bio(lh,out) \ | ||
| 2550 | LHM_lh_node_usage_stats_bio(OPENSSL_STRING,lh,out) | ||
| 2551 | #define lh_OPENSSL_STRING_stats_bio(lh,out) \ | ||
| 2552 | LHM_lh_stats_bio(OPENSSL_STRING,lh,out) | ||
| 2553 | #define lh_OPENSSL_STRING_free(lh) LHM_lh_free(OPENSSL_STRING,lh) | ||
| 2554 | |||
| 2555 | #define lh_SSL_SESSION_new() LHM_lh_new(SSL_SESSION,ssl_session) | ||
| 2556 | #define lh_SSL_SESSION_insert(lh,inst) LHM_lh_insert(SSL_SESSION,lh,inst) | ||
| 2557 | #define lh_SSL_SESSION_retrieve(lh,inst) LHM_lh_retrieve(SSL_SESSION,lh,inst) | ||
| 2558 | #define lh_SSL_SESSION_delete(lh,inst) LHM_lh_delete(SSL_SESSION,lh,inst) | ||
| 2559 | #define lh_SSL_SESSION_doall(lh,fn) LHM_lh_doall(SSL_SESSION,lh,fn) | ||
| 2560 | #define lh_SSL_SESSION_doall_arg(lh,fn,arg_type,arg) \ | ||
| 2561 | LHM_lh_doall_arg(SSL_SESSION,lh,fn,arg_type,arg) | ||
| 2562 | #define lh_SSL_SESSION_error(lh) LHM_lh_error(SSL_SESSION,lh) | ||
| 2563 | #define lh_SSL_SESSION_num_items(lh) LHM_lh_num_items(SSL_SESSION,lh) | ||
| 2564 | #define lh_SSL_SESSION_down_load(lh) LHM_lh_down_load(SSL_SESSION,lh) | ||
| 2565 | #define lh_SSL_SESSION_node_stats_bio(lh,out) \ | ||
| 2566 | LHM_lh_node_stats_bio(SSL_SESSION,lh,out) | ||
| 2567 | #define lh_SSL_SESSION_node_usage_stats_bio(lh,out) \ | ||
| 2568 | LHM_lh_node_usage_stats_bio(SSL_SESSION,lh,out) | ||
| 2569 | #define lh_SSL_SESSION_stats_bio(lh,out) \ | ||
| 2570 | LHM_lh_stats_bio(SSL_SESSION,lh,out) | ||
| 2571 | #define lh_SSL_SESSION_free(lh) LHM_lh_free(SSL_SESSION,lh) | ||
| 2028 | /* End of util/mkstack.pl block, you may now edit :-) */ | 2572 | /* End of util/mkstack.pl block, you may now edit :-) */ |
| 2029 | 2573 | ||
| 2030 | #endif /* !defined HEADER_SAFESTACK_H */ | 2574 | #endif /* !defined HEADER_SAFESTACK_H */ |
diff --git a/src/lib/libcrypto/stack/stack.c b/src/lib/libcrypto/stack/stack.c index 378bd7c796..76cf1a1168 100644 --- a/src/lib/libcrypto/stack/stack.c +++ b/src/lib/libcrypto/stack/stack.c | |||
| @@ -77,10 +77,10 @@ const char STACK_version[]="Stack" OPENSSL_VERSION_PTEXT; | |||
| 77 | 77 | ||
| 78 | #include <errno.h> | 78 | #include <errno.h> |
| 79 | 79 | ||
| 80 | int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,const char * const *))) | 80 | int (*sk_set_cmp_func(_STACK *sk, int (*c)(const void *, const void *))) |
| 81 | (const char * const *, const char * const *) | 81 | (const void *, const void *) |
| 82 | { | 82 | { |
| 83 | int (*old)(const char * const *,const char * const *)=sk->comp; | 83 | int (*old)(const void *,const void *)=sk->comp; |
| 84 | 84 | ||
| 85 | if (sk->comp != c) | 85 | if (sk->comp != c) |
| 86 | sk->sorted=0; | 86 | sk->sorted=0; |
| @@ -89,9 +89,9 @@ int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,const char * cons | |||
| 89 | return old; | 89 | return old; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | STACK *sk_dup(STACK *sk) | 92 | _STACK *sk_dup(_STACK *sk) |
| 93 | { | 93 | { |
| 94 | STACK *ret; | 94 | _STACK *ret; |
| 95 | char **s; | 95 | char **s; |
| 96 | 96 | ||
| 97 | if ((ret=sk_new(sk->comp)) == NULL) goto err; | 97 | if ((ret=sk_new(sk->comp)) == NULL) goto err; |
| @@ -112,19 +112,19 @@ err: | |||
| 112 | return(NULL); | 112 | return(NULL); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | STACK *sk_new_null(void) | 115 | _STACK *sk_new_null(void) |
| 116 | { | 116 | { |
| 117 | return sk_new((int (*)(const char * const *, const char * const *))0); | 117 | return sk_new((int (*)(const void *, const void *))0); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | STACK *sk_new(int (*c)(const char * const *, const char * const *)) | 120 | _STACK *sk_new(int (*c)(const void *, const void *)) |
| 121 | { | 121 | { |
| 122 | STACK *ret; | 122 | _STACK *ret; |
| 123 | int i; | 123 | int i; |
| 124 | 124 | ||
| 125 | if ((ret=(STACK *)OPENSSL_malloc(sizeof(STACK))) == NULL) | 125 | if ((ret=OPENSSL_malloc(sizeof(_STACK))) == NULL) |
| 126 | goto err; | 126 | goto err; |
| 127 | if ((ret->data=(char **)OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL) | 127 | if ((ret->data=OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL) |
| 128 | goto err; | 128 | goto err; |
| 129 | for (i=0; i<MIN_NODES; i++) | 129 | for (i=0; i<MIN_NODES; i++) |
| 130 | ret->data[i]=NULL; | 130 | ret->data[i]=NULL; |
| @@ -139,14 +139,14 @@ err: | |||
| 139 | return(NULL); | 139 | return(NULL); |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | int sk_insert(STACK *st, char *data, int loc) | 142 | int sk_insert(_STACK *st, void *data, int loc) |
| 143 | { | 143 | { |
| 144 | char **s; | 144 | char **s; |
| 145 | 145 | ||
| 146 | if(st == NULL) return 0; | 146 | if(st == NULL) return 0; |
| 147 | if (st->num_alloc <= st->num+1) | 147 | if (st->num_alloc <= st->num+1) |
| 148 | { | 148 | { |
| 149 | s=(char **)OPENSSL_realloc((char *)st->data, | 149 | s=OPENSSL_realloc((char *)st->data, |
| 150 | (unsigned int)sizeof(char *)*st->num_alloc*2); | 150 | (unsigned int)sizeof(char *)*st->num_alloc*2); |
| 151 | if (s == NULL) | 151 | if (s == NULL) |
| 152 | return(0); | 152 | return(0); |
| @@ -160,14 +160,14 @@ int sk_insert(STACK *st, char *data, int loc) | |||
| 160 | int i; | 160 | int i; |
| 161 | char **f,**t; | 161 | char **f,**t; |
| 162 | 162 | ||
| 163 | f=(char **)st->data; | 163 | f=st->data; |
| 164 | t=(char **)&(st->data[1]); | 164 | t=&(st->data[1]); |
| 165 | for (i=st->num; i>=loc; i--) | 165 | for (i=st->num; i>=loc; i--) |
| 166 | t[i]=f[i]; | 166 | t[i]=f[i]; |
| 167 | 167 | ||
| 168 | #ifdef undef /* no memmove on sunos :-( */ | 168 | #ifdef undef /* no memmove on sunos :-( */ |
| 169 | memmove( (char *)&(st->data[loc+1]), | 169 | memmove(&(st->data[loc+1]), |
| 170 | (char *)&(st->data[loc]), | 170 | &(st->data[loc]), |
| 171 | sizeof(char *)*(st->num-loc)); | 171 | sizeof(char *)*(st->num-loc)); |
| 172 | #endif | 172 | #endif |
| 173 | st->data[loc]=data; | 173 | st->data[loc]=data; |
| @@ -177,7 +177,7 @@ int sk_insert(STACK *st, char *data, int loc) | |||
| 177 | return(st->num); | 177 | return(st->num); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | char *sk_delete_ptr(STACK *st, char *p) | 180 | void *sk_delete_ptr(_STACK *st, void *p) |
| 181 | { | 181 | { |
| 182 | int i; | 182 | int i; |
| 183 | 183 | ||
| @@ -187,7 +187,7 @@ char *sk_delete_ptr(STACK *st, char *p) | |||
| 187 | return(NULL); | 187 | return(NULL); |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | char *sk_delete(STACK *st, int loc) | 190 | void *sk_delete(_STACK *st, int loc) |
| 191 | { | 191 | { |
| 192 | char *ret; | 192 | char *ret; |
| 193 | int i,j; | 193 | int i,j; |
| @@ -210,11 +210,11 @@ char *sk_delete(STACK *st, int loc) | |||
| 210 | return(ret); | 210 | return(ret); |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | static int internal_find(STACK *st, char *data, int ret_val_options) | 213 | static int internal_find(_STACK *st, void *data, int ret_val_options) |
| 214 | { | 214 | { |
| 215 | char **r; | 215 | const void * const *r; |
| 216 | int i; | 216 | int i; |
| 217 | int (*comp_func)(const void *,const void *); | 217 | |
| 218 | if(st == NULL) return -1; | 218 | if(st == NULL) return -1; |
| 219 | 219 | ||
| 220 | if (st->comp == NULL) | 220 | if (st->comp == NULL) |
| @@ -226,53 +226,46 @@ static int internal_find(STACK *st, char *data, int ret_val_options) | |||
| 226 | } | 226 | } |
| 227 | sk_sort(st); | 227 | sk_sort(st); |
| 228 | if (data == NULL) return(-1); | 228 | if (data == NULL) return(-1); |
| 229 | /* This (and the "qsort" below) are the two places in OpenSSL | 229 | r=OBJ_bsearch_ex_(&data,st->data,st->num,sizeof(void *),st->comp, |
| 230 | * where we need to convert from our standard (type **,type **) | 230 | ret_val_options); |
| 231 | * compare callback type to the (void *,void *) type required by | ||
| 232 | * bsearch. However, the "data" it is being called(back) with are | ||
| 233 | * not (type *) pointers, but the *pointers* to (type *) pointers, | ||
| 234 | * so we get our extra level of pointer dereferencing that way. */ | ||
| 235 | comp_func=(int (*)(const void *,const void *))(st->comp); | ||
| 236 | r=(char **)OBJ_bsearch_ex((char *)&data,(char *)st->data, | ||
| 237 | st->num,sizeof(char *),comp_func,ret_val_options); | ||
| 238 | if (r == NULL) return(-1); | 231 | if (r == NULL) return(-1); |
| 239 | return((int)(r-st->data)); | 232 | return (int)((char **)r-st->data); |
| 240 | } | 233 | } |
| 241 | 234 | ||
| 242 | int sk_find(STACK *st, char *data) | 235 | int sk_find(_STACK *st, void *data) |
| 243 | { | 236 | { |
| 244 | return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); | 237 | return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); |
| 245 | } | 238 | } |
| 246 | int sk_find_ex(STACK *st, char *data) | 239 | int sk_find_ex(_STACK *st, void *data) |
| 247 | { | 240 | { |
| 248 | return internal_find(st, data, OBJ_BSEARCH_VALUE_ON_NOMATCH); | 241 | return internal_find(st, data, OBJ_BSEARCH_VALUE_ON_NOMATCH); |
| 249 | } | 242 | } |
| 250 | 243 | ||
| 251 | int sk_push(STACK *st, char *data) | 244 | int sk_push(_STACK *st, void *data) |
| 252 | { | 245 | { |
| 253 | return(sk_insert(st,data,st->num)); | 246 | return(sk_insert(st,data,st->num)); |
| 254 | } | 247 | } |
| 255 | 248 | ||
| 256 | int sk_unshift(STACK *st, char *data) | 249 | int sk_unshift(_STACK *st, void *data) |
| 257 | { | 250 | { |
| 258 | return(sk_insert(st,data,0)); | 251 | return(sk_insert(st,data,0)); |
| 259 | } | 252 | } |
| 260 | 253 | ||
| 261 | char *sk_shift(STACK *st) | 254 | void *sk_shift(_STACK *st) |
| 262 | { | 255 | { |
| 263 | if (st == NULL) return(NULL); | 256 | if (st == NULL) return(NULL); |
| 264 | if (st->num <= 0) return(NULL); | 257 | if (st->num <= 0) return(NULL); |
| 265 | return(sk_delete(st,0)); | 258 | return(sk_delete(st,0)); |
| 266 | } | 259 | } |
| 267 | 260 | ||
| 268 | char *sk_pop(STACK *st) | 261 | void *sk_pop(_STACK *st) |
| 269 | { | 262 | { |
| 270 | if (st == NULL) return(NULL); | 263 | if (st == NULL) return(NULL); |
| 271 | if (st->num <= 0) return(NULL); | 264 | if (st->num <= 0) return(NULL); |
| 272 | return(sk_delete(st,st->num-1)); | 265 | return(sk_delete(st,st->num-1)); |
| 273 | } | 266 | } |
| 274 | 267 | ||
| 275 | void sk_zero(STACK *st) | 268 | void sk_zero(_STACK *st) |
| 276 | { | 269 | { |
| 277 | if (st == NULL) return; | 270 | if (st == NULL) return; |
| 278 | if (st->num <= 0) return; | 271 | if (st->num <= 0) return; |
| @@ -280,7 +273,7 @@ void sk_zero(STACK *st) | |||
| 280 | st->num=0; | 273 | st->num=0; |
| 281 | } | 274 | } |
| 282 | 275 | ||
| 283 | void sk_pop_free(STACK *st, void (*func)(void *)) | 276 | void sk_pop_free(_STACK *st, void (*func)(void *)) |
| 284 | { | 277 | { |
| 285 | int i; | 278 | int i; |
| 286 | 279 | ||
| @@ -291,32 +284,32 @@ void sk_pop_free(STACK *st, void (*func)(void *)) | |||
| 291 | sk_free(st); | 284 | sk_free(st); |
| 292 | } | 285 | } |
| 293 | 286 | ||
| 294 | void sk_free(STACK *st) | 287 | void sk_free(_STACK *st) |
| 295 | { | 288 | { |
| 296 | if (st == NULL) return; | 289 | if (st == NULL) return; |
| 297 | if (st->data != NULL) OPENSSL_free(st->data); | 290 | if (st->data != NULL) OPENSSL_free(st->data); |
| 298 | OPENSSL_free(st); | 291 | OPENSSL_free(st); |
| 299 | } | 292 | } |
| 300 | 293 | ||
| 301 | int sk_num(const STACK *st) | 294 | int sk_num(const _STACK *st) |
| 302 | { | 295 | { |
| 303 | if(st == NULL) return -1; | 296 | if(st == NULL) return -1; |
| 304 | return st->num; | 297 | return st->num; |
| 305 | } | 298 | } |
| 306 | 299 | ||
| 307 | char *sk_value(const STACK *st, int i) | 300 | void *sk_value(const _STACK *st, int i) |
| 308 | { | 301 | { |
| 309 | if(!st || (i < 0) || (i >= st->num)) return NULL; | 302 | if(!st || (i < 0) || (i >= st->num)) return NULL; |
| 310 | return st->data[i]; | 303 | return st->data[i]; |
| 311 | } | 304 | } |
| 312 | 305 | ||
| 313 | char *sk_set(STACK *st, int i, char *value) | 306 | void *sk_set(_STACK *st, int i, void *value) |
| 314 | { | 307 | { |
| 315 | if(!st || (i < 0) || (i >= st->num)) return NULL; | 308 | if(!st || (i < 0) || (i >= st->num)) return NULL; |
| 316 | return (st->data[i] = value); | 309 | return (st->data[i] = value); |
| 317 | } | 310 | } |
| 318 | 311 | ||
| 319 | void sk_sort(STACK *st) | 312 | void sk_sort(_STACK *st) |
| 320 | { | 313 | { |
| 321 | if (st && !st->sorted) | 314 | if (st && !st->sorted) |
| 322 | { | 315 | { |
| @@ -333,7 +326,7 @@ void sk_sort(STACK *st) | |||
| 333 | } | 326 | } |
| 334 | } | 327 | } |
| 335 | 328 | ||
| 336 | int sk_is_sorted(const STACK *st) | 329 | int sk_is_sorted(const _STACK *st) |
| 337 | { | 330 | { |
| 338 | if (!st) | 331 | if (!st) |
| 339 | return 1; | 332 | return 1; |
diff --git a/src/lib/libcrypto/stack/stack.h b/src/lib/libcrypto/stack/stack.h index 5cbb116a8b..ce35e554eb 100644 --- a/src/lib/libcrypto/stack/stack.h +++ b/src/lib/libcrypto/stack/stack.h | |||
| @@ -70,37 +70,36 @@ typedef struct stack_st | |||
| 70 | int sorted; | 70 | int sorted; |
| 71 | 71 | ||
| 72 | int num_alloc; | 72 | int num_alloc; |
| 73 | int (*comp)(const char * const *, const char * const *); | 73 | int (*comp)(const void *, const void *); |
| 74 | } STACK; | 74 | } _STACK; /* Use STACK_OF(...) instead */ |
| 75 | 75 | ||
| 76 | #define M_sk_num(sk) ((sk) ? (sk)->num:-1) | 76 | #define M_sk_num(sk) ((sk) ? (sk)->num:-1) |
| 77 | #define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) | 77 | #define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) |
| 78 | 78 | ||
| 79 | int sk_num(const STACK *); | 79 | int sk_num(const _STACK *); |
| 80 | char *sk_value(const STACK *, int); | 80 | void *sk_value(const _STACK *, int); |
| 81 | 81 | ||
| 82 | char *sk_set(STACK *, int, char *); | 82 | void *sk_set(_STACK *, int, void *); |
| 83 | 83 | ||
| 84 | STACK *sk_new(int (*cmp)(const char * const *, const char * const *)); | 84 | _STACK *sk_new(int (*cmp)(const void *, const void *)); |
| 85 | STACK *sk_new_null(void); | 85 | _STACK *sk_new_null(void); |
| 86 | void sk_free(STACK *); | 86 | void sk_free(_STACK *); |
| 87 | void sk_pop_free(STACK *st, void (*func)(void *)); | 87 | void sk_pop_free(_STACK *st, void (*func)(void *)); |
| 88 | int sk_insert(STACK *sk,char *data,int where); | 88 | int sk_insert(_STACK *sk, void *data, int where); |
| 89 | char *sk_delete(STACK *st,int loc); | 89 | void *sk_delete(_STACK *st, int loc); |
| 90 | char *sk_delete_ptr(STACK *st, char *p); | 90 | void *sk_delete_ptr(_STACK *st, void *p); |
| 91 | int sk_find(STACK *st,char *data); | 91 | int sk_find(_STACK *st, void *data); |
| 92 | int sk_find_ex(STACK *st,char *data); | 92 | int sk_find_ex(_STACK *st, void *data); |
| 93 | int sk_push(STACK *st,char *data); | 93 | int sk_push(_STACK *st, void *data); |
| 94 | int sk_unshift(STACK *st,char *data); | 94 | int sk_unshift(_STACK *st, void *data); |
| 95 | char *sk_shift(STACK *st); | 95 | void *sk_shift(_STACK *st); |
| 96 | char *sk_pop(STACK *st); | 96 | void *sk_pop(_STACK *st); |
| 97 | void sk_zero(STACK *st); | 97 | void sk_zero(_STACK *st); |
| 98 | int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *, | 98 | int (*sk_set_cmp_func(_STACK *sk, int (*c)(const void *, const void *))) |
| 99 | const char * const *))) | 99 | (const void *, const void *); |
| 100 | (const char * const *, const char * const *); | 100 | _STACK *sk_dup(_STACK *st); |
| 101 | STACK *sk_dup(STACK *st); | 101 | void sk_sort(_STACK *st); |
| 102 | void sk_sort(STACK *st); | 102 | int sk_is_sorted(const _STACK *st); |
| 103 | int sk_is_sorted(const STACK *st); | ||
| 104 | 103 | ||
| 105 | #ifdef __cplusplus | 104 | #ifdef __cplusplus |
| 106 | } | 105 | } |
diff --git a/src/lib/libcrypto/symhacks.h b/src/lib/libcrypto/symhacks.h index 8728e6124d..3fd4a81692 100644 --- a/src/lib/libcrypto/symhacks.h +++ b/src/lib/libcrypto/symhacks.h | |||
| @@ -60,12 +60,13 @@ | |||
| 60 | /* Hacks to solve the problem with linkers incapable of handling very long | 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 | 61 | symbol names. In the case of VMS, the limit is 31 characters on VMS for |
| 62 | VAX. */ | 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. */ | ||
| 63 | #ifdef OPENSSL_SYS_VMS | 68 | #ifdef OPENSSL_SYS_VMS |
| 64 | 69 | ||
| 65 | /* Hack a long name in crypto/cryptlib.c */ | ||
| 66 | #undef int_CRYPTO_set_do_dynlock_callback | ||
| 67 | #define int_CRYPTO_set_do_dynlock_callback int_CRYPTO_set_do_dynlock_cb | ||
| 68 | |||
| 69 | /* Hack a long name in crypto/ex_data.c */ | 70 | /* Hack a long name in crypto/ex_data.c */ |
| 70 | #undef CRYPTO_get_ex_data_implementation | 71 | #undef CRYPTO_get_ex_data_implementation |
| 71 | #define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl | 72 | #define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl |
| @@ -137,6 +138,8 @@ | |||
| 137 | #define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers | 138 | #define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers |
| 138 | #undef X509_STORE_CTX_get_explicit_policy | 139 | #undef X509_STORE_CTX_get_explicit_policy |
| 139 | #define X509_STORE_CTX_get_explicit_policy X509_STORE_CTX_get_expl_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 | ||
| 140 | 143 | ||
| 141 | /* Hack some long CRYPTO names */ | 144 | /* Hack some long CRYPTO names */ |
| 142 | #undef CRYPTO_set_dynlock_destroy_callback | 145 | #undef CRYPTO_set_dynlock_destroy_callback |
| @@ -144,9 +147,9 @@ | |||
| 144 | #undef CRYPTO_set_dynlock_create_callback | 147 | #undef CRYPTO_set_dynlock_create_callback |
| 145 | #define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb | 148 | #define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb |
| 146 | #undef CRYPTO_set_dynlock_lock_callback | 149 | #undef CRYPTO_set_dynlock_lock_callback |
| 147 | #define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb | 150 | #define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb |
| 148 | #undef CRYPTO_get_dynlock_lock_callback | 151 | #undef CRYPTO_get_dynlock_lock_callback |
| 149 | #define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb | 152 | #define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb |
| 150 | #undef CRYPTO_get_dynlock_destroy_callback | 153 | #undef CRYPTO_get_dynlock_destroy_callback |
| 151 | #define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb | 154 | #define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb |
| 152 | #undef CRYPTO_get_dynlock_create_callback | 155 | #undef CRYPTO_get_dynlock_create_callback |
| @@ -158,7 +161,7 @@ | |||
| 158 | 161 | ||
| 159 | /* Hack some long SSL names */ | 162 | /* Hack some long SSL names */ |
| 160 | #undef SSL_CTX_set_default_verify_paths | 163 | #undef SSL_CTX_set_default_verify_paths |
| 161 | #define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths | 164 | #define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths |
| 162 | #undef SSL_get_ex_data_X509_STORE_CTX_idx | 165 | #undef SSL_get_ex_data_X509_STORE_CTX_idx |
| 163 | #define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx | 166 | #define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx |
| 164 | #undef SSL_add_file_cert_subjects_to_stack | 167 | #undef SSL_add_file_cert_subjects_to_stack |
| @@ -168,21 +171,38 @@ | |||
| 168 | #undef SSL_CTX_use_certificate_chain_file | 171 | #undef SSL_CTX_use_certificate_chain_file |
| 169 | #define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file | 172 | #define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file |
| 170 | #undef SSL_CTX_set_cert_verify_callback | 173 | #undef SSL_CTX_set_cert_verify_callback |
| 171 | #define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb | 174 | #define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb |
| 172 | #undef SSL_CTX_set_default_passwd_cb_userdata | 175 | #undef SSL_CTX_set_default_passwd_cb_userdata |
| 173 | #define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud | 176 | #define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud |
| 174 | #undef SSL_COMP_get_compression_methods | 177 | #undef SSL_COMP_get_compression_methods |
| 175 | #define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods | 178 | #define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods |
| 176 | 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 | |||
| 177 | /* Hack some long ENGINE names */ | 189 | /* Hack some long ENGINE names */ |
| 178 | #undef ENGINE_get_default_BN_mod_exp_crt | 190 | #undef ENGINE_get_default_BN_mod_exp_crt |
| 179 | #define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt | 191 | #define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt |
| 180 | #undef ENGINE_set_default_BN_mod_exp_crt | 192 | #undef ENGINE_set_default_BN_mod_exp_crt |
| 181 | #define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt | 193 | #define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt |
| 182 | #undef ENGINE_set_load_privkey_function | 194 | #undef ENGINE_set_load_privkey_function |
| 183 | #define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn | 195 | #define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn |
| 184 | #undef ENGINE_get_load_privkey_function | 196 | #undef ENGINE_get_load_privkey_function |
| 185 | #define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn | 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 | ||
| 186 | #undef ENGINE_set_load_ssl_client_cert_function | 206 | #undef ENGINE_set_load_ssl_client_cert_function |
| 187 | #define ENGINE_set_load_ssl_client_cert_function \ | 207 | #define ENGINE_set_load_ssl_client_cert_function \ |
| 188 | ENGINE_set_ld_ssl_clnt_cert_fn | 208 | ENGINE_set_ld_ssl_clnt_cert_fn |
| @@ -191,7 +211,7 @@ | |||
| 191 | 211 | ||
| 192 | /* Hack some long OCSP names */ | 212 | /* Hack some long OCSP names */ |
| 193 | #undef OCSP_REQUEST_get_ext_by_critical | 213 | #undef OCSP_REQUEST_get_ext_by_critical |
| 194 | #define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit | 214 | #define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit |
| 195 | #undef OCSP_BASICRESP_get_ext_by_critical | 215 | #undef OCSP_BASICRESP_get_ext_by_critical |
| 196 | #define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit | 216 | #define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit |
| 197 | #undef OCSP_SINGLERESP_get_ext_by_critical | 217 | #undef OCSP_SINGLERESP_get_ext_by_critical |
| @@ -208,6 +228,8 @@ | |||
| 208 | #define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf | 228 | #define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf |
| 209 | #undef OPENSSL_add_all_algorithms_conf | 229 | #undef OPENSSL_add_all_algorithms_conf |
| 210 | #define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_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 | ||
| 211 | 233 | ||
| 212 | /* Hack some long EC names */ | 234 | /* Hack some long EC names */ |
| 213 | #undef EC_GROUP_set_point_conversion_form | 235 | #undef EC_GROUP_set_point_conversion_form |
| @@ -236,15 +258,15 @@ | |||
| 236 | #define EC_POINT_set_compressed_coordinates_GF2m \ | 258 | #define EC_POINT_set_compressed_coordinates_GF2m \ |
| 237 | EC_POINT_set_compr_coords_GF2m | 259 | EC_POINT_set_compr_coords_GF2m |
| 238 | #undef ec_GF2m_simple_group_clear_finish | 260 | #undef ec_GF2m_simple_group_clear_finish |
| 239 | #define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish | 261 | #define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish |
| 240 | #undef ec_GF2m_simple_group_check_discriminant | 262 | #undef ec_GF2m_simple_group_check_discriminant |
| 241 | #define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim | 263 | #define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim |
| 242 | #undef ec_GF2m_simple_point_clear_finish | 264 | #undef ec_GF2m_simple_point_clear_finish |
| 243 | #define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish | 265 | #define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish |
| 244 | #undef ec_GF2m_simple_point_set_to_infinity | 266 | #undef ec_GF2m_simple_point_set_to_infinity |
| 245 | #define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf | 267 | #define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf |
| 246 | #undef ec_GF2m_simple_points_make_affine | 268 | #undef ec_GF2m_simple_points_make_affine |
| 247 | #define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine | 269 | #define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine |
| 248 | #undef ec_GF2m_simple_point_set_affine_coordinates | 270 | #undef ec_GF2m_simple_point_set_affine_coordinates |
| 249 | #define ec_GF2m_simple_point_set_affine_coordinates \ | 271 | #define ec_GF2m_simple_point_set_affine_coordinates \ |
| 250 | ec_GF2m_smp_pt_set_af_coords | 272 | ec_GF2m_smp_pt_set_af_coords |
| @@ -259,19 +281,19 @@ | |||
| 259 | #undef ec_GFp_simple_group_get_curve_GFp | 281 | #undef ec_GFp_simple_group_get_curve_GFp |
| 260 | #define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp | 282 | #define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp |
| 261 | #undef ec_GFp_simple_group_clear_finish | 283 | #undef ec_GFp_simple_group_clear_finish |
| 262 | #define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish | 284 | #define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish |
| 263 | #undef ec_GFp_simple_group_set_generator | 285 | #undef ec_GFp_simple_group_set_generator |
| 264 | #define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator | 286 | #define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator |
| 265 | #undef ec_GFp_simple_group_get0_generator | 287 | #undef ec_GFp_simple_group_get0_generator |
| 266 | #define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator | 288 | #define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator |
| 267 | #undef ec_GFp_simple_group_get_cofactor | 289 | #undef ec_GFp_simple_group_get_cofactor |
| 268 | #define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor | 290 | #define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor |
| 269 | #undef ec_GFp_simple_point_clear_finish | 291 | #undef ec_GFp_simple_point_clear_finish |
| 270 | #define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish | 292 | #define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish |
| 271 | #undef ec_GFp_simple_point_set_to_infinity | 293 | #undef ec_GFp_simple_point_set_to_infinity |
| 272 | #define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf | 294 | #define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf |
| 273 | #undef ec_GFp_simple_points_make_affine | 295 | #undef ec_GFp_simple_points_make_affine |
| 274 | #define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine | 296 | #define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine |
| 275 | #undef ec_GFp_simple_group_get_curve_GFp | 297 | #undef ec_GFp_simple_group_get_curve_GFp |
| 276 | #define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp | 298 | #define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp |
| 277 | #undef ec_GFp_simple_set_Jprojective_coordinates_GFp | 299 | #undef ec_GFp_simple_set_Jprojective_coordinates_GFp |
| @@ -351,6 +373,14 @@ | |||
| 351 | #undef STORE_method_get_unlock_store_function | 373 | #undef STORE_method_get_unlock_store_function |
| 352 | #define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn | 374 | #define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn |
| 353 | 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 | |||
| 354 | /* Hack some long CMS names */ | 384 | /* Hack some long CMS names */ |
| 355 | #undef CMS_RecipientInfo_ktri_get0_algs | 385 | #undef CMS_RecipientInfo_ktri_get0_algs |
| 356 | #define CMS_RecipientInfo_ktri_get0_algs CMS_RecipInfo_ktri_get0_algs | 386 | #define CMS_RecipientInfo_ktri_get0_algs CMS_RecipInfo_ktri_get0_algs |
| @@ -365,24 +395,34 @@ | |||
| 365 | #undef cms_SignerIdentifier_get0_signer_id | 395 | #undef cms_SignerIdentifier_get0_signer_id |
| 366 | #define cms_SignerIdentifier_get0_signer_id cms_SignerId_get0_signer_id | 396 | #define cms_SignerIdentifier_get0_signer_id cms_SignerId_get0_signer_id |
| 367 | 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 | |||
| 368 | #endif /* defined OPENSSL_SYS_VMS */ | 408 | #endif /* defined OPENSSL_SYS_VMS */ |
| 369 | 409 | ||
| 370 | 410 | ||
| 371 | /* Case insensiteve linking causes problems.... */ | 411 | /* Case insensitive linking causes problems.... */ |
| 372 | #if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) | 412 | #if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) |
| 373 | #undef ERR_load_CRYPTO_strings | 413 | #undef ERR_load_CRYPTO_strings |
| 374 | #define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings | 414 | #define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings |
| 375 | #undef OCSP_crlID_new | 415 | #undef OCSP_crlID_new |
| 376 | #define OCSP_crlID_new OCSP_crlID2_new | 416 | #define OCSP_crlID_new OCSP_crlID2_new |
| 377 | 417 | ||
| 378 | #undef d2i_ECPARAMETERS | 418 | #undef d2i_ECPARAMETERS |
| 379 | #define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS | 419 | #define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS |
| 380 | #undef i2d_ECPARAMETERS | 420 | #undef i2d_ECPARAMETERS |
| 381 | #define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS | 421 | #define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS |
| 382 | #undef d2i_ECPKPARAMETERS | 422 | #undef d2i_ECPKPARAMETERS |
| 383 | #define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS | 423 | #define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS |
| 384 | #undef i2d_ECPKPARAMETERS | 424 | #undef i2d_ECPKPARAMETERS |
| 385 | #define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS | 425 | #define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS |
| 386 | 426 | ||
| 387 | /* These functions do not seem to exist! However, I'm paranoid... | 427 | /* These functions do not seem to exist! However, I'm paranoid... |
| 388 | Original command in x509v3.h: | 428 | Original command in x509v3.h: |
| @@ -391,19 +431,19 @@ | |||
| 391 | hide them a little, by giving them an extra 'o' at the | 431 | hide them a little, by giving them an extra 'o' at the |
| 392 | beginning of the name... */ | 432 | beginning of the name... */ |
| 393 | #undef X509v3_cleanup_extensions | 433 | #undef X509v3_cleanup_extensions |
| 394 | #define X509v3_cleanup_extensions oX509v3_cleanup_extensions | 434 | #define X509v3_cleanup_extensions oX509v3_cleanup_extensions |
| 395 | #undef X509v3_add_extension | 435 | #undef X509v3_add_extension |
| 396 | #define X509v3_add_extension oX509v3_add_extension | 436 | #define X509v3_add_extension oX509v3_add_extension |
| 397 | #undef X509v3_add_netscape_extensions | 437 | #undef X509v3_add_netscape_extensions |
| 398 | #define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions | 438 | #define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions |
| 399 | #undef X509v3_add_standard_extensions | 439 | #undef X509v3_add_standard_extensions |
| 400 | #define X509v3_add_standard_extensions oX509v3_add_standard_extensions | 440 | #define X509v3_add_standard_extensions oX509v3_add_standard_extensions |
| 401 | 441 | ||
| 442 | /* This one clashes with CMS_data_create */ | ||
| 443 | #undef cms_Data_create | ||
| 444 | #define cms_Data_create priv_cms_Data_create | ||
| 402 | 445 | ||
| 403 | #endif | 446 | #endif |
| 404 | 447 | ||
| 405 | 448 | ||
| 406 | #endif /* ! defined HEADER_VMS_IDHACKS_H */ | 449 | #endif /* ! defined HEADER_VMS_IDHACKS_H */ |
| 407 | /* This one clashes with CMS_data_create */ | ||
| 408 | #undef cms_Data_create | ||
| 409 | #define cms_Data_create priv_cms_Data_create | ||
diff --git a/src/lib/libcrypto/threads/mttest.c b/src/lib/libcrypto/threads/mttest.c index f6f3df4b6a..eba7aa8a6e 100644 --- a/src/lib/libcrypto/threads/mttest.c +++ b/src/lib/libcrypto/threads/mttest.c | |||
| @@ -117,11 +117,13 @@ 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); | 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); | 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); | 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); | ||
| 120 | 121 | ||
| 121 | unsigned long irix_thread_id(void ); | 122 | unsigned long irix_thread_id(void ); |
| 122 | unsigned long solaris_thread_id(void ); | 123 | unsigned long solaris_thread_id(void ); |
| 123 | unsigned long pthreads_thread_id(void ); | 124 | unsigned long pthreads_thread_id(void ); |
| 124 | unsigned long netware_thread_id(void ); | 125 | unsigned long netware_thread_id(void ); |
| 126 | unsigned long beos_thread_id(void ); | ||
| 125 | 127 | ||
| 126 | #if defined(OPENSSL_SYS_NETWARE) | 128 | #if defined(OPENSSL_SYS_NETWARE) |
| 127 | static MPKMutex *lock_cs; | 129 | static MPKMutex *lock_cs; |
| @@ -1209,3 +1211,100 @@ unsigned long netware_thread_id(void) | |||
| 1209 | return(ret); | 1211 | return(ret); |
| 1210 | } | 1212 | } |
| 1211 | #endif /* NETWARE */ | 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/pthreads-vms.com b/src/lib/libcrypto/threads/pthreads-vms.com index 63f5b8cc2e..1cf92bdf57 100644 --- a/src/lib/libcrypto/threads/pthreads-vms.com +++ b/src/lib/libcrypto/threads/pthreads-vms.com | |||
| @@ -2,8 +2,13 @@ $! To compile mttest on VMS. | |||
| 2 | $! | 2 | $! |
| 3 | $! WARNING: only tested with DEC C so far. | 3 | $! WARNING: only tested with DEC C so far. |
| 4 | $ | 4 | $ |
| 5 | $ arch := vax | 5 | $ if (f$getsyi("cpu").lt.128) |
| 6 | $ if f$getsyi("CPU") .ge. 128 then arch := axp | 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 | ||
| 7 | $ define/user openssl [--.include.openssl] | 12 | $ define/user openssl [--.include.openssl] |
| 8 | $ cc/def=PTHREADS mttest.c | 13 | $ cc/def=PTHREADS mttest.c |
| 9 | $ link mttest,[--.'arch'.exe.ssl]libssl/lib,[--.'arch'.exe.crypto]libcrypto/lib | 14 | $ link mttest,[--.'arch'.exe.ssl]libssl/lib,[--.'arch'.exe.crypto]libcrypto/lib |
diff --git a/src/lib/libcrypto/tmdiff.c b/src/lib/libcrypto/tmdiff.c deleted file mode 100644 index 1c6e052ac9..0000000000 --- a/src/lib/libcrypto/tmdiff.c +++ /dev/null | |||
| @@ -1,260 +0,0 @@ | |||
| 1 | /* crypto/tmdiff.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 "cryptlib.h" | ||
| 61 | #include <openssl/tmdiff.h> | ||
| 62 | #if !defined(OPENSSL_SYS_MSDOS) | ||
| 63 | #include OPENSSL_UNISTD | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #ifdef TIMEB | ||
| 67 | #undef OPENSSL_SYS_WIN32 | ||
| 68 | #undef TIMES | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) && !(defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX_RHAPSODY) && !defined(OPENSSL_SYS_VXWORKS) | ||
| 72 | # define TIMES | ||
| 73 | #endif | ||
| 74 | |||
| 75 | #ifdef OPENSSL_SYS_NETWARE | ||
| 76 | #undef TIMES | ||
| 77 | #endif | ||
| 78 | |||
| 79 | #if !defined(_IRIX) || defined (OPENSSL_SYS_NETWARE) | ||
| 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 | #if defined(sun) || defined(__ultrix) | ||
| 96 | #define _POSIX_SOURCE | ||
| 97 | #include <limits.h> | ||
| 98 | #include <sys/param.h> | ||
| 99 | #endif | ||
| 100 | |||
| 101 | #if !defined(TIMES) && !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_NETWARE) | ||
| 102 | #include <sys/timeb.h> | ||
| 103 | #endif | ||
| 104 | |||
| 105 | #ifdef OPENSSL_SYS_WIN32 | ||
| 106 | #include <windows.h> | ||
| 107 | #endif | ||
| 108 | |||
| 109 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 110 | #ifndef HZ | ||
| 111 | # if defined(_SC_CLK_TCK) \ | ||
| 112 | && (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >= 70000000) | ||
| 113 | /* # define HZ ((double)sysconf(_SC_CLK_TCK)) */ | ||
| 114 | # define HZ sysconf(_SC_CLK_TCK) | ||
| 115 | # else | ||
| 116 | # ifndef CLK_TCK | ||
| 117 | # ifndef _BSD_CLK_TCK_ /* FreeBSD hack */ | ||
| 118 | # define HZ 100.0 | ||
| 119 | # else /* _BSD_CLK_TCK_ */ | ||
| 120 | # define HZ ((double)_BSD_CLK_TCK_) | ||
| 121 | # endif | ||
| 122 | # else /* CLK_TCK */ | ||
| 123 | # define HZ ((double)CLK_TCK) | ||
| 124 | # endif | ||
| 125 | # endif | ||
| 126 | #endif | ||
| 127 | |||
| 128 | struct ms_tm | ||
| 129 | { | ||
| 130 | #ifdef TIMES | ||
| 131 | struct tms ms_tms; | ||
| 132 | #else | ||
| 133 | # ifdef OPENSSL_SYS_WIN32 | ||
| 134 | HANDLE thread_id; | ||
| 135 | FILETIME ms_win32; | ||
| 136 | # elif defined (OPENSSL_SYS_NETWARE) | ||
| 137 | clock_t ms_clock; | ||
| 138 | # else | ||
| 139 | # ifdef OPENSSL_SYS_VXWORKS | ||
| 140 | unsigned long ticks; | ||
| 141 | # else | ||
| 142 | struct timeb ms_timeb; | ||
| 143 | # endif | ||
| 144 | # endif | ||
| 145 | #endif | ||
| 146 | }; | ||
| 147 | |||
| 148 | MS_TM *ms_time_new(void) | ||
| 149 | { | ||
| 150 | MS_TM *ret; | ||
| 151 | |||
| 152 | ret=(MS_TM *)OPENSSL_malloc(sizeof(MS_TM)); | ||
| 153 | if (ret == NULL) | ||
| 154 | return(NULL); | ||
| 155 | memset(ret,0,sizeof(MS_TM)); | ||
| 156 | #ifdef OPENSSL_SYS_WIN32 | ||
| 157 | ret->thread_id=GetCurrentThread(); | ||
| 158 | #endif | ||
| 159 | return ret; | ||
| 160 | } | ||
| 161 | |||
| 162 | void ms_time_free(MS_TM *a) | ||
| 163 | { | ||
| 164 | if (a != NULL) | ||
| 165 | OPENSSL_free(a); | ||
| 166 | } | ||
| 167 | |||
| 168 | void ms_time_get(MS_TM *tm) | ||
| 169 | { | ||
| 170 | #ifdef OPENSSL_SYS_WIN32 | ||
| 171 | FILETIME tmpa,tmpb,tmpc; | ||
| 172 | #endif | ||
| 173 | |||
| 174 | #ifdef TIMES | ||
| 175 | times(&tm->ms_tms); | ||
| 176 | #else | ||
| 177 | # ifdef OPENSSL_SYS_WIN32 | ||
| 178 | GetThreadTimes(tm->thread_id,&tmpa,&tmpb,&tmpc,&(tm->ms_win32)); | ||
| 179 | # elif defined (OPENSSL_SYS_NETWARE) | ||
| 180 | tm->ms_clock = clock(); | ||
| 181 | # else | ||
| 182 | # ifdef OPENSSL_SYS_VXWORKS | ||
| 183 | tm->ticks = tickGet(); | ||
| 184 | # else | ||
| 185 | ftime(&tm->ms_timeb); | ||
| 186 | # endif | ||
| 187 | # endif | ||
| 188 | #endif | ||
| 189 | } | ||
| 190 | |||
| 191 | double ms_time_diff(MS_TM *a, MS_TM *b) | ||
| 192 | { | ||
| 193 | double ret; | ||
| 194 | |||
| 195 | #ifdef TIMES | ||
| 196 | ret = HZ; | ||
| 197 | ret = (b->ms_tms.tms_utime-a->ms_tms.tms_utime) / ret; | ||
| 198 | #else | ||
| 199 | # ifdef OPENSSL_SYS_WIN32 | ||
| 200 | { | ||
| 201 | #ifdef __GNUC__ | ||
| 202 | signed long long la,lb; | ||
| 203 | #else | ||
| 204 | signed _int64 la,lb; | ||
| 205 | #endif | ||
| 206 | la=a->ms_win32.dwHighDateTime; | ||
| 207 | lb=b->ms_win32.dwHighDateTime; | ||
| 208 | la<<=32; | ||
| 209 | lb<<=32; | ||
| 210 | la+=a->ms_win32.dwLowDateTime; | ||
| 211 | lb+=b->ms_win32.dwLowDateTime; | ||
| 212 | ret=((double)(lb-la))/1e7; | ||
| 213 | } | ||
| 214 | # elif defined (OPENSSL_SYS_NETWARE) | ||
| 215 | ret= (double)(b->ms_clock - a->ms_clock); | ||
| 216 | # else | ||
| 217 | # ifdef OPENSSL_SYS_VXWORKS | ||
| 218 | ret = (double)(b->ticks - a->ticks) / (double)sysClkRateGet(); | ||
| 219 | # else | ||
| 220 | ret= (double)(b->ms_timeb.time-a->ms_timeb.time)+ | ||
| 221 | (((double)b->ms_timeb.millitm)- | ||
| 222 | ((double)a->ms_timeb.millitm))/1000.0; | ||
| 223 | # endif | ||
| 224 | # endif | ||
| 225 | #endif | ||
| 226 | return((ret < 0.0000001)?0.0000001:ret); | ||
| 227 | } | ||
| 228 | |||
| 229 | int ms_time_cmp(const MS_TM *a, const MS_TM *b) | ||
| 230 | { | ||
| 231 | double d; | ||
| 232 | int ret; | ||
| 233 | |||
| 234 | #ifdef TIMES | ||
| 235 | d = HZ; | ||
| 236 | d = (b->ms_tms.tms_utime-a->ms_tms.tms_utime) / d; | ||
| 237 | #else | ||
| 238 | # ifdef OPENSSL_SYS_WIN32 | ||
| 239 | d =(b->ms_win32.dwHighDateTime&0x000fffff)*10+b->ms_win32.dwLowDateTime/1e7; | ||
| 240 | d-=(a->ms_win32.dwHighDateTime&0x000fffff)*10+a->ms_win32.dwLowDateTime/1e7; | ||
| 241 | # elif defined (OPENSSL_SYS_NETWARE) | ||
| 242 | d= (double)(b->ms_clock - a->ms_clock); | ||
| 243 | # else | ||
| 244 | # ifdef OPENSSL_SYS_VXWORKS | ||
| 245 | d = (b->ticks - a->ticks); | ||
| 246 | # else | ||
| 247 | d= (double)(b->ms_timeb.time-a->ms_timeb.time)+ | ||
| 248 | (((double)b->ms_timeb.millitm)-(double)a->ms_timeb.millitm)/1000.0; | ||
| 249 | # endif | ||
| 250 | # endif | ||
| 251 | #endif | ||
| 252 | if (d == 0.0) | ||
| 253 | ret=0; | ||
| 254 | else if (d < 0) | ||
| 255 | ret= -1; | ||
| 256 | else | ||
| 257 | ret=1; | ||
| 258 | return(ret); | ||
| 259 | } | ||
| 260 | |||
diff --git a/src/lib/libcrypto/tmdiff.h b/src/lib/libcrypto/tmdiff.h deleted file mode 100644 index af5c41c649..0000000000 --- a/src/lib/libcrypto/tmdiff.h +++ /dev/null | |||
| @@ -1,93 +0,0 @@ | |||
| 1 | /* crypto/tmdiff.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 | /* Header for dynamic hash table routines | ||
| 60 | * Author - Eric Young | ||
| 61 | */ | ||
| 62 | /* ... erm yeah, "dynamic hash tables" you say? | ||
| 63 | * | ||
| 64 | * And what would dynamic hash tables have to do with any of this code *now*? | ||
| 65 | * AFAICS, this code is only referenced by crypto/bn/exp.c which is an unused | ||
| 66 | * file that I doubt compiles any more. speed.c is the only thing that could | ||
| 67 | * use this (and it has nothing to do with hash tables), yet it instead has its | ||
| 68 | * own duplication of all this stuff and looks, if anything, more complete. See | ||
| 69 | * the corresponding note in apps/speed.c. | ||
| 70 | * The Bemused - Geoff | ||
| 71 | */ | ||
| 72 | |||
| 73 | #ifndef HEADER_TMDIFF_H | ||
| 74 | #define HEADER_TMDIFF_H | ||
| 75 | |||
| 76 | #ifdef __cplusplus | ||
| 77 | extern "C" { | ||
| 78 | #endif | ||
| 79 | |||
| 80 | typedef struct ms_tm MS_TM; | ||
| 81 | |||
| 82 | MS_TM *ms_time_new(void ); | ||
| 83 | void ms_time_free(MS_TM *a); | ||
| 84 | void ms_time_get(MS_TM *a); | ||
| 85 | double ms_time_diff(MS_TM *start, MS_TM *end); | ||
| 86 | int ms_time_cmp(const MS_TM *ap, const MS_TM *bp); | ||
| 87 | |||
| 88 | #ifdef __cplusplus | ||
| 89 | } | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #endif | ||
| 93 | |||
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.ssl b/src/lib/libcrypto/txt_db/Makefile.ssl deleted file mode 100644 index 6221dfae4d..0000000000 --- a/src/lib/libcrypto/txt_db/Makefile.ssl +++ /dev/null | |||
| @@ -1,88 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/txt_db/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= txt_db | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=txt_db.c | ||
| 27 | LIBOBJ=txt_db.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= txt_db.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.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 54 | |||
| 55 | install: | ||
| 56 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | txt_db.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 83 | txt_db.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 84 | txt_db.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 85 | txt_db.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 86 | txt_db.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 87 | txt_db.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 88 | txt_db.o: ../../include/openssl/txt_db.h ../cryptlib.h txt_db.c | ||
diff --git a/src/lib/libcrypto/txt_db/txt_db.c b/src/lib/libcrypto/txt_db/txt_db.c index 3ed5f72ee9..6f2ce3b5a4 100644 --- a/src/lib/libcrypto/txt_db/txt_db.c +++ b/src/lib/libcrypto/txt_db/txt_db.c | |||
| @@ -77,22 +77,23 @@ TXT_DB *TXT_DB_read(BIO *in, int num) | |||
| 77 | int i,add,n; | 77 | int i,add,n; |
| 78 | int size=BUFSIZE; | 78 | int size=BUFSIZE; |
| 79 | int offset=0; | 79 | int offset=0; |
| 80 | char *p,**pp,*f; | 80 | char *p,*f; |
| 81 | OPENSSL_STRING *pp; | ||
| 81 | BUF_MEM *buf=NULL; | 82 | BUF_MEM *buf=NULL; |
| 82 | 83 | ||
| 83 | if ((buf=BUF_MEM_new()) == NULL) goto err; | 84 | if ((buf=BUF_MEM_new()) == NULL) goto err; |
| 84 | if (!BUF_MEM_grow(buf,size)) goto err; | 85 | if (!BUF_MEM_grow(buf,size)) goto err; |
| 85 | 86 | ||
| 86 | if ((ret=(TXT_DB *)OPENSSL_malloc(sizeof(TXT_DB))) == NULL) | 87 | if ((ret=OPENSSL_malloc(sizeof(TXT_DB))) == NULL) |
| 87 | goto err; | 88 | goto err; |
| 88 | ret->num_fields=num; | 89 | ret->num_fields=num; |
| 89 | ret->index=NULL; | 90 | ret->index=NULL; |
| 90 | ret->qual=NULL; | 91 | ret->qual=NULL; |
| 91 | if ((ret->data=sk_new_null()) == NULL) | 92 | if ((ret->data=sk_OPENSSL_PSTRING_new_null()) == NULL) |
| 92 | goto err; | 93 | goto err; |
| 93 | if ((ret->index=(LHASH **)OPENSSL_malloc(sizeof(LHASH *)*num)) == NULL) | 94 | if ((ret->index=OPENSSL_malloc(sizeof(*ret->index)*num)) == NULL) |
| 94 | goto err; | 95 | goto err; |
| 95 | if ((ret->qual=(int (**)(char **))OPENSSL_malloc(sizeof(int (**)(char **))*num)) == NULL) | 96 | if ((ret->qual=OPENSSL_malloc(sizeof(*(ret->qual))*num)) == NULL) |
| 96 | goto err; | 97 | goto err; |
| 97 | for (i=0; i<num; i++) | 98 | for (i=0; i<num; i++) |
| 98 | { | 99 | { |
| @@ -122,7 +123,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num) | |||
| 122 | else | 123 | else |
| 123 | { | 124 | { |
| 124 | buf->data[offset-1]='\0'; /* blat the '\n' */ | 125 | buf->data[offset-1]='\0'; /* blat the '\n' */ |
| 125 | if (!(p=(char *)OPENSSL_malloc(add+offset))) goto err; | 126 | if (!(p=OPENSSL_malloc(add+offset))) goto err; |
| 126 | offset=0; | 127 | offset=0; |
| 127 | } | 128 | } |
| 128 | pp=(char **)p; | 129 | pp=(char **)p; |
| @@ -155,16 +156,16 @@ TXT_DB *TXT_DB_read(BIO *in, int num) | |||
| 155 | *(p++)='\0'; | 156 | *(p++)='\0'; |
| 156 | if ((n != num) || (*f != '\0')) | 157 | if ((n != num) || (*f != '\0')) |
| 157 | { | 158 | { |
| 158 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) /* temporaty fix :-( */ | 159 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) /* temporary fix :-( */ |
| 159 | fprintf(stderr,"wrong number of fields on line %ld (looking for field %d, got %d, '%s' left)\n",ln,num,n,f); | 160 | fprintf(stderr,"wrong number of fields on line %ld (looking for field %d, got %d, '%s' left)\n",ln,num,n,f); |
| 160 | #endif | 161 | #endif |
| 161 | er=2; | 162 | er=2; |
| 162 | goto err; | 163 | goto err; |
| 163 | } | 164 | } |
| 164 | pp[n]=p; | 165 | pp[n]=p; |
| 165 | if (!sk_push(ret->data,(char *)pp)) | 166 | if (!sk_OPENSSL_PSTRING_push(ret->data,pp)) |
| 166 | { | 167 | { |
| 167 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) /* temporaty fix :-( */ | 168 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) /* temporary fix :-( */ |
| 168 | fprintf(stderr,"failure in sk_push\n"); | 169 | fprintf(stderr,"failure in sk_push\n"); |
| 169 | #endif | 170 | #endif |
| 170 | er=2; | 171 | er=2; |
| @@ -181,7 +182,7 @@ err: | |||
| 181 | #endif | 182 | #endif |
| 182 | if (ret != NULL) | 183 | if (ret != NULL) |
| 183 | { | 184 | { |
| 184 | if (ret->data != NULL) sk_free(ret->data); | 185 | if (ret->data != NULL) sk_OPENSSL_PSTRING_free(ret->data); |
| 185 | if (ret->index != NULL) OPENSSL_free(ret->index); | 186 | if (ret->index != NULL) OPENSSL_free(ret->index); |
| 186 | if (ret->qual != NULL) OPENSSL_free(ret->qual); | 187 | if (ret->qual != NULL) OPENSSL_free(ret->qual); |
| 187 | if (ret != NULL) OPENSSL_free(ret); | 188 | if (ret != NULL) OPENSSL_free(ret); |
| @@ -192,10 +193,10 @@ err: | |||
| 192 | return(ret); | 193 | return(ret); |
| 193 | } | 194 | } |
| 194 | 195 | ||
| 195 | char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value) | 196 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value) |
| 196 | { | 197 | { |
| 197 | char **ret; | 198 | OPENSSL_STRING *ret; |
| 198 | LHASH *lh; | 199 | LHASH_OF(OPENSSL_STRING) *lh; |
| 199 | 200 | ||
| 200 | if (idx >= db->num_fields) | 201 | if (idx >= db->num_fields) |
| 201 | { | 202 | { |
| @@ -208,16 +209,16 @@ char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value) | |||
| 208 | db->error=DB_ERROR_NO_INDEX; | 209 | db->error=DB_ERROR_NO_INDEX; |
| 209 | return(NULL); | 210 | return(NULL); |
| 210 | } | 211 | } |
| 211 | ret=(char **)lh_retrieve(lh,value); | 212 | ret=lh_OPENSSL_STRING_retrieve(lh,value); |
| 212 | db->error=DB_ERROR_OK; | 213 | db->error=DB_ERROR_OK; |
| 213 | return(ret); | 214 | return(ret); |
| 214 | } | 215 | } |
| 215 | 216 | ||
| 216 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(char **), | 217 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(OPENSSL_STRING *), |
| 217 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp) | 218 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp) |
| 218 | { | 219 | { |
| 219 | LHASH *idx; | 220 | LHASH_OF(OPENSSL_STRING) *idx; |
| 220 | char **r; | 221 | OPENSSL_STRING *r; |
| 221 | int i,n; | 222 | int i,n; |
| 222 | 223 | ||
| 223 | if (field >= db->num_fields) | 224 | if (field >= db->num_fields) |
| @@ -225,26 +226,27 @@ int TXT_DB_create_index(TXT_DB *db, int field, int (*qual)(char **), | |||
| 225 | db->error=DB_ERROR_INDEX_OUT_OF_RANGE; | 226 | db->error=DB_ERROR_INDEX_OUT_OF_RANGE; |
| 226 | return(0); | 227 | return(0); |
| 227 | } | 228 | } |
| 228 | if ((idx=lh_new(hash,cmp)) == NULL) | 229 | /* FIXME: we lose type checking at this point */ |
| 230 | if ((idx=(LHASH_OF(OPENSSL_STRING) *)lh_new(hash,cmp)) == NULL) | ||
| 229 | { | 231 | { |
| 230 | db->error=DB_ERROR_MALLOC; | 232 | db->error=DB_ERROR_MALLOC; |
| 231 | return(0); | 233 | return(0); |
| 232 | } | 234 | } |
| 233 | n=sk_num(db->data); | 235 | n=sk_OPENSSL_PSTRING_num(db->data); |
| 234 | for (i=0; i<n; i++) | 236 | for (i=0; i<n; i++) |
| 235 | { | 237 | { |
| 236 | r=(char **)sk_value(db->data,i); | 238 | r=sk_OPENSSL_PSTRING_value(db->data,i); |
| 237 | if ((qual != NULL) && (qual(r) == 0)) continue; | 239 | if ((qual != NULL) && (qual(r) == 0)) continue; |
| 238 | if ((r=lh_insert(idx,r)) != NULL) | 240 | if ((r=lh_OPENSSL_STRING_insert(idx,r)) != NULL) |
| 239 | { | 241 | { |
| 240 | db->error=DB_ERROR_INDEX_CLASH; | 242 | db->error=DB_ERROR_INDEX_CLASH; |
| 241 | db->arg1=sk_find(db->data,(char *)r); | 243 | db->arg1=sk_OPENSSL_PSTRING_find(db->data,r); |
| 242 | db->arg2=i; | 244 | db->arg2=i; |
| 243 | lh_free(idx); | 245 | lh_OPENSSL_STRING_free(idx); |
| 244 | return(0); | 246 | return(0); |
| 245 | } | 247 | } |
| 246 | } | 248 | } |
| 247 | if (db->index[field] != NULL) lh_free(db->index[field]); | 249 | if (db->index[field] != NULL) lh_OPENSSL_STRING_free(db->index[field]); |
| 248 | db->index[field]=idx; | 250 | db->index[field]=idx; |
| 249 | db->qual[field]=qual; | 251 | db->qual[field]=qual; |
| 250 | return(1); | 252 | return(1); |
| @@ -259,11 +261,11 @@ long TXT_DB_write(BIO *out, TXT_DB *db) | |||
| 259 | 261 | ||
| 260 | if ((buf=BUF_MEM_new()) == NULL) | 262 | if ((buf=BUF_MEM_new()) == NULL) |
| 261 | goto err; | 263 | goto err; |
| 262 | n=sk_num(db->data); | 264 | n=sk_OPENSSL_PSTRING_num(db->data); |
| 263 | nn=db->num_fields; | 265 | nn=db->num_fields; |
| 264 | for (i=0; i<n; i++) | 266 | for (i=0; i<n; i++) |
| 265 | { | 267 | { |
| 266 | pp=(char **)sk_value(db->data,i); | 268 | pp=sk_OPENSSL_PSTRING_value(db->data,i); |
| 267 | 269 | ||
| 268 | l=0; | 270 | l=0; |
| 269 | for (j=0; j<nn; j++) | 271 | for (j=0; j<nn; j++) |
| @@ -298,10 +300,10 @@ err: | |||
| 298 | return(ret); | 300 | return(ret); |
| 299 | } | 301 | } |
| 300 | 302 | ||
| 301 | int TXT_DB_insert(TXT_DB *db, char **row) | 303 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row) |
| 302 | { | 304 | { |
| 303 | int i; | 305 | int i; |
| 304 | char **r; | 306 | OPENSSL_STRING *r; |
| 305 | 307 | ||
| 306 | for (i=0; i<db->num_fields; i++) | 308 | for (i=0; i<db->num_fields; i++) |
| 307 | { | 309 | { |
| @@ -309,7 +311,7 @@ int TXT_DB_insert(TXT_DB *db, char **row) | |||
| 309 | { | 311 | { |
| 310 | if ((db->qual[i] != NULL) && | 312 | if ((db->qual[i] != NULL) && |
| 311 | (db->qual[i](row) == 0)) continue; | 313 | (db->qual[i](row) == 0)) continue; |
| 312 | r=(char **)lh_retrieve(db->index[i],row); | 314 | r=lh_OPENSSL_STRING_retrieve(db->index[i],row); |
| 313 | if (r != NULL) | 315 | if (r != NULL) |
| 314 | { | 316 | { |
| 315 | db->error=DB_ERROR_INDEX_CLASH; | 317 | db->error=DB_ERROR_INDEX_CLASH; |
| @@ -320,7 +322,7 @@ int TXT_DB_insert(TXT_DB *db, char **row) | |||
| 320 | } | 322 | } |
| 321 | } | 323 | } |
| 322 | /* We have passed the index checks, now just append and insert */ | 324 | /* We have passed the index checks, now just append and insert */ |
| 323 | if (!sk_push(db->data,(char *)row)) | 325 | if (!sk_OPENSSL_PSTRING_push(db->data,row)) |
| 324 | { | 326 | { |
| 325 | db->error=DB_ERROR_MALLOC; | 327 | db->error=DB_ERROR_MALLOC; |
| 326 | goto err; | 328 | goto err; |
| @@ -332,7 +334,7 @@ int TXT_DB_insert(TXT_DB *db, char **row) | |||
| 332 | { | 334 | { |
| 333 | if ((db->qual[i] != NULL) && | 335 | if ((db->qual[i] != NULL) && |
| 334 | (db->qual[i](row) == 0)) continue; | 336 | (db->qual[i](row) == 0)) continue; |
| 335 | lh_insert(db->index[i],row); | 337 | (void)lh_OPENSSL_STRING_insert(db->index[i],row); |
| 336 | } | 338 | } |
| 337 | } | 339 | } |
| 338 | return(1); | 340 | return(1); |
| @@ -351,18 +353,18 @@ void TXT_DB_free(TXT_DB *db) | |||
| 351 | if (db->index != NULL) | 353 | if (db->index != NULL) |
| 352 | { | 354 | { |
| 353 | for (i=db->num_fields-1; i>=0; i--) | 355 | for (i=db->num_fields-1; i>=0; i--) |
| 354 | if (db->index[i] != NULL) lh_free(db->index[i]); | 356 | if (db->index[i] != NULL) lh_OPENSSL_STRING_free(db->index[i]); |
| 355 | OPENSSL_free(db->index); | 357 | OPENSSL_free(db->index); |
| 356 | } | 358 | } |
| 357 | if (db->qual != NULL) | 359 | if (db->qual != NULL) |
| 358 | OPENSSL_free(db->qual); | 360 | OPENSSL_free(db->qual); |
| 359 | if (db->data != NULL) | 361 | if (db->data != NULL) |
| 360 | { | 362 | { |
| 361 | for (i=sk_num(db->data)-1; i>=0; i--) | 363 | for (i=sk_OPENSSL_PSTRING_num(db->data)-1; i>=0; i--) |
| 362 | { | 364 | { |
| 363 | /* check if any 'fields' have been allocated | 365 | /* check if any 'fields' have been allocated |
| 364 | * from outside of the initial block */ | 366 | * from outside of the initial block */ |
| 365 | p=(char **)sk_value(db->data,i); | 367 | p=sk_OPENSSL_PSTRING_value(db->data,i); |
| 366 | max=p[db->num_fields]; /* last address */ | 368 | max=p[db->num_fields]; /* last address */ |
| 367 | if (max == NULL) /* new row */ | 369 | if (max == NULL) /* new row */ |
| 368 | { | 370 | { |
| @@ -378,9 +380,9 @@ void TXT_DB_free(TXT_DB *db) | |||
| 378 | OPENSSL_free(p[n]); | 380 | OPENSSL_free(p[n]); |
| 379 | } | 381 | } |
| 380 | } | 382 | } |
| 381 | OPENSSL_free(sk_value(db->data,i)); | 383 | OPENSSL_free(sk_OPENSSL_PSTRING_value(db->data,i)); |
| 382 | } | 384 | } |
| 383 | sk_free(db->data); | 385 | sk_OPENSSL_PSTRING_free(db->data); |
| 384 | } | 386 | } |
| 385 | OPENSSL_free(db); | 387 | OPENSSL_free(db); |
| 386 | } | 388 | } |
diff --git a/src/lib/libcrypto/txt_db/txt_db.h b/src/lib/libcrypto/txt_db/txt_db.h index 307e1ba23f..6abe435bc8 100644 --- a/src/lib/libcrypto/txt_db/txt_db.h +++ b/src/lib/libcrypto/txt_db/txt_db.h | |||
| @@ -77,16 +77,19 @@ | |||
| 77 | extern "C" { | 77 | extern "C" { |
| 78 | #endif | 78 | #endif |
| 79 | 79 | ||
| 80 | typedef OPENSSL_STRING *OPENSSL_PSTRING; | ||
| 81 | DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) | ||
| 82 | |||
| 80 | typedef struct txt_db_st | 83 | typedef struct txt_db_st |
| 81 | { | 84 | { |
| 82 | int num_fields; | 85 | int num_fields; |
| 83 | STACK /* char ** */ *data; | 86 | STACK_OF(OPENSSL_PSTRING) *data; |
| 84 | LHASH **index; | 87 | LHASH_OF(OPENSSL_STRING) **index; |
| 85 | int (**qual)(char **); | 88 | int (**qual)(OPENSSL_STRING *); |
| 86 | long error; | 89 | long error; |
| 87 | long arg1; | 90 | long arg1; |
| 88 | long arg2; | 91 | long arg2; |
| 89 | char **arg_row; | 92 | OPENSSL_STRING *arg_row; |
| 90 | } TXT_DB; | 93 | } TXT_DB; |
| 91 | 94 | ||
| 92 | #ifndef OPENSSL_NO_BIO | 95 | #ifndef OPENSSL_NO_BIO |
| @@ -96,11 +99,11 @@ long TXT_DB_write(BIO *out, TXT_DB *db); | |||
| 96 | TXT_DB *TXT_DB_read(char *in, int num); | 99 | TXT_DB *TXT_DB_read(char *in, int num); |
| 97 | long TXT_DB_write(char *out, TXT_DB *db); | 100 | long TXT_DB_write(char *out, TXT_DB *db); |
| 98 | #endif | 101 | #endif |
| 99 | int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(char **), | 102 | int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(OPENSSL_STRING *), |
| 100 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); | 103 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); |
| 101 | void TXT_DB_free(TXT_DB *db); | 104 | void TXT_DB_free(TXT_DB *db); |
| 102 | char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value); | 105 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value); |
| 103 | int TXT_DB_insert(TXT_DB *db,char **value); | 106 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); |
| 104 | 107 | ||
| 105 | #ifdef __cplusplus | 108 | #ifdef __cplusplus |
| 106 | } | 109 | } |
diff --git a/src/lib/libcrypto/ui/Makefile.ssl b/src/lib/libcrypto/ui/Makefile.ssl deleted file mode 100644 index ba46951d1c..0000000000 --- a/src/lib/libcrypto/ui/Makefile.ssl +++ /dev/null | |||
| @@ -1,117 +0,0 @@ | |||
| 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 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | #TEST= uitest.c | ||
| 23 | TEST= | ||
| 24 | APPS= | ||
| 25 | |||
| 26 | COMPATSRC= ui_compat.c | ||
| 27 | COMPATOBJ= ui_compat.o | ||
| 28 | |||
| 29 | LIB=$(TOP)/libcrypto.a | ||
| 30 | LIBSRC= ui_err.c ui_lib.c ui_openssl.c ui_util.c $(COMPATSRC) | ||
| 31 | LIBOBJ= ui_err.o ui_lib.o ui_openssl.o ui_util.o $(COMPATOBJ) | ||
| 32 | |||
| 33 | SRC= $(LIBSRC) | ||
| 34 | |||
| 35 | EXHEADER= ui.h ui_compat.h | ||
| 36 | HEADER= $(EXHEADER) ui_locl.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.ssl >> $(TOP)/MINFO | ||
| 52 | |||
| 53 | links: | ||
| 54 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 55 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 56 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 57 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 58 | |||
| 59 | install: | ||
| 60 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 76 | |||
| 77 | dclean: | ||
| 78 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 79 | mv -f Makefile.new $(MAKEFILE) | ||
| 80 | |||
| 81 | clean: | ||
| 82 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 83 | |||
| 84 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 85 | |||
| 86 | ui_compat.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 87 | ui_compat.o: ../../include/openssl/opensslconf.h | ||
| 88 | ui_compat.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 89 | ui_compat.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 90 | ui_compat.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 91 | ui_compat.o: ui_compat.c | ||
| 92 | ui_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 93 | ui_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 94 | ui_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 95 | ui_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 96 | ui_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 97 | ui_err.o: ../../include/openssl/ui.h ui_err.c | ||
| 98 | ui_lib.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 99 | ui_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 100 | ui_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 101 | ui_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 102 | ui_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 103 | ui_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 104 | ui_lib.o: ../../include/openssl/ui.h ../cryptlib.h ui_lib.c ui_locl.h | ||
| 105 | ui_openssl.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 106 | ui_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 107 | ui_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 108 | ui_openssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 109 | ui_openssl.o: ../../include/openssl/opensslv.h | ||
| 110 | ui_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 111 | ui_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 112 | ui_openssl.o: ../cryptlib.h ui_locl.h ui_openssl.c | ||
| 113 | ui_util.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 114 | ui_util.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 115 | ui_util.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 116 | ui_util.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 117 | ui_util.o: ui_util.c | ||
diff --git a/src/lib/libcrypto/ui/ui.h b/src/lib/libcrypto/ui/ui.h index 018296412b..2b1cfa2289 100644 --- a/src/lib/libcrypto/ui/ui.h +++ b/src/lib/libcrypto/ui/ui.h | |||
| @@ -287,8 +287,8 @@ UI_METHOD *UI_OpenSSL(void); | |||
| 287 | /* The UI_STRING type is the data structure that contains all the needed info | 287 | /* The UI_STRING type is the data structure that contains all the needed info |
| 288 | about a string or a prompt, including test data for a verification prompt. | 288 | about a string or a prompt, including test data for a verification prompt. |
| 289 | */ | 289 | */ |
| 290 | DECLARE_STACK_OF(UI_STRING) | ||
| 291 | typedef struct ui_string_st UI_STRING; | 290 | typedef struct ui_string_st UI_STRING; |
| 291 | DECLARE_STACK_OF(UI_STRING) | ||
| 292 | 292 | ||
| 293 | /* The different types of strings that are currently supported. | 293 | /* The different types of strings that are currently supported. |
| 294 | This is only needed by method authors. */ | 294 | This is only needed by method authors. */ |
| @@ -310,11 +310,13 @@ int UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis | |||
| 310 | int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui)); | 310 | int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui)); |
| 311 | int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis)); | 311 | int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis)); |
| 312 | int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)); | 312 | int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)); |
| 313 | int UI_method_set_prompt_constructor(UI_METHOD *method, char *(*prompt_constructor)(UI* ui, const char* object_desc, const char* object_name)); | ||
| 313 | int (*UI_method_get_opener(UI_METHOD *method))(UI*); | 314 | int (*UI_method_get_opener(UI_METHOD *method))(UI*); |
| 314 | int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*); | 315 | int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*); |
| 315 | int (*UI_method_get_flusher(UI_METHOD *method))(UI*); | 316 | int (*UI_method_get_flusher(UI_METHOD *method))(UI*); |
| 316 | int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*); | 317 | int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*); |
| 317 | int (*UI_method_get_closer(UI_METHOD *method))(UI*); | 318 | int (*UI_method_get_closer(UI_METHOD *method))(UI*); |
| 319 | char* (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const char*, const char*); | ||
| 318 | 320 | ||
| 319 | /* The following functions are helpers for method writers to access relevant | 321 | /* The following functions are helpers for method writers to access relevant |
| 320 | data from a UI_STRING. */ | 322 | data from a UI_STRING. */ |
diff --git a/src/lib/libcrypto/ui/ui_err.c b/src/lib/libcrypto/ui/ui_err.c index 786bd0dbc3..a6b96299a0 100644 --- a/src/lib/libcrypto/ui/ui_err.c +++ b/src/lib/libcrypto/ui/ui_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/ui/ui_err.c */ | 1 | /* crypto/ui/ui_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c index ac0100808f..a8abc27064 100644 --- a/src/lib/libcrypto/ui/ui_lib.c +++ b/src/lib/libcrypto/ui/ui_lib.c | |||
| @@ -693,6 +693,17 @@ int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)) | |||
| 693 | return -1; | 693 | return -1; |
| 694 | } | 694 | } |
| 695 | 695 | ||
| 696 | int UI_method_set_prompt_constructor(UI_METHOD *method, char *(*prompt_constructor)(UI* ui, const char* object_desc, const char* object_name)) | ||
| 697 | { | ||
| 698 | if (method) | ||
| 699 | { | ||
| 700 | method->ui_construct_prompt = prompt_constructor; | ||
| 701 | return 0; | ||
| 702 | } | ||
| 703 | else | ||
| 704 | return -1; | ||
| 705 | } | ||
| 706 | |||
| 696 | int (*UI_method_get_opener(UI_METHOD *method))(UI*) | 707 | int (*UI_method_get_opener(UI_METHOD *method))(UI*) |
| 697 | { | 708 | { |
| 698 | if (method) | 709 | if (method) |
| @@ -733,6 +744,14 @@ int (*UI_method_get_closer(UI_METHOD *method))(UI*) | |||
| 733 | return NULL; | 744 | return NULL; |
| 734 | } | 745 | } |
| 735 | 746 | ||
| 747 | char* (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const char*, const char*) | ||
| 748 | { | ||
| 749 | if (method) | ||
| 750 | return method->ui_construct_prompt; | ||
| 751 | else | ||
| 752 | return NULL; | ||
| 753 | } | ||
| 754 | |||
| 736 | enum UI_string_types UI_get_string_type(UI_STRING *uis) | 755 | enum UI_string_types UI_get_string_type(UI_STRING *uis) |
| 737 | { | 756 | { |
| 738 | if (!uis) | 757 | if (!uis) |
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c index 5fbedf6ff8..1e3dba0833 100644 --- a/src/lib/libcrypto/ui/ui_openssl.c +++ b/src/lib/libcrypto/ui/ui_openssl.c | |||
| @@ -122,7 +122,9 @@ | |||
| 122 | * sigaction and fileno included. -pedantic would be more appropriate for | 122 | * sigaction and fileno included. -pedantic would be more appropriate for |
| 123 | * the intended purposes, but we can't prevent users from adding -ansi. | 123 | * the intended purposes, but we can't prevent users from adding -ansi. |
| 124 | */ | 124 | */ |
| 125 | #define _POSIX_C_SOURCE 1 | 125 | #ifndef _POSIX_C_SOURCE |
| 126 | #define _POSIX_C_SOURCE 2 | ||
| 127 | #endif | ||
| 126 | #include <signal.h> | 128 | #include <signal.h> |
| 127 | #include <stdio.h> | 129 | #include <stdio.h> |
| 128 | #include <string.h> | 130 | #include <string.h> |
| @@ -297,7 +299,7 @@ static int is_a_tty; | |||
| 297 | 299 | ||
| 298 | /* Declare static functions */ | 300 | /* Declare static functions */ |
| 299 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) | 301 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) |
| 300 | static void read_till_nl(FILE *); | 302 | static int read_till_nl(FILE *); |
| 301 | static void recsig(int); | 303 | static void recsig(int); |
| 302 | static void pushsig(void); | 304 | static void pushsig(void); |
| 303 | static void popsig(void); | 305 | static void popsig(void); |
| @@ -390,7 +392,7 @@ static int read_string(UI *ui, UI_STRING *uis) | |||
| 390 | 392 | ||
| 391 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) | 393 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) |
| 392 | /* Internal functions to read a string without echoing */ | 394 | /* Internal functions to read a string without echoing */ |
| 393 | static void read_till_nl(FILE *in) | 395 | static int read_till_nl(FILE *in) |
| 394 | { | 396 | { |
| 395 | #define SIZE 4 | 397 | #define SIZE 4 |
| 396 | char buf[SIZE+1]; | 398 | char buf[SIZE+1]; |
| @@ -399,6 +401,7 @@ static void read_till_nl(FILE *in) | |||
| 399 | if (fgets(buf,sizeof(buf),in) == NULL) | 401 | if (fgets(buf,sizeof(buf),in) == NULL) |
| 400 | break; | 402 | break; |
| 401 | } while (strchr(buf,'\n') == NULL); | 403 | } while (strchr(buf,'\n') == NULL); |
| 404 | return 1; | ||
| 402 | } | 405 | } |
| 403 | 406 | ||
| 404 | static volatile sig_atomic_t intr_signal; | 407 | static volatile sig_atomic_t intr_signal; |
| @@ -446,7 +449,8 @@ static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl) | |||
| 446 | *p='\0'; | 449 | *p='\0'; |
| 447 | } | 450 | } |
| 448 | else | 451 | else |
| 449 | read_till_nl(tty_in); | 452 | if (!read_till_nl(tty_in)) |
| 453 | goto error; | ||
| 450 | if (UI_set_result(ui, uis, result) >= 0) | 454 | if (UI_set_result(ui, uis, result) >= 0) |
| 451 | ok=1; | 455 | ok=1; |
| 452 | 456 | ||
| @@ -474,7 +478,7 @@ static int open_console(UI *ui) | |||
| 474 | CRYPTO_w_lock(CRYPTO_LOCK_UI); | 478 | CRYPTO_w_lock(CRYPTO_LOCK_UI); |
| 475 | is_a_tty = 1; | 479 | is_a_tty = 1; |
| 476 | 480 | ||
| 477 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) | 481 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS) |
| 478 | tty_in=stdin; | 482 | tty_in=stdin; |
| 479 | tty_out=stderr; | 483 | tty_out=stderr; |
| 480 | #else | 484 | #else |
diff --git a/src/lib/libcrypto/util/arx.pl b/src/lib/libcrypto/util/arx.pl deleted file mode 100644 index ce62625c33..0000000000 --- a/src/lib/libcrypto/util/arx.pl +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | #!/bin/perl | ||
| 2 | |||
| 3 | # Simple perl script to wrap round "ar" program and exclude any | ||
| 4 | # object files in the environment variable EXCL_OBJ | ||
| 5 | |||
| 6 | map { s/^.*\/([^\/]*)$/$1/ ; $EXCL{$_} = 1} split(' ', $ENV{EXCL_OBJ}); | ||
| 7 | |||
| 8 | #my @ks = keys %EXCL; | ||
| 9 | #print STDERR "Excluding: @ks \n"; | ||
| 10 | |||
| 11 | my @ARGS = grep { !exists $EXCL{$_} } @ARGV; | ||
| 12 | |||
| 13 | system @ARGS; | ||
| 14 | |||
| 15 | exit $? >> 8; | ||
diff --git a/src/lib/libcrypto/util/checkhash.pl b/src/lib/libcrypto/util/checkhash.pl deleted file mode 100644 index c61fa72178..0000000000 --- a/src/lib/libcrypto/util/checkhash.pl +++ /dev/null | |||
| @@ -1,222 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl -w | ||
| 2 | |||
| 3 | my $package = caller; | ||
| 4 | |||
| 5 | if (!(defined $package)) | ||
| 6 | { | ||
| 7 | my $retval = check_hashes(@ARGV); | ||
| 8 | exit $retval; | ||
| 9 | } | ||
| 10 | |||
| 11 | 1; | ||
| 12 | |||
| 13 | sub check_hashes | ||
| 14 | { | ||
| 15 | |||
| 16 | my @args = @_; | ||
| 17 | |||
| 18 | my $change_dir = ""; | ||
| 19 | my $check_program = "sha/fips_standalone_sha1"; | ||
| 20 | |||
| 21 | my $verbose = 0; | ||
| 22 | my $badfiles = 0; | ||
| 23 | my $rebuild = 0; | ||
| 24 | my $force_rewrite = 0; | ||
| 25 | my $hash_file = "fipshashes.c"; | ||
| 26 | my $recurse = 0; | ||
| 27 | |||
| 28 | my @fingerprint_files; | ||
| 29 | |||
| 30 | while (@args) | ||
| 31 | { | ||
| 32 | my $arg = $args[0]; | ||
| 33 | if ($arg eq "-chdir") | ||
| 34 | { | ||
| 35 | shift @args; | ||
| 36 | $change_dir = shift @args; | ||
| 37 | } | ||
| 38 | elsif ($arg eq "-rebuild") | ||
| 39 | { | ||
| 40 | shift @args; | ||
| 41 | $rebuild = 1; | ||
| 42 | } | ||
| 43 | elsif ($arg eq "-verbose") | ||
| 44 | { | ||
| 45 | shift @args; | ||
| 46 | $verbose = 1; | ||
| 47 | } | ||
| 48 | elsif ($arg eq "-force-rewrite") | ||
| 49 | { | ||
| 50 | shift @args; | ||
| 51 | $force_rewrite = 1; | ||
| 52 | } | ||
| 53 | elsif ($arg eq "-hash_file") | ||
| 54 | { | ||
| 55 | shift @args; | ||
| 56 | $hash_file = shift @args; | ||
| 57 | } | ||
| 58 | elsif ($arg eq "-recurse") | ||
| 59 | { | ||
| 60 | shift @args; | ||
| 61 | $recurse = 1; | ||
| 62 | } | ||
| 63 | elsif ($arg eq "-program_path") | ||
| 64 | { | ||
| 65 | shift @args; | ||
| 66 | $check_program = shift @args; | ||
| 67 | } | ||
| 68 | else | ||
| 69 | { | ||
| 70 | print STDERR "Unknown Option $arg"; | ||
| 71 | return 1; | ||
| 72 | } | ||
| 73 | |||
| 74 | } | ||
| 75 | |||
| 76 | chdir $change_dir if $change_dir ne ""; | ||
| 77 | |||
| 78 | if ($recurse) | ||
| 79 | { | ||
| 80 | @fingerprint_files = ("fingerprint.sha1", | ||
| 81 | <*/fingerprint.sha1>); | ||
| 82 | } | ||
| 83 | else | ||
| 84 | { | ||
| 85 | push @fingerprint_files, $hash_file; | ||
| 86 | } | ||
| 87 | |||
| 88 | foreach $fp (@fingerprint_files) | ||
| 89 | { | ||
| 90 | if (!open(IN, "$fp")) | ||
| 91 | { | ||
| 92 | print STDERR "Can't open file $fp"; | ||
| 93 | return 1; | ||
| 94 | } | ||
| 95 | print STDERR "Opening Fingerprint file $fp\n" if $verbose; | ||
| 96 | my $dir = $fp; | ||
| 97 | $dir =~ s/[^\/]*$//; | ||
| 98 | while (<IN>) | ||
| 99 | { | ||
| 100 | chomp; | ||
| 101 | if (!(($file, $hash) = /^\"HMAC-SHA1\((.*)\)\s*=\s*(\w*)\",$/)) | ||
| 102 | { | ||
| 103 | /^\"/ || next; | ||
| 104 | print STDERR "FATAL: Invalid syntax in file $fp\n"; | ||
| 105 | print STDERR "Line:\n$_\n"; | ||
| 106 | fatal_error(); | ||
| 107 | return 1; | ||
| 108 | } | ||
| 109 | if (!$rebuild && length($hash) != 40) | ||
| 110 | { | ||
| 111 | print STDERR "FATAL: Invalid hash length in $fp for file $file\n"; | ||
| 112 | fatal_error(); | ||
| 113 | return 1; | ||
| 114 | } | ||
| 115 | push @hashed_files, "$dir$file"; | ||
| 116 | if (exists $hashes{"$dir$file"}) | ||
| 117 | { | ||
| 118 | print STDERR "FATAL: Duplicate Hash file $dir$file\n"; | ||
| 119 | fatal_error(); | ||
| 120 | return 1; | ||
| 121 | } | ||
| 122 | if (! -r "$dir$file") | ||
| 123 | { | ||
| 124 | print STDERR "FATAL: Can't access $dir$file\n"; | ||
| 125 | fatal_error(); | ||
| 126 | return 1; | ||
| 127 | } | ||
| 128 | $hashes{"$dir$file"} = $hash; | ||
| 129 | } | ||
| 130 | close IN; | ||
| 131 | } | ||
| 132 | |||
| 133 | @checked_hashes = `$check_program @hashed_files`; | ||
| 134 | |||
| 135 | if ($? != 0) | ||
| 136 | { | ||
| 137 | print STDERR "Error running hash program $check_program\n"; | ||
| 138 | fatal_error(); | ||
| 139 | return 1; | ||
| 140 | } | ||
| 141 | |||
| 142 | if (@checked_hashes != @hashed_files) | ||
| 143 | { | ||
| 144 | print STDERR "FATAL: hash count incorrect\n"; | ||
| 145 | fatal_error(); | ||
| 146 | return 1; | ||
| 147 | } | ||
| 148 | |||
| 149 | foreach (@checked_hashes) | ||
| 150 | { | ||
| 151 | chomp; | ||
| 152 | if (!(($file, $hash) = /^HMAC-SHA1\((.*)\)\s*=\s*(\w*)$/)) | ||
| 153 | { | ||
| 154 | print STDERR "FATAL: Invalid syntax in file $fp\n"; | ||
| 155 | print STDERR "Line:\n$_\n"; | ||
| 156 | fatal_error(); | ||
| 157 | return 1; | ||
| 158 | } | ||
| 159 | if (length($hash) != 40) | ||
| 160 | { | ||
| 161 | print STDERR "FATAL: Invalid hash length for file $file\n"; | ||
| 162 | fatal_error(); | ||
| 163 | return 1; | ||
| 164 | } | ||
| 165 | if ($hash ne $hashes{$file}) | ||
| 166 | { | ||
| 167 | if ($rebuild) | ||
| 168 | { | ||
| 169 | print STDERR "Updating hash on file $file\n"; | ||
| 170 | $hashes{$file} = $hash; | ||
| 171 | } | ||
| 172 | else | ||
| 173 | { | ||
| 174 | print STDERR "Hash check failed for file $file\n"; | ||
| 175 | } | ||
| 176 | $badfiles++; | ||
| 177 | } | ||
| 178 | elsif ($verbose) | ||
| 179 | { print "Hash Check OK for $file\n";} | ||
| 180 | } | ||
| 181 | |||
| 182 | |||
| 183 | if ($badfiles && !$rebuild) | ||
| 184 | { | ||
| 185 | print STDERR "FATAL: hash mismatch on $badfiles files\n"; | ||
| 186 | fatal_error(); | ||
| 187 | return 1; | ||
| 188 | } | ||
| 189 | |||
| 190 | if ($badfiles || $force_rewrite) | ||
| 191 | { | ||
| 192 | print "Updating Hash file $hash_file\n"; | ||
| 193 | if (!open(OUT, ">$hash_file")) | ||
| 194 | { | ||
| 195 | print STDERR "Error rewriting $hash_file"; | ||
| 196 | return 1; | ||
| 197 | } | ||
| 198 | print OUT "const char * const FIPS_source_hashes[] = {\n"; | ||
| 199 | foreach (@hashed_files) | ||
| 200 | { | ||
| 201 | print OUT "\"HMAC-SHA1($_)= $hashes{$_}\",\n"; | ||
| 202 | } | ||
| 203 | print OUT "};\n"; | ||
| 204 | close OUT; | ||
| 205 | } | ||
| 206 | |||
| 207 | if (!$badfiles) | ||
| 208 | { | ||
| 209 | print "FIPS hash check successful\n"; | ||
| 210 | } | ||
| 211 | |||
| 212 | return 0; | ||
| 213 | |||
| 214 | } | ||
| 215 | |||
| 216 | |||
| 217 | sub fatal_error | ||
| 218 | { | ||
| 219 | print STDERR "*** Your source code does not match the FIPS validated source ***\n"; | ||
| 220 | } | ||
| 221 | |||
| 222 | |||
diff --git a/src/lib/libcrypto/util/ck_errf.pl b/src/lib/libcrypto/util/ck_errf.pl index 344b422c34..f13af5c50b 100644 --- a/src/lib/libcrypto/util/ck_errf.pl +++ b/src/lib/libcrypto/util/ck_errf.pl | |||
| @@ -7,8 +7,16 @@ | |||
| 7 | # perl util/ck_errf.pl */*.c */*/*.c | 7 | # perl util/ck_errf.pl */*.c */*/*.c |
| 8 | # | 8 | # |
| 9 | 9 | ||
| 10 | my $err_strict = 0; | ||
| 11 | my $bad = 0; | ||
| 12 | |||
| 10 | foreach $file (@ARGV) | 13 | foreach $file (@ARGV) |
| 11 | { | 14 | { |
| 15 | if ($file eq "-strict") | ||
| 16 | { | ||
| 17 | $err_strict = 1; | ||
| 18 | next; | ||
| 19 | } | ||
| 12 | open(IN,"<$file") || die "unable to open $file\n"; | 20 | open(IN,"<$file") || die "unable to open $file\n"; |
| 13 | $func=""; | 21 | $func=""; |
| 14 | while (<IN>) | 22 | while (<IN>) |
| @@ -20,13 +28,13 @@ foreach $file (@ARGV) | |||
| 20 | $func = $1; | 28 | $func = $1; |
| 21 | $func =~ tr/A-Z/a-z/; | 29 | $func =~ tr/A-Z/a-z/; |
| 22 | } | 30 | } |
| 23 | if (/([A-Z0-9]+)err\(([^,]+)/) | 31 | if (/([A-Z0-9]+)err\(([^,]+)/ && ! /ckerr_ignore/) |
| 24 | { | 32 | { |
| 25 | $errlib=$1; | 33 | $errlib=$1; |
| 26 | $n=$2; | 34 | $n=$2; |
| 27 | 35 | ||
| 28 | if ($func eq "") | 36 | if ($func eq "") |
| 29 | { print "$file:$.:???:$n\n"; next; } | 37 | { print "$file:$.:???:$n\n"; $bad = 1; next; } |
| 30 | 38 | ||
| 31 | if ($n !~ /([^_]+)_F_(.+)$/) | 39 | if ($n !~ /([^_]+)_F_(.+)$/) |
| 32 | { | 40 | { |
| @@ -37,14 +45,20 @@ foreach $file (@ARGV) | |||
| 37 | $n=$2; | 45 | $n=$2; |
| 38 | 46 | ||
| 39 | if ($lib ne $errlib) | 47 | if ($lib ne $errlib) |
| 40 | { print "$file:$.:$func:$n [${errlib}err]\n"; next; } | 48 | { print "$file:$.:$func:$n [${errlib}err]\n"; $bad = 1; next; } |
| 41 | 49 | ||
| 42 | $n =~ tr/A-Z/a-z/; | 50 | $n =~ tr/A-Z/a-z/; |
| 43 | if (($n ne $func) && ($errlib ne "SYS")) | 51 | if (($n ne $func) && ($errlib ne "SYS")) |
| 44 | { print "$file:$.:$func:$n\n"; next; } | 52 | { print "$file:$.:$func:$n\n"; $bad = 1; next; } |
| 45 | # print "$func:$1\n"; | 53 | # print "$func:$1\n"; |
| 46 | } | 54 | } |
| 47 | } | 55 | } |
| 48 | close(IN); | 56 | close(IN); |
| 49 | } | 57 | } |
| 50 | 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 index 2b2bdb4048..d3525b0ed0 100644 --- a/src/lib/libcrypto/util/clean-depend.pl +++ b/src/lib/libcrypto/util/clean-depend.pl | |||
| @@ -42,6 +42,7 @@ foreach $file (sort keys %files) { | |||
| 42 | my @deps = map { $_ =~ s/^\.\///; $_ } @{$files{$file}}; | 42 | my @deps = map { $_ =~ s/^\.\///; $_ } @{$files{$file}}; |
| 43 | 43 | ||
| 44 | foreach $dep (sort @deps) { | 44 | foreach $dep (sort @deps) { |
| 45 | $dep=~s/^\.\///; | ||
| 45 | next if $prevdep eq $dep; # to exterminate duplicates... | 46 | next if $prevdep eq $dep; # to exterminate duplicates... |
| 46 | $prevdep = $dep; | 47 | $prevdep = $dep; |
| 47 | $len=0 if $len+length($dep)+1 >= 80; | 48 | $len=0 if $len+length($dep)+1 >= 80; |
diff --git a/src/lib/libcrypto/util/copy.pl b/src/lib/libcrypto/util/copy.pl index e20b45530a..eba6d5815e 100644 --- a/src/lib/libcrypto/util/copy.pl +++ b/src/lib/libcrypto/util/copy.pl | |||
| @@ -8,9 +8,16 @@ use Fcntl; | |||
| 8 | # Perl script 'copy' comment. On Windows the built in "copy" command also | 8 | # Perl script 'copy' comment. On Windows the built in "copy" command also |
| 9 | # copies timestamps: this messes up Makefile dependencies. | 9 | # copies timestamps: this messes up Makefile dependencies. |
| 10 | 10 | ||
| 11 | my $stripcr = 0; | ||
| 12 | |||
| 11 | my $arg; | 13 | my $arg; |
| 12 | 14 | ||
| 13 | foreach $arg (@ARGV) { | 15 | foreach $arg (@ARGV) { |
| 16 | if ($arg eq "-stripcr") | ||
| 17 | { | ||
| 18 | $stripcr = 1; | ||
| 19 | next; | ||
| 20 | } | ||
| 14 | $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... | 21 | $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... |
| 15 | foreach (glob $arg) | 22 | foreach (glob $arg) |
| 16 | { | 23 | { |
| @@ -49,6 +56,10 @@ foreach (@filelist) | |||
| 49 | || die "Can't Open $dfile"; | 56 | || die "Can't Open $dfile"; |
| 50 | while (sysread IN, $buf, 10240) | 57 | while (sysread IN, $buf, 10240) |
| 51 | { | 58 | { |
| 59 | if ($stripcr) | ||
| 60 | { | ||
| 61 | $buf =~ tr/\015//d; | ||
| 62 | } | ||
| 52 | syswrite(OUT, $buf, length($buf)); | 63 | syswrite(OUT, $buf, length($buf)); |
| 53 | } | 64 | } |
| 54 | close(IN); | 65 | close(IN); |
diff --git a/src/lib/libcrypto/util/cygwin.sh b/src/lib/libcrypto/util/cygwin.sh index 89d1dda95b..a4f2e740b4 100644 --- a/src/lib/libcrypto/util/cygwin.sh +++ b/src/lib/libcrypto/util/cygwin.sh | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | # Uncomment when debugging | 7 | # Uncomment when debugging |
| 8 | #set -x | 8 | #set -x |
| 9 | 9 | ||
| 10 | CONFIG_OPTIONS="--prefix=/usr shared no-idea no-rc5 no-mdc2" | 10 | CONFIG_OPTIONS="--prefix=/usr shared zlib no-idea no-rc5" |
| 11 | INSTALL_PREFIX=/tmp/install | 11 | INSTALL_PREFIX=/tmp/install |
| 12 | 12 | ||
| 13 | VERSION= | 13 | VERSION= |
| @@ -66,7 +66,7 @@ function create_cygwin_readme() | |||
| 66 | 66 | ||
| 67 | ./config ${CONFIG_OPTIONS} | 67 | ./config ${CONFIG_OPTIONS} |
| 68 | 68 | ||
| 69 | The IDEA, RC5 and MDC2 algorithms are disabled due to patent and/or | 69 | The IDEA and RC5 algorithms are disabled due to patent and/or |
| 70 | licensing issues. | 70 | licensing issues. |
| 71 | EOF | 71 | EOF |
| 72 | } | 72 | } |
diff --git a/src/lib/libcrypto/util/domd b/src/lib/libcrypto/util/domd index 560ebeaf82..bab48cb7a2 100644 --- a/src/lib/libcrypto/util/domd +++ b/src/lib/libcrypto/util/domd | |||
| @@ -14,7 +14,7 @@ if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi | |||
| 14 | cp Makefile Makefile.save | 14 | cp Makefile Makefile.save |
| 15 | # fake the presence of Kerberos | 15 | # fake the presence of Kerberos |
| 16 | touch $TOP/krb5.h | 16 | touch $TOP/krb5.h |
| 17 | if [ "$MAKEDEPEND" = "gcc" ]; then | 17 | if expr "$MAKEDEPEND" : '.*gcc$' > /dev/null; then |
| 18 | args="" | 18 | args="" |
| 19 | while [ $# -gt 0 ]; do | 19 | while [ $# -gt 0 ]; do |
| 20 | if [ "$1" != "--" ]; then args="$args $1"; fi | 20 | if [ "$1" != "--" ]; then args="$args $1"; fi |
| @@ -22,13 +22,17 @@ if [ "$MAKEDEPEND" = "gcc" ]; then | |||
| 22 | done | 22 | done |
| 23 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp | 23 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp |
| 24 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp | 24 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp |
| 25 | ${CC:-gcc} -D OPENSSL_DOING_MAKEDEPEND -M $args >> 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 | 26 | ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new |
| 27 | RC=$? | ||
| 27 | rm -f Makefile.tmp | 28 | rm -f Makefile.tmp |
| 28 | else | 29 | else |
| 29 | ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ | 30 | ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ && \ |
| 30 | ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new | 31 | ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new |
| 32 | RC=$? | ||
| 31 | fi | 33 | fi |
| 32 | mv Makefile.new Makefile | 34 | mv Makefile.new Makefile |
| 33 | # unfake the presence of Kerberos | 35 | # unfake the presence of Kerberos |
| 34 | rm $TOP/krb5.h | 36 | rm $TOP/krb5.h |
| 37 | |||
| 38 | exit $RC | ||
diff --git a/src/lib/libcrypto/util/fipslink.pl b/src/lib/libcrypto/util/fipslink.pl deleted file mode 100644 index 3597bc1740..0000000000 --- a/src/lib/libcrypto/util/fipslink.pl +++ /dev/null | |||
| @@ -1,78 +0,0 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | sub check_env | ||
| 4 | { | ||
| 5 | my @ret; | ||
| 6 | foreach (@_) | ||
| 7 | { | ||
| 8 | die "Environment variable $_ not defined!\n" unless exists $ENV{$_}; | ||
| 9 | push @ret, $ENV{$_}; | ||
| 10 | } | ||
| 11 | return @ret; | ||
| 12 | } | ||
| 13 | |||
| 14 | |||
| 15 | my ($fips_cc,$fips_cc_args, $fips_link,$fips_target, $fips_libdir, $sha1_exe) | ||
| 16 | = check_env("FIPS_CC", "FIPS_CC_ARGS", "FIPS_LINK", "FIPS_TARGET", | ||
| 17 | "FIPSLIB_D", "FIPS_SHA1_EXE"); | ||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | if (exists $ENV{"PREMAIN_DSO_EXE"}) | ||
| 22 | { | ||
| 23 | $fips_premain_dso = $ENV{"PREMAIN_DSO_EXE"}; | ||
| 24 | } | ||
| 25 | else | ||
| 26 | { | ||
| 27 | $fips_premain_dso = ""; | ||
| 28 | } | ||
| 29 | |||
| 30 | check_hash($sha1_exe, "fips_premain.c"); | ||
| 31 | check_hash($sha1_exe, "fipscanister.lib"); | ||
| 32 | |||
| 33 | |||
| 34 | print "Integrity check OK\n"; | ||
| 35 | |||
| 36 | print "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c\n"; | ||
| 37 | system "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c"; | ||
| 38 | die "First stage Compile failure" if $? != 0; | ||
| 39 | |||
| 40 | print "$fips_link @ARGV\n"; | ||
| 41 | system "$fips_link @ARGV"; | ||
| 42 | die "First stage Link failure" if $? != 0; | ||
| 43 | |||
| 44 | |||
| 45 | print "$fips_premain_dso $fips_target\n"; | ||
| 46 | $fips_hash=`$fips_premain_dso $fips_target`; | ||
| 47 | chomp $fips_hash; | ||
| 48 | die "Get hash failure" if $? != 0; | ||
| 49 | |||
| 50 | |||
| 51 | print "$fips_cc -DHMAC_SHA1_SIG=\\\"$fips_hash\\\" $fips_cc_args $fips_libdir/fips_premain.c\n"; | ||
| 52 | system "$fips_cc -DHMAC_SHA1_SIG=\\\"$fips_hash\\\" $fips_cc_args $fips_libdir/fips_premain.c"; | ||
| 53 | die "Second stage Compile failure" if $? != 0; | ||
| 54 | |||
| 55 | |||
| 56 | print "$fips_link @ARGV\n"; | ||
| 57 | system "$fips_link @ARGV"; | ||
| 58 | die "Second stage Link failure" if $? != 0; | ||
| 59 | |||
| 60 | sub check_hash | ||
| 61 | { | ||
| 62 | my ($sha1_exe, $filename) = @_; | ||
| 63 | my ($hashfile, $hashval); | ||
| 64 | |||
| 65 | open(IN, "${fips_libdir}/${filename}.sha1") || die "Cannot open file hash file ${fips_libdir}/${filename}.sha1"; | ||
| 66 | $hashfile = <IN>; | ||
| 67 | close IN; | ||
| 68 | $hashval = `$sha1_exe ${fips_libdir}/$filename`; | ||
| 69 | chomp $hashfile; | ||
| 70 | chomp $hashval; | ||
| 71 | $hashfile =~ s/^.*=\s+//; | ||
| 72 | $hashval =~ s/^.*=\s+//; | ||
| 73 | die "Invalid hash syntax in file" if (length($hashfile) != 40); | ||
| 74 | die "Invalid hash received for file" if (length($hashval) != 40); | ||
| 75 | die "***HASH VALUE MISMATCH FOR FILE $filename ***" if ($hashval ne $hashfile); | ||
| 76 | } | ||
| 77 | |||
| 78 | |||
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num index 0bad595233..c68047e955 100644 --- a/src/lib/libcrypto/util/libeay.num +++ b/src/lib/libcrypto/util/libeay.num | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | SSLeay 1 EXIST::FUNCTION: | 1 | SSLeay 1 EXIST::FUNCTION: |
| 2 | SSLeay_version 2 EXIST::FUNCTION: | 2 | SSLeay_version 2 EXIST::FUNCTION: |
| 3 | ASN1_BIT_STRING_asn1_meth 3 EXIST::FUNCTION: | 3 | ASN1_BIT_STRING_asn1_meth 3 NOEXIST::FUNCTION: |
| 4 | ASN1_HEADER_free 4 EXIST::FUNCTION: | 4 | ASN1_HEADER_free 4 NOEXIST::FUNCTION: |
| 5 | ASN1_HEADER_new 5 EXIST::FUNCTION: | 5 | ASN1_HEADER_new 5 NOEXIST::FUNCTION: |
| 6 | ASN1_IA5STRING_asn1_meth 6 EXIST::FUNCTION: | 6 | ASN1_IA5STRING_asn1_meth 6 NOEXIST::FUNCTION: |
| 7 | ASN1_INTEGER_get 7 EXIST::FUNCTION: | 7 | ASN1_INTEGER_get 7 EXIST::FUNCTION: |
| 8 | ASN1_INTEGER_set 8 EXIST::FUNCTION: | 8 | ASN1_INTEGER_set 8 EXIST::FUNCTION: |
| 9 | ASN1_INTEGER_to_BN 9 EXIST::FUNCTION: | 9 | ASN1_INTEGER_to_BN 9 EXIST::FUNCTION: |
| @@ -75,8 +75,8 @@ BIO_new 78 EXIST::FUNCTION: | |||
| 75 | BIO_new_accept 79 EXIST::FUNCTION: | 75 | BIO_new_accept 79 EXIST::FUNCTION: |
| 76 | BIO_new_connect 80 EXIST::FUNCTION: | 76 | BIO_new_connect 80 EXIST::FUNCTION: |
| 77 | BIO_new_fd 81 EXIST::FUNCTION: | 77 | BIO_new_fd 81 EXIST::FUNCTION: |
| 78 | BIO_new_file 82 EXIST:!WIN16:FUNCTION:FP_API | 78 | BIO_new_file 82 EXIST::FUNCTION:FP_API |
| 79 | BIO_new_fp 83 EXIST:!WIN16:FUNCTION:FP_API | 79 | BIO_new_fp 83 EXIST::FUNCTION:FP_API |
| 80 | BIO_new_socket 84 EXIST::FUNCTION: | 80 | BIO_new_socket 84 EXIST::FUNCTION: |
| 81 | BIO_pop 85 EXIST::FUNCTION: | 81 | BIO_pop 85 EXIST::FUNCTION: |
| 82 | BIO_printf 86 EXIST::FUNCTION: | 82 | BIO_printf 86 EXIST::FUNCTION: |
| @@ -86,7 +86,7 @@ BIO_read 89 EXIST::FUNCTION: | |||
| 86 | BIO_s_accept 90 EXIST::FUNCTION: | 86 | BIO_s_accept 90 EXIST::FUNCTION: |
| 87 | BIO_s_connect 91 EXIST::FUNCTION: | 87 | BIO_s_connect 91 EXIST::FUNCTION: |
| 88 | BIO_s_fd 92 EXIST::FUNCTION: | 88 | BIO_s_fd 92 EXIST::FUNCTION: |
| 89 | BIO_s_file 93 EXIST:!WIN16:FUNCTION:FP_API | 89 | BIO_s_file 93 EXIST::FUNCTION:FP_API |
| 90 | BIO_s_mem 95 EXIST::FUNCTION: | 90 | BIO_s_mem 95 EXIST::FUNCTION: |
| 91 | BIO_s_null 96 EXIST::FUNCTION: | 91 | BIO_s_null 96 EXIST::FUNCTION: |
| 92 | BIO_s_proxy_client 97 NOEXIST::FUNCTION: | 92 | BIO_s_proxy_client 97 NOEXIST::FUNCTION: |
| @@ -172,7 +172,7 @@ CRYPTO_dbg_realloc 179 EXIST::FUNCTION: | |||
| 172 | CRYPTO_dbg_remalloc 180 NOEXIST::FUNCTION: | 172 | CRYPTO_dbg_remalloc 180 NOEXIST::FUNCTION: |
| 173 | CRYPTO_free 181 EXIST::FUNCTION: | 173 | CRYPTO_free 181 EXIST::FUNCTION: |
| 174 | CRYPTO_get_add_lock_callback 182 EXIST::FUNCTION: | 174 | CRYPTO_get_add_lock_callback 182 EXIST::FUNCTION: |
| 175 | CRYPTO_get_id_callback 183 EXIST::FUNCTION: | 175 | CRYPTO_get_id_callback 183 EXIST::FUNCTION:DEPRECATED |
| 176 | CRYPTO_get_lock_name 184 EXIST::FUNCTION: | 176 | CRYPTO_get_lock_name 184 EXIST::FUNCTION: |
| 177 | CRYPTO_get_locking_callback 185 EXIST::FUNCTION: | 177 | CRYPTO_get_locking_callback 185 EXIST::FUNCTION: |
| 178 | CRYPTO_get_mem_functions 186 EXIST::FUNCTION: | 178 | CRYPTO_get_mem_functions 186 EXIST::FUNCTION: |
| @@ -185,10 +185,10 @@ CRYPTO_mem_leaks_fp 192 EXIST::FUNCTION:FP_API | |||
| 185 | CRYPTO_realloc 193 EXIST::FUNCTION: | 185 | CRYPTO_realloc 193 EXIST::FUNCTION: |
| 186 | CRYPTO_remalloc 194 EXIST::FUNCTION: | 186 | CRYPTO_remalloc 194 EXIST::FUNCTION: |
| 187 | CRYPTO_set_add_lock_callback 195 EXIST::FUNCTION: | 187 | CRYPTO_set_add_lock_callback 195 EXIST::FUNCTION: |
| 188 | CRYPTO_set_id_callback 196 EXIST::FUNCTION: | 188 | CRYPTO_set_id_callback 196 EXIST::FUNCTION:DEPRECATED |
| 189 | CRYPTO_set_locking_callback 197 EXIST::FUNCTION: | 189 | CRYPTO_set_locking_callback 197 EXIST::FUNCTION: |
| 190 | CRYPTO_set_mem_functions 198 EXIST::FUNCTION: | 190 | CRYPTO_set_mem_functions 198 EXIST::FUNCTION: |
| 191 | CRYPTO_thread_id 199 EXIST::FUNCTION: | 191 | CRYPTO_thread_id 199 EXIST::FUNCTION:DEPRECATED |
| 192 | DH_check 200 EXIST::FUNCTION:DH | 192 | DH_check 200 EXIST::FUNCTION:DH |
| 193 | DH_compute_key 201 EXIST::FUNCTION:DH | 193 | DH_compute_key 201 EXIST::FUNCTION:DH |
| 194 | DH_free 202 EXIST::FUNCTION:DH | 194 | DH_free 202 EXIST::FUNCTION:DH |
| @@ -243,7 +243,7 @@ ERR_print_errors 250 EXIST::FUNCTION:BIO | |||
| 243 | ERR_print_errors_fp 251 EXIST::FUNCTION:FP_API | 243 | ERR_print_errors_fp 251 EXIST::FUNCTION:FP_API |
| 244 | ERR_put_error 252 EXIST::FUNCTION: | 244 | ERR_put_error 252 EXIST::FUNCTION: |
| 245 | ERR_reason_error_string 253 EXIST::FUNCTION: | 245 | ERR_reason_error_string 253 EXIST::FUNCTION: |
| 246 | ERR_remove_state 254 EXIST::FUNCTION: | 246 | ERR_remove_state 254 EXIST::FUNCTION:DEPRECATED |
| 247 | EVP_BytesToKey 255 EXIST::FUNCTION: | 247 | EVP_BytesToKey 255 EXIST::FUNCTION: |
| 248 | EVP_CIPHER_CTX_cleanup 256 EXIST::FUNCTION: | 248 | EVP_CIPHER_CTX_cleanup 256 EXIST::FUNCTION: |
| 249 | EVP_CipherFinal 257 EXIST::FUNCTION: | 249 | EVP_CipherFinal 257 EXIST::FUNCTION: |
| @@ -343,7 +343,7 @@ NETSCAPE_SPKI_new 350 EXIST::FUNCTION: | |||
| 343 | NETSCAPE_SPKI_sign 351 EXIST::FUNCTION:EVP | 343 | NETSCAPE_SPKI_sign 351 EXIST::FUNCTION:EVP |
| 344 | NETSCAPE_SPKI_verify 352 EXIST::FUNCTION:EVP | 344 | NETSCAPE_SPKI_verify 352 EXIST::FUNCTION:EVP |
| 345 | OBJ_add_object 353 EXIST::FUNCTION: | 345 | OBJ_add_object 353 EXIST::FUNCTION: |
| 346 | OBJ_bsearch 354 EXIST::FUNCTION: | 346 | OBJ_bsearch 354 NOEXIST::FUNCTION: |
| 347 | OBJ_cleanup 355 EXIST::FUNCTION: | 347 | OBJ_cleanup 355 EXIST::FUNCTION: |
| 348 | OBJ_cmp 356 EXIST::FUNCTION: | 348 | OBJ_cmp 356 EXIST::FUNCTION: |
| 349 | OBJ_create 357 EXIST::FUNCTION: | 349 | OBJ_create 357 EXIST::FUNCTION: |
| @@ -356,9 +356,9 @@ OBJ_nid2sn 363 EXIST::FUNCTION: | |||
| 356 | OBJ_obj2nid 364 EXIST::FUNCTION: | 356 | OBJ_obj2nid 364 EXIST::FUNCTION: |
| 357 | OBJ_sn2nid 365 EXIST::FUNCTION: | 357 | OBJ_sn2nid 365 EXIST::FUNCTION: |
| 358 | OBJ_txt2nid 366 EXIST::FUNCTION: | 358 | OBJ_txt2nid 366 EXIST::FUNCTION: |
| 359 | PEM_ASN1_read 367 EXIST:!WIN16:FUNCTION: | 359 | PEM_ASN1_read 367 EXIST::FUNCTION: |
| 360 | PEM_ASN1_read_bio 368 EXIST::FUNCTION:BIO | 360 | PEM_ASN1_read_bio 368 EXIST::FUNCTION:BIO |
| 361 | PEM_ASN1_write 369 EXIST:!WIN16:FUNCTION: | 361 | PEM_ASN1_write 369 EXIST::FUNCTION: |
| 362 | PEM_ASN1_write_bio 370 EXIST::FUNCTION:BIO | 362 | PEM_ASN1_write_bio 370 EXIST::FUNCTION:BIO |
| 363 | PEM_SealFinal 371 EXIST::FUNCTION:RSA | 363 | PEM_SealFinal 371 EXIST::FUNCTION:RSA |
| 364 | PEM_SealInit 372 EXIST::FUNCTION:RSA | 364 | PEM_SealInit 372 EXIST::FUNCTION:RSA |
| @@ -366,14 +366,14 @@ PEM_SealUpdate 373 EXIST::FUNCTION:RSA | |||
| 366 | PEM_SignFinal 374 EXIST::FUNCTION: | 366 | PEM_SignFinal 374 EXIST::FUNCTION: |
| 367 | PEM_SignInit 375 EXIST::FUNCTION: | 367 | PEM_SignInit 375 EXIST::FUNCTION: |
| 368 | PEM_SignUpdate 376 EXIST::FUNCTION: | 368 | PEM_SignUpdate 376 EXIST::FUNCTION: |
| 369 | PEM_X509_INFO_read 377 EXIST:!WIN16:FUNCTION: | 369 | PEM_X509_INFO_read 377 EXIST::FUNCTION: |
| 370 | PEM_X509_INFO_read_bio 378 EXIST::FUNCTION:BIO | 370 | PEM_X509_INFO_read_bio 378 EXIST::FUNCTION:BIO |
| 371 | PEM_X509_INFO_write_bio 379 EXIST::FUNCTION:BIO | 371 | PEM_X509_INFO_write_bio 379 EXIST::FUNCTION:BIO |
| 372 | PEM_dek_info 380 EXIST::FUNCTION: | 372 | PEM_dek_info 380 EXIST::FUNCTION: |
| 373 | PEM_do_header 381 EXIST::FUNCTION: | 373 | PEM_do_header 381 EXIST::FUNCTION: |
| 374 | PEM_get_EVP_CIPHER_INFO 382 EXIST::FUNCTION: | 374 | PEM_get_EVP_CIPHER_INFO 382 EXIST::FUNCTION: |
| 375 | PEM_proc_type 383 EXIST::FUNCTION: | 375 | PEM_proc_type 383 EXIST::FUNCTION: |
| 376 | PEM_read 384 EXIST:!WIN16:FUNCTION: | 376 | PEM_read 384 EXIST::FUNCTION: |
| 377 | PEM_read_DHparams 385 EXIST:!WIN16:FUNCTION:DH | 377 | PEM_read_DHparams 385 EXIST:!WIN16:FUNCTION:DH |
| 378 | PEM_read_DSAPrivateKey 386 EXIST:!WIN16:FUNCTION:DSA | 378 | PEM_read_DSAPrivateKey 386 EXIST:!WIN16:FUNCTION:DSA |
| 379 | PEM_read_DSAparams 387 EXIST:!WIN16:FUNCTION:DSA | 379 | PEM_read_DSAparams 387 EXIST:!WIN16:FUNCTION:DSA |
| @@ -393,7 +393,7 @@ PEM_read_bio_RSAPrivateKey 400 EXIST::FUNCTION:RSA | |||
| 393 | PEM_read_bio_X509 401 EXIST::FUNCTION: | 393 | PEM_read_bio_X509 401 EXIST::FUNCTION: |
| 394 | PEM_read_bio_X509_CRL 402 EXIST::FUNCTION: | 394 | PEM_read_bio_X509_CRL 402 EXIST::FUNCTION: |
| 395 | PEM_read_bio_X509_REQ 403 EXIST::FUNCTION: | 395 | PEM_read_bio_X509_REQ 403 EXIST::FUNCTION: |
| 396 | PEM_write 404 EXIST:!WIN16:FUNCTION: | 396 | PEM_write 404 EXIST::FUNCTION: |
| 397 | PEM_write_DHparams 405 EXIST:!WIN16:FUNCTION:DH | 397 | PEM_write_DHparams 405 EXIST:!WIN16:FUNCTION:DH |
| 398 | PEM_write_DSAPrivateKey 406 EXIST:!WIN16:FUNCTION:DSA | 398 | PEM_write_DSAPrivateKey 406 EXIST:!WIN16:FUNCTION:DSA |
| 399 | PEM_write_DSAparams 407 EXIST:!WIN16:FUNCTION:DSA | 399 | PEM_write_DSAparams 407 EXIST:!WIN16:FUNCTION:DSA |
| @@ -469,7 +469,7 @@ RC2_set_key 476 EXIST::FUNCTION:RC2 | |||
| 469 | RC4 477 EXIST::FUNCTION:RC4 | 469 | RC4 477 EXIST::FUNCTION:RC4 |
| 470 | RC4_options 478 EXIST::FUNCTION:RC4 | 470 | RC4_options 478 EXIST::FUNCTION:RC4 |
| 471 | RC4_set_key 479 EXIST::FUNCTION:RC4 | 471 | RC4_set_key 479 EXIST::FUNCTION:RC4 |
| 472 | RSAPrivateKey_asn1_meth 480 EXIST::FUNCTION:RSA | 472 | RSAPrivateKey_asn1_meth 480 NOEXIST::FUNCTION: |
| 473 | RSAPrivateKey_dup 481 EXIST::FUNCTION:RSA | 473 | RSAPrivateKey_dup 481 EXIST::FUNCTION:RSA |
| 474 | RSAPublicKey_dup 482 EXIST::FUNCTION:RSA | 474 | RSAPublicKey_dup 482 EXIST::FUNCTION:RSA |
| 475 | RSA_PKCS1_SSLeay 483 EXIST::FUNCTION:RSA | 475 | RSA_PKCS1_SSLeay 483 EXIST::FUNCTION:RSA |
| @@ -624,7 +624,7 @@ X509_STORE_set_default_paths 630 EXIST::FUNCTION:STDIO | |||
| 624 | X509_VAL_free 631 EXIST::FUNCTION: | 624 | X509_VAL_free 631 EXIST::FUNCTION: |
| 625 | X509_VAL_new 632 EXIST::FUNCTION: | 625 | X509_VAL_new 632 EXIST::FUNCTION: |
| 626 | X509_add_ext 633 EXIST::FUNCTION: | 626 | X509_add_ext 633 EXIST::FUNCTION: |
| 627 | X509_asn1_meth 634 EXIST::FUNCTION: | 627 | X509_asn1_meth 634 NOEXIST::FUNCTION: |
| 628 | X509_certificate_type 635 EXIST::FUNCTION: | 628 | X509_certificate_type 635 EXIST::FUNCTION: |
| 629 | X509_check_private_key 636 EXIST::FUNCTION: | 629 | X509_check_private_key 636 EXIST::FUNCTION: |
| 630 | X509_cmp_current_time 637 EXIST::FUNCTION: | 630 | X509_cmp_current_time 637 EXIST::FUNCTION: |
| @@ -704,7 +704,7 @@ bn_sqr_words 710 EXIST::FUNCTION: | |||
| 704 | _ossl_old_crypt 711 EXIST:!NeXT,!PERL5:FUNCTION:DES | 704 | _ossl_old_crypt 711 EXIST:!NeXT,!PERL5:FUNCTION:DES |
| 705 | d2i_ASN1_BIT_STRING 712 EXIST::FUNCTION: | 705 | d2i_ASN1_BIT_STRING 712 EXIST::FUNCTION: |
| 706 | d2i_ASN1_BOOLEAN 713 EXIST::FUNCTION: | 706 | d2i_ASN1_BOOLEAN 713 EXIST::FUNCTION: |
| 707 | d2i_ASN1_HEADER 714 EXIST::FUNCTION: | 707 | d2i_ASN1_HEADER 714 NOEXIST::FUNCTION: |
| 708 | d2i_ASN1_IA5STRING 715 EXIST::FUNCTION: | 708 | d2i_ASN1_IA5STRING 715 EXIST::FUNCTION: |
| 709 | d2i_ASN1_INTEGER 716 EXIST::FUNCTION: | 709 | d2i_ASN1_INTEGER 716 EXIST::FUNCTION: |
| 710 | d2i_ASN1_OBJECT 717 EXIST::FUNCTION: | 710 | d2i_ASN1_OBJECT 717 EXIST::FUNCTION: |
| @@ -809,7 +809,7 @@ i2a_ASN1_OBJECT 816 EXIST::FUNCTION:BIO | |||
| 809 | i2a_ASN1_STRING 817 EXIST::FUNCTION:BIO | 809 | i2a_ASN1_STRING 817 EXIST::FUNCTION:BIO |
| 810 | i2d_ASN1_BIT_STRING 818 EXIST::FUNCTION: | 810 | i2d_ASN1_BIT_STRING 818 EXIST::FUNCTION: |
| 811 | i2d_ASN1_BOOLEAN 819 EXIST::FUNCTION: | 811 | i2d_ASN1_BOOLEAN 819 EXIST::FUNCTION: |
| 812 | i2d_ASN1_HEADER 820 EXIST::FUNCTION: | 812 | i2d_ASN1_HEADER 820 NOEXIST::FUNCTION: |
| 813 | i2d_ASN1_IA5STRING 821 EXIST::FUNCTION: | 813 | i2d_ASN1_IA5STRING 821 EXIST::FUNCTION: |
| 814 | i2d_ASN1_INTEGER 822 EXIST::FUNCTION: | 814 | i2d_ASN1_INTEGER 822 EXIST::FUNCTION: |
| 815 | i2d_ASN1_OBJECT 823 EXIST::FUNCTION: | 815 | i2d_ASN1_OBJECT 823 EXIST::FUNCTION: |
| @@ -950,9 +950,9 @@ ERR_get_next_error_library 966 EXIST::FUNCTION: | |||
| 950 | EVP_PKEY_cmp_parameters 967 EXIST::FUNCTION: | 950 | EVP_PKEY_cmp_parameters 967 EXIST::FUNCTION: |
| 951 | HMAC_cleanup 968 NOEXIST::FUNCTION: | 951 | HMAC_cleanup 968 NOEXIST::FUNCTION: |
| 952 | BIO_ptr_ctrl 969 EXIST::FUNCTION: | 952 | BIO_ptr_ctrl 969 EXIST::FUNCTION: |
| 953 | BIO_new_file_internal 970 EXIST:WIN16:FUNCTION:FP_API | 953 | BIO_new_file_internal 970 NOEXIST::FUNCTION: |
| 954 | BIO_new_fp_internal 971 EXIST:WIN16:FUNCTION:FP_API | 954 | BIO_new_fp_internal 971 NOEXIST::FUNCTION: |
| 955 | BIO_s_file_internal 972 EXIST:WIN16:FUNCTION:FP_API | 955 | BIO_s_file_internal 972 NOEXIST::FUNCTION: |
| 956 | BN_BLINDING_convert 973 EXIST::FUNCTION: | 956 | BN_BLINDING_convert 973 EXIST::FUNCTION: |
| 957 | BN_BLINDING_invert 974 EXIST::FUNCTION: | 957 | BN_BLINDING_invert 974 EXIST::FUNCTION: |
| 958 | BN_BLINDING_update 975 EXIST::FUNCTION: | 958 | BN_BLINDING_update 975 EXIST::FUNCTION: |
| @@ -984,8 +984,8 @@ BIO_ghbn_ctrl 1003 NOEXIST::FUNCTION: | |||
| 984 | CRYPTO_free_ex_data 1004 EXIST::FUNCTION: | 984 | CRYPTO_free_ex_data 1004 EXIST::FUNCTION: |
| 985 | CRYPTO_get_ex_data 1005 EXIST::FUNCTION: | 985 | CRYPTO_get_ex_data 1005 EXIST::FUNCTION: |
| 986 | CRYPTO_set_ex_data 1007 EXIST::FUNCTION: | 986 | CRYPTO_set_ex_data 1007 EXIST::FUNCTION: |
| 987 | ERR_load_CRYPTO_strings 1009 EXIST:!OS2,!VMS,!WIN16:FUNCTION: | 987 | ERR_load_CRYPTO_strings 1009 EXIST:!OS2,!VMS:FUNCTION: |
| 988 | ERR_load_CRYPTOlib_strings 1009 EXIST:OS2,VMS,WIN16:FUNCTION: | 988 | ERR_load_CRYPTOlib_strings 1009 EXIST:OS2,VMS:FUNCTION: |
| 989 | EVP_PKEY_bits 1010 EXIST::FUNCTION: | 989 | EVP_PKEY_bits 1010 EXIST::FUNCTION: |
| 990 | MD5_Transform 1011 EXIST::FUNCTION:MD5 | 990 | MD5_Transform 1011 EXIST::FUNCTION:MD5 |
| 991 | SHA1_Transform 1012 EXIST::FUNCTION:SHA,SHA1 | 991 | SHA1_Transform 1012 EXIST::FUNCTION:SHA,SHA1 |
| @@ -1117,11 +1117,11 @@ COMP_compress_block 1144 EXIST::FUNCTION: | |||
| 1117 | COMP_expand_block 1145 EXIST::FUNCTION: | 1117 | COMP_expand_block 1145 EXIST::FUNCTION: |
| 1118 | COMP_rle 1146 EXIST::FUNCTION: | 1118 | COMP_rle 1146 EXIST::FUNCTION: |
| 1119 | COMP_zlib 1147 EXIST::FUNCTION: | 1119 | COMP_zlib 1147 EXIST::FUNCTION: |
| 1120 | ms_time_diff 1148 EXIST::FUNCTION: | 1120 | ms_time_diff 1148 NOEXIST::FUNCTION: |
| 1121 | ms_time_new 1149 EXIST::FUNCTION: | 1121 | ms_time_new 1149 NOEXIST::FUNCTION: |
| 1122 | ms_time_free 1150 EXIST::FUNCTION: | 1122 | ms_time_free 1150 NOEXIST::FUNCTION: |
| 1123 | ms_time_cmp 1151 EXIST::FUNCTION: | 1123 | ms_time_cmp 1151 NOEXIST::FUNCTION: |
| 1124 | ms_time_get 1152 EXIST::FUNCTION: | 1124 | ms_time_get 1152 NOEXIST::FUNCTION: |
| 1125 | PKCS7_set_attributes 1153 EXIST::FUNCTION: | 1125 | PKCS7_set_attributes 1153 EXIST::FUNCTION: |
| 1126 | PKCS7_set_signed_attributes 1154 EXIST::FUNCTION: | 1126 | PKCS7_set_signed_attributes 1154 EXIST::FUNCTION: |
| 1127 | X509_ATTRIBUTE_create 1155 EXIST::FUNCTION: | 1127 | X509_ATTRIBUTE_create 1155 EXIST::FUNCTION: |
| @@ -1255,8 +1255,8 @@ PKCS12_gen_mac 1278 EXIST::FUNCTION: | |||
| 1255 | PKCS12_verify_mac 1279 EXIST::FUNCTION: | 1255 | PKCS12_verify_mac 1279 EXIST::FUNCTION: |
| 1256 | PKCS12_set_mac 1280 EXIST::FUNCTION: | 1256 | PKCS12_set_mac 1280 EXIST::FUNCTION: |
| 1257 | PKCS12_setup_mac 1281 EXIST::FUNCTION: | 1257 | PKCS12_setup_mac 1281 EXIST::FUNCTION: |
| 1258 | asc2uni 1282 EXIST::FUNCTION: | 1258 | OPENSSL_asc2uni 1282 EXIST::FUNCTION: |
| 1259 | uni2asc 1283 EXIST::FUNCTION: | 1259 | OPENSSL_uni2asc 1283 EXIST::FUNCTION: |
| 1260 | i2d_PKCS12_BAGS 1284 EXIST::FUNCTION: | 1260 | i2d_PKCS12_BAGS 1284 EXIST::FUNCTION: |
| 1261 | PKCS12_BAGS_new 1285 EXIST::FUNCTION: | 1261 | PKCS12_BAGS_new 1285 EXIST::FUNCTION: |
| 1262 | d2i_PKCS12_BAGS 1286 EXIST::FUNCTION: | 1262 | d2i_PKCS12_BAGS 1286 EXIST::FUNCTION: |
| @@ -2081,7 +2081,7 @@ NETSCAPE_SPKAC_it 2641 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA | |||
| 2081 | NETSCAPE_SPKAC_it 2641 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2081 | NETSCAPE_SPKAC_it 2641 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| 2082 | X509_REVOKED_it 2642 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2082 | X509_REVOKED_it 2642 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
| 2083 | X509_REVOKED_it 2642 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2083 | X509_REVOKED_it 2642 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| 2084 | ASN1_STRING_encode 2643 EXIST::FUNCTION: | 2084 | ASN1_STRING_encode 2643 NOEXIST::FUNCTION: |
| 2085 | EVP_aes_128_ecb 2644 EXIST::FUNCTION:AES | 2085 | EVP_aes_128_ecb 2644 EXIST::FUNCTION:AES |
| 2086 | KRB5_AUTHENT_free 2645 EXIST::FUNCTION: | 2086 | KRB5_AUTHENT_free 2645 EXIST::FUNCTION: |
| 2087 | OCSP_BASICRESP_get_ext_by_critical 2646 EXIST:!VMS:FUNCTION: | 2087 | OCSP_BASICRESP_get_ext_by_critical 2646 EXIST:!VMS:FUNCTION: |
| @@ -2732,8 +2732,8 @@ EC_POINT_point2oct 3178 EXIST::FUNCTION:EC | |||
| 2732 | KRB5_APREQ_free 3179 EXIST::FUNCTION: | 2732 | KRB5_APREQ_free 3179 EXIST::FUNCTION: |
| 2733 | ASN1_OBJECT_it 3180 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2733 | ASN1_OBJECT_it 3180 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
| 2734 | ASN1_OBJECT_it 3180 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2734 | ASN1_OBJECT_it 3180 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| 2735 | OCSP_crlID_new 3181 EXIST:!OS2,!VMS,!WIN16:FUNCTION: | 2735 | OCSP_crlID_new 3181 EXIST:!OS2,!VMS:FUNCTION: |
| 2736 | OCSP_crlID2_new 3181 EXIST:OS2,VMS,WIN16:FUNCTION: | 2736 | OCSP_crlID2_new 3181 EXIST:OS2,VMS:FUNCTION: |
| 2737 | CONF_modules_load_file 3182 EXIST::FUNCTION: | 2737 | CONF_modules_load_file 3182 EXIST::FUNCTION: |
| 2738 | CONF_imodule_set_usr_data 3183 EXIST::FUNCTION: | 2738 | CONF_imodule_set_usr_data 3183 EXIST::FUNCTION: |
| 2739 | ENGINE_set_default_string 3184 EXIST::FUNCTION:ENGINE | 2739 | ENGINE_set_default_string 3184 EXIST::FUNCTION:ENGINE |
| @@ -2804,57 +2804,57 @@ OPENSSL_cleanse 3245 EXIST::FUNCTION: | |||
| 2804 | ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE | 2804 | ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE |
| 2805 | ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH | 2805 | ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH |
| 2806 | EVP_aes_128_cfb8 3248 EXIST::FUNCTION:AES | 2806 | EVP_aes_128_cfb8 3248 EXIST::FUNCTION:AES |
| 2807 | FIPS_corrupt_rsa 3249 EXIST:OPENSSL_FIPS:FUNCTION: | 2807 | FIPS_corrupt_rsa 3249 NOEXIST::FUNCTION: |
| 2808 | FIPS_selftest_des 3250 EXIST:OPENSSL_FIPS:FUNCTION: | 2808 | FIPS_selftest_des 3250 NOEXIST::FUNCTION: |
| 2809 | EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES | 2809 | EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES |
| 2810 | EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES | 2810 | EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES |
| 2811 | FIPS_mode_set 3253 EXIST:OPENSSL_FIPS:FUNCTION: | 2811 | FIPS_mode_set 3253 NOEXIST::FUNCTION: |
| 2812 | FIPS_selftest_dsa 3254 EXIST:OPENSSL_FIPS:FUNCTION: | 2812 | FIPS_selftest_dsa 3254 NOEXIST::FUNCTION: |
| 2813 | EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES | 2813 | EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES |
| 2814 | FIPS_allow_md5 3256 NOEXIST::FUNCTION: | 2814 | FIPS_allow_md5 3256 NOEXIST::FUNCTION: |
| 2815 | DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES | 2815 | DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES |
| 2816 | EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES | 2816 | EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES |
| 2817 | FIPS_rand_seeded 3259 NOEXIST::FUNCTION: | 2817 | FIPS_rand_seeded 3259 NOEXIST::FUNCTION: |
| 2818 | AES_cfbr_encrypt_block 3260 EXIST::FUNCTION:AES | 2818 | AES_cfbr_encrypt_block 3260 NOEXIST::FUNCTION: |
| 2819 | AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES | 2819 | AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES |
| 2820 | FIPS_rand_seed 3262 EXIST:OPENSSL_FIPS:FUNCTION: | 2820 | FIPS_rand_seed 3262 NOEXIST::FUNCTION: |
| 2821 | FIPS_corrupt_des 3263 EXIST:OPENSSL_FIPS:FUNCTION: | 2821 | FIPS_corrupt_des 3263 NOEXIST::FUNCTION: |
| 2822 | EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES | 2822 | EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES |
| 2823 | FIPS_selftest_aes 3265 EXIST:OPENSSL_FIPS:FUNCTION: | 2823 | FIPS_selftest_aes 3265 NOEXIST::FUNCTION: |
| 2824 | FIPS_set_prng_key 3266 NOEXIST::FUNCTION: | 2824 | FIPS_set_prng_key 3266 NOEXIST::FUNCTION: |
| 2825 | EVP_des_cfb8 3267 EXIST::FUNCTION:DES | 2825 | EVP_des_cfb8 3267 EXIST::FUNCTION:DES |
| 2826 | FIPS_corrupt_dsa 3268 EXIST:OPENSSL_FIPS:FUNCTION: | 2826 | FIPS_corrupt_dsa 3268 NOEXIST::FUNCTION: |
| 2827 | FIPS_test_mode 3269 NOEXIST::FUNCTION: | 2827 | FIPS_test_mode 3269 NOEXIST::FUNCTION: |
| 2828 | FIPS_rand_method 3270 EXIST:OPENSSL_FIPS:FUNCTION: | 2828 | FIPS_rand_method 3270 NOEXIST::FUNCTION: |
| 2829 | EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES | 2829 | EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES |
| 2830 | ERR_load_FIPS_strings 3272 EXIST:OPENSSL_FIPS:FUNCTION: | 2830 | ERR_load_FIPS_strings 3272 NOEXIST::FUNCTION: |
| 2831 | FIPS_corrupt_aes 3273 EXIST:OPENSSL_FIPS:FUNCTION: | 2831 | FIPS_corrupt_aes 3273 NOEXIST::FUNCTION: |
| 2832 | FIPS_selftest_sha1 3274 EXIST:OPENSSL_FIPS:FUNCTION: | 2832 | FIPS_selftest_sha1 3274 NOEXIST::FUNCTION: |
| 2833 | FIPS_selftest_rsa 3275 EXIST:OPENSSL_FIPS:FUNCTION: | 2833 | FIPS_selftest_rsa 3275 NOEXIST::FUNCTION: |
| 2834 | FIPS_corrupt_sha1 3276 EXIST:OPENSSL_FIPS:FUNCTION: | 2834 | FIPS_corrupt_sha1 3276 NOEXIST::FUNCTION: |
| 2835 | EVP_des_cfb1 3277 EXIST::FUNCTION:DES | 2835 | EVP_des_cfb1 3277 EXIST::FUNCTION:DES |
| 2836 | FIPS_dsa_check 3278 NOEXIST::FUNCTION: | 2836 | FIPS_dsa_check 3278 NOEXIST::FUNCTION: |
| 2837 | AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES | 2837 | AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES |
| 2838 | EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES | 2838 | EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES |
| 2839 | FIPS_rand_check 3281 EXIST:OPENSSL_FIPS:FUNCTION: | 2839 | FIPS_rand_check 3281 NOEXIST::FUNCTION: |
| 2840 | FIPS_md5_allowed 3282 NOEXIST::FUNCTION: | 2840 | FIPS_md5_allowed 3282 NOEXIST::FUNCTION: |
| 2841 | FIPS_mode 3283 EXIST:OPENSSL_FIPS:FUNCTION: | 2841 | FIPS_mode 3283 NOEXIST::FUNCTION: |
| 2842 | FIPS_selftest_failed 3284 EXIST:OPENSSL_FIPS:FUNCTION: | 2842 | FIPS_selftest_failed 3284 NOEXIST::FUNCTION: |
| 2843 | sk_is_sorted 3285 EXIST::FUNCTION: | 2843 | sk_is_sorted 3285 EXIST::FUNCTION: |
| 2844 | X509_check_ca 3286 EXIST::FUNCTION: | 2844 | X509_check_ca 3286 EXIST::FUNCTION: |
| 2845 | private_idea_set_encrypt_key 3287 EXIST:OPENSSL_FIPS:FUNCTION:IDEA | 2845 | private_idea_set_encrypt_key 3287 NOEXIST::FUNCTION: |
| 2846 | HMAC_CTX_set_flags 3288 EXIST::FUNCTION:HMAC | 2846 | HMAC_CTX_set_flags 3288 EXIST::FUNCTION:HMAC |
| 2847 | private_SHA_Init 3289 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA0 | 2847 | private_SHA_Init 3289 NOEXIST::FUNCTION: |
| 2848 | private_CAST_set_key 3290 EXIST:OPENSSL_FIPS:FUNCTION:CAST | 2848 | private_CAST_set_key 3290 NOEXIST::FUNCTION: |
| 2849 | private_RIPEMD160_Init 3291 EXIST:OPENSSL_FIPS:FUNCTION:RIPEMD | 2849 | private_RIPEMD160_Init 3291 NOEXIST::FUNCTION: |
| 2850 | private_RC5_32_set_key 3292 EXIST:OPENSSL_FIPS:FUNCTION:RC5 | 2850 | private_RC5_32_set_key 3292 NOEXIST::FUNCTION: |
| 2851 | private_MD5_Init 3293 EXIST:OPENSSL_FIPS:FUNCTION:MD5 | 2851 | private_MD5_Init 3293 NOEXIST::FUNCTION: |
| 2852 | private_RC4_set_key 3294 EXIST:OPENSSL_FIPS:FUNCTION:RC4 | 2852 | private_RC4_set_key 3294 NOEXIST::FUNCTION: |
| 2853 | private_MDC2_Init 3295 EXIST:OPENSSL_FIPS:FUNCTION:MDC2 | 2853 | private_MDC2_Init 3295 NOEXIST::FUNCTION: |
| 2854 | private_RC2_set_key 3296 EXIST:OPENSSL_FIPS:FUNCTION:RC2 | 2854 | private_RC2_set_key 3296 NOEXIST::FUNCTION: |
| 2855 | private_MD4_Init 3297 EXIST:OPENSSL_FIPS:FUNCTION:MD4 | 2855 | private_MD4_Init 3297 NOEXIST::FUNCTION: |
| 2856 | private_BF_set_key 3298 EXIST:OPENSSL_FIPS:FUNCTION:BF | 2856 | private_BF_set_key 3298 NOEXIST::FUNCTION: |
| 2857 | private_MD2_Init 3299 EXIST:OPENSSL_FIPS:FUNCTION:MD2 | 2857 | private_MD2_Init 3299 NOEXIST::FUNCTION: |
| 2858 | d2i_PROXY_CERT_INFO_EXTENSION 3300 EXIST::FUNCTION: | 2858 | d2i_PROXY_CERT_INFO_EXTENSION 3300 EXIST::FUNCTION: |
| 2859 | PROXY_POLICY_it 3301 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2859 | PROXY_POLICY_it 3301 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
| 2860 | PROXY_POLICY_it 3301 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2860 | PROXY_POLICY_it 3301 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| @@ -2868,13 +2868,13 @@ PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTI | |||
| 2868 | PROXY_POLICY_free 3308 EXIST::FUNCTION: | 2868 | PROXY_POLICY_free 3308 EXIST::FUNCTION: |
| 2869 | PROXY_POLICY_new 3309 EXIST::FUNCTION: | 2869 | PROXY_POLICY_new 3309 EXIST::FUNCTION: |
| 2870 | BN_MONT_CTX_set_locked 3310 EXIST::FUNCTION: | 2870 | BN_MONT_CTX_set_locked 3310 EXIST::FUNCTION: |
| 2871 | FIPS_selftest_rng 3311 EXIST:OPENSSL_FIPS:FUNCTION: | 2871 | FIPS_selftest_rng 3311 NOEXIST::FUNCTION: |
| 2872 | EVP_sha384 3312 EXIST::FUNCTION:SHA,SHA512 | 2872 | EVP_sha384 3312 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 2873 | EVP_sha512 3313 EXIST::FUNCTION:SHA,SHA512 | 2873 | EVP_sha512 3313 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 2874 | EVP_sha224 3314 EXIST::FUNCTION:SHA,SHA256 | 2874 | EVP_sha224 3314 EXIST::FUNCTION:SHA,SHA256 |
| 2875 | EVP_sha256 3315 EXIST::FUNCTION:SHA,SHA256 | 2875 | EVP_sha256 3315 EXIST::FUNCTION:SHA,SHA256 |
| 2876 | FIPS_selftest_hmac 3316 EXIST:OPENSSL_FIPS:FUNCTION: | 2876 | FIPS_selftest_hmac 3316 NOEXIST::FUNCTION: |
| 2877 | FIPS_corrupt_rng 3317 EXIST:OPENSSL_FIPS:FUNCTION: | 2877 | FIPS_corrupt_rng 3317 NOEXIST::FUNCTION: |
| 2878 | BN_mod_exp_mont_consttime 3318 EXIST::FUNCTION: | 2878 | BN_mod_exp_mont_consttime 3318 EXIST::FUNCTION: |
| 2879 | RSA_X931_hash_id 3319 EXIST::FUNCTION:RSA | 2879 | RSA_X931_hash_id 3319 EXIST::FUNCTION:RSA |
| 2880 | RSA_padding_check_X931 3320 EXIST::FUNCTION:RSA | 2880 | RSA_padding_check_X931 3320 EXIST::FUNCTION:RSA |
| @@ -2882,7 +2882,7 @@ RSA_verify_PKCS1_PSS 3321 EXIST::FUNCTION:RSA | |||
| 2882 | RSA_padding_add_X931 3322 EXIST::FUNCTION:RSA | 2882 | RSA_padding_add_X931 3322 EXIST::FUNCTION:RSA |
| 2883 | RSA_padding_add_PKCS1_PSS 3323 EXIST::FUNCTION:RSA | 2883 | RSA_padding_add_PKCS1_PSS 3323 EXIST::FUNCTION:RSA |
| 2884 | PKCS1_MGF1 3324 EXIST::FUNCTION:RSA | 2884 | PKCS1_MGF1 3324 EXIST::FUNCTION:RSA |
| 2885 | BN_X931_generate_Xpq 3325 EXIST::FUNCTION: | 2885 | BN_X931_generate_Xpq 3325 NOEXIST::FUNCTION: |
| 2886 | RSA_X931_generate_key 3326 NOEXIST::FUNCTION: | 2886 | RSA_X931_generate_key 3326 NOEXIST::FUNCTION: |
| 2887 | BN_X931_derive_prime 3327 NOEXIST::FUNCTION: | 2887 | BN_X931_derive_prime 3327 NOEXIST::FUNCTION: |
| 2888 | BN_X931_generate_prime 3328 NOEXIST::FUNCTION: | 2888 | BN_X931_generate_prime 3328 NOEXIST::FUNCTION: |
| @@ -2893,43 +2893,43 @@ ERR_set_mark 3332 EXIST::FUNCTION: | |||
| 2893 | X509_STORE_CTX_set0_crls 3333 EXIST::FUNCTION: | 2893 | X509_STORE_CTX_set0_crls 3333 EXIST::FUNCTION: |
| 2894 | ENGINE_set_STORE 3334 EXIST::FUNCTION:ENGINE | 2894 | ENGINE_set_STORE 3334 EXIST::FUNCTION:ENGINE |
| 2895 | ENGINE_register_ECDSA 3335 EXIST::FUNCTION:ENGINE | 2895 | ENGINE_register_ECDSA 3335 EXIST::FUNCTION:ENGINE |
| 2896 | STORE_method_set_list_start_function 3336 EXIST:!VMS:FUNCTION: | 2896 | STORE_meth_set_list_start_fn 3336 NOEXIST::FUNCTION: |
| 2897 | STORE_meth_set_list_start_fn 3336 EXIST:VMS:FUNCTION: | 2897 | STORE_method_set_list_start_function 3336 NOEXIST::FUNCTION: |
| 2898 | BN_BLINDING_invert_ex 3337 EXIST::FUNCTION: | 2898 | BN_BLINDING_invert_ex 3337 EXIST::FUNCTION: |
| 2899 | NAME_CONSTRAINTS_free 3338 EXIST::FUNCTION: | 2899 | NAME_CONSTRAINTS_free 3338 EXIST::FUNCTION: |
| 2900 | STORE_ATTR_INFO_set_number 3339 EXIST::FUNCTION: | 2900 | STORE_ATTR_INFO_set_number 3339 NOEXIST::FUNCTION: |
| 2901 | BN_BLINDING_get_thread_id 3340 EXIST::FUNCTION: | 2901 | BN_BLINDING_get_thread_id 3340 EXIST::FUNCTION:DEPRECATED |
| 2902 | X509_STORE_CTX_set0_param 3341 EXIST::FUNCTION: | 2902 | X509_STORE_CTX_set0_param 3341 EXIST::FUNCTION: |
| 2903 | POLICY_MAPPING_it 3342 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2903 | POLICY_MAPPING_it 3342 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
| 2904 | POLICY_MAPPING_it 3342 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2904 | POLICY_MAPPING_it 3342 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| 2905 | STORE_parse_attrs_start 3343 EXIST::FUNCTION: | 2905 | STORE_parse_attrs_start 3343 NOEXIST::FUNCTION: |
| 2906 | POLICY_CONSTRAINTS_free 3344 EXIST::FUNCTION: | 2906 | POLICY_CONSTRAINTS_free 3344 EXIST::FUNCTION: |
| 2907 | EVP_PKEY_add1_attr_by_NID 3345 EXIST::FUNCTION: | 2907 | EVP_PKEY_add1_attr_by_NID 3345 EXIST::FUNCTION: |
| 2908 | BN_nist_mod_192 3346 EXIST::FUNCTION: | 2908 | BN_nist_mod_192 3346 EXIST::FUNCTION: |
| 2909 | EC_GROUP_get_trinomial_basis 3347 EXIST::FUNCTION:EC | 2909 | EC_GROUP_get_trinomial_basis 3347 EXIST::FUNCTION:EC |
| 2910 | STORE_set_method 3348 EXIST::FUNCTION: | 2910 | STORE_set_method 3348 NOEXIST::FUNCTION: |
| 2911 | GENERAL_SUBTREE_free 3349 EXIST::FUNCTION: | 2911 | GENERAL_SUBTREE_free 3349 EXIST::FUNCTION: |
| 2912 | NAME_CONSTRAINTS_it 3350 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 2912 | NAME_CONSTRAINTS_it 3350 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
| 2913 | NAME_CONSTRAINTS_it 3350 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 2913 | NAME_CONSTRAINTS_it 3350 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| 2914 | ECDH_get_default_method 3351 EXIST::FUNCTION:ECDH | 2914 | ECDH_get_default_method 3351 EXIST::FUNCTION:ECDH |
| 2915 | PKCS12_add_safe 3352 EXIST::FUNCTION: | 2915 | PKCS12_add_safe 3352 EXIST::FUNCTION: |
| 2916 | EC_KEY_new_by_curve_name 3353 EXIST::FUNCTION:EC | 2916 | EC_KEY_new_by_curve_name 3353 EXIST::FUNCTION:EC |
| 2917 | STORE_method_get_update_store_function 3354 EXIST:!VMS:FUNCTION: | 2917 | STORE_meth_get_update_store_fn 3354 NOEXIST::FUNCTION: |
| 2918 | STORE_meth_get_update_store_fn 3354 EXIST:VMS:FUNCTION: | 2918 | STORE_method_get_update_store_function 3354 NOEXIST::FUNCTION: |
| 2919 | ENGINE_register_ECDH 3355 EXIST::FUNCTION:ENGINE | 2919 | ENGINE_register_ECDH 3355 EXIST::FUNCTION:ENGINE |
| 2920 | SHA512_Update 3356 EXIST::FUNCTION:SHA,SHA512 | 2920 | SHA512_Update 3356 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 2921 | i2d_ECPrivateKey 3357 EXIST::FUNCTION:EC | 2921 | i2d_ECPrivateKey 3357 EXIST::FUNCTION:EC |
| 2922 | BN_get0_nist_prime_192 3358 EXIST::FUNCTION: | 2922 | BN_get0_nist_prime_192 3358 EXIST::FUNCTION: |
| 2923 | STORE_modify_certificate 3359 EXIST::FUNCTION: | 2923 | STORE_modify_certificate 3359 NOEXIST::FUNCTION: |
| 2924 | EC_POINT_set_affine_coordinates_GF2m 3360 EXIST:!VMS:FUNCTION:EC | 2924 | EC_POINT_set_affine_coordinates_GF2m 3360 EXIST:!VMS:FUNCTION:EC |
| 2925 | EC_POINT_set_affine_coords_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: | 2926 | BN_GF2m_mod_exp_arr 3361 EXIST::FUNCTION: |
| 2927 | STORE_ATTR_INFO_modify_number 3362 EXIST::FUNCTION: | 2927 | STORE_ATTR_INFO_modify_number 3362 NOEXIST::FUNCTION: |
| 2928 | X509_keyid_get0 3363 EXIST::FUNCTION: | 2928 | X509_keyid_get0 3363 EXIST::FUNCTION: |
| 2929 | ENGINE_load_gmp 3364 EXIST::FUNCTION:ENGINE,GMP,STATIC_ENGINE | 2929 | ENGINE_load_gmp 3364 EXIST::FUNCTION:ENGINE,GMP,STATIC_ENGINE |
| 2930 | pitem_new 3365 EXIST::FUNCTION: | 2930 | pitem_new 3365 EXIST::FUNCTION: |
| 2931 | BN_GF2m_mod_mul_arr 3366 EXIST::FUNCTION: | 2931 | BN_GF2m_mod_mul_arr 3366 EXIST::FUNCTION: |
| 2932 | STORE_list_public_key_endp 3367 EXIST::FUNCTION: | 2932 | STORE_list_public_key_endp 3367 NOEXIST::FUNCTION: |
| 2933 | o2i_ECPublicKey 3368 EXIST::FUNCTION:EC | 2933 | o2i_ECPublicKey 3368 EXIST::FUNCTION:EC |
| 2934 | EC_KEY_copy 3369 EXIST::FUNCTION:EC | 2934 | EC_KEY_copy 3369 EXIST::FUNCTION:EC |
| 2935 | BIO_dump_fp 3370 EXIST::FUNCTION:FP_API | 2935 | BIO_dump_fp 3370 EXIST::FUNCTION:FP_API |
| @@ -2938,25 +2938,25 @@ EC_GROUP_check_discriminant 3372 EXIST::FUNCTION:EC | |||
| 2938 | i2o_ECPublicKey 3373 EXIST::FUNCTION:EC | 2938 | i2o_ECPublicKey 3373 EXIST::FUNCTION:EC |
| 2939 | EC_KEY_precompute_mult 3374 EXIST::FUNCTION:EC | 2939 | EC_KEY_precompute_mult 3374 EXIST::FUNCTION:EC |
| 2940 | a2i_IPADDRESS 3375 EXIST::FUNCTION: | 2940 | a2i_IPADDRESS 3375 EXIST::FUNCTION: |
| 2941 | STORE_method_set_initialise_function 3376 EXIST:!VMS:FUNCTION: | 2941 | STORE_meth_set_initialise_fn 3376 NOEXIST::FUNCTION: |
| 2942 | STORE_meth_set_initialise_fn 3376 EXIST:VMS:FUNCTION: | 2942 | STORE_method_set_initialise_function 3376 NOEXIST::FUNCTION: |
| 2943 | X509_STORE_CTX_set_depth 3377 EXIST::FUNCTION: | 2943 | X509_STORE_CTX_set_depth 3377 EXIST::FUNCTION: |
| 2944 | X509_VERIFY_PARAM_inherit 3378 EXIST::FUNCTION: | 2944 | X509_VERIFY_PARAM_inherit 3378 EXIST::FUNCTION: |
| 2945 | EC_POINT_point2bn 3379 EXIST::FUNCTION:EC | 2945 | EC_POINT_point2bn 3379 EXIST::FUNCTION:EC |
| 2946 | STORE_ATTR_INFO_set_dn 3380 EXIST::FUNCTION: | 2946 | STORE_ATTR_INFO_set_dn 3380 NOEXIST::FUNCTION: |
| 2947 | X509_policy_tree_get0_policies 3381 EXIST::FUNCTION: | 2947 | X509_policy_tree_get0_policies 3381 EXIST::FUNCTION: |
| 2948 | EC_GROUP_new_curve_GF2m 3382 EXIST::FUNCTION:EC | 2948 | EC_GROUP_new_curve_GF2m 3382 EXIST::FUNCTION:EC |
| 2949 | STORE_destroy_method 3383 EXIST::FUNCTION: | 2949 | STORE_destroy_method 3383 NOEXIST::FUNCTION: |
| 2950 | ENGINE_unregister_STORE 3384 EXIST::FUNCTION:ENGINE | 2950 | ENGINE_unregister_STORE 3384 EXIST::FUNCTION:ENGINE |
| 2951 | EVP_PKEY_get1_EC_KEY 3385 EXIST::FUNCTION:EC | 2951 | EVP_PKEY_get1_EC_KEY 3385 EXIST::FUNCTION:EC |
| 2952 | STORE_ATTR_INFO_get0_number 3386 EXIST::FUNCTION: | 2952 | STORE_ATTR_INFO_get0_number 3386 NOEXIST::FUNCTION: |
| 2953 | ENGINE_get_default_ECDH 3387 EXIST::FUNCTION:ENGINE | 2953 | ENGINE_get_default_ECDH 3387 EXIST::FUNCTION:ENGINE |
| 2954 | EC_KEY_get_conv_form 3388 EXIST::FUNCTION:EC | 2954 | EC_KEY_get_conv_form 3388 EXIST::FUNCTION:EC |
| 2955 | ASN1_OCTET_STRING_NDEF_it 3389 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 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: | 2956 | ASN1_OCTET_STRING_NDEF_it 3389 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| 2957 | STORE_delete_public_key 3390 EXIST::FUNCTION: | 2957 | STORE_delete_public_key 3390 NOEXIST::FUNCTION: |
| 2958 | STORE_get_public_key 3391 EXIST::FUNCTION: | 2958 | STORE_get_public_key 3391 NOEXIST::FUNCTION: |
| 2959 | STORE_modify_arbitrary 3392 EXIST::FUNCTION: | 2959 | STORE_modify_arbitrary 3392 NOEXIST::FUNCTION: |
| 2960 | ENGINE_get_static_state 3393 EXIST::FUNCTION:ENGINE | 2960 | ENGINE_get_static_state 3393 EXIST::FUNCTION:ENGINE |
| 2961 | pqueue_iterator 3394 EXIST::FUNCTION: | 2961 | pqueue_iterator 3394 EXIST::FUNCTION: |
| 2962 | ECDSA_SIG_new 3395 EXIST::FUNCTION:ECDSA | 2962 | ECDSA_SIG_new 3395 EXIST::FUNCTION:ECDSA |
| @@ -2965,14 +2965,14 @@ BN_GF2m_mod_sqr 3397 EXIST::FUNCTION: | |||
| 2965 | EC_POINT_bn2point 3398 EXIST::FUNCTION:EC | 2965 | EC_POINT_bn2point 3398 EXIST::FUNCTION:EC |
| 2966 | X509_VERIFY_PARAM_set_depth 3399 EXIST::FUNCTION: | 2966 | X509_VERIFY_PARAM_set_depth 3399 EXIST::FUNCTION: |
| 2967 | EC_KEY_set_asn1_flag 3400 EXIST::FUNCTION:EC | 2967 | EC_KEY_set_asn1_flag 3400 EXIST::FUNCTION:EC |
| 2968 | STORE_get_method 3401 EXIST::FUNCTION: | 2968 | STORE_get_method 3401 NOEXIST::FUNCTION: |
| 2969 | EC_KEY_get_key_method_data 3402 EXIST::FUNCTION:EC | 2969 | EC_KEY_get_key_method_data 3402 EXIST::FUNCTION:EC |
| 2970 | ECDSA_sign_ex 3403 EXIST::FUNCTION:ECDSA | 2970 | ECDSA_sign_ex 3403 EXIST::FUNCTION:ECDSA |
| 2971 | STORE_parse_attrs_end 3404 EXIST::FUNCTION: | 2971 | STORE_parse_attrs_end 3404 NOEXIST::FUNCTION: |
| 2972 | EC_GROUP_get_point_conversion_form 3405 EXIST:!VMS:FUNCTION:EC | 2972 | EC_GROUP_get_point_conversion_form 3405 EXIST:!VMS:FUNCTION:EC |
| 2973 | EC_GROUP_get_point_conv_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 EXIST::FUNCTION: | 2974 | STORE_method_set_store_function 3406 NOEXIST::FUNCTION: |
| 2975 | STORE_ATTR_INFO_in 3407 EXIST::FUNCTION: | 2975 | STORE_ATTR_INFO_in 3407 NOEXIST::FUNCTION: |
| 2976 | PEM_read_bio_ECPKParameters 3408 EXIST::FUNCTION:EC | 2976 | PEM_read_bio_ECPKParameters 3408 EXIST::FUNCTION:EC |
| 2977 | EC_GROUP_get_pentanomial_basis 3409 EXIST::FUNCTION:EC | 2977 | EC_GROUP_get_pentanomial_basis 3409 EXIST::FUNCTION:EC |
| 2978 | EVP_PKEY_add1_attr_by_txt 3410 EXIST::FUNCTION: | 2978 | EVP_PKEY_add1_attr_by_txt 3410 EXIST::FUNCTION: |
| @@ -2980,7 +2980,7 @@ BN_BLINDING_set_flags 3411 EXIST::FUNCTION: | |||
| 2980 | X509_VERIFY_PARAM_set1_policies 3412 EXIST::FUNCTION: | 2980 | X509_VERIFY_PARAM_set1_policies 3412 EXIST::FUNCTION: |
| 2981 | X509_VERIFY_PARAM_set1_name 3413 EXIST::FUNCTION: | 2981 | X509_VERIFY_PARAM_set1_name 3413 EXIST::FUNCTION: |
| 2982 | X509_VERIFY_PARAM_set_purpose 3414 EXIST::FUNCTION: | 2982 | X509_VERIFY_PARAM_set_purpose 3414 EXIST::FUNCTION: |
| 2983 | STORE_get_number 3415 EXIST::FUNCTION: | 2983 | STORE_get_number 3415 NOEXIST::FUNCTION: |
| 2984 | ECDSA_sign_setup 3416 EXIST::FUNCTION:ECDSA | 2984 | ECDSA_sign_setup 3416 EXIST::FUNCTION:ECDSA |
| 2985 | BN_GF2m_mod_solve_quad_arr 3417 EXIST::FUNCTION: | 2985 | BN_GF2m_mod_solve_quad_arr 3417 EXIST::FUNCTION: |
| 2986 | EC_KEY_up_ref 3418 EXIST::FUNCTION:EC | 2986 | EC_KEY_up_ref 3418 EXIST::FUNCTION:EC |
| @@ -2988,14 +2988,14 @@ POLICY_MAPPING_free 3419 EXIST::FUNCTION: | |||
| 2988 | BN_GF2m_mod_div 3420 EXIST::FUNCTION: | 2988 | BN_GF2m_mod_div 3420 EXIST::FUNCTION: |
| 2989 | X509_VERIFY_PARAM_set_flags 3421 EXIST::FUNCTION: | 2989 | X509_VERIFY_PARAM_set_flags 3421 EXIST::FUNCTION: |
| 2990 | EC_KEY_free 3422 EXIST::FUNCTION:EC | 2990 | EC_KEY_free 3422 EXIST::FUNCTION:EC |
| 2991 | STORE_method_set_list_next_function 3423 EXIST:!VMS:FUNCTION: | 2991 | STORE_meth_set_list_next_fn 3423 NOEXIST::FUNCTION: |
| 2992 | STORE_meth_set_list_next_fn 3423 EXIST:VMS:FUNCTION: | 2992 | STORE_method_set_list_next_function 3423 NOEXIST::FUNCTION: |
| 2993 | PEM_write_bio_ECPrivateKey 3424 EXIST::FUNCTION:EC | 2993 | PEM_write_bio_ECPrivateKey 3424 EXIST::FUNCTION:EC |
| 2994 | d2i_EC_PUBKEY 3425 EXIST::FUNCTION:EC | 2994 | d2i_EC_PUBKEY 3425 EXIST::FUNCTION:EC |
| 2995 | STORE_method_get_generate_function 3426 EXIST:!VMS:FUNCTION: | 2995 | STORE_meth_get_generate_fn 3426 NOEXIST::FUNCTION: |
| 2996 | STORE_meth_get_generate_fn 3426 EXIST:VMS:FUNCTION: | 2996 | STORE_method_get_generate_function 3426 NOEXIST::FUNCTION: |
| 2997 | STORE_method_set_list_end_function 3427 EXIST:!VMS:FUNCTION: | 2997 | STORE_meth_set_list_end_fn 3427 NOEXIST::FUNCTION: |
| 2998 | STORE_meth_set_list_end_fn 3427 EXIST:VMS:FUNCTION: | 2998 | STORE_method_set_list_end_function 3427 NOEXIST::FUNCTION: |
| 2999 | pqueue_print 3428 EXIST::FUNCTION: | 2999 | pqueue_print 3428 EXIST::FUNCTION: |
| 3000 | EC_GROUP_have_precompute_mult 3429 EXIST::FUNCTION:EC | 3000 | EC_GROUP_have_precompute_mult 3429 EXIST::FUNCTION:EC |
| 3001 | EC_KEY_print_fp 3430 EXIST::FUNCTION:EC,FP_API | 3001 | EC_KEY_print_fp 3430 EXIST::FUNCTION:EC,FP_API |
| @@ -3003,8 +3003,8 @@ BN_GF2m_mod_arr 3431 EXIST::FUNCTION: | |||
| 3003 | PEM_write_bio_X509_CERT_PAIR 3432 EXIST::FUNCTION: | 3003 | PEM_write_bio_X509_CERT_PAIR 3432 EXIST::FUNCTION: |
| 3004 | EVP_PKEY_cmp 3433 EXIST::FUNCTION: | 3004 | EVP_PKEY_cmp 3433 EXIST::FUNCTION: |
| 3005 | X509_policy_level_node_count 3434 EXIST::FUNCTION: | 3005 | X509_policy_level_node_count 3434 EXIST::FUNCTION: |
| 3006 | STORE_new_engine 3435 EXIST::FUNCTION: | 3006 | STORE_new_engine 3435 NOEXIST::FUNCTION: |
| 3007 | STORE_list_public_key_start 3436 EXIST::FUNCTION: | 3007 | STORE_list_public_key_start 3436 NOEXIST::FUNCTION: |
| 3008 | X509_VERIFY_PARAM_new 3437 EXIST::FUNCTION: | 3008 | X509_VERIFY_PARAM_new 3437 EXIST::FUNCTION: |
| 3009 | ECDH_get_ex_data 3438 EXIST::FUNCTION:ECDH | 3009 | ECDH_get_ex_data 3438 EXIST::FUNCTION:ECDH |
| 3010 | EVP_PKEY_get_attr 3439 EXIST::FUNCTION: | 3010 | EVP_PKEY_get_attr 3439 EXIST::FUNCTION: |
| @@ -3014,11 +3014,11 @@ ECDH_OpenSSL 3442 EXIST::FUNCTION:ECDH | |||
| 3014 | EC_KEY_set_conv_form 3443 EXIST::FUNCTION:EC | 3014 | EC_KEY_set_conv_form 3443 EXIST::FUNCTION:EC |
| 3015 | EC_POINT_dup 3444 EXIST::FUNCTION:EC | 3015 | EC_POINT_dup 3444 EXIST::FUNCTION:EC |
| 3016 | GENERAL_SUBTREE_new 3445 EXIST::FUNCTION: | 3016 | GENERAL_SUBTREE_new 3445 EXIST::FUNCTION: |
| 3017 | STORE_list_crl_endp 3446 EXIST::FUNCTION: | 3017 | STORE_list_crl_endp 3446 NOEXIST::FUNCTION: |
| 3018 | EC_get_builtin_curves 3447 EXIST::FUNCTION:EC | 3018 | EC_get_builtin_curves 3447 EXIST::FUNCTION:EC |
| 3019 | X509_policy_node_get0_qualifiers 3448 EXIST:!VMS:FUNCTION: | 3019 | X509_policy_node_get0_qualifiers 3448 EXIST:!VMS:FUNCTION: |
| 3020 | X509_pcy_node_get0_qualifiers 3448 EXIST:VMS:FUNCTION: | 3020 | X509_pcy_node_get0_qualifiers 3448 EXIST:VMS:FUNCTION: |
| 3021 | STORE_list_crl_end 3449 EXIST::FUNCTION: | 3021 | STORE_list_crl_end 3449 NOEXIST::FUNCTION: |
| 3022 | EVP_PKEY_set1_EC_KEY 3450 EXIST::FUNCTION:EC | 3022 | EVP_PKEY_set1_EC_KEY 3450 EXIST::FUNCTION:EC |
| 3023 | BN_GF2m_mod_sqrt_arr 3451 EXIST::FUNCTION: | 3023 | BN_GF2m_mod_sqrt_arr 3451 EXIST::FUNCTION: |
| 3024 | i2d_ECPrivateKey_bio 3452 EXIST::FUNCTION:BIO,EC | 3024 | i2d_ECPrivateKey_bio 3452 EXIST::FUNCTION:BIO,EC |
| @@ -3026,60 +3026,60 @@ ECPKParameters_print_fp 3453 EXIST::FUNCTION:EC,FP_API | |||
| 3026 | pqueue_find 3454 EXIST::FUNCTION: | 3026 | pqueue_find 3454 EXIST::FUNCTION: |
| 3027 | ECDSA_SIG_free 3455 EXIST::FUNCTION:ECDSA | 3027 | ECDSA_SIG_free 3455 EXIST::FUNCTION:ECDSA |
| 3028 | PEM_write_bio_ECPKParameters 3456 EXIST::FUNCTION:EC | 3028 | PEM_write_bio_ECPKParameters 3456 EXIST::FUNCTION:EC |
| 3029 | STORE_method_set_ctrl_function 3457 EXIST::FUNCTION: | 3029 | STORE_method_set_ctrl_function 3457 NOEXIST::FUNCTION: |
| 3030 | STORE_list_public_key_end 3458 EXIST::FUNCTION: | 3030 | STORE_list_public_key_end 3458 NOEXIST::FUNCTION: |
| 3031 | EC_KEY_set_private_key 3459 EXIST::FUNCTION:EC | 3031 | EC_KEY_set_private_key 3459 EXIST::FUNCTION:EC |
| 3032 | pqueue_peek 3460 EXIST::FUNCTION: | 3032 | pqueue_peek 3460 EXIST::FUNCTION: |
| 3033 | STORE_get_arbitrary 3461 EXIST::FUNCTION: | 3033 | STORE_get_arbitrary 3461 NOEXIST::FUNCTION: |
| 3034 | STORE_store_crl 3462 EXIST::FUNCTION: | 3034 | STORE_store_crl 3462 NOEXIST::FUNCTION: |
| 3035 | X509_policy_node_get0_policy 3463 EXIST::FUNCTION: | 3035 | X509_policy_node_get0_policy 3463 EXIST::FUNCTION: |
| 3036 | PKCS12_add_safes 3464 EXIST::FUNCTION: | 3036 | PKCS12_add_safes 3464 EXIST::FUNCTION: |
| 3037 | BN_BLINDING_convert_ex 3465 EXIST::FUNCTION: | 3037 | BN_BLINDING_convert_ex 3465 EXIST::FUNCTION: |
| 3038 | X509_policy_tree_free 3466 EXIST::FUNCTION: | 3038 | X509_policy_tree_free 3466 EXIST::FUNCTION: |
| 3039 | OPENSSL_ia32cap_loc 3467 EXIST::FUNCTION: | 3039 | OPENSSL_ia32cap_loc 3467 EXIST::FUNCTION: |
| 3040 | BN_GF2m_poly2arr 3468 EXIST::FUNCTION: | 3040 | BN_GF2m_poly2arr 3468 EXIST::FUNCTION: |
| 3041 | STORE_ctrl 3469 EXIST::FUNCTION: | 3041 | STORE_ctrl 3469 NOEXIST::FUNCTION: |
| 3042 | STORE_ATTR_INFO_compare 3470 EXIST::FUNCTION: | 3042 | STORE_ATTR_INFO_compare 3470 NOEXIST::FUNCTION: |
| 3043 | BN_get0_nist_prime_224 3471 EXIST::FUNCTION: | 3043 | BN_get0_nist_prime_224 3471 EXIST::FUNCTION: |
| 3044 | i2d_ECParameters 3472 EXIST::FUNCTION:EC | 3044 | i2d_ECParameters 3472 EXIST::FUNCTION:EC |
| 3045 | i2d_ECPKParameters 3473 EXIST::FUNCTION:EC | 3045 | i2d_ECPKParameters 3473 EXIST::FUNCTION:EC |
| 3046 | BN_GENCB_call 3474 EXIST::FUNCTION: | 3046 | BN_GENCB_call 3474 EXIST::FUNCTION: |
| 3047 | d2i_ECPKParameters 3475 EXIST::FUNCTION:EC | 3047 | d2i_ECPKParameters 3475 EXIST::FUNCTION:EC |
| 3048 | STORE_method_set_generate_function 3476 EXIST:!VMS:FUNCTION: | 3048 | STORE_meth_set_generate_fn 3476 NOEXIST::FUNCTION: |
| 3049 | STORE_meth_set_generate_fn 3476 EXIST:VMS:FUNCTION: | 3049 | STORE_method_set_generate_function 3476 NOEXIST::FUNCTION: |
| 3050 | ENGINE_set_ECDH 3477 EXIST::FUNCTION:ENGINE | 3050 | ENGINE_set_ECDH 3477 EXIST::FUNCTION:ENGINE |
| 3051 | NAME_CONSTRAINTS_new 3478 EXIST::FUNCTION: | 3051 | NAME_CONSTRAINTS_new 3478 EXIST::FUNCTION: |
| 3052 | SHA256_Init 3479 EXIST::FUNCTION:SHA,SHA256 | 3052 | SHA256_Init 3479 EXIST::FUNCTION:SHA,SHA256 |
| 3053 | EC_KEY_get0_public_key 3480 EXIST::FUNCTION:EC | 3053 | EC_KEY_get0_public_key 3480 EXIST::FUNCTION:EC |
| 3054 | PEM_write_bio_EC_PUBKEY 3481 EXIST::FUNCTION:EC | 3054 | PEM_write_bio_EC_PUBKEY 3481 EXIST::FUNCTION:EC |
| 3055 | STORE_ATTR_INFO_set_cstr 3482 EXIST::FUNCTION: | 3055 | STORE_ATTR_INFO_set_cstr 3482 NOEXIST::FUNCTION: |
| 3056 | STORE_list_crl_next 3483 EXIST::FUNCTION: | 3056 | STORE_list_crl_next 3483 NOEXIST::FUNCTION: |
| 3057 | STORE_ATTR_INFO_in_range 3484 EXIST::FUNCTION: | 3057 | STORE_ATTR_INFO_in_range 3484 NOEXIST::FUNCTION: |
| 3058 | ECParameters_print 3485 EXIST::FUNCTION:BIO,EC | 3058 | ECParameters_print 3485 EXIST::FUNCTION:BIO,EC |
| 3059 | STORE_method_set_delete_function 3486 EXIST:!VMS:FUNCTION: | 3059 | STORE_meth_set_delete_fn 3486 NOEXIST::FUNCTION: |
| 3060 | STORE_meth_set_delete_fn 3486 EXIST:VMS:FUNCTION: | 3060 | STORE_method_set_delete_function 3486 NOEXIST::FUNCTION: |
| 3061 | STORE_list_certificate_next 3487 EXIST::FUNCTION: | 3061 | STORE_list_certificate_next 3487 NOEXIST::FUNCTION: |
| 3062 | ASN1_generate_nconf 3488 EXIST::FUNCTION: | 3062 | ASN1_generate_nconf 3488 EXIST::FUNCTION: |
| 3063 | BUF_memdup 3489 EXIST::FUNCTION: | 3063 | BUF_memdup 3489 EXIST::FUNCTION: |
| 3064 | BN_GF2m_mod_mul 3490 EXIST::FUNCTION: | 3064 | BN_GF2m_mod_mul 3490 EXIST::FUNCTION: |
| 3065 | STORE_method_get_list_next_function 3491 EXIST:!VMS:FUNCTION: | 3065 | STORE_meth_get_list_next_fn 3491 NOEXIST::FUNCTION: |
| 3066 | STORE_meth_get_list_next_fn 3491 EXIST:VMS:FUNCTION: | 3066 | STORE_method_get_list_next_function 3491 NOEXIST::FUNCTION: |
| 3067 | STORE_ATTR_INFO_get0_dn 3492 EXIST::FUNCTION: | 3067 | STORE_ATTR_INFO_get0_dn 3492 NOEXIST::FUNCTION: |
| 3068 | STORE_list_private_key_next 3493 EXIST::FUNCTION: | 3068 | STORE_list_private_key_next 3493 NOEXIST::FUNCTION: |
| 3069 | EC_GROUP_set_seed 3494 EXIST::FUNCTION:EC | 3069 | EC_GROUP_set_seed 3494 EXIST::FUNCTION:EC |
| 3070 | X509_VERIFY_PARAM_set_trust 3495 EXIST::FUNCTION: | 3070 | X509_VERIFY_PARAM_set_trust 3495 EXIST::FUNCTION: |
| 3071 | STORE_ATTR_INFO_free 3496 EXIST::FUNCTION: | 3071 | STORE_ATTR_INFO_free 3496 NOEXIST::FUNCTION: |
| 3072 | STORE_get_private_key 3497 EXIST::FUNCTION: | 3072 | STORE_get_private_key 3497 NOEXIST::FUNCTION: |
| 3073 | EVP_PKEY_get_attr_count 3498 EXIST::FUNCTION: | 3073 | EVP_PKEY_get_attr_count 3498 EXIST::FUNCTION: |
| 3074 | STORE_ATTR_INFO_new 3499 EXIST::FUNCTION: | 3074 | STORE_ATTR_INFO_new 3499 NOEXIST::FUNCTION: |
| 3075 | EC_GROUP_get_curve_GF2m 3500 EXIST::FUNCTION:EC | 3075 | EC_GROUP_get_curve_GF2m 3500 EXIST::FUNCTION:EC |
| 3076 | STORE_method_set_revoke_function 3501 EXIST:!VMS:FUNCTION: | 3076 | STORE_meth_set_revoke_fn 3501 NOEXIST::FUNCTION: |
| 3077 | STORE_meth_set_revoke_fn 3501 EXIST:VMS:FUNCTION: | 3077 | STORE_method_set_revoke_function 3501 NOEXIST::FUNCTION: |
| 3078 | STORE_store_number 3502 EXIST::FUNCTION: | 3078 | STORE_store_number 3502 NOEXIST::FUNCTION: |
| 3079 | BN_is_prime_ex 3503 EXIST::FUNCTION: | 3079 | BN_is_prime_ex 3503 EXIST::FUNCTION: |
| 3080 | STORE_revoke_public_key 3504 EXIST::FUNCTION: | 3080 | STORE_revoke_public_key 3504 NOEXIST::FUNCTION: |
| 3081 | X509_STORE_CTX_get0_param 3505 EXIST::FUNCTION: | 3081 | X509_STORE_CTX_get0_param 3505 EXIST::FUNCTION: |
| 3082 | STORE_delete_arbitrary 3506 EXIST::FUNCTION: | 3082 | STORE_delete_arbitrary 3506 NOEXIST::FUNCTION: |
| 3083 | PEM_read_X509_CERT_PAIR 3507 EXIST:!WIN16:FUNCTION: | 3083 | PEM_read_X509_CERT_PAIR 3507 EXIST:!WIN16:FUNCTION: |
| 3084 | X509_STORE_set_depth 3508 EXIST::FUNCTION: | 3084 | X509_STORE_set_depth 3508 EXIST::FUNCTION: |
| 3085 | ECDSA_get_ex_data 3509 EXIST::FUNCTION:ECDSA | 3085 | ECDSA_get_ex_data 3509 EXIST::FUNCTION:ECDSA |
| @@ -3087,40 +3087,40 @@ SHA224 3510 EXIST::FUNCTION:SHA,SHA256 | |||
| 3087 | BIO_dump_indent_fp 3511 EXIST::FUNCTION:FP_API | 3087 | BIO_dump_indent_fp 3511 EXIST::FUNCTION:FP_API |
| 3088 | EC_KEY_set_group 3512 EXIST::FUNCTION:EC | 3088 | EC_KEY_set_group 3512 EXIST::FUNCTION:EC |
| 3089 | BUF_strndup 3513 EXIST::FUNCTION: | 3089 | BUF_strndup 3513 EXIST::FUNCTION: |
| 3090 | STORE_list_certificate_start 3514 EXIST::FUNCTION: | 3090 | STORE_list_certificate_start 3514 NOEXIST::FUNCTION: |
| 3091 | BN_GF2m_mod 3515 EXIST::FUNCTION: | 3091 | BN_GF2m_mod 3515 EXIST::FUNCTION: |
| 3092 | X509_REQ_check_private_key 3516 EXIST::FUNCTION: | 3092 | X509_REQ_check_private_key 3516 EXIST::FUNCTION: |
| 3093 | EC_GROUP_get_seed_len 3517 EXIST::FUNCTION:EC | 3093 | EC_GROUP_get_seed_len 3517 EXIST::FUNCTION:EC |
| 3094 | ERR_load_STORE_strings 3518 EXIST::FUNCTION: | 3094 | ERR_load_STORE_strings 3518 NOEXIST::FUNCTION: |
| 3095 | PEM_read_bio_EC_PUBKEY 3519 EXIST::FUNCTION:EC | 3095 | PEM_read_bio_EC_PUBKEY 3519 EXIST::FUNCTION:EC |
| 3096 | STORE_list_private_key_end 3520 EXIST::FUNCTION: | 3096 | STORE_list_private_key_end 3520 NOEXIST::FUNCTION: |
| 3097 | i2d_EC_PUBKEY 3521 EXIST::FUNCTION:EC | 3097 | i2d_EC_PUBKEY 3521 EXIST::FUNCTION:EC |
| 3098 | ECDSA_get_default_method 3522 EXIST::FUNCTION:ECDSA | 3098 | ECDSA_get_default_method 3522 EXIST::FUNCTION:ECDSA |
| 3099 | ASN1_put_eoc 3523 EXIST::FUNCTION: | 3099 | ASN1_put_eoc 3523 EXIST::FUNCTION: |
| 3100 | X509_STORE_CTX_get_explicit_policy 3524 EXIST:!VMS:FUNCTION: | 3100 | X509_STORE_CTX_get_explicit_policy 3524 EXIST:!VMS:FUNCTION: |
| 3101 | X509_STORE_CTX_get_expl_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: | 3102 | X509_VERIFY_PARAM_table_cleanup 3525 EXIST::FUNCTION: |
| 3103 | STORE_modify_private_key 3526 EXIST::FUNCTION: | 3103 | STORE_modify_private_key 3526 NOEXIST::FUNCTION: |
| 3104 | X509_VERIFY_PARAM_free 3527 EXIST::FUNCTION: | 3104 | X509_VERIFY_PARAM_free 3527 EXIST::FUNCTION: |
| 3105 | EC_METHOD_get_field_type 3528 EXIST::FUNCTION:EC | 3105 | EC_METHOD_get_field_type 3528 EXIST::FUNCTION:EC |
| 3106 | EC_GFp_nist_method 3529 EXIST::FUNCTION:EC | 3106 | EC_GFp_nist_method 3529 EXIST::FUNCTION:EC |
| 3107 | STORE_method_set_modify_function 3530 EXIST:!VMS:FUNCTION: | 3107 | STORE_meth_set_modify_fn 3530 NOEXIST::FUNCTION: |
| 3108 | STORE_meth_set_modify_fn 3530 EXIST:VMS:FUNCTION: | 3108 | STORE_method_set_modify_function 3530 NOEXIST::FUNCTION: |
| 3109 | STORE_parse_attrs_next 3531 EXIST::FUNCTION: | 3109 | STORE_parse_attrs_next 3531 NOEXIST::FUNCTION: |
| 3110 | ENGINE_load_padlock 3532 EXIST::FUNCTION:ENGINE | 3110 | ENGINE_load_padlock 3532 EXIST::FUNCTION:ENGINE,STATIC_ENGINE |
| 3111 | EC_GROUP_set_curve_name 3533 EXIST::FUNCTION:EC | 3111 | EC_GROUP_set_curve_name 3533 EXIST::FUNCTION:EC |
| 3112 | X509_CERT_PAIR_it 3534 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 3112 | X509_CERT_PAIR_it 3534 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
| 3113 | X509_CERT_PAIR_it 3534 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 3113 | X509_CERT_PAIR_it 3534 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| 3114 | STORE_method_get_revoke_function 3535 EXIST:!VMS:FUNCTION: | 3114 | STORE_meth_get_revoke_fn 3535 NOEXIST::FUNCTION: |
| 3115 | STORE_meth_get_revoke_fn 3535 EXIST:VMS:FUNCTION: | 3115 | STORE_method_get_revoke_function 3535 NOEXIST::FUNCTION: |
| 3116 | STORE_method_set_get_function 3536 EXIST::FUNCTION: | 3116 | STORE_method_set_get_function 3536 NOEXIST::FUNCTION: |
| 3117 | STORE_modify_number 3537 EXIST::FUNCTION: | 3117 | STORE_modify_number 3537 NOEXIST::FUNCTION: |
| 3118 | STORE_method_get_store_function 3538 EXIST::FUNCTION: | 3118 | STORE_method_get_store_function 3538 NOEXIST::FUNCTION: |
| 3119 | STORE_store_private_key 3539 EXIST::FUNCTION: | 3119 | STORE_store_private_key 3539 NOEXIST::FUNCTION: |
| 3120 | BN_GF2m_mod_sqr_arr 3540 EXIST::FUNCTION: | 3120 | BN_GF2m_mod_sqr_arr 3540 EXIST::FUNCTION: |
| 3121 | RSA_setup_blinding 3541 EXIST::FUNCTION:RSA | 3121 | RSA_setup_blinding 3541 EXIST::FUNCTION:RSA |
| 3122 | BIO_s_datagram 3542 EXIST::FUNCTION:DGRAM | 3122 | BIO_s_datagram 3542 EXIST::FUNCTION:DGRAM |
| 3123 | STORE_Memory 3543 EXIST::FUNCTION: | 3123 | STORE_Memory 3543 NOEXIST::FUNCTION: |
| 3124 | sk_find_ex 3544 EXIST::FUNCTION: | 3124 | sk_find_ex 3544 EXIST::FUNCTION: |
| 3125 | EC_GROUP_set_curve_GF2m 3545 EXIST::FUNCTION:EC | 3125 | EC_GROUP_set_curve_GF2m 3545 EXIST::FUNCTION:EC |
| 3126 | ENGINE_set_default_ECDSA 3546 EXIST::FUNCTION:ENGINE | 3126 | ENGINE_set_default_ECDSA 3546 EXIST::FUNCTION:ENGINE |
| @@ -3128,69 +3128,69 @@ POLICY_CONSTRAINTS_new 3547 EXIST::FUNCTION: | |||
| 3128 | BN_GF2m_mod_sqrt 3548 EXIST::FUNCTION: | 3128 | BN_GF2m_mod_sqrt 3548 EXIST::FUNCTION: |
| 3129 | ECDH_set_default_method 3549 EXIST::FUNCTION:ECDH | 3129 | ECDH_set_default_method 3549 EXIST::FUNCTION:ECDH |
| 3130 | EC_KEY_generate_key 3550 EXIST::FUNCTION:EC | 3130 | EC_KEY_generate_key 3550 EXIST::FUNCTION:EC |
| 3131 | SHA384_Update 3551 EXIST::FUNCTION:SHA,SHA512 | 3131 | SHA384_Update 3551 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 3132 | BN_GF2m_arr2poly 3552 EXIST::FUNCTION: | 3132 | BN_GF2m_arr2poly 3552 EXIST::FUNCTION: |
| 3133 | STORE_method_get_get_function 3553 EXIST::FUNCTION: | 3133 | STORE_method_get_get_function 3553 NOEXIST::FUNCTION: |
| 3134 | STORE_method_set_cleanup_function 3554 EXIST:!VMS:FUNCTION: | 3134 | STORE_meth_set_cleanup_fn 3554 NOEXIST::FUNCTION: |
| 3135 | STORE_meth_set_cleanup_fn 3554 EXIST:VMS:FUNCTION: | 3135 | STORE_method_set_cleanup_function 3554 NOEXIST::FUNCTION: |
| 3136 | EC_GROUP_check 3555 EXIST::FUNCTION:EC | 3136 | EC_GROUP_check 3555 EXIST::FUNCTION:EC |
| 3137 | d2i_ECPrivateKey_bio 3556 EXIST::FUNCTION:BIO,EC | 3137 | d2i_ECPrivateKey_bio 3556 EXIST::FUNCTION:BIO,EC |
| 3138 | EC_KEY_insert_key_method_data 3557 EXIST::FUNCTION:EC | 3138 | EC_KEY_insert_key_method_data 3557 EXIST::FUNCTION:EC |
| 3139 | STORE_method_get_lock_store_function 3558 EXIST:!VMS:FUNCTION: | 3139 | STORE_meth_get_lock_store_fn 3558 NOEXIST::FUNCTION: |
| 3140 | STORE_meth_get_lock_store_fn 3558 EXIST:VMS:FUNCTION: | 3140 | STORE_method_get_lock_store_function 3558 NOEXIST::FUNCTION: |
| 3141 | X509_VERIFY_PARAM_get_depth 3559 EXIST::FUNCTION: | 3141 | X509_VERIFY_PARAM_get_depth 3559 EXIST::FUNCTION: |
| 3142 | SHA224_Final 3560 EXIST::FUNCTION:SHA,SHA256 | 3142 | SHA224_Final 3560 EXIST::FUNCTION:SHA,SHA256 |
| 3143 | STORE_method_set_update_store_function 3561 EXIST:!VMS:FUNCTION: | 3143 | STORE_meth_set_update_store_fn 3561 NOEXIST::FUNCTION: |
| 3144 | STORE_meth_set_update_store_fn 3561 EXIST:VMS:FUNCTION: | 3144 | STORE_method_set_update_store_function 3561 NOEXIST::FUNCTION: |
| 3145 | SHA224_Update 3562 EXIST::FUNCTION:SHA,SHA256 | 3145 | SHA224_Update 3562 EXIST::FUNCTION:SHA,SHA256 |
| 3146 | d2i_ECPrivateKey 3563 EXIST::FUNCTION:EC | 3146 | d2i_ECPrivateKey 3563 EXIST::FUNCTION:EC |
| 3147 | ASN1_item_ndef_i2d 3564 EXIST::FUNCTION: | 3147 | ASN1_item_ndef_i2d 3564 EXIST::FUNCTION: |
| 3148 | STORE_delete_private_key 3565 EXIST::FUNCTION: | 3148 | STORE_delete_private_key 3565 NOEXIST::FUNCTION: |
| 3149 | ERR_pop_to_mark 3566 EXIST::FUNCTION: | 3149 | ERR_pop_to_mark 3566 EXIST::FUNCTION: |
| 3150 | ENGINE_register_all_STORE 3567 EXIST::FUNCTION:ENGINE | 3150 | ENGINE_register_all_STORE 3567 EXIST::FUNCTION:ENGINE |
| 3151 | X509_policy_level_get0_node 3568 EXIST::FUNCTION: | 3151 | X509_policy_level_get0_node 3568 EXIST::FUNCTION: |
| 3152 | i2d_PKCS7_NDEF 3569 EXIST::FUNCTION: | 3152 | i2d_PKCS7_NDEF 3569 EXIST::FUNCTION: |
| 3153 | EC_GROUP_get_degree 3570 EXIST::FUNCTION:EC | 3153 | EC_GROUP_get_degree 3570 EXIST::FUNCTION:EC |
| 3154 | ASN1_generate_v3 3571 EXIST::FUNCTION: | 3154 | ASN1_generate_v3 3571 EXIST::FUNCTION: |
| 3155 | STORE_ATTR_INFO_modify_cstr 3572 EXIST::FUNCTION: | 3155 | STORE_ATTR_INFO_modify_cstr 3572 NOEXIST::FUNCTION: |
| 3156 | X509_policy_tree_level_count 3573 EXIST::FUNCTION: | 3156 | X509_policy_tree_level_count 3573 EXIST::FUNCTION: |
| 3157 | BN_GF2m_add 3574 EXIST::FUNCTION: | 3157 | BN_GF2m_add 3574 EXIST::FUNCTION: |
| 3158 | EC_KEY_get0_group 3575 EXIST::FUNCTION:EC | 3158 | EC_KEY_get0_group 3575 EXIST::FUNCTION:EC |
| 3159 | STORE_generate_crl 3576 EXIST::FUNCTION: | 3159 | STORE_generate_crl 3576 NOEXIST::FUNCTION: |
| 3160 | STORE_store_public_key 3577 EXIST::FUNCTION: | 3160 | STORE_store_public_key 3577 NOEXIST::FUNCTION: |
| 3161 | X509_CERT_PAIR_free 3578 EXIST::FUNCTION: | 3161 | X509_CERT_PAIR_free 3578 EXIST::FUNCTION: |
| 3162 | STORE_revoke_private_key 3579 EXIST::FUNCTION: | 3162 | STORE_revoke_private_key 3579 NOEXIST::FUNCTION: |
| 3163 | BN_nist_mod_224 3580 EXIST::FUNCTION: | 3163 | BN_nist_mod_224 3580 EXIST::FUNCTION: |
| 3164 | SHA512_Final 3581 EXIST::FUNCTION:SHA,SHA512 | 3164 | SHA512_Final 3581 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 3165 | STORE_ATTR_INFO_modify_dn 3582 EXIST::FUNCTION: | 3165 | STORE_ATTR_INFO_modify_dn 3582 NOEXIST::FUNCTION: |
| 3166 | STORE_method_get_initialise_function 3583 EXIST:!VMS:FUNCTION: | 3166 | STORE_meth_get_initialise_fn 3583 NOEXIST::FUNCTION: |
| 3167 | STORE_meth_get_initialise_fn 3583 EXIST:VMS:FUNCTION: | 3167 | STORE_method_get_initialise_function 3583 NOEXIST::FUNCTION: |
| 3168 | STORE_delete_number 3584 EXIST::FUNCTION: | 3168 | STORE_delete_number 3584 NOEXIST::FUNCTION: |
| 3169 | i2d_EC_PUBKEY_bio 3585 EXIST::FUNCTION:BIO,EC | 3169 | i2d_EC_PUBKEY_bio 3585 EXIST::FUNCTION:BIO,EC |
| 3170 | BIO_dgram_non_fatal_error 3586 EXIST::FUNCTION: | 3170 | BIO_dgram_non_fatal_error 3586 EXIST::FUNCTION: |
| 3171 | EC_GROUP_get_asn1_flag 3587 EXIST::FUNCTION:EC | 3171 | EC_GROUP_get_asn1_flag 3587 EXIST::FUNCTION:EC |
| 3172 | STORE_ATTR_INFO_in_ex 3588 EXIST::FUNCTION: | 3172 | STORE_ATTR_INFO_in_ex 3588 NOEXIST::FUNCTION: |
| 3173 | STORE_list_crl_start 3589 EXIST::FUNCTION: | 3173 | STORE_list_crl_start 3589 NOEXIST::FUNCTION: |
| 3174 | ECDH_get_ex_new_index 3590 EXIST::FUNCTION:ECDH | 3174 | ECDH_get_ex_new_index 3590 EXIST::FUNCTION:ECDH |
| 3175 | STORE_method_get_modify_function 3591 EXIST:!VMS:FUNCTION: | 3175 | STORE_meth_get_modify_fn 3591 NOEXIST::FUNCTION: |
| 3176 | STORE_meth_get_modify_fn 3591 EXIST:VMS:FUNCTION: | 3176 | STORE_method_get_modify_function 3591 NOEXIST::FUNCTION: |
| 3177 | v2i_ASN1_BIT_STRING 3592 EXIST::FUNCTION: | 3177 | v2i_ASN1_BIT_STRING 3592 EXIST::FUNCTION: |
| 3178 | STORE_store_certificate 3593 EXIST::FUNCTION: | 3178 | STORE_store_certificate 3593 NOEXIST::FUNCTION: |
| 3179 | OBJ_bsearch_ex 3594 EXIST::FUNCTION: | 3179 | OBJ_bsearch_ex 3594 NOEXIST::FUNCTION: |
| 3180 | X509_STORE_CTX_set_default 3595 EXIST::FUNCTION: | 3180 | X509_STORE_CTX_set_default 3595 EXIST::FUNCTION: |
| 3181 | STORE_ATTR_INFO_set_sha1str 3596 EXIST::FUNCTION: | 3181 | STORE_ATTR_INFO_set_sha1str 3596 NOEXIST::FUNCTION: |
| 3182 | BN_GF2m_mod_inv 3597 EXIST::FUNCTION: | 3182 | BN_GF2m_mod_inv 3597 EXIST::FUNCTION: |
| 3183 | BN_GF2m_mod_exp 3598 EXIST::FUNCTION: | 3183 | BN_GF2m_mod_exp 3598 EXIST::FUNCTION: |
| 3184 | STORE_modify_public_key 3599 EXIST::FUNCTION: | 3184 | STORE_modify_public_key 3599 NOEXIST::FUNCTION: |
| 3185 | STORE_method_get_list_start_function 3600 EXIST:!VMS:FUNCTION: | 3185 | STORE_meth_get_list_start_fn 3600 NOEXIST::FUNCTION: |
| 3186 | STORE_meth_get_list_start_fn 3600 EXIST:VMS:FUNCTION: | 3186 | STORE_method_get_list_start_function 3600 NOEXIST::FUNCTION: |
| 3187 | EC_GROUP_get0_seed 3601 EXIST::FUNCTION:EC | 3187 | EC_GROUP_get0_seed 3601 EXIST::FUNCTION:EC |
| 3188 | STORE_store_arbitrary 3602 EXIST::FUNCTION: | 3188 | STORE_store_arbitrary 3602 NOEXIST::FUNCTION: |
| 3189 | STORE_method_set_unlock_store_function 3603 EXIST:!VMS:FUNCTION: | 3189 | STORE_meth_set_unlock_store_fn 3603 NOEXIST::FUNCTION: |
| 3190 | STORE_meth_set_unlock_store_fn 3603 EXIST:VMS:FUNCTION: | 3190 | STORE_method_set_unlock_store_function 3603 NOEXIST::FUNCTION: |
| 3191 | BN_GF2m_mod_div_arr 3604 EXIST::FUNCTION: | 3191 | BN_GF2m_mod_div_arr 3604 EXIST::FUNCTION: |
| 3192 | ENGINE_set_ECDSA 3605 EXIST::FUNCTION:ENGINE | 3192 | ENGINE_set_ECDSA 3605 EXIST::FUNCTION:ENGINE |
| 3193 | STORE_create_method 3606 EXIST::FUNCTION: | 3193 | STORE_create_method 3606 NOEXIST::FUNCTION: |
| 3194 | ECPKParameters_print 3607 EXIST::FUNCTION:BIO,EC | 3194 | ECPKParameters_print 3607 EXIST::FUNCTION:BIO,EC |
| 3195 | EC_KEY_get0_private_key 3608 EXIST::FUNCTION:EC | 3195 | EC_KEY_get0_private_key 3608 EXIST::FUNCTION:EC |
| 3196 | PEM_write_EC_PUBKEY 3609 EXIST:!WIN16:FUNCTION:EC | 3196 | PEM_write_EC_PUBKEY 3609 EXIST:!WIN16:FUNCTION:EC |
| @@ -3198,7 +3198,7 @@ X509_VERIFY_PARAM_set1 3610 EXIST::FUNCTION: | |||
| 3198 | ECDH_set_method 3611 EXIST::FUNCTION:ECDH | 3198 | ECDH_set_method 3611 EXIST::FUNCTION:ECDH |
| 3199 | v2i_GENERAL_NAME_ex 3612 EXIST::FUNCTION: | 3199 | v2i_GENERAL_NAME_ex 3612 EXIST::FUNCTION: |
| 3200 | ECDH_set_ex_data 3613 EXIST::FUNCTION:ECDH | 3200 | ECDH_set_ex_data 3613 EXIST::FUNCTION:ECDH |
| 3201 | STORE_generate_key 3614 EXIST::FUNCTION: | 3201 | STORE_generate_key 3614 NOEXIST::FUNCTION: |
| 3202 | BN_nist_mod_521 3615 EXIST::FUNCTION: | 3202 | BN_nist_mod_521 3615 EXIST::FUNCTION: |
| 3203 | X509_policy_tree_get0_level 3616 EXIST::FUNCTION: | 3203 | X509_policy_tree_get0_level 3616 EXIST::FUNCTION: |
| 3204 | EC_GROUP_set_point_conversion_form 3617 EXIST:!VMS:FUNCTION:EC | 3204 | EC_GROUP_set_point_conversion_form 3617 EXIST:!VMS:FUNCTION:EC |
| @@ -3206,7 +3206,7 @@ EC_GROUP_set_point_conv_form 3617 EXIST:VMS:FUNCTION:EC | |||
| 3206 | PEM_read_EC_PUBKEY 3618 EXIST:!WIN16:FUNCTION:EC | 3206 | PEM_read_EC_PUBKEY 3618 EXIST:!WIN16:FUNCTION:EC |
| 3207 | i2d_ECDSA_SIG 3619 EXIST::FUNCTION:ECDSA | 3207 | i2d_ECDSA_SIG 3619 EXIST::FUNCTION:ECDSA |
| 3208 | ECDSA_OpenSSL 3620 EXIST::FUNCTION:ECDSA | 3208 | ECDSA_OpenSSL 3620 EXIST::FUNCTION:ECDSA |
| 3209 | STORE_delete_crl 3621 EXIST::FUNCTION: | 3209 | STORE_delete_crl 3621 NOEXIST::FUNCTION: |
| 3210 | EC_KEY_get_enc_flags 3622 EXIST::FUNCTION:EC | 3210 | EC_KEY_get_enc_flags 3622 EXIST::FUNCTION:EC |
| 3211 | ASN1_const_check_infinite_end 3623 EXIST::FUNCTION: | 3211 | ASN1_const_check_infinite_end 3623 EXIST::FUNCTION: |
| 3212 | EVP_PKEY_delete_attr 3624 EXIST::FUNCTION: | 3212 | EVP_PKEY_delete_attr 3624 EXIST::FUNCTION: |
| @@ -3214,31 +3214,31 @@ ECDSA_set_default_method 3625 EXIST::FUNCTION:ECDSA | |||
| 3214 | EC_POINT_set_compressed_coordinates_GF2m 3626 EXIST:!VMS:FUNCTION:EC | 3214 | EC_POINT_set_compressed_coordinates_GF2m 3626 EXIST:!VMS:FUNCTION:EC |
| 3215 | EC_POINT_set_compr_coords_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 | 3216 | EC_GROUP_cmp 3627 EXIST::FUNCTION:EC |
| 3217 | STORE_revoke_certificate 3628 EXIST::FUNCTION: | 3217 | STORE_revoke_certificate 3628 NOEXIST::FUNCTION: |
| 3218 | BN_get0_nist_prime_256 3629 EXIST::FUNCTION: | 3218 | BN_get0_nist_prime_256 3629 EXIST::FUNCTION: |
| 3219 | STORE_method_get_delete_function 3630 EXIST:!VMS:FUNCTION: | 3219 | STORE_meth_get_delete_fn 3630 NOEXIST::FUNCTION: |
| 3220 | STORE_meth_get_delete_fn 3630 EXIST:VMS:FUNCTION: | 3220 | STORE_method_get_delete_function 3630 NOEXIST::FUNCTION: |
| 3221 | SHA224_Init 3631 EXIST::FUNCTION:SHA,SHA256 | 3221 | SHA224_Init 3631 EXIST::FUNCTION:SHA,SHA256 |
| 3222 | PEM_read_ECPrivateKey 3632 EXIST:!WIN16:FUNCTION:EC | 3222 | PEM_read_ECPrivateKey 3632 EXIST:!WIN16:FUNCTION:EC |
| 3223 | SHA512_Init 3633 EXIST::FUNCTION:SHA,SHA512 | 3223 | SHA512_Init 3633 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 3224 | STORE_parse_attrs_endp 3634 EXIST::FUNCTION: | 3224 | STORE_parse_attrs_endp 3634 NOEXIST::FUNCTION: |
| 3225 | BN_set_negative 3635 EXIST::FUNCTION: | 3225 | BN_set_negative 3635 EXIST::FUNCTION: |
| 3226 | ERR_load_ECDSA_strings 3636 EXIST::FUNCTION:ECDSA | 3226 | ERR_load_ECDSA_strings 3636 EXIST::FUNCTION:ECDSA |
| 3227 | EC_GROUP_get_basis_type 3637 EXIST::FUNCTION:EC | 3227 | EC_GROUP_get_basis_type 3637 EXIST::FUNCTION:EC |
| 3228 | STORE_list_public_key_next 3638 EXIST::FUNCTION: | 3228 | STORE_list_public_key_next 3638 NOEXIST::FUNCTION: |
| 3229 | i2v_ASN1_BIT_STRING 3639 EXIST::FUNCTION: | 3229 | i2v_ASN1_BIT_STRING 3639 EXIST::FUNCTION: |
| 3230 | STORE_OBJECT_free 3640 EXIST::FUNCTION: | 3230 | STORE_OBJECT_free 3640 NOEXIST::FUNCTION: |
| 3231 | BN_nist_mod_384 3641 EXIST::FUNCTION: | 3231 | BN_nist_mod_384 3641 EXIST::FUNCTION: |
| 3232 | i2d_X509_CERT_PAIR 3642 EXIST::FUNCTION: | 3232 | i2d_X509_CERT_PAIR 3642 EXIST::FUNCTION: |
| 3233 | PEM_write_ECPKParameters 3643 EXIST:!WIN16:FUNCTION:EC | 3233 | PEM_write_ECPKParameters 3643 EXIST:!WIN16:FUNCTION:EC |
| 3234 | ECDH_compute_key 3644 EXIST::FUNCTION:ECDH | 3234 | ECDH_compute_key 3644 EXIST::FUNCTION:ECDH |
| 3235 | STORE_ATTR_INFO_get0_sha1str 3645 EXIST::FUNCTION: | 3235 | STORE_ATTR_INFO_get0_sha1str 3645 NOEXIST::FUNCTION: |
| 3236 | ENGINE_register_all_ECDH 3646 EXIST::FUNCTION:ENGINE | 3236 | ENGINE_register_all_ECDH 3646 EXIST::FUNCTION:ENGINE |
| 3237 | pqueue_pop 3647 EXIST::FUNCTION: | 3237 | pqueue_pop 3647 EXIST::FUNCTION: |
| 3238 | STORE_ATTR_INFO_get0_cstr 3648 EXIST::FUNCTION: | 3238 | STORE_ATTR_INFO_get0_cstr 3648 NOEXIST::FUNCTION: |
| 3239 | POLICY_CONSTRAINTS_it 3649 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 3239 | POLICY_CONSTRAINTS_it 3649 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
| 3240 | POLICY_CONSTRAINTS_it 3649 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 3240 | POLICY_CONSTRAINTS_it 3649 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| 3241 | STORE_get_ex_new_index 3650 EXIST::FUNCTION: | 3241 | STORE_get_ex_new_index 3650 NOEXIST::FUNCTION: |
| 3242 | EVP_PKEY_get_attr_by_OBJ 3651 EXIST::FUNCTION: | 3242 | EVP_PKEY_get_attr_by_OBJ 3651 EXIST::FUNCTION: |
| 3243 | X509_VERIFY_PARAM_add0_policy 3652 EXIST::FUNCTION: | 3243 | X509_VERIFY_PARAM_add0_policy 3652 EXIST::FUNCTION: |
| 3244 | BN_GF2m_mod_solve_quad 3653 EXIST::FUNCTION: | 3244 | BN_GF2m_mod_solve_quad 3653 EXIST::FUNCTION: |
| @@ -3259,20 +3259,20 @@ EC_KEY_set_enc_flags 3665 EXIST::FUNCTION:EC | |||
| 3259 | ECDSA_verify 3666 EXIST::FUNCTION:ECDSA | 3259 | ECDSA_verify 3666 EXIST::FUNCTION:ECDSA |
| 3260 | EC_POINT_point2hex 3667 EXIST::FUNCTION:EC | 3260 | EC_POINT_point2hex 3667 EXIST::FUNCTION:EC |
| 3261 | ENGINE_get_STORE 3668 EXIST::FUNCTION:ENGINE | 3261 | ENGINE_get_STORE 3668 EXIST::FUNCTION:ENGINE |
| 3262 | SHA512 3669 EXIST::FUNCTION:SHA,SHA512 | 3262 | SHA512 3669 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 3263 | STORE_get_certificate 3670 EXIST::FUNCTION: | 3263 | STORE_get_certificate 3670 NOEXIST::FUNCTION: |
| 3264 | ECDSA_do_sign_ex 3671 EXIST::FUNCTION:ECDSA | 3264 | ECDSA_do_sign_ex 3671 EXIST::FUNCTION:ECDSA |
| 3265 | ECDSA_do_verify 3672 EXIST::FUNCTION:ECDSA | 3265 | ECDSA_do_verify 3672 EXIST::FUNCTION:ECDSA |
| 3266 | d2i_ECPrivateKey_fp 3673 EXIST::FUNCTION:EC,FP_API | 3266 | d2i_ECPrivateKey_fp 3673 EXIST::FUNCTION:EC,FP_API |
| 3267 | STORE_delete_certificate 3674 EXIST::FUNCTION: | 3267 | STORE_delete_certificate 3674 NOEXIST::FUNCTION: |
| 3268 | SHA512_Transform 3675 EXIST::FUNCTION:SHA,SHA512 | 3268 | SHA512_Transform 3675 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 3269 | X509_STORE_set1_param 3676 EXIST::FUNCTION: | 3269 | X509_STORE_set1_param 3676 EXIST::FUNCTION: |
| 3270 | STORE_method_get_ctrl_function 3677 EXIST::FUNCTION: | 3270 | STORE_method_get_ctrl_function 3677 NOEXIST::FUNCTION: |
| 3271 | STORE_free 3678 EXIST::FUNCTION: | 3271 | STORE_free 3678 NOEXIST::FUNCTION: |
| 3272 | PEM_write_ECPrivateKey 3679 EXIST:!WIN16:FUNCTION:EC | 3272 | PEM_write_ECPrivateKey 3679 EXIST:!WIN16:FUNCTION:EC |
| 3273 | STORE_method_get_unlock_store_function 3680 EXIST:!VMS:FUNCTION: | 3273 | STORE_meth_get_unlock_store_fn 3680 NOEXIST::FUNCTION: |
| 3274 | STORE_meth_get_unlock_store_fn 3680 EXIST:VMS:FUNCTION: | 3274 | STORE_method_get_unlock_store_function 3680 NOEXIST::FUNCTION: |
| 3275 | STORE_get_ex_data 3681 EXIST::FUNCTION: | 3275 | STORE_get_ex_data 3681 NOEXIST::FUNCTION: |
| 3276 | EC_KEY_set_public_key 3682 EXIST::FUNCTION:EC | 3276 | EC_KEY_set_public_key 3682 EXIST::FUNCTION:EC |
| 3277 | PEM_read_ECPKParameters 3683 EXIST:!WIN16:FUNCTION:EC | 3277 | PEM_read_ECPKParameters 3683 EXIST:!WIN16:FUNCTION:EC |
| 3278 | X509_CERT_PAIR_new 3684 EXIST::FUNCTION: | 3278 | X509_CERT_PAIR_new 3684 EXIST::FUNCTION: |
| @@ -3282,8 +3282,8 @@ DSA_generate_parameters_ex 3687 EXIST::FUNCTION:DSA | |||
| 3282 | ECParameters_print_fp 3688 EXIST::FUNCTION:EC,FP_API | 3282 | ECParameters_print_fp 3688 EXIST::FUNCTION:EC,FP_API |
| 3283 | X509V3_NAME_from_section 3689 EXIST::FUNCTION: | 3283 | X509V3_NAME_from_section 3689 EXIST::FUNCTION: |
| 3284 | EVP_PKEY_add1_attr 3690 EXIST::FUNCTION: | 3284 | EVP_PKEY_add1_attr 3690 EXIST::FUNCTION: |
| 3285 | STORE_modify_crl 3691 EXIST::FUNCTION: | 3285 | STORE_modify_crl 3691 NOEXIST::FUNCTION: |
| 3286 | STORE_list_private_key_start 3692 EXIST::FUNCTION: | 3286 | STORE_list_private_key_start 3692 NOEXIST::FUNCTION: |
| 3287 | POLICY_MAPPINGS_it 3693 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 3287 | POLICY_MAPPINGS_it 3693 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
| 3288 | POLICY_MAPPINGS_it 3693 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | 3288 | POLICY_MAPPINGS_it 3693 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: |
| 3289 | GENERAL_SUBTREE_it 3694 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | 3289 | GENERAL_SUBTREE_it 3694 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: |
| @@ -3292,7 +3292,7 @@ EC_GROUP_get_curve_name 3695 EXIST::FUNCTION:EC | |||
| 3292 | PEM_write_X509_CERT_PAIR 3696 EXIST:!WIN16:FUNCTION: | 3292 | PEM_write_X509_CERT_PAIR 3696 EXIST:!WIN16:FUNCTION: |
| 3293 | BIO_dump_indent_cb 3697 EXIST::FUNCTION: | 3293 | BIO_dump_indent_cb 3697 EXIST::FUNCTION: |
| 3294 | d2i_X509_CERT_PAIR 3698 EXIST::FUNCTION: | 3294 | d2i_X509_CERT_PAIR 3698 EXIST::FUNCTION: |
| 3295 | STORE_list_private_key_endp 3699 EXIST::FUNCTION: | 3295 | STORE_list_private_key_endp 3699 NOEXIST::FUNCTION: |
| 3296 | asn1_const_Finish 3700 EXIST::FUNCTION: | 3296 | asn1_const_Finish 3700 EXIST::FUNCTION: |
| 3297 | i2d_EC_PUBKEY_fp 3701 EXIST::FUNCTION:EC,FP_API | 3297 | i2d_EC_PUBKEY_fp 3701 EXIST::FUNCTION:EC,FP_API |
| 3298 | BN_nist_mod_256 3702 EXIST::FUNCTION: | 3298 | BN_nist_mod_256 3702 EXIST::FUNCTION: |
| @@ -3302,47 +3302,47 @@ BN_BLINDING_create_param 3705 EXIST::FUNCTION: | |||
| 3302 | ECDSA_size 3706 EXIST::FUNCTION:ECDSA | 3302 | ECDSA_size 3706 EXIST::FUNCTION:ECDSA |
| 3303 | d2i_EC_PUBKEY_bio 3707 EXIST::FUNCTION:BIO,EC | 3303 | d2i_EC_PUBKEY_bio 3707 EXIST::FUNCTION:BIO,EC |
| 3304 | BN_get0_nist_prime_521 3708 EXIST::FUNCTION: | 3304 | BN_get0_nist_prime_521 3708 EXIST::FUNCTION: |
| 3305 | STORE_ATTR_INFO_modify_sha1str 3709 EXIST::FUNCTION: | 3305 | STORE_ATTR_INFO_modify_sha1str 3709 NOEXIST::FUNCTION: |
| 3306 | BN_generate_prime_ex 3710 EXIST::FUNCTION: | 3306 | BN_generate_prime_ex 3710 EXIST::FUNCTION: |
| 3307 | EC_GROUP_new_by_curve_name 3711 EXIST::FUNCTION:EC | 3307 | EC_GROUP_new_by_curve_name 3711 EXIST::FUNCTION:EC |
| 3308 | SHA256_Final 3712 EXIST::FUNCTION:SHA,SHA256 | 3308 | SHA256_Final 3712 EXIST::FUNCTION:SHA,SHA256 |
| 3309 | DH_generate_parameters_ex 3713 EXIST::FUNCTION:DH | 3309 | DH_generate_parameters_ex 3713 EXIST::FUNCTION:DH |
| 3310 | PEM_read_bio_ECPrivateKey 3714 EXIST::FUNCTION:EC | 3310 | PEM_read_bio_ECPrivateKey 3714 EXIST::FUNCTION:EC |
| 3311 | STORE_method_get_cleanup_function 3715 EXIST:!VMS:FUNCTION: | 3311 | STORE_meth_get_cleanup_fn 3715 NOEXIST::FUNCTION: |
| 3312 | STORE_meth_get_cleanup_fn 3715 EXIST:VMS:FUNCTION: | 3312 | STORE_method_get_cleanup_function 3715 NOEXIST::FUNCTION: |
| 3313 | ENGINE_get_ECDH 3716 EXIST::FUNCTION:ENGINE | 3313 | ENGINE_get_ECDH 3716 EXIST::FUNCTION:ENGINE |
| 3314 | d2i_ECDSA_SIG 3717 EXIST::FUNCTION:ECDSA | 3314 | d2i_ECDSA_SIG 3717 EXIST::FUNCTION:ECDSA |
| 3315 | BN_is_prime_fasttest_ex 3718 EXIST::FUNCTION: | 3315 | BN_is_prime_fasttest_ex 3718 EXIST::FUNCTION: |
| 3316 | ECDSA_sign 3719 EXIST::FUNCTION:ECDSA | 3316 | ECDSA_sign 3719 EXIST::FUNCTION:ECDSA |
| 3317 | X509_policy_check 3720 EXIST::FUNCTION: | 3317 | X509_policy_check 3720 EXIST::FUNCTION: |
| 3318 | EVP_PKEY_get_attr_by_NID 3721 EXIST::FUNCTION: | 3318 | EVP_PKEY_get_attr_by_NID 3721 EXIST::FUNCTION: |
| 3319 | STORE_set_ex_data 3722 EXIST::FUNCTION: | 3319 | STORE_set_ex_data 3722 NOEXIST::FUNCTION: |
| 3320 | ENGINE_get_ECDSA 3723 EXIST::FUNCTION:ENGINE | 3320 | ENGINE_get_ECDSA 3723 EXIST::FUNCTION:ENGINE |
| 3321 | EVP_ecdsa 3724 EXIST::FUNCTION:SHA | 3321 | EVP_ecdsa 3724 EXIST::FUNCTION:SHA |
| 3322 | BN_BLINDING_get_flags 3725 EXIST::FUNCTION: | 3322 | BN_BLINDING_get_flags 3725 EXIST::FUNCTION: |
| 3323 | PKCS12_add_cert 3726 EXIST::FUNCTION: | 3323 | PKCS12_add_cert 3726 EXIST::FUNCTION: |
| 3324 | STORE_OBJECT_new 3727 EXIST::FUNCTION: | 3324 | STORE_OBJECT_new 3727 NOEXIST::FUNCTION: |
| 3325 | ERR_load_ECDH_strings 3728 EXIST::FUNCTION:ECDH | 3325 | ERR_load_ECDH_strings 3728 EXIST::FUNCTION:ECDH |
| 3326 | EC_KEY_dup 3729 EXIST::FUNCTION:EC | 3326 | EC_KEY_dup 3729 EXIST::FUNCTION:EC |
| 3327 | EVP_CIPHER_CTX_rand_key 3730 EXIST::FUNCTION: | 3327 | EVP_CIPHER_CTX_rand_key 3730 EXIST::FUNCTION: |
| 3328 | ECDSA_set_method 3731 EXIST::FUNCTION:ECDSA | 3328 | ECDSA_set_method 3731 EXIST::FUNCTION:ECDSA |
| 3329 | a2i_IPADDRESS_NC 3732 EXIST::FUNCTION: | 3329 | a2i_IPADDRESS_NC 3732 EXIST::FUNCTION: |
| 3330 | d2i_ECParameters 3733 EXIST::FUNCTION:EC | 3330 | d2i_ECParameters 3733 EXIST::FUNCTION:EC |
| 3331 | STORE_list_certificate_end 3734 EXIST::FUNCTION: | 3331 | STORE_list_certificate_end 3734 NOEXIST::FUNCTION: |
| 3332 | STORE_get_crl 3735 EXIST::FUNCTION: | 3332 | STORE_get_crl 3735 NOEXIST::FUNCTION: |
| 3333 | X509_POLICY_NODE_print 3736 EXIST::FUNCTION: | 3333 | X509_POLICY_NODE_print 3736 EXIST::FUNCTION: |
| 3334 | SHA384_Init 3737 EXIST::FUNCTION:SHA,SHA512 | 3334 | SHA384_Init 3737 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 3335 | EC_GF2m_simple_method 3738 EXIST::FUNCTION:EC | 3335 | EC_GF2m_simple_method 3738 EXIST::FUNCTION:EC |
| 3336 | ECDSA_set_ex_data 3739 EXIST::FUNCTION:ECDSA | 3336 | ECDSA_set_ex_data 3739 EXIST::FUNCTION:ECDSA |
| 3337 | SHA384_Final 3740 EXIST::FUNCTION:SHA,SHA512 | 3337 | SHA384_Final 3740 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 3338 | PKCS7_set_digest 3741 EXIST::FUNCTION: | 3338 | PKCS7_set_digest 3741 EXIST::FUNCTION: |
| 3339 | EC_KEY_print 3742 EXIST::FUNCTION:BIO,EC | 3339 | EC_KEY_print 3742 EXIST::FUNCTION:BIO,EC |
| 3340 | STORE_method_set_lock_store_function 3743 EXIST:!VMS:FUNCTION: | 3340 | STORE_meth_set_lock_store_fn 3743 NOEXIST::FUNCTION: |
| 3341 | STORE_meth_set_lock_store_fn 3743 EXIST:VMS:FUNCTION: | 3341 | STORE_method_set_lock_store_function 3743 NOEXIST::FUNCTION: |
| 3342 | ECDSA_get_ex_new_index 3744 EXIST::FUNCTION:ECDSA | 3342 | ECDSA_get_ex_new_index 3744 EXIST::FUNCTION:ECDSA |
| 3343 | SHA384 3745 EXIST::FUNCTION:SHA,SHA512 | 3343 | SHA384 3745 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 |
| 3344 | POLICY_MAPPING_new 3746 EXIST::FUNCTION: | 3344 | POLICY_MAPPING_new 3746 EXIST::FUNCTION: |
| 3345 | STORE_list_certificate_endp 3747 EXIST::FUNCTION: | 3345 | STORE_list_certificate_endp 3747 NOEXIST::FUNCTION: |
| 3346 | X509_STORE_CTX_get0_policy_tree 3748 EXIST::FUNCTION: | 3346 | X509_STORE_CTX_get0_policy_tree 3748 EXIST::FUNCTION: |
| 3347 | EC_GROUP_set_asn1_flag 3749 EXIST::FUNCTION:EC | 3347 | EC_GROUP_set_asn1_flag 3749 EXIST::FUNCTION:EC |
| 3348 | EC_KEY_check_key 3750 EXIST::FUNCTION:EC | 3348 | EC_KEY_check_key 3750 EXIST::FUNCTION:EC |
| @@ -3350,13 +3350,13 @@ d2i_EC_PUBKEY_fp 3751 EXIST::FUNCTION:EC,FP_API | |||
| 3350 | PKCS7_set0_type_other 3752 EXIST::FUNCTION: | 3350 | PKCS7_set0_type_other 3752 EXIST::FUNCTION: |
| 3351 | PEM_read_bio_X509_CERT_PAIR 3753 EXIST::FUNCTION: | 3351 | PEM_read_bio_X509_CERT_PAIR 3753 EXIST::FUNCTION: |
| 3352 | pqueue_next 3754 EXIST::FUNCTION: | 3352 | pqueue_next 3754 EXIST::FUNCTION: |
| 3353 | STORE_method_get_list_end_function 3755 EXIST:!VMS:FUNCTION: | 3353 | STORE_meth_get_list_end_fn 3755 NOEXIST::FUNCTION: |
| 3354 | STORE_meth_get_list_end_fn 3755 EXIST:VMS:FUNCTION: | 3354 | STORE_method_get_list_end_function 3755 NOEXIST::FUNCTION: |
| 3355 | EVP_PKEY_add1_attr_by_OBJ 3756 EXIST::FUNCTION: | 3355 | EVP_PKEY_add1_attr_by_OBJ 3756 EXIST::FUNCTION: |
| 3356 | X509_VERIFY_PARAM_set_time 3757 EXIST::FUNCTION: | 3356 | X509_VERIFY_PARAM_set_time 3757 EXIST::FUNCTION: |
| 3357 | pqueue_new 3758 EXIST::FUNCTION: | 3357 | pqueue_new 3758 EXIST::FUNCTION: |
| 3358 | ENGINE_set_default_ECDH 3759 EXIST::FUNCTION:ENGINE | 3358 | ENGINE_set_default_ECDH 3759 EXIST::FUNCTION:ENGINE |
| 3359 | STORE_new_method 3760 EXIST::FUNCTION: | 3359 | STORE_new_method 3760 NOEXIST::FUNCTION: |
| 3360 | PKCS12_add_key 3761 EXIST::FUNCTION: | 3360 | PKCS12_add_key 3761 EXIST::FUNCTION: |
| 3361 | DSO_merge 3762 EXIST::FUNCTION: | 3361 | DSO_merge 3762 EXIST::FUNCTION: |
| 3362 | EC_POINT_hex2point 3763 EXIST::FUNCTION:EC | 3362 | EC_POINT_hex2point 3763 EXIST::FUNCTION:EC |
| @@ -3366,7 +3366,7 @@ pqueue_insert 3766 EXIST::FUNCTION: | |||
| 3366 | pitem_free 3767 EXIST::FUNCTION: | 3366 | pitem_free 3767 EXIST::FUNCTION: |
| 3367 | BN_GF2m_mod_inv_arr 3768 EXIST::FUNCTION: | 3367 | BN_GF2m_mod_inv_arr 3768 EXIST::FUNCTION: |
| 3368 | ENGINE_unregister_ECDSA 3769 EXIST::FUNCTION:ENGINE | 3368 | ENGINE_unregister_ECDSA 3769 EXIST::FUNCTION:ENGINE |
| 3369 | BN_BLINDING_set_thread_id 3770 EXIST::FUNCTION: | 3369 | BN_BLINDING_set_thread_id 3770 EXIST::FUNCTION:DEPRECATED |
| 3370 | get_rfc3526_prime_8192 3771 EXIST::FUNCTION: | 3370 | get_rfc3526_prime_8192 3771 EXIST::FUNCTION: |
| 3371 | X509_VERIFY_PARAM_clear_flags 3772 EXIST::FUNCTION: | 3371 | X509_VERIFY_PARAM_clear_flags 3772 EXIST::FUNCTION: |
| 3372 | get_rfc2409_prime_1024 3773 EXIST::FUNCTION: | 3372 | get_rfc2409_prime_1024 3773 EXIST::FUNCTION: |
| @@ -3385,7 +3385,7 @@ Camellia_cfb128_encrypt 3785 EXIST::FUNCTION:CAMELLIA | |||
| 3385 | Camellia_cfb1_encrypt 3786 EXIST::FUNCTION:CAMELLIA | 3385 | Camellia_cfb1_encrypt 3786 EXIST::FUNCTION:CAMELLIA |
| 3386 | Camellia_cfb8_encrypt 3787 EXIST::FUNCTION:CAMELLIA | 3386 | Camellia_cfb8_encrypt 3787 EXIST::FUNCTION:CAMELLIA |
| 3387 | Camellia_ctr128_encrypt 3788 EXIST::FUNCTION:CAMELLIA | 3387 | Camellia_ctr128_encrypt 3788 EXIST::FUNCTION:CAMELLIA |
| 3388 | Camellia_cfbr_encrypt_block 3789 EXIST::FUNCTION:CAMELLIA | 3388 | Camellia_cfbr_encrypt_block 3789 NOEXIST::FUNCTION: |
| 3389 | Camellia_decrypt 3790 EXIST::FUNCTION:CAMELLIA | 3389 | Camellia_decrypt 3790 EXIST::FUNCTION:CAMELLIA |
| 3390 | Camellia_ecb_encrypt 3791 EXIST::FUNCTION:CAMELLIA | 3390 | Camellia_ecb_encrypt 3791 EXIST::FUNCTION:CAMELLIA |
| 3391 | Camellia_encrypt 3792 EXIST::FUNCTION:CAMELLIA | 3391 | Camellia_encrypt 3792 EXIST::FUNCTION:CAMELLIA |
| @@ -3585,7 +3585,7 @@ CMS_data_create 3975 EXIST::FUNCTION:CMS | |||
| 3585 | i2d_CMS_bio 3976 EXIST::FUNCTION:CMS | 3585 | i2d_CMS_bio 3976 EXIST::FUNCTION:CMS |
| 3586 | CMS_EncryptedData_set1_key 3977 EXIST::FUNCTION:CMS | 3586 | CMS_EncryptedData_set1_key 3977 EXIST::FUNCTION:CMS |
| 3587 | CMS_decrypt 3978 EXIST::FUNCTION:CMS | 3587 | CMS_decrypt 3978 EXIST::FUNCTION:CMS |
| 3588 | int_smime_write_ASN1 3979 EXIST::FUNCTION: | 3588 | int_smime_write_ASN1 3979 NOEXIST::FUNCTION: |
| 3589 | CMS_unsigned_delete_attr 3980 EXIST::FUNCTION:CMS | 3589 | CMS_unsigned_delete_attr 3980 EXIST::FUNCTION:CMS |
| 3590 | CMS_unsigned_get_attr_count 3981 EXIST::FUNCTION:CMS | 3590 | CMS_unsigned_get_attr_count 3981 EXIST::FUNCTION:CMS |
| 3591 | CMS_add_smimecap 3982 EXIST::FUNCTION:CMS | 3591 | CMS_add_smimecap 3982 EXIST::FUNCTION:CMS |
| @@ -3657,53 +3657,52 @@ ENGINE_set_ld_ssl_clnt_cert_fn 4044 EXIST:VMS:FUNCTION:ENGINE | |||
| 3657 | ENGINE_get_ssl_client_cert_function 4045 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 | 3658 | ENGINE_get_ssl_client_cert_fn 4045 EXIST:VMS:FUNCTION:ENGINE |
| 3659 | ENGINE_load_ssl_client_cert 4046 EXIST::FUNCTION:ENGINE | 3659 | ENGINE_load_ssl_client_cert 4046 EXIST::FUNCTION:ENGINE |
| 3660 | ENGINE_load_capi 4047 EXIST::FUNCTION:CAPIENG,ENGINE | 3660 | ENGINE_load_capi 4047 EXIST::FUNCTION:ENGINE,STATIC_ENGINE |
| 3661 | OPENSSL_isservice 4048 EXIST::FUNCTION: | 3661 | OPENSSL_isservice 4048 EXIST::FUNCTION: |
| 3662 | FIPS_dsa_sig_decode 4049 EXIST:OPENSSL_FIPS:FUNCTION:DSA | 3662 | FIPS_dsa_sig_decode 4049 NOEXIST::FUNCTION: |
| 3663 | EVP_CIPHER_CTX_clear_flags 4050 EXIST::FUNCTION: | 3663 | EVP_CIPHER_CTX_clear_flags 4050 EXIST::FUNCTION: |
| 3664 | FIPS_rand_status 4051 EXIST:OPENSSL_FIPS:FUNCTION: | 3664 | FIPS_rand_status 4051 NOEXIST::FUNCTION: |
| 3665 | FIPS_rand_set_key 4052 EXIST:OPENSSL_FIPS:FUNCTION: | 3665 | FIPS_rand_set_key 4052 NOEXIST::FUNCTION: |
| 3666 | CRYPTO_set_mem_info_functions 4053 EXIST::FUNCTION: | 3666 | CRYPTO_set_mem_info_functions 4053 NOEXIST::FUNCTION: |
| 3667 | RSA_X931_generate_key_ex 4054 EXIST::FUNCTION:RSA | 3667 | RSA_X931_generate_key_ex 4054 NOEXIST::FUNCTION: |
| 3668 | int_ERR_set_state_func 4055 EXIST:OPENSSL_FIPS:FUNCTION: | 3668 | int_ERR_set_state_func 4055 NOEXIST::FUNCTION: |
| 3669 | int_EVP_MD_set_engine_callbacks 4056 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE | 3669 | int_EVP_MD_set_engine_callbacks 4056 NOEXIST::FUNCTION: |
| 3670 | int_CRYPTO_set_do_dynlock_callback 4057 EXIST:!VMS:FUNCTION: | 3670 | int_CRYPTO_set_do_dynlock_callback 4057 NOEXIST::FUNCTION: |
| 3671 | int_CRYPTO_set_do_dynlock_cb 4057 EXIST:VMS:FUNCTION: | 3671 | FIPS_rng_stick 4058 NOEXIST::FUNCTION: |
| 3672 | FIPS_rng_stick 4058 EXIST:OPENSSL_FIPS:FUNCTION: | ||
| 3673 | EVP_CIPHER_CTX_set_flags 4059 EXIST::FUNCTION: | 3672 | EVP_CIPHER_CTX_set_flags 4059 EXIST::FUNCTION: |
| 3674 | BN_X931_generate_prime_ex 4060 EXIST::FUNCTION: | 3673 | BN_X931_generate_prime_ex 4060 NOEXIST::FUNCTION: |
| 3675 | FIPS_selftest_check 4061 EXIST:OPENSSL_FIPS:FUNCTION: | 3674 | FIPS_selftest_check 4061 NOEXIST::FUNCTION: |
| 3676 | FIPS_rand_set_dt 4062 EXIST:OPENSSL_FIPS:FUNCTION: | 3675 | FIPS_rand_set_dt 4062 NOEXIST::FUNCTION: |
| 3677 | CRYPTO_dbg_pop_info 4063 EXIST::FUNCTION: | 3676 | CRYPTO_dbg_pop_info 4063 NOEXIST::FUNCTION: |
| 3678 | FIPS_dsa_free 4064 EXIST:OPENSSL_FIPS:FUNCTION:DSA | 3677 | FIPS_dsa_free 4064 NOEXIST::FUNCTION: |
| 3679 | RSA_X931_derive_ex 4065 EXIST::FUNCTION:RSA | 3678 | RSA_X931_derive_ex 4065 NOEXIST::FUNCTION: |
| 3680 | FIPS_rsa_new 4066 EXIST:OPENSSL_FIPS:FUNCTION:RSA | 3679 | FIPS_rsa_new 4066 NOEXIST::FUNCTION: |
| 3681 | FIPS_rand_bytes 4067 EXIST:OPENSSL_FIPS:FUNCTION: | 3680 | FIPS_rand_bytes 4067 NOEXIST::FUNCTION: |
| 3682 | fips_cipher_test 4068 EXIST:OPENSSL_FIPS:FUNCTION: | 3681 | fips_cipher_test 4068 NOEXIST::FUNCTION: |
| 3683 | EVP_CIPHER_CTX_test_flags 4069 EXIST::FUNCTION: | 3682 | EVP_CIPHER_CTX_test_flags 4069 EXIST::FUNCTION: |
| 3684 | CRYPTO_malloc_debug_init 4070 EXIST::FUNCTION: | 3683 | CRYPTO_malloc_debug_init 4070 NOEXIST::FUNCTION: |
| 3685 | CRYPTO_dbg_push_info 4071 EXIST::FUNCTION: | 3684 | CRYPTO_dbg_push_info 4071 NOEXIST::FUNCTION: |
| 3686 | FIPS_corrupt_rsa_keygen 4072 EXIST:OPENSSL_FIPS:FUNCTION: | 3685 | FIPS_corrupt_rsa_keygen 4072 NOEXIST::FUNCTION: |
| 3687 | FIPS_dh_new 4073 EXIST:OPENSSL_FIPS:FUNCTION:DH | 3686 | FIPS_dh_new 4073 NOEXIST::FUNCTION: |
| 3688 | FIPS_corrupt_dsa_keygen 4074 EXIST:OPENSSL_FIPS:FUNCTION: | 3687 | FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION: |
| 3689 | FIPS_dh_free 4075 EXIST:OPENSSL_FIPS:FUNCTION:DH | 3688 | FIPS_dh_free 4075 NOEXIST::FUNCTION: |
| 3690 | fips_pkey_signature_test 4076 EXIST:OPENSSL_FIPS:FUNCTION: | 3689 | fips_pkey_signature_test 4076 NOEXIST::FUNCTION: |
| 3691 | EVP_add_alg_module 4077 EXIST::FUNCTION: | 3690 | EVP_add_alg_module 4077 NOEXIST::FUNCTION: |
| 3692 | int_RAND_init_engine_callbacks 4078 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE | 3691 | int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION: |
| 3693 | int_EVP_CIPHER_set_engine_callbacks 4079 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE | 3692 | int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION: |
| 3694 | int_EVP_MD_init_engine_callbacks 4080 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE | 3693 | int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION: |
| 3695 | FIPS_rand_test_mode 4081 EXIST:OPENSSL_FIPS:FUNCTION: | 3694 | FIPS_rand_test_mode 4081 NOEXIST::FUNCTION: |
| 3696 | FIPS_rand_reset 4082 EXIST:OPENSSL_FIPS:FUNCTION: | 3695 | FIPS_rand_reset 4082 NOEXIST::FUNCTION: |
| 3697 | FIPS_dsa_new 4083 EXIST:OPENSSL_FIPS:FUNCTION:DSA | 3696 | FIPS_dsa_new 4083 NOEXIST::FUNCTION: |
| 3698 | int_RAND_set_callbacks 4084 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE | 3697 | int_RAND_set_callbacks 4084 NOEXIST::FUNCTION: |
| 3699 | BN_X931_derive_prime_ex 4085 EXIST::FUNCTION: | 3698 | BN_X931_derive_prime_ex 4085 NOEXIST::FUNCTION: |
| 3700 | int_ERR_lib_init 4086 EXIST:OPENSSL_FIPS:FUNCTION: | 3699 | int_ERR_lib_init 4086 NOEXIST::FUNCTION: |
| 3701 | int_EVP_CIPHER_init_engine_callbacks 4087 EXIST:OPENSSL_FIPS:FUNCTION:ENGINE | 3700 | int_EVP_CIPHER_init_engine_callbacks 4087 NOEXIST::FUNCTION: |
| 3702 | FIPS_rsa_free 4088 EXIST:OPENSSL_FIPS:FUNCTION:RSA | 3701 | FIPS_rsa_free 4088 NOEXIST::FUNCTION: |
| 3703 | FIPS_dsa_sig_encode 4089 EXIST:OPENSSL_FIPS:FUNCTION:DSA | 3702 | FIPS_dsa_sig_encode 4089 NOEXIST::FUNCTION: |
| 3704 | CRYPTO_dbg_remove_all_info 4090 EXIST::FUNCTION: | 3703 | CRYPTO_dbg_remove_all_info 4090 NOEXIST::FUNCTION: |
| 3705 | OPENSSL_init 4091 EXIST::FUNCTION: | 3704 | OPENSSL_init 4091 NOEXIST::FUNCTION: |
| 3706 | private_Camellia_set_key 4092 EXIST:OPENSSL_FIPS:FUNCTION:CAMELLIA | 3705 | private_Camellia_set_key 4092 NOEXIST::FUNCTION: |
| 3707 | CRYPTO_strdup 4093 EXIST::FUNCTION: | 3706 | CRYPTO_strdup 4093 EXIST::FUNCTION: |
| 3708 | JPAKE_STEP3A_process 4094 EXIST::FUNCTION:JPAKE | 3707 | JPAKE_STEP3A_process 4094 EXIST::FUNCTION:JPAKE |
| 3709 | JPAKE_STEP1_release 4095 EXIST::FUNCTION:JPAKE | 3708 | JPAKE_STEP1_release 4095 EXIST::FUNCTION:JPAKE |
| @@ -3725,4 +3724,458 @@ JPAKE_STEP2_release 4110 EXIST::FUNCTION:JPAKE | |||
| 3725 | JPAKE_STEP3A_init 4111 EXIST::FUNCTION:JPAKE | 3724 | JPAKE_STEP3A_init 4111 EXIST::FUNCTION:JPAKE |
| 3726 | ERR_load_JPAKE_strings 4112 EXIST::FUNCTION:JPAKE | 3725 | ERR_load_JPAKE_strings 4112 EXIST::FUNCTION:JPAKE |
| 3727 | JPAKE_STEP2_init 4113 EXIST::FUNCTION:JPAKE | 3726 | JPAKE_STEP2_init 4113 EXIST::FUNCTION:JPAKE |
| 3728 | ENGINE_load_aesni 4114 EXIST::FUNCTION:ENGINE | 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 index 4c16f1dc9e..780029a03f 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
| @@ -6,36 +6,56 @@ | |||
| 6 | # | 6 | # |
| 7 | 7 | ||
| 8 | $INSTALLTOP="/usr/local/ssl"; | 8 | $INSTALLTOP="/usr/local/ssl"; |
| 9 | $OPENSSLDIR="/usr/local/ssl"; | ||
| 9 | $OPTIONS=""; | 10 | $OPTIONS=""; |
| 10 | $ssl_version=""; | 11 | $ssl_version=""; |
| 11 | $banner="\t\@echo Building OpenSSL"; | 12 | $banner="\t\@echo Building OpenSSL"; |
| 12 | 13 | ||
| 13 | my $no_static_engine = 0; | 14 | my $no_static_engine = 1; |
| 14 | my $engines = ""; | 15 | my $engines = ""; |
| 15 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic | 16 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic |
| 16 | local $zlib_lib = ""; | 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 | ); | ||
| 17 | 44 | ||
| 18 | local $fips_canister_path = ""; | ||
| 19 | my $fips_premain_dso_exe_path = ""; | ||
| 20 | my $fips_premain_c_path = ""; | ||
| 21 | my $fips_sha1_exe_path = ""; | ||
| 22 | |||
| 23 | local $fipscanisterbuild = 0; | ||
| 24 | local $fipsdso = 0; | ||
| 25 | |||
| 26 | my $fipslibdir = ""; | ||
| 27 | my $baseaddr = ""; | ||
| 28 | |||
| 29 | my $ex_l_libs = ""; | ||
| 30 | 45 | ||
| 31 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | 46 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; |
| 32 | while(<IN>) { | 47 | while(<IN>) { |
| 33 | $ssl_version=$1 if (/^VERSION=(.*)$/); | 48 | my ($mf_opt, $mf_ref); |
| 34 | $OPTIONS=$1 if (/^OPTIONS=(.*)$/); | 49 | while (($mf_opt, $mf_ref) = each %mf_import) { |
| 35 | $INSTALLTOP=$1 if (/^INSTALLTOP=(.*$)/); | 50 | if (/^$mf_opt\s*=\s*(.*)$/) { |
| 51 | $$mf_ref = $1; | ||
| 52 | } | ||
| 53 | } | ||
| 36 | } | 54 | } |
| 37 | close(IN); | 55 | close(IN); |
| 38 | 56 | ||
| 57 | $debug = 1 if $mf_platform =~ /^debug-/; | ||
| 58 | |||
| 39 | die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; | 59 | die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; |
| 40 | 60 | ||
| 41 | $infile="MINFO"; | 61 | $infile="MINFO"; |
| @@ -58,6 +78,7 @@ $infile="MINFO"; | |||
| 58 | "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", | 78 | "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", |
| 59 | "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", | 79 | "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", |
| 60 | "default","cc under unix", | 80 | "default","cc under unix", |
| 81 | "auto", "auto detect from top level Makefile" | ||
| 61 | ); | 82 | ); |
| 62 | 83 | ||
| 63 | $platform=""; | 84 | $platform=""; |
| @@ -144,6 +165,12 @@ $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; | |||
| 144 | $NT=0; | 165 | $NT=0; |
| 145 | 166 | ||
| 146 | push(@INC,"util/pl","pl"); | 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 | |||
| 147 | if (($platform =~ /VC-(.+)/)) | 174 | if (($platform =~ /VC-(.+)/)) |
| 148 | { | 175 | { |
| 149 | $FLAVOR=$1; | 176 | $FLAVOR=$1; |
| @@ -228,13 +255,12 @@ $cflags.=" -DOPENSSL_NO_DES" if $no_des; | |||
| 228 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; | 255 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; |
| 229 | $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa; | 256 | $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa; |
| 230 | $cflags.=" -DOPENSSL_NO_DH" if $no_dh; | 257 | $cflags.=" -DOPENSSL_NO_DH" if $no_dh; |
| 258 | $cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool; | ||
| 231 | $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; | 259 | $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; |
| 232 | $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; | 260 | $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; |
| 233 | $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; | 261 | $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; |
| 234 | $cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; | 262 | $cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; |
| 235 | $cflags.=" -DOPENSSL_NO_CMS" if $no_cms; | 263 | $cflags.=" -DOPENSSL_NO_CMS" if $no_cms; |
| 236 | $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; | ||
| 237 | $cflags.=" -DOPENSSL_NO_CAPIENG" if $no_capieng; | ||
| 238 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; | 264 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; |
| 239 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; | 265 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; |
| 240 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; | 266 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; |
| @@ -242,7 +268,7 @@ $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; | |||
| 242 | $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; | 268 | $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; |
| 243 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; | 269 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; |
| 244 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | 270 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; |
| 245 | $cflags.=" -DOPENSSL_FIPS" if $fips; | 271 | $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; |
| 246 | $cflags.= " -DZLIB" if $zlib_opt; | 272 | $cflags.= " -DZLIB" if $zlib_opt; |
| 247 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; | 273 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; |
| 248 | 274 | ||
| @@ -264,9 +290,9 @@ else | |||
| 264 | 290 | ||
| 265 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); | 291 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); |
| 266 | 292 | ||
| 293 | |||
| 267 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", | 294 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", |
| 268 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO", | 295 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); |
| 269 | "FIPS" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); | ||
| 270 | 296 | ||
| 271 | if ($msdos) | 297 | if ($msdos) |
| 272 | { | 298 | { |
| @@ -280,6 +306,7 @@ if ($msdos) | |||
| 280 | $link="$bin_dir$link" if ($link !~ /^\$/); | 306 | $link="$bin_dir$link" if ($link !~ /^\$/); |
| 281 | 307 | ||
| 282 | $INSTALLTOP =~ s|/|$o|g; | 308 | $INSTALLTOP =~ s|/|$o|g; |
| 309 | $OPENSSLDIR =~ s|/|$o|g; | ||
| 283 | 310 | ||
| 284 | ############################################# | 311 | ############################################# |
| 285 | # We parse in input file and 'store' info for later printing. | 312 | # We parse in input file and 'store' info for later printing. |
| @@ -294,21 +321,11 @@ for (;;) | |||
| 294 | { | 321 | { |
| 295 | if ($lib ne "") | 322 | if ($lib ne "") |
| 296 | { | 323 | { |
| 297 | if ($fips && $dir =~ /^fips/) | 324 | $uc=$lib; |
| 298 | { | 325 | $uc =~ s/^lib(.*)\.a/$1/; |
| 299 | $uc = "FIPS"; | 326 | $uc =~ tr/a-z/A-Z/; |
| 300 | } | 327 | $lib_nam{$uc}=$uc; |
| 301 | else | 328 | $lib_obj{$uc}.=$libobj." "; |
| 302 | { | ||
| 303 | $uc=$lib; | ||
| 304 | $uc =~ s/^lib(.*)\.a/$1/; | ||
| 305 | $uc =~ tr/a-z/A-Z/; | ||
| 306 | } | ||
| 307 | if (($uc ne "FIPS") || $fipscanisterbuild) | ||
| 308 | { | ||
| 309 | $lib_nam{$uc}=$uc; | ||
| 310 | $lib_obj{$uc}.=$libobj." "; | ||
| 311 | } | ||
| 312 | } | 329 | } |
| 313 | last if ($val eq "FINISHED"); | 330 | last if ($val eq "FINISHED"); |
| 314 | $lib=""; | 331 | $lib=""; |
| @@ -351,130 +368,11 @@ for (;;) | |||
| 351 | if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) | 368 | if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) |
| 352 | { $engines.=$val } | 369 | { $engines.=$val } |
| 353 | 370 | ||
| 354 | if ($key eq "FIPS_EX_OBJ") | ||
| 355 | { | ||
| 356 | $fips_ex_obj=&var_add("crypto",$val,0); | ||
| 357 | } | ||
| 358 | |||
| 359 | if ($key eq "FIPSLIBDIR") | ||
| 360 | { | ||
| 361 | $fipslibdir=$val; | ||
| 362 | $fipslibdir =~ s/\/$//; | ||
| 363 | $fipslibdir =~ s/\//$o/g; | ||
| 364 | } | ||
| 365 | |||
| 366 | if ($key eq "BASEADDR") | ||
| 367 | { $baseaddr=$val;} | ||
| 368 | |||
| 369 | if (!($_=<IN>)) | 371 | if (!($_=<IN>)) |
| 370 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | 372 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } |
| 371 | } | 373 | } |
| 372 | close(IN); | 374 | close(IN); |
| 373 | 375 | ||
| 374 | if ($fips) | ||
| 375 | { | ||
| 376 | |||
| 377 | foreach (split " ", $fips_ex_obj) | ||
| 378 | { | ||
| 379 | $fips_exclude_obj{$1} = 1 if (/\/([^\/]*)$/); | ||
| 380 | } | ||
| 381 | |||
| 382 | $fips_exclude_obj{"cpu_win32"} = 1; | ||
| 383 | $fips_exclude_obj{"bn_asm"} = 1; | ||
| 384 | $fips_exclude_obj{"des_enc"} = 1; | ||
| 385 | $fips_exclude_obj{"fcrypt_b"} = 1; | ||
| 386 | $fips_exclude_obj{"aes_core"} = 1; | ||
| 387 | $fips_exclude_obj{"aes_cbc"} = 1; | ||
| 388 | |||
| 389 | my @ltmp = split " ", $lib_obj{"CRYPTO"}; | ||
| 390 | |||
| 391 | |||
| 392 | $lib_obj{"CRYPTO"} = ""; | ||
| 393 | |||
| 394 | foreach(@ltmp) | ||
| 395 | { | ||
| 396 | if (/\/([^\/]*)$/ && exists $fips_exclude_obj{$1}) | ||
| 397 | { | ||
| 398 | if ($fipscanisterbuild) | ||
| 399 | { | ||
| 400 | $lib_obj{"FIPS"} .= "$_ "; | ||
| 401 | } | ||
| 402 | } | ||
| 403 | else | ||
| 404 | { | ||
| 405 | $lib_obj{"CRYPTO"} .= "$_ "; | ||
| 406 | } | ||
| 407 | } | ||
| 408 | |||
| 409 | } | ||
| 410 | |||
| 411 | if ($fipscanisterbuild) | ||
| 412 | { | ||
| 413 | $fips_canister_path = "\$(LIB_D)${o}fipscanister.lib" if $fips_canister_path eq ""; | ||
| 414 | $fips_premain_c_path = "\$(LIB_D)${o}fips_premain.c"; | ||
| 415 | } | ||
| 416 | else | ||
| 417 | { | ||
| 418 | if ($fips_canister_path eq "") | ||
| 419 | { | ||
| 420 | $fips_canister_path = "\$(FIPSLIB_D)${o}fipscanister.lib"; | ||
| 421 | } | ||
| 422 | |||
| 423 | if ($fips_premain_c_path eq "") | ||
| 424 | { | ||
| 425 | $fips_premain_c_path = "\$(FIPSLIB_D)${o}fips_premain.c"; | ||
| 426 | } | ||
| 427 | } | ||
| 428 | |||
| 429 | if ($fips) | ||
| 430 | { | ||
| 431 | if ($fips_sha1_exe_path eq "") | ||
| 432 | { | ||
| 433 | $fips_sha1_exe_path = | ||
| 434 | "\$(BIN_D)${o}fips_standalone_sha1$exep"; | ||
| 435 | } | ||
| 436 | } | ||
| 437 | else | ||
| 438 | { | ||
| 439 | $fips_sha1_exe_path = ""; | ||
| 440 | } | ||
| 441 | |||
| 442 | if ($fips_premain_dso_exe_path eq "") | ||
| 443 | { | ||
| 444 | $fips_premain_dso_exe_path = "\$(BIN_D)${o}fips_premain_dso$exep"; | ||
| 445 | } | ||
| 446 | |||
| 447 | # $ex_build_targets .= "\$(BIN_D)${o}\$(E_PREMAIN_DSO)$exep" if ($fips); | ||
| 448 | |||
| 449 | #$ex_l_libs .= " \$(L_FIPS)" if $fipsdso; | ||
| 450 | |||
| 451 | if ($fips) | ||
| 452 | { | ||
| 453 | if (!$shlib) | ||
| 454 | { | ||
| 455 | $ex_build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)"; | ||
| 456 | $ex_l_libs .= " \$(O_FIPSCANISTER)"; | ||
| 457 | $ex_libs_dep .= " \$(O_FIPSCANISTER)" if $fipscanisterbuild; | ||
| 458 | } | ||
| 459 | if ($fipscanisterbuild) | ||
| 460 | { | ||
| 461 | $fipslibdir = "\$(LIB_D)"; | ||
| 462 | } | ||
| 463 | else | ||
| 464 | { | ||
| 465 | if ($fipslibdir eq "") | ||
| 466 | { | ||
| 467 | open (IN, "util/fipslib_path.txt") || fipslib_error(); | ||
| 468 | $fipslibdir = <IN>; | ||
| 469 | chomp $fipslibdir; | ||
| 470 | close IN; | ||
| 471 | } | ||
| 472 | fips_check_files($fipslibdir, | ||
| 473 | "fipscanister.lib", "fipscanister.lib.sha1", | ||
| 474 | "fips_premain.c", "fips_premain.c.sha1"); | ||
| 475 | } | ||
| 476 | } | ||
| 477 | |||
| 478 | if ($shlib) | 376 | if ($shlib) |
| 479 | { | 377 | { |
| 480 | $extra_install= <<"EOF"; | 378 | $extra_install= <<"EOF"; |
| @@ -520,6 +418,7 @@ $defs .= $preamble if defined $preamble; | |||
| 520 | 418 | ||
| 521 | $defs.= <<"EOF"; | 419 | $defs.= <<"EOF"; |
| 522 | INSTALLTOP=$INSTALLTOP | 420 | INSTALLTOP=$INSTALLTOP |
| 421 | OPENSSLDIR=$OPENSSLDIR | ||
| 523 | 422 | ||
| 524 | # Set your compiler options | 423 | # Set your compiler options |
| 525 | PLATFORM=$platform | 424 | PLATFORM=$platform |
| @@ -540,32 +439,6 @@ SRC_D=$src_dir | |||
| 540 | LINK=$link | 439 | LINK=$link |
| 541 | LFLAGS=$lflags | 440 | LFLAGS=$lflags |
| 542 | RSC=$rsc | 441 | RSC=$rsc |
| 543 | FIPSLINK=\$(PERL) util${o}fipslink.pl | ||
| 544 | |||
| 545 | AES_ASM_OBJ=$aes_asm_obj | ||
| 546 | AES_ASM_SRC=$aes_asm_src | ||
| 547 | BN_ASM_OBJ=$bn_asm_obj | ||
| 548 | BN_ASM_SRC=$bn_asm_src | ||
| 549 | BNCO_ASM_OBJ=$bnco_asm_obj | ||
| 550 | BNCO_ASM_SRC=$bnco_asm_src | ||
| 551 | DES_ENC_OBJ=$des_enc_obj | ||
| 552 | DES_ENC_SRC=$des_enc_src | ||
| 553 | BF_ENC_OBJ=$bf_enc_obj | ||
| 554 | BF_ENC_SRC=$bf_enc_src | ||
| 555 | CAST_ENC_OBJ=$cast_enc_obj | ||
| 556 | CAST_ENC_SRC=$cast_enc_src | ||
| 557 | RC4_ENC_OBJ=$rc4_enc_obj | ||
| 558 | RC4_ENC_SRC=$rc4_enc_src | ||
| 559 | RC5_ENC_OBJ=$rc5_enc_obj | ||
| 560 | RC5_ENC_SRC=$rc5_enc_src | ||
| 561 | MD5_ASM_OBJ=$md5_asm_obj | ||
| 562 | MD5_ASM_SRC=$md5_asm_src | ||
| 563 | SHA1_ASM_OBJ=$sha1_asm_obj | ||
| 564 | SHA1_ASM_SRC=$sha1_asm_src | ||
| 565 | RMD160_ASM_OBJ=$rmd160_asm_obj | ||
| 566 | RMD160_ASM_SRC=$rmd160_asm_src | ||
| 567 | CPUID_ASM_OBJ=$cpuid_asm_obj | ||
| 568 | CPUID_ASM_SRC=$cpuid_asm_src | ||
| 569 | 442 | ||
| 570 | # The output directory for everything intersting | 443 | # The output directory for everything intersting |
| 571 | OUT_D=$out_dir | 444 | OUT_D=$out_dir |
| @@ -584,17 +457,6 @@ MKLIB=$bin_dir$mklib | |||
| 584 | MLFLAGS=$mlflags | 457 | MLFLAGS=$mlflags |
| 585 | ASM=$bin_dir$asm | 458 | ASM=$bin_dir$asm |
| 586 | 459 | ||
| 587 | # FIPS validated module and support file locations | ||
| 588 | |||
| 589 | E_PREMAIN_DSO=fips_premain_dso | ||
| 590 | |||
| 591 | FIPSLIB_D=$fipslibdir | ||
| 592 | BASEADDR=$baseaddr | ||
| 593 | FIPS_PREMAIN_SRC=$fips_premain_c_path | ||
| 594 | O_FIPSCANISTER=$fips_canister_path | ||
| 595 | FIPS_SHA1_EXE=$fips_sha1_exe_path | ||
| 596 | PREMAIN_DSO_EXE=$fips_premain_dso_exe_path | ||
| 597 | |||
| 598 | ###################################################### | 460 | ###################################################### |
| 599 | # You should not need to touch anything below this point | 461 | # You should not need to touch anything below this point |
| 600 | ###################################################### | 462 | ###################################################### |
| @@ -602,7 +464,6 @@ PREMAIN_DSO_EXE=$fips_premain_dso_exe_path | |||
| 602 | E_EXE=openssl | 464 | E_EXE=openssl |
| 603 | SSL=$ssl | 465 | SSL=$ssl |
| 604 | CRYPTO=$crypto | 466 | CRYPTO=$crypto |
| 605 | LIBFIPS=libosslfips | ||
| 606 | 467 | ||
| 607 | # BIN_D - Binary output directory | 468 | # BIN_D - Binary output directory |
| 608 | # TEST_D - Binary test file output directory | 469 | # TEST_D - Binary test file output directory |
| @@ -623,14 +484,12 @@ INCL_D=\$(TMP_D) | |||
| 623 | 484 | ||
| 624 | O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp | 485 | O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp |
| 625 | O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp | 486 | O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp |
| 626 | O_FIPS= \$(LIB_D)$o$plib\$(LIBFIPS)$shlibp | ||
| 627 | SO_SSL= $plib\$(SSL)$so_shlibp | 487 | SO_SSL= $plib\$(SSL)$so_shlibp |
| 628 | SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp | 488 | SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp |
| 629 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp | 489 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp |
| 630 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp | 490 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp |
| 631 | L_FIPS= \$(LIB_D)$o$plib\$(LIBFIPS)$libp | ||
| 632 | 491 | ||
| 633 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs | 492 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) |
| 634 | 493 | ||
| 635 | ###################################################### | 494 | ###################################################### |
| 636 | # Don't touch anything below this point | 495 | # Don't touch anything below this point |
| @@ -640,13 +499,13 @@ INC=-I\$(INC_D) -I\$(INCL_D) | |||
| 640 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) | 499 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) |
| 641 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) | 500 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) |
| 642 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) | 501 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) |
| 643 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) $ex_libs_dep | 502 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) |
| 644 | 503 | ||
| 645 | ############################################# | 504 | ############################################# |
| 646 | EOF | 505 | EOF |
| 647 | 506 | ||
| 648 | $rules=<<"EOF"; | 507 | $rules=<<"EOF"; |
| 649 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers \$(FIPS_SHA1_EXE) lib exe $ex_build_targets | 508 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe |
| 650 | 509 | ||
| 651 | banner: | 510 | banner: |
| 652 | $banner | 511 | $banner |
| @@ -683,8 +542,9 @@ install: all | |||
| 683 | \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" | 542 | \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" |
| 684 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" | 543 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" |
| 685 | \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" | 544 | \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" |
| 686 | \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep\" \"\$(INSTALLTOP)${o}bin\" | 545 | \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\" |
| 687 | \$(CP) \"apps${o}openssl.cnf\" \"\$(INSTALLTOP)\" | 546 | \$(MKDIR) \"\$(OPENSSLDIR)\" |
| 547 | \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\" | ||
| 688 | $extra_install | 548 | $extra_install |
| 689 | 549 | ||
| 690 | 550 | ||
| @@ -761,26 +621,6 @@ $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | |||
| 761 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); | 621 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); |
| 762 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); | 622 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); |
| 763 | 623 | ||
| 764 | # Special case rules for fips_start and fips_end fips_premain_dso | ||
| 765 | |||
| 766 | if ($fips) | ||
| 767 | { | ||
| 768 | if ($fipscanisterbuild) | ||
| 769 | { | ||
| 770 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_start$obj", | ||
| 771 | "fips${o}fips_canister.c", | ||
| 772 | "-DFIPS_START \$(SHLIB_CFLAGS)"); | ||
| 773 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_end$obj", | ||
| 774 | "fips${o}fips_canister.c", "\$(SHLIB_CFLAGS)"); | ||
| 775 | } | ||
| 776 | $rules.=&cc_compile_target("\$(OBJ_D)${o}fips_standalone_sha1$obj", | ||
| 777 | "fips${o}sha${o}fips_standalone_sha1.c", | ||
| 778 | "\$(SHLIB_CFLAGS)"); | ||
| 779 | $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj", | ||
| 780 | "fips${o}fips_premain.c", | ||
| 781 | "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)"); | ||
| 782 | } | ||
| 783 | |||
| 784 | foreach (values %lib_nam) | 624 | foreach (values %lib_nam) |
| 785 | { | 625 | { |
| 786 | $lib_obj=$lib_obj{$_}; | 626 | $lib_obj=$lib_obj{$_}; |
| @@ -792,78 +632,14 @@ foreach (values %lib_nam) | |||
| 792 | next; | 632 | next; |
| 793 | } | 633 | } |
| 794 | 634 | ||
| 795 | if ((!$fips && ($_ eq "CRYPTO")) || ($fips && ($_ eq "FIPS"))) | ||
| 796 | { | ||
| 797 | if ($cpuid_asm_obj ne "") | ||
| 798 | { | ||
| 799 | $lib_obj =~ s/(\S*\/cryptlib\S*)/$1 \$(CPUID_ASM_OBJ)/; | ||
| 800 | $rules.=&do_asm_rule($cpuid_asm_obj,$cpuid_asm_src); | ||
| 801 | } | ||
| 802 | if ($aes_asm_obj ne "") | ||
| 803 | { | ||
| 804 | $lib_obj =~ s/\s(\S*\/aes_core\S*)/ \$(AES_ASM_OBJ)/; | ||
| 805 | $lib_obj =~ s/\s\S*\/aes_cbc\S*//; | ||
| 806 | $rules.=&do_asm_rule($aes_asm_obj,$aes_asm_src); | ||
| 807 | } | ||
| 808 | if ($sha1_asm_obj ne "") | ||
| 809 | { | ||
| 810 | $lib_obj =~ s/\s(\S*\/sha1dgst\S*)/ $1 \$(SHA1_ASM_OBJ)/; | ||
| 811 | $rules.=&do_asm_rule($sha1_asm_obj,$sha1_asm_src); | ||
| 812 | } | ||
| 813 | if ($bn_asm_obj ne "") | ||
| 814 | { | ||
| 815 | $lib_obj =~ s/\s\S*\/bn_asm\S*/ \$(BN_ASM_OBJ)/; | ||
| 816 | $rules.=&do_asm_rule($bn_asm_obj,$bn_asm_src); | ||
| 817 | } | ||
| 818 | if ($bnco_asm_obj ne "") | ||
| 819 | { | ||
| 820 | $lib_obj .= "\$(BNCO_ASM_OBJ)"; | ||
| 821 | $rules.=&do_asm_rule($bnco_asm_obj,$bnco_asm_src); | ||
| 822 | } | ||
| 823 | if ($des_enc_obj ne "") | ||
| 824 | { | ||
| 825 | $lib_obj =~ s/\s\S*des_enc\S*/ \$(DES_ENC_OBJ)/; | ||
| 826 | $lib_obj =~ s/\s\S*\/fcrypt_b\S*\s*/ /; | ||
| 827 | $rules.=&do_asm_rule($des_enc_obj,$des_enc_src); | ||
| 828 | } | ||
| 829 | } | ||
| 830 | if (($bf_enc_obj ne "") && ($_ eq "CRYPTO")) | ||
| 831 | { | ||
| 832 | $lib_obj =~ s/\s\S*\/bf_enc\S*/ \$(BF_ENC_OBJ)/; | ||
| 833 | $rules.=&do_asm_rule($bf_enc_obj,$bf_enc_src); | ||
| 834 | } | ||
| 835 | if (($cast_enc_obj ne "") && ($_ eq "CRYPTO")) | ||
| 836 | { | ||
| 837 | $lib_obj =~ s/(\s\S*\/c_enc\S*)/ \$(CAST_ENC_OBJ)/; | ||
| 838 | $rules.=&do_asm_rule($cast_enc_obj,$cast_enc_src); | ||
| 839 | } | ||
| 840 | if (($rc4_enc_obj ne "") && ($_ eq "CRYPTO")) | ||
| 841 | { | ||
| 842 | $lib_obj =~ s/\s\S*\/rc4_enc\S*/ \$(RC4_ENC_OBJ)/; | ||
| 843 | $rules.=&do_asm_rule($rc4_enc_obj,$rc4_enc_src); | ||
| 844 | } | ||
| 845 | if (($rc5_enc_obj ne "") && ($_ eq "CRYPTO")) | ||
| 846 | { | ||
| 847 | $lib_obj =~ s/\s\S*\/rc5_enc\S*/ \$(RC5_ENC_OBJ)/; | ||
| 848 | $rules.=&do_asm_rule($rc5_enc_obj,$rc5_enc_src); | ||
| 849 | } | ||
| 850 | if (($md5_asm_obj ne "") && ($_ eq "CRYPTO")) | ||
| 851 | { | ||
| 852 | $lib_obj =~ s/\s(\S*\/md5_dgst\S*)/ $1 \$(MD5_ASM_OBJ)/; | ||
| 853 | $rules.=&do_asm_rule($md5_asm_obj,$md5_asm_src); | ||
| 854 | } | ||
| 855 | if (($rmd160_asm_obj ne "") && ($_ eq "CRYPTO")) | ||
| 856 | { | ||
| 857 | $lib_obj =~ s/\s(\S*\/rmd_dgst\S*)/ $1 \$(RMD160_ASM_OBJ)/; | ||
| 858 | $rules.=&do_asm_rule($rmd160_asm_obj,$rmd160_asm_src); | ||
| 859 | } | ||
| 860 | $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); | 635 | $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); |
| 861 | $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; | 636 | $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; |
| 862 | $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); | 637 | $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); |
| 863 | } | 638 | } |
| 864 | 639 | ||
| 865 | # hack to add version info on MSVC | 640 | # hack to add version info on MSVC |
| 866 | if (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) { | 641 | if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A") |
| 642 | || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) { | ||
| 867 | $rules.= <<"EOF"; | 643 | $rules.= <<"EOF"; |
| 868 | \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc | 644 | \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc |
| 869 | \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc | 645 | \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc |
| @@ -871,43 +647,15 @@ if (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) { | |||
| 871 | \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc | 647 | \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc |
| 872 | \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc | 648 | \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc |
| 873 | 649 | ||
| 874 | \$(OBJ_D)\\\$(LIBFIPS).res: ms\\version32.rc | ||
| 875 | \$(RSC) /fo"\$(OBJ_D)\\\$(LIBFIPS).res" /d FIPS ms\\version32.rc | ||
| 876 | |||
| 877 | EOF | 650 | EOF |
| 878 | } | 651 | } |
| 879 | 652 | ||
| 880 | $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); | 653 | $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); |
| 881 | foreach (split(/\s+/,$test)) | 654 | foreach (split(/\s+/,$test)) |
| 882 | { | 655 | { |
| 883 | my $t_libs; | ||
| 884 | $t=&bname($_); | 656 | $t=&bname($_); |
| 885 | my $ltype; | ||
| 886 | # Check to see if test program is FIPS | ||
| 887 | if ($fips && /fips/) | ||
| 888 | { | ||
| 889 | # If fipsdso link to libosslfips.dll | ||
| 890 | # otherwise perform static link to | ||
| 891 | # $(O_FIPSCANISTER) | ||
| 892 | if ($fipsdso) | ||
| 893 | { | ||
| 894 | $t_libs = "\$(L_FIPS)"; | ||
| 895 | $ltype = 0; | ||
| 896 | } | ||
| 897 | else | ||
| 898 | { | ||
| 899 | $t_libs = "\$(O_FIPSCANISTER)"; | ||
| 900 | $ltype = 2; | ||
| 901 | } | ||
| 902 | } | ||
| 903 | else | ||
| 904 | { | ||
| 905 | $t_libs = "\$(L_LIBS)"; | ||
| 906 | $ltype = 0; | ||
| 907 | } | ||
| 908 | |||
| 909 | $tt="\$(OBJ_D)${o}$t${obj}"; | 657 | $tt="\$(OBJ_D)${o}$t${obj}"; |
| 910 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","$t_libs \$(EX_LIBS)", $ltype); | 658 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); |
| 911 | } | 659 | } |
| 912 | 660 | ||
| 913 | $defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp); | 661 | $defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp); |
| @@ -921,69 +669,9 @@ foreach (split(/\s+/,$engines)) | |||
| 921 | 669 | ||
| 922 | 670 | ||
| 923 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | 671 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); |
| 672 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); | ||
| 924 | 673 | ||
| 925 | if ($fips) | 674 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); |
| 926 | { | ||
| 927 | if ($shlib) | ||
| 928 | { | ||
| 929 | if ($fipsdso) | ||
| 930 | { | ||
| 931 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)", | ||
| 932 | "\$(O_CRYPTO)", "$crypto", | ||
| 933 | $shlib, "", ""); | ||
| 934 | $rules.= &do_lib_rule( | ||
| 935 | "\$(O_FIPSCANISTER)", | ||
| 936 | "\$(O_FIPS)", "\$(LIBFIPS)", | ||
| 937 | $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)"); | ||
| 938 | $rules.= &do_sdef_rule(); | ||
| 939 | } | ||
| 940 | else | ||
| 941 | { | ||
| 942 | $rules.= &do_lib_rule( | ||
| 943 | "\$(CRYPTOOBJ) \$(O_FIPSCANISTER)", | ||
| 944 | "\$(O_CRYPTO)", "$crypto", | ||
| 945 | $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)"); | ||
| 946 | } | ||
| 947 | } | ||
| 948 | else | ||
| 949 | { | ||
| 950 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)", | ||
| 951 | "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
| 952 | $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(FIPSOBJ)", | ||
| 953 | "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", ""); | ||
| 954 | } | ||
| 955 | } | ||
| 956 | else | ||
| 957 | { | ||
| 958 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib, | ||
| 959 | "\$(SO_CRYPTO)"); | ||
| 960 | } | ||
| 961 | |||
| 962 | if ($fips) | ||
| 963 | { | ||
| 964 | if ($fipscanisterbuild) | ||
| 965 | { | ||
| 966 | $rules.= &do_rlink_rule("\$(O_FIPSCANISTER)", | ||
| 967 | "\$(OBJ_D)${o}fips_start$obj", | ||
| 968 | "\$(FIPSOBJ)", | ||
| 969 | "\$(OBJ_D)${o}fips_end$obj", | ||
| 970 | "\$(FIPS_SHA1_EXE)", ""); | ||
| 971 | $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)", | ||
| 972 | "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(OBJ_D)${o}sha1dgst$obj \$(SHA1_ASM_OBJ)", | ||
| 973 | "","\$(EX_LIBS)", 1); | ||
| 974 | } | ||
| 975 | else | ||
| 976 | { | ||
| 977 | $rules.=&do_link_rule("\$(FIPS_SHA1_EXE)", | ||
| 978 | "\$(OBJ_D)${o}fips_standalone_sha1$obj \$(O_FIPSCANISTER)", | ||
| 979 | "","", 1); | ||
| 980 | |||
| 981 | } | ||
| 982 | $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1); | ||
| 983 | |||
| 984 | } | ||
| 985 | |||
| 986 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0); | ||
| 987 | 675 | ||
| 988 | print $defs; | 676 | print $defs; |
| 989 | 677 | ||
| @@ -1022,7 +710,6 @@ sub var_add | |||
| 1022 | return("") if $no_ec && $dir =~ /\/ec/; | 710 | return("") if $no_ec && $dir =~ /\/ec/; |
| 1023 | return("") if $no_cms && $dir =~ /\/cms/; | 711 | return("") if $no_cms && $dir =~ /\/cms/; |
| 1024 | return("") if $no_jpake && $dir =~ /\/jpake/; | 712 | return("") if $no_jpake && $dir =~ /\/jpake/; |
| 1025 | return("") if !$fips && $dir =~ /^fips/; | ||
| 1026 | if ($no_des && $dir =~ /\/des/) | 713 | if ($no_des && $dir =~ /\/des/) |
| 1027 | { | 714 | { |
| 1028 | if ($val =~ /read_pwd/) | 715 | if ($val =~ /read_pwd/) |
| @@ -1034,6 +721,7 @@ sub var_add | |||
| 1034 | return("") if $no_sock && $dir =~ /\/proxy/; | 721 | return("") if $no_sock && $dir =~ /\/proxy/; |
| 1035 | return("") if $no_bf && $dir =~ /\/bf/; | 722 | return("") if $no_bf && $dir =~ /\/bf/; |
| 1036 | return("") if $no_cast && $dir =~ /\/cast/; | 723 | return("") if $no_cast && $dir =~ /\/cast/; |
| 724 | return("") if $no_whirlpool && $dir =~ /\/whrlpool/; | ||
| 1037 | 725 | ||
| 1038 | $val =~ s/^\s*(.*)\s*$/$1/; | 726 | $val =~ s/^\s*(.*)\s*$/$1/; |
| 1039 | @a=split(/\s+/,$val); | 727 | @a=split(/\s+/,$val); |
| @@ -1051,8 +739,8 @@ sub var_add | |||
| 1051 | @a=grep(!/^e_camellia$/,@a) if $no_camellia; | 739 | @a=grep(!/^e_camellia$/,@a) if $no_camellia; |
| 1052 | @a=grep(!/^e_seed$/,@a) if $no_seed; | 740 | @a=grep(!/^e_seed$/,@a) if $no_seed; |
| 1053 | 741 | ||
| 1054 | @a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; | 742 | #@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; |
| 1055 | @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; | 743 | #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; |
| 1056 | 744 | ||
| 1057 | @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock; | 745 | @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock; |
| 1058 | 746 | ||
| @@ -1126,6 +814,7 @@ sub do_defs | |||
| 1126 | else { $pf=$postfix; } | 814 | else { $pf=$postfix; } |
| 1127 | if ($_ =~ /BN_ASM/) { $t="$_ "; } | 815 | if ($_ =~ /BN_ASM/) { $t="$_ "; } |
| 1128 | elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; } | 816 | elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; } |
| 817 | elsif ($_ =~ /AES_ASM/){ $t="$_ "; } | ||
| 1129 | elsif ($_ =~ /DES_ENC/) { $t="$_ "; } | 818 | elsif ($_ =~ /DES_ENC/) { $t="$_ "; } |
| 1130 | elsif ($_ =~ /BF_ENC/) { $t="$_ "; } | 819 | elsif ($_ =~ /BF_ENC/) { $t="$_ "; } |
| 1131 | elsif ($_ =~ /CAST_ENC/){ $t="$_ "; } | 820 | elsif ($_ =~ /CAST_ENC/){ $t="$_ "; } |
| @@ -1133,8 +822,8 @@ sub do_defs | |||
| 1133 | elsif ($_ =~ /RC5_ENC/) { $t="$_ "; } | 822 | elsif ($_ =~ /RC5_ENC/) { $t="$_ "; } |
| 1134 | elsif ($_ =~ /MD5_ASM/) { $t="$_ "; } | 823 | elsif ($_ =~ /MD5_ASM/) { $t="$_ "; } |
| 1135 | elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; } | 824 | elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; } |
| 1136 | elsif ($_ =~ /AES_ASM/){ $t="$_ "; } | ||
| 1137 | elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; } | 825 | elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; } |
| 826 | elsif ($_ =~ /WHIRLPOOL_ASM/){ $t="$_ "; } | ||
| 1138 | elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; } | 827 | elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; } |
| 1139 | else { $t="$location${o}$_$pf "; } | 828 | else { $t="$location${o}$_$pf "; } |
| 1140 | 829 | ||
| @@ -1142,7 +831,7 @@ sub do_defs | |||
| 1142 | $ret.=$t; | 831 | $ret.=$t; |
| 1143 | } | 832 | } |
| 1144 | # hack to add version info on MSVC | 833 | # hack to add version info on MSVC |
| 1145 | if ($shlib && (($platform eq "VC-WIN32") || ($platform eq "VC-NT"))) | 834 | if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT"))) |
| 1146 | { | 835 | { |
| 1147 | if ($var eq "CRYPTOOBJ") | 836 | if ($var eq "CRYPTOOBJ") |
| 1148 | { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; } | 837 | { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; } |
| @@ -1162,6 +851,13 @@ sub bname | |||
| 1162 | return($ret); | 851 | return($ret); |
| 1163 | } | 852 | } |
| 1164 | 853 | ||
| 854 | # return the leading path | ||
| 855 | sub dname | ||
| 856 | { | ||
| 857 | my $ret=shift; | ||
| 858 | $ret =~ s/(^.*)[\\\/][^\\\/]+$/$1/; | ||
| 859 | return($ret); | ||
| 860 | } | ||
| 1165 | 861 | ||
| 1166 | ############################################################## | 862 | ############################################################## |
| 1167 | # do a rule for each file that says 'compile' to new direcory | 863 | # do a rule for each file that says 'compile' to new direcory |
| @@ -1169,19 +865,61 @@ sub bname | |||
| 1169 | sub do_compile_rule | 865 | sub do_compile_rule |
| 1170 | { | 866 | { |
| 1171 | local($to,$files,$ex)=@_; | 867 | local($to,$files,$ex)=@_; |
| 1172 | local($ret,$_,$n); | 868 | local($ret,$_,$n,$d,$s); |
| 1173 | 869 | ||
| 1174 | $files =~ s/\//$o/g if $o ne '/'; | 870 | $files =~ s/\//$o/g if $o ne '/'; |
| 1175 | foreach (split(/\s+/,$files)) | 871 | foreach (split(/\s+/,$files)) |
| 1176 | { | 872 | { |
| 1177 | $n=&bname($_); | 873 | $n=&bname($_); |
| 1178 | $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex) | 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 $_"; } | ||
| 1179 | } | 891 | } |
| 1180 | return($ret); | 892 | return($ret); |
| 1181 | } | 893 | } |
| 1182 | 894 | ||
| 1183 | ############################################################## | 895 | ############################################################## |
| 1184 | # do a rule for each file that says 'compile' to new direcory | 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 | |||
| 1185 | sub cc_compile_target | 923 | sub cc_compile_target |
| 1186 | { | 924 | { |
| 1187 | local($target,$source,$ex_flags)=@_; | 925 | local($target,$source,$ex_flags)=@_; |
| @@ -1204,13 +942,25 @@ sub do_asm_rule | |||
| 1204 | $target =~ s/\//$o/g if $o ne "/"; | 942 | $target =~ s/\//$o/g if $o ne "/"; |
| 1205 | $src =~ s/\//$o/g if $o ne "/"; | 943 | $src =~ s/\//$o/g if $o ne "/"; |
| 1206 | 944 | ||
| 1207 | @s=split(/\s+/,$src); | ||
| 1208 | @t=split(/\s+/,$target); | 945 | @t=split(/\s+/,$target); |
| 946 | @s=split(/\s+/,$src); | ||
| 947 | |||
| 1209 | 948 | ||
| 1210 | for ($i=0; $i<=$#s; $i++) | 949 | for ($i=0; $i<=$#s; $i++) |
| 1211 | { | 950 | { |
| 1212 | $ret.="$t[$i]: $s[$i]\n"; | 951 | my $objfile = $t[$i]; |
| 1213 | $ret.="\t\$(ASM) $afile$t[$i] \$(SRC_D)$o$s[$i]\n\n"; | 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"; | ||
| 1214 | } | 964 | } |
| 1215 | return($ret); | 965 | return($ret); |
| 1216 | } | 966 | } |
| @@ -1274,6 +1024,7 @@ sub read_options | |||
| 1274 | "no-sha1" => \$no_sha1, | 1024 | "no-sha1" => \$no_sha1, |
| 1275 | "no-ripemd" => \$no_ripemd, | 1025 | "no-ripemd" => \$no_ripemd, |
| 1276 | "no-mdc2" => \$no_mdc2, | 1026 | "no-mdc2" => \$no_mdc2, |
| 1027 | "no-whirlpool" => \$no_whirlpool, | ||
| 1277 | "no-patents" => | 1028 | "no-patents" => |
| 1278 | [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], | 1029 | [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], |
| 1279 | "no-rsa" => \$no_rsa, | 1030 | "no-rsa" => \$no_rsa, |
| @@ -1282,7 +1033,6 @@ sub read_options | |||
| 1282 | "no-hmac" => \$no_hmac, | 1033 | "no-hmac" => \$no_hmac, |
| 1283 | "no-asm" => \$no_asm, | 1034 | "no-asm" => \$no_asm, |
| 1284 | "nasm" => \$nasm, | 1035 | "nasm" => \$nasm, |
| 1285 | "ml64" => \$ml64, | ||
| 1286 | "nw-nasm" => \$nw_nasm, | 1036 | "nw-nasm" => \$nw_nasm, |
| 1287 | "nw-mwasm" => \$nw_mwasm, | 1037 | "nw-mwasm" => \$nw_mwasm, |
| 1288 | "gaswin" => \$gaswin, | 1038 | "gaswin" => \$gaswin, |
| @@ -1291,7 +1041,6 @@ sub read_options | |||
| 1291 | "no-tlsext" => \$no_tlsext, | 1041 | "no-tlsext" => \$no_tlsext, |
| 1292 | "no-cms" => \$no_cms, | 1042 | "no-cms" => \$no_cms, |
| 1293 | "no-jpake" => \$no_jpake, | 1043 | "no-jpake" => \$no_jpake, |
| 1294 | "no-capieng" => \$no_capieng, | ||
| 1295 | "no-err" => \$no_err, | 1044 | "no-err" => \$no_err, |
| 1296 | "no-sock" => \$no_sock, | 1045 | "no-sock" => \$no_sock, |
| 1297 | "no-krb5" => \$no_krb5, | 1046 | "no-krb5" => \$no_krb5, |
| @@ -1316,11 +1065,9 @@ sub read_options | |||
| 1316 | "no-rfc3779" => 0, | 1065 | "no-rfc3779" => 0, |
| 1317 | "no-montasm" => 0, | 1066 | "no-montasm" => 0, |
| 1318 | "no-shared" => 0, | 1067 | "no-shared" => 0, |
| 1068 | "no-store" => 0, | ||
| 1319 | "no-zlib" => 0, | 1069 | "no-zlib" => 0, |
| 1320 | "no-zlib-dynamic" => 0, | 1070 | "no-zlib-dynamic" => 0, |
| 1321 | "fips" => \$fips, | ||
| 1322 | "fipscanisterbuild" => [\$fips, \$fipscanisterbuild], | ||
| 1323 | "fipsdso" => [\$fips, \$fipscanisterbuild, \$fipsdso], | ||
| 1324 | ); | 1071 | ); |
| 1325 | 1072 | ||
| 1326 | if (exists $valid_options{$_}) | 1073 | if (exists $valid_options{$_}) |
| @@ -1397,31 +1144,3 @@ sub read_options | |||
| 1397 | else { return(0); } | 1144 | else { return(0); } |
| 1398 | return(1); | 1145 | return(1); |
| 1399 | } | 1146 | } |
| 1400 | |||
| 1401 | sub fipslib_error | ||
| 1402 | { | ||
| 1403 | print STDERR "***FIPS module directory sanity check failed***\n"; | ||
| 1404 | print STDERR "FIPS module build failed, or was deleted\n"; | ||
| 1405 | print STDERR "Please rebuild FIPS module.\n"; | ||
| 1406 | exit 1; | ||
| 1407 | } | ||
| 1408 | |||
| 1409 | sub fips_check_files | ||
| 1410 | { | ||
| 1411 | my $dir = shift @_; | ||
| 1412 | my $ret = 1; | ||
| 1413 | if (!-d $dir) | ||
| 1414 | { | ||
| 1415 | print STDERR "FIPS module directory $dir does not exist\n"; | ||
| 1416 | fipslib_error(); | ||
| 1417 | } | ||
| 1418 | foreach (@_) | ||
| 1419 | { | ||
| 1420 | if (!-f "$dir${o}$_") | ||
| 1421 | { | ||
| 1422 | print STDERR "FIPS module file $_ does not exist!\n"; | ||
| 1423 | $ret = 0; | ||
| 1424 | } | ||
| 1425 | } | ||
| 1426 | fipslib_error() if ($ret == 0); | ||
| 1427 | } | ||
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl index 5ae9ebb619..a4a17e3ae9 100644 --- a/src/lib/libcrypto/util/mkdef.pl +++ b/src/lib/libcrypto/util/mkdef.pl | |||
| @@ -69,7 +69,7 @@ my $do_ctestall = 0; | |||
| 69 | my $do_checkexist = 0; | 69 | my $do_checkexist = 0; |
| 70 | 70 | ||
| 71 | my $VMSVAX=0; | 71 | my $VMSVAX=0; |
| 72 | my $VMSAlpha=0; | 72 | my $VMSNonVAX=0; |
| 73 | my $VMS=0; | 73 | my $VMS=0; |
| 74 | my $W32=0; | 74 | my $W32=0; |
| 75 | my $W16=0; | 75 | my $W16=0; |
| @@ -79,12 +79,13 @@ my $OS2=0; | |||
| 79 | my $safe_stack_def = 0; | 79 | my $safe_stack_def = 0; |
| 80 | 80 | ||
| 81 | my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", | 81 | my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", |
| 82 | "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS"); | 82 | "EXPORT_VAR_AS_FUNCTION", "ZLIB" ); |
| 83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); | 83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); |
| 84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | 84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", |
| 85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", | 85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", |
| 86 | "SHA256", "SHA512", "RIPEMD", | 86 | "SHA256", "SHA512", "RIPEMD", |
| 87 | "MDC2", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "HMAC", "AES", "CAMELLIA", "SEED", | 87 | "MDC2", "WHIRLPOOL", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", |
| 88 | "HMAC", "AES", "CAMELLIA", "SEED", "GOST", | ||
| 88 | # Envelope "algorithms" | 89 | # Envelope "algorithms" |
| 89 | "EVP", "X509", "ASN1_TYPEDEFS", | 90 | "EVP", "X509", "ASN1_TYPEDEFS", |
| 90 | # Helper "algorithms" | 91 | # Helper "algorithms" |
| @@ -94,14 +95,16 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | |||
| 94 | "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM", | 95 | "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM", |
| 95 | # Engines | 96 | # Engines |
| 96 | "STATIC_ENGINE", "ENGINE", "HW", "GMP", | 97 | "STATIC_ENGINE", "ENGINE", "HW", "GMP", |
| 97 | # RFC3779 support | 98 | # RFC3779 |
| 98 | "RFC3779", | 99 | "RFC3779", |
| 99 | # TLS extension support | 100 | # TLS |
| 100 | "TLSEXT", | 101 | "TLSEXT", "PSK", |
| 101 | # CMS | 102 | # CMS |
| 102 | "CMS", | 103 | "CMS", |
| 103 | # CryptoAPI Engine | 104 | # CryptoAPI Engine |
| 104 | "CAPIENG", | 105 | "CAPIENG", |
| 106 | # SSL v2 | ||
| 107 | "SSL2", | ||
| 105 | # JPAKE | 108 | # JPAKE |
| 106 | "JPAKE", | 109 | "JPAKE", |
| 107 | # Deprecated functions | 110 | # Deprecated functions |
| @@ -118,14 +121,15 @@ close(IN); | |||
| 118 | # defined with ifndef(NO_XXX) are not included in the .def file, and everything | 121 | # defined with ifndef(NO_XXX) are not included in the .def file, and everything |
| 119 | # in directory xxx is ignored. | 122 | # in directory xxx is ignored. |
| 120 | my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf; | 123 | my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf; |
| 121 | my $no_cast; | 124 | my $no_cast; my $no_whirlpool; my $no_camellia; my $no_seed; |
| 122 | my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; | 125 | my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; |
| 123 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; | 126 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; |
| 124 | my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; my $no_camellia; | 127 | my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; |
| 125 | my $no_seed; | 128 | my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated; |
| 126 | my $no_fp_api; my $no_static_engine; my $no_gmp; my $no_deprecated; | 129 | my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng; |
| 127 | my $no_rfc3779; my $no_tlsext; my $no_cms; my $no_capieng; my $no_jpake; | 130 | my $no_jpake; my $no_ssl2; |
| 128 | my $fips; | 131 | |
| 132 | my $zlib; | ||
| 129 | 133 | ||
| 130 | 134 | ||
| 131 | foreach (@ARGV, split(/ /, $options)) | 135 | foreach (@ARGV, split(/ /, $options)) |
| @@ -141,17 +145,15 @@ foreach (@ARGV, split(/ /, $options)) | |||
| 141 | $VMS=1; | 145 | $VMS=1; |
| 142 | $VMSVAX=1; | 146 | $VMSVAX=1; |
| 143 | } | 147 | } |
| 144 | if ($_ eq "VMS-Alpha") { | 148 | if ($_ eq "VMS-NonVAX") { |
| 145 | $VMS=1; | 149 | $VMS=1; |
| 146 | $VMSAlpha=1; | 150 | $VMSNonVAX=1; |
| 147 | } | 151 | } |
| 148 | $VMS=1 if $_ eq "VMS"; | 152 | $VMS=1 if $_ eq "VMS"; |
| 149 | $OS2=1 if $_ eq "OS2"; | 153 | $OS2=1 if $_ eq "OS2"; |
| 150 | $fips=1 if /^fips/; | 154 | if ($_ eq "zlib" || $_ eq "enable-zlib" || $_ eq "zlib-dynamic" |
| 151 | 155 | || $_ eq "enable-zlib-dynamic") { | |
| 152 | if ($_ eq "zlib" || $_ eq "zlib-dynamic" | 156 | $zlib = 1; |
| 153 | || $_ eq "enable-zlib-dynamic") { | ||
| 154 | $zlib = 1; | ||
| 155 | } | 157 | } |
| 156 | 158 | ||
| 157 | $do_ssl=1 if $_ eq "ssleay"; | 159 | $do_ssl=1 if $_ eq "ssleay"; |
| @@ -180,6 +182,7 @@ foreach (@ARGV, split(/ /, $options)) | |||
| 180 | elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; } | 182 | elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; } |
| 181 | elsif (/^no-bf$/) { $no_bf=1; } | 183 | elsif (/^no-bf$/) { $no_bf=1; } |
| 182 | elsif (/^no-cast$/) { $no_cast=1; } | 184 | elsif (/^no-cast$/) { $no_cast=1; } |
| 185 | elsif (/^no-whirlpool$/) { $no_whirlpool=1; } | ||
| 183 | elsif (/^no-md2$/) { $no_md2=1; } | 186 | elsif (/^no-md2$/) { $no_md2=1; } |
| 184 | elsif (/^no-md4$/) { $no_md4=1; } | 187 | elsif (/^no-md4$/) { $no_md4=1; } |
| 185 | elsif (/^no-md5$/) { $no_md5=1; } | 188 | elsif (/^no-md5$/) { $no_md5=1; } |
| @@ -212,6 +215,7 @@ foreach (@ARGV, split(/ /, $options)) | |||
| 212 | elsif (/^no-rfc3779$/) { $no_rfc3779=1; } | 215 | elsif (/^no-rfc3779$/) { $no_rfc3779=1; } |
| 213 | elsif (/^no-tlsext$/) { $no_tlsext=1; } | 216 | elsif (/^no-tlsext$/) { $no_tlsext=1; } |
| 214 | elsif (/^no-cms$/) { $no_cms=1; } | 217 | elsif (/^no-cms$/) { $no_cms=1; } |
| 218 | elsif (/^no-ssl2$/) { $no_ssl2=1; } | ||
| 215 | elsif (/^no-capieng$/) { $no_capieng=1; } | 219 | elsif (/^no-capieng$/) { $no_capieng=1; } |
| 216 | elsif (/^no-jpake$/) { $no_jpake=1; } | 220 | elsif (/^no-jpake$/) { $no_jpake=1; } |
| 217 | } | 221 | } |
| @@ -260,6 +264,7 @@ $crypto.=" crypto/rc5/rc5.h" ; # unless $no_rc5; | |||
| 260 | $crypto.=" crypto/rc2/rc2.h" ; # unless $no_rc2; | 264 | $crypto.=" crypto/rc2/rc2.h" ; # unless $no_rc2; |
| 261 | $crypto.=" crypto/bf/blowfish.h" ; # unless $no_bf; | 265 | $crypto.=" crypto/bf/blowfish.h" ; # unless $no_bf; |
| 262 | $crypto.=" crypto/cast/cast.h" ; # unless $no_cast; | 266 | $crypto.=" crypto/cast/cast.h" ; # unless $no_cast; |
| 267 | $crypto.=" crypto/whrlpool/whrlpool.h" ; | ||
| 263 | $crypto.=" crypto/md2/md2.h" ; # unless $no_md2; | 268 | $crypto.=" crypto/md2/md2.h" ; # unless $no_md2; |
| 264 | $crypto.=" crypto/md4/md4.h" ; # unless $no_md4; | 269 | $crypto.=" crypto/md4/md4.h" ; # unless $no_md4; |
| 265 | $crypto.=" crypto/md5/md5.h" ; # unless $no_md5; | 270 | $crypto.=" crypto/md5/md5.h" ; # unless $no_md5; |
| @@ -301,17 +306,16 @@ $crypto.=" crypto/pkcs12/pkcs12.h"; | |||
| 301 | $crypto.=" crypto/x509/x509.h"; | 306 | $crypto.=" crypto/x509/x509.h"; |
| 302 | $crypto.=" crypto/x509/x509_vfy.h"; | 307 | $crypto.=" crypto/x509/x509_vfy.h"; |
| 303 | $crypto.=" crypto/x509v3/x509v3.h"; | 308 | $crypto.=" crypto/x509v3/x509v3.h"; |
| 309 | $crypto.=" crypto/ts/ts.h"; | ||
| 304 | $crypto.=" crypto/rand/rand.h"; | 310 | $crypto.=" crypto/rand/rand.h"; |
| 305 | $crypto.=" crypto/comp/comp.h" ; # unless $no_comp; | 311 | $crypto.=" crypto/comp/comp.h" ; # unless $no_comp; |
| 306 | $crypto.=" crypto/ocsp/ocsp.h"; | 312 | $crypto.=" crypto/ocsp/ocsp.h"; |
| 307 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; | 313 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; |
| 308 | $crypto.=" crypto/krb5/krb5_asn.h"; | 314 | $crypto.=" crypto/krb5/krb5_asn.h"; |
| 309 | $crypto.=" crypto/tmdiff.h"; | 315 | #$crypto.=" crypto/store/store.h"; |
| 310 | $crypto.=" crypto/store/store.h"; | ||
| 311 | $crypto.=" crypto/pqueue/pqueue.h"; | 316 | $crypto.=" crypto/pqueue/pqueue.h"; |
| 312 | $crypto.=" crypto/cms/cms.h"; | 317 | $crypto.=" crypto/cms/cms.h"; |
| 313 | $crypto.=" crypto/jpake/jpake.h"; | 318 | $crypto.=" crypto/jpake/jpake.h"; |
| 314 | $crypto.=" fips/fips.h fips/rand/fips_rand.h"; | ||
| 315 | 319 | ||
| 316 | my $symhacks="crypto/symhacks.h"; | 320 | my $symhacks="crypto/symhacks.h"; |
| 317 | 321 | ||
| @@ -885,6 +889,7 @@ sub do_defs | |||
| 885 | s/\{\}/\(\)/gs; | 889 | s/\{\}/\(\)/gs; |
| 886 | 890 | ||
| 887 | s/STACK_OF\(\)/void/gs; | 891 | s/STACK_OF\(\)/void/gs; |
| 892 | s/LHASH_OF\(\)/void/gs; | ||
| 888 | 893 | ||
| 889 | print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug; | 894 | print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug; |
| 890 | if (/^\#INFO:([^:]*):(.*)$/) { | 895 | if (/^\#INFO:([^:]*):(.*)$/) { |
| @@ -961,6 +966,25 @@ sub do_defs | |||
| 961 | $platform{"PEM_write_NS_CERT_SEQ"} = "VMS"; | 966 | $platform{"PEM_write_NS_CERT_SEQ"} = "VMS"; |
| 962 | $platform{"PEM_read_P8_PRIV_KEY_INFO"} = "VMS"; | 967 | $platform{"PEM_read_P8_PRIV_KEY_INFO"} = "VMS"; |
| 963 | $platform{"PEM_write_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 | |||
| 964 | 988 | ||
| 965 | # Info we know about | 989 | # Info we know about |
| 966 | 990 | ||
| @@ -1085,6 +1109,8 @@ sub is_valid | |||
| 1085 | 1109 | ||
| 1086 | if ($platforms) { | 1110 | if ($platforms) { |
| 1087 | # platforms | 1111 | # platforms |
| 1112 | if ($keyword eq "VMSVAX" && $VMSVAX) { return 1; } | ||
| 1113 | if ($keyword eq "VMSNonVAX" && $VMSNonVAX) { return 1; } | ||
| 1088 | if ($keyword eq "VMS" && $VMS) { return 1; } | 1114 | if ($keyword eq "VMS" && $VMS) { return 1; } |
| 1089 | if ($keyword eq "WIN32" && $W32) { return 1; } | 1115 | if ($keyword eq "WIN32" && $W32) { return 1; } |
| 1090 | if ($keyword eq "WIN16" && $W16) { return 1; } | 1116 | if ($keyword eq "WIN16" && $W16) { return 1; } |
| @@ -1097,9 +1123,6 @@ sub is_valid | |||
| 1097 | if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { | 1123 | if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { |
| 1098 | return 1; | 1124 | return 1; |
| 1099 | } | 1125 | } |
| 1100 | if ($keyword eq "OPENSSL_FIPS" && $fips) { | ||
| 1101 | return 1; | ||
| 1102 | } | ||
| 1103 | if ($keyword eq "ZLIB" && $zlib) { return 1; } | 1126 | if ($keyword eq "ZLIB" && $zlib) { return 1; } |
| 1104 | return 0; | 1127 | return 0; |
| 1105 | } else { | 1128 | } else { |
| @@ -1117,6 +1140,7 @@ sub is_valid | |||
| 1117 | if ($keyword eq "SHA" && $no_sha) { return 0; } | 1140 | if ($keyword eq "SHA" && $no_sha) { return 0; } |
| 1118 | if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; } | 1141 | if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; } |
| 1119 | if ($keyword eq "MDC2" && $no_mdc2) { return 0; } | 1142 | if ($keyword eq "MDC2" && $no_mdc2) { return 0; } |
| 1143 | if ($keyword eq "WHIRLPOOL" && $no_whirlpool) { return 0; } | ||
| 1120 | if ($keyword eq "RSA" && $no_rsa) { return 0; } | 1144 | if ($keyword eq "RSA" && $no_rsa) { return 0; } |
| 1121 | if ($keyword eq "DSA" && $no_dsa) { return 0; } | 1145 | if ($keyword eq "DSA" && $no_dsa) { return 0; } |
| 1122 | if ($keyword eq "DH" && $no_dh) { return 0; } | 1146 | if ($keyword eq "DH" && $no_dh) { return 0; } |
| @@ -1143,7 +1167,9 @@ sub is_valid | |||
| 1143 | if ($keyword eq "GMP" && $no_gmp) { return 0; } | 1167 | if ($keyword eq "GMP" && $no_gmp) { return 0; } |
| 1144 | if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; } | 1168 | if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; } |
| 1145 | if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; } | 1169 | if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; } |
| 1170 | if ($keyword eq "PSK" && $no_psk) { return 0; } | ||
| 1146 | if ($keyword eq "CMS" && $no_cms) { return 0; } | 1171 | if ($keyword eq "CMS" && $no_cms) { return 0; } |
| 1172 | if ($keyword eq "SSL2" && $no_ssl2) { return 0; } | ||
| 1147 | if ($keyword eq "CAPIENG" && $no_capieng) { return 0; } | 1173 | if ($keyword eq "CAPIENG" && $no_capieng) { return 0; } |
| 1148 | if ($keyword eq "JPAKE" && $no_jpake) { return 0; } | 1174 | if ($keyword eq "JPAKE" && $no_jpake) { return 0; } |
| 1149 | if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; } | 1175 | if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; } |
diff --git a/src/lib/libcrypto/util/mkerr.pl b/src/lib/libcrypto/util/mkerr.pl index 554bebb159..15b774f277 100644 --- a/src/lib/libcrypto/util/mkerr.pl +++ b/src/lib/libcrypto/util/mkerr.pl | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #!/usr/local/bin/perl -w | 1 | #!/usr/local/bin/perl -w |
| 2 | 2 | ||
| 3 | my $config = "crypto/err/openssl.ec"; | 3 | my $config = "crypto/err/openssl.ec"; |
| 4 | my $hprefix = "openssl/"; | ||
| 4 | my $debug = 0; | 5 | my $debug = 0; |
| 5 | my $rebuild = 0; | 6 | my $rebuild = 0; |
| 6 | my $static = 1; | 7 | my $static = 1; |
| @@ -12,11 +13,16 @@ my $staticloader = ""; | |||
| 12 | my $pack_errcode; | 13 | my $pack_errcode; |
| 13 | my $load_errcode; | 14 | my $load_errcode; |
| 14 | 15 | ||
| 16 | my $errcount; | ||
| 17 | |||
| 15 | while (@ARGV) { | 18 | while (@ARGV) { |
| 16 | my $arg = $ARGV[0]; | 19 | my $arg = $ARGV[0]; |
| 17 | if($arg eq "-conf") { | 20 | if($arg eq "-conf") { |
| 18 | shift @ARGV; | 21 | shift @ARGV; |
| 19 | $config = shift @ARGV; | 22 | $config = shift @ARGV; |
| 23 | } elsif($arg eq "-hprefix") { | ||
| 24 | shift @ARGV; | ||
| 25 | $hprefix = shift @ARGV; | ||
| 20 | } elsif($arg eq "-debug") { | 26 | } elsif($arg eq "-debug") { |
| 21 | $debug = 1; | 27 | $debug = 1; |
| 22 | shift @ARGV; | 28 | shift @ARGV; |
| @@ -38,14 +44,78 @@ while (@ARGV) { | |||
| 38 | } elsif($arg eq "-write") { | 44 | } elsif($arg eq "-write") { |
| 39 | $dowrite = 1; | 45 | $dowrite = 1; |
| 40 | shift @ARGV; | 46 | shift @ARGV; |
| 47 | } elsif($arg eq "-help" || $arg eq "-h" || $arg eq "-?" || $arg eq "--help") { | ||
| 48 | print STDERR <<"EOF"; | ||
| 49 | mkerr.pl [options] ... | ||
| 50 | |||
| 51 | Options: | ||
| 52 | |||
| 53 | -conf F Use the config file F instead of the default one: | ||
| 54 | crypto/err/openssl.ec | ||
| 55 | |||
| 56 | -hprefix P Prepend the filenames in generated #include <header> | ||
| 57 | statements with prefix P. Default: 'openssl/' (without | ||
| 58 | the quotes, naturally) | ||
| 59 | |||
| 60 | -debug Turn on debugging verbose output on stderr. | ||
| 61 | |||
| 62 | -rebuild Rebuild all header and C source files, irrespective of the | ||
| 63 | fact if any error or function codes have been added/removed. | ||
| 64 | Default: only update files for libraries which saw change | ||
| 65 | (of course, this requires '-write' as well, or no | ||
| 66 | files will be touched!) | ||
| 67 | |||
| 68 | -recurse scan a preconfigured set of directories / files for error and | ||
| 69 | function codes: | ||
| 70 | (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <apps/*.c>) | ||
| 71 | When this option is NOT specified, the filelist is taken from | ||
| 72 | the commandline instead. Here, wildcards may be embedded. (Be | ||
| 73 | sure to escape those to prevent the shell from expanding them | ||
| 74 | for you when you wish mkerr.pl to do so instead.) | ||
| 75 | Default: take file list to scan from the command line. | ||
| 76 | |||
| 77 | -reindex Discard the numeric values previously assigned to the error | ||
| 78 | and function codes as extracted from the scanned header files; | ||
| 79 | instead renumber all of them starting from 100. (Note that | ||
| 80 | the numbers assigned through 'R' records in the config file | ||
| 81 | remain intact.) | ||
| 82 | Default: keep previously assigned numbers. (You are warned | ||
| 83 | when collisions are detected.) | ||
| 84 | |||
| 85 | -nostatic Generates a different source code, where these additional | ||
| 86 | functions are generated for each library specified in the | ||
| 87 | config file: | ||
| 88 | void ERR_load_<LIB>_strings(void); | ||
| 89 | void ERR_unload_<LIB>_strings(void); | ||
| 90 | void ERR_<LIB>_error(int f, int r, char *fn, int ln); | ||
| 91 | #define <LIB>err(f,r) ERR_<LIB>_error(f,r,__FILE__,__LINE__) | ||
| 92 | while the code facilitates the use of these in an environment | ||
| 93 | where the error support routines are dynamically loaded at | ||
| 94 | runtime. | ||
| 95 | Default: 'static' code generation. | ||
| 96 | |||
| 97 | -staticloader Prefix generated functions with the 'static' scope modifier. | ||
| 98 | Default: don't write any scope modifier prefix. | ||
| 99 | |||
| 100 | -write Actually (over)write the generated code to the header and C | ||
| 101 | source files as assigned to each library through the config | ||
| 102 | file. | ||
| 103 | Default: don't write. | ||
| 104 | |||
| 105 | -help / -h / -? / --help Show this help text. | ||
| 106 | |||
| 107 | ... Additional arguments are added to the file list to scan, | ||
| 108 | assuming '-recurse' was NOT specified on the command line. | ||
| 109 | |||
| 110 | EOF | ||
| 111 | exit 1; | ||
| 41 | } else { | 112 | } else { |
| 42 | last; | 113 | last; |
| 43 | } | 114 | } |
| 44 | } | 115 | } |
| 45 | 116 | ||
| 46 | if($recurse) { | 117 | if($recurse) { |
| 47 | @source = ( <crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, | 118 | @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>); |
| 48 | <fips/*.c>, <fips/*/*.c>); | ||
| 49 | } else { | 119 | } else { |
| 50 | @source = @ARGV; | 120 | @source = @ARGV; |
| 51 | } | 121 | } |
| @@ -64,8 +134,8 @@ while(<IN>) | |||
| 64 | $cskip{$3} = $1; | 134 | $cskip{$3} = $1; |
| 65 | if($3 ne "NONE") { | 135 | if($3 ne "NONE") { |
| 66 | $csrc{$1} = $3; | 136 | $csrc{$1} = $3; |
| 67 | $fmax{$1} = 99; | 137 | $fmax{$1} = 100; |
| 68 | $rmax{$1} = 99; | 138 | $rmax{$1} = 100; |
| 69 | $fassigned{$1} = ":"; | 139 | $fassigned{$1} = ":"; |
| 70 | $rassigned{$1} = ":"; | 140 | $rassigned{$1} = ":"; |
| 71 | $fnew{$1} = 0; | 141 | $fnew{$1} = 0; |
| @@ -191,7 +261,8 @@ while (($hdr, $lib) = each %libinc) | |||
| 191 | if($1 eq "R") { | 261 | if($1 eq "R") { |
| 192 | $rcodes{$name} = $code; | 262 | $rcodes{$name} = $code; |
| 193 | if ($rassigned{$lib} =~ /:$code:/) { | 263 | if ($rassigned{$lib} =~ /:$code:/) { |
| 194 | print STDERR "!! ERROR: $lib reason code $code assigned twice\n"; | 264 | print STDERR "!! ERROR: $lib reason code $code assigned twice (collision at $name)\n"; |
| 265 | ++$errcount; | ||
| 195 | } | 266 | } |
| 196 | $rassigned{$lib} .= "$code:"; | 267 | $rassigned{$lib} .= "$code:"; |
| 197 | if(!(exists $rextra{$name}) && | 268 | if(!(exists $rextra{$name}) && |
| @@ -200,7 +271,8 @@ while (($hdr, $lib) = each %libinc) | |||
| 200 | } | 271 | } |
| 201 | } else { | 272 | } else { |
| 202 | if ($fassigned{$lib} =~ /:$code:/) { | 273 | if ($fassigned{$lib} =~ /:$code:/) { |
| 203 | print STDERR "!! ERROR: $lib function code $code assigned twice\n"; | 274 | print STDERR "!! ERROR: $lib function code $code assigned twice (collision at $name)\n"; |
| 275 | ++$errcount; | ||
| 204 | } | 276 | } |
| 205 | $fassigned{$lib} .= "$code:"; | 277 | $fassigned{$lib} .= "$code:"; |
| 206 | if($code > $fmax{$lib}) { | 278 | if($code > $fmax{$lib}) { |
| @@ -231,6 +303,7 @@ while (($hdr, $lib) = each %libinc) | |||
| 231 | if ($rmax{$lib} >= 1000) { | 303 | if ($rmax{$lib} >= 1000) { |
| 232 | print STDERR "!! ERROR: SSL error codes 1000+ are reserved for alerts.\n"; | 304 | print STDERR "!! ERROR: SSL error codes 1000+ are reserved for alerts.\n"; |
| 233 | print STDERR "!! Any new alerts must be added to $config.\n"; | 305 | print STDERR "!! Any new alerts must be added to $config.\n"; |
| 306 | ++$errcount; | ||
| 234 | print STDERR "\n"; | 307 | print STDERR "\n"; |
| 235 | } | 308 | } |
| 236 | } | 309 | } |
| @@ -255,6 +328,9 @@ foreach $file (@source) { | |||
| 255 | print STDERR "File loaded: ".$file."\r" if $debug; | 328 | print STDERR "File loaded: ".$file."\r" if $debug; |
| 256 | open(IN, "<$file") || die "Can't open source file $file\n"; | 329 | open(IN, "<$file") || die "Can't open source file $file\n"; |
| 257 | while(<IN>) { | 330 | while(<IN>) { |
| 331 | # skip obsoleted source files entirely! | ||
| 332 | last if(/^#error\s+obsolete/); | ||
| 333 | |||
| 258 | if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) { | 334 | if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) { |
| 259 | next unless exists $csrc{$2}; | 335 | next unless exists $csrc{$2}; |
| 260 | next if($1 eq "BIO_F_BUFFER_CTX"); | 336 | next if($1 eq "BIO_F_BUFFER_CTX"); |
| @@ -264,6 +340,7 @@ foreach $file (@source) { | |||
| 264 | $fnew{$2}++; | 340 | $fnew{$2}++; |
| 265 | } | 341 | } |
| 266 | $notrans{$1} = 1 unless exists $ftrans{$3}; | 342 | $notrans{$1} = 1 unless exists $ftrans{$3}; |
| 343 | print STDERR "Function: $1\t= $fcodes{$1} (lib: $2, name: $3)\n" if $debug; | ||
| 267 | } | 344 | } |
| 268 | if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) { | 345 | if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) { |
| 269 | next unless exists $csrc{$2}; | 346 | next unless exists $csrc{$2}; |
| @@ -272,6 +349,7 @@ foreach $file (@source) { | |||
| 272 | $rcodes{$1} = "X"; | 349 | $rcodes{$1} = "X"; |
| 273 | $rnew{$2}++; | 350 | $rnew{$2}++; |
| 274 | } | 351 | } |
| 352 | print STDERR "Reason: $1\t= $rcodes{$1} (lib: $2)\n" if $debug; | ||
| 275 | } | 353 | } |
| 276 | } | 354 | } |
| 277 | close IN; | 355 | close IN; |
| @@ -313,7 +391,7 @@ foreach $lib (keys %csrc) | |||
| 313 | } else { | 391 | } else { |
| 314 | push @out, | 392 | push @out, |
| 315 | "/* ====================================================================\n", | 393 | "/* ====================================================================\n", |
| 316 | " * Copyright (c) 2001-2008 The OpenSSL Project. All rights reserved.\n", | 394 | " * Copyright (c) 2001-2010 The OpenSSL Project. All rights reserved.\n", |
| 317 | " *\n", | 395 | " *\n", |
| 318 | " * 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", |
| 319 | " * modification, are permitted provided that the following conditions\n", | 397 | " * modification, are permitted provided that the following conditions\n", |
| @@ -369,6 +447,10 @@ foreach $lib (keys %csrc) | |||
| 369 | "#ifndef HEADER_${lib}_ERR_H\n", | 447 | "#ifndef HEADER_${lib}_ERR_H\n", |
| 370 | "#define HEADER_${lib}_ERR_H\n", | 448 | "#define HEADER_${lib}_ERR_H\n", |
| 371 | "\n", | 449 | "\n", |
| 450 | "#ifdef __cplusplus\n", | ||
| 451 | "extern \"C\" {\n", | ||
| 452 | "#endif\n", | ||
| 453 | "\n", | ||
| 372 | "/* BEGIN ERROR CODES */\n"; | 454 | "/* BEGIN ERROR CODES */\n"; |
| 373 | } | 455 | } |
| 374 | open (OUT, ">$hfile") || die "Can't Open File $hfile for writing\n"; | 456 | open (OUT, ">$hfile") || die "Can't Open File $hfile for writing\n"; |
| @@ -455,14 +537,21 @@ EOF | |||
| 455 | if (/\b(${lib}_R_\w*)\b.*\"(.*)\"/) { | 537 | if (/\b(${lib}_R_\w*)\b.*\"(.*)\"/) { |
| 456 | $err_reason_strings{$1} = $2; | 538 | $err_reason_strings{$1} = $2; |
| 457 | } | 539 | } |
| 540 | if (/\b${lib}_F_(\w*)\b.*\"(.*)\"/) { | ||
| 541 | if (!exists $ftrans{$1} && ($1 ne $2)) { | ||
| 542 | print STDERR "WARNING: Mismatched function string $2\n"; | ||
| 543 | $ftrans{$1} = $2; | ||
| 544 | } | ||
| 545 | } | ||
| 458 | } | 546 | } |
| 459 | close(IN); | 547 | close(IN); |
| 460 | } | 548 | } |
| 461 | 549 | ||
| 550 | |||
| 462 | my $hincf; | 551 | my $hincf; |
| 463 | if($static) { | 552 | if($static) { |
| 464 | $hfile =~ /([^\/]+)$/; | 553 | $hfile =~ /([^\/]+)$/; |
| 465 | $hincf = "<openssl/$1>"; | 554 | $hincf = "<${hprefix}$1>"; |
| 466 | } else { | 555 | } else { |
| 467 | $hincf = "\"$hfile\""; | 556 | $hincf = "\"$hfile\""; |
| 468 | } | 557 | } |
| @@ -487,7 +576,7 @@ EOF | |||
| 487 | print OUT <<"EOF"; | 576 | print OUT <<"EOF"; |
| 488 | /* $cfile */ | 577 | /* $cfile */ |
| 489 | /* ==================================================================== | 578 | /* ==================================================================== |
| 490 | * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. | 579 | * Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved. |
| 491 | * | 580 | * |
| 492 | * Redistribution and use in source and binary forms, with or without | 581 | * Redistribution and use in source and binary forms, with or without |
| 493 | * modification, are permitted provided that the following conditions | 582 | * modification, are permitted provided that the following conditions |
| @@ -713,3 +802,9 @@ if($debug && defined(@runref) ) { | |||
| 713 | print STDERR "$_\n"; | 802 | print STDERR "$_\n"; |
| 714 | } | 803 | } |
| 715 | } | 804 | } |
| 805 | |||
| 806 | if($errcount) { | ||
| 807 | print STDERR "There were errors, failing...\n\n"; | ||
| 808 | exit $errcount; | ||
| 809 | } | ||
| 810 | |||
diff --git a/src/lib/libcrypto/util/mkfiles.pl b/src/lib/libcrypto/util/mkfiles.pl index 67fb8694c8..6d15831450 100644 --- a/src/lib/libcrypto/util/mkfiles.pl +++ b/src/lib/libcrypto/util/mkfiles.pl | |||
| @@ -26,6 +26,7 @@ my @dirs = ( | |||
| 26 | "crypto/aes", | 26 | "crypto/aes", |
| 27 | "crypto/camellia", | 27 | "crypto/camellia", |
| 28 | "crypto/seed", | 28 | "crypto/seed", |
| 29 | "crypto/modes", | ||
| 29 | "crypto/bn", | 30 | "crypto/bn", |
| 30 | "crypto/rsa", | 31 | "crypto/rsa", |
| 31 | "crypto/dsa", | 32 | "crypto/dsa", |
| @@ -46,6 +47,7 @@ my @dirs = ( | |||
| 46 | "crypto/pem", | 47 | "crypto/pem", |
| 47 | "crypto/x509", | 48 | "crypto/x509", |
| 48 | "crypto/x509v3", | 49 | "crypto/x509v3", |
| 50 | "crypto/cms", | ||
| 49 | "crypto/conf", | 51 | "crypto/conf", |
| 50 | "crypto/jpake", | 52 | "crypto/jpake", |
| 51 | "crypto/txt_db", | 53 | "crypto/txt_db", |
| @@ -56,25 +58,20 @@ my @dirs = ( | |||
| 56 | "crypto/ocsp", | 58 | "crypto/ocsp", |
| 57 | "crypto/ui", | 59 | "crypto/ui", |
| 58 | "crypto/krb5", | 60 | "crypto/krb5", |
| 59 | "crypto/store", | 61 | #"crypto/store", |
| 60 | "crypto/pqueue", | 62 | "crypto/pqueue", |
| 61 | "crypto/cms", | 63 | "crypto/whrlpool", |
| 62 | "fips", | 64 | "crypto/ts", |
| 63 | "fips/aes", | ||
| 64 | "fips/des", | ||
| 65 | "fips/dsa", | ||
| 66 | "fips/dh", | ||
| 67 | "fips/hmac", | ||
| 68 | "fips/rand", | ||
| 69 | "fips/rsa", | ||
| 70 | "fips/sha", | ||
| 71 | "ssl", | 65 | "ssl", |
| 72 | "apps", | 66 | "apps", |
| 73 | "engines", | 67 | "engines", |
| 68 | "engines/ccgost", | ||
| 74 | "test", | 69 | "test", |
| 75 | "tools" | 70 | "tools" |
| 76 | ); | 71 | ); |
| 77 | 72 | ||
| 73 | %top; | ||
| 74 | |||
| 78 | foreach (@dirs) { | 75 | foreach (@dirs) { |
| 79 | &files_dir ($_, "Makefile"); | 76 | &files_dir ($_, "Makefile"); |
| 80 | } | 77 | } |
| @@ -118,8 +115,8 @@ while (<IN>) | |||
| 118 | $o =~ s/\s+$//; | 115 | $o =~ s/\s+$//; |
| 119 | $o =~ s/\s+/ /g; | 116 | $o =~ s/\s+/ /g; |
| 120 | 117 | ||
| 121 | $o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g; | 118 | $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge; |
| 122 | $sym{$s}=$o; | 119 | $sym{$s}=($top{$s} or $o); |
| 123 | } | 120 | } |
| 124 | } | 121 | } |
| 125 | 122 | ||
| @@ -129,6 +126,15 @@ foreach (sort keys %sym) | |||
| 129 | { | 126 | { |
| 130 | print "$_=$sym{$_}\n"; | 127 | print "$_=$sym{$_}\n"; |
| 131 | } | 128 | } |
| 129 | if ($dir eq "." && defined($sym{"BUILDENV"})) | ||
| 130 | { | ||
| 131 | foreach (split(' ',$sym{"BUILDENV"})) | ||
| 132 | { | ||
| 133 | /^(.+)=/; | ||
| 134 | $top{$1}=$sym{$1}; | ||
| 135 | } | ||
| 136 | } | ||
| 137 | |||
| 132 | print "RELATIVE_DIRECTORY=\n"; | 138 | print "RELATIVE_DIRECTORY=\n"; |
| 133 | 139 | ||
| 134 | close (IN); | 140 | close (IN); |
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl index eacc327882..61db12c68f 100644 --- a/src/lib/libcrypto/util/mklink.pl +++ b/src/lib/libcrypto/util/mklink.pl | |||
| @@ -15,21 +15,13 @@ | |||
| 15 | # Apart from this, this script should be able to handle even the most | 15 | # Apart from this, this script should be able to handle even the most |
| 16 | # pathological cases. | 16 | # pathological cases. |
| 17 | 17 | ||
| 18 | my $pwd; | 18 | use Cwd; |
| 19 | eval 'use Cwd;'; | ||
| 20 | if ($@) | ||
| 21 | { | ||
| 22 | $pwd = `pwd`; | ||
| 23 | } | ||
| 24 | else | ||
| 25 | { | ||
| 26 | $pwd = getcwd(); | ||
| 27 | } | ||
| 28 | 19 | ||
| 29 | my $from = shift; | 20 | my $from = shift; |
| 30 | my @files = @ARGV; | 21 | my @files = @ARGV; |
| 31 | 22 | ||
| 32 | my @from_path = split(/[\\\/]/, $from); | 23 | my @from_path = split(/[\\\/]/, $from); |
| 24 | my $pwd = getcwd(); | ||
| 33 | chomp($pwd); | 25 | chomp($pwd); |
| 34 | my @pwd_path = split(/[\\\/]/, $pwd); | 26 | my @pwd_path = split(/[\\\/]/, $pwd); |
| 35 | 27 | ||
| @@ -59,6 +51,7 @@ my $to = join('/', @to_path); | |||
| 59 | 51 | ||
| 60 | my $file; | 52 | my $file; |
| 61 | $symlink_exists=eval {symlink("",""); 1}; | 53 | $symlink_exists=eval {symlink("",""); 1}; |
| 54 | if ($^O eq "msys") { $symlink_exists=0 }; | ||
| 62 | foreach $file (@files) { | 55 | foreach $file (@files) { |
| 63 | my $err = ""; | 56 | my $err = ""; |
| 64 | if ($symlink_exists) { | 57 | if ($symlink_exists) { |
diff --git a/src/lib/libcrypto/util/mksdef.pl b/src/lib/libcrypto/util/mksdef.pl deleted file mode 100644 index 065dc675f1..0000000000 --- a/src/lib/libcrypto/util/mksdef.pl +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | |||
| 2 | # Perl script to split libeay32.def into two distinct DEF files for use in | ||
| 3 | # fipdso mode. It works out symbols in each case by running "link" command and | ||
| 4 | # parsing the output to find the list of missing symbols then splitting | ||
| 5 | # libeay32.def based on the result. | ||
| 6 | |||
| 7 | |||
| 8 | # Get list of unknown symbols | ||
| 9 | |||
| 10 | my @deferr = `link @ARGV`; | ||
| 11 | |||
| 12 | my $preamble = ""; | ||
| 13 | my @fipsdll; | ||
| 14 | my @fipsrest; | ||
| 15 | my %nosym; | ||
| 16 | |||
| 17 | # Add symbols to a hash for easy lookup | ||
| 18 | |||
| 19 | foreach (@deferr) | ||
| 20 | { | ||
| 21 | if (/^.*symbol (\S+)$/) | ||
| 22 | { | ||
| 23 | $nosym{$1} = 1; | ||
| 24 | } | ||
| 25 | } | ||
| 26 | |||
| 27 | open (IN, "ms/libeay32.def") || die "Can't Open DEF file for spliting"; | ||
| 28 | |||
| 29 | my $started = 0; | ||
| 30 | |||
| 31 | # Parse libeay32.def into two arrays depending on whether the symbol matches | ||
| 32 | # the missing list. | ||
| 33 | |||
| 34 | |||
| 35 | foreach (<IN>) | ||
| 36 | { | ||
| 37 | if (/^\s*(\S+)\s*(\@\S+)\s*$/) | ||
| 38 | { | ||
| 39 | $started = 1; | ||
| 40 | if (exists $nosym{$1}) | ||
| 41 | { | ||
| 42 | push @fipsrest, $_; | ||
| 43 | } | ||
| 44 | else | ||
| 45 | { | ||
| 46 | my $imptmp = sprintf " %-39s %s\n", | ||
| 47 | "$1=libosslfips.$1", $2; | ||
| 48 | push @fipsrest, $imptmp; | ||
| 49 | push @fipsdll, "\t$1\n"; | ||
| 50 | } | ||
| 51 | } | ||
| 52 | $preamble .= $_ unless $started; | ||
| 53 | } | ||
| 54 | |||
| 55 | close IN; | ||
| 56 | |||
| 57 | # Hack! Add some additional exports needed for libcryptofips.dll | ||
| 58 | # | ||
| 59 | |||
| 60 | push @fipsdll, "\tOPENSSL_showfatal\n"; | ||
| 61 | push @fipsdll, "\tOPENSSL_cpuid_setup\n"; | ||
| 62 | |||
| 63 | # Write out DEF files for each array | ||
| 64 | |||
| 65 | write_def("ms/libosslfips.def", "LIBOSSLFIPS", $preamble, \@fipsdll); | ||
| 66 | write_def("ms/libeayfips.def", "", $preamble, \@fipsrest); | ||
| 67 | |||
| 68 | |||
| 69 | sub write_def | ||
| 70 | { | ||
| 71 | my ($fnam, $defname, $preamble, $rdefs) = @_; | ||
| 72 | open (OUT, ">$fnam") || die "Can't Open DEF file $fnam for Writing\n"; | ||
| 73 | |||
| 74 | if ($defname ne "") | ||
| 75 | { | ||
| 76 | $preamble =~ s/LIBEAY32/$defname/g; | ||
| 77 | $preamble =~ s/LIBEAY/$defname/g; | ||
| 78 | } | ||
| 79 | print OUT $preamble; | ||
| 80 | foreach (@$rdefs) | ||
| 81 | { | ||
| 82 | print OUT $_; | ||
| 83 | } | ||
| 84 | close OUT; | ||
| 85 | } | ||
| 86 | |||
| 87 | |||
diff --git a/src/lib/libcrypto/util/mkstack.pl b/src/lib/libcrypto/util/mkstack.pl index 2a968f395f..6a43757c95 100644 --- a/src/lib/libcrypto/util/mkstack.pl +++ b/src/lib/libcrypto/util/mkstack.pl | |||
| @@ -21,7 +21,7 @@ while (@ARGV) { | |||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | @source = (<crypto/*.[ch]>, <crypto/*/*.[ch]>, <ssl/*.[ch]>); | 24 | @source = (<crypto/*.[ch]>, <crypto/*/*.[ch]>, <ssl/*.[ch]>, <apps/*.[ch]>); |
| 25 | foreach $file (@source) { | 25 | foreach $file (@source) { |
| 26 | next if -l $file; | 26 | next if -l $file; |
| 27 | 27 | ||
| @@ -31,11 +31,19 @@ foreach $file (@source) { | |||
| 31 | while(<IN>) { | 31 | while(<IN>) { |
| 32 | if (/^DECLARE_STACK_OF\(([^)]+)\)/) { | 32 | if (/^DECLARE_STACK_OF\(([^)]+)\)/) { |
| 33 | push @stacklst, $1; | 33 | push @stacklst, $1; |
| 34 | } if (/^DECLARE_ASN1_SET_OF\(([^)]+)\)/) { | 34 | } |
| 35 | if (/^DECLARE_SPECIAL_STACK_OF\(([^,\s]+)\s*,\s*([^>\s]+)\)/) { | ||
| 36 | push @sstacklst, [$1, $2]; | ||
| 37 | } | ||
| 38 | if (/^DECLARE_ASN1_SET_OF\(([^)]+)\)/) { | ||
| 35 | push @asn1setlst, $1; | 39 | push @asn1setlst, $1; |
| 36 | } if (/^DECLARE_PKCS12_STACK_OF\(([^)]+)\)/) { | 40 | } |
| 41 | if (/^DECLARE_PKCS12_STACK_OF\(([^)]+)\)/) { | ||
| 37 | push @p12stklst, $1; | 42 | push @p12stklst, $1; |
| 38 | } | 43 | } |
| 44 | if (/^DECLARE_LHASH_OF\(([^)]+)\)/) { | ||
| 45 | push @lhashlst, $1; | ||
| 46 | } | ||
| 39 | } | 47 | } |
| 40 | close(IN); | 48 | close(IN); |
| 41 | } | 49 | } |
| @@ -65,7 +73,7 @@ while(<IN>) { | |||
| 65 | foreach $type_thing (sort @stacklst) { | 73 | foreach $type_thing (sort @stacklst) { |
| 66 | $new_stackfile .= <<EOF; | 74 | $new_stackfile .= <<EOF; |
| 67 | 75 | ||
| 68 | #define sk_${type_thing}_new(st) SKM_sk_new($type_thing, (st)) | 76 | #define sk_${type_thing}_new(cmp) SKM_sk_new($type_thing, (cmp)) |
| 69 | #define sk_${type_thing}_new_null() SKM_sk_new_null($type_thing) | 77 | #define sk_${type_thing}_new_null() SKM_sk_new_null($type_thing) |
| 70 | #define sk_${type_thing}_free(st) SKM_sk_free($type_thing, (st)) | 78 | #define sk_${type_thing}_free(st) SKM_sk_free($type_thing, (st)) |
| 71 | #define sk_${type_thing}_num(st) SKM_sk_num($type_thing, (st)) | 79 | #define sk_${type_thing}_num(st) SKM_sk_num($type_thing, (st)) |
| @@ -88,6 +96,39 @@ while(<IN>) { | |||
| 88 | #define sk_${type_thing}_is_sorted(st) SKM_sk_is_sorted($type_thing, (st)) | 96 | #define sk_${type_thing}_is_sorted(st) SKM_sk_is_sorted($type_thing, (st)) |
| 89 | EOF | 97 | EOF |
| 90 | } | 98 | } |
| 99 | |||
| 100 | foreach $type_thing (sort @sstacklst) { | ||
| 101 | my $t1 = $type_thing->[0]; | ||
| 102 | my $t2 = $type_thing->[1]; | ||
| 103 | $new_stackfile .= <<EOF; | ||
| 104 | |||
| 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()) | ||
| 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_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val)) | ||
| 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) | ||
| 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_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val), i) | ||
| 113 | #define sk_${t1}_free(st) SKM_sk_free(${t1}, st) | ||
| 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)) | ||
| 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)) | ||
| 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((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, ptr)) | ||
| 120 | #define sk_${t1}_set_cmp_func(st, cmp) \\ | ||
| 121 | ((int (*)(const $t2 * const *,const $t2 * const *)) \\ | ||
| 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) | ||
| 124 | #define sk_${t1}_shift(st) SKM_sk_shift($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)) | ||
| 127 | #define sk_${t1}_is_sorted(st) SKM_sk_is_sorted($t1, (st)) | ||
| 128 | |||
| 129 | EOF | ||
| 130 | } | ||
| 131 | |||
| 91 | foreach $type_thing (sort @asn1setlst) { | 132 | foreach $type_thing (sort @asn1setlst) { |
| 92 | $new_stackfile .= <<EOF; | 133 | $new_stackfile .= <<EOF; |
| 93 | 134 | ||
| @@ -108,6 +149,31 @@ EOF | |||
| 108 | SKM_PKCS12_decrypt_d2i($type_thing, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) | 149 | SKM_PKCS12_decrypt_d2i($type_thing, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) |
| 109 | EOF | 150 | EOF |
| 110 | } | 151 | } |
| 152 | |||
| 153 | foreach $type_thing (sort @lhashlst) { | ||
| 154 | my $lc_tt = lc $type_thing; | ||
| 155 | $new_stackfile .= <<EOF; | ||
| 156 | |||
| 157 | #define lh_${type_thing}_new() LHM_lh_new(${type_thing},${lc_tt}) | ||
| 158 | #define lh_${type_thing}_insert(lh,inst) LHM_lh_insert(${type_thing},lh,inst) | ||
| 159 | #define lh_${type_thing}_retrieve(lh,inst) LHM_lh_retrieve(${type_thing},lh,inst) | ||
| 160 | #define lh_${type_thing}_delete(lh,inst) LHM_lh_delete(${type_thing},lh,inst) | ||
| 161 | #define lh_${type_thing}_doall(lh,fn) LHM_lh_doall(${type_thing},lh,fn) | ||
| 162 | #define lh_${type_thing}_doall_arg(lh,fn,arg_type,arg) \\ | ||
| 163 | LHM_lh_doall_arg(${type_thing},lh,fn,arg_type,arg) | ||
| 164 | #define lh_${type_thing}_error(lh) LHM_lh_error(${type_thing},lh) | ||
| 165 | #define lh_${type_thing}_num_items(lh) LHM_lh_num_items(${type_thing},lh) | ||
| 166 | #define lh_${type_thing}_down_load(lh) LHM_lh_down_load(${type_thing},lh) | ||
| 167 | #define lh_${type_thing}_node_stats_bio(lh,out) \\ | ||
| 168 | LHM_lh_node_stats_bio(${type_thing},lh,out) | ||
| 169 | #define lh_${type_thing}_node_usage_stats_bio(lh,out) \\ | ||
| 170 | LHM_lh_node_usage_stats_bio(${type_thing},lh,out) | ||
| 171 | #define lh_${type_thing}_stats_bio(lh,out) \\ | ||
| 172 | LHM_lh_stats_bio(${type_thing},lh,out) | ||
| 173 | #define lh_${type_thing}_free(lh) LHM_lh_free(${type_thing},lh) | ||
| 174 | EOF | ||
| 175 | } | ||
| 176 | |||
| 111 | $new_stackfile .= "/* End of util/mkstack.pl block, you may now edit :-) */\n"; | 177 | $new_stackfile .= "/* End of util/mkstack.pl block, you may now edit :-) */\n"; |
| 112 | $inside_block = 2; | 178 | $inside_block = 2; |
| 113 | } | 179 | } |
diff --git a/src/lib/libcrypto/util/pl/BC-16.pl b/src/lib/libcrypto/util/pl/BC-16.pl deleted file mode 100644 index 8030653daa..0000000000 --- a/src/lib/libcrypto/util/pl/BC-16.pl +++ /dev/null | |||
| @@ -1,151 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # VCw16lib.pl - the file for Visual C++ 1.52b for windows, static libraries | ||
| 3 | # | ||
| 4 | |||
| 5 | $o='\\'; | ||
| 6 | $cp='copy'; | ||
| 7 | $rm='del'; | ||
| 8 | |||
| 9 | # C compiler stuff | ||
| 10 | $cc='bcc'; | ||
| 11 | |||
| 12 | if ($debug) | ||
| 13 | { $op="-v "; } | ||
| 14 | else { $op="-O "; } | ||
| 15 | |||
| 16 | $cflags="-d -ml $op -DL_ENDIAN"; | ||
| 17 | # I add the stack opt | ||
| 18 | $base_lflags="/c /C"; | ||
| 19 | $lflags="$base_lflags"; | ||
| 20 | |||
| 21 | if ($win16) | ||
| 22 | { | ||
| 23 | $shlib=1; | ||
| 24 | $cflags.=" -DOPENSSL_SYSNAME_WIN16"; | ||
| 25 | $app_cflag="-W"; | ||
| 26 | $lib_cflag="-WD"; | ||
| 27 | $lflags.="/Twe"; | ||
| 28 | } | ||
| 29 | else | ||
| 30 | { | ||
| 31 | $cflags.=" -DOENSSL_SYSNAME_MSDOS"; | ||
| 32 | $lflags.=" /Tde"; | ||
| 33 | } | ||
| 34 | |||
| 35 | if ($shlib) | ||
| 36 | { | ||
| 37 | $mlflags=" /Twd $base_lflags"; # stack if defined in .def file | ||
| 38 | $libs="libw ldllcew"; | ||
| 39 | $no_asm=1; | ||
| 40 | } | ||
| 41 | else | ||
| 42 | { $mlflags=''; } | ||
| 43 | |||
| 44 | $obj='.obj'; | ||
| 45 | $ofile="-o"; | ||
| 46 | |||
| 47 | # EXE linking stuff | ||
| 48 | $link="tlink"; | ||
| 49 | $efile=""; | ||
| 50 | $exep='.exe'; | ||
| 51 | $ex_libs="CL"; | ||
| 52 | $ex_libs.=$no_sock?"":" winsock.lib"; | ||
| 53 | |||
| 54 | $app_ex_obj="C0L.obj "; | ||
| 55 | $shlib_ex_obj="" if ($shlib); | ||
| 56 | |||
| 57 | # static library stuff | ||
| 58 | $mklib='tlib'; | ||
| 59 | $ranlib='echo no ranlib'; | ||
| 60 | $plib=""; | ||
| 61 | $libp=".lib"; | ||
| 62 | $shlibp=($shlib)?".dll":".lib"; | ||
| 63 | $lfile=''; | ||
| 64 | |||
| 65 | $asm='bcc -c -B -Tml'; | ||
| 66 | $afile='/o'; | ||
| 67 | if ($no_asm || $fips) | ||
| 68 | { | ||
| 69 | $bn_asm_obj=''; | ||
| 70 | $bn_asm_src=''; | ||
| 71 | } | ||
| 72 | elsif ($asmbits == 32) | ||
| 73 | { | ||
| 74 | $bn_asm_obj='crypto\bn\asm\x86w32.obj'; | ||
| 75 | $bn_asm_src='crypto\bn\asm\x86w32.asm'; | ||
| 76 | } | ||
| 77 | else | ||
| 78 | { | ||
| 79 | $bn_asm_obj='crypto\bn\asm\x86w16.obj'; | ||
| 80 | $bn_asm_src='crypto\bn\asm\x86w16.asm'; | ||
| 81 | } | ||
| 82 | |||
| 83 | sub do_lib_rule | ||
| 84 | { | ||
| 85 | local($target,$name,$shlib)=@_; | ||
| 86 | local($ret,$Name); | ||
| 87 | |||
| 88 | $taget =~ s/\//$o/g if $o ne '/'; | ||
| 89 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
| 90 | |||
| 91 | $ret.="$target: \$(${Name}OBJ)\n"; | ||
| 92 | $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
| 93 | |||
| 94 | # Due to a pathetic line length limit, I unwrap the args. | ||
| 95 | local($lib_names)=""; | ||
| 96 | local($dll_names)=""; | ||
| 97 | foreach $_ (sort split(/\s+/,$Vars{"${Name}OBJ"})) | ||
| 98 | { | ||
| 99 | $lib_names.=" +$_ &\n"; | ||
| 100 | $dll_names.=" $_\n"; | ||
| 101 | } | ||
| 102 | |||
| 103 | if (!$shlib) | ||
| 104 | { | ||
| 105 | $ret.="\t\$(MKLIB) $target & <<|\n$lib_names\n,\n|\n"; | ||
| 106 | } | ||
| 107 | else | ||
| 108 | { | ||
| 109 | local($ex)=($Name eq "SSL")?' $(L_CRYPTO) winsock':""; | ||
| 110 | $ret.="\t\$(LINK) \$(MLFLAGS) @&&|\n"; | ||
| 111 | $ret.=$dll_names; | ||
| 112 | $ret.="\n $target\n\n $ex $libs\nms$o${name}16.def;\n|\n"; | ||
| 113 | ($out_lib=$target) =~ s/O_/L_/; | ||
| 114 | $ret.="\timplib /nowep $out_lib $target\n\n"; | ||
| 115 | } | ||
| 116 | $ret.="\n"; | ||
| 117 | return($ret); | ||
| 118 | } | ||
| 119 | |||
| 120 | sub do_link_rule | ||
| 121 | { | ||
| 122 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; | ||
| 123 | local($ret,$f,$_,@f); | ||
| 124 | |||
| 125 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 126 | $n=&bname($target); | ||
| 127 | $ret.="$target: $files $dep_libs\n"; | ||
| 128 | $ret.=" \$(LINK) @&&|"; | ||
| 129 | |||
| 130 | # Due to a pathetic line length limit, I have to unwrap the args. | ||
| 131 | $ret.=" \$(LFLAGS) "; | ||
| 132 | if ($files =~ /\(([^)]*)\)$/) | ||
| 133 | { | ||
| 134 | $ret.=" \$(APP_EX_OBJ)"; | ||
| 135 | foreach $_ (sort split(/\s+/,$Vars{$1})) | ||
| 136 | { $ret.="\n $r $_ +"; } | ||
| 137 | chop($ret); | ||
| 138 | $ret.="\n"; | ||
| 139 | } | ||
| 140 | else | ||
| 141 | { $ret.="\n $r \$(APP_EX_OBJ) $files\n"; } | ||
| 142 | $ret.=" $target\n\n $libs\n\n|\n"; | ||
| 143 | if (defined $sha1file) | ||
| 144 | { | ||
| 145 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
| 146 | } | ||
| 147 | $ret.="\n"; | ||
| 148 | return($ret); | ||
| 149 | } | ||
| 150 | |||
| 151 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl index 99b8c058d2..1f1e13fb40 100644 --- a/src/lib/libcrypto/util/pl/BC-32.pl +++ b/src/lib/libcrypto/util/pl/BC-32.pl | |||
| @@ -117,7 +117,7 @@ ___ | |||
| 117 | else | 117 | else |
| 118 | { | 118 | { |
| 119 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | 119 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; |
| 120 | $ex.=' wsock32.lib gdi32.lib'; | 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"; | 121 | $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; |
| 122 | } | 122 | } |
| 123 | $ret.="\n"; | 123 | $ret.="\n"; |
diff --git a/src/lib/libcrypto/util/pl/Mingw32.pl b/src/lib/libcrypto/util/pl/Mingw32.pl index 8f0483fb93..fe3fb27a78 100644 --- a/src/lib/libcrypto/util/pl/Mingw32.pl +++ b/src/lib/libcrypto/util/pl/Mingw32.pl | |||
| @@ -19,7 +19,7 @@ $cc='gcc'; | |||
| 19 | if ($debug) | 19 | if ($debug) |
| 20 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -g2 -ggdb"; } | 20 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -g2 -ggdb"; } |
| 21 | else | 21 | else |
| 22 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -march=i486 -Wall"; } | 22 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -mcpu=i486 -Wall"; } |
| 23 | 23 | ||
| 24 | if ($gaswin and !$no_asm) | 24 | if ($gaswin and !$no_asm) |
| 25 | { | 25 | { |
| @@ -43,8 +43,6 @@ if ($gaswin and !$no_asm) | |||
| 43 | $rmd160_asm_src='crypto/ripemd/asm/rm-win32.s'; | 43 | $rmd160_asm_src='crypto/ripemd/asm/rm-win32.s'; |
| 44 | $sha1_asm_obj='$(OBJ_D)\s1-win32.o'; | 44 | $sha1_asm_obj='$(OBJ_D)\s1-win32.o'; |
| 45 | $sha1_asm_src='crypto/sha/asm/s1-win32.s'; | 45 | $sha1_asm_src='crypto/sha/asm/s1-win32.s'; |
| 46 | $cpuid_asm_obj='$(OBJ_D)\cpu-win32.o'; | ||
| 47 | $cpuid_asm_src='crypto/cpu-win32.s'; | ||
| 48 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS"; | 46 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS"; |
| 49 | } | 47 | } |
| 50 | 48 | ||
| @@ -57,7 +55,7 @@ $link='${CC}'; | |||
| 57 | $lflags='${CFLAGS}'; | 55 | $lflags='${CFLAGS}'; |
| 58 | $efile='-o '; | 56 | $efile='-o '; |
| 59 | $exep=''; | 57 | $exep=''; |
| 60 | $ex_libs="-lwsock32 -lgdi32"; | 58 | $ex_libs="-lws2_32 -lgdi32"; |
| 61 | 59 | ||
| 62 | # static library stuff | 60 | # static library stuff |
| 63 | $mklib='ar r'; | 61 | $mklib='ar r'; |
diff --git a/src/lib/libcrypto/util/pl/VC-16.pl b/src/lib/libcrypto/util/pl/VC-16.pl deleted file mode 100644 index 564ba3fd08..0000000000 --- a/src/lib/libcrypto/util/pl/VC-16.pl +++ /dev/null | |||
| @@ -1,177 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # VCw16lib.pl - the file for Visual C++ 1.52b for windows, static libraries | ||
| 3 | # | ||
| 4 | |||
| 5 | $ssl= "ssleay16"; | ||
| 6 | $crypto="libeay16"; | ||
| 7 | |||
| 8 | $o='\\'; | ||
| 9 | $cp='copy'; | ||
| 10 | $rm='del'; | ||
| 11 | |||
| 12 | # C compiler stuff | ||
| 13 | $cc='cl'; | ||
| 14 | |||
| 15 | $out_def="out16"; | ||
| 16 | $tmp_def="tmp16"; | ||
| 17 | $inc_def="inc16"; | ||
| 18 | |||
| 19 | if ($debug) | ||
| 20 | { | ||
| 21 | $op="/Od /Zi /Zd"; | ||
| 22 | $base_lflags="/CO"; | ||
| 23 | } | ||
| 24 | else { | ||
| 25 | $op="/G2 /f- /Ocgnotb2"; | ||
| 26 | } | ||
| 27 | $base_lflags.=" /FARCALL /NOLOGO /NOD /SEG:1024 /ONERROR:NOEXE /NOE /PACKC:60000"; | ||
| 28 | if ($win16) { $base_lflags.=" /PACKD:60000"; } | ||
| 29 | |||
| 30 | $cflags="/ALw /Gx- /Gt256 /Gf $op /W3 /WX -DL_ENDIAN /nologo"; | ||
| 31 | # I add the stack opt | ||
| 32 | $lflags="$base_lflags /STACK:20000"; | ||
| 33 | |||
| 34 | if ($win16) | ||
| 35 | { | ||
| 36 | $cflags.=" -DOPENSSL_SYSNAME_WIN16"; | ||
| 37 | $app_cflag="/Gw /FPi87"; | ||
| 38 | $lib_cflag="/Gw"; | ||
| 39 | $lib_cflag.=" -D_WINDLL -D_DLL" if $shlib; | ||
| 40 | $lib_cflag.=" -DWIN16TTY" if !$shlib; | ||
| 41 | $lflags.=" /ALIGN:256"; | ||
| 42 | $ex_libs.="oldnames llibcewq libw"; | ||
| 43 | } | ||
| 44 | else | ||
| 45 | { | ||
| 46 | $no_sock=1; | ||
| 47 | $cflags.=" -DMSDOS"; | ||
| 48 | $lflags.=" /EXEPACK"; | ||
| 49 | $ex_libs.="oldnames.lib llibce.lib"; | ||
| 50 | } | ||
| 51 | |||
| 52 | if ($shlib) | ||
| 53 | { | ||
| 54 | $mlflags="$base_lflags"; | ||
| 55 | $libs="oldnames ldllcew libw"; | ||
| 56 | $shlib_ex_obj=""; | ||
| 57 | # $no_asm=1; | ||
| 58 | $out_def="out16dll"; | ||
| 59 | $tmp_def="tmp16dll"; | ||
| 60 | } | ||
| 61 | else | ||
| 62 | { $mlflags=''; } | ||
| 63 | |||
| 64 | $app_ex_obj=""; | ||
| 65 | |||
| 66 | $obj='.obj'; | ||
| 67 | $ofile="/Fo"; | ||
| 68 | |||
| 69 | # EXE linking stuff | ||
| 70 | $link="link"; | ||
| 71 | $efile=""; | ||
| 72 | $exep='.exe'; | ||
| 73 | $ex_libs.=$no_sock?"":" winsock"; | ||
| 74 | |||
| 75 | # static library stuff | ||
| 76 | $mklib='lib /PAGESIZE:1024'; | ||
| 77 | $ranlib=''; | ||
| 78 | $plib=""; | ||
| 79 | $libp=".lib"; | ||
| 80 | $shlibp=($shlib)?".dll":".lib"; | ||
| 81 | $lfile=''; | ||
| 82 | |||
| 83 | $asm='ml /Cp /c /Cx'; | ||
| 84 | $afile='/Fo'; | ||
| 85 | |||
| 86 | $bn_asm_obj=''; | ||
| 87 | $bn_asm_src=''; | ||
| 88 | $des_enc_obj=''; | ||
| 89 | $des_enc_src=''; | ||
| 90 | $bf_enc_obj=''; | ||
| 91 | $bf_enc_src=''; | ||
| 92 | |||
| 93 | if (!$no_asm && !$fips) | ||
| 94 | { | ||
| 95 | if ($asmbits == 32) | ||
| 96 | { | ||
| 97 | $bn_asm_obj='crypto\bn\asm\x86w32.obj'; | ||
| 98 | $bn_asm_src='crypto\bn\asm\x86w32.asm'; | ||
| 99 | } | ||
| 100 | else | ||
| 101 | { | ||
| 102 | $bn_asm_obj='crypto\bn\asm\x86w16.obj'; | ||
| 103 | $bn_asm_src='crypto\bn\asm\x86w16.asm'; | ||
| 104 | } | ||
| 105 | } | ||
| 106 | |||
| 107 | sub do_lib_rule | ||
| 108 | { | ||
| 109 | local($objs,$target,$name,$shlib)=@_; | ||
| 110 | local($ret,$Name); | ||
| 111 | |||
| 112 | $taget =~ s/\//$o/g if $o ne '/'; | ||
| 113 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
| 114 | |||
| 115 | # $target="\$(LIB_D)$o$target"; | ||
| 116 | $ret.="$target: $objs\n"; | ||
| 117 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
| 118 | |||
| 119 | # Due to a pathetic line length limit, I unwrap the args. | ||
| 120 | local($lib_names)=""; | ||
| 121 | local($dll_names)=" \$(SHLIB_EX_OBJ) +\n"; | ||
| 122 | ($obj)= ($objs =~ /\((.*)\)/); | ||
| 123 | foreach $_ (sort split(/\s+/,$Vars{$obj})) | ||
| 124 | { | ||
| 125 | $lib_names.="+$_ &\n"; | ||
| 126 | $dll_names.=" $_ +\n"; | ||
| 127 | } | ||
| 128 | |||
| 129 | if (!$shlib) | ||
| 130 | { | ||
| 131 | $ret.="\tdel $target\n"; | ||
| 132 | $ret.="\t\$(MKLIB) @<<\n$target\ny\n$lib_names\n\n<<\n"; | ||
| 133 | } | ||
| 134 | else | ||
| 135 | { | ||
| 136 | local($ex)=($target =~ /O_SSL/)?'$(L_CRYPTO)':""; | ||
| 137 | $ex.=' winsock'; | ||
| 138 | $ret.="\t\$(LINK) \$(MLFLAGS) @<<\n"; | ||
| 139 | $ret.=$dll_names; | ||
| 140 | $ret.="\n $target\n\n $ex $libs\nms$o${name}.def;\n<<\n"; | ||
| 141 | ($out_lib=$target) =~ s/O_/L_/; | ||
| 142 | $ret.="\timplib /noignorecase /nowep $out_lib $target\n"; | ||
| 143 | } | ||
| 144 | $ret.="\n"; | ||
| 145 | return($ret); | ||
| 146 | } | ||
| 147 | |||
| 148 | sub do_link_rule | ||
| 149 | { | ||
| 150 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; | ||
| 151 | local($ret,$f,$_,@f); | ||
| 152 | |||
| 153 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 154 | $n=&bname($targer); | ||
| 155 | $ret.="$target: $files $dep_libs\n"; | ||
| 156 | $ret.=" \$(LINK) \$(LFLAGS) @<<\n"; | ||
| 157 | |||
| 158 | # Due to a pathetic line length limit, I have to unwrap the args. | ||
| 159 | if ($files =~ /\(([^)]*)\)$/) | ||
| 160 | { | ||
| 161 | @a=('$(APP_EX_OBJ)'); | ||
| 162 | push(@a,sort split(/\s+/,$Vars{$1})); | ||
| 163 | for $_ (@a) | ||
| 164 | { $ret.=" $_ +\n"; } | ||
| 165 | } | ||
| 166 | else | ||
| 167 | { $ret.=" \$(APP_EX_OBJ) $files"; } | ||
| 168 | $ret.="\n $target\n\n $libs\n\n<<\n"; | ||
| 169 | if (defined $sha1file) | ||
| 170 | { | ||
| 171 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
| 172 | } | ||
| 173 | $ret.="\n"; | ||
| 174 | return($ret); | ||
| 175 | } | ||
| 176 | |||
| 177 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl b/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl deleted file mode 100644 index b5bbcac6c2..0000000000 --- a/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl +++ /dev/null | |||
| @@ -1,222 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # VCw32lib.pl - the file for Visual C++ 4.[01] for windows NT, static libraries | ||
| 3 | # | ||
| 4 | |||
| 5 | |||
| 6 | if ($fips && !$shlib) | ||
| 7 | { | ||
| 8 | $crypto="libeayfips32"; | ||
| 9 | $crypto_compat = "libeaycompat32.lib"; | ||
| 10 | } | ||
| 11 | else | ||
| 12 | { | ||
| 13 | $crypto="libeay32"; | ||
| 14 | } | ||
| 15 | $ssl= "ssleay32"; | ||
| 16 | |||
| 17 | $o='/'; | ||
| 18 | #$cp='copy nul+'; # Timestamps get stuffed otherwise | ||
| 19 | #$rm='del'; | ||
| 20 | |||
| 21 | $cp='cp'; | ||
| 22 | $rm='rm'; | ||
| 23 | |||
| 24 | $zlib_lib="zlib1.lib"; | ||
| 25 | |||
| 26 | # C compiler stuff | ||
| 27 | $cc='cl'; | ||
| 28 | $cflags=' -MD -W3 -WX -Ox -O2 -Ob2 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32'; | ||
| 29 | $cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8 | ||
| 30 | $cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8 | ||
| 31 | $lflags="-nologo -subsystem:console -machine:I386 -opt:ref"; | ||
| 32 | $mlflags=''; | ||
| 33 | |||
| 34 | $out_def="gmout32"; | ||
| 35 | $tmp_def="gmtmp32"; | ||
| 36 | $inc_def="gminc32"; | ||
| 37 | |||
| 38 | if ($debug) | ||
| 39 | { | ||
| 40 | $cflags=" -MDd -W3 -WX -Zi -Yd -Od -nologo -DOPENSSL_SYSNAME_WIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32"; | ||
| 41 | $lflags.=" -debug"; | ||
| 42 | $mlflags.=' -debug'; | ||
| 43 | } | ||
| 44 | $cflags .= " -DOPENSSL_SYSNAME_WINNT" if $NT == 1; | ||
| 45 | |||
| 46 | $obj='.obj'; | ||
| 47 | $ofile="-Fo"; | ||
| 48 | |||
| 49 | # EXE linking stuff | ||
| 50 | $link="link"; | ||
| 51 | $efile="-out:"; | ||
| 52 | $exep='.exe'; | ||
| 53 | if ($no_sock) | ||
| 54 | { $ex_libs=""; } | ||
| 55 | else { $ex_libs="wsock32.lib user32.lib gdi32.lib"; } | ||
| 56 | |||
| 57 | # static library stuff | ||
| 58 | $mklib='lib'; | ||
| 59 | $ranlib=''; | ||
| 60 | $plib=""; | ||
| 61 | $libp=".lib"; | ||
| 62 | $shlibp=($shlib)?".dll":".lib"; | ||
| 63 | $lfile='-out:'; | ||
| 64 | |||
| 65 | $shlib_ex_obj=""; | ||
| 66 | $app_ex_obj="setargv.obj"; | ||
| 67 | if ($nasm) { | ||
| 68 | $asm='nasmw -f win32'; | ||
| 69 | $afile='-o '; | ||
| 70 | } else { | ||
| 71 | $asm='ml -Cp -coff -c -Cx'; | ||
| 72 | $asm.=" -Zi" if $debug; | ||
| 73 | $afile='-Fo'; | ||
| 74 | } | ||
| 75 | |||
| 76 | $bn_asm_obj=''; | ||
| 77 | $bn_asm_src=''; | ||
| 78 | $des_enc_obj=''; | ||
| 79 | $des_enc_src=''; | ||
| 80 | $bf_enc_obj=''; | ||
| 81 | $bf_enc_src=''; | ||
| 82 | |||
| 83 | if (!$no_asm && !$fips) | ||
| 84 | { | ||
| 85 | $bn_asm_obj='crypto/bn/asm/bn_win32.obj'; | ||
| 86 | $bn_asm_src='crypto/bn/asm/bn_win32.asm'; | ||
| 87 | $des_enc_obj='crypto/des/asm/d_win32.obj crypto/des/asm/y_win32.obj'; | ||
| 88 | $des_enc_src='crypto/des/asm/d_win32.asm crypto/des/asm/y_win32.asm'; | ||
| 89 | $bf_enc_obj='crypto/bf/asm/b_win32.obj'; | ||
| 90 | $bf_enc_src='crypto/bf/asm/b_win32.asm'; | ||
| 91 | $cast_enc_obj='crypto/cast/asm/c_win32.obj'; | ||
| 92 | $cast_enc_src='crypto/cast/asm/c_win32.asm'; | ||
| 93 | $rc4_enc_obj='crypto/rc4/asm/r4_win32.obj'; | ||
| 94 | $rc4_enc_src='crypto/rc4/asm/r4_win32.asm'; | ||
| 95 | $rc5_enc_obj='crypto/rc5/asm/r5_win32.obj'; | ||
| 96 | $rc5_enc_src='crypto/rc5/asm/r5_win32.asm'; | ||
| 97 | $md5_asm_obj='crypto/md5/asm/m5_win32.obj'; | ||
| 98 | $md5_asm_src='crypto/md5/asm/m5_win32.asm'; | ||
| 99 | $sha1_asm_obj='crypto/sha/asm/s1_win32.obj'; | ||
| 100 | $sha1_asm_src='crypto/sha/asm/s1_win32.asm'; | ||
| 101 | $rmd160_asm_obj='crypto/ripemd/asm/rm_win32.obj'; | ||
| 102 | $rmd160_asm_src='crypto/ripemd/asm/rm_win32.asm'; | ||
| 103 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM"; | ||
| 104 | } | ||
| 105 | |||
| 106 | if ($shlib) | ||
| 107 | { | ||
| 108 | $mlflags.=" $lflags -dll"; | ||
| 109 | # $cflags =~ s| -MD| -MT|; | ||
| 110 | $lib_cflag=" -D_WINDLL"; | ||
| 111 | $out_def="gmout32dll"; | ||
| 112 | $tmp_def="gmtmp32dll"; | ||
| 113 | } | ||
| 114 | |||
| 115 | $cflags.=" -Fd$out_def"; | ||
| 116 | |||
| 117 | sub do_lib_rule | ||
| 118 | { | ||
| 119 | local($objs,$target,$name,$shlib,$ign,$base_addr, $fips_get_sig, $fips_premain_src)=@_; | ||
| 120 | local($ret,$Name); | ||
| 121 | |||
| 122 | $taget =~ s/\//$o/g if $o ne '/'; | ||
| 123 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
| 124 | my $base_arg; | ||
| 125 | if ($base_addr ne "") | ||
| 126 | { | ||
| 127 | $base_arg= " -base:$base_addr"; | ||
| 128 | } | ||
| 129 | else | ||
| 130 | { | ||
| 131 | $base_arg = ""; | ||
| 132 | } | ||
| 133 | |||
| 134 | |||
| 135 | # $target="\$(LIB_D)$o$target"; | ||
| 136 | if (!$shlib) | ||
| 137 | { | ||
| 138 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
| 139 | $ret.="$target: $objs\n"; | ||
| 140 | $ex =' advapi32.lib'; | ||
| 141 | $ret.="\t\$(MKLIB) $lfile$target $objs $ex\n\n"; | ||
| 142 | } | ||
| 143 | else | ||
| 144 | { | ||
| 145 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | ||
| 146 | $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib'; | ||
| 147 | $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; | ||
| 148 | if (defined $fips_get_sig) | ||
| 149 | { | ||
| 150 | $ret.="$target: \$(O_FIPSCANISTER) $objs $fips_get_sig\n"; | ||
| 151 | $ret.="\tFIPS_LINK=\$(LINK) "; | ||
| 152 | $ret.="FIPS_CC=\$(CC) "; | ||
| 153 | $ret.="FIPS_CC_ARGS=\"-Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\" "; | ||
| 154 | $ret.="FIPS_PREMAIN_DSO=$fips_get_sig "; | ||
| 155 | $ret.="FIPS_TARGET=$target "; | ||
| 156 | $ret.="FIPS_LIBDIR=\$(FIPSLIB_D) "; | ||
| 157 | $ret.="\$(FIPSLINK) \$(MLFLAGS) $base_arg $efile$target "; | ||
| 158 | $ret.="-def:ms/${Name}.def \$(SHLIB_EX_OBJ) $objs "; | ||
| 159 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n\n"; | ||
| 160 | } | ||
| 161 | else | ||
| 162 | { | ||
| 163 | $ret.="$target: $objs\n"; | ||
| 164 | $ret.="\t\$(LINK) \$(MLFLAGS) $base_arg $efile$target /def:ms/${Name}.def \$(SHLIB_EX_OBJ) $objs $ex\n\n"; | ||
| 165 | } | ||
| 166 | } | ||
| 167 | $ret.="\n"; | ||
| 168 | return($ret); | ||
| 169 | } | ||
| 170 | |||
| 171 | sub do_link_rule | ||
| 172 | { | ||
| 173 | local($target,$files,$dep_libs,$libs,$standalone)=@_; | ||
| 174 | local($ret,$_); | ||
| 175 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 176 | $n=&bname($targer); | ||
| 177 | if ($standalone) | ||
| 178 | { | ||
| 179 | $ret.="$target: $files $dep_libs\n"; | ||
| 180 | $ret.="\t\$(LINK) \$(LFLAGS) $efile$target "; | ||
| 181 | $ret.="$files $libs\n\n"; | ||
| 182 | } | ||
| 183 | elsif ($fips && !$shlib) | ||
| 184 | { | ||
| 185 | $ret.="$target: \$(O_FIPSCANISTER) $files $dep_libs\n"; | ||
| 186 | $ret.="\tFIPS_LINK=\$(LINK) "; | ||
| 187 | $ret.="FIPS_CC=\$(CC) "; | ||
| 188 | $ret.="FIPS_CC_ARGS=\"-Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\" "; | ||
| 189 | $ret.="FIPS_PREMAIN_DSO= "; | ||
| 190 | $ret.="FIPS_TARGET=$target "; | ||
| 191 | $ret.="FIPS_LIBDIR=\$(FIPSLIB_D) "; | ||
| 192 | $ret.=" \$(FIPSLINK) \$(LFLAGS) $efile$target "; | ||
| 193 | $ret.="\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n\n"; | ||
| 194 | } | ||
| 195 | else | ||
| 196 | { | ||
| 197 | $ret.="$target: $files $dep_libs\n"; | ||
| 198 | $ret.="\t\$(LINK) \$(LFLAGS) $efile$target "; | ||
| 199 | $ret.="\$(APP_EX_OBJ) $files $libs\n\n"; | ||
| 200 | } | ||
| 201 | $ret.="\n"; | ||
| 202 | return($ret); | ||
| 203 | } | ||
| 204 | |||
| 205 | sub do_rlink_rule | ||
| 206 | { | ||
| 207 | local($target,$files,$check_hash, $deps)=@_; | ||
| 208 | local($ret,$_); | ||
| 209 | |||
| 210 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 211 | $n=&bname($targer); | ||
| 212 | $ret.="$target: $check_hash $files $deps\n"; | ||
| 213 | $ret.="\t\$(PERL) util${o}checkhash.pl -chdir fips-1.0 -program_path ..$o$check_hash\n"; | ||
| 214 | $ret.="\t\$(MKCANISTER) $target $files\n"; | ||
| 215 | $ret.="\t$check_hash $target > $target.sha1\n"; | ||
| 216 | $ret.="\t\$(CP) fips-1.0${o}fips_premain.c \$(FIPSLIB_D)\n"; | ||
| 217 | $ret.="\t$check_hash \$(FIPSLIB_D)${o}fips_premain.c > \$(FIPSLIB_D)${o}fips_premain.c.sha1\n\n"; | ||
| 218 | return($ret); | ||
| 219 | } | ||
| 220 | |||
| 221 | |||
| 222 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl index 8eb3c6c4bd..c3e29fda96 100644 --- a/src/lib/libcrypto/util/pl/VC-32.pl +++ b/src/lib/libcrypto/util/pl/VC-32.pl | |||
| @@ -4,21 +4,7 @@ | |||
| 4 | # | 4 | # |
| 5 | 5 | ||
| 6 | $ssl= "ssleay32"; | 6 | $ssl= "ssleay32"; |
| 7 | 7 | $crypto="libeay32"; | |
| 8 | if ($fips && !$shlib) | ||
| 9 | { | ||
| 10 | $crypto="libeayfips32"; | ||
| 11 | $crypto_compat = "libeaycompat32.lib"; | ||
| 12 | } | ||
| 13 | else | ||
| 14 | { | ||
| 15 | $crypto="libeay32"; | ||
| 16 | } | ||
| 17 | |||
| 18 | if ($fipscanisterbuild) | ||
| 19 | { | ||
| 20 | $fips_canister_path = "\$(LIB_D)\\fipscanister.lib"; | ||
| 21 | } | ||
| 22 | 8 | ||
| 23 | $o='\\'; | 9 | $o='\\'; |
| 24 | $cp='$(PERL) util/copy.pl'; | 10 | $cp='$(PERL) util/copy.pl'; |
| @@ -27,6 +13,10 @@ $rm='del /Q'; | |||
| 27 | 13 | ||
| 28 | $zlib_lib="zlib1.lib"; | 14 | $zlib_lib="zlib1.lib"; |
| 29 | 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 | |||
| 30 | # C compiler stuff | 20 | # C compiler stuff |
| 31 | $cc='cl'; | 21 | $cc='cl'; |
| 32 | if ($FLAVOR =~ /WIN64/) | 22 | if ($FLAVOR =~ /WIN64/) |
| @@ -42,14 +32,28 @@ if ($FLAVOR =~ /WIN64/) | |||
| 42 | # per 0.9.8 release remaining warnings were explicitly examined and | 32 | # per 0.9.8 release remaining warnings were explicitly examined and |
| 43 | # considered safe to ignore. | 33 | # considered safe to ignore. |
| 44 | # | 34 | # |
| 45 | $base_cflags=' /W3 /Gs0 /GF /Gy /nologo -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DOPENSSL_SYSNAME_WIN32 -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE'; | 35 | $base_cflags= " $mf_cflag"; |
| 46 | $base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8 | ||
| 47 | $base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8 | ||
| 48 | my $f = $shlib?' /MD':' /MT'; | 36 | my $f = $shlib?' /MD':' /MT'; |
| 49 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib | 37 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib |
| 50 | $opt_cflags=$f.' /Ox'; | 38 | $opt_cflags=$f.' /Ox'; |
| 51 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; | 39 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; |
| 52 | $lflags="/nologo /subsystem:console /opt:ref"; | 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 | } | ||
| 53 | } | 57 | } |
| 54 | elsif ($FLAVOR =~ /CE/) | 58 | elsif ($FLAVOR =~ /CE/) |
| 55 | { | 59 | { |
| @@ -99,18 +103,18 @@ elsif ($FLAVOR =~ /CE/) | |||
| 99 | } | 103 | } |
| 100 | 104 | ||
| 101 | $cc='$(CC)'; | 105 | $cc='$(CC)'; |
| 102 | $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include -DOPENSSL_SMALL_FOOTPRINT'; | 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'; |
| 103 | $base_cflags.=" $wcecdefs"; | 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'})); | ||
| 104 | $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... | 110 | $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... |
| 105 | $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG'; | 111 | $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG'; |
| 106 | $lflags="/nologo /opt:ref $wcelflag"; | 112 | $lflags="/nologo /opt:ref $wcelflag"; |
| 107 | } | 113 | } |
| 108 | else # Win32 | 114 | else # Win32 |
| 109 | { | 115 | { |
| 110 | $base_cflags=' /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32'; | 116 | $base_cflags= " $mf_cflag"; |
| 111 | $base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8 | 117 | my $f = $shlib?' /MD':' /MT'; |
| 112 | $base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8 | ||
| 113 | my $f = $shlib || $fips ?' /MD':' /MT'; | ||
| 114 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib | 118 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib |
| 115 | $opt_cflags=$f.' /Ox /O2 /Ob2'; | 119 | $opt_cflags=$f.' /Ox /O2 /Ob2'; |
| 116 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; | 120 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; |
| @@ -118,22 +122,28 @@ else # Win32 | |||
| 118 | } | 122 | } |
| 119 | $mlflags=''; | 123 | $mlflags=''; |
| 120 | 124 | ||
| 121 | $out_def="out32"; $out_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/); | 125 | $out_def ="out32"; $out_def.="dll" if ($shlib); |
| 122 | $tmp_def="tmp32"; $tmp_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/); | 126 | $out_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/); |
| 127 | $tmp_def ="tmp32"; $tmp_def.="dll" if ($shlib); | ||
| 128 | $tmp_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/); | ||
| 123 | $inc_def="inc32"; | 129 | $inc_def="inc32"; |
| 124 | 130 | ||
| 125 | if ($debug) | 131 | if ($debug) |
| 126 | { | 132 | { |
| 127 | $cflags=$dbg_cflags.$base_cflags; | 133 | $cflags=$dbg_cflags.$base_cflags; |
| 128 | $lflags.=" /debug"; | ||
| 129 | $mlflags.=' /debug'; | ||
| 130 | } | 134 | } |
| 131 | else | 135 | else |
| 132 | { | 136 | { |
| 133 | $cflags=$opt_cflags.$base_cflags; | 137 | $cflags=$opt_cflags.$base_cflags; |
| 134 | } | 138 | } |
| 135 | 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 | |||
| 136 | $obj='.obj'; | 145 | $obj='.obj'; |
| 146 | $asm_suffix='.asm'; | ||
| 137 | $ofile="/Fo"; | 147 | $ofile="/Fo"; |
| 138 | 148 | ||
| 139 | # EXE linking stuff | 149 | # EXE linking stuff |
| @@ -143,26 +153,23 @@ $efile="/out:"; | |||
| 143 | $exep='.exe'; | 153 | $exep='.exe'; |
| 144 | if ($no_sock) { $ex_libs=''; } | 154 | if ($no_sock) { $ex_libs=''; } |
| 145 | elsif ($FLAVOR =~ /CE/) { $ex_libs='winsock.lib'; } | 155 | elsif ($FLAVOR =~ /CE/) { $ex_libs='winsock.lib'; } |
| 146 | else { $ex_libs='wsock32.lib'; } | 156 | else { $ex_libs='ws2_32.lib'; } |
| 147 | 157 | ||
| 148 | if ($FLAVOR =~ /CE/) | 158 | if ($FLAVOR =~ /CE/) |
| 149 | { | 159 | { |
| 150 | $ex_libs.=' $(WCECOMPAT)/lib/wcecompatex.lib'; | 160 | $ex_libs.=' $(WCECOMPAT)/lib/wcecompatex.lib' if (defined($ENV{'WCECOMPAT'})); |
| 161 | $ex_libs.=' $(PORTSDK_LIBPATH)/portlib.lib' if (defined($ENV{'PORTSDK_LIBPATH'})); | ||
| 151 | $ex_libs.=' /nodefaultlib:oldnames.lib coredll.lib corelibc.lib' if ($ENV{'TARGETCPU'} eq "X86"); | 162 | $ex_libs.=' /nodefaultlib:oldnames.lib coredll.lib corelibc.lib' if ($ENV{'TARGETCPU'} eq "X86"); |
| 152 | } | 163 | } |
| 153 | else | 164 | else |
| 154 | { | 165 | { |
| 155 | $ex_libs.=' gdi32.lib crypt32.lib advapi32.lib user32.lib'; | 166 | $ex_libs.=' gdi32.lib advapi32.lib crypt32.lib user32.lib'; |
| 156 | $ex_libs.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/); | 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/); | ||
| 157 | } | 171 | } |
| 158 | 172 | ||
| 159 | # As native NT API is pure UNICODE, our WIN-NT build defaults to UNICODE, | ||
| 160 | # but gets linked with unicows.lib to ensure backward compatibility. | ||
| 161 | if ($FLAVOR =~ /NT/) | ||
| 162 | { | ||
| 163 | $cflags.=" -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE"; | ||
| 164 | $ex_libs="unicows.lib $ex_libs"; | ||
| 165 | } | ||
| 166 | # static library stuff | 173 | # static library stuff |
| 167 | $mklib='lib /nologo'; | 174 | $mklib='lib /nologo'; |
| 168 | $ranlib=''; | 175 | $ranlib=''; |
| @@ -173,23 +180,30 @@ $lfile='/out:'; | |||
| 173 | 180 | ||
| 174 | $shlib_ex_obj=""; | 181 | $shlib_ex_obj=""; |
| 175 | $app_ex_obj="setargv.obj" if ($FLAVOR !~ /CE/); | 182 | $app_ex_obj="setargv.obj" if ($FLAVOR !~ /CE/); |
| 176 | if ($nasm) { | 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) { | ||
| 177 | my $ver=`nasm -v 2>NUL`; | 195 | my $ver=`nasm -v 2>NUL`; |
| 178 | my $vew=`nasmw -v 2>NUL`; | 196 | my $vew=`nasmw -v 2>NUL`; |
| 179 | # pick newest version | 197 | # pick newest version |
| 180 | $asm=($ver gt $vew?"nasm":"nasmw")." -f win32"; | 198 | $asm=($ver gt $vew?"nasm":"nasmw")." -f win32"; |
| 199 | $asmtype="win32n"; | ||
| 181 | $afile='-o '; | 200 | $afile='-o '; |
| 182 | } elsif ($ml64) { | ||
| 183 | $asm='ml64 /c /Cp /Cx'; | ||
| 184 | $asm.=' /Zi' if $debug; | ||
| 185 | $afile='/Fo'; | ||
| 186 | } else { | 201 | } else { |
| 187 | $asm='ml /nologo /Cp /coff /c /Cx'; | 202 | $asm='ml /nologo /Cp /coff /c /Cx /Zi'; |
| 188 | $asm.=" /Zi" if $debug; | ||
| 189 | $afile='/Fo'; | 203 | $afile='/Fo'; |
| 204 | $asmtype="win32"; | ||
| 190 | } | 205 | } |
| 191 | 206 | ||
| 192 | $aes_asm_obj=''; | ||
| 193 | $bn_asm_obj=''; | 207 | $bn_asm_obj=''; |
| 194 | $bn_asm_src=''; | 208 | $bn_asm_src=''; |
| 195 | $des_enc_obj=''; | 209 | $des_enc_obj=''; |
| @@ -198,56 +212,26 @@ $bf_enc_obj=''; | |||
| 198 | $bf_enc_src=''; | 212 | $bf_enc_src=''; |
| 199 | 213 | ||
| 200 | if (!$no_asm) | 214 | if (!$no_asm) |
| 201 | { | ||
| 202 | if ($FLAVOR =~ "WIN32") | ||
| 203 | { | ||
| 204 | $aes_asm_obj='crypto\aes\asm\a_win32.obj'; | ||
| 205 | $aes_asm_src='crypto\aes\asm\a_win32.asm'; | ||
| 206 | $bn_asm_obj='crypto\bn\asm\bn_win32.obj crypto\bn\asm\mt_win32.obj'; | ||
| 207 | $bn_asm_src='crypto\bn\asm\bn_win32.asm crypto\bn\asm\mt_win32.asm'; | ||
| 208 | $bnco_asm_obj='crypto\bn\asm\co_win32.obj'; | ||
| 209 | $bnco_asm_src='crypto\bn\asm\co_win32.asm'; | ||
| 210 | $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj'; | ||
| 211 | $des_enc_src='crypto\des\asm\d_win32.asm crypto\des\asm\y_win32.asm'; | ||
| 212 | $bf_enc_obj='crypto\bf\asm\b_win32.obj'; | ||
| 213 | $bf_enc_src='crypto\bf\asm\b_win32.asm'; | ||
| 214 | $cast_enc_obj='crypto\cast\asm\c_win32.obj'; | ||
| 215 | $cast_enc_src='crypto\cast\asm\c_win32.asm'; | ||
| 216 | $rc4_enc_obj='crypto\rc4\asm\r4_win32.obj'; | ||
| 217 | $rc4_enc_src='crypto\rc4\asm\r4_win32.asm'; | ||
| 218 | $rc5_enc_obj='crypto\rc5\asm\r5_win32.obj'; | ||
| 219 | $rc5_enc_src='crypto\rc5\asm\r5_win32.asm'; | ||
| 220 | $md5_asm_obj='crypto\md5\asm\m5_win32.obj'; | ||
| 221 | $md5_asm_src='crypto\md5\asm\m5_win32.asm'; | ||
| 222 | $sha1_asm_obj='crypto\sha\asm\s1_win32.obj crypto\sha\asm\sha512-sse2.obj'; | ||
| 223 | $sha1_asm_src='crypto\sha\asm\s1_win32.asm crypto\sha\asm\sha512-sse2.asm'; | ||
| 224 | $rmd160_asm_obj='crypto\ripemd\asm\rm_win32.obj'; | ||
| 225 | $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm'; | ||
| 226 | $cpuid_asm_obj='crypto\cpu_win32.obj'; | ||
| 227 | $cpuid_asm_src='crypto\cpu_win32.asm'; | ||
| 228 | $cflags.=" -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DAES_ASM -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DMD5_ASM -DSHA1_ASM -DRMD160_ASM"; | ||
| 229 | } | ||
| 230 | elsif ($FLAVOR =~ "WIN64A") | ||
| 231 | { | 215 | { |
| 232 | $aes_asm_obj='$(OBJ_D)\aes-x86_64.obj'; | 216 | win32_import_asm($mf_bn_asm, "bn", \$bn_asm_obj, \$bn_asm_src); |
| 233 | $aes_asm_src='crypto\aes\asm\aes-x86_64.asm'; | 217 | win32_import_asm($mf_aes_asm, "aes", \$aes_asm_obj, \$aes_asm_src); |
| 234 | $bn_asm_obj='$(OBJ_D)\x86_64-mont.obj $(OBJ_D)\bn_asm.obj'; | 218 | win32_import_asm($mf_des_asm, "des", \$des_enc_obj, \$des_enc_src); |
| 235 | $bn_asm_src='crypto\bn\asm\x86_64-mont.asm'; | 219 | win32_import_asm($mf_bf_asm, "bf", \$bf_enc_obj, \$bf_enc_src); |
| 236 | $sha1_asm_obj='$(OBJ_D)\sha1-x86_64.obj $(OBJ_D)\sha256-x86_64.obj $(OBJ_D)\sha512-x86_64.obj'; | 220 | win32_import_asm($mf_cast_asm, "cast", \$cast_enc_obj, \$cast_enc_src); |
| 237 | $sha1_asm_src='crypto\sha\asm\sha1-x86_64.asm crypto\sha\asm\sha256-x86_64.asm crypto\sha\asm\sha512-x86_64.asm'; | 221 | win32_import_asm($mf_rc4_asm, "rc4", \$rc4_enc_obj, \$rc4_enc_src); |
| 238 | $cpuid_asm_obj='$(OBJ_D)\cpuid-x86_64.obj'; | 222 | win32_import_asm($mf_rc5_asm, "rc5", \$rc5_enc_obj, \$rc5_enc_src); |
| 239 | $cpuid_asm_src='crypto\cpuid-x86_64.asm'; | 223 | win32_import_asm($mf_md5_asm, "md5", \$md5_asm_obj, \$md5_asm_src); |
| 240 | $cflags.=" -DOPENSSL_CPUID_OBJ -DAES_ASM -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM"; | 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; | ||
| 241 | } | 229 | } |
| 242 | } | ||
| 243 | 230 | ||
| 244 | if ($shlib && $FLAVOR !~ /CE/) | 231 | if ($shlib && $FLAVOR !~ /CE/) |
| 245 | { | 232 | { |
| 246 | $mlflags.=" $lflags /dll"; | 233 | $mlflags.=" $lflags /dll"; |
| 247 | # $cflags =~ s| /MD| /MT|; | 234 | $lib_cflag.=" -D_WINDLL"; |
| 248 | $lib_cflag=" -D_WINDLL"; | ||
| 249 | $out_def="out32dll"; | ||
| 250 | $tmp_def="tmp32dll"; | ||
| 251 | # | 235 | # |
| 252 | # Engage Applink... | 236 | # Engage Applink... |
| 253 | # | 237 | # |
| @@ -267,8 +251,8 @@ $(INCO_D)\applink.c: ms\applink.c | |||
| 267 | EXHEADER= $(EXHEADER) $(INCO_D)\applink.c | 251 | EXHEADER= $(EXHEADER) $(INCO_D)\applink.c |
| 268 | 252 | ||
| 269 | LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj | 253 | LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj |
| 254 | CRYPTOOBJ=$(OBJ_D)\uplink.obj $(CRYPTOOBJ) | ||
| 270 | ___ | 255 | ___ |
| 271 | $banner .= "CRYPTOOBJ=\$(OBJ_D)\\uplink.obj \$(CRYPTOOBJ)\n"; | ||
| 272 | $banner.=<<'___' if ($FLAVOR =~ /WIN64/); | 256 | $banner.=<<'___' if ($FLAVOR =~ /WIN64/); |
| 273 | CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ) | 257 | CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ) |
| 274 | ___ | 258 | ___ |
| @@ -276,119 +260,35 @@ ___ | |||
| 276 | elsif ($shlib && $FLAVOR =~ /CE/) | 260 | elsif ($shlib && $FLAVOR =~ /CE/) |
| 277 | { | 261 | { |
| 278 | $mlflags.=" $lflags /dll"; | 262 | $mlflags.=" $lflags /dll"; |
| 279 | $lib_cflag=" -D_WINDLL -D_DLL"; | 263 | $lflags.=' /entry:mainCRTstartup' if(defined($ENV{'PORTSDK_LIBPATH'})); |
| 280 | $out_def='out32dll_$(TARGETCPU)'; | 264 | $lib_cflag.=" -D_WINDLL -D_DLL"; |
| 281 | $tmp_def='tmp32dll_$(TARGETCPU)'; | ||
| 282 | } | 265 | } |
| 283 | 266 | ||
| 284 | $cflags.=" /Fd$out_def"; | ||
| 285 | |||
| 286 | sub do_lib_rule | 267 | sub do_lib_rule |
| 287 | { | 268 | { |
| 288 | my($objs,$target,$name,$shlib,$ign,$base_addr) = @_; | 269 | local($objs,$target,$name,$shlib)=@_; |
| 289 | local($ret); | 270 | local($ret); |
| 290 | 271 | ||
| 291 | $taget =~ s/\//$o/g if $o ne '/'; | 272 | $taget =~ s/\//$o/g if $o ne '/'; |
| 292 | my $base_arg; | 273 | if ($name ne "") |
| 293 | if ($base_addr ne "") | ||
| 294 | { | ||
| 295 | $base_arg= " /base:$base_addr"; | ||
| 296 | } | ||
| 297 | else | ||
| 298 | { | ||
| 299 | $base_arg = ""; | ||
| 300 | } | ||
| 301 | if ($target =~ /O_CRYPTO/ && $fipsdso) | ||
| 302 | { | ||
| 303 | $name = "/def:ms/libeayfips.def"; | ||
| 304 | } | ||
| 305 | elsif ($name ne "") | ||
| 306 | { | 274 | { |
| 307 | $name =~ tr/a-z/A-Z/; | 275 | $name =~ tr/a-z/A-Z/; |
| 308 | $name = "/def:ms/${name}.def"; | 276 | $name = "/def:ms/${name}.def"; |
| 309 | } | 277 | } |
| 278 | |||
| 310 | # $target="\$(LIB_D)$o$target"; | 279 | # $target="\$(LIB_D)$o$target"; |
| 311 | # $ret.="$target: $objs\n"; | 280 | $ret.="$target: $objs\n"; |
| 312 | if (!$shlib) | 281 | if (!$shlib) |
| 313 | { | 282 | { |
| 314 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | 283 | # $ret.="\t\$(RM) \$(O_$Name)\n"; |
| 315 | $ex =' '; | 284 | $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs\n<<\n"; |
| 316 | $ret.="$target: $objs\n"; | ||
| 317 | $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; | ||
| 318 | } | 285 | } |
| 319 | else | 286 | else |
| 320 | { | 287 | { |
| 321 | my $ex = ""; | 288 | local($ex)=($target =~ /O_CRYPTO/)?'':' $(L_CRYPTO)'; |
| 322 | if ($target =~ /O_SSL/) | ||
| 323 | { | ||
| 324 | $ex .= " \$(L_CRYPTO)"; | ||
| 325 | #$ex .= " \$(L_FIPS)" if $fipsdso; | ||
| 326 | } | ||
| 327 | my $fipstarget; | ||
| 328 | if ($fipsdso) | ||
| 329 | { | ||
| 330 | $fipstarget = "O_FIPS"; | ||
| 331 | } | ||
| 332 | else | ||
| 333 | { | ||
| 334 | $fipstarget = "O_CRYPTO"; | ||
| 335 | } | ||
| 336 | |||
| 337 | |||
| 338 | if ($name eq "") | ||
| 339 | { | ||
| 340 | $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/); | ||
| 341 | if ($target =~ /capi/) | ||
| 342 | { | ||
| 343 | $ex.=' crypt32.lib advapi32.lib'; | ||
| 344 | } | ||
| 345 | } | ||
| 346 | elsif ($FLAVOR =~ /CE/) | ||
| 347 | { | ||
| 348 | $ex.=' winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib'; | ||
| 349 | } | ||
| 350 | else | ||
| 351 | { | ||
| 352 | $ex.=' unicows.lib' if ($FLAVOR =~ /NT/); | ||
| 353 | $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib'; | ||
| 354 | $ex.=' crypt32.lib'; | ||
| 355 | $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/); | ||
| 356 | } | ||
| 357 | $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; | 289 | $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; |
| 358 | 290 | $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex \$(EX_LIBS)\n<<\n"; | |
| 359 | if ($fips && $target =~ /$fipstarget/) | 291 | $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n"; |
| 360 | { | ||
| 361 | $ex.= $mwex unless $fipscanisterbuild; | ||
| 362 | $ret.="$target: $objs \$(PREMAIN_DSO_EXE)"; | ||
| 363 | if ($fipsdso) | ||
| 364 | { | ||
| 365 | $ex.=" \$(OBJ_D)\\\$(LIBFIPS).res"; | ||
| 366 | $ret.=" \$(OBJ_D)\\\$(LIBFIPS).res"; | ||
| 367 | $ret.=" ms/\$(LIBFIPS).def"; | ||
| 368 | } | ||
| 369 | $ret.="\n\tSET FIPS_LINK=\$(LINK)\n"; | ||
| 370 | $ret.="\tSET FIPS_CC=\$(CC)\n"; | ||
| 371 | $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n"; | ||
| 372 | $ret.="\tSET PREMAIN_DSO_EXE=\$(PREMAIN_DSO_EXE)\n"; | ||
| 373 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; | ||
| 374 | $ret.="\tSET FIPS_TARGET=$target\n"; | ||
| 375 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; | ||
| 376 | $ret.="\t\$(FIPSLINK) \$(MLFLAGS) /map $base_arg $efile$target "; | ||
| 377 | $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs "; | ||
| 378 | $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n"; | ||
| 379 | } | ||
| 380 | else | ||
| 381 | { | ||
| 382 | $ret.="$target: $objs"; | ||
| 383 | if ($target =~ /O_CRYPTO/ && $fipsdso) | ||
| 384 | { | ||
| 385 | $ret .= " \$(O_FIPS)"; | ||
| 386 | $ex .= " \$(L_FIPS)"; | ||
| 387 | } | ||
| 388 | $ret.="\n\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; | ||
| 389 | } | ||
| 390 | |||
| 391 | $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n"; | ||
| 392 | } | 292 | } |
| 393 | $ret.="\n"; | 293 | $ret.="\n"; |
| 394 | return($ret); | 294 | return($ret); |
| @@ -396,64 +296,43 @@ sub do_lib_rule | |||
| 396 | 296 | ||
| 397 | sub do_link_rule | 297 | sub do_link_rule |
| 398 | { | 298 | { |
| 399 | my($target,$files,$dep_libs,$libs,$standalone)=@_; | 299 | local($target,$files,$dep_libs,$libs)=@_; |
| 400 | local($ret,$_); | 300 | local($ret,$_); |
| 301 | |||
| 401 | $file =~ s/\//$o/g if $o ne '/'; | 302 | $file =~ s/\//$o/g if $o ne '/'; |
| 402 | $n=&bname($targer); | 303 | $n=&bname($targer); |
| 403 | $ret.="$target: $files $dep_libs\n"; | 304 | $ret.="$target: $files $dep_libs\n"; |
| 404 | if ($standalone == 1) | 305 | $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n"; |
| 405 | { | 306 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; |
| 406 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t"; | 307 | $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n"; |
| 407 | $ret.= "\$(EX_LIBS) " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild); | 308 | return($ret); |
| 408 | $ret.="$files $libs\n<<\n"; | 309 | } |
| 409 | } | 310 | |
| 410 | elsif ($standalone == 2) | 311 | sub win32_import_asm |
| 312 | { | ||
| 313 | my ($mf_var, $asm_name, $oref, $sref) = @_; | ||
| 314 | my $asm_dir; | ||
| 315 | if ($asm_name eq "") | ||
| 411 | { | 316 | { |
| 412 | $ret.="\tSET FIPS_LINK=\$(LINK)\n"; | 317 | $asm_dir = "crypto\\"; |
| 413 | $ret.="\tSET FIPS_CC=\$(CC)\n"; | ||
| 414 | $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n"; | ||
| 415 | $ret.="\tSET PREMAIN_DSO_EXE=\n"; | ||
| 416 | $ret.="\tSET FIPS_TARGET=$target\n"; | ||
| 417 | $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n"; | ||
| 418 | $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n"; | ||
| 419 | $ret.="\t\$(FIPSLINK) \$(LFLAGS) /map $efile$target @<<\n"; | ||
| 420 | $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n"; | ||
| 421 | } | 318 | } |
| 422 | else | 319 | else |
| 423 | { | 320 | { |
| 424 | $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n"; | 321 | $asm_dir = "crypto\\$asm_name\\asm\\"; |
| 425 | $ret.="\t\$(APP_EX_OBJ) $files $libs\n<<\n"; | ||
| 426 | } | 322 | } |
| 427 | $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n"; | ||
| 428 | return($ret); | ||
| 429 | } | ||
| 430 | 323 | ||
| 431 | sub do_rlink_rule | 324 | $$oref = ""; |
| 432 | { | 325 | $mf_var =~ s/\.o$/.obj/g; |
| 433 | local($target,$rl_start, $rl_mid, $rl_end,$dep_libs,$libs)=@_; | ||
| 434 | local($ret,$_); | ||
| 435 | my $files = "$rl_start $rl_mid $rl_end"; | ||
| 436 | 326 | ||
| 437 | $file =~ s/\//$o/g if $o ne '/'; | 327 | foreach (split(/ /, $mf_var)) |
| 438 | $n=&bname($targer); | 328 | { |
| 439 | $ret.="$target: $files $dep_libs \$(FIPS_SHA1_EXE)\n"; | 329 | $$oref .= $asm_dir . $_ . " "; |
| 440 | $ret.="\t\$(PERL) ms\\segrenam.pl \$\$a $rl_start\n"; | 330 | } |
| 441 | $ret.="\t\$(PERL) ms\\segrenam.pl \$\$b $rl_mid\n"; | 331 | $$oref =~ s/ $//; |
| 442 | $ret.="\t\$(PERL) ms\\segrenam.pl \$\$c $rl_end\n"; | 332 | $$sref = $$oref; |
| 443 | $ret.="\t\$(MKLIB) $lfile$target @<<\n\t$files\n<<\n"; | 333 | $$sref =~ s/\.obj/.asm/g; |
| 444 | $ret.="\t\$(FIPS_SHA1_EXE) $target > ${target}.sha1\n"; | ||
| 445 | $ret.="\t\$(PERL) util${o}copy.pl -stripcr fips${o}fips_premain.c \$(LIB_D)${o}fips_premain.c\n"; | ||
| 446 | $ret.="\t\$(CP) fips${o}fips_premain.c.sha1 \$(LIB_D)${o}fips_premain.c.sha1\n"; | ||
| 447 | $ret.="\n"; | ||
| 448 | return($ret); | ||
| 449 | } | ||
| 450 | 334 | ||
| 451 | sub do_sdef_rule | ||
| 452 | { | ||
| 453 | my $ret = "ms/\$(LIBFIPS).def: \$(O_FIPSCANISTER)\n"; | ||
| 454 | $ret.="\t\$(PERL) util/mksdef.pl \$(MLFLAGS) /out:dummy.dll /def:ms/libeay32.def @<<\n \$(O_FIPSCANISTER)\n<<\n"; | ||
| 455 | $ret.="\n"; | ||
| 456 | return $ret; | ||
| 457 | } | 335 | } |
| 458 | 336 | ||
| 337 | |||
| 459 | 1; | 338 | 1; |
diff --git a/src/lib/libcrypto/util/pl/VC-CE.pl b/src/lib/libcrypto/util/pl/VC-CE.pl deleted file mode 100644 index 2fd0c4dd32..0000000000 --- a/src/lib/libcrypto/util/pl/VC-CE.pl +++ /dev/null | |||
| @@ -1,116 +0,0 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # VC-CE.pl - the file for eMbedded Visual C++ 3.0 for windows CE, static libraries | ||
| 3 | # | ||
| 4 | |||
| 5 | $ssl= "ssleay32"; | ||
| 6 | $crypto="libeay32"; | ||
| 7 | $RSAref="RSAref32"; | ||
| 8 | |||
| 9 | $o='\\'; | ||
| 10 | $cp='copy nul+'; # Timestamps get stuffed otherwise | ||
| 11 | $rm='del'; | ||
| 12 | |||
| 13 | # C compiler stuff | ||
| 14 | $cc='$(CC)'; | ||
| 15 | $cflags=' /W3 /WX /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo $(WCETARGETDEFS) -DUNICODE -D_UNICODE -DWIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include'; | ||
| 16 | $lflags='/nologo /subsystem:windowsce,$(WCELDVERSION) /machine:$(WCELDMACHINE) /opt:ref'; | ||
| 17 | $mlflags=''; | ||
| 18 | |||
| 19 | $out_def='out32_$(TARGETCPU)'; | ||
| 20 | $tmp_def='tmp32_$(TARGETCPU)'; | ||
| 21 | $inc_def="inc32"; | ||
| 22 | |||
| 23 | if ($debug) | ||
| 24 | { | ||
| 25 | $cflags=" /MDd /W3 /WX /Zi /Yd /Od /nologo -DWIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32"; | ||
| 26 | $lflags.=" /debug"; | ||
| 27 | $mlflags.=' /debug'; | ||
| 28 | } | ||
| 29 | |||
| 30 | $obj='.obj'; | ||
| 31 | $ofile="/Fo"; | ||
| 32 | |||
| 33 | # EXE linking stuff | ||
| 34 | $link="link"; | ||
| 35 | $efile="/out:"; | ||
| 36 | $exep='.exe'; | ||
| 37 | if ($no_sock) | ||
| 38 | { $ex_libs=""; } | ||
| 39 | else { $ex_libs='winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib $(WCELDFLAGS)'; } | ||
| 40 | |||
| 41 | # static library stuff | ||
| 42 | $mklib='lib'; | ||
| 43 | $ranlib=''; | ||
| 44 | $plib=""; | ||
| 45 | $libp=".lib"; | ||
| 46 | $shlibp=($shlib)?".dll":".lib"; | ||
| 47 | $lfile='/out:'; | ||
| 48 | |||
| 49 | $shlib_ex_obj=""; | ||
| 50 | $app_ex_obj=""; | ||
| 51 | $app_ex_obj=""; | ||
| 52 | |||
| 53 | $bn_asm_obj=''; | ||
| 54 | $bn_asm_src=''; | ||
| 55 | $des_enc_obj=''; | ||
| 56 | $des_enc_src=''; | ||
| 57 | $bf_enc_obj=''; | ||
| 58 | $bf_enc_src=''; | ||
| 59 | |||
| 60 | if ($shlib) | ||
| 61 | { | ||
| 62 | $mlflags.=" $lflags /dll"; | ||
| 63 | # $cflags =~ s| /MD| /MT|; | ||
| 64 | $lib_cflag=" -D_WINDLL -D_DLL"; | ||
| 65 | $out_def='out32dll_$(TARGETCPU)'; | ||
| 66 | $tmp_def='tmp32dll_$(TARGETCPU)'; | ||
| 67 | } | ||
| 68 | |||
| 69 | $cflags.=" /Fd$out_def"; | ||
| 70 | |||
| 71 | sub do_lib_rule | ||
| 72 | { | ||
| 73 | local($objs,$target,$name,$shlib)=@_; | ||
| 74 | local($ret,$Name); | ||
| 75 | |||
| 76 | $taget =~ s/\//$o/g if $o ne '/'; | ||
| 77 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
| 78 | |||
| 79 | # $target="\$(LIB_D)$o$target"; | ||
| 80 | $ret.="$target: $objs\n"; | ||
| 81 | if (!$shlib) | ||
| 82 | { | ||
| 83 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
| 84 | $ex =' '; | ||
| 85 | $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; | ||
| 86 | } | ||
| 87 | else | ||
| 88 | { | ||
| 89 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | ||
| 90 | # $ex.=' winsock.lib coredll.lib $(WCECOMPAT)/lib/wcecompatex.lib'; | ||
| 91 | $ex.=' winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib'; | ||
| 92 | $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; | ||
| 93 | } | ||
| 94 | $ret.="\n"; | ||
| 95 | return($ret); | ||
| 96 | } | ||
| 97 | |||
| 98 | sub do_link_rule | ||
| 99 | { | ||
| 100 | local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; | ||
| 101 | local($ret,$_); | ||
| 102 | |||
| 103 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 104 | $n=&bname($targer); | ||
| 105 | $ret.="$target: $files $dep_libs\n"; | ||
| 106 | $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; | ||
| 107 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; | ||
| 108 | if (defined $sha1file) | ||
| 109 | { | ||
| 110 | $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; | ||
| 111 | } | ||
| 112 | $ret.="\n"; | ||
| 113 | return($ret); | ||
| 114 | } | ||
| 115 | |||
| 116 | 1; | ||
diff --git a/src/lib/libcrypto/util/pod2man.pl b/src/lib/libcrypto/util/pod2man.pl index 546d1ec186..025d914f2e 100644 --- a/src/lib/libcrypto/util/pod2man.pl +++ b/src/lib/libcrypto/util/pod2man.pl | |||
| @@ -425,7 +425,7 @@ if ($name ne 'something') { | |||
| 425 | } | 425 | } |
| 426 | next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME | 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 | 427 | next if /^=pod\b/; # It is OK to have =pod before NAME |
| 428 | next if /^=for\s+comment\b/; # It is OK to have =for comment 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; | 429 | die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; |
| 430 | } | 430 | } |
| 431 | die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; | 431 | die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; |
diff --git a/src/lib/libcrypto/util/point.sh b/src/lib/libcrypto/util/point.sh index 4790e08f8a..da39899cb1 100644 --- a/src/lib/libcrypto/util/point.sh +++ b/src/lib/libcrypto/util/point.sh | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | rm -f "$2" | 3 | rm -f "$2" |
| 4 | if test "$OSTYPE" = msdosdjgpp; then | 4 | if test "$OSTYPE" = msdosdjgpp || test "x$PLATFORM" = xmingw ; then |
| 5 | cp "$1" "$2" | 5 | cp "$1" "$2" |
| 6 | else | 6 | else |
| 7 | ln -s "$1" "$2" | 7 | ln -s "$1" "$2" |
diff --git a/src/lib/libcrypto/util/selftest.pl b/src/lib/libcrypto/util/selftest.pl index 4778c5ab01..7b32e9f4ff 100644 --- a/src/lib/libcrypto/util/selftest.pl +++ b/src/lib/libcrypto/util/selftest.pl | |||
| @@ -78,7 +78,7 @@ print OUT "\n"; | |||
| 78 | 78 | ||
| 79 | print "Checking compiler...\n"; | 79 | print "Checking compiler...\n"; |
| 80 | if (open(TEST,">cctest.c")) { | 80 | if (open(TEST,">cctest.c")) { |
| 81 | print TEST "#include <stdio.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n"; | 81 | print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n"; |
| 82 | close(TEST); | 82 | close(TEST); |
| 83 | system("$cc -o cctest cctest.c"); | 83 | system("$cc -o cctest cctest.c"); |
| 84 | if (`./cctest` !~ /Hello world/) { | 84 | if (`./cctest` !~ /Hello world/) { |
| @@ -96,7 +96,7 @@ if (open(TEST,">cctest.c")) { | |||
| 96 | print OUT "Can't create cctest.c\n"; | 96 | print OUT "Can't create cctest.c\n"; |
| 97 | } | 97 | } |
| 98 | if (open(TEST,">cctest.c")) { | 98 | if (open(TEST,">cctest.c")) { |
| 99 | print TEST "#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n"; | 99 | print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n"; |
| 100 | close(TEST); | 100 | close(TEST); |
| 101 | system("$cc -o cctest -Iinclude cctest.c"); | 101 | system("$cc -o cctest -Iinclude cctest.c"); |
| 102 | $cctest = `./cctest`; | 102 | $cctest = `./cctest`; |
diff --git a/src/lib/libcrypto/util/ssleay.num b/src/lib/libcrypto/util/ssleay.num index 2055cc1597..15a58e7b13 100644 --- a/src/lib/libcrypto/util/ssleay.num +++ b/src/lib/libcrypto/util/ssleay.num | |||
| @@ -98,9 +98,9 @@ SSLeay_add_ssl_algorithms 109 NOEXIST::FUNCTION: | |||
| 98 | SSLv23_client_method 110 EXIST::FUNCTION:RSA | 98 | SSLv23_client_method 110 EXIST::FUNCTION:RSA |
| 99 | SSLv23_method 111 EXIST::FUNCTION:RSA | 99 | SSLv23_method 111 EXIST::FUNCTION:RSA |
| 100 | SSLv23_server_method 112 EXIST::FUNCTION:RSA | 100 | SSLv23_server_method 112 EXIST::FUNCTION:RSA |
| 101 | SSLv2_client_method 113 EXIST::FUNCTION:RSA | 101 | SSLv2_client_method 113 EXIST::FUNCTION:RSA,SSL2 |
| 102 | SSLv2_method 114 EXIST::FUNCTION:RSA | 102 | SSLv2_method 114 EXIST::FUNCTION:RSA,SSL2 |
| 103 | SSLv2_server_method 115 EXIST::FUNCTION:RSA | 103 | SSLv2_server_method 115 EXIST::FUNCTION:RSA,SSL2 |
| 104 | SSLv3_client_method 116 EXIST::FUNCTION: | 104 | SSLv3_client_method 116 EXIST::FUNCTION: |
| 105 | SSLv3_method 117 EXIST::FUNCTION: | 105 | SSLv3_method 117 EXIST::FUNCTION: |
| 106 | SSLv3_server_method 118 EXIST::FUNCTION: | 106 | SSLv3_server_method 118 EXIST::FUNCTION: |
| @@ -117,8 +117,8 @@ SSL_CIPHER_get_bits 128 EXIST::FUNCTION: | |||
| 117 | SSL_CIPHER_get_version 129 EXIST::FUNCTION: | 117 | SSL_CIPHER_get_version 129 EXIST::FUNCTION: |
| 118 | SSL_CIPHER_get_name 130 EXIST::FUNCTION: | 118 | SSL_CIPHER_get_name 130 EXIST::FUNCTION: |
| 119 | BIO_ssl_shutdown 131 EXIST::FUNCTION:BIO | 119 | BIO_ssl_shutdown 131 EXIST::FUNCTION:BIO |
| 120 | SSL_SESSION_cmp 132 EXIST::FUNCTION: | 120 | SSL_SESSION_cmp 132 NOEXIST::FUNCTION: |
| 121 | SSL_SESSION_hash 133 EXIST::FUNCTION: | 121 | SSL_SESSION_hash 133 NOEXIST::FUNCTION: |
| 122 | SSL_SESSION_get_time 134 EXIST::FUNCTION: | 122 | SSL_SESSION_get_time 134 EXIST::FUNCTION: |
| 123 | SSL_SESSION_set_time 135 EXIST::FUNCTION: | 123 | SSL_SESSION_set_time 135 EXIST::FUNCTION: |
| 124 | SSL_SESSION_get_timeout 136 EXIST::FUNCTION: | 124 | SSL_SESSION_get_timeout 136 EXIST::FUNCTION: |
| @@ -242,3 +242,20 @@ SSL_set_SSL_CTX 290 EXIST::FUNCTION: | |||
| 242 | SSL_get_servername 291 EXIST::FUNCTION:TLSEXT | 242 | SSL_get_servername 291 EXIST::FUNCTION:TLSEXT |
| 243 | SSL_get_servername_type 292 EXIST::FUNCTION:TLSEXT | 243 | SSL_get_servername_type 292 EXIST::FUNCTION:TLSEXT |
| 244 | SSL_CTX_set_client_cert_engine 293 EXIST::FUNCTION:ENGINE | 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/x509/Makefile.ssl b/src/lib/libcrypto/x509/Makefile.ssl deleted file mode 100644 index 3a3452536c..0000000000 --- a/src/lib/libcrypto/x509/Makefile.ssl +++ /dev/null | |||
| @@ -1,594 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/x509/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= x509 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile README | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= x509_def.c x509_d2.c x509_r2x.c x509_cmp.c \ | ||
| 27 | x509_obj.c x509_req.c x509spki.c x509_vfy.c \ | ||
| 28 | x509_set.c x509cset.c x509rset.c x509_err.c \ | ||
| 29 | x509name.c x509_v3.c x509_ext.c x509_att.c \ | ||
| 30 | x509type.c x509_lu.c x_all.c x509_txt.c \ | ||
| 31 | x509_trs.c by_file.c by_dir.c | ||
| 32 | LIBOBJ= x509_def.o x509_d2.o x509_r2x.o x509_cmp.o \ | ||
| 33 | x509_obj.o x509_req.o x509spki.o x509_vfy.o \ | ||
| 34 | x509_set.o x509cset.o x509rset.o x509_err.o \ | ||
| 35 | x509name.o x509_v3.o x509_ext.o x509_att.o \ | ||
| 36 | x509type.o x509_lu.o x_all.o x509_txt.o \ | ||
| 37 | x509_trs.o by_file.o by_dir.o | ||
| 38 | |||
| 39 | SRC= $(LIBSRC) | ||
| 40 | |||
| 41 | EXHEADER= x509.h x509_vfy.h | ||
| 42 | HEADER= $(EXHEADER) | ||
| 43 | |||
| 44 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 45 | |||
| 46 | top: | ||
| 47 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 48 | |||
| 49 | all: lib | ||
| 50 | |||
| 51 | lib: $(LIBOBJ) | ||
| 52 | $(AR) $(LIB) $(LIBOBJ) | ||
| 53 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 54 | @touch lib | ||
| 55 | |||
| 56 | files: | ||
| 57 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 58 | |||
| 59 | links: | ||
| 60 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 61 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 62 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 63 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 64 | |||
| 65 | install: | ||
| 66 | @for i in $(EXHEADER) ; \ | ||
| 67 | do \ | ||
| 68 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 69 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 70 | done; | ||
| 71 | |||
| 72 | tags: | ||
| 73 | ctags $(SRC) | ||
| 74 | |||
| 75 | tests: | ||
| 76 | |||
| 77 | lint: | ||
| 78 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 79 | |||
| 80 | depend: | ||
| 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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 89 | |||
| 90 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 91 | |||
| 92 | by_dir.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 93 | by_dir.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 94 | by_dir.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 95 | by_dir.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 96 | by_dir.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 97 | by_dir.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 98 | by_dir.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 99 | by_dir.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 100 | by_dir.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 101 | by_dir.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 102 | by_dir.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 103 | by_dir.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 104 | by_dir.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 105 | by_dir.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 106 | by_dir.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 107 | by_dir.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 108 | by_dir.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 109 | by_dir.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 110 | by_dir.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 111 | by_dir.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 112 | by_dir.o: ../cryptlib.h by_dir.c | ||
| 113 | by_file.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 114 | by_file.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 115 | by_file.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 116 | by_file.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 117 | by_file.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 118 | by_file.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 119 | by_file.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 120 | by_file.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 121 | by_file.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 122 | by_file.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 123 | by_file.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 124 | by_file.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 125 | by_file.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 126 | by_file.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 127 | by_file.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 128 | by_file.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 129 | by_file.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 130 | by_file.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 131 | by_file.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 132 | by_file.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 133 | by_file.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 134 | by_file.o: ../../include/openssl/x509_vfy.h ../cryptlib.h by_file.c | ||
| 135 | x509_att.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 136 | x509_att.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 137 | x509_att.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 138 | x509_att.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 139 | x509_att.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 140 | x509_att.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 141 | x509_att.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 142 | x509_att.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 143 | x509_att.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 144 | x509_att.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 145 | x509_att.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 146 | x509_att.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 147 | x509_att.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 148 | x509_att.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 149 | x509_att.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 150 | x509_att.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 151 | x509_att.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 152 | x509_att.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 153 | x509_att.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 154 | x509_att.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 155 | x509_att.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 156 | x509_att.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_att.c | ||
| 157 | x509_cmp.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 158 | x509_cmp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 159 | x509_cmp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 160 | x509_cmp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 161 | x509_cmp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 162 | x509_cmp.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 163 | x509_cmp.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 164 | x509_cmp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 165 | x509_cmp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 166 | x509_cmp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 167 | x509_cmp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 168 | x509_cmp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 169 | x509_cmp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 170 | x509_cmp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 171 | x509_cmp.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 172 | x509_cmp.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 173 | x509_cmp.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 174 | x509_cmp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 175 | x509_cmp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 176 | x509_cmp.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 177 | x509_cmp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 178 | x509_cmp.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_cmp.c | ||
| 179 | x509_d2.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 180 | x509_d2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 181 | x509_d2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 182 | x509_d2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 183 | x509_d2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 184 | x509_d2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 185 | x509_d2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 186 | x509_d2.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 187 | x509_d2.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 188 | x509_d2.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 189 | x509_d2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 190 | x509_d2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 191 | x509_d2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 192 | x509_d2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 193 | x509_d2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 194 | x509_d2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 195 | x509_d2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 196 | x509_d2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 197 | x509_d2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 198 | x509_d2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 199 | x509_d2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_d2.c | ||
| 200 | x509_def.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 201 | x509_def.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 202 | x509_def.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 203 | x509_def.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 204 | x509_def.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 205 | x509_def.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 206 | x509_def.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 207 | x509_def.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 208 | x509_def.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 209 | x509_def.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 210 | x509_def.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 211 | x509_def.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 212 | x509_def.o: ../../include/openssl/opensslconf.h | ||
| 213 | x509_def.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 214 | x509_def.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 215 | x509_def.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 216 | x509_def.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 217 | x509_def.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 218 | x509_def.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 219 | x509_def.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 220 | x509_def.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 221 | x509_def.o: ../cryptlib.h x509_def.c | ||
| 222 | x509_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 223 | x509_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 224 | x509_err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 225 | x509_err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 226 | x509_err.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 227 | x509_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 228 | x509_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 229 | x509_err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 230 | x509_err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 231 | x509_err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 232 | x509_err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 233 | x509_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 234 | x509_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 235 | x509_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 236 | x509_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 237 | x509_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 238 | x509_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 239 | x509_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 240 | x509_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 241 | x509_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 242 | x509_err.o: x509_err.c | ||
| 243 | x509_ext.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 244 | x509_ext.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 245 | x509_ext.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 246 | x509_ext.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 247 | x509_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 248 | x509_ext.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 249 | x509_ext.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 250 | x509_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 251 | x509_ext.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 252 | x509_ext.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 253 | x509_ext.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 254 | x509_ext.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 255 | x509_ext.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 256 | x509_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 257 | x509_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 258 | x509_ext.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 259 | x509_ext.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 260 | x509_ext.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 261 | x509_ext.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 262 | x509_ext.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 263 | x509_ext.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 264 | x509_ext.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_ext.c | ||
| 265 | x509_lu.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 266 | x509_lu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 267 | x509_lu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 268 | x509_lu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 269 | x509_lu.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 270 | x509_lu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 271 | x509_lu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 272 | x509_lu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 273 | x509_lu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 274 | x509_lu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 275 | x509_lu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 276 | x509_lu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 277 | x509_lu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 278 | x509_lu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 279 | x509_lu.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 280 | x509_lu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 281 | x509_lu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 282 | x509_lu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 283 | x509_lu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 284 | x509_lu.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 285 | x509_lu.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 286 | x509_lu.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_lu.c | ||
| 287 | x509_obj.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 288 | x509_obj.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 289 | x509_obj.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 290 | x509_obj.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 291 | x509_obj.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 292 | x509_obj.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 293 | x509_obj.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 294 | x509_obj.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 295 | x509_obj.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 296 | x509_obj.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 297 | x509_obj.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 298 | x509_obj.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 299 | x509_obj.o: ../../include/openssl/opensslconf.h | ||
| 300 | x509_obj.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 301 | x509_obj.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 302 | x509_obj.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 303 | x509_obj.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 304 | x509_obj.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 305 | x509_obj.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 306 | x509_obj.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 307 | x509_obj.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 308 | x509_obj.o: ../cryptlib.h x509_obj.c | ||
| 309 | x509_r2x.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 310 | x509_r2x.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 311 | x509_r2x.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 312 | x509_r2x.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 313 | x509_r2x.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 314 | x509_r2x.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 315 | x509_r2x.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 316 | x509_r2x.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 317 | x509_r2x.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 318 | x509_r2x.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 319 | x509_r2x.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 320 | x509_r2x.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 321 | x509_r2x.o: ../../include/openssl/opensslconf.h | ||
| 322 | x509_r2x.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 323 | x509_r2x.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 324 | x509_r2x.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 325 | x509_r2x.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 326 | x509_r2x.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 327 | x509_r2x.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 328 | x509_r2x.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 329 | x509_r2x.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 330 | x509_r2x.o: ../cryptlib.h x509_r2x.c | ||
| 331 | x509_req.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 332 | x509_req.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 333 | x509_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 334 | x509_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 335 | x509_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 336 | x509_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 337 | x509_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 338 | x509_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 339 | x509_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 340 | x509_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 341 | x509_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 342 | x509_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 343 | x509_req.o: ../../include/openssl/opensslconf.h | ||
| 344 | x509_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 345 | x509_req.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 346 | x509_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 347 | x509_req.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 348 | x509_req.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 349 | x509_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 350 | x509_req.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 351 | x509_req.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 352 | x509_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 353 | x509_req.o: ../cryptlib.h x509_req.c | ||
| 354 | x509_set.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 355 | x509_set.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 356 | x509_set.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 357 | x509_set.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 358 | x509_set.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 359 | x509_set.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 360 | x509_set.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 361 | x509_set.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 362 | x509_set.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 363 | x509_set.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 364 | x509_set.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 365 | x509_set.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 366 | x509_set.o: ../../include/openssl/opensslconf.h | ||
| 367 | x509_set.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 368 | x509_set.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 369 | x509_set.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 370 | x509_set.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 371 | x509_set.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 372 | x509_set.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 373 | x509_set.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 374 | x509_set.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 375 | x509_set.o: ../cryptlib.h x509_set.c | ||
| 376 | x509_trs.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 377 | x509_trs.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 378 | x509_trs.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 379 | x509_trs.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 380 | x509_trs.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 381 | x509_trs.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 382 | x509_trs.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 383 | x509_trs.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 384 | x509_trs.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 385 | x509_trs.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 386 | x509_trs.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 387 | x509_trs.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 388 | x509_trs.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 389 | x509_trs.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 390 | x509_trs.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 391 | x509_trs.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 392 | x509_trs.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 393 | x509_trs.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 394 | x509_trs.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 395 | x509_trs.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 396 | x509_trs.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 397 | x509_trs.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_trs.c | ||
| 398 | x509_txt.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 399 | x509_txt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 400 | x509_txt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 401 | x509_txt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 402 | x509_txt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 403 | x509_txt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 404 | x509_txt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 405 | x509_txt.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 406 | x509_txt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 407 | x509_txt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 408 | x509_txt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 409 | x509_txt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 410 | x509_txt.o: ../../include/openssl/opensslconf.h | ||
| 411 | x509_txt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 412 | x509_txt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 413 | x509_txt.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 414 | x509_txt.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 415 | x509_txt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 416 | x509_txt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 417 | x509_txt.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 418 | x509_txt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 419 | x509_txt.o: ../cryptlib.h x509_txt.c | ||
| 420 | x509_v3.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 421 | x509_v3.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 422 | x509_v3.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 423 | x509_v3.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 424 | x509_v3.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 425 | x509_v3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 426 | x509_v3.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 427 | x509_v3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 428 | x509_v3.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 429 | x509_v3.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 430 | x509_v3.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 431 | x509_v3.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 432 | x509_v3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 433 | x509_v3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 434 | x509_v3.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 435 | x509_v3.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 436 | x509_v3.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 437 | x509_v3.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 438 | x509_v3.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 439 | x509_v3.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 440 | x509_v3.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 441 | x509_v3.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_v3.c | ||
| 442 | x509_vfy.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 443 | x509_vfy.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 444 | x509_vfy.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 445 | x509_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 446 | x509_vfy.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 447 | x509_vfy.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 448 | x509_vfy.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 449 | x509_vfy.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 450 | x509_vfy.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 451 | x509_vfy.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 452 | x509_vfy.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 453 | x509_vfy.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 454 | x509_vfy.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 455 | x509_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 456 | x509_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 457 | x509_vfy.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 458 | x509_vfy.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 459 | x509_vfy.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 460 | x509_vfy.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 461 | x509_vfy.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 462 | x509_vfy.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 463 | x509_vfy.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_vfy.c | ||
| 464 | x509cset.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 465 | x509cset.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 466 | x509cset.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 467 | x509cset.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 468 | x509cset.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 469 | x509cset.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 470 | x509cset.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 471 | x509cset.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 472 | x509cset.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 473 | x509cset.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 474 | x509cset.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 475 | x509cset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 476 | x509cset.o: ../../include/openssl/opensslconf.h | ||
| 477 | x509cset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 478 | x509cset.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 479 | x509cset.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 480 | x509cset.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 481 | x509cset.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 482 | x509cset.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 483 | x509cset.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 484 | x509cset.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 485 | x509cset.o: ../cryptlib.h x509cset.c | ||
| 486 | x509name.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 487 | x509name.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 488 | x509name.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 489 | x509name.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 490 | x509name.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 491 | x509name.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 492 | x509name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 493 | x509name.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 494 | x509name.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 495 | x509name.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 496 | x509name.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 497 | x509name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 498 | x509name.o: ../../include/openssl/opensslconf.h | ||
| 499 | x509name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 500 | x509name.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 501 | x509name.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 502 | x509name.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 503 | x509name.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 504 | x509name.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 505 | x509name.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 506 | x509name.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 507 | x509name.o: ../cryptlib.h x509name.c | ||
| 508 | x509rset.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 509 | x509rset.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 510 | x509rset.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 511 | x509rset.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 512 | x509rset.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 513 | x509rset.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 514 | x509rset.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 515 | x509rset.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 516 | x509rset.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 517 | x509rset.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 518 | x509rset.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 519 | x509rset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 520 | x509rset.o: ../../include/openssl/opensslconf.h | ||
| 521 | x509rset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 522 | x509rset.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 523 | x509rset.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 524 | x509rset.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 525 | x509rset.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 526 | x509rset.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 527 | x509rset.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 528 | x509rset.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 529 | x509rset.o: ../cryptlib.h x509rset.c | ||
| 530 | x509spki.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 531 | x509spki.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 532 | x509spki.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 533 | x509spki.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 534 | x509spki.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 535 | x509spki.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 536 | x509spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 537 | x509spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 538 | x509spki.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 539 | x509spki.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 540 | x509spki.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 541 | x509spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 542 | x509spki.o: ../../include/openssl/opensslconf.h | ||
| 543 | x509spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 544 | x509spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 545 | x509spki.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 546 | x509spki.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 547 | x509spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 548 | x509spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 549 | x509spki.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 550 | x509spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 551 | x509spki.o: ../cryptlib.h x509spki.c | ||
| 552 | x509type.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 553 | x509type.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 554 | x509type.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 555 | x509type.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 556 | x509type.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 557 | x509type.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 558 | x509type.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 559 | x509type.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 560 | x509type.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 561 | x509type.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 562 | x509type.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 563 | x509type.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 564 | x509type.o: ../../include/openssl/opensslconf.h | ||
| 565 | x509type.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 566 | x509type.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 567 | x509type.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 568 | x509type.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 569 | x509type.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 570 | x509type.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 571 | x509type.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 572 | x509type.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 573 | x509type.o: ../cryptlib.h x509type.c | ||
| 574 | x_all.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 575 | x_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 576 | x_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 577 | x_all.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 578 | x_all.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 579 | x_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 580 | x_all.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 581 | x_all.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 582 | x_all.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 583 | x_all.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 584 | x_all.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 585 | x_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 586 | x_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 587 | x_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 588 | x_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 589 | x_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 590 | x_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 591 | x_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 592 | x_all.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 593 | x_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 594 | x_all.o: ../cryptlib.h x_all.c | ||
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c index 341e0ba6a4..27ca5150c1 100644 --- a/src/lib/libcrypto/x509/by_dir.c +++ b/src/lib/libcrypto/x509/by_dir.c | |||
| @@ -65,28 +65,36 @@ | |||
| 65 | #ifndef NO_SYS_TYPES_H | 65 | #ifndef NO_SYS_TYPES_H |
| 66 | # include <sys/types.h> | 66 | # include <sys/types.h> |
| 67 | #endif | 67 | #endif |
| 68 | #ifdef MAC_OS_pre_X | 68 | #ifndef OPENSSL_NO_POSIX_IO |
| 69 | # include <stat.h> | ||
| 70 | #else | ||
| 71 | # include <sys/stat.h> | 69 | # include <sys/stat.h> |
| 72 | #endif | 70 | #endif |
| 73 | 71 | ||
| 74 | #include <openssl/lhash.h> | 72 | #include <openssl/lhash.h> |
| 75 | #include <openssl/x509.h> | 73 | #include <openssl/x509.h> |
| 76 | 74 | ||
| 77 | #ifdef _WIN32 | 75 | |
| 78 | #define stat _stat | 76 | typedef struct lookup_dir_hashes_st |
| 79 | #endif | 77 | { |
| 78 | unsigned long hash; | ||
| 79 | int suffix; | ||
| 80 | } BY_DIR_HASH; | ||
| 81 | |||
| 82 | typedef struct lookup_dir_entry_st | ||
| 83 | { | ||
| 84 | char *dir; | ||
| 85 | int dir_type; | ||
| 86 | STACK_OF(BY_DIR_HASH) *hashes; | ||
| 87 | } BY_DIR_ENTRY; | ||
| 80 | 88 | ||
| 81 | typedef struct lookup_dir_st | 89 | typedef struct lookup_dir_st |
| 82 | { | 90 | { |
| 83 | BUF_MEM *buffer; | 91 | BUF_MEM *buffer; |
| 84 | int num_dirs; | 92 | STACK_OF(BY_DIR_ENTRY) *dirs; |
| 85 | char **dirs; | ||
| 86 | int *dirs_type; | ||
| 87 | int num_dirs_alloced; | ||
| 88 | } BY_DIR; | 93 | } BY_DIR; |
| 89 | 94 | ||
| 95 | DECLARE_STACK_OF(BY_DIR_HASH) | ||
| 96 | DECLARE_STACK_OF(BY_DIR_ENTRY) | ||
| 97 | |||
| 90 | static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, | 98 | static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, |
| 91 | char **ret); | 99 | char **ret); |
| 92 | static int new_dir(X509_LOOKUP *lu); | 100 | static int new_dir(X509_LOOKUP *lu); |
| @@ -127,7 +135,7 @@ static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, | |||
| 127 | case X509_L_ADD_DIR: | 135 | case X509_L_ADD_DIR: |
| 128 | if (argl == X509_FILETYPE_DEFAULT) | 136 | if (argl == X509_FILETYPE_DEFAULT) |
| 129 | { | 137 | { |
| 130 | dir=(char *)Getenv(X509_get_default_cert_dir_env()); | 138 | dir=(char *)getenv(X509_get_default_cert_dir_env()); |
| 131 | if (dir) | 139 | if (dir) |
| 132 | ret=add_cert_dir(ld,dir,X509_FILETYPE_PEM); | 140 | ret=add_cert_dir(ld,dir,X509_FILETYPE_PEM); |
| 133 | else | 141 | else |
| @@ -156,34 +164,51 @@ static int new_dir(X509_LOOKUP *lu) | |||
| 156 | OPENSSL_free(a); | 164 | OPENSSL_free(a); |
| 157 | return(0); | 165 | return(0); |
| 158 | } | 166 | } |
| 159 | a->num_dirs=0; | ||
| 160 | a->dirs=NULL; | 167 | a->dirs=NULL; |
| 161 | a->dirs_type=NULL; | ||
| 162 | a->num_dirs_alloced=0; | ||
| 163 | lu->method_data=(char *)a; | 168 | lu->method_data=(char *)a; |
| 164 | return(1); | 169 | return(1); |
| 165 | } | 170 | } |
| 166 | 171 | ||
| 172 | static void by_dir_hash_free(BY_DIR_HASH *hash) | ||
| 173 | { | ||
| 174 | OPENSSL_free(hash); | ||
| 175 | } | ||
| 176 | |||
| 177 | static int by_dir_hash_cmp(const BY_DIR_HASH * const *a, | ||
| 178 | const BY_DIR_HASH * const *b) | ||
| 179 | { | ||
| 180 | if ((*a)->hash > (*b)->hash) | ||
| 181 | return 1; | ||
| 182 | if ((*a)->hash < (*b)->hash) | ||
| 183 | return -1; | ||
| 184 | return 0; | ||
| 185 | } | ||
| 186 | |||
| 187 | static void by_dir_entry_free(BY_DIR_ENTRY *ent) | ||
| 188 | { | ||
| 189 | if (ent->dir) | ||
| 190 | OPENSSL_free(ent->dir); | ||
| 191 | if (ent->hashes) | ||
| 192 | sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); | ||
| 193 | OPENSSL_free(ent); | ||
| 194 | } | ||
| 195 | |||
| 167 | static void free_dir(X509_LOOKUP *lu) | 196 | static void free_dir(X509_LOOKUP *lu) |
| 168 | { | 197 | { |
| 169 | BY_DIR *a; | 198 | BY_DIR *a; |
| 170 | int i; | ||
| 171 | 199 | ||
| 172 | a=(BY_DIR *)lu->method_data; | 200 | a=(BY_DIR *)lu->method_data; |
| 173 | for (i=0; i<a->num_dirs; i++) | 201 | if (a->dirs != NULL) |
| 174 | if (a->dirs[i] != NULL) OPENSSL_free(a->dirs[i]); | 202 | sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free); |
| 175 | if (a->dirs != NULL) OPENSSL_free(a->dirs); | 203 | if (a->buffer != NULL) |
| 176 | if (a->dirs_type != NULL) OPENSSL_free(a->dirs_type); | 204 | BUF_MEM_free(a->buffer); |
| 177 | if (a->buffer != NULL) BUF_MEM_free(a->buffer); | ||
| 178 | OPENSSL_free(a); | 205 | OPENSSL_free(a); |
| 179 | } | 206 | } |
| 180 | 207 | ||
| 181 | static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) | 208 | static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) |
| 182 | { | 209 | { |
| 183 | int j,len; | 210 | int j,len; |
| 184 | int *ip; | ||
| 185 | const char *s,*ss,*p; | 211 | const char *s,*ss,*p; |
| 186 | char **pp; | ||
| 187 | 212 | ||
| 188 | if (dir == NULL || !*dir) | 213 | if (dir == NULL || !*dir) |
| 189 | { | 214 | { |
| @@ -197,49 +222,52 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
| 197 | { | 222 | { |
| 198 | if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) | 223 | if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) |
| 199 | { | 224 | { |
| 225 | BY_DIR_ENTRY *ent; | ||
| 200 | ss=s; | 226 | ss=s; |
| 201 | s=p+1; | 227 | s=p+1; |
| 202 | len=(int)(p-ss); | 228 | len=(int)(p-ss); |
| 203 | if (len == 0) continue; | 229 | if (len == 0) continue; |
| 204 | for (j=0; j<ctx->num_dirs; j++) | 230 | for (j=0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) |
| 205 | if (strlen(ctx->dirs[j]) == (size_t)len && | 231 | { |
| 206 | strncmp(ctx->dirs[j],ss,(unsigned int)len) == 0) | 232 | ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); |
| 233 | if (strlen(ent->dir) == (size_t)len && | ||
| 234 | strncmp(ent->dir,ss,(unsigned int)len) == 0) | ||
| 207 | break; | 235 | break; |
| 208 | if (j<ctx->num_dirs) | 236 | } |
| 237 | if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) | ||
| 209 | continue; | 238 | continue; |
| 210 | if (ctx->num_dirs_alloced < (ctx->num_dirs+1)) | 239 | if (ctx->dirs == NULL) |
| 211 | { | 240 | { |
| 212 | ctx->num_dirs_alloced+=10; | 241 | ctx->dirs = sk_BY_DIR_ENTRY_new_null(); |
| 213 | pp=(char **)OPENSSL_malloc(ctx->num_dirs_alloced* | 242 | if (!ctx->dirs) |
| 214 | sizeof(char *)); | ||
| 215 | ip=(int *)OPENSSL_malloc(ctx->num_dirs_alloced* | ||
| 216 | sizeof(int)); | ||
| 217 | if ((pp == NULL) || (ip == NULL)) | ||
| 218 | { | 243 | { |
| 219 | X509err(X509_F_ADD_CERT_DIR,ERR_R_MALLOC_FAILURE); | 244 | X509err(X509_F_ADD_CERT_DIR,ERR_R_MALLOC_FAILURE); |
| 220 | return(0); | 245 | return 0; |
| 221 | } | 246 | } |
| 222 | memcpy(pp,ctx->dirs,(ctx->num_dirs_alloced-10)* | ||
| 223 | sizeof(char *)); | ||
| 224 | memcpy(ip,ctx->dirs_type,(ctx->num_dirs_alloced-10)* | ||
| 225 | sizeof(int)); | ||
| 226 | if (ctx->dirs != NULL) | ||
| 227 | OPENSSL_free(ctx->dirs); | ||
| 228 | if (ctx->dirs_type != NULL) | ||
| 229 | OPENSSL_free(ctx->dirs_type); | ||
| 230 | ctx->dirs=pp; | ||
| 231 | ctx->dirs_type=ip; | ||
| 232 | } | 247 | } |
| 233 | ctx->dirs_type[ctx->num_dirs]=type; | 248 | ent = OPENSSL_malloc(sizeof(BY_DIR_ENTRY)); |
| 234 | ctx->dirs[ctx->num_dirs]=(char *)OPENSSL_malloc((unsigned int)len+1); | 249 | if (!ent) |
| 235 | if (ctx->dirs[ctx->num_dirs] == NULL) return(0); | 250 | return 0; |
| 236 | strncpy(ctx->dirs[ctx->num_dirs],ss,(unsigned int)len); | 251 | ent->dir_type = type; |
| 237 | ctx->dirs[ctx->num_dirs][len]='\0'; | 252 | ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); |
| 238 | ctx->num_dirs++; | 253 | ent->dir = OPENSSL_malloc((unsigned int)len+1); |
| 254 | if (!ent->dir || !ent->hashes) | ||
| 255 | { | ||
| 256 | by_dir_entry_free(ent); | ||
| 257 | return 0; | ||
| 258 | } | ||
| 259 | strncpy(ent->dir,ss,(unsigned int)len); | ||
| 260 | ent->dir[len] = '\0'; | ||
| 261 | if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) | ||
| 262 | { | ||
| 263 | by_dir_entry_free(ent); | ||
| 264 | return 0; | ||
| 265 | } | ||
| 239 | } | 266 | } |
| 240 | if (*p == '\0') break; | 267 | if (*p == '\0') |
| 268 | break; | ||
| 241 | } | 269 | } |
| 242 | return(1); | 270 | return 1; |
| 243 | } | 271 | } |
| 244 | 272 | ||
| 245 | static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | 273 | static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, |
| @@ -260,7 +288,6 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
| 260 | int i,j,k; | 288 | int i,j,k; |
| 261 | unsigned long h; | 289 | unsigned long h; |
| 262 | BUF_MEM *b=NULL; | 290 | BUF_MEM *b=NULL; |
| 263 | struct stat st; | ||
| 264 | X509_OBJECT stmp,*tmp; | 291 | X509_OBJECT stmp,*tmp; |
| 265 | const char *postfix=""; | 292 | const char *postfix=""; |
| 266 | 293 | ||
| @@ -296,20 +323,45 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
| 296 | ctx=(BY_DIR *)xl->method_data; | 323 | ctx=(BY_DIR *)xl->method_data; |
| 297 | 324 | ||
| 298 | h=X509_NAME_hash(name); | 325 | h=X509_NAME_hash(name); |
| 299 | for (i=0; i<ctx->num_dirs; i++) | 326 | for (i=0; i < sk_BY_DIR_ENTRY_num(ctx->dirs); i++) |
| 300 | { | 327 | { |
| 301 | j=strlen(ctx->dirs[i])+1+8+6+1+1; | 328 | BY_DIR_ENTRY *ent; |
| 329 | int idx; | ||
| 330 | BY_DIR_HASH htmp, *hent; | ||
| 331 | ent = sk_BY_DIR_ENTRY_value(ctx->dirs, i); | ||
| 332 | j=strlen(ent->dir)+1+8+6+1+1; | ||
| 302 | if (!BUF_MEM_grow(b,j)) | 333 | if (!BUF_MEM_grow(b,j)) |
| 303 | { | 334 | { |
| 304 | X509err(X509_F_GET_CERT_BY_SUBJECT,ERR_R_MALLOC_FAILURE); | 335 | X509err(X509_F_GET_CERT_BY_SUBJECT,ERR_R_MALLOC_FAILURE); |
| 305 | goto finish; | 336 | goto finish; |
| 306 | } | 337 | } |
| 307 | k=0; | 338 | if (type == X509_LU_CRL && ent->hashes) |
| 339 | { | ||
| 340 | htmp.hash = h; | ||
| 341 | CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE); | ||
| 342 | idx = sk_BY_DIR_HASH_find(ent->hashes, &htmp); | ||
| 343 | if (idx >= 0) | ||
| 344 | { | ||
| 345 | hent = sk_BY_DIR_HASH_value(ent->hashes, idx); | ||
| 346 | k = hent->suffix; | ||
| 347 | } | ||
| 348 | else | ||
| 349 | { | ||
| 350 | hent = NULL; | ||
| 351 | k=0; | ||
| 352 | } | ||
| 353 | CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 354 | } | ||
| 355 | else | ||
| 356 | { | ||
| 357 | k = 0; | ||
| 358 | hent = NULL; | ||
| 359 | } | ||
| 308 | for (;;) | 360 | for (;;) |
| 309 | { | 361 | { |
| 310 | char c = '/'; | 362 | char c = '/'; |
| 311 | #ifdef OPENSSL_SYS_VMS | 363 | #ifdef OPENSSL_SYS_VMS |
| 312 | c = ctx->dirs[i][strlen(ctx->dirs[i])-1]; | 364 | c = ent->dir[strlen(ent->dir)-1]; |
| 313 | if (c != ':' && c != '>' && c != ']') | 365 | if (c != ':' && c != '>' && c != ']') |
| 314 | { | 366 | { |
| 315 | /* If no separator is present, we assume the | 367 | /* If no separator is present, we assume the |
| @@ -330,41 +382,86 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
| 330 | /* This is special. When c == '\0', no | 382 | /* This is special. When c == '\0', no |
| 331 | directory separator should be added. */ | 383 | directory separator should be added. */ |
| 332 | BIO_snprintf(b->data,b->max, | 384 | BIO_snprintf(b->data,b->max, |
| 333 | "%s%08lx.%s%d",ctx->dirs[i],h, | 385 | "%s%08lx.%s%d",ent->dir,h, |
| 334 | postfix,k); | 386 | postfix,k); |
| 335 | } | 387 | } |
| 336 | else | 388 | else |
| 337 | { | 389 | { |
| 338 | BIO_snprintf(b->data,b->max, | 390 | BIO_snprintf(b->data,b->max, |
| 339 | "%s%c%08lx.%s%d",ctx->dirs[i],c,h, | 391 | "%s%c%08lx.%s%d",ent->dir,c,h, |
| 340 | postfix,k); | 392 | postfix,k); |
| 341 | } | 393 | } |
| 342 | k++; | 394 | #ifndef OPENSSL_NO_POSIX_IO |
| 395 | #ifdef _WIN32 | ||
| 396 | #define stat _stat | ||
| 397 | #endif | ||
| 398 | { | ||
| 399 | struct stat st; | ||
| 343 | if (stat(b->data,&st) < 0) | 400 | if (stat(b->data,&st) < 0) |
| 344 | break; | 401 | break; |
| 402 | } | ||
| 403 | #endif | ||
| 345 | /* found one. */ | 404 | /* found one. */ |
| 346 | if (type == X509_LU_X509) | 405 | if (type == X509_LU_X509) |
| 347 | { | 406 | { |
| 348 | if ((X509_load_cert_file(xl,b->data, | 407 | if ((X509_load_cert_file(xl,b->data, |
| 349 | ctx->dirs_type[i])) == 0) | 408 | ent->dir_type)) == 0) |
| 350 | break; | 409 | break; |
| 351 | } | 410 | } |
| 352 | else if (type == X509_LU_CRL) | 411 | else if (type == X509_LU_CRL) |
| 353 | { | 412 | { |
| 354 | if ((X509_load_crl_file(xl,b->data, | 413 | if ((X509_load_crl_file(xl,b->data, |
| 355 | ctx->dirs_type[i])) == 0) | 414 | ent->dir_type)) == 0) |
| 356 | break; | 415 | break; |
| 357 | } | 416 | } |
| 358 | /* else case will caught higher up */ | 417 | /* else case will caught higher up */ |
| 418 | k++; | ||
| 359 | } | 419 | } |
| 360 | 420 | ||
| 361 | /* we have added it to the cache so now pull | 421 | /* we have added it to the cache so now pull |
| 362 | * it out again */ | 422 | * it out again */ |
| 363 | CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE); | 423 | CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); |
| 364 | j = sk_X509_OBJECT_find(xl->store_ctx->objs,&stmp); | 424 | j = sk_X509_OBJECT_find(xl->store_ctx->objs,&stmp); |
| 365 | if(j != -1) tmp=sk_X509_OBJECT_value(xl->store_ctx->objs,j); | 425 | if(j != -1) tmp=sk_X509_OBJECT_value(xl->store_ctx->objs,j); |
| 366 | else tmp = NULL; | 426 | else tmp = NULL; |
| 367 | CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE); | 427 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); |
| 428 | |||
| 429 | |||
| 430 | /* If a CRL, update the last file suffix added for this */ | ||
| 431 | |||
| 432 | if (type == X509_LU_CRL) | ||
| 433 | { | ||
| 434 | CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); | ||
| 435 | /* Look for entry again in case another thread added | ||
| 436 | * an entry first. | ||
| 437 | */ | ||
| 438 | if (!hent) | ||
| 439 | { | ||
| 440 | htmp.hash = h; | ||
| 441 | idx = sk_BY_DIR_HASH_find(ent->hashes, &htmp); | ||
| 442 | if (idx >= 0) | ||
| 443 | hent = | ||
| 444 | sk_BY_DIR_HASH_value(ent->hashes, idx); | ||
| 445 | } | ||
| 446 | if (!hent) | ||
| 447 | { | ||
| 448 | hent = OPENSSL_malloc(sizeof(BY_DIR_HASH)); | ||
| 449 | hent->hash = h; | ||
| 450 | hent->suffix = k; | ||
| 451 | if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) | ||
| 452 | { | ||
| 453 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 454 | OPENSSL_free(hent); | ||
| 455 | ok = 0; | ||
| 456 | goto finish; | ||
| 457 | } | ||
| 458 | } | ||
| 459 | else if (hent->suffix < k) | ||
| 460 | hent->suffix = k; | ||
| 461 | |||
| 462 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 463 | |||
| 464 | } | ||
| 368 | 465 | ||
| 369 | if (tmp != NULL) | 466 | if (tmp != NULL) |
| 370 | { | 467 | { |
| @@ -383,4 +480,3 @@ finish: | |||
| 383 | if (b != NULL) BUF_MEM_free(b); | 480 | if (b != NULL) BUF_MEM_free(b); |
| 384 | return(ok); | 481 | return(ok); |
| 385 | } | 482 | } |
| 386 | |||
diff --git a/src/lib/libcrypto/x509/by_file.c b/src/lib/libcrypto/x509/by_file.c index a5e0d4aefa..57b08ee094 100644 --- a/src/lib/libcrypto/x509/by_file.c +++ b/src/lib/libcrypto/x509/by_file.c | |||
| @@ -100,7 +100,7 @@ static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, | |||
| 100 | case X509_L_FILE_LOAD: | 100 | case X509_L_FILE_LOAD: |
| 101 | if (argl == X509_FILETYPE_DEFAULT) | 101 | if (argl == X509_FILETYPE_DEFAULT) |
| 102 | { | 102 | { |
| 103 | file = (char *)Getenv(X509_get_default_cert_file_env()); | 103 | file = (char *)getenv(X509_get_default_cert_file_env()); |
| 104 | if (file) | 104 | if (file) |
| 105 | ok = (X509_load_cert_crl_file(ctx,file, | 105 | ok = (X509_load_cert_crl_file(ctx,file, |
| 106 | X509_FILETYPE_PEM) != 0); | 106 | X509_FILETYPE_PEM) != 0); |
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h index e71b5257e5..604f4fb27f 100644 --- a/src/lib/libcrypto/x509/x509.h +++ b/src/lib/libcrypto/x509/x509.h | |||
| @@ -116,6 +116,7 @@ extern "C" { | |||
| 116 | /* Under Win32 these are defined in wincrypt.h */ | 116 | /* Under Win32 these are defined in wincrypt.h */ |
| 117 | #undef X509_NAME | 117 | #undef X509_NAME |
| 118 | #undef X509_CERT_PAIR | 118 | #undef X509_CERT_PAIR |
| 119 | #undef X509_EXTENSIONS | ||
| 119 | #endif | 120 | #endif |
| 120 | 121 | ||
| 121 | #define X509_FILETYPE_PEM 1 | 122 | #define X509_FILETYPE_PEM 1 |
| @@ -156,12 +157,12 @@ typedef struct X509_val_st | |||
| 156 | ASN1_TIME *notAfter; | 157 | ASN1_TIME *notAfter; |
| 157 | } X509_VAL; | 158 | } X509_VAL; |
| 158 | 159 | ||
| 159 | typedef struct X509_pubkey_st | 160 | struct X509_pubkey_st |
| 160 | { | 161 | { |
| 161 | X509_ALGOR *algor; | 162 | X509_ALGOR *algor; |
| 162 | ASN1_BIT_STRING *public_key; | 163 | ASN1_BIT_STRING *public_key; |
| 163 | EVP_PKEY *pkey; | 164 | EVP_PKEY *pkey; |
| 164 | } X509_PUBKEY; | 165 | }; |
| 165 | 166 | ||
| 166 | typedef struct X509_sig_st | 167 | typedef struct X509_sig_st |
| 167 | { | 168 | { |
| @@ -190,7 +191,9 @@ struct X509_name_st | |||
| 190 | #else | 191 | #else |
| 191 | char *bytes; | 192 | char *bytes; |
| 192 | #endif | 193 | #endif |
| 193 | unsigned long hash; /* Keep the hash around for lookups */ | 194 | /* unsigned long hash; Keep the hash around for lookups */ |
| 195 | unsigned char *canon_enc; | ||
| 196 | int canon_enclen; | ||
| 194 | } /* X509_NAME */; | 197 | } /* X509_NAME */; |
| 195 | 198 | ||
| 196 | DECLARE_STACK_OF(X509_NAME) | 199 | DECLARE_STACK_OF(X509_NAME) |
| @@ -289,8 +292,11 @@ struct x509_st | |||
| 289 | unsigned long ex_xkusage; | 292 | unsigned long ex_xkusage; |
| 290 | unsigned long ex_nscert; | 293 | unsigned long ex_nscert; |
| 291 | ASN1_OCTET_STRING *skid; | 294 | ASN1_OCTET_STRING *skid; |
| 292 | struct AUTHORITY_KEYID_st *akid; | 295 | AUTHORITY_KEYID *akid; |
| 293 | X509_POLICY_CACHE *policy_cache; | 296 | X509_POLICY_CACHE *policy_cache; |
| 297 | STACK_OF(DIST_POINT) *crldp; | ||
| 298 | STACK_OF(GENERAL_NAME) *altname; | ||
| 299 | NAME_CONSTRAINTS *nc; | ||
| 294 | #ifndef OPENSSL_NO_RFC3779 | 300 | #ifndef OPENSSL_NO_RFC3779 |
| 295 | STACK_OF(IPAddressFamily) *rfc3779_addr; | 301 | STACK_OF(IPAddressFamily) *rfc3779_addr; |
| 296 | struct ASIdentifiers_st *rfc3779_asid; | 302 | struct ASIdentifiers_st *rfc3779_asid; |
| @@ -333,10 +339,11 @@ typedef struct x509_cert_pair_st { | |||
| 333 | #define X509_TRUST_OBJECT_SIGN 5 | 339 | #define X509_TRUST_OBJECT_SIGN 5 |
| 334 | #define X509_TRUST_OCSP_SIGN 6 | 340 | #define X509_TRUST_OCSP_SIGN 6 |
| 335 | #define X509_TRUST_OCSP_REQUEST 7 | 341 | #define X509_TRUST_OCSP_REQUEST 7 |
| 342 | #define X509_TRUST_TSA 8 | ||
| 336 | 343 | ||
| 337 | /* Keep these up to date! */ | 344 | /* Keep these up to date! */ |
| 338 | #define X509_TRUST_MIN 1 | 345 | #define X509_TRUST_MIN 1 |
| 339 | #define X509_TRUST_MAX 7 | 346 | #define X509_TRUST_MAX 8 |
| 340 | 347 | ||
| 341 | 348 | ||
| 342 | /* trust_flags values */ | 349 | /* trust_flags values */ |
| @@ -423,13 +430,17 @@ typedef struct x509_cert_pair_st { | |||
| 423 | XN_FLAG_FN_LN | \ | 430 | XN_FLAG_FN_LN | \ |
| 424 | XN_FLAG_FN_ALIGN) | 431 | XN_FLAG_FN_ALIGN) |
| 425 | 432 | ||
| 426 | typedef struct X509_revoked_st | 433 | struct x509_revoked_st |
| 427 | { | 434 | { |
| 428 | ASN1_INTEGER *serialNumber; | 435 | ASN1_INTEGER *serialNumber; |
| 429 | ASN1_TIME *revocationDate; | 436 | ASN1_TIME *revocationDate; |
| 430 | STACK_OF(X509_EXTENSION) /* optional */ *extensions; | 437 | STACK_OF(X509_EXTENSION) /* optional */ *extensions; |
| 438 | /* Set up if indirect CRL */ | ||
| 439 | STACK_OF(GENERAL_NAME) *issuer; | ||
| 440 | /* Revocation reason */ | ||
| 441 | int reason; | ||
| 431 | int sequence; /* load sequence */ | 442 | int sequence; /* load sequence */ |
| 432 | } X509_REVOKED; | 443 | }; |
| 433 | 444 | ||
| 434 | DECLARE_STACK_OF(X509_REVOKED) | 445 | DECLARE_STACK_OF(X509_REVOKED) |
| 435 | DECLARE_ASN1_SET_OF(X509_REVOKED) | 446 | DECLARE_ASN1_SET_OF(X509_REVOKED) |
| @@ -453,6 +464,22 @@ struct X509_crl_st | |||
| 453 | X509_ALGOR *sig_alg; | 464 | X509_ALGOR *sig_alg; |
| 454 | ASN1_BIT_STRING *signature; | 465 | ASN1_BIT_STRING *signature; |
| 455 | int references; | 466 | int references; |
| 467 | int flags; | ||
| 468 | /* Copies of various extensions */ | ||
| 469 | AUTHORITY_KEYID *akid; | ||
| 470 | ISSUING_DIST_POINT *idp; | ||
| 471 | /* Convenient breakdown of IDP */ | ||
| 472 | int idp_flags; | ||
| 473 | int idp_reasons; | ||
| 474 | /* CRL and base CRL numbers for delta processing */ | ||
| 475 | ASN1_INTEGER *crl_number; | ||
| 476 | ASN1_INTEGER *base_crl_number; | ||
| 477 | #ifndef OPENSSL_NO_SHA | ||
| 478 | unsigned char sha1_hash[SHA_DIGEST_LENGTH]; | ||
| 479 | #endif | ||
| 480 | STACK_OF(GENERAL_NAMES) *issuers; | ||
| 481 | const X509_CRL_METHOD *meth; | ||
| 482 | void *meth_data; | ||
| 456 | } /* X509_CRL */; | 483 | } /* X509_CRL */; |
| 457 | 484 | ||
| 458 | DECLARE_STACK_OF(X509_CRL) | 485 | DECLARE_STACK_OF(X509_CRL) |
| @@ -551,18 +578,19 @@ X509_ALGOR *prf; | |||
| 551 | 578 | ||
| 552 | /* PKCS#8 private key info structure */ | 579 | /* PKCS#8 private key info structure */ |
| 553 | 580 | ||
| 554 | typedef struct pkcs8_priv_key_info_st | 581 | struct pkcs8_priv_key_info_st |
| 555 | { | 582 | { |
| 556 | int broken; /* Flag for various broken formats */ | 583 | int broken; /* Flag for various broken formats */ |
| 557 | #define PKCS8_OK 0 | 584 | #define PKCS8_OK 0 |
| 558 | #define PKCS8_NO_OCTET 1 | 585 | #define PKCS8_NO_OCTET 1 |
| 559 | #define PKCS8_EMBEDDED_PARAM 2 | 586 | #define PKCS8_EMBEDDED_PARAM 2 |
| 560 | #define PKCS8_NS_DB 3 | 587 | #define PKCS8_NS_DB 3 |
| 588 | #define PKCS8_NEG_PRIVKEY 4 | ||
| 561 | ASN1_INTEGER *version; | 589 | ASN1_INTEGER *version; |
| 562 | X509_ALGOR *pkeyalg; | 590 | X509_ALGOR *pkeyalg; |
| 563 | ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */ | 591 | ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */ |
| 564 | STACK_OF(X509_ATTRIBUTE) *attributes; | 592 | STACK_OF(X509_ATTRIBUTE) *attributes; |
| 565 | } PKCS8_PRIV_KEY_INFO; | 593 | }; |
| 566 | 594 | ||
| 567 | #ifdef __cplusplus | 595 | #ifdef __cplusplus |
| 568 | } | 596 | } |
| @@ -575,151 +603,6 @@ typedef struct pkcs8_priv_key_info_st | |||
| 575 | extern "C" { | 603 | extern "C" { |
| 576 | #endif | 604 | #endif |
| 577 | 605 | ||
| 578 | #ifdef SSLEAY_MACROS | ||
| 579 | #define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\ | ||
| 580 | a->signature,(char *)a->cert_info,r) | ||
| 581 | #define X509_REQ_verify(a,r) ASN1_verify((int (*)())i2d_X509_REQ_INFO, \ | ||
| 582 | a->sig_alg,a->signature,(char *)a->req_info,r) | ||
| 583 | #define X509_CRL_verify(a,r) ASN1_verify((int (*)())i2d_X509_CRL_INFO, \ | ||
| 584 | a->sig_alg, a->signature,(char *)a->crl,r) | ||
| 585 | |||
| 586 | #define X509_sign(x,pkey,md) \ | ||
| 587 | ASN1_sign((int (*)())i2d_X509_CINF, x->cert_info->signature, \ | ||
| 588 | x->sig_alg, x->signature, (char *)x->cert_info,pkey,md) | ||
| 589 | #define X509_REQ_sign(x,pkey,md) \ | ||
| 590 | ASN1_sign((int (*)())i2d_X509_REQ_INFO,x->sig_alg, NULL, \ | ||
| 591 | x->signature, (char *)x->req_info,pkey,md) | ||
| 592 | #define X509_CRL_sign(x,pkey,md) \ | ||
| 593 | ASN1_sign((int (*)())i2d_X509_CRL_INFO,x->crl->sig_alg,x->sig_alg, \ | ||
| 594 | x->signature, (char *)x->crl,pkey,md) | ||
| 595 | #define NETSCAPE_SPKI_sign(x,pkey,md) \ | ||
| 596 | ASN1_sign((int (*)())i2d_NETSCAPE_SPKAC, x->sig_algor,NULL, \ | ||
| 597 | x->signature, (char *)x->spkac,pkey,md) | ||
| 598 | |||
| 599 | #define X509_dup(x509) (X509 *)ASN1_dup((int (*)())i2d_X509, \ | ||
| 600 | (char *(*)())d2i_X509,(char *)x509) | ||
| 601 | #define X509_ATTRIBUTE_dup(xa) (X509_ATTRIBUTE *)ASN1_dup(\ | ||
| 602 | (int (*)())i2d_X509_ATTRIBUTE, \ | ||
| 603 | (char *(*)())d2i_X509_ATTRIBUTE,(char *)xa) | ||
| 604 | #define X509_EXTENSION_dup(ex) (X509_EXTENSION *)ASN1_dup( \ | ||
| 605 | (int (*)())i2d_X509_EXTENSION, \ | ||
| 606 | (char *(*)())d2i_X509_EXTENSION,(char *)ex) | ||
| 607 | #define d2i_X509_fp(fp,x509) (X509 *)ASN1_d2i_fp((char *(*)())X509_new, \ | ||
| 608 | (char *(*)())d2i_X509, (fp),(unsigned char **)(x509)) | ||
| 609 | #define i2d_X509_fp(fp,x509) ASN1_i2d_fp(i2d_X509,fp,(unsigned char *)x509) | ||
| 610 | #define d2i_X509_bio(bp,x509) (X509 *)ASN1_d2i_bio((char *(*)())X509_new, \ | ||
| 611 | (char *(*)())d2i_X509, (bp),(unsigned char **)(x509)) | ||
| 612 | #define i2d_X509_bio(bp,x509) ASN1_i2d_bio(i2d_X509,bp,(unsigned char *)x509) | ||
| 613 | |||
| 614 | #define X509_CRL_dup(crl) (X509_CRL *)ASN1_dup((int (*)())i2d_X509_CRL, \ | ||
| 615 | (char *(*)())d2i_X509_CRL,(char *)crl) | ||
| 616 | #define d2i_X509_CRL_fp(fp,crl) (X509_CRL *)ASN1_d2i_fp((char *(*)()) \ | ||
| 617 | X509_CRL_new,(char *(*)())d2i_X509_CRL, (fp),\ | ||
| 618 | (unsigned char **)(crl)) | ||
| 619 | #define i2d_X509_CRL_fp(fp,crl) ASN1_i2d_fp(i2d_X509_CRL,fp,\ | ||
| 620 | (unsigned char *)crl) | ||
| 621 | #define d2i_X509_CRL_bio(bp,crl) (X509_CRL *)ASN1_d2i_bio((char *(*)()) \ | ||
| 622 | X509_CRL_new,(char *(*)())d2i_X509_CRL, (bp),\ | ||
| 623 | (unsigned char **)(crl)) | ||
| 624 | #define i2d_X509_CRL_bio(bp,crl) ASN1_i2d_bio(i2d_X509_CRL,bp,\ | ||
| 625 | (unsigned char *)crl) | ||
| 626 | |||
| 627 | #define PKCS7_dup(p7) (PKCS7 *)ASN1_dup((int (*)())i2d_PKCS7, \ | ||
| 628 | (char *(*)())d2i_PKCS7,(char *)p7) | ||
| 629 | #define d2i_PKCS7_fp(fp,p7) (PKCS7 *)ASN1_d2i_fp((char *(*)()) \ | ||
| 630 | PKCS7_new,(char *(*)())d2i_PKCS7, (fp),\ | ||
| 631 | (unsigned char **)(p7)) | ||
| 632 | #define i2d_PKCS7_fp(fp,p7) ASN1_i2d_fp(i2d_PKCS7,fp,\ | ||
| 633 | (unsigned char *)p7) | ||
| 634 | #define d2i_PKCS7_bio(bp,p7) (PKCS7 *)ASN1_d2i_bio((char *(*)()) \ | ||
| 635 | PKCS7_new,(char *(*)())d2i_PKCS7, (bp),\ | ||
| 636 | (unsigned char **)(p7)) | ||
| 637 | #define i2d_PKCS7_bio(bp,p7) ASN1_i2d_bio(i2d_PKCS7,bp,\ | ||
| 638 | (unsigned char *)p7) | ||
| 639 | |||
| 640 | #define X509_REQ_dup(req) (X509_REQ *)ASN1_dup((int (*)())i2d_X509_REQ, \ | ||
| 641 | (char *(*)())d2i_X509_REQ,(char *)req) | ||
| 642 | #define d2i_X509_REQ_fp(fp,req) (X509_REQ *)ASN1_d2i_fp((char *(*)())\ | ||
| 643 | X509_REQ_new, (char *(*)())d2i_X509_REQ, (fp),\ | ||
| 644 | (unsigned char **)(req)) | ||
| 645 | #define i2d_X509_REQ_fp(fp,req) ASN1_i2d_fp(i2d_X509_REQ,fp,\ | ||
| 646 | (unsigned char *)req) | ||
| 647 | #define d2i_X509_REQ_bio(bp,req) (X509_REQ *)ASN1_d2i_bio((char *(*)())\ | ||
| 648 | X509_REQ_new, (char *(*)())d2i_X509_REQ, (bp),\ | ||
| 649 | (unsigned char **)(req)) | ||
| 650 | #define i2d_X509_REQ_bio(bp,req) ASN1_i2d_bio(i2d_X509_REQ,bp,\ | ||
| 651 | (unsigned char *)req) | ||
| 652 | |||
| 653 | #define RSAPublicKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPublicKey, \ | ||
| 654 | (char *(*)())d2i_RSAPublicKey,(char *)rsa) | ||
| 655 | #define RSAPrivateKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPrivateKey, \ | ||
| 656 | (char *(*)())d2i_RSAPrivateKey,(char *)rsa) | ||
| 657 | |||
| 658 | #define d2i_RSAPrivateKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\ | ||
| 659 | RSA_new,(char *(*)())d2i_RSAPrivateKey, (fp), \ | ||
| 660 | (unsigned char **)(rsa)) | ||
| 661 | #define i2d_RSAPrivateKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPrivateKey,fp, \ | ||
| 662 | (unsigned char *)rsa) | ||
| 663 | #define d2i_RSAPrivateKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\ | ||
| 664 | RSA_new,(char *(*)())d2i_RSAPrivateKey, (bp), \ | ||
| 665 | (unsigned char **)(rsa)) | ||
| 666 | #define i2d_RSAPrivateKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPrivateKey,bp, \ | ||
| 667 | (unsigned char *)rsa) | ||
| 668 | |||
| 669 | #define d2i_RSAPublicKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\ | ||
| 670 | RSA_new,(char *(*)())d2i_RSAPublicKey, (fp), \ | ||
| 671 | (unsigned char **)(rsa)) | ||
| 672 | #define i2d_RSAPublicKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPublicKey,fp, \ | ||
| 673 | (unsigned char *)rsa) | ||
| 674 | #define d2i_RSAPublicKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\ | ||
| 675 | RSA_new,(char *(*)())d2i_RSAPublicKey, (bp), \ | ||
| 676 | (unsigned char **)(rsa)) | ||
| 677 | #define i2d_RSAPublicKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPublicKey,bp, \ | ||
| 678 | (unsigned char *)rsa) | ||
| 679 | |||
| 680 | #define d2i_DSAPrivateKey_fp(fp,dsa) (DSA *)ASN1_d2i_fp((char *(*)())\ | ||
| 681 | DSA_new,(char *(*)())d2i_DSAPrivateKey, (fp), \ | ||
| 682 | (unsigned char **)(dsa)) | ||
| 683 | #define i2d_DSAPrivateKey_fp(fp,dsa) ASN1_i2d_fp(i2d_DSAPrivateKey,fp, \ | ||
| 684 | (unsigned char *)dsa) | ||
| 685 | #define d2i_DSAPrivateKey_bio(bp,dsa) (DSA *)ASN1_d2i_bio((char *(*)())\ | ||
| 686 | DSA_new,(char *(*)())d2i_DSAPrivateKey, (bp), \ | ||
| 687 | (unsigned char **)(dsa)) | ||
| 688 | #define i2d_DSAPrivateKey_bio(bp,dsa) ASN1_i2d_bio(i2d_DSAPrivateKey,bp, \ | ||
| 689 | (unsigned char *)dsa) | ||
| 690 | |||
| 691 | #define d2i_ECPrivateKey_fp(fp,ecdsa) (EC_KEY *)ASN1_d2i_fp((char *(*)())\ | ||
| 692 | EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (fp), \ | ||
| 693 | (unsigned char **)(ecdsa)) | ||
| 694 | #define i2d_ECPrivateKey_fp(fp,ecdsa) ASN1_i2d_fp(i2d_ECPrivateKey,fp, \ | ||
| 695 | (unsigned char *)ecdsa) | ||
| 696 | #define d2i_ECPrivateKey_bio(bp,ecdsa) (EC_KEY *)ASN1_d2i_bio((char *(*)())\ | ||
| 697 | EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (bp), \ | ||
| 698 | (unsigned char **)(ecdsa)) | ||
| 699 | #define i2d_ECPrivateKey_bio(bp,ecdsa) ASN1_i2d_bio(i2d_ECPrivateKey,bp, \ | ||
| 700 | (unsigned char *)ecdsa) | ||
| 701 | |||
| 702 | #define X509_ALGOR_dup(xn) (X509_ALGOR *)ASN1_dup((int (*)())i2d_X509_ALGOR,\ | ||
| 703 | (char *(*)())d2i_X509_ALGOR,(char *)xn) | ||
| 704 | |||
| 705 | #define X509_NAME_dup(xn) (X509_NAME *)ASN1_dup((int (*)())i2d_X509_NAME, \ | ||
| 706 | (char *(*)())d2i_X509_NAME,(char *)xn) | ||
| 707 | #define X509_NAME_ENTRY_dup(ne) (X509_NAME_ENTRY *)ASN1_dup( \ | ||
| 708 | (int (*)())i2d_X509_NAME_ENTRY, \ | ||
| 709 | (char *(*)())d2i_X509_NAME_ENTRY,\ | ||
| 710 | (char *)ne) | ||
| 711 | |||
| 712 | #define X509_digest(data,type,md,len) \ | ||
| 713 | ASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len) | ||
| 714 | #define X509_NAME_digest(data,type,md,len) \ | ||
| 715 | ASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len) | ||
| 716 | #ifndef PKCS7_ISSUER_AND_SERIAL_digest | ||
| 717 | #define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \ | ||
| 718 | ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\ | ||
| 719 | (char *)data,md,len) | ||
| 720 | #endif | ||
| 721 | #endif | ||
| 722 | |||
| 723 | #define X509_EXT_PACK_UNKNOWN 1 | 606 | #define X509_EXT_PACK_UNKNOWN 1 |
| 724 | #define X509_EXT_PACK_STRING 2 | 607 | #define X509_EXT_PACK_STRING 2 |
| 725 | 608 | ||
| @@ -740,6 +623,18 @@ extern "C" { | |||
| 740 | #define X509_CRL_get_issuer(x) ((x)->crl->issuer) | 623 | #define X509_CRL_get_issuer(x) ((x)->crl->issuer) |
| 741 | #define X509_CRL_get_REVOKED(x) ((x)->crl->revoked) | 624 | #define X509_CRL_get_REVOKED(x) ((x)->crl->revoked) |
| 742 | 625 | ||
| 626 | void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); | ||
| 627 | X509_CRL_METHOD *X509_CRL_METHOD_new( | ||
| 628 | int (*crl_init)(X509_CRL *crl), | ||
| 629 | int (*crl_free)(X509_CRL *crl), | ||
| 630 | int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret, | ||
| 631 | ASN1_INTEGER *ser, X509_NAME *issuer), | ||
| 632 | int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk)); | ||
| 633 | void X509_CRL_METHOD_free(X509_CRL_METHOD *m); | ||
| 634 | |||
| 635 | void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); | ||
| 636 | void *X509_CRL_get_meth_data(X509_CRL *crl); | ||
| 637 | |||
| 743 | /* This one is only used so that a binary form can output, as in | 638 | /* This one is only used so that a binary form can output, as in |
| 744 | * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */ | 639 | * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */ |
| 745 | #define X509_get_X509_PUBKEY(x) ((x)->cert_info->key) | 640 | #define X509_get_X509_PUBKEY(x) ((x)->cert_info->key) |
| @@ -747,7 +642,6 @@ extern "C" { | |||
| 747 | 642 | ||
| 748 | const char *X509_verify_cert_error_string(long n); | 643 | const char *X509_verify_cert_error_string(long n); |
| 749 | 644 | ||
| 750 | #ifndef SSLEAY_MACROS | ||
| 751 | #ifndef OPENSSL_NO_EVP | 645 | #ifndef OPENSSL_NO_EVP |
| 752 | int X509_verify(X509 *a, EVP_PKEY *r); | 646 | int X509_verify(X509 *a, EVP_PKEY *r); |
| 753 | 647 | ||
| @@ -872,11 +766,11 @@ void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval, | |||
| 872 | X509_NAME *X509_NAME_dup(X509_NAME *xn); | 766 | X509_NAME *X509_NAME_dup(X509_NAME *xn); |
| 873 | X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); | 767 | X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); |
| 874 | 768 | ||
| 875 | #endif /* !SSLEAY_MACROS */ | 769 | int X509_cmp_time(const ASN1_TIME *s, time_t *t); |
| 876 | 770 | int X509_cmp_current_time(const ASN1_TIME *s); | |
| 877 | int X509_cmp_time(ASN1_TIME *s, time_t *t); | ||
| 878 | int X509_cmp_current_time(ASN1_TIME *s); | ||
| 879 | ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t); | 771 | ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t); |
| 772 | ASN1_TIME * X509_time_adj_ex(ASN1_TIME *s, | ||
| 773 | int offset_day, long offset_sec, time_t *t); | ||
| 880 | ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj); | 774 | ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj); |
| 881 | 775 | ||
| 882 | const char * X509_get_default_cert_area(void ); | 776 | const char * X509_get_default_cert_area(void ); |
| @@ -964,6 +858,9 @@ DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) | |||
| 964 | DECLARE_ASN1_FUNCTIONS(X509_CRL) | 858 | DECLARE_ASN1_FUNCTIONS(X509_CRL) |
| 965 | 859 | ||
| 966 | int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); | 860 | int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); |
| 861 | int X509_CRL_get0_by_serial(X509_CRL *crl, | ||
| 862 | X509_REVOKED **ret, ASN1_INTEGER *serial); | ||
| 863 | int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); | ||
| 967 | 864 | ||
| 968 | X509_PKEY * X509_PKEY_new(void ); | 865 | X509_PKEY * X509_PKEY_new(void ); |
| 969 | void X509_PKEY_free(X509_PKEY *a); | 866 | void X509_PKEY_free(X509_PKEY *a); |
| @@ -1007,8 +904,8 @@ int X509_set_issuer_name(X509 *x, X509_NAME *name); | |||
| 1007 | X509_NAME * X509_get_issuer_name(X509 *a); | 904 | X509_NAME * X509_get_issuer_name(X509 *a); |
| 1008 | int X509_set_subject_name(X509 *x, X509_NAME *name); | 905 | int X509_set_subject_name(X509 *x, X509_NAME *name); |
| 1009 | X509_NAME * X509_get_subject_name(X509 *a); | 906 | X509_NAME * X509_get_subject_name(X509 *a); |
| 1010 | int X509_set_notBefore(X509 *x, ASN1_TIME *tm); | 907 | int X509_set_notBefore(X509 *x, const ASN1_TIME *tm); |
| 1011 | int X509_set_notAfter(X509 *x, ASN1_TIME *tm); | 908 | int X509_set_notAfter(X509 *x, const ASN1_TIME *tm); |
| 1012 | int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); | 909 | int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); |
| 1013 | EVP_PKEY * X509_get_pubkey(X509 *x); | 910 | EVP_PKEY * X509_get_pubkey(X509 *x); |
| 1014 | ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x); | 911 | ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x); |
| @@ -1045,8 +942,8 @@ int X509_REQ_add1_attr_by_txt(X509_REQ *req, | |||
| 1045 | 942 | ||
| 1046 | int X509_CRL_set_version(X509_CRL *x, long version); | 943 | int X509_CRL_set_version(X509_CRL *x, long version); |
| 1047 | int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); | 944 | int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); |
| 1048 | int X509_CRL_set_lastUpdate(X509_CRL *x, ASN1_TIME *tm); | 945 | int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); |
| 1049 | int X509_CRL_set_nextUpdate(X509_CRL *x, ASN1_TIME *tm); | 946 | int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); |
| 1050 | int X509_CRL_sort(X509_CRL *crl); | 947 | int X509_CRL_sort(X509_CRL *crl); |
| 1051 | 948 | ||
| 1052 | int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); | 949 | int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); |
| @@ -1065,11 +962,18 @@ unsigned long X509_issuer_name_hash(X509 *a); | |||
| 1065 | int X509_subject_name_cmp(const X509 *a, const X509 *b); | 962 | int X509_subject_name_cmp(const X509 *a, const X509 *b); |
| 1066 | unsigned long X509_subject_name_hash(X509 *x); | 963 | unsigned long X509_subject_name_hash(X509 *x); |
| 1067 | 964 | ||
| 965 | #ifndef OPENSSL_NO_MD5 | ||
| 966 | unsigned long X509_issuer_name_hash_old(X509 *a); | ||
| 967 | unsigned long X509_subject_name_hash_old(X509 *x); | ||
| 968 | #endif | ||
| 969 | |||
| 1068 | int X509_cmp(const X509 *a, const X509 *b); | 970 | int X509_cmp(const X509 *a, const X509 *b); |
| 1069 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); | 971 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); |
| 1070 | unsigned long X509_NAME_hash(X509_NAME *x); | 972 | unsigned long X509_NAME_hash(X509_NAME *x); |
| 973 | unsigned long X509_NAME_hash_old(X509_NAME *x); | ||
| 1071 | 974 | ||
| 1072 | int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); | 975 | int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); |
| 976 | int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); | ||
| 1073 | #ifndef OPENSSL_NO_FP_API | 977 | #ifndef OPENSSL_NO_FP_API |
| 1074 | int X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag); | 978 | int X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag); |
| 1075 | int X509_print_fp(FILE *bp,X509 *x); | 979 | int X509_print_fp(FILE *bp,X509 *x); |
| @@ -1245,9 +1149,16 @@ DECLARE_ASN1_FUNCTIONS(PBEPARAM) | |||
| 1245 | DECLARE_ASN1_FUNCTIONS(PBE2PARAM) | 1149 | DECLARE_ASN1_FUNCTIONS(PBE2PARAM) |
| 1246 | DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) | 1150 | DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) |
| 1247 | 1151 | ||
| 1248 | X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int saltlen); | 1152 | int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, |
| 1153 | const unsigned char *salt, int saltlen); | ||
| 1154 | |||
| 1155 | X509_ALGOR *PKCS5_pbe_set(int alg, int iter, | ||
| 1156 | const unsigned char *salt, int saltlen); | ||
| 1249 | X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | 1157 | X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, |
| 1250 | unsigned char *salt, int saltlen); | 1158 | unsigned char *salt, int saltlen); |
| 1159 | X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, | ||
| 1160 | unsigned char *salt, int saltlen, | ||
| 1161 | unsigned char *aiv, int prf_nid); | ||
| 1251 | 1162 | ||
| 1252 | /* PKCS#8 utilities */ | 1163 | /* PKCS#8 utilities */ |
| 1253 | 1164 | ||
| @@ -1258,6 +1169,22 @@ PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); | |||
| 1258 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken); | 1169 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken); |
| 1259 | PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); | 1170 | PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); |
| 1260 | 1171 | ||
| 1172 | int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, | ||
| 1173 | int version, int ptype, void *pval, | ||
| 1174 | unsigned char *penc, int penclen); | ||
| 1175 | int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg, | ||
| 1176 | const unsigned char **pk, int *ppklen, | ||
| 1177 | X509_ALGOR **pa, | ||
| 1178 | PKCS8_PRIV_KEY_INFO *p8); | ||
| 1179 | |||
| 1180 | int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, | ||
| 1181 | int ptype, void *pval, | ||
| 1182 | unsigned char *penc, int penclen); | ||
| 1183 | int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, | ||
| 1184 | const unsigned char **pk, int *ppklen, | ||
| 1185 | X509_ALGOR **pa, | ||
| 1186 | X509_PUBKEY *pub); | ||
| 1187 | |||
| 1261 | int X509_check_trust(X509 *x, int id, int flags); | 1188 | int X509_check_trust(X509 *x, int id, int flags); |
| 1262 | int X509_TRUST_get_count(void); | 1189 | int X509_TRUST_get_count(void); |
| 1263 | X509_TRUST * X509_TRUST_get0(int idx); | 1190 | X509_TRUST * X509_TRUST_get0(int idx); |
| @@ -1337,7 +1264,10 @@ void ERR_load_X509_strings(void); | |||
| 1337 | #define X509_R_KEY_VALUES_MISMATCH 116 | 1264 | #define X509_R_KEY_VALUES_MISMATCH 116 |
| 1338 | #define X509_R_LOADING_CERT_DIR 103 | 1265 | #define X509_R_LOADING_CERT_DIR 103 |
| 1339 | #define X509_R_LOADING_DEFAULTS 104 | 1266 | #define X509_R_LOADING_DEFAULTS 104 |
| 1267 | #define X509_R_METHOD_NOT_SUPPORTED 124 | ||
| 1340 | #define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 | 1268 | #define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 |
| 1269 | #define X509_R_PUBLIC_KEY_DECODE_ERROR 125 | ||
| 1270 | #define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 | ||
| 1341 | #define X509_R_SHOULD_RETRY 106 | 1271 | #define X509_R_SHOULD_RETRY 106 |
| 1342 | #define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 | 1272 | #define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 |
| 1343 | #define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 | 1273 | #define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 |
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c index 2faf92514a..4bc9da07e0 100644 --- a/src/lib/libcrypto/x509/x509_cmp.c +++ b/src/lib/libcrypto/x509/x509_cmp.c | |||
| @@ -116,6 +116,13 @@ int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b) | |||
| 116 | return(X509_NAME_cmp(a->crl->issuer,b->crl->issuer)); | 116 | return(X509_NAME_cmp(a->crl->issuer,b->crl->issuer)); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | #ifndef OPENSSL_NO_SHA | ||
| 120 | int X509_CRL_match(const X509_CRL *a, const X509_CRL *b) | ||
| 121 | { | ||
| 122 | return memcmp(a->sha1_hash, b->sha1_hash, 20); | ||
| 123 | } | ||
| 124 | #endif | ||
| 125 | |||
| 119 | X509_NAME *X509_get_issuer_name(X509 *a) | 126 | X509_NAME *X509_get_issuer_name(X509 *a) |
| 120 | { | 127 | { |
| 121 | return(a->cert_info->issuer); | 128 | return(a->cert_info->issuer); |
| @@ -126,6 +133,13 @@ unsigned long X509_issuer_name_hash(X509 *x) | |||
| 126 | return(X509_NAME_hash(x->cert_info->issuer)); | 133 | return(X509_NAME_hash(x->cert_info->issuer)); |
| 127 | } | 134 | } |
| 128 | 135 | ||
| 136 | #ifndef OPENSSL_NO_MD5 | ||
| 137 | unsigned long X509_issuer_name_hash_old(X509 *x) | ||
| 138 | { | ||
| 139 | return(X509_NAME_hash_old(x->cert_info->issuer)); | ||
| 140 | } | ||
| 141 | #endif | ||
| 142 | |||
| 129 | X509_NAME *X509_get_subject_name(X509 *a) | 143 | X509_NAME *X509_get_subject_name(X509 *a) |
| 130 | { | 144 | { |
| 131 | return(a->cert_info->subject); | 145 | return(a->cert_info->subject); |
| @@ -141,6 +155,13 @@ unsigned long X509_subject_name_hash(X509 *x) | |||
| 141 | return(X509_NAME_hash(x->cert_info->subject)); | 155 | return(X509_NAME_hash(x->cert_info->subject)); |
| 142 | } | 156 | } |
| 143 | 157 | ||
| 158 | #ifndef OPENSSL_NO_MD5 | ||
| 159 | unsigned long X509_subject_name_hash_old(X509 *x) | ||
| 160 | { | ||
| 161 | return(X509_NAME_hash_old(x->cert_info->subject)); | ||
| 162 | } | ||
| 163 | #endif | ||
| 164 | |||
| 144 | #ifndef OPENSSL_NO_SHA | 165 | #ifndef OPENSSL_NO_SHA |
| 145 | /* Compare two certificates: they must be identical for | 166 | /* Compare two certificates: they must be identical for |
| 146 | * this to work. NB: Although "cmp" operations are generally | 167 | * this to work. NB: Although "cmp" operations are generally |
| @@ -162,177 +183,63 @@ int X509_cmp(const X509 *a, const X509 *b) | |||
| 162 | #endif | 183 | #endif |
| 163 | 184 | ||
| 164 | 185 | ||
| 165 | /* Case insensitive string comparision */ | 186 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b) |
| 166 | static int nocase_cmp(const ASN1_STRING *a, const ASN1_STRING *b) | ||
| 167 | { | ||
| 168 | int i; | ||
| 169 | |||
| 170 | if (a->length != b->length) | ||
| 171 | return (a->length - b->length); | ||
| 172 | |||
| 173 | for (i=0; i<a->length; i++) | ||
| 174 | { | ||
| 175 | int ca, cb; | ||
| 176 | |||
| 177 | ca = tolower(a->data[i]); | ||
| 178 | cb = tolower(b->data[i]); | ||
| 179 | |||
| 180 | if (ca != cb) | ||
| 181 | return(ca-cb); | ||
| 182 | } | ||
| 183 | return 0; | ||
| 184 | } | ||
| 185 | |||
| 186 | /* Case insensitive string comparision with space normalization | ||
| 187 | * Space normalization - ignore leading, trailing spaces, | ||
| 188 | * multiple spaces between characters are replaced by single space | ||
| 189 | */ | ||
| 190 | static int nocase_spacenorm_cmp(const ASN1_STRING *a, const ASN1_STRING *b) | ||
| 191 | { | ||
| 192 | unsigned char *pa = NULL, *pb = NULL; | ||
| 193 | int la, lb; | ||
| 194 | |||
| 195 | la = a->length; | ||
| 196 | lb = b->length; | ||
| 197 | pa = a->data; | ||
| 198 | pb = b->data; | ||
| 199 | |||
| 200 | /* skip leading spaces */ | ||
| 201 | while (la > 0 && isspace(*pa)) | ||
| 202 | { | ||
| 203 | la--; | ||
| 204 | pa++; | ||
| 205 | } | ||
| 206 | while (lb > 0 && isspace(*pb)) | ||
| 207 | { | ||
| 208 | lb--; | ||
| 209 | pb++; | ||
| 210 | } | ||
| 211 | |||
| 212 | /* skip trailing spaces */ | ||
| 213 | while (la > 0 && isspace(pa[la-1])) | ||
| 214 | la--; | ||
| 215 | while (lb > 0 && isspace(pb[lb-1])) | ||
| 216 | lb--; | ||
| 217 | |||
| 218 | /* compare strings with space normalization */ | ||
| 219 | while (la > 0 && lb > 0) | ||
| 220 | { | 187 | { |
| 221 | int ca, cb; | 188 | int ret; |
| 222 | |||
| 223 | /* compare character */ | ||
| 224 | ca = tolower(*pa); | ||
| 225 | cb = tolower(*pb); | ||
| 226 | if (ca != cb) | ||
| 227 | return (ca - cb); | ||
| 228 | 189 | ||
| 229 | pa++; pb++; | 190 | /* Ensure canonical encoding is present and up to date */ |
| 230 | la--; lb--; | ||
| 231 | 191 | ||
| 232 | if (la <= 0 || lb <= 0) | 192 | if (!a->canon_enc || a->modified) |
| 233 | break; | 193 | { |
| 194 | ret = i2d_X509_NAME((X509_NAME *)a, NULL); | ||
| 195 | if (ret < 0) | ||
| 196 | return -2; | ||
| 197 | } | ||
| 234 | 198 | ||
| 235 | /* is white space next character ? */ | 199 | if (!b->canon_enc || b->modified) |
| 236 | if (isspace(*pa) && isspace(*pb)) | ||
| 237 | { | 200 | { |
| 238 | /* skip remaining white spaces */ | 201 | ret = i2d_X509_NAME((X509_NAME *)b, NULL); |
| 239 | while (la > 0 && isspace(*pa)) | 202 | if (ret < 0) |
| 240 | { | 203 | return -2; |
| 241 | la--; | ||
| 242 | pa++; | ||
| 243 | } | ||
| 244 | while (lb > 0 && isspace(*pb)) | ||
| 245 | { | ||
| 246 | lb--; | ||
| 247 | pb++; | ||
| 248 | } | ||
| 249 | } | 204 | } |
| 250 | } | ||
| 251 | if (la > 0 || lb > 0) | ||
| 252 | return la - lb; | ||
| 253 | 205 | ||
| 254 | return 0; | 206 | ret = a->canon_enclen - b->canon_enclen; |
| 255 | } | ||
| 256 | 207 | ||
| 257 | static int asn1_string_memcmp(ASN1_STRING *a, ASN1_STRING *b) | 208 | if (ret) |
| 258 | { | 209 | return ret; |
| 259 | int j; | ||
| 260 | j = a->length - b->length; | ||
| 261 | if (j) | ||
| 262 | return j; | ||
| 263 | return memcmp(a->data, b->data, a->length); | ||
| 264 | } | ||
| 265 | 210 | ||
| 266 | #define STR_TYPE_CMP (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_UTF8STRING) | 211 | return memcmp(a->canon_enc, b->canon_enc, a->canon_enclen); |
| 267 | 212 | ||
| 268 | int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b) | 213 | } |
| 269 | { | ||
| 270 | int i,j; | ||
| 271 | X509_NAME_ENTRY *na,*nb; | ||
| 272 | 214 | ||
| 273 | unsigned long nabit, nbbit; | 215 | unsigned long X509_NAME_hash(X509_NAME *x) |
| 216 | { | ||
| 217 | unsigned long ret=0; | ||
| 218 | unsigned char md[SHA_DIGEST_LENGTH]; | ||
| 274 | 219 | ||
| 275 | j = sk_X509_NAME_ENTRY_num(a->entries) | 220 | /* Make sure X509_NAME structure contains valid cached encoding */ |
| 276 | - sk_X509_NAME_ENTRY_num(b->entries); | 221 | i2d_X509_NAME(x,NULL); |
| 277 | if (j) | 222 | EVP_Digest(x->canon_enc, x->canon_enclen, md, NULL, EVP_sha1(), NULL); |
| 278 | return j; | ||
| 279 | for (i=sk_X509_NAME_ENTRY_num(a->entries)-1; i>=0; i--) | ||
| 280 | { | ||
| 281 | na=sk_X509_NAME_ENTRY_value(a->entries,i); | ||
| 282 | nb=sk_X509_NAME_ENTRY_value(b->entries,i); | ||
| 283 | j=na->value->type-nb->value->type; | ||
| 284 | if (j) | ||
| 285 | { | ||
| 286 | nabit = ASN1_tag2bit(na->value->type); | ||
| 287 | nbbit = ASN1_tag2bit(nb->value->type); | ||
| 288 | if (!(nabit & STR_TYPE_CMP) || | ||
| 289 | !(nbbit & STR_TYPE_CMP)) | ||
| 290 | return j; | ||
| 291 | if (!asn1_string_memcmp(na->value, nb->value)) | ||
| 292 | j = 0; | ||
| 293 | } | ||
| 294 | else if (na->value->type == V_ASN1_PRINTABLESTRING) | ||
| 295 | j=nocase_spacenorm_cmp(na->value, nb->value); | ||
| 296 | else if (na->value->type == V_ASN1_IA5STRING | ||
| 297 | && OBJ_obj2nid(na->object) == NID_pkcs9_emailAddress) | ||
| 298 | j=nocase_cmp(na->value, nb->value); | ||
| 299 | else | ||
| 300 | j = asn1_string_memcmp(na->value, nb->value); | ||
| 301 | if (j) return(j); | ||
| 302 | j=na->set-nb->set; | ||
| 303 | if (j) return(j); | ||
| 304 | } | ||
| 305 | 223 | ||
| 306 | /* We will check the object types after checking the values | 224 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| |
| 307 | * since the values will more often be different than the object | 225 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) |
| 308 | * types. */ | 226 | )&0xffffffffL; |
| 309 | for (i=sk_X509_NAME_ENTRY_num(a->entries)-1; i>=0; i--) | 227 | return(ret); |
| 310 | { | ||
| 311 | na=sk_X509_NAME_ENTRY_value(a->entries,i); | ||
| 312 | nb=sk_X509_NAME_ENTRY_value(b->entries,i); | ||
| 313 | j=OBJ_cmp(na->object,nb->object); | ||
| 314 | if (j) return(j); | ||
| 315 | } | ||
| 316 | return(0); | ||
| 317 | } | 228 | } |
| 318 | 229 | ||
| 230 | |||
| 319 | #ifndef OPENSSL_NO_MD5 | 231 | #ifndef OPENSSL_NO_MD5 |
| 320 | /* I now DER encode the name and hash it. Since I cache the DER encoding, | 232 | /* I now DER encode the name and hash it. Since I cache the DER encoding, |
| 321 | * this is reasonably efficient. */ | 233 | * this is reasonably efficient. */ |
| 322 | unsigned long X509_NAME_hash(X509_NAME *x) | 234 | |
| 235 | unsigned long X509_NAME_hash_old(X509_NAME *x) | ||
| 323 | { | 236 | { |
| 324 | unsigned long ret=0; | 237 | unsigned long ret=0; |
| 325 | unsigned char md[16]; | 238 | unsigned char md[16]; |
| 326 | EVP_MD_CTX md_ctx; | ||
| 327 | 239 | ||
| 328 | /* Make sure X509_NAME structure contains valid cached encoding */ | 240 | /* Make sure X509_NAME structure contains valid cached encoding */ |
| 329 | i2d_X509_NAME(x,NULL); | 241 | i2d_X509_NAME(x,NULL); |
| 330 | EVP_MD_CTX_init(&md_ctx); | 242 | EVP_Digest(x->bytes->data, x->bytes->length, md, NULL, EVP_md5(), NULL); |
| 331 | EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
| 332 | EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL); | ||
| 333 | EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length); | ||
| 334 | EVP_DigestFinal_ex(&md_ctx,md,NULL); | ||
| 335 | EVP_MD_CTX_cleanup(&md_ctx); | ||
| 336 | 243 | ||
| 337 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| | 244 | ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| |
| 338 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) | 245 | ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) |
| @@ -393,14 +300,19 @@ ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) | |||
| 393 | 300 | ||
| 394 | int X509_check_private_key(X509 *x, EVP_PKEY *k) | 301 | int X509_check_private_key(X509 *x, EVP_PKEY *k) |
| 395 | { | 302 | { |
| 396 | EVP_PKEY *xk=NULL; | 303 | EVP_PKEY *xk; |
| 397 | int ok=0; | 304 | int ret; |
| 398 | 305 | ||
| 399 | xk=X509_get_pubkey(x); | 306 | xk=X509_get_pubkey(x); |
| 400 | switch (EVP_PKEY_cmp(xk, k)) | 307 | |
| 308 | if (xk) | ||
| 309 | ret = EVP_PKEY_cmp(xk, k); | ||
| 310 | else | ||
| 311 | ret = -2; | ||
| 312 | |||
| 313 | switch (ret) | ||
| 401 | { | 314 | { |
| 402 | case 1: | 315 | case 1: |
| 403 | ok=1; | ||
| 404 | break; | 316 | break; |
| 405 | case 0: | 317 | case 0: |
| 406 | X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_KEY_VALUES_MISMATCH); | 318 | X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_KEY_VALUES_MISMATCH); |
| @@ -409,24 +321,11 @@ int X509_check_private_key(X509 *x, EVP_PKEY *k) | |||
| 409 | X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_KEY_TYPE_MISMATCH); | 321 | X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_KEY_TYPE_MISMATCH); |
| 410 | break; | 322 | break; |
| 411 | case -2: | 323 | case -2: |
| 412 | #ifndef OPENSSL_NO_EC | ||
| 413 | if (k->type == EVP_PKEY_EC) | ||
| 414 | { | ||
| 415 | X509err(X509_F_X509_CHECK_PRIVATE_KEY, ERR_R_EC_LIB); | ||
| 416 | break; | ||
| 417 | } | ||
| 418 | #endif | ||
| 419 | #ifndef OPENSSL_NO_DH | ||
| 420 | if (k->type == EVP_PKEY_DH) | ||
| 421 | { | ||
| 422 | /* No idea */ | ||
| 423 | X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_CANT_CHECK_DH_KEY); | ||
| 424 | break; | ||
| 425 | } | ||
| 426 | #endif | ||
| 427 | X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_UNKNOWN_KEY_TYPE); | 324 | X509err(X509_F_X509_CHECK_PRIVATE_KEY,X509_R_UNKNOWN_KEY_TYPE); |
| 428 | } | 325 | } |
| 429 | 326 | if (xk) | |
| 430 | EVP_PKEY_free(xk); | 327 | EVP_PKEY_free(xk); |
| 431 | return(ok); | 328 | if (ret > 0) |
| 329 | return 1; | ||
| 330 | return 0; | ||
| 432 | } | 331 | } |
diff --git a/src/lib/libcrypto/x509/x509_err.c b/src/lib/libcrypto/x509/x509_err.c index fb377292da..a01402f416 100644 --- a/src/lib/libcrypto/x509/x509_err.c +++ b/src/lib/libcrypto/x509/x509_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/x509/x509_err.c */ | 1 | /* crypto/x509/x509_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -132,7 +132,10 @@ static ERR_STRING_DATA X509_str_reasons[]= | |||
| 132 | {ERR_REASON(X509_R_KEY_VALUES_MISMATCH) ,"key values mismatch"}, | 132 | {ERR_REASON(X509_R_KEY_VALUES_MISMATCH) ,"key values mismatch"}, |
| 133 | {ERR_REASON(X509_R_LOADING_CERT_DIR) ,"loading cert dir"}, | 133 | {ERR_REASON(X509_R_LOADING_CERT_DIR) ,"loading cert dir"}, |
| 134 | {ERR_REASON(X509_R_LOADING_DEFAULTS) ,"loading defaults"}, | 134 | {ERR_REASON(X509_R_LOADING_DEFAULTS) ,"loading defaults"}, |
| 135 | {ERR_REASON(X509_R_METHOD_NOT_SUPPORTED) ,"method not supported"}, | ||
| 135 | {ERR_REASON(X509_R_NO_CERT_SET_FOR_US_TO_VERIFY),"no cert set for us to verify"}, | 136 | {ERR_REASON(X509_R_NO_CERT_SET_FOR_US_TO_VERIFY),"no cert set for us to verify"}, |
| 137 | {ERR_REASON(X509_R_PUBLIC_KEY_DECODE_ERROR),"public key decode error"}, | ||
| 138 | {ERR_REASON(X509_R_PUBLIC_KEY_ENCODE_ERROR),"public key encode error"}, | ||
| 136 | {ERR_REASON(X509_R_SHOULD_RETRY) ,"should retry"}, | 139 | {ERR_REASON(X509_R_SHOULD_RETRY) ,"should retry"}, |
| 137 | {ERR_REASON(X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN),"unable to find parameters in chain"}, | 140 | {ERR_REASON(X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN),"unable to find parameters in chain"}, |
| 138 | {ERR_REASON(X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY),"unable to get certs public key"}, | 141 | {ERR_REASON(X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY),"unable to get certs public key"}, |
diff --git a/src/lib/libcrypto/x509/x509_lu.c b/src/lib/libcrypto/x509/x509_lu.c index cd2cfb6d85..3a6e04a1de 100644 --- a/src/lib/libcrypto/x509/x509_lu.c +++ b/src/lib/libcrypto/x509/x509_lu.c | |||
| @@ -196,9 +196,17 @@ X509_STORE *X509_STORE_new(void) | |||
| 196 | ret->get_crl = 0; | 196 | ret->get_crl = 0; |
| 197 | ret->check_crl = 0; | 197 | ret->check_crl = 0; |
| 198 | ret->cert_crl = 0; | 198 | ret->cert_crl = 0; |
| 199 | ret->lookup_certs = 0; | ||
| 200 | ret->lookup_crls = 0; | ||
| 199 | ret->cleanup = 0; | 201 | ret->cleanup = 0; |
| 200 | 202 | ||
| 201 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data); | 203 | if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data)) |
| 204 | { | ||
| 205 | sk_X509_OBJECT_free(ret->objs); | ||
| 206 | OPENSSL_free(ret); | ||
| 207 | return NULL; | ||
| 208 | } | ||
| 209 | |||
| 202 | ret->references=1; | 210 | ret->references=1; |
| 203 | return ret; | 211 | return ret; |
| 204 | } | 212 | } |
| @@ -286,9 +294,11 @@ int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name, | |||
| 286 | X509_OBJECT stmp,*tmp; | 294 | X509_OBJECT stmp,*tmp; |
| 287 | int i,j; | 295 | int i,j; |
| 288 | 296 | ||
| 297 | CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); | ||
| 289 | tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name); | 298 | tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name); |
| 299 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 290 | 300 | ||
| 291 | if (tmp == NULL) | 301 | if (tmp == NULL || type == X509_LU_CRL) |
| 292 | { | 302 | { |
| 293 | for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) | 303 | for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) |
| 294 | { | 304 | { |
| @@ -340,7 +350,6 @@ int X509_STORE_add_cert(X509_STORE *ctx, X509 *x) | |||
| 340 | 350 | ||
| 341 | X509_OBJECT_up_ref_count(obj); | 351 | X509_OBJECT_up_ref_count(obj); |
| 342 | 352 | ||
| 343 | |||
| 344 | if (X509_OBJECT_retrieve_match(ctx->objs, obj)) | 353 | if (X509_OBJECT_retrieve_match(ctx->objs, obj)) |
| 345 | { | 354 | { |
| 346 | X509_OBJECT_free_contents(obj); | 355 | X509_OBJECT_free_contents(obj); |
| @@ -414,14 +423,15 @@ void X509_OBJECT_free_contents(X509_OBJECT *a) | |||
| 414 | } | 423 | } |
| 415 | } | 424 | } |
| 416 | 425 | ||
| 417 | int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, | 426 | static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, int type, |
| 418 | X509_NAME *name) | 427 | X509_NAME *name, int *pnmatch) |
| 419 | { | 428 | { |
| 420 | X509_OBJECT stmp; | 429 | X509_OBJECT stmp; |
| 421 | X509 x509_s; | 430 | X509 x509_s; |
| 422 | X509_CINF cinf_s; | 431 | X509_CINF cinf_s; |
| 423 | X509_CRL crl_s; | 432 | X509_CRL crl_s; |
| 424 | X509_CRL_INFO crl_info_s; | 433 | X509_CRL_INFO crl_info_s; |
| 434 | int idx; | ||
| 425 | 435 | ||
| 426 | stmp.type=type; | 436 | stmp.type=type; |
| 427 | switch (type) | 437 | switch (type) |
| @@ -441,41 +451,169 @@ int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, | |||
| 441 | return -1; | 451 | return -1; |
| 442 | } | 452 | } |
| 443 | 453 | ||
| 444 | return sk_X509_OBJECT_find(h,&stmp); | 454 | idx = sk_X509_OBJECT_find(h,&stmp); |
| 455 | if (idx >= 0 && pnmatch) | ||
| 456 | { | ||
| 457 | int tidx; | ||
| 458 | const X509_OBJECT *tobj, *pstmp; | ||
| 459 | *pnmatch = 1; | ||
| 460 | pstmp = &stmp; | ||
| 461 | for (tidx = idx + 1; tidx < sk_X509_OBJECT_num(h); tidx++) | ||
| 462 | { | ||
| 463 | tobj = sk_X509_OBJECT_value(h, tidx); | ||
| 464 | if (x509_object_cmp(&tobj, &pstmp)) | ||
| 465 | break; | ||
| 466 | (*pnmatch)++; | ||
| 467 | } | ||
| 468 | } | ||
| 469 | return idx; | ||
| 470 | } | ||
| 471 | |||
| 472 | |||
| 473 | int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, | ||
| 474 | X509_NAME *name) | ||
| 475 | { | ||
| 476 | return x509_object_idx_cnt(h, type, name, NULL); | ||
| 445 | } | 477 | } |
| 446 | 478 | ||
| 447 | X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type, | 479 | X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type, |
| 448 | X509_NAME *name) | 480 | X509_NAME *name) |
| 449 | { | 481 | { |
| 450 | int idx; | 482 | int idx; |
| 451 | idx = X509_OBJECT_idx_by_subject(h, type, name); | 483 | idx = X509_OBJECT_idx_by_subject(h, type, name); |
| 452 | if (idx==-1) return NULL; | 484 | if (idx==-1) return NULL; |
| 453 | return sk_X509_OBJECT_value(h, idx); | 485 | return sk_X509_OBJECT_value(h, idx); |
| 454 | } | 486 | } |
| 487 | |||
| 488 | STACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm) | ||
| 489 | { | ||
| 490 | int i, idx, cnt; | ||
| 491 | STACK_OF(X509) *sk; | ||
| 492 | X509 *x; | ||
| 493 | X509_OBJECT *obj; | ||
| 494 | sk = sk_X509_new_null(); | ||
| 495 | CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); | ||
| 496 | idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt); | ||
| 497 | if (idx < 0) | ||
| 498 | { | ||
| 499 | /* Nothing found in cache: do lookup to possibly add new | ||
| 500 | * objects to cache | ||
| 501 | */ | ||
| 502 | X509_OBJECT xobj; | ||
| 503 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 504 | if (!X509_STORE_get_by_subject(ctx, X509_LU_X509, nm, &xobj)) | ||
| 505 | { | ||
| 506 | sk_X509_free(sk); | ||
| 507 | return NULL; | ||
| 508 | } | ||
| 509 | X509_OBJECT_free_contents(&xobj); | ||
| 510 | CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); | ||
| 511 | idx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_X509,nm, &cnt); | ||
| 512 | if (idx < 0) | ||
| 513 | { | ||
| 514 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 515 | sk_X509_free(sk); | ||
| 516 | return NULL; | ||
| 517 | } | ||
| 518 | } | ||
| 519 | for (i = 0; i < cnt; i++, idx++) | ||
| 520 | { | ||
| 521 | obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx); | ||
| 522 | x = obj->data.x509; | ||
| 523 | CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509); | ||
| 524 | if (!sk_X509_push(sk, x)) | ||
| 525 | { | ||
| 526 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 527 | X509_free(x); | ||
| 528 | sk_X509_pop_free(sk, X509_free); | ||
| 529 | return NULL; | ||
| 530 | } | ||
| 531 | } | ||
| 532 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 533 | return sk; | ||
| 534 | |||
| 535 | } | ||
| 536 | |||
| 537 | STACK_OF(X509_CRL)* X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *nm) | ||
| 538 | { | ||
| 539 | int i, idx, cnt; | ||
| 540 | STACK_OF(X509_CRL) *sk; | ||
| 541 | X509_CRL *x; | ||
| 542 | X509_OBJECT *obj, xobj; | ||
| 543 | sk = sk_X509_CRL_new_null(); | ||
| 544 | CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); | ||
| 545 | /* Check cache first */ | ||
| 546 | idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_CRL, nm, &cnt); | ||
| 547 | |||
| 548 | /* Always do lookup to possibly add new CRLs to cache | ||
| 549 | */ | ||
| 550 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 551 | if (!X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj)) | ||
| 552 | { | ||
| 553 | sk_X509_CRL_free(sk); | ||
| 554 | return NULL; | ||
| 555 | } | ||
| 556 | X509_OBJECT_free_contents(&xobj); | ||
| 557 | CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); | ||
| 558 | idx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_CRL, nm, &cnt); | ||
| 559 | if (idx < 0) | ||
| 560 | { | ||
| 561 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 562 | sk_X509_CRL_free(sk); | ||
| 563 | return NULL; | ||
| 564 | } | ||
| 565 | |||
| 566 | for (i = 0; i < cnt; i++, idx++) | ||
| 567 | { | ||
| 568 | obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx); | ||
| 569 | x = obj->data.crl; | ||
| 570 | CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL); | ||
| 571 | if (!sk_X509_CRL_push(sk, x)) | ||
| 572 | { | ||
| 573 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 574 | X509_CRL_free(x); | ||
| 575 | sk_X509_CRL_pop_free(sk, X509_CRL_free); | ||
| 576 | return NULL; | ||
| 577 | } | ||
| 578 | } | ||
| 579 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | ||
| 580 | return sk; | ||
| 581 | } | ||
| 455 | 582 | ||
| 456 | X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x) | 583 | X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x) |
| 457 | { | 584 | { |
| 458 | int idx, i; | 585 | int idx, i; |
| 459 | X509_OBJECT *obj; | 586 | X509_OBJECT *obj; |
| 460 | idx = sk_X509_OBJECT_find(h, x); | 587 | idx = sk_X509_OBJECT_find(h, x); |
| 461 | if (idx == -1) return NULL; | 588 | if (idx == -1) return NULL; |
| 462 | if (x->type != X509_LU_X509) return sk_X509_OBJECT_value(h, idx); | 589 | if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL)) |
| 590 | return sk_X509_OBJECT_value(h, idx); | ||
| 463 | for (i = idx; i < sk_X509_OBJECT_num(h); i++) | 591 | for (i = idx; i < sk_X509_OBJECT_num(h); i++) |
| 464 | { | 592 | { |
| 465 | obj = sk_X509_OBJECT_value(h, i); | 593 | obj = sk_X509_OBJECT_value(h, i); |
| 466 | if (x509_object_cmp((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x)) | 594 | if (x509_object_cmp((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x)) |
| 467 | return NULL; | 595 | return NULL; |
| 468 | if ((x->type != X509_LU_X509) || !X509_cmp(obj->data.x509, x->data.x509)) | 596 | if (x->type == X509_LU_X509) |
| 597 | { | ||
| 598 | if (!X509_cmp(obj->data.x509, x->data.x509)) | ||
| 599 | return obj; | ||
| 600 | } | ||
| 601 | else if (x->type == X509_LU_CRL) | ||
| 602 | { | ||
| 603 | if (!X509_CRL_match(obj->data.crl, x->data.crl)) | ||
| 604 | return obj; | ||
| 605 | } | ||
| 606 | else | ||
| 469 | return obj; | 607 | return obj; |
| 470 | } | 608 | } |
| 471 | return NULL; | 609 | return NULL; |
| 472 | } | 610 | } |
| 473 | 611 | ||
| 474 | 612 | ||
| 475 | /* Try to get issuer certificate from store. Due to limitations | 613 | /* Try to get issuer certificate from store. Due to limitations |
| 476 | * of the API this can only retrieve a single certificate matching | 614 | * of the API this can only retrieve a single certificate matching |
| 477 | * a given subject name. However it will fill the cache with all | 615 | * a given subject name. However it will fill the cache with all |
| 478 | * matching certificates, so we can examine the cache for all | 616 | * matching certificates, so we can examine the cache for all |
| 479 | * matches. | 617 | * matches. |
| 480 | * | 618 | * |
| 481 | * Return values are: | 619 | * Return values are: |
| @@ -483,13 +621,11 @@ X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x | |||
| 483 | * 0 certificate not found. | 621 | * 0 certificate not found. |
| 484 | * -1 some other error. | 622 | * -1 some other error. |
| 485 | */ | 623 | */ |
| 486 | |||
| 487 | |||
| 488 | int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) | 624 | int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) |
| 489 | { | 625 | { |
| 490 | X509_NAME *xn; | 626 | X509_NAME *xn; |
| 491 | X509_OBJECT obj, *pobj; | 627 | X509_OBJECT obj, *pobj; |
| 492 | int i, ok, idx; | 628 | int i, ok, idx, ret; |
| 493 | xn=X509_get_issuer_name(x); | 629 | xn=X509_get_issuer_name(x); |
| 494 | ok=X509_STORE_get_by_subject(ctx,X509_LU_X509,xn,&obj); | 630 | ok=X509_STORE_get_by_subject(ctx,X509_LU_X509,xn,&obj); |
| 495 | if (ok != X509_LU_X509) | 631 | if (ok != X509_LU_X509) |
| @@ -515,27 +651,34 @@ int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) | |||
| 515 | return 1; | 651 | return 1; |
| 516 | } | 652 | } |
| 517 | X509_OBJECT_free_contents(&obj); | 653 | X509_OBJECT_free_contents(&obj); |
| 518 | /* Else find index of first matching cert */ | ||
| 519 | idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn); | ||
| 520 | /* This shouldn't normally happen since we already have one match */ | ||
| 521 | if (idx == -1) return 0; | ||
| 522 | 654 | ||
| 523 | /* Look through all matching certificates for a suitable issuer */ | 655 | /* Else find index of first cert accepted by 'check_issued' */ |
| 524 | for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) | 656 | ret = 0; |
| 657 | CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); | ||
| 658 | idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn); | ||
| 659 | if (idx != -1) /* should be true as we've had at least one match */ | ||
| 525 | { | 660 | { |
| 526 | pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); | 661 | /* Look through all matching certs for suitable issuer */ |
| 527 | /* See if we've ran out of matches */ | 662 | for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) |
| 528 | if (pobj->type != X509_LU_X509) return 0; | ||
| 529 | if (X509_NAME_cmp(xn, X509_get_subject_name(pobj->data.x509))) return 0; | ||
| 530 | if (ctx->check_issued(ctx, x, pobj->data.x509)) | ||
| 531 | { | 663 | { |
| 532 | *issuer = pobj->data.x509; | 664 | pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i); |
| 533 | X509_OBJECT_up_ref_count(pobj); | 665 | /* See if we've run past the matches */ |
| 534 | return 1; | 666 | if (pobj->type != X509_LU_X509) |
| 667 | break; | ||
| 668 | if (X509_NAME_cmp(xn, X509_get_subject_name(pobj->data.x509))) | ||
| 669 | break; | ||
| 670 | if (ctx->check_issued(ctx, x, pobj->data.x509)) | ||
| 671 | { | ||
| 672 | *issuer = pobj->data.x509; | ||
| 673 | X509_OBJECT_up_ref_count(pobj); | ||
| 674 | ret = 1; | ||
| 675 | break; | ||
| 676 | } | ||
| 535 | } | 677 | } |
| 536 | } | 678 | } |
| 537 | return 0; | 679 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); |
| 538 | } | 680 | return ret; |
| 681 | } | ||
| 539 | 682 | ||
| 540 | int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags) | 683 | int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags) |
| 541 | { | 684 | { |
| @@ -563,5 +706,11 @@ int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *param) | |||
| 563 | return X509_VERIFY_PARAM_set1(ctx->param, param); | 706 | return X509_VERIFY_PARAM_set1(ctx->param, param); |
| 564 | } | 707 | } |
| 565 | 708 | ||
| 709 | void X509_STORE_set_verify_cb(X509_STORE *ctx, | ||
| 710 | int (*verify_cb)(int, X509_STORE_CTX *)) | ||
| 711 | { | ||
| 712 | ctx->verify_cb = verify_cb; | ||
| 713 | } | ||
| 714 | |||
| 566 | IMPLEMENT_STACK_OF(X509_LOOKUP) | 715 | IMPLEMENT_STACK_OF(X509_LOOKUP) |
| 567 | IMPLEMENT_STACK_OF(X509_OBJECT) | 716 | IMPLEMENT_STACK_OF(X509_OBJECT) |
diff --git a/src/lib/libcrypto/x509/x509_obj.c b/src/lib/libcrypto/x509/x509_obj.c index 1e718f76eb..21fed9f838 100644 --- a/src/lib/libcrypto/x509/x509_obj.c +++ b/src/lib/libcrypto/x509/x509_obj.c | |||
| @@ -72,7 +72,7 @@ int i; | |||
| 72 | char *p; | 72 | char *p; |
| 73 | unsigned char *q; | 73 | unsigned char *q; |
| 74 | BUF_MEM *b=NULL; | 74 | BUF_MEM *b=NULL; |
| 75 | static char hex[17]="0123456789ABCDEF"; | 75 | static const char hex[17]="0123456789ABCDEF"; |
| 76 | int gs_doit[4]; | 76 | int gs_doit[4]; |
| 77 | char tmp_buf[80]; | 77 | char tmp_buf[80]; |
| 78 | #ifdef CHARSET_EBCDIC | 78 | #ifdef CHARSET_EBCDIC |
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c index 3872e1fb64..48183dc00c 100644 --- a/src/lib/libcrypto/x509/x509_req.c +++ b/src/lib/libcrypto/x509/x509_req.c | |||
| @@ -61,6 +61,7 @@ | |||
| 61 | #include <openssl/bn.h> | 61 | #include <openssl/bn.h> |
| 62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/asn1t.h> | ||
| 64 | #include <openssl/x509.h> | 65 | #include <openssl/x509.h> |
| 65 | #include <openssl/objects.h> | 66 | #include <openssl/objects.h> |
| 66 | #include <openssl/buffer.h> | 67 | #include <openssl/buffer.h> |
| @@ -205,10 +206,9 @@ STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req) | |||
| 205 | if(!ext || (ext->type != V_ASN1_SEQUENCE)) | 206 | if(!ext || (ext->type != V_ASN1_SEQUENCE)) |
| 206 | return NULL; | 207 | return NULL; |
| 207 | p = ext->value.sequence->data; | 208 | p = ext->value.sequence->data; |
| 208 | return d2i_ASN1_SET_OF_X509_EXTENSION(NULL, &p, | 209 | return (STACK_OF(X509_EXTENSION) *) |
| 209 | ext->value.sequence->length, | 210 | ASN1_item_d2i(NULL, &p, ext->value.sequence->length, |
| 210 | d2i_X509_EXTENSION, X509_EXTENSION_free, | 211 | ASN1_ITEM_rptr(X509_EXTENSIONS)); |
| 211 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL); | ||
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | /* Add a STACK_OF extensions to a certificate request: allow alternative OIDs | 214 | /* Add a STACK_OF extensions to a certificate request: allow alternative OIDs |
| @@ -218,8 +218,6 @@ STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req) | |||
| 218 | int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, | 218 | int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, |
| 219 | int nid) | 219 | int nid) |
| 220 | { | 220 | { |
| 221 | unsigned char *p = NULL, *q; | ||
| 222 | long len; | ||
| 223 | ASN1_TYPE *at = NULL; | 221 | ASN1_TYPE *at = NULL; |
| 224 | X509_ATTRIBUTE *attr = NULL; | 222 | X509_ATTRIBUTE *attr = NULL; |
| 225 | if(!(at = ASN1_TYPE_new()) || | 223 | if(!(at = ASN1_TYPE_new()) || |
| @@ -227,15 +225,10 @@ int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, | |||
| 227 | 225 | ||
| 228 | at->type = V_ASN1_SEQUENCE; | 226 | at->type = V_ASN1_SEQUENCE; |
| 229 | /* Generate encoding of extensions */ | 227 | /* Generate encoding of extensions */ |
| 230 | len = i2d_ASN1_SET_OF_X509_EXTENSION(exts, NULL, i2d_X509_EXTENSION, | 228 | at->value.sequence->length = |
| 231 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE); | 229 | ASN1_item_i2d((ASN1_VALUE *)exts, |
| 232 | if(!(p = OPENSSL_malloc(len))) goto err; | 230 | &at->value.sequence->data, |
| 233 | q = p; | 231 | ASN1_ITEM_rptr(X509_EXTENSIONS)); |
| 234 | i2d_ASN1_SET_OF_X509_EXTENSION(exts, &q, i2d_X509_EXTENSION, | ||
| 235 | V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE); | ||
| 236 | at->value.sequence->data = p; | ||
| 237 | p = NULL; | ||
| 238 | at->value.sequence->length = len; | ||
| 239 | if(!(attr = X509_ATTRIBUTE_new())) goto err; | 232 | if(!(attr = X509_ATTRIBUTE_new())) goto err; |
| 240 | if(!(attr->value.set = sk_ASN1_TYPE_new_null())) goto err; | 233 | if(!(attr->value.set = sk_ASN1_TYPE_new_null())) goto err; |
| 241 | if(!sk_ASN1_TYPE_push(attr->value.set, at)) goto err; | 234 | if(!sk_ASN1_TYPE_push(attr->value.set, at)) goto err; |
| @@ -250,7 +243,6 @@ int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, | |||
| 250 | if(!sk_X509_ATTRIBUTE_push(req->req_info->attributes, attr)) goto err; | 243 | if(!sk_X509_ATTRIBUTE_push(req->req_info->attributes, attr)) goto err; |
| 251 | return 1; | 244 | return 1; |
| 252 | err: | 245 | err: |
| 253 | if(p) OPENSSL_free(p); | ||
| 254 | X509_ATTRIBUTE_free(attr); | 246 | X509_ATTRIBUTE_free(attr); |
| 255 | ASN1_TYPE_free(at); | 247 | ASN1_TYPE_free(at); |
| 256 | return 0; | 248 | return 0; |
diff --git a/src/lib/libcrypto/x509/x509_set.c b/src/lib/libcrypto/x509/x509_set.c index aaf61ca062..4b94fc5847 100644 --- a/src/lib/libcrypto/x509/x509_set.c +++ b/src/lib/libcrypto/x509/x509_set.c | |||
| @@ -104,7 +104,7 @@ int X509_set_subject_name(X509 *x, X509_NAME *name) | |||
| 104 | return(X509_NAME_set(&x->cert_info->subject,name)); | 104 | return(X509_NAME_set(&x->cert_info->subject,name)); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | int X509_set_notBefore(X509 *x, ASN1_TIME *tm) | 107 | int X509_set_notBefore(X509 *x, const ASN1_TIME *tm) |
| 108 | { | 108 | { |
| 109 | ASN1_TIME *in; | 109 | ASN1_TIME *in; |
| 110 | 110 | ||
| @@ -122,7 +122,7 @@ int X509_set_notBefore(X509 *x, ASN1_TIME *tm) | |||
| 122 | return(in != NULL); | 122 | return(in != NULL); |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | int X509_set_notAfter(X509 *x, ASN1_TIME *tm) | 125 | int X509_set_notAfter(X509 *x, const ASN1_TIME *tm) |
| 126 | { | 126 | { |
| 127 | ASN1_TIME *in; | 127 | ASN1_TIME *in; |
| 128 | 128 | ||
diff --git a/src/lib/libcrypto/x509/x509_trs.c b/src/lib/libcrypto/x509/x509_trs.c index ed18700585..a6cb9c8b1b 100644 --- a/src/lib/libcrypto/x509/x509_trs.c +++ b/src/lib/libcrypto/x509/x509_trs.c | |||
| @@ -84,7 +84,8 @@ static X509_TRUST trstandard[] = { | |||
| 84 | {X509_TRUST_EMAIL, 0, trust_1oidany, "S/MIME email", NID_email_protect, NULL}, | 84 | {X509_TRUST_EMAIL, 0, trust_1oidany, "S/MIME email", NID_email_protect, NULL}, |
| 85 | {X509_TRUST_OBJECT_SIGN, 0, trust_1oidany, "Object Signer", NID_code_sign, NULL}, | 85 | {X509_TRUST_OBJECT_SIGN, 0, trust_1oidany, "Object Signer", NID_code_sign, NULL}, |
| 86 | {X509_TRUST_OCSP_SIGN, 0, trust_1oid, "OCSP responder", NID_OCSP_sign, NULL}, | 86 | {X509_TRUST_OCSP_SIGN, 0, trust_1oid, "OCSP responder", NID_OCSP_sign, NULL}, |
| 87 | {X509_TRUST_OCSP_REQUEST, 0, trust_1oid, "OCSP request", NID_ad_OCSP, NULL} | 87 | {X509_TRUST_OCSP_REQUEST, 0, trust_1oid, "OCSP request", NID_ad_OCSP, NULL}, |
| 88 | {X509_TRUST_TSA, 0, trust_1oidany, "TSA server", NID_time_stamp, NULL} | ||
| 88 | }; | 89 | }; |
| 89 | 90 | ||
| 90 | #define X509_TRUST_COUNT (sizeof(trstandard)/sizeof(X509_TRUST)) | 91 | #define X509_TRUST_COUNT (sizeof(trstandard)/sizeof(X509_TRUST)) |
diff --git a/src/lib/libcrypto/x509/x509_txt.c b/src/lib/libcrypto/x509/x509_txt.c index 73a8ec726f..c44f753c46 100644 --- a/src/lib/libcrypto/x509/x509_txt.c +++ b/src/lib/libcrypto/x509/x509_txt.c | |||
| @@ -162,8 +162,28 @@ const char *X509_verify_cert_error_string(long n) | |||
| 162 | return("invalid or inconsistent certificate policy extension"); | 162 | return("invalid or inconsistent certificate policy extension"); |
| 163 | case X509_V_ERR_NO_EXPLICIT_POLICY: | 163 | case X509_V_ERR_NO_EXPLICIT_POLICY: |
| 164 | return("no explicit policy"); | 164 | return("no explicit policy"); |
| 165 | case X509_V_ERR_UNNESTED_RESOURCE: | 165 | case X509_V_ERR_DIFFERENT_CRL_SCOPE: |
| 166 | return("RFC 3779 resource not subset of parent's resources"); | 166 | return("Different CRL scope"); |
| 167 | case X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: | ||
| 168 | return("Unsupported extension feature"); | ||
| 169 | case X509_V_ERR_UNNESTED_RESOURCE: | ||
| 170 | return("RFC 3779 resource not subset of parent's resources"); | ||
| 171 | |||
| 172 | case X509_V_ERR_PERMITTED_VIOLATION: | ||
| 173 | return("permitted subtree violation"); | ||
| 174 | case X509_V_ERR_EXCLUDED_VIOLATION: | ||
| 175 | return("excluded subtree violation"); | ||
| 176 | case X509_V_ERR_SUBTREE_MINMAX: | ||
| 177 | return("name constraints minimum and maximum not supported"); | ||
| 178 | case X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: | ||
| 179 | return("unsupported name constraint type"); | ||
| 180 | case X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: | ||
| 181 | return("unsupported or invalid name constraint syntax"); | ||
| 182 | case X509_V_ERR_UNSUPPORTED_NAME_SYNTAX: | ||
| 183 | return("unsupported or invalid name syntax"); | ||
| 184 | case X509_V_ERR_CRL_PATH_VALIDATION_ERROR: | ||
| 185 | return("CRL path validation error"); | ||
| 186 | |||
| 167 | default: | 187 | default: |
| 168 | BIO_snprintf(buf,sizeof buf,"error number %ld",n); | 188 | BIO_snprintf(buf,sizeof buf,"error number %ld",n); |
| 169 | return(buf); | 189 | return(buf); |
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index 336c40ddd7..87ebf62525 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
| @@ -70,14 +70,70 @@ | |||
| 70 | #include <openssl/x509v3.h> | 70 | #include <openssl/x509v3.h> |
| 71 | #include <openssl/objects.h> | 71 | #include <openssl/objects.h> |
| 72 | 72 | ||
| 73 | /* CRL score values */ | ||
| 74 | |||
| 75 | /* No unhandled critical extensions */ | ||
| 76 | |||
| 77 | #define CRL_SCORE_NOCRITICAL 0x100 | ||
| 78 | |||
| 79 | /* certificate is within CRL scope */ | ||
| 80 | |||
| 81 | #define CRL_SCORE_SCOPE 0x080 | ||
| 82 | |||
| 83 | /* CRL times valid */ | ||
| 84 | |||
| 85 | #define CRL_SCORE_TIME 0x040 | ||
| 86 | |||
| 87 | /* Issuer name matches certificate */ | ||
| 88 | |||
| 89 | #define CRL_SCORE_ISSUER_NAME 0x020 | ||
| 90 | |||
| 91 | /* If this score or above CRL is probably valid */ | ||
| 92 | |||
| 93 | #define CRL_SCORE_VALID (CRL_SCORE_NOCRITICAL|CRL_SCORE_TIME|CRL_SCORE_SCOPE) | ||
| 94 | |||
| 95 | /* CRL issuer is certificate issuer */ | ||
| 96 | |||
| 97 | #define CRL_SCORE_ISSUER_CERT 0x018 | ||
| 98 | |||
| 99 | /* CRL issuer is on certificate path */ | ||
| 100 | |||
| 101 | #define CRL_SCORE_SAME_PATH 0x008 | ||
| 102 | |||
| 103 | /* CRL issuer matches CRL AKID */ | ||
| 104 | |||
| 105 | #define CRL_SCORE_AKID 0x004 | ||
| 106 | |||
| 107 | /* Have a delta CRL with valid times */ | ||
| 108 | |||
| 109 | #define CRL_SCORE_TIME_DELTA 0x002 | ||
| 110 | |||
| 73 | static int null_callback(int ok,X509_STORE_CTX *e); | 111 | static int null_callback(int ok,X509_STORE_CTX *e); |
| 74 | static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); | 112 | static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); |
| 75 | static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x); | 113 | static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x); |
| 76 | static int check_chain_extensions(X509_STORE_CTX *ctx); | 114 | static int check_chain_extensions(X509_STORE_CTX *ctx); |
| 115 | static int check_name_constraints(X509_STORE_CTX *ctx); | ||
| 77 | static int check_trust(X509_STORE_CTX *ctx); | 116 | static int check_trust(X509_STORE_CTX *ctx); |
| 78 | static int check_revocation(X509_STORE_CTX *ctx); | 117 | static int check_revocation(X509_STORE_CTX *ctx); |
| 79 | static int check_cert(X509_STORE_CTX *ctx); | 118 | static int check_cert(X509_STORE_CTX *ctx); |
| 80 | static int check_policy(X509_STORE_CTX *ctx); | 119 | static int check_policy(X509_STORE_CTX *ctx); |
| 120 | |||
| 121 | static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer, | ||
| 122 | unsigned int *preasons, | ||
| 123 | X509_CRL *crl, X509 *x); | ||
| 124 | static int get_crl_delta(X509_STORE_CTX *ctx, | ||
| 125 | X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x); | ||
| 126 | static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl, int *pcrl_score, | ||
| 127 | X509_CRL *base, STACK_OF(X509_CRL) *crls); | ||
| 128 | static void crl_akid_check(X509_STORE_CTX *ctx, X509_CRL *crl, | ||
| 129 | X509 **pissuer, int *pcrl_score); | ||
| 130 | static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score, | ||
| 131 | unsigned int *preasons); | ||
| 132 | static int check_crl_path(X509_STORE_CTX *ctx, X509 *x); | ||
| 133 | static int check_crl_chain(X509_STORE_CTX *ctx, | ||
| 134 | STACK_OF(X509) *cert_path, | ||
| 135 | STACK_OF(X509) *crl_path); | ||
| 136 | |||
| 81 | static int internal_verify(X509_STORE_CTX *ctx); | 137 | static int internal_verify(X509_STORE_CTX *ctx); |
| 82 | const char X509_version[]="X.509" OPENSSL_VERSION_PTEXT; | 138 | const char X509_version[]="X.509" OPENSSL_VERSION_PTEXT; |
| 83 | 139 | ||
| @@ -289,6 +345,12 @@ int X509_verify_cert(X509_STORE_CTX *ctx) | |||
| 289 | 345 | ||
| 290 | if (!ok) goto end; | 346 | if (!ok) goto end; |
| 291 | 347 | ||
| 348 | /* Check name constraints */ | ||
| 349 | |||
| 350 | ok = check_name_constraints(ctx); | ||
| 351 | |||
| 352 | if (!ok) goto end; | ||
| 353 | |||
| 292 | /* The chain extensions are OK: check trust */ | 354 | /* The chain extensions are OK: check trust */ |
| 293 | 355 | ||
| 294 | if (param->trust > 0) ok = check_trust(ctx); | 356 | if (param->trust > 0) ok = check_trust(ctx); |
| @@ -398,8 +460,8 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) | |||
| 398 | X509 *x; | 460 | X509 *x; |
| 399 | int (*cb)(int xok,X509_STORE_CTX *xctx); | 461 | int (*cb)(int xok,X509_STORE_CTX *xctx); |
| 400 | int proxy_path_length = 0; | 462 | int proxy_path_length = 0; |
| 401 | int allow_proxy_certs = | 463 | int purpose; |
| 402 | !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); | 464 | int allow_proxy_certs; |
| 403 | cb=ctx->verify_cb; | 465 | cb=ctx->verify_cb; |
| 404 | 466 | ||
| 405 | /* must_be_ca can have 1 of 3 values: | 467 | /* must_be_ca can have 1 of 3 values: |
| @@ -412,10 +474,22 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) | |||
| 412 | */ | 474 | */ |
| 413 | must_be_ca = -1; | 475 | must_be_ca = -1; |
| 414 | 476 | ||
| 415 | /* A hack to keep people who don't want to modify their software | 477 | /* CRL path validation */ |
| 416 | happy */ | 478 | if (ctx->parent) |
| 417 | if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) | 479 | { |
| 418 | allow_proxy_certs = 1; | 480 | allow_proxy_certs = 0; |
| 481 | purpose = X509_PURPOSE_CRL_SIGN; | ||
| 482 | } | ||
| 483 | else | ||
| 484 | { | ||
| 485 | allow_proxy_certs = | ||
| 486 | !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); | ||
| 487 | /* A hack to keep people who don't want to modify their | ||
| 488 | software happy */ | ||
| 489 | if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) | ||
| 490 | allow_proxy_certs = 1; | ||
| 491 | purpose = ctx->param->purpose; | ||
| 492 | } | ||
| 419 | 493 | ||
| 420 | /* Check all untrusted certificates */ | 494 | /* Check all untrusted certificates */ |
| 421 | for (i = 0; i < ctx->last_untrusted; i++) | 495 | for (i = 0; i < ctx->last_untrusted; i++) |
| @@ -482,8 +556,7 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) | |||
| 482 | } | 556 | } |
| 483 | if (ctx->param->purpose > 0) | 557 | if (ctx->param->purpose > 0) |
| 484 | { | 558 | { |
| 485 | ret = X509_check_purpose(x, ctx->param->purpose, | 559 | ret = X509_check_purpose(x, purpose, must_be_ca > 0); |
| 486 | must_be_ca > 0); | ||
| 487 | if ((ret == 0) | 560 | if ((ret == 0) |
| 488 | || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) | 561 | || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) |
| 489 | && (ret != 1))) | 562 | && (ret != 1))) |
| @@ -536,6 +609,42 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) | |||
| 536 | #endif | 609 | #endif |
| 537 | } | 610 | } |
| 538 | 611 | ||
| 612 | static int check_name_constraints(X509_STORE_CTX *ctx) | ||
| 613 | { | ||
| 614 | X509 *x; | ||
| 615 | int i, j, rv; | ||
| 616 | /* Check name constraints for all certificates */ | ||
| 617 | for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) | ||
| 618 | { | ||
| 619 | x = sk_X509_value(ctx->chain, i); | ||
| 620 | /* Ignore self issued certs unless last in chain */ | ||
| 621 | if (i && (x->ex_flags & EXFLAG_SI)) | ||
| 622 | continue; | ||
| 623 | /* Check against constraints for all certificates higher in | ||
| 624 | * chain including trust anchor. Trust anchor not strictly | ||
| 625 | * speaking needed but if it includes constraints it is to be | ||
| 626 | * assumed it expects them to be obeyed. | ||
| 627 | */ | ||
| 628 | for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) | ||
| 629 | { | ||
| 630 | NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc; | ||
| 631 | if (nc) | ||
| 632 | { | ||
| 633 | rv = NAME_CONSTRAINTS_check(x, nc); | ||
| 634 | if (rv != X509_V_OK) | ||
| 635 | { | ||
| 636 | ctx->error = rv; | ||
| 637 | ctx->error_depth = i; | ||
| 638 | ctx->current_cert = x; | ||
| 639 | if (!ctx->verify_cb(0,ctx)) | ||
| 640 | return 0; | ||
| 641 | } | ||
| 642 | } | ||
| 643 | } | ||
| 644 | } | ||
| 645 | return 1; | ||
| 646 | } | ||
| 647 | |||
| 539 | static int check_trust(X509_STORE_CTX *ctx) | 648 | static int check_trust(X509_STORE_CTX *ctx) |
| 540 | { | 649 | { |
| 541 | #ifdef OPENSSL_NO_CHAIN_VERIFY | 650 | #ifdef OPENSSL_NO_CHAIN_VERIFY |
| @@ -570,7 +679,12 @@ static int check_revocation(X509_STORE_CTX *ctx) | |||
| 570 | if (ctx->param->flags & X509_V_FLAG_CRL_CHECK_ALL) | 679 | if (ctx->param->flags & X509_V_FLAG_CRL_CHECK_ALL) |
| 571 | last = sk_X509_num(ctx->chain) - 1; | 680 | last = sk_X509_num(ctx->chain) - 1; |
| 572 | else | 681 | else |
| 682 | { | ||
| 683 | /* If checking CRL paths this isn't the EE certificate */ | ||
| 684 | if (ctx->parent) | ||
| 685 | return 1; | ||
| 573 | last = 0; | 686 | last = 0; |
| 687 | } | ||
| 574 | for(i = 0; i <= last; i++) | 688 | for(i = 0; i <= last; i++) |
| 575 | { | 689 | { |
| 576 | ctx->error_depth = i; | 690 | ctx->error_depth = i; |
| @@ -582,30 +696,65 @@ static int check_revocation(X509_STORE_CTX *ctx) | |||
| 582 | 696 | ||
| 583 | static int check_cert(X509_STORE_CTX *ctx) | 697 | static int check_cert(X509_STORE_CTX *ctx) |
| 584 | { | 698 | { |
| 585 | X509_CRL *crl = NULL; | 699 | X509_CRL *crl = NULL, *dcrl = NULL; |
| 586 | X509 *x; | 700 | X509 *x; |
| 587 | int ok, cnum; | 701 | int ok, cnum; |
| 588 | cnum = ctx->error_depth; | 702 | cnum = ctx->error_depth; |
| 589 | x = sk_X509_value(ctx->chain, cnum); | 703 | x = sk_X509_value(ctx->chain, cnum); |
| 590 | ctx->current_cert = x; | 704 | ctx->current_cert = x; |
| 591 | /* Try to retrieve relevant CRL */ | 705 | ctx->current_issuer = NULL; |
| 592 | ok = ctx->get_crl(ctx, &crl, x); | 706 | ctx->current_reasons = 0; |
| 593 | /* If error looking up CRL, nothing we can do except | 707 | while (ctx->current_reasons != CRLDP_ALL_REASONS) |
| 594 | * notify callback | ||
| 595 | */ | ||
| 596 | if(!ok) | ||
| 597 | { | 708 | { |
| 598 | ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; | 709 | /* Try to retrieve relevant CRL */ |
| 599 | ok = ctx->verify_cb(0, ctx); | 710 | if (ctx->get_crl) |
| 600 | goto err; | 711 | ok = ctx->get_crl(ctx, &crl, x); |
| 712 | else | ||
| 713 | ok = get_crl_delta(ctx, &crl, &dcrl, x); | ||
| 714 | /* If error looking up CRL, nothing we can do except | ||
| 715 | * notify callback | ||
| 716 | */ | ||
| 717 | if(!ok) | ||
| 718 | { | ||
| 719 | ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; | ||
| 720 | ok = ctx->verify_cb(0, ctx); | ||
| 721 | goto err; | ||
| 722 | } | ||
| 723 | ctx->current_crl = crl; | ||
| 724 | ok = ctx->check_crl(ctx, crl); | ||
| 725 | if (!ok) | ||
| 726 | goto err; | ||
| 727 | |||
| 728 | if (dcrl) | ||
| 729 | { | ||
| 730 | ok = ctx->check_crl(ctx, dcrl); | ||
| 731 | if (!ok) | ||
| 732 | goto err; | ||
| 733 | ok = ctx->cert_crl(ctx, dcrl, x); | ||
| 734 | if (!ok) | ||
| 735 | goto err; | ||
| 736 | } | ||
| 737 | else | ||
| 738 | ok = 1; | ||
| 739 | |||
| 740 | /* Don't look in full CRL if delta reason is removefromCRL */ | ||
| 741 | if (ok != 2) | ||
| 742 | { | ||
| 743 | ok = ctx->cert_crl(ctx, crl, x); | ||
| 744 | if (!ok) | ||
| 745 | goto err; | ||
| 746 | } | ||
| 747 | |||
| 748 | X509_CRL_free(crl); | ||
| 749 | X509_CRL_free(dcrl); | ||
| 750 | crl = NULL; | ||
| 751 | dcrl = NULL; | ||
| 601 | } | 752 | } |
| 602 | ctx->current_crl = crl; | ||
| 603 | ok = ctx->check_crl(ctx, crl); | ||
| 604 | if (!ok) goto err; | ||
| 605 | ok = ctx->cert_crl(ctx, crl, x); | ||
| 606 | err: | 753 | err: |
| 607 | ctx->current_crl = NULL; | ||
| 608 | X509_CRL_free(crl); | 754 | X509_CRL_free(crl); |
| 755 | X509_CRL_free(dcrl); | ||
| 756 | |||
| 757 | ctx->current_crl = NULL; | ||
| 609 | return ok; | 758 | return ok; |
| 610 | 759 | ||
| 611 | } | 760 | } |
| @@ -616,7 +765,8 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify) | |||
| 616 | { | 765 | { |
| 617 | time_t *ptime; | 766 | time_t *ptime; |
| 618 | int i; | 767 | int i; |
| 619 | ctx->current_crl = crl; | 768 | if (notify) |
| 769 | ctx->current_crl = crl; | ||
| 620 | if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME) | 770 | if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME) |
| 621 | ptime = &ctx->param->check_time; | 771 | ptime = &ctx->param->check_time; |
| 622 | else | 772 | else |
| @@ -625,15 +775,19 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify) | |||
| 625 | i=X509_cmp_time(X509_CRL_get_lastUpdate(crl), ptime); | 775 | i=X509_cmp_time(X509_CRL_get_lastUpdate(crl), ptime); |
| 626 | if (i == 0) | 776 | if (i == 0) |
| 627 | { | 777 | { |
| 778 | if (!notify) | ||
| 779 | return 0; | ||
| 628 | ctx->error=X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD; | 780 | ctx->error=X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD; |
| 629 | if (!notify || !ctx->verify_cb(0, ctx)) | 781 | if (!ctx->verify_cb(0, ctx)) |
| 630 | return 0; | 782 | return 0; |
| 631 | } | 783 | } |
| 632 | 784 | ||
| 633 | if (i > 0) | 785 | if (i > 0) |
| 634 | { | 786 | { |
| 787 | if (!notify) | ||
| 788 | return 0; | ||
| 635 | ctx->error=X509_V_ERR_CRL_NOT_YET_VALID; | 789 | ctx->error=X509_V_ERR_CRL_NOT_YET_VALID; |
| 636 | if (!notify || !ctx->verify_cb(0, ctx)) | 790 | if (!ctx->verify_cb(0, ctx)) |
| 637 | return 0; | 791 | return 0; |
| 638 | } | 792 | } |
| 639 | 793 | ||
| @@ -643,92 +797,545 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify) | |||
| 643 | 797 | ||
| 644 | if (i == 0) | 798 | if (i == 0) |
| 645 | { | 799 | { |
| 800 | if (!notify) | ||
| 801 | return 0; | ||
| 646 | ctx->error=X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD; | 802 | ctx->error=X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD; |
| 647 | if (!notify || !ctx->verify_cb(0, ctx)) | 803 | if (!ctx->verify_cb(0, ctx)) |
| 648 | return 0; | 804 | return 0; |
| 649 | } | 805 | } |
| 650 | 806 | /* Ignore expiry of base CRL is delta is valid */ | |
| 651 | if (i < 0) | 807 | if ((i < 0) && !(ctx->current_crl_score & CRL_SCORE_TIME_DELTA)) |
| 652 | { | 808 | { |
| 809 | if (!notify) | ||
| 810 | return 0; | ||
| 653 | ctx->error=X509_V_ERR_CRL_HAS_EXPIRED; | 811 | ctx->error=X509_V_ERR_CRL_HAS_EXPIRED; |
| 654 | if (!notify || !ctx->verify_cb(0, ctx)) | 812 | if (!ctx->verify_cb(0, ctx)) |
| 655 | return 0; | 813 | return 0; |
| 656 | } | 814 | } |
| 657 | } | 815 | } |
| 658 | 816 | ||
| 659 | ctx->current_crl = NULL; | 817 | if (notify) |
| 818 | ctx->current_crl = NULL; | ||
| 660 | 819 | ||
| 661 | return 1; | 820 | return 1; |
| 662 | } | 821 | } |
| 663 | 822 | ||
| 664 | /* Lookup CRLs from the supplied list. Look for matching isser name | 823 | static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl, |
| 665 | * and validity. If we can't find a valid CRL return the last one | 824 | X509 **pissuer, int *pscore, unsigned int *preasons, |
| 666 | * with matching name. This gives more meaningful error codes. Otherwise | 825 | STACK_OF(X509_CRL) *crls) |
| 667 | * we'd get a CRL not found error if a CRL existed with matching name but | ||
| 668 | * was invalid. | ||
| 669 | */ | ||
| 670 | |||
| 671 | static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, | ||
| 672 | X509_NAME *nm, STACK_OF(X509_CRL) *crls) | ||
| 673 | { | 826 | { |
| 674 | int i; | 827 | int i, crl_score, best_score = *pscore; |
| 828 | unsigned int reasons, best_reasons = 0; | ||
| 829 | X509 *x = ctx->current_cert; | ||
| 675 | X509_CRL *crl, *best_crl = NULL; | 830 | X509_CRL *crl, *best_crl = NULL; |
| 831 | X509 *crl_issuer = NULL, *best_crl_issuer = NULL; | ||
| 832 | |||
| 676 | for (i = 0; i < sk_X509_CRL_num(crls); i++) | 833 | for (i = 0; i < sk_X509_CRL_num(crls); i++) |
| 677 | { | 834 | { |
| 678 | crl = sk_X509_CRL_value(crls, i); | 835 | crl = sk_X509_CRL_value(crls, i); |
| 679 | if (X509_NAME_cmp(nm, X509_CRL_get_issuer(crl))) | 836 | reasons = *preasons; |
| 680 | continue; | 837 | crl_score = get_crl_score(ctx, &crl_issuer, &reasons, crl, x); |
| 681 | if (check_crl_time(ctx, crl, 0)) | 838 | |
| 839 | if (crl_score > best_score) | ||
| 682 | { | 840 | { |
| 683 | *pcrl = crl; | 841 | best_crl = crl; |
| 684 | CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509); | 842 | best_crl_issuer = crl_issuer; |
| 685 | return 1; | 843 | best_score = crl_score; |
| 844 | best_reasons = reasons; | ||
| 686 | } | 845 | } |
| 687 | best_crl = crl; | ||
| 688 | } | 846 | } |
| 847 | |||
| 689 | if (best_crl) | 848 | if (best_crl) |
| 690 | { | 849 | { |
| 850 | if (*pcrl) | ||
| 851 | X509_CRL_free(*pcrl); | ||
| 691 | *pcrl = best_crl; | 852 | *pcrl = best_crl; |
| 692 | CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509); | 853 | *pissuer = best_crl_issuer; |
| 854 | *pscore = best_score; | ||
| 855 | *preasons = best_reasons; | ||
| 856 | CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509_CRL); | ||
| 857 | if (*pdcrl) | ||
| 858 | { | ||
| 859 | X509_CRL_free(*pdcrl); | ||
| 860 | *pdcrl = NULL; | ||
| 861 | } | ||
| 862 | get_delta_sk(ctx, pdcrl, pscore, best_crl, crls); | ||
| 693 | } | 863 | } |
| 694 | 864 | ||
| 865 | if (best_score >= CRL_SCORE_VALID) | ||
| 866 | return 1; | ||
| 867 | |||
| 695 | return 0; | 868 | return 0; |
| 696 | } | 869 | } |
| 697 | 870 | ||
| 698 | /* Retrieve CRL corresponding to certificate: currently just a | 871 | /* Compare two CRL extensions for delta checking purposes. They should be |
| 699 | * subject lookup: maybe use AKID later... | 872 | * both present or both absent. If both present all fields must be identical. |
| 700 | */ | 873 | */ |
| 701 | static int get_crl(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509 *x) | 874 | |
| 875 | static int crl_extension_match(X509_CRL *a, X509_CRL *b, int nid) | ||
| 702 | { | 876 | { |
| 703 | int ok; | 877 | ASN1_OCTET_STRING *exta, *extb; |
| 704 | X509_CRL *crl = NULL; | 878 | int i; |
| 705 | X509_OBJECT xobj; | 879 | i = X509_CRL_get_ext_by_NID(a, nid, 0); |
| 706 | X509_NAME *nm; | 880 | if (i >= 0) |
| 707 | nm = X509_get_issuer_name(x); | ||
| 708 | ok = get_crl_sk(ctx, &crl, nm, ctx->crls); | ||
| 709 | if (ok) | ||
| 710 | { | 881 | { |
| 711 | *pcrl = crl; | 882 | /* Can't have multiple occurrences */ |
| 883 | if (X509_CRL_get_ext_by_NID(a, nid, i) != -1) | ||
| 884 | return 0; | ||
| 885 | exta = X509_EXTENSION_get_data(X509_CRL_get_ext(a, i)); | ||
| 886 | } | ||
| 887 | else | ||
| 888 | exta = NULL; | ||
| 889 | |||
| 890 | i = X509_CRL_get_ext_by_NID(b, nid, 0); | ||
| 891 | |||
| 892 | if (i >= 0) | ||
| 893 | { | ||
| 894 | |||
| 895 | if (X509_CRL_get_ext_by_NID(b, nid, i) != -1) | ||
| 896 | return 0; | ||
| 897 | extb = X509_EXTENSION_get_data(X509_CRL_get_ext(b, i)); | ||
| 898 | } | ||
| 899 | else | ||
| 900 | extb = NULL; | ||
| 901 | |||
| 902 | if (!exta && !extb) | ||
| 712 | return 1; | 903 | return 1; |
| 904 | |||
| 905 | if (!exta || !extb) | ||
| 906 | return 0; | ||
| 907 | |||
| 908 | |||
| 909 | if (ASN1_OCTET_STRING_cmp(exta, extb)) | ||
| 910 | return 0; | ||
| 911 | |||
| 912 | return 1; | ||
| 913 | } | ||
| 914 | |||
| 915 | /* See if a base and delta are compatible */ | ||
| 916 | |||
| 917 | static int check_delta_base(X509_CRL *delta, X509_CRL *base) | ||
| 918 | { | ||
| 919 | /* Delta CRL must be a delta */ | ||
| 920 | if (!delta->base_crl_number) | ||
| 921 | return 0; | ||
| 922 | /* Base must have a CRL number */ | ||
| 923 | if (!base->crl_number) | ||
| 924 | return 0; | ||
| 925 | /* Issuer names must match */ | ||
| 926 | if (X509_NAME_cmp(X509_CRL_get_issuer(base), | ||
| 927 | X509_CRL_get_issuer(delta))) | ||
| 928 | return 0; | ||
| 929 | /* AKID and IDP must match */ | ||
| 930 | if (!crl_extension_match(delta, base, NID_authority_key_identifier)) | ||
| 931 | return 0; | ||
| 932 | if (!crl_extension_match(delta, base, NID_issuing_distribution_point)) | ||
| 933 | return 0; | ||
| 934 | /* Delta CRL base number must not exceed Full CRL number. */ | ||
| 935 | if (ASN1_INTEGER_cmp(delta->base_crl_number, base->crl_number) > 0) | ||
| 936 | return 0; | ||
| 937 | /* Delta CRL number must exceed full CRL number */ | ||
| 938 | if (ASN1_INTEGER_cmp(delta->crl_number, base->crl_number) > 0) | ||
| 939 | return 1; | ||
| 940 | return 0; | ||
| 941 | } | ||
| 942 | |||
| 943 | /* For a given base CRL find a delta... maybe extend to delta scoring | ||
| 944 | * or retrieve a chain of deltas... | ||
| 945 | */ | ||
| 946 | |||
| 947 | static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl, int *pscore, | ||
| 948 | X509_CRL *base, STACK_OF(X509_CRL) *crls) | ||
| 949 | { | ||
| 950 | X509_CRL *delta; | ||
| 951 | int i; | ||
| 952 | if (!(ctx->param->flags & X509_V_FLAG_USE_DELTAS)) | ||
| 953 | return; | ||
| 954 | if (!((ctx->current_cert->ex_flags | base->flags) & EXFLAG_FRESHEST)) | ||
| 955 | return; | ||
| 956 | for (i = 0; i < sk_X509_CRL_num(crls); i++) | ||
| 957 | { | ||
| 958 | delta = sk_X509_CRL_value(crls, i); | ||
| 959 | if (check_delta_base(delta, base)) | ||
| 960 | { | ||
| 961 | if (check_crl_time(ctx, delta, 0)) | ||
| 962 | *pscore |= CRL_SCORE_TIME_DELTA; | ||
| 963 | CRYPTO_add(&delta->references, 1, CRYPTO_LOCK_X509_CRL); | ||
| 964 | *dcrl = delta; | ||
| 965 | return; | ||
| 966 | } | ||
| 967 | } | ||
| 968 | *dcrl = NULL; | ||
| 969 | } | ||
| 970 | |||
| 971 | /* For a given CRL return how suitable it is for the supplied certificate 'x'. | ||
| 972 | * The return value is a mask of several criteria. | ||
| 973 | * If the issuer is not the certificate issuer this is returned in *pissuer. | ||
| 974 | * The reasons mask is also used to determine if the CRL is suitable: if | ||
| 975 | * no new reasons the CRL is rejected, otherwise reasons is updated. | ||
| 976 | */ | ||
| 977 | |||
| 978 | static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer, | ||
| 979 | unsigned int *preasons, | ||
| 980 | X509_CRL *crl, X509 *x) | ||
| 981 | { | ||
| 982 | |||
| 983 | int crl_score = 0; | ||
| 984 | unsigned int tmp_reasons = *preasons, crl_reasons; | ||
| 985 | |||
| 986 | /* First see if we can reject CRL straight away */ | ||
| 987 | |||
| 988 | /* Invalid IDP cannot be processed */ | ||
| 989 | if (crl->idp_flags & IDP_INVALID) | ||
| 990 | return 0; | ||
| 991 | /* Reason codes or indirect CRLs need extended CRL support */ | ||
| 992 | if (!(ctx->param->flags & X509_V_FLAG_EXTENDED_CRL_SUPPORT)) | ||
| 993 | { | ||
| 994 | if (crl->idp_flags & (IDP_INDIRECT | IDP_REASONS)) | ||
| 995 | return 0; | ||
| 996 | } | ||
| 997 | else if (crl->idp_flags & IDP_REASONS) | ||
| 998 | { | ||
| 999 | /* If no new reasons reject */ | ||
| 1000 | if (!(crl->idp_reasons & ~tmp_reasons)) | ||
| 1001 | return 0; | ||
| 1002 | } | ||
| 1003 | /* Don't process deltas at this stage */ | ||
| 1004 | else if (crl->base_crl_number) | ||
| 1005 | return 0; | ||
| 1006 | /* If issuer name doesn't match certificate need indirect CRL */ | ||
| 1007 | if (X509_NAME_cmp(X509_get_issuer_name(x), X509_CRL_get_issuer(crl))) | ||
| 1008 | { | ||
| 1009 | if (!(crl->idp_flags & IDP_INDIRECT)) | ||
| 1010 | return 0; | ||
| 1011 | } | ||
| 1012 | else | ||
| 1013 | crl_score |= CRL_SCORE_ISSUER_NAME; | ||
| 1014 | |||
| 1015 | if (!(crl->flags & EXFLAG_CRITICAL)) | ||
| 1016 | crl_score |= CRL_SCORE_NOCRITICAL; | ||
| 1017 | |||
| 1018 | /* Check expiry */ | ||
| 1019 | if (check_crl_time(ctx, crl, 0)) | ||
| 1020 | crl_score |= CRL_SCORE_TIME; | ||
| 1021 | |||
| 1022 | /* Check authority key ID and locate certificate issuer */ | ||
| 1023 | crl_akid_check(ctx, crl, pissuer, &crl_score); | ||
| 1024 | |||
| 1025 | /* If we can't locate certificate issuer at this point forget it */ | ||
| 1026 | |||
| 1027 | if (!(crl_score & CRL_SCORE_AKID)) | ||
| 1028 | return 0; | ||
| 1029 | |||
| 1030 | /* Check cert for matching CRL distribution points */ | ||
| 1031 | |||
| 1032 | if (crl_crldp_check(x, crl, crl_score, &crl_reasons)) | ||
| 1033 | { | ||
| 1034 | /* If no new reasons reject */ | ||
| 1035 | if (!(crl_reasons & ~tmp_reasons)) | ||
| 1036 | return 0; | ||
| 1037 | tmp_reasons |= crl_reasons; | ||
| 1038 | crl_score |= CRL_SCORE_SCOPE; | ||
| 713 | } | 1039 | } |
| 714 | 1040 | ||
| 715 | ok = X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj); | 1041 | *preasons = tmp_reasons; |
| 1042 | |||
| 1043 | return crl_score; | ||
| 1044 | |||
| 1045 | } | ||
| 1046 | |||
| 1047 | static void crl_akid_check(X509_STORE_CTX *ctx, X509_CRL *crl, | ||
| 1048 | X509 **pissuer, int *pcrl_score) | ||
| 1049 | { | ||
| 1050 | X509 *crl_issuer = NULL; | ||
| 1051 | X509_NAME *cnm = X509_CRL_get_issuer(crl); | ||
| 1052 | int cidx = ctx->error_depth; | ||
| 1053 | int i; | ||
| 716 | 1054 | ||
| 717 | if (!ok) | 1055 | if (cidx != sk_X509_num(ctx->chain) - 1) |
| 1056 | cidx++; | ||
| 1057 | |||
| 1058 | crl_issuer = sk_X509_value(ctx->chain, cidx); | ||
| 1059 | |||
| 1060 | if (X509_check_akid(crl_issuer, crl->akid) == X509_V_OK) | ||
| 718 | { | 1061 | { |
| 719 | /* If we got a near match from get_crl_sk use that */ | 1062 | if (*pcrl_score & CRL_SCORE_ISSUER_NAME) |
| 720 | if (crl) | ||
| 721 | { | 1063 | { |
| 722 | *pcrl = crl; | 1064 | *pcrl_score |= CRL_SCORE_AKID|CRL_SCORE_ISSUER_CERT; |
| 723 | return 1; | 1065 | *pissuer = crl_issuer; |
| 1066 | return; | ||
| 1067 | } | ||
| 1068 | } | ||
| 1069 | |||
| 1070 | for (cidx++; cidx < sk_X509_num(ctx->chain); cidx++) | ||
| 1071 | { | ||
| 1072 | crl_issuer = sk_X509_value(ctx->chain, cidx); | ||
| 1073 | if (X509_NAME_cmp(X509_get_subject_name(crl_issuer), cnm)) | ||
| 1074 | continue; | ||
| 1075 | if (X509_check_akid(crl_issuer, crl->akid) == X509_V_OK) | ||
| 1076 | { | ||
| 1077 | *pcrl_score |= CRL_SCORE_AKID|CRL_SCORE_SAME_PATH; | ||
| 1078 | *pissuer = crl_issuer; | ||
| 1079 | return; | ||
| 1080 | } | ||
| 1081 | } | ||
| 1082 | |||
| 1083 | /* Anything else needs extended CRL support */ | ||
| 1084 | |||
| 1085 | if (!(ctx->param->flags & X509_V_FLAG_EXTENDED_CRL_SUPPORT)) | ||
| 1086 | return; | ||
| 1087 | |||
| 1088 | /* Otherwise the CRL issuer is not on the path. Look for it in the | ||
| 1089 | * set of untrusted certificates. | ||
| 1090 | */ | ||
| 1091 | for (i = 0; i < sk_X509_num(ctx->untrusted); i++) | ||
| 1092 | { | ||
| 1093 | crl_issuer = sk_X509_value(ctx->untrusted, i); | ||
| 1094 | if (X509_NAME_cmp(X509_get_subject_name(crl_issuer), cnm)) | ||
| 1095 | continue; | ||
| 1096 | if (X509_check_akid(crl_issuer, crl->akid) == X509_V_OK) | ||
| 1097 | { | ||
| 1098 | *pissuer = crl_issuer; | ||
| 1099 | *pcrl_score |= CRL_SCORE_AKID; | ||
| 1100 | return; | ||
| 724 | } | 1101 | } |
| 1102 | } | ||
| 1103 | } | ||
| 1104 | |||
| 1105 | /* Check the path of a CRL issuer certificate. This creates a new | ||
| 1106 | * X509_STORE_CTX and populates it with most of the parameters from the | ||
| 1107 | * parent. This could be optimised somewhat since a lot of path checking | ||
| 1108 | * will be duplicated by the parent, but this will rarely be used in | ||
| 1109 | * practice. | ||
| 1110 | */ | ||
| 1111 | |||
| 1112 | static int check_crl_path(X509_STORE_CTX *ctx, X509 *x) | ||
| 1113 | { | ||
| 1114 | X509_STORE_CTX crl_ctx; | ||
| 1115 | int ret; | ||
| 1116 | /* Don't allow recursive CRL path validation */ | ||
| 1117 | if (ctx->parent) | ||
| 725 | return 0; | 1118 | return 0; |
| 1119 | if (!X509_STORE_CTX_init(&crl_ctx, ctx->ctx, x, ctx->untrusted)) | ||
| 1120 | return -1; | ||
| 1121 | |||
| 1122 | crl_ctx.crls = ctx->crls; | ||
| 1123 | /* Copy verify params across */ | ||
| 1124 | X509_STORE_CTX_set0_param(&crl_ctx, ctx->param); | ||
| 1125 | |||
| 1126 | crl_ctx.parent = ctx; | ||
| 1127 | crl_ctx.verify_cb = ctx->verify_cb; | ||
| 1128 | |||
| 1129 | /* Verify CRL issuer */ | ||
| 1130 | ret = X509_verify_cert(&crl_ctx); | ||
| 1131 | |||
| 1132 | if (ret <= 0) | ||
| 1133 | goto err; | ||
| 1134 | |||
| 1135 | /* Check chain is acceptable */ | ||
| 1136 | |||
| 1137 | ret = check_crl_chain(ctx, ctx->chain, crl_ctx.chain); | ||
| 1138 | err: | ||
| 1139 | X509_STORE_CTX_cleanup(&crl_ctx); | ||
| 1140 | return ret; | ||
| 1141 | } | ||
| 1142 | |||
| 1143 | /* RFC3280 says nothing about the relationship between CRL path | ||
| 1144 | * and certificate path, which could lead to situations where a | ||
| 1145 | * certificate could be revoked or validated by a CA not authorised | ||
| 1146 | * to do so. RFC5280 is more strict and states that the two paths must | ||
| 1147 | * end in the same trust anchor, though some discussions remain... | ||
| 1148 | * until this is resolved we use the RFC5280 version | ||
| 1149 | */ | ||
| 1150 | |||
| 1151 | static int check_crl_chain(X509_STORE_CTX *ctx, | ||
| 1152 | STACK_OF(X509) *cert_path, | ||
| 1153 | STACK_OF(X509) *crl_path) | ||
| 1154 | { | ||
| 1155 | X509 *cert_ta, *crl_ta; | ||
| 1156 | cert_ta = sk_X509_value(cert_path, sk_X509_num(cert_path) - 1); | ||
| 1157 | crl_ta = sk_X509_value(crl_path, sk_X509_num(crl_path) - 1); | ||
| 1158 | if (!X509_cmp(cert_ta, crl_ta)) | ||
| 1159 | return 1; | ||
| 1160 | return 0; | ||
| 1161 | } | ||
| 1162 | |||
| 1163 | /* Check for match between two dist point names: three separate cases. | ||
| 1164 | * 1. Both are relative names and compare X509_NAME types. | ||
| 1165 | * 2. One full, one relative. Compare X509_NAME to GENERAL_NAMES. | ||
| 1166 | * 3. Both are full names and compare two GENERAL_NAMES. | ||
| 1167 | * 4. One is NULL: automatic match. | ||
| 1168 | */ | ||
| 1169 | |||
| 1170 | |||
| 1171 | static int idp_check_dp(DIST_POINT_NAME *a, DIST_POINT_NAME *b) | ||
| 1172 | { | ||
| 1173 | X509_NAME *nm = NULL; | ||
| 1174 | GENERAL_NAMES *gens = NULL; | ||
| 1175 | GENERAL_NAME *gena, *genb; | ||
| 1176 | int i, j; | ||
| 1177 | if (!a || !b) | ||
| 1178 | return 1; | ||
| 1179 | if (a->type == 1) | ||
| 1180 | { | ||
| 1181 | if (!a->dpname) | ||
| 1182 | return 0; | ||
| 1183 | /* Case 1: two X509_NAME */ | ||
| 1184 | if (b->type == 1) | ||
| 1185 | { | ||
| 1186 | if (!b->dpname) | ||
| 1187 | return 0; | ||
| 1188 | if (!X509_NAME_cmp(a->dpname, b->dpname)) | ||
| 1189 | return 1; | ||
| 1190 | else | ||
| 1191 | return 0; | ||
| 1192 | } | ||
| 1193 | /* Case 2: set name and GENERAL_NAMES appropriately */ | ||
| 1194 | nm = a->dpname; | ||
| 1195 | gens = b->name.fullname; | ||
| 1196 | } | ||
| 1197 | else if (b->type == 1) | ||
| 1198 | { | ||
| 1199 | if (!b->dpname) | ||
| 1200 | return 0; | ||
| 1201 | /* Case 2: set name and GENERAL_NAMES appropriately */ | ||
| 1202 | gens = a->name.fullname; | ||
| 1203 | nm = b->dpname; | ||
| 726 | } | 1204 | } |
| 727 | 1205 | ||
| 728 | *pcrl = xobj.data.crl; | 1206 | /* Handle case 2 with one GENERAL_NAMES and one X509_NAME */ |
| 1207 | if (nm) | ||
| 1208 | { | ||
| 1209 | for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) | ||
| 1210 | { | ||
| 1211 | gena = sk_GENERAL_NAME_value(gens, i); | ||
| 1212 | if (gena->type != GEN_DIRNAME) | ||
| 1213 | continue; | ||
| 1214 | if (!X509_NAME_cmp(nm, gena->d.directoryName)) | ||
| 1215 | return 1; | ||
| 1216 | } | ||
| 1217 | return 0; | ||
| 1218 | } | ||
| 1219 | |||
| 1220 | /* Else case 3: two GENERAL_NAMES */ | ||
| 1221 | |||
| 1222 | for (i = 0; i < sk_GENERAL_NAME_num(a->name.fullname); i++) | ||
| 1223 | { | ||
| 1224 | gena = sk_GENERAL_NAME_value(a->name.fullname, i); | ||
| 1225 | for (j = 0; j < sk_GENERAL_NAME_num(b->name.fullname); j++) | ||
| 1226 | { | ||
| 1227 | genb = sk_GENERAL_NAME_value(b->name.fullname, j); | ||
| 1228 | if (!GENERAL_NAME_cmp(gena, genb)) | ||
| 1229 | return 1; | ||
| 1230 | } | ||
| 1231 | } | ||
| 1232 | |||
| 1233 | return 0; | ||
| 1234 | |||
| 1235 | } | ||
| 1236 | |||
| 1237 | static int crldp_check_crlissuer(DIST_POINT *dp, X509_CRL *crl, int crl_score) | ||
| 1238 | { | ||
| 1239 | int i; | ||
| 1240 | X509_NAME *nm = X509_CRL_get_issuer(crl); | ||
| 1241 | /* If no CRLissuer return is successful iff don't need a match */ | ||
| 1242 | if (!dp->CRLissuer) | ||
| 1243 | return !!(crl_score & CRL_SCORE_ISSUER_NAME); | ||
| 1244 | for (i = 0; i < sk_GENERAL_NAME_num(dp->CRLissuer); i++) | ||
| 1245 | { | ||
| 1246 | GENERAL_NAME *gen = sk_GENERAL_NAME_value(dp->CRLissuer, i); | ||
| 1247 | if (gen->type != GEN_DIRNAME) | ||
| 1248 | continue; | ||
| 1249 | if (!X509_NAME_cmp(gen->d.directoryName, nm)) | ||
| 1250 | return 1; | ||
| 1251 | } | ||
| 1252 | return 0; | ||
| 1253 | } | ||
| 1254 | |||
| 1255 | /* Check CRLDP and IDP */ | ||
| 1256 | |||
| 1257 | static int crl_crldp_check(X509 *x, X509_CRL *crl, int crl_score, | ||
| 1258 | unsigned int *preasons) | ||
| 1259 | { | ||
| 1260 | int i; | ||
| 1261 | if (crl->idp_flags & IDP_ONLYATTR) | ||
| 1262 | return 0; | ||
| 1263 | if (x->ex_flags & EXFLAG_CA) | ||
| 1264 | { | ||
| 1265 | if (crl->idp_flags & IDP_ONLYUSER) | ||
| 1266 | return 0; | ||
| 1267 | } | ||
| 1268 | else | ||
| 1269 | { | ||
| 1270 | if (crl->idp_flags & IDP_ONLYCA) | ||
| 1271 | return 0; | ||
| 1272 | } | ||
| 1273 | *preasons = crl->idp_reasons; | ||
| 1274 | for (i = 0; i < sk_DIST_POINT_num(x->crldp); i++) | ||
| 1275 | { | ||
| 1276 | DIST_POINT *dp = sk_DIST_POINT_value(x->crldp, i); | ||
| 1277 | if (crldp_check_crlissuer(dp, crl, crl_score)) | ||
| 1278 | { | ||
| 1279 | if (!crl->idp || | ||
| 1280 | idp_check_dp(dp->distpoint, crl->idp->distpoint)) | ||
| 1281 | { | ||
| 1282 | *preasons &= dp->dp_reasons; | ||
| 1283 | return 1; | ||
| 1284 | } | ||
| 1285 | } | ||
| 1286 | } | ||
| 1287 | if ((!crl->idp || !crl->idp->distpoint) && (crl_score & CRL_SCORE_ISSUER_NAME)) | ||
| 1288 | return 1; | ||
| 1289 | return 0; | ||
| 1290 | } | ||
| 1291 | |||
| 1292 | /* Retrieve CRL corresponding to current certificate. | ||
| 1293 | * If deltas enabled try to find a delta CRL too | ||
| 1294 | */ | ||
| 1295 | |||
| 1296 | static int get_crl_delta(X509_STORE_CTX *ctx, | ||
| 1297 | X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x) | ||
| 1298 | { | ||
| 1299 | int ok; | ||
| 1300 | X509 *issuer = NULL; | ||
| 1301 | int crl_score = 0; | ||
| 1302 | unsigned int reasons; | ||
| 1303 | X509_CRL *crl = NULL, *dcrl = NULL; | ||
| 1304 | STACK_OF(X509_CRL) *skcrl; | ||
| 1305 | X509_NAME *nm = X509_get_issuer_name(x); | ||
| 1306 | reasons = ctx->current_reasons; | ||
| 1307 | ok = get_crl_sk(ctx, &crl, &dcrl, | ||
| 1308 | &issuer, &crl_score, &reasons, ctx->crls); | ||
| 1309 | |||
| 1310 | if (ok) | ||
| 1311 | goto done; | ||
| 1312 | |||
| 1313 | /* Lookup CRLs from store */ | ||
| 1314 | |||
| 1315 | skcrl = ctx->lookup_crls(ctx, nm); | ||
| 1316 | |||
| 1317 | /* If no CRLs found and a near match from get_crl_sk use that */ | ||
| 1318 | if (!skcrl && crl) | ||
| 1319 | goto done; | ||
| 1320 | |||
| 1321 | get_crl_sk(ctx, &crl, &dcrl, &issuer, &crl_score, &reasons, skcrl); | ||
| 1322 | |||
| 1323 | sk_X509_CRL_pop_free(skcrl, X509_CRL_free); | ||
| 1324 | |||
| 1325 | done: | ||
| 1326 | |||
| 1327 | /* If we got any kind of CRL use it and return success */ | ||
| 729 | if (crl) | 1328 | if (crl) |
| 730 | X509_CRL_free(crl); | 1329 | { |
| 731 | return 1; | 1330 | ctx->current_issuer = issuer; |
| 1331 | ctx->current_crl_score = crl_score; | ||
| 1332 | ctx->current_reasons = reasons; | ||
| 1333 | *pcrl = crl; | ||
| 1334 | *pdcrl = dcrl; | ||
| 1335 | return 1; | ||
| 1336 | } | ||
| 1337 | |||
| 1338 | return 0; | ||
| 732 | } | 1339 | } |
| 733 | 1340 | ||
| 734 | /* Check CRL validity */ | 1341 | /* Check CRL validity */ |
| @@ -739,10 +1346,14 @@ static int check_crl(X509_STORE_CTX *ctx, X509_CRL *crl) | |||
| 739 | int ok = 0, chnum, cnum; | 1346 | int ok = 0, chnum, cnum; |
| 740 | cnum = ctx->error_depth; | 1347 | cnum = ctx->error_depth; |
| 741 | chnum = sk_X509_num(ctx->chain) - 1; | 1348 | chnum = sk_X509_num(ctx->chain) - 1; |
| 742 | /* Find CRL issuer: if not last certificate then issuer | 1349 | /* if we have an alternative CRL issuer cert use that */ |
| 1350 | if (ctx->current_issuer) | ||
| 1351 | issuer = ctx->current_issuer; | ||
| 1352 | |||
| 1353 | /* Else find CRL issuer: if not last certificate then issuer | ||
| 743 | * is next certificate in chain. | 1354 | * is next certificate in chain. |
| 744 | */ | 1355 | */ |
| 745 | if(cnum < chnum) | 1356 | else if (cnum < chnum) |
| 746 | issuer = sk_X509_value(ctx->chain, cnum + 1); | 1357 | issuer = sk_X509_value(ctx->chain, cnum + 1); |
| 747 | else | 1358 | else |
| 748 | { | 1359 | { |
| @@ -758,13 +1369,52 @@ static int check_crl(X509_STORE_CTX *ctx, X509_CRL *crl) | |||
| 758 | 1369 | ||
| 759 | if(issuer) | 1370 | if(issuer) |
| 760 | { | 1371 | { |
| 761 | /* Check for cRLSign bit if keyUsage present */ | 1372 | /* Skip most tests for deltas because they have already |
| 762 | if ((issuer->ex_flags & EXFLAG_KUSAGE) && | 1373 | * been done |
| 763 | !(issuer->ex_kusage & KU_CRL_SIGN)) | 1374 | */ |
| 1375 | if (!crl->base_crl_number) | ||
| 764 | { | 1376 | { |
| 765 | ctx->error = X509_V_ERR_KEYUSAGE_NO_CRL_SIGN; | 1377 | /* Check for cRLSign bit if keyUsage present */ |
| 766 | ok = ctx->verify_cb(0, ctx); | 1378 | if ((issuer->ex_flags & EXFLAG_KUSAGE) && |
| 767 | if(!ok) goto err; | 1379 | !(issuer->ex_kusage & KU_CRL_SIGN)) |
| 1380 | { | ||
| 1381 | ctx->error = X509_V_ERR_KEYUSAGE_NO_CRL_SIGN; | ||
| 1382 | ok = ctx->verify_cb(0, ctx); | ||
| 1383 | if(!ok) goto err; | ||
| 1384 | } | ||
| 1385 | |||
| 1386 | if (!(ctx->current_crl_score & CRL_SCORE_SCOPE)) | ||
| 1387 | { | ||
| 1388 | ctx->error = X509_V_ERR_DIFFERENT_CRL_SCOPE; | ||
| 1389 | ok = ctx->verify_cb(0, ctx); | ||
| 1390 | if(!ok) goto err; | ||
| 1391 | } | ||
| 1392 | |||
| 1393 | if (!(ctx->current_crl_score & CRL_SCORE_SAME_PATH)) | ||
| 1394 | { | ||
| 1395 | if (check_crl_path(ctx, ctx->current_issuer) <= 0) | ||
| 1396 | { | ||
| 1397 | ctx->error = X509_V_ERR_CRL_PATH_VALIDATION_ERROR; | ||
| 1398 | ok = ctx->verify_cb(0, ctx); | ||
| 1399 | if(!ok) goto err; | ||
| 1400 | } | ||
| 1401 | } | ||
| 1402 | |||
| 1403 | if (crl->idp_flags & IDP_INVALID) | ||
| 1404 | { | ||
| 1405 | ctx->error = X509_V_ERR_INVALID_EXTENSION; | ||
| 1406 | ok = ctx->verify_cb(0, ctx); | ||
| 1407 | if(!ok) goto err; | ||
| 1408 | } | ||
| 1409 | |||
| 1410 | |||
| 1411 | } | ||
| 1412 | |||
| 1413 | if (!(ctx->current_crl_score & CRL_SCORE_TIME)) | ||
| 1414 | { | ||
| 1415 | ok = check_crl_time(ctx, crl, 1); | ||
| 1416 | if (!ok) | ||
| 1417 | goto err; | ||
| 768 | } | 1418 | } |
| 769 | 1419 | ||
| 770 | /* Attempt to get issuer certificate public key */ | 1420 | /* Attempt to get issuer certificate public key */ |
| @@ -788,10 +1438,6 @@ static int check_crl(X509_STORE_CTX *ctx, X509_CRL *crl) | |||
| 788 | } | 1438 | } |
| 789 | } | 1439 | } |
| 790 | 1440 | ||
| 791 | ok = check_crl_time(ctx, crl, 1); | ||
| 792 | if (!ok) | ||
| 793 | goto err; | ||
| 794 | |||
| 795 | ok = 1; | 1441 | ok = 1; |
| 796 | 1442 | ||
| 797 | err: | 1443 | err: |
| @@ -802,62 +1448,43 @@ static int check_crl(X509_STORE_CTX *ctx, X509_CRL *crl) | |||
| 802 | /* Check certificate against CRL */ | 1448 | /* Check certificate against CRL */ |
| 803 | static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x) | 1449 | static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x) |
| 804 | { | 1450 | { |
| 805 | int idx, ok; | 1451 | int ok; |
| 806 | X509_REVOKED rtmp; | 1452 | X509_REVOKED *rev; |
| 807 | STACK_OF(X509_EXTENSION) *exts; | 1453 | /* The rules changed for this... previously if a CRL contained |
| 808 | X509_EXTENSION *ext; | 1454 | * unhandled critical extensions it could still be used to indicate |
| 809 | /* Look for serial number of certificate in CRL */ | 1455 | * a certificate was revoked. This has since been changed since |
| 810 | rtmp.serialNumber = X509_get_serialNumber(x); | 1456 | * critical extension can change the meaning of CRL entries. |
| 811 | /* Sort revoked into serial number order if not already sorted. | 1457 | */ |
| 812 | * Do this under a lock to avoid race condition. | 1458 | if (crl->flags & EXFLAG_CRITICAL) |
| 813 | */ | ||
| 814 | if (!sk_X509_REVOKED_is_sorted(crl->crl->revoked)) | ||
| 815 | { | 1459 | { |
| 816 | CRYPTO_w_lock(CRYPTO_LOCK_X509_CRL); | 1460 | if (ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) |
| 817 | sk_X509_REVOKED_sort(crl->crl->revoked); | 1461 | return 1; |
| 818 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_CRL); | 1462 | ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION; |
| 1463 | ok = ctx->verify_cb(0, ctx); | ||
| 1464 | if(!ok) | ||
| 1465 | return 0; | ||
| 819 | } | 1466 | } |
| 820 | idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp); | 1467 | /* Look for serial number of certificate in CRL |
| 821 | /* If found assume revoked: want something cleverer than | 1468 | * If found make sure reason is not removeFromCRL. |
| 822 | * this to handle entry extensions in V2 CRLs. | ||
| 823 | */ | 1469 | */ |
| 824 | if(idx >= 0) | 1470 | if (X509_CRL_get0_by_cert(crl, &rev, x)) |
| 825 | { | 1471 | { |
| 1472 | if (rev->reason == CRL_REASON_REMOVE_FROM_CRL) | ||
| 1473 | return 2; | ||
| 826 | ctx->error = X509_V_ERR_CERT_REVOKED; | 1474 | ctx->error = X509_V_ERR_CERT_REVOKED; |
| 827 | ok = ctx->verify_cb(0, ctx); | 1475 | ok = ctx->verify_cb(0, ctx); |
| 828 | if (!ok) return 0; | 1476 | if (!ok) |
| 1477 | return 0; | ||
| 829 | } | 1478 | } |
| 830 | 1479 | ||
| 831 | if (ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) | ||
| 832 | return 1; | ||
| 833 | |||
| 834 | /* See if we have any critical CRL extensions: since we | ||
| 835 | * currently don't handle any CRL extensions the CRL must be | ||
| 836 | * rejected. | ||
| 837 | * This code accesses the X509_CRL structure directly: applications | ||
| 838 | * shouldn't do this. | ||
| 839 | */ | ||
| 840 | |||
| 841 | exts = crl->crl->extensions; | ||
| 842 | |||
| 843 | for (idx = 0; idx < sk_X509_EXTENSION_num(exts); idx++) | ||
| 844 | { | ||
| 845 | ext = sk_X509_EXTENSION_value(exts, idx); | ||
| 846 | if (ext->critical > 0) | ||
| 847 | { | ||
| 848 | ctx->error = | ||
| 849 | X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION; | ||
| 850 | ok = ctx->verify_cb(0, ctx); | ||
| 851 | if(!ok) return 0; | ||
| 852 | break; | ||
| 853 | } | ||
| 854 | } | ||
| 855 | return 1; | 1480 | return 1; |
| 856 | } | 1481 | } |
| 857 | 1482 | ||
| 858 | static int check_policy(X509_STORE_CTX *ctx) | 1483 | static int check_policy(X509_STORE_CTX *ctx) |
| 859 | { | 1484 | { |
| 860 | int ret; | 1485 | int ret; |
| 1486 | if (ctx->parent) | ||
| 1487 | return 1; | ||
| 861 | ret = X509_policy_check(&ctx->tree, &ctx->explicit_policy, ctx->chain, | 1488 | ret = X509_policy_check(&ctx->tree, &ctx->explicit_policy, ctx->chain, |
| 862 | ctx->param->policies, ctx->param->flags); | 1489 | ctx->param->policies, ctx->param->flags); |
| 863 | if (ret == 0) | 1490 | if (ret == 0) |
| @@ -880,7 +1507,8 @@ static int check_policy(X509_STORE_CTX *ctx) | |||
| 880 | continue; | 1507 | continue; |
| 881 | ctx->current_cert = x; | 1508 | ctx->current_cert = x; |
| 882 | ctx->error = X509_V_ERR_INVALID_POLICY_EXTENSION; | 1509 | ctx->error = X509_V_ERR_INVALID_POLICY_EXTENSION; |
| 883 | ret = ctx->verify_cb(0, ctx); | 1510 | if(!ctx->verify_cb(0, ctx)) |
| 1511 | return 0; | ||
| 884 | } | 1512 | } |
| 885 | return 1; | 1513 | return 1; |
| 886 | } | 1514 | } |
| @@ -986,7 +1614,12 @@ static int internal_verify(X509_STORE_CTX *ctx) | |||
| 986 | while (n >= 0) | 1614 | while (n >= 0) |
| 987 | { | 1615 | { |
| 988 | ctx->error_depth=n; | 1616 | ctx->error_depth=n; |
| 989 | if (!xs->valid) | 1617 | |
| 1618 | /* Skip signature check for self signed certificates unless | ||
| 1619 | * explicitly asked for. It doesn't add any security and | ||
| 1620 | * just wastes time. | ||
| 1621 | */ | ||
| 1622 | if (!xs->valid && (xs != xi || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE))) | ||
| 990 | { | 1623 | { |
| 991 | if ((pkey=X509_get_pubkey(xi)) == NULL) | 1624 | if ((pkey=X509_get_pubkey(xi)) == NULL) |
| 992 | { | 1625 | { |
| @@ -996,13 +1629,6 @@ static int internal_verify(X509_STORE_CTX *ctx) | |||
| 996 | if (!ok) goto end; | 1629 | if (!ok) goto end; |
| 997 | } | 1630 | } |
| 998 | else if (X509_verify(xs,pkey) <= 0) | 1631 | else if (X509_verify(xs,pkey) <= 0) |
| 999 | /* XXX For the final trusted self-signed cert, | ||
| 1000 | * this is a waste of time. That check should | ||
| 1001 | * optional so that e.g. 'openssl x509' can be | ||
| 1002 | * used to detect invalid self-signatures, but | ||
| 1003 | * we don't verify again and again in SSL | ||
| 1004 | * handshakes and the like once the cert has | ||
| 1005 | * been declared trusted. */ | ||
| 1006 | { | 1632 | { |
| 1007 | ctx->error=X509_V_ERR_CERT_SIGNATURE_FAILURE; | 1633 | ctx->error=X509_V_ERR_CERT_SIGNATURE_FAILURE; |
| 1008 | ctx->current_cert=xs; | 1634 | ctx->current_cert=xs; |
| @@ -1041,12 +1667,12 @@ end: | |||
| 1041 | return ok; | 1667 | return ok; |
| 1042 | } | 1668 | } |
| 1043 | 1669 | ||
| 1044 | int X509_cmp_current_time(ASN1_TIME *ctm) | 1670 | int X509_cmp_current_time(const ASN1_TIME *ctm) |
| 1045 | { | 1671 | { |
| 1046 | return X509_cmp_time(ctm, NULL); | 1672 | return X509_cmp_time(ctm, NULL); |
| 1047 | } | 1673 | } |
| 1048 | 1674 | ||
| 1049 | int X509_cmp_time(ASN1_TIME *ctm, time_t *cmp_time) | 1675 | int X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time) |
| 1050 | { | 1676 | { |
| 1051 | char *str; | 1677 | char *str; |
| 1052 | ASN1_TIME atm; | 1678 | ASN1_TIME atm; |
| @@ -1101,6 +1727,7 @@ int X509_cmp_time(ASN1_TIME *ctm, time_t *cmp_time) | |||
| 1101 | offset= -offset; | 1727 | offset= -offset; |
| 1102 | } | 1728 | } |
| 1103 | atm.type=ctm->type; | 1729 | atm.type=ctm->type; |
| 1730 | atm.flags = 0; | ||
| 1104 | atm.length=sizeof(buff2); | 1731 | atm.length=sizeof(buff2); |
| 1105 | atm.data=(unsigned char *)buff2; | 1732 | atm.data=(unsigned char *)buff2; |
| 1106 | 1733 | ||
| @@ -1129,19 +1756,28 @@ ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj) | |||
| 1129 | return X509_time_adj(s, adj, NULL); | 1756 | return X509_time_adj(s, adj, NULL); |
| 1130 | } | 1757 | } |
| 1131 | 1758 | ||
| 1132 | ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm) | 1759 | ASN1_TIME *X509_time_adj(ASN1_TIME *s, long offset_sec, time_t *in_tm) |
| 1760 | { | ||
| 1761 | return X509_time_adj_ex(s, 0, offset_sec, in_tm); | ||
| 1762 | } | ||
| 1763 | |||
| 1764 | ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, | ||
| 1765 | int offset_day, long offset_sec, time_t *in_tm) | ||
| 1133 | { | 1766 | { |
| 1134 | time_t t; | 1767 | time_t t; |
| 1135 | int type = -1; | ||
| 1136 | 1768 | ||
| 1137 | if (in_tm) t = *in_tm; | 1769 | if (in_tm) t = *in_tm; |
| 1138 | else time(&t); | 1770 | else time(&t); |
| 1139 | 1771 | ||
| 1140 | t+=adj; | 1772 | if (s && !(s->flags & ASN1_STRING_FLAG_MSTRING)) |
| 1141 | if (s) type = s->type; | 1773 | { |
| 1142 | if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t); | 1774 | if (s->type == V_ASN1_UTCTIME) |
| 1143 | if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t); | 1775 | return ASN1_UTCTIME_adj(s,t, offset_day, offset_sec); |
| 1144 | return ASN1_TIME_set(s, t); | 1776 | if (s->type == V_ASN1_GENERALIZEDTIME) |
| 1777 | return ASN1_GENERALIZEDTIME_adj(s, t, offset_day, | ||
| 1778 | offset_sec); | ||
| 1779 | } | ||
| 1780 | return ASN1_TIME_adj(s, t, offset_day, offset_sec); | ||
| 1145 | } | 1781 | } |
| 1146 | 1782 | ||
| 1147 | int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain) | 1783 | int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain) |
| @@ -1244,6 +1880,21 @@ STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx) | |||
| 1244 | return chain; | 1880 | return chain; |
| 1245 | } | 1881 | } |
| 1246 | 1882 | ||
| 1883 | X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx) | ||
| 1884 | { | ||
| 1885 | return ctx->current_issuer; | ||
| 1886 | } | ||
| 1887 | |||
| 1888 | X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx) | ||
| 1889 | { | ||
| 1890 | return ctx->current_crl; | ||
| 1891 | } | ||
| 1892 | |||
| 1893 | X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx) | ||
| 1894 | { | ||
| 1895 | return ctx->parent; | ||
| 1896 | } | ||
| 1897 | |||
| 1247 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x) | 1898 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x) |
| 1248 | { | 1899 | { |
| 1249 | ctx->cert=x; | 1900 | ctx->cert=x; |
| @@ -1365,6 +2016,7 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, | |||
| 1365 | ctx->current_cert=NULL; | 2016 | ctx->current_cert=NULL; |
| 1366 | ctx->current_issuer=NULL; | 2017 | ctx->current_issuer=NULL; |
| 1367 | ctx->tree = NULL; | 2018 | ctx->tree = NULL; |
| 2019 | ctx->parent = NULL; | ||
| 1368 | 2020 | ||
| 1369 | ctx->param = X509_VERIFY_PARAM_new(); | 2021 | ctx->param = X509_VERIFY_PARAM_new(); |
| 1370 | 2022 | ||
| @@ -1430,7 +2082,7 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, | |||
| 1430 | if (store && store->get_crl) | 2082 | if (store && store->get_crl) |
| 1431 | ctx->get_crl = store->get_crl; | 2083 | ctx->get_crl = store->get_crl; |
| 1432 | else | 2084 | else |
| 1433 | ctx->get_crl = get_crl; | 2085 | ctx->get_crl = NULL; |
| 1434 | 2086 | ||
| 1435 | if (store && store->check_crl) | 2087 | if (store && store->check_crl) |
| 1436 | ctx->check_crl = store->check_crl; | 2088 | ctx->check_crl = store->check_crl; |
| @@ -1442,6 +2094,16 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, | |||
| 1442 | else | 2094 | else |
| 1443 | ctx->cert_crl = cert_crl; | 2095 | ctx->cert_crl = cert_crl; |
| 1444 | 2096 | ||
| 2097 | if (store && store->lookup_certs) | ||
| 2098 | ctx->lookup_certs = store->lookup_certs; | ||
| 2099 | else | ||
| 2100 | ctx->lookup_certs = X509_STORE_get1_certs; | ||
| 2101 | |||
| 2102 | if (store && store->lookup_crls) | ||
| 2103 | ctx->lookup_crls = store->lookup_crls; | ||
| 2104 | else | ||
| 2105 | ctx->lookup_crls = X509_STORE_get1_crls; | ||
| 2106 | |||
| 1445 | ctx->check_policy = check_policy; | 2107 | ctx->check_policy = check_policy; |
| 1446 | 2108 | ||
| 1447 | 2109 | ||
| @@ -1474,7 +2136,8 @@ void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx) | |||
| 1474 | if (ctx->cleanup) ctx->cleanup(ctx); | 2136 | if (ctx->cleanup) ctx->cleanup(ctx); |
| 1475 | if (ctx->param != NULL) | 2137 | if (ctx->param != NULL) |
| 1476 | { | 2138 | { |
| 1477 | X509_VERIFY_PARAM_free(ctx->param); | 2139 | if (ctx->parent == NULL) |
| 2140 | X509_VERIFY_PARAM_free(ctx->param); | ||
| 1478 | ctx->param=NULL; | 2141 | ctx->param=NULL; |
| 1479 | } | 2142 | } |
| 1480 | if (ctx->tree != NULL) | 2143 | if (ctx->tree != NULL) |
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h index 76c76e1719..fe09b30aaa 100644 --- a/src/lib/libcrypto/x509/x509_vfy.h +++ b/src/lib/libcrypto/x509/x509_vfy.h | |||
| @@ -77,6 +77,7 @@ | |||
| 77 | extern "C" { | 77 | extern "C" { |
| 78 | #endif | 78 | #endif |
| 79 | 79 | ||
| 80 | #if 0 | ||
| 80 | /* Outer object */ | 81 | /* Outer object */ |
| 81 | typedef struct x509_hash_dir_st | 82 | typedef struct x509_hash_dir_st |
| 82 | { | 83 | { |
| @@ -85,6 +86,7 @@ typedef struct x509_hash_dir_st | |||
| 85 | int *dirs_type; | 86 | int *dirs_type; |
| 86 | int num_dirs_alloced; | 87 | int num_dirs_alloced; |
| 87 | } X509_HASH_DIR_CTX; | 88 | } X509_HASH_DIR_CTX; |
| 89 | #endif | ||
| 88 | 90 | ||
| 89 | typedef struct x509_file_st | 91 | typedef struct x509_file_st |
| 90 | { | 92 | { |
| @@ -198,6 +200,8 @@ struct x509_store_st | |||
| 198 | int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */ | 200 | int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */ |
| 199 | int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ | 201 | int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ |
| 200 | int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ | 202 | int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ |
| 203 | STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm); | ||
| 204 | STACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm); | ||
| 201 | int (*cleanup)(X509_STORE_CTX *ctx); | 205 | int (*cleanup)(X509_STORE_CTX *ctx); |
| 202 | 206 | ||
| 203 | CRYPTO_EX_DATA ex_data; | 207 | CRYPTO_EX_DATA ex_data; |
| @@ -246,6 +250,8 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
| 246 | int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ | 250 | int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ |
| 247 | int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ | 251 | int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ |
| 248 | int (*check_policy)(X509_STORE_CTX *ctx); | 252 | int (*check_policy)(X509_STORE_CTX *ctx); |
| 253 | STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm); | ||
| 254 | STACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm); | ||
| 249 | int (*cleanup)(X509_STORE_CTX *ctx); | 255 | int (*cleanup)(X509_STORE_CTX *ctx); |
| 250 | 256 | ||
| 251 | /* The following is built up */ | 257 | /* The following is built up */ |
| @@ -263,6 +269,11 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
| 263 | X509 *current_issuer; /* cert currently being tested as valid issuer */ | 269 | X509 *current_issuer; /* cert currently being tested as valid issuer */ |
| 264 | X509_CRL *current_crl; /* current CRL */ | 270 | X509_CRL *current_crl; /* current CRL */ |
| 265 | 271 | ||
| 272 | int current_crl_score; /* score of current CRL */ | ||
| 273 | unsigned int current_reasons; /* Reason mask */ | ||
| 274 | |||
| 275 | X509_STORE_CTX *parent; /* For CRL path validation: parent context */ | ||
| 276 | |||
| 266 | CRYPTO_EX_DATA ex_data; | 277 | CRYPTO_EX_DATA ex_data; |
| 267 | } /* X509_STORE_CTX */; | 278 | } /* X509_STORE_CTX */; |
| 268 | 279 | ||
| @@ -330,8 +341,18 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); | |||
| 330 | #define X509_V_ERR_INVALID_EXTENSION 41 | 341 | #define X509_V_ERR_INVALID_EXTENSION 41 |
| 331 | #define X509_V_ERR_INVALID_POLICY_EXTENSION 42 | 342 | #define X509_V_ERR_INVALID_POLICY_EXTENSION 42 |
| 332 | #define X509_V_ERR_NO_EXPLICIT_POLICY 43 | 343 | #define X509_V_ERR_NO_EXPLICIT_POLICY 43 |
| 344 | #define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 | ||
| 345 | #define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 | ||
| 346 | |||
| 347 | #define X509_V_ERR_UNNESTED_RESOURCE 46 | ||
| 333 | 348 | ||
| 334 | #define X509_V_ERR_UNNESTED_RESOURCE 44 | 349 | #define X509_V_ERR_PERMITTED_VIOLATION 47 |
| 350 | #define X509_V_ERR_EXCLUDED_VIOLATION 48 | ||
| 351 | #define X509_V_ERR_SUBTREE_MINMAX 49 | ||
| 352 | #define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 | ||
| 353 | #define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 | ||
| 354 | #define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 | ||
| 355 | #define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 | ||
| 335 | 356 | ||
| 336 | /* The application is not happy */ | 357 | /* The application is not happy */ |
| 337 | #define X509_V_ERR_APPLICATION_VERIFICATION 50 | 358 | #define X509_V_ERR_APPLICATION_VERIFICATION 50 |
| @@ -362,6 +383,13 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); | |||
| 362 | #define X509_V_FLAG_INHIBIT_MAP 0x400 | 383 | #define X509_V_FLAG_INHIBIT_MAP 0x400 |
| 363 | /* Notify callback that policy is OK */ | 384 | /* Notify callback that policy is OK */ |
| 364 | #define X509_V_FLAG_NOTIFY_POLICY 0x800 | 385 | #define X509_V_FLAG_NOTIFY_POLICY 0x800 |
| 386 | /* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ | ||
| 387 | #define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 | ||
| 388 | /* Delta CRL support */ | ||
| 389 | #define X509_V_FLAG_USE_DELTAS 0x2000 | ||
| 390 | /* Check selfsigned CA signature */ | ||
| 391 | #define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 | ||
| 392 | |||
| 365 | 393 | ||
| 366 | #define X509_VP_FLAG_DEFAULT 0x1 | 394 | #define X509_VP_FLAG_DEFAULT 0x1 |
| 367 | #define X509_VP_FLAG_OVERWRITE 0x2 | 395 | #define X509_VP_FLAG_OVERWRITE 0x2 |
| @@ -384,11 +412,16 @@ void X509_OBJECT_free_contents(X509_OBJECT *a); | |||
| 384 | X509_STORE *X509_STORE_new(void ); | 412 | X509_STORE *X509_STORE_new(void ); |
| 385 | void X509_STORE_free(X509_STORE *v); | 413 | void X509_STORE_free(X509_STORE *v); |
| 386 | 414 | ||
| 415 | STACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); | ||
| 416 | STACK_OF(X509_CRL)* X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); | ||
| 387 | int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); | 417 | int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); |
| 388 | int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); | 418 | int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); |
| 389 | int X509_STORE_set_trust(X509_STORE *ctx, int trust); | 419 | int X509_STORE_set_trust(X509_STORE *ctx, int trust); |
| 390 | int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); | 420 | int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); |
| 391 | 421 | ||
| 422 | void X509_STORE_set_verify_cb(X509_STORE *ctx, | ||
| 423 | int (*verify_cb)(int, X509_STORE_CTX *)); | ||
| 424 | |||
| 392 | X509_STORE_CTX *X509_STORE_CTX_new(void); | 425 | X509_STORE_CTX *X509_STORE_CTX_new(void); |
| 393 | 426 | ||
| 394 | int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); | 427 | int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); |
| @@ -447,6 +480,9 @@ int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); | |||
| 447 | void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); | 480 | void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); |
| 448 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); | 481 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); |
| 449 | X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); | 482 | X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); |
| 483 | X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); | ||
| 484 | X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); | ||
| 485 | X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); | ||
| 450 | STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); | 486 | STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); |
| 451 | STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); | 487 | STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); |
| 452 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x); | 488 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x); |
diff --git a/src/lib/libcrypto/x509/x509cset.c b/src/lib/libcrypto/x509/x509cset.c index 7f4004b291..3109defb0b 100644 --- a/src/lib/libcrypto/x509/x509cset.c +++ b/src/lib/libcrypto/x509/x509cset.c | |||
| @@ -81,7 +81,7 @@ int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name) | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | 83 | ||
| 84 | int X509_CRL_set_lastUpdate(X509_CRL *x, ASN1_TIME *tm) | 84 | int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm) |
| 85 | { | 85 | { |
| 86 | ASN1_TIME *in; | 86 | ASN1_TIME *in; |
| 87 | 87 | ||
| @@ -99,7 +99,7 @@ int X509_CRL_set_lastUpdate(X509_CRL *x, ASN1_TIME *tm) | |||
| 99 | return(in != NULL); | 99 | return(in != NULL); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | int X509_CRL_set_nextUpdate(X509_CRL *x, ASN1_TIME *tm) | 102 | int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm) |
| 103 | { | 103 | { |
| 104 | ASN1_TIME *in; | 104 | ASN1_TIME *in; |
| 105 | 105 | ||
diff --git a/src/lib/libcrypto/x509/x509name.c b/src/lib/libcrypto/x509/x509name.c index 068abfe5f0..27bc4dc9a3 100644 --- a/src/lib/libcrypto/x509/x509name.c +++ b/src/lib/libcrypto/x509/x509name.c | |||
| @@ -356,7 +356,7 @@ int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, | |||
| 356 | return ASN1_STRING_set_by_NID(&ne->value, bytes, | 356 | return ASN1_STRING_set_by_NID(&ne->value, bytes, |
| 357 | len, type, | 357 | len, type, |
| 358 | OBJ_obj2nid(ne->object)) ? 1 : 0; | 358 | OBJ_obj2nid(ne->object)) ? 1 : 0; |
| 359 | if (len < 0) len=strlen((char *)bytes); | 359 | if (len < 0) len=strlen((const char *)bytes); |
| 360 | i=ASN1_STRING_set(ne->value,bytes,len); | 360 | i=ASN1_STRING_set(ne->value,bytes,len); |
| 361 | if (!i) return(0); | 361 | if (!i) return(0); |
| 362 | if (type != V_ASN1_UNDEF) | 362 | if (type != V_ASN1_UNDEF) |
diff --git a/src/lib/libcrypto/x509/x509type.c b/src/lib/libcrypto/x509/x509type.c index 2cd994c5b0..3385ad3f67 100644 --- a/src/lib/libcrypto/x509/x509type.c +++ b/src/lib/libcrypto/x509/x509type.c | |||
| @@ -91,6 +91,10 @@ int X509_certificate_type(X509 *x, EVP_PKEY *pkey) | |||
| 91 | break; | 91 | break; |
| 92 | case EVP_PKEY_DH: | 92 | case EVP_PKEY_DH: |
| 93 | ret=EVP_PK_DH|EVP_PKT_EXCH; | 93 | ret=EVP_PK_DH|EVP_PKT_EXCH; |
| 94 | break; | ||
| 95 | case NID_id_GostR3410_94: | ||
| 96 | case NID_id_GostR3410_2001: | ||
| 97 | ret=EVP_PKT_EXCH|EVP_PKT_SIGN; | ||
| 94 | break; | 98 | break; |
| 95 | default: | 99 | default: |
| 96 | break; | 100 | break; |
diff --git a/src/lib/libcrypto/x509/x_all.c b/src/lib/libcrypto/x509/x_all.c index 9039caad60..ebae30b701 100644 --- a/src/lib/libcrypto/x509/x_all.c +++ b/src/lib/libcrypto/x509/x_all.c | |||
| @@ -57,7 +57,6 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #undef SSLEAY_MACROS | ||
| 61 | #include <openssl/stack.h> | 60 | #include <openssl/stack.h> |
| 62 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 63 | #include <openssl/buffer.h> | 62 | #include <openssl/buffer.h> |
| @@ -83,12 +82,6 @@ int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r) | |||
| 83 | a->sig_alg,a->signature,a->req_info,r)); | 82 | a->sig_alg,a->signature,a->req_info,r)); |
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r) | ||
| 87 | { | ||
| 88 | return(ASN1_item_verify(ASN1_ITEM_rptr(X509_CRL_INFO), | ||
| 89 | a->sig_alg, a->signature,a->crl,r)); | ||
| 90 | } | ||
| 91 | |||
| 92 | int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r) | 85 | int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r) |
| 93 | { | 86 | { |
| 94 | return(ASN1_item_verify(ASN1_ITEM_rptr(NETSCAPE_SPKAC), | 87 | return(ASN1_item_verify(ASN1_ITEM_rptr(NETSCAPE_SPKAC), |
diff --git a/src/lib/libcrypto/x509v3/Makefile.ssl b/src/lib/libcrypto/x509v3/Makefile.ssl deleted file mode 100644 index 66df90c346..0000000000 --- a/src/lib/libcrypto/x509v3/Makefile.ssl +++ /dev/null | |||
| @@ -1,603 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/x509v3/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= x509v3 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile README | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= v3_bcons.c v3_bitst.c v3_conf.c v3_extku.c v3_ia5.c v3_lib.c \ | ||
| 27 | v3_prn.c v3_utl.c v3err.c v3_genn.c v3_alt.c v3_skey.c v3_akey.c v3_pku.c \ | ||
| 28 | v3_int.c v3_enum.c v3_sxnet.c v3_cpols.c v3_crld.c v3_purp.c v3_info.c \ | ||
| 29 | v3_ocsp.c v3_akeya.c | ||
| 30 | LIBOBJ= v3_bcons.o v3_bitst.o v3_conf.o v3_extku.o v3_ia5.o v3_lib.o \ | ||
| 31 | v3_prn.o v3_utl.o v3err.o v3_genn.o v3_alt.o v3_skey.o v3_akey.o v3_pku.o \ | ||
| 32 | v3_int.o v3_enum.o v3_sxnet.o v3_cpols.o v3_crld.o v3_purp.o v3_info.o \ | ||
| 33 | v3_ocsp.o v3_akeya.o | ||
| 34 | |||
| 35 | SRC= $(LIBSRC) | ||
| 36 | |||
| 37 | EXHEADER= x509v3.h | ||
| 38 | HEADER= $(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.ssl >> $(TOP)/MINFO | ||
| 54 | |||
| 55 | links: | ||
| 56 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 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 | @for i in $(EXHEADER) ; \ | ||
| 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 | $(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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 85 | |||
| 86 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 87 | |||
| 88 | v3_akey.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 89 | v3_akey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 90 | v3_akey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 91 | v3_akey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 92 | v3_akey.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 93 | v3_akey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 94 | v3_akey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 95 | v3_akey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 96 | v3_akey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 97 | v3_akey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 98 | v3_akey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 99 | v3_akey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 100 | v3_akey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 101 | v3_akey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 102 | v3_akey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 103 | v3_akey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 104 | v3_akey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 105 | v3_akey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 106 | v3_akey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 107 | v3_akey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 108 | v3_akey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 109 | v3_akey.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 110 | v3_akey.o: ../cryptlib.h v3_akey.c | ||
| 111 | v3_akeya.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 112 | v3_akeya.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 113 | v3_akeya.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 114 | v3_akeya.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 115 | v3_akeya.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 116 | v3_akeya.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 117 | v3_akeya.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 118 | v3_akeya.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 119 | v3_akeya.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 120 | v3_akeya.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 121 | v3_akeya.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 122 | v3_akeya.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 123 | v3_akeya.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 124 | v3_akeya.o: ../../include/openssl/opensslconf.h | ||
| 125 | v3_akeya.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 126 | v3_akeya.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 127 | v3_akeya.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 128 | v3_akeya.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 129 | v3_akeya.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 130 | v3_akeya.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 131 | v3_akeya.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 132 | v3_akeya.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 133 | v3_akeya.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_akeya.c | ||
| 134 | v3_alt.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 135 | v3_alt.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 136 | v3_alt.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 137 | v3_alt.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 138 | v3_alt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 139 | v3_alt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 140 | v3_alt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 141 | v3_alt.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 142 | v3_alt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 143 | v3_alt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 144 | v3_alt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 145 | v3_alt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 146 | v3_alt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 147 | v3_alt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 148 | v3_alt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 149 | v3_alt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 150 | v3_alt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 151 | v3_alt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 152 | v3_alt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 153 | v3_alt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 154 | v3_alt.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 155 | v3_alt.o: ../cryptlib.h v3_alt.c | ||
| 156 | v3_bcons.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 157 | v3_bcons.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 158 | v3_bcons.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 159 | v3_bcons.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 160 | v3_bcons.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 161 | v3_bcons.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 162 | v3_bcons.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 163 | v3_bcons.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 164 | v3_bcons.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 165 | v3_bcons.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 166 | v3_bcons.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 167 | v3_bcons.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 168 | v3_bcons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 169 | v3_bcons.o: ../../include/openssl/opensslconf.h | ||
| 170 | v3_bcons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 171 | v3_bcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 172 | v3_bcons.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 173 | v3_bcons.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 174 | v3_bcons.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 175 | v3_bcons.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 176 | v3_bcons.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 177 | v3_bcons.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 178 | v3_bcons.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_bcons.c | ||
| 179 | v3_bitst.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 180 | v3_bitst.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 181 | v3_bitst.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 182 | v3_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 183 | v3_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 184 | v3_bitst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 185 | v3_bitst.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 186 | v3_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 187 | v3_bitst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 188 | v3_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 189 | v3_bitst.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 190 | v3_bitst.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 191 | v3_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 192 | v3_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 193 | v3_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 194 | v3_bitst.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 195 | v3_bitst.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 196 | v3_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 197 | v3_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 198 | v3_bitst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 199 | v3_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 200 | v3_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_bitst.c | ||
| 201 | v3_conf.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 202 | v3_conf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 203 | v3_conf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 204 | v3_conf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 205 | v3_conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 206 | v3_conf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 207 | v3_conf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 208 | v3_conf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 209 | v3_conf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 210 | v3_conf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 211 | v3_conf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 212 | v3_conf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 213 | v3_conf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 214 | v3_conf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 215 | v3_conf.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 216 | v3_conf.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 217 | v3_conf.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 218 | v3_conf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 219 | v3_conf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 220 | v3_conf.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 221 | v3_conf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 222 | v3_conf.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_conf.c | ||
| 223 | v3_cpols.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 224 | v3_cpols.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 225 | v3_cpols.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 226 | v3_cpols.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 227 | v3_cpols.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 228 | v3_cpols.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 229 | v3_cpols.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 230 | v3_cpols.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 231 | v3_cpols.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 232 | v3_cpols.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 233 | v3_cpols.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 234 | v3_cpols.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 235 | v3_cpols.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 236 | v3_cpols.o: ../../include/openssl/opensslconf.h | ||
| 237 | v3_cpols.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 238 | v3_cpols.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 239 | v3_cpols.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 240 | v3_cpols.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 241 | v3_cpols.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 242 | v3_cpols.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 243 | v3_cpols.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 244 | v3_cpols.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 245 | v3_cpols.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_cpols.c | ||
| 246 | v3_crld.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 247 | v3_crld.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 248 | v3_crld.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 249 | v3_crld.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 250 | v3_crld.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 251 | v3_crld.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 252 | v3_crld.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 253 | v3_crld.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 254 | v3_crld.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 255 | v3_crld.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 256 | v3_crld.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 257 | v3_crld.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 258 | v3_crld.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 259 | v3_crld.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 260 | v3_crld.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 261 | v3_crld.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 262 | v3_crld.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 263 | v3_crld.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 264 | v3_crld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 265 | v3_crld.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 266 | v3_crld.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 267 | v3_crld.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 268 | v3_crld.o: ../cryptlib.h v3_crld.c | ||
| 269 | v3_enum.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 270 | v3_enum.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 271 | v3_enum.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 272 | v3_enum.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 273 | v3_enum.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 274 | v3_enum.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 275 | v3_enum.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 276 | v3_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 277 | v3_enum.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 278 | v3_enum.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 279 | v3_enum.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 280 | v3_enum.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 281 | v3_enum.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 282 | v3_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 283 | v3_enum.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 284 | v3_enum.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 285 | v3_enum.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 286 | v3_enum.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 287 | v3_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 288 | v3_enum.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 289 | v3_enum.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 290 | v3_enum.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_enum.c | ||
| 291 | v3_extku.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 292 | v3_extku.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 293 | v3_extku.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 294 | v3_extku.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 295 | v3_extku.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 296 | v3_extku.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 297 | v3_extku.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 298 | v3_extku.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 299 | v3_extku.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 300 | v3_extku.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 301 | v3_extku.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 302 | v3_extku.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 303 | v3_extku.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 304 | v3_extku.o: ../../include/openssl/opensslconf.h | ||
| 305 | v3_extku.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 306 | v3_extku.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 307 | v3_extku.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 308 | v3_extku.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 309 | v3_extku.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 310 | v3_extku.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 311 | v3_extku.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 312 | v3_extku.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 313 | v3_extku.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_extku.c | ||
| 314 | v3_genn.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 315 | v3_genn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 316 | v3_genn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 317 | v3_genn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 318 | v3_genn.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 319 | v3_genn.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 320 | v3_genn.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 321 | v3_genn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 322 | v3_genn.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 323 | v3_genn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 324 | v3_genn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 325 | v3_genn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 326 | v3_genn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 327 | v3_genn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 328 | v3_genn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 329 | v3_genn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 330 | v3_genn.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 331 | v3_genn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 332 | v3_genn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 333 | v3_genn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 334 | v3_genn.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 335 | v3_genn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 336 | v3_genn.o: ../cryptlib.h v3_genn.c | ||
| 337 | v3_ia5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 338 | v3_ia5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 339 | v3_ia5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 340 | v3_ia5.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 341 | v3_ia5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 342 | v3_ia5.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 343 | v3_ia5.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 344 | v3_ia5.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 345 | v3_ia5.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 346 | v3_ia5.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 347 | v3_ia5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 348 | v3_ia5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 349 | v3_ia5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 350 | v3_ia5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 351 | v3_ia5.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 352 | v3_ia5.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 353 | v3_ia5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 354 | v3_ia5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 355 | v3_ia5.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 356 | v3_ia5.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 357 | v3_ia5.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 358 | v3_ia5.o: ../cryptlib.h v3_ia5.c | ||
| 359 | v3_info.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 360 | v3_info.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 361 | v3_info.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 362 | v3_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 363 | v3_info.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 364 | v3_info.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 365 | v3_info.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 366 | v3_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 367 | v3_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 368 | v3_info.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 369 | v3_info.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 370 | v3_info.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 371 | v3_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 372 | v3_info.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 373 | v3_info.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 374 | v3_info.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 375 | v3_info.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 376 | v3_info.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 377 | v3_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 378 | v3_info.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 379 | v3_info.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 380 | v3_info.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 381 | v3_info.o: ../cryptlib.h v3_info.c | ||
| 382 | v3_int.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 383 | v3_int.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 384 | v3_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 385 | v3_int.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 386 | v3_int.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 387 | v3_int.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 388 | v3_int.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 389 | v3_int.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 390 | v3_int.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 391 | v3_int.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 392 | v3_int.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 393 | v3_int.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 394 | v3_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 395 | v3_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 396 | v3_int.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 397 | v3_int.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 398 | v3_int.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 399 | v3_int.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 400 | v3_int.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 401 | v3_int.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 402 | v3_int.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 403 | v3_int.o: ../cryptlib.h v3_int.c | ||
| 404 | v3_lib.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 405 | v3_lib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 406 | v3_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 407 | v3_lib.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 408 | v3_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 409 | v3_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 410 | v3_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 411 | v3_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 412 | v3_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 413 | v3_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 414 | v3_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 415 | v3_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 416 | v3_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 417 | v3_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 418 | v3_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 419 | v3_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 420 | v3_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 421 | v3_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 422 | v3_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 423 | v3_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 424 | v3_lib.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 425 | v3_lib.o: ../cryptlib.h ext_dat.h v3_lib.c | ||
| 426 | v3_ocsp.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 427 | v3_ocsp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 428 | v3_ocsp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 429 | v3_ocsp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 430 | v3_ocsp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 431 | v3_ocsp.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 432 | v3_ocsp.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 433 | v3_ocsp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 434 | v3_ocsp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 435 | v3_ocsp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 436 | v3_ocsp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 437 | v3_ocsp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 438 | v3_ocsp.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 439 | v3_ocsp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 440 | v3_ocsp.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 441 | v3_ocsp.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 442 | v3_ocsp.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 443 | v3_ocsp.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 444 | v3_ocsp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 445 | v3_ocsp.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 446 | v3_ocsp.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 447 | v3_ocsp.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 448 | v3_ocsp.o: ../cryptlib.h v3_ocsp.c | ||
| 449 | v3_pku.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 450 | v3_pku.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 451 | v3_pku.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 452 | v3_pku.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 453 | v3_pku.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 454 | v3_pku.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 455 | v3_pku.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 456 | v3_pku.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 457 | v3_pku.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 458 | v3_pku.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 459 | v3_pku.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 460 | v3_pku.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 461 | v3_pku.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 462 | v3_pku.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 463 | v3_pku.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 464 | v3_pku.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 465 | v3_pku.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 466 | v3_pku.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 467 | v3_pku.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 468 | v3_pku.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 469 | v3_pku.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 470 | v3_pku.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_pku.c | ||
| 471 | v3_prn.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 472 | v3_prn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 473 | v3_prn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 474 | v3_prn.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 475 | v3_prn.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 476 | v3_prn.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 477 | v3_prn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 478 | v3_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 479 | v3_prn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 480 | v3_prn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 481 | v3_prn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 482 | v3_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 483 | v3_prn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 484 | v3_prn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 485 | v3_prn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 486 | v3_prn.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 487 | v3_prn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 488 | v3_prn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 489 | v3_prn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 490 | v3_prn.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 491 | v3_prn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 492 | v3_prn.o: ../cryptlib.h v3_prn.c | ||
| 493 | v3_purp.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 494 | v3_purp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 495 | v3_purp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 496 | v3_purp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 497 | v3_purp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 498 | v3_purp.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 499 | v3_purp.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 500 | v3_purp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 501 | v3_purp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 502 | v3_purp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 503 | v3_purp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 504 | v3_purp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 505 | v3_purp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 506 | v3_purp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 507 | v3_purp.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 508 | v3_purp.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 509 | v3_purp.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 510 | v3_purp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 511 | v3_purp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 512 | v3_purp.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 513 | v3_purp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 514 | v3_purp.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_purp.c | ||
| 515 | v3_skey.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 516 | v3_skey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 517 | v3_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 518 | v3_skey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 519 | v3_skey.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 520 | v3_skey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 521 | v3_skey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 522 | v3_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 523 | v3_skey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 524 | v3_skey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 525 | v3_skey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 526 | v3_skey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 527 | v3_skey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 528 | v3_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 529 | v3_skey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 530 | v3_skey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 531 | v3_skey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 532 | v3_skey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 533 | v3_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 534 | v3_skey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 535 | v3_skey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 536 | v3_skey.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_skey.c | ||
| 537 | v3_sxnet.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 538 | v3_sxnet.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 539 | v3_sxnet.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 540 | v3_sxnet.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 541 | v3_sxnet.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 542 | v3_sxnet.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 543 | v3_sxnet.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 544 | v3_sxnet.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 545 | v3_sxnet.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 546 | v3_sxnet.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 547 | v3_sxnet.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 548 | v3_sxnet.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 549 | v3_sxnet.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 550 | v3_sxnet.o: ../../include/openssl/opensslconf.h | ||
| 551 | v3_sxnet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 552 | v3_sxnet.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 553 | v3_sxnet.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 554 | v3_sxnet.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 555 | v3_sxnet.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 556 | v3_sxnet.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 557 | v3_sxnet.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 558 | v3_sxnet.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 559 | v3_sxnet.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_sxnet.c | ||
| 560 | v3_utl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 561 | v3_utl.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 562 | v3_utl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 563 | v3_utl.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 564 | v3_utl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 565 | v3_utl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 566 | v3_utl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 567 | v3_utl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 568 | v3_utl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 569 | v3_utl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 570 | v3_utl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 571 | v3_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 572 | v3_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 573 | v3_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 574 | v3_utl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 575 | v3_utl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 576 | v3_utl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 577 | v3_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 578 | v3_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 579 | v3_utl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 580 | v3_utl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 581 | v3_utl.o: ../cryptlib.h v3_utl.c | ||
| 582 | v3err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 583 | v3err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 584 | v3err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 585 | v3err.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 586 | v3err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 587 | v3err.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 588 | v3err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 589 | v3err.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 590 | v3err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 591 | v3err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 592 | v3err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 593 | v3err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 594 | v3err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 595 | v3err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 596 | v3err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 597 | v3err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 598 | v3err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 599 | v3err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 600 | v3err.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 601 | v3err.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 602 | v3err.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 603 | v3err.o: v3err.c | ||
diff --git a/src/lib/libcrypto/x509v3/ext_dat.h b/src/lib/libcrypto/x509v3/ext_dat.h index 3eaec46f8a..76daee6fcd 100644 --- a/src/lib/libcrypto/x509v3/ext_dat.h +++ b/src/lib/libcrypto/x509v3/ext_dat.h | |||
| @@ -61,21 +61,19 @@ extern X509V3_EXT_METHOD v3_bcons, v3_nscert, v3_key_usage, v3_ext_ku; | |||
| 61 | extern X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo; | 61 | extern X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo; |
| 62 | extern X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_id; | 62 | extern X509V3_EXT_METHOD v3_ns_ia5_list[], v3_alt[], v3_skey_id, v3_akey_id; |
| 63 | extern X509V3_EXT_METHOD v3_crl_num, v3_crl_reason, v3_crl_invdate; | 63 | extern X509V3_EXT_METHOD v3_crl_num, v3_crl_reason, v3_crl_invdate; |
| 64 | extern X509V3_EXT_METHOD v3_delta_crl, v3_cpols, v3_crld; | 64 | extern X509V3_EXT_METHOD v3_delta_crl, v3_cpols, v3_crld, v3_freshest_crl; |
| 65 | extern X509V3_EXT_METHOD v3_ocsp_nonce, v3_ocsp_accresp, v3_ocsp_acutoff; | 65 | extern X509V3_EXT_METHOD v3_ocsp_nonce, v3_ocsp_accresp, v3_ocsp_acutoff; |
| 66 | extern X509V3_EXT_METHOD v3_ocsp_crlid, v3_ocsp_nocheck, v3_ocsp_serviceloc; | 66 | extern X509V3_EXT_METHOD v3_ocsp_crlid, v3_ocsp_nocheck, v3_ocsp_serviceloc; |
| 67 | extern X509V3_EXT_METHOD v3_crl_hold, v3_pci; | 67 | extern X509V3_EXT_METHOD v3_crl_hold, v3_pci; |
| 68 | extern X509V3_EXT_METHOD v3_policy_mappings, v3_policy_constraints; | 68 | extern X509V3_EXT_METHOD v3_policy_mappings, v3_policy_constraints; |
| 69 | extern X509V3_EXT_METHOD v3_name_constraints, v3_inhibit_anyp; | 69 | extern X509V3_EXT_METHOD v3_name_constraints, v3_inhibit_anyp, v3_idp; |
| 70 | #ifndef OPENSSL_NO_RFC3779 | ||
| 71 | extern X509V3_EXT_METHOD v3_addr, v3_asid; | 70 | extern X509V3_EXT_METHOD v3_addr, v3_asid; |
| 72 | #endif | ||
| 73 | 71 | ||
| 74 | /* This table will be searched using OBJ_bsearch so it *must* kept in | 72 | /* This table will be searched using OBJ_bsearch so it *must* kept in |
| 75 | * order of the ext_nid values. | 73 | * order of the ext_nid values. |
| 76 | */ | 74 | */ |
| 77 | 75 | ||
| 78 | static X509V3_EXT_METHOD *standard_exts[] = { | 76 | static const X509V3_EXT_METHOD *standard_exts[] = { |
| 79 | &v3_nscert, | 77 | &v3_nscert, |
| 80 | &v3_ns_ia5_list[0], | 78 | &v3_ns_ia5_list[0], |
| 81 | &v3_ns_ia5_list[1], | 79 | &v3_ns_ia5_list[1], |
| @@ -122,7 +120,10 @@ static X509V3_EXT_METHOD *standard_exts[] = { | |||
| 122 | &v3_pci, | 120 | &v3_pci, |
| 123 | &v3_name_constraints, | 121 | &v3_name_constraints, |
| 124 | &v3_policy_mappings, | 122 | &v3_policy_mappings, |
| 125 | &v3_inhibit_anyp | 123 | &v3_inhibit_anyp, |
| 124 | &v3_idp, | ||
| 125 | &v3_alt[2], | ||
| 126 | &v3_freshest_crl, | ||
| 126 | }; | 127 | }; |
| 127 | 128 | ||
| 128 | /* Number of standard extensions */ | 129 | /* Number of standard extensions */ |
diff --git a/src/lib/libcrypto/x509v3/pcy_data.c b/src/lib/libcrypto/x509v3/pcy_data.c index fb392b901f..3444b03195 100644 --- a/src/lib/libcrypto/x509v3/pcy_data.c +++ b/src/lib/libcrypto/x509v3/pcy_data.c | |||
| @@ -82,17 +82,21 @@ void policy_data_free(X509_POLICY_DATA *data) | |||
| 82 | * another source. | 82 | * another source. |
| 83 | */ | 83 | */ |
| 84 | 84 | ||
| 85 | X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, ASN1_OBJECT *id, int crit) | 85 | X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, |
| 86 | const ASN1_OBJECT *cid, int crit) | ||
| 86 | { | 87 | { |
| 87 | X509_POLICY_DATA *ret; | 88 | X509_POLICY_DATA *ret; |
| 88 | if (!policy && !id) | 89 | ASN1_OBJECT *id; |
| 90 | if (!policy && !cid) | ||
| 89 | return NULL; | 91 | return NULL; |
| 90 | if (id) | 92 | if (cid) |
| 91 | { | 93 | { |
| 92 | id = OBJ_dup(id); | 94 | id = OBJ_dup(cid); |
| 93 | if (!id) | 95 | if (!id) |
| 94 | return NULL; | 96 | return NULL; |
| 95 | } | 97 | } |
| 98 | else | ||
| 99 | id = NULL; | ||
| 96 | ret = OPENSSL_malloc(sizeof(X509_POLICY_DATA)); | 100 | ret = OPENSSL_malloc(sizeof(X509_POLICY_DATA)); |
| 97 | if (!ret) | 101 | if (!ret) |
| 98 | return NULL; | 102 | return NULL; |
diff --git a/src/lib/libcrypto/x509v3/pcy_tree.c b/src/lib/libcrypto/x509v3/pcy_tree.c index 6c87a7f506..92f6b24556 100644 --- a/src/lib/libcrypto/x509v3/pcy_tree.c +++ b/src/lib/libcrypto/x509v3/pcy_tree.c | |||
| @@ -62,6 +62,75 @@ | |||
| 62 | 62 | ||
| 63 | #include "pcy_int.h" | 63 | #include "pcy_int.h" |
| 64 | 64 | ||
| 65 | /* Enable this to print out the complete policy tree at various point during | ||
| 66 | * evaluation. | ||
| 67 | */ | ||
| 68 | |||
| 69 | /*#define OPENSSL_POLICY_DEBUG*/ | ||
| 70 | |||
| 71 | #ifdef OPENSSL_POLICY_DEBUG | ||
| 72 | |||
| 73 | static void expected_print(BIO *err, X509_POLICY_LEVEL *lev, | ||
| 74 | X509_POLICY_NODE *node, int indent) | ||
| 75 | { | ||
| 76 | if ( (lev->flags & X509_V_FLAG_INHIBIT_MAP) | ||
| 77 | || !(node->data->flags & POLICY_DATA_FLAG_MAP_MASK)) | ||
| 78 | BIO_puts(err, " Not Mapped\n"); | ||
| 79 | else | ||
| 80 | { | ||
| 81 | int i; | ||
| 82 | STACK_OF(ASN1_OBJECT) *pset = node->data->expected_policy_set; | ||
| 83 | ASN1_OBJECT *oid; | ||
| 84 | BIO_puts(err, " Expected: "); | ||
| 85 | for (i = 0; i < sk_ASN1_OBJECT_num(pset); i++) | ||
| 86 | { | ||
| 87 | oid = sk_ASN1_OBJECT_value(pset, i); | ||
| 88 | if (i) | ||
| 89 | BIO_puts(err, ", "); | ||
| 90 | i2a_ASN1_OBJECT(err, oid); | ||
| 91 | } | ||
| 92 | BIO_puts(err, "\n"); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | static void tree_print(char *str, X509_POLICY_TREE *tree, | ||
| 97 | X509_POLICY_LEVEL *curr) | ||
| 98 | { | ||
| 99 | X509_POLICY_LEVEL *plev; | ||
| 100 | X509_POLICY_NODE *node; | ||
| 101 | int i; | ||
| 102 | BIO *err; | ||
| 103 | err = BIO_new_fp(stderr, BIO_NOCLOSE); | ||
| 104 | if (!curr) | ||
| 105 | curr = tree->levels + tree->nlevel; | ||
| 106 | else | ||
| 107 | curr++; | ||
| 108 | BIO_printf(err, "Level print after %s\n", str); | ||
| 109 | BIO_printf(err, "Printing Up to Level %ld\n", curr - tree->levels); | ||
| 110 | for (plev = tree->levels; plev != curr; plev++) | ||
| 111 | { | ||
| 112 | BIO_printf(err, "Level %ld, flags = %x\n", | ||
| 113 | plev - tree->levels, plev->flags); | ||
| 114 | for (i = 0; i < sk_X509_POLICY_NODE_num(plev->nodes); i++) | ||
| 115 | { | ||
| 116 | node = sk_X509_POLICY_NODE_value(plev->nodes, i); | ||
| 117 | X509_POLICY_NODE_print(err, node, 2); | ||
| 118 | expected_print(err, plev, node, 2); | ||
| 119 | BIO_printf(err, " Flags: %x\n", node->data->flags); | ||
| 120 | } | ||
| 121 | if (plev->anyPolicy) | ||
| 122 | X509_POLICY_NODE_print(err, plev->anyPolicy, 2); | ||
| 123 | } | ||
| 124 | |||
| 125 | BIO_free(err); | ||
| 126 | |||
| 127 | } | ||
| 128 | #else | ||
| 129 | |||
| 130 | #define tree_print(a,b,c) /* */ | ||
| 131 | |||
| 132 | #endif | ||
| 133 | |||
| 65 | /* Initialize policy tree. Return values: | 134 | /* Initialize policy tree. Return values: |
| 66 | * 0 Some internal error occured. | 135 | * 0 Some internal error occured. |
| 67 | * -1 Inconsistent or invalid extensions in certificates. | 136 | * -1 Inconsistent or invalid extensions in certificates. |
| @@ -87,8 +156,10 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, | |||
| 87 | *ptree = NULL; | 156 | *ptree = NULL; |
| 88 | n = sk_X509_num(certs); | 157 | n = sk_X509_num(certs); |
| 89 | 158 | ||
| 159 | #if 0 | ||
| 90 | /* Disable policy mapping for now... */ | 160 | /* Disable policy mapping for now... */ |
| 91 | flags |= X509_V_FLAG_INHIBIT_MAP; | 161 | flags |= X509_V_FLAG_INHIBIT_MAP; |
| 162 | #endif | ||
| 92 | 163 | ||
| 93 | if (flags & X509_V_FLAG_EXPLICIT_POLICY) | 164 | if (flags & X509_V_FLAG_EXPLICIT_POLICY) |
| 94 | explicit_policy = 0; | 165 | explicit_policy = 0; |
| @@ -160,7 +231,7 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, | |||
| 160 | tree->auth_policies = NULL; | 231 | tree->auth_policies = NULL; |
| 161 | tree->user_policies = NULL; | 232 | tree->user_policies = NULL; |
| 162 | 233 | ||
| 163 | if (!tree) | 234 | if (!tree->levels) |
| 164 | { | 235 | { |
| 165 | OPENSSL_free(tree); | 236 | OPENSSL_free(tree); |
| 166 | return 0; | 237 | return 0; |
| @@ -184,7 +255,6 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, | |||
| 184 | level++; | 255 | level++; |
| 185 | x = sk_X509_value(certs, i); | 256 | x = sk_X509_value(certs, i); |
| 186 | cache = policy_cache_set(x); | 257 | cache = policy_cache_set(x); |
| 187 | |||
| 188 | CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509); | 258 | CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509); |
| 189 | level->cert = x; | 259 | level->cert = x; |
| 190 | 260 | ||
| @@ -213,13 +283,13 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, | |||
| 213 | level->flags |= X509_V_FLAG_INHIBIT_MAP; | 283 | level->flags |= X509_V_FLAG_INHIBIT_MAP; |
| 214 | else | 284 | else |
| 215 | { | 285 | { |
| 216 | map_skip--; | 286 | if (!(x->ex_flags & EXFLAG_SI)) |
| 287 | map_skip--; | ||
| 217 | if ((cache->map_skip >= 0) | 288 | if ((cache->map_skip >= 0) |
| 218 | && (cache->map_skip < map_skip)) | 289 | && (cache->map_skip < map_skip)) |
| 219 | map_skip = cache->map_skip; | 290 | map_skip = cache->map_skip; |
| 220 | } | 291 | } |
| 221 | 292 | ||
| 222 | |||
| 223 | } | 293 | } |
| 224 | 294 | ||
| 225 | *ptree = tree; | 295 | *ptree = tree; |
| @@ -237,7 +307,32 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, | |||
| 237 | 307 | ||
| 238 | } | 308 | } |
| 239 | 309 | ||
| 240 | /* This corresponds to RFC3280 XXXX XXXXX: | 310 | static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr, |
| 311 | const X509_POLICY_DATA *data) | ||
| 312 | { | ||
| 313 | X509_POLICY_LEVEL *last = curr - 1; | ||
| 314 | X509_POLICY_NODE *node; | ||
| 315 | int i, matched = 0; | ||
| 316 | /* Iterate through all in nodes linking matches */ | ||
| 317 | for (i = 0; i < sk_X509_POLICY_NODE_num(last->nodes); i++) | ||
| 318 | { | ||
| 319 | node = sk_X509_POLICY_NODE_value(last->nodes, i); | ||
| 320 | if (policy_node_match(last, node, data->valid_policy)) | ||
| 321 | { | ||
| 322 | if (!level_add_node(curr, data, node, NULL)) | ||
| 323 | return 0; | ||
| 324 | matched = 1; | ||
| 325 | } | ||
| 326 | } | ||
| 327 | if (!matched && last->anyPolicy) | ||
| 328 | { | ||
| 329 | if (!level_add_node(curr, data, last->anyPolicy, NULL)) | ||
| 330 | return 0; | ||
| 331 | } | ||
| 332 | return 1; | ||
| 333 | } | ||
| 334 | |||
| 335 | /* This corresponds to RFC3280 6.1.3(d)(1): | ||
| 241 | * link any data from CertificatePolicies onto matching parent | 336 | * link any data from CertificatePolicies onto matching parent |
| 242 | * or anyPolicy if no match. | 337 | * or anyPolicy if no match. |
| 243 | */ | 338 | */ |
| @@ -248,7 +343,6 @@ static int tree_link_nodes(X509_POLICY_LEVEL *curr, | |||
| 248 | int i; | 343 | int i; |
| 249 | X509_POLICY_LEVEL *last; | 344 | X509_POLICY_LEVEL *last; |
| 250 | X509_POLICY_DATA *data; | 345 | X509_POLICY_DATA *data; |
| 251 | X509_POLICY_NODE *parent; | ||
| 252 | last = curr - 1; | 346 | last = curr - 1; |
| 253 | 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++) |
| 254 | { | 348 | { |
| @@ -261,40 +355,109 @@ static int tree_link_nodes(X509_POLICY_LEVEL *curr, | |||
| 261 | * link because then it will have the mapping flags | 355 | * link because then it will have the mapping flags |
| 262 | * right and we can prune it later. | 356 | * right and we can prune it later. |
| 263 | */ | 357 | */ |
| 358 | #if 0 | ||
| 264 | if ((data->flags & POLICY_DATA_FLAG_MAPPED_ANY) | 359 | if ((data->flags & POLICY_DATA_FLAG_MAPPED_ANY) |
| 265 | && !(curr->flags & X509_V_FLAG_INHIBIT_ANY)) | 360 | && !(curr->flags & X509_V_FLAG_INHIBIT_ANY)) |
| 266 | continue; | 361 | continue; |
| 267 | /* Look for matching node in parent */ | 362 | #endif |
| 268 | parent = level_find_node(last, data->valid_policy); | 363 | /* Look for matching nodes in previous level */ |
| 269 | /* If no match link to anyPolicy */ | 364 | if (!tree_link_matching_nodes(curr, data)) |
| 270 | if (!parent) | ||
| 271 | parent = last->anyPolicy; | ||
| 272 | if (parent && !level_add_node(curr, data, parent, NULL)) | ||
| 273 | return 0; | 365 | return 0; |
| 274 | } | 366 | } |
| 275 | return 1; | 367 | return 1; |
| 276 | } | 368 | } |
| 277 | 369 | ||
| 278 | /* This corresponds to RFC3280 XXXX XXXXX: | 370 | /* This corresponds to RFC3280 6.1.3(d)(2): |
| 279 | * Create new data for any unmatched policies in the parent and link | 371 | * Create new data for any unmatched policies in the parent and link |
| 280 | * to anyPolicy. | 372 | * to anyPolicy. |
| 281 | */ | 373 | */ |
| 282 | 374 | ||
| 375 | static int tree_add_unmatched(X509_POLICY_LEVEL *curr, | ||
| 376 | const X509_POLICY_CACHE *cache, | ||
| 377 | const ASN1_OBJECT *id, | ||
| 378 | X509_POLICY_NODE *node, | ||
| 379 | X509_POLICY_TREE *tree) | ||
| 380 | { | ||
| 381 | X509_POLICY_DATA *data; | ||
| 382 | if (id == NULL) | ||
| 383 | id = node->data->valid_policy; | ||
| 384 | /* Create a new node with qualifiers from anyPolicy and | ||
| 385 | * id from unmatched node. | ||
| 386 | */ | ||
| 387 | data = policy_data_new(NULL, id, node_critical(node)); | ||
| 388 | |||
| 389 | if (data == NULL) | ||
| 390 | return 0; | ||
| 391 | /* Curr may not have anyPolicy */ | ||
| 392 | data->qualifier_set = cache->anyPolicy->qualifier_set; | ||
| 393 | data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS; | ||
| 394 | if (!level_add_node(curr, data, node, tree)) | ||
| 395 | { | ||
| 396 | policy_data_free(data); | ||
| 397 | return 0; | ||
| 398 | } | ||
| 399 | |||
| 400 | return 1; | ||
| 401 | } | ||
| 402 | |||
| 403 | static int tree_link_unmatched(X509_POLICY_LEVEL *curr, | ||
| 404 | const X509_POLICY_CACHE *cache, | ||
| 405 | X509_POLICY_NODE *node, | ||
| 406 | X509_POLICY_TREE *tree) | ||
| 407 | { | ||
| 408 | const X509_POLICY_LEVEL *last = curr - 1; | ||
| 409 | int i; | ||
| 410 | |||
| 411 | if ( (last->flags & X509_V_FLAG_INHIBIT_MAP) | ||
| 412 | || !(node->data->flags & POLICY_DATA_FLAG_MAPPED)) | ||
| 413 | { | ||
| 414 | /* If no policy mapping: matched if one child present */ | ||
| 415 | if (node->nchild) | ||
| 416 | return 1; | ||
| 417 | if (!tree_add_unmatched(curr, cache, NULL, node, tree)) | ||
| 418 | return 0; | ||
| 419 | /* Add it */ | ||
| 420 | } | ||
| 421 | else | ||
| 422 | { | ||
| 423 | /* If mapping: matched if one child per expected policy set */ | ||
| 424 | STACK_OF(ASN1_OBJECT) *expset = node->data->expected_policy_set; | ||
| 425 | if (node->nchild == sk_ASN1_OBJECT_num(expset)) | ||
| 426 | return 1; | ||
| 427 | /* Locate unmatched nodes */ | ||
| 428 | for (i = 0; i < sk_ASN1_OBJECT_num(expset); i++) | ||
| 429 | { | ||
| 430 | ASN1_OBJECT *oid = sk_ASN1_OBJECT_value(expset, i); | ||
| 431 | if (level_find_node(curr, node, oid)) | ||
| 432 | continue; | ||
| 433 | if (!tree_add_unmatched(curr, cache, oid, node, tree)) | ||
| 434 | return 0; | ||
| 435 | } | ||
| 436 | |||
| 437 | } | ||
| 438 | |||
| 439 | return 1; | ||
| 440 | |||
| 441 | } | ||
| 442 | |||
| 283 | static int tree_link_any(X509_POLICY_LEVEL *curr, | 443 | static int tree_link_any(X509_POLICY_LEVEL *curr, |
| 284 | const X509_POLICY_CACHE *cache, | 444 | const X509_POLICY_CACHE *cache, |
| 285 | X509_POLICY_TREE *tree) | 445 | X509_POLICY_TREE *tree) |
| 286 | { | 446 | { |
| 287 | int i; | 447 | int i; |
| 288 | X509_POLICY_DATA *data; | 448 | /*X509_POLICY_DATA *data;*/ |
| 289 | X509_POLICY_NODE *node; | 449 | X509_POLICY_NODE *node; |
| 290 | X509_POLICY_LEVEL *last; | 450 | X509_POLICY_LEVEL *last = curr - 1; |
| 291 | |||
| 292 | last = curr - 1; | ||
| 293 | 451 | ||
| 294 | for (i = 0; i < sk_X509_POLICY_NODE_num(last->nodes); i++) | 452 | for (i = 0; i < sk_X509_POLICY_NODE_num(last->nodes); i++) |
| 295 | { | 453 | { |
| 296 | node = sk_X509_POLICY_NODE_value(last->nodes, i); | 454 | node = sk_X509_POLICY_NODE_value(last->nodes, i); |
| 297 | 455 | ||
| 456 | if (!tree_link_unmatched(curr, cache, node, tree)) | ||
| 457 | return 0; | ||
| 458 | |||
| 459 | #if 0 | ||
| 460 | |||
| 298 | /* Skip any node with any children: we only want unmathced | 461 | /* Skip any node with any children: we only want unmathced |
| 299 | * nodes. | 462 | * nodes. |
| 300 | * | 463 | * |
| @@ -303,6 +466,7 @@ static int tree_link_any(X509_POLICY_LEVEL *curr, | |||
| 303 | */ | 466 | */ |
| 304 | if (node->nchild) | 467 | if (node->nchild) |
| 305 | continue; | 468 | continue; |
| 469 | |||
| 306 | /* Create a new node with qualifiers from anyPolicy and | 470 | /* Create a new node with qualifiers from anyPolicy and |
| 307 | * id from unmatched node. | 471 | * id from unmatched node. |
| 308 | */ | 472 | */ |
| @@ -319,6 +483,9 @@ static int tree_link_any(X509_POLICY_LEVEL *curr, | |||
| 319 | policy_data_free(data); | 483 | policy_data_free(data); |
| 320 | return 0; | 484 | return 0; |
| 321 | } | 485 | } |
| 486 | |||
| 487 | #endif | ||
| 488 | |||
| 322 | } | 489 | } |
| 323 | /* Finally add link to anyPolicy */ | 490 | /* Finally add link to anyPolicy */ |
| 324 | if (last->anyPolicy) | 491 | if (last->anyPolicy) |
| @@ -337,30 +504,36 @@ static int tree_link_any(X509_POLICY_LEVEL *curr, | |||
| 337 | 504 | ||
| 338 | static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) | 505 | static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr) |
| 339 | { | 506 | { |
| 507 | STACK_OF(X509_POLICY_NODE) *nodes; | ||
| 340 | X509_POLICY_NODE *node; | 508 | X509_POLICY_NODE *node; |
| 341 | int i; | 509 | int i; |
| 342 | for (i = sk_X509_POLICY_NODE_num(curr->nodes) - 1; i >= 0; i--) | 510 | nodes = curr->nodes; |
| 511 | if (curr->flags & X509_V_FLAG_INHIBIT_MAP) | ||
| 343 | { | 512 | { |
| 344 | node = sk_X509_POLICY_NODE_value(curr->nodes, i); | 513 | for (i = sk_X509_POLICY_NODE_num(nodes) - 1; i >= 0; i--) |
| 345 | /* Delete any mapped data: see RFC3280 XXXX */ | ||
| 346 | if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK) | ||
| 347 | { | 514 | { |
| 348 | node->parent->nchild--; | 515 | node = sk_X509_POLICY_NODE_value(nodes, i); |
| 349 | OPENSSL_free(node); | 516 | /* Delete any mapped data: see RFC3280 XXXX */ |
| 350 | (void)sk_X509_POLICY_NODE_delete(curr->nodes, i); | 517 | if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK) |
| 518 | { | ||
| 519 | node->parent->nchild--; | ||
| 520 | OPENSSL_free(node); | ||
| 521 | (void)sk_X509_POLICY_NODE_delete(nodes,i); | ||
| 522 | } | ||
| 351 | } | 523 | } |
| 352 | } | 524 | } |
| 353 | 525 | ||
| 354 | for(;;) { | 526 | for(;;) { |
| 355 | --curr; | 527 | --curr; |
| 356 | for (i = sk_X509_POLICY_NODE_num(curr->nodes) - 1; i >= 0; i--) | 528 | nodes = curr->nodes; |
| 529 | for (i = sk_X509_POLICY_NODE_num(nodes) - 1; i >= 0; i--) | ||
| 357 | { | 530 | { |
| 358 | node = sk_X509_POLICY_NODE_value(curr->nodes, i); | 531 | node = sk_X509_POLICY_NODE_value(nodes, i); |
| 359 | if (node->nchild == 0) | 532 | if (node->nchild == 0) |
| 360 | { | 533 | { |
| 361 | node->parent->nchild--; | 534 | node->parent->nchild--; |
| 362 | OPENSSL_free(node); | 535 | OPENSSL_free(node); |
| 363 | (void)sk_X509_POLICY_NODE_delete(curr->nodes, i); | 536 | (void)sk_X509_POLICY_NODE_delete(nodes, i); |
| 364 | } | 537 | } |
| 365 | } | 538 | } |
| 366 | if (curr->anyPolicy && !curr->anyPolicy->nchild) | 539 | if (curr->anyPolicy && !curr->anyPolicy->nchild) |
| @@ -536,6 +709,7 @@ static int tree_evaluate(X509_POLICY_TREE *tree) | |||
| 536 | if (!(curr->flags & X509_V_FLAG_INHIBIT_ANY) | 709 | if (!(curr->flags & X509_V_FLAG_INHIBIT_ANY) |
| 537 | && !tree_link_any(curr, cache, tree)) | 710 | && !tree_link_any(curr, cache, tree)) |
| 538 | return 0; | 711 | return 0; |
| 712 | tree_print("before tree_prune()", tree, curr); | ||
| 539 | ret = tree_prune(tree, curr); | 713 | ret = tree_prune(tree, curr); |
| 540 | if (ret != 1) | 714 | if (ret != 1) |
| 541 | return ret; | 715 | return ret; |
| @@ -604,7 +778,6 @@ int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, | |||
| 604 | *pexplicit_policy = 0; | 778 | *pexplicit_policy = 0; |
| 605 | ret = tree_init(&tree, certs, flags); | 779 | ret = tree_init(&tree, certs, flags); |
| 606 | 780 | ||
| 607 | |||
| 608 | switch (ret) | 781 | switch (ret) |
| 609 | { | 782 | { |
| 610 | 783 | ||
| @@ -613,6 +786,10 @@ int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, | |||
| 613 | return 1; | 786 | return 1; |
| 614 | 787 | ||
| 615 | /* Some internal error */ | 788 | /* Some internal error */ |
| 789 | case -1: | ||
| 790 | return -1; | ||
| 791 | |||
| 792 | /* Some internal error */ | ||
| 616 | case 0: | 793 | case 0: |
| 617 | return 0; | 794 | return 0; |
| 618 | 795 | ||
| @@ -646,6 +823,8 @@ int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, | |||
| 646 | if (!tree) goto error; | 823 | if (!tree) goto error; |
| 647 | ret = tree_evaluate(tree); | 824 | ret = tree_evaluate(tree); |
| 648 | 825 | ||
| 826 | tree_print("tree_evaluate()", tree, NULL); | ||
| 827 | |||
| 649 | if (ret <= 0) | 828 | if (ret <= 0) |
| 650 | goto error; | 829 | goto error; |
| 651 | 830 | ||
diff --git a/src/lib/libcrypto/x509v3/v3_addr.c b/src/lib/libcrypto/x509v3/v3_addr.c index efdf7c3ba7..9087d66e0a 100644 --- a/src/lib/libcrypto/x509v3/v3_addr.c +++ b/src/lib/libcrypto/x509v3/v3_addr.c | |||
| @@ -236,7 +236,7 @@ static int i2r_IPAddressOrRanges(BIO *out, | |||
| 236 | /* | 236 | /* |
| 237 | * i2r handler for an IPAddrBlocks extension. | 237 | * i2r handler for an IPAddrBlocks extension. |
| 238 | */ | 238 | */ |
| 239 | static int i2r_IPAddrBlocks(X509V3_EXT_METHOD *method, | 239 | static int i2r_IPAddrBlocks(const X509V3_EXT_METHOD *method, |
| 240 | void *ext, | 240 | void *ext, |
| 241 | BIO *out, | 241 | BIO *out, |
| 242 | int indent) | 242 | int indent) |
| @@ -315,8 +315,7 @@ static int IPAddressOrRange_cmp(const IPAddressOrRange *a, | |||
| 315 | const int length) | 315 | const int length) |
| 316 | { | 316 | { |
| 317 | unsigned char addr_a[ADDR_RAW_BUF_LEN], addr_b[ADDR_RAW_BUF_LEN]; | 317 | unsigned char addr_a[ADDR_RAW_BUF_LEN], addr_b[ADDR_RAW_BUF_LEN]; |
| 318 | int prefixlen_a = 0; | 318 | int prefixlen_a = 0, prefixlen_b = 0; |
| 319 | int prefixlen_b = 0; | ||
| 320 | int r; | 319 | int r; |
| 321 | 320 | ||
| 322 | switch (a->type) { | 321 | switch (a->type) { |
| @@ -596,10 +595,10 @@ static IPAddressOrRanges *make_prefix_or_range(IPAddrBlocks *addr, | |||
| 596 | return NULL; | 595 | return NULL; |
| 597 | switch (afi) { | 596 | switch (afi) { |
| 598 | case IANA_AFI_IPV4: | 597 | case IANA_AFI_IPV4: |
| 599 | (void)sk_IPAddressOrRange_set_cmp_func(aors, v4IPAddressOrRange_cmp); | 598 | sk_IPAddressOrRange_set_cmp_func(aors, v4IPAddressOrRange_cmp); |
| 600 | break; | 599 | break; |
| 601 | case IANA_AFI_IPV6: | 600 | case IANA_AFI_IPV6: |
| 602 | (void)sk_IPAddressOrRange_set_cmp_func(aors, v6IPAddressOrRange_cmp); | 601 | sk_IPAddressOrRange_set_cmp_func(aors, v6IPAddressOrRange_cmp); |
| 603 | break; | 602 | break; |
| 604 | } | 603 | } |
| 605 | f->ipAddressChoice->type = IPAddressChoice_addressesOrRanges; | 604 | f->ipAddressChoice->type = IPAddressChoice_addressesOrRanges; |
| @@ -856,7 +855,7 @@ static int IPAddressOrRanges_canonize(IPAddressOrRanges *aors, | |||
| 856 | if (!make_addressRange(&merged, a_min, b_max, length)) | 855 | if (!make_addressRange(&merged, a_min, b_max, length)) |
| 857 | return 0; | 856 | return 0; |
| 858 | sk_IPAddressOrRange_set(aors, i, merged); | 857 | sk_IPAddressOrRange_set(aors, i, merged); |
| 859 | (void)sk_IPAddressOrRange_delete(aors, i + 1); | 858 | sk_IPAddressOrRange_delete(aors, i + 1); |
| 860 | IPAddressOrRange_free(a); | 859 | IPAddressOrRange_free(a); |
| 861 | IPAddressOrRange_free(b); | 860 | IPAddressOrRange_free(b); |
| 862 | --i; | 861 | --i; |
| @@ -880,7 +879,7 @@ int v3_addr_canonize(IPAddrBlocks *addr) | |||
| 880 | v3_addr_get_afi(f))) | 879 | v3_addr_get_afi(f))) |
| 881 | return 0; | 880 | return 0; |
| 882 | } | 881 | } |
| 883 | (void)sk_IPAddressFamily_set_cmp_func(addr, IPAddressFamily_cmp); | 882 | sk_IPAddressFamily_set_cmp_func(addr, IPAddressFamily_cmp); |
| 884 | sk_IPAddressFamily_sort(addr); | 883 | sk_IPAddressFamily_sort(addr); |
| 885 | OPENSSL_assert(v3_addr_is_canonical(addr)); | 884 | OPENSSL_assert(v3_addr_is_canonical(addr)); |
| 886 | return 1; | 885 | return 1; |
| @@ -889,7 +888,7 @@ int v3_addr_canonize(IPAddrBlocks *addr) | |||
| 889 | /* | 888 | /* |
| 890 | * v2i handler for the IPAddrBlocks extension. | 889 | * v2i handler for the IPAddrBlocks extension. |
| 891 | */ | 890 | */ |
| 892 | static void *v2i_IPAddrBlocks(struct v3_ext_method *method, | 891 | static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, |
| 893 | struct v3_ext_ctx *ctx, | 892 | struct v3_ext_ctx *ctx, |
| 894 | STACK_OF(CONF_VALUE) *values) | 893 | STACK_OF(CONF_VALUE) *values) |
| 895 | { | 894 | { |
| @@ -1125,7 +1124,7 @@ int v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b) | |||
| 1125 | return 1; | 1124 | return 1; |
| 1126 | if (b == NULL || v3_addr_inherits(a) || v3_addr_inherits(b)) | 1125 | if (b == NULL || v3_addr_inherits(a) || v3_addr_inherits(b)) |
| 1127 | return 0; | 1126 | return 0; |
| 1128 | (void)sk_IPAddressFamily_set_cmp_func(b, IPAddressFamily_cmp); | 1127 | sk_IPAddressFamily_set_cmp_func(b, IPAddressFamily_cmp); |
| 1129 | for (i = 0; i < sk_IPAddressFamily_num(a); i++) { | 1128 | for (i = 0; i < sk_IPAddressFamily_num(a); i++) { |
| 1130 | IPAddressFamily *fa = sk_IPAddressFamily_value(a, i); | 1129 | IPAddressFamily *fa = sk_IPAddressFamily_value(a, i); |
| 1131 | int j = sk_IPAddressFamily_find(b, fa); | 1130 | int j = sk_IPAddressFamily_find(b, fa); |
| @@ -1167,7 +1166,7 @@ static int v3_addr_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 1167 | { | 1166 | { |
| 1168 | IPAddrBlocks *child = NULL; | 1167 | IPAddrBlocks *child = NULL; |
| 1169 | int i, j, ret = 1; | 1168 | int i, j, ret = 1; |
| 1170 | X509 *x = NULL; | 1169 | X509 *x; |
| 1171 | 1170 | ||
| 1172 | OPENSSL_assert(chain != NULL && sk_X509_num(chain) > 0); | 1171 | OPENSSL_assert(chain != NULL && sk_X509_num(chain) > 0); |
| 1173 | OPENSSL_assert(ctx != NULL || ext != NULL); | 1172 | OPENSSL_assert(ctx != NULL || ext != NULL); |
| @@ -1180,6 +1179,7 @@ static int v3_addr_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 1180 | */ | 1179 | */ |
| 1181 | if (ext != NULL) { | 1180 | if (ext != NULL) { |
| 1182 | i = -1; | 1181 | i = -1; |
| 1182 | x = NULL; | ||
| 1183 | } else { | 1183 | } else { |
| 1184 | i = 0; | 1184 | i = 0; |
| 1185 | x = sk_X509_value(chain, i); | 1185 | x = sk_X509_value(chain, i); |
| @@ -1189,7 +1189,7 @@ static int v3_addr_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 1189 | } | 1189 | } |
| 1190 | if (!v3_addr_is_canonical(ext)) | 1190 | if (!v3_addr_is_canonical(ext)) |
| 1191 | validation_err(X509_V_ERR_INVALID_EXTENSION); | 1191 | validation_err(X509_V_ERR_INVALID_EXTENSION); |
| 1192 | (void)sk_IPAddressFamily_set_cmp_func(ext, IPAddressFamily_cmp); | 1192 | sk_IPAddressFamily_set_cmp_func(ext, IPAddressFamily_cmp); |
| 1193 | if ((child = sk_IPAddressFamily_dup(ext)) == NULL) { | 1193 | if ((child = sk_IPAddressFamily_dup(ext)) == NULL) { |
| 1194 | X509V3err(X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL, ERR_R_MALLOC_FAILURE); | 1194 | X509V3err(X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL, ERR_R_MALLOC_FAILURE); |
| 1195 | ret = 0; | 1195 | ret = 0; |
| @@ -1215,7 +1215,7 @@ static int v3_addr_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 1215 | } | 1215 | } |
| 1216 | continue; | 1216 | continue; |
| 1217 | } | 1217 | } |
| 1218 | (void)sk_IPAddressFamily_set_cmp_func(x->rfc3779_addr, IPAddressFamily_cmp); | 1218 | sk_IPAddressFamily_set_cmp_func(x->rfc3779_addr, IPAddressFamily_cmp); |
| 1219 | for (j = 0; j < sk_IPAddressFamily_num(child); j++) { | 1219 | for (j = 0; j < sk_IPAddressFamily_num(child); j++) { |
| 1220 | IPAddressFamily *fc = sk_IPAddressFamily_value(child, j); | 1220 | IPAddressFamily *fc = sk_IPAddressFamily_value(child, j); |
| 1221 | int k = sk_IPAddressFamily_find(x->rfc3779_addr, fc); | 1221 | int k = sk_IPAddressFamily_find(x->rfc3779_addr, fc); |
| @@ -1242,6 +1242,7 @@ static int v3_addr_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 1242 | /* | 1242 | /* |
| 1243 | * Trust anchor can't inherit. | 1243 | * Trust anchor can't inherit. |
| 1244 | */ | 1244 | */ |
| 1245 | OPENSSL_assert(x != NULL); | ||
| 1245 | if (x->rfc3779_addr != NULL) { | 1246 | if (x->rfc3779_addr != NULL) { |
| 1246 | for (j = 0; j < sk_IPAddressFamily_num(x->rfc3779_addr); j++) { | 1247 | for (j = 0; j < sk_IPAddressFamily_num(x->rfc3779_addr); j++) { |
| 1247 | IPAddressFamily *fp = sk_IPAddressFamily_value(x->rfc3779_addr, j); | 1248 | IPAddressFamily *fp = sk_IPAddressFamily_value(x->rfc3779_addr, j); |
diff --git a/src/lib/libcrypto/x509v3/v3_alt.c b/src/lib/libcrypto/x509v3/v3_alt.c index 75fda7f268..91aefcddc1 100644 --- a/src/lib/libcrypto/x509v3/v3_alt.c +++ b/src/lib/libcrypto/x509v3/v3_alt.c | |||
| @@ -82,6 +82,12 @@ NULL, NULL, NULL}, | |||
| 82 | (X509V3_EXT_I2V)i2v_GENERAL_NAMES, | 82 | (X509V3_EXT_I2V)i2v_GENERAL_NAMES, |
| 83 | (X509V3_EXT_V2I)v2i_issuer_alt, | 83 | (X509V3_EXT_V2I)v2i_issuer_alt, |
| 84 | NULL, NULL, NULL}, | 84 | NULL, NULL, NULL}, |
| 85 | |||
| 86 | { NID_certificate_issuer, 0, ASN1_ITEM_ref(GENERAL_NAMES), | ||
| 87 | 0,0,0,0, | ||
| 88 | 0,0, | ||
| 89 | (X509V3_EXT_I2V)i2v_GENERAL_NAMES, | ||
| 90 | NULL, NULL, NULL, NULL}, | ||
| 85 | }; | 91 | }; |
| 86 | 92 | ||
| 87 | STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, | 93 | STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, |
| @@ -147,9 +153,9 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, | |||
| 147 | BIO_snprintf(htmp, sizeof htmp, | 153 | BIO_snprintf(htmp, sizeof htmp, |
| 148 | "%X", p[0] << 8 | p[1]); | 154 | "%X", p[0] << 8 | p[1]); |
| 149 | p += 2; | 155 | p += 2; |
| 150 | strlcat(oline, htmp, sizeof oline); | 156 | strlcat(oline, htmp, sizeof(oline)); |
| 151 | if (i != 7) | 157 | if (i != 7) |
| 152 | strlcat(oline, ":", sizeof oline); | 158 | strlcat(oline, ":", sizeof(oline)); |
| 153 | } | 159 | } |
| 154 | } | 160 | } |
| 155 | else | 161 | else |
| @@ -360,6 +366,7 @@ static int copy_email(X509V3_CTX *ctx, GENERAL_NAMES *gens, int move_p) | |||
| 360 | if (move_p) | 366 | if (move_p) |
| 361 | { | 367 | { |
| 362 | X509_NAME_delete_entry(nm, i); | 368 | X509_NAME_delete_entry(nm, i); |
| 369 | X509_NAME_ENTRY_free(ne); | ||
| 363 | i--; | 370 | i--; |
| 364 | } | 371 | } |
| 365 | if(!email || !(gen = GENERAL_NAME_new())) { | 372 | if(!email || !(gen = GENERAL_NAME_new())) { |
| @@ -386,8 +393,8 @@ static int copy_email(X509V3_CTX *ctx, GENERAL_NAMES *gens, int move_p) | |||
| 386 | 393 | ||
| 387 | } | 394 | } |
| 388 | 395 | ||
| 389 | GENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method, | 396 | GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, |
| 390 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval) | 397 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval) |
| 391 | { | 398 | { |
| 392 | GENERAL_NAME *gen; | 399 | GENERAL_NAME *gen; |
| 393 | GENERAL_NAMES *gens = NULL; | 400 | GENERAL_NAMES *gens = NULL; |
| @@ -408,28 +415,22 @@ GENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method, | |||
| 408 | return NULL; | 415 | return NULL; |
| 409 | } | 416 | } |
| 410 | 417 | ||
| 411 | GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | 418 | GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, |
| 412 | CONF_VALUE *cnf) | 419 | CONF_VALUE *cnf) |
| 413 | { | 420 | { |
| 414 | return v2i_GENERAL_NAME_ex(NULL, method, ctx, cnf, 0); | 421 | return v2i_GENERAL_NAME_ex(NULL, method, ctx, cnf, 0); |
| 415 | } | 422 | } |
| 416 | 423 | ||
| 417 | GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, | 424 | GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, |
| 418 | X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | 425 | const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, |
| 419 | CONF_VALUE *cnf, int is_nc) | 426 | int gen_type, char *value, int is_nc) |
| 420 | { | 427 | { |
| 421 | char is_string = 0; | 428 | char is_string = 0; |
| 422 | int type; | ||
| 423 | GENERAL_NAME *gen = NULL; | 429 | GENERAL_NAME *gen = NULL; |
| 424 | 430 | ||
| 425 | char *name, *value; | ||
| 426 | |||
| 427 | name = cnf->name; | ||
| 428 | value = cnf->value; | ||
| 429 | |||
| 430 | if(!value) | 431 | if(!value) |
| 431 | { | 432 | { |
| 432 | X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_MISSING_VALUE); | 433 | X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_MISSING_VALUE); |
| 433 | return NULL; | 434 | return NULL; |
| 434 | } | 435 | } |
| 435 | 436 | ||
| @@ -440,74 +441,62 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, | |||
| 440 | gen = GENERAL_NAME_new(); | 441 | gen = GENERAL_NAME_new(); |
| 441 | if(gen == NULL) | 442 | if(gen == NULL) |
| 442 | { | 443 | { |
| 443 | X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,ERR_R_MALLOC_FAILURE); | 444 | X509V3err(X509V3_F_A2I_GENERAL_NAME,ERR_R_MALLOC_FAILURE); |
| 444 | return NULL; | 445 | return NULL; |
| 445 | } | 446 | } |
| 446 | } | 447 | } |
| 447 | 448 | ||
| 448 | if(!name_cmp(name, "email")) | 449 | switch (gen_type) |
| 449 | { | ||
| 450 | is_string = 1; | ||
| 451 | type = GEN_EMAIL; | ||
| 452 | } | ||
| 453 | else if(!name_cmp(name, "URI")) | ||
| 454 | { | ||
| 455 | is_string = 1; | ||
| 456 | type = GEN_URI; | ||
| 457 | } | ||
| 458 | else if(!name_cmp(name, "DNS")) | ||
| 459 | { | 450 | { |
| 451 | case GEN_URI: | ||
| 452 | case GEN_EMAIL: | ||
| 453 | case GEN_DNS: | ||
| 460 | is_string = 1; | 454 | is_string = 1; |
| 461 | type = GEN_DNS; | 455 | break; |
| 462 | } | 456 | |
| 463 | else if(!name_cmp(name, "RID")) | 457 | case GEN_RID: |
| 464 | { | 458 | { |
| 465 | ASN1_OBJECT *obj; | 459 | ASN1_OBJECT *obj; |
| 466 | if(!(obj = OBJ_txt2obj(value,0))) | 460 | if(!(obj = OBJ_txt2obj(value,0))) |
| 467 | { | 461 | { |
| 468 | X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_BAD_OBJECT); | 462 | X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_BAD_OBJECT); |
| 469 | ERR_add_error_data(2, "value=", value); | 463 | ERR_add_error_data(2, "value=", value); |
| 470 | goto err; | 464 | goto err; |
| 471 | } | 465 | } |
| 472 | gen->d.rid = obj; | 466 | gen->d.rid = obj; |
| 473 | type = GEN_RID; | ||
| 474 | } | 467 | } |
| 475 | else if(!name_cmp(name, "IP")) | 468 | break; |
| 476 | { | 469 | |
| 470 | case GEN_IPADD: | ||
| 477 | if (is_nc) | 471 | if (is_nc) |
| 478 | gen->d.ip = a2i_IPADDRESS_NC(value); | 472 | gen->d.ip = a2i_IPADDRESS_NC(value); |
| 479 | else | 473 | else |
| 480 | gen->d.ip = a2i_IPADDRESS(value); | 474 | gen->d.ip = a2i_IPADDRESS(value); |
| 481 | if(gen->d.ip == NULL) | 475 | if(gen->d.ip == NULL) |
| 482 | { | 476 | { |
| 483 | X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_BAD_IP_ADDRESS); | 477 | X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_BAD_IP_ADDRESS); |
| 484 | ERR_add_error_data(2, "value=", value); | 478 | ERR_add_error_data(2, "value=", value); |
| 485 | goto err; | 479 | goto err; |
| 486 | } | 480 | } |
| 487 | type = GEN_IPADD; | 481 | break; |
| 488 | } | 482 | |
| 489 | else if(!name_cmp(name, "dirName")) | 483 | case GEN_DIRNAME: |
| 490 | { | ||
| 491 | type = GEN_DIRNAME; | ||
| 492 | if (!do_dirname(gen, value, ctx)) | 484 | if (!do_dirname(gen, value, ctx)) |
| 493 | { | 485 | { |
| 494 | X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_DIRNAME_ERROR); | 486 | X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_DIRNAME_ERROR); |
| 495 | goto err; | 487 | goto err; |
| 496 | } | 488 | } |
| 497 | } | 489 | break; |
| 498 | else if(!name_cmp(name, "otherName")) | 490 | |
| 499 | { | 491 | case GEN_OTHERNAME: |
| 500 | if (!do_othername(gen, value, ctx)) | 492 | if (!do_othername(gen, value, ctx)) |
| 501 | { | 493 | { |
| 502 | X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_OTHERNAME_ERROR); | 494 | X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_OTHERNAME_ERROR); |
| 503 | goto err; | 495 | goto err; |
| 504 | } | 496 | } |
| 505 | type = GEN_OTHERNAME; | 497 | break; |
| 506 | } | 498 | default: |
| 507 | else | 499 | X509V3err(X509V3_F_A2I_GENERAL_NAME,X509V3_R_UNSUPPORTED_TYPE); |
| 508 | { | ||
| 509 | X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_UNSUPPORTED_OPTION); | ||
| 510 | ERR_add_error_data(2, "name=", name); | ||
| 511 | goto err; | 500 | goto err; |
| 512 | } | 501 | } |
| 513 | 502 | ||
| @@ -517,12 +506,12 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, | |||
| 517 | !ASN1_STRING_set(gen->d.ia5, (unsigned char*)value, | 506 | !ASN1_STRING_set(gen->d.ia5, (unsigned char*)value, |
| 518 | strlen(value))) | 507 | strlen(value))) |
| 519 | { | 508 | { |
| 520 | X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,ERR_R_MALLOC_FAILURE); | 509 | X509V3err(X509V3_F_A2I_GENERAL_NAME,ERR_R_MALLOC_FAILURE); |
| 521 | goto err; | 510 | goto err; |
| 522 | } | 511 | } |
| 523 | } | 512 | } |
| 524 | 513 | ||
| 525 | gen->type = type; | 514 | gen->type = gen_type; |
| 526 | 515 | ||
| 527 | return gen; | 516 | return gen; |
| 528 | 517 | ||
| @@ -532,6 +521,48 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, | |||
| 532 | return NULL; | 521 | return NULL; |
| 533 | } | 522 | } |
| 534 | 523 | ||
| 524 | GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, | ||
| 525 | const X509V3_EXT_METHOD *method, | ||
| 526 | X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc) | ||
| 527 | { | ||
| 528 | int type; | ||
| 529 | |||
| 530 | char *name, *value; | ||
| 531 | |||
| 532 | name = cnf->name; | ||
| 533 | value = cnf->value; | ||
| 534 | |||
| 535 | if(!value) | ||
| 536 | { | ||
| 537 | X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_MISSING_VALUE); | ||
| 538 | return NULL; | ||
| 539 | } | ||
| 540 | |||
| 541 | if(!name_cmp(name, "email")) | ||
| 542 | type = GEN_EMAIL; | ||
| 543 | else if(!name_cmp(name, "URI")) | ||
| 544 | type = GEN_URI; | ||
| 545 | else if(!name_cmp(name, "DNS")) | ||
| 546 | type = GEN_DNS; | ||
| 547 | else if(!name_cmp(name, "RID")) | ||
| 548 | type = GEN_RID; | ||
| 549 | else if(!name_cmp(name, "IP")) | ||
| 550 | type = GEN_IPADD; | ||
| 551 | else if(!name_cmp(name, "dirName")) | ||
| 552 | type = GEN_DIRNAME; | ||
| 553 | else if(!name_cmp(name, "otherName")) | ||
| 554 | type = GEN_OTHERNAME; | ||
| 555 | else | ||
| 556 | { | ||
| 557 | X509V3err(X509V3_F_V2I_GENERAL_NAME_EX,X509V3_R_UNSUPPORTED_OPTION); | ||
| 558 | ERR_add_error_data(2, "name=", name); | ||
| 559 | return NULL; | ||
| 560 | } | ||
| 561 | |||
| 562 | return a2i_GENERAL_NAME(out, method, ctx, type, value, is_nc); | ||
| 563 | |||
| 564 | } | ||
| 565 | |||
| 535 | static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx) | 566 | static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx) |
| 536 | { | 567 | { |
| 537 | char *objtmp = NULL, *p; | 568 | char *objtmp = NULL, *p; |
| @@ -577,6 +608,7 @@ static int do_dirname(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx) | |||
| 577 | if (!ret) | 608 | if (!ret) |
| 578 | X509_NAME_free(nm); | 609 | X509_NAME_free(nm); |
| 579 | gen->d.dirn = nm; | 610 | gen->d.dirn = nm; |
| 611 | X509V3_section_free(ctx, sk); | ||
| 580 | 612 | ||
| 581 | return ret; | 613 | return ret; |
| 582 | } | 614 | } |
diff --git a/src/lib/libcrypto/x509v3/v3_asid.c b/src/lib/libcrypto/x509v3/v3_asid.c index abd497ed1f..56702f86b9 100644 --- a/src/lib/libcrypto/x509v3/v3_asid.c +++ b/src/lib/libcrypto/x509v3/v3_asid.c | |||
| @@ -152,7 +152,7 @@ static int i2r_ASIdentifierChoice(BIO *out, | |||
| 152 | /* | 152 | /* |
| 153 | * i2r method for an ASIdentifier extension. | 153 | * i2r method for an ASIdentifier extension. |
| 154 | */ | 154 | */ |
| 155 | static int i2r_ASIdentifiers(X509V3_EXT_METHOD *method, | 155 | static int i2r_ASIdentifiers(const X509V3_EXT_METHOD *method, |
| 156 | void *ext, | 156 | void *ext, |
| 157 | BIO *out, | 157 | BIO *out, |
| 158 | int indent) | 158 | int indent) |
| @@ -466,7 +466,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | |||
| 466 | break; | 466 | break; |
| 467 | } | 467 | } |
| 468 | ASIdOrRange_free(b); | 468 | ASIdOrRange_free(b); |
| 469 | (void)sk_ASIdOrRange_delete(choice->u.asIdsOrRanges, i + 1); | 469 | sk_ASIdOrRange_delete(choice->u.asIdsOrRanges, i + 1); |
| 470 | i--; | 470 | i--; |
| 471 | continue; | 471 | continue; |
| 472 | } | 472 | } |
| @@ -495,7 +495,7 @@ int v3_asid_canonize(ASIdentifiers *asid) | |||
| 495 | /* | 495 | /* |
| 496 | * v2i method for an ASIdentifier extension. | 496 | * v2i method for an ASIdentifier extension. |
| 497 | */ | 497 | */ |
| 498 | static void *v2i_ASIdentifiers(struct v3_ext_method *method, | 498 | static void *v2i_ASIdentifiers(const struct v3_ext_method *method, |
| 499 | struct v3_ext_ctx *ctx, | 499 | struct v3_ext_ctx *ctx, |
| 500 | STACK_OF(CONF_VALUE) *values) | 500 | STACK_OF(CONF_VALUE) *values) |
| 501 | { | 501 | { |
| @@ -707,7 +707,7 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 707 | { | 707 | { |
| 708 | ASIdOrRanges *child_as = NULL, *child_rdi = NULL; | 708 | ASIdOrRanges *child_as = NULL, *child_rdi = NULL; |
| 709 | int i, ret = 1, inherit_as = 0, inherit_rdi = 0; | 709 | int i, ret = 1, inherit_as = 0, inherit_rdi = 0; |
| 710 | X509 *x = NULL; | 710 | X509 *x; |
| 711 | 711 | ||
| 712 | assert(chain != NULL && sk_X509_num(chain) > 0); | 712 | assert(chain != NULL && sk_X509_num(chain) > 0); |
| 713 | assert(ctx != NULL || ext != NULL); | 713 | assert(ctx != NULL || ext != NULL); |
| @@ -720,6 +720,7 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 720 | */ | 720 | */ |
| 721 | if (ext != NULL) { | 721 | if (ext != NULL) { |
| 722 | i = -1; | 722 | i = -1; |
| 723 | x = NULL; | ||
| 723 | } else { | 724 | } else { |
| 724 | i = 0; | 725 | i = 0; |
| 725 | x = sk_X509_value(chain, i); | 726 | x = sk_X509_value(chain, i); |
| @@ -799,6 +800,7 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 799 | /* | 800 | /* |
| 800 | * Trust anchor can't inherit. | 801 | * Trust anchor can't inherit. |
| 801 | */ | 802 | */ |
| 803 | assert(x != NULL); | ||
| 802 | if (x->rfc3779_asid != NULL) { | 804 | if (x->rfc3779_asid != NULL) { |
| 803 | if (x->rfc3779_asid->asnum != NULL && | 805 | if (x->rfc3779_asid->asnum != NULL && |
| 804 | x->rfc3779_asid->asnum->type == ASIdentifierChoice_inherit) | 806 | x->rfc3779_asid->asnum->type == ASIdentifierChoice_inherit) |
diff --git a/src/lib/libcrypto/x509v3/v3_conf.c b/src/lib/libcrypto/x509v3/v3_conf.c index 11eb6b7fd5..6730f9a6ee 100644 --- a/src/lib/libcrypto/x509v3/v3_conf.c +++ b/src/lib/libcrypto/x509v3/v3_conf.c | |||
| @@ -72,14 +72,14 @@ static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid, in | |||
| 72 | static X509_EXTENSION *v3_generic_extension(const char *ext, char *value, int crit, int type, X509V3_CTX *ctx); | 72 | static X509_EXTENSION *v3_generic_extension(const char *ext, char *value, int crit, int type, X509V3_CTX *ctx); |
| 73 | static char *conf_lhash_get_string(void *db, char *section, char *value); | 73 | static char *conf_lhash_get_string(void *db, char *section, char *value); |
| 74 | static STACK_OF(CONF_VALUE) *conf_lhash_get_section(void *db, char *section); | 74 | static STACK_OF(CONF_VALUE) *conf_lhash_get_section(void *db, char *section); |
| 75 | static X509_EXTENSION *do_ext_i2d(X509V3_EXT_METHOD *method, int ext_nid, | 75 | static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, int ext_nid, |
| 76 | int crit, void *ext_struc); | 76 | int crit, void *ext_struc); |
| 77 | static unsigned char *generic_asn1(char *value, X509V3_CTX *ctx, long *ext_len); | 77 | static unsigned char *generic_asn1(char *value, X509V3_CTX *ctx, long *ext_len); |
| 78 | /* CONF *conf: Config file */ | 78 | /* CONF *conf: Config file */ |
| 79 | /* char *name: Name */ | 79 | /* char *name: Name */ |
| 80 | /* char *value: Value */ | 80 | /* char *value: Value */ |
| 81 | X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, | 81 | X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, |
| 82 | char *value) | 82 | char *value) |
| 83 | { | 83 | { |
| 84 | int crit; | 84 | int crit; |
| 85 | int ext_type; | 85 | int ext_type; |
| @@ -99,7 +99,7 @@ X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, | |||
| 99 | /* CONF *conf: Config file */ | 99 | /* CONF *conf: Config file */ |
| 100 | /* char *value: Value */ | 100 | /* char *value: Value */ |
| 101 | X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, | 101 | X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, |
| 102 | char *value) | 102 | char *value) |
| 103 | { | 103 | { |
| 104 | int crit; | 104 | int crit; |
| 105 | int ext_type; | 105 | int ext_type; |
| @@ -113,9 +113,9 @@ X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, | |||
| 113 | /* CONF *conf: Config file */ | 113 | /* CONF *conf: Config file */ |
| 114 | /* char *value: Value */ | 114 | /* char *value: Value */ |
| 115 | static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid, | 115 | static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid, |
| 116 | int crit, char *value) | 116 | int crit, char *value) |
| 117 | { | 117 | { |
| 118 | X509V3_EXT_METHOD *method; | 118 | const X509V3_EXT_METHOD *method; |
| 119 | X509_EXTENSION *ext; | 119 | X509_EXTENSION *ext; |
| 120 | STACK_OF(CONF_VALUE) *nval; | 120 | STACK_OF(CONF_VALUE) *nval; |
| 121 | void *ext_struc; | 121 | void *ext_struc; |
| @@ -172,8 +172,8 @@ static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid, | |||
| 172 | 172 | ||
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | static X509_EXTENSION *do_ext_i2d(X509V3_EXT_METHOD *method, int ext_nid, | 175 | static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, int ext_nid, |
| 176 | int crit, void *ext_struc) | 176 | int crit, void *ext_struc) |
| 177 | { | 177 | { |
| 178 | unsigned char *ext_der; | 178 | unsigned char *ext_der; |
| 179 | int ext_len; | 179 | int ext_len; |
| @@ -214,7 +214,7 @@ static X509_EXTENSION *do_ext_i2d(X509V3_EXT_METHOD *method, int ext_nid, | |||
| 214 | 214 | ||
| 215 | X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc) | 215 | X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc) |
| 216 | { | 216 | { |
| 217 | X509V3_EXT_METHOD *method; | 217 | const X509V3_EXT_METHOD *method; |
| 218 | if (!(method = X509V3_EXT_get_nid(ext_nid))) { | 218 | if (!(method = X509V3_EXT_get_nid(ext_nid))) { |
| 219 | X509V3err(X509V3_F_X509V3_EXT_I2D,X509V3_R_UNKNOWN_EXTENSION); | 219 | X509V3err(X509V3_F_X509V3_EXT_I2D,X509V3_R_UNKNOWN_EXTENSION); |
| 220 | return NULL; | 220 | return NULL; |
| @@ -258,7 +258,8 @@ static int v3_check_generic(char **value) | |||
| 258 | 258 | ||
| 259 | /* Create a generic extension: for now just handle DER type */ | 259 | /* Create a generic extension: for now just handle DER type */ |
| 260 | static X509_EXTENSION *v3_generic_extension(const char *ext, char *value, | 260 | static X509_EXTENSION *v3_generic_extension(const char *ext, char *value, |
| 261 | int crit, int gen_type, X509V3_CTX *ctx) | 261 | int crit, int gen_type, |
| 262 | X509V3_CTX *ctx) | ||
| 262 | { | 263 | { |
| 263 | unsigned char *ext_der=NULL; | 264 | unsigned char *ext_der=NULL; |
| 264 | long ext_len; | 265 | long ext_len; |
| @@ -322,7 +323,7 @@ static unsigned char *generic_asn1(char *value, X509V3_CTX *ctx, long *ext_len) | |||
| 322 | 323 | ||
| 323 | 324 | ||
| 324 | int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, | 325 | int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, |
| 325 | STACK_OF(X509_EXTENSION) **sk) | 326 | STACK_OF(X509_EXTENSION) **sk) |
| 326 | { | 327 | { |
| 327 | X509_EXTENSION *ext; | 328 | X509_EXTENSION *ext; |
| 328 | STACK_OF(CONF_VALUE) *nval; | 329 | STACK_OF(CONF_VALUE) *nval; |
| @@ -343,7 +344,7 @@ int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, | |||
| 343 | /* Convenience functions to add extensions to a certificate, CRL and request */ | 344 | /* Convenience functions to add extensions to a certificate, CRL and request */ |
| 344 | 345 | ||
| 345 | int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, | 346 | int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, |
| 346 | X509 *cert) | 347 | X509 *cert) |
| 347 | { | 348 | { |
| 348 | STACK_OF(X509_EXTENSION) **sk = NULL; | 349 | STACK_OF(X509_EXTENSION) **sk = NULL; |
| 349 | if (cert) | 350 | if (cert) |
| @@ -354,7 +355,7 @@ int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, | |||
| 354 | /* Same as above but for a CRL */ | 355 | /* Same as above but for a CRL */ |
| 355 | 356 | ||
| 356 | int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, | 357 | int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, |
| 357 | X509_CRL *crl) | 358 | X509_CRL *crl) |
| 358 | { | 359 | { |
| 359 | STACK_OF(X509_EXTENSION) **sk = NULL; | 360 | STACK_OF(X509_EXTENSION) **sk = NULL; |
| 360 | if (crl) | 361 | if (crl) |
| @@ -443,7 +444,7 @@ void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf) | |||
| 443 | } | 444 | } |
| 444 | 445 | ||
| 445 | void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subj, X509_REQ *req, | 446 | void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subj, X509_REQ *req, |
| 446 | X509_CRL *crl, int flags) | 447 | X509_CRL *crl, int flags) |
| 447 | { | 448 | { |
| 448 | ctx->issuer_cert = issuer; | 449 | ctx->issuer_cert = issuer; |
| 449 | ctx->subject_cert = subj; | 450 | ctx->subject_cert = subj; |
| @@ -454,8 +455,8 @@ void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subj, X509_REQ *req, | |||
| 454 | 455 | ||
| 455 | /* Old conf compatibility functions */ | 456 | /* Old conf compatibility functions */ |
| 456 | 457 | ||
| 457 | X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, | 458 | X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
| 458 | char *value) | 459 | char *name, char *value) |
| 459 | { | 460 | { |
| 460 | CONF ctmp; | 461 | CONF ctmp; |
| 461 | CONF_set_nconf(&ctmp, conf); | 462 | CONF_set_nconf(&ctmp, conf); |
| @@ -464,8 +465,8 @@ X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, | |||
| 464 | 465 | ||
| 465 | /* LHASH *conf: Config file */ | 466 | /* LHASH *conf: Config file */ |
| 466 | /* char *value: Value */ | 467 | /* char *value: Value */ |
| 467 | X509_EXTENSION *X509V3_EXT_conf_nid(LHASH *conf, X509V3_CTX *ctx, int ext_nid, | 468 | X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
| 468 | char *value) | 469 | int ext_nid, char *value) |
| 469 | { | 470 | { |
| 470 | CONF ctmp; | 471 | CONF ctmp; |
| 471 | CONF_set_nconf(&ctmp, conf); | 472 | CONF_set_nconf(&ctmp, conf); |
| @@ -489,14 +490,14 @@ NULL, | |||
| 489 | NULL | 490 | NULL |
| 490 | }; | 491 | }; |
| 491 | 492 | ||
| 492 | void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH *lhash) | 493 | void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash) |
| 493 | { | 494 | { |
| 494 | ctx->db_meth = &conf_lhash_method; | 495 | ctx->db_meth = &conf_lhash_method; |
| 495 | ctx->db = lhash; | 496 | ctx->db = lhash; |
| 496 | } | 497 | } |
| 497 | 498 | ||
| 498 | int X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, | 499 | int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
| 499 | X509 *cert) | 500 | char *section, X509 *cert) |
| 500 | { | 501 | { |
| 501 | CONF ctmp; | 502 | CONF ctmp; |
| 502 | CONF_set_nconf(&ctmp, conf); | 503 | CONF_set_nconf(&ctmp, conf); |
| @@ -505,8 +506,8 @@ int X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, | |||
| 505 | 506 | ||
| 506 | /* Same as above but for a CRL */ | 507 | /* Same as above but for a CRL */ |
| 507 | 508 | ||
| 508 | int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, | 509 | int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
| 509 | X509_CRL *crl) | 510 | char *section, X509_CRL *crl) |
| 510 | { | 511 | { |
| 511 | CONF ctmp; | 512 | CONF ctmp; |
| 512 | CONF_set_nconf(&ctmp, conf); | 513 | CONF_set_nconf(&ctmp, conf); |
| @@ -515,8 +516,8 @@ int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, | |||
| 515 | 516 | ||
| 516 | /* Add extensions to certificate request */ | 517 | /* Add extensions to certificate request */ |
| 517 | 518 | ||
| 518 | int X509V3_EXT_REQ_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, | 519 | int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
| 519 | X509_REQ *req) | 520 | char *section, X509_REQ *req) |
| 520 | { | 521 | { |
| 521 | CONF ctmp; | 522 | CONF ctmp; |
| 522 | CONF_set_nconf(&ctmp, conf); | 523 | CONF_set_nconf(&ctmp, conf); |
diff --git a/src/lib/libcrypto/x509v3/v3_cpols.c b/src/lib/libcrypto/x509v3/v3_cpols.c index ad0506d75c..1f0798b946 100644 --- a/src/lib/libcrypto/x509v3/v3_cpols.c +++ b/src/lib/libcrypto/x509v3/v3_cpols.c | |||
| @@ -450,5 +450,8 @@ void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent) | |||
| 450 | else | 450 | else |
| 451 | BIO_printf(out, "%*sNo Qualifiers\n", indent + 2, ""); | 451 | BIO_printf(out, "%*sNo Qualifiers\n", indent + 2, ""); |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | |||
| 454 | IMPLEMENT_STACK_OF(X509_POLICY_NODE) | 455 | IMPLEMENT_STACK_OF(X509_POLICY_NODE) |
| 456 | IMPLEMENT_STACK_OF(X509_POLICY_DATA) | ||
| 457 | |||
diff --git a/src/lib/libcrypto/x509v3/v3_crld.c b/src/lib/libcrypto/x509v3/v3_crld.c index 181a8977b1..790a6dd032 100644 --- a/src/lib/libcrypto/x509v3/v3_crld.c +++ b/src/lib/libcrypto/x509v3/v3_crld.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -63,45 +63,254 @@ | |||
| 63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| 64 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 65 | 65 | ||
| 66 | static STACK_OF(CONF_VALUE) *i2v_crld(X509V3_EXT_METHOD *method, | 66 | static void *v2i_crld(const X509V3_EXT_METHOD *method, |
| 67 | STACK_OF(DIST_POINT) *crld, STACK_OF(CONF_VALUE) *extlist); | 67 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); |
| 68 | static STACK_OF(DIST_POINT) *v2i_crld(X509V3_EXT_METHOD *method, | 68 | static int i2r_crldp(const X509V3_EXT_METHOD *method, void *pcrldp, BIO *out, |
| 69 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); | 69 | int indent); |
| 70 | 70 | ||
| 71 | const X509V3_EXT_METHOD v3_crld = { | 71 | const X509V3_EXT_METHOD v3_crld = |
| 72 | NID_crl_distribution_points, X509V3_EXT_MULTILINE, ASN1_ITEM_ref(CRL_DIST_POINTS), | 72 | { |
| 73 | 0,0,0,0, | 73 | NID_crl_distribution_points, 0, ASN1_ITEM_ref(CRL_DIST_POINTS), |
| 74 | 0,0, | 74 | 0,0,0,0, |
| 75 | (X509V3_EXT_I2V)i2v_crld, | 75 | 0,0, |
| 76 | (X509V3_EXT_V2I)v2i_crld, | 76 | 0, |
| 77 | 0,0, | 77 | v2i_crld, |
| 78 | NULL | 78 | i2r_crldp,0, |
| 79 | NULL | ||
| 80 | }; | ||
| 81 | |||
| 82 | const X509V3_EXT_METHOD v3_freshest_crl = | ||
| 83 | { | ||
| 84 | NID_freshest_crl, 0, ASN1_ITEM_ref(CRL_DIST_POINTS), | ||
| 85 | 0,0,0,0, | ||
| 86 | 0,0, | ||
| 87 | 0, | ||
| 88 | v2i_crld, | ||
| 89 | i2r_crldp,0, | ||
| 90 | NULL | ||
| 91 | }; | ||
| 92 | |||
| 93 | static STACK_OF(GENERAL_NAME) *gnames_from_sectname(X509V3_CTX *ctx, char *sect) | ||
| 94 | { | ||
| 95 | STACK_OF(CONF_VALUE) *gnsect; | ||
| 96 | STACK_OF(GENERAL_NAME) *gens; | ||
| 97 | if (*sect == '@') | ||
| 98 | gnsect = X509V3_get_section(ctx, sect + 1); | ||
| 99 | else | ||
| 100 | gnsect = X509V3_parse_list(sect); | ||
| 101 | if (!gnsect) | ||
| 102 | { | ||
| 103 | X509V3err(X509V3_F_GNAMES_FROM_SECTNAME, | ||
| 104 | X509V3_R_SECTION_NOT_FOUND); | ||
| 105 | return NULL; | ||
| 106 | } | ||
| 107 | gens = v2i_GENERAL_NAMES(NULL, ctx, gnsect); | ||
| 108 | if (*sect == '@') | ||
| 109 | X509V3_section_free(ctx, gnsect); | ||
| 110 | else | ||
| 111 | sk_CONF_VALUE_pop_free(gnsect, X509V3_conf_free); | ||
| 112 | return gens; | ||
| 113 | } | ||
| 114 | |||
| 115 | static int set_dist_point_name(DIST_POINT_NAME **pdp, X509V3_CTX *ctx, | ||
| 116 | CONF_VALUE *cnf) | ||
| 117 | { | ||
| 118 | STACK_OF(GENERAL_NAME) *fnm = NULL; | ||
| 119 | STACK_OF(X509_NAME_ENTRY) *rnm = NULL; | ||
| 120 | if (!strncmp(cnf->name, "fullname", 9)) | ||
| 121 | { | ||
| 122 | fnm = gnames_from_sectname(ctx, cnf->value); | ||
| 123 | if (!fnm) | ||
| 124 | goto err; | ||
| 125 | } | ||
| 126 | else if (!strcmp(cnf->name, "relativename")) | ||
| 127 | { | ||
| 128 | int ret; | ||
| 129 | STACK_OF(CONF_VALUE) *dnsect; | ||
| 130 | X509_NAME *nm; | ||
| 131 | nm = X509_NAME_new(); | ||
| 132 | if (!nm) | ||
| 133 | return -1; | ||
| 134 | dnsect = X509V3_get_section(ctx, cnf->value); | ||
| 135 | if (!dnsect) | ||
| 136 | { | ||
| 137 | X509V3err(X509V3_F_SET_DIST_POINT_NAME, | ||
| 138 | X509V3_R_SECTION_NOT_FOUND); | ||
| 139 | return -1; | ||
| 140 | } | ||
| 141 | ret = X509V3_NAME_from_section(nm, dnsect, MBSTRING_ASC); | ||
| 142 | X509V3_section_free(ctx, dnsect); | ||
| 143 | rnm = nm->entries; | ||
| 144 | nm->entries = NULL; | ||
| 145 | X509_NAME_free(nm); | ||
| 146 | if (!ret || sk_X509_NAME_ENTRY_num(rnm) <= 0) | ||
| 147 | goto err; | ||
| 148 | /* Since its a name fragment can't have more than one | ||
| 149 | * RDNSequence | ||
| 150 | */ | ||
| 151 | if (sk_X509_NAME_ENTRY_value(rnm, | ||
| 152 | sk_X509_NAME_ENTRY_num(rnm) - 1)->set) | ||
| 153 | { | ||
| 154 | X509V3err(X509V3_F_SET_DIST_POINT_NAME, | ||
| 155 | X509V3_R_INVALID_MULTIPLE_RDNS); | ||
| 156 | goto err; | ||
| 157 | } | ||
| 158 | } | ||
| 159 | else | ||
| 160 | return 0; | ||
| 161 | |||
| 162 | if (*pdp) | ||
| 163 | { | ||
| 164 | X509V3err(X509V3_F_SET_DIST_POINT_NAME, | ||
| 165 | X509V3_R_DISTPOINT_ALREADY_SET); | ||
| 166 | goto err; | ||
| 167 | } | ||
| 168 | |||
| 169 | *pdp = DIST_POINT_NAME_new(); | ||
| 170 | if (!*pdp) | ||
| 171 | goto err; | ||
| 172 | if (fnm) | ||
| 173 | { | ||
| 174 | (*pdp)->type = 0; | ||
| 175 | (*pdp)->name.fullname = fnm; | ||
| 176 | } | ||
| 177 | else | ||
| 178 | { | ||
| 179 | (*pdp)->type = 1; | ||
| 180 | (*pdp)->name.relativename = rnm; | ||
| 181 | } | ||
| 182 | |||
| 183 | return 1; | ||
| 184 | |||
| 185 | err: | ||
| 186 | if (fnm) | ||
| 187 | sk_GENERAL_NAME_pop_free(fnm, GENERAL_NAME_free); | ||
| 188 | if (rnm) | ||
| 189 | sk_X509_NAME_ENTRY_pop_free(rnm, X509_NAME_ENTRY_free); | ||
| 190 | return -1; | ||
| 191 | } | ||
| 192 | |||
| 193 | static const BIT_STRING_BITNAME reason_flags[] = { | ||
| 194 | {0, "Unused", "unused"}, | ||
| 195 | {1, "Key Compromise", "keyCompromise"}, | ||
| 196 | {2, "CA Compromise", "CACompromise"}, | ||
| 197 | {3, "Affiliation Changed", "affiliationChanged"}, | ||
| 198 | {4, "Superseded", "superseded"}, | ||
| 199 | {5, "Cessation Of Operation", "cessationOfOperation"}, | ||
| 200 | {6, "Certificate Hold", "certificateHold"}, | ||
| 201 | {7, "Privilege Withdrawn", "privilegeWithdrawn"}, | ||
| 202 | {8, "AA Compromise", "AACompromise"}, | ||
| 203 | {-1, NULL, NULL} | ||
| 79 | }; | 204 | }; |
| 80 | 205 | ||
| 81 | static STACK_OF(CONF_VALUE) *i2v_crld(X509V3_EXT_METHOD *method, | 206 | static int set_reasons(ASN1_BIT_STRING **preas, char *value) |
| 82 | STACK_OF(DIST_POINT) *crld, STACK_OF(CONF_VALUE) *exts) | 207 | { |
| 83 | { | 208 | STACK_OF(CONF_VALUE) *rsk = NULL; |
| 84 | DIST_POINT *point; | 209 | const BIT_STRING_BITNAME *pbn; |
| 210 | const char *bnam; | ||
| 211 | int i, ret = 0; | ||
| 212 | rsk = X509V3_parse_list(value); | ||
| 213 | if (!rsk) | ||
| 214 | return 0; | ||
| 215 | if (*preas) | ||
| 216 | return 0; | ||
| 217 | for (i = 0; i < sk_CONF_VALUE_num(rsk); i++) | ||
| 218 | { | ||
| 219 | bnam = sk_CONF_VALUE_value(rsk, i)->name; | ||
| 220 | if (!*preas) | ||
| 221 | { | ||
| 222 | *preas = ASN1_BIT_STRING_new(); | ||
| 223 | if (!*preas) | ||
| 224 | goto err; | ||
| 225 | } | ||
| 226 | for (pbn = reason_flags; pbn->lname; pbn++) | ||
| 227 | { | ||
| 228 | if (!strcmp(pbn->sname, bnam)) | ||
| 229 | { | ||
| 230 | if (!ASN1_BIT_STRING_set_bit(*preas, | ||
| 231 | pbn->bitnum, 1)) | ||
| 232 | goto err; | ||
| 233 | break; | ||
| 234 | } | ||
| 235 | } | ||
| 236 | if (!pbn->lname) | ||
| 237 | goto err; | ||
| 238 | } | ||
| 239 | ret = 1; | ||
| 240 | |||
| 241 | err: | ||
| 242 | sk_CONF_VALUE_pop_free(rsk, X509V3_conf_free); | ||
| 243 | return ret; | ||
| 244 | } | ||
| 245 | |||
| 246 | static int print_reasons(BIO *out, const char *rname, | ||
| 247 | ASN1_BIT_STRING *rflags, int indent) | ||
| 248 | { | ||
| 249 | int first = 1; | ||
| 250 | const BIT_STRING_BITNAME *pbn; | ||
| 251 | BIO_printf(out, "%*s%s:\n%*s", indent, "", rname, indent + 2, ""); | ||
| 252 | for (pbn = reason_flags; pbn->lname; pbn++) | ||
| 253 | { | ||
| 254 | if (ASN1_BIT_STRING_get_bit(rflags, pbn->bitnum)) | ||
| 255 | { | ||
| 256 | if (first) | ||
| 257 | first = 0; | ||
| 258 | else | ||
| 259 | BIO_puts(out, ", "); | ||
| 260 | BIO_puts(out, pbn->lname); | ||
| 261 | } | ||
| 262 | } | ||
| 263 | if (first) | ||
| 264 | BIO_puts(out, "<EMPTY>\n"); | ||
| 265 | else | ||
| 266 | BIO_puts(out, "\n"); | ||
| 267 | return 1; | ||
| 268 | } | ||
| 269 | |||
| 270 | static DIST_POINT *crldp_from_section(X509V3_CTX *ctx, | ||
| 271 | STACK_OF(CONF_VALUE) *nval) | ||
| 272 | { | ||
| 85 | int i; | 273 | int i; |
| 86 | for(i = 0; i < sk_DIST_POINT_num(crld); i++) { | 274 | CONF_VALUE *cnf; |
| 87 | point = sk_DIST_POINT_value(crld, i); | 275 | DIST_POINT *point = NULL; |
| 88 | if(point->distpoint) { | 276 | point = DIST_POINT_new(); |
| 89 | if(point->distpoint->type == 0) | 277 | if (!point) |
| 90 | exts = i2v_GENERAL_NAMES(NULL, | 278 | goto err; |
| 91 | point->distpoint->name.fullname, exts); | 279 | for(i = 0; i < sk_CONF_VALUE_num(nval); i++) |
| 92 | else X509V3_add_value("RelativeName","<UNSUPPORTED>", &exts); | 280 | { |
| 281 | int ret; | ||
| 282 | cnf = sk_CONF_VALUE_value(nval, i); | ||
| 283 | ret = set_dist_point_name(&point->distpoint, ctx, cnf); | ||
| 284 | if (ret > 0) | ||
| 285 | continue; | ||
| 286 | if (ret < 0) | ||
| 287 | goto err; | ||
| 288 | if (!strcmp(cnf->name, "reasons")) | ||
| 289 | { | ||
| 290 | if (!set_reasons(&point->reasons, cnf->value)) | ||
| 291 | goto err; | ||
| 292 | } | ||
| 293 | else if (!strcmp(cnf->name, "CRLissuer")) | ||
| 294 | { | ||
| 295 | point->CRLissuer = | ||
| 296 | gnames_from_sectname(ctx, cnf->value); | ||
| 297 | if (!point->CRLissuer) | ||
| 298 | goto err; | ||
| 299 | } | ||
| 93 | } | 300 | } |
| 94 | if(point->reasons) | 301 | |
| 95 | X509V3_add_value("reasons","<UNSUPPORTED>", &exts); | 302 | return point; |
| 96 | if(point->CRLissuer) | 303 | |
| 97 | X509V3_add_value("CRLissuer","<UNSUPPORTED>", &exts); | 304 | |
| 305 | err: | ||
| 306 | if (point) | ||
| 307 | DIST_POINT_free(point); | ||
| 308 | return NULL; | ||
| 98 | } | 309 | } |
| 99 | return exts; | ||
| 100 | } | ||
| 101 | 310 | ||
| 102 | static STACK_OF(DIST_POINT) *v2i_crld(X509V3_EXT_METHOD *method, | 311 | static void *v2i_crld(const X509V3_EXT_METHOD *method, |
| 103 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval) | 312 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval) |
| 104 | { | 313 | { |
| 105 | STACK_OF(DIST_POINT) *crld = NULL; | 314 | STACK_OF(DIST_POINT) *crld = NULL; |
| 106 | GENERAL_NAMES *gens = NULL; | 315 | GENERAL_NAMES *gens = NULL; |
| 107 | GENERAL_NAME *gen = NULL; | 316 | GENERAL_NAME *gen = NULL; |
| @@ -111,19 +320,44 @@ static STACK_OF(DIST_POINT) *v2i_crld(X509V3_EXT_METHOD *method, | |||
| 111 | for(i = 0; i < sk_CONF_VALUE_num(nval); i++) { | 320 | for(i = 0; i < sk_CONF_VALUE_num(nval); i++) { |
| 112 | DIST_POINT *point; | 321 | DIST_POINT *point; |
| 113 | cnf = sk_CONF_VALUE_value(nval, i); | 322 | cnf = sk_CONF_VALUE_value(nval, i); |
| 114 | if(!(gen = v2i_GENERAL_NAME(method, ctx, cnf))) goto err; | 323 | if (!cnf->value) |
| 115 | if(!(gens = GENERAL_NAMES_new())) goto merr; | 324 | { |
| 116 | if(!sk_GENERAL_NAME_push(gens, gen)) goto merr; | 325 | STACK_OF(CONF_VALUE) *dpsect; |
| 117 | gen = NULL; | 326 | dpsect = X509V3_get_section(ctx, cnf->name); |
| 118 | if(!(point = DIST_POINT_new())) goto merr; | 327 | if (!dpsect) |
| 119 | if(!sk_DIST_POINT_push(crld, point)) { | 328 | goto err; |
| 120 | DIST_POINT_free(point); | 329 | point = crldp_from_section(ctx, dpsect); |
| 121 | goto merr; | 330 | X509V3_section_free(ctx, dpsect); |
| 122 | } | 331 | if (!point) |
| 123 | if(!(point->distpoint = DIST_POINT_NAME_new())) goto merr; | 332 | goto err; |
| 124 | point->distpoint->name.fullname = gens; | 333 | if(!sk_DIST_POINT_push(crld, point)) |
| 125 | point->distpoint->type = 0; | 334 | { |
| 126 | gens = NULL; | 335 | DIST_POINT_free(point); |
| 336 | goto merr; | ||
| 337 | } | ||
| 338 | } | ||
| 339 | else | ||
| 340 | { | ||
| 341 | if(!(gen = v2i_GENERAL_NAME(method, ctx, cnf))) | ||
| 342 | goto err; | ||
| 343 | if(!(gens = GENERAL_NAMES_new())) | ||
| 344 | goto merr; | ||
| 345 | if(!sk_GENERAL_NAME_push(gens, gen)) | ||
| 346 | goto merr; | ||
| 347 | gen = NULL; | ||
| 348 | if(!(point = DIST_POINT_new())) | ||
| 349 | goto merr; | ||
| 350 | if(!sk_DIST_POINT_push(crld, point)) | ||
| 351 | { | ||
| 352 | DIST_POINT_free(point); | ||
| 353 | goto merr; | ||
| 354 | } | ||
| 355 | if(!(point->distpoint = DIST_POINT_NAME_new())) | ||
| 356 | goto merr; | ||
| 357 | point->distpoint->name.fullname = gens; | ||
| 358 | point->distpoint->type = 0; | ||
| 359 | gens = NULL; | ||
| 360 | } | ||
| 127 | } | 361 | } |
| 128 | return crld; | 362 | return crld; |
| 129 | 363 | ||
| @@ -139,11 +373,31 @@ static STACK_OF(DIST_POINT) *v2i_crld(X509V3_EXT_METHOD *method, | |||
| 139 | IMPLEMENT_STACK_OF(DIST_POINT) | 373 | IMPLEMENT_STACK_OF(DIST_POINT) |
| 140 | IMPLEMENT_ASN1_SET_OF(DIST_POINT) | 374 | IMPLEMENT_ASN1_SET_OF(DIST_POINT) |
| 141 | 375 | ||
| 376 | static int dpn_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | ||
| 377 | void *exarg) | ||
| 378 | { | ||
| 379 | DIST_POINT_NAME *dpn = (DIST_POINT_NAME *)*pval; | ||
| 380 | |||
| 381 | switch(operation) | ||
| 382 | { | ||
| 383 | case ASN1_OP_NEW_POST: | ||
| 384 | dpn->dpname = NULL; | ||
| 385 | break; | ||
| 386 | |||
| 387 | case ASN1_OP_FREE_POST: | ||
| 388 | if (dpn->dpname) | ||
| 389 | X509_NAME_free(dpn->dpname); | ||
| 390 | break; | ||
| 391 | } | ||
| 392 | return 1; | ||
| 393 | } | ||
| 394 | |||
| 142 | 395 | ||
| 143 | ASN1_CHOICE(DIST_POINT_NAME) = { | 396 | ASN1_CHOICE_cb(DIST_POINT_NAME, dpn_cb) = { |
| 144 | ASN1_IMP_SEQUENCE_OF(DIST_POINT_NAME, name.fullname, GENERAL_NAME, 0), | 397 | ASN1_IMP_SEQUENCE_OF(DIST_POINT_NAME, name.fullname, GENERAL_NAME, 0), |
| 145 | ASN1_IMP_SET_OF(DIST_POINT_NAME, name.relativename, X509_NAME_ENTRY, 1) | 398 | ASN1_IMP_SET_OF(DIST_POINT_NAME, name.relativename, X509_NAME_ENTRY, 1) |
| 146 | } ASN1_CHOICE_END(DIST_POINT_NAME) | 399 | } ASN1_CHOICE_END_cb(DIST_POINT_NAME, DIST_POINT_NAME, type) |
| 400 | |||
| 147 | 401 | ||
| 148 | IMPLEMENT_ASN1_FUNCTIONS(DIST_POINT_NAME) | 402 | IMPLEMENT_ASN1_FUNCTIONS(DIST_POINT_NAME) |
| 149 | 403 | ||
| @@ -160,3 +414,203 @@ ASN1_ITEM_TEMPLATE(CRL_DIST_POINTS) = | |||
| 160 | ASN1_ITEM_TEMPLATE_END(CRL_DIST_POINTS) | 414 | ASN1_ITEM_TEMPLATE_END(CRL_DIST_POINTS) |
| 161 | 415 | ||
| 162 | IMPLEMENT_ASN1_FUNCTIONS(CRL_DIST_POINTS) | 416 | IMPLEMENT_ASN1_FUNCTIONS(CRL_DIST_POINTS) |
| 417 | |||
| 418 | ASN1_SEQUENCE(ISSUING_DIST_POINT) = { | ||
| 419 | ASN1_EXP_OPT(ISSUING_DIST_POINT, distpoint, DIST_POINT_NAME, 0), | ||
| 420 | ASN1_IMP_OPT(ISSUING_DIST_POINT, onlyuser, ASN1_FBOOLEAN, 1), | ||
| 421 | ASN1_IMP_OPT(ISSUING_DIST_POINT, onlyCA, ASN1_FBOOLEAN, 2), | ||
| 422 | ASN1_IMP_OPT(ISSUING_DIST_POINT, onlysomereasons, ASN1_BIT_STRING, 3), | ||
| 423 | ASN1_IMP_OPT(ISSUING_DIST_POINT, indirectCRL, ASN1_FBOOLEAN, 4), | ||
| 424 | ASN1_IMP_OPT(ISSUING_DIST_POINT, onlyattr, ASN1_FBOOLEAN, 5) | ||
| 425 | } ASN1_SEQUENCE_END(ISSUING_DIST_POINT) | ||
| 426 | |||
| 427 | IMPLEMENT_ASN1_FUNCTIONS(ISSUING_DIST_POINT) | ||
| 428 | |||
| 429 | static int i2r_idp(const X509V3_EXT_METHOD *method, void *pidp, BIO *out, | ||
| 430 | int indent); | ||
| 431 | static void *v2i_idp(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | ||
| 432 | STACK_OF(CONF_VALUE) *nval); | ||
| 433 | |||
| 434 | const X509V3_EXT_METHOD v3_idp = | ||
| 435 | { | ||
| 436 | NID_issuing_distribution_point, X509V3_EXT_MULTILINE, | ||
| 437 | ASN1_ITEM_ref(ISSUING_DIST_POINT), | ||
| 438 | 0,0,0,0, | ||
| 439 | 0,0, | ||
| 440 | 0, | ||
| 441 | v2i_idp, | ||
| 442 | i2r_idp,0, | ||
| 443 | NULL | ||
| 444 | }; | ||
| 445 | |||
| 446 | static void *v2i_idp(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | ||
| 447 | STACK_OF(CONF_VALUE) *nval) | ||
| 448 | { | ||
| 449 | ISSUING_DIST_POINT *idp = NULL; | ||
| 450 | CONF_VALUE *cnf; | ||
| 451 | char *name, *val; | ||
| 452 | int i, ret; | ||
| 453 | idp = ISSUING_DIST_POINT_new(); | ||
| 454 | if (!idp) | ||
| 455 | goto merr; | ||
| 456 | for(i = 0; i < sk_CONF_VALUE_num(nval); i++) | ||
| 457 | { | ||
| 458 | cnf = sk_CONF_VALUE_value(nval, i); | ||
| 459 | name = cnf->name; | ||
| 460 | val = cnf->value; | ||
| 461 | ret = set_dist_point_name(&idp->distpoint, ctx, cnf); | ||
| 462 | if (ret > 0) | ||
| 463 | continue; | ||
| 464 | if (ret < 0) | ||
| 465 | goto err; | ||
| 466 | if (!strcmp(name, "onlyuser")) | ||
| 467 | { | ||
| 468 | if (!X509V3_get_value_bool(cnf, &idp->onlyuser)) | ||
| 469 | goto err; | ||
| 470 | } | ||
| 471 | else if (!strcmp(name, "onlyCA")) | ||
| 472 | { | ||
| 473 | if (!X509V3_get_value_bool(cnf, &idp->onlyCA)) | ||
| 474 | goto err; | ||
| 475 | } | ||
| 476 | else if (!strcmp(name, "onlyAA")) | ||
| 477 | { | ||
| 478 | if (!X509V3_get_value_bool(cnf, &idp->onlyattr)) | ||
| 479 | goto err; | ||
| 480 | } | ||
| 481 | else if (!strcmp(name, "indirectCRL")) | ||
| 482 | { | ||
| 483 | if (!X509V3_get_value_bool(cnf, &idp->indirectCRL)) | ||
| 484 | goto err; | ||
| 485 | } | ||
| 486 | else if (!strcmp(name, "onlysomereasons")) | ||
| 487 | { | ||
| 488 | if (!set_reasons(&idp->onlysomereasons, val)) | ||
| 489 | goto err; | ||
| 490 | } | ||
| 491 | else | ||
| 492 | { | ||
| 493 | X509V3err(X509V3_F_V2I_IDP, X509V3_R_INVALID_NAME); | ||
| 494 | X509V3_conf_err(cnf); | ||
| 495 | goto err; | ||
| 496 | } | ||
| 497 | } | ||
| 498 | return idp; | ||
| 499 | |||
| 500 | merr: | ||
| 501 | X509V3err(X509V3_F_V2I_IDP,ERR_R_MALLOC_FAILURE); | ||
| 502 | err: | ||
| 503 | ISSUING_DIST_POINT_free(idp); | ||
| 504 | return NULL; | ||
| 505 | } | ||
| 506 | |||
| 507 | static int print_gens(BIO *out, STACK_OF(GENERAL_NAME) *gens, int indent) | ||
| 508 | { | ||
| 509 | int i; | ||
| 510 | for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) | ||
| 511 | { | ||
| 512 | BIO_printf(out, "%*s", indent + 2, ""); | ||
| 513 | GENERAL_NAME_print(out, sk_GENERAL_NAME_value(gens, i)); | ||
| 514 | BIO_puts(out, "\n"); | ||
| 515 | } | ||
| 516 | return 1; | ||
| 517 | } | ||
| 518 | |||
| 519 | static int print_distpoint(BIO *out, DIST_POINT_NAME *dpn, int indent) | ||
| 520 | { | ||
| 521 | if (dpn->type == 0) | ||
| 522 | { | ||
| 523 | BIO_printf(out, "%*sFull Name:\n", indent, ""); | ||
| 524 | print_gens(out, dpn->name.fullname, indent); | ||
| 525 | } | ||
| 526 | else | ||
| 527 | { | ||
| 528 | X509_NAME ntmp; | ||
| 529 | ntmp.entries = dpn->name.relativename; | ||
| 530 | BIO_printf(out, "%*sRelative Name:\n%*s", | ||
| 531 | indent, "", indent + 2, ""); | ||
| 532 | X509_NAME_print_ex(out, &ntmp, 0, XN_FLAG_ONELINE); | ||
| 533 | BIO_puts(out, "\n"); | ||
| 534 | } | ||
| 535 | return 1; | ||
| 536 | } | ||
| 537 | |||
| 538 | static int i2r_idp(const X509V3_EXT_METHOD *method, void *pidp, BIO *out, | ||
| 539 | int indent) | ||
| 540 | { | ||
| 541 | ISSUING_DIST_POINT *idp = pidp; | ||
| 542 | if (idp->distpoint) | ||
| 543 | print_distpoint(out, idp->distpoint, indent); | ||
| 544 | if (idp->onlyuser > 0) | ||
| 545 | BIO_printf(out, "%*sOnly User Certificates\n", indent, ""); | ||
| 546 | if (idp->onlyCA > 0) | ||
| 547 | BIO_printf(out, "%*sOnly CA Certificates\n", indent, ""); | ||
| 548 | if (idp->indirectCRL > 0) | ||
| 549 | BIO_printf(out, "%*sIndirect CRL\n", indent, ""); | ||
| 550 | if (idp->onlysomereasons) | ||
| 551 | print_reasons(out, "Only Some Reasons", | ||
| 552 | idp->onlysomereasons, indent); | ||
| 553 | if (idp->onlyattr > 0) | ||
| 554 | BIO_printf(out, "%*sOnly Attribute Certificates\n", indent, ""); | ||
| 555 | if (!idp->distpoint && (idp->onlyuser <= 0) && (idp->onlyCA <= 0) | ||
| 556 | && (idp->indirectCRL <= 0) && !idp->onlysomereasons | ||
| 557 | && (idp->onlyattr <= 0)) | ||
| 558 | BIO_printf(out, "%*s<EMPTY>\n", indent, ""); | ||
| 559 | |||
| 560 | return 1; | ||
| 561 | } | ||
| 562 | |||
| 563 | static int i2r_crldp(const X509V3_EXT_METHOD *method, void *pcrldp, BIO *out, | ||
| 564 | int indent) | ||
| 565 | { | ||
| 566 | STACK_OF(DIST_POINT) *crld = pcrldp; | ||
| 567 | DIST_POINT *point; | ||
| 568 | int i; | ||
| 569 | for(i = 0; i < sk_DIST_POINT_num(crld); i++) | ||
| 570 | { | ||
| 571 | BIO_puts(out, "\n"); | ||
| 572 | point = sk_DIST_POINT_value(crld, i); | ||
| 573 | if(point->distpoint) | ||
| 574 | print_distpoint(out, point->distpoint, indent); | ||
| 575 | if(point->reasons) | ||
| 576 | print_reasons(out, "Reasons", point->reasons, | ||
| 577 | indent); | ||
| 578 | if(point->CRLissuer) | ||
| 579 | { | ||
| 580 | BIO_printf(out, "%*sCRL Issuer:\n", indent, ""); | ||
| 581 | print_gens(out, point->CRLissuer, indent); | ||
| 582 | } | ||
| 583 | } | ||
| 584 | return 1; | ||
| 585 | } | ||
| 586 | |||
| 587 | int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname) | ||
| 588 | { | ||
| 589 | int i; | ||
| 590 | STACK_OF(X509_NAME_ENTRY) *frag; | ||
| 591 | X509_NAME_ENTRY *ne; | ||
| 592 | if (!dpn || (dpn->type != 1)) | ||
| 593 | return 1; | ||
| 594 | frag = dpn->name.relativename; | ||
| 595 | dpn->dpname = X509_NAME_dup(iname); | ||
| 596 | if (!dpn->dpname) | ||
| 597 | return 0; | ||
| 598 | for (i = 0; i < sk_X509_NAME_ENTRY_num(frag); i++) | ||
| 599 | { | ||
| 600 | ne = sk_X509_NAME_ENTRY_value(frag, i); | ||
| 601 | if (!X509_NAME_add_entry(dpn->dpname, ne, -1, i ? 0 : 1)) | ||
| 602 | { | ||
| 603 | X509_NAME_free(dpn->dpname); | ||
| 604 | dpn->dpname = NULL; | ||
| 605 | return 0; | ||
| 606 | } | ||
| 607 | } | ||
| 608 | /* generate cached encoding of name */ | ||
| 609 | if (i2d_X509_NAME(dpn->dpname, NULL) < 0) | ||
| 610 | { | ||
| 611 | X509_NAME_free(dpn->dpname); | ||
| 612 | dpn->dpname = NULL; | ||
| 613 | return 0; | ||
| 614 | } | ||
| 615 | return 1; | ||
| 616 | } | ||
diff --git a/src/lib/libcrypto/x509v3/v3_enum.c b/src/lib/libcrypto/x509v3/v3_enum.c index 36576eaa4d..c0575e368d 100644 --- a/src/lib/libcrypto/x509v3/v3_enum.c +++ b/src/lib/libcrypto/x509v3/v3_enum.c | |||
| @@ -61,14 +61,17 @@ | |||
| 61 | #include <openssl/x509v3.h> | 61 | #include <openssl/x509v3.h> |
| 62 | 62 | ||
| 63 | static ENUMERATED_NAMES crl_reasons[] = { | 63 | static ENUMERATED_NAMES crl_reasons[] = { |
| 64 | {0, "Unspecified", "unspecified"}, | 64 | {CRL_REASON_UNSPECIFIED, "Unspecified", "unspecified"}, |
| 65 | {1, "Key Compromise", "keyCompromise"}, | 65 | {CRL_REASON_KEY_COMPROMISE, "Key Compromise", "keyCompromise"}, |
| 66 | {2, "CA Compromise", "CACompromise"}, | 66 | {CRL_REASON_CA_COMPROMISE, "CA Compromise", "CACompromise"}, |
| 67 | {3, "Affiliation Changed", "affiliationChanged"}, | 67 | {CRL_REASON_AFFILIATION_CHANGED, "Affiliation Changed", "affiliationChanged"}, |
| 68 | {4, "Superseded", "superseded"}, | 68 | {CRL_REASON_SUPERSEDED, "Superseded", "superseded"}, |
| 69 | {5, "Cessation Of Operation", "cessationOfOperation"}, | 69 | {CRL_REASON_CESSATION_OF_OPERATION, |
| 70 | {6, "Certificate Hold", "certificateHold"}, | 70 | "Cessation Of Operation", "cessationOfOperation"}, |
| 71 | {8, "Remove From CRL", "removeFromCRL"}, | 71 | {CRL_REASON_CERTIFICATE_HOLD, "Certificate Hold", "certificateHold"}, |
| 72 | {CRL_REASON_REMOVE_FROM_CRL, "Remove From CRL", "removeFromCRL"}, | ||
| 73 | {CRL_REASON_PRIVILEGE_WITHDRAWN, "Privilege Withdrawn", "privilegeWithdrawn"}, | ||
| 74 | {CRL_REASON_AA_COMPROMISE, "AA Compromise", "AACompromise"}, | ||
| 72 | {-1, NULL, NULL} | 75 | {-1, NULL, NULL} |
| 73 | }; | 76 | }; |
| 74 | 77 | ||
diff --git a/src/lib/libcrypto/x509v3/v3_extku.c b/src/lib/libcrypto/x509v3/v3_extku.c index c0d14500ed..1c66532757 100644 --- a/src/lib/libcrypto/x509v3/v3_extku.c +++ b/src/lib/libcrypto/x509v3/v3_extku.c | |||
| @@ -63,9 +63,10 @@ | |||
| 63 | #include <openssl/conf.h> | 63 | #include <openssl/conf.h> |
| 64 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 65 | 65 | ||
| 66 | static void *v2i_EXTENDED_KEY_USAGE(X509V3_EXT_METHOD *method, | 66 | static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method, |
| 67 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); | 67 | X509V3_CTX *ctx, |
| 68 | static STACK_OF(CONF_VALUE) *i2v_EXTENDED_KEY_USAGE(X509V3_EXT_METHOD *method, | 68 | STACK_OF(CONF_VALUE) *nval); |
| 69 | static STACK_OF(CONF_VALUE) *i2v_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method, | ||
| 69 | void *eku, STACK_OF(CONF_VALUE) *extlist); | 70 | void *eku, STACK_OF(CONF_VALUE) *extlist); |
| 70 | 71 | ||
| 71 | const X509V3_EXT_METHOD v3_ext_ku = { | 72 | const X509V3_EXT_METHOD v3_ext_ku = { |
| @@ -97,8 +98,9 @@ ASN1_ITEM_TEMPLATE_END(EXTENDED_KEY_USAGE) | |||
| 97 | 98 | ||
| 98 | IMPLEMENT_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) | 99 | IMPLEMENT_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) |
| 99 | 100 | ||
| 100 | static STACK_OF(CONF_VALUE) *i2v_EXTENDED_KEY_USAGE(X509V3_EXT_METHOD *method, | 101 | static STACK_OF(CONF_VALUE) * |
| 101 | void *a, STACK_OF(CONF_VALUE) *ext_list) | 102 | i2v_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method, void *a, |
| 103 | STACK_OF(CONF_VALUE) *ext_list) | ||
| 102 | { | 104 | { |
| 103 | EXTENDED_KEY_USAGE *eku = a; | 105 | EXTENDED_KEY_USAGE *eku = a; |
| 104 | int i; | 106 | int i; |
| @@ -112,8 +114,8 @@ static STACK_OF(CONF_VALUE) *i2v_EXTENDED_KEY_USAGE(X509V3_EXT_METHOD *method, | |||
| 112 | return ext_list; | 114 | return ext_list; |
| 113 | } | 115 | } |
| 114 | 116 | ||
| 115 | static void *v2i_EXTENDED_KEY_USAGE(X509V3_EXT_METHOD *method, | 117 | static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method, |
| 116 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval) | 118 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval) |
| 117 | { | 119 | { |
| 118 | EXTENDED_KEY_USAGE *extku; | 120 | EXTENDED_KEY_USAGE *extku; |
| 119 | char *extval; | 121 | char *extval; |
diff --git a/src/lib/libcrypto/x509v3/v3_genn.c b/src/lib/libcrypto/x509v3/v3_genn.c index 84b4b1c881..b628357301 100644 --- a/src/lib/libcrypto/x509v3/v3_genn.c +++ b/src/lib/libcrypto/x509v3/v3_genn.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -99,3 +99,154 @@ ASN1_ITEM_TEMPLATE(GENERAL_NAMES) = | |||
| 99 | ASN1_ITEM_TEMPLATE_END(GENERAL_NAMES) | 99 | ASN1_ITEM_TEMPLATE_END(GENERAL_NAMES) |
| 100 | 100 | ||
| 101 | IMPLEMENT_ASN1_FUNCTIONS(GENERAL_NAMES) | 101 | IMPLEMENT_ASN1_FUNCTIONS(GENERAL_NAMES) |
| 102 | |||
| 103 | GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a) | ||
| 104 | { | ||
| 105 | return (GENERAL_NAME *) ASN1_dup((i2d_of_void *) i2d_GENERAL_NAME, | ||
| 106 | (d2i_of_void *) d2i_GENERAL_NAME, | ||
| 107 | (char *) a); | ||
| 108 | } | ||
| 109 | |||
| 110 | /* Returns 0 if they are equal, != 0 otherwise. */ | ||
| 111 | int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b) | ||
| 112 | { | ||
| 113 | int result = -1; | ||
| 114 | |||
| 115 | if (!a || !b || a->type != b->type) return -1; | ||
| 116 | switch(a->type) | ||
| 117 | { | ||
| 118 | case GEN_X400: | ||
| 119 | case GEN_EDIPARTY: | ||
| 120 | result = ASN1_TYPE_cmp(a->d.other, b->d.other); | ||
| 121 | break; | ||
| 122 | |||
| 123 | case GEN_OTHERNAME: | ||
| 124 | result = OTHERNAME_cmp(a->d.otherName, b->d.otherName); | ||
| 125 | break; | ||
| 126 | |||
| 127 | case GEN_EMAIL: | ||
| 128 | case GEN_DNS: | ||
| 129 | case GEN_URI: | ||
| 130 | result = ASN1_STRING_cmp(a->d.ia5, b->d.ia5); | ||
| 131 | break; | ||
| 132 | |||
| 133 | case GEN_DIRNAME: | ||
| 134 | result = X509_NAME_cmp(a->d.dirn, b->d.dirn); | ||
| 135 | break; | ||
| 136 | |||
| 137 | case GEN_IPADD: | ||
| 138 | result = ASN1_OCTET_STRING_cmp(a->d.ip, b->d.ip); | ||
| 139 | break; | ||
| 140 | |||
| 141 | case GEN_RID: | ||
| 142 | result = OBJ_cmp(a->d.rid, b->d.rid); | ||
| 143 | break; | ||
| 144 | } | ||
| 145 | return result; | ||
| 146 | } | ||
| 147 | |||
| 148 | /* Returns 0 if they are equal, != 0 otherwise. */ | ||
| 149 | int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b) | ||
| 150 | { | ||
| 151 | int result = -1; | ||
| 152 | |||
| 153 | if (!a || !b) return -1; | ||
| 154 | /* Check their type first. */ | ||
| 155 | if ((result = OBJ_cmp(a->type_id, b->type_id)) != 0) | ||
| 156 | return result; | ||
| 157 | /* Check the value. */ | ||
| 158 | result = ASN1_TYPE_cmp(a->value, b->value); | ||
| 159 | return result; | ||
| 160 | } | ||
| 161 | |||
| 162 | void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value) | ||
| 163 | { | ||
| 164 | switch(type) | ||
| 165 | { | ||
| 166 | case GEN_X400: | ||
| 167 | case GEN_EDIPARTY: | ||
| 168 | a->d.other = value; | ||
| 169 | break; | ||
| 170 | |||
| 171 | case GEN_OTHERNAME: | ||
| 172 | a->d.otherName = value; | ||
| 173 | break; | ||
| 174 | |||
| 175 | case GEN_EMAIL: | ||
| 176 | case GEN_DNS: | ||
| 177 | case GEN_URI: | ||
| 178 | a->d.ia5 = value; | ||
| 179 | break; | ||
| 180 | |||
| 181 | case GEN_DIRNAME: | ||
| 182 | a->d.dirn = value; | ||
| 183 | break; | ||
| 184 | |||
| 185 | case GEN_IPADD: | ||
| 186 | a->d.ip = value; | ||
| 187 | break; | ||
| 188 | |||
| 189 | case GEN_RID: | ||
| 190 | a->d.rid = value; | ||
| 191 | break; | ||
| 192 | } | ||
| 193 | a->type = type; | ||
| 194 | } | ||
| 195 | |||
| 196 | void *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype) | ||
| 197 | { | ||
| 198 | if (ptype) | ||
| 199 | *ptype = a->type; | ||
| 200 | switch(a->type) | ||
| 201 | { | ||
| 202 | case GEN_X400: | ||
| 203 | case GEN_EDIPARTY: | ||
| 204 | return a->d.other; | ||
| 205 | |||
| 206 | case GEN_OTHERNAME: | ||
| 207 | return a->d.otherName; | ||
| 208 | |||
| 209 | case GEN_EMAIL: | ||
| 210 | case GEN_DNS: | ||
| 211 | case GEN_URI: | ||
| 212 | return a->d.ia5; | ||
| 213 | |||
| 214 | case GEN_DIRNAME: | ||
| 215 | return a->d.dirn; | ||
| 216 | |||
| 217 | case GEN_IPADD: | ||
| 218 | return a->d.ip; | ||
| 219 | |||
| 220 | case GEN_RID: | ||
| 221 | return a->d.rid; | ||
| 222 | |||
| 223 | default: | ||
| 224 | return NULL; | ||
| 225 | } | ||
| 226 | } | ||
| 227 | |||
| 228 | int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, | ||
| 229 | ASN1_OBJECT *oid, ASN1_TYPE *value) | ||
| 230 | { | ||
| 231 | OTHERNAME *oth; | ||
| 232 | oth = OTHERNAME_new(); | ||
| 233 | if (!oth) | ||
| 234 | return 0; | ||
| 235 | oth->type_id = oid; | ||
| 236 | oth->value = value; | ||
| 237 | GENERAL_NAME_set0_value(gen, GEN_OTHERNAME, oth); | ||
| 238 | return 1; | ||
| 239 | } | ||
| 240 | |||
| 241 | int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen, | ||
| 242 | ASN1_OBJECT **poid, ASN1_TYPE **pvalue) | ||
| 243 | { | ||
| 244 | if (gen->type != GEN_OTHERNAME) | ||
| 245 | return 0; | ||
| 246 | if (poid) | ||
| 247 | *poid = gen->d.otherName->type_id; | ||
| 248 | if (pvalue) | ||
| 249 | *pvalue = gen->d.otherName->value; | ||
| 250 | return 1; | ||
| 251 | } | ||
| 252 | |||
diff --git a/src/lib/libcrypto/x509v3/v3_lib.c b/src/lib/libcrypto/x509v3/v3_lib.c index df3a48f43e..0f1e1d4422 100644 --- a/src/lib/libcrypto/x509v3/v3_lib.c +++ b/src/lib/libcrypto/x509v3/v3_lib.c | |||
| @@ -84,20 +84,24 @@ int X509V3_EXT_add(X509V3_EXT_METHOD *ext) | |||
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | static int ext_cmp(const X509V3_EXT_METHOD * const *a, | 86 | static int ext_cmp(const X509V3_EXT_METHOD * const *a, |
| 87 | const X509V3_EXT_METHOD * const *b) | 87 | const X509V3_EXT_METHOD * const *b) |
| 88 | { | 88 | { |
| 89 | return ((*a)->ext_nid - (*b)->ext_nid); | 89 | return ((*a)->ext_nid - (*b)->ext_nid); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid) | 92 | DECLARE_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *, const X509V3_EXT_METHOD *, |
| 93 | ext); | ||
| 94 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *, | ||
| 95 | const X509V3_EXT_METHOD *, ext); | ||
| 96 | |||
| 97 | const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid) | ||
| 93 | { | 98 | { |
| 94 | X509V3_EXT_METHOD tmp, *t = &tmp, **ret; | 99 | X509V3_EXT_METHOD tmp; |
| 100 | const X509V3_EXT_METHOD *t = &tmp, * const *ret; | ||
| 95 | int idx; | 101 | int idx; |
| 96 | if(nid < 0) return NULL; | 102 | if(nid < 0) return NULL; |
| 97 | tmp.ext_nid = nid; | 103 | tmp.ext_nid = nid; |
| 98 | ret = (X509V3_EXT_METHOD **) OBJ_bsearch((char *)&t, | 104 | ret = OBJ_bsearch_ext(&t, standard_exts, STANDARD_EXTENSION_COUNT); |
| 99 | (char *)standard_exts, STANDARD_EXTENSION_COUNT, | ||
| 100 | sizeof(X509V3_EXT_METHOD *), (int (*)(const void *, const void *))ext_cmp); | ||
| 101 | if(ret) return *ret; | 105 | if(ret) return *ret; |
| 102 | if(!ext_list) return NULL; | 106 | if(!ext_list) return NULL; |
| 103 | idx = sk_X509V3_EXT_METHOD_find(ext_list, &tmp); | 107 | idx = sk_X509V3_EXT_METHOD_find(ext_list, &tmp); |
| @@ -105,7 +109,7 @@ X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid) | |||
| 105 | return sk_X509V3_EXT_METHOD_value(ext_list, idx); | 109 | return sk_X509V3_EXT_METHOD_value(ext_list, idx); |
| 106 | } | 110 | } |
| 107 | 111 | ||
| 108 | X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext) | 112 | const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext) |
| 109 | { | 113 | { |
| 110 | int nid; | 114 | int nid; |
| 111 | if((nid = OBJ_obj2nid(ext->object)) == NID_undef) return NULL; | 115 | if((nid = OBJ_obj2nid(ext->object)) == NID_undef) return NULL; |
| @@ -122,7 +126,9 @@ int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist) | |||
| 122 | 126 | ||
| 123 | int X509V3_EXT_add_alias(int nid_to, int nid_from) | 127 | int X509V3_EXT_add_alias(int nid_to, int nid_from) |
| 124 | { | 128 | { |
| 125 | X509V3_EXT_METHOD *ext, *tmpext; | 129 | const X509V3_EXT_METHOD *ext; |
| 130 | X509V3_EXT_METHOD *tmpext; | ||
| 131 | |||
| 126 | if(!(ext = X509V3_EXT_get_nid(nid_from))) { | 132 | if(!(ext = X509V3_EXT_get_nid(nid_from))) { |
| 127 | X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND); | 133 | X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND); |
| 128 | return 0; | 134 | return 0; |
| @@ -161,7 +167,7 @@ int X509V3_add_standard_extensions(void) | |||
| 161 | 167 | ||
| 162 | void *X509V3_EXT_d2i(X509_EXTENSION *ext) | 168 | void *X509V3_EXT_d2i(X509_EXTENSION *ext) |
| 163 | { | 169 | { |
| 164 | X509V3_EXT_METHOD *method; | 170 | const X509V3_EXT_METHOD *method; |
| 165 | const unsigned char *p; | 171 | const unsigned char *p; |
| 166 | 172 | ||
| 167 | if(!(method = X509V3_EXT_get(ext))) return NULL; | 173 | if(!(method = X509V3_EXT_get(ext))) return NULL; |
diff --git a/src/lib/libcrypto/x509v3/v3_ocsp.c b/src/lib/libcrypto/x509v3/v3_ocsp.c index e426ea930c..0c165af314 100644 --- a/src/lib/libcrypto/x509v3/v3_ocsp.c +++ b/src/lib/libcrypto/x509v3/v3_ocsp.c | |||
| @@ -68,19 +68,26 @@ | |||
| 68 | /* OCSP extensions and a couple of CRL entry extensions | 68 | /* OCSP extensions and a couple of CRL entry extensions |
| 69 | */ | 69 | */ |
| 70 | 70 | ||
| 71 | static int i2r_ocsp_crlid(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent); | 71 | static int i2r_ocsp_crlid(const X509V3_EXT_METHOD *method, void *nonce, |
| 72 | static int i2r_ocsp_acutoff(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent); | 72 | BIO *out, int indent); |
| 73 | static int i2r_object(X509V3_EXT_METHOD *method, void *obj, BIO *out, int indent); | 73 | static int i2r_ocsp_acutoff(const X509V3_EXT_METHOD *method, void *nonce, |
| 74 | BIO *out, int indent); | ||
| 75 | static int i2r_object(const X509V3_EXT_METHOD *method, void *obj, BIO *out, | ||
| 76 | int indent); | ||
| 74 | 77 | ||
| 75 | static void *ocsp_nonce_new(void); | 78 | static void *ocsp_nonce_new(void); |
| 76 | static int i2d_ocsp_nonce(void *a, unsigned char **pp); | 79 | static int i2d_ocsp_nonce(void *a, unsigned char **pp); |
| 77 | static void *d2i_ocsp_nonce(void *a, const unsigned char **pp, long length); | 80 | static void *d2i_ocsp_nonce(void *a, const unsigned char **pp, long length); |
| 78 | static void ocsp_nonce_free(void *a); | 81 | static void ocsp_nonce_free(void *a); |
| 79 | static int i2r_ocsp_nonce(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent); | 82 | static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce, |
| 83 | BIO *out, int indent); | ||
| 80 | 84 | ||
| 81 | static int i2r_ocsp_nocheck(X509V3_EXT_METHOD *method, void *nocheck, BIO *out, int indent); | 85 | static int i2r_ocsp_nocheck(const X509V3_EXT_METHOD *method, |
| 82 | static void *s2i_ocsp_nocheck(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, const char *str); | 86 | void *nocheck, BIO *out, int indent); |
| 83 | static int i2r_ocsp_serviceloc(X509V3_EXT_METHOD *method, void *in, BIO *bp, int ind); | 87 | static void *s2i_ocsp_nocheck(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, |
| 88 | const char *str); | ||
| 89 | static int i2r_ocsp_serviceloc(const X509V3_EXT_METHOD *method, void *in, | ||
| 90 | BIO *bp, int ind); | ||
| 84 | 91 | ||
| 85 | const X509V3_EXT_METHOD v3_ocsp_crlid = { | 92 | const X509V3_EXT_METHOD v3_ocsp_crlid = { |
| 86 | NID_id_pkix_OCSP_CrlID, 0, ASN1_ITEM_ref(OCSP_CRLID), | 93 | NID_id_pkix_OCSP_CrlID, 0, ASN1_ITEM_ref(OCSP_CRLID), |
| @@ -148,44 +155,47 @@ const X509V3_EXT_METHOD v3_ocsp_serviceloc = { | |||
| 148 | NULL | 155 | NULL |
| 149 | }; | 156 | }; |
| 150 | 157 | ||
| 151 | static int i2r_ocsp_crlid(X509V3_EXT_METHOD *method, void *in, BIO *bp, int ind) | 158 | static int i2r_ocsp_crlid(const X509V3_EXT_METHOD *method, void *in, BIO *bp, |
| 159 | int ind) | ||
| 152 | { | 160 | { |
| 153 | OCSP_CRLID *a = in; | 161 | OCSP_CRLID *a = in; |
| 154 | if (a->crlUrl) | 162 | if (a->crlUrl) |
| 155 | { | 163 | { |
| 156 | if (!BIO_printf(bp, "%*scrlUrl: ", ind, "")) goto err; | 164 | if (BIO_printf(bp, "%*scrlUrl: ", ind, "") <= 0) goto err; |
| 157 | if (!ASN1_STRING_print(bp, (ASN1_STRING*)a->crlUrl)) goto err; | 165 | if (!ASN1_STRING_print(bp, (ASN1_STRING*)a->crlUrl)) goto err; |
| 158 | if (!BIO_write(bp, "\n", 1)) goto err; | 166 | if (BIO_write(bp, "\n", 1) <= 0) goto err; |
| 159 | } | 167 | } |
| 160 | if (a->crlNum) | 168 | if (a->crlNum) |
| 161 | { | 169 | { |
| 162 | if (!BIO_printf(bp, "%*scrlNum: ", ind, "")) goto err; | 170 | if (BIO_printf(bp, "%*scrlNum: ", ind, "") <= 0) goto err; |
| 163 | if (!i2a_ASN1_INTEGER(bp, a->crlNum)) goto err; | 171 | if (i2a_ASN1_INTEGER(bp, a->crlNum) <= 0) goto err; |
| 164 | if (!BIO_write(bp, "\n", 1)) goto err; | 172 | if (BIO_write(bp, "\n", 1) <= 0) goto err; |
| 165 | } | 173 | } |
| 166 | if (a->crlTime) | 174 | if (a->crlTime) |
| 167 | { | 175 | { |
| 168 | if (!BIO_printf(bp, "%*scrlTime: ", ind, "")) goto err; | 176 | if (BIO_printf(bp, "%*scrlTime: ", ind, "") <= 0) goto err; |
| 169 | if (!ASN1_GENERALIZEDTIME_print(bp, a->crlTime)) goto err; | 177 | if (!ASN1_GENERALIZEDTIME_print(bp, a->crlTime)) goto err; |
| 170 | if (!BIO_write(bp, "\n", 1)) goto err; | 178 | if (BIO_write(bp, "\n", 1) <= 0) goto err; |
| 171 | } | 179 | } |
| 172 | return 1; | 180 | return 1; |
| 173 | err: | 181 | err: |
| 174 | return 0; | 182 | return 0; |
| 175 | } | 183 | } |
| 176 | 184 | ||
| 177 | static int i2r_ocsp_acutoff(X509V3_EXT_METHOD *method, void *cutoff, BIO *bp, int ind) | 185 | static int i2r_ocsp_acutoff(const X509V3_EXT_METHOD *method, void *cutoff, |
| 186 | BIO *bp, int ind) | ||
| 178 | { | 187 | { |
| 179 | if (!BIO_printf(bp, "%*s", ind, "")) return 0; | 188 | if (BIO_printf(bp, "%*s", ind, "") <= 0) return 0; |
| 180 | if(!ASN1_GENERALIZEDTIME_print(bp, cutoff)) return 0; | 189 | if(!ASN1_GENERALIZEDTIME_print(bp, cutoff)) return 0; |
| 181 | return 1; | 190 | return 1; |
| 182 | } | 191 | } |
| 183 | 192 | ||
| 184 | 193 | ||
| 185 | static int i2r_object(X509V3_EXT_METHOD *method, void *oid, BIO *bp, int ind) | 194 | static int i2r_object(const X509V3_EXT_METHOD *method, void *oid, BIO *bp, |
| 195 | int ind) | ||
| 186 | { | 196 | { |
| 187 | if (!BIO_printf(bp, "%*s", ind, "")) return 0; | 197 | if (BIO_printf(bp, "%*s", ind, "") <= 0) return 0; |
| 188 | if(!i2a_ASN1_OBJECT(bp, oid)) return 0; | 198 | if(i2a_ASN1_OBJECT(bp, oid) <= 0) return 0; |
| 189 | return 1; | 199 | return 1; |
| 190 | } | 200 | } |
| 191 | 201 | ||
| @@ -232,7 +242,8 @@ static void ocsp_nonce_free(void *a) | |||
| 232 | M_ASN1_OCTET_STRING_free(a); | 242 | M_ASN1_OCTET_STRING_free(a); |
| 233 | } | 243 | } |
| 234 | 244 | ||
| 235 | static int i2r_ocsp_nonce(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent) | 245 | static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce, |
| 246 | BIO *out, int indent) | ||
| 236 | { | 247 | { |
| 237 | if(BIO_printf(out, "%*s", indent, "") <= 0) return 0; | 248 | if(BIO_printf(out, "%*s", indent, "") <= 0) return 0; |
| 238 | if(i2a_ASN1_STRING(out, nonce, V_ASN1_OCTET_STRING) <= 0) return 0; | 249 | if(i2a_ASN1_STRING(out, nonce, V_ASN1_OCTET_STRING) <= 0) return 0; |
| @@ -241,17 +252,20 @@ static int i2r_ocsp_nonce(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int | |||
| 241 | 252 | ||
| 242 | /* Nocheck is just a single NULL. Don't print anything and always set it */ | 253 | /* Nocheck is just a single NULL. Don't print anything and always set it */ |
| 243 | 254 | ||
| 244 | static int i2r_ocsp_nocheck(X509V3_EXT_METHOD *method, void *nocheck, BIO *out, int indent) | 255 | static int i2r_ocsp_nocheck(const X509V3_EXT_METHOD *method, void *nocheck, |
| 256 | BIO *out, int indent) | ||
| 245 | { | 257 | { |
| 246 | return 1; | 258 | return 1; |
| 247 | } | 259 | } |
| 248 | 260 | ||
| 249 | static void *s2i_ocsp_nocheck(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, const char *str) | 261 | static void *s2i_ocsp_nocheck(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, |
| 262 | const char *str) | ||
| 250 | { | 263 | { |
| 251 | return ASN1_NULL_new(); | 264 | return ASN1_NULL_new(); |
| 252 | } | 265 | } |
| 253 | 266 | ||
| 254 | static int i2r_ocsp_serviceloc(X509V3_EXT_METHOD *method, void *in, BIO *bp, int ind) | 267 | static int i2r_ocsp_serviceloc(const X509V3_EXT_METHOD *method, void *in, |
| 268 | BIO *bp, int ind) | ||
| 255 | { | 269 | { |
| 256 | int i; | 270 | int i; |
| 257 | OCSP_SERVICELOC *a = in; | 271 | OCSP_SERVICELOC *a = in; |
diff --git a/src/lib/libcrypto/x509v3/v3_prn.c b/src/lib/libcrypto/x509v3/v3_prn.c index c1bb17f105..3146218708 100644 --- a/src/lib/libcrypto/x509v3/v3_prn.c +++ b/src/lib/libcrypto/x509v3/v3_prn.c | |||
| @@ -110,7 +110,7 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int inde | |||
| 110 | void *ext_str = NULL; | 110 | void *ext_str = NULL; |
| 111 | char *value = NULL; | 111 | char *value = NULL; |
| 112 | const unsigned char *p; | 112 | const unsigned char *p; |
| 113 | X509V3_EXT_METHOD *method; | 113 | const X509V3_EXT_METHOD *method; |
| 114 | STACK_OF(CONF_VALUE) *nval = NULL; | 114 | STACK_OF(CONF_VALUE) *nval = NULL; |
| 115 | int ok = 1; | 115 | int ok = 1; |
| 116 | 116 | ||
diff --git a/src/lib/libcrypto/x509v3/v3_purp.c b/src/lib/libcrypto/x509v3/v3_purp.c index e18751e01c..181bd34979 100644 --- a/src/lib/libcrypto/x509v3/v3_purp.c +++ b/src/lib/libcrypto/x509v3/v3_purp.c | |||
| @@ -71,6 +71,7 @@ static int purpose_smime(const X509 *x, int ca); | |||
| 71 | static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x, int ca); | 71 | static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x, int ca); |
| 72 | static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 *x, int ca); | 72 | static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 *x, int ca); |
| 73 | static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, int ca); | 73 | static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, int ca); |
| 74 | static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x, int ca); | ||
| 74 | static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca); | 75 | static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca); |
| 75 | static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca); | 76 | static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca); |
| 76 | 77 | ||
| @@ -87,6 +88,7 @@ static X509_PURPOSE xstandard[] = { | |||
| 87 | {X509_PURPOSE_CRL_SIGN, X509_TRUST_COMPAT, 0, check_purpose_crl_sign, "CRL signing", "crlsign", NULL}, | 88 | {X509_PURPOSE_CRL_SIGN, X509_TRUST_COMPAT, 0, check_purpose_crl_sign, "CRL signing", "crlsign", NULL}, |
| 88 | {X509_PURPOSE_ANY, X509_TRUST_DEFAULT, 0, no_check, "Any Purpose", "any", NULL}, | 89 | {X509_PURPOSE_ANY, X509_TRUST_DEFAULT, 0, no_check, "Any Purpose", "any", NULL}, |
| 89 | {X509_PURPOSE_OCSP_HELPER, X509_TRUST_COMPAT, 0, ocsp_helper, "OCSP helper", "ocsphelper", NULL}, | 90 | {X509_PURPOSE_OCSP_HELPER, X509_TRUST_COMPAT, 0, ocsp_helper, "OCSP helper", "ocsphelper", NULL}, |
| 91 | {X509_PURPOSE_TIMESTAMP_SIGN, X509_TRUST_TSA, 0, check_purpose_timestamp_sign, "Time Stamp signing", "timestampsign", NULL}, | ||
| 90 | }; | 92 | }; |
| 91 | 93 | ||
| 92 | #define X509_PURPOSE_COUNT (sizeof(xstandard)/sizeof(X509_PURPOSE)) | 94 | #define X509_PURPOSE_COUNT (sizeof(xstandard)/sizeof(X509_PURPOSE)) |
| @@ -265,11 +267,14 @@ int X509_PURPOSE_get_trust(X509_PURPOSE *xp) | |||
| 265 | return xp->trust; | 267 | return xp->trust; |
| 266 | } | 268 | } |
| 267 | 269 | ||
| 268 | static int nid_cmp(int *a, int *b) | 270 | static int nid_cmp(const int *a, const int *b) |
| 269 | { | 271 | { |
| 270 | return *a - *b; | 272 | return *a - *b; |
| 271 | } | 273 | } |
| 272 | 274 | ||
| 275 | DECLARE_OBJ_BSEARCH_CMP_FN(int, int, nid); | ||
| 276 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(int, int, nid); | ||
| 277 | |||
| 273 | int X509_supported_extension(X509_EXTENSION *ex) | 278 | int X509_supported_extension(X509_EXTENSION *ex) |
| 274 | { | 279 | { |
| 275 | /* This table is a list of the NIDs of supported extensions: | 280 | /* This table is a list of the NIDs of supported extensions: |
| @@ -280,7 +285,7 @@ int X509_supported_extension(X509_EXTENSION *ex) | |||
| 280 | * searched using bsearch. | 285 | * searched using bsearch. |
| 281 | */ | 286 | */ |
| 282 | 287 | ||
| 283 | static int supported_nids[] = { | 288 | static const int supported_nids[] = { |
| 284 | NID_netscape_cert_type, /* 71 */ | 289 | NID_netscape_cert_type, /* 71 */ |
| 285 | NID_key_usage, /* 83 */ | 290 | NID_key_usage, /* 83 */ |
| 286 | NID_subject_alt_name, /* 85 */ | 291 | NID_subject_alt_name, /* 85 */ |
| @@ -292,24 +297,62 @@ int X509_supported_extension(X509_EXTENSION *ex) | |||
| 292 | NID_sbgp_autonomousSysNum, /* 291 */ | 297 | NID_sbgp_autonomousSysNum, /* 291 */ |
| 293 | #endif | 298 | #endif |
| 294 | NID_policy_constraints, /* 401 */ | 299 | NID_policy_constraints, /* 401 */ |
| 295 | NID_proxyCertInfo, /* 661 */ | 300 | NID_proxyCertInfo, /* 663 */ |
| 301 | NID_name_constraints, /* 666 */ | ||
| 302 | NID_policy_mappings, /* 747 */ | ||
| 296 | NID_inhibit_any_policy /* 748 */ | 303 | NID_inhibit_any_policy /* 748 */ |
| 297 | }; | 304 | }; |
| 298 | 305 | ||
| 299 | int ex_nid; | 306 | int ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex)); |
| 300 | |||
| 301 | ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex)); | ||
| 302 | 307 | ||
| 303 | if (ex_nid == NID_undef) | 308 | if (ex_nid == NID_undef) |
| 304 | return 0; | 309 | return 0; |
| 305 | 310 | ||
| 306 | if (OBJ_bsearch((char *)&ex_nid, (char *)supported_nids, | 311 | if (OBJ_bsearch_nid(&ex_nid, supported_nids, |
| 307 | sizeof(supported_nids)/sizeof(int), sizeof(int), | 312 | sizeof(supported_nids)/sizeof(int))) |
| 308 | (int (*)(const void *, const void *))nid_cmp)) | ||
| 309 | return 1; | 313 | return 1; |
| 310 | return 0; | 314 | return 0; |
| 311 | } | 315 | } |
| 312 | 316 | ||
| 317 | static void setup_dp(X509 *x, DIST_POINT *dp) | ||
| 318 | { | ||
| 319 | X509_NAME *iname = NULL; | ||
| 320 | int i; | ||
| 321 | if (dp->reasons) | ||
| 322 | { | ||
| 323 | if (dp->reasons->length > 0) | ||
| 324 | dp->dp_reasons = dp->reasons->data[0]; | ||
| 325 | if (dp->reasons->length > 1) | ||
| 326 | dp->dp_reasons |= (dp->reasons->data[1] << 8); | ||
| 327 | dp->dp_reasons &= CRLDP_ALL_REASONS; | ||
| 328 | } | ||
| 329 | else | ||
| 330 | dp->dp_reasons = CRLDP_ALL_REASONS; | ||
| 331 | if (!dp->distpoint || (dp->distpoint->type != 1)) | ||
| 332 | return; | ||
| 333 | for (i = 0; i < sk_GENERAL_NAME_num(dp->CRLissuer); i++) | ||
| 334 | { | ||
| 335 | GENERAL_NAME *gen = sk_GENERAL_NAME_value(dp->CRLissuer, i); | ||
| 336 | if (gen->type == GEN_DIRNAME) | ||
| 337 | { | ||
| 338 | iname = gen->d.directoryName; | ||
| 339 | break; | ||
| 340 | } | ||
| 341 | } | ||
| 342 | if (!iname) | ||
| 343 | iname = X509_get_issuer_name(x); | ||
| 344 | |||
| 345 | DIST_POINT_set_dpname(dp->distpoint, iname); | ||
| 346 | |||
| 347 | } | ||
| 348 | |||
| 349 | static void setup_crldp(X509 *x) | ||
| 350 | { | ||
| 351 | int i; | ||
| 352 | x->crldp = X509_get_ext_d2i(x, NID_crl_distribution_points, NULL, NULL); | ||
| 353 | for (i = 0; i < sk_DIST_POINT_num(x->crldp); i++) | ||
| 354 | setup_dp(x, sk_DIST_POINT_value(x->crldp, i)); | ||
| 355 | } | ||
| 313 | 356 | ||
| 314 | static void x509v3_cache_extensions(X509 *x) | 357 | static void x509v3_cache_extensions(X509 *x) |
| 315 | { | 358 | { |
| @@ -417,16 +460,25 @@ static void x509v3_cache_extensions(X509 *x) | |||
| 417 | } | 460 | } |
| 418 | x->skid =X509_get_ext_d2i(x, NID_subject_key_identifier, NULL, NULL); | 461 | x->skid =X509_get_ext_d2i(x, NID_subject_key_identifier, NULL, NULL); |
| 419 | x->akid =X509_get_ext_d2i(x, NID_authority_key_identifier, NULL, NULL); | 462 | x->akid =X509_get_ext_d2i(x, NID_authority_key_identifier, NULL, NULL); |
| 463 | x->altname = X509_get_ext_d2i(x, NID_subject_alt_name, NULL, NULL); | ||
| 464 | x->nc = X509_get_ext_d2i(x, NID_name_constraints, &i, NULL); | ||
| 465 | if (!x->nc && (i != -1)) | ||
| 466 | x->ex_flags |= EXFLAG_INVALID; | ||
| 467 | setup_crldp(x); | ||
| 468 | |||
| 420 | #ifndef OPENSSL_NO_RFC3779 | 469 | #ifndef OPENSSL_NO_RFC3779 |
| 421 | x->rfc3779_addr =X509_get_ext_d2i(x, NID_sbgp_ipAddrBlock, NULL, NULL); | 470 | x->rfc3779_addr =X509_get_ext_d2i(x, NID_sbgp_ipAddrBlock, NULL, NULL); |
| 422 | x->rfc3779_asid =X509_get_ext_d2i(x, NID_sbgp_autonomousSysNum, | 471 | x->rfc3779_asid =X509_get_ext_d2i(x, NID_sbgp_autonomousSysNum, |
| 423 | NULL, NULL); | 472 | NULL, NULL); |
| 424 | #endif | 473 | #endif |
| 425 | for (i = 0; i < X509_get_ext_count(x); i++) | 474 | for (i = 0; i < X509_get_ext_count(x); i++) |
| 426 | { | 475 | { |
| 427 | ex = X509_get_ext(x, i); | 476 | ex = X509_get_ext(x, i); |
| 428 | if (!X509_EXTENSION_get_critical(ex)) | 477 | if (!X509_EXTENSION_get_critical(ex)) |
| 429 | continue; | 478 | continue; |
| 479 | if (OBJ_obj2nid(X509_EXTENSION_get_object(ex)) | ||
| 480 | == NID_freshest_crl) | ||
| 481 | x->ex_flags |= EXFLAG_FRESHEST; | ||
| 430 | if (!X509_supported_extension(ex)) | 482 | if (!X509_supported_extension(ex)) |
| 431 | { | 483 | { |
| 432 | x->ex_flags |= EXFLAG_CRITICAL; | 484 | x->ex_flags |= EXFLAG_CRITICAL; |
| @@ -594,6 +646,41 @@ static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca) | |||
| 594 | return 1; | 646 | return 1; |
| 595 | } | 647 | } |
| 596 | 648 | ||
| 649 | static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x, | ||
| 650 | int ca) | ||
| 651 | { | ||
| 652 | int i_ext; | ||
| 653 | |||
| 654 | /* If ca is true we must return if this is a valid CA certificate. */ | ||
| 655 | if (ca) return check_ca(x); | ||
| 656 | |||
| 657 | /* | ||
| 658 | * Check the optional key usage field: | ||
| 659 | * if Key Usage is present, it must be one of digitalSignature | ||
| 660 | * and/or nonRepudiation (other values are not consistent and shall | ||
| 661 | * be rejected). | ||
| 662 | */ | ||
| 663 | if ((x->ex_flags & EXFLAG_KUSAGE) | ||
| 664 | && ((x->ex_kusage & ~(KU_NON_REPUDIATION | KU_DIGITAL_SIGNATURE)) || | ||
| 665 | !(x->ex_kusage & (KU_NON_REPUDIATION | KU_DIGITAL_SIGNATURE)))) | ||
| 666 | return 0; | ||
| 667 | |||
| 668 | /* Only time stamp key usage is permitted and it's required. */ | ||
| 669 | if (!(x->ex_flags & EXFLAG_XKUSAGE) || x->ex_xkusage != XKU_TIMESTAMP) | ||
| 670 | return 0; | ||
| 671 | |||
| 672 | /* Extended Key Usage MUST be critical */ | ||
| 673 | i_ext = X509_get_ext_by_NID((X509 *) x, NID_ext_key_usage, 0); | ||
| 674 | if (i_ext >= 0) | ||
| 675 | { | ||
| 676 | X509_EXTENSION *ext = X509_get_ext((X509 *) x, i_ext); | ||
| 677 | if (!X509_EXTENSION_get_critical(ext)) | ||
| 678 | return 0; | ||
| 679 | } | ||
| 680 | |||
| 681 | return 1; | ||
| 682 | } | ||
| 683 | |||
| 597 | static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca) | 684 | static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca) |
| 598 | { | 685 | { |
| 599 | return 1; | 686 | return 1; |
| @@ -618,39 +705,14 @@ int X509_check_issued(X509 *issuer, X509 *subject) | |||
| 618 | return X509_V_ERR_SUBJECT_ISSUER_MISMATCH; | 705 | return X509_V_ERR_SUBJECT_ISSUER_MISMATCH; |
| 619 | x509v3_cache_extensions(issuer); | 706 | x509v3_cache_extensions(issuer); |
| 620 | x509v3_cache_extensions(subject); | 707 | x509v3_cache_extensions(subject); |
| 621 | if(subject->akid) { | 708 | |
| 622 | /* Check key ids (if present) */ | 709 | if(subject->akid) |
| 623 | if(subject->akid->keyid && issuer->skid && | 710 | { |
| 624 | ASN1_OCTET_STRING_cmp(subject->akid->keyid, issuer->skid) ) | 711 | int ret = X509_check_akid(issuer, subject->akid); |
| 625 | return X509_V_ERR_AKID_SKID_MISMATCH; | 712 | if (ret != X509_V_OK) |
| 626 | /* Check serial number */ | 713 | return ret; |
| 627 | if(subject->akid->serial && | ||
| 628 | ASN1_INTEGER_cmp(X509_get_serialNumber(issuer), | ||
| 629 | subject->akid->serial)) | ||
| 630 | return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH; | ||
| 631 | /* Check issuer name */ | ||
| 632 | if(subject->akid->issuer) { | ||
| 633 | /* Ugh, for some peculiar reason AKID includes | ||
| 634 | * SEQUENCE OF GeneralName. So look for a DirName. | ||
| 635 | * There may be more than one but we only take any | ||
| 636 | * notice of the first. | ||
| 637 | */ | ||
| 638 | GENERAL_NAMES *gens; | ||
| 639 | GENERAL_NAME *gen; | ||
| 640 | X509_NAME *nm = NULL; | ||
| 641 | int i; | ||
| 642 | gens = subject->akid->issuer; | ||
| 643 | for(i = 0; i < sk_GENERAL_NAME_num(gens); i++) { | ||
| 644 | gen = sk_GENERAL_NAME_value(gens, i); | ||
| 645 | if(gen->type == GEN_DIRNAME) { | ||
| 646 | nm = gen->d.dirn; | ||
| 647 | break; | ||
| 648 | } | ||
| 649 | } | ||
| 650 | if(nm && X509_NAME_cmp(nm, X509_get_issuer_name(issuer))) | ||
| 651 | return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH; | ||
| 652 | } | 714 | } |
| 653 | } | 715 | |
| 654 | if(subject->ex_flags & EXFLAG_PROXY) | 716 | if(subject->ex_flags & EXFLAG_PROXY) |
| 655 | { | 717 | { |
| 656 | if(ku_reject(issuer, KU_DIGITAL_SIGNATURE)) | 718 | if(ku_reject(issuer, KU_DIGITAL_SIGNATURE)) |
| @@ -661,3 +723,45 @@ int X509_check_issued(X509 *issuer, X509 *subject) | |||
| 661 | return X509_V_OK; | 723 | return X509_V_OK; |
| 662 | } | 724 | } |
| 663 | 725 | ||
| 726 | int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid) | ||
| 727 | { | ||
| 728 | |||
| 729 | if(!akid) | ||
| 730 | return X509_V_OK; | ||
| 731 | |||
| 732 | /* Check key ids (if present) */ | ||
| 733 | if(akid->keyid && issuer->skid && | ||
| 734 | ASN1_OCTET_STRING_cmp(akid->keyid, issuer->skid) ) | ||
| 735 | return X509_V_ERR_AKID_SKID_MISMATCH; | ||
| 736 | /* Check serial number */ | ||
| 737 | if(akid->serial && | ||
| 738 | ASN1_INTEGER_cmp(X509_get_serialNumber(issuer), akid->serial)) | ||
| 739 | return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH; | ||
| 740 | /* Check issuer name */ | ||
| 741 | if(akid->issuer) | ||
| 742 | { | ||
| 743 | /* Ugh, for some peculiar reason AKID includes | ||
| 744 | * SEQUENCE OF GeneralName. So look for a DirName. | ||
| 745 | * There may be more than one but we only take any | ||
| 746 | * notice of the first. | ||
| 747 | */ | ||
| 748 | GENERAL_NAMES *gens; | ||
| 749 | GENERAL_NAME *gen; | ||
| 750 | X509_NAME *nm = NULL; | ||
| 751 | int i; | ||
| 752 | gens = akid->issuer; | ||
| 753 | for(i = 0; i < sk_GENERAL_NAME_num(gens); i++) | ||
| 754 | { | ||
| 755 | gen = sk_GENERAL_NAME_value(gens, i); | ||
| 756 | if(gen->type == GEN_DIRNAME) | ||
| 757 | { | ||
| 758 | nm = gen->d.dirn; | ||
| 759 | break; | ||
| 760 | } | ||
| 761 | } | ||
| 762 | if(nm && X509_NAME_cmp(nm, X509_get_issuer_name(issuer))) | ||
| 763 | return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH; | ||
| 764 | } | ||
| 765 | return X509_V_OK; | ||
| 766 | } | ||
| 767 | |||
diff --git a/src/lib/libcrypto/x509v3/v3_utl.c b/src/lib/libcrypto/x509v3/v3_utl.c index 2cb53008e3..e030234540 100644 --- a/src/lib/libcrypto/x509v3/v3_utl.c +++ b/src/lib/libcrypto/x509v3/v3_utl.c | |||
| @@ -67,9 +67,9 @@ | |||
| 67 | 67 | ||
| 68 | static char *strip_spaces(char *name); | 68 | static char *strip_spaces(char *name); |
| 69 | static int sk_strcmp(const char * const *a, const char * const *b); | 69 | static int sk_strcmp(const char * const *a, const char * const *b); |
| 70 | static STACK *get_email(X509_NAME *name, GENERAL_NAMES *gens); | 70 | static STACK_OF(OPENSSL_STRING) *get_email(X509_NAME *name, GENERAL_NAMES *gens); |
| 71 | static void str_free(void *str); | 71 | static void str_free(OPENSSL_STRING str); |
| 72 | static int append_ia5(STACK **sk, ASN1_IA5STRING *email); | 72 | static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email); |
| 73 | 73 | ||
| 74 | static int ipv4_from_asc(unsigned char *v4, const char *in); | 74 | static int ipv4_from_asc(unsigned char *v4, const char *in); |
| 75 | static int ipv6_from_asc(unsigned char *v6, const char *in); | 75 | static int ipv6_from_asc(unsigned char *v6, const char *in); |
| @@ -344,7 +344,7 @@ static char *strip_spaces(char *name) | |||
| 344 | char *p, *q; | 344 | char *p, *q; |
| 345 | /* Skip over leading spaces */ | 345 | /* Skip over leading spaces */ |
| 346 | p = name; | 346 | p = name; |
| 347 | while(isspace((unsigned char)*p)) p++; | 347 | while(*p && isspace((unsigned char)*p)) p++; |
| 348 | if(!*p) return NULL; | 348 | if(!*p) return NULL; |
| 349 | q = p + strlen(p) - 1; | 349 | q = p + strlen(p) - 1; |
| 350 | while((q != p) && isspace((unsigned char)*q)) q--; | 350 | while((q != p) && isspace((unsigned char)*q)) q--; |
| @@ -360,10 +360,10 @@ static char *strip_spaces(char *name) | |||
| 360 | * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines) | 360 | * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines) |
| 361 | */ | 361 | */ |
| 362 | 362 | ||
| 363 | char *hex_to_string(unsigned char *buffer, long len) | 363 | char *hex_to_string(const unsigned char *buffer, long len) |
| 364 | { | 364 | { |
| 365 | char *tmp, *q; | 365 | char *tmp, *q; |
| 366 | unsigned char *p; | 366 | const unsigned char *p; |
| 367 | int i; | 367 | int i; |
| 368 | const static char hexdig[] = "0123456789ABCDEF"; | 368 | const static char hexdig[] = "0123456789ABCDEF"; |
| 369 | if(!buffer || !len) return NULL; | 369 | if(!buffer || !len) return NULL; |
| @@ -389,7 +389,7 @@ char *hex_to_string(unsigned char *buffer, long len) | |||
| 389 | * a buffer | 389 | * a buffer |
| 390 | */ | 390 | */ |
| 391 | 391 | ||
| 392 | unsigned char *string_to_hex(char *str, long *len) | 392 | unsigned char *string_to_hex(const char *str, long *len) |
| 393 | { | 393 | { |
| 394 | unsigned char *hexbuf, *q; | 394 | unsigned char *hexbuf, *q; |
| 395 | unsigned char ch, cl, *p; | 395 | unsigned char ch, cl, *p; |
| @@ -463,21 +463,23 @@ static int sk_strcmp(const char * const *a, const char * const *b) | |||
| 463 | return strcmp(*a, *b); | 463 | return strcmp(*a, *b); |
| 464 | } | 464 | } |
| 465 | 465 | ||
| 466 | STACK *X509_get1_email(X509 *x) | 466 | STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x) |
| 467 | { | 467 | { |
| 468 | GENERAL_NAMES *gens; | 468 | GENERAL_NAMES *gens; |
| 469 | STACK *ret; | 469 | STACK_OF(OPENSSL_STRING) *ret; |
| 470 | |||
| 470 | gens = X509_get_ext_d2i(x, NID_subject_alt_name, NULL, NULL); | 471 | gens = X509_get_ext_d2i(x, NID_subject_alt_name, NULL, NULL); |
| 471 | ret = get_email(X509_get_subject_name(x), gens); | 472 | ret = get_email(X509_get_subject_name(x), gens); |
| 472 | sk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free); | 473 | sk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free); |
| 473 | return ret; | 474 | return ret; |
| 474 | } | 475 | } |
| 475 | 476 | ||
| 476 | STACK *X509_get1_ocsp(X509 *x) | 477 | STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x) |
| 477 | { | 478 | { |
| 478 | AUTHORITY_INFO_ACCESS *info; | 479 | AUTHORITY_INFO_ACCESS *info; |
| 479 | STACK *ret = NULL; | 480 | STACK_OF(OPENSSL_STRING) *ret = NULL; |
| 480 | int i; | 481 | int i; |
| 482 | |||
| 481 | info = X509_get_ext_d2i(x, NID_info_access, NULL, NULL); | 483 | info = X509_get_ext_d2i(x, NID_info_access, NULL, NULL); |
| 482 | if (!info) | 484 | if (!info) |
| 483 | return NULL; | 485 | return NULL; |
| @@ -497,11 +499,12 @@ STACK *X509_get1_ocsp(X509 *x) | |||
| 497 | return ret; | 499 | return ret; |
| 498 | } | 500 | } |
| 499 | 501 | ||
| 500 | STACK *X509_REQ_get1_email(X509_REQ *x) | 502 | STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x) |
| 501 | { | 503 | { |
| 502 | GENERAL_NAMES *gens; | 504 | GENERAL_NAMES *gens; |
| 503 | STACK_OF(X509_EXTENSION) *exts; | 505 | STACK_OF(X509_EXTENSION) *exts; |
| 504 | STACK *ret; | 506 | STACK_OF(OPENSSL_STRING) *ret; |
| 507 | |||
| 505 | exts = X509_REQ_get_extensions(x); | 508 | exts = X509_REQ_get_extensions(x); |
| 506 | gens = X509V3_get_d2i(exts, NID_subject_alt_name, NULL, NULL); | 509 | gens = X509V3_get_d2i(exts, NID_subject_alt_name, NULL, NULL); |
| 507 | ret = get_email(X509_REQ_get_subject_name(x), gens); | 510 | ret = get_email(X509_REQ_get_subject_name(x), gens); |
| @@ -511,9 +514,9 @@ STACK *X509_REQ_get1_email(X509_REQ *x) | |||
| 511 | } | 514 | } |
| 512 | 515 | ||
| 513 | 516 | ||
| 514 | static STACK *get_email(X509_NAME *name, GENERAL_NAMES *gens) | 517 | static STACK_OF(OPENSSL_STRING) *get_email(X509_NAME *name, GENERAL_NAMES *gens) |
| 515 | { | 518 | { |
| 516 | STACK *ret = NULL; | 519 | STACK_OF(OPENSSL_STRING) *ret = NULL; |
| 517 | X509_NAME_ENTRY *ne; | 520 | X509_NAME_ENTRY *ne; |
| 518 | ASN1_IA5STRING *email; | 521 | ASN1_IA5STRING *email; |
| 519 | GENERAL_NAME *gen; | 522 | GENERAL_NAME *gen; |
| @@ -536,23 +539,23 @@ static STACK *get_email(X509_NAME *name, GENERAL_NAMES *gens) | |||
| 536 | return ret; | 539 | return ret; |
| 537 | } | 540 | } |
| 538 | 541 | ||
| 539 | static void str_free(void *str) | 542 | static void str_free(OPENSSL_STRING str) |
| 540 | { | 543 | { |
| 541 | OPENSSL_free(str); | 544 | OPENSSL_free(str); |
| 542 | } | 545 | } |
| 543 | 546 | ||
| 544 | static int append_ia5(STACK **sk, ASN1_IA5STRING *email) | 547 | static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email) |
| 545 | { | 548 | { |
| 546 | char *emtmp; | 549 | char *emtmp; |
| 547 | /* First some sanity checks */ | 550 | /* First some sanity checks */ |
| 548 | if(email->type != V_ASN1_IA5STRING) return 1; | 551 | if(email->type != V_ASN1_IA5STRING) return 1; |
| 549 | if(!email->data || !email->length) return 1; | 552 | if(!email->data || !email->length) return 1; |
| 550 | if(!*sk) *sk = sk_new(sk_strcmp); | 553 | if(!*sk) *sk = sk_OPENSSL_STRING_new(sk_strcmp); |
| 551 | if(!*sk) return 0; | 554 | if(!*sk) return 0; |
| 552 | /* Don't add duplicates */ | 555 | /* Don't add duplicates */ |
| 553 | if(sk_find(*sk, (char *)email->data) != -1) return 1; | 556 | if(sk_OPENSSL_STRING_find(*sk, (char *)email->data) != -1) return 1; |
| 554 | emtmp = BUF_strdup((char *)email->data); | 557 | emtmp = BUF_strdup((char *)email->data); |
| 555 | if(!emtmp || !sk_push(*sk, emtmp)) { | 558 | if(!emtmp || !sk_OPENSSL_STRING_push(*sk, emtmp)) { |
| 556 | X509_email_free(*sk); | 559 | X509_email_free(*sk); |
| 557 | *sk = NULL; | 560 | *sk = NULL; |
| 558 | return 0; | 561 | return 0; |
| @@ -560,9 +563,9 @@ static int append_ia5(STACK **sk, ASN1_IA5STRING *email) | |||
| 560 | return 1; | 563 | return 1; |
| 561 | } | 564 | } |
| 562 | 565 | ||
| 563 | void X509_email_free(STACK *sk) | 566 | void X509_email_free(STACK_OF(OPENSSL_STRING) *sk) |
| 564 | { | 567 | { |
| 565 | sk_pop_free(sk, str_free); | 568 | sk_OPENSSL_STRING_pop_free(sk, str_free); |
| 566 | } | 569 | } |
| 567 | 570 | ||
| 568 | /* Convert IP addresses both IPv4 and IPv6 into an | 571 | /* Convert IP addresses both IPv4 and IPv6 into an |
diff --git a/src/lib/libcrypto/x509v3/v3err.c b/src/lib/libcrypto/x509v3/v3err.c index d538ad8b80..f9f6f1f91f 100644 --- a/src/lib/libcrypto/x509v3/v3err.c +++ b/src/lib/libcrypto/x509v3/v3err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/x509v3/v3err.c */ | 1 | /* crypto/x509v3/v3err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -70,6 +70,7 @@ | |||
| 70 | 70 | ||
| 71 | static ERR_STRING_DATA X509V3_str_functs[]= | 71 | static ERR_STRING_DATA X509V3_str_functs[]= |
| 72 | { | 72 | { |
| 73 | {ERR_FUNC(X509V3_F_A2I_GENERAL_NAME), "A2I_GENERAL_NAME"}, | ||
| 73 | {ERR_FUNC(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE), "ASIDENTIFIERCHOICE_CANONIZE"}, | 74 | {ERR_FUNC(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE), "ASIDENTIFIERCHOICE_CANONIZE"}, |
| 74 | {ERR_FUNC(X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL), "ASIDENTIFIERCHOICE_IS_CANONICAL"}, | 75 | {ERR_FUNC(X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL), "ASIDENTIFIERCHOICE_IS_CANONICAL"}, |
| 75 | {ERR_FUNC(X509V3_F_COPY_EMAIL), "COPY_EMAIL"}, | 76 | {ERR_FUNC(X509V3_F_COPY_EMAIL), "COPY_EMAIL"}, |
| @@ -79,6 +80,7 @@ static ERR_STRING_DATA X509V3_str_functs[]= | |||
| 79 | {ERR_FUNC(X509V3_F_DO_EXT_I2D), "DO_EXT_I2D"}, | 80 | {ERR_FUNC(X509V3_F_DO_EXT_I2D), "DO_EXT_I2D"}, |
| 80 | {ERR_FUNC(X509V3_F_DO_EXT_NCONF), "DO_EXT_NCONF"}, | 81 | {ERR_FUNC(X509V3_F_DO_EXT_NCONF), "DO_EXT_NCONF"}, |
| 81 | {ERR_FUNC(X509V3_F_DO_I2V_NAME_CONSTRAINTS), "DO_I2V_NAME_CONSTRAINTS"}, | 82 | {ERR_FUNC(X509V3_F_DO_I2V_NAME_CONSTRAINTS), "DO_I2V_NAME_CONSTRAINTS"}, |
| 83 | {ERR_FUNC(X509V3_F_GNAMES_FROM_SECTNAME), "GNAMES_FROM_SECTNAME"}, | ||
| 82 | {ERR_FUNC(X509V3_F_HEX_TO_STRING), "hex_to_string"}, | 84 | {ERR_FUNC(X509V3_F_HEX_TO_STRING), "hex_to_string"}, |
| 83 | {ERR_FUNC(X509V3_F_I2S_ASN1_ENUMERATED), "i2s_ASN1_ENUMERATED"}, | 85 | {ERR_FUNC(X509V3_F_I2S_ASN1_ENUMERATED), "i2s_ASN1_ENUMERATED"}, |
| 84 | {ERR_FUNC(X509V3_F_I2S_ASN1_IA5STRING), "I2S_ASN1_IA5STRING"}, | 86 | {ERR_FUNC(X509V3_F_I2S_ASN1_IA5STRING), "I2S_ASN1_IA5STRING"}, |
| @@ -95,6 +97,7 @@ static ERR_STRING_DATA X509V3_str_functs[]= | |||
| 95 | {ERR_FUNC(X509V3_F_S2I_ASN1_OCTET_STRING), "s2i_ASN1_OCTET_STRING"}, | 97 | {ERR_FUNC(X509V3_F_S2I_ASN1_OCTET_STRING), "s2i_ASN1_OCTET_STRING"}, |
| 96 | {ERR_FUNC(X509V3_F_S2I_ASN1_SKEY_ID), "S2I_ASN1_SKEY_ID"}, | 98 | {ERR_FUNC(X509V3_F_S2I_ASN1_SKEY_ID), "S2I_ASN1_SKEY_ID"}, |
| 97 | {ERR_FUNC(X509V3_F_S2I_SKEY_ID), "S2I_SKEY_ID"}, | 99 | {ERR_FUNC(X509V3_F_S2I_SKEY_ID), "S2I_SKEY_ID"}, |
| 100 | {ERR_FUNC(X509V3_F_SET_DIST_POINT_NAME), "SET_DIST_POINT_NAME"}, | ||
| 98 | {ERR_FUNC(X509V3_F_STRING_TO_HEX), "string_to_hex"}, | 101 | {ERR_FUNC(X509V3_F_STRING_TO_HEX), "string_to_hex"}, |
| 99 | {ERR_FUNC(X509V3_F_SXNET_ADD_ID_ASC), "SXNET_add_id_asc"}, | 102 | {ERR_FUNC(X509V3_F_SXNET_ADD_ID_ASC), "SXNET_add_id_asc"}, |
| 100 | {ERR_FUNC(X509V3_F_SXNET_ADD_ID_INTEGER), "SXNET_add_id_INTEGER"}, | 103 | {ERR_FUNC(X509V3_F_SXNET_ADD_ID_INTEGER), "SXNET_add_id_INTEGER"}, |
| @@ -110,6 +113,7 @@ static ERR_STRING_DATA X509V3_str_functs[]= | |||
| 110 | {ERR_FUNC(X509V3_F_V2I_EXTENDED_KEY_USAGE), "V2I_EXTENDED_KEY_USAGE"}, | 113 | {ERR_FUNC(X509V3_F_V2I_EXTENDED_KEY_USAGE), "V2I_EXTENDED_KEY_USAGE"}, |
| 111 | {ERR_FUNC(X509V3_F_V2I_GENERAL_NAMES), "v2i_GENERAL_NAMES"}, | 114 | {ERR_FUNC(X509V3_F_V2I_GENERAL_NAMES), "v2i_GENERAL_NAMES"}, |
| 112 | {ERR_FUNC(X509V3_F_V2I_GENERAL_NAME_EX), "v2i_GENERAL_NAME_ex"}, | 115 | {ERR_FUNC(X509V3_F_V2I_GENERAL_NAME_EX), "v2i_GENERAL_NAME_ex"}, |
| 116 | {ERR_FUNC(X509V3_F_V2I_IDP), "V2I_IDP"}, | ||
| 113 | {ERR_FUNC(X509V3_F_V2I_IPADDRBLOCKS), "V2I_IPADDRBLOCKS"}, | 117 | {ERR_FUNC(X509V3_F_V2I_IPADDRBLOCKS), "V2I_IPADDRBLOCKS"}, |
| 114 | {ERR_FUNC(X509V3_F_V2I_ISSUER_ALT), "V2I_ISSUER_ALT"}, | 118 | {ERR_FUNC(X509V3_F_V2I_ISSUER_ALT), "V2I_ISSUER_ALT"}, |
| 115 | {ERR_FUNC(X509V3_F_V2I_NAME_CONSTRAINTS), "V2I_NAME_CONSTRAINTS"}, | 119 | {ERR_FUNC(X509V3_F_V2I_NAME_CONSTRAINTS), "V2I_NAME_CONSTRAINTS"}, |
| @@ -141,6 +145,7 @@ static ERR_STRING_DATA X509V3_str_reasons[]= | |||
| 141 | {ERR_REASON(X509V3_R_BN_DEC2BN_ERROR) ,"bn dec2bn error"}, | 145 | {ERR_REASON(X509V3_R_BN_DEC2BN_ERROR) ,"bn dec2bn error"}, |
| 142 | {ERR_REASON(X509V3_R_BN_TO_ASN1_INTEGER_ERROR),"bn to asn1 integer error"}, | 146 | {ERR_REASON(X509V3_R_BN_TO_ASN1_INTEGER_ERROR),"bn to asn1 integer error"}, |
| 143 | {ERR_REASON(X509V3_R_DIRNAME_ERROR) ,"dirname error"}, | 147 | {ERR_REASON(X509V3_R_DIRNAME_ERROR) ,"dirname error"}, |
| 148 | {ERR_REASON(X509V3_R_DISTPOINT_ALREADY_SET),"distpoint already set"}, | ||
| 144 | {ERR_REASON(X509V3_R_DUPLICATE_ZONE_ID) ,"duplicate zone id"}, | 149 | {ERR_REASON(X509V3_R_DUPLICATE_ZONE_ID) ,"duplicate zone id"}, |
| 145 | {ERR_REASON(X509V3_R_ERROR_CONVERTING_ZONE),"error converting zone"}, | 150 | {ERR_REASON(X509V3_R_ERROR_CONVERTING_ZONE),"error converting zone"}, |
| 146 | {ERR_REASON(X509V3_R_ERROR_CREATING_EXTENSION),"error creating extension"}, | 151 | {ERR_REASON(X509V3_R_ERROR_CREATING_EXTENSION),"error creating extension"}, |
| @@ -154,6 +159,7 @@ static ERR_STRING_DATA X509V3_str_reasons[]= | |||
| 154 | {ERR_REASON(X509V3_R_ILLEGAL_EMPTY_EXTENSION),"illegal empty extension"}, | 159 | {ERR_REASON(X509V3_R_ILLEGAL_EMPTY_EXTENSION),"illegal empty extension"}, |
| 155 | {ERR_REASON(X509V3_R_ILLEGAL_HEX_DIGIT) ,"illegal hex digit"}, | 160 | {ERR_REASON(X509V3_R_ILLEGAL_HEX_DIGIT) ,"illegal hex digit"}, |
| 156 | {ERR_REASON(X509V3_R_INCORRECT_POLICY_SYNTAX_TAG),"incorrect policy syntax tag"}, | 161 | {ERR_REASON(X509V3_R_INCORRECT_POLICY_SYNTAX_TAG),"incorrect policy syntax tag"}, |
| 162 | {ERR_REASON(X509V3_R_INVALID_MULTIPLE_RDNS),"invalid multiple rdns"}, | ||
| 157 | {ERR_REASON(X509V3_R_INVALID_ASNUMBER) ,"invalid asnumber"}, | 163 | {ERR_REASON(X509V3_R_INVALID_ASNUMBER) ,"invalid asnumber"}, |
| 158 | {ERR_REASON(X509V3_R_INVALID_ASRANGE) ,"invalid asrange"}, | 164 | {ERR_REASON(X509V3_R_INVALID_ASRANGE) ,"invalid asrange"}, |
| 159 | {ERR_REASON(X509V3_R_INVALID_BOOLEAN_STRING),"invalid boolean string"}, | 165 | {ERR_REASON(X509V3_R_INVALID_BOOLEAN_STRING),"invalid boolean string"}, |
| @@ -187,9 +193,9 @@ static ERR_STRING_DATA X509V3_str_reasons[]= | |||
| 187 | {ERR_REASON(X509V3_R_ODD_NUMBER_OF_DIGITS),"odd number of digits"}, | 193 | {ERR_REASON(X509V3_R_ODD_NUMBER_OF_DIGITS),"odd number of digits"}, |
| 188 | {ERR_REASON(X509V3_R_OPERATION_NOT_DEFINED),"operation not defined"}, | 194 | {ERR_REASON(X509V3_R_OPERATION_NOT_DEFINED),"operation not defined"}, |
| 189 | {ERR_REASON(X509V3_R_OTHERNAME_ERROR) ,"othername error"}, | 195 | {ERR_REASON(X509V3_R_OTHERNAME_ERROR) ,"othername error"}, |
| 190 | {ERR_REASON(X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED),"policy language alreadty defined"}, | 196 | {ERR_REASON(X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED),"policy language already defined"}, |
| 191 | {ERR_REASON(X509V3_R_POLICY_PATH_LENGTH) ,"policy path length"}, | 197 | {ERR_REASON(X509V3_R_POLICY_PATH_LENGTH) ,"policy path length"}, |
| 192 | {ERR_REASON(X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED),"policy path length alreadty defined"}, | 198 | {ERR_REASON(X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED),"policy path length already defined"}, |
| 193 | {ERR_REASON(X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED),"policy syntax not currently supported"}, | 199 | {ERR_REASON(X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED),"policy syntax not currently supported"}, |
| 194 | {ERR_REASON(X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY),"policy when proxy language requires no policy"}, | 200 | {ERR_REASON(X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY),"policy when proxy language requires no policy"}, |
| 195 | {ERR_REASON(X509V3_R_SECTION_NOT_FOUND) ,"section not found"}, | 201 | {ERR_REASON(X509V3_R_SECTION_NOT_FOUND) ,"section not found"}, |
| @@ -200,6 +206,7 @@ static ERR_STRING_DATA X509V3_str_reasons[]= | |||
| 200 | {ERR_REASON(X509V3_R_UNKNOWN_EXTENSION_NAME),"unknown extension name"}, | 206 | {ERR_REASON(X509V3_R_UNKNOWN_EXTENSION_NAME),"unknown extension name"}, |
| 201 | {ERR_REASON(X509V3_R_UNKNOWN_OPTION) ,"unknown option"}, | 207 | {ERR_REASON(X509V3_R_UNKNOWN_OPTION) ,"unknown option"}, |
| 202 | {ERR_REASON(X509V3_R_UNSUPPORTED_OPTION) ,"unsupported option"}, | 208 | {ERR_REASON(X509V3_R_UNSUPPORTED_OPTION) ,"unsupported option"}, |
| 209 | {ERR_REASON(X509V3_R_UNSUPPORTED_TYPE) ,"unsupported type"}, | ||
| 203 | {ERR_REASON(X509V3_R_USER_TOO_LONG) ,"user too long"}, | 210 | {ERR_REASON(X509V3_R_USER_TOO_LONG) ,"user too long"}, |
| 204 | {0,NULL} | 211 | {0,NULL} |
| 205 | }; | 212 | }; |
diff --git a/src/lib/libcrypto/x509v3/x509v3.h b/src/lib/libcrypto/x509v3/x509v3.h index 9ef83da755..b308abe7cd 100644 --- a/src/lib/libcrypto/x509v3/x509v3.h +++ b/src/lib/libcrypto/x509v3/x509v3.h | |||
| @@ -76,12 +76,19 @@ typedef void * (*X509V3_EXT_NEW)(void); | |||
| 76 | typedef void (*X509V3_EXT_FREE)(void *); | 76 | typedef void (*X509V3_EXT_FREE)(void *); |
| 77 | typedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long); | 77 | typedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long); |
| 78 | typedef int (*X509V3_EXT_I2D)(void *, unsigned char **); | 78 | typedef int (*X509V3_EXT_I2D)(void *, unsigned char **); |
| 79 | typedef STACK_OF(CONF_VALUE) * (*X509V3_EXT_I2V)(struct v3_ext_method *method, void *ext, STACK_OF(CONF_VALUE) *extlist); | 79 | typedef STACK_OF(CONF_VALUE) * |
| 80 | typedef void * (*X509V3_EXT_V2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, STACK_OF(CONF_VALUE) *values); | 80 | (*X509V3_EXT_I2V)(const struct v3_ext_method *method, void *ext, |
| 81 | typedef char * (*X509V3_EXT_I2S)(struct v3_ext_method *method, void *ext); | 81 | STACK_OF(CONF_VALUE) *extlist); |
| 82 | typedef void * (*X509V3_EXT_S2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str); | 82 | typedef void * (*X509V3_EXT_V2I)(const struct v3_ext_method *method, |
| 83 | typedef int (*X509V3_EXT_I2R)(struct v3_ext_method *method, void *ext, BIO *out, int indent); | 83 | struct v3_ext_ctx *ctx, |
| 84 | typedef void * (*X509V3_EXT_R2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str); | 84 | STACK_OF(CONF_VALUE) *values); |
| 85 | typedef char * (*X509V3_EXT_I2S)(const struct v3_ext_method *method, void *ext); | ||
| 86 | typedef void * (*X509V3_EXT_S2I)(const struct v3_ext_method *method, | ||
| 87 | struct v3_ext_ctx *ctx, const char *str); | ||
| 88 | typedef int (*X509V3_EXT_I2R)(const struct v3_ext_method *method, void *ext, | ||
| 89 | BIO *out, int indent); | ||
| 90 | typedef void * (*X509V3_EXT_R2I)(const struct v3_ext_method *method, | ||
| 91 | struct v3_ext_ctx *ctx, const char *str); | ||
| 85 | 92 | ||
| 86 | /* V3 extension structure */ | 93 | /* V3 extension structure */ |
| 87 | 94 | ||
| @@ -220,24 +227,41 @@ union { | |||
| 220 | GENERAL_NAMES *fullname; | 227 | GENERAL_NAMES *fullname; |
| 221 | STACK_OF(X509_NAME_ENTRY) *relativename; | 228 | STACK_OF(X509_NAME_ENTRY) *relativename; |
| 222 | } name; | 229 | } name; |
| 230 | /* If relativename then this contains the full distribution point name */ | ||
| 231 | X509_NAME *dpname; | ||
| 223 | } DIST_POINT_NAME; | 232 | } DIST_POINT_NAME; |
| 224 | 233 | /* All existing reasons */ | |
| 225 | typedef struct DIST_POINT_st { | 234 | #define CRLDP_ALL_REASONS 0x807f |
| 235 | |||
| 236 | #define CRL_REASON_NONE -1 | ||
| 237 | #define CRL_REASON_UNSPECIFIED 0 | ||
| 238 | #define CRL_REASON_KEY_COMPROMISE 1 | ||
| 239 | #define CRL_REASON_CA_COMPROMISE 2 | ||
| 240 | #define CRL_REASON_AFFILIATION_CHANGED 3 | ||
| 241 | #define CRL_REASON_SUPERSEDED 4 | ||
| 242 | #define CRL_REASON_CESSATION_OF_OPERATION 5 | ||
| 243 | #define CRL_REASON_CERTIFICATE_HOLD 6 | ||
| 244 | #define CRL_REASON_REMOVE_FROM_CRL 8 | ||
| 245 | #define CRL_REASON_PRIVILEGE_WITHDRAWN 9 | ||
| 246 | #define CRL_REASON_AA_COMPROMISE 10 | ||
| 247 | |||
| 248 | struct DIST_POINT_st { | ||
| 226 | DIST_POINT_NAME *distpoint; | 249 | DIST_POINT_NAME *distpoint; |
| 227 | ASN1_BIT_STRING *reasons; | 250 | ASN1_BIT_STRING *reasons; |
| 228 | GENERAL_NAMES *CRLissuer; | 251 | GENERAL_NAMES *CRLissuer; |
| 229 | } DIST_POINT; | 252 | int dp_reasons; |
| 253 | }; | ||
| 230 | 254 | ||
| 231 | typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; | 255 | typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; |
| 232 | 256 | ||
| 233 | DECLARE_STACK_OF(DIST_POINT) | 257 | DECLARE_STACK_OF(DIST_POINT) |
| 234 | DECLARE_ASN1_SET_OF(DIST_POINT) | 258 | DECLARE_ASN1_SET_OF(DIST_POINT) |
| 235 | 259 | ||
| 236 | typedef struct AUTHORITY_KEYID_st { | 260 | struct AUTHORITY_KEYID_st { |
| 237 | ASN1_OCTET_STRING *keyid; | 261 | ASN1_OCTET_STRING *keyid; |
| 238 | GENERAL_NAMES *issuer; | 262 | GENERAL_NAMES *issuer; |
| 239 | ASN1_INTEGER *serial; | 263 | ASN1_INTEGER *serial; |
| 240 | } AUTHORITY_KEYID; | 264 | }; |
| 241 | 265 | ||
| 242 | /* Strong extranet structures */ | 266 | /* Strong extranet structures */ |
| 243 | 267 | ||
| @@ -303,10 +327,10 @@ typedef struct GENERAL_SUBTREE_st { | |||
| 303 | 327 | ||
| 304 | DECLARE_STACK_OF(GENERAL_SUBTREE) | 328 | DECLARE_STACK_OF(GENERAL_SUBTREE) |
| 305 | 329 | ||
| 306 | typedef struct NAME_CONSTRAINTS_st { | 330 | struct NAME_CONSTRAINTS_st { |
| 307 | STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; | 331 | STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; |
| 308 | STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; | 332 | STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; |
| 309 | } NAME_CONSTRAINTS; | 333 | }; |
| 310 | 334 | ||
| 311 | typedef struct POLICY_CONSTRAINTS_st { | 335 | typedef struct POLICY_CONSTRAINTS_st { |
| 312 | ASN1_INTEGER *requireExplicitPolicy; | 336 | ASN1_INTEGER *requireExplicitPolicy; |
| @@ -329,6 +353,31 @@ typedef struct PROXY_CERT_INFO_EXTENSION_st | |||
| 329 | DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) | 353 | DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) |
| 330 | DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) | 354 | DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) |
| 331 | 355 | ||
| 356 | struct ISSUING_DIST_POINT_st | ||
| 357 | { | ||
| 358 | DIST_POINT_NAME *distpoint; | ||
| 359 | int onlyuser; | ||
| 360 | int onlyCA; | ||
| 361 | ASN1_BIT_STRING *onlysomereasons; | ||
| 362 | int indirectCRL; | ||
| 363 | int onlyattr; | ||
| 364 | }; | ||
| 365 | |||
| 366 | /* Values in idp_flags field */ | ||
| 367 | /* IDP present */ | ||
| 368 | #define IDP_PRESENT 0x1 | ||
| 369 | /* IDP values inconsistent */ | ||
| 370 | #define IDP_INVALID 0x2 | ||
| 371 | /* onlyuser true */ | ||
| 372 | #define IDP_ONLYUSER 0x4 | ||
| 373 | /* onlyCA true */ | ||
| 374 | #define IDP_ONLYCA 0x8 | ||
| 375 | /* onlyattr true */ | ||
| 376 | #define IDP_ONLYATTR 0x10 | ||
| 377 | /* indirectCRL true */ | ||
| 378 | #define IDP_INDIRECT 0x20 | ||
| 379 | /* onlysomereasons present */ | ||
| 380 | #define IDP_REASONS 0x40 | ||
| 332 | 381 | ||
| 333 | #define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ | 382 | #define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ |
| 334 | ",name:", val->name, ",value:", val->value); | 383 | ",name:", val->name, ",value:", val->value); |
| @@ -373,6 +422,7 @@ DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) | |||
| 373 | #define EXFLAG_PROXY 0x400 | 422 | #define EXFLAG_PROXY 0x400 |
| 374 | 423 | ||
| 375 | #define EXFLAG_INVALID_POLICY 0x800 | 424 | #define EXFLAG_INVALID_POLICY 0x800 |
| 425 | #define EXFLAG_FRESHEST 0x1000 | ||
| 376 | 426 | ||
| 377 | #define KU_DIGITAL_SIGNATURE 0x0080 | 427 | #define KU_DIGITAL_SIGNATURE 0x0080 |
| 378 | #define KU_NON_REPUDIATION 0x0040 | 428 | #define KU_NON_REPUDIATION 0x0040 |
| @@ -424,9 +474,10 @@ typedef struct x509_purpose_st { | |||
| 424 | #define X509_PURPOSE_CRL_SIGN 6 | 474 | #define X509_PURPOSE_CRL_SIGN 6 |
| 425 | #define X509_PURPOSE_ANY 7 | 475 | #define X509_PURPOSE_ANY 7 |
| 426 | #define X509_PURPOSE_OCSP_HELPER 8 | 476 | #define X509_PURPOSE_OCSP_HELPER 8 |
| 477 | #define X509_PURPOSE_TIMESTAMP_SIGN 9 | ||
| 427 | 478 | ||
| 428 | #define X509_PURPOSE_MIN 1 | 479 | #define X509_PURPOSE_MIN 1 |
| 429 | #define X509_PURPOSE_MAX 8 | 480 | #define X509_PURPOSE_MAX 9 |
| 430 | 481 | ||
| 431 | /* Flags for X509V3_EXT_print() */ | 482 | /* Flags for X509V3_EXT_print() */ |
| 432 | 483 | ||
| @@ -471,6 +522,9 @@ DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) | |||
| 471 | DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) | 522 | DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) |
| 472 | 523 | ||
| 473 | DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) | 524 | DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) |
| 525 | GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a); | ||
| 526 | int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); | ||
| 527 | |||
| 474 | 528 | ||
| 475 | 529 | ||
| 476 | ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, | 530 | ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, |
| @@ -486,11 +540,18 @@ DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) | |||
| 486 | 540 | ||
| 487 | STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, | 541 | STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, |
| 488 | GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist); | 542 | GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist); |
| 489 | GENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method, | 543 | GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, |
| 490 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); | 544 | X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); |
| 491 | 545 | ||
| 492 | DECLARE_ASN1_FUNCTIONS(OTHERNAME) | 546 | DECLARE_ASN1_FUNCTIONS(OTHERNAME) |
| 493 | DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) | 547 | DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) |
| 548 | int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); | ||
| 549 | void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); | ||
| 550 | void *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype); | ||
| 551 | int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, | ||
| 552 | ASN1_OBJECT *oid, ASN1_TYPE *value); | ||
| 553 | int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen, | ||
| 554 | ASN1_OBJECT **poid, ASN1_TYPE **pvalue); | ||
| 494 | 555 | ||
| 495 | char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5); | 556 | char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5); |
| 496 | ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str); | 557 | ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str); |
| @@ -507,6 +568,11 @@ DECLARE_ASN1_FUNCTIONS(NOTICEREF) | |||
| 507 | DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) | 568 | DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) |
| 508 | DECLARE_ASN1_FUNCTIONS(DIST_POINT) | 569 | DECLARE_ASN1_FUNCTIONS(DIST_POINT) |
| 509 | DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) | 570 | DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) |
| 571 | DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) | ||
| 572 | |||
| 573 | int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname); | ||
| 574 | |||
| 575 | int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); | ||
| 510 | 576 | ||
| 511 | DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) | 577 | DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) |
| 512 | DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) | 578 | DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) |
| @@ -524,11 +590,16 @@ DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) | |||
| 524 | DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) | 590 | DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) |
| 525 | DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) | 591 | DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) |
| 526 | 592 | ||
| 593 | GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, | ||
| 594 | const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | ||
| 595 | int gen_type, char *value, int is_nc); | ||
| 596 | |||
| 527 | #ifdef HEADER_CONF_H | 597 | #ifdef HEADER_CONF_H |
| 528 | GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | 598 | GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, |
| 529 | CONF_VALUE *cnf); | 599 | CONF_VALUE *cnf); |
| 530 | GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, X509V3_EXT_METHOD *method, | 600 | GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, |
| 531 | X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc); | 601 | const X509V3_EXT_METHOD *method, |
| 602 | X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc); | ||
| 532 | void X509V3_conf_free(CONF_VALUE *val); | 603 | void X509V3_conf_free(CONF_VALUE *val); |
| 533 | 604 | ||
| 534 | X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value); | 605 | X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value); |
| @@ -538,18 +609,23 @@ int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert) | |||
| 538 | int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_REQ *req); | 609 | int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_REQ *req); |
| 539 | int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl); | 610 | int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl); |
| 540 | 611 | ||
| 541 | X509_EXTENSION *X509V3_EXT_conf_nid(LHASH *conf, X509V3_CTX *ctx, int ext_nid, char *value); | 612 | X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
| 542 | X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, char *value); | 613 | int ext_nid, char *value); |
| 543 | int X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509 *cert); | 614 | X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
| 544 | int X509V3_EXT_REQ_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_REQ *req); | 615 | char *name, char *value); |
| 545 | int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl); | 616 | int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, |
| 617 | char *section, X509 *cert); | ||
| 618 | int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, | ||
| 619 | char *section, X509_REQ *req); | ||
| 620 | int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, | ||
| 621 | char *section, X509_CRL *crl); | ||
| 546 | 622 | ||
| 547 | int X509V3_add_value_bool_nf(char *name, int asn1_bool, | 623 | int X509V3_add_value_bool_nf(char *name, int asn1_bool, |
| 548 | STACK_OF(CONF_VALUE) **extlist); | 624 | STACK_OF(CONF_VALUE) **extlist); |
| 549 | int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool); | 625 | int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool); |
| 550 | int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint); | 626 | int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint); |
| 551 | void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); | 627 | void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); |
| 552 | void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH *lhash); | 628 | void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); |
| 553 | #endif | 629 | #endif |
| 554 | 630 | ||
| 555 | char * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section); | 631 | char * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section); |
| @@ -576,8 +652,8 @@ int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); | |||
| 576 | int X509V3_EXT_add_alias(int nid_to, int nid_from); | 652 | int X509V3_EXT_add_alias(int nid_to, int nid_from); |
| 577 | void X509V3_EXT_cleanup(void); | 653 | void X509V3_EXT_cleanup(void); |
| 578 | 654 | ||
| 579 | X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); | 655 | const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); |
| 580 | X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); | 656 | const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); |
| 581 | int X509V3_add_standard_extensions(void); | 657 | int X509V3_add_standard_extensions(void); |
| 582 | STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); | 658 | STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); |
| 583 | void *X509V3_EXT_d2i(X509_EXTENSION *ext); | 659 | void *X509V3_EXT_d2i(X509_EXTENSION *ext); |
| @@ -587,8 +663,8 @@ void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx); | |||
| 587 | X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); | 663 | X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); |
| 588 | int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags); | 664 | int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags); |
| 589 | 665 | ||
| 590 | char *hex_to_string(unsigned char *buffer, long len); | 666 | char *hex_to_string(const unsigned char *buffer, long len); |
| 591 | unsigned char *string_to_hex(char *str, long *len); | 667 | unsigned char *string_to_hex(const char *str, long *len); |
| 592 | int name_cmp(const char *name, const char *cmp); | 668 | int name_cmp(const char *name, const char *cmp); |
| 593 | 669 | ||
| 594 | void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, | 670 | void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, |
| @@ -603,6 +679,7 @@ int X509_check_purpose(X509 *x, int id, int ca); | |||
| 603 | int X509_supported_extension(X509_EXTENSION *ex); | 679 | int X509_supported_extension(X509_EXTENSION *ex); |
| 604 | int X509_PURPOSE_set(int *p, int purpose); | 680 | int X509_PURPOSE_set(int *p, int purpose); |
| 605 | int X509_check_issued(X509 *issuer, X509 *subject); | 681 | int X509_check_issued(X509 *issuer, X509 *subject); |
| 682 | int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); | ||
| 606 | int X509_PURPOSE_get_count(void); | 683 | int X509_PURPOSE_get_count(void); |
| 607 | X509_PURPOSE * X509_PURPOSE_get0(int idx); | 684 | X509_PURPOSE * X509_PURPOSE_get0(int idx); |
| 608 | int X509_PURPOSE_get_by_sname(char *sname); | 685 | int X509_PURPOSE_get_by_sname(char *sname); |
| @@ -616,10 +693,10 @@ int X509_PURPOSE_get_trust(X509_PURPOSE *xp); | |||
| 616 | void X509_PURPOSE_cleanup(void); | 693 | void X509_PURPOSE_cleanup(void); |
| 617 | int X509_PURPOSE_get_id(X509_PURPOSE *); | 694 | int X509_PURPOSE_get_id(X509_PURPOSE *); |
| 618 | 695 | ||
| 619 | STACK *X509_get1_email(X509 *x); | 696 | STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); |
| 620 | STACK *X509_REQ_get1_email(X509_REQ *x); | 697 | STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); |
| 621 | void X509_email_free(STACK *sk); | 698 | void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); |
| 622 | STACK *X509_get1_ocsp(X509 *x); | 699 | STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); |
| 623 | 700 | ||
| 624 | ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); | 701 | ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); |
| 625 | ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); | 702 | ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); |
| @@ -628,6 +705,7 @@ int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk, | |||
| 628 | unsigned long chtype); | 705 | unsigned long chtype); |
| 629 | 706 | ||
| 630 | void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); | 707 | void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); |
| 708 | DECLARE_STACK_OF(X509_POLICY_NODE) | ||
| 631 | 709 | ||
| 632 | #ifndef OPENSSL_NO_RFC3779 | 710 | #ifndef OPENSSL_NO_RFC3779 |
| 633 | 711 | ||
| @@ -787,8 +865,9 @@ void ERR_load_X509V3_strings(void); | |||
| 787 | /* Error codes for the X509V3 functions. */ | 865 | /* Error codes for the X509V3 functions. */ |
| 788 | 866 | ||
| 789 | /* Function codes. */ | 867 | /* Function codes. */ |
| 790 | #define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 156 | 868 | #define X509V3_F_A2I_GENERAL_NAME 164 |
| 791 | #define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 157 | 869 | #define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161 |
| 870 | #define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162 | ||
| 792 | #define X509V3_F_COPY_EMAIL 122 | 871 | #define X509V3_F_COPY_EMAIL 122 |
| 793 | #define X509V3_F_COPY_ISSUER 123 | 872 | #define X509V3_F_COPY_ISSUER 123 |
| 794 | #define X509V3_F_DO_DIRNAME 144 | 873 | #define X509V3_F_DO_DIRNAME 144 |
| @@ -796,6 +875,7 @@ void ERR_load_X509V3_strings(void); | |||
| 796 | #define X509V3_F_DO_EXT_I2D 135 | 875 | #define X509V3_F_DO_EXT_I2D 135 |
| 797 | #define X509V3_F_DO_EXT_NCONF 151 | 876 | #define X509V3_F_DO_EXT_NCONF 151 |
| 798 | #define X509V3_F_DO_I2V_NAME_CONSTRAINTS 148 | 877 | #define X509V3_F_DO_I2V_NAME_CONSTRAINTS 148 |
| 878 | #define X509V3_F_GNAMES_FROM_SECTNAME 156 | ||
| 799 | #define X509V3_F_HEX_TO_STRING 111 | 879 | #define X509V3_F_HEX_TO_STRING 111 |
| 800 | #define X509V3_F_I2S_ASN1_ENUMERATED 121 | 880 | #define X509V3_F_I2S_ASN1_ENUMERATED 121 |
| 801 | #define X509V3_F_I2S_ASN1_IA5STRING 149 | 881 | #define X509V3_F_I2S_ASN1_IA5STRING 149 |
| @@ -812,13 +892,14 @@ void ERR_load_X509V3_strings(void); | |||
| 812 | #define X509V3_F_S2I_ASN1_OCTET_STRING 112 | 892 | #define X509V3_F_S2I_ASN1_OCTET_STRING 112 |
| 813 | #define X509V3_F_S2I_ASN1_SKEY_ID 114 | 893 | #define X509V3_F_S2I_ASN1_SKEY_ID 114 |
| 814 | #define X509V3_F_S2I_SKEY_ID 115 | 894 | #define X509V3_F_S2I_SKEY_ID 115 |
| 895 | #define X509V3_F_SET_DIST_POINT_NAME 158 | ||
| 815 | #define X509V3_F_STRING_TO_HEX 113 | 896 | #define X509V3_F_STRING_TO_HEX 113 |
| 816 | #define X509V3_F_SXNET_ADD_ID_ASC 125 | 897 | #define X509V3_F_SXNET_ADD_ID_ASC 125 |
| 817 | #define X509V3_F_SXNET_ADD_ID_INTEGER 126 | 898 | #define X509V3_F_SXNET_ADD_ID_INTEGER 126 |
| 818 | #define X509V3_F_SXNET_ADD_ID_ULONG 127 | 899 | #define X509V3_F_SXNET_ADD_ID_ULONG 127 |
| 819 | #define X509V3_F_SXNET_GET_ID_ASC 128 | 900 | #define X509V3_F_SXNET_GET_ID_ASC 128 |
| 820 | #define X509V3_F_SXNET_GET_ID_ULONG 129 | 901 | #define X509V3_F_SXNET_GET_ID_ULONG 129 |
| 821 | #define X509V3_F_V2I_ASIDENTIFIERS 158 | 902 | #define X509V3_F_V2I_ASIDENTIFIERS 163 |
| 822 | #define X509V3_F_V2I_ASN1_BIT_STRING 101 | 903 | #define X509V3_F_V2I_ASN1_BIT_STRING 101 |
| 823 | #define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 | 904 | #define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 |
| 824 | #define X509V3_F_V2I_AUTHORITY_KEYID 119 | 905 | #define X509V3_F_V2I_AUTHORITY_KEYID 119 |
| @@ -827,6 +908,7 @@ void ERR_load_X509V3_strings(void); | |||
| 827 | #define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 | 908 | #define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 |
| 828 | #define X509V3_F_V2I_GENERAL_NAMES 118 | 909 | #define X509V3_F_V2I_GENERAL_NAMES 118 |
| 829 | #define X509V3_F_V2I_GENERAL_NAME_EX 117 | 910 | #define X509V3_F_V2I_GENERAL_NAME_EX 117 |
| 911 | #define X509V3_F_V2I_IDP 157 | ||
| 830 | #define X509V3_F_V2I_IPADDRBLOCKS 159 | 912 | #define X509V3_F_V2I_IPADDRBLOCKS 159 |
| 831 | #define X509V3_F_V2I_ISSUER_ALT 153 | 913 | #define X509V3_F_V2I_ISSUER_ALT 153 |
| 832 | #define X509V3_F_V2I_NAME_CONSTRAINTS 147 | 914 | #define X509V3_F_V2I_NAME_CONSTRAINTS 147 |
| @@ -855,6 +937,7 @@ void ERR_load_X509V3_strings(void); | |||
| 855 | #define X509V3_R_BN_DEC2BN_ERROR 100 | 937 | #define X509V3_R_BN_DEC2BN_ERROR 100 |
| 856 | #define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 | 938 | #define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 |
| 857 | #define X509V3_R_DIRNAME_ERROR 149 | 939 | #define X509V3_R_DIRNAME_ERROR 149 |
| 940 | #define X509V3_R_DISTPOINT_ALREADY_SET 160 | ||
| 858 | #define X509V3_R_DUPLICATE_ZONE_ID 133 | 941 | #define X509V3_R_DUPLICATE_ZONE_ID 133 |
| 859 | #define X509V3_R_ERROR_CONVERTING_ZONE 131 | 942 | #define X509V3_R_ERROR_CONVERTING_ZONE 131 |
| 860 | #define X509V3_R_ERROR_CREATING_EXTENSION 144 | 943 | #define X509V3_R_ERROR_CREATING_EXTENSION 144 |
| @@ -868,12 +951,13 @@ void ERR_load_X509V3_strings(void); | |||
| 868 | #define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 | 951 | #define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 |
| 869 | #define X509V3_R_ILLEGAL_HEX_DIGIT 113 | 952 | #define X509V3_R_ILLEGAL_HEX_DIGIT 113 |
| 870 | #define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 | 953 | #define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 |
| 871 | #define X509V3_R_INVALID_ASNUMBER 160 | 954 | #define X509V3_R_INVALID_MULTIPLE_RDNS 161 |
| 872 | #define X509V3_R_INVALID_ASRANGE 161 | 955 | #define X509V3_R_INVALID_ASNUMBER 162 |
| 956 | #define X509V3_R_INVALID_ASRANGE 163 | ||
| 873 | #define X509V3_R_INVALID_BOOLEAN_STRING 104 | 957 | #define X509V3_R_INVALID_BOOLEAN_STRING 104 |
| 874 | #define X509V3_R_INVALID_EXTENSION_STRING 105 | 958 | #define X509V3_R_INVALID_EXTENSION_STRING 105 |
| 875 | #define X509V3_R_INVALID_INHERITANCE 162 | 959 | #define X509V3_R_INVALID_INHERITANCE 165 |
| 876 | #define X509V3_R_INVALID_IPADDRESS 163 | 960 | #define X509V3_R_INVALID_IPADDRESS 166 |
| 877 | #define X509V3_R_INVALID_NAME 106 | 961 | #define X509V3_R_INVALID_NAME 106 |
| 878 | #define X509V3_R_INVALID_NULL_ARGUMENT 107 | 962 | #define X509V3_R_INVALID_NULL_ARGUMENT 107 |
| 879 | #define X509V3_R_INVALID_NULL_NAME 108 | 963 | #define X509V3_R_INVALID_NULL_NAME 108 |
| @@ -901,9 +985,9 @@ void ERR_load_X509V3_strings(void); | |||
| 901 | #define X509V3_R_ODD_NUMBER_OF_DIGITS 112 | 985 | #define X509V3_R_ODD_NUMBER_OF_DIGITS 112 |
| 902 | #define X509V3_R_OPERATION_NOT_DEFINED 148 | 986 | #define X509V3_R_OPERATION_NOT_DEFINED 148 |
| 903 | #define X509V3_R_OTHERNAME_ERROR 147 | 987 | #define X509V3_R_OTHERNAME_ERROR 147 |
| 904 | #define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED 155 | 988 | #define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 |
| 905 | #define X509V3_R_POLICY_PATH_LENGTH 156 | 989 | #define X509V3_R_POLICY_PATH_LENGTH 156 |
| 906 | #define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED 157 | 990 | #define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 |
| 907 | #define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 158 | 991 | #define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 158 |
| 908 | #define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 | 992 | #define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 |
| 909 | #define X509V3_R_SECTION_NOT_FOUND 150 | 993 | #define X509V3_R_SECTION_NOT_FOUND 150 |
| @@ -914,6 +998,7 @@ void ERR_load_X509V3_strings(void); | |||
| 914 | #define X509V3_R_UNKNOWN_EXTENSION_NAME 130 | 998 | #define X509V3_R_UNKNOWN_EXTENSION_NAME 130 |
| 915 | #define X509V3_R_UNKNOWN_OPTION 120 | 999 | #define X509V3_R_UNKNOWN_OPTION 120 |
| 916 | #define X509V3_R_UNSUPPORTED_OPTION 117 | 1000 | #define X509V3_R_UNSUPPORTED_OPTION 117 |
| 1001 | #define X509V3_R_UNSUPPORTED_TYPE 167 | ||
| 917 | #define X509V3_R_USER_TOO_LONG 132 | 1002 | #define X509V3_R_USER_TOO_LONG 132 |
| 918 | 1003 | ||
| 919 | #ifdef __cplusplus | 1004 | #ifdef __cplusplus |
diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl index 8946b464a8..b771a8539d 100644 --- a/src/lib/libcrypto/x86_64cpuid.pl +++ b/src/lib/libcrypto/x86_64cpuid.pl | |||
| @@ -1,110 +1,38 @@ | |||
| 1 | #!/usr/bin/env perl | 1 | #!/usr/bin/env perl |
| 2 | 2 | ||
| 3 | $output=shift; | 3 | $flavour = shift; |
| 4 | $masm=1 if ($output =~ /\.asm/); | 4 | $output = shift; |
| 5 | open STDOUT,">$output" || die "can't open $output: $!"; | 5 | if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } |
| 6 | |||
| 7 | print<<___ if(defined($masm)); | ||
| 8 | _TEXT SEGMENT | ||
| 9 | PUBLIC OPENSSL_rdtsc | ||
| 10 | |||
| 11 | PUBLIC OPENSSL_atomic_add | ||
| 12 | ALIGN 16 | ||
| 13 | OPENSSL_atomic_add PROC | ||
| 14 | mov eax,DWORD PTR[rcx] | ||
| 15 | \$Lspin: lea r8,DWORD PTR[rdx+rax] | ||
| 16 | lock cmpxchg DWORD PTR[rcx],r8d | ||
| 17 | jne \$Lspin | ||
| 18 | mov eax,r8d | ||
| 19 | cdqe | ||
| 20 | ret | ||
| 21 | OPENSSL_atomic_add ENDP | ||
| 22 | |||
| 23 | PUBLIC OPENSSL_wipe_cpu | ||
| 24 | ALIGN 16 | ||
| 25 | OPENSSL_wipe_cpu PROC | ||
| 26 | pxor xmm0,xmm0 | ||
| 27 | pxor xmm1,xmm1 | ||
| 28 | pxor xmm2,xmm2 | ||
| 29 | pxor xmm3,xmm3 | ||
| 30 | pxor xmm4,xmm4 | ||
| 31 | pxor xmm5,xmm5 | ||
| 32 | xor rcx,rcx | ||
| 33 | xor rdx,rdx | ||
| 34 | xor r8,r8 | ||
| 35 | xor r9,r9 | ||
| 36 | xor r10,r10 | ||
| 37 | xor r11,r11 | ||
| 38 | lea rax,QWORD PTR[rsp+8] | ||
| 39 | ret | ||
| 40 | OPENSSL_wipe_cpu ENDP | ||
| 41 | _TEXT ENDS | ||
| 42 | 6 | ||
| 43 | CRT\$XIU SEGMENT | 7 | $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); |
| 44 | EXTRN OPENSSL_cpuid_setup:PROC | ||
| 45 | DQ OPENSSL_cpuid_setup | ||
| 46 | CRT\$XIU ENDS | ||
| 47 | 8 | ||
| 48 | ___ | 9 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; |
| 49 | print<<___ if(!defined($masm)); | 10 | open STDOUT,"| $^X ${dir}perlasm/x86_64-xlate.pl $flavour $output"; |
| 11 | |||
| 12 | if ($win64) { $arg1="%rcx"; $arg2="%rdx"; } | ||
| 13 | else { $arg1="%rdi"; $arg2="%rsi"; } | ||
| 14 | print<<___; | ||
| 50 | #include <machine/asm.h> | 15 | #include <machine/asm.h> |
| 16 | .extern OPENSSL_cpuid_setup | ||
| 17 | .section .init | ||
| 18 | call PIC_PLT(OPENSSL_cpuid_setup) | ||
| 51 | 19 | ||
| 52 | .text | 20 | .text |
| 53 | 21 | ||
| 54 | .globl OPENSSL_atomic_add | 22 | .globl OPENSSL_atomic_add |
| 55 | .type OPENSSL_atomic_add,\@function | 23 | .type OPENSSL_atomic_add,\@abi-omnipotent |
| 56 | .align 16 | 24 | .align 16 |
| 57 | OPENSSL_atomic_add: | 25 | OPENSSL_atomic_add: |
| 58 | movl (%rdi),%eax | 26 | movl ($arg1),%eax |
| 59 | .Lspin: leaq (%rsi,%rax),%r8 | 27 | .Lspin: leaq ($arg2,%rax),%r8 |
| 60 | lock; cmpxchgl %r8d,(%rdi) | 28 | .byte 0xf0 # lock |
| 29 | cmpxchgl %r8d,($arg1) | ||
| 61 | jne .Lspin | 30 | jne .Lspin |
| 62 | movl %r8d,%eax | 31 | movl %r8d,%eax |
| 63 | .byte 0x48,0x98 | 32 | .byte 0x48,0x98 # cltq/cdqe |
| 64 | ret | 33 | ret |
| 65 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add | 34 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add |
| 66 | 35 | ||
| 67 | .globl OPENSSL_wipe_cpu | ||
| 68 | .type OPENSSL_wipe_cpu,\@function | ||
| 69 | .align 16 | ||
| 70 | OPENSSL_wipe_cpu: | ||
| 71 | pxor %xmm0,%xmm0 | ||
| 72 | pxor %xmm1,%xmm1 | ||
| 73 | pxor %xmm2,%xmm2 | ||
| 74 | pxor %xmm3,%xmm3 | ||
| 75 | pxor %xmm4,%xmm4 | ||
| 76 | pxor %xmm5,%xmm5 | ||
| 77 | pxor %xmm6,%xmm6 | ||
| 78 | pxor %xmm7,%xmm7 | ||
| 79 | pxor %xmm8,%xmm8 | ||
| 80 | pxor %xmm9,%xmm9 | ||
| 81 | pxor %xmm10,%xmm10 | ||
| 82 | pxor %xmm11,%xmm11 | ||
| 83 | pxor %xmm12,%xmm12 | ||
| 84 | pxor %xmm13,%xmm13 | ||
| 85 | pxor %xmm14,%xmm14 | ||
| 86 | pxor %xmm15,%xmm15 | ||
| 87 | xorq %rcx,%rcx | ||
| 88 | xorq %rdx,%rdx | ||
| 89 | xorq %rsi,%rsi | ||
| 90 | xorq %rdi,%rdi | ||
| 91 | xorq %r8,%r8 | ||
| 92 | xorq %r9,%r9 | ||
| 93 | xorq %r10,%r10 | ||
| 94 | xorq %r11,%r11 | ||
| 95 | leaq 8(%rsp),%rax | ||
| 96 | ret | ||
| 97 | .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu | ||
| 98 | |||
| 99 | .section .init | ||
| 100 | call PIC_PLT(OPENSSL_cpuid_setup) | ||
| 101 | |||
| 102 | ___ | ||
| 103 | |||
| 104 | open STDOUT,"| $^X perlasm/x86_64-xlate.pl $output"; | ||
| 105 | print<<___; | ||
| 106 | .text | ||
| 107 | |||
| 108 | .globl OPENSSL_rdtsc | 36 | .globl OPENSSL_rdtsc |
| 109 | .type OPENSSL_rdtsc,\@abi-omnipotent | 37 | .type OPENSSL_rdtsc,\@abi-omnipotent |
| 110 | .align 16 | 38 | .align 16 |
| @@ -123,6 +51,8 @@ OPENSSL_ia32_cpuid: | |||
| 123 | 51 | ||
| 124 | xor %eax,%eax | 52 | xor %eax,%eax |
| 125 | cpuid | 53 | cpuid |
| 54 | mov %eax,%r11d # max value for standard query level | ||
| 55 | |||
| 126 | xor %eax,%eax | 56 | xor %eax,%eax |
| 127 | cmp \$0x756e6547,%ebx # "Genu" | 57 | cmp \$0x756e6547,%ebx # "Genu" |
| 128 | setne %al | 58 | setne %al |
| @@ -132,8 +62,54 @@ OPENSSL_ia32_cpuid: | |||
| 132 | or %eax,%r9d | 62 | or %eax,%r9d |
| 133 | cmp \$0x6c65746e,%ecx # "ntel" | 63 | cmp \$0x6c65746e,%ecx # "ntel" |
| 134 | setne %al | 64 | setne %al |
| 135 | or %eax,%r9d | 65 | or %eax,%r9d # 0 indicates Intel CPU |
| 66 | jz .Lintel | ||
| 67 | |||
| 68 | cmp \$0x68747541,%ebx # "Auth" | ||
| 69 | setne %al | ||
| 70 | mov %eax,%r10d | ||
| 71 | cmp \$0x69746E65,%edx # "enti" | ||
| 72 | setne %al | ||
| 73 | or %eax,%r10d | ||
| 74 | cmp \$0x444D4163,%ecx # "cAMD" | ||
| 75 | setne %al | ||
| 76 | or %eax,%r10d # 0 indicates AMD CPU | ||
| 77 | jnz .Lintel | ||
| 78 | |||
| 79 | # AMD specific | ||
| 80 | mov \$0x80000000,%eax | ||
| 81 | cpuid | ||
| 82 | cmp \$0x80000008,%eax | ||
| 83 | jb .Lintel | ||
| 84 | |||
| 85 | mov \$0x80000008,%eax | ||
| 86 | cpuid | ||
| 87 | movzb %cl,%r10 # number of cores - 1 | ||
| 88 | inc %r10 # number of cores | ||
| 89 | |||
| 90 | mov \$1,%eax | ||
| 91 | cpuid | ||
| 92 | bt \$28,%edx # test hyper-threading bit | ||
| 93 | jnc .Ldone | ||
| 94 | shr \$16,%ebx # number of logical processors | ||
| 95 | cmp %r10b,%bl | ||
| 96 | ja .Ldone | ||
| 97 | and \$0xefffffff,%edx # ~(1<<28) | ||
| 98 | jmp .Ldone | ||
| 99 | |||
| 100 | .Lintel: | ||
| 101 | cmp \$4,%r11d | ||
| 102 | mov \$-1,%r10d | ||
| 103 | jb .Lnocacheinfo | ||
| 104 | |||
| 105 | mov \$4,%eax | ||
| 106 | mov \$0,%ecx # query L1D | ||
| 107 | cpuid | ||
| 108 | mov %eax,%r10d | ||
| 109 | shr \$14,%r10d | ||
| 110 | and \$0xfff,%r10d # number of cores -1 per L1D | ||
| 136 | 111 | ||
| 112 | .Lnocacheinfo: | ||
| 137 | mov \$1,%eax | 113 | mov \$1,%eax |
| 138 | cpuid | 114 | cpuid |
| 139 | cmp \$0,%r9d | 115 | cmp \$0,%r9d |
| @@ -146,6 +122,11 @@ OPENSSL_ia32_cpuid: | |||
| 146 | .Lnotintel: | 122 | .Lnotintel: |
| 147 | bt \$28,%edx # test hyper-threading bit | 123 | bt \$28,%edx # test hyper-threading bit |
| 148 | jnc .Ldone | 124 | jnc .Ldone |
| 125 | and \$0xefffffff,%edx # ~(1<<28) | ||
| 126 | cmp \$0,%r10d | ||
| 127 | je .Ldone | ||
| 128 | |||
| 129 | or \$0x10000000,%edx # 1<<28 | ||
| 149 | shr \$16,%ebx | 130 | shr \$16,%ebx |
| 150 | cmp \$1,%bl # see if cache is shared | 131 | cmp \$1,%bl # see if cache is shared |
| 151 | ja .Ldone | 132 | ja .Ldone |
| @@ -157,5 +138,96 @@ OPENSSL_ia32_cpuid: | |||
| 157 | or %rcx,%rax | 138 | or %rcx,%rax |
| 158 | ret | 139 | ret |
| 159 | .size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid | 140 | .size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid |
| 141 | |||
| 142 | .globl OPENSSL_cleanse | ||
| 143 | .type OPENSSL_cleanse,\@abi-omnipotent | ||
| 144 | .align 16 | ||
| 145 | OPENSSL_cleanse: | ||
| 146 | xor %rax,%rax | ||
| 147 | cmp \$15,$arg2 | ||
| 148 | jae .Lot | ||
| 149 | cmp \$0,$arg2 | ||
| 150 | je .Lret | ||
| 151 | .Little: | ||
| 152 | mov %al,($arg1) | ||
| 153 | sub \$1,$arg2 | ||
| 154 | lea 1($arg1),$arg1 | ||
| 155 | jnz .Little | ||
| 156 | .Lret: | ||
| 157 | ret | ||
| 158 | .align 16 | ||
| 159 | .Lot: | ||
| 160 | test \$7,$arg1 | ||
| 161 | jz .Laligned | ||
| 162 | mov %al,($arg1) | ||
| 163 | lea -1($arg2),$arg2 | ||
| 164 | lea 1($arg1),$arg1 | ||
| 165 | jmp .Lot | ||
| 166 | .Laligned: | ||
| 167 | mov %rax,($arg1) | ||
| 168 | lea -8($arg2),$arg2 | ||
| 169 | test \$-8,$arg2 | ||
| 170 | lea 8($arg1),$arg1 | ||
| 171 | jnz .Laligned | ||
| 172 | cmp \$0,$arg2 | ||
| 173 | jne .Little | ||
| 174 | ret | ||
| 175 | .size OPENSSL_cleanse,.-OPENSSL_cleanse | ||
| 176 | ___ | ||
| 177 | |||
| 178 | print<<___ if (!$win64); | ||
| 179 | .globl OPENSSL_wipe_cpu | ||
| 180 | .type OPENSSL_wipe_cpu,\@abi-omnipotent | ||
| 181 | .align 16 | ||
| 182 | OPENSSL_wipe_cpu: | ||
| 183 | pxor %xmm0,%xmm0 | ||
| 184 | pxor %xmm1,%xmm1 | ||
| 185 | pxor %xmm2,%xmm2 | ||
| 186 | pxor %xmm3,%xmm3 | ||
| 187 | pxor %xmm4,%xmm4 | ||
| 188 | pxor %xmm5,%xmm5 | ||
| 189 | pxor %xmm6,%xmm6 | ||
| 190 | pxor %xmm7,%xmm7 | ||
| 191 | pxor %xmm8,%xmm8 | ||
| 192 | pxor %xmm9,%xmm9 | ||
| 193 | pxor %xmm10,%xmm10 | ||
| 194 | pxor %xmm11,%xmm11 | ||
| 195 | pxor %xmm12,%xmm12 | ||
| 196 | pxor %xmm13,%xmm13 | ||
| 197 | pxor %xmm14,%xmm14 | ||
| 198 | pxor %xmm15,%xmm15 | ||
| 199 | xorq %rcx,%rcx | ||
| 200 | xorq %rdx,%rdx | ||
| 201 | xorq %rsi,%rsi | ||
| 202 | xorq %rdi,%rdi | ||
| 203 | xorq %r8,%r8 | ||
| 204 | xorq %r9,%r9 | ||
| 205 | xorq %r10,%r10 | ||
| 206 | xorq %r11,%r11 | ||
| 207 | leaq 8(%rsp),%rax | ||
| 208 | ret | ||
| 209 | .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu | ||
| 160 | ___ | 210 | ___ |
| 211 | print<<___ if ($win64); | ||
| 212 | .globl OPENSSL_wipe_cpu | ||
| 213 | .type OPENSSL_wipe_cpu,\@abi-omnipotent | ||
| 214 | .align 16 | ||
| 215 | OPENSSL_wipe_cpu: | ||
| 216 | pxor %xmm0,%xmm0 | ||
| 217 | pxor %xmm1,%xmm1 | ||
| 218 | pxor %xmm2,%xmm2 | ||
| 219 | pxor %xmm3,%xmm3 | ||
| 220 | pxor %xmm4,%xmm4 | ||
| 221 | pxor %xmm5,%xmm5 | ||
| 222 | xorq %rcx,%rcx | ||
| 223 | xorq %rdx,%rdx | ||
| 224 | xorq %r8,%r8 | ||
| 225 | xorq %r9,%r9 | ||
| 226 | xorq %r10,%r10 | ||
| 227 | xorq %r11,%r11 | ||
| 228 | leaq 8(%rsp),%rax | ||
| 229 | ret | ||
| 230 | .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu | ||
| 231 | ___ | ||
| 232 | |||
| 161 | close STDOUT; # flush | 233 | close STDOUT; # flush |
