diff options
author | NIIBE Yutaka <[email protected]> | 2015-04-30 08:02:42 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2015-05-01 04:58:18 +0000 |
commit | f77fd572db658959fa40aa8c181be919e688b707 (patch) | |
tree | 29708e9744655a7306318905871f500203604fa3 | |
parent | scd: PC/SC reader selection by partial string match. (diff) | |
download | gnupg-f77fd572db658959fa40aa8c181be919e688b707.tar.gz gnupg-f77fd572db658959fa40aa8c181be919e688b707.zip |
g10: fix cmp_public_key.
* g10/free-packet.c (cmp_public_keys): Compare opaque
data at the first entry of the array when it's unknown algo.
--
(forwardported from 2.0 commit 43429c7869152f301157e4b24790b3801dce0f0a)
GnuPG-bug-id: 1962
-rw-r--r-- | g10/free-packet.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/g10/free-packet.c b/g10/free-packet.c index 49d54f419..670f2565e 100644 --- a/g10/free-packet.c +++ b/g10/free-packet.c @@ -434,11 +434,14 @@ cmp_public_keys( PKT_public_key *a, PKT_public_key *b ) return -1; n = pubkey_get_npkey( b->pubkey_algo ); - if( !n ) - return -1; /* can't compare due to unknown algorithm */ - for(i=0; i < n; i++ ) { - if( mpi_cmp( a->pkey[i], b->pkey[i] ) ) - return -1; + if( !n ) { /* unknown algorithm, rest is in opaque MPI */ + if( mpi_cmp( a->pkey[0], b->pkey[0] ) ) + return -1; /* can't compare due to unknown algorithm */ + } else { + for(i=0; i < n; i++ ) { + if( mpi_cmp( a->pkey[i], b->pkey[i] ) ) + return -1; + } } return 0; |