[PATCH -next] staging: spmi: hisi-spmi-controller: Use proper format in call to dev_err()

2020-08-31 Thread YueHaibing
The correct format string for a size_t argument should be %zu.

Signed-off-by: YueHaibing 
---
 drivers/staging/hikey9xx/hisi-spmi-controller.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hikey9xx/hisi-spmi-controller.c 
b/drivers/staging/hikey9xx/hisi-spmi-controller.c
index 66a0b296e06f..34c690da09e3 100644
--- a/drivers/staging/hikey9xx/hisi-spmi-controller.c
+++ b/drivers/staging/hikey9xx/hisi-spmi-controller.c
@@ -121,7 +121,7 @@ static int spmi_read_cmd(struct spmi_controller *ctrl,
 
if (bc > SPMI_CONTROLLER_MAX_TRANS_BYTES) {
dev_err(>dev,
-   "spmi_controller supports 1..%d bytes per trans, 
but:%ld requested\n",
+   "spmi_controller supports 1..%d bytes per trans, 
but:%zu requested\n",
SPMI_CONTROLLER_MAX_TRANS_BYTES, bc);
return  -EINVAL;
}
@@ -175,7 +175,7 @@ static int spmi_read_cmd(struct spmi_controller *ctrl,
spin_unlock_irqrestore(_controller->lock, flags);
if (rc)
dev_err(>dev,
-   "spmi read wait timeout op:0x%x slave_id:%d 
slave_addr:0x%x bc:%ld\n",
+   "spmi read wait timeout op:0x%x slave_id:%d 
slave_addr:0x%x bc:%zu\n",
opc, slave_id, slave_addr, bc + 1);
else
dev_dbg(>dev, "%s: id:%d slave_addr:0x%x, read value: 
%*ph\n",
@@ -197,7 +197,7 @@ static int spmi_write_cmd(struct spmi_controller *ctrl,
 
if (bc > SPMI_CONTROLLER_MAX_TRANS_BYTES) {
dev_err(>dev,
-   "spmi_controller supports 1..%d bytes per trans, 
but:%ld requested\n",
+   "spmi_controller supports 1..%d bytes per trans, 
but:%zu requested\n",
SPMI_CONTROLLER_MAX_TRANS_BYTES, bc);
return  -EINVAL;
}
@@ -251,7 +251,7 @@ static int spmi_write_cmd(struct spmi_controller *ctrl,
spin_unlock_irqrestore(_controller->lock, flags);
 
if (rc)
-   dev_err(>dev, "spmi write wait timeout op:0x%x 
slave_id:%d slave_addr:0x%x bc:%ld\n",
+   dev_err(>dev, "spmi write wait timeout op:0x%x 
slave_id:%d slave_addr:0x%x bc:%zu\n",
opc, slave_id, slave_addr, bc);
else
dev_dbg(>dev, "%s: id:%d slave_addr:0x%x, wrote value: 
%*ph\n",
-- 
2.17.1


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[staging:staging-linus] BUILD SUCCESS c96711e138444d37d6d8b3f0fa7f09e4917cd326

2020-08-31 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
 staging-linus
branch HEAD: c96711e138444d37d6d8b3f0fa7f09e4917cd326  Merge tag 
'iio-fixes-for-5.9a' of 
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

elapsed time: 724m

configs tested: 92
configs skipped: 8

The following configs have been built successfully.
More configs may be tested in the coming days.

arm defconfig
arm64allyesconfig
arm64   defconfig
arm  allyesconfig
arm  allmodconfig
arc  axs103_smp_defconfig
mips  rb532_defconfig
arm   viper_defconfig
m68kq40_defconfig
arm   cns3420vb_defconfig
alphaallyesconfig
mipsomega2p_defconfig
h8300alldefconfig
arm pxa_defconfig
arm   omap1_defconfig
arm mv78xx0_defconfig
mips tb0287_defconfig
arm socfpga_defconfig
sh   se7751_defconfig
um i386_defconfig
m68kstmark2_defconfig
m68k allyesconfig
mips  cavium_octeon_defconfig
mips   rbtx49xx_defconfig
mips  ath25_defconfig
arm nhk8815_defconfig
sh   se7722_defconfig
arm  exynos_defconfig
sh  ul2_defconfig
armclps711x_defconfig
nds32 allnoconfig
pariscgeneric-64bit_defconfig
xtensa  defconfig
arm  alldefconfig
ia64 allmodconfig
ia64defconfig
ia64 allyesconfig
m68k allmodconfig
m68kdefconfig
nios2   defconfig
arc  allyesconfig
c6x  allyesconfig
nds32   defconfig
nios2allyesconfig
cskydefconfig
alpha   defconfig
xtensa   allyesconfig
h8300allyesconfig
arc defconfig
sh   allmodconfig
parisc  defconfig
s390 allyesconfig
parisc   allyesconfig
s390defconfig
i386 allyesconfig
sparcallyesconfig
sparc   defconfig
i386defconfig
mips allyesconfig
mips allmodconfig
powerpc  allyesconfig
powerpc  allmodconfig
powerpc   allnoconfig
powerpc defconfig
i386 randconfig-a001-20200831
i386 randconfig-a002-20200831
i386 randconfig-a004-20200831
i386 randconfig-a006-20200831
i386 randconfig-a005-20200831
i386 randconfig-a003-20200831
x86_64   randconfig-a012-20200831
x86_64   randconfig-a015-20200831
x86_64   randconfig-a014-20200831
x86_64   randconfig-a011-20200831
x86_64   randconfig-a016-20200831
x86_64   randconfig-a013-20200831
i386 randconfig-a013-20200831
i386 randconfig-a011-20200831
i386 randconfig-a012-20200831
i386 randconfig-a015-20200831
i386 randconfig-a016-20200831
i386 randconfig-a014-20200831
riscvallyesconfig
riscv allnoconfig
riscv   defconfig
riscvallmodconfig
x86_64   rhel
x86_64   allyesconfig
x86_64rhel-7.6-kselftests
x86_64  defconfig
x86_64   rhel-8.3
x86_64  kexec

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 28/47] staging: vchi: Get rid of vchiq_shim's message callback

2020-08-31 Thread Nicolas Saenz Julienne
Hi Jacopo, sorry if I'm a little late with my replies but I'm on vacation. I'll
be back Sept 7th, but wanted to reply since I don't want to stop your work.

On Fri, 2020-08-28 at 16:31 +0200, Jacopo Mondi wrote:
> Hi Nicolas,
> 
>I'm working on a v2 of the bcm2835-isp support which was sent along
> with UNICAM v4l2 driver and some misc changes you have collected in
> this series. Reference to v1:
> https://lore.kernel.org/linux-media/20200504092611.9798-1-laurent.pinch...@ideasonboard.com/
> 
> On Mon, Jun 29, 2020 at 05:09:26PM +0200, Nicolas Saenz Julienne wrote:
> > As vchiq_shim's callback does nothing aside from pushing messages into
> > the service's queue, let's bypass it and jump directly to the service's
> > callbacks, letting them choose whether to use the message queue.
> 
> I admit this patch caused me some pain, as after a few days chasing
> why the ISP got stuck in importing buffers into the VPU through the vc-sm-cma
> driver I realized that this patch removed a significant part of the
> process..

Sorry for the pain, I made my best to keep the downstream code in mind, and
also to keep the amount of functional changes needed in the services minimal.
That said, getting rid of VCHI is, IMO, a necessary step towards making VCHIQ
upstreamable.

> > It turns out most services don't need to use the message queue, which
> > makes for simpler code in the end.
> > 
> > -
> > -   if (reason == VCHIQ_MESSAGE_AVAILABLE)
> > -   vchiq_msg_queue_push(service->handle, header);
> 
> This one '-.-
> 
> I wonder if this was intentional and it is expected all services now
> handle the message queue (it seems so according to your commit
> message).

Indeed, it was intentional. Upstream services (mmal & audio) don't need it and
IIRC vchiq's ioctl interface has it's own queue implementation. So I figured it
would be best to keep its usage optional.

> Fair enough, I could add in the vc-sma-cma callback a call to
> vchiq_msg_queue_push() but I wonder if it wouldn't be better to do so
> in vchiq_core.c:parse_rx_slots(), just before calling the service's
> callback, so that this has not to be re-implemented in all services.
> 
> What would you suggest ?

Actually, in hindsight my suggestion would be to get rid of the vchiq message
queue altogether[1], keeping VCHIQ as simple as possible is a must if we want
to get it upstream, and since vc-sma-cma is the only queue user there is little
benefit to having a generic implementation. Let the service do it's own custom
queueing and just force all services to release the messages when they see fit.
It'll make for a simpler VCHIQ usage.

> And by the way I see mmal-vchiq.c:service_callback() releasing
> messages but never pushing them to the queue. Is this intended as well ?

Yes, sorry, it's pretty confusing. That call, vchiq_release_message(), has
nothing to do with the queue. It's the call that really gets the core to
release the message from its slot and the only mandatory thing to do after
receiving a message.

All in all VCHIQ isn't documented an pretty cryptic in its design. I don't
claim to be an expert. So feel free to contradict me anytime, I'll be happy to
work out something that fits all of us.

Regards,
Nicolas

[1] Here I mean vchiq_msg_queue_push() & vchiq_msg_hold()

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: gdm724x: fixed two macros by adding brackets

2020-08-31 Thread Greg KH
On Mon, Aug 31, 2020 at 06:03:32PM +0200, antoniprzybylik wrote:
> Added brackets to two macros.

That says _what_ you did, but not _why_ you did it.

Why did you do it?  What does this fix?

Does it make sense to do this?

And why these two macros?  Be specific please.

> 
> Signed-off-by: Antoni Przybylik 
> ---
>  drivers/staging/gdm724x/gdm_tty.c   | 3 +--
>  drivers/staging/gdm724x/netlink_k.c | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/gdm724x/gdm_tty.c 
> b/drivers/staging/gdm724x/gdm_tty.c
> index 6e813693a766..5cd94347bf78 100644
> --- a/drivers/staging/gdm724x/gdm_tty.c
> +++ b/drivers/staging/gdm724x/gdm_tty.c
> @@ -27,7 +27,7 @@
>  
>  #define MUX_TX_MAX_SIZE 2048
>  
> -#define GDM_TTY_READY(gdm) (gdm && gdm->tty_dev && gdm->port.count)
> +#define GDM_TTY_READY(gdm) ((gdm) && (gdm)->tty_dev && (gdm)->port.count)
>  
>  static struct tty_driver *gdm_driver[TTY_MAX_COUNT];
>  static struct gdm *gdm_table[TTY_MAX_COUNT][GDM_TTY_MINOR];
> @@ -323,4 +323,3 @@ void unregister_lte_tty_driver(void)
>   }
>   }
>  }
> -

You also deleted a line without saying so :(

> diff --git a/drivers/staging/gdm724x/netlink_k.c 
> b/drivers/staging/gdm724x/netlink_k.c
> index 7902e52a699b..399b7b4b536f 100644
> --- a/drivers/staging/gdm724x/netlink_k.c
> +++ b/drivers/staging/gdm724x/netlink_k.c
> @@ -20,7 +20,7 @@ static DEFINE_MUTEX(netlink_mutex);
>  #define ND_NLMSG_DATA(nlh)   ((void *)((char *)NLMSG_DATA(nlh) + \
> ND_IFINDEX_LEN))
>  #define ND_NLMSG_S_LEN(len)  (len + ND_IFINDEX_LEN)
> -#define ND_NLMSG_R_LEN(nlh)  (nlh->nlmsg_len - ND_IFINDEX_LEN)
> +#define ND_NLMSG_R_LEN(nlh)  ((nlh)->nlmsg_len - ND_IFINDEX_LEN)

Does that really make sense to change?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: gdm724x: fixed two macros by adding brackets

2020-08-31 Thread antoniprzybylik
Added brackets to two macros.

Signed-off-by: Antoni Przybylik 
---
 drivers/staging/gdm724x/gdm_tty.c   | 3 +--
 drivers/staging/gdm724x/netlink_k.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index 6e813693a766..5cd94347bf78 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -27,7 +27,7 @@
 
 #define MUX_TX_MAX_SIZE 2048
 
-#define GDM_TTY_READY(gdm) (gdm && gdm->tty_dev && gdm->port.count)
+#define GDM_TTY_READY(gdm) ((gdm) && (gdm)->tty_dev && (gdm)->port.count)
 
 static struct tty_driver *gdm_driver[TTY_MAX_COUNT];
 static struct gdm *gdm_table[TTY_MAX_COUNT][GDM_TTY_MINOR];
@@ -323,4 +323,3 @@ void unregister_lte_tty_driver(void)
}
}
 }
