rewrote z85 stream decoder (again), using hyphens again. clearsig doesn't work yet, a newline problem...

This commit is contained in:
TLINDEN
2014-03-01 18:51:25 +01:00
parent b8552af5e9
commit 4253e1088f
16 changed files with 201 additions and 123 deletions

View File

@@ -58,15 +58,15 @@ typedef unsigned short dbyte; /* Double byte = 16 bits */
typedef unsigned int qbyte; /* Quad byte = 32 bits */ typedef unsigned int qbyte; /* Quad byte = 32 bits */
/* key stuff, deprecated. */ /* key stuff, deprecated. */
#define PCP_ENFILE_HEADER "~~~~~ BEGIN PCP ENCRYPTED FILE ~~~~~\r\n" #define PCP_ENFILE_HEADER "----- BEGIN PCP ENCRYPTED FILE -----\r\n"
#define PCP_ENFILE_FOOTER "\r\n~~~~~ END PCP ENCRYPTED FILE ~~~~~\r\n" #define PCP_ENFILE_FOOTER "\r\n----- END PCP ENCRYPTED FILE -----\r\n"
#define PCP_ZFILE_HEADER "~~~~~ BEGIN Z85 ENCODED FILE ~~~~~" #define PCP_ZFILE_HEADER "----- BEGIN Z85 ENCODED FILE -----"
#define PCP_ZFILE_FOOTER "~~~~~ END Z85 ENCODED FILE ~~~~~" #define PCP_ZFILE_FOOTER "----- END Z85 ENCODED FILE -----"
#define PCP_SIG_HEADER "~~~~~ BEGIN ED25519 SIGNED MESSAGE ~~~~~" #define PCP_SIG_HEADER "----- BEGIN ED25519 SIGNED MESSAGE -----"
#define PCP_SIG_START "~~~~~ BEGIN ED25519 SIGNATURE ~~~~~" #define PCP_SIG_START "----- BEGIN ED25519 SIGNATURE -----"
#define PCP_SIG_END "~~~~~ END ED25519 SIGNATURE ~~~~~" #define PCP_SIG_END "----- END ED25519 SIGNATURE -----"
#define PCP_SIGPREFIX "\nnacl-" #define PCP_SIGPREFIX "\nnacl-"
#define PCP_ME "Pretty Curved Privacy" #define PCP_ME "Pretty Curved Privacy"

View File

@@ -109,10 +109,10 @@ typedef struct _pcp_ks_bundle_t pcp_ks_bundle_t;
#define EXP_SIG_SUB_KEYFLAGS 27 #define EXP_SIG_SUB_KEYFLAGS 27
/* in armored mode, we're using the usual head+foot */ /* in armored mode, we're using the usual head+foot */
#define EXP_PK_HEADER "~~~~~BEGIN ED25519-CURVE29915 PUBLIC KEY~~~~~" #define EXP_PK_HEADER "----- BEGIN ED25519-CURVE29915 PUBLIC KEY -----"
#define EXP_PK_FOOTER "~~~~~END ED25519-CURVE29915 PUBLIC KEY~~~~~" #define EXP_PK_FOOTER "----- END ED25519-CURVE29915 PUBLIC KEY -----"
#define EXP_SK_HEADER "~~~~~BEGIN ED25519-CURVE29915 PRIVATE KEY~~~~~" #define EXP_SK_HEADER "----- BEGIN ED25519-CURVE29915 PRIVATE KEY -----"
#define EXP_SK_FOOTER "~~~~~END ED25519-CURVE29915 PRIVATE KEY~~~~~" #define EXP_SK_FOOTER "----- END ED25519-CURVE29915 PRIVATE KEY -----"
/* pubkey export formats */ /* pubkey export formats */

View File

