diff mbox series

[1/4] ima-evm-utils: link to libcrypto instead of OpenSSL

Message ID 20190523122623.25684-1-dbaryshkov@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/4] ima-evm-utils: link to libcrypto instead of OpenSSL | expand

Commit Message

Dmitry Baryshkov May 23, 2019, 12:26 p.m. UTC
There is no need to link to full libssl. evmctl uses functions from
libcrypto, so let's link only against that library.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 configure.ac    | 4 +---
 src/Makefile.am | 9 ++++-----
 2 files changed, 5 insertions(+), 8 deletions(-)

Comments

Mimi Zohar May 23, 2019, 3:12 p.m. UTC | #1
On Thu, 2019-05-23 at 15:26 +0300, Dmitry Eremin-Solenikov wrote:
> There is no need to link to full libssl. evmctl uses functions from
> libcrypto, so let's link only against that library.
> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

Thank you for this patch and the other three.  They're all now in the
next branch.

Mimi
Dmitry Baryshkov May 23, 2019, 3:17 p.m. UTC | #2
чт, 23 мая 2019 г. в 18:13, Mimi Zohar <zohar@linux.ibm.com>:
>
> On Thu, 2019-05-23 at 15:26 +0300, Dmitry Eremin-Solenikov wrote:
> > There is no need to link to full libssl. evmctl uses functions from
> > libcrypto, so let's link only against that library.
> >
> > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>
> Thank you for this patch and the other three.  They're all now in the
> next branch.

Thank you!
Vitaly Chikunov July 11, 2019, 3:07 p.m. UTC | #3
Dmitry,

On Thu, May 23, 2019 at 03:26:20PM +0300, Dmitry Eremin-Solenikov wrote:
> There is no need to link to full libssl. evmctl uses functions from
> libcrypto, so let's link only against that library.

Btw, this breaks my tests in my set up with gost-engine, making evmctl
crash on OPENSSL_init_crypto (in bind_gost). Did not investigate real
cause yet. I test with latest version of gost-engine (e372739) and
openssl 0fc4d00a00.


> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
>  configure.ac    | 4 +---
>  src/Makefile.am | 9 ++++-----
>  2 files changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 10d1d88ccdc7..9beb4b6c2377 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -24,9 +24,7 @@ LT_INIT
>  # Checks for header files.
>  AC_HEADER_STDC
>  
> -PKG_CHECK_MODULES(OPENSSL, [ openssl >= 0.9.8 ])
> -AC_SUBST(OPENSSL_CFLAGS)
> -AC_SUBST(OPENSSL_LIBS)
> +PKG_CHECK_MODULES(LIBCRYPTO, [libcrypto >= 0.9.8 ])
>  AC_SUBST(KERNEL_HEADERS)
>  AC_CHECK_HEADER(unistd.h)
>  AC_CHECK_HEADERS(openssl/conf.h)
> diff --git a/src/Makefile.am b/src/Makefile.am
> index d74fc6f6e190..b81281a31d9b 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -1,11 +1,11 @@
>  lib_LTLIBRARIES = libimaevm.la
>  
>  libimaevm_la_SOURCES = libimaevm.c
> -libimaevm_la_CPPFLAGS = $(OPENSSL_CFLAGS)
> +libimaevm_la_CPPFLAGS = $(LIBCRYPTO_CFLAGS)
>  # current[:revision[:age]]
>  # result: [current-age].age.revision
>  libimaevm_la_LDFLAGS = -version-info 0:0:0
> -libimaevm_la_LIBADD =  $(OPENSSL_LIBS)
> +libimaevm_la_LIBADD =  $(LIBCRYPTO_LIBS)
>  
>  include_HEADERS = imaevm.h
>  
> @@ -17,12 +17,11 @@ hash_info.h: Makefile
>  bin_PROGRAMS = evmctl
>  
>  evmctl_SOURCES = evmctl.c
> -evmctl_CPPFLAGS = $(OPENSSL_CFLAGS)
> +evmctl_CPPFLAGS = $(LIBCRYPTO_CFLAGS)
>  evmctl_LDFLAGS = $(LDFLAGS_READLINE)
> -evmctl_LDADD =  $(OPENSSL_LIBS) -lkeyutils libimaevm.la
> +evmctl_LDADD =  $(LIBCRYPTO_LIBS) -lkeyutils libimaevm.la
>  
>  INCLUDES = -I$(top_srcdir) -include config.h
>  
>  CLEANFILES = hash_info.h
>  DISTCLEANFILES = @DISTCLEANFILES@
> -
> -- 
> 2.20.1
Vitaly Chikunov July 12, 2019, 2:05 a.m. UTC | #4
Dmitry,

