added signature support (doesn't work yet)

This commit is contained in:
git@daemon.de
2013-11-08 09:40:51 +01:00
parent a2c55c96b4
commit e6733e5e56
15 changed files with 497 additions and 39 deletions

View File

@@ -14,6 +14,7 @@ PCPEXPORT = pcp.h \
pcp/vault.h \
pcp/version.h \
pcp/z85.h \
pcp/zmq_z85.h
pcp/zmq_z85.h \
pcp/ed.h
nobase_include_HEADERS = $(PCPEXPORT)

View File

@@ -233,7 +233,8 @@ PCPEXPORT = pcp.h \
pcp/vault.h \
pcp/version.h \
pcp/z85.h \
pcp/zmq_z85.h
pcp/zmq_z85.h \
pcp/ed.h
nobase_include_HEADERS = $(PCPEXPORT)
all: all-am

View File

@@ -8,6 +8,7 @@ extern "C" {
#include "pcp/crypto.h"
#include "pcp/defines.h"
#include "pcp/digital_crc32.h"
#include "pcp/ed.h"
#include "pcp/getpass.h"
#include "pcp/jenhash.h"
#include "pcp/key.h"

View File

@@ -40,6 +40,9 @@ typedef unsigned int qbyte; // Quad byte = 32 bits
#define PCP_ZFILE_HEADER "----- BEGIN Z85 ENCODED FILE -----"
#define PCP_ZFILE_FOOTER "------ END Z85 ENCODED FILE ------"
#define PCP_SIG_HEADER "----- BEGIN PCP SIGNATURE FILE -----"
#define PCP_SIG_FOOTER "------ END PCP SIGNATURE FILE ------"
#define PCP_ME "Pretty Curved Privacy"
#define PCP_KEY_VERSION 0x00000001U
@@ -59,6 +62,9 @@ typedef unsigned int qbyte; // Quad byte = 32 bits
#define PCP_VAULT_ID 0xC4
#define PCP_VAULT_VERSION 0x01
// sigs
#define PCP_SIG_VERSION 0x01
char *PCP_ERR;
byte PCP_ERRSET;
int PCP_EXIT;

62
include/pcp/ed.h Normal file
View File

@@ -0,0 +1,62 @@
/*
This file is part of Pretty Curved Privacy (pcp1).
Copyright (C) 2013 T.Linden.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact me by mail: <tlinden AT cpan DOT org>.
*/
#ifndef _HAVE_PCP_ED_H
#define _HAVE_PCP_ED_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sodium.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include "defines.h"
#include "platform.h"
#include "mem.h"
#include "key.h"
struct _pcp_sig_t {
char id[17];
long ctime;
uint32_t version;
byte edsig[crypto_hash_sha256_BYTES + crypto_sign_BYTES];
};
typedef struct _pcp_sig_t pcp_sig_t;
int pcp_ed_verify(unsigned char *input, size_t inputlen, pcp_sig_t *sig, pcp_pubkey_t *p);
pcp_sig_t *pcp_ed_sign(unsigned char *message,
size_t messagesize, pcp_key_t *s);
pcp_sig_t *sig2native(pcp_sig_t *k);
pcp_sig_t *sig2be(pcp_sig_t *k);
pcp_sig_t *pcp_ed_newsig(unsigned char *hash, char *id);
#ifdef __cplusplus
}
#endif
#endif // _HAVE_PCP_ED_H