summaryrefslogtreecommitdiff
path: root/cipher/ecc-ecdsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'cipher/ecc-ecdsa.c')
-rw-r--r--cipher/ecc-ecdsa.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/cipher/ecc-ecdsa.c b/cipher/ecc-ecdsa.c
index 7663623d..b4bbe2cc 100644
--- a/cipher/ecc-ecdsa.c
+++ b/cipher/ecc-ecdsa.c
@@ -42,7 +42,7 @@ _gcry_ecc_ecdsa_sign (gcry_mpi_t input, ECC_secret_key *skey,
gcry_mpi_t r, gcry_mpi_t s,
int flags, int hashalgo)
{
- gpg_err_code_t err = 0;
+ gpg_err_code_t rc = 0;
int extraloops = 0;
gcry_mpi_t k, dr, sum, k_1, x;
mpi_point_struct I;
@@ -59,13 +59,12 @@ _gcry_ecc_ecdsa_sign (gcry_mpi_t input, ECC_secret_key *skey,
/* Convert the INPUT into an MPI if needed. */
if (mpi_is_opaque (input))
{
- abuf = gcry_mpi_get_opaque (input, &abits);
- err = gpg_err_code (gcry_mpi_scan (&hash, GCRYMPI_FMT_USG,
- abuf, (abits+7)/8, NULL));
- if (err)
- return err;
+ abuf = mpi_get_opaque (input, &abits);
+ rc = _gcry_mpi_scan (&hash, GCRYMPI_FMT_USG, abuf, (abits+7)/8, NULL);
+ if (rc)
+ return rc;
if (abits > qbits)
- gcry_mpi_rshift (hash, hash, abits - qbits);
+ mpi_rshift (hash, hash, abits - qbits);
}
else
hash = input;
@@ -98,15 +97,15 @@ _gcry_ecc_ecdsa_sign (gcry_mpi_t input, ECC_secret_key *skey,
used as h1 from 3.2.a. */
if (!mpi_is_opaque (input))
{
- err = GPG_ERR_CONFLICT;
+ rc = GPG_ERR_CONFLICT;
goto leave;
}
- abuf = gcry_mpi_get_opaque (input, &abits);
- err = _gcry_dsa_gen_rfc6979_k (&k, skey->E.n, skey->d,
- abuf, (abits+7)/8,
- hashalgo, extraloops);
- if (err)
+ abuf = mpi_get_opaque (input, &abits);
+ rc = _gcry_dsa_gen_rfc6979_k (&k, skey->E.n, skey->d,
+ abuf, (abits+7)/8,
+ hashalgo, extraloops);
+ if (rc)
goto leave;
extraloops++;
}
@@ -118,7 +117,7 @@ _gcry_ecc_ecdsa_sign (gcry_mpi_t input, ECC_secret_key *skey,
{
if (DBG_CIPHER)
log_debug ("ecc sign: Failed to get affine coordinates\n");
- err = GPG_ERR_BAD_SIGNATURE;
+ rc = GPG_ERR_BAD_SIGNATURE;
goto leave;
}
mpi_mod (r, x, skey->E.n); /* r = x mod n */
@@ -150,7 +149,7 @@ _gcry_ecc_ecdsa_sign (gcry_mpi_t input, ECC_secret_key *skey,
if (hash != input)
mpi_free (hash);
- return err;
+ return rc;
}