# Top level excludes
/Makefile.bak
/Makefile
+/MINFO
/*.a
/include
/*.pc
/rehash.time
+/inc.*
+/makefile.*
+/out.*
+/tmp.*
# Most *.c files under test/ are symlinks
/test/*.c
--- /dev/null
+#!/bin/sh
+
+BRANCH=`git rev-parse --abbrev-ref HEAD`
+
+./Configure $@ no-symlinks
+make files
+util/mk1mf.pl OUT=out.$BRANCH TMP=tmp.$BRANCH INC=inc.$BRANCH copy > makefile.$BRANCH
+make -f makefile.$BRANCH init
--- /dev/null
+#!/bin/sh
+
+BRANCH=`git rev-parse --abbrev-ref HEAD`
+
+make -f makefile.$BRANCH $@
@target=all; $(RECURSIVE_MAKE)
files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+ $(PERL) $(TOP)/util/files.pl "CPUID_OBJ=$(CPUID_OBJ)" Makefile >> $(TOP)/MINFO
@target=files; $(RECURSIVE_MAKE)
links:
aes-armv4.o: aes-armv4.S
files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+ $(PERL) $(TOP)/util/files.pl "AES_ENC=$(AES_ENC)" Makefile >> $(TOP)/MINFO
links:
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
rc4-%.s: asm/rc4-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
files:
- $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+ $(PERL) $(TOP)/util/files.pl "RC4_ENC=$(RC4_ENC)" Makefile >> $(TOP)/MINFO
links:
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
+files:
+ $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+
links:
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
fi
files:
-
-
+ $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
# KRB5 stuff
KRB5_INCLUDES=
LIBKRB5=
+TEST= igetest.c
PEX_LIBS=
EX_LIBS= #-lnsl -lsocket
test_ss test_ca test_engine test_evp test_ssl test_tsa test_ige \
test_jpake test_srp test_cms test_ocsp test_v3name
-test_evp:
+test_evp: $(EVPTEST) evptests.txt
../util/shlib_wrap.sh ./$(EVPTEST) evptests.txt
-test_des:
+test_des: $(DESTEST)
../util/shlib_wrap.sh ./$(DESTEST)
-test_idea:
+test_idea: $(IDEATEST)
../util/shlib_wrap.sh ./$(IDEATEST)
-test_sha:
+test_sha: $(SHATEST) $(SHA1TEST) $(SHA256TEST) $(SHA512TEST)
../util/shlib_wrap.sh ./$(SHATEST)
../util/shlib_wrap.sh ./$(SHA1TEST)
../util/shlib_wrap.sh ./$(SHA256TEST)
../util/shlib_wrap.sh ./$(SHA512TEST)
-test_mdc2:
+test_mdc2: $(MDC2TEST)
../util/shlib_wrap.sh ./$(MDC2TEST)
-test_md5:
+test_md5: $(MD5TEST)
../util/shlib_wrap.sh ./$(MD5TEST)
-test_md4:
+test_md4: $(MD4TEST)
../util/shlib_wrap.sh ./$(MD4TEST)
-test_hmac:
+test_hmac: $(HMACTEST)
../util/shlib_wrap.sh ./$(HMACTEST)
-test_wp:
+test_wp: $(WPTEST)
../util/shlib_wrap.sh ./$(WPTEST)
-test_md2:
+test_md2: $(MD2TEST)
../util/shlib_wrap.sh ./$(MD2TEST)
-test_rmd:
+test_rmd: $(RMDTEST)
../util/shlib_wrap.sh ./$(RMDTEST)
-test_bf:
+test_bf: $(BFTEST)
../util/shlib_wrap.sh ./$(BFTEST)
-test_cast:
+test_cast: $(CASTTEST)
../util/shlib_wrap.sh ./$(CASTTEST)
-test_rc2:
+test_rc2: $(RC2TEST)
../util/shlib_wrap.sh ./$(RC2TEST)
-test_rc4:
+test_rc4: $(RC4TEST)
../util/shlib_wrap.sh ./$(RC4TEST)
-test_rc5:
+test_rc5: $(RC5TEST)
../util/shlib_wrap.sh ./$(RC5TEST)
-test_rand:
+test_rand: $(RANDTEST)
../util/shlib_wrap.sh ./$(RANDTEST)
-test_enc:
+test_enc: ../apps/openssl testenc
@sh ./testenc
-test_x509:
+test_x509: ../apps/openssl tx509 testx509.pem v3-cert1.pem v3-cert2.pem
echo test normal x509v1 certificate
sh ./tx509 2>/dev/null
echo test first x509v3 certificate
echo test second x509v3 certificate
sh ./tx509 v3-cert2.pem 2>/dev/null
-test_rsa: $(RSATEST)$(EXE_EXT)
+test_rsa: $(RSATEST)$(EXE_EXT) ../apps/openssl trsa testrsa.pem
@sh ./trsa 2>/dev/null
../util/shlib_wrap.sh ./$(RSATEST)
-test_crl:
+test_crl: ../apps/openssl tcrl testcrl.pem
@sh ./tcrl 2>/dev/null
-test_sid:
+test_sid: ../apps/openssl tsid testsid.pem
@sh ./tsid 2>/dev/null
-test_req:
+test_req: ../apps/openssl treq testreq.pem testreq2.pem
@sh ./treq 2>/dev/null
@sh ./treq testreq2.pem 2>/dev/null
-test_pkcs7:
+test_pkcs7: ../apps/openssl tpkcs7 tpkcs7d testp7.pem pkcs7-1.pem
@sh ./tpkcs7 2>/dev/null
@sh ./tpkcs7d 2>/dev/null
-test_bn:
+test_bn: $(BNTEST) $(EXPTEST) bctest
@echo starting big number library test, could take a while...
@../util/shlib_wrap.sh ./$(BNTEST) >tmp.bntest
@echo quit >>tmp.bntest
@echo 'test a^b%c implementations'
../util/shlib_wrap.sh ./$(EXPTEST)
-test_ec:
+test_ec: $(ECTEST)
@echo 'test elliptic curves'
../util/shlib_wrap.sh ./$(ECTEST)
-test_ecdsa:
+test_ecdsa: $(ECDSATEST)
@echo 'test ecdsa'
../util/shlib_wrap.sh ./$(ECDSATEST)
-test_ecdh:
+test_ecdh: $(ECDHTEST)
@echo 'test ecdh'
../util/shlib_wrap.sh ./$(ECDHTEST)
-test_verify:
+test_verify: ../apps/openssl
@echo "The following command should have some OK's and some failures"
@echo "There are definitly a few expired certificates"
../util/shlib_wrap.sh ../apps/openssl verify -CApath ../certs/demo ../certs/demo/*.pem
-test_dh:
+test_dh: $(DHTEST)
@echo "Generate a set of DH parameters"
../util/shlib_wrap.sh ./$(DHTEST)
-test_dsa:
+test_dsa: $(DSATEST)
@echo "Generate a set of DSA parameters"
../util/shlib_wrap.sh ./$(DSATEST)
../util/shlib_wrap.sh ./$(DSATEST) -app2_1
-test_gen:
+test_gen testreq.pem: ../apps/openssl testgen test.cnf
@echo "Generate and verify a certificate request"
@sh ./testgen
test_ss keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \
- intP1.ss intP2.ss: testss
+ intP1.ss intP2.ss: testss CAss.cnf Uss.cnf P1ss.cnf P2ss.cnf \
+ ../apps/openssl
@echo "Generate and certify a test certificate"
@sh ./testss
@cat certCA.ss certU.ss > intP1.ss
@cat certCA.ss certU.ss certP1.ss > intP2.ss
-test_engine:
+test_engine: $(ENGINETEST)
@echo "Manipulate the ENGINE structures"
../util/shlib_wrap.sh ./$(ENGINETEST)
test_ssl: keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \
- intP1.ss intP2.ss
+ intP1.ss intP2.ss $(SSLTEST) testssl testsslproxy \
+ ../apps/server2.pem
@echo "test SSL protocol"
@if [ -n "$(FIPSCANLIB)" ]; then \
sh ./testfipsssl keyU.ss certU.ss certCA.ss; \
@sh ./testsslproxy keyP1.ss certP1.ss intP1.ss
@sh ./testsslproxy keyP2.ss certP2.ss intP2.ss
-test_ca:
+test_ca: ../apps/openssl testca CAss.cnf Uss.cnf
@if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then \
echo "skipping CA.sh test -- requires RSA"; \
else \
# @echo "test Rijndael"
# ../util/shlib_wrap.sh ./$(AESTEST)
-test_tsa:
+test_tsa: ../apps/openssl testtsa CAtsa.cnf ../util/shlib_wrap.sh
@if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then \
echo "skipping testtsa test -- requires RSA"; \
else \
@echo "Test JPAKE"
../util/shlib_wrap.sh ./$(JPAKETEST)
-test_cms:
+test_cms: ../apps/openssl cms-test.pl smcont.txt
@echo "CMS consistency test"
$(PERL) cms-test.pl
@echo "Test SRP"
../util/shlib_wrap.sh ./srptest
-test_ocsp:
+test_ocsp: ../apps/openssl tocsp
@echo "Test OCSP"
@sh ./tocsp
fi
echo testing crl conversions
-cp $t fff.p
+cp $t crl-fff.p
echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
+$cmd -in crl-fff.p -inform p -outform d >crl-f.d
if [ $? != 0 ]; then exit 1; fi
#echo "p -> t"
-#$cmd -in fff.p -inform p -outform t >f.t
+#$cmd -in crl-fff.p -inform p -outform t >crl-f.t
#if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
+$cmd -in crl-fff.p -inform p -outform p >crl-f.p
if [ $? != 0 ]; then exit 1; fi
echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
+$cmd -in crl-f.d -inform d -outform d >crl-ff.d1
if [ $? != 0 ]; then exit 1; fi
#echo "t -> d"
-#$cmd -in f.t -inform t -outform d >ff.d2
+#$cmd -in crl-f.t -inform t -outform d >crl-ff.d2
#if [ $? != 0 ]; then exit 1; fi
echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
+$cmd -in crl-f.p -inform p -outform d >crl-ff.d3
if [ $? != 0 ]; then exit 1; fi
#echo "d -> t"
-#$cmd -in f.d -inform d -outform t >ff.t1
+#$cmd -in crl-f.d -inform d -outform t >crl-ff.t1
#if [ $? != 0 ]; then exit 1; fi
#echo "t -> t"
-#$cmd -in f.t -inform t -outform t >ff.t2
+#$cmd -in crl-f.t -inform t -outform t >crl-ff.t2
#if [ $? != 0 ]; then exit 1; fi
#echo "p -> t"
-#$cmd -in f.p -inform p -outform t >ff.t3
+#$cmd -in crl-f.p -inform p -outform t >crl-ff.t3
#if [ $? != 0 ]; then exit 1; fi
echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
+$cmd -in crl-f.d -inform d -outform p >crl-ff.p1
if [ $? != 0 ]; then exit 1; fi
#echo "t -> p"
-#$cmd -in f.t -inform t -outform p >ff.p2
+#$cmd -in crl-f.t -inform t -outform p >crl-ff.p2
#if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
+$cmd -in crl-f.p -inform p -outform p >crl-ff.p3
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p f.p
+cmp crl-fff.p crl-f.p
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p1
+cmp crl-fff.p crl-ff.p1
if [ $? != 0 ]; then exit 1; fi
-#cmp fff.p ff.p2
+#cmp crl-fff.p crl-ff.p2
#if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p3
+cmp crl-fff.p crl-ff.p3
if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t1
+#cmp crl-f.t crl-ff.t1
#if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t2
+#cmp crl-f.t crl-ff.t2
#if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t3
+#cmp crl-f.t crl-ff.t3
#if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p1
+cmp crl-f.p crl-ff.p1
if [ $? != 0 ]; then exit 1; fi
-#cmp f.p ff.p2
+#cmp crl-f.p crl-ff.p2
#if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p3
+cmp crl-f.p crl-ff.p3
if [ $? != 0 ]; then exit 1; fi
-/bin/rm -f f.* ff.* fff.*
+/bin/rm -f crl-f.* crl-ff.* crl-fff.*
exit 0
#!/bin/sh
-testsrc=Makefile
+testsrc=testenc
test=./p
cmd="../util/shlib_wrap.sh ../apps/openssl"
fi
echo testing pkcs7 conversions
-cp $t fff.p
+cp $t p7-fff.p
echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
+$cmd -in p7-fff.p -inform p -outform d >p7-f.d
if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
+$cmd -in p7-fff.p -inform p -outform p >p7-f.p
if [ $? != 0 ]; then exit 1; fi
echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
+$cmd -in p7-f.d -inform d -outform d >p7-ff.d1
if [ $? != 0 ]; then exit 1; fi
echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
+$cmd -in p7-f.p -inform p -outform d >p7-ff.d3
if [ $? != 0 ]; then exit 1; fi
echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
+$cmd -in p7-f.d -inform d -outform p >p7-ff.p1
if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
+$cmd -in p7-f.p -inform p -outform p >p7-ff.p3
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p f.p
+cmp p7-fff.p p7-f.p
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p1
+cmp p7-fff.p p7-ff.p1
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p3
+cmp p7-fff.p p7-ff.p3
if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p1
+cmp p7-f.p p7-ff.p1
if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p3
+cmp p7-f.p p7-ff.p3
if [ $? != 0 ]; then exit 1; fi
-/bin/rm -f f.* ff.* fff.*
+/bin/rm -f p7-f.* p7-ff.* p7-fff.*
exit 0
fi
echo "testing pkcs7 conversions (2)"
-cp $t fff.p
+cp $t p7d-fff.p
echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
+$cmd -in p7d-fff.p -inform p -outform d >p7d-f.d
if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
+$cmd -in p7d-fff.p -inform p -outform p >p7d-f.p
if [ $? != 0 ]; then exit 1; fi
echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
+$cmd -in p7d-f.d -inform d -outform d >p7d-ff.d1
if [ $? != 0 ]; then exit 1; fi
echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
+$cmd -in p7d-f.p -inform p -outform d >p7d-ff.d3
if [ $? != 0 ]; then exit 1; fi
echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
+$cmd -in p7d-f.d -inform d -outform p >p7d-ff.p1
if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
+$cmd -in p7d-f.p -inform p -outform p >p7d-ff.p3
if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p1
+cmp p7d-f.p p7d-ff.p1
if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p3
+cmp p7d-f.p p7d-ff.p3
if [ $? != 0 ]; then exit 1; fi
-/bin/rm -f f.* ff.* fff.*
+/bin/rm -f p7d-f.* p7d-ff.* p7d-fff.*
exit 0
fi
echo testing req conversions
-cp $t fff.p
+cp $t req-fff.p
echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
+$cmd -in req-fff.p -inform p -outform d >req-f.d
if [ $? != 0 ]; then exit 1; fi
#echo "p -> t"
-#$cmd -in fff.p -inform p -outform t >f.t
+#$cmd -in req-fff.p -inform p -outform t >req-f.t
#if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
+$cmd -in req-fff.p -inform p -outform p >req-f.p
if [ $? != 0 ]; then exit 1; fi
echo "d -> d"
-$cmd -verify -in f.d -inform d -outform d >ff.d1
+$cmd -verify -in req-f.d -inform d -outform d >req-ff.d1
if [ $? != 0 ]; then exit 1; fi
#echo "t -> d"
-#$cmd -in f.t -inform t -outform d >ff.d2
+#$cmd -in req-f.t -inform t -outform d >req-ff.d2
#if [ $? != 0 ]; then exit 1; fi
echo "p -> d"
-$cmd -verify -in f.p -inform p -outform d >ff.d3
+$cmd -verify -in req-f.p -inform p -outform d >req-ff.d3
if [ $? != 0 ]; then exit 1; fi
#echo "d -> t"
-#$cmd -in f.d -inform d -outform t >ff.t1
+#$cmd -in req-f.d -inform d -outform t >req-ff.t1
#if [ $? != 0 ]; then exit 1; fi
#echo "t -> t"
-#$cmd -in f.t -inform t -outform t >ff.t2
+#$cmd -in req-f.t -inform t -outform t >req-ff.t2
#if [ $? != 0 ]; then exit 1; fi
#echo "p -> t"
-#$cmd -in f.p -inform p -outform t >ff.t3
+#$cmd -in req-f.p -inform p -outform t >req-ff.t3
#if [ $? != 0 ]; then exit 1; fi
echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
+$cmd -in req-f.d -inform d -outform p >req-ff.p1
if [ $? != 0 ]; then exit 1; fi
#echo "t -> p"
-#$cmd -in f.t -inform t -outform p >ff.p2
+#$cmd -in req-f.t -inform t -outform p >req-ff.p2
#if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
+$cmd -in req-f.p -inform p -outform p >req-ff.p3
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p f.p
+cmp req-fff.p req-f.p
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p1
+cmp req-fff.p req-ff.p1
if [ $? != 0 ]; then exit 1; fi
-#cmp fff.p ff.p2
+#cmp req-fff.p req-ff.p2
#if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p3
+cmp req-fff.p req-ff.p3
if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t1
+#cmp req-f.t req-ff.t1
#if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t2
+#cmp req-f.t req-ff.t2
#if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t3
+#cmp req-f.t req-ff.t3
#if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p1
+cmp req-f.p req-ff.p1
if [ $? != 0 ]; then exit 1; fi
-#cmp f.p ff.p2
+#cmp req-f.p req-ff.p2
#if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p3
+cmp req-f.p req-ff.p3
if [ $? != 0 ]; then exit 1; fi
-/bin/rm -f f.* ff.* fff.*
+/bin/rm -f req-f.* req-ff.* req-fff.*
exit 0
fi
echo testing rsa conversions
-cp $t fff.p
+cp $t rsa-fff.p
echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
+$cmd -in rsa-fff.p -inform p -outform d >rsa-f.d
if [ $? != 0 ]; then exit 1; fi
#echo "p -> t"
-#$cmd -in fff.p -inform p -outform t >f.t
+#$cmd -in rsa-fff.p -inform p -outform t >rsa-f.t
#if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
+$cmd -in rsa-fff.p -inform p -outform p >rsa-f.p
if [ $? != 0 ]; then exit 1; fi
echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
+$cmd -in rsa-f.d -inform d -outform d >rsa-ff.d1
if [ $? != 0 ]; then exit 1; fi
#echo "t -> d"
-#$cmd -in f.t -inform t -outform d >ff.d2
+#$cmd -in rsa-f.t -inform t -outform d >rsa-ff.d2
#if [ $? != 0 ]; then exit 1; fi
echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
+$cmd -in rsa-f.p -inform p -outform d >rsa-ff.d3
if [ $? != 0 ]; then exit 1; fi
#echo "d -> t"
-#$cmd -in f.d -inform d -outform t >ff.t1
+#$cmd -in rsa-f.d -inform d -outform t >rsa-ff.t1
#if [ $? != 0 ]; then exit 1; fi
#echo "t -> t"
-#$cmd -in f.t -inform t -outform t >ff.t2
+#$cmd -in rsa-f.t -inform t -outform t >rsa-ff.t2
#if [ $? != 0 ]; then exit 1; fi
#echo "p -> t"
-#$cmd -in f.p -inform p -outform t >ff.t3
+#$cmd -in rsa-f.p -inform p -outform t >rsa-ff.t3
#if [ $? != 0 ]; then exit 1; fi
echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
+$cmd -in rsa-f.d -inform d -outform p >rsa-ff.p1
if [ $? != 0 ]; then exit 1; fi
#echo "t -> p"
-#$cmd -in f.t -inform t -outform p >ff.p2
+#$cmd -in rsa-f.t -inform t -outform p >rsa-ff.p2
#if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
+$cmd -in rsa-f.p -inform p -outform p >rsa-ff.p3
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p f.p
+cmp rsa-fff.p rsa-f.p
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p1
+cmp rsa-fff.p rsa-ff.p1
if [ $? != 0 ]; then exit 1; fi
-#cmp fff.p ff.p2
+#cmp rsa-fff.p rsa-ff.p2
#if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p3
+cmp rsa-fff.p rsa-ff.p3
if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t1
+#cmp rsa-f.t rsa-ff.t1
#if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t2
+#cmp rsa-f.t rsa-ff.t2
#if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t3
+#cmp rsa-f.t rsa-ff.t3
#if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p1
+cmp rsa-f.p rsa-ff.p1
if [ $? != 0 ]; then exit 1; fi
-#cmp f.p ff.p2
+#cmp rsa-f.p rsa-ff.p2
#if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p3
+cmp rsa-f.p rsa-ff.p3
if [ $? != 0 ]; then exit 1; fi
-/bin/rm -f f.* ff.* fff.*
+/bin/rm -f rsa-f.* rsa-ff.* rsa-fff.*
exit 0
fi
echo testing session-id conversions
-cp $t fff.p
+cp $t sid-fff.p
echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
+$cmd -in sid-fff.p -inform p -outform d >sid-f.d
if [ $? != 0 ]; then exit 1; fi
#echo "p -> t"
-#$cmd -in fff.p -inform p -outform t >f.t
+#$cmd -in sid-fff.p -inform p -outform t >sid-f.t
#if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
+$cmd -in sid-fff.p -inform p -outform p >sid-f.p
if [ $? != 0 ]; then exit 1; fi
echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
+$cmd -in sid-f.d -inform d -outform d >sid-ff.d1
if [ $? != 0 ]; then exit 1; fi
#echo "t -> d"
-#$cmd -in f.t -inform t -outform d >ff.d2
+#$cmd -in sid-f.t -inform t -outform d >sid-ff.d2
#if [ $? != 0 ]; then exit 1; fi
echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
+$cmd -in sid-f.p -inform p -outform d >sid-ff.d3
if [ $? != 0 ]; then exit 1; fi
#echo "d -> t"
-#$cmd -in f.d -inform d -outform t >ff.t1
+#$cmd -in sid-f.d -inform d -outform t >sid-ff.t1
#if [ $? != 0 ]; then exit 1; fi
#echo "t -> t"
-#$cmd -in f.t -inform t -outform t >ff.t2
+#$cmd -in sid-f.t -inform t -outform t >sid-ff.t2
#if [ $? != 0 ]; then exit 1; fi
#echo "p -> t"
-#$cmd -in f.p -inform p -outform t >ff.t3
+#$cmd -in sid-f.p -inform p -outform t >sid-ff.t3
#if [ $? != 0 ]; then exit 1; fi
echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
+$cmd -in sid-f.d -inform d -outform p >sid-ff.p1
if [ $? != 0 ]; then exit 1; fi
#echo "t -> p"
-#$cmd -in f.t -inform t -outform p >ff.p2
+#$cmd -in sid-f.t -inform t -outform p >sid-ff.p2
#if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
+$cmd -in sid-f.p -inform p -outform p >sid-ff.p3
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p f.p
+cmp sid-fff.p sid-f.p
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p1
+cmp sid-fff.p sid-ff.p1
if [ $? != 0 ]; then exit 1; fi
-#cmp fff.p ff.p2
+#cmp sid-fff.p sid-ff.p2
#if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p3
+cmp sid-fff.p sid-ff.p3
if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t1
+#cmp sid-f.t sid-ff.t1
#if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t2
+#cmp sid-f.t sid-ff.t2
#if [ $? != 0 ]; then exit 1; fi
-#cmp f.t ff.t3
+#cmp sid-f.t sid-ff.t3
#if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p1
+cmp sid-f.p sid-ff.p1
if [ $? != 0 ]; then exit 1; fi
-#cmp f.p ff.p2
+#cmp sid-f.p sid-ff.p2
#if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p3
+cmp sid-f.p sid-ff.p3
if [ $? != 0 ]; then exit 1; fi
-/bin/rm -f f.* ff.* fff.*
+/bin/rm -f sid-f.* sid-ff.* sid-fff.*
exit 0
fi
echo testing X509 conversions
-cp $t fff.p
+cp $t x509-fff.p
echo "p -> d"
-$cmd -in fff.p -inform p -outform d >f.d
+$cmd -in x509-fff.p -inform p -outform d >x509-f.d
if [ $? != 0 ]; then exit 1; fi
echo "p -> n"
-$cmd -in fff.p -inform p -outform n >f.n
+$cmd -in x509-fff.p -inform p -outform n >x509-f.n
if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in fff.p -inform p -outform p >f.p
+$cmd -in x509-fff.p -inform p -outform p >x509-f.p
if [ $? != 0 ]; then exit 1; fi
echo "d -> d"
-$cmd -in f.d -inform d -outform d >ff.d1
+$cmd -in x509-f.d -inform d -outform d >x509-ff.d1
if [ $? != 0 ]; then exit 1; fi
echo "n -> d"
-$cmd -in f.n -inform n -outform d >ff.d2
+$cmd -in x509-f.n -inform n -outform d >x509-ff.d2
if [ $? != 0 ]; then exit 1; fi
echo "p -> d"
-$cmd -in f.p -inform p -outform d >ff.d3
+$cmd -in x509-f.p -inform p -outform d >x509-ff.d3
if [ $? != 0 ]; then exit 1; fi
echo "d -> n"
-$cmd -in f.d -inform d -outform n >ff.n1
+$cmd -in x509-f.d -inform d -outform n >x509-ff.n1
if [ $? != 0 ]; then exit 1; fi
echo "n -> n"
-$cmd -in f.n -inform n -outform n >ff.n2
+$cmd -in x509-f.n -inform n -outform n >x509-ff.n2
if [ $? != 0 ]; then exit 1; fi
echo "p -> n"
-$cmd -in f.p -inform p -outform n >ff.n3
+$cmd -in x509-f.p -inform p -outform n >x509-ff.n3
if [ $? != 0 ]; then exit 1; fi
echo "d -> p"
-$cmd -in f.d -inform d -outform p >ff.p1
+$cmd -in x509-f.d -inform d -outform p >x509-ff.p1
if [ $? != 0 ]; then exit 1; fi
echo "n -> p"
-$cmd -in f.n -inform n -outform p >ff.p2
+$cmd -in x509-f.n -inform n -outform p >x509-ff.p2
if [ $? != 0 ]; then exit 1; fi
echo "p -> p"
-$cmd -in f.p -inform p -outform p >ff.p3
+$cmd -in x509-f.p -inform p -outform p >x509-ff.p3
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p f.p
+cmp x509-fff.p x509-f.p
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p1
+cmp x509-fff.p x509-ff.p1
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p2
+cmp x509-fff.p x509-ff.p2
if [ $? != 0 ]; then exit 1; fi
-cmp fff.p ff.p3
+cmp x509-fff.p x509-ff.p3
if [ $? != 0 ]; then exit 1; fi
-cmp f.n ff.n1
+cmp x509-f.n x509-ff.n1
if [ $? != 0 ]; then exit 1; fi
-cmp f.n ff.n2
+cmp x509-f.n x509-ff.n2
if [ $? != 0 ]; then exit 1; fi
-cmp f.n ff.n3
+cmp x509-f.n x509-ff.n3
if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p1
+cmp x509-f.p x509-ff.p1
if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p2
+cmp x509-f.p x509-ff.p2
if [ $? != 0 ]; then exit 1; fi
-cmp f.p ff.p3
+cmp x509-f.p x509-ff.p3
if [ $? != 0 ]; then exit 1; fi
-/bin/rm -f f.* ff.* fff.*
+/bin/rm -f x509-f.* x509-ff.* x509-fff.*
exit 0
--- /dev/null
+#!/usr/local/bin/perl
+
+use strict;
+
+use Fcntl;
+
+# copy-if-different.pl
+
+# Copy to the destination if the source is not the same as it.
+
+my @filelist;
+
+foreach my $arg (@ARGV) {
+ $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob...
+ foreach (glob $arg)
+ {
+ push @filelist, $_;
+ }
+}
+
+my $fnum = @filelist;
+
+if ($fnum <= 1)
+ {
+ die "Need at least two filenames";
+ }
+
+my $dest = pop @filelist;
+
+if ($fnum > 2 && ! -d $dest)
+ {
+ die "Destination must be a directory";
+ }
+
+foreach (@filelist)
+ {
+ my $dfile;
+ if (-d $dest)
+ {
+ $dfile = $_;
+ $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|;
+ $dfile = "$dest/$dfile";
+ }
+ else
+ {
+ $dfile = $dest;
+ }
+
+ my $buf;
+ if (-f $dfile)
+ {
+ sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_";
+ sysopen(OUT, $dfile, O_RDONLY|O_BINARY)
+ || die "Can't Open $dfile";
+ while (sysread IN, $buf, 10240)
+ {
+ my $b2;
+ goto copy if !sysread(OUT, $b2, 10240) || $buf ne $b2;
+ }
+ goto copy if sysread(OUT, $buf, 1);
+ close(IN);
+ close(OUT);
+ print "NOT copying: $_ to $dfile\n";
+ next;
+ }
+ copy:
+ sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_";
+ sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY)
+ || die "Can't Open $dfile";
+ while (sysread IN, $buf, 10240)
+ {
+ syswrite(OUT, $buf, length($buf));
+ }
+ close(IN);
+ close(OUT);
+ print "Copying: $_ to $dfile\n";
+ }
+
# It is basically a list of all variables from the passed makefile
#
+while ($ARGV[0] =~ /^(\S+)\s*=(.*)$/)
+ {
+ $sym{$1} = $2;
+ shift;
+ }
+
$s="";
while (<>)
{
$o =~ s/\s+/ /g;
$o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g;
- $sym{$s}=$o;
+ $sym{$s}=$o if !exists $sym{$s};
}
}
# A bit of an evil hack but it post processes the file ../MINFO which
# is generated by `make files` in the top directory.
# This script outputs one mega makefile that has no shell stuff or any
-# funny stuff
-#
+# funny stuff (if the target is not "copy").
+# If the target is "copy", then it tries to create a makefile that can be
+# safely used with the -j flag and that is compatible with the top-level
+# Makefile, in the sense that it uses the same options and assembler files etc.
+
+use Cwd;
$INSTALLTOP="/usr/local/ssl";
$OPENSSLDIR="/usr/local/ssl";
INSTALLTOP => \$INSTALLTOP,
OPENSSLDIR => \$OPENSSLDIR,
PLATFORM => \$mf_platform,
+ CC => \$mf_cc,
CFLAG => \$mf_cflag,
DEPFLAG => \$mf_depflag,
CPUID_OBJ => \$mf_cpuid_asm,
RMD160_ASM_OBJ => \$mf_rmd_asm,
WP_ASM_OBJ => \$mf_wp_asm,
CMLL_ENC => \$mf_cm_asm,
+ MODES_ASM_OBJ => \$mf_modes_asm,
+ ENGINES_ASM_OBJ=> \$mf_engines_asm,
BASEADDR => \$baseaddr,
FIPSDIR => \$fipsdir,
);
-
open(IN,"<Makefile") || die "unable to open Makefile!\n";
while(<IN>) {
my ($mf_opt, $mf_ref);
while (($mf_opt, $mf_ref) = each %mf_import) {
- if (/^$mf_opt\s*=\s*(.*)$/) {
+ if (/^$mf_opt\s*=\s*(.*)$/ && !defined($$mfref)) {
$$mf_ref = $1;
}
}
"netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets",
"netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets",
"default","cc under unix",
- "auto", "auto detect from top level Makefile"
+ "auto", "auto detect from top level Makefile",
+ "copy", "copy from top level Makefile"
);
$platform="";
$ranlib="echo ranlib";
$cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc';
-$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.';
+$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:getcwd();
$bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:'';
# $bin_dir.=$o causes a core dump on my sparc :-(
push(@INC,"util/pl","pl");
-if ($platform eq "auto") {
+if ($platform eq "auto" || $platform eq 'copy') {
+ $orig_platform = $platform;
$platform = $mf_platform;
print STDERR "Imported platform $mf_platform\n";
}
##else
{ $cflags="$c_flags$cflags" if ($c_flags ne ""); }
+if ($orig_platform eq 'copy') {
+ $cflags = $mf_cflag;
+ $cc = $mf_cc;
+}
+
$ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
}
$defs= <<"EOF";
+# N.B. You MUST use -j on FreeBSD.
# This makefile has been automatically generated from the OpenSSL distribution.
# This single makefile will build the complete OpenSSL distribution and
# by default leave the 'intertesting' output files in .${o}out and the stuff
LFLAGS=$lflags
RSC=$rsc
-# The output directory for everything intersting
+# The output directory for everything interesting
OUT_D=$out_dir
# The output directory for all the temporary muck
TMP_D=$tmp_dir
# FIPS validated module and support file locations
+E_PREMAIN_DSO=fips_premain_dso
+
FIPSDIR=$fipsdir
BASEADDR=$baseaddr
FIPSLIB_D=\$(FIPSDIR)${o}lib
FIPS_PREMAIN_SRC=\$(FIPSLIB_D)${o}fips_premain.c
O_FIPSCANISTER=\$(FIPSLIB_D)${o}fipscanister.lib
FIPS_SHA1_EXE=\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep}
-E_PREMAIN_DSO=fips_premain_dso
PREMAIN_DSO_EXE=\$(BIN_D)${o}fips_premain_dso$exep
FIPSLINK=\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl
\$(INC_D):
\$(MKDIR) \"\$(INC_D)\"
+# This needs to be invoked once, when the makefile is first constructed, or
+# after cleaning.
+init: \$(TMP_D) \$(LIB_D) \$(INC_D) \$(INCO_D) \$(BIN_D) \$(TEST_D) headers
+
headers: \$(HEADER) \$(EXHEADER)
- @
lib: \$(LIBS_DEP) \$(E_SHLIB)
\$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\"
$extra_install
-
-test: \$(T_EXE)
- cd \$(BIN_D)
- ..${o}ms${o}test
-
clean:
\$(RM) \$(TMP_D)$o*.*
\$(RM) \$(TMP_D)$o*.*
\$(RM) \$(OUT_D)$o*.*
+reallyclean:
+ \$(RM) -rf \$(TMP_D)
+ \$(RM) -rf \$(BIN_D)
+ \$(RM) -rf \$(TEST_D)
+ \$(RM) -rf \$(LIB_D)
+ \$(RM) -rf \$(INC_D)
+
EOF
-
+
+if ($orig_platform ne 'copy')
+ {
+ $rules .= <<"EOF";
+test: \$(T_EXE)
+ cd \$(BIN_D)
+ ..${o}ms${o}test
+
+EOF
+ }
+
my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform";
$platform_cpp_symbol =~ s/-/_/g;
if (open(IN,"crypto/buildinf.h"))
printf OUT "#endif\n";
close(OUT);
-# Strip of trailing ' '
+# Strip off trailing ' '
foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); }
$test=&clean_up_ws($test);
$e_exe=&clean_up_ws($e_exe);
$rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1);
}
+sub fix_asm
+ {
+ my($asm, $dir) = @_;
+
+ return '' if $asm eq '';
+
+ $asm = " $asm";
+ $asm =~ s/\s+/ $dir\//g;
+ $asm =~ s/\.o//g;
+ $asm =~ s/^ //;
+
+ return $asm . ' ';
+ }
+
+if ($orig_platform eq 'copy') {
+ $lib_obj{CRYPTO} .= fix_asm($mf_md5_asm, 'crypto/md5');
+ $lib_obj{CRYPTO} .= fix_asm($mf_bn_asm, 'crypto/bn');
+ # cpuid is included by the crypto dir
+ #$lib_obj{CRYPTO} .= fix_asm($mf_cpuid_asm, 'crypto');
+ # AES asm files DON'T end up included by the aes dir itself
+ $lib_obj{CRYPTO} .= fix_asm($mf_aes_asm, 'crypto/aes');
+ $lib_obj{CRYPTO} .= fix_asm($mf_sha_asm, 'crypto/sha');
+ $lib_obj{CRYPTO} .= fix_asm($mf_engines_asm, 'engines');
+ $lib_obj{CRYPTO} .= fix_asm($mf_rc4_asm, 'crypto/rc4');
+ $lib_obj{CRYPTO} .= fix_asm($mf_modes_asm, 'crypto/modes');
+}
+
foreach (values %lib_nam)
{
$lib_obj=$lib_obj{$_};
$rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0);
+$rules .= get_tests('test/Makefile') if $orig_platform eq 'copy';
+
print $defs;
if ($platform eq "linux-elf") {
{
$ret.=&Sasm_compile_target("$to${o}$n$obj",$s,$n);
}
+ elsif (defined &special_compile_target and
+ ($s=special_compile_target($_)))
+ {
+ $ret.=$s;
+ }
else { die "no rule for $_"; }
}
return($ret);
sub perlasm_compile_target
{
my($target,$source,$bname)=@_;
+
+ return platform_perlasm_compile_target($target, $source, $bname)
+ if defined &platform_perlasm_compile_target;
+
my($ret);
$bname =~ s/(.*)\.[^\.]$/$1/;
$source =~ s/\//$o/g if $o ne "/";
$srcd = "\$(SRC_D)$o" unless defined $srcd;
$ret ="$target: $srcd$source\n\t";
- $ret.="\$(CC) ${ofile}$target $ex_flags -c $srcd$source\n\n";
+ $ret.="\$(CC)";
+ $ret.= " -MMD" if $orig_platform eq "copy";
+ $ret.= " ${ofile}$target $ex_flags -c \$(SRC_D)$o$source\n\n";
+ $target =~ s/\.o$/.d/;
+ $ret.=".sinclude \"$target\"\n\n" if $orig_platform eq "copy";
return($ret);
}
if ($n =~ /bss_file/)
{ $pp=".c"; }
else { $pp=$p; }
- $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n";
+ $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(PERL) \$(SRC_D)${o}util${o}copy-if-different.pl \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n";
}
return($ret);
}
"no-tlsext" => \$no_tlsext,
"no-srp" => \$no_srp,
"no-cms" => \$no_cms,
- "no-ec2m" => \$no_ec2m,
"no-jpake" => \$no_jpake,
+ "no-ec2m" => \$no_ec2m,
"no-ec_nistp_64_gcc_128" => 0,
"no-err" => \$no_err,
"no-sock" => \$no_sock,
{ $cflags="-O"; }
}
$obj='.o';
+$asm_suffix='.s';
$ofile='-o ';
# EXE linking stuff
$link='${CC}';
-$lflags='${CFLAGS}';
+$lflags='${CFLAG}';
$efile='-o ';
$exep='';
$ex_libs="";
$bf_enc_obj="";
$bf_enc_src="";
+%perl1 = (
+ 'md5-x86_64' => 'crypto/md5',
+ 'x86_64-mont' => 'crypto/bn',
+ 'x86_64-mont5' => 'crypto/bn',
+ 'x86_64-gf2m' => 'crypto/bn',
+ 'modexp512-x86_64' => 'crypto/bn',
+ 'aes-x86_64' => 'crypto/aes',
+ 'vpaes-x86_64' => 'crypto/aes',
+ 'bsaes-x86_64' => 'crypto/aes',
+ 'aesni-x86_64' => 'crypto/aes',
+ 'aesni-sha1-x86_64' => 'crypto/aes',
+ 'sha1-x86_64' => 'crypto/sha',
+ 'e_padlock-x86_64' => 'engines',
+ 'rc4-x86_64' => 'crypto/rc4',
+ 'rc4-md5-x86_64' => 'crypto/rc4',
+ 'ghash-x86_64' => 'crypto/modes',
+ 'aesni-gcm-x86_64' => 'crypto/modes',
+ 'aesni-sha256-x86_64' => 'crypto/aes',
+ );
+
+# If I were feeling more clever, these could probably be extracted
+# from makefiles.
+sub platform_perlasm_compile_target
+ {
+ local($target, $source, $bname) = @_;
+
+ for $p (keys %perl1)
+ {
+ if ($target eq "\$(OBJ_D)/$p.o")
+ {
+ return << "EOF";
+\$(TMP_D)/$p.s: $perl1{$p}/asm/$p.pl
+ \$(PERL) $perl1{$p}/asm/$p.pl \$(PERLASM_SCHEME) > \$@
+EOF
+ }
+ }
+ if ($target eq '$(OBJ_D)/x86_64cpuid.o')
+ {
+ return << 'EOF';
+$(TMP_D)/x86_64cpuid.s: crypto/x86_64cpuid.pl
+ $(PERL) crypto/x86_64cpuid.pl $(PERLASM_SCHEME) > $@
+EOF
+ }
+ elsif ($target eq '$(OBJ_D)/sha256-x86_64.o')
+ {
+ return << 'EOF';
+$(TMP_D)/sha256-x86_64.s: crypto/sha/asm/sha512-x86_64.pl
+ $(PERL) crypto/sha/asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@
+EOF
+ }
+ elsif ($target eq '$(OBJ_D)/sha512-x86_64.o')
+ {
+ return << 'EOF';
+$(TMP_D)/sha512-x86_64.s: crypto/sha/asm/sha512-x86_64.pl
+ $(PERL) crypto/sha/asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@
+EOF
+ }
+ elsif ($target eq '$(OBJ_D)/sha512-x86_64.o')
+ {
+ return << 'EOF';
+$(TMP_D)/sha512-x86_64.s: crypto/sha/asm/sha512-x86_64.pl
+ $(PERL) crypto/sha/asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@
+EOF
+ }
+
+ die $target;
+ }
+
+sub special_compile_target
+ {
+ local($target) = @_;
+
+ if ($target eq 'crypto/bn/x86_64-gcc')
+ {
+ return << "EOF";
+\$(TMP_D)/x86_64-gcc.o: crypto/bn/asm/x86_64-gcc.c
+ \$(CC) \$(CFLAGS) -c -o \$@ crypto/bn/asm/x86_64-gcc.c
+EOF
+ }
+ return undef;
+ }
+
sub do_lib_rule
{
local($obj,$target,$name,$shlib)=@_;
{
local($target,$files,$dep_libs,$libs)=@_;
local($ret,$_);
-
+
$file =~ s/\//$o/g if $o ne '/';
$n=&bname($target);
$ret.="$target: $files $dep_libs\n";
}
}
+sub fixtests
+ {
+ my ($str, $tests) = @_;
+
+ foreach my $t (keys %$tests)
+ {
+ $str =~ s/(\.\/)?\$\($t\)/\$(TEST_D)\/$tests->{$t}/g;
+ }
+
+ return $str;
+ }
+
+sub fixdeps
+ {
+ my ($str, $fakes) = @_;
+
+ my @t = split(/\s+/, $str);
+ $str = '';
+ foreach my $t (@t)
+ {
+ $str .= ' ' if $str ne '';
+ if (exists($fakes->{$t}))
+ {
+ $str .= $fakes->{$t};
+ next;
+ }
+ if ($t =~ /^[^\/]+$/)
+ {
+ $str .= '$(TEST_D)/' . $t;
+ }
+ else
+ {
+ $str .= $t;
+ }
+ }
+
+ return $str;
+ }
+
+sub fixrules
+ {
+ my ($str) = @_;
+
+ # Compatible with -j...
+ $str =~ s/^(\s+@?)/$1cd \$(TEST_D) && /;
+ return $str;
+
+ # Compatible with not -j.
+ my @t = split("\n", $str);
+ $str = '';
+ my $prev;
+ foreach my $t (@t)
+ {
+ $t =~ s/^\s+//;
+ if (!$prev)
+ {
+ if ($t =~ /^@/)
+ {
+ $t =~ s/^@/\@cd \$(TEST_D) && /;
+ }
+ elsif ($t !~ /^\s*#/)
+ {
+ $t = 'cd $(TEST_D) && ' . $t;
+ }
+ }
+ $str .= "\t$t\n";
+ $prev = $t =~/\\$/;
+ }
+ return $str;
+}
+
+sub copy_scripts
+ {
+ my ($sed, $src, @targets) = @_;
+
+ my $s = '';
+ foreach my $t (@targets)
+ {
+ # Copy first so we get file modes...
+ $s .= "\$(TEST_D)/$t: \$(SRC_D)/$src/$t\n\tcp \$(SRC_D)/$src/$t \$(TEST_D)/$t\n";
+ $s .= "\tsed -e 's/\\.\\.\\/apps/..\\/\$(OUT_D)/' -e 's/\\.\\.\\/util/..\\/\$(TEST_D)/' < \$(SRC_D)/$src/$t > \$(TEST_D)/$t\n" if $sed;
+ $s .= "\n";
+ }
+ return $s;
+ }
+
+sub get_tests
+ {
+ my ($makefile) = @_;
+
+ open(M, $makefile) || die "Can't open $makefile: $!";
+ my %targets;
+ my %deps;
+ my %tests;
+ my %alltests;
+ my %fakes;
+ while (my $line = <M>)
+ {
+ chomp $line;
+ while ($line =~ /^(.*)\\$/)
+ {
+ $line = $1 . <M>;
+ }
+
+ if ($line =~ /^alltests:(.*)$/)
+ {
+ my @t = split(/\s+/, $1);
+ foreach my $t (@t)
+ {
+ $targets{$t} = '';
+ $alltests{$t} = undef;
+ }
+ }
+
+ if (($line =~ /^(?<t>\S+):(?<d>.*)$/ && exists $targets{$1})
+ || $line =~ /^(?<t>test_(ss|gen) .*):(?<d>.*)/)
+ {
+ my $t = $+{t};
+ my $d = $+{d};
+ # If there are multiple targets stupid FreeBSD make runs the
+ # rules once for each dependency that matches one of the
+ # targets. Running the same rule twice concurrently causes
+ # breakage, so replace with a fake target.
+ if ($t =~ /\s/)
+ {
+ ++$fake;
+ my @targets = split /\s+/, $t;
+ $t = "_fake$fake";
+ foreach my $f (@targets)
+ {
+ $fakes{$f} = $t;
+ }
+ }
+ $deps{$t} = $d;
+ $deps{$t} =~ s/#.*$//;
+ for (;;)
+ {
+ $line = <M>;
+ chomp $line;
+ last if $line eq '';
+ $targets{$t} .= "$line\n";
+ }
+ next;
+ }
+
+ if ($line =~ /^(\S+TEST)=\s*(\S+)$/)
+ {
+ $tests{$1} = $2;
+ next;
+ }
+ }
+
+ delete $alltests{test_jpake} if $no_jpake;
+ delete $targets{test_ige} if $no_ige;
+ delete $alltests{test_md2} if $no_md2;
+ delete $alltests{test_rc5} if $no_rc5;
+
+ my $tests;
+ foreach my $t (keys %tests)
+ {
+ $tests .= "$t = $tests{$t}\n";
+ }
+
+ my $each;
+ foreach my $t (keys %targets)
+ {
+ next if $t eq '';
+
+ my $d = $deps{$t};
+ $d =~ s/\.\.\/apps/\$(BIN_D)/g;
+ $d =~ s/\.\.\/util/\$(TEST_D)/g;
+ $d = fixtests($d, \%tests);
+ $d = fixdeps($d, \%fakes);
+
+ my $r = $targets{$t};
+ $r =~ s/\.\.\/apps/..\/\$(BIN_D)/g;
+ $r =~ s/\.\.\/util/..\/\$(TEST_D)/g;
+ $r =~ s/\.\.\/(\S+)/\$(SRC_D)\/$1/g;
+ $r = fixrules($r);
+
+ next if $r eq '';
+
+ $t =~ s/\s+/ \$(TEST_D)\//g;
+
+ $each .= "$t: test_scripts $d\n\t\@echo '$t test started'\n$r\t\@echo '$t test done'\n\n";
+ }
+
+ # FIXME: Might be a clever way to figure out what needs copying
+ my @copies = ( 'bctest',
+ 'testgen',
+ 'cms-test.pl',
+ 'tx509',
+ 'test.cnf',
+ 'testenc',
+ 'tocsp',
+ 'testca',
+ 'CAss.cnf',
+ 'testtsa',
+ 'CAtsa.cnf',
+ 'Uss.cnf',
+ 'P1ss.cnf',
+ 'P2ss.cnf',
+ 'tcrl',
+ 'tsid',
+ 'treq',
+ 'tpkcs7',
+ 'tpkcs7d',
+ 'testcrl.pem',
+ 'testx509.pem',
+ 'v3-cert1.pem',
+ 'v3-cert2.pem',
+ 'testreq2.pem',
+ 'testp7.pem',
+ 'pkcs7-1.pem',
+ 'trsa',
+ 'testrsa.pem',
+ 'testsid.pem',
+ 'testss',
+ 'testssl',
+ 'testsslproxy',
+ );
+ my $copies = copy_scripts(1, 'test', @copies);
+ $copies .= copy_scripts(0, 'test', ('smcont.txt'));
+
+ my @utils = ( 'shlib_wrap.sh',
+ 'opensslwrap.sh',
+ );
+ $copies .= copy_scripts(1, 'util', @utils);
+
+ my @apps = ( 'CA.sh',
+ 'openssl.cnf',
+ 'server2.pem',
+ );
+ $copies .= copy_scripts(1, 'apps', @apps);
+
+ $copies .= copy_scripts(1, 'crypto/evp', ('evptests.txt'));
+
+ $scripts = "test_scripts: \$(TEST_D)/CA.sh \$(TEST_D)/opensslwrap.sh \$(TEST_D)/openssl.cnf \$(TEST_D)/shlib_wrap.sh ocsp smime\n";
+ $scripts .= "\nocsp:\n\tcp -R test/ocsp-tests \$(TEST_D)\n";
+ $scripts .= "\smime:\n\tcp -R test/smime-certs \$(TEST_D)\n";
+
+ my $all = 'test:';
+ foreach my $t (keys %alltests)
+ {
+ if (exists($fakes{$t}))
+ {
+ $all .= " $fakes{$t}";
+ }
+ else
+ {
+ $all .= " $t";
+ }
+ }
+
+ return "$scripts\n$copies\n$tests\n$all\n\n$each";
+ }
+
1;