diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-12-12 13:19:36 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-01-22 19:14:03 -0500 |
commit | dae714df3f624ce007cec59839f86b0f4d07a357 (patch) | |
tree | 77127cfa1ea47d929039f3eebcbed63f430392d3 | |
parent | 848dc9d1cd2a260ac1a16e3cc52fa7e3c4065e50 (diff) | |
download | libgit2-dae714df3f624ce007cec59839f86b0f4d07a357.tar.gz |
sha1: refactor folder structure
Eliminate the `sha1` folder, move it down into `hash` so that future
impelmentations can share common code.
-rw-r--r-- | src/CMakeLists.txt | 14 | ||||
-rw-r--r-- | src/hash.h | 2 | ||||
-rw-r--r-- | src/hash/collisiondetect.c (renamed from src/hash/sha1/collisiondetect.c) | 0 | ||||
-rw-r--r-- | src/hash/collisiondetect.h (renamed from src/hash/sha1/collisiondetect.h) | 6 | ||||
-rw-r--r-- | src/hash/common_crypto.c (renamed from src/hash/sha1/common_crypto.c) | 0 | ||||
-rw-r--r-- | src/hash/common_crypto.h (renamed from src/hash/sha1/common_crypto.h) | 6 | ||||
-rw-r--r-- | src/hash/mbedtls.c (renamed from src/hash/sha1/mbedtls.c) | 0 | ||||
-rw-r--r-- | src/hash/mbedtls.h (renamed from src/hash/sha1/mbedtls.h) | 6 | ||||
-rw-r--r-- | src/hash/openssl.c (renamed from src/hash/sha1/openssl.c) | 0 | ||||
-rw-r--r-- | src/hash/openssl.h (renamed from src/hash/sha1/openssl.h) | 6 | ||||
-rw-r--r-- | src/hash/sha.h (renamed from src/hash/sha1.h) | 16 | ||||
-rw-r--r-- | src/hash/sha1dc/sha1.c (renamed from src/hash/sha1/sha1dc/sha1.c) | 0 | ||||
-rw-r--r-- | src/hash/sha1dc/sha1.h (renamed from src/hash/sha1/sha1dc/sha1.h) | 0 | ||||
-rw-r--r-- | src/hash/sha1dc/ubc_check.c (renamed from src/hash/sha1/sha1dc/ubc_check.c) | 0 | ||||
-rw-r--r-- | src/hash/sha1dc/ubc_check.h (renamed from src/hash/sha1/sha1dc/ubc_check.h) | 0 | ||||
-rw-r--r-- | src/hash/win32.c (renamed from src/hash/sha1/win32.c) | 0 | ||||
-rw-r--r-- | src/hash/win32.h (renamed from src/hash/sha1/win32.h) | 6 |
17 files changed, 32 insertions, 30 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 34ee95ef2..51e915b35 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -99,18 +99,18 @@ include(SelectZlib) if(USE_SHA1 STREQUAL "CollisionDetection") - file(GLOB SRC_SHA1 hash/sha1/collisiondetect.* hash/sha1/sha1dc/*) + file(GLOB SRC_SHA1 hash/collisiondetect.* hash/sha1dc/*) elseif(USE_SHA1 STREQUAL "OpenSSL") - file(GLOB SRC_SHA1 hash/sha1/openssl.*) + file(GLOB SRC_SHA1 hash/openssl.*) elseif(USE_SHA1 STREQUAL "CommonCrypto") - file(GLOB SRC_SHA1 hash/sha1/common_crypto.*) + file(GLOB SRC_SHA1 hash/common_crypto.*) elseif(USE_SHA1 STREQUAL "mbedTLS") - file(GLOB SRC_SHA1 hash/sha1/mbedtls.*) + file(GLOB SRC_SHA1 hash/mbedtls.*) elseif(USE_SHA1 STREQUAL "Win32") - file(GLOB SRC_SHA1 hash/sha1/win32.*) + file(GLOB SRC_SHA1 hash/win32.*) endif() -list(APPEND SRC_SHA1 "hash/sha1.h") -target_sources(git2internal PRIVATE ${SRC_SHA1}) + +target_sources(git2internal PRIVATE ${SRC_SHA1} "hash/sha.h") # Optional external dependency: ntlmclient if(USE_NTLMCLIENT) diff --git a/src/hash.h b/src/hash.h index 2b2eaf6d6..0e987c539 100644 --- a/src/hash.h +++ b/src/hash.h @@ -10,7 +10,7 @@ #include "common.h" -#include "hash/sha1.h" +#include "hash/sha.h" typedef struct { void *data; diff --git a/src/hash/sha1/collisiondetect.c b/src/hash/collisiondetect.c index ec7059c4c..ec7059c4c 100644 --- a/src/hash/sha1/collisiondetect.c +++ b/src/hash/collisiondetect.c diff --git a/src/hash/sha1/collisiondetect.h b/src/hash/collisiondetect.h index eb88e86c1..8de550230 100644 --- a/src/hash/sha1/collisiondetect.h +++ b/src/hash/collisiondetect.h @@ -5,10 +5,10 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_sha1_collisiondetect_h__ -#define INCLUDE_hash_sha1_collisiondetect_h__ +#ifndef INCLUDE_hash_collisiondetect_h__ +#define INCLUDE_hash_collisiondetect_h__ -#include "hash/sha1.h" +#include "hash/sha.h" #include "sha1dc/sha1.h" diff --git a/src/hash/sha1/common_crypto.c b/src/hash/common_crypto.c index 9d608f449..9d608f449 100644 --- a/src/hash/sha1/common_crypto.c +++ b/src/hash/common_crypto.c diff --git a/src/hash/sha1/common_crypto.h b/src/hash/common_crypto.h index a5fcfb33e..5b92f0fa0 100644 --- a/src/hash/sha1/common_crypto.h +++ b/src/hash/common_crypto.h @@ -5,10 +5,10 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_sha1_common_crypto_h__ -#define INCLUDE_hash_sha1_common_crypto_h__ +#ifndef INCLUDE_hash_common_crypto_h__ +#define INCLUDE_hash_common_crypto_h__ -#include "hash/sha1.h" +#include "hash/sha.h" #include <CommonCrypto/CommonDigest.h> diff --git a/src/hash/sha1/mbedtls.c b/src/hash/mbedtls.c index 56016bec8..56016bec8 100644 --- a/src/hash/sha1/mbedtls.c +++ b/src/hash/mbedtls.c diff --git a/src/hash/sha1/mbedtls.h b/src/hash/mbedtls.h index 15f7462a4..efe9c07a5 100644 --- a/src/hash/sha1/mbedtls.h +++ b/src/hash/mbedtls.h @@ -5,10 +5,10 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_sha1_mbedtls_h__ -#define INCLUDE_hash_sha1_mbedtls_h__ +#ifndef INCLUDE_hash_mbedtls_h__ +#define INCLUDE_hash_mbedtls_h__ -#include "hash/sha1.h" +#include "hash/sha.h" #include <mbedtls/sha1.h> diff --git a/src/hash/sha1/openssl.c b/src/hash/openssl.c index 64bf99b3c..64bf99b3c 100644 --- a/src/hash/sha1/openssl.c +++ b/src/hash/openssl.c diff --git a/src/hash/sha1/openssl.h b/src/hash/openssl.h index a223ca03e..5fa42b82d 100644 --- a/src/hash/sha1/openssl.h +++ b/src/hash/openssl.h @@ -5,10 +5,10 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_sha1_openssl_h__ -#define INCLUDE_hash_sha1_openssl_h__ +#ifndef INCLUDE_hash_openssl_h__ +#define INCLUDE_hash_openssl_h__ -#include "hash/sha1.h" +#include "hash/sha.h" #include <openssl/sha.h> diff --git a/src/hash/sha1.h b/src/hash/sha.h index ca3ecdcd3..973687001 100644 --- a/src/hash/sha1.h +++ b/src/hash/sha.h @@ -5,23 +5,25 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_sha1_h__ -#define INCLUDE_hash_sha1_h__ +#ifndef INCLUDE_hash_sha_h__ +#define INCLUDE_hash_sha_h__ #include "common.h" typedef struct git_hash_sha1_ctx git_hash_sha1_ctx; #if defined(GIT_SHA1_COMMON_CRYPTO) -# include "sha1/common_crypto.h" +# include "common_crypto.h" #elif defined(GIT_SHA1_OPENSSL) -# include "sha1/openssl.h" +# include "openssl.h" #elif defined(GIT_SHA1_WIN32) -# include "sha1/win32.h" +# include "win32.h" #elif defined(GIT_SHA1_MBEDTLS) -# include "sha1/mbedtls.h" +# include "mbedtls.h" +#elif defined(GIT_SHA1_COLLISIONDETECT) +# include "collisiondetect.h" #else -# include "sha1/collisiondetect.h" +# error "unknown sha1 implementation" #endif #define GIT_HASH_SHA1_SIZE 20 diff --git a/src/hash/sha1/sha1dc/sha1.c b/src/hash/sha1dc/sha1.c index 929822728..929822728 100644 --- a/src/hash/sha1/sha1dc/sha1.c +++ b/src/hash/sha1dc/sha1.c diff --git a/src/hash/sha1/sha1dc/sha1.h b/src/hash/sha1dc/sha1.h index 1e4e94be5..1e4e94be5 100644 --- a/src/hash/sha1/sha1dc/sha1.h +++ b/src/hash/sha1dc/sha1.h diff --git a/src/hash/sha1/sha1dc/ubc_check.c b/src/hash/sha1dc/ubc_check.c index b3beff2af..b3beff2af 100644 --- a/src/hash/sha1/sha1dc/ubc_check.c +++ b/src/hash/sha1dc/ubc_check.c diff --git a/src/hash/sha1/sha1dc/ubc_check.h b/src/hash/sha1dc/ubc_check.h index d7e17dc73..d7e17dc73 100644 --- a/src/hash/sha1/sha1dc/ubc_check.h +++ b/src/hash/sha1dc/ubc_check.h diff --git a/src/hash/sha1/win32.c b/src/hash/win32.c index b89dfbad8..b89dfbad8 100644 --- a/src/hash/sha1/win32.c +++ b/src/hash/win32.c diff --git a/src/hash/sha1/win32.h b/src/hash/win32.h index 791d20a42..79f603380 100644 --- a/src/hash/sha1/win32.h +++ b/src/hash/win32.h @@ -5,10 +5,10 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_sha1_win32_h__ -#define INCLUDE_hash_sha1_win32_h__ +#ifndef INCLUDE_hash_win32_h__ +#define INCLUDE_hash_win32_h__ -#include "hash/sha1.h" +#include "hash/sha.h" #include <wincrypt.h> #include <strsafe.h> |