summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_shift.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/bn_shift.c')
-rw-r--r--src/lib/libcrypto/bn/bn_shift.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libcrypto/bn/bn_shift.c b/src/lib/libcrypto/bn/bn_shift.c
index e89e157446..e2612d1e9d 100644
--- a/src/lib/libcrypto/bn/bn_shift.c
+++ b/src/lib/libcrypto/bn/bn_shift.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_shift.c,v 1.14 2022/06/22 09:03:06 tb Exp $ */ 1/* $OpenBSD: bn_shift.c,v 1.15 2022/11/24 01:30:01 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -74,11 +74,11 @@ BN_lshift1(BIGNUM *r, const BIGNUM *a)
74 74
75 if (r != a) { 75 if (r != a) {
76 r->neg = a->neg; 76 r->neg = a->neg;
77 if (bn_wexpand(r, a->top + 1) == NULL) 77 if (!bn_wexpand(r, a->top + 1))
78 return (0); 78 return (0);
79 r->top = a->top; 79 r->top = a->top;
80 } else { 80 } else {
81 if (bn_wexpand(r, a->top + 1) == NULL) 81 if (!bn_wexpand(r, a->top + 1))
82 return (0); 82 return (0);
83 } 83 }
84 ap = a->d; 84 ap = a->d;
@@ -114,7 +114,7 @@ BN_rshift1(BIGNUM *r, const BIGNUM *a)
114 ap = a->d; 114 ap = a->d;
115 j = i - (ap[i - 1]==1); 115 j = i - (ap[i - 1]==1);
116 if (a != r) { 116 if (a != r) {
117 if (bn_wexpand(r, j) == NULL) 117 if (!bn_wexpand(r, j))
118 return (0); 118 return (0);
119 r->neg = a->neg; 119 r->neg = a->neg;
120 } 120 }
@@ -150,7 +150,7 @@ BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
150 150
151 r->neg = a->neg; 151 r->neg = a->neg;
152 nw = n / BN_BITS2; 152 nw = n / BN_BITS2;
153 if (bn_wexpand(r, a->top + nw + 1) == NULL) 153 if (!bn_wexpand(r, a->top + nw + 1))
154 return (0); 154 return (0);
155 lb = n % BN_BITS2; 155 lb = n % BN_BITS2;
156 rb = BN_BITS2 - lb; 156 rb = BN_BITS2 - lb;
@@ -200,7 +200,7 @@ BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
200 i = (BN_num_bits(a) - n + (BN_BITS2 - 1)) / BN_BITS2; 200 i = (BN_num_bits(a) - n + (BN_BITS2 - 1)) / BN_BITS2;
201 if (r != a) { 201 if (r != a) {
202 r->neg = a->neg; 202 r->neg = a->neg;
203 if (bn_wexpand(r, i) == NULL) 203 if (!bn_wexpand(r, i))
204 return (0); 204 return (0);
205 } else { 205 } else {
206 if (n == 0) 206 if (n == 0)