mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
initial default modes better, initialize crypto before use
This commit is contained in:
parent
4d911f94d6
commit
5a01bf4d7a
1 changed files with 6 additions and 4 deletions
|
@ -142,8 +142,8 @@ main(int argc, char *argv[])
|
|||
"file\n");
|
||||
return 0;
|
||||
}
|
||||
bool genMode;
|
||||
bool updMode;
|
||||
bool genMode = false;
|
||||
bool updMode = false;
|
||||
int c;
|
||||
char *rcfname;
|
||||
while(1)
|
||||
|
@ -203,6 +203,7 @@ main(int argc, char *argv[])
|
|||
tmp.last_updated = llarp_time_now_ms();
|
||||
// load longterm identity
|
||||
llarp_crypto crypt;
|
||||
llarp_crypto_libsodium_init(&crypt);
|
||||
fs::path ident_keyfile = "identity.key";
|
||||
llarp_seckey_t identity;
|
||||
llarp_findOrCreateIdentity(&crypt, ident_keyfile.c_str(), identity);
|
||||
|
@ -210,7 +211,7 @@ main(int argc, char *argv[])
|
|||
uint8_t *pubkey = llarp_seckey_topublic(identity);
|
||||
llarp_rc_set_pubkey(&tmp, pubkey);
|
||||
// this causes a segfault
|
||||
// llarp_rc_sign(&crypt, &identity, &tmp);
|
||||
llarp_rc_sign(&crypt, identity, &tmp);
|
||||
// set filename
|
||||
fs::path our_rc_file = rcfname;
|
||||
// write file
|
||||
|
@ -220,7 +221,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
if(updMode)
|
||||
{
|
||||
printf("Loading [%s]\n", rcfname);
|
||||
printf("rcutil.cpp - Loading [%s]\n", rcfname);
|
||||
fs::path our_rc_file = rcfname;
|
||||
std::error_code ec;
|
||||
if(!fs::exists(our_rc_file, ec))
|
||||
|
@ -250,6 +251,7 @@ main(int argc, char *argv[])
|
|||
tmp.last_updated = llarp_time_now_ms();
|
||||
// load longterm identity
|
||||
llarp_crypto crypt;
|
||||
llarp_crypto_libsodium_init(&crypt);
|
||||
fs::path ident_keyfile = "identity.key";
|
||||
llarp_seckey_t identity;
|
||||
llarp_findOrCreateIdentity(&crypt, ident_keyfile.c_str(), identity);
|
||||
|
|
Loading…
Reference in a new issue