< OpenECU Support

How do I use CCP security?

The following is a simple example of how to set up a model with CCP security. This example uses OpenECU Calibrator as the calibration tool.

First, include in your model a pcp_CCPSecurity block:

ccp_sec_1.png

key_validator is the name of the key validator function and is described in detail in the user guide.

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:

ccp_sec_6.png

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

ccp_sec_2.png

ccp_sec_3.png

ccp_sec_4.png

ccp_sec_5.png

Doing all this, one can modify calibrations and reflash, but only with security turned on.

. If you have further questions, feel free to contact OpenECU support.

Copyright © 2022 OpenECU, All rights reserved