mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-18 04:10:57 +01:00
fixed keysig saving (forgot the id), enhancements on cmdline
This commit is contained in:
@@ -20,7 +20,8 @@
|
||||
#
|
||||
|
||||
AM_CFLAGS = -I../include/pcp -I../src -I../libpcp/scrypt/crypto -Wall -g
|
||||
check_PROGRAMS = col invalidkeys pwhashes gencheader statictest cpptest buffertest sample streamtest pipetest
|
||||
check_PROGRAMS = col invalidkeys gencheader statictest cpptest \
|
||||
buffertest sample streamtest pipetest decodertest
|
||||
|
||||
gencheader_LDADD = ../libpcp/.libs/libpcp1.a
|
||||
gencheader_SOURCES = gencheader.c
|
||||
@@ -40,6 +41,9 @@ streamtest_SOURCES = streamtest.c
|
||||
pipetest_LDADD = ../libpcp/.libs/libpcp1.a
|
||||
pipetest_SOURCES = pipetest.c
|
||||
|
||||
decodertest_LDADD = ../libpcp/.libs/libpcp1.a
|
||||
decodertest_SOURCES = decodertest.c
|
||||
|
||||
col_LDADD = ../libpcp/.libs/libpcp1.a
|
||||
col_SOURCES = collisions.c ../src/compat_getopt.c
|
||||
|
||||
@@ -47,9 +51,6 @@ invalidkeys_LDADD = ../libpcp/.libs/libpcp1.a \
|
||||
../src/keyprint.o ../src/keymgmt.o ../src/readpass.o
|
||||
invalidkeys_SOURCES = invalidkeys.c
|
||||
|
||||
pwhashes_LDADD = ../libpcp/.libs/libpcp1.a
|
||||
pwhashes_SOURCES = pwhashes.c
|
||||
|
||||
AM_CXXFLAGS = -I../include -I../bindings/cpp -I../libpcp/scrypt/crypto -Wall -g
|
||||
cpptest_LDADD = ../bindings/cpp/.libs/libpcp1++.a ../libpcp/.libs/libpcp1.a
|
||||
cpptest_SOURCES = cpptest.cpp
|
||||
|
||||
@@ -4,36 +4,9 @@
|
||||
|
||||
#include <pcp.h>
|
||||
|
||||
int linetest() {
|
||||
FILE *in;
|
||||
|
||||
if((in = fopen("x", "rb")) == NULL) {
|
||||
fprintf(stderr, "oops, could not open file!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Pcpstream *pin = ps_new_file(in);
|
||||
ps_setdetermine(pin, 8);
|
||||
size_t got;
|
||||
byte data[9] = {0};
|
||||
while(!ps_end(pin)) {
|
||||
if((got = ps_read(pin, data, 8)) > 0) {
|
||||
fprintf(stderr, "######## <");
|
||||
fwrite(data, 1, got, stderr);
|
||||
fprintf(stderr, "> ##### %ld\n", got);
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
ps_close(pin);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
/* create a file with "encrypted" data */
|
||||
|
||||
return linetest();
|
||||
|
||||
FILE *out, *in;
|
||||
unsigned char clear[8] = "ABCDEFGH";
|
||||
unsigned char key[8] = "IxD8Lq1K";
|
||||
@@ -49,14 +22,13 @@ int main() {
|
||||
|
||||
/* out output stream, z85 encoded, use z85 blocksize 8 */
|
||||
Pcpstream *pout = ps_new_file(out);
|
||||
ps_print(pout, "~~~~~ BEGIN ~~~~~\r\n");
|
||||
ps_print(pout, "----- BEGIN -----\r\n");
|
||||
ps_armor(pout, blocksize);
|
||||
|
||||
/* "encrypt" a couple of times into the output stream */
|
||||
for(i=0; i<blocks; i++) {
|
||||
memcpy(crypt, clear, 8);
|
||||
_xorbuf(key, crypt, 8);
|
||||
//_dump("crypt", crypt, 8);
|
||||
ps_write(pout, crypt, 8);
|
||||
}
|
||||
|
||||
@@ -64,7 +36,7 @@ int main() {
|
||||
ps_finish(pout);
|
||||
|
||||
pout->armor = 0;
|
||||
ps_print(pout, "\r\n~~~~~ END ~~~~~\r\n");
|
||||
ps_print(pout, "\r\n----- END -----\r\n");
|
||||
ps_close(pout);
|
||||
fclose(out);
|
||||
|
||||
@@ -86,7 +58,6 @@ int main() {
|
||||
for(i=0; i<blocks; i++) {
|
||||
ps_read(pin, crypt, 8);
|
||||
_xorbuf(key, crypt, 8);
|
||||
//_dump("got", crypt, 8);
|
||||
ps_write(pclear, crypt, 8);
|
||||
memset(crypt,0,8);
|
||||
}
|
||||
@@ -99,7 +70,6 @@ int main() {
|
||||
/* and verify if it's "decrypted" (re-use crypt) */
|
||||
for(i=0; i<blocks; i++) {
|
||||
buffer_get_chunk(result, crypt, 8);
|
||||
//_dump("result", crypt, 8);
|
||||
if(memcmp(crypt, clear, 8) != 0) {
|
||||
fprintf(stderr, "Oops, block %d doesn't match\n", i);
|
||||
goto error;
|
||||
|
||||
@@ -68,6 +68,32 @@ include keys.cfg
|
||||
</test>
|
||||
</test>
|
||||
|
||||
<test check-z85>
|
||||
<test check-z85-1-compliant>
|
||||
cmd = ./decodertest 1
|
||||
expect = /ok/
|
||||
</test>
|
||||
|
||||
<test check-z85-2-compliant-no-newlines>
|
||||
cmd = ./decodertest 2
|
||||
expect = /ok/
|
||||
</test>
|
||||
|
||||
<test check-z85-3-compliant-no-begin-header>
|
||||
cmd = ./decodertest 3
|
||||
expect = /ok/
|
||||
</test>
|
||||
|
||||
<test check-z85-4-uncompliant-empty-comment>
|
||||
cmd = ./decodertest 4
|
||||
expect = /ok/
|
||||
</test>
|
||||
|
||||
<test check-z85-5-uncompliant-missing-char>
|
||||
cmd = ./decodertest 5
|
||||
expect = /ok/
|
||||
</test>
|
||||
</test>
|
||||
|
||||
<test check-show-help>
|
||||
cmd = $pcp -h
|
||||
@@ -491,10 +517,6 @@ temporarily disabled
|
||||
expect = /contain any keys so far./
|
||||
</test>
|
||||
|
||||
<test check-encryptionkeys-dont-collide>
|
||||
cmd = ./pwhashes
|
||||
expect = /ok/
|
||||
</test>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user