diff mbox series

[xtables-addons,v2,1/2] xt_pknock, xt_SYSRQ: don't set shash_desc::flags.

Message ID 20190812115742.21770-2-jeremy@azazel.net
State Awaiting Upstream
Delegated to: Pablo Neira
Headers show
Series Kernel API updates | expand

Commit Message

Jeremy Sowden Aug. 12, 2019, 11:57 a.m. UTC
shash_desc::flags was removed from the kernel in 5.1.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 extensions/pknock/xt_pknock.c | 1 -
 extensions/xt_SYSRQ.c         | 1 -
 2 files changed, 2 deletions(-)

Comments

Jan Engelhardt Aug. 12, 2019, 3:17 p.m. UTC | #1
On Monday 2019-08-12 19:57, Jeremy Sowden wrote:

>shash_desc::flags was removed from the kernel in 5.1.
>
>Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
>---
> extensions/pknock/xt_pknock.c | 1 -
> extensions/xt_SYSRQ.c         | 1 -
> 2 files changed, 2 deletions(-)
>
>diff --git a/extensions/pknock/xt_pknock.c b/extensions/pknock/xt_pknock.c
>index c76901ac4c1a..8021ea07e1b9 100644
>--- a/extensions/pknock/xt_pknock.c
>+++ b/extensions/pknock/xt_pknock.c
>@@ -1125,7 +1125,6 @@ static int __init xt_pknock_mt_init(void)
> 
> 	crypto.size = crypto_shash_digestsize(crypto.tfm);
> 	crypto.desc.tfm = crypto.tfm;
>-	crypto.desc.flags = 0;

But this will still be needed for 5.0 I guess, so it cannot just be 
unconditionally removed.
Jeremy Sowden Aug. 12, 2019, 4:57 p.m. UTC | #2
On 2019-08-12, at 23:17:52 +0800, Jan Engelhardt wrote:
> On Monday 2019-08-12 19:57, Jeremy Sowden wrote:
> >shash_desc::flags was removed from the kernel in 5.1.
> >
> >Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
> >---
> > extensions/pknock/xt_pknock.c | 1 -
> > extensions/xt_SYSRQ.c         | 1 -
> > 2 files changed, 2 deletions(-)
> >
> >diff --git a/extensions/pknock/xt_pknock.c b/extensions/pknock/xt_pknock.c
> >index c76901ac4c1a..8021ea07e1b9 100644
> >--- a/extensions/pknock/xt_pknock.c
> >+++ b/extensions/pknock/xt_pknock.c
> >@@ -1125,7 +1125,6 @@ static int __init xt_pknock_mt_init(void)
> >
> > 	crypto.size = crypto_shash_digestsize(crypto.tfm);
> > 	crypto.desc.tfm = crypto.tfm;
> >-	crypto.desc.flags = 0;
>
> But this will still be needed for 5.0 I guess, so it cannot just be
> unconditionally removed.

That assignment was actually superfluous anyway, because crypto.desc is
zero-initialized when crypto is initialized (xt_pknock.c, ll. 110ff.):

  static struct {
          const char *algo;
          struct crypto_shash *tfm;
          unsigned int size;
          struct shash_desc desc;
  } crypto = {
          .algo	= "hmac(sha256)",
          .tfm	= NULL,
          .size	= 0
  };

In fact the explicit zero-initialization of .tfm and .size is also
superfluous and can be removed:

  static struct {
          const char *algo;
          struct crypto_shash *tfm;
          unsigned int size;
          struct shash_desc desc;
  } crypto = {
          .algo	= "hmac(sha256)",
  };

Adding an initializer to the variable declaration in xt_SYSRQ.c will do
the same thing.  Patch attached.

J.
Franta Hanzlík Aug. 19, 2019, 7:34 p.m. UTC | #3
On Mon, 12 Aug 2019 17:57:31 +0100
Jeremy Sowden <jeremy@azazel.net> wrote:

> On 2019-08-12, at 23:17:52 +0800, Jan Engelhardt wrote:
> > On Monday 2019-08-12 19:57, Jeremy Sowden wrote:  
> > >shash_desc::flags was removed from the kernel in 5.1.
> > >
> > >Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
> > >---
> > > extensions/pknock/xt_pknock.c | 1 -
> > > extensions/xt_SYSRQ.c         | 1 -
> > > 2 files changed, 2 deletions(-)
> > >
> > >diff --git a/extensions/pknock/xt_pknock.c b/extensions/pknock/xt_pknock.c
> > >index c76901ac4c1a..8021ea07e1b9 100644
> > >--- a/extensions/pknock/xt_pknock.c
> > >+++ b/extensions/pknock/xt_pknock.c
> > >@@ -1125,7 +1125,6 @@ static int __init xt_pknock_mt_init(void)
> > >
> > > 	crypto.size = crypto_shash_digestsize(crypto.tfm);
> > > 	crypto.desc.tfm = crypto.tfm;
> > >-	crypto.desc.flags = 0;  
> >
> > But this will still be needed for 5.0 I guess, so it cannot just be
> > unconditionally removed.  
> 
> That assignment was actually superfluous anyway, because crypto.desc is
> zero-initialized when crypto is initialized (xt_pknock.c, ll. 110ff.):
> 
>   static struct {
>           const char *algo;
>           struct crypto_shash *tfm;
>           unsigned int size;
>           struct shash_desc desc;
>   } crypto = {
>           .algo	= "hmac(sha256)",
>           .tfm	= NULL,
>           .size	= 0
>   };
> 
> In fact the explicit zero-initialization of .tfm and .size is also
> superfluous and can be removed:
> 
>   static struct {
>           const char *algo;
>           struct crypto_shash *tfm;
>           unsigned int size;
>           struct shash_desc desc;
>   } crypto = {
>           .algo	= "hmac(sha256)",
>   };
> 
> Adding an initializer to the variable declaration in xt_SYSRQ.c will do
> the same thing.  Patch attached.
> 
> J.