-
diff --git a/drivers/staging/gdm724x/netlink_k.c 
b/drivers/staging/gdm724x/netlink_k.c
index 7902e52a699b..399b7b4b536f 100644
--- a/drivers/staging/gdm724x/netlink_k.c
+++ b/drivers/staging/gdm724x/netlink_k.c
@@ -20,7 +20,7 @@ static DEFINE_MUTEX(netlink_mutex);
 #define ND_NLMSG_DATA(nlh) ((void *)((char *)NLMSG_DATA(nlh) + \
  ND_IFINDEX_LEN))
 #define ND_NLMSG_S_LEN(len)(len + ND_IFINDEX_LEN)
-#define ND_NLMSG_R_LEN(nlh)(nlh->nlmsg_len - ND_IFINDEX_LEN)
+#define ND_NLMSG_R_LEN(nlh)((nlh)->nlmsg_len - ND_IFINDEX_LEN)
 #define ND_NLMSG_IFIDX(nlh)NLMSG_DATA(nlh)
 #define ND_MAX_MSG_LEN (1024 * 32)
 
-- 
2.28.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH AUTOSEL 5.8 07/42] speakup: Fix wait_for_xmitr for ttyio case

2020-08-31 Thread Greg Kroah-Hartman
On Mon, Aug 31, 2020 at 11:28:59AM -0400, Sasha Levin wrote:
> From: Samuel Thibault 
> 
> [ Upstream commit 2b86d9b8ec6efb86fc5ea44f2d49b1df17f699a1 ]
> 
> This was missed while introducing the tty-based serial access.
> 
> The only remaining use of wait_for_xmitr with tty-based access is in
> spk_synth_is_alive_restart to check whether the synth can be restarted.
> With tty-based this is up to the tty layer to cope with the buffering
> etc. so we can just say yes.
> 
> Signed-off-by: Samuel Thibault 
> Link: https://lore.kernel.org/r/20200804160637.x3iycau5izywbgzl@function
> Signed-off-by: Greg Kroah-Hartman 
> Signed-off-by: Sasha Levin 
> ---
>  drivers/staging/speakup/serialio.c  | 8 +---
>  drivers/staging/speakup/spk_priv.h  | 1 -
>  drivers/staging/speakup/spk_ttyio.c | 7 +++
>  drivers/staging/speakup/spk_types.h | 1 +
>  drivers/staging/speakup/synth.c | 2 +-
>  5 files changed, 14 insertions(+), 5 deletions(-)

Not needed for 5.8 or older, sorry, this was a 5.9-rc1+ issue only.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH AUTOSEL 4.14 2/9] speakup: Fix wait_for_xmitr for ttyio case

2020-08-31 Thread Sasha Levin
From: Samuel Thibault 

[ Upstream commit 2b86d9b8ec6efb86fc5ea44f2d49b1df17f699a1 ]

This was missed while introducing the tty-based serial access.

The only remaining use of wait_for_xmitr with tty-based access is in
spk_synth_is_alive_restart to check whether the synth can be restarted.
With tty-based this is up to the tty layer to cope with the buffering
etc. so we can just say yes.

Signed-off-by: Samuel Thibault 
Link: https://lore.kernel.org/r/20200804160637.x3iycau5izywbgzl@function
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/staging/speakup/serialio.c  | 8 +---
 drivers/staging/speakup/spk_priv.h  | 1 -
 drivers/staging/speakup/spk_ttyio.c | 7 +++
 drivers/staging/speakup/spk_types.h | 1 +
 drivers/staging/speakup/synth.c | 2 +-
 5 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/speakup/serialio.c 
b/drivers/staging/speakup/serialio.c
index 9cfc8142a3187..f9ec8f1ac73be 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -31,6 +31,7 @@ static void spk_serial_tiocmset(unsigned int set, unsigned 
int clear);
 static unsigned char spk_serial_in(void);
 static unsigned char spk_serial_in_nowait(void);
 static void spk_serial_flush_buffer(void);
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_serial_io_ops = {
.synth_out = spk_serial_out,
@@ -39,6 +40,7 @@ struct spk_io_ops spk_serial_io_ops = {
.synth_in = spk_serial_in,
.synth_in_nowait = spk_serial_in_nowait,
.flush_buffer = spk_serial_flush_buffer,
+   .wait_for_xmitr = spk_serial_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_serial_io_ops);
 
@@ -210,7 +212,7 @@ void spk_stop_serial_interrupt(void)
 }
 EXPORT_SYMBOL_GPL(spk_stop_serial_interrupt);
 
