CANcrypt FD Demo for NXP LPC54618,
by Embedded Systems Academy GmbH, August 2018.

The CANcrypt software in this distribution may be used freely on
NXP LPC546xx devices. When used on other devices or hardware,
a commercial license is required, contact us at
https://www.cancrypt.net for more information.

Unless required by applicable law or agreed to in writing, 
software distributed under the License is distributed on an 
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
either express or implied.

Overview
========
CANcrypt FD implements the CANcrypt grouping and secure messaging features of 
CANcrypt in a version optimized to support CAN FD. Three communication 
partners perform a secure grouping (based on shared symmetric key) with 
continous secure heartbeat to update the dyanmic key used and transmit and 
receive secure messages. After a timeout, communication stops and a last 
session key is saved. On next start, grouping is based on last saved session
key.

For more information, see: https://www.cancrypt.net
and security publications by Olaf Pfeiffer and Christian Keydel in the
2018 CAN newsletters: https://can-newsletter.org

Toolchain supported
===================
- Keil MDK 5.21a

Hardware requirements
=====================
- Micro USB cable
- CAN cable
- 3x LPCXpresso54618 CAN-FD kit (OM13094)
- Personal Computer

Board settings
==============
No special settings are required.

Prepare the Demo
================
Transfer the "CANcryptFD X Share Secret" programs 2, 3 and 7 into three
LPCXpresso54618 boards. Connect the CAN0 (upper connector) to appropriate
wiring (ensure proper termination). If you have a CAN monitor or analyzer, 
connect it too, and set it to a bit rate of 500/2000 kbps.

Running the demo
================
When boards are powered on, they use 0x017X CAN IDs to start the 
grouping process. Once grouped, a 500ms secure heartbeat sets in.
Secure messaging uses 0x018X and 0x038X CAN IDs. Messages are partially
or fully encrypted, last 8 bytes are always the CANcrypt security record.
Each secure message received is shared again by the receiver using
a 29bit CAN ID as follows: 0x1D0X0YYY where X is the device number the
message came from (2, 3 or 7) and YYY the CAN ID used by the original.
Data contents is decrypted and has no security record / overhead.

Customization options
=====================
See Cc_user_config.h for configurations. Changes in configurations must
be applied to all three devices!

Cc_FUNCTIONALITY can be set to 
  Cc_SECFCT_REGULAR:  using 64/128bit dynamic key, SPECK cipher
  Cc_SECFCT_ADVANCED: using 128bit dynamic key, AES
  
adapt Cc_KEY_LEN_BITS accordingly to 64 or 128


