- add hmac FIPS integrity verification check
This commit is contained in:
parent
7de5049932
commit
4b8542ad6d
74
libgcrypt-1.4.4-use-fipscheck.patch
Normal file
74
libgcrypt-1.4.4-use-fipscheck.patch
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
diff -up libgcrypt-1.4.4/src/fips.c.use-fipscheck libgcrypt-1.4.4/src/fips.c
|
||||||
|
--- libgcrypt-1.4.4/src/fips.c.use-fipscheck 2009-03-03 18:10:49.000000000 +0100
|
||||||
|
+++ libgcrypt-1.4.4/src/fips.c 2009-03-03 18:51:31.000000000 +0100
|
||||||
|
@@ -570,23 +570,48 @@ run_random_selftests (void)
|
||||||
|
return !!err;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int
|
||||||
|
+get_library_path(const char *libname, const char *symbolname, char *path, size_t pathlen)
|
||||||
|
+{
|
||||||
|
+ Dl_info info;
|
||||||
|
+ void *dl, *sym;
|
||||||
|
+ int rv = -1;
|
||||||
|
+
|
||||||
|
+ dl = dlopen(libname, RTLD_LAZY);
|
||||||
|
+ if (dl == NULL) {
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ sym = dlsym(dl, symbolname);
|
||||||
|
+
|
||||||
|
+ if (sym != NULL && dladdr(sym, &info)) {
|
||||||
|
+ strncpy(path, info.dli_fname, pathlen-1);
|
||||||
|
+ path[pathlen-1] = '\0';
|
||||||
|
+ rv = 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ dlclose(dl);
|
||||||
|
+
|
||||||
|
+ return rv;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Run an integrity check on the binary. Returns 0 on success. */
|
||||||
|
static int
|
||||||
|
check_binary_integrity (void)
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_HMAC_BINARY_CHECK
|
||||||
|
gpg_error_t err;
|
||||||
|
- Dl_info info;
|
||||||
|
+ char libpath[4096];
|
||||||
|
unsigned char digest[32];
|
||||||
|
int dlen;
|
||||||
|
char *fname = NULL;
|
||||||
|
- const char key[] = "What am I, a doctor or a moonshuttle conductor?";
|
||||||
|
+ const char key[] = "orboDeJITITejsirpADONivirpUkvarP";
|
||||||
|
|
||||||
|
- if (!dladdr ("gcry_check_version", &info))
|
||||||
|
+ if (get_library_path ("libgcrypt.so.11", "gcry_check_version", libpath, sizeof(libpath)))
|
||||||
|
err = gpg_error_from_syserror ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- dlen = _gcry_hmac256_file (digest, sizeof digest, info.dli_fname,
|
||||||
|
+ dlen = _gcry_hmac256_file (digest, sizeof digest, libpath,
|
||||||
|
key, strlen (key));
|
||||||
|
if (dlen < 0)
|
||||||
|
err = gpg_error_from_syserror ();
|
||||||
|
@@ -594,7 +619,7 @@ check_binary_integrity (void)
|
||||||
|
err = gpg_error (GPG_ERR_INTERNAL);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- fname = gcry_malloc (strlen (info.dli_fname) + 1 + 5 + 1 );
|
||||||
|
+ fname = gcry_malloc (strlen (libpath) + 1 + 5 + 1 );
|
||||||
|
if (!fname)
|
||||||
|
err = gpg_error_from_syserror ();
|
||||||
|
else
|
||||||
|
@@ -603,7 +628,7 @@ check_binary_integrity (void)
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
/* Prefix the basename with a dot. */
|
||||||
|
- strcpy (fname, info.dli_fname);
|
||||||
|
+ strcpy (fname, libpath);
|
||||||
|
p = strrchr (fname, '/');
|
||||||
|
if (p)
|
||||||
|
p++;
|
@ -1,6 +1,6 @@
|
|||||||
Name: libgcrypt
|
Name: libgcrypt
|
||||||
Version: 1.4.4
|
Version: 1.4.4
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
Source0: libgcrypt-%{version}-hobbled.tar.bz2
|
Source0: libgcrypt-%{version}-hobbled.tar.bz2
|
||||||
# The original libgcrypt sources now contain potentially patented ECC
|
# The original libgcrypt sources now contain potentially patented ECC
|
||||||
# cipher support. We have to remove it in the tarball we ship with
|
# cipher support. We have to remove it in the tarball we ship with
|
||||||
@ -10,12 +10,14 @@ Source0: libgcrypt-%{version}-hobbled.tar.bz2
|
|||||||
Source2: wk@g10code.com
|
Source2: wk@g10code.com
|
||||||
Source3: hobble-libgcrypt
|
Source3: hobble-libgcrypt
|
||||||
Patch1: libgcrypt-1.4.4-fips-no-access.patch
|
Patch1: libgcrypt-1.4.4-fips-no-access.patch
|
||||||
|
Patch2: libgcrypt-1.4.4-use-fipscheck.patch
|
||||||
|
|
||||||
# Technically LGPLv2.1+, but Fedora's table doesn't draw a distinction.
|
# Technically LGPLv2.1+, but Fedora's table doesn't draw a distinction.
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
Summary: A general-purpose cryptography library
|
Summary: A general-purpose cryptography library
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||||
BuildRequires: gawk, libgpg-error-devel >= 1.4, pkgconfig
|
BuildRequires: gawk, libgpg-error-devel >= 1.4, pkgconfig
|
||||||
|
BuildRequires: fipscheck
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
|
|
||||||
%package devel
|
%package devel
|
||||||
@ -38,6 +40,7 @@ applications using libgcrypt.
|
|||||||
%setup -q
|
%setup -q
|
||||||
%{SOURCE3}
|
%{SOURCE3}
|
||||||
%patch1 -p1 -b .no-access
|
%patch1 -p1 -b .no-access
|
||||||
|
%patch2 -p1 -b .use-fipscheck
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --disable-static \
|
%configure --disable-static \
|
||||||
@ -45,12 +48,22 @@ applications using libgcrypt.
|
|||||||
--disable-asm \
|
--disable-asm \
|
||||||
%endif
|
%endif
|
||||||
--enable-noexecstack \
|
--enable-noexecstack \
|
||||||
|
--enable-hmac-binary-check \
|
||||||
--enable-pubkey-ciphers='dsa elgamal rsa'
|
--enable-pubkey-ciphers='dsa elgamal rsa'
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
|
fipshmac src/.libs/libgcrypt.so.??
|
||||||
make check
|
make check
|
||||||
|
|
||||||
|
# Add generation of HMAC checksums of the final stripped binaries
|
||||||
|
%define __spec_install_post \
|
||||||
|
%{?__debug_package:%{__debug_install_post}} \
|
||||||
|
%{__arch_install_post} \
|
||||||
|
%{__os_install_post} \
|
||||||
|
fipshmac $RPM_BUILD_ROOT/%{_lib}/*.so.?? \
|
||||||
|
%{nil}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -fr $RPM_BUILD_ROOT
|
rm -fr $RPM_BUILD_ROOT
|
||||||
%makeinstall
|
%makeinstall
|
||||||
@ -117,8 +130,8 @@ exit 0
|
|||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%dir /etc/gcrypt
|
%dir /etc/gcrypt
|
||||||
/%{_lib}/*.so.*
|
/%{_lib}/libgcrypt.so.*
|
||||||
#%{_libdir}/%{name}
|
/%{_lib}/.libgcrypt.so.*.hmac
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
@ -128,11 +141,13 @@ exit 0
|
|||||||
%{_includedir}/*
|
%{_includedir}/*
|
||||||
%{_libdir}/*.so
|
%{_libdir}/*.so
|
||||||
%{_datadir}/aclocal/*
|
%{_datadir}/aclocal/*
|
||||||
#%{_datadir}/%{name}
|
|
||||||
|
|
||||||
%{_infodir}/gcrypt.info*
|
%{_infodir}/gcrypt.info*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 3 2009 Tomas Mraz <tmraz@redhat.com> 1.4.4-3
|
||||||
|
- add hmac FIPS integrity verification check
|
||||||
|
|
||||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.4-2
|
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.4-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user