diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/ubsec.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index eabe5862414..5dc8b9ac5b4 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.93 2002/05/02 18:20:50 jason Exp $ */ +/* $OpenBSD: ubsec.c,v 1.94 2002/05/02 18:28:24 jason Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -1752,7 +1752,7 @@ ubsec_kprocess(krp) } /* - * Start computation of cr[3] = (cr[0] ^ cr[1]) mod cr[2] + * Start computation of cr[C] = (cr[M] ^ cr[E]) mod cr[N] */ int ubsec_kprocess_modexp(sc, krp) @@ -1790,6 +1790,13 @@ ubsec_kprocess_modexp(sc, krp) goto errout; } + /* Sanity check: result bits must be >= true modulus bits. */ + if (krp->krp_param[UBS_MODEXP_PAR_C].crp_nbits < + krp->krp_param[UBS_MODEXP_PAR_N].crp_nbits) { + err = ERANGE; + goto errout; + } + me = (struct ubsec_q2_modexp *)malloc(sizeof *me, M_DEVBUF, M_NOWAIT); if (me == NULL) return (ENOMEM); |