diff --git a/0001-Add-OpenSSL-support-for-digest-and-signatures.patch b/0001-Add-OpenSSL-support-for-digest-and-signatures.patch index 070e555..9026897 100644 --- a/0001-Add-OpenSSL-support-for-digest-and-signatures.patch +++ b/0001-Add-OpenSSL-support-for-digest-and-signatures.patch @@ -1,4 +1,4 @@ -From 64028f9a1c25ada8ffc7a48775f526600edcbf85 Mon Sep 17 00:00:00 2001 +From 64c75ba68118e47f65eedf15855d8a50deeebcd1 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Mon, 16 Jan 2017 09:19:43 -0500 Subject: [PATCH] Add OpenSSL support for digest and signatures @@ -14,13 +14,15 @@ indicating that the user should instead use --with-crypto= See also: https://github.com/rpm-software-management/rpm/issues/119 + +(cherry picked from commit 64028f9a1c25ada8ffc7a48775f526600edcbf85) --- INSTALL | 27 +- Makefile.am | 17 +- - configure.ac | 108 ++++++- + configure.ac | 115 ++++++- rpmio/Makefile.am | 6 + rpmio/digest_openssl.c | 838 +++++++++++++++++++++++++++++++++++++++++++++++++ - 5 files changed, 975 insertions(+), 21 deletions(-) + 5 files changed, 982 insertions(+), 21 deletions(-) create mode 100644 rpmio/digest_openssl.c diff --git a/INSTALL b/INSTALL @@ -68,76 +70,76 @@ index 60536e316..8eefef799 100644 default database backend. BDB can be downloaded from http://www.oracle.com/technology/software/products/berkeley-db/index.html diff --git a/Makefile.am b/Makefile.am -index b99da12ec..56aa485f7 100644 +index 6b37b5898..42a77c0d4 100644 --- a/Makefile.am +++ b/Makefile.am -@@ -43,6 +43,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/lib +@@ -41,6 +41,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/build + AM_CPPFLAGS += -I$(top_srcdir)/lib AM_CPPFLAGS += -I$(top_srcdir)/rpmio - AM_CPPFLAGS += @WITH_BEECRYPT_INCLUDE@ AM_CPPFLAGS += @WITH_NSS_INCLUDE@ +AM_CPPFLAGS += @WITH_OPENSSL_INCLUDE@ AM_CPPFLAGS += @WITH_POPT_INCLUDE@ AM_CPPFLAGS += -I$(top_srcdir)/misc AM_CPPFLAGS += -DLOCALEDIR="\"$(localedir)\"" -@@ -111,45 +112,45 @@ rpm_SOURCES = rpmqv.c debug.h system.h +@@ -113,45 +114,45 @@ rpm_SOURCES = rpmqv.c debug.h system.h rpm_CPPFLAGS = $(AM_CPPFLAGS) -DIAM_RPMEIU -DIAM_RPMQ -DIAM_RPMV rpm_LDADD = libcliutils.la rpm_LDADD += lib/librpm.la rpmio/librpmio.la --rpm_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ -+rpm_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ +-rpm_LDADD += @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ ++rpm_LDADD += @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ rpmdb_SOURCES = rpmdb.c debug.h system.h rpmdb_CPPFLAGS = $(AM_CPPFLAGS) rpmdb_LDADD = libcliutils.la rpmdb_LDADD += lib/librpm.la rpmio/librpmio.la --rpmdb_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ -+rpmdb_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ +-rpmdb_LDADD += @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ ++rpmdb_LDADD += @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ rpmkeys_SOURCES = rpmkeys.c debug.h system.h rpmkeys_CPPFLAGS = $(AM_CPPFLAGS) rpmkeys_LDADD = libcliutils.la rpmkeys_LDADD += lib/librpm.la rpmio/librpmio.la --rpmkeys_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ -+rpmkeys_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ +-rpmkeys_LDADD += @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ ++rpmkeys_LDADD += @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ rpmsign_SOURCES = rpmsign.c debug.h system.h rpmsign_CPPFLAGS = $(AM_CPPFLAGS) rpmsign_LDADD = libcliutils.la rpmsign_LDADD += sign/librpmsign.la lib/librpm.la rpmio/librpmio.la --rpmsign_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ -+rpmsign_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ +-rpmsign_LDADD += @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ ++rpmsign_LDADD += @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ rpmbuild_SOURCES = rpmbuild.c debug.h system.h rpmbuild_CPPFLAGS = $(AM_CPPFLAGS) rpmbuild_LDADD = libcliutils.la rpmbuild_LDADD += build/librpmbuild.la lib/librpm.la rpmio/librpmio.la --rpmbuild_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ -+rpmbuild_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ +-rpmbuild_LDADD += @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ ++rpmbuild_LDADD += @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ rpmspec_SOURCES = rpmspec.c debug.h system.h rpmspec_CPPFLAGS = $(AM_CPPFLAGS) rpmspec_LDADD = libcliutils.la rpmspec_LDADD += build/librpmbuild.la lib/librpm.la rpmio/librpmio.la --rpmspec_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ -+rpmspec_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ +-rpmspec_LDADD += @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ ++rpmspec_LDADD += @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ rpm2cpio_SOURCES = rpm2cpio.c debug.h system.h rpm2cpio_LDADD = lib/librpm.la rpmio/librpmio.la --rpm2cpio_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ -+rpm2cpio_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ +-rpm2cpio_LDADD += @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ ++rpm2cpio_LDADD += @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ rpm2archive_SOURCES = rpm2archive.c debug.h system.h rpm2archive_LDADD = lib/librpm.la rpmio/librpmio.la --rpm2archive_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ @WITH_ARCHIVE_LIB@ -+rpm2archive_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ @WITH_ARCHIVE_LIB@ +-rpm2archive_LDADD += @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ @WITH_ARCHIVE_LIB@ ++rpm2archive_LDADD += @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@ @WITH_ARCHIVE_LIB@ if LIBELF diff --git a/configure.ac b/configure.ac -index 4f3be8770..9ecef95d1 100644 +index 91fadbade..d21b67220 100644 --- a/configure.ac +++ b/configure.ac -@@ -245,18 +245,30 @@ AC_CHECK_HEADERS([dwarf.h], [ +@@ -243,18 +243,30 @@ AC_CHECK_HEADERS([dwarf.h], [ AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes]) #================= @@ -172,7 +174,7 @@ index 4f3be8770..9ecef95d1 100644 AC_DEFINE(WITH_BEECRYPT, 1, [Build with beecrypt instead of nss3 support?]) if test "$with_internal_beecrypt" = yes ; then WITH_BEECRYPT_INCLUDE="-I\$(top_srcdir)/beecrypt" -@@ -265,7 +277,7 @@ if test "$with_beecrypt" = yes ; then +@@ -263,7 +275,7 @@ if test "$with_beecrypt" = yes ; then AC_CHECK_LIB(beecrypt, mpfprintln, [ WITH_BEECRYPT_LIB="-lbeecrypt" ],[ @@ -181,7 +183,7 @@ index 4f3be8770..9ecef95d1 100644 ]) AC_CHECK_HEADER([beecrypt/api.h], [AC_DEFINE(HAVE_BEECRYPT_API_H, 1, [Define to 1 if you have the header file.]) ]) -@@ -275,13 +287,93 @@ AC_SUBST(WITH_BEECRYPT_LIB) +@@ -273,13 +285,100 @@ AC_SUBST(WITH_BEECRYPT_LIB) AC_SUBST(WITH_BEECRYPT_INCLUDE) #================= @@ -275,14 +277,21 @@ index 4f3be8770..9ecef95d1 100644 WITH_NSS_LIB= -if test "$with_beecrypt" != yes ; then +if test "$with_crypto" = nss; then - # If we have pkgconfig make sure CPPFLAGS are setup correctly for the nss - # -I include path. Otherwise the below checks will fail because nspr.h - # cannot be found. ++# If we have pkgconfig make sure CPPFLAGS are setup correctly for the nss ++# -I include path. Otherwise the below checks will fail because nspr.h ++# cannot be found. ++AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no], [$PATH:/usr/bin:/usr/local/bin]) ++if test "x$PKGCONFIG" != "xno"; then ++ CPPFLAGS="$CPPFLAGS $($PKGCONFIG --cflags nss)" ++fi + AC_CHECK_HEADERS([nspr.h nss.h sechash.h], [], [ + AC_MSG_ERROR([missing required NSPR / NSS header]) + ]) diff --git a/rpmio/Makefile.am b/rpmio/Makefile.am -index 5ad4d6818..3ac1c715d 100644 +index 68a821934..9062f58a5 100644 --- a/rpmio/Makefile.am +++ b/rpmio/Makefile.am -@@ -6,6 +6,7 @@ AM_CFLAGS = @RPMCFLAGS@ +@@ -5,6 +5,7 @@ include $(top_srcdir)/rpm.am AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_builddir)/include/ AM_CPPFLAGS += @WITH_NSS_INCLUDE@ AM_CPPFLAGS += @WITH_BEECRYPT_INCLUDE@ @@ -290,7 +299,7 @@ index 5ad4d6818..3ac1c715d 100644 AM_CPPFLAGS += @WITH_POPT_INCLUDE@ AM_CPPFLAGS += -I$(top_srcdir)/misc AM_CPPFLAGS += -DRPMCONFIGDIR="\"@RPMCONFIGDIR@\"" -@@ -24,8 +25,12 @@ librpmio_la_SOURCES = \ +@@ -23,8 +24,12 @@ librpmio_la_SOURCES = \ if WITH_BEECRYPT librpmio_la_SOURCES += digest_beecrypt.c else @@ -303,7 +312,7 @@ index 5ad4d6818..3ac1c715d 100644 librpmio_la_LDFLAGS = -version-info $(rpm_version_info) -@@ -33,6 +38,7 @@ librpmio_la_LIBADD = \ +@@ -32,6 +37,7 @@ librpmio_la_LIBADD = \ ../misc/libmisc.la \ @WITH_NSS_LIB@ \ @WITH_BEECRYPT_LIB@ \