diff --git a/lib_generic/md5.c b/lib_generic/md5.c
index 78ef47535e9a395cc0bd221d4fdd03844edcd6b8..a9aae4682f69d2ce07933e2a4018bc0c14c98102 100644
--- a/lib_generic/md5.c
+++ b/lib_generic/md5.c
@@ -27,6 +27,8 @@
 
 #ifndef USE_HOSTCC
 #include <common.h>
+#else
+#include <string.h>
 #endif /* USE_HOSTCC */
 #include <watchdog.h>
 #include <linux/types.h>
diff --git a/lib_generic/sha1.c b/lib_generic/sha1.c
index c8ef4d2827362af0a91953c0e2d06c0182e68c78..a192e5f3dd15308330ac40a8bef12a7346529eda 100644
--- a/lib_generic/sha1.c
+++ b/lib_generic/sha1.c
@@ -31,6 +31,8 @@
 
 #ifndef USE_HOSTCC
 #include <common.h>
+#else
+#include <string.h>
 #endif /* USE_HOSTCC */
 #include <watchdog.h>
 #include <linux/string.h>