* [RFC][PATCH 2/6] encrypted-keys: added additional debug messages
@ 2010-12-23 17:34 Roberto Sassu
2010-12-24 16:20 ` Mimi Zohar
0 siblings, 1 reply; 3+ messages in thread
From: Roberto Sassu @ 2010-12-23 17:34 UTC (permalink / raw)
To: linux-security-module
Cc: keyrings, linux-fsdevel, linux-kernel, Mimi Zohar, David Howells,
James Morris, David Safford, Gianluca Ramunno, Tyler Hicks,
kirkland
[-- Attachment #1: Type: text/plain, Size: 2689 bytes --]
Some debug messages have been added in the function datablob_parse() in
order to better identify errors returned when dealing with 'encrypted'
keys.
Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
---
security/keys/encrypted_defined.c | 44 +++++++++++++++++++++++++++---------
1 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/security/keys/encrypted_defined.c b/security/keys/encrypted_defined.c
index c1c5e27..2bb2c47 100644
--- a/security/keys/encrypted_defined.c
+++ b/security/keys/encrypted_defined.c
@@ -133,46 +133,68 @@ static int datablob_parse(char *datablob, char **master_desc,
substring_t args[MAX_OPT_ARGS];
int ret = -EINVAL;
int key_cmd;
- char *p;
+ char *p, *keyword;
- p = strsep(&datablob, " \t");
- if (!p)
+ keyword = strsep(&datablob, " \t");
+ if (!keyword) {
+ pr_err("encrypted_key: insufficient parameters specified\n");
return ret;
- key_cmd = match_token(p, key_tokens, args);
+ }
+ key_cmd = match_token(keyword, key_tokens, args);
*master_desc = strsep(&datablob, " \t");
- if (!*master_desc)
+ if (!*master_desc) {
+ pr_err("encrypted_key: master key parameter is missing\n");
goto out;
+ }
- if (valid_master_desc(*master_desc, NULL) < 0)
+ if (valid_master_desc(*master_desc, NULL) < 0) {
+ pr_err("encrypted_key: master key parameter \'%s\' "
+ "is invalid\n", *master_desc);
goto out;
+ }
if (decrypted_datalen) {
*decrypted_datalen = strsep(&datablob, " \t");
- if (!*decrypted_datalen)
+ if (!*decrypted_datalen) {
+ pr_err("encrypted_key: keylen parameter is missing\n");
goto out;
+ }
}
switch (key_cmd) {
case Opt_new:
- if (!decrypted_datalen)
+ if (!decrypted_datalen) {
+ pr_err("encrypted_key: keyword \'%s\' not allowed when "
+ "updating an existent key\n", keyword);
break;
+ }
ret = 0;
break;
case Opt_load:
- if (!decrypted_datalen)
+ if (!decrypted_datalen) {
+ pr_err("encrypted_key: keyword \'%s\' not allowed when "
+ "updating an existent key\n", keyword);
break;
+ }
*hex_encoded_iv = strsep(&datablob, " \t");
- if (!*hex_encoded_iv)
+ if (!*hex_encoded_iv) {
+ pr_err("encrypted_key: hex blob is missing\n");
break;
+ }
ret = 0;
break;
case Opt_update:
- if (decrypted_datalen)
+ if (decrypted_datalen) {
+ pr_err("encrypted_key: keyword \'%s\' not allowed when "
+ "instantiating a new key\n", keyword);
break;
+ }
ret = 0;
break;
case Opt_err:
+ pr_err("encrypted_key: keyword \'%s\' not recognized\n",
+ keyword);
break;
}
out:
--
1.7.2.3
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4401 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [RFC][PATCH 2/6] encrypted-keys: added additional debug messages
2010-12-23 17:34 [RFC][PATCH 2/6] encrypted-keys: added additional debug messages Roberto Sassu
@ 2010-12-24 16:20 ` Mimi Zohar
0 siblings, 0 replies; 3+ messages in thread
From: Mimi Zohar @ 2010-12-24 16:20 UTC (permalink / raw)
To: Roberto Sassu
Cc: linux-security-module, keyrings, linux-fsdevel, linux-kernel,
David Howells, James Morris, David Safford, Gianluca Ramunno,
Tyler Hicks, kirkland
On Thu, 2010-12-23 at 18:34 +0100, Roberto Sassu wrote:
> Some debug messages have been added in the function datablob_parse() in
> order to better identify errors returned when dealing with 'encrypted'
> keys.
>
> Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Other than the patches being mangled by the mailer, nice. Please
re-post.
Acked-by: Mimi Zohar <zohar@us.ibm.com>
> ---
> security/keys/encrypted_defined.c | 44 +++++++++++++++++++++++++++---------
> 1 files changed, 33 insertions(+), 11 deletions(-)
>
> diff --git a/security/keys/encrypted_defined.c b/security/keys/encrypted_defined.c
> index c1c5e27..2bb2c47 100644
> --- a/security/keys/encrypted_defined.c
> +++ b/security/keys/encrypted_defined.c
> @@ -133,46 +133,68 @@ static int datablob_parse(char *datablob, char **master_desc,
> substring_t args[MAX_OPT_ARGS];
> int ret = -EINVAL;
> int key_cmd;
> - char *p;
> + char *p, *keyword;
>
> - p = strsep(&datablob, " \t");
> - if (!p)
> + keyword = strsep(&datablob, " \t");
> + if (!keyword) {
> + pr_err("encrypted_key: insufficient parameters specified\n");
> return ret;
> - key_cmd = match_token(p, key_tokens, args);
> + }
> + key_cmd = match_token(keyword, key_tokens, args);
>
> *master_desc = strsep(&datablob, " \t");
> - if (!*master_desc)
> + if (!*master_desc) {
> + pr_err("encrypted_key: master key parameter is missing\n");
> goto out;
> + }
>
> - if (valid_master_desc(*master_desc, NULL) < 0)
> + if (valid_master_desc(*master_desc, NULL) < 0) {
> + pr_err("encrypted_key: master key parameter \'%s\' "
> + "is invalid\n", *master_desc);
> goto out;
> + }
>
> if (decrypted_datalen) {
> *decrypted_datalen = strsep(&datablob, " \t");
> - if (!*decrypted_datalen)
> + if (!*decrypted_datalen) {
> + pr_err("encrypted_key: keylen parameter is missing\n");
> goto out;
> + }
> }
>
> switch (key_cmd) {
> case Opt_new:
> - if (!decrypted_datalen)
> + if (!decrypted_datalen) {
> + pr_err("encrypted_key: keyword \'%s\' not allowed when "
> + "updating an existent key\n", keyword);
> break;
> + }
> ret = 0;
> break;
> case Opt_load:
> - if (!decrypted_datalen)
> + if (!decrypted_datalen) {
> + pr_err("encrypted_key: keyword \'%s\' not allowed when "
> + "updating an existent key\n", keyword);
> break;
> + }
> *hex_encoded_iv = strsep(&datablob, " \t");
> - if (!*hex_encoded_iv)
> + if (!*hex_encoded_iv) {
> + pr_err("encrypted_key: hex blob is missing\n");
> break;
> + }
> ret = 0;
> break;
> case Opt_update:
> - if (decrypted_datalen)
> + if (decrypted_datalen) {
> + pr_err("encrypted_key: keyword \'%s\' not allowed when "
> + "instantiating a new key\n", keyword);
> break;
> + }
> ret = 0;
> break;
> case Opt_err:
> + pr_err("encrypted_key: keyword \'%s\' not recognized\n",
> + keyword);
> break;
> }
> out:
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC][PATCH 2/6] encrypted-keys: added additional debug messages
@ 2010-12-23 17:15 Roberto Sassu
0 siblings, 0 replies; 3+ messages in thread
From: Roberto Sassu @ 2010-12-23 17:15 UTC (permalink / raw)
To: linux-security-module
Cc: keyrings, linux-fsdevel, Mimi Zohar, David Howells, James Morris,
David Safford, Gianluca Ramunno, Tyler Hicks, kirkland
[-- Attachment #1: Type: text/plain, Size: 2693 bytes --]
Some debug messages have been added in the function datablob_parse() in
order to better identify errors returned when dealing with 'encrypted'
keys.
Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
---
security/keys/encrypted_defined.c | 44 +++++++++++++++++++++++++++---------
1 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/security/keys/encrypted_defined.c
b/security/keys/encrypted_defined.c
index c1c5e27..2bb2c47 100644
--- a/security/keys/encrypted_defined.c
+++ b/security/keys/encrypted_defined.c
@@ -133,46 +133,68 @@ static int datablob_parse(char *datablob, char
**master_desc,
substring_t args[MAX_OPT_ARGS];
int ret = -EINVAL;
int key_cmd;
- char *p;
+ char *p, *keyword;
- p = strsep(&datablob, " \t");
- if (!p)
+ keyword = strsep(&datablob, " \t");
+ if (!keyword) {
+ pr_err("encrypted_key: insufficient parameters specified\n");
return ret;
- key_cmd = match_token(p, key_tokens, args);
+ }
+ key_cmd = match_token(keyword, key_tokens, args);
*master_desc = strsep(&datablob, " \t");
- if (!*master_desc)
+ if (!*master_desc) {
+ pr_err("encrypted_key: master key parameter is missing\n");
goto out;
+ }
- if (valid_master_desc(*master_desc, NULL) < 0)
+ if (valid_master_desc(*master_desc, NULL) < 0) {
+ pr_err("encrypted_key: master key parameter \'%s\' "
+ "is invalid\n", *master_desc);
goto out;
+ }
if (decrypted_datalen) {
*decrypted_datalen = strsep(&datablob, " \t");
- if (!*decrypted_datalen)
+ if (!*decrypted_datalen) {
+ pr_err("encrypted_key: keylen parameter is missing\n");
goto out;
+ }
}
switch (key_cmd) {
case Opt_new:
- if (!decrypted_datalen)
+ if (!decrypted_datalen) {
+ pr_err("encrypted_key: keyword \'%s\' not allowed when "
+ "updating an existent key\n", keyword);
break;
+ }
ret = 0;
break;
case Opt_load:
- if (!decrypted_datalen)
+ if (!decrypted_datalen) {
+ pr_err("encrypted_key: keyword \'%s\' not allowed when "
+ "updating an existent key\n", keyword);
break;
+ }
*hex_encoded_iv = strsep(&datablob, " \t");
- if (!*hex_encoded_iv)
+ if (!*hex_encoded_iv) {
+ pr_err("encrypted_key: hex blob is missing\n");
break;
+ }
ret = 0;
break;
case Opt_update:
- if (decrypted_datalen)
+ if (decrypted_datalen) {
+ pr_err("encrypted_key: keyword \'%s\' not allowed when "
+ "instantiating a new key\n", keyword);
break;
+ }
ret = 0;
break;
case Opt_err:
+ pr_err("encrypted_key: keyword \'%s\' not recognized\n",
+ keyword);
break;
}
out:
--
1.7.2.3
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4401 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-24 16:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-23 17:34 [RFC][PATCH 2/6] encrypted-keys: added additional debug messages Roberto Sassu
2010-12-24 16:20 ` Mimi Zohar
-- strict thread matches above, loose matches on Subject: below --
2010-12-23 17:15 Roberto Sassu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox