diff --git a/ecc-ecdsa-sign.c b/ecc-ecdsa-sign.c
index cdf377465d860f996f94ea49e05b2cb2f4b56113..c17a9ecccc778c2554bbdcb1afefb615e8f5eb39 100644
--- a/ecc-ecdsa-sign.c
+++ b/ecc-ecdsa-sign.c
@@ -48,7 +48,7 @@ ecc_ecdsa_sign (const struct ecc_curve *ecc,
 		/* Random nonce, must be invertible mod ecc group
 		   order. */
 		const mp_limb_t *kp,
-		unsigned length, const uint8_t *digest,
+		size_t length, const uint8_t *digest,
 		mp_limb_t *rp, mp_limb_t *sp,
 		mp_limb_t *scratch)
 {
diff --git a/ecc-ecdsa-verify.c b/ecc-ecdsa-verify.c
index f24eff37185f65ff42b54cfdb5a9cf0d9bca5a2d..9b0dd6f701a95616f4028ed2b881ae065b90172e 100644
--- a/ecc-ecdsa-verify.c
+++ b/ecc-ecdsa-verify.c
@@ -62,7 +62,7 @@ ecc_ecdsa_verify_itch (const struct ecc_curve *ecc)
 int
 ecc_ecdsa_verify (const struct ecc_curve *ecc,
 		  const mp_limb_t *pp, /* Public key */
-		  unsigned length, const uint8_t *digest,
+		  size_t length, const uint8_t *digest,
 		  const mp_limb_t *rp, const mp_limb_t *sp,
 		  mp_limb_t *scratch)
 {
diff --git a/ecc-hash.c b/ecc-hash.c
index f63544fb37a0fe5939b98463c8c8f7c35ead2ffd..7b8a0a76bbe83f778392ae73854085bd3db46b04 100644
--- a/ecc-hash.c
+++ b/ecc-hash.c
@@ -41,9 +41,9 @@
 void
 ecc_hash (const struct ecc_curve *ecc,
 	  mp_limb_t *hp,
-	  unsigned length, const uint8_t *digest)
+	  size_t length, const uint8_t *digest)
 {
-  if (length > ((unsigned) ecc->bit_size + 7) / 8)
+  if (length > ((size_t) ecc->bit_size + 7) / 8)
     length = (ecc->bit_size + 7) / 8;
 
   mpn_set_base256 (hp, ecc->size + 1, digest, length);
diff --git a/ecc-internal.h b/ecc-internal.h
index e8974fe4c9dcfbf794c5db829e686a65e97a2bd0..014716da7d7ee63753fb59c0657e48ca7d689405 100644
--- a/ecc-internal.h
+++ b/ecc-internal.h
@@ -202,7 +202,7 @@ ecc_mod (mp_limb_t *rp, mp_size_t rn, mp_size_t mn,
 void
 ecc_hash (const struct ecc_curve *ecc,
 	  mp_limb_t *hp,
-	  unsigned length, const uint8_t *digest);
+	  size_t length, const uint8_t *digest);
 
 void
 cnd_copy (int cnd, mp_limb_t *rp, const mp_limb_t *ap, mp_size_t n);
diff --git a/ecdsa-sign.c b/ecdsa-sign.c
index 2ee019c8c9714bcc56979f5fd144054a012096f8..13d8cac136a67c68f344d7559bda973508a65abe 100644
--- a/ecdsa-sign.c
+++ b/ecdsa-sign.c
@@ -36,7 +36,7 @@
 void
 ecdsa_sign (const struct ecc_scalar *key,
 	    void *random_ctx, nettle_random_func *random,
-	    unsigned digest_length,
+	    size_t digest_length,
 	    const uint8_t *digest,
 	    struct dsa_signature *signature)
 {
diff --git a/ecdsa-verify.c b/ecdsa-verify.c
index d889d780b79fa0b03e6b7487c190827c5d996eda..7aa72008db8c17ec32ad47784fe00b67ec417739 100644
--- a/ecdsa-verify.c
+++ b/ecdsa-verify.c
@@ -34,7 +34,7 @@
 
 int
 ecdsa_verify (const struct ecc_point *pub,
-	      unsigned length, const uint8_t *digest,
+	      size_t length, const uint8_t *digest,
 	      const struct dsa_signature *signature)
 {
   mp_limb_t size = pub->ecc->size;
diff --git a/ecdsa.h b/ecdsa.h
index 17267a92686dff85b446b6967038c24cfe4e204c..ec6ac92185b547898aff544908503b8c7f82af68 100644
--- a/ecdsa.h
+++ b/ecdsa.h
@@ -48,13 +48,13 @@ extern "C" {
 void
 ecdsa_sign (const struct ecc_scalar *key,
 	    void *random_ctx, nettle_random_func *random,
-	    unsigned digest_length,
+	    size_t digest_length,
 	    const uint8_t *digest,
 	    struct dsa_signature *signature);
 
 int
 ecdsa_verify (const struct ecc_point *pub,
-	      unsigned length, const uint8_t *digest,
+	      size_t length, const uint8_t *digest,
 	      const struct dsa_signature *signature);
 
 void
@@ -72,7 +72,7 @@ ecc_ecdsa_sign (const struct ecc_curve *ecc,
 		/* Random nonce, must be invertible mod ecc group
 		   order. */
 		const mp_limb_t *kp,
-		unsigned length, const uint8_t *digest,
+		size_t length, const uint8_t *digest,
 		mp_limb_t *rp, mp_limb_t *sp,
 		mp_limb_t *scratch);
 
@@ -82,7 +82,7 @@ ecc_ecdsa_verify_itch (const struct ecc_curve *ecc);
 int
 ecc_ecdsa_verify (const struct ecc_curve *ecc,
 		  const mp_limb_t *pp, /* Public key */
-		  unsigned length, const uint8_t *digest,
+		  size_t length, const uint8_t *digest,
 		  const mp_limb_t *rp, const mp_limb_t *sp,
 		  mp_limb_t *scratch);