lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 11 Jan 2018 07:45:25 +0000
From:   Fabien DESSENNE <fabien.dessenne@...com>
To:     Corentin Labbe <clabbe.montjoie@...il.com>,
        Alexandre TORGUE <alexandre.torgue@...com>,
        "arei.gonglei@...wei.com" <arei.gonglei@...wei.com>,
        "corbet@....net" <corbet@....net>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
        "jasowang@...hat.com" <jasowang@...hat.com>,
        "mcoquelin.stm32@...il.com" <mcoquelin.stm32@...il.com>,
        "mst@...hat.com" <mst@...hat.com>
CC:     "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
        "linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "virtualization@...ts.linux-foundation.org" 
        <virtualization@...ts.linux-foundation.org>,
        Benjamin GAIGNARD <benjamin.gaignard@...com>
Subject: Re: [PATCH 6/6] crypto: stm32-cryp: convert to the new crypto engine
 API

(Adding my tested by)


On 10/01/18 15:25, Fabien DESSENNE wrote:
>
> On 03/01/18 21:11, Corentin Labbe wrote:
>> This patch convert the stm32-cryp driver to the new crypto engine API.
>> Signed-off-by: Corentin Labbe <clabbe.montjoie@...il.com>

Tested-by: Fabien Dessenne <fabien.dessenne@...com>

>> ---
>>    drivers/crypto/stm32/stm32-cryp.c | 21 ++++++++++++++++-----
>>    1 file changed, 16 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c
>> index cf1dddbeaa2c..99e0473ef247 100644
>> --- a/drivers/crypto/stm32/stm32-cryp.c
>> +++ b/drivers/crypto/stm32/stm32-cryp.c
>> @@ -91,6 +91,7 @@
>>    #define _walked_out             (cryp->out_walk.offset - cryp->out_sg->offset)
>>    
>>    struct stm32_cryp_ctx {
>> +	struct crypto_engine_reqctx enginectx;
>>    	struct stm32_cryp       *cryp;
>>    	int                     keylen;
>>    	u32                     key[AES_KEYSIZE_256 / sizeof(u32)];
>> @@ -494,10 +495,20 @@ static int stm32_cryp_cpu_start(struct stm32_cryp *cryp)
>>    	return 0;
>>    }
>>    
>> +static int stm32_cryp_cipher_one_req(struct crypto_engine *engine,
>> +				     void *areq);
> Merge these 2 lines in a single one
>
>> +static int stm32_cryp_prepare_cipher_req(struct crypto_engine *engine,
>> +					 void *areq);
>> +
>>    static int stm32_cryp_cra_init(struct crypto_tfm *tfm)
>>    {
>> +	struct stm32_cryp_ctx *ctx = crypto_tfm_ctx(tfm);
>> +
>>    	tfm->crt_ablkcipher.reqsize = sizeof(struct stm32_cryp_reqctx);
>>    
>> +	ctx->enginectx.op.do_one_request = stm32_cryp_cipher_one_req;
>> +	ctx->enginectx.op.prepare_request = stm32_cryp_prepare_cipher_req;
>> +	ctx->enginectx.op.unprepare_request = NULL;
>>    	return 0;
>>    }
>>    
>> @@ -695,14 +706,17 @@ static int stm32_cryp_prepare_req(struct crypto_engine *engine,
>>    }
>>    
>>    static int stm32_cryp_prepare_cipher_req(struct crypto_engine *engine,
>> -					 struct ablkcipher_request *req)
>> +					 void *areq)
>>    {
>> +	struct ablkcipher_request *req = container_of(areq, struct ablkcipher_request, base);
>   > 80 characters (CHECKPATCH)
>
>> +
>>    	return stm32_cryp_prepare_req(engine, req);
>>    }
>>    
>>    static int stm32_cryp_cipher_one_req(struct crypto_engine *engine,
>> -				     struct ablkcipher_request *req)
>> +				     void *areq)
> Merge these 2 lines in a single one
>
>>    {
>> +	struct ablkcipher_request *req = container_of(areq, struct ablkcipher_request, base);
>   > 80 characters (CHECKPATCH)
>
>>    	struct stm32_cryp_ctx *ctx = crypto_ablkcipher_ctx(
>>    			crypto_ablkcipher_reqtfm(req));
>>    	struct stm32_cryp *cryp = ctx->cryp;
>> @@ -1104,9 +1118,6 @@ static int stm32_cryp_probe(struct platform_device *pdev)
>>    		goto err_engine1;
>>    	}
>>    
>> -	cryp->engine->prepare_cipher_request = stm32_cryp_prepare_cipher_req;
>> -	cryp->engine->cipher_one_request = stm32_cryp_cipher_one_req;
>> -
>>    	ret = crypto_engine_start(cryp->engine);
>>    	if (ret) {
>>    		dev_err(dev, "Could not start crypto engine\n");

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