On Tue, 2011-11-29 at 23:43 +0000, David Howells wrote: > Add some useful PGP definitions from RFC 4880. These describe details of > public key crypto as used by crypto keys for things like signature > verification. [...] > +struct pgp_signature_v3_packet { > + enum pgp_signature_version version : 8; /* == PGP_SIG_VERSION_3 */ > + u8 length_of_hashed; /* == 5 */ > + struct { > + enum pgp_signature_type signature_type : 8; > + struct pgp_time creation_time; > + } hashed; > + struct pgp_key_ID issuer; > + enum pgp_pubkey_algo pubkey_algo : 8; > + enum pgp_hash_algo hash_algo : 8; > +}; > + > +struct pgp_signature_v4_packet { > + enum pgp_signature_version version : 8; /* == PGP_SIG_VERSION_4 */ > + enum pgp_signature_type signature_type : 8; > + enum pgp_pubkey_algo pubkey_algo : 8; > + enum pgp_hash_algo hash_algo : 8; > +}; [...] > +struct pgp_key_v3_packet { > + enum pgp_key_version version : 8; > + struct pgp_time creation_time; > + u8 expiry[2]; /* 0 or time in days till expiry */ > + enum pgp_pubkey_algo pubkey_algo : 8; > + u8 key_material[0]; > +}; > + > +struct pgp_key_v4_packet { > + enum pgp_key_version version : 8; > + struct pgp_time creation_time; > + enum pgp_pubkey_algo pubkey_algo : 8; > + u8 key_material[0]; > +}; [...] I'm a little uneasy about these structure definitions. There have been C ABIs that set the structure alignment to at least 4 by default. It may be better to play safe by declaring them '__packed'. Ben. -- Ben Hutchings Klipstein's 4th Law of Prototyping and Production: A fail-safe circuit will destroy others.
Attachment:
signature.asc
Description: This is a digitally signed message part