CAT2 Peripheral Driver Library
Crypto (Cryptography)

The Crypto driver provides a public API to perform cryptographic and hash operations, as well as generate both true and pseudo random numbers. More...

Modules

 Macros
 
 Enums
 
 Structures
 
 Functions
 

Detailed Description

The Crypto driver provides a public API to perform cryptographic and hash operations, as well as generate both true and pseudo random numbers.

It uses a hardware IP block to accelerate operations.

The functions and other declarations used in this driver are in cy_crypto.h. You can also include cy_pdl.h to get access to all functions and declarations in the PDL.

The Crypto driver supports these standards: AES (128, 192, and 256 bits), SHA (160, 224, and 256 bits hash), CRC (upto 32-bit), PRNG, and TRNG.

Configuration considerations

Firmware sets up a cryptographic operation by passing the required data as parameters in the function calls.

All Crypto functions require a context. A context is a data structure that the driver uses for its operations. Firmware declares a context (allocates memory), but does not write or read the values in that context. In effect, the context is a scratchpad you provide to the driver. The driver uses the context to store and manipulate the data during cryptographic operations.

Crypto functions are not thread-safe. Applications must use its own locking mechanism to ensure that functions in this driver are called by only one thread at a time.

Crypto TRNG and PRNG functions can execute in parallel with AES, SHA, and CRC functions.

Definitions

Term

Definition

Plaintext

An unencrypted message

Ciphertext

An encrypted message

Block cipher

An encryption function for fixed-size blocks of data. This function takes a fixed-size key and a block of plain text data from the message and encrypts it to generate the cipher text. Block ciphers are reversible. The function performed on a block of encrypted data will decrypt that data.

Block Cipher mode

A mode of encrypting a message using block ciphers for messages of an arbitrary length. The message is padded so that its length is an integer multiple of the block size. Electronic code book (ECB), cipher block chaining (CBC), and cipher feedback (CFB) are modes of using block ciphers to create an encrypted message of an arbitrary length.

Advanced Encryption Standard (AES)

The AES standard specifies the Rijndael algorithm, a symmetric block cipher that can process 128-bit data blocks using cipher keys with 128-, 192-, and 256-bit lengths. Rijndael was designed to handle additional block sizes and key lengths. However, they are not adopted in this standard. AES is also used for message authentication.

Secure Hash Algorithm (SHA)

A cryptographic hash function. This function takes a message of an arbitrary length and reduces it to a fixed-length residue or message digest after performing a series of mathematically defined operations that practically guarantee that any change in the message will change the hash value. It is used for message authentication by transmitting a message with a hash value appended to it and recalculating the message hash value using the same algorithm at the recipient's end. If the hashes differ, it indicates that the message is corrupted. For more information see Secure Hash standard description.

Pseudo Random Number Generator (PRNG)

An algorithm based on linear feedback shift registers for generating a sequence of numbers starting from a non-zero seed.

True Random Number Generator (TRNG)

A block that generates a number that is statistically random and based on some physical random variation. The number cannot be duplicated by running the process again.

Symmetric Key Cryptography

Uses a common, known key to encrypt and decrypt messages (a shared secret between the sender and the receiver). An efficient method used for encrypting and decrypting messages after the authenticity of the other party has been established. DES (now obsolete), 3DES, and AES (currently used) are well-known symmetric cryptography methods.

Changelog

VersionChangesReason for Change
1.0.1 Update the paths to the code snippets. PDL structure update.
1.0 Initial version