diff options
author | Bodo Möller <bodo@openssl.org> | 2001-03-11 08:44:50 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2001-03-11 08:44:50 +0000 |
commit | 86a921af06f52d1b16fbc8a76d8f0ff1950d1c8a (patch) | |
tree | ef61352f93abc72ab99295a318ad0b3a45f73b0e /crypto/ec/ec_mult.c | |
parent | 616df356332246c891fb1a650fef54ee211cafd3 (diff) | |
download | openssl-new-86a921af06f52d1b16fbc8a76d8f0ff1950d1c8a.tar.gz |
handle negative scalars correctly when doing point multiplication
Diffstat (limited to 'crypto/ec/ec_mult.c')
-rw-r--r-- | crypto/ec/ec_mult.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/ec/ec_mult.c b/crypto/ec/ec_mult.c index ddd3db5921..01574d8c93 100644 --- a/crypto/ec/ec_mult.c +++ b/crypto/ec/ec_mult.c @@ -187,10 +187,18 @@ int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, BIGNUM *scalar, if (i < num) { if (!EC_POINT_copy(val_sub[i][0], points[i])) goto err; + if (scalars[i]->neg) + { + if (!EC_POINT_invert(group, val_sub[i][0], ctx)) goto err; + } } else { if (!EC_POINT_copy(val_sub[i][0], generator)) goto err; + if (scalar->neg) + { + if (!EC_POINT_invert(group, val_sub[i][0], ctx)) goto err; + } } if (wsize[i] > 1) |