* MA 02111-1307 USA
*/
+#include "os_support.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
-#include <sys/mman.h>
#include <sys/stat.h>
#include "sha1.h"
#include <config.h>
#undef __ASSEMBLY__
-#ifndef O_BINARY /* should be define'd on __WIN32__ */
-#define O_BINARY 0
-#endif
-
-#ifndef MAP_FAILED
-#define MAP_FAILED (-1)
-#endif
-
-extern int errno;
-
extern void sha1_csum (unsigned char *input, int ilen, unsigned char output[20]);
int main (int argc, char **argv)
cmdname, imagefile, strerror(errno));
exit (EXIT_FAILURE);
}
-
+
/* create a copy, so we can blank out the sha1 sum */
data = malloc (len);
memcpy (data, ptr, len);
for (i = 0; i < SHA1_SUM_LEN; i++) {
ptroff[i] = 0;
}
-
+
sha1_csum ((unsigned char *) data, len, (unsigned char *)output);
printf ("U-Boot sum:\n");
- for (i = 0; i < 20 ; i++)
- {
+ for (i = 0; i < 20 ; i++) {
printf ("%02X ", output[i]);
}
printf ("\n");
cmdname, imagefile, strerror(errno));
exit (EXIT_FAILURE);
}
-
+
free (data);
(void) munmap((void *)ptr, len);
(void) close (ifd);