diff --git a/sha1.c b/sha1.c
index 90e7f2fd55d188922483586c744d8ae67047997e..8c044b71edf95c049a78a184f640115c29a2c780 100644
--- a/sha1.c
+++ b/sha1.c
@@ -40,6 +40,7 @@
 #include "macros.h"
 
 #include <assert.h>
+#include <stdlib.h>
 #include <string.h>
 
 /* A block, treated as a sequence of 32-bit words. */