Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/opencrypto opencrypto: Make freesession callback return ...



details:   https://anonhg.NetBSD.org/src/rev/3638d72eebee
branches:  trunk
changeset: 366335:3638d72eebee
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun May 22 11:39:26 2022 +0000

description:
opencrypto: Make freesession callback return void.

No functional change intended: all drivers already return zero
unconditionally.

diffstat:

 share/man/man9/opencrypto.9       |   8 +++++---
 sys/arch/arm/sunxi/sun8i_crypto.c |  11 ++++-------
 sys/arch/i386/pci/glxsb.c         |   9 ++++-----
 sys/arch/x86/x86/via_padlock.c    |   9 ++++-----
 sys/dev/marvell/mvcesa.c          |   9 ++++-----
 sys/dev/marvell/mvxpsecvar.h      |   4 ++--
 sys/dev/pci/hifn7751.c            |   9 ++++-----
 sys/dev/pci/qat/qat.c             |  21 ++++++++-------------
 sys/dev/pci/ubsec.c               |   9 ++++-----
 sys/opencrypto/crypto.c           |  10 ++++------
 sys/opencrypto/cryptodev.h        |   6 +++---
 sys/opencrypto/cryptosoft.c       |  10 ++++------
 12 files changed, 50 insertions(+), 65 deletions(-)

diffs (truncated from 501 to 300 lines):

diff -r 70f7cdd90be4 -r 3638d72eebee share/man/man9/opencrypto.9
--- a/share/man/man9/opencrypto.9       Sun May 22 11:39:17 2022 +0000
+++ b/share/man/man9/opencrypto.9       Sun May 22 11:39:26 2022 +0000
@@ -1,5 +1,5 @@
 .\"    $OpenBSD: crypto.9,v 1.25 2003/07/11 13:47:41 jmc Exp $
-.\"    $NetBSD: opencrypto.9,v 1.18 2022/05/22 11:34:17 riastradh Exp $
+.\"    $NetBSD: opencrypto.9,v 1.19 2022/05/22 11:39:26 riastradh Exp $
 .\"
 .\" The author of this man page is Angelos D. Keromytis (angelos%cis.upenn.edu@localhost)
 .\"
@@ -579,7 +579,7 @@
 The calling convention for the three driver-supplied routines is:
 .Bd -literal
 int (*newsession) (void *, u_int32_t *, struct cryptoini *);
-int (*freesession) (void *, u_int64_t);
+void (*freesession) (void *, u_int64_t);
 int (*process) (void *, struct cryptop *, int);
 .Ed
 .Pp
@@ -595,7 +595,9 @@
 The
 .Fn freesession
 routine takes as argument the SID (which is the concatenation of the
-driver identifier and the driver-specific session identifier).
+driver identifier and the driver-specific session identifier returned
+by
+.Fn newsession ).
 It should clear any context associated with the session (clear hardware
 registers, memory, etc.).
 .Pp
diff -r 70f7cdd90be4 -r 3638d72eebee sys/arch/arm/sunxi/sun8i_crypto.c
--- a/sys/arch/arm/sunxi/sun8i_crypto.c Sun May 22 11:39:17 2022 +0000
+++ b/sys/arch/arm/sunxi/sun8i_crypto.c Sun May 22 11:39:26 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sun8i_crypto.c,v 1.31 2022/05/15 16:58:28 riastradh Exp $      */
+/*     $NetBSD: sun8i_crypto.c,v 1.32 2022/05/22 11:39:26 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.31 2022/05/15 16:58:28 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.32 2022/05/22 11:39:26 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -249,7 +249,7 @@
 static void    sun8i_crypto_register1(struct sun8i_crypto_softc *, uint32_t);
 static int     sun8i_crypto_newsession(void *, uint32_t *,
                    struct cryptoini *);
-static int     sun8i_crypto_freesession(void *, uint64_t);
+static void    sun8i_crypto_freesession(void *, uint64_t);
 static u_int   sun8i_crypto_ivlen(const struct cryptodesc *);
 static int     sun8i_crypto_process(void *, struct cryptop *, int);
 static void    sun8i_crypto_callback(struct sun8i_crypto_softc *,
@@ -2050,14 +2050,11 @@
  *     Note: dsid is actually a 64-bit quantity containing both the
  *     driver id in the high half and the session id in the low half.
  */
