All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Halcrow <mhalcrow@google.com>
To: Eric Biggers <ebiggers3@gmail.com>
Cc: linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-mtd@lists.infradead.org, linux-crypto@vger.kernel.org,
	"Theodore Y . Ts'o" <tytso@mit.edu>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Alex Cope <alexcope@google.com>,
	Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH 2/6] fscrypt: rename ->ci_master_key to ->ci_master_key_descriptor
Date: Fri, 14 Jul 2017 08:36:15 -0700	[thread overview]
Message-ID: <20170714153615.GA25453@google.com> (raw)
In-Reply-To: <20170712210035.51534-3-ebiggers3@gmail.com>

On Wed, Jul 12, 2017 at 02:00:31PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> In struct fscrypt_info, ->ci_master_key is the master key descriptor,
> not the master key itself.  In preparation for introducing a struct
> fscrypt_master_key and making ->ci_master_key point to it, rename the
> existing ->ci_master_key to ->ci_master_key_descriptor.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Acked-by: Michael Halcrow <mhalcrow@google.com>

> ---
>  fs/crypto/fscrypt_private.h | 2 +-
>  fs/crypto/keyinfo.c         | 4 ++--
>  fs/crypto/policy.c          | 5 +++--
>  3 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h
> index ef6909035823..5470aac82cab 100644
> --- a/fs/crypto/fscrypt_private.h
> +++ b/fs/crypto/fscrypt_private.h
> @@ -107,7 +107,7 @@ struct fscrypt_info {
>  	u8 ci_data_mode;
>  	u8 ci_filename_mode;
>  	u8 ci_flags;
> -	u8 ci_master_key[FS_KEY_DESCRIPTOR_SIZE];
> +	u8 ci_master_key_descriptor[FS_KEY_DESCRIPTOR_SIZE];
>  };
>  
>  typedef enum {
> diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c
> index 7e664a11340a..5591fd24e4b2 100644
> --- a/fs/crypto/keyinfo.c
> +++ b/fs/crypto/keyinfo.c
> @@ -293,8 +293,8 @@ int fscrypt_get_encryption_info(struct inode *inode)
>  	crypt_info->ci_data_mode = ctx.contents_encryption_mode;
>  	crypt_info->ci_filename_mode = ctx.filenames_encryption_mode;
>  	crypt_info->ci_flags = ctx.flags;
> -	memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor,
> -				sizeof(crypt_info->ci_master_key));
> +	memcpy(crypt_info->ci_master_key_descriptor, ctx.master_key_descriptor,
> +	       FS_KEY_DESCRIPTOR_SIZE);
>  
>  	res = determine_cipher_type(crypt_info, inode, &cipher_str, &keysize);
>  	if (res)
> diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c
> index 044f23fadb5a..81c59f8e45c0 100644
> --- a/fs/crypto/policy.c
> +++ b/fs/crypto/policy.c
> @@ -224,7 +224,8 @@ int fscrypt_has_permitted_context(struct inode *parent, struct inode *child)
>  	child_ci = child->i_crypt_info;
>  
>  	if (parent_ci && child_ci) {
> -		return memcmp(parent_ci->ci_master_key, child_ci->ci_master_key,
> +		return memcmp(parent_ci->ci_master_key_descriptor,
> +			      child_ci->ci_master_key_descriptor,
>  			      FS_KEY_DESCRIPTOR_SIZE) == 0 &&
>  			(parent_ci->ci_context_version ==
>  			 child_ci->ci_context_version) &&
> @@ -282,7 +283,7 @@ int fscrypt_inherit_context(struct inode *parent, struct inode *child,
>  	ctx.contents_encryption_mode = ci->ci_data_mode;
>  	ctx.filenames_encryption_mode = ci->ci_filename_mode;
>  	ctx.flags = ci->ci_flags;
> -	memcpy(ctx.master_key_descriptor, ci->ci_master_key,
> +	memcpy(ctx.master_key_descriptor, ci->ci_master_key_descriptor,
>  	       FS_KEY_DESCRIPTOR_SIZE);
>  	get_random_bytes(ctx.nonce, FS_KEY_DERIVATION_NONCE_SIZE);
>  	if (ctx.version != FSCRYPT_CONTEXT_V1)
> -- 
> 2.13.2.932.g7449e964c-goog
> 

  reply	other threads:[~2017-07-14 15:36 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12 21:00 [PATCH 0/6] fscrypt: key verification and KDF improvement Eric Biggers
2017-07-12 21:00 ` [PATCH 1/6] fscrypt: add v2 encryption context and policy Eric Biggers
2017-07-13 22:29   ` Michael Halcrow
2017-07-13 22:58     ` Eric Biggers
2017-07-14 20:08       ` Andreas Dilger
2017-07-12 21:00 ` [PATCH 2/6] fscrypt: rename ->ci_master_key to ->ci_master_key_descriptor Eric Biggers
2017-07-14 15:36   ` Michael Halcrow [this message]
2017-07-12 21:00 ` [PATCH 3/6] fscrypt: use HKDF-SHA512 to derive the per-inode encryption keys Eric Biggers
2017-07-12 21:00   ` Eric Biggers
2017-07-13 14:54   ` Stephan Müller
2017-07-13 16:07     ` Herbert Xu
2017-07-13 16:07       ` Herbert Xu
2017-07-13 16:18       ` Stephan Müller
2017-07-13 18:10     ` Eric Biggers
2017-07-13 18:10       ` Eric Biggers
2017-07-13 18:10       ` Eric Biggers
2017-07-14 15:50       ` Stephan Müller
2017-07-14 15:50         ` Stephan Müller
2017-07-14 15:50         ` Stephan Müller
2017-07-14 16:24   ` Michael Halcrow
2017-07-14 17:11     ` Michael Halcrow
2017-07-19 17:32     ` Eric Biggers
2017-07-12 21:00 ` [PATCH 4/6] fscrypt: verify that the correct master key was supplied Eric Biggers
2017-07-14 16:40   ` Michael Halcrow via Linux-f2fs-devel
2017-07-14 16:40     ` Michael Halcrow
2017-07-14 17:34   ` Jeffrey Walton
2017-07-15  0:52     ` Eric Biggers
2017-07-12 21:00 ` [PATCH 5/6] fscrypt: cache the HMAC transform for each master key Eric Biggers
2017-07-12 21:00   ` Eric Biggers
2017-07-17 17:45   ` Michael Halcrow
2017-07-19 17:37     ` Eric Biggers
2017-07-12 21:00 ` [PATCH 6/6] fscrypt: for v2 policies, support "fscrypt:" key prefix only Eric Biggers
2017-07-17 17:54   ` Michael Halcrow

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=20170714153615.GA25453@google.com \
    --to=mhalcrow@google.com \
    --cc=alexcope@google.com \
    --cc=ebiggers3@gmail.com \
    --cc=ebiggers@google.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.