#include "x25519_handshake.hpp" #include #include #include extern "C" { #include "monocypher.h" } void x25519GenerateEphemeral(AppConfig &config){ FILE* f=fopen("/dev/urandom","rb"); if(!f)return; fread(config.ephemeralSec,1,32,f); fclose(f); crypto_x25519_public_key(config.ephemeralPub,config.ephemeralSec); std::memset(config.sharedSecret,0,32); config.haveSharedSecret=false; } void x25519ComputeShared(AppConfig &config,const uint8_t otherPub[32]){ uint8_t shared[32]; crypto_x25519(shared,config.ephemeralSec,otherPub); std::memcpy(config.sharedSecret,shared,32); config.haveSharedSecret=true; std::cout<