-int spk_wait_for_xmitr(struct spk_synth *in_synth)
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth)
 {
int tmout = SPK_XMITR_TIMEOUT;
 
@@ -279,7 +281,7 @@ static void spk_serial_flush_buffer(void)
 
 static int spk_serial_out(struct spk_synth *in_synth, const char ch)
 {
-   if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
+   if (in_synth->alive && spk_serial_wait_for_xmitr(in_synth)) {
outb_p(ch, speakup_info.port_tts);
return 1;
}
@@ -294,7 +296,7 @@ const char *spk_serial_synth_immediate(struct spk_synth 
*synth,
while ((ch = *buff)) {
if (ch == '\n')
ch = synth->procspeech;
-   if (spk_wait_for_xmitr(synth))
+   if (spk_serial_wait_for_xmitr(synth))
outb(ch, speakup_info.port_tts);
else
return buff;
diff --git a/drivers/staging/speakup/spk_priv.h 
b/drivers/staging/speakup/spk_priv.h
index 046040ac074c6..8466c4c81ea84 100644
--- a/drivers/staging/speakup/spk_priv.h
+++ b/drivers/staging/speakup/spk_priv.h
@@ -45,7 +45,6 @@
 
 const struct old_serial_port *spk_serial_init(int index);
 void spk_stop_serial_interrupt(void);
-int spk_wait_for_xmitr(struct spk_synth *in_synth);
 void spk_serial_release(void);
 void spk_ttyio_release(void);
 void spk_ttyio_register_ldisc(void);
diff --git a/drivers/staging/speakup/spk_ttyio.c 
b/drivers/staging/speakup/spk_ttyio.c
index 71edd3cfe6844..59cd966932c82 100644
--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -115,6 +115,7 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned 
int clear);
 static unsigned char spk_ttyio_in(void);
 static unsigned char spk_ttyio_in_nowait(void);
 static void spk_ttyio_flush_buffer(void);
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_ttyio_ops = {
.synth_out = spk_ttyio_out,
@@ -123,6 +124,7 @@ struct spk_io_ops spk_ttyio_ops = {
.synth_in = spk_ttyio_in,
.synth_in_nowait = spk_ttyio_in_nowait,
.flush_buffer = spk_ttyio_flush_buffer,
+   .wait_for_xmitr = spk_ttyio_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_ttyio_ops);
 
@@ -264,6 +266,11 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned 
int clear)
mutex_unlock(_tty_mutex);
 }
 
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth)
+{
+   return 1;
+}
+
 static unsigned char ttyio_in(int timeout)
 {
struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;
diff --git a/drivers/staging/speakup/spk_types.h 
b/drivers/staging/speakup/spk_types.h
index c50de6035a9aa..bfbc09f760a94 100644
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -156,6 +156,7 @@ struct spk_io_ops {
unsigned char (*synth_in)(void);
unsigned char (*synth_in_nowait)(void);
void (*flush_buffer)(void);
+   int (*wait_for_xmitr)(struct spk_synth *synth);
 };
 
 struct spk_synth {
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 

[PATCH AUTOSEL 5.4 04/23] speakup: Fix wait_for_xmitr for ttyio case

2020-08-31 Thread Sasha Levin
From: Samuel Thibault 

[ Upstream commit 2b86d9b8ec6efb86fc5ea44f2d49b1df17f699a1 ]

This was missed while introducing the tty-based serial access.

The only remaining use of wait_for_xmitr with tty-based access is in
spk_synth_is_alive_restart to check whether the synth can be restarted.
With tty-based this is up to the tty layer to cope with the buffering
etc. so we can just say yes.

Signed-off-by: Samuel Thibault 
Link: https://lore.kernel.org/r/20200804160637.x3iycau5izywbgzl@function
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/staging/speakup/serialio.c  | 8 +---
 drivers/staging/speakup/spk_priv.h  | 1 -
 drivers/staging/speakup/spk_ttyio.c | 7 +++
 drivers/staging/speakup/spk_types.h | 1 +
 drivers/staging/speakup/synth.c | 2 +-
 5 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/speakup/serialio.c 
b/drivers/staging/speakup/serialio.c
index 177a2988641c1..403b01d66367e 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -32,6 +32,7 @@ static void spk_serial_tiocmset(unsigned int set, unsigned 
int clear);
 static unsigned char spk_serial_in(void);
 static unsigned char spk_serial_in_nowait(void);
 static void spk_serial_flush_buffer(void);
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_serial_io_ops = {
.synth_out = spk_serial_out,
@@ -40,6 +41,7 @@ struct spk_io_ops spk_serial_io_ops = {
.synth_in = spk_serial_in,
.synth_in_nowait = spk_serial_in_nowait,
.flush_buffer = spk_serial_flush_buffer,
+   .wait_for_xmitr = spk_serial_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_serial_io_ops);
 
@@ -211,7 +213,7 @@ void spk_stop_serial_interrupt(void)
 }
 EXPORT_SYMBOL_GPL(spk_stop_serial_interrupt);
 
-int spk_wait_for_xmitr(struct spk_synth *in_synth)
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth)
 {
int tmout = SPK_XMITR_TIMEOUT;
 
@@ -280,7 +282,7 @@ static void spk_serial_flush_buffer(void)
 
 static int spk_serial_out(struct spk_synth *in_synth, const char ch)
 {
-   if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
+   if (in_synth->alive && spk_serial_wait_for_xmitr(in_synth)) {
outb_p(ch, speakup_info.port_tts);
return 1;
}
@@ -295,7 +297,7 @@ const char *spk_serial_synth_immediate(struct spk_synth 
*synth,
while ((ch = *buff)) {
if (ch == '\n')
ch = synth->procspeech;
-   if (spk_wait_for_xmitr(synth))
+   if (spk_serial_wait_for_xmitr(synth))
outb(ch, speakup_info.port_tts);
else
return buff;
diff --git a/drivers/staging/speakup/spk_priv.h 
b/drivers/staging/speakup/spk_priv.h
index ac6a74883af47..e9e3460634da2 100644
--- a/drivers/staging/speakup/spk_priv.h
+++ b/drivers/staging/speakup/spk_priv.h
@@ -36,7 +36,6 @@
 
 const struct old_serial_port *spk_serial_init(int index);
 void spk_stop_serial_interrupt(void);
-int spk_wait_for_xmitr(struct spk_synth *in_synth);
 void spk_serial_release(void);
 void spk_ttyio_release(void);
 void spk_ttyio_register_ldisc(void);
diff --git a/drivers/staging/speakup/spk_ttyio.c 
b/drivers/staging/speakup/spk_ttyio.c
index 5a9eff08cb960..b79361b6dc3a6 100644
--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -116,6 +116,7 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned 
int clear);
 static unsigned char spk_ttyio_in(void);
 static unsigned char spk_ttyio_in_nowait(void);
 static void spk_ttyio_flush_buffer(void);
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_ttyio_ops = {
.synth_out = spk_ttyio_out,
@@ -125,6 +126,7 @@ struct spk_io_ops spk_ttyio_ops = {
.synth_in = spk_ttyio_in,
.synth_in_nowait = spk_ttyio_in_nowait,
.flush_buffer = spk_ttyio_flush_buffer,
+   .wait_for_xmitr = spk_ttyio_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_ttyio_ops);
 
@@ -286,6 +288,11 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned 
int clear)
mutex_unlock(_tty_mutex);
 }
 
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth)
+{
+   return 1;
+}
+
 static unsigned char ttyio_in(int timeout)
 {
struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;
diff --git a/drivers/staging/speakup/spk_types.h 
b/drivers/staging/speakup/spk_types.h
index a2fc72c298944..f2d3bd72c2c19 100644
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -157,6 +157,7 @@ struct spk_io_ops {
unsigned char (*synth_in)(void);
unsigned char (*synth_in_nowait)(void);
void (*flush_buffer)(void);
+   int (*wait_for_xmitr)(struct spk_synth *synth);
 };
 
 struct spk_synth {
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 

[PATCH AUTOSEL 4.19 02/11] speakup: Fix wait_for_xmitr for ttyio case

2020-08-31 Thread Sasha Levin
From: Samuel Thibault 

[ Upstream commit 2b86d9b8ec6efb86fc5ea44f2d49b1df17f699a1 ]

This was missed while introducing the tty-based serial access.

The only remaining use of wait_for_xmitr with tty-based access is in
spk_synth_is_alive_restart to check whether the synth can be restarted.
With tty-based this is up to the tty layer to cope with the buffering
etc. so we can just say yes.

Signed-off-by: Samuel Thibault 
Link: https://lore.kernel.org/r/20200804160637.x3iycau5izywbgzl@function
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/staging/speakup/serialio.c  | 8 +---
 drivers/staging/speakup/spk_priv.h  | 1 -
 drivers/staging/speakup/spk_ttyio.c | 7 +++
 drivers/staging/speakup/spk_types.h | 1 +
 drivers/staging/speakup/synth.c | 2 +-
 5 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/speakup/serialio.c 
b/drivers/staging/speakup/serialio.c
index 177a2988641c1..403b01d66367e 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -32,6 +32,7 @@ static void spk_serial_tiocmset(unsigned int set, unsigned 
int clear);
 static unsigned char spk_serial_in(void);
 static unsigned char spk_serial_in_nowait(void);
 static void spk_serial_flush_buffer(void);
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_serial_io_ops = {
.synth_out = spk_serial_out,
@@ -40,6 +41,7 @@ struct spk_io_ops spk_serial_io_ops = {
.synth_in = spk_serial_in,
.synth_in_nowait = spk_serial_in_nowait,
.flush_buffer = spk_serial_flush_buffer,
+   .wait_for_xmitr = spk_serial_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_serial_io_ops);
 
@@ -211,7 +213,7 @@ void spk_stop_serial_interrupt(void)
 }
 EXPORT_SYMBOL_GPL(spk_stop_serial_interrupt);
 
-int spk_wait_for_xmitr(struct spk_synth *in_synth)
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth)
 {
int tmout = SPK_XMITR_TIMEOUT;
 
@@ -280,7 +282,7 @@ static void spk_serial_flush_buffer(void)
 
 static int spk_serial_out(struct spk_synth *in_synth, const char ch)
 {
-   if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
+   if (in_synth->alive && spk_serial_wait_for_xmitr(in_synth)) {
outb_p(ch, speakup_info.port_tts);
return 1;
}
@@ -295,7 +297,7 @@ const char *spk_serial_synth_immediate(struct spk_synth 
*synth,
while ((ch = *buff)) {
if (ch == '\n')
ch = synth->procspeech;
-   if (spk_wait_for_xmitr(synth))
+   if (spk_serial_wait_for_xmitr(synth))
outb(ch, speakup_info.port_tts);
else
return buff;
diff --git a/drivers/staging/speakup/spk_priv.h 
b/drivers/staging/speakup/spk_priv.h
index 796ffcca43c18..de1ed6c5018f6 100644
--- a/drivers/staging/speakup/spk_priv.h
+++ b/drivers/staging/speakup/spk_priv.h
@@ -36,7 +36,6 @@
 
 const struct old_serial_port *spk_serial_init(int index);
 void spk_stop_serial_interrupt(void);
-int spk_wait_for_xmitr(struct spk_synth *in_synth);
 void spk_serial_release(void);
 void spk_ttyio_release(void);
 void spk_ttyio_register_ldisc(void);
diff --git a/drivers/staging/speakup/spk_ttyio.c 
b/drivers/staging/speakup/spk_ttyio.c
index 93742dbdee77b..07948755cf9ed 100644
--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -116,6 +116,7 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned 
int clear);
 static unsigned char spk_ttyio_in(void);
 static unsigned char spk_ttyio_in_nowait(void);
 static void spk_ttyio_flush_buffer(void);
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_ttyio_ops = {
.synth_out = spk_ttyio_out,
@@ -125,6 +126,7 @@ struct spk_io_ops spk_ttyio_ops = {
.synth_in = spk_ttyio_in,
.synth_in_nowait = spk_ttyio_in_nowait,
.flush_buffer = spk_ttyio_flush_buffer,
+   .wait_for_xmitr = spk_ttyio_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_ttyio_ops);
 
@@ -283,6 +285,11 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned 
int clear)
mutex_unlock(_tty_mutex);
 }
 
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth)
+{
+   return 1;
+}
+
 static unsigned char ttyio_in(int timeout)
 {
struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;
diff --git a/drivers/staging/speakup/spk_types.h 
b/drivers/staging/speakup/spk_types.h
index a2fc72c298944..f2d3bd72c2c19 100644
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -157,6 +157,7 @@ struct spk_io_ops {
unsigned char (*synth_in)(void);
unsigned char (*synth_in_nowait)(void);
void (*flush_buffer)(void);
+   int (*wait_for_xmitr)(struct spk_synth *synth);
 };
 
 struct spk_synth {
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 

[PATCH AUTOSEL 5.8 07/42] speakup: Fix wait_for_xmitr for ttyio case

2020-08-31 Thread Sasha Levin
From: Samuel Thibault 

[ Upstream commit 2b86d9b8ec6efb86fc5ea44f2d49b1df17f699a1 ]

This was missed while introducing the tty-based serial access.

The only remaining use of wait_for_xmitr with tty-based access is in
spk_synth_is_alive_restart to check whether the synth can be restarted.
With tty-based this is up to the tty layer to cope with the buffering
etc. so we can just say yes.

Signed-off-by: Samuel Thibault 
Link: https://lore.kernel.org/r/20200804160637.x3iycau5izywbgzl@function
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/staging/speakup/serialio.c  | 8 +---
 drivers/staging/speakup/spk_priv.h  | 1 -
 drivers/staging/speakup/spk_ttyio.c | 7 +++
 drivers/staging/speakup/spk_types.h | 1 +
 drivers/staging/speakup/synth.c | 2 +-
 5 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/speakup/serialio.c 
b/drivers/staging/speakup/serialio.c
index 177a2988641c1..403b01d66367e 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -32,6 +32,7 @@ static void spk_serial_tiocmset(unsigned int set, unsigned 
int clear);
 static unsigned char spk_serial_in(void);
 static unsigned char spk_serial_in_nowait(void);
 static void spk_serial_flush_buffer(void);
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_serial_io_ops = {
.synth_out = spk_serial_out,
@@ -40,6 +41,7 @@ struct spk_io_ops spk_serial_io_ops = {
.synth_in = spk_serial_in,
.synth_in_nowait = spk_serial_in_nowait,
.flush_buffer = spk_serial_flush_buffer,
+   .wait_for_xmitr = spk_serial_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_serial_io_ops);
 
@@ -211,7 +213,7 @@ void spk_stop_serial_interrupt(void)
 }
 EXPORT_SYMBOL_GPL(spk_stop_serial_interrupt);
 
-int spk_wait_for_xmitr(struct spk_synth *in_synth)
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth)
 {
int tmout = SPK_XMITR_TIMEOUT;
 
@@ -280,7 +282,7 @@ static void spk_serial_flush_buffer(void)
 
 static int spk_serial_out(struct spk_synth *in_synth, const char ch)
 {
-   if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
+   if (in_synth->alive && spk_serial_wait_for_xmitr(in_synth)) {
outb_p(ch, speakup_info.port_tts);
return 1;
}
@@ -295,7 +297,7 @@ const char *spk_serial_synth_immediate(struct spk_synth 
*synth,
while ((ch = *buff)) {
if (ch == '\n')
ch = synth->procspeech;
-   if (spk_wait_for_xmitr(synth))
+   if (spk_serial_wait_for_xmitr(synth))
outb(ch, speakup_info.port_tts);
else
return buff;
diff --git a/drivers/staging/speakup/spk_priv.h 
b/drivers/staging/speakup/spk_priv.h
index c75b408387947..0f4bcbe5ddb93 100644
--- a/drivers/staging/speakup/spk_priv.h
+++ b/drivers/staging/speakup/spk_priv.h
@@ -34,7 +34,6 @@
 
 const struct old_serial_port *spk_serial_init(int index);
 void spk_stop_serial_interrupt(void);
-int spk_wait_for_xmitr(struct spk_synth *in_synth);
 void spk_serial_release(void);
 void spk_ttyio_release(void);
 void spk_ttyio_register_ldisc(void);
diff --git a/drivers/staging/speakup/spk_ttyio.c 
b/drivers/staging/speakup/spk_ttyio.c
index 9b95f77f92657..a831ff64f8ba5 100644
--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -116,6 +116,7 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned 
int clear);
 static unsigned char spk_ttyio_in(void);
 static unsigned char spk_ttyio_in_nowait(void);
 static void spk_ttyio_flush_buffer(void);
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_ttyio_ops = {
.synth_out = spk_ttyio_out,
@@ -125,6 +126,7 @@ struct spk_io_ops spk_ttyio_ops = {
.synth_in = spk_ttyio_in,
.synth_in_nowait = spk_ttyio_in_nowait,
.flush_buffer = spk_ttyio_flush_buffer,
+   .wait_for_xmitr = spk_ttyio_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_ttyio_ops);
 
@@ -286,6 +288,11 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned 
int clear)
mutex_unlock(_tty_mutex);
 }
 
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth)
+{
+   return 1;
+}
+
 static unsigned char ttyio_in(int timeout)
 {
struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;
diff --git a/drivers/staging/speakup/spk_types.h 
b/drivers/staging/speakup/spk_types.h
index d3272c6d199aa..7398f1196e103 100644
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -158,6 +158,7 @@ struct spk_io_ops {
unsigned char (*synth_in)(void);
unsigned char (*synth_in_nowait)(void);
void (*flush_buffer)(void);
+   int (*wait_for_xmitr)(struct spk_synth *synth);
 };
 
 struct spk_synth {
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 

[PATCH v3 7/7] crypto: arc4 - mark ecb(arc4) skcipher as obsolete

2020-08-31 Thread Ard Biesheuvel
Cryptographic algorithms may have a lifespan that is significantly
shorter than Linux's, and so we need to start phasing out algorithms
that are known to be broken, and are no longer fit for general use.

RC4 (or arc4) is a good example here: there are a few areas where its
use is still somewhat acceptable, e.g., for interoperability with legacy
wifi hardware that can only use WEP or TKIP data encryption, but that
should not imply that, for instance, use of RC4 based EAP-TLS by the WPA
supplicant for negotiating TKIP keys is equally acceptable, or that RC4
should remain available as a general purpose cryptographic transform for
all in-kernel and user space clients.

Now that all in-kernel users that need to retain support have moved to
the arc4 library interface, and the known users of ecb(arc4) via the
socket API (iwd [0] and libell [1][2]) have been updated to switch to a
local implementation, we can take the next step, and mark the ecb(arc4)
skcipher as obsolete, and only provide it if the socket API is enabled in
the first place, as well as provide the option to disable all algorithms
that have been marked as obsolete.

[0] 
https://git.kernel.org/pub/scm/network/wireless/iwd.git/commit/?id=1db8a85a60c64523
[1] https://git.kernel.org/pub/scm/libs/ell/ell.git/commit/?id=53482ce421b727c2
[2] https://git.kernel.org/pub/scm/libs/ell/ell.git/commit/?id=7f6a137809d42f6b

Signed-off-by: Ard Biesheuvel 
---
 crypto/Kconfig | 10 ++
 crypto/arc4.c  | 10 ++
 2 files changed, 20 insertions(+)

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 1b57419fa2e7..e85d8a059489 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -1199,6 +1199,7 @@ config CRYPTO_ANUBIS
 
 config CRYPTO_ARC4
tristate "ARC4 cipher algorithm"
+   depends on CRYPTO_USER_API_ENABLE_OBSOLETE
select CRYPTO_SKCIPHER
select CRYPTO_LIB_ARC4
help
@@ -1881,6 +1882,15 @@ config CRYPTO_USER_API_AEAD
  This option enables the user-spaces interface for AEAD
  cipher algorithms.
 
+config CRYPTO_USER_API_ENABLE_OBSOLETE
+   bool "Enable obsolete cryptographic algorithms for userspace"
+   depends on CRYPTO_USER_API
+   default y
+   help
+ Allow obsolete cryptographic algorithms to be selected that have
+ already been phased out from internal use by the kernel, and are
+ only useful for userspace clients that still rely on them.
+
 config CRYPTO_STATS
bool "Crypto usage statistics for User-space"
depends on CRYPTO_USER
diff --git a/crypto/arc4.c b/crypto/arc4.c
index aa79571dbd49..923aa7a6cd60 100644
--- a/crypto/arc4.c
+++ b/crypto/arc4.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static int crypto_arc4_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
  unsigned int key_len)
@@ -39,6 +40,14 @@ static int crypto_arc4_crypt(struct skcipher_request *req)
return err;
 }
 
+static int crypto_arc4_init(struct crypto_skcipher *tfm)
+{
+   pr_warn_ratelimited("\"%s\" (%ld) uses obsolete ecb(arc4) skcipher\n",
+   current->comm, (unsigned long)current->pid);
+
+   return 0;
+}
+
 static struct skcipher_alg arc4_alg = {
/*
 * For legacy reasons, this is named "ecb(arc4)", not "arc4".
@@ -55,6 +64,7 @@ static struct skcipher_alg arc4_alg = {
.setkey =   crypto_arc4_setkey,
.encrypt=   crypto_arc4_crypt,
.decrypt=   crypto_arc4_crypt,
+   .init   =   crypto_arc4_init,
 };
 
 static int __init arc4_init(void)
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 5/7] crypto: bcm-iproc - remove ecb(arc4) support

2020-08-31 Thread Ard Biesheuvel
Signed-off-by: Ard Biesheuvel 
---
 drivers/crypto/bcm/cipher.c | 96 +---
 drivers/crypto/bcm/cipher.h |  1 -
 drivers/crypto/bcm/spu.c| 23 +
 drivers/crypto/bcm/spu.h|  1 -
 drivers/crypto/bcm/spu2.c   | 12 +--
 drivers/crypto/bcm/spu2.h   |  1 -
 6 files changed, 6 insertions(+), 128 deletions(-)

diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index 8a7fa1ae1ade..5d38b87b9d77 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -165,10 +165,6 @@ spu_skcipher_rx_sg_create(struct brcm_message *mssg,
return -EFAULT;
}
 
-   if (ctx->cipher.alg == CIPHER_ALG_RC4)
-   /* Add buffer to catch 260-byte SUPDT field for RC4 */
-   sg_set_buf(sg++, rctx->msg_buf.c.supdt_tweak, SPU_SUPDT_LEN);
-
if (stat_pad_len)
sg_set_buf(sg++, rctx->msg_buf.rx_stat_pad, stat_pad_len);
 
@@ -317,7 +313,6 @@ static int handle_skcipher_req(struct iproc_reqctx_s *rctx)
u8 local_iv_ctr[MAX_IV_SIZE];
u32 stat_pad_len;   /* num bytes to align status field */
u32 pad_len;/* total length of all padding */
-   bool update_key = false;
struct brcm_message *mssg;  /* mailbox message */
 
/* number of entries in src and dst sg in mailbox message. */
@@ -391,28 +386,6 @@ static int handle_skcipher_req(struct iproc_reqctx_s *rctx)
}
}
 
-   if (ctx->cipher.alg == CIPHER_ALG_RC4) {
-   rx_frag_num++;
-   if (chunk_start) {
-   /*
-* for non-first RC4 chunks, use SUPDT from previous
-* response as key for this chunk.
-*/
-   cipher_parms.key_buf = rctx->msg_buf.c.supdt_tweak;
-   update_key = true;
-   cipher_parms.type = CIPHER_TYPE_UPDT;
-   } else if (!rctx->is_encrypt) {
-   /*
-* First RC4 chunk. For decrypt, key in pre-built msg
-* header may have been changed if encrypt required
-* multiple chunks. So revert the key to the
-* ctx->enckey value.
-*/
-   update_key = true;
-   cipher_parms.type = CIPHER_TYPE_INIT;
-   }
-   }
-
if (ctx->max_payload == SPU_MAX_PAYLOAD_INF)
flow_log("max_payload infinite\n");
else
@@ -425,14 +398,9 @@ static int handle_skcipher_req(struct iproc_reqctx_s *rctx)
memcpy(rctx->msg_buf.bcm_spu_req_hdr, ctx->bcm_spu_req_hdr,
   sizeof(rctx->msg_buf.bcm_spu_req_hdr));
 
-   /*
-* Pass SUPDT field as key. Key field in finish() call is only used
-* when update_key has been set above for RC4. Will be ignored in
-* all other cases.
-*/
spu->spu_cipher_req_finish(rctx->msg_buf.bcm_spu_req_hdr + BCM_HDR_LEN,
   ctx->spu_req_hdr_len, !(rctx->is_encrypt),
-  _parms, update_key, chunksize);
+  _parms, chunksize);
 
atomic64_add(chunksize, _priv.bytes_out);
 
@@ -527,9 +495,6 @@ static void handle_skcipher_resp(struct iproc_reqctx_s 
*rctx)
 __func__, rctx->total_received, payload_len);
 
dump_sg(req->dst, rctx->total_received, payload_len);
-   if (ctx->cipher.alg == CIPHER_ALG_RC4)
-   packet_dump("  supdt ", rctx->msg_buf.c.supdt_tweak,
-   SPU_SUPDT_LEN);
 
rctx->total_received += payload_len;
if (rctx->total_received == rctx->total_todo) {
@@ -1853,26 +1818,6 @@ static int aes_setkey(struct crypto_skcipher *cipher, 
const u8 *key,
return 0;
 }
 
-static int rc4_setkey(struct crypto_skcipher *cipher, const u8 *key,
- unsigned int keylen)
-{
-   struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
-   int i;
-
-   ctx->enckeylen = ARC4_MAX_KEY_SIZE + ARC4_STATE_SIZE;
-
-   ctx->enckey[0] = 0x00;  /* 0x00 */
-   ctx->enckey[1] = 0x00;  /* i*/
-   ctx->enckey[2] = 0x00;  /* 0x00 */
-   ctx->enckey[3] = 0x00;  /* j*/
-   for (i = 0; i < ARC4_MAX_KEY_SIZE; i++)
-   ctx->enckey[i + ARC4_STATE_SIZE] = key[i % keylen];
-
-   ctx->cipher_type = CIPHER_TYPE_INIT;
-
-   return 0;
-}
-
 static int skcipher_setkey(struct crypto_skcipher *cipher, const u8 *key,
 unsigned int keylen)
 {
@@ -1895,9 +1840,6 @@ static int skcipher_setkey(struct crypto_skcipher 
*cipher, const u8 *key,
case CIPHER_ALG_AES:
err = aes_setkey(cipher, key, keylen);
break;
-   case CIPHER_ALG_RC4:
-   err = rc4_setkey(cipher, key, keylen);
-   break;
default:

[PATCH v3 1/7] staging/rtl8192e: switch to RC4 library interface

2020-08-31 Thread Ard Biesheuvel
Switch to the ARC4 library interface, to remove the pointless
dependency on the skcipher API, from which we will hopefully be
able to drop ecb(arc4) skcipher support.

Signed-off-by: Ard Biesheuvel 
Acked-by: Greg Kroah-Hartman 
---
 drivers/staging/rtl8192e/Kconfig |  4 +-
 drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 70 ---
 drivers/staging/rtl8192e/rtllib_crypt_wep.c  | 72 
 3 files changed, 28 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/rtl8192e/Kconfig b/drivers/staging/rtl8192e/Kconfig
index 1007eea6c8fc..4c440bdaaf6e 100644
--- a/drivers/staging/rtl8192e/Kconfig
+++ b/drivers/staging/rtl8192e/Kconfig
@@ -25,7 +25,7 @@ config RTLLIB_CRYPTO_CCMP
 config RTLLIB_CRYPTO_TKIP
tristate "Support for rtllib TKIP crypto"
depends on RTLLIB
-   select CRYPTO_ARC4
+   select CRYPTO_LIB_ARC4
select CRYPTO_MICHAEL_MIC
default y
help
@@ -35,7 +35,7 @@ config RTLLIB_CRYPTO_TKIP
 
 config RTLLIB_CRYPTO_WEP
tristate "Support for rtllib WEP crypto"
-   select CRYPTO_ARC4
+   select CRYPTO_LIB_ARC4
depends on RTLLIB
default y
help
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c 
b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
index 8d2a58e706d5..8c2ff37b2d3a 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
@@ -5,8 +5,9 @@
  * Copyright (c) 2003-2004, Jouni Malinen 
  */
 
+#include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -16,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -45,9 +45,9 @@ struct rtllib_tkip_data {
u32 dot11RSNAStatsTKIPLocalMICFailures;
 
int key_idx;
-   struct crypto_sync_skcipher *rx_tfm_arc4;
+   struct arc4_ctx rx_ctx_arc4;
+   struct arc4_ctx tx_ctx_arc4;
struct crypto_shash *rx_tfm_michael;
-   struct crypto_sync_skcipher *tx_tfm_arc4;
struct crypto_shash *tx_tfm_michael;
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16];
@@ -58,16 +58,13 @@ static void *rtllib_tkip_init(int key_idx)
 {
struct rtllib_tkip_data *priv;
 
+   if (fips_enabled)
+   return NULL;
+
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
if (priv == NULL)
goto fail;
priv->key_idx = key_idx;
-   priv->tx_tfm_arc4 = crypto_alloc_sync_skcipher("ecb(arc4)", 0, 0);
-   if (IS_ERR(priv->tx_tfm_arc4)) {
-   pr_debug("Could not allocate crypto API arc4\n");
-   priv->tx_tfm_arc4 = NULL;
-   goto fail;
-   }
 
priv->tx_tfm_michael = crypto_alloc_shash("michael_mic", 0, 0);
if (IS_ERR(priv->tx_tfm_michael)) {
@@ -76,13 +73,6 @@ static void *rtllib_tkip_init(int key_idx)
goto fail;
}
 
-   priv->rx_tfm_arc4 = crypto_alloc_sync_skcipher("ecb(arc4)", 0, 0);
-   if (IS_ERR(priv->rx_tfm_arc4)) {
-   pr_debug("Could not allocate crypto API arc4\n");
-   priv->rx_tfm_arc4 = NULL;
-   goto fail;
-   }
-
priv->rx_tfm_michael = crypto_alloc_shash("michael_mic", 0, 0);
if (IS_ERR(priv->rx_tfm_michael)) {
pr_debug("Could not allocate crypto API michael_mic\n");
@@ -94,9 +84,7 @@ static void *rtllib_tkip_init(int key_idx)
 fail:
if (priv) {
crypto_free_shash(priv->tx_tfm_michael);
-   crypto_free_sync_skcipher(priv->tx_tfm_arc4);
crypto_free_shash(priv->rx_tfm_michael);
-   crypto_free_sync_skcipher(priv->rx_tfm_arc4);
kfree(priv);
}
 
@@ -110,11 +98,9 @@ static void rtllib_tkip_deinit(void *priv)
 
if (_priv) {
crypto_free_shash(_priv->tx_tfm_michael);
-   crypto_free_sync_skcipher(_priv->tx_tfm_arc4);
crypto_free_shash(_priv->rx_tfm_michael);
-   crypto_free_sync_skcipher(_priv->rx_tfm_arc4);
}
-   kfree(priv);
+   kzfree(priv);
 }
 
 
@@ -289,7 +275,6 @@ static int rtllib_tkip_encrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
int ret = 0;
u8 rc4key[16],  *icv;
u32 crc;
-   struct scatterlist sg;
 
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -331,8 +316,6 @@ static int rtllib_tkip_encrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
*pos++ = (tkey->tx_iv32 >> 24) & 0xff;
 
if (!tcb_desc->bHwSec) {
-   SYNC_SKCIPHER_REQUEST_ON_STACK(req, tkey->tx_tfm_arc4);
-
icv = skb_put(skb, 4);
crc = ~crc32_le(~0, pos, len);
icv[0] = crc;
@@ -340,15 +323,8 @@ static int rtllib_tkip_encrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
icv[2] = crc >> 16;
icv[3] = crc >> 24;
 
-   sg_init_one(, pos, len+4);

[PATCH v3 6/7] net: wireless: drop bogus CRYPTO_xxx Kconfig selects

2020-08-31 Thread Ard Biesheuvel
Drop some bogus Kconfig selects that are not entirely accurate, and
unnecessary to begin with, since the same Kconfig options also select
LIB80211 features that already imply the selected functionality (AES
for CCMP, ARC4 and ECB for TKIP)

Signed-off-by: Ard Biesheuvel 
---
 drivers/net/wireless/intel/ipw2x00/Kconfig   | 4 
 drivers/net/wireless/intersil/hostap/Kconfig | 4 
 2 files changed, 8 deletions(-)

diff --git a/drivers/net/wireless/intel/ipw2x00/Kconfig 
b/drivers/net/wireless/intel/ipw2x00/Kconfig
index b1e7b4470842..1650d5865aa0 100644
--- a/drivers/net/wireless/intel/ipw2x00/Kconfig
+++ b/drivers/net/wireless/intel/ipw2x00/Kconfig
@@ -160,11 +160,7 @@ config LIBIPW
select WIRELESS_EXT
select WEXT_SPY
select CRYPTO
-   select CRYPTO_ARC4
-   select CRYPTO_ECB
-   select CRYPTO_AES
select CRYPTO_MICHAEL_MIC
-   select CRYPTO_ECB
select CRC32
select LIB80211
select LIB80211_CRYPT_WEP
diff --git a/drivers/net/wireless/intersil/hostap/Kconfig 
b/drivers/net/wireless/intersil/hostap/Kconfig
index 6ad88299432f..c865d3156cea 100644
--- a/drivers/net/wireless/intersil/hostap/Kconfig
+++ b/drivers/net/wireless/intersil/hostap/Kconfig
@@ -5,11 +5,7 @@ config HOSTAP
select WEXT_SPY
select WEXT_PRIV
select CRYPTO
-   select CRYPTO_ARC4
-   select CRYPTO_ECB
-   select CRYPTO_AES
select CRYPTO_MICHAEL_MIC
-   select CRYPTO_ECB
select CRC32
select LIB80211
select LIB80211_CRYPT_WEP
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 4/7] crypto: n2 - remove ecb(arc4) support

2020-08-31 Thread Ard Biesheuvel
Signed-off-by: Ard Biesheuvel 
---
 drivers/crypto/n2_core.c | 46 
 1 file changed, 46 deletions(-)

diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index d8aec5153b21..8c8e17d5fb20 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -662,7 +662,6 @@ struct n2_skcipher_context {
u8  aes[AES_MAX_KEY_SIZE];
u8  des[DES_KEY_SIZE];
u8  des3[3 * DES_KEY_SIZE];
-   u8  arc4[258]; /* S-box, X, Y */
} key;
 };
 
@@ -789,36 +788,6 @@ static int n2_3des_setkey(struct crypto_skcipher 
*skcipher, const u8 *key,
return 0;
 }
 
-static int n2_arc4_setkey(struct crypto_skcipher *skcipher, const u8 *key,
- unsigned int keylen)
-{
-   struct crypto_tfm *tfm = crypto_skcipher_tfm(skcipher);
-   struct n2_skcipher_context *ctx = crypto_tfm_ctx(tfm);
-   struct n2_skcipher_alg *n2alg = n2_skcipher_alg(skcipher);
-   u8 *s = ctx->key.arc4;
-   u8 *x = s + 256;
-   u8 *y = x + 1;
-   int i, j, k;
-
-   ctx->enc_type = n2alg->enc_type;
-
-   j = k = 0;
-   *x = 0;
-   *y = 0;
-   for (i = 0; i < 256; i++)
-   s[i] = i;
-   for (i = 0; i < 256; i++) {
-   u8 a = s[i];
-   j = (j + key[k] + a) & 0xff;
-   s[i] = s[j];
-   s[j] = a;
-   if (++k >= keylen)
-   k = 0;
-   }
-
-   return 0;
-}
-
 static inline int skcipher_descriptor_len(int nbytes, unsigned int block_size)
 {
int this_len = nbytes;
@@ -1122,21 +1091,6 @@ struct n2_skcipher_tmpl {
 };
 
 static const struct n2_skcipher_tmpl skcipher_tmpls[] = {
-   /* ARC4: only ECB is supported (chaining bits ignored) */
-   {   .name   = "ecb(arc4)",
-   .drv_name   = "ecb-arc4",
-   .block_size = 1,
-   .enc_type   = (ENC_TYPE_ALG_RC4_STREAM |
-  ENC_TYPE_CHAINING_ECB),
-   .skcipher   = {
-   .min_keysize= 1,
-   .max_keysize= 256,
-   .setkey = n2_arc4_setkey,
-   .encrypt= n2_encrypt_ecb,
-   .decrypt= n2_decrypt_ecb,
-   },
-   },
-
/* DES: ECB CBC and CFB are supported */
{   .name   = "ecb(des)",
.drv_name   = "ecb-des",
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 2/7] staging/rtl8192u: switch to RC4 library interface

2020-08-31 Thread Ard Biesheuvel
Switch to the ARC4 library interface, to remove the pointless
dependency on the skcipher API, from which we will hopefully be
able to drop ecb(arc4) skcipher support.

Signed-off-by: Ard Biesheuvel 
Acked-by: Greg Kroah-Hartman 
---
 drivers/staging/rtl8192u/Kconfig  |  1 +
 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 81 

 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c  | 64 +++-
 3 files changed, 27 insertions(+), 119 deletions(-)

diff --git a/drivers/staging/rtl8192u/Kconfig b/drivers/staging/rtl8192u/Kconfig
index 1edca5c304fb..ef883d462d3d 100644
--- a/drivers/staging/rtl8192u/Kconfig
+++ b/drivers/staging/rtl8192u/Kconfig
@@ -8,3 +8,4 @@ config RTL8192U
select CRYPTO
select CRYPTO_AES
select CRYPTO_CCM
+   select CRYPTO_LIB_ARC4
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
index ffe624ed0c0c..4b415cc76715 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
@@ -5,6 +5,7 @@
  * Copyright (c) 2003-2004, Jouni Malinen 
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -17,9 +18,8 @@
 
 #include "ieee80211.h"
 
+#include 
 #include 
-#include 
-   #include 
 #include 
 
 MODULE_AUTHOR("Jouni Malinen");
@@ -49,9 +49,9 @@ struct ieee80211_tkip_data {
 
int key_idx;
 
-   struct crypto_sync_skcipher *rx_tfm_arc4;
+   struct arc4_ctx rx_ctx_arc4;
+   struct arc4_ctx tx_ctx_arc4;
struct crypto_shash *rx_tfm_michael;
-   struct crypto_sync_skcipher *tx_tfm_arc4;
struct crypto_shash *tx_tfm_michael;
 
/* scratch buffers for virt_to_page() (crypto API) */
@@ -62,19 +62,14 @@ static void *ieee80211_tkip_init(int key_idx)
 {
struct ieee80211_tkip_data *priv;
 
+   if (fips_enabled)
+   return NULL;
+
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
goto fail;
priv->key_idx = key_idx;
 
-   priv->tx_tfm_arc4 = crypto_alloc_sync_skcipher("ecb(arc4)", 0, 0);
-   if (IS_ERR(priv->tx_tfm_arc4)) {
-   printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
-   "crypto API arc4\n");
-   priv->tx_tfm_arc4 = NULL;
-   goto fail;
-   }
-
priv->tx_tfm_michael = crypto_alloc_shash("michael_mic", 0, 0);
if (IS_ERR(priv->tx_tfm_michael)) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
@@ -83,14 +78,6 @@ static void *ieee80211_tkip_init(int key_idx)
goto fail;
}
 
-   priv->rx_tfm_arc4 = crypto_alloc_sync_skcipher("ecb(arc4)", 0, 0);
-   if (IS_ERR(priv->rx_tfm_arc4)) {
-   printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
-   "crypto API arc4\n");
-   priv->rx_tfm_arc4 = NULL;
-   goto fail;
-   }
-
priv->rx_tfm_michael = crypto_alloc_shash("michael_mic", 0, 0);
if (IS_ERR(priv->rx_tfm_michael)) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
@@ -104,9 +91,7 @@ static void *ieee80211_tkip_init(int key_idx)
 fail:
if (priv) {
crypto_free_shash(priv->tx_tfm_michael);
-   crypto_free_sync_skcipher(priv->tx_tfm_arc4);
crypto_free_shash(priv->rx_tfm_michael);
-   crypto_free_sync_skcipher(priv->rx_tfm_arc4);
kfree(priv);
}
 
@@ -120,11 +105,9 @@ static void ieee80211_tkip_deinit(void *priv)
 
if (_priv) {
crypto_free_shash(_priv->tx_tfm_michael);
-   crypto_free_sync_skcipher(_priv->tx_tfm_arc4);
crypto_free_shash(_priv->rx_tfm_michael);
-   crypto_free_sync_skcipher(_priv->rx_tfm_arc4);
}
-   kfree(priv);
+   kzfree(priv);
 }
 
 
@@ -290,10 +273,8 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
u8 *pos;
struct rtl_80211_hdr_4addr *hdr;
struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + 
MAX_DEV_ADDR_SIZE);
-   int ret = 0;
u8 rc4key[16],  *icv;
u32 crc;
-   struct scatterlist sg;
 
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -334,21 +315,15 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, 
int hdr_len, void *priv)
*pos++ = (tkey->tx_iv32 >> 24) & 0xff;
 
if (!tcb_desc->bHwSec) {
-   SYNC_SKCIPHER_REQUEST_ON_STACK(req, tkey->tx_tfm_arc4);
-
icv = skb_put(skb, 4);
crc = ~crc32_le(~0, pos, len);
icv[0] = crc;
icv[1] = crc >> 8;
icv[2] = crc >> 16;
icv[3] = crc >> 24;
-   

[PATCH v3 0/7] crypto: mark ecb(arc4) skcipher as obsolete

2020-08-31 Thread Ard Biesheuvel
RC4 hasn't aged very well, and is a poor fit for the skcipher API so it
would be good if we could get rid of the ecb(arc4) drivers in the kernel
at some point in the future. This prevents new users from creeping in, and
allows us to improve the skcipher API without having to care too much about
obsolete algorithms that may be difficult to support going forward.

So let's get rid of any remaining in-kernel users, either by switching them
to the arc4 library API (for cases which simply cannot change algorithms,
e.g., WEP), or dropping the code entirely. Also remove the remaining h/w
accelerated implementations, and mark the generic s/w implementation as
obsolete in Kconfig.

Changes since v2:
- depend on CRYPTO_USER_API not CRYPTO_USER
- rename CRYPTO_USER_ENABLE_OBSOLETE to CRYPTO_USER_API_ENABLE_OBSOLETE for
  clarity

Changes since RFC [0]:
- keep ecb(arc4) generic C implementation, and the associated test vectors,
  but print a warning about ecb(arc4) being obsolete so we can identify
  remaining users
- add a Kconfig option to en/disable obsolete algorithms that are only kept
  around to prevent breaking users that rely on it via the socket interface
- add a patch to clean up some bogus Kconfig dependencies
- add acks to patches #1, #2 and #3

[0] 
https://lore.kernel.org/driverdev-devel/20200702101947.682-1-a...@kernel.org/

Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: Greg Kroah-Hartman 
Cc: Trond Myklebust 
Cc: Anna Schumaker 
Cc: "J. Bruce Fields" 
Cc: Chuck Lever 
Cc: Eric Biggers 
Cc: Arnd Bergmann 
Cc: linux-cry...@vger.kernel.org
Cc: net...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Cc: linux-...@vger.kernel.org

Ard Biesheuvel (7):
  staging/rtl8192e: switch to RC4 library interface
  staging/rtl8192u: switch to RC4 library interface
  SUNRPC: remove RC4-HMAC-MD5 support from KerberosV
  crypto: n2 - remove ecb(arc4) support
  crypto: bcm-iproc - remove ecb(arc4) support
  net: wireless: drop bogus CRYPTO_xxx Kconfig selects
  crypto: arc4 - mark ecb(arc4) skcipher as obsolete

 crypto/Kconfig|  10 +
 crypto/arc4.c |  10 +
 drivers/crypto/bcm/cipher.c   |  96 +-
 drivers/crypto/bcm/cipher.h   |   1 -
 drivers/crypto/bcm/spu.c  |  23 +-
 drivers/crypto/bcm/spu.h  |   1 -
 drivers/crypto/bcm/spu2.c |  12 +-
 drivers/crypto/bcm/spu2.h |   1 -
 drivers/crypto/n2_core.c  |  46 ---
 drivers/net/wireless/intel/ipw2x00/Kconfig|   4 -
 drivers/net/wireless/intersil/hostap/Kconfig  |   4 -
 drivers/staging/rtl8192e/Kconfig  |   4 +-
 drivers/staging/rtl8192e/rtllib_crypt_tkip.c  |  70 +
 drivers/staging/rtl8192e/rtllib_crypt_wep.c   |  72 +
 drivers/staging/rtl8192u/Kconfig  |   1 +
 .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c |  81 +
 .../rtl8192u/ieee80211/ieee80211_crypt_wep.c  |  64 +---
 include/linux/sunrpc/gss_krb5.h   |  11 -
 include/linux/sunrpc/gss_krb5_enctypes.h  |   9 +-
 net/sunrpc/Kconfig|   1 -
 net/sunrpc/auth_gss/gss_krb5_crypto.c | 276 --
 net/sunrpc/auth_gss/gss_krb5_mech.c   |  95 --
 net/sunrpc/auth_gss/gss_krb5_seal.c   |   1 -
 net/sunrpc/auth_gss/gss_krb5_seqnum.c |  87 --
 net/sunrpc/auth_gss/gss_krb5_unseal.c |   1 -
 net/sunrpc/auth_gss/gss_krb5_wrap.c   |  65 +
 26 files changed, 97 insertions(+), 949 deletions(-)

-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 3/7] SUNRPC: remove RC4-HMAC-MD5 support from KerberosV

2020-08-31 Thread Ard Biesheuvel
The RC4-HMAC-MD5 KerberosV algorithm is based on RFC 4757 [0], which
was specifically issued for interoperability with Windows 2000, but was
never intended to receive the same level of support. The RFC says

  The IETF Kerberos community supports publishing this specification as
  an informational document in order to describe this widely
  implemented technology.  However, while these encryption types
  provide the operations necessary to implement the base Kerberos
  specification [RFC4120], they do not provide all the required
  operations in the Kerberos cryptography framework [RFC3961].  As a
  result, it is not generally possible to implement potential
  extensions to Kerberos using these encryption types.  The Kerberos
  encryption type negotiation mechanism [RFC4537] provides one approach
  for using such extensions even when a Kerberos infrastructure uses
  long-term RC4 keys.  Because this specification does not implement
  operations required by RFC 3961 and because of security concerns with
  the use of RC4 and MD4 discussed in Section 8, this specification is
  not appropriate for publication on the standards track.

  The RC4-HMAC encryption types are used to ease upgrade of existing
  Windows NT environments, provide strong cryptography (128-bit key
  lengths), and provide exportable (meet United States government
  export restriction requirements) encryption.  This document describes
  the implementation of those encryption types.

Furthermore, this RFC was re-classified as 'historic' by RFC 8429 [1] in
2018, stating that 'none of the encryption types it specifies should be
used'

Note that other outdated algorithms are left in place (some of which are
guarded by CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES), so this should only
adversely affect interoperability with Windows NT/2000 systems that have
not received any updates since 2008 (but are connected to a network
nonetheless)

[0] https://tools.ietf.org/html/rfc4757
[1] https://tools.ietf.org/html/rfc8429

Signed-off-by: Ard Biesheuvel 
Acked-by: J. Bruce Fields 
---
 include/linux/sunrpc/gss_krb5.h  |  11 -
 include/linux/sunrpc/gss_krb5_enctypes.h |   9 +-
 net/sunrpc/Kconfig   |   1 -
 net/sunrpc/auth_gss/gss_krb5_crypto.c| 276 
 net/sunrpc/auth_gss/gss_krb5_mech.c  |  95 ---
 net/sunrpc/auth_gss/gss_krb5_seal.c  |   1 -
 net/sunrpc/auth_gss/gss_krb5_seqnum.c|  87 --
 net/sunrpc/auth_gss/gss_krb5_unseal.c|   1 -
 net/sunrpc/auth_gss/gss_krb5_wrap.c  |  65 +
 9 files changed, 16 insertions(+), 530 deletions(-)

diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index e8f8ffe7448b..91f43d86879d 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -141,14 +141,12 @@ enum sgn_alg {
SGN_ALG_MD2_5 = 0x0001,
SGN_ALG_DES_MAC = 0x0002,
SGN_ALG_3 = 0x0003, /* not published */
-   SGN_ALG_HMAC_MD5 = 0x0011,  /* microsoft w2k; no support */
SGN_ALG_HMAC_SHA1_DES3_KD = 0x0004
 };
 enum seal_alg {
SEAL_ALG_NONE = 0x,
SEAL_ALG_DES = 0x,
SEAL_ALG_1 = 0x0001,/* not published */
-   SEAL_ALG_MICROSOFT_RC4 = 0x0010,/* microsoft w2k; no support */
SEAL_ALG_DES3KD = 0x0002
 };
 
@@ -316,14 +314,5 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, 
u32 len,
 struct xdr_buf *buf, u32 *plainoffset,
 u32 *plainlen);
 
-int
-krb5_rc4_setup_seq_key(struct krb5_ctx *kctx,
-  struct crypto_sync_skcipher *cipher,
-  unsigned char *cksum);
-
-int
-krb5_rc4_setup_enc_key(struct krb5_ctx *kctx,
-  struct crypto_sync_skcipher *cipher,
-  s32 seqnum);
 void
 gss_krb5_make_confounder(char *p, u32 conflen);
diff --git a/include/linux/sunrpc/gss_krb5_enctypes.h 
b/include/linux/sunrpc/gss_krb5_enctypes.h
index 981c89cef19d..87eea679d750 100644
--- a/include/linux/sunrpc/gss_krb5_enctypes.h
+++ b/include/linux/sunrpc/gss_krb5_enctypes.h
@@ -13,15 +13,13 @@
 #ifdef CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES
 
 /*
- * NB: This list includes encryption types that were deprecated
- * by RFC 8429 (DES3_CBC_SHA1 and ARCFOUR_HMAC).
+ * NB: This list includes DES3_CBC_SHA1, which was deprecated by RFC 8429.
  *
  * ENCTYPE_AES256_CTS_HMAC_SHA1_96
  * ENCTYPE_AES128_CTS_HMAC_SHA1_96
  * ENCTYPE_DES3_CBC_SHA1
- * ENCTYPE_ARCFOUR_HMAC
  */
-#define KRB5_SUPPORTED_ENCTYPES "18,17,16,23"
+#define KRB5_SUPPORTED_ENCTYPES "18,17,16"
 
 #else  /* CONFIG_SUNRPC_DISABLE_INSECURE_ENCTYPES */
 
@@ -32,12 +30,11 @@
  * ENCTYPE_AES256_CTS_HMAC_SHA1_96
  * ENCTYPE_AES128_CTS_HMAC_SHA1_96
  * ENCTYPE_DES3_CBC_SHA1
- * ENCTYPE_ARCFOUR_HMAC
  * ENCTYPE_DES_CBC_MD5
  * ENCTYPE_DES_CBC_CRC
  * ENCTYPE_DES_CBC_MD4
  */
-#define KRB5_SUPPORTED_ENCTYPES "18,17,16,23,3,1,2"
+#define KRB5_SUPPORTED_ENCTYPES "18,17,16,3,1,2"
 
 #endif /* 

Re: [PATCH] staging: atomisp: Fix fallthrough keyword warning

2020-08-31 Thread Mauro Carvalho Chehab
Em Mon, 31 Aug 2020 16:30:12 +0300
Cengiz Can  escreveu:

> commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
> Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
> with 'fallthrough' pseudo-keyword.
> 
> However, in one of the switch-case statements, Coverity Static Analyzer
> throws a warning that 'fallthrough' is unreachable due to the adjacent
> 'return false' statement.
> 
> Since 'fallthrough' is actually an empty "do {} while(0)" this might be
> due to compiler optimizations. But that needs further investigation.
> 
> In order to fix the unreachable code warning, make adjacent 'return
> false' a part of the previous if statement's else clause.
> 
> Reported-by: Coverity Static Analyzer CID 1466511
> Signed-off-by: Cengiz Can 
> ---
>  drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c 
> b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> index 1b2b2c68025b..aaa2d0e0851b 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> @@ -709,8 +709,8 @@ static bool is_pipe_valid_to_current_run_mode(struct 
> atomisp_sub_device *asd,
>   if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
>   pipe_id == IA_CSS_PIPE_ID_PREVIEW)
>   return true;
> -
> - return false;
> + else
> + return false;
>   fallthrough;

Actually, the actual fix here would be to get rid of fallthrough.

Regards,

Thanks,
Mauro
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: atomisp: Remove unnecessary 'fallthrough'

2020-08-31 Thread Gustavo A. R. Silva
On Mon, Aug 31, 2020 at 04:51:04PM +0300, Cengiz Can wrote:
> commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
> Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
> with 'fallthrough' pseudo-keyword.
> 
> However, in one of the switch-case statements, Coverity Static Analyzer
> throws a warning that 'fallthrough' is unreachable due to the adjacent
> 'return false' statement. (Coverity ID CID 1466511)
> 
> In order to fix the unreachable code warning, remove unnecessary
> fallthrough keyword.
> 
> Signed-off-by: Cengiz Can 

Reviewed-by: Gustavo A. R. Silva 

Thanks
--
Gustavo

> ---
>  drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c 
> b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> index 1b2b2c68025b..feb26c221e96 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> @@ -711,7 +711,6 @@ static bool is_pipe_valid_to_current_run_mode(struct 
> atomisp_sub_device *asd,
>   return true;
>  
>   return false;
> - fallthrough;
>   case ATOMISP_RUN_MODE_VIDEO:
>   if (!asd->continuous_mode->val) {
>   if (pipe_id == IA_CSS_PIPE_ID_VIDEO ||
> -- 
> 2.28.0
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: atomisp: Remove unnecessary 'fallthrough'

2020-08-31 Thread Cengiz Can
commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
with 'fallthrough' pseudo-keyword.

However, in one of the switch-case statements, Coverity Static Analyzer
throws a warning that 'fallthrough' is unreachable due to the adjacent
'return false' statement. (Coverity ID CID 1466511)

In order to fix the unreachable code warning, remove unnecessary
fallthrough keyword.

Signed-off-by: Cengiz Can 
---
 drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c 
b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index 1b2b2c68025b..feb26c221e96 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -711,7 +711,6 @@ static bool is_pipe_valid_to_current_run_mode(struct 
atomisp_sub_device *asd,
return true;
 
return false;
-   fallthrough;
case ATOMISP_RUN_MODE_VIDEO:
if (!asd->continuous_mode->val) {
if (pipe_id == IA_CSS_PIPE_ID_VIDEO ||
-- 
2.28.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: atomisp: Fix fallthrough keyword warning

2020-08-31 Thread Dan Carpenter
Really I think this function is pretty buggy.  It shouldn't be falling
through at all...  I reported it a couple days back so it's possible
that someone is working on a fix already.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: atomisp: Fix fallthrough keyword warning

2020-08-31 Thread Dan Carpenter
On Mon, Aug 31, 2020 at 04:30:12PM +0300, Cengiz Can wrote:
> commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
> Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
> with 'fallthrough' pseudo-keyword.
> 
> However, in one of the switch-case statements, Coverity Static Analyzer
> throws a warning that 'fallthrough' is unreachable due to the adjacent
> 'return false' statement.
> 
> Since 'fallthrough' is actually an empty "do {} while(0)" this might be
> due to compiler optimizations. But that needs further investigation.
> 
> In order to fix the unreachable code warning, make adjacent 'return
> false' a part of the previous if statement's else clause.
> 
> Reported-by: Coverity Static Analyzer CID 1466511
> Signed-off-by: Cengiz Can 
> ---
>  drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c 
> b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> index 1b2b2c68025b..aaa2d0e0851b 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> @@ -709,8 +709,8 @@ static bool is_pipe_valid_to_current_run_mode(struct 
> atomisp_sub_device *asd,
>   if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
>   pipe_id == IA_CSS_PIPE_ID_PREVIEW)
>   return true;
> -
> - return false;
> + else
> + return false;
>   fallthrough;

Heh...  Still unreachable, but now it has a checkpatch.pl warning as
well.  Just get rid of the bogus fallthrough annotation.

>   case ATOMISP_RUN_MODE_VIDEO:
>   if (!asd->continuous_mode->val) {

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: atomisp: Fix fallthrough keyword warning

2020-08-31 Thread Cengiz Can
commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
with 'fallthrough' pseudo-keyword.

However, in one of the switch-case statements, Coverity Static Analyzer
throws a warning that 'fallthrough' is unreachable due to the adjacent
'return false' statement.

Since 'fallthrough' is actually an empty "do {} while(0)" this might be
due to compiler optimizations. But that needs further investigation.

In order to fix the unreachable code warning, make adjacent 'return
false' a part of the previous if statement's else clause.

Reported-by: Coverity Static Analyzer CID 1466511
Signed-off-by: Cengiz Can 
---
 drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c 
b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index 1b2b2c68025b..aaa2d0e0851b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -709,8 +709,8 @@ static bool is_pipe_valid_to_current_run_mode(struct 
atomisp_sub_device *asd,
if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
pipe_id == IA_CSS_PIPE_ID_PREVIEW)
return true;
-
-   return false;
+   else
+   return false;
fallthrough;
case ATOMISP_RUN_MODE_VIDEO:
if (!asd->continuous_mode->val) {
-- 
2.28.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: rtl8723bs: os_dep: fixed some coding style issues

2020-08-31 Thread Greg KH
On Fri, Aug 28, 2020 at 08:14:05PM -0500, Ross Schmidt wrote:
> Fixed some coding style issues.

What issues?  Always be specific please.

Please fix up and resend.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel