Skip to content

Performance optimization advice for PIC18 (8-bit MCU) - 50 seconds for ECDSA signature #243

@anandhurajesh

Description

@anandhurajesh

System Details

  • Microcontroller: PIC18F27J53 (8-bit architecture, 3.8 KB RAM)
  • Compiler: Microchip XC8 (v3.10)
  • Clock Speed: 48 MHz
  • Curve Used: secp256r1

Current Configuration

I have configured uECC.h with the following macros for my 8-bit target:

  • #define uECC_WORD_SIZE 1
  • #define uECC_OPTIMIZATION_LEVEL 3
  • #define uECC_SUPPORT_COMPRESSED_POINT 0

The Problem

The total processing time to complete a signature calculation takes approximately 50 seconds.
By stepping through the code, I isolated the bottleneck to the core Montgomery Ladder loop inside EccPoint_mult():

for (i = num_bits - 2; i > 0; --i) {
    nb = !uECC_vli_testBit(scalar, i);
    XYcZ_addC(Rx[1 - nb], Ry[1 - nb], Rx[nb], Ry[nb], sub, curve);
    XYcZ_add(Rx[nb], Ry[nb], Rx[1 - nb], Ry[1 - nb], sub, curve);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions