Refreshed all patches.
Altered patches:
- 150-bridge_allow_receiption_on_disabled_port.patch
- 201-extra_optimization.patch
Remove upstreamed:
- 022-0006-crypto-crypto4xx-properly-set-IV-after-de-and-encryp.patch
Compile-tested on: ar71xx, cns3xxx, imx6, x86_64
Runtime-tested on: ar71xx, cns3xxx, imx6
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
LINUX_VERSION-3.18 = .136
LINUX_VERSION-4.9 = .171
-LINUX_VERSION-4.14 = .113
+LINUX_VERSION-4.14 = .114
LINUX_VERSION-4.19 = .36
LINUX_KERNEL_HASH-3.18.136 = 48c8775013d23229462134f911bbb14c7935096fcccfb19ce28ecd5f7154f35c
LINUX_KERNEL_HASH-4.9.171 = 431cd992bf74da9851dd5938dbe45ff7577219b84b237ae5e30067d483b57f01
-LINUX_KERNEL_HASH-4.14.113 = b24df2e37faaf2290999c507f9e29de98494f52429bcd35513c5b3e52eaddac2
+LINUX_KERNEL_HASH-4.14.114 = b75e1dcfabc8d18051a07cbf9b60eaee8ac470a2311fed20447fd0d022c19e15
LINUX_KERNEL_HASH-4.19.36 = b808b508177f9d288d94a3b9df7b01d5eac9fcc1804a794c913b2144de63f2bc
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
sa = (struct dynamic_sa_ctl *) ctx->sa_in;
- ctx->hash_final = 0;
- set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, SA_NOT_SAVE_IV,
- SA_LOAD_HASH_FROM_SA, SA_LOAD_IV_FROM_STATE,
-@@ -191,7 +188,6 @@ static int crypto4xx_hash_alg_init(struc
+ set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, (cm == CRYPTO_MODE_CBC ?
+ SA_SAVE_IV : SA_NOT_SAVE_IV),
+@@ -192,7 +189,6 @@ static int crypto4xx_hash_alg_init(struc
ctx->dev = my_alg->dev;
ctx->is_hash = 1;
/* Create SA */
if (ctx->sa_in_dma_addr || ctx->sa_out_dma_addr)
-@@ -256,7 +252,6 @@ int crypto4xx_hash_update(struct ahash_r
+@@ -257,7 +253,6 @@ int crypto4xx_hash_update(struct ahash_r
struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
ctx->is_hash = 1;
ctx->pd_ctl = 0x11;
ctx->direction = DIR_INBOUND;
-@@ -274,7 +269,6 @@ int crypto4xx_hash_digest(struct ahash_r
+@@ -275,7 +270,6 @@ int crypto4xx_hash_digest(struct ahash_r
{
struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -964,7 +964,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -973,7 +973,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
sa->sa_command_1.bf.hash_crypto_offset = 0;
pd->pd_ctl.w = ctx->pd_ctl;
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1116,7 +1116,9 @@ struct crypto4xx_alg_common crypto4xx_al
+@@ -1125,7 +1125,9 @@ struct crypto4xx_alg_common crypto4xx_al
.cra_name = "cbc(aes)",
.cra_driver_name = "cbc-aes-ppc4xx",
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1081,7 +1081,6 @@ static void crypto4xx_bh_tasklet_cb(unsi
+@@ -1090,7 +1090,6 @@ static void crypto4xx_bh_tasklet_cb(unsi
pd->pd_ctl.bf.pe_done = 0;
crypto4xx_pd_done(core_dev->dev, tail);
crypto4xx_put_pd_to_pdr(core_dev->dev, tail);
--- a/drivers/crypto/amcc/crypto4xx_alg.c
+++ b/drivers/crypto/amcc/crypto4xx_alg.c
-@@ -149,7 +149,7 @@ static int crypto4xx_setkey_aes(struct c
+@@ -150,7 +150,7 @@ static int crypto4xx_setkey_aes(struct c
SA_NOT_COPY_HDR);
crypto4xx_memcpy_le(ctx->sa_in + get_dynamic_sa_offset_key_field(ctx),
key, keylen);
sa->sa_command_1.bf.key_len = keylen >> 3;
ctx->is_hash = 0;
ctx->direction = DIR_INBOUND;
-@@ -219,7 +219,7 @@ static int crypto4xx_hash_alg_init(struc
+@@ -220,7 +220,7 @@ static int crypto4xx_hash_alg_init(struc
SA_NOT_COPY_PAD, SA_NOT_COPY_PAYLOAD,
SA_NOT_COPY_HDR);
ctx->direction = DIR_INBOUND;
}
/**
-@@ -147,15 +147,15 @@ static int crypto4xx_setkey_aes(struct c
+@@ -148,15 +148,15 @@ static int crypto4xx_setkey_aes(struct c
SA_SEQ_MASK_OFF, SA_MC_ENABLE,
SA_NOT_COPY_PAD, SA_NOT_COPY_PAYLOAD,
SA_NOT_COPY_HDR);
memcpy(ctx->sa_out, ctx->sa_in, ctx->sa_len * 4);
sa = (struct dynamic_sa_ctl *) ctx->sa_out;
-@@ -225,7 +225,7 @@ static int crypto4xx_hash_alg_init(struc
+@@ -226,7 +226,7 @@ static int crypto4xx_hash_alg_init(struc
memset(sa_in->inner_digest, 0, sizeof(sa_in->inner_digest));
memset(sa_in->outer_digest, 0, sizeof(sa_in->outer_digest));
sa_in->state_ptr = ctx->state_record_dma_addr;
#include "crypto4xx_reg_def.h"
#include "crypto4xx_core.h"
#include "crypto4xx_sa.h"
-@@ -171,6 +172,71 @@ int crypto4xx_setkey_aes_cbc(struct cryp
+@@ -172,6 +173,71 @@ int crypto4xx_setkey_aes_cbc(struct cryp
CRYPTO_FEEDBACK_MODE_NO_FB);
}
#include <crypto/sha.h>
#include "crypto4xx_reg_def.h"
#include "crypto4xx_core.h"
-@@ -1135,6 +1136,103 @@ struct crypto4xx_alg_common crypto4xx_al
+@@ -1144,6 +1145,103 @@ struct crypto4xx_alg_common crypto4xx_al
}
}
}},
- sa = (struct dynamic_sa_ctl *) ctx->sa_in;
+ sa = ctx->sa_in;
- set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, SA_NOT_SAVE_IV,
- SA_LOAD_HASH_FROM_SA, SA_LOAD_IV_FROM_STATE,
-@@ -159,7 +159,7 @@ static int crypto4xx_setkey_aes(struct c
+ set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, (cm == CRYPTO_MODE_CBC ?
+ SA_SAVE_IV : SA_NOT_SAVE_IV),
+@@ -160,7 +160,7 @@ static int crypto4xx_setkey_aes(struct c
ctx->offset_to_sr_ptr = get_dynamic_sa_offset_state_ptr_field(sa);
memcpy(ctx->sa_out, ctx->sa_in, ctx->sa_len * 4);
sa->sa_command_0.bf.dir = DIR_OUTBOUND;
return 0;
-@@ -248,8 +248,7 @@ static int crypto4xx_hash_alg_init(struc
+@@ -249,8 +249,7 @@ static int crypto4xx_hash_alg_init(struc
struct crypto_alg *alg = tfm->__crt_alg;
struct crypto4xx_alg *my_alg = crypto_alg_to_crypto4xx_alg(alg);
struct crypto4xx_ctx *ctx = crypto_tfm_ctx(tfm);
int rc;
ctx->dev = my_alg->dev;
-@@ -273,25 +272,24 @@ static int crypto4xx_hash_alg_init(struc
+@@ -274,25 +273,24 @@ static int crypto4xx_hash_alg_init(struc
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
sizeof(struct crypto4xx_ctx));
return 0;
}
-@@ -302,7 +300,7 @@ int crypto4xx_hash_init(struct ahash_req
+@@ -303,7 +301,7 @@ int crypto4xx_hash_init(struct ahash_req
int ds;
struct dynamic_sa_ctl *sa;
SA_HASH_ALG_SHA1_DIGEST_SIZE);
}
-@@ -607,11 +600,9 @@ static u32 crypto4xx_ahash_done(struct c
+@@ -616,11 +609,9 @@ static u32 crypto4xx_ahash_done(struct c
static u32 crypto4xx_pd_done(struct crypto4xx_device *dev, u32 idx)
{
if (crypto_tfm_alg_type(pd_uinfo->async_req->tfm) ==
CRYPTO_ALG_TYPE_ABLKCIPHER)
return crypto4xx_ablkcipher_done(dev, pd_uinfo, pd);
-@@ -712,7 +703,6 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -721,7 +712,6 @@ u32 crypto4xx_build_pd(struct crypto_asy
unsigned long flags;
struct pd_uinfo *pd_uinfo = NULL;
unsigned int nbytes = datalen, idx;
u32 gd_idx = 0;
/* figure how many gd is needed */
-@@ -771,17 +761,15 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -780,17 +770,15 @@ u32 crypto4xx_build_pd(struct crypto_asy
}
spin_unlock_irqrestore(&dev->core_dev->lock, flags);
if (ctx->direction == DIR_INBOUND)
memcpy(sa, ctx->sa_in, ctx->sa_len * 4);
else
-@@ -791,14 +779,15 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -800,14 +788,15 @@ u32 crypto4xx_build_pd(struct crypto_asy
&pd_uinfo->sr_pa, 4);
if (iv_len)
}
}
pd->sa_len = ctx->sa_len;
-@@ -1006,9 +995,8 @@ static void crypto4xx_bh_tasklet_cb(unsi
+@@ -1015,9 +1004,8 @@ static void crypto4xx_bh_tasklet_cb(unsi
while (core_dev->dev->pdr_head != core_dev->dev->pdr_tail) {
tail = core_dev->dev->pdr_tail;
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1148,7 +1148,7 @@ struct crypto4xx_alg_common crypto4xx_al
+@@ -1157,7 +1157,7 @@ struct crypto4xx_alg_common crypto4xx_al
.min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE,
.ivsize = AES_IV_SIZE,
#include "crypto4xx_reg_def.h"
#include "crypto4xx_core.h"
#include "crypto4xx_sa.h"
-@@ -573,8 +574,10 @@ static u32 crypto4xx_ablkcipher_done(str
- dst->offset, dst->length, DMA_FROM_DEVICE);
+@@ -582,8 +583,10 @@ static u32 crypto4xx_ablkcipher_done(str
}
+
crypto4xx_ret_sg_desc(dev, pd_uinfo);
- if (ablk_req->base.complete != NULL)
- ablk_req->base.complete(&ablk_req->base, 0);
return 0;
}
-@@ -591,9 +594,10 @@ static u32 crypto4xx_ahash_done(struct c
+@@ -600,9 +603,10 @@ static u32 crypto4xx_ahash_done(struct c
crypto4xx_copy_digest_to_dst(pd_uinfo,
crypto_tfm_ctx(ahash_req->base.tfm));
crypto4xx_ret_sg_desc(dev, pd_uinfo);
return 0;
}
-@@ -704,6 +708,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -713,6 +717,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
struct pd_uinfo *pd_uinfo = NULL;
unsigned int nbytes = datalen, idx;
u32 gd_idx = 0;
/* figure how many gd is needed */
num_gd = sg_nents_for_len(src, datalen);
-@@ -734,6 +739,31 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -743,6 +748,31 @@ u32 crypto4xx_build_pd(struct crypto_asy
* already got must be return the original place.
*/
spin_lock_irqsave(&dev->core_dev->lock, flags);
if (num_gd) {
fst_gd = crypto4xx_get_n_gd(dev, num_gd);
if (fst_gd == ERING_WAS_FULL) {
-@@ -888,11 +918,12 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -897,11 +927,12 @@ u32 crypto4xx_build_pd(struct crypto_asy
sa->sa_command_1.bf.hash_crypto_offset = 0;
pd->pd_ctl.w = ctx->pd_ctl;
pd->pd_ctl_len.w = 0x00400000 | datalen;
}
/**
-@@ -997,7 +1028,7 @@ static void crypto4xx_bh_tasklet_cb(unsi
+@@ -1006,7 +1037,7 @@ static void crypto4xx_bh_tasklet_cb(unsi
tail = core_dev->dev->pdr_tail;
pd_uinfo = &core_dev->dev->pdr_uinfo[tail];
pd = &core_dev->dev->pdr[tail];
--- a/drivers/crypto/amcc/crypto4xx_alg.c
+++ b/drivers/crypto/amcc/crypto4xx_alg.c
-@@ -149,8 +149,8 @@ static int crypto4xx_setkey_aes(struct c
+@@ -150,8 +150,8 @@ static int crypto4xx_setkey_aes(struct c
SA_SEQ_MASK_OFF, SA_MC_ENABLE,
SA_NOT_COPY_PAD, SA_NOT_COPY_PAYLOAD,
SA_NOT_COPY_HDR);
ctx->is_hash = 0;
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -614,42 +614,6 @@ static u32 crypto4xx_pd_done(struct cryp
+@@ -623,42 +623,6 @@ static u32 crypto4xx_pd_done(struct cryp
return crypto4xx_ahash_done(dev, pd_uinfo);
}
static void crypto4xx_stop_all(struct crypto4xx_core_device *core_dev)
{
crypto4xx_destroy_pdr(core_dev->dev);
-@@ -809,8 +773,8 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -818,8 +782,8 @@ u32 crypto4xx_build_pd(struct crypto_asy
&pd_uinfo->sr_pa, 4);
if (iv_len)
}
/**
-@@ -153,11 +155,6 @@ static int crypto4xx_setkey_aes(struct c
+@@ -154,11 +156,6 @@ static int crypto4xx_setkey_aes(struct c
key, keylen);
sa->sa_contents.w = SA_AES_CONTENTS | (keylen << 2);
sa->sa_command_1.bf.key_len = keylen >> 3;
memcpy(ctx->sa_out, ctx->sa_in, ctx->sa_len * 4);
sa = ctx->sa_out;
-@@ -206,7 +203,7 @@ int crypto4xx_setkey_rfc3686(struct cryp
+@@ -207,7 +204,7 @@ int crypto4xx_setkey_rfc3686(struct cryp
if (rc)
return rc;
key + keylen - CTR_RFC3686_NONCE_SIZE, CTR_RFC3686_NONCE_SIZE);
return 0;
-@@ -215,27 +212,29 @@ int crypto4xx_setkey_rfc3686(struct cryp
+@@ -216,27 +213,29 @@ int crypto4xx_setkey_rfc3686(struct cryp
int crypto4xx_rfc3686_encrypt(struct ablkcipher_request *req)
{
struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
}
/**
-@@ -253,7 +252,6 @@ static int crypto4xx_hash_alg_init(struc
+@@ -254,7 +253,6 @@ static int crypto4xx_hash_alg_init(struc
int rc;
ctx->dev = my_alg->dev;
/* Create SA */
if (ctx->sa_in_dma_addr || ctx->sa_out_dma_addr)
-@@ -284,13 +282,9 @@ static int crypto4xx_hash_alg_init(struc
+@@ -285,13 +283,9 @@ static int crypto4xx_hash_alg_init(struc
SA_SEQ_MASK_OFF, SA_MC_ENABLE,
SA_NOT_COPY_PAD, SA_NOT_COPY_PAYLOAD,
SA_NOT_COPY_HDR);
return 0;
}
-@@ -306,23 +300,22 @@ int crypto4xx_hash_init(struct ahash_req
+@@ -307,23 +301,22 @@ int crypto4xx_hash_init(struct ahash_req
__crypto_ahash_cast(req->base.tfm));
sa->sa_command_0.bf.digest_len = ds >> 2;
sa->sa_command_0.bf.load_hash_state = SA_LOAD_HASH_FROM_SA;
}
int crypto4xx_hash_final(struct ahash_request *req)
-@@ -332,14 +325,16 @@ int crypto4xx_hash_final(struct ahash_re
+@@ -333,14 +326,16 @@ int crypto4xx_hash_final(struct ahash_re
int crypto4xx_hash_digest(struct ahash_request *req)
{
}
static void crypto4xx_ret_sg_desc(struct crypto4xx_device *dev,
-@@ -591,7 +583,7 @@ static u32 crypto4xx_ahash_done(struct c
+@@ -600,7 +592,7 @@ static u32 crypto4xx_ahash_done(struct c
ahash_req = ahash_request_cast(pd_uinfo->async_req);
ctx = crypto_tfm_ctx(ahash_req->base.tfm);
crypto_tfm_ctx(ahash_req->base.tfm));
crypto4xx_ret_sg_desc(dev, pd_uinfo);
-@@ -651,17 +643,17 @@ static u32 get_next_sd(u32 current)
+@@ -660,17 +652,17 @@ static u32 get_next_sd(u32 current)
return 0;
}
struct ce_gd *gd;
struct ce_pd *pd;
u32 num_gd, num_sd;
-@@ -669,8 +661,9 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -678,8 +670,9 @@ u32 crypto4xx_build_pd(struct crypto_asy
u32 fst_sd = 0xffffffff;
u32 pd_entry;
unsigned long flags;
u32 gd_idx = 0;
bool is_busy;
-@@ -684,7 +677,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -693,7 +686,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
num_gd = 0;
/* figure how many sd is needed */
num_sd = 0;
} else {
if (datalen > PPC4XX_SD_BUFFER_SIZE) {
-@@ -755,37 +748,27 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -764,37 +757,27 @@ u32 crypto4xx_build_pd(struct crypto_asy
}
spin_unlock_irqrestore(&dev->core_dev->lock, flags);
/* get first gd we are going to use */
gd_idx = fst_gd;
pd_uinfo->first_gd = fst_gd;
-@@ -794,27 +777,30 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -803,27 +786,30 @@ u32 crypto4xx_build_pd(struct crypto_asy
pd->src = gd_dma;
/* enable gather */
sa->sa_command_0.bf.gather = 1;
/*
* Disable gather in sa command
*/
-@@ -825,25 +811,24 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -834,25 +820,24 @@ u32 crypto4xx_build_pd(struct crypto_asy
pd_uinfo->first_gd = 0xffffffff;
pd_uinfo->num_gd = 0;
}
u32 sd_idx = fst_sd;
nbytes = datalen;
sa->sa_command_0.bf.scatter = 1;
-@@ -857,7 +842,6 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -866,7 +851,6 @@ u32 crypto4xx_build_pd(struct crypto_asy
sd->ctl.done = 0;
sd->ctl.rdy = 1;
/* sd->ptr should be setup by sd_init routine*/
if (nbytes >= PPC4XX_SD_BUFFER_SIZE)
nbytes -= PPC4XX_SD_BUFFER_SIZE;
else
-@@ -868,19 +852,23 @@ u32 crypto4xx_build_pd(struct crypto_asy
+@@ -877,19 +861,23 @@ u32 crypto4xx_build_pd(struct crypto_asy
/* setup scatter descriptor */
sd->ctl.done = 0;
sd->ctl.rdy = 1;
if (n >= PPC4XX_NUM_GD)
return ERING_WAS_FULL;
-@@ -616,17 +617,6 @@ static void crypto4xx_stop_all(struct cr
+@@ -625,17 +626,6 @@ static void crypto4xx_stop_all(struct cr
kfree(core_dev);
}
}
/**
-@@ -854,16 +857,16 @@ int crypto4xx_build_pd(struct crypto_asy
+@@ -863,16 +866,16 @@ int crypto4xx_build_pd(struct crypto_asy
}
}
writel(1, dev->ce_base + CRYPTO4XX_INT_DESCR_RD);
return is_busy ? -EBUSY : -EINPROGRESS;
}
-@@ -964,23 +967,23 @@ static void crypto4xx_bh_tasklet_cb(unsi
+@@ -973,23 +976,23 @@ static void crypto4xx_bh_tasklet_cb(unsi
struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev);
struct pd_uinfo *pd_uinfo;
struct ce_pd *pd;
/* Setup SA */
sa = ctx->sa_in;
-@@ -203,8 +196,8 @@ int crypto4xx_setkey_rfc3686(struct cryp
+@@ -204,8 +197,8 @@ int crypto4xx_setkey_rfc3686(struct cryp
if (rc)
return rc;
return 0;
}
-@@ -213,7 +206,7 @@ int crypto4xx_rfc3686_encrypt(struct abl
+@@ -214,7 +207,7 @@ int crypto4xx_rfc3686_encrypt(struct abl
{
struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
__le32 iv[AES_IV_SIZE / 4] = {
cpu_to_le32p((u32 *) req->info),
cpu_to_le32p((u32 *) (req->info + 4)),
cpu_to_le32(1) };
-@@ -227,7 +220,7 @@ int crypto4xx_rfc3686_decrypt(struct abl
+@@ -228,7 +221,7 @@ int crypto4xx_rfc3686_decrypt(struct abl
{
struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
__le32 iv[AES_IV_SIZE / 4] = {
cpu_to_le32p((u32 *) req->info),
cpu_to_le32p((u32 *) (req->info + 4)),
cpu_to_le32(1) };
-@@ -254,21 +247,13 @@ static int crypto4xx_hash_alg_init(struc
+@@ -255,21 +248,13 @@ static int crypto4xx_hash_alg_init(struc
ctx->dev = my_alg->dev;
/* Create SA */
/**
* alloc memory for the gather ring
* no need to alloc buf for the ring
-@@ -883,8 +852,6 @@ static int crypto4xx_alg_init(struct cry
+@@ -892,8 +861,6 @@ static int crypto4xx_alg_init(struct cry
ctx->dev = amcc_alg->dev;
ctx->sa_in = NULL;
ctx->sa_out = NULL;
ctx->sa_len = 0;
switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) {
-@@ -905,7 +872,6 @@ static void crypto4xx_alg_exit(struct cr
+@@ -914,7 +881,6 @@ static void crypto4xx_alg_exit(struct cr
struct crypto4xx_ctx *ctx = crypto_tfm_ctx(tfm);
crypto4xx_free_sa(ctx);
}
/**
-@@ -213,7 +214,7 @@ int crypto4xx_rfc3686_encrypt(struct abl
+@@ -214,7 +215,7 @@ int crypto4xx_rfc3686_encrypt(struct abl
return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst,
req->nbytes, iv, AES_IV_SIZE,
}
int crypto4xx_rfc3686_decrypt(struct ablkcipher_request *req)
-@@ -227,7 +228,7 @@ int crypto4xx_rfc3686_decrypt(struct abl
+@@ -228,7 +229,7 @@ int crypto4xx_rfc3686_decrypt(struct abl
return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst,
req->nbytes, iv, AES_IV_SIZE,
}
/**
-@@ -239,11 +240,13 @@ static int crypto4xx_hash_alg_init(struc
+@@ -240,11 +241,13 @@ static int crypto4xx_hash_alg_init(struc
unsigned char hm)
{
struct crypto_alg *alg = tfm->__crt_alg;
ctx->dev = my_alg->dev;
/* Create SA */
-@@ -300,7 +303,7 @@ int crypto4xx_hash_update(struct ahash_r
+@@ -301,7 +304,7 @@ int crypto4xx_hash_update(struct ahash_r
return crypto4xx_build_pd(&req->base, ctx, req->src, &dst,
req->nbytes, NULL, 0, ctx->sa_in,
}
int crypto4xx_hash_final(struct ahash_request *req)
-@@ -319,7 +322,7 @@ int crypto4xx_hash_digest(struct ahash_r
+@@ -320,7 +323,7 @@ int crypto4xx_hash_digest(struct ahash_r
return crypto4xx_build_pd(&req->base, ctx, req->src, &dst,
req->nbytes, NULL, 0, ctx->sa_in,
}
/**
-@@ -330,5 +333,3 @@ int crypto4xx_sha1_alg_init(struct crypt
+@@ -331,5 +334,3 @@ int crypto4xx_sha1_alg_init(struct crypt
return crypto4xx_hash_alg_init(tfm, SA_HASH160_LEN, SA_HASH_ALG_SHA1,
SA_HASH_MODE_HASH);
}
struct pd_uinfo *pd_uinfo,
struct ce_pd *pd)
{
-@@ -543,11 +545,9 @@ static u32 crypto4xx_ablkcipher_done(str
+@@ -552,11 +554,9 @@ static u32 crypto4xx_ablkcipher_done(str
if (pd_uinfo->state & PD_ENTRY_BUSY)
ablkcipher_request_complete(ablk_req, -EINPROGRESS);
ablkcipher_request_complete(ablk_req, 0);
struct pd_uinfo *pd_uinfo)
{
struct crypto4xx_ctx *ctx;
-@@ -563,20 +563,88 @@ static u32 crypto4xx_ahash_done(struct c
+@@ -572,20 +572,88 @@ static u32 crypto4xx_ahash_done(struct c
if (pd_uinfo->state & PD_ENTRY_BUSY)
ahash_request_complete(ahash_req, -EINPROGRESS);
ahash_request_complete(ahash_req, 0);
}
static void crypto4xx_stop_all(struct crypto4xx_core_device *core_dev)
-@@ -612,8 +680,10 @@ int crypto4xx_build_pd(struct crypto_asy
+@@ -621,8 +689,10 @@ int crypto4xx_build_pd(struct crypto_asy
const unsigned int datalen,
const __le32 *iv, const u32 iv_len,
const struct dynamic_sa_ctl *req_sa,
struct crypto4xx_device *dev = ctx->dev;
struct dynamic_sa_ctl *sa;
struct ce_gd *gd;
-@@ -627,18 +697,25 @@ int crypto4xx_build_pd(struct crypto_asy
+@@ -636,18 +706,25 @@ int crypto4xx_build_pd(struct crypto_asy
unsigned int nbytes = datalen;
size_t offset_to_sr_ptr;
u32 gd_idx = 0;
if (sg_is_last(dst)) {
num_sd = 0;
} else {
-@@ -724,6 +801,7 @@ int crypto4xx_build_pd(struct crypto_asy
+@@ -733,6 +810,7 @@ int crypto4xx_build_pd(struct crypto_asy
sa = pd_uinfo->sa_va;
memcpy(sa, req_sa, sa_len * 4);
offset_to_sr_ptr = get_dynamic_sa_offset_state_ptr_field(sa);
*(u32 *)((unsigned long)sa + offset_to_sr_ptr) = pd_uinfo->sr_pa;
-@@ -830,7 +908,7 @@ int crypto4xx_build_pd(struct crypto_asy
+@@ -839,7 +917,7 @@ int crypto4xx_build_pd(struct crypto_asy
((crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AHASH) |
(crypto_tfm_alg_type(req->tfm) == CRYPTO_ALG_TYPE_AEAD) ?
PD_CTL_HASH_FINAL : 0);
pd_uinfo->state = PD_ENTRY_INUSE | (is_busy ? PD_ENTRY_BUSY : 0);
wmb();
-@@ -843,40 +921,68 @@ int crypto4xx_build_pd(struct crypto_asy
+@@ -852,40 +930,68 @@ int crypto4xx_build_pd(struct crypto_asy
/**
* Algorithm Registration Functions
*/
{
struct crypto4xx_alg *alg;
int i;
-@@ -891,6 +997,10 @@ int crypto4xx_register_alg(struct crypto
+@@ -900,6 +1006,10 @@ int crypto4xx_register_alg(struct crypto
alg->dev = sec_dev;
switch (alg->alg.type) {
case CRYPTO_ALG_TYPE_AHASH:
rc = crypto_register_ahash(&alg->alg.u.hash);
break;
-@@ -920,6 +1030,10 @@ static void crypto4xx_unregister_alg(str
+@@ -929,6 +1039,10 @@ static void crypto4xx_unregister_alg(str
crypto_unregister_ahash(&alg->alg.u.hash);
break;
default:
crypto_unregister_alg(&alg->alg.u.cipher);
}
-@@ -973,7 +1087,7 @@ static irqreturn_t crypto4xx_ce_interrup
+@@ -982,7 +1096,7 @@ static irqreturn_t crypto4xx_ce_interrup
/**
* Supported Crypto Algorithms
*/
/* Crypto AES modes */
{ .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
.cra_name = "cbc(aes)",
-@@ -985,8 +1099,8 @@ struct crypto4xx_alg_common crypto4xx_al
+@@ -994,8 +1108,8 @@ struct crypto4xx_alg_common crypto4xx_al
.cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
.cra_type = &crypto_ablkcipher_type,
.cra_module = THIS_MODULE,
.cra_u = {
.ablkcipher = {
-@@ -1009,8 +1123,8 @@ struct crypto4xx_alg_common crypto4xx_al
+@@ -1018,8 +1132,8 @@ struct crypto4xx_alg_common crypto4xx_al
.cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
.cra_type = &crypto_ablkcipher_type,
.cra_module = THIS_MODULE,
.cra_u = {
.ablkcipher = {
-@@ -1033,8 +1147,8 @@ struct crypto4xx_alg_common crypto4xx_al
+@@ -1042,8 +1156,8 @@ struct crypto4xx_alg_common crypto4xx_al
.cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
.cra_type = &crypto_ablkcipher_type,
.cra_module = THIS_MODULE,
.cra_u = {
.ablkcipher = {
-@@ -1059,8 +1173,8 @@ struct crypto4xx_alg_common crypto4xx_al
+@@ -1068,8 +1182,8 @@ struct crypto4xx_alg_common crypto4xx_al
.cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
.cra_type = &crypto_ablkcipher_type,
.cra_module = THIS_MODULE,
.cra_u = {
.ablkcipher = {
-@@ -1082,8 +1196,8 @@ struct crypto4xx_alg_common crypto4xx_al
+@@ -1091,8 +1205,8 @@ struct crypto4xx_alg_common crypto4xx_al
.cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
.cra_type = &crypto_ablkcipher_type,
.cra_module = THIS_MODULE,
.cra_u = {
.ablkcipher = {
-@@ -1149,6 +1263,7 @@ static int crypto4xx_probe(struct platfo
+@@ -1158,6 +1272,7 @@ static int crypto4xx_probe(struct platfo
core_dev->device = dev;
spin_lock_init(&core_dev->lock);
INIT_LIST_HEAD(&core_dev->dev->alg_list);
--- a/drivers/crypto/amcc/crypto4xx_alg.c
+++ b/drivers/crypto/amcc/crypto4xx_alg.c
-@@ -231,6 +231,191 @@ int crypto4xx_rfc3686_decrypt(struct abl
+@@ -232,6 +232,191 @@ int crypto4xx_rfc3686_decrypt(struct abl
ctx->sa_out, ctx->sa_len, 0);
}
*/
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1210,6 +1210,29 @@ static struct crypto4xx_alg_common crypt
+@@ -1219,6 +1219,29 @@ static struct crypto4xx_alg_common crypt
}
}
} },
#include <crypto/sha.h>
#include <crypto/ctr.h>
#include "crypto4xx_reg_def.h"
-@@ -417,6 +418,144 @@ int crypto4xx_setauthsize_aead(struct cr
+@@ -418,6 +419,144 @@ int crypto4xx_setauthsize_aead(struct cr
}
/**
#include <crypto/sha.h>
#include <crypto/scatterwalk.h>
#include <crypto/internal/aead.h>
-@@ -1227,6 +1228,27 @@ static struct crypto4xx_alg_common crypt
+@@ -1236,6 +1237,27 @@ static struct crypto4xx_alg_common crypt
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC |
CRYPTO_ALG_NEED_FALLBACK |
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1075,9 +1075,6 @@ static irqreturn_t crypto4xx_ce_interrup
+@@ -1084,9 +1084,6 @@ static irqreturn_t crypto4xx_ce_interrup
struct device *dev = (struct device *)data;
struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev);
writel(PPC4XX_INTERRUPT_CLR,
core_dev->dev->ce_base + CRYPTO4XX_INT_CLR);
tasklet_schedule(&core_dev->tasklet);
-@@ -1325,13 +1322,6 @@ static int crypto4xx_probe(struct platfo
+@@ -1334,13 +1331,6 @@ static int crypto4xx_probe(struct platfo
tasklet_init(&core_dev->tasklet, crypto4xx_bh_tasklet_cb,
(unsigned long) dev);
core_dev->dev->ce_base = of_iomap(ofdev->dev.of_node, 0);
if (!core_dev->dev->ce_base) {
dev_err(dev, "failed to of_iomap\n");
-@@ -1339,6 +1329,13 @@ static int crypto4xx_probe(struct platfo
+@@ -1348,6 +1338,13 @@ static int crypto4xx_probe(struct platfo
goto err_iomap;
}
/* need to setup pdr, rdr, gdr and sdr before this */
crypto4xx_hw_init(core_dev->dev);
-@@ -1352,11 +1349,11 @@ static int crypto4xx_probe(struct platfo
+@@ -1361,11 +1358,11 @@ static int crypto4xx_probe(struct platfo
return 0;
err_start_dev:
}
int crypto4xx_alloc_sa(struct crypto4xx_ctx *ctx, u32 size)
-@@ -1070,18 +1077,29 @@ static void crypto4xx_bh_tasklet_cb(unsi
+@@ -1079,18 +1086,29 @@ static void crypto4xx_bh_tasklet_cb(unsi
/**
* Top Half of isr.
*/
/**
* Supported Crypto Algorithms
*/
-@@ -1263,6 +1281,8 @@ static int crypto4xx_probe(struct platfo
+@@ -1272,6 +1290,8 @@ static int crypto4xx_probe(struct platfo
struct resource res;
struct device *dev = &ofdev->dev;
struct crypto4xx_core_device *core_dev;
rc = of_address_to_resource(ofdev->dev.of_node, 0, &res);
if (rc)
-@@ -1279,6 +1299,7 @@ static int crypto4xx_probe(struct platfo
+@@ -1288,6 +1308,7 @@ static int crypto4xx_probe(struct platfo
mfdcri(SDR0, PPC405EX_SDR0_SRST) | PPC405EX_CE_RESET);
mtdcri(SDR0, PPC405EX_SDR0_SRST,
mfdcri(SDR0, PPC405EX_SDR0_SRST) & ~PPC405EX_CE_RESET);
} else if (of_find_compatible_node(NULL, NULL,
"amcc,ppc460sx-crypto")) {
mtdcri(SDR0, PPC460SX_SDR0_SRST,
-@@ -1301,7 +1322,22 @@ static int crypto4xx_probe(struct platfo
+@@ -1310,7 +1331,22 @@ static int crypto4xx_probe(struct platfo
if (!core_dev->dev)
goto err_alloc_dev;
core_dev->device = dev;
spin_lock_init(&core_dev->lock);
INIT_LIST_HEAD(&core_dev->dev->alg_list);
-@@ -1331,7 +1367,9 @@ static int crypto4xx_probe(struct platfo
+@@ -1340,7 +1376,9 @@ static int crypto4xx_probe(struct platfo
/* Register for Crypto isr, Crypto Engine IRQ */
core_dev->irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1370,7 +1370,7 @@ static int crypto4xx_probe(struct platfo
+@@ -1379,7 +1379,7 @@ static int crypto4xx_probe(struct platfo
rc = request_irq(core_dev->irq, is_revb ?
crypto4xx_ce_interrupt_handler_revb :
crypto4xx_ce_interrupt_handler, 0,
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1432,7 +1432,7 @@ MODULE_DEVICE_TABLE(of, crypto4xx_match)
+@@ -1441,7 +1441,7 @@ MODULE_DEVICE_TABLE(of, crypto4xx_match)
static struct platform_driver crypto4xx_driver = {
.driver = {
--- a/drivers/crypto/amcc/crypto4xx_alg.c
+++ b/drivers/crypto/amcc/crypto4xx_alg.c
-@@ -256,10 +256,6 @@ static inline bool crypto4xx_aead_need_f
+@@ -257,10 +257,6 @@ static inline bool crypto4xx_aead_need_f
if (is_ccm && !(req->iv[0] == 1 || req->iv[0] == 3))
return true;
return false;
}
-@@ -330,7 +326,7 @@ int crypto4xx_setkey_aes_ccm(struct cryp
+@@ -331,7 +327,7 @@ int crypto4xx_setkey_aes_ccm(struct cryp
sa = (struct dynamic_sa_ctl *) ctx->sa_in;
sa->sa_contents.w = SA_AES_CCM_CONTENTS | (keylen << 2);
SA_CIPHER_ALG_AES,
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -577,15 +577,14 @@ static void crypto4xx_aead_done(struct c
+@@ -586,15 +586,14 @@ static void crypto4xx_aead_done(struct c
struct pd_uinfo *pd_uinfo,
struct ce_pd *pd)
{
if (pd_uinfo->using_sd) {
crypto4xx_copy_pkt_to_dst(dev, pd, pd_uinfo,
pd->pd_ctl_len.bf.pkt_len,
-@@ -597,38 +596,39 @@ static void crypto4xx_aead_done(struct c
+@@ -606,38 +605,39 @@ static void crypto4xx_aead_done(struct c
if (pd_uinfo->sa_va->sa_command_0.bf.dir == DIR_OUTBOUND) {
/* append icv at the end */
/**
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -580,7 +580,7 @@ static void crypto4xx_aead_done(struct c
+@@ -589,7 +589,7 @@ static void crypto4xx_aead_done(struct c
struct scatterlist *dst = pd_uinfo->dest_va;
size_t cp_len = crypto_aead_authsize(
crypto_aead_reqtfm(aead_req));
int err = 0;
if (pd_uinfo->using_sd) {
-@@ -595,7 +595,7 @@ static void crypto4xx_aead_done(struct c
+@@ -604,7 +604,7 @@ static void crypto4xx_aead_done(struct c
if (pd_uinfo->sa_va->sa_command_0.bf.dir == DIR_OUTBOUND) {
/* append icv at the end */
crypto4xx_memcpy_from_le32(icv, pd_uinfo->sr_va->save_digest,
scatterwalk_map_and_copy(icv, dst, aead_req->cryptlen,
cp_len, 1);
-@@ -605,7 +605,7 @@ static void crypto4xx_aead_done(struct c
+@@ -614,7 +614,7 @@ static void crypto4xx_aead_done(struct c
aead_req->assoclen + aead_req->cryptlen -
cp_len, cp_len, 0);
if (crypto_memneq(icv, pd_uinfo->sr_va->save_digest, cp_len))
err = -EBADMSG;
-@@ -1122,8 +1122,8 @@ static struct crypto4xx_alg_common crypt
+@@ -1131,8 +1131,8 @@ static struct crypto4xx_alg_common crypt
.max_keysize = AES_MAX_KEY_SIZE,
.ivsize = AES_IV_SIZE,
.setkey = crypto4xx_setkey_aes_cbc,
}
}
}},
-@@ -1146,8 +1146,8 @@ static struct crypto4xx_alg_common crypt
+@@ -1155,8 +1155,8 @@ static struct crypto4xx_alg_common crypt
.max_keysize = AES_MAX_KEY_SIZE,
.ivsize = AES_IV_SIZE,
.setkey = crypto4xx_setkey_aes_cfb,
}
}
} },
-@@ -1195,8 +1195,8 @@ static struct crypto4xx_alg_common crypt
+@@ -1204,8 +1204,8 @@ static struct crypto4xx_alg_common crypt
.min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE,
.setkey = crypto4xx_setkey_aes_ecb,
}
}
} },
-@@ -1219,8 +1219,8 @@ static struct crypto4xx_alg_common crypt
+@@ -1228,8 +1228,8 @@ static struct crypto4xx_alg_common crypt
.max_keysize = AES_MAX_KEY_SIZE,
.ivsize = AES_IV_SIZE,
.setkey = crypto4xx_setkey_aes_ofb,
CRYPTO_TFM_RES_BAD_KEY_LEN);
return -EINVAL;
}
-@@ -164,39 +165,38 @@ static int crypto4xx_setkey_aes(struct c
+@@ -165,39 +166,38 @@ static int crypto4xx_setkey_aes(struct c
return 0;
}
int rc;
rc = crypto4xx_setkey_aes(cipher, key, keylen - CTR_RFC3686_NONCE_SIZE,
-@@ -210,31 +210,33 @@ int crypto4xx_setkey_rfc3686(struct cryp
+@@ -211,31 +211,33 @@ int crypto4xx_setkey_rfc3686(struct cryp
return 0;
}
} else {
dst = pd_uinfo->dest_va;
addr = dma_map_page(dev->core_dev->device, sg_page(dst),
-@@ -549,8 +548,8 @@ static void crypto4xx_ablkcipher_done(st
+@@ -558,8 +557,8 @@ static void crypto4xx_ablkcipher_done(st
crypto4xx_ret_sg_desc(dev, pd_uinfo);
if (pd_uinfo->state & PD_ENTRY_BUSY)
}
static void crypto4xx_ahash_done(struct crypto4xx_device *dev,
-@@ -641,8 +640,8 @@ static void crypto4xx_pd_done(struct cry
+@@ -650,8 +649,8 @@ static void crypto4xx_pd_done(struct cry
struct pd_uinfo *pd_uinfo = &dev->pdr_uinfo[idx];
switch (crypto_tfm_alg_type(pd_uinfo->async_req->tfm)) {
break;
case CRYPTO_ALG_TYPE_AEAD:
crypto4xx_aead_done(dev, pd_uinfo, pd);
-@@ -936,15 +935,14 @@ static void crypto4xx_ctx_init(struct cr
+@@ -945,15 +944,14 @@ static void crypto4xx_ctx_init(struct cr
ctx->sa_len = 0;
}
return 0;
}
-@@ -953,9 +951,11 @@ static void crypto4xx_common_exit(struct
+@@ -962,9 +960,11 @@ static void crypto4xx_common_exit(struct
crypto4xx_free_sa(ctx);
}
}
static int crypto4xx_aead_init(struct crypto_aead *tfm)
-@@ -1012,7 +1012,7 @@ static int crypto4xx_register_alg(struct
+@@ -1021,7 +1021,7 @@ static int crypto4xx_register_alg(struct
break;
default:
break;
}
-@@ -1041,7 +1041,7 @@ static void crypto4xx_unregister_alg(str
+@@ -1050,7 +1050,7 @@ static void crypto4xx_unregister_alg(str
break;
default:
}
kfree(alg);
}
-@@ -1103,126 +1103,109 @@ static irqreturn_t crypto4xx_ce_interrup
+@@ -1112,126 +1112,109 @@ static irqreturn_t crypto4xx_ce_interrup
*/
static struct crypto4xx_alg_common crypto4xx_alg[] = {
/* Crypto AES modes */
if (ivlen)
crypto4xx_memcpy_to_le32(iv, req->iv, ivlen);
-@@ -270,13 +270,7 @@ static inline bool crypto4xx_aead_need_f
+@@ -271,13 +271,7 @@ static inline bool crypto4xx_aead_need_f
static int crypto4xx_aead_fallback(struct aead_request *req,
struct crypto4xx_ctx *ctx, bool do_decrypt)
{
aead_request_set_tfm(subreq, ctx->sw_cipher.aead);
aead_request_set_callback(subreq, req->base.flags,
-@@ -377,7 +371,7 @@ static int crypto4xx_crypt_aes_ccm(struc
+@@ -378,7 +372,7 @@ static int crypto4xx_crypt_aes_ccm(struc
struct crypto_aead *aead = crypto_aead_reqtfm(req);
unsigned int len = req->cryptlen;
__le32 iv[16];
struct dynamic_sa_ctl *sa = (struct dynamic_sa_ctl *)tmp_sa;
if (crypto4xx_aead_need_fallback(req, true, decrypt))
-@@ -386,7 +380,7 @@ static int crypto4xx_crypt_aes_ccm(struc
+@@ -387,7 +381,7 @@ static int crypto4xx_crypt_aes_ccm(struc
if (decrypt)
len -= crypto_aead_authsize(aead);
--- a/drivers/crypto/amcc/crypto4xx_alg.c
+++ b/drivers/crypto/amcc/crypto4xx_alg.c
-@@ -240,6 +240,85 @@ int crypto4xx_rfc3686_decrypt(struct skc
+@@ -241,6 +241,85 @@ int crypto4xx_rfc3686_decrypt(struct skc
ctx->sa_out, ctx->sa_len, 0);
}
static inline bool crypto4xx_aead_need_fallback(struct aead_request *req,
bool is_ccm, bool decrypt)
{
-@@ -282,10 +361,10 @@ static int crypto4xx_aead_fallback(struc
+@@ -283,10 +362,10 @@ static int crypto4xx_aead_fallback(struc
crypto_aead_encrypt(subreq);
}
{
int rc;
-@@ -313,7 +392,7 @@ int crypto4xx_setkey_aes_ccm(struct cryp
+@@ -314,7 +393,7 @@ int crypto4xx_setkey_aes_ccm(struct cryp
struct dynamic_sa_ctl *sa;
int rc = 0;
if (rc)
return rc;
-@@ -472,7 +551,7 @@ int crypto4xx_setkey_aes_gcm(struct cryp
+@@ -473,7 +552,7 @@ int crypto4xx_setkey_aes_gcm(struct cryp
return -EINVAL;
}
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -941,6 +941,19 @@ static int crypto4xx_sk_init(struct cryp
+@@ -950,6 +950,19 @@ static int crypto4xx_sk_init(struct cryp
struct crypto4xx_alg *amcc_alg;
struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(sk);
amcc_alg = container_of(alg, struct crypto4xx_alg, alg.u.cipher);
crypto4xx_ctx_init(amcc_alg, ctx);
return 0;
-@@ -956,6 +969,8 @@ static void crypto4xx_sk_exit(struct cry
+@@ -965,6 +978,8 @@ static void crypto4xx_sk_exit(struct cry
struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(sk);
crypto4xx_common_exit(ctx);
}
static int crypto4xx_aead_init(struct crypto_aead *tfm)
-@@ -1145,6 +1160,28 @@ static struct crypto4xx_alg_common crypt
+@@ -1154,6 +1169,28 @@ static struct crypto4xx_alg_common crypt
.init = crypto4xx_sk_init,
.exit = crypto4xx_sk_exit,
} },
+++ /dev/null
-From fc340115ffb8235c1bbd200c28855e6373d0dd1a Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey@gmail.com>
-Date: Thu, 19 Apr 2018 18:41:55 +0200
-Subject: [PATCH 6/8] crypto: crypto4xx - properly set IV after de- and encrypt
-
-This patch fixes cts(cbc(aes)) test when cbc-aes-ppc4xx is used.
-alg: skcipher: Test 1 failed (invalid result) on encryption for cts(cbc-aes-ppc4xx)
-00000000: 4b 10 75 fc 2f 14 1b 6a 27 35 37 33 d1 b7 70 05
-00000010: 97
-alg: skcipher: Failed to load transform for cts(cbc(aes)): -2
-
-The CTS cipher mode expect the IV (req->iv) of skcipher_request
-to contain the last ciphertext block after the {en,de}crypt
-operation is complete.
-
-Fix this issue for the AMCC Crypto4xx hardware engine.
-The tcrypt test case for cts(cbc(aes)) is now correctly passed.
-
-name : cts(cbc(aes))
-driver : cts(cbc-aes-ppc4xx)
-module : cts
-priority : 300
-refcnt : 1
-selftest : passed
-internal : no
-type : skcipher
-async : yes
-blocksize : 16
-min keysize : 16
-max keysize : 32
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- drivers/crypto/amcc/crypto4xx_alg.c | 3 ++-
- drivers/crypto/amcc/crypto4xx_core.c | 9 +++++++++
- 2 files changed, 11 insertions(+), 1 deletion(-)
-
---- a/drivers/crypto/amcc/crypto4xx_alg.c
-+++ b/drivers/crypto/amcc/crypto4xx_alg.c
-@@ -141,7 +141,8 @@ static int crypto4xx_setkey_aes(struct c
- /* Setup SA */
- sa = ctx->sa_in;
-
-- set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, SA_NOT_SAVE_IV,
-+ set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, (cm == CRYPTO_MODE_CBC ?
-+ SA_SAVE_IV : SA_NOT_SAVE_IV),
- SA_LOAD_HASH_FROM_SA, SA_LOAD_IV_FROM_STATE,
- SA_NO_HEADER_PROC, SA_HASH_ALG_NULL,
- SA_CIPHER_ALG_AES, SA_PAD_TYPE_ZERO,
---- a/drivers/crypto/amcc/crypto4xx_core.c
-+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -545,6 +545,15 @@ static void crypto4xx_cipher_done(struct
- addr = dma_map_page(dev->core_dev->device, sg_page(dst),
- dst->offset, dst->length, DMA_FROM_DEVICE);
- }
-+
-+ if (pd_uinfo->sa_va->sa_command_0.bf.save_iv == SA_SAVE_IV) {
-+ struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
-+
-+ crypto4xx_memcpy_from_le32((u32 *)req->iv,
-+ pd_uinfo->sr_va->save_iv,
-+ crypto_skcipher_ivsize(skcipher));
-+ }
-+
- crypto4xx_ret_sg_desc(dev, pd_uinfo);
-
- if (pd_uinfo->state & PD_ENTRY_BUSY)
return false;
return true;
-@@ -634,13 +638,13 @@ static inline void ipv6_addr_set_v4mappe
+@@ -605,13 +609,13 @@ static inline void ipv6_addr_set_v4mappe
*/
static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen)
{
if (xb)
return i * 32 + 31 - __fls(ntohl(xb));
}
-@@ -809,17 +813,18 @@ static inline int ip6_default_np_autolab
+@@ -780,17 +784,18 @@ static inline int ip6_default_np_autolab
static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
__be32 flowlabel)
{
return false;
return true;
-@@ -634,13 +638,13 @@ static inline void ipv6_addr_set_v4mappe
+@@ -605,13 +609,13 @@ static inline void ipv6_addr_set_v4mappe
*/
static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen)
{
if (xb)
return i * 32 + 31 - __fls(ntohl(xb));
}
-@@ -809,17 +813,18 @@ static inline int ip6_default_np_autolab
+@@ -780,17 +784,18 @@ static inline int ip6_default_np_autolab
static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
__be32 flowlabel)
{
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
-@@ -889,6 +889,8 @@ static inline struct sk_buff *ip6_finish
+@@ -860,6 +860,8 @@ static inline struct sk_buff *ip6_finish
&inet6_sk(sk)->cork);
}
#endif
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
-@@ -889,8 +889,6 @@ static inline struct sk_buff *ip6_finish
+@@ -860,8 +860,6 @@ static inline struct sk_buff *ip6_finish
&inet6_sk(sk)->cork);
}
--- a/Makefile
+++ b/Makefile
-@@ -1240,7 +1240,6 @@ all: modules
+@@ -1239,7 +1239,6 @@ all: modules
PHONY += modules
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
@$(kecho) ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
-@@ -1269,7 +1268,6 @@ _modinst_:
+@@ -1268,7 +1267,6 @@ _modinst_:
rm -f $(MODLIB)/build ; \
ln -s $(CURDIR) $(MODLIB)/build ; \
fi
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
-@@ -788,11 +793,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH
+@@ -787,11 +792,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH
KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
endif
}
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
-@@ -1955,10 +1955,12 @@ void __init init_mm_internals(void)
+@@ -1950,10 +1950,12 @@ void __init init_mm_internals(void)
start_shepherd_timer();
#endif
#ifdef CONFIG_PROC_FS
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
-@@ -239,7 +239,8 @@ static int br_handle_local_finish(struct
+@@ -237,7 +237,10 @@ static void __br_handle_local_finish(str
+ /* note: already called with rcu_read_lock */
+ static int br_handle_local_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{
- struct net_bridge_port *p = br_port_get_rcu(skb->dev);
-
- __br_handle_local_finish(skb);
++ struct net_bridge_port *p = br_port_get_rcu(skb->dev);
++
+ if (p->state != BR_STATE_DISABLED)
+ __br_handle_local_finish(skb);
- BR_INPUT_SKB_CB(skb)->brdev = p->br->dev;
- br_pass_frame_up(skb);
-@@ -327,6 +328,15 @@ rx_handler_result_t br_handle_frame(stru
+ /* return 1 to signal the okfn() was called so it's ok to use the skb */
+ return 1;
+@@ -332,6 +335,15 @@ rx_handler_result_t br_handle_frame(stru
forward:
switch (p->state) {
--- a/Makefile
+++ b/Makefile
-@@ -654,12 +654,12 @@ KBUILD_CFLAGS += $(call cc-disable-warni
+@@ -653,12 +653,12 @@ KBUILD_CFLAGS += $(call cc-disable-warni
+ KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias)
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
- KBUILD_CFLAGS += $(call cc-option,-Oz,-Os)
--KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
-+KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) $(EXTRA_OPTIMIZATION)
+-KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
++KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) $(EXTRA_OPTIMIZATION)
else
ifdef CONFIG_PROFILE_ALL_BRANCHES
-KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
{
struct bonding *bond = netdev_priv(bond_dev);
const struct net_device_ops *slave_ops = slave_dev->netdev_ops;
-@@ -3502,7 +3503,7 @@ static int bond_do_ioctl(struct net_devi
+@@ -3506,7 +3507,7 @@ static int bond_do_ioctl(struct net_devi
switch (cmd) {
case BOND_ENSLAVE_OLD:
case SIOCBONDENSLAVE:
case '-':
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
-@@ -1921,7 +1921,8 @@ static int team_netpoll_setup(struct net
+@@ -1947,7 +1947,8 @@ static int team_netpoll_setup(struct net
}
#endif