* Derived from cryptoapi implementation, originally based on the
* public domain implementation written by Colin Plumb in 1993.
*
+ * Reduced object size by around 50% compared to the original Linux
+ * version for use in Etherboot by Michael Brown.
+ *
* Copyright (c) Cryptoapi developers.
* Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
+ * Copyright (c) 2006 Michael Brown <mbrown@fensystems.co.uk>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
#include <string.h>
#include <byteswap.h>
#include <gpxe/crypto.h>
+#include <gpxe/md5.h>
#define MD5_DIGEST_SIZE 16
#define MD5_BLOCK_WORDS 16
6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21
};
-static const u32 k[] = {
+static const u32 k[64] = {
0xd76aa478UL, 0xe8c7b756UL, 0x242070dbUL, 0xc1bdceeeUL,
0xf57c0fafUL, 0x4787c62aUL, 0xa8304613UL, 0xfd469501UL,
0x698098d8UL, 0x8b44f7afUL, 0xffff5bb1UL, 0x895cd7beUL,
0x655b59c3UL, 0x8f0ccc92UL, 0xffeff47dUL, 0x85845dd1UL,
0x6fa87e4fUL, 0xfe2ce6e0UL, 0xa3014314UL, 0x4e0811a1UL,
0xf7537e82UL, 0xbd3af235UL, 0x2ad7d2bbUL, 0xeb86d391UL,
- 0xe1f27f3aUL, 0xf5710fb0UL, 0xada0e5c4UL, 0x98e4c919UL
};
static void md5_transform(u32 *hash, const u32 *in)
static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
{
while (words--) {
- // __le32_to_cpus(buf);
+ le32_to_cpus(buf);
buf++;
}
}
static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
{
while (words--) {
- // __cpu_to_le32s(buf);
+ cpu_to_le32s(buf);
buf++;
}
}
}
struct digest_algorithm md5_algorithm = {
+ .name = "md5",
.context_len = sizeof ( struct md5_ctx ),
.digest_len = MD5_DIGEST_SIZE,
.init = md5_init,