Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

XTEA, Bootloader and AVRDOS

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
Alex20q90

Bascom Member



Joined: 24 Sep 2007
Posts: 89

germany.gif
PostPosted: Fri Apr 03, 2015 5:44 pm    Post subject: XTEA, Bootloader and AVRDOS Reply with quote

Hello,

i have a "little" Problem:

I try to buld a bootloader for a AT90CAN128 attached with a SD-Card. Without key i can now flash my new file and work.

I would make a encrypted .bin-File with the $XTEAKEY. How i have to decode the .bin-File by my bootloader?



Code:

Writepage:
   Print #1 , "." ;
   For J = 1 To 128 Step 2                                  ' we write 2 bytes into a page
      Vl = Buf(j) : Vh = Buf(j + 1)                         ' get Low and High bytes

      If Crypt = 1 Then
        Vl = Decrypt_table(vl) : Vh = Decrypt_table(vh)     ' <---------------------------------    here in "Vl" and "Vh" i have to put the decryptet Byte. How i have to decrypt it first? The "Decrypt_table" was a test but dont work!
      End If

      Spmcrval = 1 : Gosub Do_spm                           ' write value into page at word address
      Wrd = Wrd + 2                                         ' word address increases with 2 because LS bit of Z is not used
      If Wrd = Maxword Then
          Wrd = 0                                           ' Z pointer needs wrd to be 0
          Spmcrval = 5 : Gosub Do_spm                       ' write page
          Spmcrval = 17 : Gosub Do_spm                      ' re-enable page

          Page = Page + 1                                   ' next page

          If Page <= Maxpages Then                          ' avoid to erase first page of bootlaoder

             Spmcrval = 3 : Gosub Do_spm                    ' erase  next page
             Spmcrval = 17 : Gosub Do_spm                   ' re-enable page

          End If

      End If
   Next
Return
 


Thanks, Alex!

(BASCOM-AVR version : 2.0.7.8 )
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4966
Location: Holland

blank.gif
PostPosted: Fri Apr 03, 2015 9:27 pm    Post subject: Reply with quote

it is simple :

Writepage:
Xteadecode Buf(1) , Key(1) , 128
'rest of code

_________________
Mark
Back to top
View user's profile Visit poster's website
Alex20q90

Bascom Member



Joined: 24 Sep 2007
Posts: 89

germany.gif
PostPosted: Sat Apr 04, 2015 7:00 pm    Post subject: Reply with quote

whoops? Thanks i will try it!
So easy...

Best regards
Alex
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum