Linux-Modules Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Link against libcrypto, not all of openssl
@ 2019-02-13 15:27 Dave Reisner
  2019-02-13 17:53 ` Lucas De Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Reisner @ 2019-02-13 15:27 UTC (permalink / raw)
  To: linux-modules; +Cc: Dave Reisner

In the previous build setup, libkmod.so would link to not just
libcrypto.so, but also libssl.so:

$ readelf -d /lib/libkmod.so | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [liblzma.so.5]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libssl.so.1.1]
 0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.1.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

We don't need any symbols from libssl, though. This patch ensures that
we pass 'libcrypto' to pkgconfig rather than 'openssl', getting only the
library that we need:

$ readelf -d tools/kmod | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [liblzma.so.5]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.1.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
---
 Makefile.am  | 6 +++---
 configure.ac | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index ddb25f0..758f4f0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,8 +35,8 @@ SED_PROCESS = \
 	-e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
 	-e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
 	-e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
-	-e 's,@openssl_CFLAGS\@,${openssl_CFLAGS},g' \
-	-e 's,@openssl_LIBS\@,${openssl_LIBS},g' \
+	-e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \
+	-e 's,@libcrypto_LIBS\@,${libcrypto_LIBS},g' \
 	< $< > $@ || rm $@
 
 %.pc: %.pc.in Makefile
@@ -89,7 +89,7 @@ libkmod_libkmod_la_DEPENDENCIES = \
 	${top_srcdir}/libkmod/libkmod.sym
 libkmod_libkmod_la_LIBADD = \
 	shared/libshared.la \
-	${liblzma_LIBS} ${zlib_LIBS} ${openssl_LIBS}
+	${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
 
 noinst_LTLIBRARIES += libkmod/libkmod-internal.la
 libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
diff --git a/configure.ac b/configure.ac
index ee72283..dffe278 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,12 +110,12 @@ AC_ARG_WITH([openssl],
 	AS_HELP_STRING([--with-openssl], [handle PKCS7 signatures @<:@default=disabled@:>@]),
 	[], [with_openssl=no])
 AS_IF([test "x$with_openssl" != "xno"], [
-	PKG_CHECK_MODULES([openssl], [openssl >= 1.1.0])
+	PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0])
 	AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.])
 ], [
 	AC_MSG_NOTICE([openssl support not requested])
 ])
-CC_FEATURE_APPEND([with_features], [with_openssl], [OPENSSL])
+CC_FEATURE_APPEND([with_features], [with_openssl], [LIBCRYPTO])
 
 AC_ARG_WITH([bashcompletiondir],
 	AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
-- 
2.20.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Link against libcrypto, not all of openssl
  2019-02-13 15:27 [PATCH] Link against libcrypto, not all of openssl Dave Reisner
@ 2019-02-13 17:53 ` Lucas De Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas De Marchi @ 2019-02-13 17:53 UTC (permalink / raw)
  To: Dave Reisner; +Cc: linux-modules

On Wed, Feb 13, 2019 at 8:02 AM Dave Reisner <dreisner@archlinux.org> wrote:
>
> In the previous build setup, libkmod.so would link to not just
> libcrypto.so, but also libssl.so:
>
> $ readelf -d /lib/libkmod.so | grep NEEDED
>  0x0000000000000001 (NEEDED)             Shared library: [liblzma.so.5]
>  0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
>  0x0000000000000001 (NEEDED)             Shared library: [libssl.so.1.1]
>  0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.1.1]
>  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
>
> We don't need any symbols from libssl, though. This patch ensures that
> we pass 'libcrypto' to pkgconfig rather than 'openssl', getting only the
> library that we need:
>
> $ readelf -d tools/kmod | grep NEEDED

as per chat on irc, I updated the commit message to point to libkmod
rather than kmod.

Patch applied, thanks.

Lucas De Marchi

>  0x0000000000000001 (NEEDED)             Shared library: [liblzma.so.5]
>  0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
>  0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.1.1]
>  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
> ---
>  Makefile.am  | 6 +++---
>  configure.ac | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index ddb25f0..758f4f0 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -35,8 +35,8 @@ SED_PROCESS = \
>         -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
>         -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
>         -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
> -       -e 's,@openssl_CFLAGS\@,${openssl_CFLAGS},g' \
> -       -e 's,@openssl_LIBS\@,${openssl_LIBS},g' \
> +       -e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \
> +       -e 's,@libcrypto_LIBS\@,${libcrypto_LIBS},g' \
>         < $< > $@ || rm $@
>
>  %.pc: %.pc.in Makefile
> @@ -89,7 +89,7 @@ libkmod_libkmod_la_DEPENDENCIES = \
>         ${top_srcdir}/libkmod/libkmod.sym
>  libkmod_libkmod_la_LIBADD = \
>         shared/libshared.la \
> -       ${liblzma_LIBS} ${zlib_LIBS} ${openssl_LIBS}
> +       ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
>
>  noinst_LTLIBRARIES += libkmod/libkmod-internal.la
>  libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
> diff --git a/configure.ac b/configure.ac
> index ee72283..dffe278 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -110,12 +110,12 @@ AC_ARG_WITH([openssl],
>         AS_HELP_STRING([--with-openssl], [handle PKCS7 signatures @<:@default=disabled@:>@]),
>         [], [with_openssl=no])
>  AS_IF([test "x$with_openssl" != "xno"], [
> -       PKG_CHECK_MODULES([openssl], [openssl >= 1.1.0])
> +       PKG_CHECK_MODULES([libcrypto], [libcrypto >= 1.1.0])
>         AC_DEFINE([ENABLE_OPENSSL], [1], [Enable openssl for modinfo.])
>  ], [
>         AC_MSG_NOTICE([openssl support not requested])
>  ])
> -CC_FEATURE_APPEND([with_features], [with_openssl], [OPENSSL])
> +CC_FEATURE_APPEND([with_features], [with_openssl], [LIBCRYPTO])
>
>  AC_ARG_WITH([bashcompletiondir],
>         AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
> --
> 2.20.1



-- 
Lucas De Marchi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13 15:27 [PATCH] Link against libcrypto, not all of openssl Dave Reisner
2019-02-13 17:53 ` Lucas De Marchi

Linux-Modules Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-modules/0 linux-modules/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-modules linux-modules/ https://lore.kernel.org/linux-modules \
		linux-modules@vger.kernel.org linux-modules@archiver.kernel.org
	public-inbox-index linux-modules


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-modules


AGPL code for this site: git clone https://public-inbox.org/ public-inbox