[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1295887497-20198-3-git-send-email-roberto.sassu@polito.it>
Date: Mon, 24 Jan 2011 17:44:50 +0100
From: Roberto Sassu <roberto.sassu@...ito.it>
To: linux-security-module@...r.kernel.org
Cc: keyrings@...ux-nfs.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, dhowells@...hat.com,
jmorris@...ei.org, zohar@...ux.vnet.ibm.com,
safford@...son.ibm.com, ramunno@...ito.it,
tyhicks@...ux.vnet.ibm.com, kirkland@...onical.com,
Roberto Sassu <roberto.sassu@...ito.it>
Subject: [RFC][PATCH v3 2/6] encrypted-keys: added additional debug messages
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@...ito.it>
Acked-by: Gianluca Ramunno <ramunno@...ito.it>
Acked-by: Mimi Zohar <zohar@...ibm.com>
---
security/keys/encrypted.c | 44 +++++++++++++++++++++++++++++++++-----------
1 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/security/keys/encrypted.c b/security/keys/encrypted.c
index 6135836..322e979 100644
--- a/security/keys/encrypted.c
+++ b/security/keys/encrypted.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 *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.3.4
Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (2061 bytes)
Powered by blists - more mailing lists