Overview

Basic Functions:

  1. Key Generation:

    • Generate public and private keys using the mathematical properties of elliptic curves.

  2. Digital Signature:

    • Supported signature algorithm: ECDSA

    • ECC operation curve support:

      • Prime field curves: 192-256 bits

      • Montgomery Curves: Curve25519

  3. Key Exchange: Supports ECDH.

  4. OTP Key Port (only for ECDSA public key generation/signing)

    • Physically irreversible writing

    • Physical architecture isolation (OTP key directly connected to ECC engine, preventing bus sniffing attacks)

Driver Architecture:

  • The ECC hardware encryption engine is a security chip module dedicated to digital signature algorithms, implementing cryptographic operations directly through hardware circuits. It adopts physical protection mechanisms to ensure key security and can improve computational efficiency compared to software solutions.

  • The ECC software is responsible for parsing upper-layer protocols and command scheduling, while the hardware layer completes core encryption computation tasks through specially designed circuits. The software layer architecture is shown in the following diagram:

../../_images/crypto_lite_driver_arch.svg

ECDSA OTP Keys

The ECDSA engine can download private keys in two ways:

  • Users pass the private key to the API, which then writes it into the ECDSA register.

  • ECDSA automatically downloads the ECDSA OTP key.

The OTP physical mapping can store two private keys for ECDSA use, which can only be accessed through ECDSA triggering and cannot be tampered with or read. The prerequisite is that the private keys need to be pre-burned into the OTP physical mapping.

OTP Key

Address

Size

Default Value

Description

ECDSA_PRI_KEY1

Physical mapping 0x280

32 bytes

0xFF each byte

If OTPKEY=1, load this key to ECDSA engine as private key

ECDSA_PRI_KEY2

Physical mapping 0x2A0

32 bytes

0xFF each byte

If OTPKEY=2, load this key to ECDSA engine as private key

ECDSA_PRI_KEY1_Read_Protection

Physical mapping 0x366[2]

1 bit

1

0: Enable ECDSA Key1 read protection, prohibit key reading

1: Disable ECDSA Key1 read protection

ECDSA_PRI_KEY1_Write_Protection

Physical mapping 0x366[3]

1 bit

1

0: Enable ECDSA Key1 write protection, prohibit hackers from writing key to all 0s

1: Disable ECDSA Key1 write protection

ECDSA_PRI_KEY2_Read_Protection

Physical mapping 0x366[4]

1 bit

1

0: Enable ECDSA Key2 read protection, prohibit key reading

1: Disable ECDSA Key2 read protection

ECDSA_PRI_KEY2_Write_Protection

Physical mapping 0x366[5]

1 bit

1

0: Enable ECDSA Key2 write protection, prohibit hackers from writing key to all 0s

1: Disable ECDSA Key2 write protection

Usage

  1. Hardware interface characteristics: Only supports Slave mode, connected to the CPU via APB bus.

  2. Operation process:

    • CPU first acquires the mutex

    • Writes algorithm parameters to the engine storage unit

    • Sets the control register to select the operation mode

    • Enables the engine to start calculation

    • Polls the status register to monitor progress

    • Upon detecting the end flag

    • Reads the calculation result from the storage unit

    • Releases the mutex

  3. Exception handling mechanism

    • Error identification

      • Status register contains error flag bits

      • Immediately terminates the process when an error is detected during polling

    • Error feedback

      • API returns predefined error codes (non-zero values)

      • Returns status code 0 for normal completion

API

Realtek provides low-level APIs, users do not need to concern themselves with specific register operation methods and processes. Additionally, for better adaptability, Realtek has integrated the hardware acceleration engine into the MbedTLS API. MbedTLS ECDSA API only supports Software keys. When using OTP keys, low-level APIs are required. Due to hardware limitations, Realtek has disabled MbedTLS support for the SECP521R1 curve. The following commonly used curve parameters are currently built into the ROM:

  • SECP256R1

  • SECP224R1

  • SECP192R1

  • SECP256K1

  • SECP224K1

  • SECP192K1

  • BP256R1

  • CURVE25519