
The libgcrypt rsa code is mostly visible at https://dev.gnupg.org/source/libgcrypt/browse/master/cipher/rsa.c . (I had to work around some network issues reaching git.gnupg.org, and found dev.gnupg.org which works for me.) The operations of use start around line 909. Here's a link to that line: https://dev.gnupg.org/source/libgcrypt/browse/master/cipher/rsa.c$909 This source can also be cloned at https://dev.gnupg.org/source/libgcrypt.git . I've cloned it locally. The basic operations of use are public() and secret(). They basically just call out to mpi_powm, which is a wrapper for gcry_mpi_powm(). There's a #define in gcrypt.h, which is a different file generated from gcrypt.h.in . Before moving off rsa.c, it's notable that: - public() basically just wraps mpi_powm, using the same structures - secret() has an additional step to remove leading zeros - secret() has a special form that might be used when p and q are known called secret_core_crt() - there's something else called secret_blinded() that is likely documented in a header file or elsewhere Basically, everything of interest is likely in mpi_powm. I'm taking it slower now, because complexity will increase as we get deeper. mpi_powm could look frighteningly new.