1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-09-28 12:47:35 +00:00

Added lsodium.c, laikaK_loadKeys, laikaK_genKeys

This commit is contained in:
2022-03-21 15:24:05 -05:00
parent af9cdfdaed
commit 30f7ffb73b
8 changed files with 51 additions and 38 deletions

View File

@@ -56,13 +56,13 @@ struct sLaika_bot *laikaB_newBot(void) {
LAIKA_ERROR("LibSodium failed to initialize!\n");
}
if (crypto_kx_keypair(bot->pub, bot->priv) != 0) {
if (!laikaK_genKeys(bot->pub, bot->priv)) {
laikaB_freeBot(bot);
LAIKA_ERROR("Failed to gen keypair!\n");
}
/* read cnc's public key into peerPub */
if (sodium_hex2bin(bot->peer->peerPub, crypto_kx_PUBLICKEYBYTES, LAIKA_PUBKEY, strlen(LAIKA_PUBKEY), NULL, &_unused, NULL) != 0) {
if (!laikaK_loadKeys(bot->peer->peerPub, NULL, LAIKA_PUBKEY, NULL)) {
laikaB_freeBot(bot);
LAIKA_ERROR("Failed to init cnc public key!\n");
}