.. ............................................................................ .. Project: OpenECU .. Version: $Id: $ .. File: $URL: $ .. Description: .. .. Copyright (C) 2023 Pi Innovo .. ............................................................................ .. _ccp_security: 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: .. image:: ccp_security_img1.jpg :alt: CCP Security 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: .. code-block:: 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: .. image:: ccp_security_img6.jpg :alt: Custom Code 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: .. image:: ccp_security_img2.jpg :alt: PiSnoop Workspace Setup .. image:: ccp_security_img3.jpg :alt: PiSnoop Workspace Setup .. image:: ccp_security_img4.jpg :alt: PiSnoop Workspace Setup .. image:: ccp_security_img5.jpg :alt: PiSnoop Workspace Setup 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.