From bf3da45968aed13243f818089e1fa0224b39e6c0 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 17 Jul 2017 12:16:25 -0400 Subject: [PATCH] Prepare Pycryptopp for Crypto++ changes for byte The Crypto++ library is getting ready to change the scope of its definition for a byte. The short of it is, Crypto++ byte and C++17 std::byte can cause compile failures due to ambiguous resolutions; and the behavior of byte and std::byte are incompatible. More information can be found at: std::byte (https://www.cryptopp.com/wiki/Std::byte) on the Crypto++ wiki Issue 442, Test C++17 byte change with dry runs from various projects (https://github.com/weidai11/cryptopp/issues/442) --- src/pycryptopp/cipher/aesmodule.cpp | 3 +++ src/pycryptopp/cipher/xsalsa20module.cpp | 3 +++ src/pycryptopp/hash/sha256module.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/pycryptopp/cipher/aesmodule.cpp b/src/pycryptopp/cipher/aesmodule.cpp index 360827d..3d0b95a 100644 --- a/src/pycryptopp/cipher/aesmodule.cpp +++ b/src/pycryptopp/cipher/aesmodule.cpp @@ -20,6 +20,9 @@ typedef int Py_ssize_t; #include #endif +// https://github.com/weidai11/cryptopp/issues/442 +typedef unsigned char byte; + static const char*const aes___doc__ = "_aes counter mode cipher\n\ You are advised to run aes.start_up_self_test() after importing this module."; diff --git a/src/pycryptopp/cipher/xsalsa20module.cpp b/src/pycryptopp/cipher/xsalsa20module.cpp index ab29787..a0b7c71 100644 --- a/src/pycryptopp/cipher/xsalsa20module.cpp +++ b/src/pycryptopp/cipher/xsalsa20module.cpp @@ -16,6 +16,9 @@ typedef int Py_ssize_t; #include #endif +// https://github.com/weidai11/cryptopp/issues/442 +typedef unsigned char byte; + static const char* const xsalsa20__doc__ = "_xsalsa20 cipher"; static PyObject *xsalsa20_error; diff --git a/src/pycryptopp/hash/sha256module.cpp b/src/pycryptopp/hash/sha256module.cpp index bf9d8e3..8272e6c 100644 --- a/src/pycryptopp/hash/sha256module.cpp +++ b/src/pycryptopp/hash/sha256module.cpp @@ -21,6 +21,9 @@ typedef int Py_ssize_t; #include #endif +// https://github.com/weidai11/cryptopp/issues/442 +typedef unsigned char byte; + static const char*const sha256___doc__ = "_sha256 hash function"; static PyObject *sha256_error;