mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 12:00:56 +01:00
changed invalid // c++ comments to valid /* .. */ C comments
This commit is contained in:
@@ -32,4 +32,4 @@ void encode_85(char *buf, const unsigned char *data, int bytes);
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
|
||||
#define error(...) (fatal(__VA_ARGS__), -1)
|
||||
|
||||
#endif // HAVE_BASE85_H
|
||||
#endif /* HAVE_BASE85_H */
|
||||
|
||||
@@ -65,4 +65,4 @@ size_t pcp_decrypt_file_sym(FILE *in, FILE* out, unsigned char *symkey, pcp_rec_
|
||||
pcp_rec_t *pcp_rec_new(unsigned char *cipher, size_t clen, pcp_key_t *secret, pcp_pubkey_t *pub);
|
||||
void pcp_rec_free(pcp_rec_t *r);
|
||||
|
||||
#endif // _HAVE_PCP_CRYPTO_H
|
||||
#endif /* _HAVE_PCP_CRYPTO_H */
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
typedef unsigned char byte; // Single unsigned byte = 8 bits
|
||||
typedef unsigned short dbyte; // Double byte = 16 bits
|
||||
typedef unsigned int qbyte; // Quad byte = 32 bits
|
||||
typedef unsigned char byte; /* Single unsigned byte = 8 bits */
|
||||
typedef unsigned short dbyte; /* Double byte = 16 bits */
|
||||
typedef unsigned int qbyte; /* Quad byte = 32 bits */
|
||||
|
||||
// key stuff
|
||||
/* key stuff */
|
||||
#define PCP_KEY_HEADER "----- BEGIN PCP SECRET KEY -----"
|
||||
#define PCP_KEY_FOOTER "------ END PCP SECRET KEY ------"
|
||||
|
||||
@@ -56,24 +56,24 @@ typedef unsigned int qbyte; // Quad byte = 32 bits
|
||||
#define PCP_KEY_TYPE_SECRET 2
|
||||
#define PCP_KEY_TYPE_PUBLIC 3
|
||||
|
||||
// save typing, dammit
|
||||
/* save typing, dammit */
|
||||
#define PCP_ENCRYPT_PAD crypto_secretbox_ZEROBYTES + crypto_secretbox_NONCEBYTES
|
||||
|
||||
// vault id
|
||||
/* vault id */
|
||||
#define PCP_VAULT_ID 14
|
||||
#define PCP_VAULT_VERSION 2
|
||||
|
||||
// sigs
|
||||
/* sigs */
|
||||
#define PCP_SIG_VERSION 2
|
||||
|
||||
// crypto file format stuff
|
||||
// enabled via config.h (configure --enable-cbc)
|
||||
/* crypto file format stuff */
|
||||
/* enabled via config.h (configure --enable-cbc) */
|
||||
#ifndef PCP_CBC
|
||||
#define PCP_ASYM_CIPHER 5
|
||||
#define PCP_SYM_CIPHER 23
|
||||
#define PCP_BLOCK_SIZE 32 * 1024
|
||||
#else
|
||||
// CBC mode, use smaller blocks
|
||||
/* CBC mode, use smaller blocks */
|
||||
#define PCP_ASYM_CIPHER 7
|
||||
#define PCP_SYM_CIPHER 25
|
||||
#define PCP_BLOCK_SIZE 1 * 1024
|
||||
@@ -82,23 +82,23 @@ typedef unsigned int qbyte; // Quad byte = 32 bits
|
||||
#define PCP_CRYPTO_ADD (crypto_box_ZEROBYTES - crypto_box_BOXZEROBYTES)
|
||||
#define PCP_BLOCK_SIZE_IN (PCP_BLOCK_SIZE) + PCP_CRYPTO_ADD + crypto_secretbox_NONCEBYTES
|
||||
#define PCP_ASYM_RECIPIENT_SIZE crypto_secretbox_KEYBYTES + PCP_CRYPTO_ADD + crypto_secretbox_NONCEBYTES
|
||||
//#define PCP_ASYM_ADD_SENDER_PUB
|
||||
/* #define PCP_ASYM_ADD_SENDER_PUB */
|
||||
|
||||
// used for self encryption only
|
||||
/* used for self encryption only */
|
||||
#define PBP_COMPAT_SALT "qa~t](84z<1t<1oz:ik.@IRNyhG=8q(on9}4#!/_h#a7wqK{Nt$T?W>,mt8NqYq&6U<GB1$,<$j>,rSYI2GRDd:Bcm"
|
||||
|
||||
// error handling
|
||||
/* error handling */
|
||||
extern char *PCP_ERR;
|
||||
extern byte PCP_ERRSET;
|
||||
extern int PCP_EXIT;
|
||||
|
||||
//set error
|
||||
/* set error */
|
||||
void fatal(const char * fmt, ...);
|
||||
|
||||
// fetch error
|
||||
/* fetch error */
|
||||
void fatals_ifany();
|
||||
|
||||
// reset
|
||||
/* reset */
|
||||
void fatals_reset();
|
||||
|
||||
#endif // _DEFINES_H
|
||||
#endif /* _DEFINES_H */
|
||||
|
||||
@@ -58,4 +58,4 @@ pcp_pubkey_t *pcp_ed_verify_buffered(FILE *in, pcp_pubkey_t *p);
|
||||
size_t pcp_ed_detachsign_buffered(FILE *in, FILE *out, pcp_key_t *s);
|
||||
pcp_pubkey_t *pcp_ed_detachverify_buffered(FILE *in, FILE *sigfd, pcp_pubkey_t *p);
|
||||
|
||||
#endif // _HAVE_PCP_ED_H
|
||||
#endif /* _HAVE_PCP_ED_H */
|
||||
|
||||
@@ -19,4 +19,4 @@ void pcp_echo_on();
|
||||
char *pcp_get_stdin();
|
||||
char *pcp_get_passphrase(char *prompt);
|
||||
|
||||
#endif // _HAVE_PCP_GETPASS
|
||||
#endif /* _HAVE_PCP_GETPASS */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef _HAVE_JENHASH_H
|
||||
#define _HAVE_JENHASH_H
|
||||
|
||||
// Bob Jenkins 32bit hash function
|
||||
// via: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx
|
||||
/* Bob Jenkins 32bit hash function */
|
||||
/* via: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */
|
||||
|
||||
#define jen_mix(a,b,c) \
|
||||
{ \
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
unsigned jen_hash ( unsigned char *k, unsigned length, unsigned initval );
|
||||
|
||||
#endif // _HAVE_JENHASH_H
|
||||
#endif /* _HAVE_JENHASH_H */
|
||||
|
||||
@@ -80,14 +80,14 @@ struct _pcp_key_t {
|
||||
byte edpub[32];
|
||||
byte edsecret[64];
|
||||
byte nonce[24];
|
||||
byte encrypted[112]; // both ed+curve encrypted
|
||||
byte encrypted[112]; /* both ed+curve encrypted */
|
||||
char owner[255];
|
||||
char mail[255];
|
||||
char id[17];
|
||||
uint8_t type;
|
||||
uint64_t ctime; // 8
|
||||
uint32_t version; // 4
|
||||
uint32_t serial; // 4
|
||||
uint64_t ctime; /* 8 */
|
||||
uint32_t version; /* 4 */
|
||||
uint32_t serial; /* 4 */
|
||||
UT_hash_handle hh;
|
||||
};
|
||||
|
||||
@@ -104,8 +104,8 @@ struct _pcp_pubkey_t {
|
||||
UT_hash_handle hh;
|
||||
};
|
||||
|
||||
// the PBP public key format
|
||||
// keys.mp+keys.cp+keys.sp+keys.name
|
||||
/* the PBP public key format */
|
||||
/* keys.mp+keys.cp+keys.sp+keys.name */
|
||||
struct _pbp_pubkey_t {
|
||||
byte sigpub[crypto_sign_PUBLICKEYBYTES];
|
||||
byte pub[crypto_box_PUBLICKEYBYTES];
|
||||
@@ -165,17 +165,17 @@ unsigned char * pcp_gennonce();
|
||||
|
||||
void pcpedit_key(char *keyid);
|
||||
|
||||
// use scrypt() to create a key from a passphrase and a nonce
|
||||
/* use scrypt() to create a key from a passphrase and a nonce */
|
||||
unsigned char *pcp_derivekey(char *passphrase, unsigned char *nonce);
|
||||
|
||||
pcp_key_t *pcp_derive_pcpkey (pcp_key_t *ours, char *theirs);
|
||||
|
||||
void pcp_seckeyblob(void *blob, pcp_key_t *k);
|
||||
void pcp_pubkeyblob(void *blob, pcp_pubkey_t *k);
|
||||
void *pcp_keyblob(void *k, int type); // allocates blob
|
||||
void *pcp_keyblob(void *k, int type); /* allocates blob */
|
||||
|
||||
int pcp_sanitycheck_pub(pcp_pubkey_t *key);
|
||||
int pcp_sanitycheck_key(pcp_key_t *key);
|
||||
|
||||
|
||||
#endif // _HAVE_PCP_KEYPAIR_H
|
||||
#endif /* _HAVE_PCP_KEYPAIR_H */
|
||||
|
||||
@@ -30,7 +30,7 @@ extern pcp_pubkey_t *pcppubkey_hash;
|
||||
extern pcp_key_t *__k;
|
||||
extern pcp_pubkey_t *__p;
|
||||
|
||||
// wrapper for HASH_ITER
|
||||
/* wrapper for HASH_ITER */
|
||||
#define pcphash_iterate(key) \
|
||||
__k = NULL; \
|
||||
HASH_ITER(hh, pcpkey_hash, key, __k)
|
||||
@@ -52,4 +52,4 @@ void pcphash_add(void *key, int type);
|
||||
int pcphash_count();
|
||||
int pcphash_countpub();
|
||||
|
||||
#endif // _HAVE_KEYHASH_H
|
||||
#endif /* _HAVE_KEYHASH_H */
|
||||
|
||||
@@ -31,38 +31,38 @@
|
||||
#include "mem.h"
|
||||
|
||||
|
||||
// how many times do we hash the passphrase
|
||||
/* how many times do we hash the passphrase */
|
||||
#define HCYCLES 128000
|
||||
|
||||
// encrypt some arbitrary cleartext using
|
||||
// a curve25519 secret key and a given nonce.
|
||||
//
|
||||
// expects a pointer to the target binary
|
||||
// stream containing the encrypted data,
|
||||
// the cleartext string, its size, the nonce
|
||||
// (24 bytes) and the secret key (32 bytes).
|
||||
//
|
||||
// allocates memory for the returned cipher
|
||||
// and it is up to the user to free it after use.
|
||||
//
|
||||
// returns the size of the returned cipherstream.
|
||||
// in case of an error, the cipher will be set
|
||||
// to NULL.
|
||||
/* encrypt some arbitrary cleartext using */
|
||||
/* a curve25519 secret key and a given nonce. */
|
||||
/* */
|
||||
/* expects a pointer to the target binary */
|
||||
/* stream containing the encrypted data, */
|
||||
/* the cleartext string, its size, the nonce */
|
||||
/* (24 bytes) and the secret key (32 bytes). */
|
||||
/* */
|
||||
/* allocates memory for the returned cipher */
|
||||
/* and it is up to the user to free it after use. */
|
||||
/* */
|
||||
/* returns the size of the returned cipherstream. */
|
||||
/* in case of an error, the cipher will be set */
|
||||
/* to NULL. */
|
||||
size_t pcp_sodium_mac(unsigned char **cipher,
|
||||
unsigned char *cleartext,
|
||||
size_t clearsize,
|
||||
unsigned char *nonce,
|
||||
unsigned char *key);
|
||||
|
||||
// does the opposite of pcp_sodium_mac and decrypts
|
||||
// a given encrypted binary stream using a nonce and
|
||||
// a secret key (sizes: see above).
|
||||
//
|
||||
// allocates memory for the returned cleartext and
|
||||
// it is up to the user to free it after use.
|
||||
//
|
||||
// returns 0 if decryption and verification were
|
||||
// successful, otherwise -1.
|
||||
/* does the opposite of pcp_sodium_mac and decrypts */
|
||||
/* a given encrypted binary stream using a nonce and */
|
||||
/* a secret key (sizes: see above). */
|
||||
/* */
|
||||
/* allocates memory for the returned cleartext and */
|
||||
/* it is up to the user to free it after use. */
|
||||
/* */
|
||||
/* returns 0 if decryption and verification were */
|
||||
/* successful, otherwise -1. */
|
||||
int pcp_sodium_verify_mac(unsigned char **cleartext,
|
||||
unsigned char* message,
|
||||
size_t messagesize,
|
||||
@@ -72,4 +72,4 @@ int pcp_sodium_verify_mac(unsigned char **cleartext,
|
||||
|
||||
|
||||
|
||||
#endif // _HAVE_PCP_MAC
|
||||
#endif /* _HAVE_PCP_MAC */
|
||||
|
||||
@@ -27,19 +27,16 @@
|
||||
#include <stdlib.h>
|
||||
#include "platform.h"
|
||||
|
||||
// simple malloc() wrapper
|
||||
// behaves like calloc(), which
|
||||
// I don't have here.
|
||||
//
|
||||
// exits if there's no more memory
|
||||
// available.
|
||||
/* simple malloc() wrapper */
|
||||
/* behaves like calloc(), which */
|
||||
/* I don't have here. */
|
||||
/* */
|
||||
/* exits if there's no more memory */
|
||||
/* available. */
|
||||
void *ucmalloc(size_t s);
|
||||
|
||||
// the same but it fills the pointer with random values
|
||||
/* the same but it fills the pointer with random values */
|
||||
void *urmalloc(size_t s);
|
||||
|
||||
// dito.
|
||||
void *ucfree(void *ptr);
|
||||
|
||||
|
||||
#endif // _HAVE_PCP_MEM
|
||||
#endif /* _HAVE_PCP_MEM */
|
||||
|
||||
@@ -37,62 +37,62 @@
|
||||
#define ZPADCHAR 0
|
||||
#endif
|
||||
|
||||
// prepends a binary stream with a number of
|
||||
// \0's as required by the secret_box and
|
||||
// secret_box_open functions of libsodium.
|
||||
//
|
||||
// parameters:
|
||||
//
|
||||
// padded: destination array (ref)
|
||||
// unpadded: source array without padding
|
||||
// padlen: length of padding
|
||||
// unpadlen: length of source array
|
||||
//
|
||||
// turns "efa5" into "00000000efa5" with padlen 8
|
||||
//
|
||||
// if DEBUG is set, destination will be padded with
|
||||
// the character '0', NOT the integer 0.
|
||||
//
|
||||
// allocates memory for padded and it is up to the
|
||||
// user to free it after use.
|
||||
//
|
||||
// sample call:
|
||||
//
|
||||
// char unpadded[] = {0xef, 0xa5};
|
||||
// unsigned char *padded;
|
||||
// pcp_pad_prepend(&padded, unpadded, 8, 2);
|
||||
//
|
||||
// the result, padded, would be 10 bytes long, 8
|
||||
// bytes for the leading zeros and 2 for the content
|
||||
// of the original unpadded.
|
||||
/* prepends a binary stream with a number of */
|
||||
/* \0's as required by the secret_box and */
|
||||
/* secret_box_open functions of libsodium. */
|
||||
/* */
|
||||
/* parameters: */
|
||||
/* */
|
||||
/* padded: destination array (ref) */
|
||||
/* unpadded: source array without padding */
|
||||
/* padlen: length of padding */
|
||||
/* unpadlen: length of source array */
|
||||
/* */
|
||||
/* turns "efa5" into "00000000efa5" with padlen 8 */
|
||||
/* */
|
||||
/* if DEBUG is set, destination will be padded with */
|
||||
/* the character '0', NOT the integer 0. */
|
||||
/* */
|
||||
/* allocates memory for padded and it is up to the */
|
||||
/* user to free it after use. */
|
||||
/* */
|
||||
/* sample call: */
|
||||
/* */
|
||||
/* char unpadded[] = {0xef, 0xa5}; */
|
||||
/* unsigned char *padded; */
|
||||
/* pcp_pad_prepend(&padded, unpadded, 8, 2); */
|
||||
/* */
|
||||
/* the result, padded, would be 10 bytes long, 8 */
|
||||
/* bytes for the leading zeros and 2 for the content */
|
||||
/* of the original unpadded. */
|
||||
void pcp_pad_prepend(unsigned char **padded, unsigned char *unpadded,
|
||||
size_t padlen, size_t unpadlen);
|
||||
|
||||
// removes zero's of a binary stream, which is
|
||||
// the reverse of pcp_pad_prepend().
|
||||
//
|
||||
// parameters:
|
||||
//
|
||||
// unpadded: destination array (ref), with padding removed
|
||||
// padded: source array with padding
|
||||
// padlen: length of padding
|
||||
// unpadlen: length of source array
|
||||
//
|
||||
// turns "00000000efa5" into "efa5" with padlen 8
|
||||
//
|
||||
// allocates memory for unpadded and it is up to the
|
||||
// user to free it after use.
|
||||
//
|
||||
// sample call:
|
||||
//
|
||||
// char padded[] = {0x0, 0x0, 0x0, 0x0, 0xef, 0xa5};
|
||||
// unsigned char *unpadded;
|
||||
// pcp_pad_remove(unpadded, padded, 4, 2);
|
||||
//
|
||||
// the result, unpadded would be 2 bytes long containing
|
||||
// only the 2 bytes we want to have with zeros removed.
|
||||
/* removes zero's of a binary stream, which is */
|
||||
/* the reverse of pcp_pad_prepend(). */
|
||||
/* */
|
||||
/* parameters: */
|
||||
/* */
|
||||
/* unpadded: destination array (ref), with padding removed */
|
||||
/* padded: source array with padding */
|
||||
/* padlen: length of padding */
|
||||
/* unpadlen: length of source array */
|
||||
/* */
|
||||
/* turns "00000000efa5" into "efa5" with padlen 8 */
|
||||
/* */
|
||||
/* allocates memory for unpadded and it is up to the */
|
||||
/* user to free it after use. */
|
||||
/* */
|
||||
/* sample call: */
|
||||
/* */
|
||||
/* char padded[] = {0x0, 0x0, 0x0, 0x0, 0xef, 0xa5}; */
|
||||
/* unsigned char *unpadded; */
|
||||
/* pcp_pad_remove(unpadded, padded, 4, 2); */
|
||||
/* */
|
||||
/* the result, unpadded would be 2 bytes long containing */
|
||||
/* only the 2 bytes we want to have with zeros removed. */
|
||||
void pcp_pad_remove(unsigned char **unpadded, unsigned char *padded,
|
||||
size_t padlen, size_t unpadlen);
|
||||
|
||||
|
||||
#endif // _HAVE_PCP_ZPADDING
|
||||
#endif /* _HAVE_PCP_ZPADDING */
|
||||
|
||||
@@ -27,16 +27,16 @@
|
||||
|
||||
#ifdef HAVE_ENDIAN_H
|
||||
# include <endian.h>
|
||||
#else // no endian.h
|
||||
#else /* no endian.h */
|
||||
# ifdef HAVE_SYS_ENDIAN_H
|
||||
# include <sys/types.h>
|
||||
# include <sys/endian.h>
|
||||
# ifndef HAVE_BE32TOH
|
||||
# // openbsd, use aliases
|
||||
# /* openbsd, use aliases */
|
||||
# define be32toh betoh32
|
||||
# define be64toh betoh64
|
||||
# endif
|
||||
# else // no sys/endian.h
|
||||
# else /* no sys/endian.h */
|
||||
# ifdef __CPU_IS_BIG_ENDIAN
|
||||
# define be32toh(x) (x)
|
||||
# define htobe32(x) (x)
|
||||
@@ -57,12 +57,12 @@
|
||||
# define be64toh(x) ((u_int64_t)ntohl((u_int64_t)(x)))
|
||||
# define htobe64(x) ((u_int64_t)htonl((u_int64_t)(x)))
|
||||
# endif
|
||||
# endif // HAVE_SYS_ENDIAN_H
|
||||
#endif // HAVE_ENDIAN_H
|
||||
# endif /* HAVE_SYS_ENDIAN_H */
|
||||
#endif /* HAVE_ENDIAN_H */
|
||||
|
||||
|
||||
#ifndef HAVE_ARC4RANDOM_BUF
|
||||
// shitty OS. we're using libsodium's implementation
|
||||
/* shitty OS. we're using libsodium's implementation */
|
||||
|
||||
#include <sodium.h>
|
||||
|
||||
@@ -127,7 +127,7 @@ int vasprintf(char **ret, const char *format, va_list args) {
|
||||
*ret = buffer;
|
||||
}
|
||||
}
|
||||
va_end(copy); // Each va_start() or va_copy() needs a va_end()
|
||||
va_end(copy); /* Each va_start() or va_copy() needs a va_end() */
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -73,4 +73,4 @@ static inline void p_clean(plist_t *lst) {
|
||||
|
||||
}
|
||||
|
||||
#endif // _HAVE_PCP_PLIST_H
|
||||
#endif /* _HAVE_PCP_PLIST_H */
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// key_fingerprint_randomart comitted by Alexander von Gernler in rev 1.70
|
||||
/* key_fingerprint_randomart comitted by Alexander von Gernler in rev 1.70 */
|
||||
|
||||
#ifndef _HAVE_PCP_RANDOMART_H
|
||||
#define _HAVE_PCP_RANDOMART_H
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "mem.h"
|
||||
#include <string.h>
|
||||
|
||||
// from openssh key.c
|
||||
/* from openssh key.c */
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
@@ -51,4 +51,4 @@
|
||||
|
||||
char *key_fingerprint_randomart(unsigned char *dgst_raw, unsigned int dgst_raw_len);
|
||||
|
||||
#endif // _HAVE_PCP_RANDOMART_H
|
||||
#endif /* _HAVE_PCP_RANDOMART_H */
|
||||
|
||||
@@ -38,5 +38,5 @@
|
||||
|
||||
unsigned char * pcp_scrypt(char *passwd, size_t passwdlen, unsigned char *nonce, size_t noncelen);
|
||||
|
||||
#endif // _HAVE_PCP_SCRYPT_H
|
||||
#endif /* _HAVE_PCP_SCRYPT_H */
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
|
||||
// various helpers, too small to put into own c
|
||||
/* various helpers, too small to put into own c */
|
||||
|
||||
#ifndef _HAVE_PCP_UTIL_H
|
||||
#define _HAVE_PCP_UTIL_H
|
||||
@@ -36,4 +36,4 @@ size_t _findoffset(unsigned char *bin, size_t binlen, char *sigstart, size_t hle
|
||||
void _xorbuf(unsigned char *iv, unsigned char *buf, size_t xlen);
|
||||
void _dump(char *n, unsigned char *d, size_t s);
|
||||
|
||||
#endif // _HAVE_PCP_UTIL_H
|
||||
#endif /* _HAVE_PCP_UTIL_H */
|
||||
|
||||
@@ -83,4 +83,4 @@ vault_header_t * vh2native(vault_header_t *h);
|
||||
vault_item_header_t * ih2be(vault_item_header_t *h);
|
||||
vault_item_header_t * ih2native(vault_item_header_t *h);
|
||||
|
||||
#endif // _HAVE_PCP_VAULT
|
||||
#endif /* _HAVE_PCP_VAULT */
|
||||
|
||||
@@ -34,4 +34,4 @@
|
||||
|
||||
int pcp_version();
|
||||
|
||||
#endif // _HAVE_PCP_VERSION
|
||||
#endif /* _HAVE_PCP_VERSION */
|
||||
|
||||
@@ -20,27 +20,27 @@
|
||||
*/
|
||||
|
||||
|
||||
// from https://github.com/tlinden/curve-keygen/
|
||||
/* from https://github.com/tlinden/curve-keygen/ */
|
||||
#ifndef _HAVE_PCP_Z85_H
|
||||
|
||||
#include "defines.h"
|
||||
#include "zmq_z85.h"
|
||||
#include "mem.h"
|
||||
|
||||
// convert a binary stream to one which gets accepted by zmq_z85_encode
|
||||
// we pad it with zeroes and put the number of zerores in front of it
|
||||
/* convert a binary stream to one which gets accepted by zmq_z85_encode */
|
||||
/* we pad it with zeroes and put the number of zerores in front of it */
|
||||
unsigned char *pcp_unpadfour(unsigned char *src, size_t srclen, size_t *dstlen);
|
||||
|
||||
// the reverse of the above
|
||||
/* the reverse of the above */
|
||||
unsigned char *pcp_unpadfour(unsigned char *src, size_t srclen, size_t *dstlen);
|
||||
|
||||
// wrapper around zmq Z85 encoding function
|
||||
/* wrapper around zmq Z85 encoding function */
|
||||
unsigned char *pcp_z85_decode(char *z85block, size_t *dstlen);
|
||||
|
||||
// the reverse of the above
|
||||
/* the reverse of the above */
|
||||
char *pcp_z85_encode(unsigned char *raw, size_t srclen, size_t *dstlen);
|
||||
|
||||
char *pcp_readz85file(FILE *infile);
|
||||
char *pcp_readz85string(unsigned char *input, size_t bufsize);
|
||||
|
||||
#endif // _HAVE_PCP_Z85_H
|
||||
#endif /* _HAVE_PCP_Z85_H */
|
||||
|
||||
Reference in New Issue
Block a user