Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/crypto/ec
diff options
context:
space:
mode:
authorBrian Smith <brian@briansmith.org>2016-03-12 02:19:14 +0300
committerDavid Benjamin <davidben@google.com>2016-03-28 20:22:29 +0300
commit95cc3bea3b4817698ab0f62a29c906e7c85b8796 (patch)
treea29c31906ee4fca1c56bf6baed3dfba33f45d5c9 /crypto/ec
parenta00f8454341f9d089da96e8cd3960d926e8c6599 (diff)
Remove dead code from |ec_GFp_mont_point_get_affine_coordinates|.
This code is only used in ec_montgomery.c, so |field_encode| and |field_decode| are never NULL. Change-Id: I42a3ad5744d4ed6f0be1707494411e7efcf930ff Reviewed-on: https://boringssl-review.googlesource.com/7585 Reviewed-by: David Benjamin <davidben@google.com>
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/ec_montgomery.c47
1 files changed, 11 insertions, 36 deletions
diff --git a/crypto/ec/ec_montgomery.c b/crypto/ec/ec_montgomery.c
index 154ce84b..30898ae5 100644
--- a/crypto/ec/ec_montgomery.c
+++ b/crypto/ec/ec_montgomery.c
@@ -221,7 +221,6 @@ static int ec_GFp_mont_point_get_affine_coordinates(const EC_GROUP *group,
BN_CTX *ctx) {
BN_CTX *new_ctx = NULL;
BIGNUM *Z, *Z_1, *Z_2, *Z_3;
- const BIGNUM *Z_;
int ret = 0;
if (EC_POINT_is_at_infinity(group, point)) {
@@ -247,43 +246,24 @@ static int ec_GFp_mont_point_get_affine_coordinates(const EC_GROUP *group,
/* transform (X, Y, Z) into (x, y) := (X/Z^2, Y/Z^3) */
- if (group->meth->field_decode) {
- if (!group->meth->field_decode(group, Z, &point->Z, ctx)) {
- goto err;
- }
- Z_ = Z;
- } else {
- Z_ = &point->Z;
+ if (!group->meth->field_decode(group, Z, &point->Z, ctx)) {
+ goto err;
}
- if (BN_is_one(Z_)) {
- if (group->meth->field_decode) {
- if (x != NULL && !group->meth->field_decode(group, x, &point->X, ctx)) {
- goto err;
- }
- if (y != NULL && !group->meth->field_decode(group, y, &point->Y, ctx)) {
- goto err;
- }
- } else {
- if (x != NULL && !BN_copy(x, &point->X)) {
- goto err;
- }
- if (y != NULL && !BN_copy(y, &point->Y)) {
- goto err;
- }
+ if (BN_is_one(Z)) {
+ if (x != NULL && !group->meth->field_decode(group, x, &point->X, ctx)) {
+ goto err;
+ }
+ if (y != NULL && !group->meth->field_decode(group, y, &point->Y, ctx)) {
+ goto err;
}
} else {
- if (!BN_mod_inverse(Z_1, Z_, &group->field, ctx)) {
+ if (!BN_mod_inverse(Z_1, Z, &group->field, ctx)) {
OPENSSL_PUT_ERROR(EC, ERR_R_BN_LIB);
goto err;
}
- if (group->meth->field_encode == 0) {
- /* field_sqr works on standard representation */
- if (!group->meth->field_sqr(group, Z_2, Z_1, ctx)) {
- goto err;
- }
- } else if (!BN_mod_sqr(Z_2, Z_1, &group->field, ctx)) {
+ if (!BN_mod_sqr(Z_2, Z_1, &group->field, ctx)) {
goto err;
}
@@ -294,12 +274,7 @@ static int ec_GFp_mont_point_get_affine_coordinates(const EC_GROUP *group,
}
if (y != NULL) {
- if (group->meth->field_encode == 0) {
- /* field_mul works on standard representation */
- if (!group->meth->field_mul(group, Z_3, Z_2, Z_1, ctx)) {
- goto err;
- }
- } else if (!BN_mod_mul(Z_3, Z_2, Z_1, &group->field, ctx)) {
+ if (!BN_mod_mul(Z_3, Z_2, Z_1, &group->field, ctx)) {
goto err;
}