diff options
author | James Morris <jmorris@namei.org> | 2011-09-26 19:20:46 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-09-26 19:20:46 -0400 |
commit | c6cb56fc94f4efaec2d4ad74bed2be7883179ccd (patch) | |
tree | cc4ebf2231093ab57c2e868fbdf176791de600db /security | |
parent | a427fd14d3edf6396c4b9638dbc8e2972afaa05b (diff) | |
parent | 8c35ad20270de91d0f3bfe521daa3b7983ee8db7 (diff) |
Merge branch 'next-hex2bin' of git://github.com/mzohar/linux-evm into next
Diffstat (limited to 'security')
-rw-r--r-- | security/keys/encrypted-keys/encrypted.c | 14 | ||||
-rw-r--r-- | security/keys/trusted.c | 19 |
2 files changed, 26 insertions, 7 deletions
diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c index 3f577954b85a..f33804c1b4c8 100644 --- a/security/keys/encrypted-keys/encrypted.c +++ b/security/keys/encrypted-keys/encrypted.c | |||
@@ -667,11 +667,19 @@ static int encrypted_key_decrypt(struct encrypted_key_payload *epayload, | |||
667 | return -EINVAL; | 667 | return -EINVAL; |
668 | 668 | ||
669 | hex_encoded_data = hex_encoded_iv + (2 * ivsize) + 2; | 669 | hex_encoded_data = hex_encoded_iv + (2 * ivsize) + 2; |
670 | hex2bin(epayload->iv, hex_encoded_iv, ivsize); | 670 | ret = hex2bin(epayload->iv, hex_encoded_iv, ivsize); |
671 | hex2bin(epayload->encrypted_data, hex_encoded_data, encrypted_datalen); | 671 | if (ret < 0) |
672 | return -EINVAL; | ||
673 | ret = hex2bin(epayload->encrypted_data, hex_encoded_data, | ||
674 | encrypted_datalen); | ||
675 | if (ret < 0) | ||
676 | return -EINVAL; | ||
672 | 677 | ||
673 | hmac = epayload->format + epayload->datablob_len; | 678 | hmac = epayload->format + epayload->datablob_len; |
674 | hex2bin(hmac, hex_encoded_data + (encrypted_datalen * 2), HASH_SIZE); | 679 | ret = hex2bin(hmac, hex_encoded_data + (encrypted_datalen * 2), |
680 | HASH_SIZE); | ||
681 | if (ret < 0) | ||
682 | return -EINVAL; | ||
675 | 683 | ||
676 | mkey = request_master_key(epayload, &master_key, &master_keylen); | 684 | mkey = request_master_key(epayload, &master_key, &master_keylen); |
677 | if (IS_ERR(mkey)) | 685 | if (IS_ERR(mkey)) |
diff --git a/security/keys/trusted.c b/security/keys/trusted.c index 0c33e2ea1f3c..0964fc236946 100644 --- a/security/keys/trusted.c +++ b/security/keys/trusted.c | |||
@@ -779,7 +779,10 @@ static int getoptions(char *c, struct trusted_key_payload *pay, | |||
779 | opt->pcrinfo_len = strlen(args[0].from) / 2; | 779 | opt->pcrinfo_len = strlen(args[0].from) / 2; |
780 | if (opt->pcrinfo_len > MAX_PCRINFO_SIZE) | 780 | if (opt->pcrinfo_len > MAX_PCRINFO_SIZE) |
781 | return -EINVAL; | 781 | return -EINVAL; |
782 | hex2bin(opt->pcrinfo, args[0].from, opt->pcrinfo_len); | 782 | res = hex2bin(opt->pcrinfo, args[0].from, |
783 | opt->pcrinfo_len); | ||
784 | if (res < 0) | ||
785 | return -EINVAL; | ||
783 | break; | 786 | break; |
784 | case Opt_keyhandle: | 787 | case Opt_keyhandle: |
785 | res = strict_strtoul(args[0].from, 16, &handle); | 788 | res = strict_strtoul(args[0].from, 16, &handle); |
@@ -791,12 +794,18 @@ static int getoptions(char *c, struct trusted_key_payload *pay, | |||
791 | case Opt_keyauth: | 794 | case Opt_keyauth: |
792 | if (strlen(args[0].from) != 2 * SHA1_DIGEST_SIZE) | 795 | if (strlen(args[0].from) != 2 * SHA1_DIGEST_SIZE) |
793 | return -EINVAL; | 796 | return -EINVAL; |
794 | hex2bin(opt->keyauth, args[0].from, SHA1_DIGEST_SIZE); | 797 | res = hex2bin(opt->keyauth, args[0].from, |
798 | SHA1_DIGEST_SIZE); | ||
799 | if (res < 0) | ||
800 | return -EINVAL; | ||
795 | break; | 801 | break; |
796 | case Opt_blobauth: | 802 | case Opt_blobauth: |
797 | if (strlen(args[0].from) != 2 * SHA1_DIGEST_SIZE) | 803 | if (strlen(args[0].from) != 2 * SHA1_DIGEST_SIZE) |
798 | return -EINVAL; | 804 | return -EINVAL; |
799 | hex2bin(opt->blobauth, args[0].from, SHA1_DIGEST_SIZE); | 805 | res = hex2bin(opt->blobauth, args[0].from, |
806 | SHA1_DIGEST_SIZE); | ||
807 | if (res < 0) | ||
808 | return -EINVAL; | ||
800 | break; | 809 | break; |
801 | case Opt_migratable: | 810 | case Opt_migratable: |
802 | if (*args[0].from == '0') | 811 | if (*args[0].from == '0') |
@@ -860,7 +869,9 @@ static int datablob_parse(char *datablob, struct trusted_key_payload *p, | |||
860 | p->blob_len = strlen(c) / 2; | 869 | p->blob_len = strlen(c) / 2; |
861 | if (p->blob_len > MAX_BLOB_SIZE) | 870 | if (p->blob_len > MAX_BLOB_SIZE) |
862 | return -EINVAL; | 871 | return -EINVAL; |
863 | hex2bin(p->blob, c, p->blob_len); | 872 | ret = hex2bin(p->blob, c, p->blob_len); |
873 | if (ret < 0) | ||
874 | return -EINVAL; | ||
864 | ret = getoptions(datablob, p, o); | 875 | ret = getoptions(datablob, p, o); |
865 | if (ret < 0) | 876 | if (ret < 0) |
866 | return ret; | 877 | return ret; |