From: Behan Webster <[email protected]>
These patches remove the use of Variable Length Arrays In Structs (VLAIS) in
crypto related code. Presented here for comments as a whole (since they all do
the same thing in the same way). Once everyone is happy I will submit them
individually to their appropriate maintainers.
The LLVMLinux project aims to fully build the Linux kernel using both gcc and
clang (the C front end for the LLVM compiler infrastructure project).
Jan-Simon Möller (4):
crypto, dm: LLVMLinux: Remove VLAIS usage from dm-crypt
crypto: LLVMLinux: Remove VLAIS usage from crypto/hmac.c
crypto: LLVMLinux: Remove VLAIS usage from libcrc32c.c
crypto: LLVMLinux: Remove VLAIS usage from crypto/testmgr.c
Vinícius Tinti (2):
apparmor: LLVMLinux: Remove VLAIS
btrfs: LLVMLinux: Remove VLAIS
crypto/hmac.c | 27 +++++++++++++--------------
crypto/testmgr.c | 16 ++++++++--------
drivers/md/dm-crypt.c | 38 ++++++++++++++++++--------------------
fs/btrfs/hash.c | 18 +++++++++---------
lib/libcrc32c.c | 18 +++++++++---------
security/apparmor/crypto.c | 19 +++++++++----------
6 files changed, 66 insertions(+), 70 deletions(-)
--
1.9.1
From: Jan-Simon Möller <[email protected]>
The use of variable length arrays in structs (VLAIS) in the Linux Kernel code
precludes the use of compilers which don't implement VLAIS (for instance the
Clang compiler). This patch instead allocates the appropriate amount of memory
using an char array.
struct shash_desc contains a flexible array member member ctx declared with
CRYPTO_MINALIGN_ATTR, so sizeof(struct shash_desc) aligns the beginning
of the array declared after struct shash_desc with long long.
No trailing padding is required because it is not a struct type that can
be used in an array.
The CRYPTO_MINALIGN_ATTR is required so that desc is aligned with long long
as would be the case for a struct containing a member with
CRYPTO_MINALIGN_ATTR.
Signed-off-by: Jan-Simon Möller <[email protected]>
Signed-off-by: Behan Webster <[email protected]>
Cc: [email protected]
---
crypto/testmgr.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ac2b631..f4bf5c2 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1714,16 +1714,16 @@ static int alg_test_crc32c(const struct alg_test_desc *desc,
}
do {
- struct {
- struct shash_desc shash;
- char ctx[crypto_shash_descsize(tfm)];
- } sdesc;
+ char sdesc[sizeof(struct shash_desc)
+ + crypto_shash_descsize(tfm)] CRYPTO_MINALIGN_ATTR;
+ struct shash_desc *shash = (struct shash_desc *)sdesc;
+ u32 *ctx = (u32 *)shash_desc_ctx(shash);
- sdesc.shash.tfm = tfm;
- sdesc.shash.flags = 0;
+ shash->tfm = tfm;
+ shash->flags = 0;
- *(u32 *)sdesc.ctx = le32_to_cpu(420553207);
- err = crypto_shash_final(&sdesc.shash, (u8 *)&val);
+ *ctx = le32_to_cpu(420553207);
+ err = crypto_shash_final(shash, (u8 *)&val);
if (err) {
printk(KERN_ERR "alg: crc32c: Operation failed for "
"%s: %d\n", driver, err);
--
1.9.1
From: Jan-Simon Möller <[email protected]>
The use of variable length arrays in structs (VLAIS) in the Linux Kernel code
precludes the use of compilers which don't implement VLAIS (for instance the
Clang compiler). This patch instead allocates the appropriate amount of memory
using an char array.
struct shash_desc contains a flexible array member member ctx declared with
CRYPTO_MINALIGN_ATTR, so sizeof(struct shash_desc) aligns the beginning
of the array declared after struct shash_desc with long long.
No trailing padding is required because it is not a struct type that can
be used in an array.
The CRYPTO_MINALIGN_ATTR is required so that desc is aligned with long long
as would be the case for a struct containing a member with
CRYPTO_MINALIGN_ATTR.
Signed-off-by: Jan-Simon Möller <[email protected]>
Signed-off-by: Behan Webster <[email protected]>
Cc: [email protected]
---
lib/libcrc32c.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c
index b3131f5..03f2cf3 100644
--- a/lib/libcrc32c.c
+++ b/lib/libcrc32c.c
@@ -41,20 +41,20 @@ static struct crypto_shash *tfm;
u32 crc32c(u32 crc, const void *address, unsigned int length)
{
- struct {
- struct shash_desc shash;
- char ctx[crypto_shash_descsize(tfm)];
- } desc;
+ char desc[sizeof(struct shash_desc)
+ + crypto_shash_descsize(tfm)] CRYPTO_MINALIGN_ATTR;
+ struct shash_desc *shash = (struct shash_desc *)desc;
+ u32 *ctx = (u32 *)shash_desc_ctx(shash);
int err;
- desc.shash.tfm = tfm;
- desc.shash.flags = 0;
- *(u32 *)desc.ctx = crc;
+ shash->tfm = tfm;
+ shash->flags = 0;
+ *ctx = crc;
- err = crypto_shash_update(&desc.shash, address, length);
+ err = crypto_shash_update(shash, address, length);
BUG_ON(err);
- return *(u32 *)desc.ctx;
+ return *ctx;
}
EXPORT_SYMBOL(crc32c);
--
1.9.1
From: Jan-Simon Möller <[email protected]>
The use of variable length arrays in structs (VLAIS) in the Linux Kernel code
precludes the use of compilers which don't implement VLAIS (for instance the
Clang compiler). This patch instead allocates the appropriate amount of memory
using an char array.
struct shash_desc contains a flexible array member member ctx declared with
CRYPTO_MINALIGN_ATTR, so sizeof(struct shash_desc) aligns the beginning
of the array declared after struct shash_desc with long long.
No trailing padding is required because it is not a struct type that can
be used in an array.
The CRYPTO_MINALIGN_ATTR is required so that desc is aligned with long long
as would be the case for a struct containing a member with
CRYPTO_MINALIGN_ATTR.
Signed-off-by: Jan-Simon Möller <[email protected]>
Signed-off-by: Behan Webster <[email protected]>
Cc: [email protected]
---
crypto/hmac.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/crypto/hmac.c b/crypto/hmac.c
index 8d9544c..00ce204 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -52,20 +52,19 @@ static int hmac_setkey(struct crypto_shash *parent,
struct hmac_ctx *ctx = align_ptr(opad + ss,
crypto_tfm_ctx_alignment());
struct crypto_shash *hash = ctx->hash;
- struct {
- struct shash_desc shash;
- char ctx[crypto_shash_descsize(hash)];
- } desc;
+ char desc[sizeof(struct shash_desc)
+ + crypto_shash_descsize(hash)] CRYPTO_MINALIGN_ATTR;
+ struct shash_desc *shash = (struct shash_desc *)desc;
unsigned int i;
- desc.shash.tfm = hash;
- desc.shash.flags = crypto_shash_get_flags(parent) &
- CRYPTO_TFM_REQ_MAY_SLEEP;
+ shash->tfm = hash;
+ shash->flags = crypto_shash_get_flags(parent)
+ & CRYPTO_TFM_REQ_MAY_SLEEP;
if (keylen > bs) {
int err;
- err = crypto_shash_digest(&desc.shash, inkey, keylen, ipad);
+ err = crypto_shash_digest(shash, inkey, keylen, ipad);
if (err)
return err;
@@ -81,12 +80,12 @@ static int hmac_setkey(struct crypto_shash *parent,
opad[i] ^= 0x5c;
}
- return crypto_shash_init(&desc.shash) ?:
- crypto_shash_update(&desc.shash, ipad, bs) ?:
- crypto_shash_export(&desc.shash, ipad) ?:
- crypto_shash_init(&desc.shash) ?:
- crypto_shash_update(&desc.shash, opad, bs) ?:
- crypto_shash_export(&desc.shash, opad);
+ return crypto_shash_init(shash) ?:
+ crypto_shash_update(shash, ipad, bs) ?:
+ crypto_shash_export(shash, ipad) ?:
+ crypto_shash_init(shash) ?:
+ crypto_shash_update(shash, opad, bs) ?:
+ crypto_shash_export(shash, opad);
}
static int hmac_export(struct shash_desc *pdesc, void *out)
--
1.9.1
From: Vinícius Tinti <[email protected]>
Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99
compliant equivalent. This is the original VLAIS struct.
struct {
struct shash_desc shash;
char ctx[crypto_shash_descsize(tfm)];
} desc;
This patch instead allocates the appropriate amount of memory using an char
array.
The new code can be compiled with both gcc and clang.
struct shash_desc contains a flexible array member member ctx declared with
CRYPTO_MINALIGN_ATTR, so sizeof(struct shash_desc) aligns the beginning
of the array declared after struct shash_desc with long long.
No trailing padding is required because it is not a struct type that can
be used in an array.
The CRYPTO_MINALIGN_ATTR is required so that desc is aligned with long long
as would be the case for a struct containing a member with
CRYPTO_MINALIGN_ATTR.
Signed-off-by: Jan-Simon Möller <[email protected]>
Signed-off-by: Behan Webster <[email protected]>
Signed-off-by: Vinícius Tinti <[email protected]>
Signed-off-by: Mark Charlebois <[email protected]>
---
fs/btrfs/hash.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/btrfs/hash.c b/fs/btrfs/hash.c
index 85889aa..2fdacda 100644
--- a/fs/btrfs/hash.c
+++ b/fs/btrfs/hash.c
@@ -33,18 +33,18 @@ void btrfs_hash_exit(void)
u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length)
{
- struct {
- struct shash_desc shash;
- char ctx[crypto_shash_descsize(tfm)];
- } desc;
+ char desc[sizeof(struct shash_desc)
+ + crypto_shash_descsize(tfm)] CRYPTO_MINALIGN_ATTR;
+ struct shash_desc *shash = (struct shash_desc *)desc;
+ u32 *ctx = (u32 *)shash_desc_ctx(shash);
int err;
- desc.shash.tfm = tfm;
- desc.shash.flags = 0;
- *(u32 *)desc.ctx = crc;
+ shash->tfm = tfm;
+ shash->flags = 0;
+ *ctx = crc;
- err = crypto_shash_update(&desc.shash, address, length);
+ err = crypto_shash_update(shash, address, length);
BUG_ON(err);
- return *(u32 *)desc.ctx;
+ return *ctx;
}
--
1.9.1
From: Jan-Simon Möller <[email protected]>
The use of variable length arrays in structs (VLAIS) in the Linux Kernel code
precludes the use of compilers which don't implement VLAIS (for instance the
Clang compiler). This patch instead allocates the appropriate amount of memory
using an char array.
struct shash_desc contains a flexible array member member ctx declared with
CRYPTO_MINALIGN_ATTR, so sizeof(struct shash_desc) aligns the beginning
of the array declared after struct shash_desc with long long.
No trailing padding is required because it is not a struct type that can
be used in an array.
The CRYPTO_MINALIGN_ATTR is required so that desc is aligned with long long
as would be the case for a struct containing a member with
CRYPTO_MINALIGN_ATTR.
Signed-off-by: Jan-Simon Möller <[email protected]>
Signed-off-by: Behan Webster <[email protected]>
Cc: [email protected]
---
drivers/md/dm-crypt.c | 38 ++++++++++++++++++--------------------
1 file changed, 18 insertions(+), 20 deletions(-)
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index cd15e08..4d940d3 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -526,29 +526,28 @@ static int crypt_iv_lmk_one(struct crypt_config *cc, u8 *iv,
u8 *data)
{
struct iv_lmk_private *lmk = &cc->iv_gen_private.lmk;
- struct {
- struct shash_desc desc;
- char ctx[crypto_shash_descsize(lmk->hash_tfm)];
- } sdesc;
+ char sdesc[sizeof(struct shash_desc)
+ + crypto_shash_descsize(lmk->hash_tfm)] CRYPTO_MINALIGN_ATTR;
+ struct shash_desc *desc = (struct shash_desc *)sdesc;
struct md5_state md5state;
__le32 buf[4];
int i, r;
- sdesc.desc.tfm = lmk->hash_tfm;
- sdesc.desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
+ desc->tfm = lmk->hash_tfm;
+ desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
- r = crypto_shash_init(&sdesc.desc);
+ r = crypto_shash_init(desc);
if (r)
return r;
if (lmk->seed) {
- r = crypto_shash_update(&sdesc.desc, lmk->seed, LMK_SEED_SIZE);
+ r = crypto_shash_update(desc, lmk->seed, LMK_SEED_SIZE);
if (r)
return r;
}
/* Sector is always 512B, block size 16, add data of blocks 1-31 */
- r = crypto_shash_update(&sdesc.desc, data + 16, 16 * 31);
+ r = crypto_shash_update(desc, data + 16, 16 * 31);
if (r)
return r;
@@ -557,12 +556,12 @@ static int crypt_iv_lmk_one(struct crypt_config *cc, u8 *iv,
buf[1] = cpu_to_le32((((u64)dmreq->iv_sector >> 32) & 0x00FFFFFF) | 0x80000000);
buf[2] = cpu_to_le32(4024);
buf[3] = 0;
- r = crypto_shash_update(&sdesc.desc, (u8 *)buf, sizeof(buf));
+ r = crypto_shash_update(desc, (u8 *)buf, sizeof(buf));
if (r)
return r;
/* No MD5 padding here */
- r = crypto_shash_export(&sdesc.desc, &md5state);
+ r = crypto_shash_export(desc, &md5state);
if (r)
return r;
@@ -679,10 +678,9 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc,
struct iv_tcw_private *tcw = &cc->iv_gen_private.tcw;
u64 sector = cpu_to_le64((u64)dmreq->iv_sector);
u8 buf[TCW_WHITENING_SIZE];
- struct {
- struct shash_desc desc;
- char ctx[crypto_shash_descsize(tcw->crc32_tfm)];
- } sdesc;
+ char sdesc[sizeof(struct shash_desc)
+ + crypto_shash_descsize(tcw->crc32_tfm)] CRYPTO_MINALIGN_ATTR;
+ struct shash_desc *desc = (struct shash_desc *)sdesc;
int i, r;
/* xor whitening with sector number */
@@ -691,16 +689,16 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc,
crypto_xor(&buf[8], (u8 *)§or, 8);
/* calculate crc32 for every 32bit part and xor it */
- sdesc.desc.tfm = tcw->crc32_tfm;
- sdesc.desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
+ desc->tfm = tcw->crc32_tfm;
+ desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
for (i = 0; i < 4; i++) {
- r = crypto_shash_init(&sdesc.desc);
+ r = crypto_shash_init(desc);
if (r)
goto out;
- r = crypto_shash_update(&sdesc.desc, &buf[i * 4], 4);
+ r = crypto_shash_update(desc, &buf[i * 4], 4);
if (r)
goto out;
- r = crypto_shash_final(&sdesc.desc, &buf[i * 4]);
+ r = crypto_shash_final(desc, &buf[i * 4]);
if (r)
goto out;
}
--
1.9.1
From: Vinícius Tinti <[email protected]>
Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99
compliant equivalent. This is the original VLAIS struct.
struct {
struct shash_desc shash;
char ctx[crypto_shash_descsize(apparmor_tfm)];
} desc;
This patch instead allocates the appropriate amount of memory using an
char array.
The new code can be compiled with both gcc and clang.
struct shash_desc contains a flexible array member member ctx declared with
CRYPTO_MINALIGN_ATTR, so sizeof(struct shash_desc) aligns the beginning
of the array declared after struct shash_desc with long long.
No trailing padding is required because it is not a struct type that can
be used in an array.
The CRYPTO_MINALIGN_ATTR is required so that desc is aligned with long long
as would be the case for a struct containing a member with
CRYPTO_MINALIGN_ATTR.
Signed-off-by: Jan-Simon Möller <[email protected]>
Signed-off-by: Behan Webster <[email protected]>
Signed-off-by: Vinícius Tinti <[email protected]>
Signed-off-by: Mark Charlebois <[email protected]>
---
security/apparmor/crypto.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/security/apparmor/crypto.c b/security/apparmor/crypto.c
index 532471d..62b32e7 100644
--- a/security/apparmor/crypto.c
+++ b/security/apparmor/crypto.c
@@ -32,10 +32,9 @@ unsigned int aa_hash_size(void)
int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start,
size_t len)
{
- struct {
- struct shash_desc shash;
- char ctx[crypto_shash_descsize(apparmor_tfm)];
- } desc;
+ char desc[sizeof(struct shash_desc)
+ + crypto_shash_descsize(apparmor_tfm)] CRYPTO_MINALIGN_ATTR;
+ struct shash_desc *shash = (struct shash_desc *)desc;
int error = -ENOMEM;
u32 le32_version = cpu_to_le32(version);
@@ -46,19 +45,19 @@ int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start,
if (!profile->hash)
goto fail;
- desc.shash.tfm = apparmor_tfm;
- desc.shash.flags = 0;
+ shash->tfm = apparmor_tfm;
+ shash->flags = 0;
- error = crypto_shash_init(&desc.shash);
+ error = crypto_shash_init(shash);
if (error)
goto fail;
- error = crypto_shash_update(&desc.shash, (u8 *) &le32_version, 4);
+ error = crypto_shash_update(shash, (u8 *) &le32_version, 4);
if (error)
goto fail;
- error = crypto_shash_update(&desc.shash, (u8 *) start, len);
+ error = crypto_shash_update(shash, (u8 *) start, len);
if (error)
goto fail;
- error = crypto_shash_final(&desc.shash, profile->hash);
+ error = crypto_shash_final(shash, profile->hash);
if (error)
goto fail;
--
1.9.1
Hi Behan,
> These patches remove the use of Variable Length Arrays In Structs (VLAIS) in
> crypto related code. Presented here for comments as a whole (since they all do
> the same thing in the same way). Once everyone is happy I will submit them
> individually to their appropriate maintainers.
>
> The LLVMLinux project aims to fully build the Linux kernel using both gcc and
> clang (the C front end for the LLVM compiler infrastructure project).
>
>
> Jan-Simon M?ller (4):
> crypto, dm: LLVMLinux: Remove VLAIS usage from dm-crypt
> crypto: LLVMLinux: Remove VLAIS usage from crypto/hmac.c
> crypto: LLVMLinux: Remove VLAIS usage from libcrc32c.c
> crypto: LLVMLinux: Remove VLAIS usage from crypto/testmgr.c
>
> Vin?cius Tinti (2):
> apparmor: LLVMLinux: Remove VLAIS
> btrfs: LLVMLinux: Remove VLAIS
>
> crypto/hmac.c | 27 +++++++++++++--------------
> crypto/testmgr.c | 16 ++++++++--------
> drivers/md/dm-crypt.c | 38 ++++++++++++++++++--------------------
> fs/btrfs/hash.c | 18 +++++++++---------
> lib/libcrc32c.c | 18 +++++++++---------
> security/apparmor/crypto.c | 19 +++++++++----------
> 6 files changed, 66 insertions(+), 70 deletions(-)
are you sure these are all of them? I know for a fact that we are using the same construct in net/bluetooth/amp.c as well.
Regards
Marcel
On 09/02/14 16:01, Marcel Holtmann wrote:
> Hi Behan,
>
>> These patches remove the use of Variable Length Arrays In Structs (VLAIS) in
>> crypto related code. Presented here for comments as a whole (since they all do
>> the same thing in the same way). Once everyone is happy I will submit them
>> individually to their appropriate maintainers.
>>
>> The LLVMLinux project aims to fully build the Linux kernel using both gcc and
>> clang (the C front end for the LLVM compiler infrastructure project).
>>
>>
>> Jan-Simon M?ller (4):
>> crypto, dm: LLVMLinux: Remove VLAIS usage from dm-crypt
>> crypto: LLVMLinux: Remove VLAIS usage from crypto/hmac.c
>> crypto: LLVMLinux: Remove VLAIS usage from libcrc32c.c
>> crypto: LLVMLinux: Remove VLAIS usage from crypto/testmgr.c
>>
>> Vin?cius Tinti (2):
>> apparmor: LLVMLinux: Remove VLAIS
>> btrfs: LLVMLinux: Remove VLAIS
>>
>> crypto/hmac.c | 27 +++++++++++++--------------
>> crypto/testmgr.c | 16 ++++++++--------
>> drivers/md/dm-crypt.c | 38 ++++++++++++++++++--------------------
>> fs/btrfs/hash.c | 18 +++++++++---------
>> lib/libcrc32c.c | 18 +++++++++---------
>> security/apparmor/crypto.c | 19 +++++++++----------
>> 6 files changed, 66 insertions(+), 70 deletions(-)
> are you sure these are all of them? I know for a fact that we are using the same construct in net/bluetooth/amp.c as well.
There have been other places where this was an issue before too (ext4,
mac80211, USB gadget, ...). Some have already been fixed.
Hmm. Yeah, I thought we had a patch for bluetooth too. I can't find it
now though.
Suffice it to say that similar patches are required for the other
instances of this kind of code elsewhere as well.
Thanks Marcel,
Behan
--
Behan Webster
[email protected]
On 09/02/2014 03:32 PM, [email protected] wrote:
> From: Vinícius Tinti <[email protected]>
>
> Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99
> compliant equivalent. This is the original VLAIS struct.
>
> struct {
> struct shash_desc shash;
> char ctx[crypto_shash_descsize(apparmor_tfm)];
> } desc;
>
> This patch instead allocates the appropriate amount of memory using an
> char array.
>
> The new code can be compiled with both gcc and clang.
>
> struct shash_desc contains a flexible array member member ctx declared with
> CRYPTO_MINALIGN_ATTR, so sizeof(struct shash_desc) aligns the beginning
> of the array declared after struct shash_desc with long long.
>
> No trailing padding is required because it is not a struct type that can
> be used in an array.
>
> The CRYPTO_MINALIGN_ATTR is required so that desc is aligned with long long
> as would be the case for a struct containing a member with
> CRYPTO_MINALIGN_ATTR.
>
> Signed-off-by: Jan-Simon Möller <[email protected]>
> Signed-off-by: Behan Webster <[email protected]>
> Signed-off-by: Vinícius Tinti <[email protected]>
> Signed-off-by: Mark Charlebois <[email protected]>
I'm fine with this, do you want me to pull it into my tree for our next push
or do you want this all to go together as a set?
Acked-by: John Johansen <[email protected]>
> ---
> security/apparmor/crypto.c | 19 +++++++++----------
> 1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/security/apparmor/crypto.c b/security/apparmor/crypto.c
> index 532471d..62b32e7 100644
> --- a/security/apparmor/crypto.c
> +++ b/security/apparmor/crypto.c
> @@ -32,10 +32,9 @@ unsigned int aa_hash_size(void)
> int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start,
> size_t len)
> {
> - struct {
> - struct shash_desc shash;
> - char ctx[crypto_shash_descsize(apparmor_tfm)];
> - } desc;
> + char desc[sizeof(struct shash_desc)
> + + crypto_shash_descsize(apparmor_tfm)] CRYPTO_MINALIGN_ATTR;
> + struct shash_desc *shash = (struct shash_desc *)desc;
> int error = -ENOMEM;
> u32 le32_version = cpu_to_le32(version);
>
> @@ -46,19 +45,19 @@ int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start,
> if (!profile->hash)
> goto fail;
>
> - desc.shash.tfm = apparmor_tfm;
> - desc.shash.flags = 0;
> + shash->tfm = apparmor_tfm;
> + shash->flags = 0;
>
> - error = crypto_shash_init(&desc.shash);
> + error = crypto_shash_init(shash);
> if (error)
> goto fail;
> - error = crypto_shash_update(&desc.shash, (u8 *) &le32_version, 4);
> + error = crypto_shash_update(shash, (u8 *) &le32_version, 4);
> if (error)
> goto fail;
> - error = crypto_shash_update(&desc.shash, (u8 *) start, len);
> + error = crypto_shash_update(shash, (u8 *) start, len);
> if (error)
> goto fail;
> - error = crypto_shash_final(&desc.shash, profile->hash);
> + error = crypto_shash_final(shash, profile->hash);
> if (error)
> goto fail;
>
>
On 09/02/14 16:16, John Johansen wrote:
>
> I'm fine with this, do you want me to pull it into my tree for our next push
> or do you want this all to go together as a set?
>
> Acked-by: John Johansen <[email protected]>
I'm more than happy for individual maintainers to pull relevant patches
into their trees for the next merge window.
They were presented as a RFC patch set purely to get consensus as a
group since its the same change across the board.
Happy to push your patch to you now.
Behan
--
Behan Webster
[email protected]
Same deal there, too!
Best,
JS