Usage of mpz_t inside of structures

Bruno Jiménez brunojimen at gmail.com
Wed Jun 20 00:02:34 CEST 2012


Hi,

I have been using GMP for a short time, so this may be some kind of
mistake I am doing with the lib.

The thing is that I am creating a mini-library to play around with the
RSA cypher algorithm and I have a structure with all the info I need.

typedef struct _rsa_key
{
    mpz_t n,e,d,p,q;
} rsa_key;

Until now, I was just passing all the arguments as parameters to the
function that creates the rsa_key, just as the GMP functions do. For
example:

void create_rsa_key(/* all the mpz_t's */)
{
    /* create the key */
}

And I get back all the numbers needed for the key. But I wanted to
change it to use directly the structure I have written above, supposing
that it would work the same way as with just the mpz_t's, but it
doesn't.

So, I don't know if I just am doing something wrong, or it is because
this just can't be done this way.

Best Regards,
Bruno



More information about the gmp-discuss mailing list