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

View File

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