diff options
Diffstat (limited to 'g10/free-packet.c')
-rw-r--r-- | g10/free-packet.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/g10/free-packet.c b/g10/free-packet.c index 0f8e0e8ce..e772c0866 100644 --- a/g10/free-packet.c +++ b/g10/free-packet.c @@ -452,11 +452,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] ) ) + if( !n ) { /* unknown algorithm, rest is in opaque MPI */ + if( mpi_cmp( a->pkey[0], b->pkey[0] ) ) return -1; + } else { + for(i=0; i < n; i++ ) { + if( mpi_cmp( a->pkey[i], b->pkey[i] ) ) + return -1; + } } return 0; @@ -479,11 +482,14 @@ cmp_secret_keys( PKT_secret_key *a, PKT_secret_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->skey[i], b->skey[i] ) ) + if( !n ) { /* unknown algorithm, rest is in opaque MPI */ + if( mpi_cmp( a->skey[0], b->skey[0] ) ) return -1; + } else { + for(i=0; i < n; i++ ) { + if( mpi_cmp( a->skey[i], b->skey[i] ) ) + return -1; + } } return 0; |