diff --git a/pgp-encode.c b/pgp-encode.c index 5154bce61f9558f4874a69f21d891fe722e4d8ed..22d2281a53c41ffe17f29caa27846e72dd62815b 100644 --- a/pgp-encode.c +++ b/pgp-encode.c @@ -31,17 +31,24 @@ #include <stdlib.h> #include <string.h> -#include "pgp.h" +#if HAVE_LIBGMP +# include "bignum.h" +# include "pgp.h" +#else /* !HAVE_LIBGMP */ +/* Kludge to make it possible to include pgp.h */ +# define mpz_t int +# include "pgp.h" +# undef mpz_t +#endif /* !HAVE_LIBGMP */ + +#if WITH_PUBLIC_KEY +# include "rsa.h" +#endif #include "base64.h" #include "buffer.h" #include "macros.h" -#if WITH_PUBLIC_KEY -# include "bignum.h" -# include "rsa.h" -#endif /* WITH_PUBLIC_KEY */ - int pgp_put_uint32(struct nettle_buffer *buffer, uint32_t i) { @@ -64,6 +71,7 @@ pgp_put_uint16(struct nettle_buffer *buffer, unsigned i) return 1; } +#if HAVE_LIBGMP int pgp_put_mpi(struct nettle_buffer *buffer, const mpz_t x) { @@ -85,6 +93,7 @@ pgp_put_mpi(struct nettle_buffer *buffer, const mpz_t x) return 1; } +#endif int pgp_put_string(struct nettle_buffer *buffer, diff --git a/pgp.h b/pgp.h index b9103ebda50f5e1e7b56f4a1e199112bf7f09391..2bd9a30d3439426c5e802f7bc76cc34088c267e9 100644 --- a/pgp.h +++ b/pgp.h @@ -28,7 +28,9 @@ #include <time.h> -#include "bignum.h" +/* FIXME: User must include bignum.h before this file, in order to get + mpz_t defined. We don't do that here, in order to kludge through + compilation without public key support and without gmp.h. */ /* Name mangling */ #define pgp_put_uint32 nettle_pgp_put_uint32