Openssl w/ gost-engine

Requests go here. If you fill a request, give it a new thread in the appropriate category and then link to it in the request thread.
Post Reply
Message
Author
s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

Openssl w/ gost-engine

#1 Post by s243a »

Related to my thread about DNSCrypt, I need onessl compiled with gost-engine for it to work. I'm trying this on my own on the version of puppylinux called "precise" and if successful I will try it on other pups.

So far the issues that I've had are:
- I've tried the classic "configure" then make install

Code: Select all

make install DESTDIR=/tmp/xxx
but this didn't build to the target director. It looks from the primary make file that instead there are two macros you are supposed to set depending on weather you you want want the target to apply recursively or not:

Code: Select all

# BUILD_ONE_CMD is a macro to build a given target in a given
# subdirectory if that subdirectory is part of $(DIRS).  It requires
# exactly the same shell variables as BUILD_CMD.
#
# RECURSIVE_BUILD_CMD is a macro to build a given target in all
# subdirectories defined in $(DIRS).  It requires that the target
# is given through the shell variable `target'.
https://github.com/luvit/openssl/blob/m ... l/Makefile

Needless to say I decide to try new2dir instead since this takes care of this stuff automatically. I'm not sure which version of new2dir I have.

new2dir worked as far as the compiling and creating a pet package went but looking inside the pet pacakage i found no "gost" shared libraries. I need to figure how to specify which ssl engines to include.

Some relevant parts of the primary make file:

Code: Select all

line#106  ENGINES_ASM_OBJ= 
...
line#141  DIRS=   crypto ssl engines apps test tools
line#142  ENGDIRS= ccgost
...
line#208  BUILDENV=...
line#237  		ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)'		\
line#276  build_libs: build_crypto build_ssl build_engines
....
line#282  build_engines:
line#283	@dir=engines; target=all; $(BUILD_ONE_CMD)
https://github.com/luvit/openssl/blob/m ... l/Makefile

Lines#541-614

Code: Select all

install: all install_docs install_sw

install_sw:
	@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
		$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
		$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
		$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
		$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
		$(INSTALL_PREFIX)$(OPENSSLDIR)/private
	@set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
	do \
	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
	done;
	@set -e; target=install; $(RECURSIVE_BUILD_CMD)
	@set -e; liblist="$(LIBS)"; for i in $$liblist ;\
	do \
		if [ -f "$$i" ]; then \
		(       echo installing $$i; \
			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
			$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
			mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
		fi; \
	done;
	@set -e; if [ -n "$(SHARED_LIBS)" ]; then \
		tmp="$(SHARED_LIBS)"; \
		for i in $${tmp:-x}; \
		do \
			if [ -f "$$i" -o -f "$$i.a" ]; then \
			(       echo installing $$i; \
				if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
					cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
				else \
					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
				fi ); \
				if expr $(PLATFORM) : 'mingw' > /dev/null; then \
				(	case $$i in \
						*crypto*) i=libeay32.dll;; \
						*ssl*)    i=ssleay32.dll;; \
					esac; \
					echo installing $$i; \
	 				cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
	 				chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
	 				mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
				fi; \
			fi; \
		done; \
		(	here="`pwd`"; \
			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:'; \
			echo '  $(INSTALLTOP)'; \
			echo ''; \
			sed -e '1,/^$$/d' doc/openssl-shared.txt; \
		fi; \
	fi
	cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
	cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
	cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
https://github.com/luvit/openssl/blob/m ... l/Makefile

In the next level down openss/engines we have:

Code: Select all

line#12  ENGDIRS= ccgost
line#13  
line#14  RECURSIVE_MAKE=	[ -z "$(ENGDIRS)" ] || for i in $(ENGDIRS) ; do \
line#15  		    (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
line#16  		    $(MAKE) -e TOP=../.. DIR=$$i $$target ) || exit 1; \
line#17  		done;
..
line#73  all:	lib subdirs
..
line#90  subdirs:
line#91  	echo $(EDIRS)
line#92  	@target=all; $(RECURSIVE_MAKE)
https://github.com/luvit/openssl/blob/m ... s/Makefile
and the next level down (openssl/engines/ccgost) we have:
https://github.com/luvit/openssl/blob/m ... t/Makefile

which at the moment I won't highlight any of the makefile code.

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#2 Post by s243a »

I figured out how to build shared libraries. I did so by adding the "--shared" option as an input to the configure file:

Code: Select all

perl ./ConfigureEcho linux-elf --shared -fPIC -DOPENSSL_PIC -march=pentium -Wa,--noexecstack

I also edited INSTALL_PREFIX in the make file as follows

Code: Select all

Line#28  INSTALL_PREFIX=/tmp/openssl
I should though look for the option in the configure script to do this though because the configure script overwrites the makefile.

Edit: Looks like gost was built as well.

Post Reply