Constant-time (architecturally) implementation of X25519 Diffie-Hellman key exchange for Xtensa LX6 and LX7. Shipped as an ESP-IDF component. Tested with ESP-IDF v5.5.
#include <esp-x25519.h>
{
unsigned char secret_key[32] = {
0xd0, 0x66, 0x3c, 0xcc, 0xff, 0x48, 0x1c, 0x1d,
0x1d, 0x5a, 0xe6, 0x1d, 0xdb, 0x79, 0xb8, 0x8b,
0x05, 0x57, 0x14, 0x57, 0xcc, 0x17, 0x54, 0xa0,
0xf3, 0x54, 0xd6, 0x2e, 0xcb, 0x12, 0x42, 0x69
};
unsigned char public_key[32] = { 9 };
unsigned char shared_secret[32];
xtensa_curve25519(shared_secret, secret_key, public_key);
}