Suppose the following scenario:
- There is a binary image of some application, for a microcontroller (to avoid stirring this towards ELF / PE format problems, anyway, my particular related problem is a microcontroller project).
- This binary image is protected by CRC (to detect errors in it, no cryptographic concerns).
- I want to have a section it which can be replaced later (for example using a bootloader), without affecting the CRC.
The problem is solveable, an example for CRC32 follows:
- Inner stream 1: 0x49 0xA3 0x45 0xEF => CRC32: 0xA1DD6F3B
- Inner stream 2: 0xAD 0x33 0x10 0x86 => CRC32: 0xF6717149
- Binary 1: 0x11 0x49 0xA3 0x45 0xEF 0x3B 0x6F 0xDD 0xA1 0x22 => 0xDEAD20F7
- Binary 2: 0x11 0xAD 0x33 0x10 0x86 0x49 0x71 0x71 0xF6 0x22 => 0xDEAD20F7
That is, embedding a block of data with CRC32 within another one having a CRC32, the inner block can be replaced without affecting the outer CRC (this relates to that performing the CRC calculation on the block with the CRC included, you get the same "magic value": 0xDEBB20E3, or complemented as could be seen in a CRC calculator: 0x2144DF1C).
I think this inclusion shouldn't affect the performance (error detecting capability) of CRC, neither in any part of the outer block or the inner block (if I checked it only by the outer CRC, naturally the inner block checked by its own CRC can't be affected), however I am not entirely sure.
(Of course the inner block won't get any improvement in its error detection by the outer CRC as when an undetectable fault by the inner CRC happens in it, that means it yields the same "magic value", thus also defeating the outer CRC's capability to detect an error in it)
So the question is, if CRC is used in this manner, whether parts of the outer block (or the inner block if only checked by the outer CRC) would suffer any degradation in the performance of error detection.
the inner block [doesn't benefit from] the outer CRC
I doubt this holds with different polynomials – greybeard=> 0xDEAD20F7
mean? What is"magic value": 0xDEBB20E3
and how did you get that? – Lundin