@@ -114,6 +114,8 @@ size_t ps_read_raw(Pcpstream *stream, void *buf, size_t readbytes) {
} }
} }
// fprintf(stderr, " ps_read_raw, idx: %ld, readbytes: %ld\n", idx, readbytes);
if(stream->is_buffer) { if(stream->is_buffer) {
/* check if there's enough space in our buffer */ /* check if there's enough space in our buffer */
if(buffer_left(stream->b) < readbytes) if(buffer_left(stream->b) < readbytes)
@@ -144,23 +146,24 @@ size_t ps_read_raw(Pcpstream *stream, void *buf, size_t readbytes) {
that */ that */
size_t ps_read_cached(Pcpstream *stream, void *buf, size_t readbytes) { size_t ps_read_cached(Pcpstream *stream, void *buf, size_t readbytes) {
/*
fprintf(stderr, "%ld <= %ld && %ld <= %ld\n", fprintf(stderr, "%ld <= %ld && %ld <= %ld\n",
readbytes, buffer_left(stream->cache), readbytes, stream->blocksize) ; readbytes, buffer_left(stream->cache), readbytes, stream->blocksize) ;
fprintf(stderr, "%d == 1 && %ld >= %ld\n", ps_left(stream), readbytes, buffer_left(stream->cache)); fprintf(stderr, "%d == 1 && %ld >= %ld\n",
ps_end(stream), readbytes, buffer_left(stream->cache));
*/
if(readbytes <= buffer_left(stream->cache) && readbytes <= stream->blocksize) { if(readbytes <= buffer_left(stream->cache) && readbytes <= stream->blocksize) {
/* enough left in current cache */ /* enough left in current cache */
fprintf(stderr, " get all from cache\n"); // fprintf(stderr, " get all from cache\n");
return buffer_get_chunk(stream->cache, buf, readbytes); return buffer_get_chunk(stream->cache, buf, readbytes);
} }
else if(ps_end(stream) == 1 && readbytes >= buffer_left(stream->cache) ) { else if(ps_end(stream) == 1 && readbytes >= buffer_left(stream->cache) ) {
fprintf(stderr, " get rest from cache\n"); // fprintf(stderr, " get rest from cache\n");
return buffer_get_chunk(stream->cache, buf, buffer_left(stream->cache)); return buffer_get_chunk(stream->cache, buf, buffer_left(stream->cache));
} }
else { else {
fprintf(stderr, " fetch next\n"); // fprintf(stderr, " fetch next\n");
/* request for chunk larger than what we've got in the cache */ /* request for chunk larger than what we've got in the cache */
Buffer *tmp = buffer_new(stream->blocksize, "Pcpreadchunktmp"); Buffer *tmp = buffer_new(stream->blocksize, "Pcpreadchunktmp");
@@ -169,7 +172,7 @@ size_t ps_read_cached(Pcpstream *stream, void *buf, size_t readbytes) {
buffer_get_chunk_tobuf(stream->cache, tmp, buffer_left(stream->cache)); buffer_get_chunk_tobuf(stream->cache, tmp, buffer_left(stream->cache));
} }
#error EOF reached, cache empty, save filled, doesnt call ps_read_next() //#error EOF reached, cache empty, save filled, doesnt call ps_read_next()
/* how much left to fetch */ /* how much left to fetch */
long int left = readbytes - buffer_size(tmp); long int left = readbytes - buffer_size(tmp);
@@ -177,8 +180,10 @@ size_t ps_read_cached(Pcpstream *stream, void *buf, size_t readbytes) {
/* fetch and decode data until tmp is filled */ /* fetch and decode data until tmp is filled */
while (left > 0) { while (left > 0) {
/* not enough cached, fetch the next chunk */ /* not enough cached, fetch the next chunk */
// fprintf(stderr, " fetch next read_next\n");
if(ps_read_next(stream) == 0) if(ps_read_next(stream) == 0)
break; break;
// fprintf(stderr, " fetch next read_continue\n");
/* need to fetch more? */ /* need to fetch more? */
left = readbytes - (buffer_size(tmp) + buffer_size(stream->next)); left = readbytes - (buffer_size(tmp) + buffer_size(stream->next));
@@ -220,6 +225,7 @@ size_t ps_read_cached(Pcpstream *stream, void *buf, size_t readbytes) {
/* read and decode the next chunk and put it into stream->next */ /* read and decode the next chunk and put it into stream->next */
size_t ps_read_next(Pcpstream *stream) { size_t ps_read_next(Pcpstream *stream) {
// fprintf(stderr, " ps_read_next ps_left: %d, ps_end: %d, save_left: %ld\n", ps_left(stream), ps_end(stream), buffer_left(stream->save));
if(ps_left(stream) == 0 || buffer_left(stream->save)) { if(ps_left(stream) == 0 || buffer_left(stream->save)) {
if(stream->armor == 1) { if(stream->armor == 1) {
/* fetch next chunk and decode it */ /* fetch next chunk and decode it */
@@ -245,7 +251,7 @@ size_t ps_read(Pcpstream *stream, void *buf, size_t readbytes) {
else if(buffer_size(stream->cache) > 0) { else if(buffer_size(stream->cache) > 0) {
/* use cache */ /* use cache */
got = ps_read_cached(stream, buf, readbytes); got = ps_read_cached(stream, buf, readbytes);
fprintf(stderr, "%ld = use cache directly\n", got); // fprintf(stderr, "%ld = use cache directly\n", got);
} }
else { else {
/* no cache yet */ /* no cache yet */
@@ -254,13 +260,13 @@ size_t ps_read(Pcpstream *stream, void *buf, size_t readbytes) {
recursively call ps_read() again to return the apropriate data */ recursively call ps_read() again to return the apropriate data */
ps_determine(stream); ps_determine(stream);
got = ps_read(stream, buf, readbytes); got = ps_read(stream, buf, readbytes);
fprintf(stderr, "%ld = ps_read(stream, buf, readbytes);\n", got); // fprintf(stderr, "%ld = ps_read(stream, buf, readbytes);\n", got);
} }
else if(stream->armor == 1) { else if(stream->armor == 1) {
/* z85 encoding has already been determined, therefore the cache /* z85 encoding has already been determined, therefore the cache
is now filled, use it then */ is now filled, use it then */
got = ps_read_cached(stream, buf, readbytes); got = ps_read_cached(stream, buf, readbytes);
fprintf(stderr, "%ld = ps_read_cached(stream, buf, readbytes);\n", got); // fprintf(stderr, "%ld = ps_read_cached(stream, buf, readbytes);\n", got);
} }
else { else {
/* read directly from source */ /* read directly from source */
@@ -269,27 +275,33 @@ size_t ps_read(Pcpstream *stream, void *buf, size_t readbytes) {
} }
stream->pos += got; stream->pos += got;
fprintf(stderr, " ps_read(): %ld\n", got); // fprintf(stderr, " ps_read(): %ld\n", got);
return got; return got;
} }
int ps_readline(Pcpstream *stream, Buffer *line) { int ps_readline(Pcpstream *stream, Buffer *line) {
int c = 0, max = 1; int c = -1, max = 1;
byte b[1]; byte b[1];
while(c<PSMAXLINE) { while(c<PSMAXLINE) {
// fprintf(stderr, " ps_readline: call raw\n");
if(ps_read_raw(stream, b, 1) < 1) { if(ps_read_raw(stream, b, 1) < 1) {
// fprintf(stderr, " ps_readline: raw returned < 1\n");
max = 0; max = 0;
break; /* eof or err */ break; /* eof or err */
} }
if(*b == '\r') { if(*b == '\r') {
// fprintf(stderr, " ps_readline: raw found CR\n");
continue; continue;
} }
else if(*b == '\n' || ps_left(stream) == 1) { else if(*b == '\n' || ps_left(stream) == 1) {
// fprintf(stderr, " ps_readline: raw found NL\n");
c++;
max = 0; max = 0;
break; break;
} }
else { else {
// fprintf(stderr, " ps_readline: raw found regular\n");
buffer_add8(line, *b); buffer_add8(line, *b);
} }
c++; c++;
@@ -304,6 +316,8 @@ int ps_readline(Pcpstream *stream, Buffer *line) {
return -1; return -1;
} }
// fprintf(stderr, " ps_readline: raw return %d\n", c);
return c; return c;
} }
@@ -342,22 +356,29 @@ size_t ps_read_decode(Pcpstream *stream) {
Buffer *z = buffer_new(32, "ztemp"); Buffer *z = buffer_new(32, "ztemp");
Buffer *line = buffer_new_str("line"); Buffer *line = buffer_new_str("line");
buffer_info(stream->save); // buffer_info(stream->save);
if(buffer_left(stream->save) >= stream->blocksize && stream->firstread == 1) {
if(buffer_left(stream->save) > stream->blocksize){// && stream->firstread == 1) {
/* use the save buffer instead */ /* use the save buffer instead */
/* fprintf(stderr, " ps_read_next get chunk from save %ld >= %ld\n",
buffer_left(stream->save), stream->blocksize); */
buffer_get_chunk_tobuf(stream->save, z, stream->blocksize); buffer_get_chunk_tobuf(stream->save, z, stream->blocksize);
} }
else if(ps_left(stream) == 1 && buffer_left(stream->save) > 0) { else if(ps_left(stream) == 1 && buffer_left(stream->save) > 0) {
/* there's something left which doesn't end in a newline */ /* there's something left which doesn't end in a newline */
buffer_get_chunk_tobuf(stream->save, z, stream->blocksize); // fprintf(stderr, " ps_read_next which doesn't end in a newline\n");
buffer_get_chunk_tobuf(stream->save, z, buffer_left(stream->save));
buffer_dump(z);
fatals_ifany();
} }
else { else {
/* continue reading linewise */ /* continue reading linewise */
// fprintf(stderr, " ps_read_next while(%ld < %ld)\n", buffer_size(z), stream->blocksize);
while(buffer_size(z) < stream->blocksize) { while(buffer_size(z) < stream->blocksize) {
buffer_clear(line); buffer_clear(line);
if(ps_readline(stream, line) >= 0) { if(ps_readline(stream, line) >= 0) {
fprintf(stderr, "got: <%s>\n", buffer_get_str(line)); // fprintf(stderr, "got: <%s>\n", buffer_get_str(line));
if(z85_isbegin(line) && stream->have_begin == 0) { if(z85_isbegin(line) && stream->have_begin == 0) {
/* begin header encountered */ /* begin header encountered */
stream->have_begin = 1; /* otherwise ignore it */ stream->have_begin = 1; /* otherwise ignore it */
@@ -373,17 +394,21 @@ size_t ps_read_decode(Pcpstream *stream) {
} }
else { else {
/* regular z85 encoded content */ /* regular z85 encoded content */
fprintf(stderr, "regular\n"); // fprintf(stderr, "regular\n");
// fprintf(stderr, " %ld + %ld > %ld\n", buffer_size(z), buffer_size(line), stream->blocksize);
if(buffer_size(z) + buffer_size(line) > stream->blocksize) { if(buffer_size(z) + buffer_size(line) > stream->blocksize) {
/* we've got more than needed. /* we've got more than needed.
put what we need into z and the remainder put what we need into z and the remainder
into the save buffer for further reading. */ into the save buffer for further reading. */
fprintf(stderr, "overflow %ld + %ld > %ld\n", /* fprintf(stderr, "overflow %ld + %ld > %ld\n",
buffer_size(z), buffer_size(line), stream->blocksize); buffer_size(z), buffer_size(line), stream->blocksize);
*/
buffer_get_chunk_tobuf(line, z, stream->blocksize - buffer_size(z)); buffer_get_chunk_tobuf(line, z, stream->blocksize - buffer_size(z));
buffer_get_chunk_tobuf(line, stream->save, buffer_left(line)); buffer_get_chunk_tobuf(line, stream->save, buffer_left(line));
buffer_add8(stream->save, '\n'); if(!ps_left(stream)) {
/* only add the newline if there's no more to follow */
buffer_add8(stream->save, '\n');
}
break; break;
} }
else { else {
@@ -393,17 +418,19 @@ size_t ps_read_decode(Pcpstream *stream) {
} }
} }
else { else {
// fprintf(stderr, " ps_read_next readline returned 0\n");
/* eof or err */ /* eof or err */
break; break;
} }
} }
} }
fprintf(stderr, "Z: <%s>\n", buffer_get_str(z)); // fprintf(stderr, "Z: <%s>\n", buffer_get_str(z));
/* finally, decode it and put into next */ /* finally, decode it and put into next */
size_t binlen, outlen; size_t binlen, outlen;
byte *bin = pcp_z85_decode(buffer_get_str(z), &binlen); byte *bin = pcp_z85_decode(buffer_get_str(z), &binlen);
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) {
@@ -421,6 +448,7 @@ size_t ps_read_decode(Pcpstream *stream) {
else { else {
/* yes, successfully decoded it, put into cache */ /* yes, successfully decoded it, put into cache */
buffer_add(stream->next, bin, binlen); buffer_add(stream->next, bin, binlen);
// fprintf(stderr, "ps_read_decode decoded: <%s>\n", buffer_get_str(stream->next));
outlen = binlen; outlen = binlen;
} }
@@ -626,6 +654,11 @@ void ps_close(Pcpstream *stream) {
} }
int ps_end(Pcpstream *stream) { int ps_end(Pcpstream *stream) {
/* bail out if we have errors! */
if(ps_err(stream)) {
return 1;
}
/* simulate open file if there's still something in the cache */ /* simulate open file if there's still something in the cache */
if(stream->cache != NULL) { if(stream->cache != NULL) {
if(buffer_left(stream->cache) > 0) { if(buffer_left(stream->cache) > 0) {
@@ -645,7 +678,7 @@ int ps_left(Pcpstream *stream) {
/* used internally to determine if we reached end of source */ /* used internally to determine if we reached end of source */
if(stream->is_buffer) { if(stream->is_buffer) {
if(buffer_left(stream->b) == 0) if(buffer_left(stream->b) == 0)
return 1; return 1; /* true, more to read */
else else
return 0; return 0;
} }
@@ -665,3 +698,4 @@ size_t ps_tell(Pcpstream *stream) {
Buffer *ps_buffer(Pcpstream *stream) { Buffer *ps_buffer(Pcpstream *stream) {
return stream->b; return stream->b;
} }

View File

@@ -267,7 +267,7 @@ char *pcp_readz85file(FILE *infile) {
return pcp_readz85string(input, bufsize); return pcp_readz85string(input, bufsize);
} }
char *pcp_readz85string(byte *input, size_t bufsize) { char *pcp_readz85string(unsigned char *input, size_t bufsize) {
size_t i; size_t i;
size_t MAXLINE = 1024; size_t MAXLINE = 1024;
@@ -282,12 +282,50 @@ char *pcp_readz85string(byte *input, size_t bufsize) {
} }
Buffer *z = buffer_new(MAXLINE, "z"); Buffer *z = buffer_new(MAXLINE, "z");
uint8_t is_comment = 0; Buffer *line = buffer_new(MAXLINE, "line");
int begin, end;
begin = end = 0;
char *out = NULL; char *out = NULL;
for(i=0; i<bufsize; ++i) for(i=0; i<bufsize; ++i) {
is_comment = _parse_zchar(z, input[i], is_comment); if(input[i] == '\r')
continue;
else if(input[i] == '\n') {
/* a line is complete */
if(z85_isbegin(line) && begin == 0) {
/* a begin header, reset whatever we've got so far in z buffer */
begin = 1;
buffer_clear(line);
buffer_clear(z);
continue;
}
else if(z85_isend(line)){
/* an end header */
end = 1;
break;
}
else if(z85_isempty(line) || z85_iscomment(line)) {
/* a comment */
buffer_clear(line);
continue;
}
else {
/* regular z85 encoded content */
buffer_add_buf(z, line);
buffer_clear(line);
}
}
else {
/* regular line content */
buffer_add8(line, input[i]);
}
}
if(buffer_size(line) > 0 && end != 1) {
/* something left in line buffer, probably
newline at eof missing or no multiline input */
buffer_add_buf(z, line);
}
if(buffer_size(z) == 0) { if(buffer_size(z) == 0) {
fatal("empty z85 encoded string"); fatal("empty z85 encoded string");
@@ -298,15 +336,19 @@ char *pcp_readz85string(byte *input, size_t bufsize) {
strncpy(out, buffer_get_str(z), buffer_size(z)+1); strncpy(out, buffer_get_str(z), buffer_size(z)+1);
buffer_free(z); buffer_free(z);
buffer_free(line);
return out; return out;
rferr: rferr:
buffer_free(z); buffer_free(z);
buffer_free(line);
return NULL; return NULL;
} }
int z85_isheader(Buffer *buf) { int z85_isheader(Buffer *buf) {
size_t len = buffer_size(buf); size_t len = buffer_size(buf);
byte *line = buffer_get(buf); byte *line = buffer_get(buf);

View File

@@ -1,8 +1,8 @@
~~~~~BEGIN ED25519-CURVE29915 PUBLIC KEY~~~~~ ----- BEGIN ED25519-CURVE29915 PUBLIC KEY -----
22+[E/=.$41#M]-p3Z*%mJukC}Az}B1oy^NZQodOb+b/v<qySc6H5d^=p/Ue@6[.W=ZtoIf 22=cP^iizk/S(7@mlSgf@6nh%u@zErhpi[-k6q<YR.>jn6%ok*g5#O]e.QB3MuuWrixpn12
rE+un7tFVW$#33:XcMgzw3&PZ)7ekwL}7Eqd1d[NpaMnHj@&9s0p6!?cy46bo^9)000040- 2n4nKEzxTj8xsVxIq[Zy?5q0?AVs^G$%P8DW#AkLv6l5E6vUi0R*9FJb5Cobo^9)000040-
GFA*5I9M1oRS&QfmJ%00AQc)4NR.000Gy00SAaB7GxavqLtPY&$Ep01xRx1POWzCwZ#jlsB GZL^eTdD1oRS{qbEq[00AQc]heu+000Gy00SAaB7GxavqD(T=>lrU01xRx1POWzCwZ#jlsB
[R0000i6Awmo3t<i=y*{*[Bu<UXv{%fN0003s01<4EQ*G9>pHh6fA/A944@{IMelG{62mGJ [R0000i6Awmo3t<i=y*{*[Bu<UXv{%fN0003s0b@::z?jG/>x*3M*i@UAy.o5#svC=hxAbY
m9=#BHf}C+wnm]q@Ts>0&wN0UDH>Rm7+]8@<[fYHG>Em7026*4BOF5#qVZBr+RPvPrmFy:# xhb5hzpC7b6=IE5cD9H@b!fWP{2pbLNtYH8+-n0Yj=vzBX2T>[lMq-q5i*2l)PdG:BIPA2B
v5khdlw:Ym>>*%uPeej4FJk^>lj{byzcNiGCk#%?ht]4ni@+5PJxsHLFb/MH D4^a6a@jiPj@$B.!^!{]aAy))63hk{cXx}mn51fTD6^]V{p9p-sQ6ahG-z8M
~~~~~END ED25519-CURVE29915 PUBLIC KEY~~~~~ ----- END ED25519-CURVE29915 PUBLIC KEY -----

View File

@@ -1,8 +1,8 @@
~~~~~BEGIN ED25519-CURVE29915 PUBLIC KEY~~~~~ ----- BEGIN ED25519-CURVE29915 PUBLIC KEY -----
22+[E!fex*BR+=DXNjIW*d]B9yhJyNrMg0#a!%V*Xbws>g4<g1]xVgVHyJne2T@q.hh[Vvc 22=cP=lrd7n!C:!XGq^$9<CK>Y}+=ZwmlP)g)@xo9^e/o*Inh/D$%Byb76oY5FWb{*A)%P+
Y}(Imx2$E?B:U2pl.@^*{KGDffo*GcI+^eyGIhZ&MZCAPR.Pxmd?(^s1sp[bo^9)000040- )ZLI]woam72W7o+2/0jlexvmVD$M@D@AkVO{ifxYN+3nlzTKbo^om]kmdAkbo^9)000040-
GFA!C]NH1oRS&Qe.f[00AQc)4NCV000Gy00SAaB7GxavqJja2djBh01P+z1PO:BCwZ#jl2p GZL=J0}B1oRS{qbme(00AQc]hel.000Gy00SAaB7GxavqF>%B3xT801P+z1PO:BCwZ#jl2p
mBx<*#w02caE1on<EvqfK^y?Wx[vl!TEv{%fN0003s0e-H.xJaP(BoT*HH[-oOFqW7(I>J+ mBx<*#w02caE1on<EvqfK^y?Wx[vl!TEv{%fN0003s0oJoQH4mRgO=rD%ZM>6]>5bo+9J*O
iHwx}-&tG+bR-@GioqlzuJq[GE*3My.aX]SmgU:zaB%=y].Owpf1Al4i0FCA>lF<{mMi$2> AOZK#pb[R/]4Ioj#%g-^K&wXGZo%RVL-krtAo2KlE5+mZwVYEq42qBn%fbgnj!xKjo0K]]z
s=p/)jfQgIX:Qi:EGr6&^d)R2%a/@Th!*(Uhi>$WMI+l}oi%=1Yj[(RwQ{deEe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6 +1,6 @@
bartid = 0x81E0427F3EE40B39 bartid = 0x4EF5795E2874AD8D
bartserial = 0xEDCCBD5B bartserial = 0x1B4ED012
idbobby = 0xEDF476444C8B5721 idbobby = 0x969D5931D7B409C6
idalicia = 0xD467BA4B3187236F idalicia = 0x629AFD2418EFA3BA
mailbobby = bobby@local mailbobby = bobby@local
mailalicia = alicia@local mailalicia = alicia@local

View File

@@ -50,11 +50,9 @@ int main(int argc, char **argv) {
void *buf = ucmalloc(rblocksize); void *buf = ucmalloc(rblocksize);
while(!ps_end(in)) { while(!ps_end(in)) {
fprintf(stderr, "=== read:\n");
got = ps_read(in, buf, rblocksize); got = ps_read(in, buf, rblocksize);
if(got > 0) if(got > 0)
ps_write(out, buf, got); ps_write(out, buf, got);
fprintf(stderr, "======= got: %ld\n", got);
} }
ps_finish(out); ps_finish(out);

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] = {
0x48, 0x59, 0xdb, 0xdb, 0x16, 0xfe, 0xa0, 0x17, 0xd0, 0xb0, 0x71, 0x2c, 0x3f, 0x08, 0xc2, 0x74,
0xc8, 0x34, 0x38, 0x32, 0x29, 0x41, 0x56, 0xf1, 0x55, 0x72, 0x32, 0xb0, 0x12, 0x9b, 0x5b, 0x88,
0x35, 0x5d, 0x20, 0x52, 0xa2, 0x54, 0xeb, 0x67, 0x96, 0x38, 0xf8, 0xa4, 0xca, 0x4b, 0x0f, 0xc5,
0xb2, 0xd9, 0x5d, 0xa2, 0x90, 0xbc, 0x19, 0x55 0x0c, 0xd0, 0xd1, 0xd7, 0xbe, 0x83, 0x31, 0x75
}; };
size_t public_a_len = 32; size_t public_a_len = 32;
unsigned char public_a[32] = { unsigned char public_a[32] = {
0xfd, 0x9e, 0x3b, 0xe5, 0x99, 0x13, 0x22, 0xf6, 0xdd, 0x1a, 0xc0, 0xcf, 0xb2, 0xb9, 0x69, 0x7b,
0xc8, 0x42, 0x10, 0x6e, 0x75, 0xd5, 0xe4, 0xcd, 0x60, 0x31, 0x98, 0x12, 0x9e, 0xe4, 0x5c, 0x6e,
0x1d, 0x69, 0xbf, 0x31, 0xbc, 0xfc, 0x2c, 0x27, 0x3b, 0xe4, 0x91, 0x98, 0x26, 0x67, 0xd4, 0x75,
0xb7, 0xd2, 0x0f, 0xcc, 0xa6, 0x6e, 0x92, 0x38 0xb7, 0x2f, 0xb3, 0xdf, 0xb6, 0x9d, 0x0a, 0x60
}; };
size_t secret_b_len = 32; size_t secret_b_len = 32;
unsigned char secret_b[32] = { unsigned char secret_b[32] = {
0x88, 0x06, 0xfd, 0x5d, 0x6f, 0x45, 0xd0, 0x0e, 0x18, 0xc9, 0x0f, 0xcd, 0xa7, 0x76, 0x0a, 0x5b,
0xea, 0x66, 0xc9, 0xdc, 0xda, 0x38, 0xd4, 0xa8, 0xc2, 0x8a, 0x3a, 0x06, 0xf6, 0xfe, 0xbd, 0xbb,
0x06, 0x81, 0xd9, 0x31, 0x9b, 0x22, 0x2d, 0xef, 0x7b, 0x99, 0x63, 0x4c, 0xf6, 0x5e, 0xf8, 0x2c,
0x4e, 0x69, 0x00, 0xc4, 0x8c, 0xdf, 0x4e, 0x44 0x1e, 0x53, 0x16, 0x2e, 0x75, 0xba, 0x16, 0x53
}; };
size_t public_b_len = 32; size_t public_b_len = 32;
unsigned char public_b[32] = { unsigned char public_b[32] = {
0xdc, 0xc2, 0xcf, 0xe2, 0xc9, 0x3e, 0xe0, 0xf7, 0x70, 0xb6, 0xe2, 0x75, 0x4d, 0x30, 0x3f, 0xef,
0x33, 0x6f, 0xb8, 0xab, 0xe4, 0xb4, 0xe1, 0x6d, 0x01, 0xd8, 0xfe, 0xe2, 0x83, 0x62, 0xda, 0x8f,
0x82, 0xcb, 0xcc, 0xfa, 0x83, 0xc4, 0x8d, 0x09, 0x53, 0xb2, 0x35, 0xa6, 0x23, 0x39, 0xca, 0x3c,
0x6f, 0x24, 0xec, 0xe0, 0xf3, 0x93, 0xce, 0x73 0xb9, 0x81, 0x34, 0x2b, 0x5f, 0x5b, 0xe8, 0x45
}; };
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] = {
0x5e, 0xa0, 0xbd, 0x53, 0x16, 0xbf, 0x91, 0x2d, 0x1f, 0x54, 0xb8, 0x13, 0x86, 0x6c, 0xc4, 0x8b,
0xfc, 0xe7, 0x1c, 0x0d, 0x4c, 0x9f, 0x79, 0xd1, 0xd1, 0x92, 0x27, 0x5e, 0x40, 0xc2, 0x91, 0x2a,
0x4d, 0x98, 0x3c, 0x2b, 0x1e, 0x47, 0x35, 0x0d 0x96, 0x1a, 0xed, 0x57, 0xa1, 0xda, 0xcd, 0x41
}; };
size_t cipher_len = 28; size_t cipher_len = 28;
unsigned char cipher[28] = { unsigned char cipher[28] = {
0xac, 0x06, 0x36, 0x4d, 0xd0, 0xa7, 0x58, 0x4e, 0xca, 0x76, 0xac, 0x81, 0x94, 0x06, 0x52, 0x45,
0x18, 0x35, 0x99, 0x29, 0x2b, 0x1e, 0x4a, 0x08, 0x5e, 0xa6, 0x15, 0xd5, 0xda, 0x5a, 0xef, 0xf9,
0x1e, 0xcd, 0xd3, 0xc7, 0xce, 0x4a, 0xd1, 0xa7, 0x7b, 0x32, 0x2c, 0x5d, 0x7d, 0x3d, 0xd5, 0x3a,
0x3e, 0x78, 0x94, 0xe9 0xba, 0x03, 0x67, 0x73
}; };

View File

@@ -18,8 +18,11 @@ int linetest() {
byte data[9] = {0}; byte data[9] = {0};
while(!ps_end(pin)) { while(!ps_end(pin)) {
if((got = ps_read(pin, data, 8)) > 0) { if((got = ps_read(pin, data, 8)) > 0) {
fwrite(data, 1, got, stdout); fprintf(stderr, "######## <");
fwrite(data, 1, got, stderr);
fprintf(stderr, "> ##### %ld\n", got);
} }
else break;
} }
ps_close(pin); ps_close(pin);

View File

@@ -1,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