requesting another ECC function...
Werner Koch
wk at gnupg.org
Thu Apr 11 20:41:26 CEST 2013
On Thu, 21 Mar 2013 13:39, grothoff at in.tum.de said:
> I can manipulate 'Q' freely) to an S-expression. So what I need is
> something like a function "gcry_sexp_from_ec_context", to be used as
> follows:
Here we go: Instead of
> if (0 != (rc = gcry_sexp_from_ec_context (&pk_sexpr, ctx)))
> {
> LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_from_context", rc);
> gcry_ctx_release (ctx);
> gcry_sexp_release (data);
> gcry_sexp_release (sig_sexpr);
> return GNUNET_SYSERR;
> }
use this:
if (0 != (rc = gcry_pubkey_get_sexp (&pk_sexpr, GCRY_PK_GET_PUBKEY, ctx)))
{
LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pubkey_get_sexp", rc);
gcry_ctx_release (ctx);
gcry_sexp_release (data);
gcry_sexp_release (sig_sexpr);
return GNUNET_SYSERR;
}
Instead of GCRY_PK_GET_PUBKEY you might simply use 0, but that would
return the private key if D is available in the contetx. Thus better
request the public key explicit. Note that there are a few new error
code, thus a gpg_strerror would return "unknown error code". If in
doubt look at the number:
#define GPG_ERR_NO_CRYPT_CTX 191
#define GPG_ERR_WRONG_CRYPT_CTX 192
#define GPG_ERR_BAD_CRYPT_CTX 193
#define GPG_ERR_CRYPT_CTX_CONFLICT 194
#define GPG_ERR_BROKEN_PUBKEY 195
#define GPG_ERR_BROKEN_SECKEY 196
You also need libgpg-error 1.11 now. Check out tests/t-mpi-point.c if
you need examples.
> Also, I noticed that there is point_get_affine, but no point_set_affine.
> As creating an MPI with value "1" is inconvenient, it might be nice
> (also for symmetry) to have a gcry_point_set_affine (x,y) API as well.
I'll look at this later.
Salam-Shalom,
Werner
--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the Gcrypt-devel
mailing list