summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-11-15 14:26:16 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-11-15 14:26:16 (GMT)
commitb6f1b1741d3a998deb374609133482daf8c26993 (patch)
tree60b9e5181926829881334461bbe7ded5bc489e1f /Source
parent2b7cc7644063778b26e60ab4f07bbfe06b539157 (diff)
parentf636d1e74a5a9d39d2f25b72b26c3d24813a5565 (diff)
downloadCMake-b6f1b1741d3a998deb374609133482daf8c26993.zip
CMake-b6f1b1741d3a998deb374609133482daf8c26993.tar.gz
CMake-b6f1b1741d3a998deb374609133482daf8c26993.tar.bz2
Merge topic 'add-SHA-3'
f636d1e7 Help: Add notes for topic 'add-SHA-3' cb5dba8e Tests: Add SHA-3 algorithm coverage to CPack checksum test a9fa6099 ExternalProject: Add support for SHA-3 algorithms b4ffd26f ExternalData: Add support for SHA-3 algorithms 60939702 file: Add support for SHA-3 algorithms 92f95aed string: Add support for SHA-3 algorithms c326209f cmCryptoHash: Add support for SHA-3 algorithms 979e8ba6 Help: De-duplicate and spell out supported hash algorithms 7a79f7e3 librhash: Activate SHA-3 implementation 87584b5e Merge branch 'upstream-librhash' into add-SHA-3 7fcbd47e librhash 2016-11-06 (de79828d) c50c32a3 librhash: Update import script to add SHA-3 implementation
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCryptoHash.cxx28
-rw-r--r--Source/cmCryptoHash.h9
-rw-r--r--Source/cmFileCommand.cxx4
-rw-r--r--Source/cmStringCommand.cxx4
4 files changed, 35 insertions, 10 deletions
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index f440999..d5807b1 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -9,12 +9,16 @@
static unsigned int const cmCryptoHashAlgoToId[] = {
/* clang-format needs this comment to break after the opening brace */
- RHASH_MD5, //
- RHASH_SHA1, //
- RHASH_SHA224, //
- RHASH_SHA256, //
- RHASH_SHA384, //
- RHASH_SHA512
+ RHASH_MD5, //
+ RHASH_SHA1, //
+ RHASH_SHA224, //
+ RHASH_SHA256, //
+ RHASH_SHA384, //
+ RHASH_SHA512, //
+ RHASH_SHA3_224, //
+ RHASH_SHA3_256, //
+ RHASH_SHA3_384, //
+ RHASH_SHA3_512
};
static int cmCryptoHash_rhash_library_initialized;
@@ -59,6 +63,18 @@ CM_AUTO_PTR<cmCryptoHash> cmCryptoHash::New(const char* algo)
if (strcmp(algo, "SHA512") == 0) {
return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA512));
}
+ if (strcmp(algo, "SHA3_224") == 0) {
+ return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_224));
+ }
+ if (strcmp(algo, "SHA3_256") == 0) {
+ return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_256));
+ }
+ if (strcmp(algo, "SHA3_384") == 0) {
+ return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_384));
+ }
+ if (strcmp(algo, "SHA3_512") == 0) {
+ return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_512));
+ }
return CM_AUTO_PTR<cmCryptoHash>(CM_NULLPTR);
}
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index 95080ac..26d55b3 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -22,7 +22,11 @@ public:
AlgoSHA224,
AlgoSHA256,
AlgoSHA384,
- AlgoSHA512
+ AlgoSHA512,
+ AlgoSHA3_224,
+ AlgoSHA3_256,
+ AlgoSHA3_384,
+ AlgoSHA3_512
};
cmCryptoHash(Algo algo);
@@ -30,7 +34,8 @@ public:
/// @brief Returns a new hash generator of the requested type
/// @arg algo Hash type name. Supported hash types are
- /// MD5, SHA1, SHA224, SHA256, SHA384, SHA512
+ /// MD5, SHA1, SHA224, SHA256, SHA384, SHA512,
+ /// SHA3_224, SHA3_256, SHA3_384, SHA3_512
/// @return A valid auto pointer if algo is supported or
/// an invalid/NULL pointer otherwise
static CM_AUTO_PTR<cmCryptoHash> New(const char* algo);
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 15257fc..c2e37c1 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -111,7 +111,9 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
}
if (subCommand == "MD5" || subCommand == "SHA1" || subCommand == "SHA224" ||
subCommand == "SHA256" || subCommand == "SHA384" ||
- subCommand == "SHA512") {
+ subCommand == "SHA512" || subCommand == "SHA3_224" ||
+ subCommand == "SHA3_256" || subCommand == "SHA3_384" ||
+ subCommand == "SHA3_512") {
return this->HandleHashCommand(args);
}
if (subCommand == "STRINGS") {
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index f835445..603c990 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -36,7 +36,9 @@ bool cmStringCommand::InitialPass(std::vector<std::string> const& args,
}
if (subCommand == "MD5" || subCommand == "SHA1" || subCommand == "SHA224" ||
subCommand == "SHA256" || subCommand == "SHA384" ||
- subCommand == "SHA512") {
+ subCommand == "SHA512" || subCommand == "SHA3_224" ||
+ subCommand == "SHA3_256" || subCommand == "SHA3_384" ||
+ subCommand == "SHA3_512") {
return this->HandleHashCommand(args);
}
if (subCommand == "TOLOWER") {