Fix the ecc_decode_test to use a real OID (instead of 1), so the tests work properly.

This commit is contained in:
David Garske
2018-01-29 15:58:04 -08:00
parent 90a3daa887
commit 9d7374348b

View File

@@ -13778,7 +13778,11 @@ static int ecc_decode_test(void)
word32 inSz;
word32 inOutIdx;
ecc_key key;
const byte good[] = { 0x30, 0x0d, 0x30, 0x0b, 0x06, 0x00, 0x06, 0x01, 0x01,
/* SECP256R1 OID: 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07 */
const byte good[] = { 0x30, 0x14, 0x30, 0x0b, 0x06, 0x00,
0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,
0x03, 0x04, 0x00, 0x04, 0x01, 0x01 };
const byte badNoObjId[] = { 0x30, 0x08, 0x30, 0x06, 0x03, 0x04,
0x00, 0x04, 0x01, 0x01 };
@@ -13788,14 +13792,18 @@ static int ecc_decode_test(void)
0x06, 0x00, 0x03, 0x04, 0x00, 0x04, 0x01, 0x01 };
const byte badObj2d1Len[] = { 0x30, 0x0c, 0x30, 0x0a, 0x06, 0x00,
0x06, 0x07, 0x03, 0x04, 0x00, 0x04, 0x01, 0x01 };
const byte badNotBitStr[] = { 0x30, 0x0d, 0x30, 0x0b, 0x06, 0x00,
0x06, 0x01, 0x01, 0x04, 0x04, 0x00, 0x04, 0x01, 0x01 };
const byte badBitStrLen[] = { 0x30, 0x0d, 0x30, 0x0b, 0x06, 0x00,
0x06, 0x01, 0x01, 0x03, 0x05, 0x00, 0x04, 0x01, 0x01 };
const byte badNoBitStrZero[] = { 0x30, 0x0c, 0x30, 0x0a, 0x06, 0x00,
0x06, 0x01, 0x01, 0x03, 0x03, 0x04, 0x01, 0x01 };
const byte badPoint[] = { 0x30, 0x0b, 0x30, 0x09, 0x06, 0x00, 0x06, 0x01,
0x01, 0x03, 0x03, 0x00, 0x04, 0x01 };
const byte badNotBitStr[] = { 0x30, 0x14, 0x30, 0x0b, 0x06, 0x00,
0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,
0x04, 0x04, 0x00, 0x04, 0x01, 0x01 };
const byte badBitStrLen[] = { 0x30, 0x14, 0x30, 0x0b, 0x06, 0x00,
0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,
0x03, 0x05, 0x00, 0x04, 0x01, 0x01 };
const byte badNoBitStrZero[] = { 0x30, 0x13, 0x30, 0x0a, 0x06, 0x00,
0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,
0x03, 0x03, 0x04, 0x01, 0x01 };
const byte badPoint[] = { 0x30, 0x12, 0x30, 0x09, 0x06, 0x00,
0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,
0x03, 0x03, 0x00, 0x04, 0x01 };
XMEMSET(&key, 0, sizeof(key));
wc_ecc_init(&key);