OpenCores
URL https://opencores.org/ocsvn/csa/csa/trunk

Subversion Repositories csa

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /csa/trunk/sw_sim
    from Rev 24 to Rev 34
    Reverse comparison

Rev 24 → Rev 34

/misc.h
1,4 → 1,5
 
#if 0
#define READ_DATA(a,n) \
do{ \
int i; \
13,33 → 14,32
} \
} \
}while(0)
#else
#define READ_DATA(a,n) \
do{ \
memset(a ,0,sizeof a); \
fread(a,1,n,stdin); \
}while(0)
#endif
 
#define WRITE_DATA(a,n) \
do { \
int i; \
for (i= n-1;i>=0;i--) \
{ \
if(a [i/8]&(1<<(i%8))) \
printf("1"); \
else \
printf("0"); \
} \
printf("\n"); \
fwrite(a,1,n,stdout); \
}while(0)
 
#define DEBUG_OUTPUT_ARR( a , n ) \
do{ \
int i; \
printf("%s:\n",#a); \
fprintf(stderr,"%s:\n",#a); \
for(i=n-1;i>=0;i--) \
{ \
printf("%x ",(a)[i]); \
fprintf(stderr,"%x ",(a)[i]);\
} \
printf("\n"); \
fprintf(stderr,"\n"); \
}while(0)
 
#define DEBUG_OUTPUT_VAL( a ) \
#define DEBUG_OUTPUT_VAL( a ) \
do{ \
printf(" %s=%x ",#a,a); \
printf("\n"); \
fprintf(stderr," %s=%x ",#a,a); \
fprintf(stderr,"\n"); \
}while(0)
/decrypt.c
12,11 → 12,11
unsigned char cws[16];
unsigned char encrypted[188];
unsigned char decrypted[188];
READ_DATA(cws,8*16);
READ_DATA(encrypted,188*8);
READ_DATA(cws,16);
READ_DATA(encrypted,188);
set_cws(cws,&key);
decrypt(&key,encrypted,decrypted);
DEBUG_OUTPUT_ARR(decrypted,64);
WRITE_DATA(decrypted,188*8);
WRITE_DATA(decrypted,188);
return 0;
}
/makefile
2,7 → 2,7
PROJ_NAME ?= decrypt
DEBUG ?=y
 
CFLAGS=-g -ggdb -ansi
CFLAGS=-g -ggdb -ansi -Wall
 
ifeq ($(DEBUG),y)
CFLAGS+=-DDEBUG
31,3 → 31,21
decrypt:csa.o decrypt.o
 
stream_cypher:csa.o stream_cypher.o
 
-include .depend
 
CSRCS= \
block_decypher.c \
csa.c decrypt.c \
get_key_perm_table.c \
key_perm.c \
key_schedule.c \
misc.c \
stream_cypher.c
 
depend:
rm -fr .depend
for f in $(CSRCS); \
do \
gcc -M -MM $$f>>.depend;\
done

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.