diff options
| author | djm <> | 2010-10-01 22:54:18 +0000 |
|---|---|---|
| committer | djm <> | 2010-10-01 22:54:18 +0000 |
| commit | f6ca1ae73bb9eabfb510df2cffc2599db98d35a9 (patch) | |
| tree | def8296400903465cb96345535c0a56935eb05a4 /src/lib/libc | |
| parent | 0229f29a33371533962d8b0b8264882afac53d70 (diff) | |
| download | openbsd-f6ca1ae73bb9eabfb510df2cffc2599db98d35a9.tar.gz openbsd-f6ca1ae73bb9eabfb510df2cffc2599db98d35a9.tar.bz2 openbsd-f6ca1ae73bb9eabfb510df2cffc2599db98d35a9.zip | |
import OpenSSL-1.0.0a
Diffstat (limited to '')
39 files changed, 1837 insertions, 296 deletions
diff --git a/src/lib/libcrypto/LPdir_win.c b/src/lib/libcrypto/LPdir_win.c index 09b475beed..702dbc730f 100644 --- a/src/lib/libcrypto/LPdir_win.c +++ b/src/lib/libcrypto/LPdir_win.c | |||
| @@ -54,8 +54,6 @@ struct LP_dir_context_st | |||
| 54 | 54 | ||
| 55 | const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) | 55 | const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) |
| 56 | { | 56 | { |
| 57 | struct dirent *direntry = NULL; | ||
| 58 | |||
| 59 | if (ctx == NULL || directory == NULL) | 57 | if (ctx == NULL || directory == NULL) |
| 60 | { | 58 | { |
| 61 | errno = EINVAL; | 59 | errno = EINVAL; |
diff --git a/src/lib/libcrypto/bio/bio_lcl.h b/src/lib/libcrypto/bio/bio_lcl.h index dba2919d43..e7f7ec8d8b 100644 --- a/src/lib/libcrypto/bio/bio_lcl.h +++ b/src/lib/libcrypto/bio/bio_lcl.h | |||
| @@ -18,11 +18,19 @@ | |||
| 18 | #define UP_ftell ftell | 18 | #define UP_ftell ftell |
| 19 | #define UP_fflush fflush | 19 | #define UP_fflush fflush |
| 20 | #define UP_ferror ferror | 20 | #define UP_ferror ferror |
| 21 | #ifdef _WIN32 | ||
| 22 | #define UP_fileno _fileno | ||
| 23 | #define UP_open _open | ||
| 24 | #define UP_read _read | ||
| 25 | #define UP_write _write | ||
| 26 | #define UP_lseek _lseek | ||
| 27 | #define UP_close _close | ||
| 28 | #else | ||
| 21 | #define UP_fileno fileno | 29 | #define UP_fileno fileno |
| 22 | |||
| 23 | #define UP_open open | 30 | #define UP_open open |
| 24 | #define UP_read read | 31 | #define UP_read read |
| 25 | #define UP_write write | 32 | #define UP_write write |
| 26 | #define UP_lseek lseek | 33 | #define UP_lseek lseek |
| 27 | #define UP_close close | 34 | #define UP_close close |
| 28 | #endif | 35 | #endif |
| 36 | #endif | ||
diff --git a/src/lib/libcrypto/camellia/Makefile b/src/lib/libcrypto/camellia/Makefile index dfb12951fd..ff5fe4a01d 100644 --- a/src/lib/libcrypto/camellia/Makefile +++ b/src/lib/libcrypto/camellia/Makefile | |||
| @@ -11,7 +11,7 @@ CFLAG=-g | |||
| 11 | MAKEFILE= Makefile | 11 | MAKEFILE= Makefile |
| 12 | AR= ar r | 12 | AR= ar r |
| 13 | 13 | ||
| 14 | CAMELLIA_ASM_OBJ= | 14 | CMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o |
| 15 | 15 | ||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | 16 | CFLAGS= $(INCLUDES) $(CFLAG) |
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) |
| @@ -25,8 +25,7 @@ LIB=$(TOP)/libcrypto.a | |||
| 25 | LIBSRC=camellia.c cmll_misc.c cmll_ecb.c cmll_cbc.c cmll_ofb.c \ | 25 | LIBSRC=camellia.c cmll_misc.c cmll_ecb.c cmll_cbc.c cmll_ofb.c \ |
| 26 | cmll_cfb.c cmll_ctr.c | 26 | cmll_cfb.c cmll_ctr.c |
| 27 | 27 | ||
| 28 | LIBOBJ= camellia.o cmll_misc.o cmll_ecb.o cmll_cbc.o cmll_ofb.o \ | 28 | LIBOBJ= cmll_ecb.o cmll_ofb.o cmll_cfb.o cmll_ctr.o $(CMLL_ENC) |
| 29 | cmll_cfb.o cmll_ctr.o $(CAMELLIA_ASM_OBJ) | ||
| 30 | 29 | ||
| 31 | SRC= $(LIBSRC) | 30 | SRC= $(LIBSRC) |
| 32 | 31 | ||
| @@ -41,12 +40,14 @@ top: | |||
| 41 | all: lib | 40 | all: lib |
| 42 | 41 | ||
| 43 | lib: $(LIBOBJ) | 42 | lib: $(LIBOBJ) |
| 44 | $(ARX) $(LIB) $(LIBOBJ) | 43 | $(AR) $(LIB) $(LIBOBJ) |
| 45 | $(RANLIB) $(LIB) || echo Never mind. | 44 | $(RANLIB) $(LIB) || echo Never mind. |
| 46 | @touch lib | 45 | @touch lib |
| 47 | 46 | ||
| 48 | $(LIBOBJ): $(LIBSRC) | 47 | cmll-x86.s: asm/cmll-x86.pl ../perlasm/x86asm.pl |
| 49 | 48 | $(PERL) asm/cmll-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | |
| 49 | cmll-x86_64.s: asm/cmll-x86_64.pl | ||
| 50 | $(PERL) asm/cmll-x86_64.pl $(PERLASM_SCHEME) > $@ | ||
| 50 | 51 | ||
| 51 | files: | 52 | files: |
| 52 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | 53 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO |
| @@ -85,19 +86,18 @@ clean: | |||
| 85 | 86 | ||
| 86 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 87 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 87 | 88 | ||
| 88 | camellia.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | 89 | camellia.o: ../../include/openssl/opensslconf.h camellia.c camellia.h |
| 89 | camellia.o: camellia.c camellia.h cmll_locl.h | 90 | camellia.o: cmll_locl.h |
| 90 | cmll_cbc.o: ../../include/openssl/camellia.h ../../include/openssl/e_os2.h | 91 | cmll_cbc.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h |
| 91 | cmll_cbc.o: ../../include/openssl/opensslconf.h cmll_cbc.c cmll_locl.h | 92 | cmll_cbc.o: ../../include/openssl/opensslconf.h cmll_cbc.c |
| 92 | cmll_cfb.o: ../../e_os.h ../../include/openssl/camellia.h | 93 | cmll_cfb.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h |
| 93 | cmll_cfb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | 94 | cmll_cfb.o: ../../include/openssl/opensslconf.h cmll_cfb.c |
| 94 | cmll_cfb.o: cmll_cfb.c cmll_locl.h | 95 | cmll_ctr.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h |
| 95 | cmll_ctr.o: ../../include/openssl/camellia.h ../../include/openssl/e_os2.h | 96 | cmll_ctr.o: ../../include/openssl/opensslconf.h cmll_ctr.c |
| 96 | cmll_ctr.o: ../../include/openssl/opensslconf.h cmll_ctr.c cmll_locl.h | 97 | cmll_ecb.o: ../../include/openssl/camellia.h |
| 97 | cmll_ecb.o: ../../include/openssl/camellia.h ../../include/openssl/e_os2.h | ||
| 98 | cmll_ecb.o: ../../include/openssl/opensslconf.h cmll_ecb.c cmll_locl.h | 98 | cmll_ecb.o: ../../include/openssl/opensslconf.h cmll_ecb.c cmll_locl.h |
| 99 | cmll_misc.o: ../../include/openssl/camellia.h ../../include/openssl/e_os2.h | 99 | cmll_misc.o: ../../include/openssl/camellia.h |
| 100 | cmll_misc.o: ../../include/openssl/opensslconf.h | 100 | cmll_misc.o: ../../include/openssl/opensslconf.h |
| 101 | cmll_misc.o: ../../include/openssl/opensslv.h cmll_locl.h cmll_misc.c | 101 | cmll_misc.o: ../../include/openssl/opensslv.h cmll_locl.h cmll_misc.c |
| 102 | cmll_ofb.o: ../../include/openssl/camellia.h ../../include/openssl/e_os2.h | 102 | cmll_ofb.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h |
| 103 | cmll_ofb.o: ../../include/openssl/opensslconf.h cmll_locl.h cmll_ofb.c | 103 | cmll_ofb.o: ../../include/openssl/opensslconf.h cmll_ofb.c |
diff --git a/src/lib/libcrypto/cms/Makefile b/src/lib/libcrypto/cms/Makefile index 1c137e0cff..5837049725 100644 --- a/src/lib/libcrypto/cms/Makefile +++ b/src/lib/libcrypto/cms/Makefile | |||
| @@ -37,7 +37,7 @@ test: | |||
| 37 | all: lib | 37 | all: lib |
| 38 | 38 | ||
| 39 | lib: $(LIBOBJ) | 39 | lib: $(LIBOBJ) |
| 40 | $(ARX) $(LIB) $(LIBOBJ) | 40 | $(AR) $(LIB) $(LIBOBJ) |
| 41 | $(RANLIB) $(LIB) || echo Never mind. | 41 | $(RANLIB) $(LIB) || echo Never mind. |
| 42 | @touch lib | 42 | @touch lib |
| 43 | 43 | ||
| @@ -108,6 +108,71 @@ cms_att.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | |||
| 108 | cms_att.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 108 | cms_att.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 109 | cms_att.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | 109 | cms_att.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h |
| 110 | cms_att.o: cms.h cms_att.c cms_lcl.h | 110 | cms_att.o: cms.h cms_att.c cms_lcl.h |
| 111 | cms_cd.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 112 | cms_cd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 113 | cms_cd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 114 | cms_cd.o: ../../include/openssl/comp.h ../../include/openssl/conf.h | ||
| 115 | cms_cd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 116 | cms_cd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 117 | cms_cd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 118 | cms_cd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 119 | cms_cd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 120 | cms_cd.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 121 | cms_cd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 122 | cms_cd.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 123 | cms_cd.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 124 | cms_cd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 125 | cms_cd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 126 | cms_cd.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_cd.c cms_lcl.h | ||
| 127 | cms_dd.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 128 | cms_dd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 129 | cms_dd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 130 | cms_dd.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 131 | cms_dd.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 132 | cms_dd.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 133 | cms_dd.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 134 | cms_dd.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 135 | cms_dd.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 136 | cms_dd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 137 | cms_dd.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 138 | cms_dd.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 139 | cms_dd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 140 | cms_dd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 141 | cms_dd.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 142 | cms_dd.o: ../cryptlib.h cms_dd.c cms_lcl.h | ||
| 143 | cms_enc.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 144 | cms_enc.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 145 | cms_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 146 | cms_enc.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 147 | cms_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 148 | cms_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 149 | cms_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 150 | cms_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 151 | cms_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 152 | cms_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 153 | cms_enc.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 154 | cms_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 155 | cms_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 156 | cms_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 157 | cms_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 158 | cms_enc.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_enc.c cms_lcl.h | ||
| 159 | cms_env.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 160 | cms_env.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 161 | cms_env.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 162 | cms_env.o: ../../include/openssl/cms.h ../../include/openssl/conf.h | ||
| 163 | cms_env.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 164 | cms_env.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 165 | cms_env.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 166 | cms_env.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 167 | cms_env.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 168 | cms_env.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 169 | cms_env.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 170 | cms_env.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 171 | cms_env.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 172 | cms_env.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 173 | cms_env.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 174 | cms_env.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 175 | cms_env.o: ../asn1/asn1_locl.h ../cryptlib.h cms_env.c cms_lcl.h | ||
| 111 | cms_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 176 | cms_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 112 | cms_err.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | 177 | cms_err.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h |
| 113 | cms_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 178 | cms_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| @@ -121,6 +186,22 @@ cms_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | |||
| 121 | cms_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 186 | cms_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 122 | cms_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 187 | cms_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 123 | cms_err.o: cms_err.c | 188 | cms_err.o: cms_err.c |
| 189 | cms_ess.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 190 | cms_ess.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 191 | cms_ess.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 192 | cms_ess.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 193 | cms_ess.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 194 | cms_ess.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 195 | cms_ess.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 196 | cms_ess.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 197 | cms_ess.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 198 | cms_ess.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 199 | cms_ess.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 200 | cms_ess.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 201 | cms_ess.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 202 | cms_ess.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 203 | cms_ess.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 204 | cms_ess.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_ess.c cms_lcl.h | ||
| 124 | cms_io.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | 205 | cms_io.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h |
| 125 | cms_io.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 206 | cms_io.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h |
| 126 | cms_io.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | 207 | cms_io.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| @@ -164,7 +245,7 @@ cms_sd.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | |||
| 164 | cms_sd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 245 | cms_sd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 165 | cms_sd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 246 | cms_sd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 166 | cms_sd.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | 247 | cms_sd.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h |
| 167 | cms_sd.o: ../cryptlib.h cms_lcl.h cms_sd.c | 248 | cms_sd.o: ../asn1/asn1_locl.h ../cryptlib.h cms_lcl.h cms_sd.c |
| 168 | cms_smime.o: ../../e_os.h ../../include/openssl/asn1.h | 249 | cms_smime.o: ../../e_os.h ../../include/openssl/asn1.h |
| 169 | cms_smime.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | 250 | cms_smime.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h |
| 170 | cms_smime.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | 251 | cms_smime.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h |
diff --git a/src/lib/libcrypto/dso/dso_beos.c b/src/lib/libcrypto/dso/dso_beos.c new file mode 100644 index 0000000000..553966e699 --- /dev/null +++ b/src/lib/libcrypto/dso/dso_beos.c | |||
| @@ -0,0 +1,270 @@ | |||
| 1 | /* dso_beos.c */ | ||
| 2 | /* Written by Marcin Konicki (ahwayakchih@neoni.net) for the OpenSSL | ||
| 3 | * project 2000. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/dso.h> | ||
| 63 | |||
| 64 | #if !defined(OPENSSL_SYS_BEOS) | ||
| 65 | DSO_METHOD *DSO_METHOD_beos(void) | ||
| 66 | { | ||
| 67 | return NULL; | ||
| 68 | } | ||
| 69 | #else | ||
| 70 | |||
| 71 | #include <kernel/image.h> | ||
| 72 | |||
| 73 | static int beos_load(DSO *dso); | ||
| 74 | static int beos_unload(DSO *dso); | ||
| 75 | static void *beos_bind_var(DSO *dso, const char *symname); | ||
| 76 | static DSO_FUNC_TYPE beos_bind_func(DSO *dso, const char *symname); | ||
| 77 | #if 0 | ||
| 78 | static int beos_unbind_var(DSO *dso, char *symname, void *symptr); | ||
| 79 | static int beos_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); | ||
| 80 | static int beos_init(DSO *dso); | ||
| 81 | static int beos_finish(DSO *dso); | ||
| 82 | static long beos_ctrl(DSO *dso, int cmd, long larg, void *parg); | ||
| 83 | #endif | ||
| 84 | static char *beos_name_converter(DSO *dso, const char *filename); | ||
| 85 | |||
| 86 | static DSO_METHOD dso_meth_beos = { | ||
| 87 | "OpenSSL 'beos' shared library method", | ||
| 88 | beos_load, | ||
| 89 | beos_unload, | ||
| 90 | beos_bind_var, | ||
| 91 | beos_bind_func, | ||
| 92 | /* For now, "unbind" doesn't exist */ | ||
| 93 | #if 0 | ||
| 94 | NULL, /* unbind_var */ | ||
| 95 | NULL, /* unbind_func */ | ||
| 96 | #endif | ||
| 97 | NULL, /* ctrl */ | ||
| 98 | beos_name_converter, | ||
| 99 | NULL, /* init */ | ||
| 100 | NULL /* finish */ | ||
| 101 | }; | ||
| 102 | |||
| 103 | DSO_METHOD *DSO_METHOD_beos(void) | ||
| 104 | { | ||
| 105 | return(&dso_meth_beos); | ||
| 106 | } | ||
| 107 | |||
| 108 | /* For this DSO_METHOD, our meth_data STACK will contain; | ||
| 109 | * (i) a pointer to the handle (image_id) returned from | ||
| 110 | * load_add_on(). | ||
| 111 | */ | ||
| 112 | |||
| 113 | static int beos_load(DSO *dso) | ||
| 114 | { | ||
| 115 | image_id id; | ||
| 116 | /* See applicable comments from dso_dl.c */ | ||
| 117 | char *filename = DSO_convert_filename(dso, NULL); | ||
| 118 | |||
| 119 | if(filename == NULL) | ||
| 120 | { | ||
| 121 | DSOerr(DSO_F_BEOS_LOAD,DSO_R_NO_FILENAME); | ||
| 122 | goto err; | ||
| 123 | } | ||
| 124 | id = load_add_on(filename); | ||
| 125 | if(id < 1) | ||
| 126 | { | ||
| 127 | DSOerr(DSO_F_BEOS_LOAD,DSO_R_LOAD_FAILED); | ||
| 128 | ERR_add_error_data(3, "filename(", filename, ")"); | ||
| 129 | goto err; | ||
| 130 | } | ||
| 131 | if(!sk_push(dso->meth_data, (char *)id)) | ||
| 132 | { | ||
| 133 | DSOerr(DSO_F_BEOS_LOAD,DSO_R_STACK_ERROR); | ||
| 134 | goto err; | ||
| 135 | } | ||
| 136 | /* Success */ | ||
| 137 | dso->loaded_filename = filename; | ||
| 138 | return(1); | ||
| 139 | err: | ||
| 140 | /* Cleanup !*/ | ||
| 141 | if(filename != NULL) | ||
| 142 | OPENSSL_free(filename); | ||
| 143 | if(id > 0) | ||
| 144 | unload_add_on(id); | ||
| 145 | return(0); | ||
| 146 | } | ||
| 147 | |||
| 148 | static int beos_unload(DSO *dso) | ||
| 149 | { | ||
| 150 | image_id id; | ||
| 151 | if(dso == NULL) | ||
| 152 | { | ||
| 153 | DSOerr(DSO_F_BEOS_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); | ||
| 154 | return(0); | ||
| 155 | } | ||
| 156 | if(sk_num(dso->meth_data) < 1) | ||
| 157 | return(1); | ||
| 158 | id = (image_id)sk_pop(dso->meth_data); | ||
| 159 | if(id < 1) | ||
| 160 | { | ||
| 161 | DSOerr(DSO_F_BEOS_UNLOAD,DSO_R_NULL_HANDLE); | ||
| 162 | return(0); | ||
| 163 | } | ||
| 164 | if(unload_add_on(id) != B_OK) | ||
| 165 | { | ||
| 166 | DSOerr(DSO_F_BEOS_UNLOAD,DSO_R_UNLOAD_FAILED); | ||
| 167 | /* We should push the value back onto the stack in | ||
| 168 | * case of a retry. */ | ||
| 169 | sk_push(dso->meth_data, (char *)id); | ||
| 170 | return(0); | ||
| 171 | } | ||
| 172 | return(1); | ||
| 173 | } | ||
| 174 | |||
| 175 | static void *beos_bind_var(DSO *dso, const char *symname) | ||
| 176 | { | ||
| 177 | image_id id; | ||
| 178 | void *sym; | ||
| 179 | |||
| 180 | if((dso == NULL) || (symname == NULL)) | ||
| 181 | { | ||
| 182 | DSOerr(DSO_F_BEOS_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); | ||
| 183 | return(NULL); | ||
| 184 | } | ||
| 185 | if(sk_num(dso->meth_data) < 1) | ||
| 186 | { | ||
| 187 | DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_STACK_ERROR); | ||
| 188 | return(NULL); | ||
| 189 | } | ||
| 190 | id = (image_id)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); | ||
| 191 | if(id < 1) | ||
| 192 | { | ||
| 193 | DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_NULL_HANDLE); | ||
| 194 | return(NULL); | ||
| 195 | } | ||
| 196 | if(get_image_symbol(id, symname, B_SYMBOL_TYPE_DATA, &sym) != B_OK) | ||
| 197 | { | ||
| 198 | DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_SYM_FAILURE); | ||
| 199 | ERR_add_error_data(3, "symname(", symname, ")"); | ||
| 200 | return(NULL); | ||
| 201 | } | ||
| 202 | return(sym); | ||
| 203 | } | ||
| 204 | |||
| 205 | static DSO_FUNC_TYPE beos_bind_func(DSO *dso, const char *symname) | ||
| 206 | { | ||
| 207 | image_id id; | ||
| 208 | void *sym; | ||
| 209 | |||
| 210 | if((dso == NULL) || (symname == NULL)) | ||
| 211 | { | ||
| 212 | DSOerr(DSO_F_BEOS_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); | ||
| 213 | return(NULL); | ||
| 214 | } | ||
| 215 | if(sk_num(dso->meth_data) < 1) | ||
| 216 | { | ||
| 217 | DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_STACK_ERROR); | ||
| 218 | return(NULL); | ||
| 219 | } | ||
| 220 | id = (image_id)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); | ||
| 221 | if(id < 1) | ||
| 222 | { | ||
| 223 | DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_NULL_HANDLE); | ||
| 224 | return(NULL); | ||
| 225 | } | ||
| 226 | if(get_image_symbol(id, symname, B_SYMBOL_TYPE_TEXT, &sym) != B_OK) | ||
| 227 | { | ||
| 228 | DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_SYM_FAILURE); | ||
| 229 | ERR_add_error_data(3, "symname(", symname, ")"); | ||
| 230 | return(NULL); | ||
| 231 | } | ||
| 232 | return((DSO_FUNC_TYPE)sym); | ||
| 233 | } | ||
| 234 | |||
| 235 | /* This one is the same as the one in dlfcn */ | ||
| 236 | static char *beos_name_converter(DSO *dso, const char *filename) | ||
| 237 | { | ||
| 238 | char *translated; | ||
| 239 | int len, rsize, transform; | ||
| 240 | |||
| 241 | len = strlen(filename); | ||
| 242 | rsize = len + 1; | ||
| 243 | transform = (strstr(filename, "/") == NULL); | ||
| 244 | if(transform) | ||
| 245 | { | ||
| 246 | /* We will convert this to "%s.so" or "lib%s.so" */ | ||
| 247 | rsize += 3; /* The length of ".so" */ | ||
| 248 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | ||
| 249 | rsize += 3; /* The length of "lib" */ | ||
| 250 | } | ||
| 251 | translated = OPENSSL_malloc(rsize); | ||
| 252 | if(translated == NULL) | ||
| 253 | { | ||
| 254 | DSOerr(DSO_F_BEOS_NAME_CONVERTER, | ||
| 255 | DSO_R_NAME_TRANSLATION_FAILED); | ||
| 256 | return(NULL); | ||
| 257 | } | ||
| 258 | if(transform) | ||
| 259 | { | ||
| 260 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | ||
| 261 | sprintf(translated, "lib%s.so", filename); | ||
| 262 | else | ||
| 263 | sprintf(translated, "%s.so", filename); | ||
| 264 | } | ||
| 265 | else | ||
| 266 | sprintf(translated, "%s", filename); | ||
| 267 | return(translated); | ||
| 268 | } | ||
| 269 | |||
| 270 | #endif | ||
diff --git a/src/lib/libcrypto/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/ecdh/ecdhtest.c b/src/lib/libcrypto/ecdh/ecdhtest.c index 1575006b51..212a87efa4 100644 --- a/src/lib/libcrypto/ecdh/ecdhtest.c +++ b/src/lib/libcrypto/ecdh/ecdhtest.c | |||
| @@ -343,7 +343,7 @@ err: | |||
| 343 | if (ctx) BN_CTX_free(ctx); | 343 | if (ctx) BN_CTX_free(ctx); |
| 344 | BIO_free(out); | 344 | BIO_free(out); |
| 345 | CRYPTO_cleanup_all_ex_data(); | 345 | CRYPTO_cleanup_all_ex_data(); |
| 346 | ERR_remove_state(0); | 346 | ERR_remove_thread_state(NULL); |
| 347 | CRYPTO_mem_leaks_fp(stderr); | 347 | CRYPTO_mem_leaks_fp(stderr); |
| 348 | EXIT(ret); | 348 | EXIT(ret); |
| 349 | return(ret); | 349 | return(ret); |
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/ecdsa/ecdsatest.c b/src/lib/libcrypto/ecdsa/ecdsatest.c index b07e31252b..aa4e1481a8 100644 --- a/src/lib/libcrypto/ecdsa/ecdsatest.c +++ b/src/lib/libcrypto/ecdsa/ecdsatest.c | |||
| @@ -490,7 +490,7 @@ err: | |||
| 490 | if (ret) | 490 | if (ret) |
| 491 | ERR_print_errors(out); | 491 | ERR_print_errors(out); |
| 492 | CRYPTO_cleanup_all_ex_data(); | 492 | CRYPTO_cleanup_all_ex_data(); |
| 493 | ERR_remove_state(0); | 493 | ERR_remove_thread_state(NULL); |
| 494 | ERR_free_strings(); | 494 | ERR_free_strings(); |
| 495 | CRYPTO_mem_leaks(out); | 495 | CRYPTO_mem_leaks(out); |
| 496 | if (out != NULL) | 496 | if (out != NULL) |
diff --git a/src/lib/libcrypto/evp/e_seed.c b/src/lib/libcrypto/evp/e_seed.c index 8c1ec0d43a..2d1759d276 100644 --- a/src/lib/libcrypto/evp/e_seed.c +++ b/src/lib/libcrypto/evp/e_seed.c | |||
| @@ -54,11 +54,11 @@ | |||
| 54 | */ | 54 | */ |
| 55 | 55 | ||
| 56 | #include <openssl/opensslconf.h> | 56 | #include <openssl/opensslconf.h> |
| 57 | #ifndef OPENSSL_NO_SEED | ||
| 57 | #include <openssl/evp.h> | 58 | #include <openssl/evp.h> |
| 58 | #include <openssl/err.h> | 59 | #include <openssl/err.h> |
| 59 | #include <string.h> | 60 | #include <string.h> |
| 60 | #include <assert.h> | 61 | #include <assert.h> |
| 61 | #ifndef OPENSSL_NO_SEED | ||
| 62 | #include <openssl/seed.h> | 62 | #include <openssl/seed.h> |
| 63 | #include "evp_locl.h" | 63 | #include "evp_locl.h" |
| 64 | 64 | ||
diff --git a/src/lib/libcrypto/jpake/Makefile b/src/lib/libcrypto/jpake/Makefile index a4a1402f2e..110c49ce0b 100644 --- a/src/lib/libcrypto/jpake/Makefile +++ b/src/lib/libcrypto/jpake/Makefile | |||
| @@ -16,7 +16,7 @@ top: | |||
| 16 | all: lib | 16 | all: lib |
| 17 | 17 | ||
| 18 | lib: $(LIBOBJ) | 18 | lib: $(LIBOBJ) |
| 19 | $(ARX) $(LIB) $(LIBOBJ) | 19 | $(AR) $(LIB) $(LIBOBJ) |
| 20 | $(RANLIB) $(LIB) || echo Never mind. | 20 | $(RANLIB) $(LIB) || echo Never mind. |
| 21 | @touch lib | 21 | @touch lib |
| 22 | 22 | ||
diff --git a/src/lib/libcrypto/jpake/jpake.c b/src/lib/libcrypto/jpake/jpake.c index 577b7ef375..086d9f47e0 100644 --- a/src/lib/libcrypto/jpake/jpake.c +++ b/src/lib/libcrypto/jpake/jpake.c | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | #include <openssl/sha.h> | 4 | #include <openssl/sha.h> |
| 5 | #include <openssl/err.h> | 5 | #include <openssl/err.h> |
| 6 | #include <memory.h> | 6 | #include <memory.h> |
| 7 | #include <assert.h> | ||
| 8 | 7 | ||
| 9 | /* | 8 | /* |
| 10 | * In the definition, (xa, xb, xc, xd) are Alice's (x1, x2, x3, x4) or | 9 | * In the definition, (xa, xb, xc, xd) are Alice's (x1, x2, x3, x4) or |
| @@ -134,7 +133,7 @@ static void hashlength(SHA_CTX *sha, size_t l) | |||
| 134 | { | 133 | { |
| 135 | unsigned char b[2]; | 134 | unsigned char b[2]; |
| 136 | 135 | ||
| 137 | assert(l <= 0xffff); | 136 | OPENSSL_assert(l <= 0xffff); |
| 138 | b[0] = l >> 8; | 137 | b[0] = l >> 8; |
| 139 | b[1] = l&0xff; | 138 | b[1] = l&0xff; |
| 140 | SHA1_Update(sha, b, 2); | 139 | SHA1_Update(sha, b, 2); |
| @@ -172,7 +171,7 @@ static void zkp_hash(BIGNUM *h, const BIGNUM *zkpg, const JPAKE_STEP_PART *p, | |||
| 172 | */ | 171 | */ |
| 173 | SHA1_Init(&sha); | 172 | SHA1_Init(&sha); |
| 174 | hashbn(&sha, zkpg); | 173 | hashbn(&sha, zkpg); |
| 175 | assert(!BN_is_zero(p->zkpx.gr)); | 174 | OPENSSL_assert(!BN_is_zero(p->zkpx.gr)); |
| 176 | hashbn(&sha, p->zkpx.gr); | 175 | hashbn(&sha, p->zkpx.gr); |
| 177 | hashbn(&sha, p->gx); | 176 | hashbn(&sha, p->gx); |
| 178 | hashstring(&sha, proof_name); | 177 | hashstring(&sha, proof_name); |
diff --git a/src/lib/libcrypto/jpake/jpaketest.c b/src/lib/libcrypto/jpake/jpaketest.c index 792fc49eb4..eaba75ed8a 100644 --- a/src/lib/libcrypto/jpake/jpaketest.c +++ b/src/lib/libcrypto/jpake/jpaketest.c | |||
| @@ -182,7 +182,7 @@ int main(int argc, char **argv) | |||
| 182 | BN_free(p); | 182 | BN_free(p); |
| 183 | 183 | ||
| 184 | CRYPTO_cleanup_all_ex_data(); | 184 | CRYPTO_cleanup_all_ex_data(); |
| 185 | ERR_remove_state(0); | 185 | ERR_remove_thread_state(NULL); |
| 186 | ERR_free_strings(); | 186 | ERR_free_strings(); |
| 187 | CRYPTO_mem_leaks(bio_err); | 187 | CRYPTO_mem_leaks(bio_err); |
| 188 | 188 | ||
diff --git a/src/lib/libcrypto/mdc2/mdc2_one.c b/src/lib/libcrypto/mdc2/mdc2_one.c new file mode 100644 index 0000000000..72647f67ed --- /dev/null +++ b/src/lib/libcrypto/mdc2/mdc2_one.c | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | /* crypto/mdc2/mdc2_one.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/mdc2.h> | ||
| 62 | |||
| 63 | unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md) | ||
| 64 | { | ||
| 65 | MDC2_CTX c; | ||
| 66 | static unsigned char m[MDC2_DIGEST_LENGTH]; | ||
| 67 | |||
| 68 | if (md == NULL) md=m; | ||
| 69 | if (!MDC2_Init(&c)) | ||
| 70 | return NULL; | ||
| 71 | MDC2_Update(&c,d,n); | ||
| 72 | MDC2_Final(md,&c); | ||
| 73 | OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */ | ||
| 74 | return(md); | ||
| 75 | } | ||
| 76 | |||
diff --git a/src/lib/libcrypto/mdc2/mdc2dgst.c b/src/lib/libcrypto/mdc2/mdc2dgst.c new file mode 100644 index 0000000000..4aa406edc3 --- /dev/null +++ b/src/lib/libcrypto/mdc2/mdc2dgst.c | |||
| @@ -0,0 +1,199 @@ | |||
| 1 | /* crypto/mdc2/mdc2dgst.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | #include <openssl/des.h> | ||
| 63 | #include <openssl/mdc2.h> | ||
| 64 | |||
| 65 | #undef c2l | ||
| 66 | #define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ | ||
| 67 | l|=((DES_LONG)(*((c)++)))<< 8L, \ | ||
| 68 | l|=((DES_LONG)(*((c)++)))<<16L, \ | ||
| 69 | l|=((DES_LONG)(*((c)++)))<<24L) | ||
| 70 | |||
| 71 | #undef l2c | ||
| 72 | #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ | ||
| 73 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
| 74 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
| 75 | *((c)++)=(unsigned char)(((l)>>24L)&0xff)) | ||
| 76 | |||
| 77 | static void mdc2_body(MDC2_CTX *c, const unsigned char *in, size_t len); | ||
| 78 | int MDC2_Init(MDC2_CTX *c) | ||
| 79 | { | ||
| 80 | c->num=0; | ||
| 81 | c->pad_type=1; | ||
| 82 | memset(&(c->h[0]),0x52,MDC2_BLOCK); | ||
| 83 | memset(&(c->hh[0]),0x25,MDC2_BLOCK); | ||
| 84 | return 1; | ||
| 85 | } | ||
| 86 | |||
| 87 | int MDC2_Update(MDC2_CTX *c, const unsigned char *in, size_t len) | ||
| 88 | { | ||
| 89 | size_t i,j; | ||
| 90 | |||
| 91 | i=c->num; | ||
| 92 | if (i != 0) | ||
| 93 | { | ||
| 94 | if (i+len < MDC2_BLOCK) | ||
| 95 | { | ||
| 96 | /* partial block */ | ||
| 97 | memcpy(&(c->data[i]),in,len); | ||
| 98 | c->num+=(int)len; | ||
| 99 | return 1; | ||
| 100 | } | ||
| 101 | else | ||
| 102 | { | ||
| 103 | /* filled one */ | ||
| 104 | j=MDC2_BLOCK-i; | ||
| 105 | memcpy(&(c->data[i]),in,j); | ||
| 106 | len-=j; | ||
| 107 | in+=j; | ||
| 108 | c->num=0; | ||
| 109 | mdc2_body(c,&(c->data[0]),MDC2_BLOCK); | ||
| 110 | } | ||
| 111 | } | ||
| 112 | i=len&~((size_t)MDC2_BLOCK-1); | ||
| 113 | if (i > 0) mdc2_body(c,in,i); | ||
| 114 | j=len-i; | ||
| 115 | if (j > 0) | ||
| 116 | { | ||
| 117 | memcpy(&(c->data[0]),&(in[i]),j); | ||
| 118 | c->num=(int)j; | ||
| 119 | } | ||
| 120 | return 1; | ||
| 121 | } | ||
| 122 | |||
| 123 | static void mdc2_body(MDC2_CTX *c, const unsigned char *in, size_t len) | ||
| 124 | { | ||
| 125 | register DES_LONG tin0,tin1; | ||
| 126 | register DES_LONG ttin0,ttin1; | ||
| 127 | DES_LONG d[2],dd[2]; | ||
| 128 | DES_key_schedule k; | ||
| 129 | unsigned char *p; | ||
| 130 | size_t i; | ||
| 131 | |||
| 132 | for (i=0; i<len; i+=8) | ||
| 133 | { | ||
| 134 | c2l(in,tin0); d[0]=dd[0]=tin0; | ||
| 135 | c2l(in,tin1); d[1]=dd[1]=tin1; | ||
| 136 | c->h[0]=(c->h[0]&0x9f)|0x40; | ||
| 137 | c->hh[0]=(c->hh[0]&0x9f)|0x20; | ||
| 138 | |||
| 139 | DES_set_odd_parity(&c->h); | ||
| 140 | DES_set_key_unchecked(&c->h,&k); | ||
| 141 | DES_encrypt1(d,&k,1); | ||
| 142 | |||
| 143 | DES_set_odd_parity(&c->hh); | ||
| 144 | DES_set_key_unchecked(&c->hh,&k); | ||
| 145 | DES_encrypt1(dd,&k,1); | ||
| 146 | |||
| 147 | ttin0=tin0^dd[0]; | ||
| 148 | ttin1=tin1^dd[1]; | ||
| 149 | tin0^=d[0]; | ||
| 150 | tin1^=d[1]; | ||
| 151 | |||
| 152 | p=c->h; | ||
| 153 | l2c(tin0,p); | ||
| 154 | l2c(ttin1,p); | ||
| 155 | p=c->hh; | ||
| 156 | l2c(ttin0,p); | ||
| 157 | l2c(tin1,p); | ||
| 158 | } | ||
| 159 | } | ||
| 160 | |||
| 161 | int MDC2_Final(unsigned char *md, MDC2_CTX *c) | ||
| 162 | { | ||
| 163 | unsigned int i; | ||
| 164 | int j; | ||
| 165 | |||
| 166 | i=c->num; | ||
| 167 | j=c->pad_type; | ||
| 168 | if ((i > 0) || (j == 2)) | ||
| 169 | { | ||
| 170 | if (j == 2) | ||
| 171 | c->data[i++]=0x80; | ||
| 172 | memset(&(c->data[i]),0,MDC2_BLOCK-i); | ||
| 173 | mdc2_body(c,c->data,MDC2_BLOCK); | ||
| 174 | } | ||
| 175 | memcpy(md,(char *)c->h,MDC2_BLOCK); | ||
| 176 | memcpy(&(md[MDC2_BLOCK]),(char *)c->hh,MDC2_BLOCK); | ||
| 177 | return 1; | ||
| 178 | } | ||
| 179 | |||
| 180 | #undef TEST | ||
| 181 | |||
| 182 | #ifdef TEST | ||
| 183 | main() | ||
| 184 | { | ||
| 185 | unsigned char md[MDC2_DIGEST_LENGTH]; | ||
| 186 | int i; | ||
| 187 | MDC2_CTX c; | ||
| 188 | static char *text="Now is the time for all "; | ||
| 189 | |||
| 190 | MDC2_Init(&c); | ||
| 191 | MDC2_Update(&c,text,strlen(text)); | ||
| 192 | MDC2_Final(&(md[0]),&c); | ||
| 193 | |||
| 194 | for (i=0; i<MDC2_DIGEST_LENGTH; i++) | ||
| 195 | printf("%02X",md[i]); | ||
| 196 | printf("\n"); | ||
| 197 | } | ||
| 198 | |||
| 199 | #endif | ||
diff --git a/src/lib/libcrypto/modes/Makefile b/src/lib/libcrypto/modes/Makefile new file mode 100644 index 0000000000..6c85861b6c --- /dev/null +++ b/src/lib/libcrypto/modes/Makefile | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/modes/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= modes | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= cbc128.c ctr128.c cts128.c cfb128.c ofb128.c | ||
| 21 | LIBOBJ= cbc128.o ctr128.o cts128.o cfb128.o ofb128.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | #EXHEADER= store.h str_compat.h | ||
| 26 | EXHEADER= modes.h | ||
| 27 | HEADER= $(EXHEADER) | ||
| 28 | |||
| 29 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 30 | |||
| 31 | top: | ||
| 32 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 33 | |||
| 34 | all: lib | ||
| 35 | |||
| 36 | lib: $(LIBOBJ) | ||
| 37 | $(AR) $(LIB) $(LIBOBJ) | ||
| 38 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 39 | @touch lib | ||
| 40 | |||
| 41 | files: | ||
| 42 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 43 | |||
| 44 | links: | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 48 | |||
| 49 | install: | ||
| 50 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 51 | @headerlist="$(EXHEADER)"; for i in $$headerlist; \ | ||
| 52 | do \ | ||
| 53 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 54 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 55 | done; | ||
| 56 | |||
| 57 | tags: | ||
| 58 | ctags $(SRC) | ||
| 59 | |||
| 60 | tests: | ||
| 61 | |||
| 62 | lint: | ||
| 63 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 64 | |||
| 65 | depend: | ||
| 66 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 67 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 68 | |||
| 69 | dclean: | ||
| 70 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 71 | mv -f Makefile.new $(MAKEFILE) | ||
| 72 | |||
| 73 | clean: | ||
| 74 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 75 | |||
| 76 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 77 | |||
| 78 | cbc128.o: cbc128.c modes.h | ||
| 79 | cfb128.o: cfb128.c modes.h | ||
| 80 | ctr128.o: ctr128.c modes.h | ||
| 81 | cts128.o: cts128.c modes.h | ||
| 82 | ofb128.o: modes.h ofb128.c | ||
diff --git a/src/lib/libcrypto/perlasm/x86masm.pl b/src/lib/libcrypto/perlasm/x86masm.pl new file mode 100644 index 0000000000..3d50e4a786 --- /dev/null +++ b/src/lib/libcrypto/perlasm/x86masm.pl | |||
| @@ -0,0 +1,184 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | package x86masm; | ||
| 4 | |||
| 5 | *out=\@::out; | ||
| 6 | |||
| 7 | $::lbdecor="\$L"; # local label decoration | ||
| 8 | $nmdecor="_"; # external name decoration | ||
| 9 | |||
| 10 | $initseg=""; | ||
| 11 | $segment=""; | ||
| 12 | |||
| 13 | sub ::generic | ||
| 14 | { my ($opcode,@arg)=@_; | ||
| 15 | |||
| 16 | # fix hexadecimal constants | ||
| 17 | for (@arg) { s/0x([0-9a-f]+)/0$1h/oi; } | ||
| 18 | |||
| 19 | if ($opcode !~ /movq/) | ||
| 20 | { # fix xmm references | ||
| 21 | $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i); | ||
| 22 | $arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i); | ||
| 23 | } | ||
| 24 | |||
| 25 | &::emit($opcode,@arg); | ||
| 26 | 1; | ||
| 27 | } | ||
| 28 | # | ||
| 29 | # opcodes not covered by ::generic above, mostly inconsistent namings... | ||
| 30 | # | ||
| 31 | sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); } | ||
| 32 | sub ::call_ptr { &::emit("call",@_); } | ||
| 33 | sub ::jmp_ptr { &::emit("jmp",@_); } | ||
| 34 | |||
| 35 | sub get_mem | ||
| 36 | { my($size,$addr,$reg1,$reg2,$idx)=@_; | ||
| 37 | my($post,$ret); | ||
| 38 | |||
| 39 | $ret .= "$size PTR " if ($size ne ""); | ||
| 40 | |||
| 41 | $addr =~ s/^\s+//; | ||
| 42 | # prepend global references with optional underscore | ||
| 43 | $addr =~ s/^([^\+\-0-9][^\+\-]*)/&::islabel($1) or "$nmdecor$1"/ige; | ||
| 44 | # put address arithmetic expression in parenthesis | ||
| 45 | $addr="($addr)" if ($addr =~ /^.+[\-\+].+$/); | ||
| 46 | |||
| 47 | if (($addr ne "") && ($addr ne 0)) | ||
| 48 | { if ($addr !~ /^-/) { $ret .= "$addr"; } | ||
| 49 | else { $post=$addr; } | ||
| 50 | } | ||
| 51 | $ret .= "["; | ||
| 52 | |||
| 53 | if ($reg2 ne "") | ||
| 54 | { $idx!=0 or $idx=1; | ||
| 55 | $ret .= "$reg2*$idx"; | ||
| 56 | $ret .= "+$reg1" if ($reg1 ne ""); | ||
| 57 | } | ||
| 58 | else | ||
| 59 | { $ret .= "$reg1"; } | ||
| 60 | |||
| 61 | $ret .= "$post]"; | ||
| 62 | $ret =~ s/\+\]/]/; # in case $addr was the only argument | ||
| 63 | $ret =~ s/\[\s*\]//; | ||
| 64 | |||
| 65 | $ret; | ||
| 66 | } | ||
| 67 | sub ::BP { &get_mem("BYTE",@_); } | ||
| 68 | sub ::DWP { &get_mem("DWORD",@_); } | ||
| 69 | sub ::QWP { &get_mem("QWORD",@_); } | ||
| 70 | sub ::BC { "@_"; } | ||
| 71 | sub ::DWC { "@_"; } | ||
| 72 | |||
| 73 | sub ::file | ||
| 74 | { my $tmp=<<___; | ||
| 75 | TITLE $_[0].asm | ||
| 76 | IF \@Version LT 800 | ||
| 77 | ECHO MASM version 8.00 or later is strongly recommended. | ||
| 78 | ENDIF | ||
| 79 | .486 | ||
| 80 | .MODEL FLAT | ||
| 81 | OPTION DOTNAME | ||
| 82 | IF \@Version LT 800 | ||
| 83 | .text\$ SEGMENT PAGE 'CODE' | ||
| 84 | ELSE | ||
| 85 | .text\$ SEGMENT ALIGN(64) 'CODE' | ||
| 86 | ENDIF | ||
| 87 | ___ | ||
| 88 | push(@out,$tmp); | ||
| 89 | $segment = ".text\$"; | ||
| 90 | } | ||
| 91 | |||
| 92 | sub ::function_begin_B | ||
| 93 | { my $func=shift; | ||
| 94 | my $global=($func !~ /^_/); | ||
| 95 | my $begin="${::lbdecor}_${func}_begin"; | ||
| 96 | |||
| 97 | &::LABEL($func,$global?"$begin":"$nmdecor$func"); | ||
| 98 | $func="ALIGN\t16\n".$nmdecor.$func."\tPROC"; | ||
| 99 | |||
| 100 | if ($global) { $func.=" PUBLIC\n${begin}::\n"; } | ||
| 101 | else { $func.=" PRIVATE\n"; } | ||
| 102 | push(@out,$func); | ||
| 103 | $::stack=4; | ||
| 104 | } | ||
| 105 | sub ::function_end_B | ||
| 106 | { my $func=shift; | ||
| 107 | |||
| 108 | push(@out,"$nmdecor$func ENDP\n"); | ||
| 109 | $::stack=0; | ||
| 110 | &::wipe_labels(); | ||
| 111 | } | ||
| 112 | |||
| 113 | sub ::file_end | ||
| 114 | { my $xmmheader=<<___; | ||
| 115 | .686 | ||
| 116 | .XMM | ||
| 117 | IF \@Version LT 800 | ||
| 118 | XMMWORD STRUCT 16 | ||
| 119 | DQ 2 dup (?) | ||
| 120 | XMMWORD ENDS | ||
| 121 | ENDIF | ||
| 122 | ___ | ||
| 123 | if (grep {/\b[x]?mm[0-7]\b/i} @out) { | ||
| 124 | grep {s/\.[3-7]86/$xmmheader/} @out; | ||
| 125 | } | ||
| 126 | |||
| 127 | push(@out,"$segment ENDS\n"); | ||
| 128 | |||
| 129 | if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) | ||
| 130 | { my $comm=<<___; | ||
| 131 | .bss SEGMENT 'BSS' | ||
| 132 | COMM ${nmdecor}OPENSSL_ia32cap_P:DWORD | ||
| 133 | .bss ENDS | ||
| 134 | ___ | ||
| 135 | # comment out OPENSSL_ia32cap_P declarations | ||
| 136 | grep {s/(^EXTERN\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out; | ||
| 137 | push (@out,$comm); | ||
| 138 | } | ||
| 139 | push (@out,$initseg) if ($initseg); | ||
| 140 | push (@out,"END\n"); | ||
| 141 | } | ||
| 142 | |||
| 143 | sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } } | ||
| 144 | |||
| 145 | *::set_label_B = sub | ||
| 146 | { my $l=shift; push(@out,$l.($l=~/^\Q${::lbdecor}\E[0-9]{3}/?":\n":"::\n")); }; | ||
| 147 | |||
| 148 | sub ::external_label | ||
| 149 | { foreach(@_) | ||
| 150 | { push(@out, "EXTERN\t".&::LABEL($_,$nmdecor.$_).":NEAR\n"); } | ||
| 151 | } | ||
| 152 | |||
| 153 | sub ::public_label | ||
| 154 | { push(@out,"PUBLIC\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); } | ||
| 155 | |||
| 156 | sub ::data_byte | ||
| 157 | { push(@out,("DB\t").join(',',@_)."\n"); } | ||
| 158 | |||
| 159 | sub ::data_word | ||
| 160 | { push(@out,("DD\t").join(',',@_)."\n"); } | ||
| 161 | |||
| 162 | sub ::align | ||
| 163 | { push(@out,"ALIGN\t$_[0]\n"); } | ||
| 164 | |||
| 165 | sub ::picmeup | ||
| 166 | { my($dst,$sym)=@_; | ||
| 167 | &::lea($dst,&::DWP($sym)); | ||
| 168 | } | ||
| 169 | |||
| 170 | sub ::initseg | ||
| 171 | { my $f=$nmdecor.shift; | ||
| 172 | |||
| 173 | $initseg.=<<___; | ||
| 174 | .CRT\$XCU SEGMENT DWORD PUBLIC 'DATA' | ||
| 175 | EXTERN $f:NEAR | ||
| 176 | DD $f | ||
| 177 | .CRT\$XCU ENDS | ||
| 178 | ___ | ||
| 179 | } | ||
| 180 | |||
| 181 | sub ::dataseg | ||
| 182 | { push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment="_DATA"; } | ||
| 183 | |||
| 184 | 1; | ||
diff --git a/src/lib/libcrypto/pqueue/Makefile b/src/lib/libcrypto/pqueue/Makefile index 36bfc349aa..fb36a0c876 100644 --- a/src/lib/libcrypto/pqueue/Makefile +++ b/src/lib/libcrypto/pqueue/Makefile | |||
| @@ -22,7 +22,7 @@ LIBOBJ=pqueue.o | |||
| 22 | 22 | ||
| 23 | SRC= $(LIBSRC) | 23 | SRC= $(LIBSRC) |
| 24 | 24 | ||
| 25 | EXHEADER= pqueue.h pq_compat.h | 25 | EXHEADER= pqueue.h |
| 26 | HEADER= $(EXHEADER) | 26 | HEADER= $(EXHEADER) |
| 27 | 27 | ||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | 28 | ALL= $(GENERAL) $(SRC) $(HEADER) |
| @@ -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 | ||
| @@ -79,6 +79,5 @@ pqueue.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | |||
| 79 | pqueue.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 79 | pqueue.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 80 | pqueue.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 80 | pqueue.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
| 81 | pqueue.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | 81 | pqueue.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 82 | pqueue.o: ../../include/openssl/pq_compat.h ../../include/openssl/safestack.h | 82 | pqueue.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
| 83 | pqueue.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 83 | pqueue.o: ../../include/openssl/symhacks.h ../cryptlib.h pqueue.c pqueue.h |
| 84 | pqueue.o: ../cryptlib.h pqueue.c pqueue.h | ||
diff --git a/src/lib/libcrypto/pqueue/pqueue.c b/src/lib/libcrypto/pqueue/pqueue.c index 5cc18527f8..99a6fb874d 100644 --- a/src/lib/libcrypto/pqueue/pqueue.c +++ b/src/lib/libcrypto/pqueue/pqueue.c | |||
| @@ -68,13 +68,12 @@ typedef struct _pqueue | |||
| 68 | } pqueue_s; | 68 | } pqueue_s; |
| 69 | 69 | ||
| 70 | pitem * | 70 | pitem * |
| 71 | pitem_new(PQ_64BIT priority, void *data) | 71 | pitem_new(unsigned char *prio64be, void *data) |
| 72 | { | 72 | { |
| 73 | pitem *item = (pitem *) OPENSSL_malloc(sizeof(pitem)); | 73 | pitem *item = (pitem *) OPENSSL_malloc(sizeof(pitem)); |
| 74 | if (item == NULL) return NULL; | 74 | if (item == NULL) return NULL; |
| 75 | 75 | ||
| 76 | pq_64bit_init(&(item->priority)); | 76 | memcpy(item->priority,prio64be,sizeof(item->priority)); |
| 77 | pq_64bit_assign(&item->priority, &priority); | ||
| 78 | 77 | ||
| 79 | item->data = data; | 78 | item->data = data; |
| 80 | item->next = NULL; | 79 | item->next = NULL; |
| @@ -87,7 +86,6 @@ pitem_free(pitem *item) | |||
| 87 | { | 86 | { |
| 88 | if (item == NULL) return; | 87 | if (item == NULL) return; |
| 89 | 88 | ||
| 90 | pq_64bit_free(&(item->priority)); | ||
| 91 | OPENSSL_free(item); | 89 | OPENSSL_free(item); |
| 92 | } | 90 | } |
| 93 | 91 | ||
| @@ -124,7 +122,10 @@ pqueue_insert(pqueue_s *pq, pitem *item) | |||
| 124 | next != NULL; | 122 | next != NULL; |
| 125 | curr = next, next = next->next) | 123 | curr = next, next = next->next) |
| 126 | { | 124 | { |
| 127 | if (pq_64bit_gt(&(next->priority), &(item->priority))) | 125 | /* we can compare 64-bit value in big-endian encoding |
| 126 | * with memcmp:-) */ | ||
| 127 | int cmp = memcmp(next->priority, item->priority,8); | ||
| 128 | if (cmp > 0) /* next > item */ | ||
| 128 | { | 129 | { |
| 129 | item->next = next; | 130 | item->next = next; |
| 130 | 131 | ||
| @@ -135,8 +136,8 @@ pqueue_insert(pqueue_s *pq, pitem *item) | |||
| 135 | 136 | ||
| 136 | return item; | 137 | return item; |
| 137 | } | 138 | } |
| 138 | /* duplicates not allowed */ | 139 | |
| 139 | if (pq_64bit_eq(&(item->priority), &(next->priority))) | 140 | else if (cmp == 0) /* duplicates not allowed */ |
| 140 | return NULL; | 141 | return NULL; |
| 141 | } | 142 | } |
| 142 | 143 | ||
| @@ -164,7 +165,7 @@ pqueue_pop(pqueue_s *pq) | |||
| 164 | } | 165 | } |
| 165 | 166 | ||
| 166 | pitem * | 167 | pitem * |
| 167 | pqueue_find(pqueue_s *pq, PQ_64BIT priority) | 168 | pqueue_find(pqueue_s *pq, unsigned char *prio64be) |
| 168 | { | 169 | { |
| 169 | pitem *next, *prev = NULL; | 170 | pitem *next, *prev = NULL; |
| 170 | pitem *found = NULL; | 171 | pitem *found = NULL; |
| @@ -175,7 +176,7 @@ pqueue_find(pqueue_s *pq, PQ_64BIT priority) | |||
| 175 | for ( next = pq->items; next->next != NULL; | 176 | for ( next = pq->items; next->next != NULL; |
| 176 | prev = next, next = next->next) | 177 | prev = next, next = next->next) |
| 177 | { | 178 | { |
| 178 | if ( pq_64bit_eq(&(next->priority), &priority)) | 179 | if ( memcmp(next->priority, prio64be,8) == 0) |
| 179 | { | 180 | { |
| 180 | found = next; | 181 | found = next; |
| 181 | break; | 182 | break; |
| @@ -183,7 +184,7 @@ pqueue_find(pqueue_s *pq, PQ_64BIT priority) | |||
| 183 | } | 184 | } |
| 184 | 185 | ||
| 185 | /* check the one last node */ | 186 | /* check the one last node */ |
| 186 | if ( pq_64bit_eq(&(next->priority), &priority)) | 187 | if ( memcmp(next->priority, prio64be,8) ==0) |
| 187 | found = next; | 188 | found = next; |
| 188 | 189 | ||
| 189 | if ( ! found) | 190 | if ( ! found) |
| @@ -199,7 +200,6 @@ pqueue_find(pqueue_s *pq, PQ_64BIT priority) | |||
| 199 | return found; | 200 | return found; |
| 200 | } | 201 | } |
| 201 | 202 | ||
| 202 | #if PQ_64BIT_IS_INTEGER | ||
| 203 | void | 203 | void |
| 204 | pqueue_print(pqueue_s *pq) | 204 | pqueue_print(pqueue_s *pq) |
| 205 | { | 205 | { |
| @@ -207,11 +207,14 @@ pqueue_print(pqueue_s *pq) | |||
| 207 | 207 | ||
| 208 | while(item != NULL) | 208 | while(item != NULL) |
| 209 | { | 209 | { |
| 210 | printf("item\t" PQ_64BIT_PRINT "\n", item->priority); | 210 | printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n", |
| 211 | item->priority[0],item->priority[1], | ||
| 212 | item->priority[2],item->priority[3], | ||
| 213 | item->priority[4],item->priority[5], | ||
| 214 | item->priority[6],item->priority[7]); | ||
| 211 | item = item->next; | 215 | item = item->next; |
| 212 | } | 216 | } |
| 213 | } | 217 | } |
| 214 | #endif | ||
| 215 | 218 | ||
| 216 | pitem * | 219 | pitem * |
| 217 | pqueue_iterator(pqueue_s *pq) | 220 | pqueue_iterator(pqueue_s *pq) |
| @@ -234,3 +237,17 @@ pqueue_next(pitem **item) | |||
| 234 | 237 | ||
| 235 | return ret; | 238 | return ret; |
| 236 | } | 239 | } |
| 240 | |||
| 241 | int | ||
| 242 | pqueue_size(pqueue_s *pq) | ||
| 243 | { | ||
| 244 | pitem *item = pq->items; | ||
| 245 | int count = 0; | ||
| 246 | |||
| 247 | while(item != NULL) | ||
| 248 | { | ||
| 249 | count++; | ||
| 250 | item = item->next; | ||
| 251 | } | ||
| 252 | return count; | ||
| 253 | } | ||
diff --git a/src/lib/libcrypto/pqueue/pqueue.h b/src/lib/libcrypto/pqueue/pqueue.h index 02386d130e..87fc9037c8 100644 --- a/src/lib/libcrypto/pqueue/pqueue.h +++ b/src/lib/libcrypto/pqueue/pqueue.h | |||
| @@ -64,20 +64,18 @@ | |||
| 64 | #include <stdlib.h> | 64 | #include <stdlib.h> |
| 65 | #include <string.h> | 65 | #include <string.h> |
| 66 | 66 | ||
| 67 | #include <openssl/pq_compat.h> | ||
| 68 | |||
| 69 | typedef struct _pqueue *pqueue; | 67 | typedef struct _pqueue *pqueue; |
| 70 | 68 | ||
| 71 | typedef struct _pitem | 69 | typedef struct _pitem |
| 72 | { | 70 | { |
| 73 | PQ_64BIT priority; | 71 | unsigned char priority[8]; /* 64-bit value in big-endian encoding */ |
| 74 | void *data; | 72 | void *data; |
| 75 | struct _pitem *next; | 73 | struct _pitem *next; |
| 76 | } pitem; | 74 | } pitem; |
| 77 | 75 | ||
| 78 | typedef struct _pitem *piterator; | 76 | typedef struct _pitem *piterator; |
| 79 | 77 | ||
| 80 | pitem *pitem_new(PQ_64BIT priority, void *data); | 78 | pitem *pitem_new(unsigned char *prio64be, void *data); |
| 81 | void pitem_free(pitem *item); | 79 | void pitem_free(pitem *item); |
| 82 | 80 | ||
| 83 | pqueue pqueue_new(void); | 81 | pqueue pqueue_new(void); |
| @@ -86,10 +84,11 @@ void pqueue_free(pqueue pq); | |||
| 86 | pitem *pqueue_insert(pqueue pq, pitem *item); | 84 | pitem *pqueue_insert(pqueue pq, pitem *item); |
| 87 | pitem *pqueue_peek(pqueue pq); | 85 | pitem *pqueue_peek(pqueue pq); |
| 88 | pitem *pqueue_pop(pqueue pq); | 86 | pitem *pqueue_pop(pqueue pq); |
| 89 | pitem *pqueue_find(pqueue pq, PQ_64BIT priority); | 87 | pitem *pqueue_find(pqueue pq, unsigned char *prio64be); |
| 90 | pitem *pqueue_iterator(pqueue pq); | 88 | pitem *pqueue_iterator(pqueue pq); |
| 91 | pitem *pqueue_next(piterator *iter); | 89 | pitem *pqueue_next(piterator *iter); |
| 92 | 90 | ||
| 93 | void pqueue_print(pqueue pq); | 91 | void pqueue_print(pqueue pq); |
| 92 | int pqueue_size(pqueue pq); | ||
| 94 | 93 | ||
| 95 | #endif /* ! HEADER_PQUEUE_H */ | 94 | #endif /* ! HEADER_PQUEUE_H */ |
diff --git a/src/lib/libcrypto/seed/Makefile b/src/lib/libcrypto/seed/Makefile index ffaeb84218..4bc55e4916 100644 --- a/src/lib/libcrypto/seed/Makefile +++ b/src/lib/libcrypto/seed/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 | ||
| @@ -75,13 +75,32 @@ clean: | |||
| 75 | 75 | ||
| 76 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 76 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 77 | 77 | ||
| 78 | seed.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | 78 | seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 79 | seed.o: ../../include/openssl/seed.h seed.c seed_locl.h | 79 | seed.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 80 | seed_cbc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | 80 | seed.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h |
| 81 | seed_cbc.o: ../../include/openssl/seed.h seed_cbc.c seed_locl.h | 81 | seed.o: ../../include/openssl/seed.h ../../include/openssl/stack.h |
| 82 | seed_cfb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | 82 | seed.o: ../../include/openssl/symhacks.h seed.c seed_locl.h |
| 83 | seed_cfb.o: ../../include/openssl/seed.h seed_cfb.c seed_locl.h | 83 | seed_cbc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 84 | seed_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/seed.h | 84 | seed_cbc.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h |
| 85 | seed_cbc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 86 | seed_cbc.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h | ||
| 87 | seed_cbc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 88 | seed_cbc.o: seed_cbc.c | ||
| 89 | seed_cfb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 90 | seed_cfb.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h | ||
| 91 | seed_cfb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 92 | seed_cfb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h | ||
| 93 | seed_cfb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 94 | seed_cfb.o: seed_cfb.c | ||
| 95 | seed_ecb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 96 | seed_ecb.o: ../../include/openssl/opensslconf.h | ||
| 97 | seed_ecb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 98 | seed_ecb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h | ||
| 99 | seed_ecb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 85 | seed_ecb.o: seed_ecb.c | 100 | seed_ecb.o: seed_ecb.c |
| 86 | seed_ofb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | 101 | seed_ofb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h |
| 87 | seed_ofb.o: ../../include/openssl/seed.h seed_locl.h seed_ofb.c | 102 | seed_ofb.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h |
| 103 | seed_ofb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 104 | seed_ofb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h | ||
| 105 | seed_ofb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 106 | seed_ofb.o: seed_ofb.c | ||
diff --git a/src/lib/libcrypto/seed/seed.c b/src/lib/libcrypto/seed/seed.c index 125dd7d66f..2bc384a19f 100644 --- a/src/lib/libcrypto/seed/seed.c +++ b/src/lib/libcrypto/seed/seed.c | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | #include <openssl/seed.h> | 35 | #include <openssl/seed.h> |
| 36 | #include "seed_locl.h" | 36 | #include "seed_locl.h" |
| 37 | 37 | ||
| 38 | static seed_word SS[4][256] = { { | 38 | static const seed_word SS[4][256] = { { |
| 39 | 0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124, | 39 | 0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124, |
| 40 | 0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0x0acac2c8, 0x23436360, | 40 | 0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0x0acac2c8, 0x23436360, |
| 41 | 0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x22c2e2e0, 0x08c8c0c8, 0x17071314, | 41 | 0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x22c2e2e0, 0x08c8c0c8, 0x17071314, |
| @@ -187,6 +187,11 @@ static seed_word SS[4][256] = { { | |||
| 187 | #define KC14 0xde6e678d | 187 | #define KC14 0xde6e678d |
| 188 | #define KC15 0xbcdccf1b | 188 | #define KC15 0xbcdccf1b |
| 189 | 189 | ||
| 190 | #if defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 191 | static const seed_word KC[] = { | ||
| 192 | KC0, KC1, KC2, KC3, KC4, KC5, KC6, KC7, | ||
| 193 | KC8, KC9, KC10, KC11, KC12, KC13, KC14, KC15 }; | ||
| 194 | #endif | ||
| 190 | 195 | ||
| 191 | void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks) | 196 | void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks) |
| 192 | { | 197 | { |
| @@ -201,6 +206,8 @@ void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE | |||
| 201 | t0 = (x1 + x3 - KC0) & 0xffffffff; | 206 | t0 = (x1 + x3 - KC0) & 0xffffffff; |
| 202 | t1 = (x2 - x4 + KC0) & 0xffffffff; KEYUPDATE_TEMP(t0, t1, &ks->data[0]); | 207 | t1 = (x2 - x4 + KC0) & 0xffffffff; KEYUPDATE_TEMP(t0, t1, &ks->data[0]); |
| 203 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC1); KEYUPDATE_TEMP(t0, t1, &ks->data[2]); | 208 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC1); KEYUPDATE_TEMP(t0, t1, &ks->data[2]); |
| 209 | |||
| 210 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 204 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC2); KEYUPDATE_TEMP(t0, t1, &ks->data[4]); | 211 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC2); KEYUPDATE_TEMP(t0, t1, &ks->data[4]); |
| 205 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC3); KEYUPDATE_TEMP(t0, t1, &ks->data[6]); | 212 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC3); KEYUPDATE_TEMP(t0, t1, &ks->data[6]); |
| 206 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC4); KEYUPDATE_TEMP(t0, t1, &ks->data[8]); | 213 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC4); KEYUPDATE_TEMP(t0, t1, &ks->data[8]); |
| @@ -215,6 +222,17 @@ void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE | |||
| 215 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC13); KEYUPDATE_TEMP(t0, t1, &ks->data[26]); | 222 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC13); KEYUPDATE_TEMP(t0, t1, &ks->data[26]); |
| 216 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC14); KEYUPDATE_TEMP(t0, t1, &ks->data[28]); | 223 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC14); KEYUPDATE_TEMP(t0, t1, &ks->data[28]); |
| 217 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC15); KEYUPDATE_TEMP(t0, t1, &ks->data[30]); | 224 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC15); KEYUPDATE_TEMP(t0, t1, &ks->data[30]); |
| 225 | #else | ||
| 226 | { | ||
| 227 | int i; | ||
| 228 | for (i=2; i<16; i+=2) { | ||
| 229 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC[i]); | ||
| 230 | KEYUPDATE_TEMP(t0, t1, &ks->data[i*2]); | ||
| 231 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC[i+1]); | ||
| 232 | KEYUPDATE_TEMP(t0, t1, &ks->data[i*2+2]); | ||
| 233 | } | ||
| 234 | } | ||
| 235 | #endif | ||
| 218 | } | 236 | } |
| 219 | 237 | ||
| 220 | void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks) | 238 | void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks) |
| @@ -226,7 +244,8 @@ void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_B | |||
| 226 | char2word(s+4, x2); | 244 | char2word(s+4, x2); |
| 227 | char2word(s+8, x3); | 245 | char2word(s+8, x3); |
| 228 | char2word(s+12, x4); | 246 | char2word(s+12, x4); |
| 229 | 247 | ||
| 248 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 230 | E_SEED(t0, t1, x1, x2, x3, x4, 0); | 249 | E_SEED(t0, t1, x1, x2, x3, x4, 0); |
| 231 | E_SEED(t0, t1, x3, x4, x1, x2, 2); | 250 | E_SEED(t0, t1, x3, x4, x1, x2, 2); |
| 232 | E_SEED(t0, t1, x1, x2, x3, x4, 4); | 251 | E_SEED(t0, t1, x1, x2, x3, x4, 4); |
| @@ -243,6 +262,15 @@ void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_B | |||
| 243 | E_SEED(t0, t1, x3, x4, x1, x2, 26); | 262 | E_SEED(t0, t1, x3, x4, x1, x2, 26); |
| 244 | E_SEED(t0, t1, x1, x2, x3, x4, 28); | 263 | E_SEED(t0, t1, x1, x2, x3, x4, 28); |
| 245 | E_SEED(t0, t1, x3, x4, x1, x2, 30); | 264 | E_SEED(t0, t1, x3, x4, x1, x2, 30); |
| 265 | #else | ||
| 266 | { | ||
| 267 | int i; | ||
| 268 | for (i=0;i<30;i+=4) { | ||
| 269 | E_SEED(t0,t1,x1,x2,x3,x4,i); | ||
| 270 | E_SEED(t0,t1,x3,x4,x1,x2,i+2); | ||
| 271 | } | ||
| 272 | } | ||
| 273 | #endif | ||
| 246 | 274 | ||
| 247 | word2char(x3, d); | 275 | word2char(x3, d); |
| 248 | word2char(x4, d+4); | 276 | word2char(x4, d+4); |
| @@ -259,7 +287,8 @@ void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_B | |||
| 259 | char2word(s+4, x2); | 287 | char2word(s+4, x2); |
| 260 | char2word(s+8, x3); | 288 | char2word(s+8, x3); |
| 261 | char2word(s+12, x4); | 289 | char2word(s+12, x4); |
| 262 | 290 | ||
| 291 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 263 | E_SEED(t0, t1, x1, x2, x3, x4, 30); | 292 | E_SEED(t0, t1, x1, x2, x3, x4, 30); |
| 264 | E_SEED(t0, t1, x3, x4, x1, x2, 28); | 293 | E_SEED(t0, t1, x3, x4, x1, x2, 28); |
| 265 | E_SEED(t0, t1, x1, x2, x3, x4, 26); | 294 | E_SEED(t0, t1, x1, x2, x3, x4, 26); |
| @@ -276,6 +305,16 @@ void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_B | |||
| 276 | E_SEED(t0, t1, x3, x4, x1, x2, 4); | 305 | E_SEED(t0, t1, x3, x4, x1, x2, 4); |
| 277 | E_SEED(t0, t1, x1, x2, x3, x4, 2); | 306 | E_SEED(t0, t1, x1, x2, x3, x4, 2); |
| 278 | E_SEED(t0, t1, x3, x4, x1, x2, 0); | 307 | E_SEED(t0, t1, x3, x4, x1, x2, 0); |
| 308 | #else | ||
| 309 | { | ||
| 310 | int i; | ||
| 311 | for (i=30; i>0; i-=4) { | ||
| 312 | E_SEED(t0, t1, x1, x2, x3, x4, i); | ||
| 313 | E_SEED(t0, t1, x3, x4, x1, x2, i-2); | ||
| 314 | |||
| 315 | } | ||
| 316 | } | ||
| 317 | #endif | ||
| 279 | 318 | ||
| 280 | word2char(x3, d); | 319 | word2char(x3, d); |
| 281 | word2char(x4, d+4); | 320 | word2char(x4, d+4); |
diff --git a/src/lib/libcrypto/seed/seed.h b/src/lib/libcrypto/seed/seed.h index 427915ed9a..6ffa5f024e 100644 --- a/src/lib/libcrypto/seed/seed.h +++ b/src/lib/libcrypto/seed/seed.h | |||
| @@ -82,6 +82,8 @@ | |||
| 82 | #define HEADER_SEED_H | 82 | #define HEADER_SEED_H |
| 83 | 83 | ||
| 84 | #include <openssl/opensslconf.h> | 84 | #include <openssl/opensslconf.h> |
| 85 | #include <openssl/e_os2.h> | ||
| 86 | #include <openssl/crypto.h> | ||
| 85 | 87 | ||
| 86 | #ifdef OPENSSL_NO_SEED | 88 | #ifdef OPENSSL_NO_SEED |
| 87 | #error SEED is disabled. | 89 | #error SEED is disabled. |
diff --git a/src/lib/libcrypto/seed/seed_cbc.c b/src/lib/libcrypto/seed/seed_cbc.c index 4f718ccb44..6c3f9b527a 100644 --- a/src/lib/libcrypto/seed/seed_cbc.c +++ b/src/lib/libcrypto/seed/seed_cbc.c | |||
| @@ -49,81 +49,15 @@ | |||
| 49 | * | 49 | * |
| 50 | */ | 50 | */ |
| 51 | 51 | ||
| 52 | #include "seed_locl.h" | 52 | #include <openssl/seed.h> |
| 53 | #include <string.h> | 53 | #include <openssl/modes.h> |
| 54 | 54 | ||
| 55 | void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, | 55 | void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, |
| 56 | size_t len, const SEED_KEY_SCHEDULE *ks, | 56 | size_t len, const SEED_KEY_SCHEDULE *ks, |
| 57 | unsigned char ivec[SEED_BLOCK_SIZE], int enc) | 57 | unsigned char ivec[SEED_BLOCK_SIZE], int enc) |
| 58 | { | 58 | { |
| 59 | size_t n; | ||
| 60 | unsigned char tmp[SEED_BLOCK_SIZE]; | ||
| 61 | const unsigned char *iv = ivec; | ||
| 62 | |||
| 63 | if (enc) | 59 | if (enc) |
| 64 | { | 60 | CRYPTO_cbc128_encrypt(in,out,len,ks,ivec,(block128_f)SEED_encrypt); |
| 65 | while (len >= SEED_BLOCK_SIZE) | 61 | else |
| 66 | { | 62 | CRYPTO_cbc128_decrypt(in,out,len,ks,ivec,(block128_f)SEED_decrypt); |
| 67 | for (n = 0; n < SEED_BLOCK_SIZE; ++n) | ||
| 68 | out[n] = in[n] ^ iv[n]; | ||
| 69 | SEED_encrypt(out, out, ks); | ||
| 70 | iv = out; | ||
| 71 | len -= SEED_BLOCK_SIZE; | ||
| 72 | in += SEED_BLOCK_SIZE; | ||
| 73 | out += SEED_BLOCK_SIZE; | ||
| 74 | } | ||
| 75 | if (len) | ||
| 76 | { | ||
| 77 | for (n = 0; n < len; ++n) | ||
| 78 | out[n] = in[n] ^ iv[n]; | ||
| 79 | for (n = len; n < SEED_BLOCK_SIZE; ++n) | ||
| 80 | out[n] = iv[n]; | ||
| 81 | SEED_encrypt(out, out, ks); | ||
| 82 | iv = out; | ||
| 83 | } | ||
| 84 | memcpy(ivec, iv, SEED_BLOCK_SIZE); | ||
| 85 | } | ||
| 86 | else if (in != out) /* decrypt */ | ||
| 87 | { | ||
| 88 | while (len >= SEED_BLOCK_SIZE) | ||
| 89 | { | ||
| 90 | SEED_decrypt(in, out, ks); | ||
| 91 | for (n = 0; n < SEED_BLOCK_SIZE; ++n) | ||
| 92 | out[n] ^= iv[n]; | ||
| 93 | iv = in; | ||
| 94 | len -= SEED_BLOCK_SIZE; | ||
| 95 | in += SEED_BLOCK_SIZE; | ||
| 96 | out += SEED_BLOCK_SIZE; | ||
| 97 | } | ||
| 98 | if (len) | ||
| 99 | { | ||
| 100 | SEED_decrypt(in, tmp, ks); | ||
| 101 | for (n = 0; n < len; ++n) | ||
| 102 | out[n] = tmp[n] ^ iv[n]; | ||
| 103 | iv = in; | ||
| 104 | } | ||
| 105 | memcpy(ivec, iv, SEED_BLOCK_SIZE); | ||
| 106 | } | ||
| 107 | else /* decrypt, overlap */ | ||
| 108 | { | ||
| 109 | while (len >= SEED_BLOCK_SIZE) | ||
| 110 | { | ||
| 111 | memcpy(tmp, in, SEED_BLOCK_SIZE); | ||
| 112 | SEED_decrypt(in, out, ks); | ||
| 113 | for (n = 0; n < SEED_BLOCK_SIZE; ++n) | ||
| 114 | out[n] ^= ivec[n]; | ||
| 115 | memcpy(ivec, tmp, SEED_BLOCK_SIZE); | ||
| 116 | len -= SEED_BLOCK_SIZE; | ||
| 117 | in += SEED_BLOCK_SIZE; | ||
| 118 | out += SEED_BLOCK_SIZE; | ||
| 119 | } | ||
| 120 | if (len) | ||
| 121 | { | ||
| 122 | memcpy(tmp, in, SEED_BLOCK_SIZE); | ||
| 123 | SEED_decrypt(tmp, tmp, ks); | ||
| 124 | for (n = 0; n < len; ++n) | ||
| 125 | out[n] = tmp[n] ^ ivec[n]; | ||
| 126 | memcpy(ivec, tmp, SEED_BLOCK_SIZE); | ||
| 127 | } | ||
| 128 | } | ||
| 129 | } | 63 | } |
diff --git a/src/lib/libcrypto/seed/seed_cfb.c b/src/lib/libcrypto/seed/seed_cfb.c index 07d878a788..694597dd06 100644 --- a/src/lib/libcrypto/seed/seed_cfb.c +++ b/src/lib/libcrypto/seed/seed_cfb.c | |||
| @@ -105,40 +105,12 @@ | |||
| 105 | * [including the GNU Public Licence.] | 105 | * [including the GNU Public Licence.] |
| 106 | */ | 106 | */ |
| 107 | 107 | ||
| 108 | #include "seed_locl.h" | 108 | #include <openssl/seed.h> |
| 109 | #include <string.h> | 109 | #include <openssl/modes.h> |
| 110 | 110 | ||
| 111 | void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, | 111 | void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, |
| 112 | size_t len, const SEED_KEY_SCHEDULE *ks, | 112 | size_t len, const SEED_KEY_SCHEDULE *ks, |
| 113 | unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc) | 113 | unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc) |
| 114 | { | 114 | { |
| 115 | int n; | 115 | CRYPTO_cfb128_encrypt(in,out,len,ks,ivec,num,enc,(block128_f)SEED_encrypt); |
| 116 | unsigned char c; | ||
| 117 | |||
| 118 | n = *num; | ||
| 119 | |||
| 120 | if (enc) | ||
| 121 | { | ||
| 122 | while (len--) | ||
| 123 | { | ||
| 124 | if (n == 0) | ||
| 125 | SEED_encrypt(ivec, ivec, ks); | ||
| 126 | ivec[n] = *(out++) = *(in++) ^ ivec[n]; | ||
| 127 | n = (n+1) % SEED_BLOCK_SIZE; | ||
| 128 | } | ||
| 129 | } | ||
| 130 | else | ||
| 131 | { | ||
| 132 | while (len--) | ||
| 133 | { | ||
| 134 | if (n == 0) | ||
| 135 | SEED_encrypt(ivec, ivec, ks); | ||
| 136 | c = *(in); | ||
| 137 | *(out++) = *(in++) ^ ivec[n]; | ||
| 138 | ivec[n] = c; | ||
| 139 | n = (n+1) % SEED_BLOCK_SIZE; | ||
| 140 | } | ||
| 141 | } | ||
| 142 | |||
| 143 | *num = n; | ||
| 144 | } | 116 | } |
diff --git a/src/lib/libcrypto/seed/seed_ofb.c b/src/lib/libcrypto/seed/seed_ofb.c index e2f3f57a38..3c8ba33bb9 100644 --- a/src/lib/libcrypto/seed/seed_ofb.c +++ b/src/lib/libcrypto/seed/seed_ofb.c | |||
| @@ -105,24 +105,12 @@ | |||
| 105 | * [including the GNU Public Licence.] | 105 | * [including the GNU Public Licence.] |
| 106 | */ | 106 | */ |
| 107 | 107 | ||
| 108 | #include "seed_locl.h" | 108 | #include <openssl/seed.h> |
| 109 | #include <string.h> | 109 | #include <openssl/modes.h> |
| 110 | 110 | ||
| 111 | void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, | 111 | void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, |
| 112 | size_t len, const SEED_KEY_SCHEDULE *ks, | 112 | size_t len, const SEED_KEY_SCHEDULE *ks, |
| 113 | unsigned char ivec[SEED_BLOCK_SIZE], int *num) | 113 | unsigned char ivec[SEED_BLOCK_SIZE], int *num) |
| 114 | { | 114 | { |
| 115 | int n; | 115 | CRYPTO_ofb128_encrypt(in,out,len,ks,ivec,num,(block128_f)SEED_encrypt); |
| 116 | |||
| 117 | n = *num; | ||
| 118 | |||
| 119 | while (len--) | ||
| 120 | { | ||
| 121 | if (n == 0) | ||
| 122 | SEED_encrypt(ivec, ivec, ks); | ||
| 123 | *(out++) = *(in++) ^ ivec[n]; | ||
| 124 | n = (n+1) % SEED_BLOCK_SIZE; | ||
| 125 | } | ||
| 126 | |||
| 127 | *num = n; | ||
| 128 | } | 116 | } |
diff --git a/src/lib/libcrypto/store/Makefile b/src/lib/libcrypto/store/Makefile index c9f5d001a3..0dcfd7857a 100644 --- a/src/lib/libcrypto/store/Makefile +++ b/src/lib/libcrypto/store/Makefile | |||
| @@ -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 | ||
| @@ -89,14 +89,14 @@ str_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | |||
| 89 | str_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | 89 | str_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h |
| 90 | str_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | 90 | str_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h |
| 91 | str_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 91 | str_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 92 | str_lib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | 92 | str_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 93 | str_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 93 | str_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 94 | str_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 94 | str_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 95 | str_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | 95 | str_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 96 | str_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 96 | str_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 97 | str_lib.o: ../../include/openssl/stack.h ../../include/openssl/store.h | 97 | str_lib.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h |
| 98 | str_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 98 | str_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 99 | str_lib.o: ../../include/openssl/x509_vfy.h str_lib.c str_locl.h | 99 | str_lib.o: str_lib.c str_locl.h |
| 100 | str_mem.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | 100 | str_mem.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h |
| 101 | str_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 101 | str_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 102 | str_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | 102 | str_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
diff --git a/src/lib/libcrypto/store/store.h b/src/lib/libcrypto/store/store.h index 64583377a9..0a28c7d5a2 100644 --- a/src/lib/libcrypto/store/store.h +++ b/src/lib/libcrypto/store/store.h | |||
| @@ -59,6 +59,12 @@ | |||
| 59 | #ifndef HEADER_STORE_H | 59 | #ifndef HEADER_STORE_H |
| 60 | #define HEADER_STORE_H | 60 | #define HEADER_STORE_H |
| 61 | 61 | ||
| 62 | #include <openssl/opensslconf.h> | ||
| 63 | |||
| 64 | #ifdef OPENSSL_NO_STORE | ||
| 65 | #error STORE is disabled. | ||
| 66 | #endif | ||
| 67 | |||
| 62 | #include <openssl/ossl_typ.h> | 68 | #include <openssl/ossl_typ.h> |
| 63 | #ifndef OPENSSL_NO_DEPRECATED | 69 | #ifndef OPENSSL_NO_DEPRECATED |
| 64 | #include <openssl/evp.h> | 70 | #include <openssl/evp.h> |
| @@ -408,7 +414,8 @@ int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | |||
| 408 | 414 | ||
| 409 | /* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values | 415 | /* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values |
| 410 | in each contained attribute. */ | 416 | in each contained attribute. */ |
| 411 | int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); | 417 | int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a, |
| 418 | const STORE_ATTR_INFO * const *b); | ||
| 412 | /* Check if the set of attributes in a is within the range of attributes | 419 | /* Check if the set of attributes in a is within the range of attributes |
| 413 | set in b. */ | 420 | set in b. */ |
| 414 | int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); | 421 | int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); |
diff --git a/src/lib/libcrypto/store/str_err.c b/src/lib/libcrypto/store/str_err.c index 6fee649822..924edf0505 100644 --- a/src/lib/libcrypto/store/str_err.c +++ b/src/lib/libcrypto/store/str_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/store/str_err.c */ | 1 | /* crypto/store/str_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/store/str_lib.c b/src/lib/libcrypto/store/str_lib.c index 32ae5bd395..f1dbcbd0e0 100644 --- a/src/lib/libcrypto/store/str_lib.c +++ b/src/lib/libcrypto/store/str_lib.c | |||
| @@ -1670,7 +1670,7 @@ int STORE_parse_attrs_endp(void *handle) | |||
| 1670 | } | 1670 | } |
| 1671 | 1671 | ||
| 1672 | static int attr_info_compare_compute_range( | 1672 | static int attr_info_compare_compute_range( |
| 1673 | unsigned char *abits, unsigned char *bbits, | 1673 | const unsigned char *abits, const unsigned char *bbits, |
| 1674 | unsigned int *alowp, unsigned int *ahighp, | 1674 | unsigned int *alowp, unsigned int *ahighp, |
| 1675 | unsigned int *blowp, unsigned int *bhighp) | 1675 | unsigned int *blowp, unsigned int *bhighp) |
| 1676 | { | 1676 | { |
| @@ -1739,13 +1739,15 @@ static int attr_info_compare_compute_range( | |||
| 1739 | return res; | 1739 | return res; |
| 1740 | } | 1740 | } |
| 1741 | 1741 | ||
| 1742 | int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | 1742 | int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a, |
| 1743 | const STORE_ATTR_INFO * const *b) | ||
| 1743 | { | 1744 | { |
| 1744 | if (a == b) return 0; | 1745 | if (a == b) return 0; |
| 1745 | if (!a) return -1; | 1746 | if (!a) return -1; |
| 1746 | if (!b) return 1; | 1747 | if (!b) return 1; |
| 1747 | return attr_info_compare_compute_range(a->set, b->set, 0, 0, 0, 0); | 1748 | return attr_info_compare_compute_range((*a)->set, (*b)->set, 0, 0, 0, 0); |
| 1748 | } | 1749 | } |
| 1750 | |||
| 1749 | int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | 1751 | int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) |
| 1750 | { | 1752 | { |
| 1751 | unsigned int alow, ahigh, blow, bhigh; | 1753 | unsigned int alow, ahigh, blow, bhigh; |
| @@ -1759,6 +1761,7 @@ int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | |||
| 1759 | return 1; | 1761 | return 1; |
| 1760 | return 0; | 1762 | return 0; |
| 1761 | } | 1763 | } |
| 1764 | |||
| 1762 | int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | 1765 | int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) |
| 1763 | { | 1766 | { |
| 1764 | unsigned char *abits, *bbits; | 1767 | unsigned char *abits, *bbits; |
| @@ -1776,6 +1779,7 @@ int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | |||
| 1776 | } | 1779 | } |
| 1777 | return 1; | 1780 | return 1; |
| 1778 | } | 1781 | } |
| 1782 | |||
| 1779 | int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | 1783 | int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) |
| 1780 | { | 1784 | { |
| 1781 | STORE_ATTR_TYPES i; | 1785 | STORE_ATTR_TYPES i; |
diff --git a/src/lib/libcrypto/store/str_mem.c b/src/lib/libcrypto/store/str_mem.c index 527757ae09..8ac4f7e55c 100644 --- a/src/lib/libcrypto/store/str_mem.c +++ b/src/lib/libcrypto/store/str_mem.c | |||
| @@ -76,30 +76,35 @@ | |||
| 76 | attribute type code). | 76 | attribute type code). |
| 77 | */ | 77 | */ |
| 78 | 78 | ||
| 79 | struct mem_object_data_st | 79 | typedef struct mem_object_data_st |
| 80 | { | 80 | { |
| 81 | STORE_OBJECT *object; | 81 | STORE_OBJECT *object; |
| 82 | STORE_ATTR_INFO *attr_info; | 82 | STORE_ATTR_INFO *attr_info; |
| 83 | int references; | 83 | int references; |
| 84 | }; | 84 | } MEM_OBJECT_DATA; |
| 85 | 85 | ||
| 86 | DECLARE_STACK_OF(MEM_OBJECT_DATA) | ||
| 86 | struct mem_data_st | 87 | struct mem_data_st |
| 87 | { | 88 | { |
| 88 | STACK *data; /* A stack of mem_object_data_st, | 89 | STACK_OF(MEM_OBJECT_DATA) *data; /* sorted with |
| 89 | sorted with STORE_ATTR_INFO_compare(). */ | 90 | * STORE_ATTR_INFO_compare(). */ |
| 90 | unsigned int compute_components : 1; /* Currently unused, but can | 91 | unsigned int compute_components : 1; /* Currently unused, but can |
| 91 | be used to add attributes | 92 | be used to add attributes |
| 92 | from parts of the data. */ | 93 | from parts of the data. */ |
| 93 | }; | 94 | }; |
| 94 | 95 | ||
| 96 | DECLARE_STACK_OF(STORE_ATTR_INFO) | ||
| 95 | struct mem_ctx_st | 97 | struct mem_ctx_st |
| 96 | { | 98 | { |
| 97 | int type; /* The type we're searching for */ | 99 | int type; /* The type we're searching for */ |
| 98 | STACK *search_attributes; /* Sets of attributes to search for. | 100 | STACK_OF(STORE_ATTR_INFO) *search_attributes; /* Sets of |
| 99 | Each element is a STORE_ATTR_INFO. */ | 101 | attributes to search for. Each |
| 100 | int search_index; /* which of the search attributes we found a match | 102 | element is a STORE_ATTR_INFO. */ |
| 101 | for, -1 when we still haven't found any */ | 103 | int search_index; /* which of the search attributes we |
| 102 | int index; /* -1 as long as we're searching for the first */ | 104 | found a match for, -1 when we still |
| 105 | haven't found any */ | ||
| 106 | int index; /* -1 as long as we're searching for | ||
| 107 | the first */ | ||
| 103 | }; | 108 | }; |
| 104 | 109 | ||
| 105 | static int mem_init(STORE *s); | 110 | static int mem_init(STORE *s); |
| @@ -240,7 +245,7 @@ static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type, | |||
| 240 | if (context->search_attributes == NULL) | 245 | if (context->search_attributes == NULL) |
| 241 | { | 246 | { |
| 242 | context->search_attributes = | 247 | context->search_attributes = |
| 243 | sk_new((int (*)(const char * const *, const char * const *))STORE_ATTR_INFO_compare); | 248 | sk_STORE_ATTR_INFO_new(STORE_ATTR_INFO_compare); |
| 244 | if (!context->search_attributes) | 249 | if (!context->search_attributes) |
| 245 | { | 250 | { |
| 246 | STOREerr(STORE_F_MEM_LIST_START, | 251 | STOREerr(STORE_F_MEM_LIST_START, |
| @@ -248,7 +253,7 @@ static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type, | |||
| 248 | goto err; | 253 | goto err; |
| 249 | } | 254 | } |
| 250 | } | 255 | } |
| 251 | sk_push(context->search_attributes,(char *)attrs); | 256 | sk_STORE_ATTR_INFO_push(context->search_attributes,attrs); |
| 252 | } | 257 | } |
| 253 | if (!STORE_parse_attrs_endp(attribute_context)) | 258 | if (!STORE_parse_attrs_endp(attribute_context)) |
| 254 | goto err; | 259 | goto err; |
| @@ -284,11 +289,14 @@ static STORE_OBJECT *mem_list_next(STORE *s, void *handle) | |||
| 284 | 289 | ||
| 285 | if (context->search_index == -1) | 290 | if (context->search_index == -1) |
| 286 | { | 291 | { |
| 287 | for (i = 0; i < sk_num(context->search_attributes); i++) | 292 | for (i = 0; |
| 293 | i < sk_STORE_ATTR_INFO_num(context->search_attributes); | ||
| 294 | i++) | ||
| 288 | { | 295 | { |
| 289 | key.attr_info = | 296 | key.attr_info |
| 290 | (STORE_ATTR_INFO *)sk_value(context->search_attributes, i); | 297 | = sk_STORE_ATTR_INFO_value(context->search_attributes, |
| 291 | srch = sk_find_ex(store->data, (char *)&key); | 298 | i); |
| 299 | srch = sk_MEM_OBJECT_DATA_find_ex(store->data, &key); | ||
| 292 | 300 | ||
| 293 | if (srch >= 0) | 301 | if (srch >= 0) |
| 294 | { | 302 | { |
| @@ -301,21 +309,20 @@ static STORE_OBJECT *mem_list_next(STORE *s, void *handle) | |||
| 301 | return NULL; | 309 | return NULL; |
| 302 | 310 | ||
| 303 | key.attr_info = | 311 | key.attr_info = |
| 304 | (STORE_ATTR_INFO *)sk_value(context->search_attributes, | 312 | sk_STORE_ATTR_INFO_value(context->search_attributes, |
| 305 | context->search_index); | 313 | context->search_index); |
| 306 | for(srch = context->search_index; | 314 | for(srch = context->search_index; |
| 307 | srch < sk_num(store->data) | 315 | srch < sk_MEM_OBJECT_DATA_num(store->data) |
| 308 | && STORE_ATTR_INFO_in_range(key.attr_info, | 316 | && STORE_ATTR_INFO_in_range(key.attr_info, |
| 309 | (STORE_ATTR_INFO *)sk_value(store->data, srch)) | 317 | sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info) |
| 310 | && !(cres = STORE_ATTR_INFO_in_ex(key.attr_info, | 318 | && !(cres = STORE_ATTR_INFO_in_ex(key.attr_info, |
| 311 | (STORE_ATTR_INFO *)sk_value(store->data, srch))); | 319 | sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info)); |
| 312 | srch++) | 320 | srch++) |
| 313 | ; | 321 | ; |
| 314 | 322 | ||
| 315 | context->search_index = srch; | 323 | context->search_index = srch; |
| 316 | if (cres) | 324 | if (cres) |
| 317 | return ((struct mem_object_data_st *)sk_value(store->data, | 325 | return (sk_MEM_OBJECT_DATA_value(store->data, srch))->object; |
| 318 | srch))->object; | ||
| 319 | return NULL; | 326 | return NULL; |
| 320 | } | 327 | } |
| 321 | static int mem_list_end(STORE *s, void *handle) | 328 | static int mem_list_end(STORE *s, void *handle) |
| @@ -328,7 +335,7 @@ static int mem_list_end(STORE *s, void *handle) | |||
| 328 | return 0; | 335 | return 0; |
| 329 | } | 336 | } |
| 330 | if (context && context->search_attributes) | 337 | if (context && context->search_attributes) |
| 331 | sk_free(context->search_attributes); | 338 | sk_STORE_ATTR_INFO_free(context->search_attributes); |
| 332 | if (context) OPENSSL_free(context); | 339 | if (context) OPENSSL_free(context); |
| 333 | return 1; | 340 | return 1; |
| 334 | } | 341 | } |
| @@ -337,7 +344,8 @@ static int mem_list_endp(STORE *s, void *handle) | |||
| 337 | struct mem_ctx_st *context = (struct mem_ctx_st *)handle; | 344 | struct mem_ctx_st *context = (struct mem_ctx_st *)handle; |
| 338 | 345 | ||
| 339 | if (!context | 346 | if (!context |
| 340 | || context->search_index == sk_num(context->search_attributes)) | 347 | || context->search_index |
| 348 | == sk_STORE_ATTR_INFO_num(context->search_attributes)) | ||
| 341 | return 1; | 349 | return 1; |
| 342 | return 0; | 350 | return 0; |
| 343 | } | 351 | } |
diff --git a/src/lib/libcrypto/ts/Makefile b/src/lib/libcrypto/ts/Makefile new file mode 100644 index 0000000000..c18234555b --- /dev/null +++ b/src/lib/libcrypto/ts/Makefile | |||
| @@ -0,0 +1,269 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/ts/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= ts | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I../../include | ||
| 9 | CFLAG = -g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKEDEPPROG= makedepend | ||
| 14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 15 | MAKEFILE= Makefile | ||
| 16 | AR= ar r | ||
| 17 | |||
| 18 | PEX_LIBS= | ||
| 19 | EX_LIBS= | ||
| 20 | |||
| 21 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 22 | |||
| 23 | GENERAL= Makefile | ||
| 24 | TEST= | ||
| 25 | APPS= | ||
| 26 | |||
| 27 | LIB=$(TOP)/libcrypto.a | ||
| 28 | LIBSRC= ts_err.c ts_req_utils.c ts_req_print.c ts_rsp_utils.c ts_rsp_print.c \ | ||
| 29 | ts_rsp_sign.c ts_rsp_verify.c ts_verify_ctx.c ts_lib.c ts_conf.c \ | ||
| 30 | ts_asn1.c | ||
| 31 | LIBOBJ= ts_err.o ts_req_utils.o ts_req_print.o ts_rsp_utils.o ts_rsp_print.o \ | ||
| 32 | ts_rsp_sign.o ts_rsp_verify.o ts_verify_ctx.o ts_lib.o ts_conf.o \ | ||
| 33 | ts_asn1.o | ||
| 34 | |||
| 35 | SRC= $(LIBSRC) | ||
| 36 | |||
| 37 | EXHEADER= ts.h | ||
| 38 | HEADER= $(EXHEADER) | ||
| 39 | |||
| 40 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 41 | |||
| 42 | top: | ||
| 43 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 44 | |||
| 45 | test: | ||
| 46 | |||
| 47 | all: lib | ||
| 48 | |||
| 49 | lib: $(LIBOBJ) | ||
| 50 | $(AR) $(LIB) $(LIBOBJ) | ||
| 51 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 52 | @touch lib | ||
| 53 | |||
| 54 | files: | ||
| 55 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 56 | |||
| 57 | links: | ||
| 58 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 59 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 60 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 61 | |||
| 62 | install: | ||
| 63 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 64 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 65 | do \ | ||
| 66 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 67 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 68 | done; | ||
| 69 | |||
| 70 | tags: | ||
| 71 | ctags $(SRC) | ||
| 72 | |||
| 73 | lint: | ||
| 74 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 75 | |||
| 76 | depend: | ||
| 77 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 78 | |||
| 79 | dclean: | ||
| 80 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 81 | mv -f Makefile.new $(MAKEFILE) | ||
| 82 | |||
| 83 | clean: | ||
| 84 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff enc dec sign verify | ||
| 85 | |||
| 86 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 87 | |||
| 88 | ts_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 89 | ts_asn1.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 90 | ts_asn1.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 91 | ts_asn1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 92 | ts_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 93 | ts_asn1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 94 | ts_asn1.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 95 | ts_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 96 | ts_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 97 | ts_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 98 | ts_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 99 | ts_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 100 | ts_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 101 | ts_asn1.o: ../../include/openssl/ts.h ../../include/openssl/x509.h | ||
| 102 | ts_asn1.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 103 | ts_asn1.o: ts_asn1.c | ||
| 104 | ts_conf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 105 | ts_conf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 106 | ts_conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 107 | ts_conf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 108 | ts_conf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 109 | ts_conf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 110 | ts_conf.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 111 | ts_conf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 112 | ts_conf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 113 | ts_conf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 114 | ts_conf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 115 | ts_conf.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 116 | ts_conf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 117 | ts_conf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 118 | ts_conf.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 119 | ts_conf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 120 | ts_conf.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_conf.c | ||
| 121 | ts_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 122 | ts_err.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 123 | ts_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 124 | ts_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 125 | ts_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 126 | ts_err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 127 | ts_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 128 | ts_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 129 | ts_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 130 | ts_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 131 | ts_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 132 | ts_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 133 | ts_err.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 134 | ts_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 135 | ts_err.o: ../../include/openssl/x509v3.h ts_err.c | ||
| 136 | ts_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 137 | ts_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 138 | ts_lib.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 139 | ts_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 140 | ts_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 141 | ts_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 142 | ts_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 143 | ts_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 144 | ts_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 145 | ts_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 146 | ts_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 147 | ts_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 148 | ts_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 149 | ts_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 150 | ts_lib.o: ../../include/openssl/x509v3.h ../cryptlib.h ts.h ts_lib.c | ||
| 151 | ts_req_print.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 152 | ts_req_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 153 | ts_req_print.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 154 | ts_req_print.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 155 | ts_req_print.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 156 | ts_req_print.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 157 | ts_req_print.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 158 | ts_req_print.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 159 | ts_req_print.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 160 | ts_req_print.o: ../../include/openssl/opensslconf.h | ||
| 161 | ts_req_print.o: ../../include/openssl/opensslv.h | ||
| 162 | ts_req_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 163 | ts_req_print.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 164 | ts_req_print.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 165 | ts_req_print.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 166 | ts_req_print.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 167 | ts_req_print.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_req_print.c | ||
| 168 | ts_req_utils.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 169 | ts_req_utils.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 170 | ts_req_utils.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 171 | ts_req_utils.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 172 | ts_req_utils.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 173 | ts_req_utils.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 174 | ts_req_utils.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 175 | ts_req_utils.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 176 | ts_req_utils.o: ../../include/openssl/objects.h | ||
| 177 | ts_req_utils.o: ../../include/openssl/opensslconf.h | ||
| 178 | ts_req_utils.o: ../../include/openssl/opensslv.h | ||
| 179 | ts_req_utils.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 180 | ts_req_utils.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 181 | ts_req_utils.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 182 | ts_req_utils.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 183 | ts_req_utils.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 184 | ts_req_utils.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_req_utils.c | ||
| 185 | ts_rsp_print.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 186 | ts_rsp_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 187 | ts_rsp_print.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 188 | ts_rsp_print.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 189 | ts_rsp_print.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 190 | ts_rsp_print.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 191 | ts_rsp_print.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 192 | ts_rsp_print.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 193 | ts_rsp_print.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 194 | ts_rsp_print.o: ../../include/openssl/opensslconf.h | ||
| 195 | ts_rsp_print.o: ../../include/openssl/opensslv.h | ||
| 196 | ts_rsp_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 197 | ts_rsp_print.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 198 | ts_rsp_print.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 199 | ts_rsp_print.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 200 | ts_rsp_print.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 201 | ts_rsp_print.o: ../cryptlib.h ts.h ts_rsp_print.c | ||
| 202 | ts_rsp_sign.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 203 | ts_rsp_sign.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 204 | ts_rsp_sign.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 205 | ts_rsp_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 206 | ts_rsp_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 207 | ts_rsp_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 208 | ts_rsp_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 209 | ts_rsp_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 210 | ts_rsp_sign.o: ../../include/openssl/objects.h | ||
| 211 | ts_rsp_sign.o: ../../include/openssl/opensslconf.h | ||
| 212 | ts_rsp_sign.o: ../../include/openssl/opensslv.h | ||
| 213 | ts_rsp_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 214 | ts_rsp_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 215 | ts_rsp_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 216 | ts_rsp_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 217 | ts_rsp_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 218 | ts_rsp_sign.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_sign.c | ||
| 219 | ts_rsp_utils.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 220 | ts_rsp_utils.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 221 | ts_rsp_utils.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 222 | ts_rsp_utils.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 223 | ts_rsp_utils.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 224 | ts_rsp_utils.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 225 | ts_rsp_utils.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 226 | ts_rsp_utils.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 227 | ts_rsp_utils.o: ../../include/openssl/objects.h | ||
| 228 | ts_rsp_utils.o: ../../include/openssl/opensslconf.h | ||
| 229 | ts_rsp_utils.o: ../../include/openssl/opensslv.h | ||
| 230 | ts_rsp_utils.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 231 | ts_rsp_utils.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 232 | ts_rsp_utils.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 233 | ts_rsp_utils.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 234 | ts_rsp_utils.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 235 | ts_rsp_utils.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_utils.c | ||
| 236 | ts_rsp_verify.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 237 | ts_rsp_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 238 | ts_rsp_verify.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 239 | ts_rsp_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 240 | ts_rsp_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 241 | ts_rsp_verify.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 242 | ts_rsp_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 243 | ts_rsp_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 244 | ts_rsp_verify.o: ../../include/openssl/objects.h | ||
| 245 | ts_rsp_verify.o: ../../include/openssl/opensslconf.h | ||
| 246 | ts_rsp_verify.o: ../../include/openssl/opensslv.h | ||
| 247 | ts_rsp_verify.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 248 | ts_rsp_verify.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 249 | ts_rsp_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 250 | ts_rsp_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 251 | ts_rsp_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 252 | ts_rsp_verify.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_verify.c | ||
| 253 | ts_verify_ctx.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 254 | ts_verify_ctx.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 255 | ts_verify_ctx.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 256 | ts_verify_ctx.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 257 | ts_verify_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 258 | ts_verify_ctx.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 259 | ts_verify_ctx.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 260 | ts_verify_ctx.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 261 | ts_verify_ctx.o: ../../include/openssl/objects.h | ||
| 262 | ts_verify_ctx.o: ../../include/openssl/opensslconf.h | ||
| 263 | ts_verify_ctx.o: ../../include/openssl/opensslv.h | ||
| 264 | ts_verify_ctx.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 265 | ts_verify_ctx.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 266 | ts_verify_ctx.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 267 | ts_verify_ctx.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 268 | ts_verify_ctx.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 269 | ts_verify_ctx.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_verify_ctx.c | ||
diff --git a/src/lib/libcrypto/util/copy.pl b/src/lib/libcrypto/util/copy.pl index eba6d5815e..e20b45530a 100644 --- a/src/lib/libcrypto/util/copy.pl +++ b/src/lib/libcrypto/util/copy.pl | |||
| @@ -8,16 +8,9 @@ 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 | |||
| 13 | my $arg; | 11 | my $arg; |
| 14 | 12 | ||
| 15 | foreach $arg (@ARGV) { | 13 | foreach $arg (@ARGV) { |
| 16 | if ($arg eq "-stripcr") | ||
| 17 | { | ||
| 18 | $stripcr = 1; | ||
| 19 | next; | ||
| 20 | } | ||
| 21 | $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... | 14 | $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... |
| 22 | foreach (glob $arg) | 15 | foreach (glob $arg) |
| 23 | { | 16 | { |
| @@ -56,10 +49,6 @@ foreach (@filelist) | |||
| 56 | || die "Can't Open $dfile"; | 49 | || die "Can't Open $dfile"; |
| 57 | while (sysread IN, $buf, 10240) | 50 | while (sysread IN, $buf, 10240) |
| 58 | { | 51 | { |
| 59 | if ($stripcr) | ||
| 60 | { | ||
| 61 | $buf =~ tr/\015//d; | ||
| 62 | } | ||
| 63 | syswrite(OUT, $buf, length($buf)); | 52 | syswrite(OUT, $buf, length($buf)); |
| 64 | } | 53 | } |
| 65 | close(IN); | 54 | close(IN); |
diff --git a/src/lib/libcrypto/util/mkrc.pl b/src/lib/libcrypto/util/mkrc.pl new file mode 100755 index 0000000000..0ceadcf8d1 --- /dev/null +++ b/src/lib/libcrypto/util/mkrc.pl | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | #!/bin/env perl | ||
| 2 | # | ||
| 3 | open FD,"crypto/opensslv.h"; | ||
| 4 | while(<FD>) { | ||
| 5 | if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) { | ||
| 6 | $ver = hex($1); | ||
| 7 | $v1 = ($ver>>28); | ||
| 8 | $v2 = ($ver>>20)&0xff; | ||
| 9 | $v3 = ($ver>>12)&0xff; | ||
| 10 | $v4 = ($ver>> 4)&0xff; | ||
| 11 | $beta = $ver&0xf; | ||
| 12 | $version = "$v1.$v2.$v3"; | ||
| 13 | if ($beta==0xf) { $version .= chr(ord('a')+$v4-1) if ($v4); } | ||
| 14 | elsif ($beta==0){ $version .= "-dev"; } | ||
| 15 | else { $version .= "-beta$beta"; } | ||
| 16 | last; | ||
| 17 | } | ||
| 18 | } | ||
| 19 | close(FD); | ||
| 20 | |||
| 21 | $filename = $ARGV[0]; $filename =~ /(.*)\.([^.]+)$/; | ||
| 22 | $basename = $1; | ||
| 23 | $extname = $2; | ||
| 24 | |||
| 25 | if ($extname =~ /dll/i) { $description = "OpenSSL shared library"; } | ||
| 26 | else { $description = "OpenSSL application"; } | ||
| 27 | |||
| 28 | print <<___; | ||
| 29 | #include <winver.h> | ||
| 30 | |||
| 31 | LANGUAGE 0x09,0x01 | ||
| 32 | |||
| 33 | 1 VERSIONINFO | ||
| 34 | FILEVERSION $v1,$v2,$v3,$v4 | ||
| 35 | PRODUCTVERSION $v1,$v2,$v3,$v4 | ||
| 36 | FILEFLAGSMASK 0x3fL | ||
| 37 | #ifdef _DEBUG | ||
| 38 | FILEFLAGS 0x01L | ||
| 39 | #else | ||
| 40 | FILEFLAGS 0x00L | ||
| 41 | #endif | ||
| 42 | FILEOS VOS__WINDOWS32 | ||
| 43 | FILETYPE VFT_DLL | ||
| 44 | FILESUBTYPE 0x0L | ||
| 45 | BEGIN | ||
| 46 | BLOCK "StringFileInfo" | ||
| 47 | BEGIN | ||
| 48 | BLOCK "040904b0" | ||
| 49 | BEGIN | ||
| 50 | // Required: | ||
| 51 | VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0" | ||
| 52 | VALUE "FileDescription", "$description\\0" | ||
| 53 | VALUE "FileVersion", "$version\\0" | ||
| 54 | VALUE "InternalName", "$basename\\0" | ||
| 55 | VALUE "OriginalFilename", "$filename\\0" | ||
| 56 | VALUE "ProductName", "The OpenSSL Toolkit\\0" | ||
| 57 | VALUE "ProductVersion", "$version\\0" | ||
| 58 | // Optional: | ||
| 59 | //VALUE "Comments", "\\0" | ||
| 60 | VALUE "LegalCopyright", "Copyright © 1998-2006 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0" | ||
| 61 | //VALUE "LegalTrademarks", "\\0" | ||
| 62 | //VALUE "PrivateBuild", "\\0" | ||
| 63 | //VALUE "SpecialBuild", "\\0" | ||
| 64 | END | ||
| 65 | END | ||
| 66 | BLOCK "VarFileInfo" | ||
| 67 | BEGIN | ||
| 68 | VALUE "Translation", 0x409, 0x4b0 | ||
| 69 | END | ||
| 70 | END | ||
| 71 | ___ | ||
diff --git a/src/lib/libcrypto/util/pl/netware.pl b/src/lib/libcrypto/util/pl/netware.pl index 173c9919f2..c78bcfc874 100644 --- a/src/lib/libcrypto/util/pl/netware.pl +++ b/src/lib/libcrypto/util/pl/netware.pl | |||
| @@ -131,13 +131,14 @@ else | |||
| 131 | # assembler | 131 | # assembler |
| 132 | if ($nw_nasm) | 132 | if ($nw_nasm) |
| 133 | { | 133 | { |
| 134 | $asm=(`nasm -v 2>NUL` gt `nasmw -v 2>NUL`?"nasm":"nasmw"); | ||
| 134 | if ($gnuc) | 135 | if ($gnuc) |
| 135 | { | 136 | { |
| 136 | $asm="nasmw -s -f elf"; | 137 | $asm.=" -s -f elf"; |
| 137 | } | 138 | } |
| 138 | else | 139 | else |
| 139 | { | 140 | { |
| 140 | $asm="nasmw -s -f coff"; | 141 | $asm.=" -s -f coff -d __coff__"; |
| 141 | } | 142 | } |
| 142 | $afile="-o "; | 143 | $afile="-o "; |
| 143 | $asm.=" -g" if $debug; | 144 | $asm.=" -g" if $debug; |
| @@ -323,13 +324,16 @@ if (!$no_asm) | |||
| 323 | $rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm"; | 324 | $rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm"; |
| 324 | $md5_asm_obj="\$(OBJ_D)${o}m5-nw${obj}"; | 325 | $md5_asm_obj="\$(OBJ_D)${o}m5-nw${obj}"; |
| 325 | $md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm"; | 326 | $md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm"; |
| 326 | $sha1_asm_obj="\$(OBJ_D)${o}s1-nw${obj}"; | 327 | $sha1_asm_obj="\$(OBJ_D)${o}s1-nw${obj} \$(OBJ_D)${o}sha256-nw${obj} \$(OBJ_D)${o}sha512-nw${obj}"; |
| 327 | $sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm"; | 328 | $sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm crypto${o}sha${o}asm${o}sha256-nw.asm crypto${o}sha${o}asm${o}sha512-nw.asm"; |
| 328 | $rmd160_asm_obj="\$(OBJ_D)${o}rm-nw${obj}"; | 329 | $rmd160_asm_obj="\$(OBJ_D)${o}rm-nw${obj}"; |
| 329 | $rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm"; | 330 | $rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm"; |
| 331 | $whirlpool_asm_obj="\$(OBJ_D)${o}wp-nw${obj}"; | ||
| 332 | $whirlpool_asm_src="crypto${o}whrlpool${o}asm${o}wp-nw.asm"; | ||
| 330 | $cpuid_asm_obj="\$(OBJ_D)${o}x86cpuid-nw${obj}"; | 333 | $cpuid_asm_obj="\$(OBJ_D)${o}x86cpuid-nw${obj}"; |
| 331 | $cpuid_asm_src="crypto${o}x86cpuid-nw.asm"; | 334 | $cpuid_asm_src="crypto${o}x86cpuid-nw.asm"; |
| 332 | $cflags.=" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DSHA1_ASM"; | 335 | $cflags.=" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DWHIRLPOOL_ASM"; |
| 336 | $cflags.=" -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM"; | ||
| 333 | $cflags.=" -DAES_ASM -DRMD160_ASM"; | 337 | $cflags.=" -DAES_ASM -DRMD160_ASM"; |
| 334 | } | 338 | } |
| 335 | else | 339 | else |
| @@ -356,6 +360,8 @@ else | |||
| 356 | $sha1_asm_src=''; | 360 | $sha1_asm_src=''; |
| 357 | $rmd160_asm_obj=''; | 361 | $rmd160_asm_obj=''; |
| 358 | $rmd160_asm_src=''; | 362 | $rmd160_asm_src=''; |
| 363 | $whirlpool_asm_obj=''; | ||
| 364 | $whirlpool_asm_src=''; | ||
| 359 | $cpuid_asm_obj=''; | 365 | $cpuid_asm_obj=''; |
| 360 | $cpuid_asm_src=''; | 366 | $cpuid_asm_src=''; |
| 361 | } | 367 | } |
diff --git a/src/lib/libcrypto/whrlpool/Makefile b/src/lib/libcrypto/whrlpool/Makefile new file mode 100644 index 0000000000..566b996290 --- /dev/null +++ b/src/lib/libcrypto/whrlpool/Makefile | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | # | ||
| 2 | # crypto/whrlpool/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= whrlpool | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | WP_ASM_OBJ=wp_block.o | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST=wp_test.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC=wp_dgst.c wp_block.c | ||
| 26 | LIBOBJ=wp_dgst.o $(WP_ASM_OBJ) | ||
| 27 | |||
| 28 | SRC= $(LIBSRC) | ||
| 29 | |||
| 30 | EXHEADER= whrlpool.h | ||
| 31 | HEADER= wp_locl.h $(EXHEADER) | ||
| 32 | |||
| 33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 34 | |||
| 35 | top: | ||
| 36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 37 | |||
| 38 | all: lib | ||
| 39 | |||
| 40 | lib: $(LIBOBJ) | ||
| 41 | $(AR) $(LIB) $(LIBOBJ) | ||
| 42 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 43 | @touch lib | ||
| 44 | |||
| 45 | wp-mmx.s: asm/wp-mmx.pl ../perlasm/x86asm.pl | ||
| 46 | $(PERL) asm/wp-mmx.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 47 | |||
| 48 | wp-x86_64.s: asm/wp-x86_64.pl | ||
| 49 | $(PERL) asm/wp-x86_64.pl $(PERLASM_SCHEME) > $@ | ||
| 50 | |||
| 51 | $(LIBOBJ): $(LIBSRC) | ||
| 52 | |||
| 53 | files: | ||
| 54 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 55 | |||
| 56 | links: | ||
| 57 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 58 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 59 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 60 | |||
| 61 | install: | ||
| 62 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 63 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 64 | do \ | ||
| 65 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 66 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 67 | done; | ||
| 68 | |||
| 69 | tags: | ||
| 70 | ctags $(SRC) | ||
| 71 | |||
| 72 | tests: | ||
| 73 | |||
| 74 | lint: | ||
| 75 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 76 | |||
| 77 | depend: | ||
| 78 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 79 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 80 | |||
| 81 | dclean: | ||
| 82 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 83 | mv -f Makefile.new $(MAKEFILE) | ||
| 84 | |||
| 85 | clean: | ||
| 86 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 87 | |||
| 88 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 89 | |||
| 90 | wp_block.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 91 | wp_block.o: ../../include/openssl/whrlpool.h wp_block.c wp_locl.h | ||
| 92 | wp_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 93 | wp_dgst.o: ../../include/openssl/whrlpool.h wp_dgst.c wp_locl.h | ||
diff --git a/src/lib/libcrypto/whrlpool/wp_test.c b/src/lib/libcrypto/whrlpool/wp_test.c new file mode 100644 index 0000000000..c68c2c62ca --- /dev/null +++ b/src/lib/libcrypto/whrlpool/wp_test.c | |||
| @@ -0,0 +1,228 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2005 The OpenSSL Project. All rights reserved. | ||
| 3 | * ==================================================================== | ||
| 4 | */ | ||
| 5 | #include <stdio.h> | ||
| 6 | #include <string.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | |||
| 9 | #include <openssl/whrlpool.h> | ||
| 10 | #include <openssl/crypto.h> | ||
| 11 | |||
| 12 | #if defined(OPENSSL_NO_WHIRLPOOL) | ||
| 13 | int main(int argc, char *argv[]) | ||
| 14 | { | ||
| 15 | printf("No Whirlpool support\n"); | ||
| 16 | return(0); | ||
| 17 | } | ||
| 18 | #else | ||
| 19 | |||
| 20 | /* ISO/IEC 10118-3 test vector set */ | ||
| 21 | unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 22 | 0x19,0xFA,0x61,0xD7,0x55,0x22,0xA4,0x66, | ||
| 23 | 0x9B,0x44,0xE3,0x9C,0x1D,0x2E,0x17,0x26, | ||
| 24 | 0xC5,0x30,0x23,0x21,0x30,0xD4,0x07,0xF8, | ||
| 25 | 0x9A,0xFE,0xE0,0x96,0x49,0x97,0xF7,0xA7, | ||
| 26 | 0x3E,0x83,0xBE,0x69,0x8B,0x28,0x8F,0xEB, | ||
| 27 | 0xCF,0x88,0xE3,0xE0,0x3C,0x4F,0x07,0x57, | ||
| 28 | 0xEA,0x89,0x64,0xE5,0x9B,0x63,0xD9,0x37, | ||
| 29 | 0x08,0xB1,0x38,0xCC,0x42,0xA6,0x6E,0xB3 }; | ||
| 30 | |||
| 31 | unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 32 | 0x8A,0xCA,0x26,0x02,0x79,0x2A,0xEC,0x6F, | ||
| 33 | 0x11,0xA6,0x72,0x06,0x53,0x1F,0xB7,0xD7, | ||
| 34 | 0xF0,0xDF,0xF5,0x94,0x13,0x14,0x5E,0x69, | ||
| 35 | 0x73,0xC4,0x50,0x01,0xD0,0x08,0x7B,0x42, | ||
| 36 | 0xD1,0x1B,0xC6,0x45,0x41,0x3A,0xEF,0xF6, | ||
| 37 | 0x3A,0x42,0x39,0x1A,0x39,0x14,0x5A,0x59, | ||
| 38 | 0x1A,0x92,0x20,0x0D,0x56,0x01,0x95,0xE5, | ||
| 39 | 0x3B,0x47,0x85,0x84,0xFD,0xAE,0x23,0x1A }; | ||
| 40 | |||
| 41 | unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 42 | 0x4E,0x24,0x48,0xA4,0xC6,0xF4,0x86,0xBB, | ||
| 43 | 0x16,0xB6,0x56,0x2C,0x73,0xB4,0x02,0x0B, | ||
| 44 | 0xF3,0x04,0x3E,0x3A,0x73,0x1B,0xCE,0x72, | ||
| 45 | 0x1A,0xE1,0xB3,0x03,0xD9,0x7E,0x6D,0x4C, | ||
| 46 | 0x71,0x81,0xEE,0xBD,0xB6,0xC5,0x7E,0x27, | ||
| 47 | 0x7D,0x0E,0x34,0x95,0x71,0x14,0xCB,0xD6, | ||
| 48 | 0xC7,0x97,0xFC,0x9D,0x95,0xD8,0xB5,0x82, | ||
| 49 | 0xD2,0x25,0x29,0x20,0x76,0xD4,0xEE,0xF5 }; | ||
| 50 | |||
| 51 | unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 52 | 0x37,0x8C,0x84,0xA4,0x12,0x6E,0x2D,0xC6, | ||
| 53 | 0xE5,0x6D,0xCC,0x74,0x58,0x37,0x7A,0xAC, | ||
| 54 | 0x83,0x8D,0x00,0x03,0x22,0x30,0xF5,0x3C, | ||
| 55 | 0xE1,0xF5,0x70,0x0C,0x0F,0xFB,0x4D,0x3B, | ||
| 56 | 0x84,0x21,0x55,0x76,0x59,0xEF,0x55,0xC1, | ||
| 57 | 0x06,0xB4,0xB5,0x2A,0xC5,0xA4,0xAA,0xA6, | ||
| 58 | 0x92,0xED,0x92,0x00,0x52,0x83,0x8F,0x33, | ||
| 59 | 0x62,0xE8,0x6D,0xBD,0x37,0xA8,0x90,0x3E }; | ||
| 60 | |||
| 61 | unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 62 | 0xF1,0xD7,0x54,0x66,0x26,0x36,0xFF,0xE9, | ||
| 63 | 0x2C,0x82,0xEB,0xB9,0x21,0x2A,0x48,0x4A, | ||
| 64 | 0x8D,0x38,0x63,0x1E,0xAD,0x42,0x38,0xF5, | ||
| 65 | 0x44,0x2E,0xE1,0x3B,0x80,0x54,0xE4,0x1B, | ||
| 66 | 0x08,0xBF,0x2A,0x92,0x51,0xC3,0x0B,0x6A, | ||
| 67 | 0x0B,0x8A,0xAE,0x86,0x17,0x7A,0xB4,0xA6, | ||
| 68 | 0xF6,0x8F,0x67,0x3E,0x72,0x07,0x86,0x5D, | ||
| 69 | 0x5D,0x98,0x19,0xA3,0xDB,0xA4,0xEB,0x3B }; | ||
| 70 | |||
| 71 | unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 72 | 0xDC,0x37,0xE0,0x08,0xCF,0x9E,0xE6,0x9B, | ||
| 73 | 0xF1,0x1F,0x00,0xED,0x9A,0xBA,0x26,0x90, | ||
| 74 | 0x1D,0xD7,0xC2,0x8C,0xDE,0xC0,0x66,0xCC, | ||
| 75 | 0x6A,0xF4,0x2E,0x40,0xF8,0x2F,0x3A,0x1E, | ||
| 76 | 0x08,0xEB,0xA2,0x66,0x29,0x12,0x9D,0x8F, | ||
| 77 | 0xB7,0xCB,0x57,0x21,0x1B,0x92,0x81,0xA6, | ||
| 78 | 0x55,0x17,0xCC,0x87,0x9D,0x7B,0x96,0x21, | ||
| 79 | 0x42,0xC6,0x5F,0x5A,0x7A,0xF0,0x14,0x67 }; | ||
| 80 | |||
| 81 | unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 82 | 0x46,0x6E,0xF1,0x8B,0xAB,0xB0,0x15,0x4D, | ||
| 83 | 0x25,0xB9,0xD3,0x8A,0x64,0x14,0xF5,0xC0, | ||
| 84 | 0x87,0x84,0x37,0x2B,0xCC,0xB2,0x04,0xD6, | ||
| 85 | 0x54,0x9C,0x4A,0xFA,0xDB,0x60,0x14,0x29, | ||
| 86 | 0x4D,0x5B,0xD8,0xDF,0x2A,0x6C,0x44,0xE5, | ||
| 87 | 0x38,0xCD,0x04,0x7B,0x26,0x81,0xA5,0x1A, | ||
| 88 | 0x2C,0x60,0x48,0x1E,0x88,0xC5,0xA2,0x0B, | ||
| 89 | 0x2C,0x2A,0x80,0xCF,0x3A,0x9A,0x08,0x3B }; | ||
| 90 | |||
| 91 | unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 92 | 0x2A,0x98,0x7E,0xA4,0x0F,0x91,0x70,0x61, | ||
| 93 | 0xF5,0xD6,0xF0,0xA0,0xE4,0x64,0x4F,0x48, | ||
| 94 | 0x8A,0x7A,0x5A,0x52,0xDE,0xEE,0x65,0x62, | ||
| 95 | 0x07,0xC5,0x62,0xF9,0x88,0xE9,0x5C,0x69, | ||
| 96 | 0x16,0xBD,0xC8,0x03,0x1B,0xC5,0xBE,0x1B, | ||
| 97 | 0x7B,0x94,0x76,0x39,0xFE,0x05,0x0B,0x56, | ||
| 98 | 0x93,0x9B,0xAA,0xA0,0xAD,0xFF,0x9A,0xE6, | ||
| 99 | 0x74,0x5B,0x7B,0x18,0x1C,0x3B,0xE3,0xFD }; | ||
| 100 | |||
| 101 | unsigned char iso_test_9[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 102 | 0x0C,0x99,0x00,0x5B,0xEB,0x57,0xEF,0xF5, | ||
| 103 | 0x0A,0x7C,0xF0,0x05,0x56,0x0D,0xDF,0x5D, | ||
| 104 | 0x29,0x05,0x7F,0xD8,0x6B,0x20,0xBF,0xD6, | ||
| 105 | 0x2D,0xEC,0xA0,0xF1,0xCC,0xEA,0x4A,0xF5, | ||
| 106 | 0x1F,0xC1,0x54,0x90,0xED,0xDC,0x47,0xAF, | ||
| 107 | 0x32,0xBB,0x2B,0x66,0xC3,0x4F,0xF9,0xAD, | ||
| 108 | 0x8C,0x60,0x08,0xAD,0x67,0x7F,0x77,0x12, | ||
| 109 | 0x69,0x53,0xB2,0x26,0xE4,0xED,0x8B,0x01 }; | ||
| 110 | |||
| 111 | int main (int argc,char *argv[]) | ||
| 112 | { unsigned char md[WHIRLPOOL_DIGEST_LENGTH]; | ||
| 113 | int i; | ||
| 114 | WHIRLPOOL_CTX ctx; | ||
| 115 | |||
| 116 | #ifdef OPENSSL_IA32_SSE2 | ||
| 117 | /* Alternative to this is to call OpenSSL_add_all_algorithms... | ||
| 118 | * The below code is retained exclusively for debugging purposes. */ | ||
| 119 | { char *env; | ||
| 120 | |||
| 121 | if ((env=getenv("OPENSSL_ia32cap"))) | ||
| 122 | OPENSSL_ia32cap = strtoul (env,NULL,0); | ||
| 123 | } | ||
| 124 | #endif | ||
| 125 | |||
| 126 | fprintf(stdout,"Testing Whirlpool "); | ||
| 127 | |||
| 128 | WHIRLPOOL("",0,md); | ||
| 129 | if (memcmp(md,iso_test_1,sizeof(iso_test_1))) | ||
| 130 | { fflush(stdout); | ||
| 131 | fprintf(stderr,"\nTEST 1 of 9 failed.\n"); | ||
| 132 | return 1; | ||
| 133 | } | ||
| 134 | else | ||
| 135 | fprintf(stdout,"."); fflush(stdout); | ||
| 136 | |||
| 137 | WHIRLPOOL("a",1,md); | ||
| 138 | if (memcmp(md,iso_test_2,sizeof(iso_test_2))) | ||
| 139 | { fflush(stdout); | ||
| 140 | fprintf(stderr,"\nTEST 2 of 9 failed.\n"); | ||
| 141 | return 1; | ||
| 142 | } | ||
| 143 | else | ||
| 144 | fprintf(stdout,"."); fflush(stdout); | ||
| 145 | |||
| 146 | WHIRLPOOL("abc",3,md); | ||
| 147 | if (memcmp(md,iso_test_3,sizeof(iso_test_3))) | ||
| 148 | { fflush(stdout); | ||
| 149 | fprintf(stderr,"\nTEST 3 of 9 failed.\n"); | ||
| 150 | return 1; | ||
| 151 | } | ||
| 152 | else | ||
| 153 | fprintf(stdout,"."); fflush(stdout); | ||
| 154 | |||
| 155 | WHIRLPOOL("message digest",14,md); | ||
| 156 | if (memcmp(md,iso_test_4,sizeof(iso_test_4))) | ||
| 157 | { fflush(stdout); | ||
| 158 | fprintf(stderr,"\nTEST 4 of 9 failed.\n"); | ||
| 159 | return 1; | ||
| 160 | } | ||
| 161 | else | ||
| 162 | fprintf(stdout,"."); fflush(stdout); | ||
| 163 | |||
| 164 | WHIRLPOOL("abcdefghijklmnopqrstuvwxyz",26,md); | ||
| 165 | if (memcmp(md,iso_test_5,sizeof(iso_test_5))) | ||
| 166 | { fflush(stdout); | ||
| 167 | fprintf(stderr,"\nTEST 5 of 9 failed.\n"); | ||
| 168 | return 1; | ||
| 169 | } | ||
| 170 | else | ||
| 171 | fprintf(stdout,"."); fflush(stdout); | ||
| 172 | |||
| 173 | WHIRLPOOL( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
| 174 | "abcdefghijklmnopqrstuvwxyz" | ||
| 175 | "0123456789",62,md); | ||
| 176 | if (memcmp(md,iso_test_6,sizeof(iso_test_6))) | ||
| 177 | { fflush(stdout); | ||
| 178 | fprintf(stderr,"\nTEST 6 of 9 failed.\n"); | ||
| 179 | return 1; | ||
| 180 | } | ||
| 181 | else | ||
| 182 | fprintf(stdout,"."); fflush(stdout); | ||
| 183 | |||
| 184 | WHIRLPOOL( "1234567890""1234567890""1234567890""1234567890" | ||
| 185 | "1234567890""1234567890""1234567890""1234567890",80,md); | ||
| 186 | if (memcmp(md,iso_test_7,sizeof(iso_test_7))) | ||
| 187 | { fflush(stdout); | ||
| 188 | fprintf(stderr,"\nTEST 7 of 9 failed.\n"); | ||
| 189 | return 1; | ||
| 190 | } | ||
| 191 | else | ||
| 192 | fprintf(stdout,"."); fflush(stdout); | ||
| 193 | |||
| 194 | WHIRLPOOL("abcdbcdecdefdefgefghfghighijhijk",32,md); | ||
| 195 | if (memcmp(md,iso_test_8,sizeof(iso_test_8))) | ||
| 196 | { fflush(stdout); | ||
| 197 | fprintf(stderr,"\nTEST 8 of 9 failed.\n"); | ||
| 198 | return 1; | ||
| 199 | } | ||
| 200 | else | ||
| 201 | fprintf(stdout,"."); fflush(stdout); | ||
| 202 | |||
| 203 | WHIRLPOOL_Init (&ctx); | ||
| 204 | for (i=0;i<1000000;i+=288) | ||
| 205 | WHIRLPOOL_Update (&ctx, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 206 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 207 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 208 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 209 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 210 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 211 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 212 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 213 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa", | ||
| 214 | (1000000-i)<288?1000000-i:288); | ||
| 215 | WHIRLPOOL_Final (md,&ctx); | ||
| 216 | if (memcmp(md,iso_test_9,sizeof(iso_test_9))) | ||
| 217 | { fflush(stdout); | ||
| 218 | fprintf(stderr,"\nTEST 9 of 9 failed.\n"); | ||
| 219 | return 1; | ||
| 220 | } | ||
| 221 | else | ||
| 222 | fprintf(stdout,"."); fflush(stdout); | ||
| 223 | |||
| 224 | fprintf(stdout," passed.\n"); fflush(stdout); | ||
| 225 | |||
| 226 | return 0; | ||
| 227 | } | ||
| 228 | #endif | ||
diff --git a/src/lib/libcrypto/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_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) |
