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
41 lines
645 B
C
41 lines
645 B
C
#include "ed_25519.h"
|
|
|
|
#ifndef ED25519_NO_SEED
|
|
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#include <wincrypt.h>
|
|
#else
|
|
#include <stdio.h>
|
|
#endif
|
|
|
|
int ed25519_create_seed(unsigned char *seed) {
|
|
#ifdef _WIN32
|
|
HCRYPTPROV prov;
|
|
|
|
if (!CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
|
|
return 1;
|
|
}
|
|
|
|
if (!CryptGenRandom(prov, 32, seed)) {
|
|
CryptReleaseContext(prov, 0);
|
|
return 1;
|
|
}
|
|
|
|
CryptReleaseContext(prov, 0);
|
|
#else
|
|
FILE *f = fopen("/dev/urandom", "rb");
|
|
|
|
if (f == NULL) {
|
|
return 1;
|
|
}
|
|
|
|
fread(seed, 1, 32, f);
|
|
fclose(f);
|
|
#endif
|
|
|
|
return 0;
|
|
}
|
|
|
|
#endif
|