summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config_int.h21
-rw-r--r--config_misc.h5
-rw-r--r--cryptlib.h7
3 files changed, 29 insertions, 4 deletions
diff --git a/config_int.h b/config_int.h
index 2f74480f..d71c08ef 100644
--- a/config_int.h
+++ b/config_int.h
@@ -27,6 +27,16 @@
#include "config_ns.h"
#include "config_ver.h"
+#include "config_misc.h"
+
+// C5264 new for VS2022/v17.4, MSC v14.34
+// https://github.com/weidai11/cryptopp/issues/1185
+#if (CRYPTOPP_MSC_VERSION)
+# pragma warning(push)
+# if (CRYPTOPP_MSC_VERSION >= 1434)
+# pragma warning(disable: 5264)
+# endif
+#endif
/// \brief Library byte guard
/// \details CRYPTOPP_NO_GLOBAL_BYTE indicates <tt>byte</tt> is in the Crypto++
@@ -161,7 +171,7 @@ typedef word64 lword;
/// \details LWORD_MAX is the maximum value for large word types.
/// Since an <tt>lword</tt> is an unsigned type, the value is
/// <tt>0xffffffffffffffff</tt>. W64LIT will append the proper suffix.
-const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
+CRYPTOPP_CONST_OR_CONSTEXPR lword LWORD_MAX = W64LIT(0xffffffffffffffff);
#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
/// \brief Half word used for multiprecision integer arithmetic
@@ -242,12 +252,17 @@ const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
/// \brief Size of a platform word in bytes
/// \details The size of a platform word, in bytes
-const unsigned int WORD_SIZE = sizeof(word);
+CRYPTOPP_CONST_OR_CONSTEXPR unsigned int WORD_SIZE = sizeof(word);
/// \brief Size of a platform word in bits
/// \details The size of a platform word, in bits
-const unsigned int WORD_BITS = WORD_SIZE * 8;
+/// \sa https://github.com/weidai11/cryptopp/issues/1185
+CRYPTOPP_CONST_OR_CONSTEXPR unsigned int WORD_BITS = WORD_SIZE * 8;
NAMESPACE_END
+#if (CRYPTOPP_MSC_VERSION)
+# pragma warning(pop)
+#endif
+
#endif // CRYPTOPP_CONFIG_INT_H
diff --git a/config_misc.h b/config_misc.h
index 67b2d4ab..cf398b16 100644
--- a/config_misc.h
+++ b/config_misc.h
@@ -145,11 +145,16 @@
#endif
// http://stackoverflow.com/a/13867690/608639
+// CRYPTOPP_CONST_OR_CONSTEXPR due to https://github.com/weidai11/cryptopp/issues/1185
#if defined(CRYPTOPP_CXX11_CONSTEXPR)
# define CRYPTOPP_STATIC_CONSTEXPR static constexpr
+# define CRYPTOPP_STATIC_CONST_OR_CONSTEXPR static constexpr
+# define CRYPTOPP_CONST_OR_CONSTEXPR constexpr
# define CRYPTOPP_CONSTEXPR constexpr
#else
# define CRYPTOPP_STATIC_CONSTEXPR static
+# define CRYPTOPP_STATIC_CONST_OR_CONSTEXPR static const
+# define CRYPTOPP_CONST_OR_CONSTEXPR const
# define CRYPTOPP_CONSTEXPR
#endif // CRYPTOPP_CXX11_CONSTEXPR
diff --git a/cryptlib.h b/cryptlib.h
index 5d8792d6..a528b780 100644
--- a/cryptlib.h
+++ b/cryptlib.h
@@ -106,9 +106,14 @@ and getting us started on the manual.
#include "stdcpp.h"
#include "trap.h"
+// C5264 new for VS2022/v17.4, MSC v14.34
+// https://github.com/weidai11/cryptopp/issues/1185
#if CRYPTOPP_MSC_VERSION
# pragma warning(push)
# pragma warning(disable: 4127 4189 4505 4702)
+# if (CRYPTOPP_MSC_VERSION >= 1434)
+# pragma warning(disable: 5264)
+# endif
#endif
NAMESPACE_BEGIN(CryptoPP)
@@ -127,7 +132,7 @@ enum CipherDir {
DECRYPTION};
/// \brief Represents infinite time
-const unsigned long INFINITE_TIME = ULONG_MAX;
+CRYPTOPP_CONST_OR_CONSTEXPR unsigned long INFINITE_TIME = ULONG_MAX;
// VC60 workaround: using enums as template parameters causes problems
/// \brief Converts an enumeration to a type suitable for use as a template parameter