Commit c7b189ba by Edward Thomson

sha1: refactor folder structure

Eliminate the `sha1` folder, move it down into `hash` so that future
impelmentations can share common code.
parent 8bc998f4
...@@ -9,7 +9,7 @@ set(UTIL_INCLUDES ...@@ -9,7 +9,7 @@ set(UTIL_INCLUDES
"${PROJECT_SOURCE_DIR}/src/util" "${PROJECT_SOURCE_DIR}/src/util"
"${PROJECT_SOURCE_DIR}/include") "${PROJECT_SOURCE_DIR}/include")
file(GLOB UTIL_SRC *.c *.h allocators/*.c allocators/*.h hash/sha1.h) file(GLOB UTIL_SRC *.c *.h allocators/*.c allocators/*.h hash.h)
list(SORT UTIL_SRC) list(SORT UTIL_SRC)
# #
...@@ -29,18 +29,18 @@ endif() ...@@ -29,18 +29,18 @@ endif()
# #
if(USE_SHA1 STREQUAL "CollisionDetection") if(USE_SHA1 STREQUAL "CollisionDetection")
file(GLOB UTIL_SRC_HASH hash/sha1/collisiondetect.* hash/sha1/sha1dc/*) file(GLOB UTIL_SRC_HASH hash/collisiondetect.* hash/sha1dc/*)
target_compile_definitions(util PRIVATE SHA1DC_NO_STANDARD_INCLUDES=1) target_compile_definitions(util PRIVATE SHA1DC_NO_STANDARD_INCLUDES=1)
target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_SHA1_C=\"git2_util.h\") target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_SHA1_C=\"git2_util.h\")
target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"git2_util.h\") target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"git2_util.h\")
elseif(USE_SHA1 STREQUAL "OpenSSL") elseif(USE_SHA1 STREQUAL "OpenSSL")
file(GLOB UTIL_SRC_HASH hash/sha1/openssl.*) file(GLOB UTIL_SRC_HASH hash/openssl.*)
elseif(USE_SHA1 STREQUAL "CommonCrypto") elseif(USE_SHA1 STREQUAL "CommonCrypto")
file(GLOB UTIL_SRC_HASH hash/sha1/common_crypto.*) file(GLOB UTIL_SRC_HASH hash/common_crypto.*)
elseif(USE_SHA1 STREQUAL "mbedTLS") elseif(USE_SHA1 STREQUAL "mbedTLS")
file(GLOB UTIL_SRC_HASH hash/sha1/mbedtls.*) file(GLOB UTIL_SRC_HASH hash/mbedtls.*)
elseif(USE_SHA1 STREQUAL "Win32") elseif(USE_SHA1 STREQUAL "Win32")
file(GLOB UTIL_SRC_HASH hash/sha1/win32.*) file(GLOB UTIL_SRC_HASH hash/win32.*)
else() else()
message(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}") message(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}")
endif() endif()
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "git2_util.h" #include "git2_util.h"
#include "hash/sha1.h" #include "hash/sha.h"
typedef struct { typedef struct {
void *data; void *data;
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
* a Linking Exception. For full terms see the included COPYING file. * a Linking Exception. For full terms see the included COPYING file.
*/ */
#ifndef INCLUDE_hash_sha1_collisiondetect_h__ #ifndef INCLUDE_hash_collisiondetect_h__
#define INCLUDE_hash_sha1_collisiondetect_h__ #define INCLUDE_hash_collisiondetect_h__
#include "hash/sha1.h" #include "hash/sha.h"
#include "sha1dc/sha1.h" #include "sha1dc/sha1.h"
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
* a Linking Exception. For full terms see the included COPYING file. * a Linking Exception. For full terms see the included COPYING file.
*/ */
#ifndef INCLUDE_hash_sha1_common_crypto_h__ #ifndef INCLUDE_hash_common_crypto_h__
#define INCLUDE_hash_sha1_common_crypto_h__ #define INCLUDE_hash_common_crypto_h__
#include "hash/sha1.h" #include "hash/sha.h"
#include <CommonCrypto/CommonDigest.h> #include <CommonCrypto/CommonDigest.h>
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
* a Linking Exception. For full terms see the included COPYING file. * a Linking Exception. For full terms see the included COPYING file.
*/ */
#ifndef INCLUDE_hash_sha1_mbedtls_h__ #ifndef INCLUDE_hash_mbedtls_h__
#define INCLUDE_hash_sha1_mbedtls_h__ #define INCLUDE_hash_mbedtls_h__
#include "hash/sha1.h" #include "hash/sha.h"
#include <mbedtls/sha1.h> #include <mbedtls/sha1.h>
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
* a Linking Exception. For full terms see the included COPYING file. * a Linking Exception. For full terms see the included COPYING file.
*/ */
#ifndef INCLUDE_hash_sha1_openssl_h__ #ifndef INCLUDE_hash_openssl_h__
#define INCLUDE_hash_sha1_openssl_h__ #define INCLUDE_hash_openssl_h__
#include "hash/sha1.h" #include "hash/sha.h"
#include <openssl/sha.h> #include <openssl/sha.h>
......
...@@ -5,23 +5,25 @@ ...@@ -5,23 +5,25 @@
* a Linking Exception. For full terms see the included COPYING file. * a Linking Exception. For full terms see the included COPYING file.
*/ */
#ifndef INCLUDE_hash_sha1_h__ #ifndef INCLUDE_hash_sha_h__
#define INCLUDE_hash_sha1_h__ #define INCLUDE_hash_sha_h__
#include "git2_util.h" #include "git2_util.h"
typedef struct git_hash_sha1_ctx git_hash_sha1_ctx; typedef struct git_hash_sha1_ctx git_hash_sha1_ctx;
#if defined(GIT_SHA1_COMMON_CRYPTO) #if defined(GIT_SHA1_COMMON_CRYPTO)
# include "sha1/common_crypto.h" # include "common_crypto.h"
#elif defined(GIT_SHA1_OPENSSL) #elif defined(GIT_SHA1_OPENSSL)
# include "sha1/openssl.h" # include "openssl.h"
#elif defined(GIT_SHA1_WIN32) #elif defined(GIT_SHA1_WIN32)
# include "sha1/win32.h" # include "win32.h"
#elif defined(GIT_SHA1_MBEDTLS) #elif defined(GIT_SHA1_MBEDTLS)
# include "sha1/mbedtls.h" # include "mbedtls.h"
#elif defined(GIT_SHA1_COLLISIONDETECT)
# include "collisiondetect.h"
#else #else
# include "sha1/collisiondetect.h" # error "unknown sha1 implementation"
#endif #endif
#define GIT_HASH_SHA1_SIZE 20 #define GIT_HASH_SHA1_SIZE 20
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
* a Linking Exception. For full terms see the included COPYING file. * a Linking Exception. For full terms see the included COPYING file.
*/ */
#ifndef INCLUDE_hash_sha1_win32_h__ #ifndef INCLUDE_hash_win32_h__
#define INCLUDE_hash_sha1_win32_h__ #define INCLUDE_hash_win32_h__
#include "hash/sha1.h" #include "hash/sha.h"
#include <wincrypt.h> #include <wincrypt.h>
#include <strsafe.h> #include <strsafe.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment