CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Code proctection and firmware updates?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Trampas



Joined: 04 Sep 2004
Posts: 89
Location: NC

View user's profile Send private message MSN Messenger

Code proctection and firmware updates?
PostPosted: Sun Sep 26, 2004 8:43 am     Reply with quote

I am trying to figure out the best way to do code proctection and allow a firmware update.

First I have been reading the data sheets on the code protection bits, did anyone ever mention that Microchip data sheets are not clear? So here is what I can figure out:

The Code Protection bits (CPx) do not allow external read and writes of the program memory.

The Write-Protect bits (WRTx) do not allow program to write to program memory.

The External Block Table Read Bit (EBTRx) do not allow a block of program memory to be read from outside of it's block.

So I was thinking that I will need to set the CPx bits, but not WRTx and EBTRx bits. This way my loader can read/write program memory.

Now assuming that I have encryption of the data and that the encrypted updates are loaded into external flash memory. Then on power up the PIC checks external flash for vaild program. Then decrypts data and loads(program) into PIC. What is the risk that the program can be compromised? I am looking for a difficulty rating from 0-easy to 10-impossible, assuming my encryption algorithm is 128-bit encryption. With the keys stored in program memory with the bootloader.

Basically I am looking for something that will take cost more than $10k to crack. Heck for $10k I would consider selling the code. Is the CPx bits relativly secure?

Thanks
Trampas
Yashu



Joined: 08 Oct 2003
Posts: 26

View user's profile Send private message

Re: Code proctection and firmware updates?
PostPosted: Tue Sep 28, 2004 5:59 pm     Reply with quote

Trampas wrote:
I am trying to figure out the best way to do code proctection and allow a firmware update.

First I have been reading the data sheets on the code protection bits, did anyone ever mention that Microchip data sheets are not clear? So here is what I can figure out:

The Code Protection bits (CPx) do not allow external read and writes of the program memory.

The Write-Protect bits (WRTx) do not allow program to write to program memory.

The External Block Table Read Bit (EBTRx) do not allow a block of program memory to be read from outside of it's block.

So I was thinking that I will need to set the CPx bits, but not WRTx and EBTRx bits. This way my loader can read/write program memory.

Now assuming that I have encryption of the data and that the encrypted updates are loaded into external flash memory. Then on power up the PIC checks external flash for vaild program. Then decrypts data and loads(program) into PIC. What is the risk that the program can be compromised? I am looking for a difficulty rating from 0-easy to 10-impossible, assuming my encryption algorithm is 128-bit encryption. With the keys stored in program memory with the bootloader.

Basically I am looking for something that will take cost more than $10k to crack. Heck for $10k I would consider selling the code. Is the CPx bits relativly secure?

Thanks
Trampas


Protection bits work OK. I do exactly what you plan on doing...except, the 128-bit encryption. I use simple "z-1" xor/and type of recursive algorithm. It's only to keep honest people honest.

If they want to try to reverse engineer my op-code,... go right ahead... personally, I feel it's easier to just write your own code instead of leeching on some elses'... esp. if there's no comments and it's in assembly.
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

Re: Code proctection and firmware updates?
PostPosted: Tue Sep 28, 2004 6:26 pm     Reply with quote

Yashu wrote:

If they want to try to reverse engineer my op-code,... go right ahead... personally, I feel it's easier to just write your own code instead of leeching on some elses'... esp. if there's no comments and it's in assembly.


Reverse-engineering the code that was compiled from a C source is not very easy, especially if the code is big and especially if the code is compiled by CCS.
I thought about encrypting the code once but then I thought if those guys are smart enough to reverse-engineer my code successfully then they deserve to have it Very Happy
Yashu



Joined: 08 Oct 2003
Posts: 26

View user's profile Send private message

Re: Code proctection and firmware updates?
PostPosted: Tue Sep 28, 2004 6:32 pm     Reply with quote

[quote="Haplo"]
Yashu wrote:

I thought about encrypting the code once but then I thought if those guys are smart enough to reverse-engineer my code successfully then they deserve to have it Very Happy


touchee... and if they can reverse engineer it, they should call me too..... so I can hire them.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
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


Powered by phpBB © 2001, 2005 phpBB Group