Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 260909
b: refs/heads/master
c: 7103dff
h: refs/heads/master
i:
  260907: 3f0c3dd
v: v3
  • Loading branch information
Roberto Sassu authored and Mimi Zohar committed Jun 27, 2011
1 parent bb25f09 commit 792c75b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08fa2aa54e72ddde8076cc77126bace8d4780e0f
refs/heads/master: 7103dff0e598cd634767f17a2958302c515700ca
45 changes: 34 additions & 11 deletions trunk/security/keys/encrypted.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,46 +133,69 @@ 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_info("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_info("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_info("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_info("encrypted_key: keylen parameter is missing\n");
goto out;
}
}

switch (key_cmd) {
case Opt_new:
if (!decrypted_datalen)
if (!decrypted_datalen) {
pr_info("encrypted_key: keyword \'%s\' not allowed "
"when called from .update method\n", keyword);
break;
}
ret = 0;
break;
case Opt_load:
if (!decrypted_datalen)
if (!decrypted_datalen) {
pr_info("encrypted_key: keyword \'%s\' not allowed "
"when called from .update method\n", keyword);
break;
}
*hex_encoded_iv = strsep(&datablob, " \t");
if (!*hex_encoded_iv)
if (!*hex_encoded_iv) {
pr_info("encrypted_key: hex blob is missing\n");
break;
}
ret = 0;
break;
case Opt_update:
if (decrypted_datalen)
if (decrypted_datalen) {
pr_info("encrypted_key: keyword \'%s\' not allowed "
"when called from .instantiate method\n",
keyword);
break;
}
ret = 0;
break;
case Opt_err:
pr_info("encrypted_key: keyword \'%s\' not recognized\n",
keyword);
break;
}
out:
Expand Down

0 comments on commit 792c75b

Please sign in to comment.