I'm looking for the definition of the gcry_mpi_t
type. I'm looking into the code of GnuPG, which uses libgcrypt, which in turn uses the latter as the type responsible for storing the modulus, the prime numbers of the RSA keys, etc. Typically, in /libgcrypt-1.8.2/cipher/rsa.c
you can find:
typedef struct
{
gcry_mpi_t n; /* modulus */
gcry_mpi_t e; /* exponent */
} RSA_public_key;
typedef struct
{
gcry_mpi_t n; /* public modulus */
gcry_mpi_t e; /* public exponent */
gcry_mpi_t d; /* exponent */
gcry_mpi_t p; /* prime p. */
gcry_mpi_t q; /* prime q. */
gcry_mpi_t u; /* inverse of p mod q. */
} RSA_secret_key;
I've found this SO post which mentions the specific type I'm trying to define, but it doesn't tell how it is defined.
My aim is to use the definition in a basic CS class introducing RSA and how it can be implemented. I therefore wish to show how the specific RSA variables have to be handled by specially designed struct
for efficient memory management.
However, until now, I couldn't find the proper piece of code defining it in the libgcrypt code. Thanks !