add a negative test for the hex decode

This commit is contained in:
Klas Lindfors
2015-02-03 10:56:13 +01:00
parent 06997e3d52
commit 220f0f0226
+4 -3
View File
@@ -37,9 +37,7 @@ struct key {
const char text[49];
const unsigned char formatted[24];
int valid;
};
struct key keys[] = {
} keys[] = {
{"010203040506070801020304050607080102030405060708",
{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08},
1},
@@ -49,6 +47,9 @@ struct key keys[] = {
{"A1A2A3A4A5A6A7A8A1A2A3A4A5A6A7A8A1A2A3A4A5A6A7A8",
{0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8},
1},
{"This is not something considered valid hex......",
{},
0},
};
static int parse_key(const char *text, const unsigned char *expected, int valid) {