From e2a9429979aecbdf828441206a0ec5ce4eadc16c Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Sat, 23 Sep 2023 07:00:33 +0200 Subject: SHA256 is available only in test program --- src/SBaseCommon.cpp | 1 - src/StormLib.h | 4 ---- test/StormTest.cpp | 6 ++++++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/SBaseCommon.cpp b/src/SBaseCommon.cpp index 664d4b0..cb78bb5 100644 --- a/src/SBaseCommon.cpp +++ b/src/SBaseCommon.cpp @@ -244,7 +244,6 @@ void InitializeMpqCryptography() } // Also register both MD5 and SHA1 hash algorithms - register_hash(&sha256_desc); register_hash(&sha1_desc); register_hash(&md5_desc); diff --git a/src/StormLib.h b/src/StormLib.h index 0bab24e..4d5992d 100644 --- a/src/StormLib.h +++ b/src/StormLib.h @@ -403,10 +403,6 @@ extern "C" { #define SHA1_DIGEST_SIZE 0x14 // 160 bits #endif -#ifndef SHA256_DIGEST_SIZE -#define SHA256_DIGEST_SIZE 0x20 // 256 bits -#endif - #ifndef LANG_NEUTRAL #define LANG_NEUTRAL 0x00 // Neutral locale #endif diff --git a/test/StormTest.cpp b/test/StormTest.cpp index c25ec84..035642f 100755 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -44,6 +44,9 @@ // Artificial flag for not reporting open failure #define MPQ_OPEN_DONT_REPORT_FAILURE 0x80000000 +// Size of SHA256, in bytes +#define SHA256_DIGEST_SIZE 0x20 + typedef DWORD (*FS_SEARCH_CALLBACK)(LPCTSTR szFullPath, void * lpContext); typedef enum _EXTRA_TYPE @@ -838,6 +841,9 @@ static DWORD InitializeMpqDirectory(TCHAR * argv[], int argc) LPCTSTR szWhereFrom = _T("default"); LPCTSTR szDirName = WORK_PATH_ROOT; + // Make sure SHA256 works in test program + register_hash(&sha256_desc); + // Retrieve the first argument if(argc > 1 && argv[1] != NULL) { -- cgit v1.2.3