Re: [PATCH 5/8] crypto:chcr: Change cra_flags for cipher algos
Hi Herbert On Fri, Jan 27, 2017 at 4:09 PM, Harsh Jainwrote: > Change cipher algos flags to CRYPTO_ALG_TYPE_ABLKCIPHER. > > Signed-off-by: Harsh Jain > --- > drivers/crypto/chelsio/chcr_algo.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/crypto/chelsio/chcr_algo.c > b/drivers/crypto/chelsio/chcr_algo.c > index d335943..21fc04c 100644 > --- a/drivers/crypto/chelsio/chcr_algo.c > +++ b/drivers/crypto/chelsio/chcr_algo.c > @@ -171,7 +171,7 @@ int chcr_handle_resp(struct crypto_async_request *req, > unsigned char *input, > } > break; > > - case CRYPTO_ALG_TYPE_BLKCIPHER: > + case CRYPTO_ALG_TYPE_ABLKCIPHER: > ctx_req.req.ablk_req = (struct ablkcipher_request *)req; > ctx_req.ctx.ablk_ctx = > ablkcipher_request_ctx(ctx_req.req.ablk_req); > @@ -2492,7 +2492,7 @@ static int chcr_aead_op(struct aead_request *req, > .cra_name = "cbc(aes)", > .cra_driver_name= "cbc-aes-chcr", > .cra_priority = CHCR_CRA_PRIORITY, > - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | > + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | > CRYPTO_ALG_ASYNC, > .cra_blocksize = AES_BLOCK_SIZE, > .cra_ctxsize= sizeof(struct chcr_context) > @@ -2519,7 +2519,7 @@ static int chcr_aead_op(struct aead_request *req, > .cra_name = "xts(aes)", > .cra_driver_name= "xts-aes-chcr", > .cra_priority = CHCR_CRA_PRIORITY, > - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | > + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | > CRYPTO_ALG_ASYNC, > .cra_blocksize = AES_BLOCK_SIZE, > .cra_ctxsize= sizeof(struct chcr_context) > + If I try above patch on 4.9.13 stable kernel. Kernel stops executing tests for cbc(aes), Same is working fine on cryptodev-2.6 latest tree. It seems below patch set has changed the behavior. crypto: testmgr - Do not test internal algorithms diff --git a/crypto/algboss.c b/crypto/algboss.c index 6e39d9c..ccb85e1 100644 --- a/crypto/algboss.c +++ b/crypto/algboss.c @@ -247,12 +247,8 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg) memcpy(param->alg, alg->cra_name, sizeof(param->alg)); type = alg->cra_flags; - /* This piece of crap needs to disappear into per-type test hooks. */ - if (!((type ^ CRYPTO_ALG_TYPE_BLKCIPHER) & - CRYPTO_ALG_TYPE_BLKCIPHER_MASK) && !(type & CRYPTO_ALG_GENIV) && - ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == - CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize : - alg->cra_ablkcipher.ivsize)) + /* Do not test internal algorithms. */ + if (type & CRYPTO_ALG_INTERNAL) type |= CRYPTO_ALG_TESTED; Its bit confusing for me. Are we supposed to declared it as "CRYPTO_ALG_TYPE_BLKCIPHER" for older kernels. Regards Harsh Jain
Re: [PATCH 5/8] crypto:chcr: Change cra_flags for cipher algos
On Wed, Mar 08, 2017 at 03:28:26PM +0530, Harsh Jain wrote: > > If I try above patch on 4.9.13 stable kernel. Kernel stops executing > tests for cbc(aes), Same is working fine on cryptodev-2.6 latest tree. > It seems below patch set has changed the behavior. > > > crypto: testmgr - Do not test internal algorithms On older kernels each ablkcipher gets an geniv instantiated on top of it. Therefore the ablkcipher itself is never tested, only the geniv is tested. We have since got rid of the geniv and now test the ablkcipher directly. There was a period where we didn't generate a geniv but I forgot to also remove the below chunk which skipped testing the ablkcipher. > diff --git a/crypto/algboss.c b/crypto/algboss.c > index 6e39d9c..ccb85e1 100644 > --- a/crypto/algboss.c > +++ b/crypto/algboss.c > @@ -247,12 +247,8 @@ static int cryptomgr_schedule_test(struct crypto_alg > *alg) > memcpy(param->alg, alg->cra_name, sizeof(param->alg)); > type = alg->cra_flags; > - /* This piece of crap needs to disappear into per-type test hooks. */ > - if (!((type ^ CRYPTO_ALG_TYPE_BLKCIPHER) & > - CRYPTO_ALG_TYPE_BLKCIPHER_MASK) && !(type & CRYPTO_ALG_GENIV) && > - ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == > - CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize : > - alg->cra_ablkcipher.ivsize)) > + /* Do not test internal algorithms. */ > + if (type & CRYPTO_ALG_INTERNAL) > type |= CRYPTO_ALG_TESTED; > > Its bit confusing for me. Are we supposed to declared it as > "CRYPTO_ALG_TYPE_BLKCIPHER" for older kernels. It should definitely be ABLKCIPHER in your case. Even if the test is skipped your driver should still work. Cheers, -- Email: Herbert XuHome Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
[PATCH 5/8] crypto:chcr: Change cra_flags for cipher algos
Change cipher algos flags to CRYPTO_ALG_TYPE_ABLKCIPHER. Signed-off-by: Harsh Jain--- drivers/crypto/chelsio/chcr_algo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c index d335943..21fc04c 100644 --- a/drivers/crypto/chelsio/chcr_algo.c +++ b/drivers/crypto/chelsio/chcr_algo.c @@ -171,7 +171,7 @@ int chcr_handle_resp(struct crypto_async_request *req, unsigned char *input, } break; - case CRYPTO_ALG_TYPE_BLKCIPHER: + case CRYPTO_ALG_TYPE_ABLKCIPHER: ctx_req.req.ablk_req = (struct ablkcipher_request *)req; ctx_req.ctx.ablk_ctx = ablkcipher_request_ctx(ctx_req.req.ablk_req); @@ -2492,7 +2492,7 @@ static int chcr_aead_op(struct aead_request *req, .cra_name = "cbc(aes)", .cra_driver_name= "cbc-aes-chcr", .cra_priority = CHCR_CRA_PRIORITY, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize= sizeof(struct chcr_context) @@ -2519,7 +2519,7 @@ static int chcr_aead_op(struct aead_request *req, .cra_name = "xts(aes)", .cra_driver_name= "xts-aes-chcr", .cra_priority = CHCR_CRA_PRIORITY, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | + .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize= sizeof(struct chcr_context) + -- 1.8.2.3 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html