delete[] optE.value().v.pk;
}
}
+ UDPC_ctx->_contextIdentifier = 0;
delete UDPC_ctx;
}
}
if(!c) {
return 0;
}
- return c->isAcceptNewConnections.exchange(isAccepting == 0 ? false : true);
+ return c->isAcceptNewConnections.exchange(isAccepting == 0 ? false : true)
+ ? 1 : 0;
}
void UDPC_drop_connection(UDPC_HContext ctx, UDPC_ConnectionId connectionId, int dropAllWithAddr) {
return UDPC_set_libsodium_keys(ctx, sk, pk);
}
-void UDPC_unset_libsodium_keys(UDPC_HContext ctx) {
+int UDPC_unset_libsodium_keys(UDPC_HContext ctx) {
UDPC::Context *c = UDPC::verifyContext(ctx);
if(!c || !c->flags.test(2)) {
- return;
+ return 0;
}
std::lock_guard<std::mutex> lock(c->mutex);
c->keysSet.store(false);
+ std::memset(c->pk, 0, crypto_sign_PUBLICKEYBYTES);
+ std::memset(c->sk, 0, crypto_sign_SECRETKEYBYTES);
+ return 1;
}
const char *UDPC_atostr_cid(UDPC_HContext ctx, UDPC_ConnectionId connectionId) {
int UDPC_set_libsodium_key_easy(UDPC_HContext ctx, unsigned char *sk);
-void UDPC_unset_libsodium_keys(UDPC_HContext ctx);
+int UDPC_unset_libsodium_keys(UDPC_HContext ctx);
const char *UDPC_atostr_cid(UDPC_HContext ctx, UDPC_ConnectionId connectionId);