Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
- MeshCore-based Simple Sensor firmware - Heltec T114 without display - BME280 sensor support (temp/humidity/pressure) - Radio: 868.856018 MHz, SF7, BW62.5 kHz, CR4/7 - 2-byte path hash - PlatformIO project
32 lines
828 B
C
32 lines
828 B
C
#include "ed_25519.h"
|
|
#include "sha512.h"
|
|
#include "ge.h"
|
|
#include "sc.h"
|
|
|
|
|
|
void ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key, const unsigned char *private_key) {
|
|
sha512_context hash;
|
|
unsigned char hram[64];
|
|
unsigned char r[64];
|
|
ge_p3 R;
|
|
|
|
|
|
sha512_init(&hash);
|
|
sha512_update(&hash, private_key + 32, 32);
|
|
sha512_update(&hash, message, message_len);
|
|
sha512_final(&hash, r);
|
|
|
|
sc_reduce(r);
|
|
ge_scalarmult_base(&R, r);
|
|
ge_p3_tobytes(signature, &R);
|
|
|
|
sha512_init(&hash);
|
|
sha512_update(&hash, signature, 32);
|
|
sha512_update(&hash, public_key, 32);
|
|
sha512_update(&hash, message, message_len);
|
|
sha512_final(&hash, hram);
|
|
|
|
sc_reduce(hram);
|
|
sc_muladd(signature + 32, hram, private_key, r);
|
|
}
|