more aix/big-endian fixes

This commit is contained in:
TLINDEN
2013-11-18 21:48:24 +01:00
parent 88d947aed7
commit c4940b966c
20 changed files with 231 additions and 196 deletions

View File

@@ -62,8 +62,6 @@ int pcp_storekey (pcp_key_t *key) {
return 1;
}
void pcp_keygen(char *passwd, char *outfile) {
pcp_key_t *k = pcpkey_new ();
pcp_key_t *key = NULL;
@@ -113,6 +111,8 @@ void pcp_keygen(char *passwd, char *outfile) {
else {
if(pcp_storekey(key) == 0) {
pcpkey_printshortinfo(key);
memset(key, 0, sizeof(pcp_key_t));
free(key);
}
}
}
@@ -388,10 +388,12 @@ int pcp_importsecret (vault_t *vault, FILE *in) {
if(pcpvault_addkey(vault, (void *)key, PCP_KEY_TYPE_SECRET) == 0) {
fprintf(stderr, "key 0x%s added to %s.\n", key->id, vault->filename);
free(key);
return 0;
}
}
free(key);
return 1;
}
@@ -427,10 +429,12 @@ int pcp_importpublic (vault_t *vault, FILE *in) {
if(pcp_sanitycheck_pub(pub) == 0) {
if(pcpvault_addkey(vault, (void *)pub, PCP_KEY_TYPE_PUBLIC) == 0) {
fprintf(stderr, "key 0x%s added to %s.\n", pub->id, vault->filename);
free(pub);
return 0;
}
}
free(pub);
return 1;
}

View File

@@ -243,6 +243,9 @@ void pcpkey_print(pcp_key_t *key, FILE* out) {
void pcppubkey_print(pcp_pubkey_t *key, FILE* out) {
size_t zlen;
//printf("version: %08x\n", key->version);
pubkey2be(key);
void *blob = ucmalloc(PCP_RAW_PUBKEYSIZE);

View File

@@ -62,6 +62,7 @@ int main (int argc, char **argv) {
usevault = 0;
useid = 0;
userec = 0;
lo = 0;
static struct option longopts[] = {
// generics
@@ -146,7 +147,7 @@ int main (int argc, char **argv) {
break;
case 't':
mode += PCP_MODE_TEXT;
usevault = 1;
usevault = 0;
break;
case 'E':
mode += PCP_MODE_EDIT;
@@ -308,22 +309,6 @@ int main (int argc, char **argv) {
}
break;
case PCP_MODE_TEXT:
if(! useid && infile == NULL) {
pcptext_vault(vault);
}
else if(infile != NULL) {
pcptext_infile(infile);
}
else {
id = pcp_normalize_id(keyid);
if(id != NULL) {
pcptext_key(id);
free(id);
}
}
break;
case PCP_MODE_EDIT:
if(useid) {
id = pcp_normalize_id(keyid);
@@ -410,6 +395,29 @@ int main (int argc, char **argv) {
pcpz85_decode(infile, outfile);
break;
case PCP_MODE_TEXT:
if(infile != NULL) {
pcptext_infile(infile);
}
else {
pcphash_init();
vault = pcpvault_init(vaultfile);
if(! useid && infile == NULL) {
pcptext_vault(vault);
}
else {
id = pcp_normalize_id(keyid);
if(id != NULL) {
pcptext_key(id);
free(id);
}
}
pcpvault_close(vault);
pcphash_clean();
ucfree(vaultfile);
}
break;
default:
// mode params mixed
fatal("Sorry, invalid combination of commandline parameters!\n");