Commit 36df49c2 by Edward Thomson

sha: GIT_ERROR_SHA1 is deprecated in favor of GIT_ERROR_SHA

The more generic GIT_ERROR_SHA allows for SHA256 errors as well as SHA1.
parent c7b189ba
......@@ -436,6 +436,8 @@ GIT_EXTERN(int) git_diff_format_email_options_init(
#define GITERR_WORKTREE GIT_ERROR_WORKTREE
#define GITERR_SHA1 GIT_ERROR_SHA1
#define GIT_ERROR_SHA1 GIT_ERROR_SHA
/**
* Return the last `git_error` object that was generated for the
* current thread. This is an alias of `git_error_last` and is
......
......@@ -106,7 +106,7 @@ typedef enum {
GIT_ERROR_FILESYSTEM,
GIT_ERROR_PATCH,
GIT_ERROR_WORKTREE,
GIT_ERROR_SHA1,
GIT_ERROR_SHA,
GIT_ERROR_HTTP,
GIT_ERROR_INTERNAL
} git_error_t;
......
......@@ -40,7 +40,7 @@ int git_hash_sha1_final(unsigned char *out, git_hash_sha1_ctx *ctx)
{
GIT_ASSERT_ARG(ctx);
if (SHA1DCFinal(out, &ctx->c)) {
git_error_set(GIT_ERROR_SHA1, "SHA1 collision attack detected");
git_error_set(GIT_ERROR_SHA, "SHA1 collision attack detected");
return -1;
}
......
......@@ -27,7 +27,7 @@ int git_hash_sha1_init(git_hash_sha1_ctx *ctx)
GIT_ASSERT_ARG(ctx);
if (SHA1_Init(&ctx->c) != 1) {
git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to initialize hash context");
git_error_set(GIT_ERROR_SHA, "hash_openssl: failed to initialize hash context");
return -1;
}
......@@ -39,7 +39,7 @@ int git_hash_sha1_update(git_hash_sha1_ctx *ctx, const void *data, size_t len)
GIT_ASSERT_ARG(ctx);
if (SHA1_Update(&ctx->c, data, len) != 1) {
git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to update hash");
git_error_set(GIT_ERROR_SHA, "hash_openssl: failed to update hash");
return -1;
}
......@@ -51,7 +51,7 @@ int git_hash_sha1_final(unsigned char *out, git_hash_sha1_ctx *ctx)
GIT_ASSERT_ARG(ctx);
if (SHA1_Final(out, &ctx->c) != 1) {
git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to finalize hash");
git_error_set(GIT_ERROR_SHA, "hash_openssl: failed to finalize hash");
return -1;
}
......
......@@ -35,7 +35,7 @@ GIT_INLINE(int) hash_cng_prov_init(void)
/* Only use CNG on Windows 2008 / Vista SP1 or better (Windows 6.0 SP1) */
if (!git_has_win32_version(6, 0, 1)) {
git_error_set(GIT_ERROR_SHA1, "CryptoNG is not supported on this platform");
git_error_set(GIT_ERROR_SHA, "CryptoNG is not supported on this platform");
return -1;
}
......@@ -45,7 +45,7 @@ GIT_INLINE(int) hash_cng_prov_init(void)
StringCchCat(dll_path, MAX_PATH, "\\") < 0 ||
StringCchCat(dll_path, MAX_PATH, GIT_HASH_CNG_DLL_NAME) < 0 ||
(hash_prov.prov.cng.dll = LoadLibrary(dll_path)) == NULL) {
git_error_set(GIT_ERROR_SHA1, "CryptoNG library could not be loaded");
git_error_set(GIT_ERROR_SHA, "CryptoNG library could not be loaded");
return -1;
}
......
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