mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-21 06:03:12 +00:00
Refactor meshms seed string generation
This commit is contained in:
parent
0a8f6b2bb1
commit
b7b2ad845c
13
meshms.c
13
meshms.c
@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
|
#include "strbuf.h"
|
||||||
#include "strlcpy.h"
|
#include "strlcpy.h"
|
||||||
#include "keyring.h"
|
#include "keyring.h"
|
||||||
#include "dataformats.h"
|
#include "dataformats.h"
|
||||||
@ -54,12 +55,12 @@ static enum meshms_status get_my_conversation_bundle(const sid_t *my_sidp, rhizo
|
|||||||
if (!keyring_find_sid(&it, my_sidp))
|
if (!keyring_find_sid(&it, my_sidp))
|
||||||
return MESHMS_STATUS_SID_LOCKED;
|
return MESHMS_STATUS_SID_LOCKED;
|
||||||
|
|
||||||
char seed[1024];
|
strbuf sb = strbuf_alloca(1024);
|
||||||
snprintf(seed, sizeof(seed),
|
strbuf_puts(sb, "incorrection");
|
||||||
"incorrection%sconcentrativeness",
|
strbuf_tohex(sb, crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES * 2, it.keypair->private_key);
|
||||||
alloca_tohex(it.keypair->private_key, crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES));
|
strbuf_puts(sb, "concentrativeness");
|
||||||
|
assert(!strbuf_overrun(sb));
|
||||||
if (rhizome_get_bundle_from_seed(m, seed) == -1)
|
if (rhizome_get_bundle_from_seed(m, strbuf_str(sb)) == -1)
|
||||||
return MESHMS_STATUS_ERROR;
|
return MESHMS_STATUS_ERROR;
|
||||||
|
|
||||||
// always consider the content encrypted, we don't need to rely on the manifest itself.
|
// always consider the content encrypted, we don't need to rely on the manifest itself.
|
||||||
|
Loading…
Reference in New Issue
Block a user