mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-13 22:03:09 +00:00
fixed rhizome transfer bugs.
This commit is contained in:
parent
76663d1b9e
commit
231058a218
@ -196,7 +196,6 @@ rhizome_signature *rhizome_sign_hash(rhizome_manifest *m,const char *author)
|
||||
{
|
||||
unsigned char *hash=m->manifesthash;
|
||||
unsigned char *publicKeyBytes=m->cryptoSignPublic;
|
||||
unsigned char secretKeyBytes[crypto_sign_edwards25519sha512batch_SECRETKEYBYTES];
|
||||
|
||||
if (rhizome_extract_privatekey(m,author))
|
||||
{
|
||||
@ -212,11 +211,12 @@ rhizome_signature *rhizome_sign_hash(rhizome_manifest *m,const char *author)
|
||||
int mLen=crypto_hash_sha512_BYTES;
|
||||
|
||||
int r=crypto_sign_edwards25519sha512batch(signatureBuffer,&sigLen,
|
||||
&hash[0],mLen,secretKeyBytes);
|
||||
&hash[0],mLen,m->cryptoSignSecret);
|
||||
if (r) {
|
||||
WHY("crypto_sign() failed.");
|
||||
return NULL;
|
||||
}
|
||||
dump("formed sig",signatureBuffer,sigLen);
|
||||
|
||||
rhizome_signature *out=calloc(sizeof(rhizome_signature),1);
|
||||
|
||||
@ -263,6 +263,7 @@ int rhizome_manifest_extract_signature(rhizome_manifest *m,int *ofs)
|
||||
bcopy(&m->manifestdata[(*ofs)+1+32],&sigBuf[96],32);
|
||||
/* Get public key of signatory */
|
||||
bcopy(&m->manifestdata[(*ofs)+1+64],&publicKey[0],crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES);
|
||||
dump("reconst sigblock",&sigBuf[0],128);
|
||||
|
||||
unsigned long long mlen=0;
|
||||
int r=crypto_sign_edwards25519sha512batch_open(verifyBuf,&mlen,&sigBuf[0],128,
|
||||
|
@ -514,12 +514,12 @@ int rhizome_fetch_poll()
|
||||
q->close=1;
|
||||
if (debug&DEBUG_RHIZOME) fprintf(stderr,"Received all of file via rhizome -- now to import it\n");
|
||||
{
|
||||
fclose(q->file);
|
||||
fclose(q->file); q->file=NULL;
|
||||
const char *id = rhizome_manifest_get(q->manifest, "id", NULL, 0);
|
||||
if (id == NULL)
|
||||
return WHY("Manifest missing ID");
|
||||
char filename[1024];
|
||||
if (!FORM_RHIZOME_DATASTORE_PATH("import/manifest.%s", id))
|
||||
if (!FORM_RHIZOME_DATASTORE_PATH(filename,"import/manifest.%s", id))
|
||||
return -1;
|
||||
/* Do really write the manifest unchanged */
|
||||
if (debug&DEBUG_RHIZOME) {
|
||||
@ -552,7 +552,7 @@ int rhizome_fetch_poll()
|
||||
|
||||
errno=0;
|
||||
bytes=read(q->socket,&q->request[q->request_len],
|
||||
1024-q->request_len-1);
|
||||
1024-q->request_len-1);
|
||||
|
||||
/* If we got some data, see if we have found the end of the HTTP request */
|
||||
if (bytes>0) {
|
||||
@ -578,7 +578,7 @@ int rhizome_fetch_poll()
|
||||
if (lfcount==2) {
|
||||
/* We have the response headers, so parse.
|
||||
(we may also have some extra bytes, so we need to be a little
|
||||
careful) */
|
||||
careful) */
|
||||
|
||||
/* Terminate string at end of headers */
|
||||
q->request[i]=0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user