Fix for DTLS DoS issue introduced by fix for CVE-2011-4109.
[openssl.git] / Makefile.org
index 20a5c4cab59adfc72c1b03c7858b2c3d8d4fae33..30e0ed66caca9107b2a8a593fcc304f33bb4e270 100644 (file)
@@ -78,7 +78,7 @@ LIBDIR=lib
 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
 # gcc, then the driver will automatically translate it to -xarch=v8plus
 # and pass it down to assembler.
-AS=$(CC) -c
+#AS=$(CC) -c
 ASFLAG=$(CFLAG)
 
 # For x86 assembler: Set PROCESSOR to 386 if you want to support
@@ -99,6 +99,8 @@ SHA1_ASM_OBJ=
 RMD160_ASM_OBJ= 
 WP_ASM_OBJ=
 CMLL_ENC=
+MODES_ASM_OBJ=
+ENGINES_ASM_OBJ=
 PERLASM_SCHEME=
 
 # KRB5 stuff
@@ -109,7 +111,33 @@ LIBKRB5=
 ZLIB_INCLUDE=
 LIBZLIB=
 
-DIRS=   crypto ssl engines apps test tools
+# This is the location of fipscanister.o and friends.
+# The FIPS module build will place it $(INSTALLTOP)/lib
+# but since $(INSTALLTOP) can only take the default value
+# when the module is built it will be in /usr/local/ssl/lib
+# $(INSTALLTOP) for this build may be different so hard
+# code the path.
+
+FIPSLIBDIR=/usr/local/ssl/$(LIBDIR)/
+
+# This is set to "y" if fipscanister.o is compiled internally as
+# opposed to coming from an external validated location.
+
+FIPSCANISTERINTERNAL=n
+
+# The location of the library which contains fipscanister.o
+# normally it will be libcrypto unless fipsdso is set in which
+# case it will be libfips. If not compiling in FIPS mode at all
+# this is empty making it a useful test for a FIPS compile.
+
+FIPSCANLIB=
+
+# Shared library base address. Currently only used on Windows.
+#
+
+BASEADDR=
+
+DIRS=   crypto fips ssl engines apps test tools
 ENGDIRS= ccgost
 SHLIBDIRS= crypto ssl
 
@@ -121,7 +149,7 @@ SDIRS=  \
        bn ec rsa dsa ecdsa dh ecdh dso engine \
        buffer bio stack lhash rand err \
        evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
-       cms pqueue ts jpake store
+       cms pqueue ts jpake srp store cmac
 # keep in mind that the above list is adjusted by ./Configure
 # according to no-xxx arguments...
 
@@ -178,9 +206,9 @@ CLEARENV=   TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}     \
 
 BUILDENV=      PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
                CC='$(CC)' CFLAG='$(CFLAG)'                     \
-               AS='$(CC)' ASFLAG='$(CFLAG) -c'                 \
+               ASFLAG='$(CFLAG) -c'                    \
                AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'        \
-               CROSS_COMPILE_PREFIX='$(CROSS_COMPILE_PREFIX)'  \
+               CROSS_COMPILE='$(CROSS_COMPILE)'        \
                PERL='$(PERL)' ENGDIRS='$(ENGDIRS)'             \
                SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)'     \
                INSTALL_PREFIX='$(INSTALL_PREFIX)'              \
@@ -204,7 +232,13 @@ BUILDENV=  PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
                MD5_ASM_OBJ='$(MD5_ASM_OBJ)'                    \
                RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)'              \
                WP_ASM_OBJ='$(WP_ASM_OBJ)'                      \
+               MODES_ASM_OBJ='$(MODES_ASM_OBJ)'                \
+               ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)'            \
                PERLASM_SCHEME='$(PERLASM_SCHEME)'              \
+               FIPSLIBDIR='${FIPSLIBDIR}'                      \
+               FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}"      \
+               FIPSCANISTERINTERNAL='${FIPSCANISTERINTERNAL}'  \
+               FIPS_EX_OBJ='${FIPS_EX_OBJ}'    \
                THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
 # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
 # which in turn eliminates ambiguities in variable treatment with -e.
@@ -236,17 +270,114 @@ BUILD_ONE_CMD=\
 reflect:
        @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
 
+FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
+       ../crypto/aes/aes_ecb.o \
+       ../crypto/aes/aes_ofb.o \
+       ../crypto/bn/bn_add.o \
+       ../crypto/bn/bn_blind.o \
+       ../crypto/bn/bn_ctx.o \
+       ../crypto/bn/bn_div.o \
+       ../crypto/bn/bn_exp2.o \
+       ../crypto/bn/bn_exp.o \
+       ../crypto/bn/bn_gcd.o \
+       ../crypto/bn/bn_gf2m.o \
+       ../crypto/bn/bn_lib.o \
+       ../crypto/bn/bn_mod.o \
+       ../crypto/bn/bn_mont.o \
+       ../crypto/bn/bn_mul.o \
+       ../crypto/bn/bn_nist.o \
+       ../crypto/bn/bn_prime.o \
+       ../crypto/bn/bn_rand.o \
+       ../crypto/bn/bn_recp.o \
+       ../crypto/bn/bn_shift.o \
+       ../crypto/bn/bn_sqr.o \
+       ../crypto/bn/bn_word.o \
+       ../crypto/bn/bn_x931p.o \
+       ../crypto/buffer/buf_str.o \
+       ../crypto/cmac/cmac.o \
+       ../crypto/cryptlib.o \
+       ../crypto/des/cfb64ede.o \
+       ../crypto/des/cfb64enc.o \
+       ../crypto/des/cfb_enc.o \
+       ../crypto/des/ecb3_enc.o \
+       ../crypto/des/ofb64ede.o \
+       ../crypto/des/fcrypt.o \
+       ../crypto/des/set_key.o \
+       ../crypto/dh/dh_check.o \
+       ../crypto/dh/dh_gen.o \
+       ../crypto/dh/dh_key.o \
+       ../crypto/dsa/dsa_gen.o \
+       ../crypto/dsa/dsa_key.o \
+       ../crypto/dsa/dsa_ossl.o \
+       ../crypto/ec/ec_curve.o \
+       ../crypto/ec/ec_cvt.o \
+       ../crypto/ec/ec_key.o \
+       ../crypto/ec/ec_lib.o \
+       ../crypto/ec/ecp_mont.o \
+       ../crypto/ec/ec_mult.o \
+       ../crypto/ec/ecp_nist.o \
+       ../crypto/ec/ecp_smpl.o \
+       ../crypto/ec/ec2_mult.o \
+       ../crypto/ec/ec2_smpl.o \
+       ../crypto/ecdh/ech_key.o \
+       ../crypto/ecdh/ech_ossl.o \
+       ../crypto/ecdsa/ecs_ossl.o \
+       ../crypto/evp/e_aes.o \
+       ../crypto/evp/e_des3.o \
+       ../crypto/evp/e_null.o \
+       ../crypto/evp/m_sha1.o \
+       ../crypto/evp/m_dss1.o \
+       ../crypto/evp/m_dss.o \
+       ../crypto/evp/m_ecdsa.o \
+       ../crypto/hmac/hmac.o \
+       ../crypto/modes/cbc128.o \
+       ../crypto/modes/ccm128.o \
+       ../crypto/modes/cfb128.o \
+       ../crypto/modes/ctr128.o \
+       ../crypto/modes/gcm128.o \
+       ../crypto/modes/ofb128.o \
+       ../crypto/modes/xts128.o \
+       ../crypto/rsa/rsa_eay.o \
+       ../crypto/rsa/rsa_gen.o \
+       ../crypto/rsa/rsa_crpt.o \
+       ../crypto/rsa/rsa_none.o \
+       ../crypto/rsa/rsa_oaep.o \
+       ../crypto/rsa/rsa_pk1.o \
+       ../crypto/rsa/rsa_pss.o \
+       ../crypto/rsa/rsa_ssl.o \
+       ../crypto/rsa/rsa_x931.o \
+       ../crypto/rsa/rsa_x931g.o \
+       ../crypto/sha/sha1dgst.o \
+       ../crypto/sha/sha256.o \
+       ../crypto/sha/sha512.o \
+       ../crypto/thr_id.o \
+       ../crypto/uid.o
+
 sub_all: build_all
 build_all: build_libs build_apps build_tests build_tools
 
