diff options
author | miod <> | 2016-11-05 10:47:16 +0000 |
---|---|---|
committer | miod <> | 2016-11-05 10:47:16 +0000 |
commit | 1fafed06aeab0e0177e46136e9f456587a2fd1b3 (patch) | |
tree | 19deb52e4b262dbe0227174c4e7bb1b0ed1e1aa7 /src | |
parent | 8929252cc3a29a86f7cc9822b4d98693471480b2 (diff) | |
download | openbsd-1fafed06aeab0e0177e46136e9f456587a2fd1b3.tar.gz openbsd-1fafed06aeab0e0177e46136e9f456587a2fd1b3.tar.bz2 openbsd-1fafed06aeab0e0177e46136e9f456587a2fd1b3.zip |
Stop abusing the ternary operator to decide which function to call in a
return statement.
ok beck@ jsing@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/bn/bn_mod.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/bn_mod.c b/src/lib/libcrypto/bn/bn_mod.c index 67bd3541b0..eb2d5b072e 100644 --- a/src/lib/libcrypto/bn/bn_mod.c +++ b/src/lib/libcrypto/bn/bn_mod.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_mod.c,v 1.9 2014/07/12 16:03:36 miod Exp $ */ | 1 | /* $OpenBSD: bn_mod.c,v 1.10 2016/11/05 10:47:16 miod Exp $ */ |
2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
3 | * for the OpenSSL project. */ | 3 | * for the OpenSSL project. */ |
4 | /* ==================================================================== | 4 | /* ==================================================================== |
@@ -125,8 +125,11 @@ BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) | |||
125 | return 0; | 125 | return 0; |
126 | if (!r->neg) | 126 | if (!r->neg) |
127 | return 1; | 127 | return 1; |
128 | /* now -|d| < r < 0, so we have to set r := r + |d| */ | 128 | /* now -|d| < r < 0, so we have to set r := r + |d| */ |
129 | return (d->neg ? BN_sub : BN_add)(r, r, d); | 129 | if (d->neg) |
130 | return BN_sub(r, r, d); | ||
131 | else | ||
132 | return BN_add(r, r, d); | ||
130 | } | 133 | } |
131 | 134 | ||
132 | int | 135 | int |