fixed keysig saving (forgot the id), enhancements on cmdline

This commit is contained in:
TLINDEN
2014-03-02 18:05:45 +01:00
parent 0767e55e55
commit b640fe6743
16 changed files with 84 additions and 69 deletions

View File

@@ -32,6 +32,7 @@
char *PCP_ERR;
byte PCP_ERRSET;
int PCP_EXIT;
int PCPVERBOSE;
void fatal(const char * fmt, ...) {
va_list ap;

View File

@@ -105,7 +105,7 @@ void pcphash_add(void *key, int type) {
}
else if(type == PCP_KEYSIG_NATIVE || type == PCP_KEYSIG_PBP) {
pcp_keysig_t *keysig = (pcp_keysig_t *)key;
HASH_ADD_STR( pcpkeysig_hash, belongs, keysig);
HASH_ADD_STR( pcpkeysig_hash, id, keysig);
}
else {
pcp_key_t *k = (pcp_key_t *)key;

View File

@@ -48,7 +48,7 @@ Buffer *pcp_keysig2blob(pcp_keysig_t *s) {
Buffer *b = buffer_new(256, "keysig2blob");
buffer_add8(b, s->type);
buffer_add32be(b, s->size);
buffer_add(b, s->belongs, 17);
buffer_add(b, s->id, 17);
buffer_add(b, s->checksum, 32);
buffer_add(b, s->blob, s->size);
return b;
@@ -60,6 +60,8 @@ pcp_keysig_t *pcp_keysig_new(Buffer *blob) {
uint8_t type = buffer_get8(blob);
uint32_t size = buffer_get32na(blob);
buffer_get_chunk(blob, sk->id, 17);
byte *checksum = ucmalloc(32);
buffer_get_chunk(blob, checksum, 32);

View File

@@ -120,7 +120,7 @@ int _check_hash_keysig(Buffer *blob, pcp_pubkey_t *p, pcp_keysig_t *sk) {
/* everything minus version, ctime and cipher, 1st 3 fields */
sk->size = blobstop - 6;
memcpy(sk->belongs, p->id, 17);
memcpy(sk->id, p->id, 17);
/* put the whole signature blob into our keysig */
blob->offset = 6; /* woah, hack :) */
@@ -359,7 +359,7 @@ pcp_ks_bundle_t *pcp_import_pub_pbp(Buffer *blob) {
pcp_keysig_t *sk = ucmalloc(sizeof(pcp_keysig_t));
sk->type = PCP_KEYSIG_PBP;
sk->size = buffer_size(blob);
memcpy(sk->belongs, pub->id, 17);
memcpy(sk->id, pub->id, 17);
sk->blob = ucmalloc(sk->size);
memcpy(sk->blob, buffer_get(blob), sk->size);
crypto_hash_sha256(sk->checksum, sk->blob, sk->size);

View File

@@ -123,7 +123,6 @@ size_t _buffer_is_binary(byte *buf, size_t len) {
memset(wide, 0, 4);
continue;
}
break; /* if we reach this, then it's binary and not utf8, stop checking */
}
}