diff --git a/ChangeLog b/ChangeLog
index 0416b59c082aca1374b52cace1172bb1acfe977f..e7dbb6122b64dcc4ece07a85cf6c8f9a05dcd568 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2022-08-05  Niels Möller  <nisse@lysator.liu.se>
 
+	* nettle-internal.h: Include stdlib.h, fix alloca warnings on BSD.
+	* hmac.c: Delete corresponding include here, no longer needed.
+
 	* getopt.c: Include stdlib.h and unistd.h unconditionally,
 	similarly to the gnulib version of this file.
 
diff --git a/hmac.c b/hmac.c
index 6ac5e11a0686eb8e6e818ef2486fb38279259d4f..ea35697025fd5cc81df24d7e2a8cb85a5206fb45 100644
--- a/hmac.c
+++ b/hmac.c
@@ -36,8 +36,6 @@
 #endif
 
 #include <assert.h>
-/* Needed for alloca on freebsd */
-#include <stdlib.h>
 #include <string.h>
 
 #include "hmac.h"
diff --git a/nettle-internal.h b/nettle-internal.h
index ddc483de23441ed4fda4451ef1f14452b5e43c3b..92416400b095c585d859a3897ea7d73e56d21709 100644
--- a/nettle-internal.h
+++ b/nettle-internal.h
@@ -36,6 +36,8 @@
 #define NETTLE_INTERNAL_H_INCLUDED
 
 #include <assert.h>
+/* Needed for alloca on bsd systems. */
+#include <stdlib.h>
 
 #include "nettle-meta.h"