Skip to content

Commit b6e8969

Browse files
committed
Update cryptopp to 5.6.5
1 parent d83fc8f commit b6e8969

File tree

179 files changed

+10645
-5245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+10645
-5245
lines changed

vendor/cryptopp/3way.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,22 @@
77

88
NAMESPACE_BEGIN(CryptoPP)
99

10-
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
10+
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
1111
void ThreeWay_TestInstantiations()
1212
{
1313
ThreeWay::Encryption x1;
1414
ThreeWay::Decryption x2;
1515
}
1616
#endif
1717

18-
static const word32 START_E = 0x0b0b; // round constant of first encryption round
19-
static const word32 START_D = 0xb1b1; // round constant of first decryption round
18+
namespace
19+
{
20+
const word32 START_E = 0x0b0b; // round constant of first encryption round
21+
const word32 START_D = 0xb1b1; // round constant of first decryption round
2022
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
21-
static const word32 RC_MODULUS = 0x11011;
23+
const word32 RC_MODULUS = 0x11011;
2224
#endif
25+
}
2326

2427
static inline word32 reverseBits(word32 a)
2528
{

vendor/cryptopp/CMakeLists.txt

Lines changed: 138 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
# Please ensure your changes or patch meets minimum requirements.
2-
# The minimum requirements are below, and they are 2.8.5. Please
3-
# do not check in something for 2.8.12. To test your changes,
4-
# please set up a Ubuntu 12.04 LTS system. Then, manually install
5-
# Cmake 2.8.5 from http://cmake.org/Wiki/CMake_Released_Versions.
2+
# The minimum requirements are 2.8.5. They roughly equate to Ubuntu 12.04 LTS
3+
# Please do not check in something for 2.8.12 or 3.5.0. To test your changes,
4+
# please set up a Ubuntu 12.04 LTS system. Then, manually install Cmake 2.8.5
5+
# from http://cmake.org/Wiki/CMake_Released_Versions.
66

77
cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
88

99
project(cryptopp)
1010

11+
# Make RelWithDebInfo the default (it does e.g. add '-O2 -g -DNDEBUG' for GNU)
12+
# If not in multi-configuration environments, no explicit build type or CXX
13+
# flags are set by the user and if we are the root CMakeLists.txt file.
14+
if (NOT CMAKE_CONFIGURATION_TYPES AND
15+
NOT CMAKE_NO_BUILD_TYPE AND
16+
NOT CMAKE_BUILD_TYPE AND
17+
NOT CMAKE_CXX_FLAGS AND
18+
CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
19+
set(CMAKE_BUILD_TYPE RelWithDebInfo)
20+
endif()
21+
1122
set(cryptopp_VERSION_MAJOR 5)
1223
set(cryptopp_VERSION_MINOR 6)
13-
set(cryptopp_VERSION_PATCH 4)
24+
set(cryptopp_VERSION_PATCH 5)
1425

1526
include(GNUInstallDirs)
1627
include(TestBigEndian)
28+
include(CheckCXXCompilerFlag)
1729

1830
#============================================================================
1931
# Settable options
@@ -33,13 +45,24 @@ set(CRYPTOPP_DATA_DIR "" CACHE PATH "Crypto++ test data directory")
3345
# Internal compiler options
3446
#============================================================================
3547

48+
# Stop hiding the damn output...
49+
# set(CMAKE_VERBOSE_MAKEFILE on)
50+
51+
# Always 1 ahead in Master. Also see http://groups.google.com/forum/#!topic/cryptopp-users/SFhqLDTQPG4
52+
set(LIB_VER ${cryptopp_VERSION_MAJOR}${cryptopp_VERSION_MINOR}${cryptopp_VERSION_PATCH})
53+
54+
# Only set when cross-compiling, http://www.vtk.org/Wiki/CMake_Cross_Compiling
55+
if (NOT (CMAKE_SYSTEM_VERSION AND CMAKE_SYSTEM_PROCESSOR))
56+
set(CRYPTOPP_CROSS_COMPILE 1)
57+
else()
58+
set(CRYPTOPP_CROSS_COMPILE 0)
59+
endif()
60+
3661
# Don't use RPATH's. The resulting binary could fail a security audit.
3762
if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
3863
set(CMAKE_MACOSX_RPATH 0)
3964
endif()
4065

41-
set(LIB_VER ${cryptopp_VERSION_MAJOR}${cryptopp_VERSION_MINOR}${cryptopp_VERSION_PATCH})
42-
4366
if(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
4467
add_definitions(-wd68 -wd186 -wd279 -wd327 -wd161 -wd3180)
4568
endif()
@@ -63,12 +86,92 @@ if(NOT CRYPTOPP_DATA_DIR STREQUAL "")
6386
add_definitions(-DCRYPTOPP_DATA_DIR="${CRYPTOPP_DATA_DIR}")
6487
endif()
6588

89+
# We need the output 'uname -s' for Unix and Linux system detection
90+
if (NOT CRYPTOPP_CROSS_COMPILE)
91+
set (UNAME_CMD "uname")
92+
set (UNAME_ARG "-s")
93+
execute_process(COMMAND ${UNAME_CMD} ${UNAME_ARG}
94+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
95+
RESULT_VARIABLE UNAME_RESULT
96+
OUTPUT_VARIABLE UNAME_SYSTEM)
97+
string(REGEX REPLACE "\n$" "" UNAME_SYSTEM "${UNAME_SYSTEM}")
98+
endif()
99+
100+
# We need the output 'uname -m' for Unix and Linux platform detection
101+
if (NOT CRYPTOPP_CROSS_COMPILE)
102+
set (UNAME_CMD "uname")
103+
set (UNAME_ARG "-m")
104+
execute_process(COMMAND ${UNAME_CMD} ${UNAME_ARG}
105+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
106+
RESULT_VARIABLE UNAME_RESULT
107+
OUTPUT_VARIABLE UNAME_MACHINE)
108+
string(REGEX REPLACE "\n$" "" UNAME_MACHINE "${UNAME_MACHINE}")
109+
endif()
110+
66111
if(WINDOWS_STORE OR WINDOWS_PHONE)
67112
if("${CMAKE_SYSTEM_VERSION}" MATCHES "10\\.0.*")
68113
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D\"_WIN32_WINNT=0x0A00\"" )
69114
endif()
70115
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FI\"winapifamily.h\"" )
71116
endif()
117+
118+
# Enable PIC for all targets except Windows and 32-bit x86.
119+
# Avoid on 32-bit x86 due to register pressures.
120+
if ((NOT CRYPTOPP_CROSS_COMPILE) AND (NOT (WINDOWS OR WINDOWS_STORE OR WINDOWS_PHONE)))
121+
# Use Regex; match i386, i486, i586 and i686
122+
if (NOT (${UNAME_MACHINE} MATCHES "i.86"))
123+
SET(CMAKE_POSITION_INDEPENDENT_CODE 1)
124+
endif()
125+
endif()
126+
127+
# -march=native for GCC, Clang and ICC in any version that does support it.
128+
if ((NOT CRYPTOPP_CROSS_COMPILE) AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU|Intel"))
129+
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_OPT_ARCH_NATIVE_SUPPORTED)
130+
if (COMPILER_OPT_ARCH_NATIVE_SUPPORTED AND NOT CMAKE_CXX_FLAGS MATCHES "-march=")
131+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
132+
endif()
133+
endif()
134+
135+
# Solaris specific
136+
if ((NOT CRYPTOPP_CROSS_COMPILE) AND "${UNAME_SYSTEM}" STREQUAL "SunOS")
137+
# SunCC needs -native
138+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
139+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -native")
140+
endif()
141+
142+
# Determine 32-bit vs 64-bit
143+
set (ISA_CMD "isainfo")
144+
set (ISA_ARG "-b")
145+
execute_process(COMMAND ${ISA_CMD} ${ISA_ARG}
146+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
147+
RESULT_VARIABLE ISA_RESULT
148+
OUTPUT_VARIABLE ISA_INFO)
149+
string(REGEX REPLACE "\n$" "" ISA_INFO "${ISA_INFO}")
150+
151+
# Set 64-bit or 32-bit
152+
if ("${ISA_INFO}" STREQUAL "64")
153+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
154+
else()
155+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
156+
endif()
157+
158+
# GCC needs to enable use of '/'
159+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
160+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,--divide")
161+
endif()
162+
163+
# SunCC needs -native
164+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
165+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -template=no%extdef")
166+
endif()
167+
endif()
168+
169+
# Link is driven through the compiler, but CXXFLAGS are not used. Also see
170+
# http://public.kitware.com/pipermail/cmake/2003-June/003967.html
171+
if (NOT (WINDOWS OR WINDOWS_STORE OR WINDOWS_PHONE))
172+
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_FLAGS}")
173+
endif()
174+
72175
#============================================================================
73176
# Sources & headers
74177
#============================================================================
@@ -77,13 +180,14 @@ endif()
77180
file(GLOB cryptopp_HEADERS *.h)
78181

