linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: David Howells <dhowells@redhat.com>
Cc: keyrings@linux-nfs.org, linux-crypto@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, dmitry.kasatkin@intel.com,
	zohar@linux.vnet.ibm.com, arjan.van.de.ven@intel.com,
	alan.cox@intel.com
Subject: Re: [PATCH 04/16] PGP: Add definitions (RFC 4880) and packet parser [ver #2]
Date: Sun, 04 Dec 2011 16:03:02 +0000	[thread overview]
Message-ID: <1323014582.7454.121.camel@deadeye> (raw)
In-Reply-To: <20111129234348.13625.33435.stgit@warthog.procyon.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1665 bytes --]

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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2011-12-04 16:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29 23:42 [RFC][PATCH 00/16] Crypto keys and module signing [ver #2] David Howells
2011-11-29 23:43 ` [PATCH 01/16] MPILIB: Export some more symbols " David Howells
2011-11-29 23:43 ` [PATCH 02/16] MPILIB: Add a missing ENOMEM check " David Howells
2011-11-30 15:28   ` Serge Hallyn
2011-11-30 17:00     ` David Howells
2011-11-29 23:43 ` [PATCH 03/16] KEYS: Permit key_serial() to be called with a const key pointer " David Howells
2011-11-29 23:43 ` [PATCH 04/16] PGP: Add definitions (RFC 4880) and packet parser " David Howells
2011-12-04 16:03   ` Ben Hutchings [this message]
2011-12-05 11:21     ` David Howells
2011-11-29 23:44 ` [PATCH 05/16] KEYS: Create a key type that can be used for general cryptographic operations " David Howells
2011-11-29 23:44 ` [PATCH 06/16] KEYS: Add a DSA crypto key subtype " David Howells
2011-11-29 23:44 ` [PATCH 07/16] KEYS: Add a RSA " David Howells
2011-11-29 23:44 ` [PATCH 08/16] PGP: Add signature parser " David Howells
2011-11-29 23:44 ` [PATCH 09/16] KEYS: Add signature verification facility " David Howells
2011-11-29 23:45 ` [PATCH 10/16] KEYS: DSA key signature verification " David Howells
2011-11-29 23:45 ` [PATCH 11/16] KEYS: RSA " David Howells
2011-11-29 23:45 ` [PATCH 12/16] KEYS: Add a crypto key request function " David Howells
2011-11-29 23:45 ` [PATCH 13/16] KEYS: Provide a function to load keys from a PGP keyring blob " David Howells
2011-11-29 23:45 ` [PATCH 14/16] MODSIGN: Add indications of module ELF types " David Howells
2011-11-29 23:46 ` [PATCH 15/16] MODSIGN: Module ELF verifier " David Howells
2011-11-29 23:46 ` [PATCH 16/16] MODSIGN: Apply signature checking to modules on module load " David Howells
2011-11-30 11:01 ` [RFC][PATCH 00/16] Crypto keys and module signing " Greg KH
2011-12-05 11:32 ` H. Peter Anvin
2011-12-05 11:43   ` David Howells
2011-12-06  0:54     ` [Keyrings] " James Morris
2011-12-07 14:29       ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323014582.7454.121.camel@deadeye \
    --to=ben@decadent.org.uk \
    --cc=alan.cox@intel.com \
    --cc=arjan.van.de.ven@intel.com \
    --cc=dhowells@redhat.com \
    --cc=dmitry.kasatkin@intel.com \
    --cc=keyrings@linux-nfs.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=zohar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).