CCP Security
How do I use CCP Security?
The following is a simple example of how to set up a model with CAN Calibration Protocol (CCP) security. This example uses PiSnoop as the calibration tool.
First, include in your model a pcp_CCPSecurity block:

key_validator
is the name of the key validator function and is described
in detail in the user guide ccp_seed_key_security_key_validator.
Here is the complete source code for key_validator.c:
#include "openecu.h"
BOOL key_validator(const U8 privilege_level, const U8 *const seed, const U8 *const key, const U8 key_size)
{
/* Ignore key_size, get 6 bytes in CCP v2.1 but only 4 typically relevant */
return (seed[0] == key[3] &&
seed[1] == key[2] &&
seed[2] == key[1] &&
seed[3] == key[0] );
}
In the model, this file will need to be added as custom code; e.g., in R2008b:

In PiSnoop, the workspace will need to be set up so that the CCP protocol has the seed/key enabled, e.g., using the ‘own code’ security option like this:




Doing all this, one can modify calibrations and reflash, but only with security turned on.
For further information, see the user guide ccp_seed_key_security_overview. If you have further questions, feel free to contact OpenECU support.