All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
To: Roberto Sassu <roberto.sassu@polito.it>
Cc: linux-security-module@vger.kernel.org, keyrings@linux-nfs.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	dhowells@redhat.com, jmorris@namei.org, zohar@linux.vnet.ibm.com,
	safford@watson.ibm.com, ramunno@polito.it,
	kirkland@canonical.com
Subject: Re: [RFC][PATCH v3 6/6] eCryptfs: added support for the encrypted key type
Date: Tue, 25 Jan 2011 16:41:22 -0600	[thread overview]
Message-ID: <20110125224122.GB12392@boyd.l.tihix.com> (raw)
In-Reply-To: <1295887497-20198-7-git-send-email-roberto.sassu@polito.it>

On Mon Jan 24, 2011 at 05:44:54PM +0100, Roberto Sassu <roberto.sassu@polito.it> wrote:
> The function ecryptfs_keyring_auth_tok_for_sig() has been modified in order
> to search keys of both 'user' and 'encrypted' types.
> 
> Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
> Acked-by: Gianluca Ramunno <ramunno@polito.it>

Thanks for the new revision.

Acked-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>

> ---
>  fs/ecryptfs/ecryptfs_kernel.h |   41 +++++++++++++++++++++++++++++++++++++++--
>  fs/ecryptfs/keystore.c        |   11 +++++++----
>  2 files changed, 46 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
> index 2e2242f..2b50397 100644
> --- a/fs/ecryptfs/ecryptfs_kernel.h
> +++ b/fs/ecryptfs/ecryptfs_kernel.h
> @@ -29,6 +29,7 @@
>  #define ECRYPTFS_KERNEL_H
> 
>  #include <keys/user-type.h>
> +#include <keys/encrypted-type.h>
>  #include <linux/fs.h>
>  #include <linux/fs_stack.h>
>  #include <linux/namei.h>
> @@ -78,11 +79,47 @@ struct ecryptfs_page_crypt_context {
>  	} param;
>  };
> 
> +#if defined(CONFIG_ENCRYPTED_KEYS) || defined(CONFIG_ENCRYPTED_KEYS_MODULE)
> +static inline struct ecryptfs_auth_tok *
> +ecryptfs_get_encrypted_key_payload_data(struct key *key)
> +{
> +	if (key->type == &key_type_encrypted)
> +		return (struct ecryptfs_auth_tok *)
> +			(&((struct encrypted_key_payload *)key->payload.data)->payload_data);
> +	else
> +		return NULL;
> +}
> +
> +static inline struct key *ecryptfs_get_encrypted_key(char *sig)
> +{
> +	return request_key(&key_type_encrypted, sig, NULL);
> +}
> +
> +#else
> +static inline struct ecryptfs_auth_tok *
> +ecryptfs_get_encrypted_key_payload_data(struct key *key)
> +{
> +	return NULL;
> +}
> +
> +static inline struct key *ecryptfs_get_encrypted_key(char *sig)
> +{
> +	return ERR_PTR(-ENOKEY);
> +}
> +
> +#endif /* CONFIG_ENCRYPTED_KEYS */
> +
>  static inline struct ecryptfs_auth_tok *
>  ecryptfs_get_key_payload_data(struct key *key)
>  {
> -	return (struct ecryptfs_auth_tok *)
> -		(((struct user_key_payload*)key->payload.data)->data);
> +	struct ecryptfs_auth_tok *auth_tok;
> +
> +	auth_tok = ecryptfs_get_encrypted_key_payload_data(key);
> +	if (!auth_tok)
> +		return (struct ecryptfs_auth_tok *)
> +			(((struct user_key_payload *)key->payload.data)->data);
> +	else
> +		return auth_tok;
>  }
> 
>  #define ECRYPTFS_MAX_KEYSET_SIZE 1024
> diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
> index c1436cf..17194b8 100644
> --- a/fs/ecryptfs/keystore.c
> +++ b/fs/ecryptfs/keystore.c
> @@ -1560,10 +1560,13 @@ int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key,
> 
>  	(*auth_tok_key) = request_key(&key_type_user, sig, NULL);
>  	if (!(*auth_tok_key) || IS_ERR(*auth_tok_key)) {
> -		printk(KERN_ERR "Could not find key with description: [%s]\n",
> -		       sig);
> -		rc = process_request_key_err(PTR_ERR(*auth_tok_key));
> -		goto out;
> +		(*auth_tok_key) = ecryptfs_get_encrypted_key(sig);
> +		if (!(*auth_tok_key) || IS_ERR(*auth_tok_key)) {
> +			printk(KERN_ERR "Could not find key with description: [%s]\n",
> +			      sig);
> +			rc = process_request_key_err(PTR_ERR(*auth_tok_key));
> +			goto out;
> +		}
>  	}
>  	(*auth_tok) = ecryptfs_get_key_payload_data(*auth_tok_key);
>  	if (ecryptfs_verify_version((*auth_tok)->version)) {
> -- 
> 1.7.3.4
> 



  reply	other threads:[~2011-01-25 22:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 16:44 [RFC][PATCH v3 0/6] eCryptfs: added support for the encrypted key type Roberto Sassu
2011-01-24 16:44 ` [RFC][PATCH v3 1/6] encrypted-keys: fixed valid_master_desc() function description Roberto Sassu
2011-01-24 16:44 ` [RFC][PATCH v3 2/6] encrypted-keys: added additional debug messages Roberto Sassu
2011-01-24 16:44 ` [RFC][PATCH v3 3/6] encrypted-keys: add key format support Roberto Sassu
2011-01-24 16:44 ` [RFC][PATCH v3 4/6] eCryptfs: export global eCryptfs definitions to include/linux/ecryptfs.h Roberto Sassu
2011-01-24 16:44 ` [RFC][PATCH v3 5/6] encrypted-keys: add ecryptfs format support Roberto Sassu
2011-01-25 22:57   ` Tyler Hicks
2011-01-24 16:44 ` [RFC][PATCH v3 6/6] eCryptfs: added support for the encrypted key type Roberto Sassu
2011-01-25 22:41   ` Tyler Hicks [this message]
2011-01-26 10:49 ` [RFC][PATCH v3 2/6] encrypted-keys: added additional debug messages David Howells
2011-01-26 11:03 ` [RFC][PATCH v3 3/6] encrypted-keys: add key format support David Howells
2011-01-26 11:52   ` Mimi Zohar
2011-01-26 13:01   ` David Howells
2011-01-26 11:05 ` [RFC][PATCH v3 4/6] eCryptfs: export global eCryptfs definitions to include/linux/ecryptfs.h David Howells
2011-01-26 11:05 ` [RFC][PATCH v3 1/6] encrypted-keys: fixed valid_master_desc() function description David Howells
2011-01-26 11:18 ` [RFC][PATCH v3 5/6] encrypted-keys: add ecryptfs format support David Howells
2011-01-26 12:57   ` Mimi Zohar
2011-01-26 11:28 ` [RFC][PATCH v3 6/6] eCryptfs: added support for the encrypted key type David Howells
2011-01-27 18:59   ` Roberto Sassu

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=20110125224122.GB12392@boyd.l.tihix.com \
    --to=tyhicks@linux.vnet.ibm.com \
    --cc=dhowells@redhat.com \
    --cc=jmorris@namei.org \
    --cc=keyrings@linux-nfs.org \
    --cc=kirkland@canonical.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=ramunno@polito.it \
    --cc=roberto.sassu@polito.it \
    --cc=safford@watson.ibm.com \
    --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 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.