diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-07-26 12:26:49 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-07-26 12:26:49 +0000 |
commit | 3ef4e854c3c9cde679e38a92f587e46bdf8a88a9 (patch) | |
tree | 05351f881f6c64360d49d9de9bb632b7b7962093 /lib/libcrypto/ec | |
parent | 0a6ef94dbbe56256671139e300427bda59f8ccbc (diff) |
Unindent a big block in EC_GROUP_get_affine_coordinates()
Diffstat (limited to 'lib/libcrypto/ec')
-rw-r--r-- | lib/libcrypto/ec/ecp_smpl.c | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/lib/libcrypto/ec/ecp_smpl.c b/lib/libcrypto/ec/ecp_smpl.c index add13483729..f591fa02675 100644 --- a/lib/libcrypto/ec/ecp_smpl.c +++ b/lib/libcrypto/ec/ecp_smpl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecp_smpl.c,v 1.53 2023/07/26 12:24:28 tb Exp $ */ +/* $OpenBSD: ecp_smpl.c,v 1.54 2023/07/26 12:26:48 tb Exp $ */ /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> * for the OpenSSL project. * Includes code written by Bodo Moeller for the OpenSSL project. @@ -417,47 +417,49 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, goto err; if (!ec_decode_scalar(group, y, &point->Y, ctx)) goto err; + goto done; + } + + if (BN_mod_inverse_ct(Z_1, z, &group->field, ctx) == NULL) { + ECerror(ERR_R_BN_LIB); + goto err; + } + if (group->meth->field_encode == NULL) { + /* field_sqr works on standard representation */ + if (!group->meth->field_sqr(group, Z_2, Z_1, ctx)) + goto err; } else { - if (BN_mod_inverse_ct(Z_1, z, &group->field, ctx) == NULL) { - ECerror(ERR_R_BN_LIB); + if (!BN_mod_sqr(Z_2, Z_1, &group->field, ctx)) goto err; - } + } + + if (x != NULL) { + /* + * in the Montgomery case, field_mul will cancel out + * Montgomery factor in X: + */ + if (!group->meth->field_mul(group, x, &point->X, Z_2, ctx)) + goto err; + } + if (y != NULL) { if (group->meth->field_encode == NULL) { - /* field_sqr works on standard representation */ - if (!group->meth->field_sqr(group, Z_2, Z_1, ctx)) + /* 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_sqr(Z_2, Z_1, &group->field, ctx)) + if (!BN_mod_mul(Z_3, Z_2, Z_1, &group->field, ctx)) goto err; } - if (x != NULL) { - /* - * in the Montgomery case, field_mul will cancel out - * Montgomery factor in X: - */ - if (!group->meth->field_mul(group, x, &point->X, Z_2, ctx)) - goto err; - } - if (y != NULL) { - if (group->meth->field_encode == NULL) { - /* 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)) - goto err; - } - - /* - * in the Montgomery case, field_mul will cancel out - * Montgomery factor in Y: - */ - if (!group->meth->field_mul(group, y, &point->Y, Z_3, ctx)) - goto err; - } + /* + * in the Montgomery case, field_mul will cancel out + * Montgomery factor in Y: + */ + if (!group->meth->field_mul(group, y, &point->Y, Z_3, ctx)) + goto err; } + done: ret = 1; err: |