kd_add.c
/* this function has the potential problem that if there are two keys
   out there with the same keyid, if both of them have signatures,
   they are indistinguishable without access to the public keys.  Even
   then, the only way to tell is to attempt to verify the signature
   with each public key to see if that is, in fact, the correct public
   key.  And even then, you can't ever decide that a signature is
   invalid, because you could just be missing the public key.  This
   seems to be a fundamental flaw in the keyring packet formats. */
this function has the potential problem that if there are two keys
out there with the same keyid, if both of them have signatures,
they are indistinguishable without access to the public keys.  Even
then, the only way to tell is to attempt to verify the signature
with each public key to see if that is, in fact, the correct public
key.  And even then, you can't ever decide that a signature is
invalid, because you could just be missing the public key.  This
seems to be a fundamental flaw in the keyring packet formats.
this function has the potential problem that if there are two keys out there with the same keyid if both of them have signatures they are indistinguishable without access to the public keys . Even then the only way to tell is to attempt to verify the signature with each public key to see if that is in fact the correct public key . And even then you can ' t ever decide that a signature is invalid because you could just be missing the public key . This seems to be a fundamental flaw in the keyring packet formats .
int kd_sigs_elem_merge(llist *lout, void *e1, void *e2, void *c)
{
   sigs_elem *se1 = (sigs_elem *) e1;
   sigs_elem *se2 = (sigs_elem *) e2;
   merge_state *s = (merge_state *) c;
   int o;
   if (!e1) {
      if (!llist_add(lout, e2)) {
	 dabort();
	 return(LLIST_MERGE_FAIL);
      }
      if (s) {
	 s->new_sigs++;
	 if (s->save_add) {
	    if (!llist_add(&(s->add_sigs), e2)) {
	       dabort();
	       return(LLIST_MERGE_FAIL);
	    }
	 }
	 if (s->verbose)
	    display_new_sig(s, &(se2->keyid));
      }
      return(LLIST_MERGE_DEL_2);
   }
   if (!e2) {
      if (!llist_add(lout, e1)) {
	 dabort();
	 return(LLIST_MERGE_FAIL);
      }
      return(LLIST_MERGE_DEL_1);
   }
   o = sigs_elem_order(e1, e2);
   if (o < 0) {
      if (!llist_add(lout, e1)) {
	 dabort();
	 return(LLIST_MERGE_FAIL);
      }
      return(LLIST_MERGE_DEL_1);
   }
   if (o > 0) {
      if (!llist_add(lout, e2)) {
	 dabort();
	 return(LLIST_MERGE_FAIL);
      }
      if (s) {
	 s->new_sigs++;
	 if (s->save_add) {
	    if (!llist_add(&(s->add_sigs), e2)) {
	       dabort();
	       return(LLIST_MERGE_FAIL);
	    }
	 }
	 if (s->verbose)
	    display_new_sig(s, &(se2->keyid));
      }
      return(LLIST_MERGE_DEL_2);
   }
   if (se1->sig_time >= se2->sig_time) {
      if (!llist_add(lout, e1)) {
	 dabort();
	 return(LLIST_MERGE_FAIL);
      }
      sigs_elem_free(se2, NULL);
   } else {
      if (!llist_add(lout, e2)) {
	 dabort();
	 return(LLIST_MERGE_FAIL);
      }
      if (s) {
	 s->repl_sigs++;
	 if (s->save_add) {
	    if (!llist_add(&(s->add_sigs), e2)) {
	       dabort();
	       return(LLIST_MERGE_FAIL);
	    }
	 }
	 if (s->verbose)
	    display_repl_sig(s, &(se2->keyid));
      }
      sigs_elem_free(se1, NULL);
   }
   return(LLIST_MERGE_DEL_1 | LLIST_MERGE_DEL_2);
}
int kd_sigs_elem_merge ( llist * lout , void * e1 , void * e2 , void * c ) { sigs_elem * se1 = ( sigs_elem * ) e1 ; sigs_elem * se2 = ( sigs_elem * ) e2 ; merge_state * s = ( merge_state * ) c ; int o ; if ( ! e1 ) { if ( ! llist_add ( lout , e2 ) ) { dabort ( ) ; return ( LLIST_MERGE_FAIL ) ; } if ( s ) { s -> new_sigs ++ ; if ( s -> save_add ) { if ( ! llist_add ( & ( s -> add_sigs ) , e2 ) ) { dabort ( ) ; return ( LLIST_MERGE_FAIL ) ; } } if ( s -> verbose ) display_new_sig ( s , & ( se2 -> keyid ) ) ; } return ( LLIST_MERGE_DEL_2 ) ; } if ( ! e2 ) { if ( ! llist_add ( lout , e1 ) ) { dabort ( ) ; return ( LLIST_MERGE_FAIL ) ; } return ( LLIST_MERGE_DEL_1 ) ; } o = sigs_elem_order ( e1 , e2 ) ; if ( o < 0 ) { if ( ! llist_add ( lout , e1 ) ) { dabort ( ) ; return ( LLIST_MERGE_FAIL ) ; } return ( LLIST_MERGE_DEL_1 ) ; } if ( o > 0 ) { if ( ! llist_add ( lout , e2 ) ) { dabort ( ) ; return ( LLIST_MERGE_FAIL ) ; } if ( s ) { s -> new_sigs ++ ; if ( s -> save_add ) { if ( ! llist_add ( & ( s -> add_sigs ) , e2 ) ) { dabort ( ) ; return ( LLIST_MERGE_FAIL ) ; } } if ( s -> verbose ) display_new_sig ( s , & ( se2 -> keyid ) ) ; } return ( LLIST_MERGE_DEL_2 ) ; } if ( se1 -> sig_time >= se2 -> sig_time ) { if ( ! llist_add ( lout , e1 ) ) { dabort ( ) ; return ( LLIST_MERGE_FAIL ) ; } sigs_elem_free ( se2 , NULL ) ; } else { if ( ! llist_add ( lout , e2 ) ) { dabort ( ) ; return ( LLIST_MERGE_FAIL ) ; } if ( s ) { s -> repl_sigs ++ ; if ( s -> save_add ) { if ( ! llist_add ( & ( s -> add_sigs ) , e2 ) ) { dabort ( ) ; return ( LLIST_MERGE_FAIL ) ; } } if ( s -> verbose ) display_repl_sig ( s , & ( se2 -> keyid ) ) ; } sigs_elem_free ( se1 , NULL ) ; } return ( LLIST_MERGE_DEL_1 | LLIST_MERGE_DEL_2 ) ; }
this function has the potential problem that if there are two keys
out there with the same keyid, if both of them have signatures,
they are indistinguishable without access to the public keys.
this function has the potential problem that if there are two keys out there with the same keyid if both of them have signatures they are indistinguishable without access to the public keys .
/* store pointer to added packets */ /* if the sig keyids are different, move the smaller keyid
      to the output list */ /* store pointer to added packets */ /* if the sig keyids are the same, move the more recent signature
      to the output list and delete the less recent.  If they are
      the same, take the database sig so the stats work out right */ /* store pointer to added packets */