diff options
author | Werner Koch <wk@gnupg.org> | 2016-06-02 15:14:49 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2016-06-02 15:57:59 +0200 |
commit | d837f6b0eadb14ea08c1c6030b4d6adaaee8778e (patch) | |
tree | 89536458c205d01a245a45787db035d504e93ec9 /g10/build-packet.c | |
parent | common: New function openpgp_is_curve_supported. (diff) | |
download | gnupg2-d837f6b0eadb14ea08c1c6030b4d6adaaee8778e.tar.xz gnupg2-d837f6b0eadb14ea08c1c6030b4d6adaaee8778e.zip |
gpg: Do not abort on certain invalid packets.
* g10/build-packet.c (write_fake_data): Check for non-opaque data.
* g10/seskey.c (do_encode_md): Return NULL instead of abort.
--
The first may happen if the usage flags of an algorithm do not match
the allowed usage. When writing a backsig this would lead to a
log_bug in libgcrypt due to the use of a regular MPI as opaque data.
The second may happen with all kind of invalid data. It is easy to
avoid an abort, though.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/build-packet.c')
-rw-r--r-- | g10/build-packet.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c index 1353a863c..2745734b4 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -301,6 +301,8 @@ write_fake_data (IOBUF out, gcry_mpi_t a) if (!a) return 0; + if (!gcry_mpi_get_flag (a, GCRYMPI_FLAG_OPAQUE)) + return 0; /* e.g. due to generating a key with wrong usage. */ p = gcry_mpi_get_opaque ( a, &n); if (!p) return 0; /* For example due to a read error in |