Merge branch 'ew/hash-with-openssl-evp'
Fix-up new-ish code to support OpenSSL EVP API. * ew/hash-with-openssl-evp: treewide: fix various bugs w/ OpenSSL 3+ EVP APImaint
commit
331f20d52d
|
@ -1102,6 +1102,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
|
||||||
|| (pack_size + PACK_SIZE_THRESHOLD + len) < pack_size)
|
|| (pack_size + PACK_SIZE_THRESHOLD + len) < pack_size)
|
||||||
cycle_packfile();
|
cycle_packfile();
|
||||||
|
|
||||||
|
the_hash_algo->init_fn(&checkpoint.ctx);
|
||||||
hashfile_checkpoint(pack_file, &checkpoint);
|
hashfile_checkpoint(pack_file, &checkpoint);
|
||||||
offset = checkpoint.offset;
|
offset = checkpoint.offset;
|
||||||
|
|
||||||
|
|
|
@ -1166,6 +1166,7 @@ static void parse_pack_objects(unsigned char *hash)
|
||||||
struct ofs_delta_entry *ofs_delta = ofs_deltas;
|
struct ofs_delta_entry *ofs_delta = ofs_deltas;
|
||||||
struct object_id ref_delta_oid;
|
struct object_id ref_delta_oid;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
git_hash_ctx tmp_ctx;
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
progress = start_progress(
|
progress = start_progress(
|
||||||
|
@ -1202,7 +1203,9 @@ static void parse_pack_objects(unsigned char *hash)
|
||||||
|
|
||||||
/* Check pack integrity */
|
/* Check pack integrity */
|
||||||
flush();
|
flush();
|
||||||
the_hash_algo->final_fn(hash, &input_ctx);
|
the_hash_algo->init_fn(&tmp_ctx);
|
||||||
|
the_hash_algo->clone_fn(&tmp_ctx, &input_ctx);
|
||||||
|
the_hash_algo->final_fn(hash, &tmp_ctx);
|
||||||
if (!hasheq(fill(the_hash_algo->rawsz), hash))
|
if (!hasheq(fill(the_hash_algo->rawsz), hash))
|
||||||
die(_("pack is corrupted (SHA1 mismatch)"));
|
die(_("pack is corrupted (SHA1 mismatch)"));
|
||||||
use(the_hash_algo->rawsz);
|
use(the_hash_algo->rawsz);
|
||||||
|
|
|
@ -609,6 +609,7 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix UNUSED)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
|
git_hash_ctx tmp_ctx;
|
||||||
|
|
||||||
disable_replace_refs();
|
disable_replace_refs();
|
||||||
|
|
||||||
|
@ -669,7 +670,9 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix UNUSED)
|
||||||
the_hash_algo->init_fn(&ctx);
|
the_hash_algo->init_fn(&ctx);
|
||||||
unpack_all();
|
unpack_all();
|
||||||
the_hash_algo->update_fn(&ctx, buffer, offset);
|
the_hash_algo->update_fn(&ctx, buffer, offset);
|
||||||
the_hash_algo->final_oid_fn(&oid, &ctx);
|
the_hash_algo->init_fn(&tmp_ctx);
|
||||||
|
the_hash_algo->clone_fn(&tmp_ctx, &ctx);
|
||||||
|
the_hash_algo->final_oid_fn(&oid, &tmp_ctx);
|
||||||
if (strict) {
|
if (strict) {
|
||||||
write_rest();
|
write_rest();
|
||||||
if (fsck_finish(&fsck_options))
|
if (fsck_finish(&fsck_options))
|
||||||
|
|
|
@ -268,6 +268,7 @@ static int deflate_to_pack(struct bulk_checkin_packfile *state,
|
||||||
type, size);
|
type, size);
|
||||||
the_hash_algo->init_fn(&ctx);
|
the_hash_algo->init_fn(&ctx);
|
||||||
the_hash_algo->update_fn(&ctx, obuf, header_len);
|
the_hash_algo->update_fn(&ctx, obuf, header_len);
|
||||||
|
the_hash_algo->init_fn(&checkpoint.ctx);
|
||||||
|
|
||||||
/* Note: idx is non-NULL when we are writing */
|
/* Note: idx is non-NULL when we are writing */
|
||||||
if ((flags & HASH_WRITE_OBJECT) != 0)
|
if ((flags & HASH_WRITE_OBJECT) != 0)
|
||||||
|
|
|
@ -207,7 +207,7 @@ int hashfile_truncate(struct hashfile *f, struct hashfile_checkpoint *checkpoint
|
||||||
lseek(f->fd, offset, SEEK_SET) != offset)
|
lseek(f->fd, offset, SEEK_SET) != offset)
|
||||||
return -1;
|
return -1;
|
||||||
f->total = offset;
|
f->total = offset;
|
||||||
f->ctx = checkpoint->ctx;
|
the_hash_algo->clone_fn(&f->ctx, &checkpoint->ctx);
|
||||||
f->offset = 0; /* hashflush() was called in checkpoint */
|
f->offset = 0; /* hashflush() was called in checkpoint */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue