diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2002-09-24 18:33:27 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2002-09-24 18:33:27 +0000 |
commit | 59c0d446267e5ac5962411ba74fe8dc57703e0cf (patch) | |
tree | 4af2e32929808a2bbee2f8520a6c78f750af81c1 | |
parent | 44eccc305057561641268f38e186635eaffa766c (diff) |
Don't use constants for the output parameter, use the iparam count as a pointer to the first result location.
-rw-r--r-- | sys/dev/pci/lofn.c | 10 | ||||
-rw-r--r-- | sys/dev/pci/lofnvar.h | 3 | ||||
-rw-r--r-- | sys/dev/pci/nofn.c | 10 | ||||
-rw-r--r-- | sys/dev/pci/nofnvar.h | 3 | ||||
-rw-r--r-- | sys/dev/pci/ubsec.c | 18 | ||||
-rw-r--r-- | sys/dev/pci/ubsecvar.h | 3 |
6 files changed, 22 insertions, 25 deletions
diff --git a/sys/dev/pci/lofn.c b/sys/dev/pci/lofn.c index bdcdf765409..f9df2a53e55 100644 --- a/sys/dev/pci/lofn.c +++ b/sys/dev/pci/lofn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lofn.c,v 1.20 2002/09/18 04:32:59 jason Exp $ */ +/* $OpenBSD: lofn.c,v 1.21 2002/09/24 18:33:26 jason Exp $ */ /* * Copyright (c) 2001-2002 Jason L. Wright (jason@thought.net) @@ -484,15 +484,15 @@ lofn_modexp_finish(sc, q) reglen = ((READ_REG(sc, LOFN_LENADDR(LOFN_WIN_2, 3)) & LOFN_LENMASK) + 7) / 8; - crplen = (krp->krp_param[LOFN_MODEXP_PAR_C].crp_nbits + 7) / 8; + crplen = (krp->krp_param[krp->krp_iparams].crp_nbits + 7) / 8; if (crplen <= reglen) - bcopy(sc->sc_tmp.b, krp->krp_param[LOFN_MODEXP_PAR_C].crp_p, + bcopy(sc->sc_tmp.b, krp->krp_param[krp->krp_iparams].crp_p, reglen); else { - bcopy(sc->sc_tmp.b, krp->krp_param[LOFN_MODEXP_PAR_C].crp_p, + bcopy(sc->sc_tmp.b, krp->krp_param[krp->krp_iparams].crp_p, reglen); - bzero(krp->krp_param[LOFN_MODEXP_PAR_C].crp_p + reglen, + bzero(krp->krp_param[krp->krp_iparams].crp_p + reglen, crplen - reglen); } bzero(&sc->sc_tmp, sizeof(sc->sc_tmp)); diff --git a/sys/dev/pci/lofnvar.h b/sys/dev/pci/lofnvar.h index 25d0df00ed7..b1f054fdb35 100644 --- a/sys/dev/pci/lofnvar.h +++ b/sys/dev/pci/lofnvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lofnvar.h,v 1.7 2002/05/09 19:13:09 jason Exp $ */ +/* $OpenBSD: lofnvar.h,v 1.8 2002/09/24 18:33:26 jason Exp $ */ /* * Copyright (c) 2001-2002 Jason L. Wright (jason@thought.net) @@ -81,4 +81,3 @@ struct lofn_q { #define LOFN_MODEXP_PAR_M 0 #define LOFN_MODEXP_PAR_E 1 #define LOFN_MODEXP_PAR_N 2 -#define LOFN_MODEXP_PAR_C 3 diff --git a/sys/dev/pci/nofn.c b/sys/dev/pci/nofn.c index 4a5a12e5b5a..997d6c144c1 100644 --- a/sys/dev/pci/nofn.c +++ b/sys/dev/pci/nofn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nofn.c,v 1.5 2002/09/18 04:32:59 jason Exp $ */ +/* $OpenBSD: nofn.c,v 1.6 2002/09/24 18:33:26 jason Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -677,15 +677,15 @@ nofn_modexp_finish(sc, q) reglen = ((PK_READ_4(sc, NOFN_PK_LENADDR(3)) & NOFN_PK_LENMASK) + 7) / 8; - crplen = (krp->krp_param[NOFN_MODEXP_PAR_C].crp_nbits + 7) / 8; + crplen = (krp->krp_param[krp->krp_iparams].crp_nbits + 7) / 8; if (crplen <= reglen) - bcopy(sc->sc_pk_tmp.b, krp->krp_param[NOFN_MODEXP_PAR_C].crp_p, + bcopy(sc->sc_pk_tmp.b, krp->krp_param[krp->krp_iparams].crp_p, reglen); else { - bcopy(sc->sc_pk_tmp.b, krp->krp_param[NOFN_MODEXP_PAR_C].crp_p, + bcopy(sc->sc_pk_tmp.b, krp->krp_param[krp->krp_iparams].crp_p, reglen); - bzero(krp->krp_param[NOFN_MODEXP_PAR_C].crp_p + reglen, + bzero(krp->krp_param[krp->krp_iparams].crp_p + reglen, crplen - reglen); } bzero(&sc->sc_pk_tmp, sizeof(sc->sc_pk_tmp)); diff --git a/sys/dev/pci/nofnvar.h b/sys/dev/pci/nofnvar.h index 71da51e9db4..64824976f2e 100644 --- a/sys/dev/pci/nofnvar.h +++ b/sys/dev/pci/nofnvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nofnvar.h,v 1.4 2002/05/16 22:52:17 jason Exp $ */ +/* $OpenBSD: nofnvar.h,v 1.5 2002/09/24 18:33:26 jason Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -82,4 +82,3 @@ struct nofn_pk_q { #define NOFN_MODEXP_PAR_M 0 #define NOFN_MODEXP_PAR_E 1 #define NOFN_MODEXP_PAR_N 2 -#define NOFN_MODEXP_PAR_C 3 diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index 7f143ddde82..2de8883e1f1 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.114 2002/09/19 17:58:38 jason Exp $ */ +/* $OpenBSD: ubsec.c,v 1.115 2002/09/24 18:33:26 jason Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -1406,7 +1406,7 @@ ubsec_callback2(sc, q) krp = me->me_krp; rlen = (me->me_modbits + 7) / 8; - clen = (krp->krp_param[UBS_MODEXP_PAR_C].crp_nbits + 7) / 8; + clen = (krp->krp_param[krp->krp_iparams].crp_nbits + 7) / 8; bus_dmamap_sync(sc->sc_dmat, me->me_M.dma_map, 0, me->me_M.dma_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); @@ -1421,17 +1421,17 @@ ubsec_callback2(sc, q) krp->krp_status = E2BIG; else { if (sc->sc_flags & UBS_FLAGS_HWNORM) { - bzero(krp->krp_param[UBS_MODEXP_PAR_C].crp_p, - (krp->krp_param[UBS_MODEXP_PAR_C].crp_nbits + bzero(krp->krp_param[krp->krp_iparams].crp_p, + (krp->krp_param[krp->krp_iparams].crp_nbits + 7) / 8); bcopy(me->me_C.dma_vaddr, - krp->krp_param[UBS_MODEXP_PAR_C].crp_p, + krp->krp_param[krp->krp_iparams].crp_p, (me->me_modbits + 7) / 8); } else ubsec_kshift_l(me->me_shiftbits, me->me_C.dma_vaddr, me->me_normbits, - krp->krp_param[UBS_MODEXP_PAR_C].crp_p, - krp->krp_param[UBS_MODEXP_PAR_C].crp_nbits); + krp->krp_param[krp->krp_iparams].crp_p, + krp->krp_param[krp->krp_iparams].crp_nbits); } crypto_kdone(krp); @@ -1882,7 +1882,7 @@ ubsec_kprocess_modexp_sw(sc, krp) me->me_normbits = normbits; /* Sanity check: result bits must be >= true modulus bits. */ - if (krp->krp_param[UBS_MODEXP_PAR_C].crp_nbits < nbits) { + if (krp->krp_param[krp->krp_iparams].crp_nbits < nbits) { err = ERANGE; goto errout; } @@ -2084,7 +2084,7 @@ ubsec_kprocess_modexp_hw(sc, krp) me->me_normbits = normbits; /* Sanity check: result bits must be >= true modulus bits. */ - if (krp->krp_param[UBS_MODEXP_PAR_C].crp_nbits < nbits) { + if (krp->krp_param[krp->krp_iparams].crp_nbits < nbits) { err = ERANGE; goto errout; } diff --git a/sys/dev/pci/ubsecvar.h b/sys/dev/pci/ubsecvar.h index bd2a46cd952..dfcbef97708 100644 --- a/sys/dev/pci/ubsecvar.h +++ b/sys/dev/pci/ubsecvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsecvar.h,v 1.34 2002/07/03 00:24:29 jason Exp $ */ +/* $OpenBSD: ubsecvar.h,v 1.35 2002/09/24 18:33:26 jason Exp $ */ /* * Copyright (c) 2000 Theo de Raadt @@ -78,7 +78,6 @@ struct ubsec_q2_rng { #define UBS_MODEXP_PAR_M 0 #define UBS_MODEXP_PAR_E 1 #define UBS_MODEXP_PAR_N 2 -#define UBS_MODEXP_PAR_C 3 struct ubsec_q2_modexp { struct ubsec_q2 me_q; struct cryptkop * me_krp; |