diff options
author | Rob Austein <sra@hactrn.net> | 2015-08-25 19:21:49 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2015-08-25 19:21:49 -0400 |
commit | f1f3a8adffb9ef4597fea9de8479ee9f84f0a795 (patch) | |
tree | 362933599bbe929c151db005cd235811b750e4ad /tests/test-ecdsa.h | |
parent | a4930dbbac93b3637a6f99a443dca55319c35d92 (diff) |
More test code.
Diffstat (limited to 'tests/test-ecdsa.h')
-rw-r--r-- | tests/test-ecdsa.h | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/tests/test-ecdsa.h b/tests/test-ecdsa.h index 61124e4..ca51858 100644 --- a/tests/test-ecdsa.h +++ b/tests/test-ecdsa.h @@ -58,6 +58,19 @@ static const uint8_t p256_k[] = { /* 32 bytes */ 0x19, 0x65, 0xc7, 0xb1, 0x34, 0xee, 0x45, 0xd0 }; +static const uint8_t p256_key[] = { /* 121 bytes */ + 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x70, 0xa1, 0x2c, 0x2d, 0xb1, + 0x68, 0x45, 0xed, 0x56, 0xff, 0x68, 0xcf, 0xc2, 0x1a, 0x47, 0x2b, 0x3f, + 0x04, 0xd7, 0xd6, 0x85, 0x1b, 0xf6, 0x34, 0x9f, 0x2d, 0x7d, 0x5b, 0x34, + 0x52, 0xb3, 0x8a, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, + 0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x81, 0x01, 0xec, + 0xe4, 0x74, 0x64, 0xa6, 0xea, 0xd7, 0x0c, 0xf6, 0x9a, 0x6e, 0x2b, 0xd3, + 0xd8, 0x86, 0x91, 0xa3, 0x26, 0x2d, 0x22, 0xcb, 0xa4, 0xf7, 0x63, 0x5e, + 0xaf, 0xf2, 0x66, 0x80, 0xa8, 0xd8, 0xa1, 0x2b, 0xa6, 0x1d, 0x59, 0x92, + 0x35, 0xf6, 0x7d, 0x9c, 0xb4, 0xd5, 0x8f, 0x17, 0x83, 0xd3, 0xca, 0x43, + 0xe7, 0x8f, 0x0a, 0x5a, 0xba, 0xa6, 0x24, 0x07, 0x99, 0x36, 0xc0, 0xc3, 0xa9 +}; + static const uint8_t p256_kinv[] = { /* 32 bytes */ 0x6a, 0x66, 0x4f, 0xa1, 0x15, 0x35, 0x6d, 0x33, 0xf1, 0x63, 0x31, 0xb5, 0x4c, 0x4e, 0x7c, 0xe9, 0x67, 0x96, 0x53, 0x86, 0xc7, 0xdc, 0xbf, 0x29, @@ -76,6 +89,15 @@ static const uint8_t p256_s[] = { /* 32 bytes */ 0x92, 0xdb, 0xea, 0xa1, 0xaf, 0x2b, 0xc3, 0x67 }; +static const uint8_t p256_sig[] = { /* 70 bytes */ + 0x30, 0x44, 0x02, 0x20, 0x72, 0x14, 0xbc, 0x96, 0x47, 0x16, 0x0b, 0xbd, + 0x39, 0xff, 0x2f, 0x80, 0x53, 0x3f, 0x5d, 0xc6, 0xdd, 0xd7, 0x0d, 0xdf, + 0x86, 0xbb, 0x81, 0x56, 0x61, 0xe8, 0x05, 0xd5, 0xd4, 0xe6, 0xf2, 0x7c, + 0x02, 0x20, 0x7d, 0x1f, 0xf9, 0x61, 0x98, 0x0f, 0x96, 0x1b, 0xda, 0xa3, + 0x23, 0x3b, 0x62, 0x09, 0xf4, 0x01, 0x33, 0x17, 0xd3, 0xe3, 0xf9, 0xe1, + 0x49, 0x35, 0x92, 0xdb, 0xea, 0xa1, 0xaf, 0x2b, 0xc3, 0x67 +}; + static const uint8_t p256_u1[] = { /* 32 bytes */ 0xbb, 0x25, 0x24, 0x01, 0xd6, 0xfb, 0x32, 0x2b, 0xb7, 0x47, 0x18, 0x4c, 0xf2, 0xac, 0x52, 0xbf, 0x8d, 0x54, 0xb9, 0x5a, 0x15, 0x15, 0x06, 0x2a, @@ -163,6 +185,23 @@ static const uint8_t p384_k[] = { /* 48 bytes */ 0x5a, 0xa1, 0xfd, 0x45, 0xe2, 0xd2, 0xa7, 0x35, 0xf8, 0x74, 0x93, 0x59 }; +static const uint8_t p384_key[] = { /* 167 bytes */ + 0x30, 0x81, 0xa4, 0x02, 0x01, 0x01, 0x04, 0x30, 0xc8, 0x38, 0xb8, 0x52, + 0x53, 0xef, 0x8d, 0xc7, 0x39, 0x4f, 0xa5, 0x80, 0x8a, 0x51, 0x83, 0x98, + 0x1c, 0x7d, 0xee, 0xf5, 0xa6, 0x9b, 0xa8, 0xf4, 0xf2, 0x11, 0x7f, 0xfe, + 0xa3, 0x9c, 0xfc, 0xd9, 0x0e, 0x95, 0xf6, 0xcb, 0xc8, 0x54, 0xab, 0xac, + 0xab, 0x70, 0x1d, 0x50, 0xc1, 0xf3, 0xcf, 0x24, 0xa0, 0x07, 0x06, 0x05, + 0x2b, 0x81, 0x04, 0x00, 0x22, 0xa1, 0x64, 0x03, 0x62, 0x00, 0x04, 0x1f, + 0xba, 0xc8, 0xee, 0xbd, 0x0c, 0xbf, 0x35, 0x64, 0x0b, 0x39, 0xef, 0xe0, + 0x80, 0x8d, 0xd7, 0x74, 0xde, 0xbf, 0xf2, 0x0a, 0x2a, 0x32, 0x9e, 0x91, + 0x71, 0x3b, 0xaf, 0x7d, 0x7f, 0x3c, 0x3e, 0x81, 0x54, 0x6d, 0x88, 0x37, + 0x30, 0xbe, 0xe7, 0xe4, 0x86, 0x78, 0xf8, 0x57, 0xb0, 0x2c, 0xa0, 0xeb, + 0x21, 0x31, 0x03, 0xbd, 0x68, 0xce, 0x34, 0x33, 0x65, 0xa8, 0xa4, 0xc3, + 0xd4, 0x55, 0x5f, 0xa3, 0x85, 0xf5, 0x33, 0x02, 0x03, 0xbd, 0xd7, 0x6f, + 0xfa, 0xd1, 0xf3, 0xaf, 0xfb, 0x95, 0x75, 0x1c, 0x13, 0x20, 0x07, 0xe1, + 0xb2, 0x40, 0x35, 0x3c, 0xb0, 0xa4, 0xcf, 0x16, 0x93, 0xbd, 0xf9 +}; + static const uint8_t p384_kinv[] = { /* 48 bytes */ 0x74, 0x36, 0xf0, 0x30, 0x88, 0xe6, 0x5c, 0x37, 0xba, 0x8e, 0x7b, 0x33, 0x88, 0x7f, 0xbc, 0x87, 0x75, 0x75, 0x14, 0xd6, 0x11, 0xf7, 0xd1, 0xfb, @@ -184,6 +223,18 @@ static const uint8_t p384_s[] = { /* 48 bytes */ 0x67, 0xad, 0xad, 0xf1, 0x68, 0xeb, 0xbe, 0x80, 0x37, 0x94, 0xa4, 0x02 }; +static const uint8_t p384_sig[] = { /* 103 bytes */ + 0x30, 0x65, 0x02, 0x31, 0x00, 0xa0, 0xc2, 0x7e, 0xc8, 0x93, 0x09, 0x2d, + 0xea, 0x1e, 0x1b, 0xd2, 0xcc, 0xfe, 0xd3, 0xcf, 0x94, 0x5c, 0x81, 0x34, + 0xed, 0x0c, 0x9f, 0x81, 0x31, 0x1a, 0x0f, 0x4a, 0x05, 0x94, 0x2d, 0xb8, + 0xdb, 0xed, 0x8d, 0xd5, 0x9f, 0x26, 0x74, 0x71, 0xd5, 0x46, 0x2a, 0xa1, + 0x4f, 0xe7, 0x2d, 0xe8, 0x56, 0x02, 0x30, 0x20, 0xab, 0x3f, 0x45, 0xb7, + 0x4f, 0x10, 0xb6, 0xe1, 0x1f, 0x96, 0xa2, 0xc8, 0xeb, 0x69, 0x4d, 0x20, + 0x6b, 0x9d, 0xda, 0x86, 0xd3, 0xc7, 0xe3, 0x31, 0xc2, 0x6b, 0x22, 0xc9, + 0x87, 0xb7, 0x53, 0x77, 0x26, 0x57, 0x76, 0x67, 0xad, 0xad, 0xf1, 0x68, + 0xeb, 0xbe, 0x80, 0x37, 0x94, 0xa4, 0x02 +}; + static const uint8_t p384_u1[] = { /* 48 bytes */ 0x6c, 0xe2, 0x56, 0x49, 0xd4, 0x2d, 0x22, 0x3e, 0x02, 0x0c, 0x11, 0x14, 0x0f, 0xe7, 0x72, 0x32, 0x66, 0x12, 0xbb, 0x11, 0xb6, 0x86, 0xd3, 0x5e, @@ -211,3 +262,68 @@ static const uint8_t p384_w[] = { /* 48 bytes */ 0x0a, 0x7c, 0x86, 0x1a, 0xf8, 0xfe, 0x82, 0x25, 0x46, 0x7a, 0x25, 0x7f, 0x5b, 0xf9, 0x1a, 0x4a, 0xaa, 0x5a, 0x79, 0xa8, 0x63, 0x7d, 0x21, 0x8a }; + +typedef struct { + hal_ecdsa_curve_t curve; + const uint8_t * H; size_t H_len; + const uint8_t * M; size_t M_len; + const uint8_t * Qx; size_t Qx_len; + const uint8_t * Qy; size_t Qy_len; + const uint8_t * Rx; size_t Rx_len; + const uint8_t * Ry; size_t Ry_len; + const uint8_t * d; size_t d_len; + const uint8_t * e; size_t e_len; + const uint8_t * k; size_t k_len; + const uint8_t * key; size_t key_len; + const uint8_t * kinv; size_t kinv_len; + const uint8_t * r; size_t r_len; + const uint8_t * s; size_t s_len; + const uint8_t * sig; size_t sig_len; + const uint8_t * u1; size_t u1_len; + const uint8_t * u2; size_t u2_len; + const uint8_t * v; size_t v_len; + const uint8_t * w; size_t w_len; +} ecdsa_tc_t; + +static const ecdsa_tc_t ecdsa_tc[] = { + { HAL_ECDSA_CURVE_P256, + p256_H, sizeof(p256_H), + p256_M, sizeof(p256_M), + p256_Qx, sizeof(p256_Qx), + p256_Qy, sizeof(p256_Qy), + p256_Rx, sizeof(p256_Rx), + p256_Ry, sizeof(p256_Ry), + p256_d, sizeof(p256_d), + p256_e, sizeof(p256_e), + p256_k, sizeof(p256_k), + p256_key, sizeof(p256_key), + p256_kinv, sizeof(p256_kinv), + p256_r, sizeof(p256_r), + p256_s, sizeof(p256_s), + p256_sig, sizeof(p256_sig), + p256_u1, sizeof(p256_u1), + p256_u2, sizeof(p256_u2), + p256_v, sizeof(p256_v), + p256_w, sizeof(p256_w), + }, + { HAL_ECDSA_CURVE_P384, + p384_H, sizeof(p384_H), + p384_M, sizeof(p384_M), + p384_Qx, sizeof(p384_Qx), + p384_Qy, sizeof(p384_Qy), + p384_Rx, sizeof(p384_Rx), + p384_Ry, sizeof(p384_Ry), + p384_d, sizeof(p384_d), + p384_e, sizeof(p384_e), + p384_k, sizeof(p384_k), + p384_key, sizeof(p384_key), + p384_kinv, sizeof(p384_kinv), + p384_r, sizeof(p384_r), + p384_s, sizeof(p384_s), + p384_sig, sizeof(p384_sig), + p384_u1, sizeof(p384_u1), + p384_u2, sizeof(p384_u2), + p384_v, sizeof(p384_v), + p384_w, sizeof(p384_w), + }, +}; |