mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-18 04:10:57 +01:00
added pcp_ed_verify_buffered() [doesnt work yet, needs debugging]
This commit is contained in:
@@ -40,9 +40,10 @@ 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 SIGNED MESSAGE -----"
|
||||
#define PCP_SIG_START "----- BEGIN PCP SIGNATURE -----"
|
||||
#define PCP_SIG_END "------ END PCP SIGNATURE ------"
|
||||
#define PCP_SIG_HEADER "----- BEGIN ED25519 SIGNED MESSAGE -----"
|
||||
#define PCP_SIG_START "----- BEGIN ED25519 SIGNATURE -----"
|
||||
#define PCP_SIG_END "------ END ED25519 SIGNATURE ------"
|
||||
#define PCP_SIGPREFIX "\nnacl-"
|
||||
|
||||
#define PCP_ME "Pretty Curved Privacy"
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "platform.h"
|
||||
#include "mem.h"
|
||||
#include "key.h"
|
||||
#include "keyhash.h"
|
||||
#include "util.h"
|
||||
|
||||
/* sign a message of messagesize using s->edsecret, if it works
|
||||
return message+signature (size: messagesize + crypto_sign_BYTES),
|
||||
@@ -51,4 +53,6 @@ unsigned char * pcp_ed_verify(unsigned char *signature, size_t siglen, pcp_pubke
|
||||
sig only to the output */
|
||||
size_t pcp_ed_sign_buffered(FILE *in, FILE *out, pcp_key_t *s, int z85);
|
||||
|
||||
unsigned char *pcp_ed_verify_buffered(FILE *in, pcp_pubkey_t *p);
|
||||
|
||||
#endif // _HAVE_PCP_ED_H
|
||||
|
||||
@@ -26,13 +26,31 @@
|
||||
#define _HAVE_PCP_UTIL_H
|
||||
|
||||
#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
|
||||
// lowercase a string
|
||||
static inline char *_lc(char *in) {
|
||||
size_t len = strlen(in);
|
||||
int i;
|
||||
size_t i;
|
||||
for(i=0; i<len; ++i)
|
||||
in[i] = towlower(in[i]);
|
||||
return in;
|
||||
}
|
||||
|
||||
// find the offset of the beginning of a certain string within binary data
|
||||
static inline int _findoffset(unsigned char *bin, size_t binlen, char *sigstart, size_t hlen) {
|
||||
size_t i;
|
||||
int sigfoot = 181; // yes, also bad. that's the armored sig footer
|
||||
int offset = -1;
|
||||
|
||||
for(i=0; i<binlen-sigfoot; ++i) {
|
||||
if(memcmp(&bin[i], sigstart, hlen) == 0) {
|
||||
offset = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
#endif // _HAVE_PCP_UTIL_H
|
||||
|
||||
Reference in New Issue
Block a user