STDA045 November   2026 MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G1518 , MSPM0G1519 , MSPM0G3505 , MSPM0G3506 , MSPM0G3507 , MSPM0G3518 , MSPM0G3519

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2ED25519PH Algorithm Introduction
  6. 3MSPM0G Math Accelerator (MATHACL)
    1. 3.1 MATHACL Module
    2. 3.2 Multiply-Accumulate (MAC) Operation
  7. 4Accelerate the ED25519PH Algorithm by Using MATHACL
    1. 4.1 Loop Unrolled Implementation
      1. 4.1.1 Non-MATHACL Optimization
      2. 4.1.2 MATHACL Optimization
    2. 4.2 Loop Rolled Implementation
      1. 4.2.1 Non-MATHACL Optimization
      2. 4.2.2 MATHACL Optimization
    3. 4.3 Benchmark
  8. 5Summary
  9. 6References

ED25519PH Algorithm Introduction

Refer to the Libsodium library for an implementation of the ED25519PH algorithm. The performance of the ED25519PH digital signature scheme is primarily governed by high-speed large-integer arithmetic. Specifically, the algorithm requires frequent multiplications of 256-bit integer modules, a large prime (2255 - 19). On 32-bit architectures like the Arm Cortex-M0+, implementing wide-word arithmetic requires decomposing the 256-bit operands into smaller so called limbs.

There are two primary approaches for handling these multi-precision multiplications based on Radix Sort:

A. Radix-32 Implementation: The Radix-32 approach decomposes the large integer into 32-bit limbs. This method is highly versatile, as the logic can be easily scaled to support different bit-widths, such as 512-bit or 258-bit integers. The primary advantage of this implementation is the minimal code footprint, making the implementation preferred for memory-constrained environments. However, this implementation requires rigorous handling of overflows after every limb-wise operation to maintain mathematical integrity, which can impact runtime efficiency.

B. Radix-25.5 Implementation: An alternative approach, as detailed in Curve25519: New Diffie-Hellman Speed Records, utilizes a Radix-25.5 representation. In this method, the 255-bit number is represented by ten limbs, each occupying 25.5 bits of a 32-bit word. This specific bit-width allows intermediate products to overflow the 25.5-bit boundary without exceeding the 32-bit register capacity. This strategy effectively delays carry computations until a final stage, significantly speeding up the multiplication process. While loop-unrolling techniques make this method highly performant, the technique results in a substantially larger code size compared to the Radix-32 approach.

The implementation of the ED25519PH algorithm in this document is based on the Radix-25.5 approach, and the MATHACL in the MSPM0G devices can accelerate the frequent 32x32 to 64-bit multiplication and multiply-accumulate (MAC) operations in the algorithm.