* [PATCH] crypto: mediatek - Add empty messages check in GCM mode
@ 2017-08-16 11:19 Ryder Lee
2017-08-16 12:18 ` Stephan Mueller
2017-08-22 7:01 ` Herbert Xu
0 siblings, 2 replies; 5+ messages in thread
From: Ryder Lee @ 2017-08-16 11:19 UTC (permalink / raw)
To: Herbert Xu; +Cc: linux-crypto, linux-mediatek, linux-kernel, Ryder Lee
Currently, empty messages are not supported in GCM mode, hence add
a check to prevent producing incorrect results.
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
drivers/crypto/mediatek/mtk-aes.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/crypto/mediatek/mtk-aes.c b/drivers/crypto/mediatek/mtk-aes.c
index 9e845e8..efe4e63 100644
--- a/drivers/crypto/mediatek/mtk-aes.c
+++ b/drivers/crypto/mediatek/mtk-aes.c
@@ -928,8 +928,13 @@ static int mtk_aes_gcm_start(struct mtk_cryp *cryp, struct mtk_aes_rec *aes)
static int mtk_aes_gcm_crypt(struct aead_request *req, u64 mode)
{
struct mtk_aes_base_ctx *ctx = crypto_aead_ctx(crypto_aead_reqtfm(req));
+ struct mtk_aes_gcm_ctx *gctx = mtk_aes_gcm_ctx_cast(ctx);
struct mtk_aes_reqctx *rctx = aead_request_ctx(req);
+ /* Empty messages are not supported yet */
+ if (!gctx->textlen && !req->assoclen)
+ return -EINVAL
+
rctx->mode = AES_FLAGS_GCM | mode;
return mtk_aes_handle_queue(ctx->cryp, !!(mode & AES_FLAGS_ENCRYPT),
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] crypto: mediatek - Add empty messages check in GCM mode
2017-08-16 11:19 [PATCH] crypto: mediatek - Add empty messages check in GCM mode Ryder Lee
@ 2017-08-16 12:18 ` Stephan Mueller
2017-08-16 12:50 ` Ryder Lee
2017-08-22 7:01 ` Herbert Xu
1 sibling, 1 reply; 5+ messages in thread
From: Stephan Mueller @ 2017-08-16 12:18 UTC (permalink / raw)
To: Ryder Lee; +Cc: Herbert Xu, linux-crypto, linux-mediatek, linux-kernel
Am Mittwoch, 16. August 2017, 13:19:48 CEST schrieb Ryder Lee:
Hi Ryder,
> Currently, empty messages are not supported in GCM mode, hence add
> a check to prevent producing incorrect results.
In case the caller would provide empty messages, would there be just wrong
data or a real problem? Note, unprivileged user space can make such requests.
If there would be a real problem (like crash), this should also go to stable.
Ciao
Stephan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] crypto: mediatek - Add empty messages check in GCM mode
2017-08-16 12:18 ` Stephan Mueller
@ 2017-08-16 12:50 ` Ryder Lee
0 siblings, 0 replies; 5+ messages in thread
From: Ryder Lee @ 2017-08-16 12:50 UTC (permalink / raw)
To: Stephan Mueller; +Cc: Herbert Xu, linux-crypto, linux-mediatek, linux-kernel
Hi,
On Wed, 2017-08-16 at 14:18 +0200, Stephan Mueller wrote:
> Am Mittwoch, 16. August 2017, 13:19:48 CEST schrieb Ryder Lee:
>
> Hi Ryder,
>
> > Currently, empty messages are not supported in GCM mode, hence add
> > a check to prevent producing incorrect results.
>
> In case the caller would provide empty messages, would there be just wrong
> data or a real problem? Note, unprivileged user space can make such requests.
>
> If there would be a real problem (like crash), this should also go to stable.
>
> Ciao
> Stephan
This does not cause any problem and it just returns a wrong result.
Ryder
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] crypto: mediatek - Add empty messages check in GCM mode
2017-08-16 11:19 [PATCH] crypto: mediatek - Add empty messages check in GCM mode Ryder Lee
2017-08-16 12:18 ` Stephan Mueller
@ 2017-08-22 7:01 ` Herbert Xu
2017-08-22 7:25 ` Ryder Lee
1 sibling, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2017-08-22 7:01 UTC (permalink / raw)
To: Ryder Lee; +Cc: linux-crypto, linux-mediatek, linux-kernel
On Wed, Aug 16, 2017 at 07:19:48PM +0800, Ryder Lee wrote:
> Currently, empty messages are not supported in GCM mode, hence add
> a check to prevent producing incorrect results.
>
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
> drivers/crypto/mediatek/mtk-aes.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/crypto/mediatek/mtk-aes.c b/drivers/crypto/mediatek/mtk-aes.c
> index 9e845e8..efe4e63 100644
> --- a/drivers/crypto/mediatek/mtk-aes.c
> +++ b/drivers/crypto/mediatek/mtk-aes.c
> @@ -928,8 +928,13 @@ static int mtk_aes_gcm_start(struct mtk_cryp *cryp, struct mtk_aes_rec *aes)
> static int mtk_aes_gcm_crypt(struct aead_request *req, u64 mode)
> {
> struct mtk_aes_base_ctx *ctx = crypto_aead_ctx(crypto_aead_reqtfm(req));
> + struct mtk_aes_gcm_ctx *gctx = mtk_aes_gcm_ctx_cast(ctx);
> struct mtk_aes_reqctx *rctx = aead_request_ctx(req);
>
> + /* Empty messages are not supported yet */
> + if (!gctx->textlen && !req->assoclen)
> + return -EINVAL
Your patch does not compile.
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] crypto: mediatek - Add empty messages check in GCM mode
2017-08-22 7:01 ` Herbert Xu
@ 2017-08-22 7:25 ` Ryder Lee
0 siblings, 0 replies; 5+ messages in thread
From: Ryder Lee @ 2017-08-22 7:25 UTC (permalink / raw)
To: Herbert Xu; +Cc: linux-crypto, linux-mediatek, linux-kernel
Hi,
On Tue, 2017-08-22 at 15:01 +0800, Herbert Xu wrote:
> On Wed, Aug 16, 2017 at 07:19:48PM +0800, Ryder Lee wrote:
> > Currently, empty messages are not supported in GCM mode, hence add
> > a check to prevent producing incorrect results.
> >
> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> > ---
> > drivers/crypto/mediatek/mtk-aes.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/crypto/mediatek/mtk-aes.c b/drivers/crypto/mediatek/mtk-aes.c
> > index 9e845e8..efe4e63 100644
> > --- a/drivers/crypto/mediatek/mtk-aes.c
> > +++ b/drivers/crypto/mediatek/mtk-aes.c
> > @@ -928,8 +928,13 @@ static int mtk_aes_gcm_start(struct mtk_cryp *cryp, struct mtk_aes_rec *aes)
> > static int mtk_aes_gcm_crypt(struct aead_request *req, u64 mode)
> > {
> > struct mtk_aes_base_ctx *ctx = crypto_aead_ctx(crypto_aead_reqtfm(req));
> > + struct mtk_aes_gcm_ctx *gctx = mtk_aes_gcm_ctx_cast(ctx);
> > struct mtk_aes_reqctx *rctx = aead_request_ctx(req);
> >
> > + /* Empty messages are not supported yet */
> > + if (!gctx->textlen && !req->assoclen)
> > + return -EINVAL
>
> Your patch does not compile.
Ohh..Somehow I delete the semicolon. I will send v1 soon, sorry about
that.
Ryder
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-22 7:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-16 11:19 [PATCH] crypto: mediatek - Add empty messages check in GCM mode Ryder Lee
2017-08-16 12:18 ` Stephan Mueller
2017-08-16 12:50 ` Ryder Lee
2017-08-22 7:01 ` Herbert Xu
2017-08-22 7:25 ` Ryder Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox