#include <LzmaWrapper.h>
#include <environment.h>
#include <asm/byteorder.h>
+#include <tinf.h>
DECLARE_GLOBAL_DATA_PTR;
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
- if(crc32(0, (uchar *)data, len) != checksum){
+ if(tinf_crc32((uchar *)data, len) != checksum){
puts("## Error: bad header checksum!\n");
return 1;
}
puts(" Verifying checksum... ");
- if(crc32(0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)){
+ if(tinf_crc32((uchar *)data, len) != ntohl(hdr->ih_dcrc)){
puts("bad data CRC!\n");
return(1);
}
#include <environment.h>
#include <linux/stddef.h>
#include <malloc.h>
+#include <tinf.h>
DECLARE_GLOBAL_DATA_PTR;
#endif
void env_crc_update(void){
- env_ptr->crc = crc32(0, env_ptr->data, ENV_SIZE);
+ env_ptr->crc = tinf_crc32(env_ptr->data, ENV_SIZE);
}
static uchar env_get_char_init(int index){
#include <environment.h>
#include <linux/stddef.h>
#include <malloc.h>
+#include <tinf.h>
DECLARE_GLOBAL_DATA_PTR;
ulong addr1 = (ulong)&(flash_addr->data);
ulong addr2 = (ulong)&(flash_addr_new->data);
- crc1_ok = (crc32(0, flash_addr->data, ENV_SIZE) == flash_addr->crc);
- crc2_ok = (crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc);
+ crc1_ok = (tinf_crc32(flash_addr->data, ENV_SIZE) == flash_addr->crc);
+ crc2_ok = (tinf_crc32(flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc);
if(crc1_ok && !crc2_ok){
gd->env_addr = addr1;
#else /* ! CFG_ENV_ADDR_REDUND */
int env_init(void){
- if(crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc){
+ if(tinf_crc32(env_ptr->data, ENV_SIZE) == env_ptr->crc){
gd->env_addr = (ulong)&(env_ptr->data);
gd->env_valid = 1;
end_addr_new = ltmp;
}
- if(flash_addr_new->flags != OBSOLETE_FLAG && crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc){
+ if(flash_addr_new->flags != OBSOLETE_FLAG && tinf_crc32(flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc){
char flag = OBSOLETE_FLAG;
gd->env_valid = 2;
int sprintf(char * buf, const char *fmt, ...);
int vsprintf(char *buf, const char *fmt, va_list args);
-/* lib_generic/crc32.c */
-/* Hack: Forces compilation failure if must_be_zero is not zero. */
-#define crc32(must_be_zero, buf, len) \
- tinf_crc32(buf, len*(sizeof(char[1 - 2*!!(must_be_zero)])))
-uint tinf_crc32(const void *data, uint length);
-
/* common/console.c */
int console_init_f(void); /* Before relocation; uses the serial stuff */
int console_init_r(void); /* After relocation; uses the console stuff */
#include <version.h>
#include <net.h>
#include <environment.h>
+#include <tinf.h>
#include "LzmaWrapper.h"
//#define DEBUG_ENABLE_BOOTSTRAP_PRINTF
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
- if(crc32(0, (unsigned char *)data, len) != checksum){
+ if(tinf_crc32((unsigned char *)data, len) != checksum){
return;
}
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <tinf.h>
#ifndef __ASSEMBLY__
#define __ASSEMBLY__ /* Dirty trick to get only #defines */
#define ENV_SIZE (CFG_ENV_SIZE - ENV_HEADER_SIZE)
-extern unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
-
#ifdef ENV_IS_EMBEDDED
extern unsigned int env_size;
extern unsigned char environment;
*dataptr = envptr + ENV_HEADER_SIZE;
unsigned int datasize = ENV_SIZE;
- crc = crc32 (0, dataptr, datasize);
+ crc = tinf_crc32 (dataptr, datasize);
/* Check if verbose mode is activated passing a parameter to the program */
if (argc > 1) {
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
+#include <tinf.h>
#if defined(__BEOS__) || defined(__NetBSD__) || defined(__APPLE__)
#include <inttypes.h>
char *cmdname;
-#include <tinf.h>
-/* Hack: Forces compilation failure if must_be_zero is not zero. */
-#define crc32(must_be_zero, buf, len) \
- tinf_crc32(buf, len*(sizeof(char[1 - 2*!!(must_be_zero)])))
-
typedef struct table_entry {
int val; /* as defined in image.h */
char *sname; /* short (input) name */
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = htonl(0); /* clear for re-calculation */
- if (crc32 (0, data, len) != checksum) {
+ if (tinf_crc32 (data, len) != checksum) {
fprintf (stderr,
"*** Warning: \"%s\" has bad header checksum!\n",
imagefile);
data = (char *)(ptr + sizeof(image_header_t));
len = sbuf.st_size - sizeof(image_header_t) ;
- if (crc32 (0, data, len) != ntohl(hdr->ih_dcrc)) {
+ if (tinf_crc32 (data, len) != ntohl(hdr->ih_dcrc)) {
fprintf (stderr,
"*** Warning: \"%s\" has corrupted data!\n",
imagefile);
hdr = (image_header_t *)ptr;
- checksum = crc32 (0,
+ checksum = tinf_crc32 (
(const char *)(ptr + sizeof(image_header_t)),
sbuf.st_size - sizeof(image_header_t)
);
strncpy((char *)hdr->ih_name, name, IH_NMLEN);
- checksum = crc32(0,(const char *)hdr,sizeof(image_header_t));
+ checksum = tinf_crc32((const char *)hdr,sizeof(image_header_t));
hdr->ih_hcrc = htonl(checksum);