changed z85 padding (incompatible to previous pcp versions!):

now we padd with zeroes as usual but append 4 bytes to the
raw input, the last one indicates the pad count. It's always
present, even if no padding occurred (the pad blob will then
read 0000).
This fixes the issue of earlier versions where trailing zeroes
in the original input (between block boundaries) have been
removed. Since we now add the pad counter, we know how many
zeroes to remove. If the original chunk already ended with zeroes
they will left untouched.
Re-created all test keys/data to match the change.
Also, the pcp_z85_encode() function now haves another flag
doblock. If set to 1, the function does the 72 chars per line
block creation itself, otherwise it just returns the z85 string
without any newlines added. Required by pcpstream class.
This commit is contained in:
git@daemon.de
2014-07-31 16:41:20 +02:00
parent c8317a348e
commit e033df7156
22 changed files with 192 additions and 178 deletions

4
TODO
View File

@@ -41,3 +41,7 @@ py % nacl.crypto_hash_sha256(pointer(hash), pointer(key), 32)
py % hash.raw py % hash.raw
';\xa3\xf5\xf4;\x92`&\x83\xc1\x9a\xeeb\xa2\x03B\xb0\x84\... ';\xa3\xf5\xf4;\x92`&\x83\xc1\x9a\xeeb\xa2\x03B\xb0\x84\...
py % py %
after new z85 padding scheme: write z85 blocksize to output
as well? if a reader doesn't know the blocksize it won't be
able to decode it properly. Or no issue? Not sure yet...

View File

@@ -119,7 +119,7 @@ string Key::export_secret(const string &passphrase) {
throw pcp::exception(PTX); throw pcp::exception(PTX);
size_t zlen; size_t zlen;
char *z85 = pcp_z85_encode(buffer_get(exported_sk), buffer_size(exported_sk), &zlen); char *z85 = pcp_z85_encode(buffer_get(exported_sk), buffer_size(exported_sk), &zlen, 1);
string out = string(EXP_SK_HEADER) + "\r\n" + string(z85) + "\r\n" + string(EXP_SK_FOOTER) + "\r\n"; string out = string(EXP_SK_HEADER) + "\r\n" + string(z85) + "\r\n" + string(EXP_SK_FOOTER) + "\r\n";
@@ -135,7 +135,7 @@ string Key::export_public() {
throw pcp::exception(PTX); throw pcp::exception(PTX);
size_t zlen; size_t zlen;
char *z85 = pcp_z85_encode(buffer_get(exported_pk), buffer_size(exported_pk), &zlen); char *z85 = pcp_z85_encode(buffer_get(exported_pk), buffer_size(exported_pk), &zlen, 1);
string out = string(EXP_PK_HEADER) + "\r\n" + string(z85) + "\r\n" + string(EXP_PK_FOOTER) + "\r\n"; string out = string(EXP_PK_HEADER) + "\r\n" + string(z85) + "\r\n" + string(EXP_PK_FOOTER) + "\r\n";

View File

@@ -53,9 +53,9 @@ we pad the input with zeroes and remove them after decoding.
the original pointer into it and adds a number of zeros so that the the original pointer into it and adds a number of zeros so that the
result has a size divisable by 4. result has a size divisable by 4.
\param[in] src Unpadded data. \param[in] src Unpadded data.
\param[in] srclen Size of unpadded data. \param[in] srclen Size of unpadded data.
\param[in] dstlen Returned size of padded data (pointer to int). \param[out] dstlen Returned size of padded data (pointer to int).
\return Returns a pointer to the padded data. \return Returns a pointer to the padded data.
*/ */
@@ -95,13 +95,14 @@ byte *pcp_z85_decode(PCPCTX *ptx, char *z85block, size_t *dstlen);
It allocates the memory for the returned char pointer. The caller It allocates the memory for the returned char pointer. The caller
is responsible the free() it. is responsible the free() it.
\param[in] raw Pointer to raw data. \param[in] raw Pointer to raw data.
\param[in] srclen Size of the data. \param[in] srclen Size of the data.
\param[in] dstlen Returned size of encoded data (pointer to int). \param[out] dstlen Returned size of encoded data (pointer to int).
\param[in] doblock If set to 1, turn the encoded data into a 72 chars wide block.
\return Returns a string (char array) containing the Z85 encoded data. \return Returns a string (char array) containing the Z85 encoded data.
*/ */
char *pcp_z85_encode(byte *raw, size_t srclen, size_t *dstlen); char *pcp_z85_encode(byte *raw, size_t srclen, size_t *dstlen, int doblock);
/** Read a Z85 encoded file. /** Read a Z85 encoded file.

View File

@@ -107,7 +107,7 @@ size_t pcp_ed_sign_buffered(PCPCTX *ptx, Pcpstream *in, Pcpstream* out, pcp_key_
if(z85) { if(z85) {
ps_print(out, "\r\n%s\r\nVersion: PCP v%d.%d.%d \r\n\r\n", PCP_SIG_START, PCP_VERSION_MAJOR, PCP_VERSION_MINOR, PCP_VERSION_PATCH); ps_print(out, "\r\n%s\r\nVersion: PCP v%d.%d.%d \r\n\r\n", PCP_SIG_START, PCP_VERSION_MAJOR, PCP_VERSION_MINOR, PCP_VERSION_PATCH);
size_t zlen; size_t zlen;
char *z85encoded = pcp_z85_encode((byte*)signature, mlen, &zlen); char *z85encoded = pcp_z85_encode((byte*)signature, mlen, &zlen, 1);
ps_print(out, "%s\r\n%s\r\n", z85encoded, PCP_SIG_END); ps_print(out, "%s\r\n%s\r\n", z85encoded, PCP_SIG_END);
} }
else { else {
@@ -328,7 +328,7 @@ size_t pcp_ed_detachsign_buffered(Pcpstream *in, Pcpstream *out, pcp_key_t *s) {
ps_print(out, "%s\r\nVersion: PCP v%d.%d.%d\r\n", ps_print(out, "%s\r\nVersion: PCP v%d.%d.%d\r\n",
PCP_SIG_START, PCP_VERSION_MAJOR, PCP_VERSION_MINOR, PCP_VERSION_PATCH); PCP_SIG_START, PCP_VERSION_MAJOR, PCP_VERSION_MINOR, PCP_VERSION_PATCH);
size_t zlen; size_t zlen;
char *z85encoded = pcp_z85_encode((byte*)signature, mlen, &zlen); char *z85encoded = pcp_z85_encode((byte*)signature, mlen, &zlen, 1);
ps_print(out, "%s\r\n%s\r\n", z85encoded, PCP_SIG_END); ps_print(out, "%s\r\n%s\r\n", z85encoded, PCP_SIG_END);
free(st); free(st);

View File

@@ -60,7 +60,11 @@ Pcpstream *ps_new_outbuffer() {
void ps_setdetermine(Pcpstream *stream, size_t blocksize) { void ps_setdetermine(Pcpstream *stream, size_t blocksize) {
assert(blocksize % 4 == 0); assert(blocksize % 4 == 0);
stream->determine = 1; stream->determine = 1;
stream->blocksize = blocksize + (5 - (blocksize % 5)); /* expand blocksize by the remainder of %5 plus another 5 bytes
for the pad blob */
//stream->blocksize = blocksize + (5 - (blocksize % 5)) + 5;
stream->blocksize = blocksize + (blocksize / 4) + 5;
//fprintf(stderr, "blocksize: %ld\n", stream->blocksize);
if(stream->cache == NULL) { if(stream->cache == NULL) {
stream->cache = buffer_new(32, "Pcpstreamcachedetermine"); stream->cache = buffer_new(32, "Pcpstreamcachedetermine");
stream->next = buffer_new(32, "Pcpstreamcachenextdetermin"); stream->next = buffer_new(32, "Pcpstreamcachenextdetermin");
@@ -435,8 +439,9 @@ size_t ps_read_decode(Pcpstream *stream) {
size_t binlen, outlen; size_t binlen, outlen;
byte *bin = pcp_z85_decode(ptx, buffer_get_str(z), &binlen); byte *bin = pcp_z85_decode(ptx, buffer_get_str(z), &binlen);
//fprintf(stderr, "ps_read_decode decoding z: %ld, got: %ld\n", buffer_size(z), binlen); //fprintf(stderr, "ps_read_decode decoding z: %ld, got: %ld\n", buffer_size(z), binlen);
// _dump("bin", bin, binlen); //_dump("bin", bin, binlen);
//fatals_ifany(); //fatals_ifany();
if(bin == NULL) { if(bin == NULL) {
/* it's not z85 encoded, so threat it as binary */ /* it's not z85 encoded, so threat it as binary */
if(stream->firstread) { if(stream->firstread) {
@@ -550,20 +555,8 @@ size_t ps_write(Pcpstream *stream, void *buf, size_t writebytes) {
void ps_write_encode(Pcpstream *stream, Buffer *dst) { void ps_write_encode(Pcpstream *stream, Buffer *dst) {
size_t zlen, i, pos; size_t zlen, i, pos;
/* do z85 0 padding, manually */
if(buffer_size(stream->cache) % 4 != 0) {
size_t outlen = buffer_size(stream->cache);
while (outlen % 4 != 0) {
buffer_add8(stream->cache, 0);
outlen = buffer_size(stream->cache);
}
}
/* z85 encode */ /* z85 encode */
zlen = (buffer_size(stream->cache) * 5 / 4) + 1; char *z85 = pcp_z85_encode(buffer_get(stream->cache), buffer_size(stream->cache), &zlen, 0);
char *z85 = ucmalloc(zlen);
zmq_z85_encode(z85, buffer_get(stream->cache), buffer_size(stream->cache));
/* add newlines */ /* add newlines */
pos = stream->linewr; pos = stream->linewr;
@@ -578,7 +571,6 @@ void ps_write_encode(Pcpstream *stream, Buffer *dst) {
buffer_add8(dst, z85[i]); buffer_add8(dst, z85[i]);
} }
/* remember where to start next */
stream->linewr = pos; stream->linewr = pos;
} }

View File

@@ -184,8 +184,9 @@ size_t pcp_unpadfour(byte *src, size_t srclen) {
byte *pcp_z85_decode(PCPCTX *ptx, char *z85block, size_t *dstlen) { byte *pcp_z85_decode(PCPCTX *ptx, char *z85block, size_t *dstlen) {
byte *bin = NULL; byte *bin = NULL;
size_t binlen, outlen; size_t binlen, outlen, padlen;
size_t srclen; size_t srclen;
byte padblob[4];
srclen = strlen(z85block); srclen = strlen(z85block);
@@ -203,61 +204,93 @@ byte *pcp_z85_decode(PCPCTX *ptx, char *z85block, size_t *dstlen) {
return NULL; return NULL;
} }
outlen = pcp_unpadfour(bin, binlen); /* extract pad blob */
memcpy(padblob, &bin[binlen-4], 4);
padlen = padblob[3];
if(padlen > 3) {
free(bin);
fatal(ptx, "zmq_z85_decode() failed, invalid pad counter (got %ld, expected 0-3)\n", padlen);
return NULL;
}
/*
fprintf(stderr, "srclen: %ld, binlen: %ld, padlen: %ld\n", srclen, binlen, padlen);
_dump(" z", (byte *)z85block, srclen);
_dump("padblob", padblob, 4);
*/
outlen = binlen - 4 - padlen; //pcp_unpadfour(bin, binlen, padlen);
*dstlen = outlen; *dstlen = outlen;
return bin; return bin;
} }
char *pcp_z85_encode(byte *raw, size_t srclen, size_t *dstlen) { char *pcp_z85_encode(byte *raw, size_t srclen, size_t *dstlen, int doblock) {
int pos = 0; int pos = 0;
byte *padded; byte *padded;
size_t outlen, blocklen, zlen; size_t outlen, blocklen, zlen, padlen;
char *padblob = NULL;
char *z85 = NULL;
char *z85block = NULL;
if(srclen %4 == 0) { if(srclen %4 == 0) {
/* no padding required */ /* no padding required */
padded = raw; padded = raw;
outlen = srclen; outlen = srclen;
padlen = 0;
} }
else { else {
/* make z85 happy (size % 4) */ /* make z85 happy (size % 4) */
padded = pcp_padfour(raw, srclen, &outlen); padded = pcp_padfour(raw, srclen, &outlen);
padlen = outlen - srclen;
} }
/* encode to z85 */ /* encode to z85 */
zlen = (outlen * 5 / 4) + 1; zlen = (outlen * 5 / 4) + 1;
char *z85 = ucmalloc(zlen); z85 = ucmalloc(zlen + 5); /* plus space for pad blob */
z85 = zmq_z85_encode(z85, padded, outlen); z85 = zmq_z85_encode(z85, padded, outlen);
/* make it a 72 chars wide block */
blocklen = (zlen + ((zlen / 72) * 2)) + 1;
char *z85block = ucmalloc(blocklen);
char *z = &z85[0];
char *B = &z85block[0];
while(*z != '\0') {
if(pos >= 71) {
*B++ = '\r';
*B++ = '\n';
pos = 1;
}
else {
pos++;
}
*B++ = *z++;
}
*B = '\0';
*dstlen = blocklen;
free(z85);
if(srclen %4 != 0) if(srclen %4 != 0)
free(padded); free(padded);
return z85block; /* prepare pad blob */
padblob = ucmalloc(6);
snprintf(padblob, 6, "0000%ld", padlen);
/* append pad blob to encoded output */
memcpy(&z85[zlen-1], padblob, 5);
free(padblob);
zlen += 5;
if(doblock) {
/* make it a 72 chars wide block */
blocklen = (zlen + ((zlen / 72) * 2)) + 1;
z85block = ucmalloc(blocklen);
char *z = &z85[0];
char *B = &z85block[0];
while(*z != '\0') {
if(pos >= 71) {
*B++ = '\r';
*B++ = '\n';
pos = 1;
}
else {
pos++;
}
*B++ = *z++;
}
*B = '\0';
*dstlen = blocklen;
free(z85);
return z85block;
}
else {
*dstlen = zlen;
return z85;
}
} }
@@ -295,9 +328,9 @@ char *pcp_readz85string(PCPCTX *ptx, unsigned char *input, size_t bufsize) {
fatal(ptx, "Input file is empty!\n"); fatal(ptx, "Input file is empty!\n");
return NULL; return NULL;
} }
_dump("read", input, bufsize);
if(_buffer_is_binary(input, bufsize) > 0) { if(_buffer_is_binary(input, bufsize) > 0) {
fatal(ptx, "input is not z85 encoded and contains pure binary data\n"); fatal(ptx, "input is not z85 encoded and contains pure binary data at %ld\n", _buffer_is_binary(input, bufsize) );
return NULL; return NULL;
} }

View File

@@ -271,7 +271,7 @@ void pcp_exportsecret(char *keyid, int useid, char *outfile, int armor, char *pa
if(exported_sk != NULL) { if(exported_sk != NULL) {
if(armor == 1) { if(armor == 1) {
size_t zlen; size_t zlen;
char *z85 = pcp_z85_encode(buffer_get(exported_sk), buffer_size(exported_sk), &zlen); char *z85 = pcp_z85_encode(buffer_get(exported_sk), buffer_size(exported_sk), &zlen, 1);
fprintf(out, "%s\r\n%s\r\n%s\r\n", EXP_SK_HEADER, z85, EXP_SK_FOOTER); fprintf(out, "%s\r\n%s\r\n%s\r\n", EXP_SK_HEADER, z85, EXP_SK_FOOTER);
free(z85); free(z85);
} }
@@ -369,7 +369,7 @@ void pcp_exportpublic(char *keyid, char *passwd, char *outfile, int format, int
if(exported_pk != NULL) { if(exported_pk != NULL) {
if(armor == 1) { if(armor == 1) {
size_t zlen; size_t zlen;
char *z85 = pcp_z85_encode(buffer_get(exported_pk), buffer_size(exported_pk), &zlen); char *z85 = pcp_z85_encode(buffer_get(exported_pk), buffer_size(exported_pk), &zlen, 1);
fprintf(out, "%s\r\n%s\r\n%s\r\n", EXP_PK_HEADER, z85, EXP_PK_FOOTER); fprintf(out, "%s\r\n%s\r\n%s\r\n", EXP_PK_HEADER, z85, EXP_PK_FOOTER);
free(z85); free(z85);
} }
@@ -391,7 +391,7 @@ void pcp_exportpublic(char *keyid, char *passwd, char *outfile, int format, int
if(exported_pk != NULL) { if(exported_pk != NULL) {
/* PBP format requires armoring always */ /* PBP format requires armoring always */
size_t zlen; size_t zlen;
char *z85pbp = pcp_z85_encode(buffer_get(exported_pk), buffer_size(exported_pk), &zlen); char *z85pbp = pcp_z85_encode(buffer_get(exported_pk), buffer_size(exported_pk), &zlen, 1);
fprintf(out, "%s", z85pbp); fprintf(out, "%s", z85pbp);
free(z85pbp); free(z85pbp);
buffer_free(exported_pk); buffer_free(exported_pk);

View File

@@ -203,7 +203,7 @@ void pcppubkey_print(pcp_pubkey_t *key, FILE* out) {
fprintf(out, " Mail: %s\n", key->mail); fprintf(out, " Mail: %s\n", key->mail);
fprintf(out, " Key-ID: 0x%s\n", key->id); fprintf(out, " Key-ID: 0x%s\n", key->id);
fprintf(out, " Public-Key: %s\n", pcp_z85_encode(key->pub, 32, &zlen)); fprintf(out, " Public-Key: %s\n", pcp_z85_encode(key->pub, 32, &zlen, 1));
/* 2004-06-14T23:34:30. */ /* 2004-06-14T23:34:30. */
fprintf(out, " Creation Time: %04d-%02d-%02dT%02d:%02d:%02d\n", fprintf(out, " Creation Time: %04d-%02d-%02dT%02d:%02d:%02d\n",

View File

@@ -64,7 +64,7 @@ int pcpz85_encode(char *infile, char *outfile) {
} }
size_t zlen; size_t zlen;
char *encoded = pcp_z85_encode(input, inputBufSize, &zlen); char *encoded = pcp_z85_encode(input, inputBufSize, &zlen, 1);
if(encoded != NULL) { if(encoded != NULL) {
fprintf(out, "%s\n%s\n%s\n", PCP_ZFILE_HEADER, encoded, PCP_ZFILE_FOOTER); fprintf(out, "%s\n%s\n%s\n", PCP_ZFILE_HEADER, encoded, PCP_ZFILE_FOOTER);

View File

@@ -1,9 +1,9 @@
----- BEGIN ED25519-CURVE29915 PUBLIC KEY ----- ----- BEGIN ED25519-CURVE29915 PUBLIC KEY -----
1][S608)M?oD<3BoQn[bA5Y.x9f]x:Sl$G(amCxNK9.4<AUVAh{bC%Q]WXHAI.e)OD][P?h 1][S608}PxJV?5A[Wwp%=4UFF0I1o]]>&tIIBzr3%nx$4=*4{8i#6aJtj/@VxJwiF5I9{Zl
RA(gmAjC2{VkI%*03%1StS$-h(D2UHwzzKk4AXcEba29&08a-jh/<LL?u)GH!4K*bo^9)00 kaN)/[j#0H-IW7vAaR2lGb&u{eyD*Wb*pFTDUZ{3NjaZ&+K/2Z*qRV:oCmKZBfa8bo^9)00
0080SSi208)M?o-Ld[2M>5b0031<ZrDST00&(h00010nXSyG000Gy00SAaB7GxavqIGS)#E 0080SSi208}PxJSo4V2M>5b0033hD>3bR00&(h00010Yl>7*000Gy00SAaB7GxavqD.=Hr6
CG01xRx1POWzCwZ#jlsB[R0000i6Awmo3t<i=y*{*[Bu<UXv{%fN0003s01TKGP}7W&50b} t{01xRx1POWzCwZ#jlsB[R0000i6Awmo3t<i=y*{*[Bu<UXv{%fN0003s0beQl1D}jIQx3>
O1++lYGAq>t3nfctQ1tNuPtmJ!({r/O&2P[Ma]).MjeakB/faP7m3/ey.XHv1?:eZv50}CB !sze+H<WYV%Bxs*Z>EAMv{o]@Bn8y:fx]fDY)]3tXc]DE30b<tolU/.%Ha-GAOq&1A0<w<$
(iTB/MG}TKO4u}S(-J6mn2RAhRj6<-3-7Ci60-ig!G-tkF/-eD:(9chVwfOyWVna[k6&C6y NmW3vKI<bBRq8%&c*{eJHzE[8dtXoL<xkSFQr#fIhsC=(L8Xxz}^Q9@(WbUq8vk(fLdV$X}
0Mdk@qV/$ dkg8Jq@}U00003
----- END ED25519-CURVE29915 PUBLIC KEY ----- ----- END ED25519-CURVE29915 PUBLIC KEY -----

View File

@@ -19,8 +19,8 @@ static const char *tell[] = {
int main(int argc, char **argv) { int main(int argc, char **argv) {
int ret; int ret;
size_t clearlen = 256; size_t clearlen = 256;
size_t zlen = (clearlen * 5 / 4); size_t zlen;
char *z85;
PCPCTX *ptx = ptx_new(); PCPCTX *ptx = ptx_new();
if(argc < 2) { if(argc < 2) {
@@ -35,15 +35,15 @@ int main(int argc, char **argv) {
} }
byte *clear = urmalloc(256); byte *clear = urmalloc(256);
char *z85 = ucmalloc(zlen+1);
/* we encode directly */ /* encode it */
z85 = zmq_z85_encode(z85, clear, clearlen); z85 = pcp_z85_encode(clear, clearlen, &zlen, 0);
zlen -= 1;
if(z85 == NULL) { if(z85 == NULL) {
ret = FALSE; ret = FALSE;
if(ptx->pcp_errset == 0) { if(ptx->pcp_errset == 0) {
fatal(ptx, "failed to encoded data to Z85\n"); fatal(ptx, "failed to encode data to Z85\n");
} }
goto OUT; goto OUT;
} }

View File

@@ -1,9 +1,9 @@
----- BEGIN ED25519-CURVE29915 PUBLIC KEY ----- ----- BEGIN ED25519-CURVE29915 PUBLIC KEY -----
1][S608)M?n*eqKkH?l++@(u0.LHh*tkldO3Ihr{AcL}WsD*kTjhV:vP:(GSDY*}tc!*NG* 1][S608}PxJuHxvv>P+rA6Q-eDxXMO?G/{bOUdC(izVt8x*5MjEcaq9>E8p$YS1J9n#>tnD
#^{JV%!mWkveUa-b#Br5[]X)U+1=UkFl)HHU8Hx+h?Y12&mZs}/PGIT{c3xWK81%bo^9)00 6Cd$3dT0*1h9h1h-ng@K?slf6y2(32y7y#L8je>zu^KLbhUDv(C?j[ja%7DGeAVKbo^9)00
0080SSi208)M?n=O?>2M>5b0031<ZrcAQ00&(h00010nXSsE000Gy00SAaB7GxavqJ]t!.{ 0080SSi208}PxJq@}U2M>5b0033hD<{5Q00&(h00010Yl>4/000Gy00SAaB7GxavqLm=j5(
Gd01P+z1PO:BCwZ#jl2pmBx<*#w02caE1on<EvqfK^y?Wx[vl!TEv{%fN0003s08B.BcYFb mX01P+z1PO:BCwZ#jl2pmBx<*#w02caE1on<EvqfK^y?Wx[vl!TEv{%fN0003s0c0J7y-Bj
*5S0QQCzg!q&?l.40Rb#mQY?F>rbYic]}e8iE#EyH5pAv+q3(o0KRay}KED($B1D03v+85y YLoZ9SoZ]zK-Qe1K}EfCYlU>d8K&s3O*hED>I+d%S&?OYIOaKl7JgH}0Go#pwA]KB(kaxr%
59qPN[EyDzWq<i?4!8dGJ.o<$8k2YeMuH^[E6nS/SqC%R/yM+Yo=Vu*Wd(46YjiGKKM#]b& 3.-h$:}>pn8zqF]laLMCoq/jZnyh+Z7f5(kEHwA#lyfj67EznX:PRrNTu0XlpiwUpup![rV
X4$Vd7Nk-W/uyd .F^+[nU{v(&m1=00003
----- END ED25519-CURVE29915 PUBLIC KEY ----- ----- END ED25519-CURVE29915 PUBLIC KEY -----

View File

@@ -1,8 +1,8 @@
----- BEGIN ED25519-CURVE29915 PRIVATE KEY ----- ----- BEGIN ED25519-CURVE29915 PRIVATE KEY -----
5u%W6TXtCe8k^+2Y]Ov7koRK.YAroCq[EmPF[K?P7CtUefzQ=N.Jxt99?IBqLU(abi3Lgt} l*hbuk#Y3g53P1k!cmMJrXmbAO)PC3Ne5x)&OvW&{fpvkoxL=)T<p)FDfM3S9O8==1%3iB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}Q2cd(}HmES-Pozbo^9)00 mR[x6>?1v4e%d5A$jE5:%u0zJP94M[FkdkBc/*EPOaX(mmK{>bC&+qxOxf[UQ6q(bo^9)00
0080SSi208)M?o8[}(2M>5b0031<ZrlGR00&(h00010nXSvF000Gy00SAaB7GxavqDG^w9: 0080SSi208}PxJSo4V2M>5b0033hD>3bR00&(h00010Yl>4/000Gy00SAaB7GxavqFFeUsw
f}01GXy1POZACwZ#jlt{sxC(N*A6bgAH01iTLx(4l%vQ:QFy&r/(yYBCn0uh1PE:!(ia(}o M)01GXy1POZACwZ#jlt{sxC(N*A6bgAH01iTLx(4l%vQ:QFy&r/(yYBCn0uh3qSXng*N(7P
Vmt*m9ZW@+sQ:^O6HV][YFXlN}V!4Eh+CvGxiJO7W463t7CaCy9d0g6[)&OyerHo)UFm]fj DZissLHR2T5SD#[/&2m+Iwkc6!S/rgDIgKsrtSDuB.VZA{QD}ShyggUo@0eWE8}(#TDDupu
}2MxCbxJ(o-+KnLr2MFF*)E<&TjmGqD}>rWY$%*#E{0F$@^c&])9EKG@Gj:2c3jKx9zgD.] &J6IU.1EtQjwF=jG4{S6h2epu39BiqS5xoLyxfT4NOi}Gm*Sd@v8@Q=uFGi3dnB5kJj!}1h
j)u?@cwCB 87y7{(@#500001
----- END ED25519-CURVE29915 PUBLIC KEY ----- ----- END ED25519-CURVE29915 PUBLIC KEY -----

View File

@@ -1,8 +1,8 @@
----- BEGIN ED25519-CURVE29915 PRIVATE KEY ----- ----- BEGIN ED25519-CURVE29915 PRIVATE KEY -----
=OJ[EglpH!]AK8Wtm$+L/kTBGSr&YBRl3$rmsD}>O6YmJW-(WevNA7]]J{5ii1.Q.r1[lp) oIme#QsTbLK!{=GqE{LPyinNkS9@}AuxhKunBEm%aAL7BDnu^iuF-jx?7$0M@!LL+j&Y>wo
z5*9uKH&3b*DlG:?T4OHyLp@gSOfDHGCU*&Ph8KYeY#-=zg}d=08p$VPh1%@^RZj8B7LS^/ sBb)jNY)uR)#?fQMB)37KL5a{9aImj8>e&%2JzR[xAIt^3TCO3xpvrJpc&7X#Q4y!Avzv@4
wU]vOz%DJKO&kEN)-V1tP=+1/L$HJ/*lf:t[FybaBR62.WG+Fi/E=8Iu}D0%UL?8q3N8lUx oQG)$0/6W.5/]i&lx?gyeV&lg+4^XgXv6UR9bb[ufq!xalrcnaLrlk%y>x5}<zMRSoBFkgl
$uktDv.2{hi[oxl#ajyrcaP5:CC0$H:Qo]ti10rO-6{MJ9SLmh$i3RwIlem8[hrB8-b=[[& .qQ?XlWjosDFA:s<5JDKfrX[n$UrN)T<rz#>$>]1.^si6EBL$(h#}gS9Wn{GXUqgO4sAs6W
q8HAEvfoJG+DETVCC>DZuxKHkP[19DRTkL3.aC}{WhapK4awVY(JgwruXppNjVHdUU2)z!) I*o^RucnR]B((HTV/1-tUW&^qv+8*@IS%nraQ?kK4nsmHsS]&imY.vI@W?JtPlNhaQ:T]jK
cy?oCdI/1SnJx9f+X<x&o<0%K[->>8evejVbWfX]X%1k-fBe:Qh1L3^m[KD5 9Bn0+wi>EP)wa{Kx&1)@E}9EjgjL^s-)ztQ}os^TO6TsS(E9iw^j+%nDFY&T00000
----- END ED25519-CURVE29915 PRIVATE KEY ----- ----- END ED25519-CURVE29915 PRIVATE KEY -----

View File

@@ -1,6 +1,6 @@
bartid = 0xB389A718C85E3A64 bartid = 0x7A88E19429C196D8
bartserial = 0x9D75EF8F bartserial = 0x170886C8
idbobby = 0x1B0B4712982982C8 idbobby = 0xAE1098607B00C2B8
idalicia = 0x32092E3EDBA01044 idalicia = 0x437A76EDE40D67EC
mailbobby = bobby@local mailbobby = bobby@local
mailalicia = alicia@local mailalicia = alicia@local

View File

@@ -6,32 +6,26 @@
#include <pcp.h> #include <pcp.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
if(argc < 4) { if(argc < 3) {
fprintf(stderr, "Usage: pipetest <read-blocksize> <z85-blocksize> <d|e>\n"); fprintf(stderr, "Usage: pipetest <read-blocksize> <d|e>\n");
fprintf(stderr, "d - decode\ne - encode\n"); fprintf(stderr, "d - decode\ne - encode\n");
return 1; return 1;
} }
size_t rblocksize; size_t blocksize;
size_t zblocksize;
char mode; char mode;
if((rblocksize = strtol(argv[1], NULL, 0)) == 0) { if((blocksize = strtol(argv[1], NULL, 0)) == 0) {
fprintf(stderr, "Error: invalid read blocksize %s\n", argv[1]); fprintf(stderr, "Error: invalid read blocksize %s\n", argv[1]);
return 1; return 1;
} }
if((zblocksize = strtol(argv[2], NULL, 0)) == 0) { if(blocksize % 4 != 0) {
fprintf(stderr, "Error: invalid z85 blocksize %s\n", argv[2]);
return 1;
}
if(zblocksize % 4 != 0) {
fprintf(stderr, "Error: z85 blocksize shall be divisible by 4\n"); fprintf(stderr, "Error: z85 blocksize shall be divisible by 4\n");
return 1; return 1;
} }
mode = argv[3][0]; mode = argv[2][0];
if(mode != 'd' && mode != 'e') { if(mode != 'd' && mode != 'e') {
fprintf(stderr, "Error: invalid mode %s\n", argv[3]); fprintf(stderr, "Error: invalid mode %s\n", argv[3]);
@@ -43,14 +37,14 @@ int main(int argc, char **argv) {
size_t got; size_t got;
if(mode == 'e') if(mode == 'e')
ps_armor(out, zblocksize); ps_armor(out, blocksize);
else else
ps_setdetermine(in, zblocksize); ps_setdetermine(in, blocksize);
void *buf = ucmalloc(rblocksize); void *buf = ucmalloc(blocksize);
while(!ps_end(in)) { while(!ps_end(in)) {
got = ps_read(in, buf, rblocksize); got = ps_read(in, buf, blocksize);
if(got > 0) if(got > 0)
ps_write(out, buf, got); ps_write(out, buf, got);
} }

View File

@@ -1,33 +1,33 @@
size_t secret_a_len = 32; size_t secret_a_len = 32;
unsigned char secret_a[32] = { unsigned char secret_a[32] = {
0x88, 0x7c, 0x08, 0x37, 0xed, 0x3b, 0x72, 0x0f, 0x58, 0x08, 0xc7, 0x3b, 0xfb, 0xc5, 0x85, 0xe2,
0x5c, 0xc1, 0x1c, 0x83, 0xe4, 0x04, 0xbe, 0xca, 0x00, 0xbb, 0x75, 0x31, 0x05, 0xb1, 0xed, 0xb9,
0xff, 0x23, 0x7c, 0x32, 0xf3, 0x2b, 0x03, 0x9c, 0x8b, 0xc8, 0xf5, 0x05, 0x23, 0xf5, 0xda, 0x8d,
0x6e, 0x1c, 0xd5, 0xdb, 0x19, 0x3b, 0x3a, 0x5b 0x46, 0xca, 0xb1, 0x3c, 0xb4, 0xe2, 0xaa, 0x65
}; };
size_t public_a_len = 32; size_t public_a_len = 32;
unsigned char public_a[32] = { unsigned char public_a[32] = {
0x7a, 0xa9, 0x18, 0x30, 0xf1, 0xab, 0xca, 0x88, 0x5d, 0x55, 0x3b, 0xf1, 0xa9, 0xf9, 0xaa, 0x69,
0x14, 0x7b, 0x72, 0x8a, 0x4f, 0xc0, 0x09, 0x37, 0x2c, 0x21, 0x9f, 0x90, 0x02, 0xd7, 0xab, 0x3d,
0xa6, 0xd6, 0x74, 0x24, 0xc5, 0x06, 0x5f, 0x5a, 0x6c, 0xce, 0xa3, 0xb3, 0x5a, 0x23, 0xd9, 0x92,
0xf7, 0x15, 0x0c, 0xb7, 0x2c, 0x0c, 0x45, 0x7a 0x9f, 0x0a, 0x6c, 0xee, 0x8c, 0x59, 0x7a, 0x3a
}; };
size_t secret_b_len = 32; size_t secret_b_len = 32;
unsigned char secret_b[32] = { unsigned char secret_b[32] = {
0x28, 0x19, 0x3f, 0x07, 0x66, 0xc8, 0x1c, 0x60, 0xa8, 0xce, 0x93, 0x86, 0xff, 0xa9, 0x16, 0xdc,
0xf5, 0x56, 0x48, 0xa2, 0x8e, 0x74, 0xd1, 0x0c, 0x88, 0x2a, 0xd3, 0xab, 0x30, 0x25, 0x9c, 0xf0,
0xe6, 0x9f, 0x16, 0x06, 0x9b, 0x04, 0x6d, 0xe9, 0x6e, 0x5e, 0x4e, 0x83, 0x7d, 0x96, 0xa1, 0x08,
0x0f, 0x7c, 0x2a, 0x36, 0xee, 0xad, 0xb4, 0x59 0x18, 0x44, 0x30, 0x68, 0x9b, 0xb7, 0xd0, 0x5f
}; };
size_t public_b_len = 32; size_t public_b_len = 32;
unsigned char public_b[32] = { unsigned char public_b[32] = {
0x62, 0xa7, 0xad, 0xce, 0x41, 0x45, 0x49, 0x5e, 0x71, 0xb3, 0x81, 0xa1, 0x16, 0xfd, 0x37, 0x3d,
0xc9, 0xb0, 0xe9, 0xc9, 0x45, 0x82, 0x79, 0x9e, 0xff, 0xd6, 0xb3, 0xb3, 0xd3, 0x8e, 0xe0, 0xaa,
0x47, 0x1b, 0x71, 0x7c, 0xbd, 0x2d, 0xda, 0x8d, 0xb6, 0xf9, 0x01, 0xf8, 0xe7, 0xfc, 0xc3, 0x6a,
0x8a, 0xb8, 0xc5, 0x5e, 0x14, 0x2d, 0x35, 0x7e 0x7a, 0xfe, 0xab, 0x09, 0x52, 0x22, 0x45, 0x63
}; };
size_t message_len = 12; size_t message_len = 12;
@@ -38,16 +38,16 @@ unsigned char message[12] = {
size_t nonce_len = 24; size_t nonce_len = 24;
unsigned char nonce[24] = { unsigned char nonce[24] = {
0xa6, 0x53, 0x14, 0x2a, 0x7c, 0x31, 0x53, 0xc9, 0xf9, 0x40, 0x18, 0xd2, 0xdc, 0xf6, 0xab, 0x80,
0xcb, 0x44, 0x83, 0x1e, 0xf3, 0x15, 0xa5, 0x81, 0xfb, 0xe0, 0x77, 0x59, 0x21, 0xaa, 0xd5, 0xa6,
0x2b, 0x1f, 0x10, 0xb6, 0x31, 0x68, 0x2c, 0x88 0xd3, 0xe1, 0x8b, 0xc4, 0xbd, 0x22, 0xee, 0xbc
}; };
size_t cipher_len = 28; size_t cipher_len = 28;
unsigned char cipher[28] = { unsigned char cipher[28] = {
0x7a, 0x4f, 0x59, 0x9b, 0x27, 0x3c, 0x22, 0x6c, 0x74, 0x81, 0x08, 0x7c, 0xf6, 0x45, 0xd0, 0x99,
0x5f, 0x25, 0xd0, 0x01, 0x17, 0x61, 0x6e, 0x6c, 0x58, 0x79, 0xbb, 0x84, 0x40, 0x0a, 0x13, 0x8a,
0xf0, 0x62, 0x0c, 0x81, 0x6c, 0x58, 0x57, 0x2b, 0x73, 0x1a, 0x2b, 0x4f, 0x13, 0x57, 0x15, 0xfb,
0x0b, 0x38, 0x48, 0x12 0x07, 0x7e, 0x06, 0x88
}; };

View File

@@ -37,34 +37,24 @@ include keys.cfg
<test check-streams> <test check-streams>
<test check-streams-8-8> <test check-streams-8>
md5 = `./md5 ../COPYING` md5 = `./md5 ../COPYING`
cmd = ./pipetest 8 8 e < ../COPYING | ./pipetest 8 8 d | ./md5 cmd = ./pipetest 8 e < ../COPYING | ./pipetest 8 d | ./md5
expect = /$md5/ expect = /$md5/
</test> </test>
<test check-streams-8-16> <test check-streams-16>
md5 = `./md5 ../COPYING` md5 = `./md5 ../COPYING`
cmd = ./pipetest 8 16 e < ../COPYING | ./pipetest 8 16 d | ./md5 cmd = ./pipetest 16 e < ../COPYING | ./pipetest 16 d | ./md5
expect = /$md5/ expect = /$md5/
</test> </test>
<test check-streams-16-8> <test check-streams-32>
md5 = `./md5 ../COPYING` md5 = `./md5 ../COPYING`
cmd = ./pipetest 16 8 e < ../COPYING | ./pipetest 16 8 d | ./md5 cmd = ./pipetest 32 e < ../COPYING | ./pipetest 32 d | ./md5
expect = /$md5/ expect = /$md5/
</test> </test>
<test check-streams-64-32> <test check-streams-64>
md5 = `./md5 ../COPYING` md5 = `./md5 ../COPYING`
cmd = ./pipetest 64 32 e < ../COPYING | ./pipetest 64 32 d | ./md5 cmd = ./pipetest 64 e < ../COPYING | ./pipetest 64 d | ./md5
expect = /$md5/
</test>
<test check-streams-32-64>
md5 = `./md5 ../COPYING`
cmd = ./pipetest 32 64 e < ../COPYING | ./pipetest 32 64 d | ./md5
expect = /$md5/
</test>
<test check-streams-64-64>
md5 = `./md5 ../COPYING`
cmd = ./pipetest 64 64 e < ../COPYING | ./pipetest 64 64 d | ./md5
expect = /$md5/ expect = /$md5/
</test> </test>
</test> </test>

View File

@@ -1,9 +1,9 @@
----- BEGIN ED25519-CURVE29915 PUBLIC KEY ----- ----- BEGIN ED25519-CURVE29915 PUBLIC KEY -----
1][S608)M?o^bg=DTHr&HDQ5Mh#oh$WhV!KxwM}<9O<?nhj1eRZ=ih*2ZasEg=/(#lC}GnB 1][S608}PxJV>G/!8Vhi)6Yjo!DqLQW5^vbPD}hvgBgfIFYGdsF77eJBiMBwyG&+-To2i}B
3mCFxO.KVo3No)A4:e<oy}H-iAXt4i]SyR7O!G&einwun9dW.@m-}(>G&*Ls26^#bo^9)00 gL#xzQ2xNoQbS-@TJ#x*^T-MRClOblFE]jR?lEgVR$y7Q[L>z5EUww{J=kA+%IHNbo^9)00
0080SSi208)M?p5>m]2M>5b0031<ZrMYU00&(h00010nXSBH000Gy00SAaB7GxavqDD15([ 0080SSi208}PxJ@PdW2M>5b0033hD>chS00&(h00010Yl>7*000Gy00SAaB7GxavqHsVvL!
#j01Y?A1PO^CCwZ#jphaoRvqYPQ000-F00Aohzddc{zFrW0vqYQvy&r/(yYBCn0uh3ncv:q 5+01Y?A1PO^CCwZ#jphaoRvqYPQ000-F00Aohzddc{zFrW0vqYQvy&r/(yYBCn0uh2cID>+
amE.-Ce{OV2w:{/F65Nh#h0nM9i/iHLWG+rRzO2(2m@Q2RDnPBI^Jk4xC7:jGEe]kk[>Y3- C0tc$Ga.-{JG^nWb+c)h6dy{}!p(HtZ/X28Vr{%rAl73K1KU-cUF(&!lXL^itwL^l)gNRM1
jKBN$o)!WM2@+zcuO?{a.G[ioHP^t4MHXKS=uFuFPAZ^l]VC3byZ{nY*sYGvW:rZ(zRb-E0 B/C<=9Ysfd@hKyQ0$g(f+=%dOD.zeUGy#[j@Kt:srRjF<hY)Ma6{Er4+tD#[AG[ImXf^ke@
a3X57iYnuonC?k 8aZ[g(jL55=QkV00001
----- END ED25519-CURVE29915 PUBLIC KEY ----- ----- END ED25519-CURVE29915 PUBLIC KEY -----

View File

@@ -1,8 +1,8 @@
----- BEGIN ED25519-CURVE29915 PRIVATE KEY ----- ----- BEGIN ED25519-CURVE29915 PR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