Hi Jeremy, thanks for Your patches!
Please, they are only here in mail list, or also in any repo?
Or will be some new package release and I should wait?

My xtables-addons v3.3 package list SourceForge as project home site,
but I can't find there nothing newer than stuff from March 2019:
https://sourceforge.net/p/xtables-addons/xtables-addons/ci/master/tree/
Or am I wrong?
Jeremy Sowden Sept. 1, 2019, 5:04 p.m. UTC | #4
On 2019-08-19, at 21:34:11 +0200, Franta Hanzlík wrote:
> On Mon, 12 Aug 2019 17:57:31 +0100 Jeremy Sowden wrote:
> > On 2019-08-12, at 23:17:52 +0800, Jan Engelhardt wrote:
> > > On Monday 2019-08-12 19:57, Jeremy Sowden wrote:
> > > >shash_desc::flags was removed from the kernel in 5.1.
> > > >
> > > >Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
> > > >---
> > > > extensions/pknock/xt_pknock.c | 1 -
> > > > extensions/xt_SYSRQ.c         | 1 -
> > > > 2 files changed, 2 deletions(-)
> > > >
> > > >diff --git a/extensions/pknock/xt_pknock.c b/extensions/pknock/xt_pknock.c
> > > >index c76901ac4c1a..8021ea07e1b9 100644
> > > >--- a/extensions/pknock/xt_pknock.c
> > > >+++ b/extensions/pknock/xt_pknock.c
> > > >@@ -1125,7 +1125,6 @@ static int __init xt_pknock_mt_init(void)
> > > >
> > > > 	crypto.size = crypto_shash_digestsize(crypto.tfm);
> > > > 	crypto.desc.tfm = crypto.tfm;
> > > >-	crypto.desc.flags = 0;
> > >
> > > But this will still be needed for 5.0 I guess, so it cannot just be
> > > unconditionally removed.
> >
> > That assignment was actually superfluous anyway, because crypto.desc is
> > zero-initialized when crypto is initialized (xt_pknock.c, ll. 110ff.):
> >
> > [...]
> >
> > Adding an initializer to the variable declaration in xt_SYSRQ.c will do
> > the same thing.
>
> Hi Jeremy, thanks for Your patches!
> Please, they are only here in mail list, or also in any repo?
> Or will be some new package release and I should wait?
>
> My xtables-addons v3.3 package list SourceForge as project home site,
> but I can't find there nothing newer than stuff from March 2019:
> https://sourceforge.net/p/xtables-addons/xtables-addons/ci/master/tree/

There are open MR's:

  https://sourceforge.net/p/xtables-addons/xtables-addons/merge-requests/12/
  https://sourceforge.net/p/xtables-addons/xtables-addons/merge-requests/13/

J.
Jan Engelhardt Sept. 6, 2019, 8:38 a.m. UTC | #5
On Monday 2019-08-12 13:57, Jeremy Sowden wrote:

>shash_desc::flags was removed from the kernel in 5.1.

Applied this. The DHCPMAC update I happened to take from SF.
diff mbox series

Patch

diff --git a/extensions/pknock/xt_pknock.c b/extensions/pknock/xt_pknock.c
index c76901ac4c1a..8021ea07e1b9 100644
--- a/extensions/pknock/xt_pknock.c
+++ b/extensions/pknock/xt_pknock.c
@@ -1125,7 +1125,6 @@  static int __init xt_pknock_mt_init(void)
 
 	crypto.size = crypto_shash_digestsize(crypto.tfm);
 	crypto.desc.tfm = crypto.tfm;
-	crypto.desc.flags = 0;
 
 	pde = proc_mkdir("xt_pknock", init_net.proc_net);
 	if (pde == NULL) {
diff --git a/extensions/xt_SYSRQ.c b/extensions/xt_SYSRQ.c
index c386c7e2db5d..183692f49489 100644
--- a/extensions/xt_SYSRQ.c
+++ b/extensions/xt_SYSRQ.c
@@ -114,7 +114,6 @@  static unsigned int sysrq_tg(const void *pdata, uint16_t len)
 	}
 
 	desc.tfm   = sysrq_tfm;
-	desc.flags = 0;
 	ret = crypto_shash_init(&desc);
 	if (ret != 0)
 		goto hash_fail;