summaryrefslogtreecommitdiff
path: root/cipher
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2021-01-18 18:28:13 +0100
committerWerner Koch <wk@gnupg.org>2021-01-18 18:28:13 +0100
commitca5a90bf70598247589078478d237287ca524453 (patch)
tree78b41038748cff3a4f502761f8c7268a338e9628 /cipher
parent04c50901a2f2016486f532891ee8c1961a465c04 (diff)
downloadlibgcrypt-ca5a90bf70598247589078478d237287ca524453.tar.gz
ecc: Change an error code of gcry_ecc_mul_point.
* cipher/ecc-ecdh.c (_gcry_ecc_mul_point): Return GPG_ERR_UNKNOWN_CURVE. -- Unknown_curve is more specific than unknown_algorithm. This patch also adds documentation and renames rthe parameter from 'algo' to 'curveid'. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'cipher')
-rw-r--r--cipher/ecc-ecdh.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/cipher/ecc-ecdh.c b/cipher/ecc-ecdh.c
index 39458788..43eb731a 100644
--- a/cipher/ecc-ecdh.c
+++ b/cipher/ecc-ecdh.c
@@ -46,20 +46,20 @@ prepare_ec (mpi_ec_t *r_ec, const char *name)
}
unsigned int
-_gcry_ecc_get_algo_keylen (int algo)
+_gcry_ecc_get_algo_keylen (int curveid)
{
unsigned int len = 0;
- if (algo == GCRY_ECC_CURVE25519)
+ if (curveid == GCRY_ECC_CURVE25519)
len = ECC_CURVE25519_BYTES;
- else if (algo == GCRY_ECC_CURVE448)
+ else if (curveid == GCRY_ECC_CURVE448)
len = ECC_CURVE448_BYTES;
return len;
}
gpg_error_t
-_gcry_ecc_mul_point (int algo, unsigned char *result,
+_gcry_ecc_mul_point (int curveid, unsigned char *result,
const unsigned char *scalar, const unsigned char *point)
{
unsigned int nbits;
@@ -73,12 +73,12 @@ _gcry_ecc_mul_point (int algo, unsigned char *result,
unsigned int len;
unsigned char *buf;
- if (algo == GCRY_ECC_CURVE25519)
+ if (curveid == GCRY_ECC_CURVE25519)
curve = "Curve25519";
- else if (algo == GCRY_ECC_CURVE448)
+ else if (curveid == GCRY_ECC_CURVE448)
curve = "X448";
else
- return gpg_error (GPG_ERR_UNKNOWN_ALGORITHM);
+ return gpg_error (GPG_ERR_UNKNOWN_CURVE);
err = prepare_ec (&ec, curve);
if (err)