1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

import works

This commit is contained in:
Werner Koch 1998-02-17 20:48:52 +00:00
parent 78c49af6c3
commit c8bb57d05d
33 changed files with 1404 additions and 141 deletions

View file

@ -271,6 +271,37 @@ free_packet( PACKET *pkt )
pkt->pkt.generic = NULL;
}
/****************
* Returns 0 if they match.
*/
int
cmp_public_certs( PKT_public_cert *a, PKT_public_cert *b )
{
if( a->timestamp != b->timestamp )
return -1;
if( a->valid_days != b->valid_days )
return -1;
if( a->pubkey_algo != b->pubkey_algo )
return -1;
if( a->pubkey_algo == PUBKEY_ALGO_ELGAMAL ) {
if( mpi_cmp( a->d.elg.p , b->d.elg.p ) )
return -1;
if( mpi_cmp( a->d.elg.g , b->d.elg.g ) )
return -1;
if( mpi_cmp( a->d.elg.y , b->d.elg.y ) )
return -1;
}
else if( a->pubkey_algo == PUBKEY_ALGO_RSA ) {
if( mpi_cmp( a->d.rsa.rsa_n , b->d.rsa.rsa_n ) )
return -1;
if( mpi_cmp( a->d.rsa.rsa_e , b->d.rsa.rsa_e ) )
return -1;
}
return 0;
}
/****************
* Returns 0 if they match.
*/
@ -302,3 +333,15 @@ cmp_public_secret_cert( PKT_public_cert *pkc, PKT_secret_cert *skc )
return 0;
}
int
cmp_user_ids( PKT_user_id *a, PKT_user_id *b )
{
int res;
res = a->len - b->len;
if( !res )
res = memcmp( a->name, b->name, a->len );
return res;
}