diff --git a/libavutil/md5.c b/libavutil/md5.c
index 844bcb0e8034eb43d62c46701dbab11ce690d6a3..82a2cffc220d3f6b1a820023575d16ed876f1a57 100644
--- a/libavutil/md5.c
+++ b/libavutil/md5.c
@@ -69,7 +69,11 @@ static const uint32_t T[64] = {
         }\
         a = b + (( a << t ) | ( a >> (32 - t) ));
 
+#ifdef WORDS_BIGENDIAN
+static void body(uint32_t ABCD[4], uint32_t X[16]){
+#else
 static void body(uint32_t ABCD[4], const uint32_t X[16]){
+#endif
     int t;
     int i attribute_unused;
     unsigned int a= ABCD[3];