diff options
author | Xin LI <delphij@FreeBSD.org> | 2013-05-22 22:41:42 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2013-05-22 22:41:42 +0000 |
commit | 4fa5971018975ef5283476fe4fb71973e00adee9 (patch) | |
tree | 2904e7b8c35eec1de7f12841e2d4b5dfd811c5c2 /security/cryptopp | |
parent | Update to version 5.0.0.0 (diff) |
This changeset fixes two issues with crypto++ library:
* patch-misc.h
This fixes a warning triggered by testing an unsigned parameter against
0. The patch solves this by creating a different template for signed
case.
* patch-nbtheory.cpp
This is a workaround for a bug with the current version of libc++ shipped
with FreeBSD 9.x, which causes an infinite loop when generating RSA key,
possibly also other operations.
PR: ports/178827
Submitted by: Michael Gmelin <freebsd grem de>
Notes
Notes:
svn path=/head/; revision=318802
Diffstat (limited to 'security/cryptopp')
-rw-r--r-- | security/cryptopp/Makefile | 2 | ||||
-rw-r--r-- | security/cryptopp/files/patch-misc.h | 54 | ||||
-rw-r--r-- | security/cryptopp/files/patch-nbtheory.cpp | 21 |
3 files changed, 76 insertions, 1 deletions
diff --git a/security/cryptopp/Makefile b/security/cryptopp/Makefile index 728d07943107..d40343d8df74 100644 --- a/security/cryptopp/Makefile +++ b/security/cryptopp/Makefile @@ -3,7 +3,7 @@ PORTNAME= cryptopp PORTVERSION= 5.6.1 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= security MASTER_SITES= SF \ http://www.cryptopp.com/ diff --git a/security/cryptopp/files/patch-misc.h b/security/cryptopp/files/patch-misc.h new file mode 100644 index 000000000000..88b84f5b8e80 --- /dev/null +++ b/security/cryptopp/files/patch-misc.h @@ -0,0 +1,54 @@ +--- misc.h.orig 2010-08-06 18:46:18.000000000 +0000 ++++ misc.h 2013-05-22 08:43:01.949194748 +0000 +@@ -405,17 +405,13 @@ + return order == GetNativeByteOrder(); + } + ++template<bool> struct IsUnsigned {}; ++ + template <class T> +-std::string IntToString(T a, unsigned int base = 10) ++std::string IntToStringImpl(T a, unsigned int base, IsUnsigned<true>) + { + if (a == 0) + return "0"; +- bool negate = false; +- if (a < 0) +- { +- negate = true; +- a = 0-a; // VC .NET does not like -a +- } + std::string result; + while (a > 0) + { +@@ -423,11 +419,30 @@ + result = char((digit < 10 ? '0' : ('a' - 10)) + digit) + result; + a /= base; + } ++ return result; ++} ++ ++template <class T> ++std::string IntToStringImpl(T a, unsigned int base, IsUnsigned<false>) ++{ ++ bool negate = false; ++ if (a < 0) ++ { ++ negate = true; ++ a = 0-a; // VC .NET does not like -a ++ } ++ std::string result = IntToStringImpl(a, base, IsUnsigned<true>()); + if (negate) + result = "-" + result; + return result; + } + ++template <class T> ++std::string IntToString(T a, unsigned int base = 10) ++{ ++ return IntToStringImpl(a, base, IsUnsigned<(static_cast<T>(-1) > 0)>()); ++} ++ + template <class T1, class T2> + inline T1 SaturatingSubtract(const T1 &a, const T2 &b) + { diff --git a/security/cryptopp/files/patch-nbtheory.cpp b/security/cryptopp/files/patch-nbtheory.cpp new file mode 100644 index 000000000000..9ef5cf616ba2 --- /dev/null +++ b/security/cryptopp/files/patch-nbtheory.cpp @@ -0,0 +1,21 @@ +--- nbtheory.cpp.orig 2013-05-22 00:16:26.761193859 +0000 ++++ nbtheory.cpp 2013-05-22 00:15:29.401256454 +0000 +@@ -307,7 +307,18 @@ + + bool PrimeSieve::NextCandidate(Integer &c) + { ++#if defined(__clang__) && defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 1101 ++ // Workaround for a bug in libc++ in std::find on std::vector<bool> ++ std::vector<bool>::iterator pos = m_sieve.begin()+m_next; ++ for (std::vector<bool>::iterator end = m_sieve.end(); pos != end; ++pos) ++ { ++ if (*pos == false) ++ break; ++ } ++ bool safe = SafeConvert(pos - m_sieve.begin(), m_next); ++#else + bool safe = SafeConvert(std::find(m_sieve.begin()+m_next, m_sieve.end(), false) - m_sieve.begin(), m_next); ++#endif + assert(safe); + if (m_next == m_sieve.size()) + { |