diff --git a/pbkdf2-hmac-sha1.c b/pbkdf2-hmac-sha1.c
index 918550377d20f79a1dceaf9395e809d2d1633a25..acbc1200e4ebf77eee930814f9ed02af567fe2a5 100644
--- a/pbkdf2-hmac-sha1.c
+++ b/pbkdf2-hmac-sha1.c
@@ -32,10 +32,10 @@
 #include "hmac.h"
 
 void
-pbkdf2_hmac_sha1 (unsigned key_length, const uint8_t *key,
+pbkdf2_hmac_sha1 (size_t key_length, const uint8_t *key,
 		  unsigned iterations,
-		  unsigned salt_length, const uint8_t *salt,
-		  unsigned length, uint8_t *dst)
+		  size_t salt_length, const uint8_t *salt,
+		  size_t length, uint8_t *dst)
 {
   struct hmac_sha1_ctx sha1ctx;
 
diff --git a/pbkdf2-hmac-sha256.c b/pbkdf2-hmac-sha256.c
index 448f676d858bced7729b6b6586837afc0d656068..e2318b059e331c4811cfbc96f6368e0cbef75f5b 100644
--- a/pbkdf2-hmac-sha256.c
+++ b/pbkdf2-hmac-sha256.c
@@ -32,10 +32,10 @@
 #include "hmac.h"
 
 void
-pbkdf2_hmac_sha256 (unsigned key_length, const uint8_t *key,
-		  unsigned iterations,
-		  unsigned salt_length, const uint8_t *salt,
-		  unsigned length, uint8_t *dst)
+pbkdf2_hmac_sha256 (size_t key_length, const uint8_t *key,
+		    unsigned iterations,
+		    size_t salt_length, const uint8_t *salt,
+		    size_t length, uint8_t *dst)
 {
   struct hmac_sha256_ctx sha256ctx;
 
diff --git a/pbkdf2.c b/pbkdf2.c
index 10e6bc20cd49582bc84af1be96d728c7c41e0d32..9a4e33a5b16824deae454fb37a8f3ef8838aabf9 100644
--- a/pbkdf2.c
+++ b/pbkdf2.c
@@ -41,9 +41,9 @@ void
 pbkdf2 (void *mac_ctx,
 	nettle_hash_update_func *update,
 	nettle_hash_digest_func *digest,
-	unsigned digest_size, unsigned iterations,
-	unsigned salt_length, const uint8_t *salt,
-	unsigned length, uint8_t *dst)
+	size_t digest_size, unsigned iterations,
+	size_t salt_length, const uint8_t *salt,
+	size_t length, uint8_t *dst)
 {
   TMP_DECL(U, uint8_t, NETTLE_MAX_HASH_DIGEST_SIZE);
   TMP_DECL(T, uint8_t, NETTLE_MAX_HASH_DIGEST_SIZE);
diff --git a/pbkdf2.h b/pbkdf2.h
index 41192e8a5f26c0acae7779e1a6e0f82381d9d7a5..1a47c5438c006c163ae6cbe3d4e3ef908d3af225 100644
--- a/pbkdf2.h
+++ b/pbkdf2.h
@@ -42,9 +42,9 @@ void
 pbkdf2 (void *mac_ctx,
 	nettle_hash_update_func *update,
 	nettle_hash_digest_func *digest,
-	unsigned digest_size, unsigned iterations,
-	unsigned salt_length, const uint8_t *salt,
-	unsigned length, uint8_t *dst);
+	size_t digest_size, unsigned iterations,
+	size_t salt_length, const uint8_t *salt,
+	size_t length, uint8_t *dst);
 
 #define PBKDF2(ctx, update, digest, digest_size,			\
 	       iterations, salt_length, salt, length, dst)		\
@@ -59,16 +59,16 @@ pbkdf2 (void *mac_ctx,
 /* PBKDF2 with specific PRFs. */
 
 void
-pbkdf2_hmac_sha1 (unsigned key_length, const uint8_t *key,
+pbkdf2_hmac_sha1 (size_t key_length, const uint8_t *key,
 		  unsigned iterations,
-		  unsigned salt_length, const uint8_t *salt,
-		  unsigned length, uint8_t *dst);
+		  size_t salt_length, const uint8_t *salt,
+		  size_t length, uint8_t *dst);
 
 void
-pbkdf2_hmac_sha256 (unsigned key_length, const uint8_t *key,
+pbkdf2_hmac_sha256 (size_t key_length, const uint8_t *key,
 		    unsigned iterations,
-		    unsigned salt_length, const uint8_t *salt,
-		    unsigned length, uint8_t *dst);
+		    size_t salt_length, const uint8_t *salt,
+		    size_t length, uint8_t *dst);
 
 #ifdef __cplusplus
 }