From 019fa4ac88f394aa1b8325b277f2dd04b43d7352 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Fri, 5 Aug 2011 19:55:29 +0200 Subject: [PATCH] ENCRYPT. WE ARE APPLE! :-) --- firmware/.gitignore | 1 + firmware/SECRETS | 2 ++ firmware/getkey.pl | 23 +++++++++++++++++++++++ firmware/release-all | 20 ++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100755 firmware/getkey.pl diff --git a/firmware/.gitignore b/firmware/.gitignore index 5323c83..d2d2dd6 100644 --- a/firmware/.gitignore +++ b/firmware/.gitignore @@ -6,3 +6,4 @@ lcd/allfonts.h Makefile.dep table.c table.h +SECRETS.release diff --git a/firmware/SECRETS b/firmware/SECRETS index 3f5f8c2..3ea9057 100644 --- a/firmware/SECRETS +++ b/firmware/SECRETS @@ -1,6 +1,8 @@ #ifndef _SECRETS_ #define _SECRETS_ +#undef ENCRYPT_L0DABLE + static uint32_t const meshkey[4] = { 0x00000042, 0x000005ec, 0x00000023, 0x00000005 }; diff --git a/firmware/getkey.pl b/firmware/getkey.pl new file mode 100755 index 0000000..4611ed9 --- /dev/null +++ b/firmware/getkey.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl +# +# vim:set ts=4 sw=4: + +use strict; + +my $good; + +my $search=shift; + +open(F,"<","SECRETS") || die; + +while(){ + chomp;s///; + if($good){ + s/0x//g;y/ ,;//d; + print $_,"\n"; + exit; + }; + if(/$search/){ + $good=1; + }; +}; diff --git a/firmware/release-all b/firmware/release-all index 46d34be..e54b5c2 100755 --- a/firmware/release-all +++ b/firmware/release-all @@ -69,8 +69,28 @@ mv l0dable/*.c0d $TARG/files/ mv l0dable/*.int $TARG/files/ mv l0dable/*.nik $TARG/files/ +skey=`./getkey.pl l0dable_sign` +ekey=`./getkey.pl l0dable_crypt` + +if [ -z "$ekey" ] ; then + echo E-Key fail + exit 1 +fi + +if [ -z "$skey" ] ; then + echo S-Key fail + exit 1 +fi + +for a in $TARG/files/*.c0d $TARG/files/*.int $TARG/files/*.nik ; do + echo Crypting $a + ../tools/crypto/xxtea -e -k $ekey -s -k $skey $a +done + + echo "###" echo "### Done. Yay!" echo "###" git checkout SECRETS +git checkout filesystem/ffconf.h