On Thu, Jul 11, 2019 at 06:07:32PM +0300, Vitaly Chikunov wrote:
> On Thu, May 23, 2019 at 03:26:20PM +0300, Dmitry Eremin-Solenikov wrote:
> > There is no need to link to full libssl. evmctl uses functions from
> > libcrypto, so let's link only against that library.
> 
> Btw, this breaks my tests in my set up with gost-engine, making evmctl
> crash on OPENSSL_init_crypto (in bind_gost). Did not investigate real
> cause yet. I test with latest version of gost-engine (e372739) and
> openssl 0fc4d00a00.

Sorry, this was my set up failure. Previously I was defining
`OPENSSL_LIBS="-L$HOME/src/openssl -lssl -lcrypto"` to link with custom
OpenSSL build. Now I should just define
`LIBCRYPTO_LIBS="-L$HOME/src/openssl -lcrypto"` instead.

So there is no error in these commits.

Thanks,
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index 10d1d88ccdc7..9beb4b6c2377 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,9 +24,7 @@  LT_INIT
 # Checks for header files.
 AC_HEADER_STDC
 
-PKG_CHECK_MODULES(OPENSSL, [ openssl >= 0.9.8 ])
-AC_SUBST(OPENSSL_CFLAGS)
-AC_SUBST(OPENSSL_LIBS)
+PKG_CHECK_MODULES(LIBCRYPTO, [libcrypto >= 0.9.8 ])
 AC_SUBST(KERNEL_HEADERS)
 AC_CHECK_HEADER(unistd.h)
 AC_CHECK_HEADERS(openssl/conf.h)
diff --git a/src/Makefile.am b/src/Makefile.am
index d74fc6f6e190..b81281a31d9b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,11 +1,11 @@ 
 lib_LTLIBRARIES = libimaevm.la
 
 libimaevm_la_SOURCES = libimaevm.c
-libimaevm_la_CPPFLAGS = $(OPENSSL_CFLAGS)
+libimaevm_la_CPPFLAGS = $(LIBCRYPTO_CFLAGS)
 # current[:revision[:age]]
 # result: [current-age].age.revision
 libimaevm_la_LDFLAGS = -version-info 0:0:0
-libimaevm_la_LIBADD =  $(OPENSSL_LIBS)
+libimaevm_la_LIBADD =  $(LIBCRYPTO_LIBS)
 
 include_HEADERS = imaevm.h
 
@@ -17,12 +17,11 @@  hash_info.h: Makefile
 bin_PROGRAMS = evmctl
 
 evmctl_SOURCES = evmctl.c
-evmctl_CPPFLAGS = $(OPENSSL_CFLAGS)
+evmctl_CPPFLAGS = $(LIBCRYPTO_CFLAGS)
 evmctl_LDFLAGS = $(LDFLAGS_READLINE)
-evmctl_LDADD =  $(OPENSSL_LIBS) -lkeyutils libimaevm.la
+evmctl_LDADD =  $(LIBCRYPTO_LIBS) -lkeyutils libimaevm.la
 
 INCLUDES = -I$(top_srcdir) -include config.h
 
 CLEANFILES = hash_info.h
 DISTCLEANFILES = @DISTCLEANFILES@
-