Libgcrypt (hopefully not OT)
Werner Koch
wk at gnupg.org
Mon May 6 21:50:07 CEST 2013
On Fri, 3 May 2013 23:27, robertc at broadcom.com said:
> I am using Libgcrypt 1.5.2 with gcc v 4.5.3 on Cygwin to use the MPI
> functions. Can you please provide some guidance on how to handle
> signed and negative MPIs? I cannot seem to get a negative MPI, which
Negative numbers are supported by the MPI subsystem but a rarely used.
There is a macro mpi_is_neg to test for it. We have no explict function
to negate an MPI. You would need to resort to somthing like
void
make_negative (gcry_mpi_t value)
{
gcry_mpi_t zero = gcry_mpi_new (0);
gcry_mpi_sub (value, zero, value);
gcry_mpi_release (zero);
}
Not pretty elegant or fast given that it only needs to toggle a bit.
For the use of some macros the sign bit is exposed, so you could use a
bad hack to do it faster.
> As an alternative, Is it possible to use the ecc functions with a custom random number generator algorithm?
Are you looking into deterministic DSA, similar to the
draft-pornin-deterministic-dsa-01 I-D? We recently started a discussion
on gcrypt-devel at gnupg.org about this. That ML would anyway be a better
place for your questions.
Shalom-Salam,
Werner
--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the Gnupg-users
mailing list