diff --git a/bignum.c b/bignum.c
index c9f5a460c28f58fda2a3d406ae474022f41c383f..d1c3c5d049e1cc974b4ca14c3a2bbc672a1a3c92 100644
--- a/bignum.c
+++ b/bignum.c
@@ -35,7 +35,7 @@
 #include <string.h>
 
 void
-nettle_mpz_get_str_256(unsigned length, uint8_t *s, mpz_t x)
+nettle_mpz_get_str_256(unsigned length, uint8_t *s, const mpz_t x)
 {
   uint8_t *dst = s + length - 1;
   unsigned size = mpz_size(x);
diff --git a/bignum.h b/bignum.h
index 244d957331e911ccc208f0ef41349c9df42df720..b4cfcc372ab6d3e9d2c2bb93d6ac823dfb532fc4 100644
--- a/bignum.h
+++ b/bignum.h
@@ -32,7 +32,7 @@
 /* Writes an unsigned integer as length octets, using big endian byte
  * order. */
 void
-nettle_mpz_get_str_256(unsigned length, uint8_t *s, mpz_t x);
+nettle_mpz_get_str_256(unsigned length, uint8_t *s, const mpz_t x);
 
 void
 nettle_mpz_set_str_256(mpz_t x,