%pre: fix /usr/include/cryptopp directory becoming a symlink [release 5.6.2-2mamba;Mon Aug 19 2013]

This commit is contained in:
Silvan Calarco 2024-01-06 04:02:24 +01:00
parent a7963be948
commit 04e5d9819f
5 changed files with 398 additions and 0 deletions

View File

@ -1,2 +1,7 @@
# libcryptopp # libcryptopp
Crypto++ Library is a free C++ class library of cryptographic schemes.
Currently the library consists of the following, some of which are other people's code, repackaged into classes.
One purpose of Crypto++ is to act as a repository of public domain (not copyrighted) source code. Although the library is copyrighted as a compilation, the individual files in it (except for a few exceptions listed in the license) are in the public domain.

View File

@ -0,0 +1,107 @@
Index: libcryptopp-5.6.1/eccrypto.h
===================================================================
--- libcryptopp-5.6.1.orig/eccrypto.h
+++ libcryptopp-5.6.1/eccrypto.h
@@ -43,7 +43,7 @@ public:
void Initialize(const EllipticCurve &ec, const Point &G, const Integer &n, const Integer &k = Integer::Zero())
{
this->m_groupPrecomputation.SetCurve(ec);
- SetSubgroupGenerator(G);
+ this->SetSubgroupGenerator(G);
m_n = n;
m_k = k;
}
@@ -145,9 +145,9 @@ public:
typedef typename EC::Point Element;
void Initialize(const DL_GroupParameters_EC<EC> &params, const Element &Q)
- {this->AccessGroupParameters() = params; SetPublicElement(Q);}
+ {this->AccessGroupParameters() = params; this->SetPublicElement(Q);}
void Initialize(const EC &ec, const Element &G, const Integer &n, const Element &Q)
- {this->AccessGroupParameters().Initialize(ec, G, n); SetPublicElement(Q);}
+ {this->AccessGroupParameters().Initialize(ec, G, n); this->SetPublicElement(Q);}
// X509PublicKey
void BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size);
@@ -166,9 +166,9 @@ public:
void Initialize(const EC &ec, const Element &G, const Integer &n, const Integer &x)
{this->AccessGroupParameters().Initialize(ec, G, n); this->SetPrivateExponent(x);}
void Initialize(RandomNumberGenerator &rng, const DL_GroupParameters_EC<EC> &params)
- {GenerateRandom(rng, params);}
+ {this->GenerateRandom(rng, params);}
void Initialize(RandomNumberGenerator &rng, const EC &ec, const Element &G, const Integer &n)
- {GenerateRandom(rng, DL_GroupParameters_EC<EC>(ec, G, n));}
+ {this->GenerateRandom(rng, DL_GroupParameters_EC<EC>(ec, G, n));}
// PKCS8PrivateKey
void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size);
Index: libcryptopp-5.6.1/secblock.h
===================================================================
--- libcryptopp-5.6.1.orig/secblock.h
+++ libcryptopp-5.6.1/secblock.h
@@ -88,7 +88,7 @@ public:
pointer allocate(size_type n, const void * = NULL)
{
- CheckSize(n);
+ this->CheckSize(n);
if (n == 0)
return NULL;
Index: libcryptopp-5.6.1/eccrypto.cpp
===================================================================
--- libcryptopp-5.6.1.orig/eccrypto.cpp
+++ libcryptopp-5.6.1/eccrypto.cpp
@@ -435,7 +435,7 @@ template <class EC> void DL_GroupParamet
StringSource ssG(param.g, true, new HexDecoder);
Element G;
bool result = GetCurve().DecodePoint(G, ssG, (size_t)ssG.MaxRetrievable());
- SetSubgroupGenerator(G);
+ this->SetSubgroupGenerator(G);
assert(result);
StringSource ssN(param.n, true, new HexDecoder);
@@ -591,7 +591,7 @@ bool DL_GroupParameters_EC<EC>::Validate
if (level >= 2 && pass)
{
const Integer &q = GetSubgroupOrder();
- Element gq = gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : ExponentiateElement(g, q);
+ Element gq = gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : this->ExponentiateElement(g, q);
pass = pass && IsIdentity(gq);
}
return pass;
@@ -629,7 +629,7 @@ void DL_PublicKey_EC<EC>::BERDecodePubli
typename EC::Point P;
if (!this->GetGroupParameters().GetCurve().DecodePoint(P, bt, size))
BERDecodeError();
- SetPublicElement(P);
+ this->SetPublicElement(P);
}
template <class EC>
Index: libcryptopp-5.6.1/algebra.cpp
===================================================================
--- libcryptopp-5.6.1.orig/algebra.cpp
+++ libcryptopp-5.6.1/algebra.cpp
@@ -58,7 +58,7 @@ template <class T> const T& AbstractEucl
Element g[3]={b, a};
unsigned int i0=0, i1=1, i2=2;
- while (!Equal(g[i1], this->Identity()))
+ while (!this->Equal(g[i1], this->Identity()))
{
g[i2] = Mod(g[i0], g[i1]);
unsigned int t = i0; i0 = i1; i1 = i2; i2 = t;
Index: libcryptopp-5.6.1/panama.cpp
===================================================================
--- libcryptopp-5.6.1.orig/panama.cpp
+++ libcryptopp-5.6.1/panama.cpp
@@ -422,7 +422,7 @@ void PanamaHash<B>::TruncatedFinal(byte
{
this->ThrowIfInvalidTruncatedSize(size);
- PadLastBlock(this->BLOCKSIZE, 0x01);
+ this->PadLastBlock(this->BLOCKSIZE, 0x01);
HashEndianCorrectedBlock(this->m_data);

View File

@ -0,0 +1,12 @@
diff -Nru libcryptopp-5.6.1.orig/GNUmakefile libcryptopp-5.6.1/GNUmakefile
--- libcryptopp-5.6.1.orig/GNUmakefile 2013-03-28 11:53:42.647445161 +0000
+++ libcryptopp-5.6.1/GNUmakefile 2013-03-28 12:02:52.083097231 +0000
@@ -151,7 +151,7 @@
$(RANLIB) $@
libcryptopp.so: $(LIBOBJS)
- $(CXX) -shared -o $@ $(LIBOBJS)
+ $(CXX) -shared -o $@ $(CXXFLAGS) $(LIBOBJS)
cryptest.exe: libcryptopp.a $(TESTOBJS)
$(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) -L. -lcryptopp $(LDFLAGS) $(LDLIBS)

View File

@ -0,0 +1,150 @@
--- cryptopp562/GNUmakefile
+++ cryptopp562/GNUmakefile
@@ -1,3 +1,5 @@
+LIBTOOL = libtool
+LIBDIR = lib
CXXFLAGS = -DNDEBUG -g -O2
# -O3 fails to link on Cygwin GCC version 4.5.3
# -fPIC is supported. Please report any breakage of -fPIC as a bug.
@@ -7,8 +9,9 @@
# LDFLAGS += -Wl,--gc-sections
ARFLAGS = -cr # ar needs the dash on OpenBSD
RANLIB = ranlib
-CP = cp
+LN_S = ln -s
MKDIR = mkdir
+INSTALL = install
EGREP = egrep
UNAME = $(shell uname)
ISX86 = $(shell uname -m | $(EGREP) -c "i.86|x86|i86|amd64")
@@ -79,8 +82,11 @@
LDLIBS += -lws2_32
endif
+THREAD_LIBS =
+
ifeq ($(IS_LINUX),1)
LDFLAGS += -pthread
+THREAD_LIBS += -lpthread
ifneq ($(shell uname -i | $(EGREP) -c "(_64|d64)"),0)
M32OR64 = -m64
endif
@@ -126,54 +132,52 @@
SRCS = $(shell echo *.cpp)
endif
-OBJS = $(SRCS:.cpp=.o)
-# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?)
-TESTOBJS = bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o
+OBJS = $(SRCS:.cpp=.lo)
+# test.lo needs to be after bench.lo for cygwin 1.1.4 (possible ld bug?)
+TESTOBJS = bench.lo bench2.lo test.lo validat1.lo validat2.lo validat3.lo adhoc.lo datatest.lo regtest.lo fipsalgt.lo dlltest.lo
LIBOBJS = $(filter-out $(TESTOBJS),$(OBJS))
DLLSRCS = algebra.cpp algparam.cpp asn.cpp basecode.cpp cbcmac.cpp channels.cpp cryptlib.cpp des.cpp dessp.cpp dh.cpp dll.cpp dsa.cpp ec2n.cpp eccrypto.cpp ecp.cpp eprecomp.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gf2n.cpp gfpcrypt.cpp hex.cpp hmac.cpp integer.cpp iterhash.cpp misc.cpp modes.cpp modexppc.cpp mqueue.cpp nbtheory.cpp oaep.cpp osrng.cpp pch.cpp pkcspad.cpp pubkey.cpp queue.cpp randpool.cpp rdtables.cpp rijndael.cpp rng.cpp rsa.cpp sha.cpp simple.cpp skipjack.cpp strciphr.cpp trdlocal.cpp
-DLLOBJS = $(DLLSRCS:.cpp=.export.o)
-LIBIMPORTOBJS = $(LIBOBJS:.o=.import.o)
-TESTIMPORTOBJS = $(TESTOBJS:.o=.import.o)
-DLLTESTOBJS = dlltest.dllonly.o
-
-all: cryptest.exe
-static: libcryptopp.a
-dynamic: libcryptopp.so
+DLLOBJS = $(DLLSRCS:.cpp=.export.lo)
+LIBIMPORTOBJS = $(LIBOBJS:.lo=.import.lo)
+TESTIMPORTOBJS = $(TESTOBJS:.lo=.import.lo)
+DLLTESTOBJS = dlltest.dllonly.lo
+
+all: libcrypto++.la
-test: cryptest.exe
- ./cryptest.exe v
+test: cryptest
+ ./cryptest v
clean:
- -$(RM) cryptest.exe libcryptopp.a libcryptopp.so $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTI MPORTOBJS) $(DLLTESTOBJS)
+ $(RM) -f .libs cryptest libcrypto++.* libcryptopp.* $(LIBOBJS) $(TESTOBJS) cryptopp.dll cryptest.import dlltest $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
+
install:
- $(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin
- -$(CP) *.h $(PREFIX)/include/cryptopp
- -$(CP) *.a $(PREFIX)/lib
- -$(CP) *.so $(PREFIX)/lib
- -$(CP) *.exe $(PREFIX)/bin
+ $(MKDIR) -p $(DESTDIR)$(PREFIX)/include/crypto++ $(DESTDIR)$(PREFIX)/$(LIBDIR)
+ $(INSTALL) -m 644 *.h $(DESTDIR)$(PREFIX)/include/crypto++
+ $(LN_S) crypto++ $(DESTDIR)$(PREFIX)/include/cryptopp
+ $(LIBTOOL) --mode=install $(INSTALL) libcrypto++.la $(DESTDIR)$(PREFIX)/$(LIBDIR)
+ $(LN_S) libcrypto++.a $(DESTDIR)$(PREFIX)/$(LIBDIR)/libcryptopp.a
+ $(LN_S) libcrypto++.so.0.0.0 $(DESTDIR)$(PREFIX)/$(LIBDIR)/libcryptopp.so
+ $(LN_S) libcrypto++.so.0.0.0 $(DESTDIR)$(PREFIX)/$(LIBDIR)/libcryptopp.so.0
+ $(LN_S) libcrypto++.so.0.0.0 $(DESTDIR)$(PREFIX)/$(LIBDIR)/libcryptopp.so.0.0.0
remove:
- -$(RM) -rf $(PREFIX)/include/cryptopp
- -$(RM) $(PREFIX)/lib/libcryptopp.a
- -$(RM) $(PREFIX)/lib/libcryptopp.so
- -$(RM) $(PREFIX)/bin/cryptest.exe
-
-libcryptopp.a: $(LIBOBJS)
- $(AR) $(ARFLAGS) $@ $(LIBOBJS)
- $(RANLIB) $@
+ $(RM) -rf $(DESTDIR)$(PREFIX)/include/crypto++
+ $(RM) $(DESTDIR)$(PREFIX)/$(LIBDIR)/libcryptopp.a
+ $(RM) $(DESTDIR)$(PREFIX)/$(LIBDIR)/libcryptopp.so*
+ $(RM) $(DESTDIR)$(PREFIX)/bin/cryptest
-libcryptopp.so: $(LIBOBJS)
- $(CXX) -shared -o $@ $(LIBOBJS)
+libcrypto++.la: $(LIBOBJS)
+ $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(LDFLAGS) -rpath $(PREFIX)/$(LIBDIR) -o $@ $(LIBOBJS) $(THREAD_LIBS)
-cryptest.exe: libcryptopp.a $(TESTOBJS)
- $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
+cryptest: libcrypto++.la $(TESTOBJS)
+ $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(LDFLAGS) -o $@ $(TESTOBJS) -L. -lcrypto++ $(LDLIBS) $(THREAD_LIBS)
nolib: $(OBJS) # makes it faster to test changes
- $(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS)
+ $(LIBTOOL) --tag=CXX --mode=link $(CXX) -o ct $(LDFLAGS) $(OBJS) $(LDLIBS) $(THREAD_LIBS)
-dll: cryptest.import.exe dlltest.exe
+dll: cryptest.import dlltest
cryptopp.dll: $(DLLOBJS)
$(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a
@@ -182,10 +186,10 @@
$(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS)
$(RANLIB) $@
-cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
+cryptest.import: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
$(CXX) -o $@ $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS)
-dlltest.exe: cryptopp.dll $(DLLTESTOBJS)
+dlltest: cryptopp.dll $(DLLTESTOBJS)
$(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS)
adhoc.cpp: adhoc.cpp.proto
@@ -195,14 +199,14 @@
touch adhoc.cpp
endif
-%.dllonly.o : %.cpp
+%.dllonly.lo : %.cpp
$(CXX) $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c $< -o $@
-%.import.o : %.cpp
+%.import.lo : %.cpp
$(CXX) $(CXXFLAGS) -DCRYPTOPP_IMPORTS -c $< -o $@
-%.export.o : %.cpp
+%.export.lo : %.cpp
$(CXX) $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c $< -o $@
-%.o : %.cpp
- $(CXX) $(CXXFLAGS) -c $<
+%.lo : %.cpp
+ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(CXXFLAGS) -c $<

124
libcryptopp.spec Normal file
View File

@ -0,0 +1,124 @@
%define realversion %(echo %version | tr -d .)
Name: libcryptopp
Version: 5.6.2
Release: 2mamba
Summary: Free C++ class library of cryptographic schemes
Group: System/Libraries
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.cryptopp.com/
Source: http://downloads.sourceforge.net/project/cryptopp/cryptopp/%{version}/cryptopp%{realversion}.zip
Patch0: libcryptopp-5.6.2-gnumakefile.patch
Patch1: libcryptopp-5.6.1-gcc-4.7.patch
Patch2: libcryptopp-5.6.1-libcryptopp-CXXFLAGS.patch
License: Public domain
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libgcc
BuildRequires: libstdc++6-devel
## AUTOBUILDREQ-END
BuildRequires: unzip
BuildRequires: gcc-c++
BuildRequires: hd2u
%ifarch x86_64
Provides: libcryptopp.so()(64bit)
%else
Provides: libcryptopp.so
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Obsoletes: libcryptopp-tools
%description
Crypto++ Library is a free C++ class library of cryptographic schemes.
Currently the library consists of the following, some of which are other people's code, repackaged into classes.
One purpose of Crypto++ is to act as a repository of public domain (not copyrighted) source code. Although the library is copyrighted as a compilation, the individual files in it (except for a few exceptions listed in the license) are in the public domain.
%package devel
Group: Development/Libraries
Summary: Files for development of applications which will use %{name}
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description devel
Crypto++ Library is a free C++ class library of cryptographic schemes.
Currently the library consists of the following, some of which are other people's code, repackaged into classes.
This package contains the header files and static libraries for Crypto++.
%package tools
Summary: Programs for manipulating %{name} routines
Group: Development/Tools
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description tools
Crypto++ Library is a free C++ class library of cryptographic schemes.
Currently the library consists of the following, some of which are other people's code, repackaged into classes.
This package contains programs for manipulating %{name} routines.
%prep
%setup -q -c -n %{name}-%{version}
# All files have ^M end of lines, fix that for the makefile patch to apply
find . -type f -exec dos2unix {} \;
%patch0 -p1
#%patch1 -p1
#%patch2 -p1
%build
%{make} \
%ifarch x86_64
CXXFLAGS+="-fPIC"
%endif
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pre
if [ $1 -gt 1 ]; then
[ -L %{_includedir}/cryptopp ] || {
mkdir -p %{_includedir}/crypto++
mv %{_includedir}/cryptopp/* %{_includedir}/crypto++/
rmdir %{_includedir}/cryptopp
}
fi
:
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root,0755)
%{_libdir}/libcryptopp.so*
%{_libdir}/libcrypto++.so.*
%files devel
%defattr(-,root,root,0755)
%{_includedir}/cryptopp
%dir %{_includedir}/crypto++
%{_includedir}/crypto++/*.h
%{_libdir}/libcryptopp.a
%{_libdir}/libcrypto++.a
%{_libdir}/libcrypto++.la
%{_libdir}/libcrypto++.so
#%files tools
#%defattr(-,root,root,0755)
#%{_bindir}/cryptest
%changelog
* Mon Aug 19 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 5.6.2-2mamba
- %pre: fix /usr/include/cryptopp directory becoming a symlink
* Mon Aug 19 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 5.6.2-1mamba
- update to 5.6.2
* Wed Oct 24 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 5.6.1-1mamba
- update to 5.6.1
* Thu Aug 21 2008 gil <puntogil@libero.it> 5.5.2-1mamba
- added patch