genode/repos/dde_linux/patches/wifi_crypto.patch

102 lines
3.3 KiB
Diff
Raw Normal View History

diff --git a/crypto/ccm.c b/crypto/ccm.c
index 1df8421..a5ee033 100644
--- a/crypto/ccm.c
+++ b/crypto/ccm.c
@@ -52,7 +52,8 @@ static inline struct crypto_ccm_req_priv_ctx *crypto_ccm_reqctx(
{
unsigned long align = crypto_aead_alignmask(crypto_aead_reqtfm(req));
- return (void *)PTR_ALIGN((u8 *)aead_request_ctx(req), align + 1);
+ u8 *p = (u8 *) aead_request_ctx(req);
+ return (void *)PTR_ALIGN(p, (align + 1));
}
static int set_msg_len(u8 *block, unsigned int msglen, int csize)
@@ -681,8 +682,10 @@ static struct aead_request *crypto_rfc4309_crypt(struct aead_request *req)
struct crypto_aead *aead = crypto_aead_reqtfm(req);
struct crypto_rfc4309_ctx *ctx = crypto_aead_ctx(aead);
struct crypto_aead *child = ctx->child;
- u8 *iv = PTR_ALIGN((u8 *)(subreq + 1) + crypto_aead_reqsize(child),
- crypto_aead_alignmask(child) + 1);
+
+ unsigned long m = crypto_aead_alignmask(child) + 1;
+ u8 *p = (u8 *)(subreq + 1) + crypto_aead_reqsize(child);
+ u8 *iv = PTR_ALIGN(p, m);
/* L' */
iv[0] = 3;
diff --git a/crypto/ctr.c b/crypto/ctr.c
index f2b94f2..b345689 100644
--- a/crypto/ctr.c
+++ b/crypto/ctr.c
@@ -59,7 +59,9 @@ static void crypto_ctr_crypt_final(struct blkcipher_walk *walk,
unsigned long alignmask = crypto_cipher_alignmask(tfm);
u8 *ctrblk = walk->iv;
u8 tmp[bsize + alignmask];
- u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1);
+ u8 *p = (u8*)(tmp + 0);
+ unsigned long m = alignmask + 1;
+ u8 *keystream = PTR_ALIGN(p, m);
u8 *src = walk->src.virt.addr;
u8 *dst = walk->dst.virt.addr;
unsigned int nbytes = walk->nbytes;
@@ -108,7 +110,9 @@ static int crypto_ctr_crypt_inplace(struct blkcipher_walk *walk,
u8 *ctrblk = walk->iv;
u8 *src = walk->src.virt.addr;
u8 tmp[bsize + alignmask];
- u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1);
+ unsigned long m = alignmask + 1;
+ u8 *p = (u8*)(tmp + 0);
+ u8 *keystream = PTR_ALIGN(p , m);
do {
/* create keystream */
@@ -281,8 +285,11 @@ static int crypto_rfc3686_crypt(struct ablkcipher_request *req)
struct crypto_rfc3686_ctx *ctx = crypto_ablkcipher_ctx(tfm);
struct crypto_ablkcipher *child = ctx->child;
unsigned long align = crypto_ablkcipher_alignmask(tfm);
+
+ unsigned long m = align + 1;
+ u8 *p = (u8*) ablkcipher_request_ctx(req);
struct crypto_rfc3686_req_ctx *rctx =
- (void *)PTR_ALIGN((u8 *)ablkcipher_request_ctx(req), align + 1);
+ (void *)PTR_ALIGN(p, m);
struct ablkcipher_request *subreq = &rctx->subreq;
u8 *iv = rctx->iv;
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -201,8 +201,10 @@ void __ablkcipher_walk_complete(struct ablkcipher_walk *walk);
static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
{
- return PTR_ALIGN(crypto_tfm_ctx(tfm),
- crypto_tfm_alg_alignmask(tfm) + 1);
+ void *p = crypto_tfm_ctx(tfm);
+ unsigned int m = crypto_tfm_alg_alignmask(tfm) + 1;
+
+ return PTR_ALIGN(p, m);
}
static inline struct crypto_instance *crypto_tfm_alg_instance(
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -90,6 +90,8 @@ out:
crypto_alg_put(&param->larval->alg);
kfree(param);
module_put_and_exit(0);
+
+ return 0;
}
static int cryptomgr_schedule_probe(struct crypto_larval *larval)
@@ -228,6 +230,8 @@ skiptest:
kfree(param);
module_put_and_exit(0);
+
+ return 0;
}
static int cryptomgr_schedule_test(struct crypto_alg *alg)