Skip to main content
Version: Next

Ed25519

Ed25519 digital signatures (RFC 8032). Header: pkc/ed25519/noxtls_ed25519.h.

Algorithm overview​

Ed25519 is an EdDSA signature scheme over Curve25519. It is designed for high speed, deterministic signing, and strong security properties with compact keys/signatures.

Pros and cons​

Pros

  • Very fast verification/signing with small keys and signatures.
  • Deterministic signing avoids many nonce-generation failure classes.
  • Widely adopted across modern protocols and tooling.

Cons

  • Signature algorithm only (not key agreement).
  • Compatibility with legacy RSA/ECDSA-only systems can be limited.
  • Requires careful domain separation/protocol framing, like all signature schemes.

When to use​

  • Strong default for modern software signing and identity/authentication.
  • Good choice when performance and compact signatures matter.
  • Prefer when interoperability targets support Ed25519 natively.

Constants​

  • NOXTLS_ED25519_PRIVATE_KEY_SIZE = 32
  • NOXTLS_ED25519_PUBLIC_KEY_SIZE = 32
  • NOXTLS_ED25519_SIGNATURE_SIZE = 64

API​

noxtls_ed25519_generate_key​

noxtls_return_t noxtls_ed25519_generate_key(uint8_t private_key[32], uint8_t public_key[32]);

Generate private/public key pair.

noxtls_ed25519_public_key​

noxtls_return_t noxtls_ed25519_public_key(const uint8_t private_key[32], uint8_t public_key[32]);

Derive public key from private key seed.

noxtls_ed25519_sign​

noxtls_return_t noxtls_ed25519_sign(const uint8_t private_key[32],
const uint8_t *message,
uint32_t message_len,
uint8_t signature[64]);

Sign message with Ed25519.

noxtls_ed25519_verify​

noxtls_return_t noxtls_ed25519_verify(const uint8_t public_key[32],
const uint8_t *message,
uint32_t message_len,
const uint8_t signature[64]);

Verify Ed25519 signature.

Streaming verification​

Use the streaming form when the signed message arrives in pieces or should not be assembled in one contiguous buffer. The context retains the public key, signature, and SHA-512 state; it contains no private signing key.

noxtls_ed25519_verify_stream_ctx_t verify_ctx;

rc = noxtls_ed25519_verify_stream_init(&verify_ctx, public_key, signature);
if (rc == NOXTLS_RETURN_SUCCESS) {
rc = noxtls_ed25519_verify_stream_update(&verify_ctx, part_a, part_a_len);
}
if (rc == NOXTLS_RETURN_SUCCESS) {
rc = noxtls_ed25519_verify_stream_update(&verify_ctx, part_b, part_b_len);
}
if (rc == NOXTLS_RETURN_SUCCESS) {
rc = noxtls_ed25519_verify_stream_final(&verify_ctx);
}

noxtls_ed25519_verify_stream_final() returns NOXTLS_RETURN_SUCCESS only when the signature is valid. Do not call update() after final(); initialize a new context for another message.

noxtls_ed25519_verify_split​

noxtls_return_t noxtls_ed25519_verify_split(const uint8_t public_key[32],
const uint8_t *message_part_a,
uint32_t message_part_a_len,
const uint8_t *message_part_b,
uint32_t message_part_b_len,
const uint8_t signature[64]);

Convenience verification for exactly two consecutive message segments. It has the same validity result as verifying their concatenation.

Compact Tables in Read-Only Memory​

NOXTLS_ED25519_READONLY_SMALL_BASE is disabled by default. Enabling the CMake option selects the existing compact radix-16 implementation with its fixed-base and verify-odd tables stored as static const data. Direct compiler/configuration users must define both NOXTLS_ED25519_SMALL_BASE=1 and NOXTLS_ED25519_READONLY_SMALL_BASE=1.

The two tables contain 16 extended points and 16 odd Duif points. They occupy 4,480 bytes of read-only storage and replace 4,480 bytes of mutable tables plus eight bytes of initialization flags. Cortex-M33 GCC 14.2.1 at -Os measured 4,488 bytes less BSS and 4,016 bytes more code/read-only data for the group-arithmetic object because lazy initialization code is also removed. Whole-application sizes depend on linking and other features. No TLS buffer, stack or workspace size changes.

The generic default remains lazy multi-comb, and the compact lazy path remains available. Read-only tables require window width four, 16 odd points and slide magnitude 31; incompatible geometry fails compilation. Curve constants and variable-base verification still follow their existing implementation. This option does not add hardware acceleration.

tools/generate_ed25519_small_base.c regenerates every signed limb using the current in-house ge25519_base_table_small_init() and ge25519_base_odd_init() functions. Build it as a host tool together with the existing field, constant-time and memory modules; write its standard output to noxtls-lib/pkc/ed25519/noxtls_ed25519_small_readonly.inc. Do not enable the read-only option while generating. No TI implementation or external precomputed table is used.

The focused UTNox project is ut/ed25519_readonly. Configure it with NOXTLS_ERROR_UTNOX pointing to an existing UTNox source checkout. Both lazy and read-only profiles compare every table entry, full-width fixed-base multiplication and canonical verify double-scalar multiplication against independent binary double/add calculations. The existing ed25519_rfc8032_test additionally checks signatures, rejection and streaming behavior when building the library with the option enabled.