Skip to content

Commit

Permalink
Add a Sequoia-based OpenPGP backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
nwalfield committed Apr 13, 2022
1 parent c3e9882 commit 097b033
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
22 changes: 20 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
# Select crypto library
AC_ARG_WITH(crypto,
[AC_HELP_STRING([--with-crypto=CRYPTO_LIB],
[The cryptographic library to use (openssl|libgcrypt). The default is libgcrypt.])
[The cryptographic library to use (sequoia|openssl|libgcrypt). The default is sequoia.])
],[],
[with_crypto=libgcrypt])
[with_crypto=sequoia])

#=================
# Check for OpenSSL library.
Expand Down Expand Up @@ -382,6 +382,24 @@ AM_CONDITIONAL([WITH_LIBGCRYPT],[test "$with_crypto" = libgcrypt])
AC_SUBST(WITH_LIBGCRYPT_INCLUDE)
AC_SUBST(WITH_LIBGCRYPT_LIB)

#=================
# Check for the rpm-sequoia backend.
WITH_RPM_SEQUOIA_INCLUDE=
WITH_RPM_SEQUOIA_LIB=
if test "$with_crypto" = sequoia ; then
PKG_CHECK_MODULES([RPM_SEQUOIA], [rpm-sequoia], [have_rpm_sequoia=yes], [have_rpm_sequoia=no])
if test "$have_rpm_sequoia" = "yes"; then
WITH_RPM_SEQUOIA_INCLUDE="$RPM_SEQUOIA_CFLAGS"
WITH_RPM_SEQUOIA_LIB="$RPM_SEQUOIA_LIBS"
else
AC_MSG_ERROR([librpm-sequoia not found])
fi
fi

AM_CONDITIONAL([WITH_RPM_SEQUOIA],[test "$with_crypt" = sequoia])
AC_SUBST(WITH_RPM_SEQUOIA_INCLUDE)
AC_SUBST(WITH_RPM_SEQUOIA_LIB)

#=================
# Check for magic library.
WITH_MAGIC_INCLUDE=
Expand Down
15 changes: 12 additions & 3 deletions include/rpm/rpmpgp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1082,9 +1082,9 @@ unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype);
/** \ingroup rpmpgp
* Returns the issuer or the object's Key ID.
*
* If the object is a signature, then this returns the Key ID stored
* in the first Issuer subpacket as a hex string. (This is not
* authenticated.)
* If the object is a signature, then this returns the Key ID stored in the
* first Issuer or Issuer Fingerprint subpacket as a hex string.
* (This is not authenticated.)
*
* If the object is a certificate or a subkey, then this returns the key's
* Key ID.
Expand Down Expand Up @@ -1139,6 +1139,15 @@ int pgpDigParamsVersion(pgpDigParams digp);
/** \ingroup rpmpgp
* Retrieve the object's creation time.
*
* If the object is a signature, then this returns the signature's creation
* time.
*
* If the object is a certificate, then this returns the primary key's key
* creation time.
*
* If the object is a subkey, then this returns the subkey's key creation
* time.
*
* param digp parameter container
* return seconds since the UNIX Epoch.
*/
Expand Down
9 changes: 5 additions & 4 deletions rpmio/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ EXTRA_DIST = modemuncher.c
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/include/
AM_CPPFLAGS += @WITH_OPENSSL_INCLUDE@
AM_CPPFLAGS += @WITH_LIBGCRYPT_INCLUDE@
AM_CPPFLAGS += @WITH_RPM_SEQUOIA_INCLUDE@
AM_CPPFLAGS += @WITH_POPT_INCLUDE@
AM_CPPFLAGS += $(ZSTD_CFLAGS)
AM_CPPFLAGS += @LUA_CFLAGS@
Expand All @@ -24,14 +25,13 @@ librpmio_la_SOURCES = \
rpmio_internal.h rpmhook.h rpmvercmp.c rpmver.c \
rpmstring.c rpmfileutil.c rpmglob.c \
rpmkeyring.c rpmstrpool.c rpmmacro_internal.h \
rpmlua.c rpmlua.h lposix.c lposix.h \
rpmpgp_internal.c rpmpgp_internal.h
rpmlua.c rpmlua.h lposix.c lposix.h

if WITH_OPENSSL
librpmio_la_SOURCES += digest_openssl.c
librpmio_la_SOURCES += digest_openssl.c rpmpgp_internal.c rpmpgp_internal.h
else
if WITH_LIBGCRYPT
librpmio_la_SOURCES += digest_libgcrypt.c
librpmio_la_SOURCES += digest_libgcrypt.c rpmpgp_internal.c rpmpgp_internal.h
endif
endif

Expand All @@ -40,6 +40,7 @@ librpmio_la_LIBADD = \
../misc/libmisc.la \
@WITH_OPENSSL_LIB@ \
@WITH_LIBGCRYPT_LIB@ \
@WITH_RPM_SEQUOIA_LIB@ \
@WITH_BZ2_LIB@ \
@WITH_ZLIB_LIB@ \
@WITH_POPT_LIB@ \
Expand Down
3 changes: 2 additions & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ EXTRA_DIST += local.at $(TESTSUITE)

AM_CPPFLAGS = -I$(top_srcdir)/include

rpmpgpcheck_LDADD = ../rpmio/librpmio.la
rpmpgpcheck_LDADD = ../rpmio/librpmio.la \
@WITH_RPM_SEQUOIA_LIB@

## testsuite components
TESTSUITE_AT = rpmtests.at
Expand Down

0 comments on commit 097b033

Please sign in to comment.