Merge branch 'master' of github.com:r0ket/r0ket

This commit is contained in:
Stefan `Sec` Zehl 2011-08-07 01:44:57 +02:00
commit b977665f0f
11 changed files with 54 additions and 21 deletions

View File

@ -256,6 +256,10 @@ static void reset_area() {
} }
} }
#ifdef SIMULATOR
extern uint32_t getRandom(void);
#endif
static void random_area(struct bitset *area, uchar x0, uchar y0, uchar x1, uchar y1,uchar value) { static void random_area(struct bitset *area, uchar x0, uchar y0, uchar x1, uchar y1,uchar value) {
for(uchar x=x0; x<=x1; ++x) { for(uchar x=x0; x<=x1; ++x) {
for(uchar y=y0; y<=y1; ++y) { for(uchar y=y0; y<=y1; ++y) {

View File

@ -62,7 +62,9 @@ typedef unsigned char byte_t;
#endif #endif
// Save some space // Save some space
#ifndef SIMULATOR
#define memcpy memmove #define memcpy memmove
#endif
#endif #endif

View File

@ -52,6 +52,8 @@ for i in `find firmware -type f -name .gitignore`; do
echo OK $i and simulat0r/$i are the same echo OK $i and simulat0r/$i are the same
else else
echo WARNING: $i mismatches simulat0r/$i echo WARNING: $i mismatches simulat0r/$i
diff -y $i simulat0r/$i echo " give this command a try if the following diff looks reasonable:"
echo " cp $i simulat0r/$i"
diff -y $i simulat0r/$i || true
fi fi
done done

View File

@ -6,3 +6,4 @@ lcd/allfonts.h
Makefile.dep Makefile.dep
table.c table.c
table.h table.h
SECRETS.release

View File

@ -0,0 +1,17 @@
#ifndef _SECRETS_
#define _SECRETS_
// these keys are not the official keys
// they´re just here to make the simulat0r build
static uint32_t const meshkey[4] = {
0x01010101, 0x02020202, 0x03030303, 0x04040404
};
static const uint32_t openbeaconkey[4] = {
0x05050505, 0x06060606, 0x07070707, 0x08080808
};
static uint32_t const remotekey[4] = {
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff
};
#endif

View File

@ -6,6 +6,7 @@
#undef main_default #undef main_default
int lcdInitConfig() { int lcdInitConfig() {
return 0;
} }
void main_default() { void main_default() {

View File

@ -53,6 +53,7 @@ void gpioIntDisable (uint32_t portNum, uint32_t bitPos) {
uint32_t gpioIntStatus (uint32_t portNum, uint32_t bitPos) { uint32_t gpioIntStatus (uint32_t portNum, uint32_t bitPos) {
printf("uint32_t gpioIntStatus (uint32_t portNum, uint32_t bitPos)\n"); printf("uint32_t gpioIntStatus (uint32_t portNum, uint32_t bitPos)\n");
return 0;
} }
void gpioIntClear (uint32_t portNum, uint32_t bitPos) { void gpioIntClear (uint32_t portNum, uint32_t bitPos) {

View File

@ -2,3 +2,6 @@
*.bin *.bin
usetable.h usetable.h
loadable.ld loadable.ld
*.nik
*.c0d
*.int

View File

@ -12,12 +12,6 @@ The following symbols were found to be defined within glibc.
Use different names within simulat0r to keep the firmware and simulat0r-host universes collision-free. Use different names within simulat0r to keep the firmware and simulat0r-host universes collision-free.
*/ */
#define buf __r0ket_buf #define buf __r0ket_buf
#define deselect __r0ket_deselect
#define ECIES_embedded_public_key_validation __r0ket_ECIES_embedded_public_key_validation
#define ECIES_generate_key_pair __r0ket_ECIES_generate_key_pair
#define ECIES_public_key_validation __r0ket_ECIES_public_key_validation
#define f_sync __r0ket_f_sync
#define getInput __r0ket_getInput
#define isalnum __r0ket_isalnum #define isalnum __r0ket_isalnum
#define isalpha __r0ket_isalpha #define isalpha __r0ket_isalpha
#define isascii __r0ket_isascii #define isascii __r0ket_isascii
@ -55,4 +49,3 @@ Use different names within simulat0r to keep the firmware and simulat0r-host uni
#define vprintf __r0ket_vprintf #define vprintf __r0ket_vprintf
#define vsnprintf __r0ket_vsnprintf #define vsnprintf __r0ket_vsnprintf
#define vsprintf __r0ket_vsprintf #define vsprintf __r0ket_vsprintf
#define XTEA_init_key __r0ket_XTEA_init_key

View File

@ -49,10 +49,11 @@ def copy(count, target, dir):
while len(flashed) != count: while len(flashed) != count:
filelist = [] filelist = []
try: while len(filelist) != count:
filelist = os.listdir(target) try:
except: filelist = os.listdir(target)
pass except:
pass
oldflashed = flashed oldflashed = flashed
flashed = [] flashed = []
for x in oldflashed: for x in oldflashed:
@ -67,8 +68,13 @@ def copy(count, target, dir):
time.sleep(0.3) time.sleep(0.3)
print "mkdir", "/tmp/r0ket/"+device print "mkdir", "/tmp/r0ket/"+device
os.mkdir("/tmp/r0ket/"+device) os.mkdir("/tmp/r0ket/"+device)
print "mount "+target+device+" "+"/tmp/r0ket/"+device print "mount -t vfat "+target+device+" "+"/tmp/r0ket/"+device
os.system("mount -t vfat "+target+device+" "+"/tmp/r0ket/"+device) x = 1
while x != 0:
x = os.system("mount -t vfat "+target+device+" "+"/tmp/r0ket/"+device)
print "returned", x
if x != 0:
time.sleep(5)
os.system("../tools/crypto/generate-keys") os.system("../tools/crypto/generate-keys")
#for file in filestocopy: #for file in filestocopy:
print "cp "+dir+"/* /tmp/r0ket/"+device print "cp "+dir+"/* /tmp/r0ket/"+device
@ -87,6 +93,7 @@ def copy(count, target, dir):
os.system("touch /tmp/r0ket/"+mount+"/flashed.cfg") os.system("touch /tmp/r0ket/"+mount+"/flashed.cfg")
print "sync" print "sync"
os.system("sync") os.system("sync")
time.sleep(1)
print "umount /tmp/r0ket/"+mount print "umount /tmp/r0ket/"+mount
os.system("umount /tmp/r0ket/"+mount) os.system("umount /tmp/r0ket/"+mount)
print "rm /tmp/r0ket/"+mount print "rm /tmp/r0ket/"+mount
@ -95,12 +102,14 @@ def copy(count, target, dir):
print "rm /tmp/r0ket" print "rm /tmp/r0ket"
os.rmdir("/tmp/r0ket") os.rmdir("/tmp/r0ket")
os.system("umount /tmp/r0ket/*")
os.system("rm /tmp/r0ket -rf")
os.system("rm /dev/r0ketflash/*")
while True: while True:
raw_input("Flashed firmware.\nNow cycle power and press enter.") raw_input("Flashed firmware.\nNow cycle power and press enter.")
flash(8, "/dev/lpcflash/", "initial.bin") flash(9, "/dev/lpcflash/", "initial.bin")
raw_input("Flashed bootstrap firmware.\nNow cycle power and press enter.") raw_input("Flashed bootstrap firmware.\nNow cycle power and press enter.")
copy(8, "/dev/r0ketflash/","files") copy(9, "/dev/r0ketflash/","files")
flash(8, "/dev/lpcflash/", "final.bin") flash(9, "/dev/lpcflash/", "final.bin")

View File

@ -392,7 +392,7 @@ void ECIES_generate_key_pair(void) /* generate a public/private key pair */
//printf("Here is your new public/private key pair:\n"); //printf("Here is your new public/private key pair:\n");
bitstr_to_hex(buf, x); bitstr_to_hex(buf, x);
//printf("Public key: %s:", bufptr); //printf("Public key: %s:", bufptr);
FILE* f = fopen("pubx.key", "w"); FILE* f = fopen("files/pubx.key", "w");
if( f == NULL ){ if( f == NULL ){
printf("error opening pubx.key\n"); printf("error opening pubx.key\n");
while(1); while(1);
@ -402,7 +402,7 @@ void ECIES_generate_key_pair(void) /* generate a public/private key pair */
bitstr_to_hex(buf, y); bitstr_to_hex(buf, y);
//printf("%s\n", bufptr); //printf("%s\n", bufptr);
f = fopen("puby.key", "w"); f = fopen("files/puby.key", "w");
if( f == NULL ){ if( f == NULL ){
printf("error opening puby.key\n"); printf("error opening puby.key\n");
while(1); while(1);
@ -413,7 +413,7 @@ void ECIES_generate_key_pair(void) /* generate a public/private key pair */
bitstr_to_hex(buf, k); bitstr_to_hex(buf, k);
//printf("Private key: %s\n", bufptr); //printf("Private key: %s\n", bufptr);
f = fopen("priv.key", "w"); f = fopen("files/priv.key", "w");
if( f == NULL ){ if( f == NULL ){
printf("error opening priv.key\n"); printf("error opening priv.key\n");
while(1); while(1);