mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-22 06:27:51 +00:00
deriving conversation log BID now sets haveSecret and binds ID to
manifest structure.
This commit is contained in:
parent
424046ccd1
commit
cdec40093b
8
meshms.c
8
meshms.c
@ -186,9 +186,7 @@ int meshms_remember_conversation(const char *sender_sid_hex,
|
||||
}
|
||||
|
||||
// Check if there is an existing one, if so, read it and return it.
|
||||
if (rhizome_meshms_derive_conversation_log_bid(sender_sid_hex,
|
||||
l->cryptoSignPublic,
|
||||
l->cryptoSignSecret))
|
||||
if (rhizome_meshms_derive_conversation_log_bid(sender_sid_hex,l))
|
||||
return WHYF("Could not derive conversation log bid for sid: %s",sender_sid_hex);
|
||||
char manifestid_hex[crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES*2+1];
|
||||
tohex(manifestid_hex,l->cryptoSignPublic,
|
||||
@ -199,9 +197,7 @@ int meshms_remember_conversation(const char *sender_sid_hex,
|
||||
// Manifest already exists, nothing to do just yet.
|
||||
} else {
|
||||
// Create new manifest
|
||||
if (rhizome_meshms_derive_conversation_log_bid(sender_sid_hex,
|
||||
l->cryptoSignPublic,
|
||||
l->cryptoSignSecret))
|
||||
if (rhizome_meshms_derive_conversation_log_bid(sender_sid_hex,l))
|
||||
return WHYF("Could not derive conversation log bid for sid: %s",sender_sid_hex);
|
||||
|
||||
rhizome_manifest_set(l, "service", RHIZOME_SERVICE_FILE);
|
||||
|
@ -254,8 +254,7 @@ int rhizome_read_manifest_file(rhizome_manifest *m, const char *filename, int bu
|
||||
int rhizome_hash_file(rhizome_manifest *m, const char *filename,char *hash_out);
|
||||
|
||||
int rhizome_meshms_derive_conversation_log_bid(const char *sender_sid_hex,
|
||||
unsigned char *bid_public,
|
||||
unsigned char *bid_private);
|
||||
rhizome_manifest *m);
|
||||
int rhizome_manifest_set_real_sender(rhizome_manifest *m,
|
||||
const unsigned char *sid_binary);
|
||||
int rhizome_obfuscated_manifest_generate_outgoing_bid
|
||||
|
@ -665,8 +665,7 @@ int rhizome_manifest_set_obfuscated_sender(rhizome_manifest *m,
|
||||
}
|
||||
|
||||
int rhizome_meshms_derive_conversation_log_bid(const char *sender_sid_hex,
|
||||
unsigned char *bid_public,
|
||||
unsigned char *bid_secret)
|
||||
rhizome_manifest *m)
|
||||
{
|
||||
int cn=0,in=0,kp=0;
|
||||
sid_t sender_sid;
|
||||
@ -688,11 +687,15 @@ int rhizome_meshms_derive_conversation_log_bid(const char *sender_sid_hex,
|
||||
bcopy("concentrativeness",&secret[o],l); o+=l;
|
||||
crypto_hash_sha512(hash, (unsigned char *)secret, o);
|
||||
|
||||
bcopy(&hash[0],bid_secret,crypto_sign_edwards25519sha512batch_SECRETKEYBYTES);
|
||||
bcopy(&hash[0],m->cryptoSignSecret,crypto_sign_edwards25519sha512batch_SECRETKEYBYTES);
|
||||
bzero(hash,crypto_hash_sha512_BYTES);
|
||||
bzero(secret,sizeof(secret));
|
||||
|
||||
if (crypto_sign_compute_public_key(bid_secret,bid_public)) return -1;
|
||||
if (crypto_sign_compute_public_key(m->cryptoSignSecret,m->cryptoSignPublic))
|
||||
return -1;
|
||||
m->haveSecret=1;
|
||||
rhizome_manifest_set(m,"id",alloca_tohex_bid(m->cryptoSignPublic));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user