diff options
author | Kevin Hilman <khilman@linaro.org> | 2013-10-14 18:29:10 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@linaro.org> | 2013-10-14 18:29:24 -0400 |
commit | 7587b5965f57c1c4d6fd1377432a8473f5cd449a (patch) | |
tree | 85b7ced77656ac142369c6436df02b51d6d13527 /security/apparmor/crypto.c | |
parent | 6a9d10d529db69244baab335fb02caba3d6ebbc9 (diff) | |
parent | 8d71528343c69ce387bd5fdb4fd8dc2b9f69d97c (diff) |
Merge tag 'omap-for-v3.13/quirk-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/dt
From Tony Lindgren:
Changes needed to prepare for making omap3 device tree only:
- Always build in board-generic, and add pdata quirks and auxdata
support for it so we have all the pdata related quirks
in the same place.
- Merge of the drivers/pinctrl changes that are needed for PM
to continue working on omap3 and also needed for other omaps
eventually. The three pinctrl related patches have been acked
by Linus Walleij and are pulled into both the pinctrl tree
and this branch.
- Few defconfig related changes for drivers needed.
* tag 'omap-for-v3.13/quirk-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: (523 commits)
ARM: configs: omap2plus_defconfig: enable dwc3 and dependencies
ARM: OMAP2+: Add WLAN modules and of_serial to omap2plus_defconfig
ARM: OMAP2+: Run make savedefconfig on omap2plus_defconfig to shrink it
ARM: OMAP2+: Add minimal 8250 support for GPMC
ARM: OMAP2+: Use pdata quirks for wl12xx for omap3 evm and zoom3
ARM: OMAP: Move DT wake-up event handling over to use pinctrl-single-omap
ARM: OMAP2+: Add support for auxdata
pinctrl: single: Add support for auxdata
pinctrl: single: Add support for wake-up interrupts
pinctrl: single: Prepare for supporting SoC specific features
ARM: OMAP2+: igep0020: use display init from dss-common
ARM: OMAP2+: pdata-quirks: add legacy display init for IGEPv2 board
+Linux 3.12-rc4
Signed-off-by: Kevin Hilman <khilman@linaro.org>
Diffstat (limited to 'security/apparmor/crypto.c')
-rw-r--r-- | security/apparmor/crypto.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/security/apparmor/crypto.c b/security/apparmor/crypto.c index d6222ba4e919..532471d0b3a0 100644 --- a/security/apparmor/crypto.c +++ b/security/apparmor/crypto.c | |||
@@ -15,14 +15,14 @@ | |||
15 | * it should be. | 15 | * it should be. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/crypto.h> | 18 | #include <crypto/hash.h> |
19 | 19 | ||
20 | #include "include/apparmor.h" | 20 | #include "include/apparmor.h" |
21 | #include "include/crypto.h" | 21 | #include "include/crypto.h" |
22 | 22 | ||
23 | static unsigned int apparmor_hash_size; | 23 | static unsigned int apparmor_hash_size; |
24 | 24 | ||
25 | static struct crypto_hash *apparmor_tfm; | 25 | static struct crypto_shash *apparmor_tfm; |
26 | 26 | ||
27 | unsigned int aa_hash_size(void) | 27 | unsigned int aa_hash_size(void) |
28 | { | 28 | { |
@@ -32,35 +32,33 @@ unsigned int aa_hash_size(void) | |||
32 | int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start, | 32 | int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start, |
33 | size_t len) | 33 | size_t len) |
34 | { | 34 | { |
35 | struct scatterlist sg[2]; | 35 | struct { |
36 | struct hash_desc desc = { | 36 | struct shash_desc shash; |
37 | .tfm = apparmor_tfm, | 37 | char ctx[crypto_shash_descsize(apparmor_tfm)]; |
38 | .flags = 0 | 38 | } desc; |
39 | }; | ||
40 | int error = -ENOMEM; | 39 | int error = -ENOMEM; |
41 | u32 le32_version = cpu_to_le32(version); | 40 | u32 le32_version = cpu_to_le32(version); |
42 | 41 | ||
43 | if (!apparmor_tfm) | 42 | if (!apparmor_tfm) |
44 | return 0; | 43 | return 0; |
45 | 44 | ||
46 | sg_init_table(sg, 2); | ||
47 | sg_set_buf(&sg[0], &le32_version, 4); | ||
48 | sg_set_buf(&sg[1], (u8 *) start, len); | ||
49 | |||
50 | profile->hash = kzalloc(apparmor_hash_size, GFP_KERNEL); | 45 | profile->hash = kzalloc(apparmor_hash_size, GFP_KERNEL); |
51 | if (!profile->hash) | 46 | if (!profile->hash) |
52 | goto fail; | 47 | goto fail; |
53 | 48 | ||
54 | error = crypto_hash_init(&desc); | 49 | desc.shash.tfm = apparmor_tfm; |
50 | desc.shash.flags = 0; | ||
51 | |||
52 | error = crypto_shash_init(&desc.shash); | ||
55 | if (error) | 53 | if (error) |
56 | goto fail; | 54 | goto fail; |
57 | error = crypto_hash_update(&desc, &sg[0], 4); | 55 | error = crypto_shash_update(&desc.shash, (u8 *) &le32_version, 4); |
58 | if (error) | 56 | if (error) |
59 | goto fail; | 57 | goto fail; |
60 | error = crypto_hash_update(&desc, &sg[1], len); | 58 | error = crypto_shash_update(&desc.shash, (u8 *) start, len); |
61 | if (error) | 59 | if (error) |
62 | goto fail; | 60 | goto fail; |
63 | error = crypto_hash_final(&desc, profile->hash); | 61 | error = crypto_shash_final(&desc.shash, profile->hash); |
64 | if (error) | 62 | if (error) |
65 | goto fail; | 63 | goto fail; |
66 | 64 | ||
@@ -75,19 +73,19 @@ fail: | |||
75 | 73 | ||
76 | static int __init init_profile_hash(void) | 74 | static int __init init_profile_hash(void) |
77 | { | 75 | { |
78 | struct crypto_hash *tfm; | 76 | struct crypto_shash *tfm; |
79 | 77 | ||
80 | if (!apparmor_initialized) | 78 | if (!apparmor_initialized) |
81 | return 0; | 79 | return 0; |
82 | 80 | ||
83 | tfm = crypto_alloc_hash("sha1", 0, CRYPTO_ALG_ASYNC); | 81 | tfm = crypto_alloc_shash("sha1", 0, CRYPTO_ALG_ASYNC); |
84 | if (IS_ERR(tfm)) { | 82 | if (IS_ERR(tfm)) { |
85 | int error = PTR_ERR(tfm); | 83 | int error = PTR_ERR(tfm); |
86 | AA_ERROR("failed to setup profile sha1 hashing: %d\n", error); | 84 | AA_ERROR("failed to setup profile sha1 hashing: %d\n", error); |
87 | return error; | 85 | return error; |
88 | } | 86 | } |
89 | apparmor_tfm = tfm; | 87 | apparmor_tfm = tfm; |
90 | apparmor_hash_size = crypto_hash_digestsize(apparmor_tfm); | 88 | apparmor_hash_size = crypto_shash_digestsize(apparmor_tfm); |
91 | 89 | ||
92 | aa_info_message("AppArmor sha1 policy hashing enabled"); | 90 | aa_info_message("AppArmor sha1 policy hashing enabled"); |
93 | 91 | ||