File openssl-1.0.0-pic-pie.patch of Package openssl-1_0_0.24561
Index: openssl-1.0.2p/apps/Makefile
===================================================================
--- openssl-1.0.2p.orig/apps/Makefile
+++ openssl-1.0.2p/apps/Makefile
@@ -6,7 +6,8 @@ DIR= apps
TOP= ..
CC= cc
INCLUDES= -I$(TOP) -I../include $(KRB5_INCLUDES)
-CFLAG= -g -static
+CFLAG= -g -static -fPIE
+LDFLAGS= -pie
MAKEFILE= Makefile
PERL= perl
RM= rm -f
@@ -162,7 +163,7 @@ $(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(
LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \
$(MAKE) -f $(TOP)/Makefile.shared -e \
APPNAME=$(EXE) OBJECTS="$(PROGRAM).o $(E_OBJ)" \
- LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+ LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS) $(LDFLAGS)" \
link_app.$${shlib_target}
@(cd ..; $(MAKE) rehash)
Index: openssl-1.0.2p/crypto/fips/Makefile
===================================================================
--- openssl-1.0.2p.orig/crypto/fips/Makefile
+++ openssl-1.0.2p/crypto/fips/Makefile
@@ -6,7 +6,8 @@ DIR= fips
TOP= ../..
CC= cc
INCLUDES=
-CFLAG=-g
+CFLAG= -g -fPIE
+LDFLAGS= -pie
MAKEFILE= Makefile
AR= ar r
@@ -108,10 +109,10 @@ clean:
$(EXE): $(PROGRAM).o
FIPS_SHA_ASM=""; for i in $(SHA1_ASM_OBJ) sha256.o; do FIPS_SHA_ASM="$$FIPS_SHA_ASM ../sha/$$i" ; done; \
for i in $(CPUID_OBJ); do FIPS_SHA_ASM="$$FIPS_SHA_ASM ../$$i" ; done; \
- $(CC) -o $@ $(CFLAGS) $(PROGRAM).o $$FIPS_SHA_ASM
+ $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $(PROGRAM).o $$FIPS_SHA_ASM
$(CAVS_PROGRAMS): $(CAVS_OBJ) fips_ecdsa_lib.o fips_rsa_lib.o fips_dsa_lib.o fips_dsa_sign.o fips_err.o $(SSLLIB) $(LIB)
- $(CC) -o $@ $(CFLAGS) $@.o fips_rsa_lib.o fips_ecdsa_lib.o fips_dsa_lib.o fips_dsa_sign.o fips_err.o $(SSLLIB) $(LIB) -ldl -lz
+ $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $@.o fips_rsa_lib.o fips_ecdsa_lib.o fips_dsa_lib.o fips_dsa_sign.o fips_err.o $(SSLLIB) $(LIB) -ldl -lz
fips.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
fips.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h