]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - tools/ubsha1.c
sf: winbond: add support W25Q64 parts
[karo-tx-uboot.git] / tools / ubsha1.c
index bc877606d2ffc36ff021d6c81653bc2c6b9da6a7..625e13f90c75c91afeba0eed29051a2ab920290e 100644 (file)
  * 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"
 
-#ifndef __ASSEMBLY__
-#define        __ASSEMBLY__            /* Dirty trick to get only #defines     */
-#endif
-#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)
 {
        unsigned char output[20];
@@ -84,7 +66,7 @@ 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);
@@ -93,12 +75,11 @@ int main (int argc, char **argv)
                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");
@@ -109,7 +90,7 @@ int main (int argc, char **argv)
                                cmdname, imagefile, strerror(errno));
                        exit (EXIT_FAILURE);
                }
-       
+
                free (data);
                (void) munmap((void *)ptr, len);
                (void) close (ifd);