summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-11-08 10:07:40 +0100
committerWerner Koch <wk@gnupg.org>2013-11-08 10:09:34 +0100
commit9f63c0f7a3b2c15c7e258cd17395cabd0a8f00cc (patch)
treed735a8284329782accc6e6e4a77b9310dba5a82e
parented45fd2e60c88e2f005282e6eadd018b59dcf65b (diff)
downloadlibgcrypt-9f63c0f7a3b2c15c7e258cd17395cabd0a8f00cc.tar.gz
ecc: Implement the "nocomp" flag for key generation.
* cipher/ecc.c (ecc_generate): Support the "nocomp" flag. * tests/keygen.c (check_ecc_keys): Add a test for it. Signed-off-by: Werner Koch <wk@gnupg.org>
-rw-r--r--cipher/ecc.c2
-rw-r--r--doc/gcrypt.texi12
-rw-r--r--tests/keygen.c7
3 files changed, 13 insertions, 8 deletions
diff --git a/cipher/ecc.c b/cipher/ecc.c
index f2a0e829..d62f5555 100644
--- a/cipher/ecc.c
+++ b/cipher/ecc.c
@@ -483,7 +483,7 @@ ecc_generate (const gcry_sexp_t genparms, gcry_sexp_t *r_skey)
if (_gcry_mpi_ec_get_affine (x, y, &sk.E.G, ctx))
log_fatal ("ecgen: Failed to get affine coordinates for %s\n", "G");
base = _gcry_ecc_ec2os (x, y, sk.E.p);
- if (sk.E.dialect == ECC_DIALECT_ED25519)
+ if (sk.E.dialect == ECC_DIALECT_ED25519 && !(flags & PUBKEY_FLAG_NOCOMP))
{
unsigned char *encpk;
unsigned int encpklen;
diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi
index dd65f9a3..1619f0d4 100644
--- a/doc/gcrypt.texi
+++ b/doc/gcrypt.texi
@@ -2232,11 +2232,15 @@ are known:
@table @code
@item comp
+@itemx nocomp
@cindex comp
-If supported and not yet the default return ECC points in compact
-(compressed) representation. The compact representation requires a
-small overhead before a point can be used but halves the size of a to
-be conveyed public key.
+@cindex nocomp
+If supported by the algorithm and curve the @code{comp} flag requests
+that points are returned in compact (compressed) representation. The
+@code{nocomp} flag requests that points are returned with full
+coordinates. The default depends on the the algorithm and curve.
+The compact representation requires a small overhead before a point
+can be used but halves the size of a to be conveyed public key.
@item pkcs1
@cindex PKCS1
diff --git a/tests/keygen.c b/tests/keygen.c
index 4796b5cf..48663d45 100644
--- a/tests/keygen.c
+++ b/tests/keygen.c
@@ -416,15 +416,16 @@ check_ecc_keys (void)
show_sexp ("ECC key:\n", key);
if (verbose)
- show ("creating ECC key using curve Ed25519 for ECDSA\n");
+ show ("creating ECC key using curve Ed25519 for ECDSA (nocomp)\n");
rc = gcry_sexp_build (&keyparm, NULL,
- "(genkey(ecc(curve Ed25519)(flags)))");
+ "(genkey(ecc(curve Ed25519)(flags nocomp)))");
if (rc)
die ("error creating S-expression: %s\n", gpg_strerror (rc));
rc = gcry_pk_genkey (&key, keyparm);
gcry_sexp_release (keyparm);
if (rc)
- die ("error generating ECC key using curve Ed25519 for ECDSA: %s\n",
+ die ("error generating ECC key using curve Ed25519 for ECDSA"
+ " (nocomp): %s\n",
gpg_strerror (rc));
if (verbose > 1)