Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1416108 > unrolled thread
| Started by | Baolin Wang <baolin.wang@linaro.org> |
|---|---|
| First post | 2016-06-07 14:20 +0200 |
| Last post | 2016-06-08 04:10 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC v4 2/4] crypto: Introduce CRYPTO_ALG_BULK flag Baolin Wang <baolin.wang@linaro.org> - 2016-06-07 14:20 +0200
Re: [RFC v4 2/4] crypto: Introduce CRYPTO_ALG_BULK flag Herbert Xu <herbert@gondor.apana.org.au> - 2016-06-07 16:20 +0200
Re: [RFC v4 2/4] crypto: Introduce CRYPTO_ALG_BULK flag Baolin Wang <baolin.wang@linaro.org> - 2016-06-08 04:10 +0200
| From | Baolin Wang <baolin.wang@linaro.org> |
|---|---|
| Date | 2016-06-07 14:20 +0200 |
| Subject | [RFC v4 2/4] crypto: Introduce CRYPTO_ALG_BULK flag |
| Message-ID | <rHo9b-2Ai-3@gated-at.bofh.it> |
Now some cipher hardware engines prefer to handle bulk block rather than one
sector (512 bytes) created by dm-crypt, cause these cipher engines can handle
the intermediate values (IV) by themselves in one bulk block. This means we
can increase the size of the request by merging request rather than always 512
bytes and thus increase the hardware engine processing speed.
So introduce 'CRYPTO_ALG_BULK' flag to indicate this cipher can support bulk
mode.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
include/crypto/skcipher.h | 7 +++++++
include/linux/crypto.h | 6 ++++++
2 files changed, 13 insertions(+)
diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
index 0f987f5..d89d29a 100644
--- a/include/crypto/skcipher.h
+++ b/include/crypto/skcipher.h
@@ -519,5 +519,12 @@ static inline void skcipher_request_set_crypt(
req->iv = iv;
}
+static inline unsigned int skcipher_is_bulk_mode(struct crypto_skcipher *sk_tfm)
+{
+ struct crypto_tfm *tfm = crypto_skcipher_tfm(sk_tfm);
+
+ return crypto_tfm_alg_bulk(tfm);
+}
+
#endif /* _CRYPTO_SKCIPHER_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 6e28c89..a315487 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -63,6 +63,7 @@
#define CRYPTO_ALG_DEAD 0x00000020
#define CRYPTO_ALG_DYING 0x00000040
#define CRYPTO_ALG_ASYNC 0x00000080
+#define CRYPTO_ALG_BULK 0x00000100
/*
* Set this bit if and only if the algorithm requires another algorithm of
@@ -623,6 +624,11 @@ static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm)
return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK;
}
+static inline unsigned int crypto_tfm_alg_bulk(struct crypto_tfm *tfm)
+{
+ return tfm->__crt_alg->cra_flags & CRYPTO_ALG_BULK;
+}
+
static inline unsigned int crypto_tfm_alg_blocksize(struct crypto_tfm *tfm)
{
return tfm->__crt_alg->cra_blocksize;
--
1.7.9.5
[toc] | [next] | [standalone]
| From | Herbert Xu <herbert@gondor.apana.org.au> |
|---|---|
| Date | 2016-06-07 16:20 +0200 |
| Message-ID | <rHq1j-3KB-17@gated-at.bofh.it> |
| In reply to | #1416108 |
On Tue, Jun 07, 2016 at 08:17:05PM +0800, Baolin Wang wrote: > Now some cipher hardware engines prefer to handle bulk block rather than one > sector (512 bytes) created by dm-crypt, cause these cipher engines can handle > the intermediate values (IV) by themselves in one bulk block. This means we > can increase the size of the request by merging request rather than always 512 > bytes and thus increase the hardware engine processing speed. > > So introduce 'CRYPTO_ALG_BULK' flag to indicate this cipher can support bulk > mode. > > Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Nack. As I said before, please do it using explicit IV generators like we do for IPsec. -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
[toc] | [prev] | [next] | [standalone]
| From | Baolin Wang <baolin.wang@linaro.org> |
|---|---|
| Date | 2016-06-08 04:10 +0200 |
| Message-ID | <rHB6q-2jK-3@gated-at.bofh.it> |
| In reply to | #1416252 |
Hi Herbert, On 7 June 2016 at 22:16, Herbert Xu <herbert@gondor.apana.org.au> wrote: > On Tue, Jun 07, 2016 at 08:17:05PM +0800, Baolin Wang wrote: >> Now some cipher hardware engines prefer to handle bulk block rather than one >> sector (512 bytes) created by dm-crypt, cause these cipher engines can handle >> the intermediate values (IV) by themselves in one bulk block. This means we >> can increase the size of the request by merging request rather than always 512 >> bytes and thus increase the hardware engine processing speed. >> >> So introduce 'CRYPTO_ALG_BULK' flag to indicate this cipher can support bulk >> mode. >> >> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> > > Nack. As I said before, please do it using explicit IV generators > like we do for IPsec. OK. I would like to try your suggestion. Thanks. > -- > Email: Herbert Xu <herbert@gondor.apana.org.au> > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- Baolin.wang Best Regards
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web