aboutsummaryrefslogtreecommitdiffstats
path: root/g10/free-packet.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-12-08 12:20:53 +0000
committerWerner Koch <[email protected]>1998-12-08 12:20:53 +0000
commitab986970ebce96ad5e9df305ce2413d9d6c613e2 (patch)
tree99409ab6f191101d7b57129d6a7fed321f7d0589 /g10/free-packet.c
parentSee ChangeLog: Fri Nov 27 21:37:41 CET 1998 Werner Koch (diff)
downloadgnupg-ab986970ebce96ad5e9df305ce2413d9d6c613e2.tar.gz
gnupg-ab986970ebce96ad5e9df305ce2413d9d6c613e2.zip
See ChangeLog: Tue Dec 8 13:15:16 CET 1998 Werner Koch
Diffstat (limited to 'g10/free-packet.c')
-rw-r--r--g10/free-packet.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/g10/free-packet.c b/g10/free-packet.c
index ed8f25db8..e2bbc1640 100644
--- a/g10/free-packet.c
+++ b/g10/free-packet.c
@@ -345,7 +345,7 @@ free_packet( PACKET *pkt )
}
/****************
- * Returns 0 if they match.
+ * returns 0 if they match.
*/
int
cmp_public_keys( PKT_public_key *a, PKT_public_key *b )
@@ -372,6 +372,33 @@ cmp_public_keys( PKT_public_key *a, PKT_public_key *b )
/****************
* Returns 0 if they match.
+ * We only compare the public parts.
+ */
+int
+cmp_secret_keys( PKT_secret_key *a, PKT_secret_key *b )
+{
+ int n, i;
+
+ if( a->timestamp != b->timestamp )
+ return -1;
+ if( a->expiredate != b->expiredate )
+ return -1;
+ if( a->pubkey_algo != b->pubkey_algo )
+ 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] ) )
+ return -1;
+ }
+
+ return 0;
+}
+
+/****************
+ * Returns 0 if they match.
*/
int
cmp_public_secret_key( PKT_public_key *pk, PKT_secret_key *sk )