Is it possible to force the compiler (with a directive or something) to store a specific part of the code in a predefined area in the memory? What I want to do is to be able to calculate a checksum of some specific functions in my code, so I later can prove that they are unchanged since the last build. My thought is that if I know in which memory area these functions are located then I can simply calculate a checksum of this area. Any ideas, someone?
Ok, I shall try to explain my problem. At my company, we have some products to which we release new firmware up to four times per year. However, there is a part of the code functionality that is associated with legislation, and this part of the functionality (code) has to be certified against authority. When we deliver a firmware, the regulation says that we must be able to show that the code has the same checksum as the one we used for certification. That is a big problem for us; because we have other features in our product, not dependent on regulations, that is continuously updated, this will change the checksum of the whole source code build. So my idea was if it is possible to in some way just calculate a checksum of the code parts associated to the legislated certification. I'm not trying to track errors or anything; I just want to be able to show that these code parts are unchanged since certification. Thanks for all answers so far… / Rasmus
I think you should design the certified part of the program as a separate binary chunk of code that doesn't need to be changed when you modify the rest of the application. This means that the binary chunk should always be located in the same memory area and it should have a clearly defined binary interface (code entry points, shared data structures) and execution environment so that the main application can communicate with it. Then checking the integrity of that binary code becomes straightforward. I'd also like to reiterate the point that a simple checksum doesn't guarantee that the code is unchanged. A cryptographically strong hash does. Regards, - mike