-static int
+static void
 sun8i_crypto_freesession(void *cookie, uint64_t dsid)
 {
 
        KASSERT((dsid & 0xffffffff) == 1);
-
-       /* Success! */
-       return 0;
 }
 
 /*
diff -r 70f7cdd90be4 -r 3638d72eebee sys/arch/i386/pci/glxsb.c
--- a/sys/arch/i386/pci/glxsb.c Sun May 22 11:39:17 2022 +0000
+++ b/sys/arch/i386/pci/glxsb.c Sun May 22 11:39:26 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: glxsb.c,v 1.18 2022/05/22 11:38:12 riastradh Exp $     */
+/*     $NetBSD: glxsb.c,v 1.19 2022/05/22 11:39:26 riastradh Exp $     */
 /* $OpenBSD: glxsb.c,v 1.7 2007/02/12 14:31:45 tom Exp $ */
 
 /*
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.18 2022/05/22 11:38:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: glxsb.c,v 1.19 2022/05/22 11:39:26 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -180,7 +180,7 @@
 int glxsb_crypto_setup(struct glxsb_softc *);
 int glxsb_crypto_newsession(void *, uint32_t *, struct cryptoini *);
 int glxsb_crypto_process(void *, struct cryptop *, int);
-int glxsb_crypto_freesession(void *, uint64_t);
+void glxsb_crypto_freesession(void *, uint64_t);
 static __inline void glxsb_aes(struct glxsb_softc *, uint32_t, uint32_t,
     uint32_t, void *, int, void *);
 
@@ -352,7 +352,7 @@
        return (0);
 }
 
-int
+void
 glxsb_crypto_freesession(void *aux, uint64_t tid)
 {
        struct glxsb_softc *sc = aux;
@@ -364,7 +364,6 @@
            sesn, sc->sc_nsessions);
 
        memset(&sc->sc_sessions[sesn], 0, sizeof(sc->sc_sessions[sesn]));
-       return (0);
 }
 
 /*
diff -r 70f7cdd90be4 -r 3638d72eebee sys/arch/x86/x86/via_padlock.c
--- a/sys/arch/x86/x86/via_padlock.c    Sun May 22 11:39:17 2022 +0000
+++ b/sys/arch/x86/x86/via_padlock.c    Sun May 22 11:39:26 2022 +0000
@@ -1,5 +1,5 @@
 /*     $OpenBSD: via.c,v 1.8 2006/11/17 07:47:56 tom Exp $     */
-/*     $NetBSD: via_padlock.c,v 1.34 2022/05/22 11:38:19 riastradh Exp $ */
+/*     $NetBSD: via_padlock.c,v 1.35 2022/05/22 11:39:27 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2003 Jason Wright
@@ -20,7 +20,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.34 2022/05/22 11:38:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.35 2022/05/22 11:39:27 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -67,7 +67,7 @@
            struct swcr_data *, void *);
 int    via_padlock_crypto_encdec(struct cryptop *, struct cryptodesc *,
            struct via_padlock_session *, struct via_padlock_softc *, void *);
-int    via_padlock_crypto_freesession(void *, uint64_t);
+void   via_padlock_crypto_freesession(void *, uint64_t);
 static __inline void via_padlock_cbc(void *, void *, void *, void *, int,
            void *);
 
@@ -298,7 +298,7 @@
        return (0);
 }
 
-int
+void
 via_padlock_crypto_freesession(void *arg, uint64_t tid)
 {
        struct via_padlock_softc *sc = arg;
@@ -328,7 +328,6 @@
        }
 
        memset(&sc->sc_sessions[sesn], 0, sizeof(sc->sc_sessions[sesn]));
-       return (0);
 }
 
 static __inline void
diff -r 70f7cdd90be4 -r 3638d72eebee sys/dev/marvell/mvcesa.c
--- a/sys/dev/marvell/mvcesa.c  Sun May 22 11:39:17 2022 +0000
+++ b/sys/dev/marvell/mvcesa.c  Sun May 22 11:39:26 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mvcesa.c,v 1.5 2022/05/22 11:38:26 riastradh Exp $     */
+/*     $NetBSD: mvcesa.c,v 1.6 2022/05/22 11:39:27 riastradh Exp $     */
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.5 2022/05/22 11:38:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.6 2022/05/22 11:39:27 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -80,7 +80,7 @@
 static int mvcesa_intr(void *);
 
 static int mvcesa_newsession(void *, u_int32_t *, struct cryptoini *);
-static int mvcesa_freesession(void *, u_int64_t);
+static void mvcesa_freesession(void *, u_int64_t);
 static int mvcesa_process(void *, struct cryptop *, int);
 
 static int mvcesa_authentication(struct mvcesa_softc *, struct mvcesa_session *,
@@ -325,7 +325,7 @@
 /*
  * Deallocate a session.
  */
-static int
+static void
 mvcesa_freesession(void *arg, u_int64_t tid)
 {
        struct mvcesa_softc *sc = (struct mvcesa_softc *)arg;
@@ -338,7 +338,6 @@
            session, sc->sc_nsessions);
 
        memset(&sc->sc_sessions[session], 0, sizeof(sc->sc_sessions[session]));
-       return (0);
 }
 
 static int
diff -r 70f7cdd90be4 -r 3638d72eebee sys/dev/marvell/mvxpsecvar.h
--- a/sys/dev/marvell/mvxpsecvar.h      Sun May 22 11:39:17 2022 +0000
+++ b/sys/dev/marvell/mvxpsecvar.h      Sun May 22 11:39:26 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mvxpsecvar.h,v 1.2 2019/12/27 09:41:51 msaitoh Exp $   */
+/*     $NetBSD: mvxpsecvar.h,v 1.3 2022/05/22 11:39:27 riastradh Exp $ */
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -475,7 +475,7 @@
  */
 extern int mvxpsec_register(struct mvxpsec_softc *);
 extern int mvxpsec_newsession(void *, uint32_t *, struct cryptoini *);
-extern int mvxpsec_freesession(void *, uint64_t);
+extern void mvxpsec_freesession(void *, uint64_t);
 extern int mvxpsec_dispatch(void *, struct cryptop *, int);
 extern void mvxpsec_done(void *);
 
diff -r 70f7cdd90be4 -r 3638d72eebee sys/dev/pci/hifn7751.c
--- a/sys/dev/pci/hifn7751.c    Sun May 22 11:39:17 2022 +0000
+++ b/sys/dev/pci/hifn7751.c    Sun May 22 11:39:26 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hifn7751.c,v 1.79 2022/05/22 11:38:34 riastradh Exp $  */
+/*     $NetBSD: hifn7751.c,v 1.80 2022/05/22 11:39:27 riastradh Exp $  */
 /*     $OpenBSD: hifn7751.c,v 1.179 2020/01/11 21:34:03 cheloha Exp $  */
 
 /*
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.79 2022/05/22 11:38:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.80 2022/05/22 11:39:27 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/cprng.h>
@@ -105,7 +105,7 @@
 static u_int   hifn_write_command(struct hifn_command *, uint8_t *);
 static uint32_t hifn_next_signature(uint32_t a, u_int cnt);
 static int     hifn_newsession(void*, uint32_t *, struct cryptoini *);
-static int     hifn_freesession(void*, uint64_t);
+static void    hifn_freesession(void*, uint64_t);
 static int     hifn_process(void*, struct cryptop *, int);
 static void    hifn_callback(struct hifn_softc *, struct hifn_command *,
                              uint8_t *);
@@ -2143,7 +2143,7 @@
  * XXX this routine should run a zero'd mac/encrypt key into context ram.
  * XXX to blow away any keys already stored there.
  */
-static int
+static void
 hifn_freesession(void *arg, uint64_t tid)
 {
        struct hifn_softc *sc = arg;
@@ -2158,7 +2158,6 @@
        KASSERT(isset(sc->sc_sessions, session));
        clrbit(sc->sc_sessions, session);
        mutex_spin_exit(&sc->sc_mtx);
-       return (0);
 }
 
 static int
diff -r 70f7cdd90be4 -r 3638d72eebee sys/dev/pci/qat/qat.c
--- a/sys/dev/pci/qat/qat.c     Sun May 22 11:39:17 2022 +0000
+++ b/sys/dev/pci/qat/qat.c     Sun May 22 11:39:26 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: qat.c,v 1.7 2021/11/06 06:52:48 msaitoh Exp $  */
+/*     $NetBSD: qat.c,v 1.8 2022/05/22 11:39:27 riastradh Exp $        */
 
 /*
  * Copyright (c) 2019 Internet Initiative Japan, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: qat.c,v 1.7 2021/11/06 06:52:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qat.c,v 1.8 2022/05/22 11:39:27 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -346,11 +346,11 @@
 int            qat_crypto_setup_ring(struct qat_softc *,
                    struct qat_crypto_bank *);
 int            qat_crypto_new_session(void *, uint32_t *, struct cryptoini *);
-int            qat_crypto_free_session0(struct qat_crypto *,
+void           qat_crypto_free_session0(struct qat_crypto *,
                    struct qat_session *);
 void           qat_crypto_check_free_session(struct qat_crypto *,
                    struct qat_session *);
-int            qat_crypto_free_session(void *, uint64_t);
+void           qat_crypto_free_session(void *, uint64_t);
 int            qat_crypto_bank_init(struct qat_softc *,
                    struct qat_crypto_bank *);
 int            qat_crypto_init(struct qat_softc *);



Home | Main Index | Thread Index | Old Index