#
# spec file for package libxcrypt
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           libxcrypt
License:        LGPLv2.1+ ; Public Domain, Freeware
Group:          System/Libraries
AutoReqProv:    on
# bnc#437293
%ifarch ppc64
Obsoletes:      libxcrypt-64bit
%endif
Version:        3.0.4
Release:        11.1.2
Summary:        Crypt Library for DES, MD5, Blowfish and others
Source:         libxcrypt-%{version}.tar.bz2
Url:            http://www.openwall.com/crypt/
Source1:        %{url}crypt_blowfish-1.2.tar.gz
Source2:        %{url}crypt_blowfish-1.2.tar.gz.sign
Source20:       baselibs.conf
Patch0:         fix-werror.patch
Patch1:         libxcrypt-3.0.4-blowfish-noasm.diff
Patch2:         libxcrypt-3.0.4-blowfish-xcrypt.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       libxcrypt-crypt_blowfish = 1.2
BuildArch:	i486

%description
Libxcrypt is a replacement for libcrypt, which comes with the GNU C
Library. It supports DES crypt, MD5, SHA256, SHA512 and passwords with
blowfish encryption.



%package devel
License:        LGPLv2.1+ ; Public Domain, Freeware
Summary:        Development Include Files and Libraries for enhanced crypt functionality
Group:          Development/Libraries/C and C++
Requires:       libxcrypt = %{version}
AutoReqProv:    on
# bnc#437293
%ifarch ppc64
Obsoletes:      libxcrypt-devel-64bit
%endif

%description devel
libxcrypt is a replacement for libcrypt, which comes with the GNU C
Library. It supports DES crypt, MD5, and passwords with blowfish
encryption.

This package contains the header files and static libraries necessary
to develop software using libxcrypt.



%prep
%setup -q -a1
%patch0 -p1
%patch1 -p0
%patch2 -p0
cp crypt_blowfish-*/*.{c,h} plugins/blowfish
mv plugins/blowfish/wrapper.c plugins/blowfish/blowfish-test.c

%build
rm -f libtool
autoreconf -f -i
./configure CFLAGS="$RPM_OPT_FLAGS -Wno-cast-align" \
	--prefix=%{_prefix} \
	--libdir=/%{_lib} \
	--build=i486-pc-linux-gnu \
	--host=i486-pc-linux-gnu
make %{?_smp_mflags}

%check
%ifnarch %arm
# testsuite kills qemu-arm and worker :(
make check
%endif

%install
make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_libdir}/xcrypt
rm $RPM_BUILD_ROOT/%{_lib}/libxcrypt.{so,la}
rm $RPM_BUILD_ROOT/%{_lib}/xcrypt/lib*.{so,la}
ln -sf ../../%{_lib}/libxcrypt.so.2 $RPM_BUILD_ROOT%{_libdir}/libxcrypt.so
/sbin/ldconfig -n $RPM_BUILD_ROOT/%{_lib}/
mv $RPM_BUILD_ROOT/%{_lib}/libxcrypt.a $RPM_BUILD_ROOT/%{_libdir}
mv $RPM_BUILD_ROOT/%{_lib}/xcrypt/lib*.a $RPM_BUILD_ROOT/%{_libdir}/xcrypt/

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc COPYING README NEWS README.bcrypt README.ufc-crypt
/%{_lib}/libxcrypt.so.*
%dir /%{_lib}/xcrypt
/%{_lib}/xcrypt/lib*.so.*

%files devel
%defattr(-,root,root)
%{_prefix}/include/*.h
%{_libdir}/libxcrypt.so
%{_libdir}/libxcrypt.a
/%{_libdir}/xcrypt/lib*.a

%changelog
* Wed Aug 24 2011 lnussel@suse.de
- fix prefix detection (bnc#713727)
* Wed Jul 27 2011 lnussel@suse.de
- fix 2x and 2y modes
- add libxcrypt-crypt_blowfish = 1.2 provides
* Tue Jul 19 2011 lnussel@suse.de
- update crypt_blowfish to version 1.2 (bnc#700876, CVE-2011-2483)
  * due to the signedness bug fix 2a hashes are incompatible with
    previous versions if the password contains 8bit chracters!
* Tue Jul  5 2011 lnussel@suse.de
- update bundled crypt_blowfish to 1.1
* Thu Jun  9 2011 meissner@suse.de
- check return value of scanf() to fix -Werror building
* Tue May 10 2011 kukuk@suse.de
- Update to version 3.0.4
  - Fix new warning generated by gcc 4.6
* Mon Jun 28 2010 jengelh@medozas.de
- use %%_smp_mflags
* Sat Dec 12 2009 jengelh@medozas.de
- add baselibs.conf as a source
- enable parallel building
* Fri Oct 30 2009 kukuk@suse.de
- Update to version 3.0.3:
  - Fix memory leak [bnc#547893]
  - Fix compiler warnings [bnc#440134]
* Fri Jul 10 2009 jansimon.moeller@opensuse.org
- Disable the testsuite for ARM as it kills the qemu-arm and the
  worker gets stalled. Needs checking with qemu-arm before
  enabling again.
* Tue Dec 16 2008 kukuk@suse.de
- Update to version 3.0.2 (merge of patches)
* Thu Oct 30 2008 olh@suse.de
- obsolete old -XXbit packages (bnc#437293)
* Sat Sep 27 2008 kukuk@suse.de
- Add missing gensalt security fixes (was [bnc#408719])
* Thu Jun 26 2008 kukuk@suse.de
- Remove old obsolete libxcrypt.so.1
* Tue Apr 15 2008 kukuk@suse.de
- Create libxcrypt.so.1 symlink and include it in package
* Thu Apr 10 2008 ro@suse.de
- added baselibs.conf file to build xxbit packages
  for multilib support
* Mon Apr  7 2008 schwab@suse.de
- Remove use of undefined macro.
- Work around unclean sources.
* Thu Apr  3 2008 kukuk@suse.de
- Add libxcrypt-3.0:
  * Add sha256 and sha512 hashes
  * Create plugins for every hash function except DES/bigcrypt
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Fri Jan  6 2006 kukuk@suse.de
- Update to 2.4 (sync with crypt_blowfish 1.0)
* Sun Sep 18 2005 kukuk@suse.de
- Update to 2.3 (remove broken assembler code)
* Sat Apr  9 2005 schwab@suse.de
- Fix utterly broken and unportable code.
* Fri Jun 18 2004 kukuk@suse.de
- Update to 2.2 (apply fixes from glibc version)
* Sat Jan 10 2004 adrian@suse.de
- add %%run_ldconfig
* Fri Nov 14 2003 kukuk@suse.de
- Compile libarary with no exec stack
* Thu Oct 16 2003 kukuk@suse.de
- Update to 2.1 (use optimized assembler version on ix86)
* Mon Jul 28 2003 kukuk@suse.de
- Update to 2.0
* Tue May 13 2003 kukuk@suse.de
- Add defattr to filelist
* Thu Jan 16 2003 kukuk@suse.de
- Update to version 1.4 (compiles with glibc > 2.3.1)
* Fri Jan 10 2003 kukuk@suse.de
- Update to version 1.3 (fix initialisation of internal data
  struct for des_crypt)
* Mon Oct 21 2002 kukuk@suse.de
- Update to version 1.2 (fix compiling with glibc 2.3.x)
* Mon May 27 2002 kukuk@suse.de
- Update to version 1.1 (add SHA1 support)
* Wed Apr 17 2002 kukuk@suse.de
- Add require to libxcrypt-devel for correct shared library
* Mon Apr 15 2002 kukuk@suse.de
- Initial version of a libcrypt replacement