From 4d8decc23c94d179be49a545e0e78a89722e857d Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 12 Apr 2022 15:40:19 +0900 Subject: [PATCH] Add v5 signature salt. Signed-off-by: NIIBE Yutaka --- g10/packet.h | 1 + g10/parse-packet.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/g10/packet.h b/g10/packet.h index 2301107b2..72c405898 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -264,6 +264,7 @@ typedef struct /* First 2 bytes of the digest. (Serialized. Note: this is not automatically filled in when serializing a signature!) */ byte digest_start[2]; + byte v5_salt[16]; /* The signature. (Serialized.) */ gcry_mpi_t data[PUBKEY_MAX_NSIG]; /* The message digest and its length (in bytes). Note the maximum diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 7acad4aa9..7af5e6b40 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -2273,6 +2273,22 @@ parse_signature (IOBUF inp, int pkttype, unsigned long pktlen, sig->digest_start[1] = iobuf_get_noeof (inp); pktlen--; + if (sig->version == 5) + { + if (pktlen < 16) + goto underflow; + if (iobuf_read (inp, sig->v5_salt, 16) != 16) + { + log_error ("premature eof while reading " + "salt\n"); + if (list_mode) + es_fputs (":signature packet: [premature eof]\n", listfp); + rc = -1; + goto leave; + } + pktlen -= 16; + } + if (is_v4or5 && sig->pubkey_algo) /* Extract required information. */ { const byte *p;