summaryrefslogtreecommitdiffstats
path: root/Utilities
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-11-10 20:48:41 (GMT)
committerBrad King <brad.king@kitware.com>2016-11-10 20:48:41 (GMT)
commit7a79f7e3c13d3f1c87db40c3230716dcb79d0df9 (patch)
tree8834e8f61334876a66a5797a2d367e8b586a4ab5 /Utilities
parent87584b5e9d4bb3147de4ad2adac2d337be456a62 (diff)
downloadCMake-7a79f7e3c13d3f1c87db40c3230716dcb79d0df9.zip
CMake-7a79f7e3c13d3f1c87db40c3230716dcb79d0df9.tar.gz
CMake-7a79f7e3c13d3f1c87db40c3230716dcb79d0df9.tar.bz2
librhash: Activate SHA-3 implementation
Diffstat (limited to 'Utilities')
-rw-r--r--Utilities/cmlibrhash/CMakeLists.txt2
-rw-r--r--Utilities/cmlibrhash/librhash/algorithms.c6
-rw-r--r--Utilities/cmlibrhash/librhash/rhash.h12
3 files changed, 15 insertions, 5 deletions
diff --git a/Utilities/cmlibrhash/CMakeLists.txt b/Utilities/cmlibrhash/CMakeLists.txt
index 340d946..aa28055 100644
--- a/Utilities/cmlibrhash/CMakeLists.txt
+++ b/Utilities/cmlibrhash/CMakeLists.txt
@@ -23,6 +23,8 @@ set(librhash_sources
librhash/sha1.h
librhash/sha256.c
librhash/sha256.h
+ librhash/sha3.c
+ librhash/sha3.h
librhash/sha512.c
librhash/sha512.h
librhash/ustd.h
diff --git a/Utilities/cmlibrhash/librhash/algorithms.c b/Utilities/cmlibrhash/librhash/algorithms.c
index 56d20b8..fc01690 100644
--- a/Utilities/cmlibrhash/librhash/algorithms.c
+++ b/Utilities/cmlibrhash/librhash/algorithms.c
@@ -39,8 +39,8 @@
#include "sha1.h"
#include "sha256.h"
#include "sha512.h"
-#if 0
#include "sha3.h"
+#if 0
#include "tiger.h"
#include "tth.h"
#include "whirlpool.h"
@@ -104,11 +104,11 @@ rhash_info info_sha512 = { RHASH_SHA512, F_BE64, 64, "SHA-512", "sha512" };
#if 0
rhash_info info_edr256 = { RHASH_EDONR256, F_LE32, 32, "EDON-R256", "edon-r256" };
rhash_info info_edr512 = { RHASH_EDONR512, F_LE64, 64, "EDON-R512", "edon-r512" };
+#endif
rhash_info info_sha3_224 = { RHASH_SHA3_224, F_LE64, 28, "SHA3-224", "sha3-224" };
rhash_info info_sha3_256 = { RHASH_SHA3_256, F_LE64, 32, "SHA3-256", "sha3-256" };
rhash_info info_sha3_384 = { RHASH_SHA3_384, F_LE64, 48, "SHA3-384", "sha3-384" };
rhash_info info_sha3_512 = { RHASH_SHA3_512, F_LE64, 64, "SHA3-512", "sha3-512" };
-#endif
/* some helper macros */
#define dgshft(name) (((char*)&((name##_ctx*)0)->hash) - (char*)0)
@@ -148,11 +148,11 @@ rhash_hash_info rhash_hash_info_default[RHASH_HASH_COUNT] =
#if 0
{ &info_edr256, sizeof(edonr_ctx), dgshft2(edonr, u.data256.hash) + 32, iuf(rhash_edonr256), 0 }, /* 256 bit */
{ &info_edr512, sizeof(edonr_ctx), dgshft2(edonr, u.data512.hash) + 64, iuf(rhash_edonr512), 0 }, /* 512 bit */
+#endif
{ &info_sha3_224, sizeof(sha3_ctx), dgshft(sha3), ini(rhash_sha3_224), upd(rhash_sha3), fin(rhash_sha3), 0 }, /* 224 bit */
{ &info_sha3_256, sizeof(sha3_ctx), dgshft(sha3), ini(rhash_sha3_256), upd(rhash_sha3), fin(rhash_sha3), 0 }, /* 256 bit */
{ &info_sha3_384, sizeof(sha3_ctx), dgshft(sha3), ini(rhash_sha3_384), upd(rhash_sha3), fin(rhash_sha3), 0 }, /* 384 bit */
{ &info_sha3_512, sizeof(sha3_ctx), dgshft(sha3), ini(rhash_sha3_512), upd(rhash_sha3), fin(rhash_sha3), 0 }, /* 512 bit */
-#endif
};
/**
diff --git a/Utilities/cmlibrhash/librhash/rhash.h b/Utilities/cmlibrhash/librhash/rhash.h
index 1ac6265..cee0e25 100644
--- a/Utilities/cmlibrhash/librhash/rhash.h
+++ b/Utilities/cmlibrhash/librhash/rhash.h
@@ -66,14 +66,22 @@ enum rhash_ids
RHASH_SHA256 = 0x08,
RHASH_SHA384 = 0x10,
RHASH_SHA512 = 0x20,
+ RHASH_SHA3_224 = 0x40,
+ RHASH_SHA3_256 = 0x80,
+ RHASH_SHA3_384 = 0x100,
+ RHASH_SHA3_512 = 0x200,
RHASH_ALL_HASHES =
RHASH_MD5 |
RHASH_SHA1 |
RHASH_SHA224 |
RHASH_SHA256 |
RHASH_SHA384 |
- RHASH_SHA512,
- RHASH_HASH_COUNT = 6
+ RHASH_SHA512 |
+ RHASH_SHA3_224 |
+ RHASH_SHA3_256 |
+ RHASH_SHA3_384 |
+ RHASH_SHA3_512,
+ RHASH_HASH_COUNT = 10
#endif
};