Commit f5d8660a authored by Herbert Xu's avatar Herbert Xu

crypto: aead - Fix aead_instance struct size

The struct aead_instance is meant to extend struct crypto_instance
by incorporating the extra members of struct aead_alg.  However,
the current layout which is copied from shash/ahash does not specify
the struct fully.  In particular only aead_alg is present.

For shash/ahash this works because users there add extra headroom
to sizeof(struct crypto_instance) when allocating the instance.
Unfortunately for aead, this bit was lost when the new aead_instance
was added.

Rather than fixing it like shash/ahash, this patch simply expands
struct aead_instance to contain what is supposed to be there, i.e.,
adding struct crypto_instance.

In order to not break existing AEAD users, this is done through an
anonymous union.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent edf18b91
...@@ -15,12 +15,19 @@ ...@@ -15,12 +15,19 @@
#include <crypto/aead.h> #include <crypto/aead.h>
#include <crypto/algapi.h> #include <crypto/algapi.h>
#include <linux/stddef.h>
#include <linux/types.h> #include <linux/types.h>
struct rtattr; struct rtattr;
struct aead_instance { struct aead_instance {
union {
struct {
char head[offsetof(struct aead_alg, base)];
struct crypto_instance base;
} s;
struct aead_alg alg; struct aead_alg alg;
};
}; };
struct crypto_aead_spawn { struct crypto_aead_spawn {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment