diff options
author | Eric Wong <e@80x24.org> | 2023-09-01 05:09:28 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-09-01 08:26:01 +0300 |
commit | e0b8c84240037a592c5bd5f18fc382a98a323bea (patch) | |
tree | de19a4b26a3eca5f83892735cb28aec3223be147 /csum-file.c | |
parent | bda9c12073e786e2ffa2c3ec479c7fe098d49999 (diff) |
treewide: fix various bugs w/ OpenSSL 3+ EVP API
The OpenSSL 3+ EVP API for SHA-* cannot support our prior use cases
supported by other SHA-* implementations. It has the following
differences:
1. ->init_fn is required before all use
2. struct assignments don't work and requires ->clone_fn
3. can't support ->update_fn after ->final_*fn
While fixing cases 1 and 2 is merely the matter of calling ->init_fn and
->clone_fn as appropriate, fixing case 3 requires calling ->final_*fn on
a temporary context that's cloned from the primary context.
Reported-by: Bagas Sanjaya <bagasdotme@gmail.com>
Link: https://lore.kernel.org/ZPCL11k38PXTkFga@debian.me/
Helped-by: brian m. carlson <sandals@crustytoothpaste.net>
Fixes: 3e440ea0aba0 ("sha256: avoid functions deprecated in OpenSSL 3+")
Fixes: bda9c12073e7 ("avoid SHA-1 functions deprecated in OpenSSL 3+")
Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'csum-file.c')
-rw-r--r-- | csum-file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/csum-file.c b/csum-file.c index daf9b06dff..87961252c2 100644 --- a/csum-file.c +++ b/csum-file.c @@ -208,7 +208,7 @@ int hashfile_truncate(struct hashfile *f, struct hashfile_checkpoint *checkpoint lseek(f->fd, offset, SEEK_SET) != offset) return -1; f->total = offset; - f->ctx = checkpoint->ctx; + the_hash_algo->clone_fn(&f->ctx, &checkpoint->ctx); f->offset = 0; /* hashflush() was called in checkpoint */ return 0; } |