some fixes to new refactored bundle handling code.

This commit is contained in:
gardners 2012-05-25 23:29:23 +08:00
parent b0dca7e03f
commit e473e5b6df
3 changed files with 9 additions and 7 deletions

View File

@ -1194,7 +1194,8 @@ int app_rhizome_add_file(int argc, const char *const *argv, struct command_line_
if (rhizome_manifest_bind_id(m,authorSid))
return WHY("Could not bind manifest to an ID");
#warning need to sanely determine whether to encrypt a file
int encryptP=1;
#warning payload encryption disabled for now
int encryptP=0;
if (rhizome_manifest_bind_file(m,filepath,encryptP))
return WHYF("Could not bind manifest to file '%s'",filepath);

View File

@ -142,7 +142,7 @@ int rhizome_manifest_bind_id(rhizome_manifest *m_in,const char *author)
char id[crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES*2+1];
rhizome_bytes_to_hex_upper(m_in->cryptoSignPublic, id, crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES);
rhizome_manifest_set(m_in, "id", id);
if (author) {
if (author&&author[0]) {
/* Set the BK using the provided authorship information.
Serval Security Framework defines BK as being:
BK = privateKey XOR sha512(RS##BID), where BID = cryptoSignPublic,

View File

@ -194,11 +194,12 @@ rhizome_signature *rhizome_sign_hash(rhizome_manifest *m,const char *author)
unsigned char *hash=m->manifesthash;
unsigned char *publicKeyBytes=m->cryptoSignPublic;
if (rhizome_extract_privatekey(m,author))
{
WHY("Cannot find secret key to sign manifest data.");
return NULL;
}
if (!m->haveSecret)
if (rhizome_extract_privatekey(m,author))
{
WHY("Cannot find secret key to sign manifest data.");
return NULL;
}
/* Signature is formed by running crypto_sign_edwards25519sha512batch() on the
hash of the manifest. The signature actually contains the hash, so to save