79182
# Test sources. You can use the GNUmakefile to generate the list: `make sources`.
80-
file(GLOB cryptopp_SOURCES_TEST bench1.cpp bench2.cpp test.cpp validat1.cpp validat2.cpp validat3.cpp adhoc.cpp datatest.cpp regtest.cpp fipsalgt.cpp dlltest.cpp fipstest.cpp)
183+
file(GLOB cryptopp_SOURCES_TEST test.cpp bench1.cpp bench2.cpp validat1.cpp validat2.cpp validat3.cpp adhoc.cpp datatest.cpp regtest.cpp fipsalgt.cpp dlltest.cpp fipstest.cpp)
81184

82185
# Library sources. You can use the GNUmakefile to generate the list: `make sources`.
83186
file(GLOB cryptopp_SOURCES *.cpp)
84187
list(REMOVE_ITEM cryptopp_SOURCES
85188
${CMAKE_CURRENT_SOURCE_DIR}/cryptlib.cpp
86189
${CMAKE_CURRENT_SOURCE_DIR}/cpu.cpp
190+
${CMAKE_CURRENT_SOURCE_DIR}/integer.cpp
87191
${CMAKE_CURRENT_SOURCE_DIR}/pch.cpp
88192
${CMAKE_CURRENT_SOURCE_DIR}/simple.cpp
89193
${CMAKE_CURRENT_SOURCE_DIR}/winpipes.cpp
@@ -93,6 +197,7 @@ list(REMOVE_ITEM cryptopp_SOURCES
93197
set(cryptopp_SOURCES
94198
${CMAKE_CURRENT_SOURCE_DIR}/cryptlib.cpp
95199
${CMAKE_CURRENT_SOURCE_DIR}/cpu.cpp
200+
${CMAKE_CURRENT_SOURCE_DIR}/integer.cpp
96201
${cryptopp_SOURCES}
97202
)
98203

@@ -157,32 +262,6 @@ if (BUILD_SHARED)
157262
endif()
158263
endif()
159264

160-
# Set PIC
161-
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
162-
# Enables -fPIC on all 64-bit platforms
163-
if(NOT CMAKE_VERSION VERSION_LESS 2.8.9) # POSITION_INDEPENDENT_CODE support
164-
set_target_properties(cryptopp-object PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
165-
elseif(NOT CMAKE_VERSION VERSION_LESS 2.8.8) # Object library support
166-
get_target_property(flags_old cryptopp-object COMPILE_FLAGS)
167-
set_target_properties(cryptopp-object PROPERTIES COMPILE_FLAGS "${flags_old} -fPIC")
168-
else()
169-
if (BUILD_STATIC)
170-
get_target_property(flags_old_static cryptopp-static COMPILE_FLAGS)
171-
if(NOT flags_old_static)
172-
set(flags_old_static "")
173-
endif()
174-
set_target_properties(cryptopp-static PROPERTIES COMPILE_FLAGS "${flags_old_static} -fPIC")
175-
endif()
176-
if (BUILD_SHARED)
177-
get_target_property(flags_old_shared cryptopp-shared COMPILE_FLAGS)
178-
if(NOT flags_old_shared)
179-
set(flags_old_shared "")
180-
endif()
181-
set_target_properties(cryptopp-shared PROPERTIES COMPILE_FLAGS "${flags_old_shared} -fPIC")
182-
endif()
183-
endif()
184-
endif()
185-
186265
# Set filenames for targets to be "cryptopp"
187266
if(NOT MSVC)
188267
set(COMPAT_VERSION ${cryptopp_VERSION_MAJOR}.${cryptopp_VERSION_MINOR})
@@ -213,6 +292,7 @@ endif()
213292
#============================================================================
214293
# Third-party libraries
215294
#============================================================================
295+
216296
if(WIN32)
217297
if (BUILD_STATIC)
218298
target_link_libraries(cryptopp-static ws2_32)
@@ -222,6 +302,16 @@ if(WIN32)
222302
endif()
223303
endif()
224304

305+
# This may need to be expanded to "Solaris"
306+
if ("${UNAME_SYSTEM}" STREQUAL "SunOS")
307+
if (BUILD_STATIC)
308+
target_link_libraries(cryptopp-static nsl socket)
309+
endif()
310+
if (BUILD_SHARED)
311+
target_link_libraries(cryptopp-shared nsl socket)
312+
endif()
313+
endif()
314+
225315
find_package(Threads)
226316
if (BUILD_STATIC)
227317
target_link_libraries(cryptopp-static ${CMAKE_THREAD_LIBS_INIT})
@@ -233,6 +323,7 @@ endif()
233323
#============================================================================
234324
# Tests
235325
#============================================================================
326+
236327
enable_testing()
237328
if(BUILD_TESTING)
238329
add_executable(cryptest ${cryptopp_SOURCES_TEST})
@@ -258,6 +349,7 @@ endif()
258349
#============================================================================
259350
# Doxygen documentation
260351
#============================================================================
352+
261353
if(BUILD_DOCUMENTATION)
262354
find_package(Doxygen REQUIRED)
263355

@@ -282,6 +374,7 @@ endif()
282374
#============================================================================
283375
# Install
284376
#============================================================================
377+
285378
set(export_name "cryptopp-targets")
286379

287380
# Runtime package
@@ -317,8 +410,18 @@ if(BUILD_TESTING)
317410
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/TestVectors DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cryptopp)
318411
endif()
319412

320-
321413
# Documentation
322414
if(BUILD_DOCUMENTATION)
323415
install(DIRECTORY "${out_source_DOCS_DIR}" DESTINATION ${CMAKE_INSTALL_DOCDIR})
324416
endif()
417+
418+
# Print a configuration summary. We want CXX and CXXFLAGS, but they are not includd in ALL.
419+
if (NOT CMAKE_VERSION VERSION_LESS 3.0.2)
420+
include(FeatureSummary)
421+
message(STATUS "Compiler: ${CXX}")
422+
message(STATUS "Flags: ${CMAKE_CXX_FLAGS}")
423+
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
424+
feature_summary(WHAT ALL
425+
VAR cryptoppFeatures)
426+
message(STATUS "${cryptoppFeatures}")
427+
endif()

vendor/cryptopp/Doxyfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ PROJECT_NAME = Crypto++
4141
# could be handy for archiving the generated documentation or if some version
4242
# control system is used.
4343

44-
PROJECT_NUMBER = 5.6.4
44+
PROJECT_NUMBER = 5.6.5
4545

4646
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4747
# for a project that appears at the top of each page and should give viewer a
@@ -819,7 +819,7 @@ EXCLUDE_SYMLINKS = NO
819819
# Note that the wildcards are matched against the file with absolute path, so to
820820
# exclude all test directories for example use the pattern */test/*
821821

822-
EXCLUDE_PATTERNS =
822+
EXCLUDE_PATTERNS = *test* *validat*
823823

824824
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
825825
# (namespaces, classes, functions, etc.) that should be excluded from the

vendor/cryptopp/Filelist.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ channels.h
4848
cmac.cpp
4949
cmac.h
5050
config.h
51-
config.recommend
51+
config.compat
5252
cpu.cpp
5353
cpu.h
5454
crc.cpp
@@ -179,6 +179,7 @@ oaep.h
179179
oids.h
180180
osrng.cpp
181181
osrng.h
182+
ossig.h
182183
panama.cpp
183184
panama.h
184185
pch.cpp
@@ -263,6 +264,7 @@ strciphr.h
263264
tea.cpp
264265
tea.h
265266
test.cpp
267+
trap.h
266268
tftables.cpp
267269
tiger.cpp
268270
tiger.h
@@ -310,8 +312,6 @@ License.txt
310312
Readme.txt
311313
Install.txt
312314
Filelist.txt
313-
CMakeLists.txt
314-
cryptopp-config.cmake
315315
TestData/3desval.dat
316316
TestData/3wayval.dat
317317
TestData/camellia.dat

0 commit comments

Comments
 (0)