mpn_gcdext_n_basecase (was: Re: GMP symbol naming (and the history thereof)?)

Niels Möller nisse at lysator.liu.se
Sun Mar 3 19:11:29 CET 2013


Torbjorn Granlund <tg at gmplib.org> writes:

>   > __gmpn_gcdext_lehmer_n                          
>   
>   I think this would make sense as public, under a different name, e.g.,
>   mpn_gcdext_n_basecase.
>   
> Maybe.  We need to worry about the itch/scratch interface.  For user
> interface code, it seems to make sense to have scratch parameter less
> functions.  Like __gmpn_divisible_p.

Unless we decide that the itch/scratch interface is a failed experiment
(I don't think it is), I think we should strive for itch/scratch also in
the public mpn interface. For convenience, we can allow NULL scratch
pointer (except for low-level loops which really need all registers they
can get; this needs to be documented for each function).

For example, I'd like the ecdsa_verify function I'm writing to be
itchified, and then if I call mpn_gcdext_n_basecase do to the modular
inversion, I really want to pass in all needed storage. Ideally, I'd
like it to be possible to write programs using gmp for cryptographic
operations on known sizes, and do all allocation statically.

> Should a mpn_gcd_n_basecase also be available, for symmetry?

Would make sense. Currently, there is no such function.

> Does the gcdext functions need a large gp area also when the caller
> knows the gcd = 1?

I don't think so, but it gives a very ugly failure behaviour. And I
think "I'm *almost* sure this element is invertible" is also an
important usecase.

Regardss,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list