| * Copyright (C) the libgit2 contributors. All rights reserved. |
| * This file is part of libgit2, distributed under the GNU GPL v2 with |
| * a Linking Exception. For full terms see the included COPYING file. |
| #ifndef INCLUDE_hash_hash_openssl_h__ |
| #define INCLUDE_hash_hash_openssl_h__ |
| #define git_hash_ctx_init(ctx) git_hash_init(ctx) |
| #define git_hash_ctx_cleanup(ctx) |
| GIT_INLINE(int) git_hash_global_init(void) |
| GIT_INLINE(int) git_hash_init(git_hash_ctx *ctx) |
| if (SHA1_Init(&ctx->c) != 1) { |
| git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to initialize hash context"); |
| GIT_INLINE(int) git_hash_update(git_hash_ctx *ctx, const void *data, size_t len) |
| if (SHA1_Update(&ctx->c, data, len) != 1) { |
| git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to update hash"); |
| GIT_INLINE(int) git_hash_final(git_oid *out, git_hash_ctx *ctx) |
| if (SHA1_Final(out->id, &ctx->c) != 1) { |
| git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to finalize hash"); |