Commit ae15d22a authored by Niels Möller's avatar Niels Möller
Browse files

* pgp-encode.c [!HAVE_LIBGMP]: Kludge around the pgp.h's

dependency on gmp.h.
(pgp_put_mpi): Condition on HAVE_LIBGMP.

* pgp.h: Don't include bignum.h, to make it possible to compile
the non-bignum parts of pgp-encode.c without bignum support. Needs
to be fixed properly before the pgp interface is advertised.

Rev: src/nettle/pgp-encode.c:1.8
Rev: src/nettle/pgp.h:1.6
parent 667b0662
...@@ -31,17 +31,24 @@ ...@@ -31,17 +31,24 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.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 "base64.h"
#include "buffer.h" #include "buffer.h"
#include "macros.h" #include "macros.h"
#if WITH_PUBLIC_KEY
# include "bignum.h"
# include "rsa.h"
#endif /* WITH_PUBLIC_KEY */
int int
pgp_put_uint32(struct nettle_buffer *buffer, uint32_t i) pgp_put_uint32(struct nettle_buffer *buffer, uint32_t i)
{ {
...@@ -64,6 +71,7 @@ pgp_put_uint16(struct nettle_buffer *buffer, unsigned i) ...@@ -64,6 +71,7 @@ pgp_put_uint16(struct nettle_buffer *buffer, unsigned i)
return 1; return 1;
} }
#if HAVE_LIBGMP
int int
pgp_put_mpi(struct nettle_buffer *buffer, const mpz_t x) 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) ...@@ -85,6 +93,7 @@ pgp_put_mpi(struct nettle_buffer *buffer, const mpz_t x)
return 1; return 1;
} }
#endif
int int
pgp_put_string(struct nettle_buffer *buffer, pgp_put_string(struct nettle_buffer *buffer,
......
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
#include <time.h> #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 */ /* Name mangling */
#define pgp_put_uint32 nettle_pgp_put_uint32 #define pgp_put_uint32 nettle_pgp_put_uint32
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment