LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Verify source code integrity

Hello,

Currently, I'm using a generic CRC-generation software to verify the integrity the source code.

Basically this is how it works: After the executable file is built, I generate a CRC value for the exe file. If I re-build the program, and there is no change in the source code, I should get the same CRC value every time.

This method works on Visual C and other compilers. However, with CVI, eventhough there is no change to the code, I keept getting different CRC value every time I re-build the exe file.

I suspect CVI may generate a timestamp every time the exe is rebuilt, thus result in a different in the CRC generation.

Please let me know your advice or solution on this issue.

Thanks,
Hien Pham
Test Engineer
0 Kudos
Message 1 of 4
(3,693 Views)
Hien,

When you build an exe in CVI it actually sets the file attributes with the creatin date of the file. This simple change of the file would cause a different CRC.

You may want to give a try to generate object files and perform the checking in obj files. I am not sure whether CVI will generate time stamps, but you may want to give this a try. Open the C file, select "Options>>Create Object File...".

I hope this helps.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 2 of 4
(3,693 Views)

Hello,

Even I need to calculate and do the integrity check on my application files everytime it is launched.Can somone please share me the sample code for the same.

 

 

0 Kudos
Message 3 of 4
(3,217 Views)

You say you're trying to verify the integrity of the source code, but then you check the executable code?

 

Maybe what you meant was that you want to verify that possibly different source files generate the same executable.

 

This is an old topic, you can try searching the knowledge base or the forum and you'll find a couple of threads on this issue.  As I recall, with CVI, you're not guaranteed to generate the same binary executable signature, even if the same source code is used and all of the build / compile settings are the same.  I wouldn't bet that the .obj files are the same either, but they might be.

 

I wouldn't have thought that Visual Studio would guarantee identical .exe files either but maybe it does.

 

We used to do this in the old days with minicomputer systems, but for the last many years with PC's I've never counted on being able to compare CRC's on an executable file as proof of identical code.

0 Kudos
Message 4 of 4
(3,177 Views)