projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix a ** 0 mod 1 = 0 for real this time.
[oweals/openssl.git]
/
crypto
/
bn
/
bn_shift.c
diff --git
a/crypto/bn/bn_shift.c
b/crypto/bn/bn_shift.c
index 9895646afaafce9ef5229425aac41bfc8a98f7c3..4e43a60b22944b81e3d4e0c74e4628d39c99cc51 100644
(file)
--- a/
crypto/bn/bn_shift.c
+++ b/
crypto/bn/bn_shift.c
@@
-56,7
+56,7
@@
* [including the GNU Public Licence.]
*/
* [including the GNU Public Licence.]
*/
-#include "cryptlib.h"
+#include "
internal/
cryptlib.h"
#include "bn_lcl.h"
int BN_lshift1(BIGNUM *r, const BIGNUM *a)
#include "bn_lcl.h"
int BN_lshift1(BIGNUM *r, const BIGNUM *a)
@@
-136,6
+136,11
@@
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
bn_check_top(r);
bn_check_top(a);
bn_check_top(r);
bn_check_top(a);
+ if (n < 0) {
+ BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT);
+ return 0;
+ }
+
r->neg = a->neg;
nw = n / BN_BITS2;
if (bn_wexpand(r, a->top + nw + 1) == NULL)
r->neg = a->neg;
nw = n / BN_BITS2;
if (bn_wexpand(r, a->top + nw + 1) == NULL)
@@
-170,6
+175,11
@@
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
bn_check_top(r);
bn_check_top(a);
bn_check_top(r);
bn_check_top(a);
+ if (n < 0) {
+ BNerr(BN_F_BN_RSHIFT, BN_R_INVALID_SHIFT);
+ return 0;
+ }
+
nw = n / BN_BITS2;
rb = n % BN_BITS2;
lb = BN_BITS2 - rb;
nw = n / BN_BITS2;
rb = n % BN_BITS2;
lb = BN_BITS2 - rb;