diff options
author | Simon L. B. Nielsen <simon@FreeBSD.org> | 2010-11-21 22:45:18 +0000 |
---|---|---|
committer | Simon L. B. Nielsen <simon@FreeBSD.org> | 2010-11-21 22:45:18 +0000 |
commit | f2c43d19b91f8847c1dfd87721254b44f963d9a2 (patch) | |
tree | 4710d37952455e247de95eedf55ea05ee4df9f69 /crypto/ec/ec2_mult.c | |
parent | 0cedaa6c89235ed396068f2ebf546c9a909439e1 (diff) | |
download | src-f2c43d19b91f8847c1dfd87721254b44f963d9a2.tar.gz src-f2c43d19b91f8847c1dfd87721254b44f963d9a2.zip |
Import OpenSSL 0.9.8p.vendor/openssl/0.9.8p
Notes
Notes:
svn path=/vendor-crypto/openssl/dist/; revision=215643
svn path=/vendor-crypto/openssl/0.9.8p/; revision=215644; tag=vendor/openssl/0.9.8p
Diffstat (limited to 'crypto/ec/ec2_mult.c')
-rw-r--r-- | crypto/ec/ec2_mult.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/crypto/ec/ec2_mult.c b/crypto/ec/ec2_mult.c index ff368fd7d7b3..7dca5e4bcd43 100644 --- a/crypto/ec/ec2_mult.c +++ b/crypto/ec/ec2_mult.c @@ -318,6 +318,7 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, int ret = 0; size_t i; EC_POINT *p=NULL; + EC_POINT *acc = NULL; if (ctx == NULL) { @@ -337,15 +338,16 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, } if ((p = EC_POINT_new(group)) == NULL) goto err; + if ((acc = EC_POINT_new(group)) == NULL) goto err; - if (!EC_POINT_set_to_infinity(group, r)) goto err; + if (!EC_POINT_set_to_infinity(group, acc)) goto err; if (scalar) { if (!ec_GF2m_montgomery_point_multiply(group, p, scalar, group->generator, ctx)) goto err; - if (BN_is_negative(scalar)) + if (BN_is_negative(scalar)) if (!group->meth->invert(group, p, ctx)) goto err; - if (!group->meth->add(group, r, r, p, ctx)) goto err; + if (!group->meth->add(group, acc, acc, p, ctx)) goto err; } for (i = 0; i < num; i++) @@ -353,13 +355,16 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, if (!ec_GF2m_montgomery_point_multiply(group, p, scalars[i], points[i], ctx)) goto err; if (BN_is_negative(scalars[i])) if (!group->meth->invert(group, p, ctx)) goto err; - if (!group->meth->add(group, r, r, p, ctx)) goto err; + if (!group->meth->add(group, acc, acc, p, ctx)) goto err; } + if (!EC_POINT_copy(r, acc)) goto err; + ret = 1; err: if (p) EC_POINT_free(p); + if (acc) EC_POINT_free(acc); if (new_ctx != NULL) BN_CTX_free(new_ctx); return ret; |