diff options
author | Bodo Moeller <bodo@openssl.org> | 2014-08-13 17:37:19 +0200 |
---|---|---|
committer | Bodo Moeller <bodo@openssl.org> | 2014-08-13 17:44:53 +0200 |
commit | 6b5b85f4f6d5f4e8b88afa453fe8861f33f78c6b (patch) | |
tree | 46808adde7ccdec2b78fc3cdcf9fd9da6f8d2c6b | |
parent | 03ebf85f7757c5da9f9d4fecb8ea1a1af18df46d (diff) |
Further improve/fix ec_GFp_simple_points_make_affine (ecp_smpl.c) and
group_order_tests (ectest.c). Also fix the EC_POINTs_mul documentation (ec.h).
Reviewed-by: emilia@openssl.org
-rw-r--r-- | crypto/ec/ec.h | 2 | ||||
-rw-r--r-- | crypto/ec/ecp_smpl.c | 4 | ||||
-rw-r--r-- | crypto/ec/ectest.c | 5 |
3 files changed, 6 insertions, 5 deletions
diff --git a/crypto/ec/ec.h b/crypto/ec/ec.h index dfe8710d33..572111f16c 100644 --- a/crypto/ec/ec.h +++ b/crypto/ec/ec.h @@ -629,7 +629,7 @@ int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx); -/** Computes r = generator * n sum_{i=0}^num p[i] * m[i] +/** Computes r = generator * n sum_{i=0}^{num-1} p[i] * m[i] * \param group underlying EC_GROUP object * \param r EC_POINT object for the result * \param n BIGNUM with the multiplier for the group generator (optional) diff --git a/crypto/ec/ecp_smpl.c b/crypto/ec/ecp_smpl.c index ba56983f95..2d1f357686 100644 --- a/crypto/ec/ecp_smpl.c +++ b/crypto/ec/ecp_smpl.c @@ -1318,8 +1318,8 @@ int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT { for (i = 0; i < num; i++) { - if (prod_Z[i] != NULL) - BN_clear_free(prod_Z[i]); + if (prod_Z[i] == NULL) break; + BN_clear_free(prod_Z[i]); } OPENSSL_free(prod_Z); } diff --git a/crypto/ec/ectest.c b/crypto/ec/ectest.c index 82c8c8bfb1..d1bf980599 100644 --- a/crypto/ec/ectest.c +++ b/crypto/ec/ectest.c @@ -251,14 +251,15 @@ static void group_order_tests(EC_GROUP *group) if (!EC_POINT_is_at_infinity(group, Q)) ABORT; /* Exercise EC_POINTs_mul, including corner cases. */ + if (EC_POINT_is_at_infinity(group, P)) ABORT; scalars[0] = n1; points[0] = Q; /* => infinity */ scalars[1] = n2; points[1] = P; /* => -P */ scalars[2] = n1; points[2] = Q; /* => infinity */ scalars[3] = n2; points[3] = Q; /* => infinity */ scalars[4] = n1; points[4] = P; /* => P */ scalars[5] = n2; points[5] = Q; /* => infinity */ - if (!EC_POINTs_mul(group, Q, NULL, 5, points, scalars, ctx)) ABORT; - if (!EC_POINT_is_at_infinity(group, Q)) ABORT; + if (!EC_POINTs_mul(group, P, NULL, 6, points, scalars, ctx)) ABORT; + if (!EC_POINT_is_at_infinity(group, P)) ABORT; } fprintf(stdout, "ok\n"); |