summaryrefslogtreecommitdiffstats
path: root/kbx/keybox-blob.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-08-27 10:04:53 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2021-08-27 10:04:53 +0200
commit0b64c27446c6f17f9c108e0fa95639db12d376ff (patch)
treeebc7d4c36e8aa1bb6369b757623a2044f02e7612 /kbx/keybox-blob.c
parentcommon: Fix put_membuf. (diff)
downloadgnupg2-0b64c27446c6f17f9c108e0fa95639db12d376ff.tar.xz
gnupg2-0b64c27446c6f17f9c108e0fa95639db12d376ff.zip
kbx: Fix checksum computation for no UBID entry on disk.
* kbx/keybox-blob.c (create_blob_header): Fix the flag to match no UBID entry, (create_blob_finish): Fix the length of data to be hashed. -- GnuPG-bug-id: 5573 Fixes-commit: 915297705af6f1db74dacf0d6665b83eb0a58459 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to '')
-rw-r--r--kbx/keybox-blob.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kbx/keybox-blob.c b/kbx/keybox-blob.c
index a0ba40502..5cba6576b 100644
--- a/kbx/keybox-blob.c
+++ b/kbx/keybox-blob.c
@@ -563,7 +563,7 @@ create_blob_header (KEYBOXBLOB blob, int blobtype, int as_ephemeral,
put32 ( a, 0 ); /* blob length, needs fixup */
put8 ( a, blobtype);
put8 ( a, want_fpr32? 2:1 ); /* blob type version */
- put16 ( a, as_ephemeral? 6:4 ); /* blob flags */
+ put16 ( a, as_ephemeral? 2:0 ); /* blob flags */
put32 ( a, 0 ); /* offset to the raw data, needs fixup */
put32 ( a, 0 ); /* length of the raw data, needs fixup */
@@ -726,7 +726,7 @@ create_blob_finish (KEYBOXBLOB blob)
}
/* Compute and store the SHA-1 checksum. */
- gcry_md_hash_buffer (GCRY_MD_SHA1, p + n - 20, p, n - 40);
+ gcry_md_hash_buffer (GCRY_MD_SHA1, p + n - 20, p, n - 20);
pp = xtrymalloc (n);
if ( !pp )