Browse Source

Rename mont_data to order_mont.

It's confusing to have both mont and mont_data on EC_GROUP. The
documentation was also wrong.

Change-Id: I4e2e3169ed79307018212fba51d015bbbe5c4227
Reviewed-on: https://boringssl-review.googlesource.com/10348
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
kris/onging/CECPQ3_patch15
David Benjamin 7 years ago
committed by CQ bot account: commit-bot@chromium.org
parent
commit
331d2cee0a
3 changed files with 11 additions and 11 deletions
  1. +4
    -4
      crypto/fipsmodule/ec/ec.c
  2. +5
    -5
      crypto/fipsmodule/ec/internal.h
  3. +2
    -2
      crypto/fipsmodule/ecdsa/ecdsa.c

+ 4
- 4
crypto/fipsmodule/ec/ec.c View File

@@ -456,7 +456,7 @@ static EC_GROUP *ec_group_new_from_data(unsigned built_in_index) {

const BN_MONT_CTX **monts = *built_in_curve_scalar_field_monts();
if (monts != NULL) {
group->mont_data = monts[built_in_index];
group->order_mont = monts[built_in_index];
}

group->generator = P;
@@ -514,8 +514,8 @@ void EC_GROUP_free(EC_GROUP *group) {
OPENSSL_free(group);
}

const BN_MONT_CTX *ec_group_get_mont_data(const EC_GROUP *group) {
return group->mont_data;
const BN_MONT_CTX *ec_group_get_order_mont(const EC_GROUP *group) {
return group->order_mont;
}

EC_GROUP *EC_GROUP_dup(const EC_GROUP *a) {
@@ -533,7 +533,7 @@ EC_GROUP *EC_GROUP_dup(const EC_GROUP *a) {
return NULL;
}

ret->mont_data = a->mont_data;
ret->order_mont = a->order_mont;
ret->curve_name = a->curve_name;

if (a->generator != NULL) {


+ 5
- 5
crypto/fipsmodule/ec/internal.h View File

@@ -119,7 +119,7 @@ struct ec_group_st {

int curve_name; /* optional NID for named curve */

const BN_MONT_CTX *mont_data; /* data for ECDSA inverse */
const BN_MONT_CTX *order_mont; /* data for ECDSA inverse */

/* The following members are handled by the method functions,
* even if they appear generic */
@@ -147,10 +147,10 @@ struct ec_point_st {
EC_GROUP *ec_group_new(const EC_METHOD *meth);
int ec_group_copy(EC_GROUP *dest, const EC_GROUP *src);

/* ec_group_get_mont_data returns a Montgomery context for operations in the
* scalar field of |group|. It may return NULL in the case that |group| is not
* a built-in group. */
const BN_MONT_CTX *ec_group_get_mont_data(const EC_GROUP *group);
/* ec_group_get_order_mont returns a Montgomery context for operations modulo
* |group|'s order. It may return NULL in the case that |group| is not a
* built-in group. */
const BN_MONT_CTX *ec_group_get_order_mont(const EC_GROUP *group);

int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
const EC_POINT *p, const BIGNUM *p_scalar, BN_CTX *ctx);


+ 2
- 2
crypto/fipsmodule/ecdsa/ecdsa.c View File

@@ -280,10 +280,10 @@ static int ecdsa_sign_setup(const EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp,
}

/* Compute the inverse of k. The order is a prime, so use Fermat's Little
* Theorem. Note |ec_group_get_mont_data| may return NULL but
* Theorem. Note |ec_group_get_order_mont| may return NULL but
* |bn_mod_inverse_prime| allows this. */
if (!bn_mod_inverse_prime(kinv, k, order, ctx,
ec_group_get_mont_data(group))) {
ec_group_get_order_mont(group))) {
OPENSSL_PUT_ERROR(ECDSA, ERR_R_BN_LIB);
goto err;
}


Loading…
Cancel
Save