-build_libs: build_crypto build_ssl build_engines
+build_libs: build_crypto build_fips build_ssl build_engines
+
+build_fips:
+       @dir=fips; target=all; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD)
 
 build_crypto:
-       @dir=crypto; target=all; $(BUILD_ONE_CMD)
+       if [ -n "$(FIPSCANLIB)" ]; then \
+               EXCL_OBJ='$(AES_ENC) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_OBJ) $(MODES_ASM_OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
+               ARX='$(PERL) $${TOP}/util/arx.pl $(AR)' ; \
+       else \
+               ARX='${AR}' ; \
+       fi ; export ARX ; \
+       if [ $(FIPSCANISTERINTERNAL) = "y" ]; then \
+               AS='$(PERL) $${TOP}/util/fipsas.pl $${TOP} $${<} $(CC) -c' ; \
+       else \
+               AS='$(CC) -c' ; \
+       fi ; export AS ; \
+               dir=crypto; target=all; $(BUILD_ONE_CMD)
 build_ssl:
        @dir=ssl; target=all; $(BUILD_ONE_CMD)
 build_engines:
-       @dir=engines; target=all; $(BUILD_ONE_CMD)
+       @dir=engines; target=all; AS='$(CC) -c'; export AS; $(BUILD_ONE_CMD)
 build_apps:
        @dir=apps; target=all; $(BUILD_ONE_CMD)
 build_tests:
@@ -258,9 +389,13 @@ all_testapps: build_libs build_testapps
 build_testapps:
        @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
 
-libcrypto$(SHLIB_EXT): libcrypto.a
+libcrypto$(SHLIB_EXT): libcrypto.a build_fips
        @if [ "$(SHLIB_TARGET)" != "" ]; then \
-               $(MAKE) SHLIBDIRS=crypto build-shared; \
+               if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
+                       FIPSLD_CC="$(CC)"; CC=fips/fipsld; \
+                       export CC FIPSLD_CC; \
+               fi; \
+               $(MAKE) -e SHLIBDIRS=crypto build-shared; \
        else \
                echo "There's no support for shared libraries on this platform" >&2; \
                exit 1; \
@@ -357,7 +492,7 @@ Makefile: Makefile.org Configure config
        @false
 
 libclean:
-       rm -f *.map *.so *.so.* *.dll engines/*.so engines/*.dll *.a engines/*.a */lib */*/lib
+       rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
 
 clean: libclean
        rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
@@ -383,6 +518,9 @@ links:
        @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
        @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
        @set -e; target=links; $(RECURSIVE_BUILD_CMD)
+       @if [ -z "$(FIPSCANLIB)" ]; then \
+               set -e; target=links; dir=fips ; $(BUILD_CMD) ; \
+       fi
 
 gentests:
        @(cd test && echo "generating dummy tests (if needed)..." && \
@@ -394,7 +532,7 @@ dclean:
 
 rehash: rehash.time
 rehash.time: certs apps
-       @if [ -z "$(CROSS_COMPILE_PREFIX)" ]; then \
+       @if [ -z "$(CROSS_COMPILE)" ]; then \
                (OPENSSL="`pwd`/util/opensslwrap.sh"; \
                [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
                OPENSSL_DEBUG_MEMORY=on; \
@@ -509,7 +647,7 @@ install_sw:
        chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
        done;
        @set -e; target=install; $(RECURSIVE_BUILD_CMD)
-       @set -e; for i in $(LIBS) ;\
+       @set -e; liblist="$(LIBS)"; for i in $$liblist ;\
        do \
                if [ -f "$$i" ]; then \
                (       echo installing $$i; \
@@ -551,7 +689,7 @@ install_sw:
                        fi; \
                done; \
                (       here="`pwd`"; \
-                       cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
+                       cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \
                        $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
                if [ "$(INSTALLTOP)" != "/usr" ]; then \
                        echo 'OpenSSL shared libraries have been installed in:'; \
@@ -594,7 +732,7 @@ install_docs:
                $(INSTALL_PREFIX)$(MANDIR)/man3 \
                $(INSTALL_PREFIX)$(MANDIR)/man5 \
                $(INSTALL_PREFIX)$(MANDIR)/man7
-       @pod2man="`cd util; ./pod2mantest $(PERL)`"; \
+       @pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
        here="`pwd`"; \
        filecase=; \
        if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \