]> wimlib.net Git - wimlib/blobdiff - src/resource.c
SHA-1 rework
[wimlib] / src / resource.c
index dd0d2edd09cd2a7f83b1fa11c4149fc234d64b5f..a643ce0340c91e320b85e331c7da1bce7dedd135 100644 (file)
@@ -976,7 +976,7 @@ blobifier_cb(const void *chunk, size_t size, void *_ctx)
 }
 
 struct hasher_context {
-       SHA_CTX sha_ctx;
+       struct sha1_ctx sha_ctx;
        int flags;
        struct read_blob_callbacks cbs;
 };
@@ -1015,8 +1015,8 @@ static int
 report_sha1_mismatch(struct blob_descriptor *blob,
                     const u8 actual_hash[SHA1_HASH_SIZE], bool recover_data)
 {
-       tchar expected_hashstr[SHA1_HASH_SIZE * 2 + 1];
-       tchar actual_hashstr[SHA1_HASH_SIZE * 2 + 1];
+       tchar expected_hashstr[SHA1_HASH_STRING_LEN];
+       tchar actual_hashstr[SHA1_HASH_STRING_LEN];
 
        wimlib_assert(blob->blob_location != BLOB_NONEXISTENT);
        wimlib_assert(blob->blob_location != BLOB_IN_ATTACHED_BUFFER);
@@ -1089,7 +1089,7 @@ hasher_end_blob(struct blob_descriptor *blob, int status, void *_ctx)
        }
 
        /* Retrieve the final SHA-1 message digest.  */
-       sha1_final(hash, &ctx->sha_ctx);
+       sha1_final(&ctx->sha_ctx, hash);
 
        /* Set the SHA-1 message digest of the blob, or compare the calculated
         * value with stored value.  */