1 #ifdef WITH_CURVE_SECP192R1 2 #define ECCCDH_SECP192R1_SELF_TEST_0 3 /*** Tests for ECCCDH/SECP192R1 ***/ 4 static const u8 ecccdh_SECP192R1_0_test_vector_our_priv_key[] = { 5 0xf1, 0x7d, 0x3f, 0xea, 0x36, 0x7b, 0x74, 0xd3, 0x40, 0x85, 0x1c, 0xa4, 0x27, 0x0d, 0xcb, 0x24, 0xc2, 0x71, 0xf4, 0x45, 0xbe, 0xd9, 0xd5, 0x27, 6 }; 7 static const u8 ecccdh_SECP192R1_0_test_vector_peer_pub_key[] = { 8 0x42, 0xea, 0x6d, 0xd9, 0x96, 0x9d, 0xd2, 0xa6, 0x1f, 0xea, 0x1a, 0xac, 0x7f, 0x8e, 0x98, 0xed, 0xcc, 0x89, 0x6c, 0x6e, 0x55, 0x85, 0x7c, 0xc0, 0xdf, 0xbe, 0x5d, 0x7c, 0x61, 0xfa, 0xc8, 0x8b, 0x11, 0x81, 0x1b, 0xde, 0x32, 0x8e, 0x8a, 0x0d, 0x12, 0xbf, 0x01, 0xa9, 0xd2, 0x04, 0xb5, 0x23, 9 }; 10 static const u8 ecccdh_SECP192R1_0_test_vector_our_pub_key[] = { 11 0xb1, 0x50, 0x53, 0x40, 0x1f, 0x57, 0x28, 0x56, 0x37, 0xec, 0x32, 0x4c, 0x1c, 0xd2, 0x13, 0x9e, 0x3a, 0x67, 0xde, 0x37, 0x39, 0x23, 0x4b, 0x37, 0xf2, 0x69, 0xc1, 0x58, 0x63, 0x74, 0x82, 0xaa, 0xd6, 0x44, 0xcd, 0x69, 0x2d, 0xd1, 0xd3, 0xef, 0x2c, 0x8a, 0x7c, 0x49, 0xe3, 0x89, 0xf7, 0xf6, 12 }; 13 static const u8 ecccdh_SECP192R1_0_test_vector_shared_secret[] = { 14 0x80, 0x3d, 0x8a, 0xb2, 0xe5, 0xb6, 0xe6, 0xfc, 0xa7, 0x15, 0x73, 0x7c, 0x3a, 0x82, 0xf7, 0xce, 0x3c, 0x78, 0x31, 0x24, 0xf6, 0xd5, 0x1c, 0xd0, 15 }; 16 static const ecdh_test_case ecccdh_SECP192R1_0_test_case = { 17 .name = "ECCCDH/SECP192R1 0", 18 .ecdh_type = ECCCDH, 19 .ec_str_p = &secp192r1_str_params, 20 .our_priv_key = ecccdh_SECP192R1_0_test_vector_our_priv_key, 21 .our_priv_key_len = sizeof(ecccdh_SECP192R1_0_test_vector_our_priv_key), 22 .peer_pub_key = ecccdh_SECP192R1_0_test_vector_peer_pub_key, 23 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_0_test_vector_peer_pub_key), 24 .exp_our_pub_key = ecccdh_SECP192R1_0_test_vector_our_pub_key, 25 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_0_test_vector_our_pub_key), 26 .exp_shared_secret = ecccdh_SECP192R1_0_test_vector_shared_secret, 27 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_0_test_vector_shared_secret), 28 }; 29 #endif /* WITH_CURVE_SECP192R1 */ 30 31 #ifdef WITH_CURVE_SECP192R1 32 #define ECCCDH_SECP192R1_SELF_TEST_1 33 /*** Tests for ECCCDH/SECP192R1 ***/ 34 static const u8 ecccdh_SECP192R1_1_test_vector_our_priv_key[] = { 35 0x56, 0xe8, 0x53, 0x34, 0x9d, 0x96, 0xfe, 0x4c, 0x44, 0x24, 0x48, 0xda, 0xcb, 0x7c, 0xf9, 0x2b, 0xb7, 0xa9, 0x5d, 0xcf, 0x57, 0x4a, 0x9b, 0xd5, 36 }; 37 static const u8 ecccdh_SECP192R1_1_test_vector_peer_pub_key[] = { 38 0xde, 0xb5, 0x71, 0x2f, 0xa0, 0x27, 0xac, 0x8d, 0x2f, 0x22, 0xc4, 0x55, 0xcc, 0xb7, 0x3a, 0x91, 0xe1, 0x7b, 0x65, 0x12, 0xb5, 0xe0, 0x30, 0xe7, 0x7e, 0x26, 0x90, 0xa0, 0x2c, 0xc9, 0xb2, 0x87, 0x08, 0x43, 0x1a, 0x29, 0xfb, 0x54, 0xb8, 0x7b, 0x1f, 0x0c, 0x14, 0xe0, 0x11, 0xac, 0x21, 0x25, 39 }; 40 static const u8 ecccdh_SECP192R1_1_test_vector_our_pub_key[] = { 41 0xc0, 0x0d, 0x43, 0x57, 0x16, 0xff, 0xea, 0x53, 0xfd, 0x8c, 0x16, 0x27, 0x92, 0x41, 0x4c, 0x37, 0x66, 0x51, 0x87, 0xe5, 0x82, 0x71, 0x65, 0x39, 0xab, 0x71, 0x1c, 0x62, 0xaa, 0x71, 0xa5, 0xa1, 0x8e, 0x8a, 0x3c, 0x48, 0xf8, 0x9d, 0xc6, 0xfa, 0x52, 0xfa, 0xc0, 0x10, 0x8e, 0x52, 0xa8, 0xa0, 42 }; 43 static const u8 ecccdh_SECP192R1_1_test_vector_shared_secret[] = { 44 0xc2, 0x08, 0x84, 0x75, 0x68, 0xb9, 0x88, 0x35, 0xd7, 0x31, 0x2c, 0xef, 0x1f, 0x97, 0xf7, 0xaa, 0x29, 0x82, 0x83, 0x15, 0x23, 0x13, 0xc2, 0x9d, 45 }; 46 static const ecdh_test_case ecccdh_SECP192R1_1_test_case = { 47 .name = "ECCCDH/SECP192R1 1", 48 .ecdh_type = ECCCDH, 49 .ec_str_p = &secp192r1_str_params, 50 .our_priv_key = ecccdh_SECP192R1_1_test_vector_our_priv_key, 51 .our_priv_key_len = sizeof(ecccdh_SECP192R1_1_test_vector_our_priv_key), 52 .peer_pub_key = ecccdh_SECP192R1_1_test_vector_peer_pub_key, 53 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_1_test_vector_peer_pub_key), 54 .exp_our_pub_key = ecccdh_SECP192R1_1_test_vector_our_pub_key, 55 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_1_test_vector_our_pub_key), 56 .exp_shared_secret = ecccdh_SECP192R1_1_test_vector_shared_secret, 57 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_1_test_vector_shared_secret), 58 }; 59 #endif /* WITH_CURVE_SECP192R1 */ 60 61 #ifdef WITH_CURVE_SECP192R1 62 #define ECCCDH_SECP192R1_SELF_TEST_2 63 /*** Tests for ECCCDH/SECP192R1 ***/ 64 static const u8 ecccdh_SECP192R1_2_test_vector_our_priv_key[] = { 65 0xc6, 0xef, 0x61, 0xfe, 0x12, 0xe8, 0x0b, 0xf5, 0x6f, 0x2d, 0x3f, 0x7d, 0x0b, 0xb7, 0x57, 0x39, 0x45, 0x19, 0x90, 0x6d, 0x55, 0x50, 0x09, 0x49, 66 }; 67 static const u8 ecccdh_SECP192R1_2_test_vector_peer_pub_key[] = { 68 0x4e, 0xda, 0xa8, 0xef, 0xc5, 0xa0, 0xf4, 0x0f, 0x84, 0x36, 0x63, 0xec, 0x58, 0x15, 0xe7, 0x76, 0x2d, 0xdd, 0xc0, 0x08, 0xe6, 0x63, 0xc2, 0x0f, 0x0a, 0x9f, 0x8d, 0xc6, 0x7a, 0x3e, 0x60, 0xef, 0x6d, 0x64, 0xb5, 0x22, 0x18, 0x5d, 0x03, 0xdf, 0x1f, 0xc0, 0xad, 0xfd, 0x42, 0x47, 0x82, 0x79, 69 }; 70 static const u8 ecccdh_SECP192R1_2_test_vector_our_pub_key[] = { 71 0xe1, 0x84, 0xbc, 0x18, 0x24, 0x82, 0xf3, 0x40, 0x3c, 0x87, 0x87, 0xb8, 0x38, 0x42, 0x47, 0x74, 0x67, 0xfc, 0xd0, 0x11, 0xdb, 0x0f, 0x6c, 0x64, 0xf9, 0xd1, 0xc1, 0x41, 0x42, 0xf4, 0x0d, 0xe8, 0x63, 0x9d, 0xb9, 0x7d, 0x51, 0xa6, 0x3d, 0x2c, 0xce, 0x10, 0x07, 0xcc, 0xf7, 0x73, 0xcd, 0xcb, 72 }; 73 static const u8 ecccdh_SECP192R1_2_test_vector_shared_secret[] = { 74 0x87, 0x22, 0x91, 0x07, 0x04, 0x7a, 0x3b, 0x61, 0x19, 0x20, 0xd6, 0xe3, 0xb2, 0xc0, 0xc8, 0x9b, 0xea, 0x4f, 0x49, 0x41, 0x22, 0x60, 0xb8, 0xdd, 75 }; 76 static const ecdh_test_case ecccdh_SECP192R1_2_test_case = { 77 .name = "ECCCDH/SECP192R1 2", 78 .ecdh_type = ECCCDH, 79 .ec_str_p = &secp192r1_str_params, 80 .our_priv_key = ecccdh_SECP192R1_2_test_vector_our_priv_key, 81 .our_priv_key_len = sizeof(ecccdh_SECP192R1_2_test_vector_our_priv_key), 82 .peer_pub_key = ecccdh_SECP192R1_2_test_vector_peer_pub_key, 83 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_2_test_vector_peer_pub_key), 84 .exp_our_pub_key = ecccdh_SECP192R1_2_test_vector_our_pub_key, 85 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_2_test_vector_our_pub_key), 86 .exp_shared_secret = ecccdh_SECP192R1_2_test_vector_shared_secret, 87 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_2_test_vector_shared_secret), 88 }; 89 #endif /* WITH_CURVE_SECP192R1 */ 90 91 #ifdef WITH_CURVE_SECP192R1 92 #define ECCCDH_SECP192R1_SELF_TEST_3 93 /*** Tests for ECCCDH/SECP192R1 ***/ 94 static const u8 ecccdh_SECP192R1_3_test_vector_our_priv_key[] = { 95 0xe6, 0x74, 0x7b, 0x9c, 0x23, 0xba, 0x70, 0x44, 0xf3, 0x8f, 0xf7, 0xe6, 0x2c, 0x35, 0xe4, 0x03, 0x89, 0x20, 0xf5, 0xa0, 0x16, 0x3d, 0x3c, 0xda, 96 }; 97 static const u8 ecccdh_SECP192R1_3_test_vector_peer_pub_key[] = { 98 0x88, 0x87, 0xc2, 0x76, 0xed, 0xee, 0xd3, 0xe9, 0xe8, 0x66, 0xb4, 0x6d, 0x58, 0xd8, 0x95, 0xc7, 0x3f, 0xbd, 0x80, 0xb6, 0x3e, 0x38, 0x2e, 0x88, 0x04, 0xc5, 0x09, 0x7b, 0xa6, 0x64, 0x5e, 0x16, 0x20, 0x6c, 0xfb, 0x70, 0xf7, 0x05, 0x26, 0x55, 0x94, 0x7d, 0xd4, 0x4a, 0x17, 0xf1, 0xf9, 0xd5, 99 }; 100 static const u8 ecccdh_SECP192R1_3_test_vector_our_pub_key[] = { 101 0x2b, 0x83, 0x8d, 0xbe, 0x73, 0x73, 0x5f, 0x37, 0xa3, 0x9a, 0x78, 0xd3, 0x19, 0x57, 0x83, 0xd2, 0x69, 0x91, 0xe8, 0x6f, 0xf4, 0xd9, 0x2d, 0x1a, 0x60, 0xd3, 0x44, 0x94, 0x22, 0x74, 0x48, 0x9f, 0x98, 0x90, 0x3b, 0x2e, 0x7f, 0x93, 0xf8, 0xd1, 0x97, 0xfc, 0x9a, 0xe6, 0x0a, 0x0e, 0xd5, 0x3a, 102 }; 103 static const u8 ecccdh_SECP192R1_3_test_vector_shared_secret[] = { 104 0xee, 0xc0, 0xbe, 0xd8, 0xfc, 0x55, 0xe1, 0xfe, 0xdd, 0xc8, 0x21, 0x58, 0xfd, 0x6d, 0xc0, 0xd4, 0x8a, 0x4d, 0x79, 0x6a, 0xaf, 0x47, 0xd4, 0x6c, 105 }; 106 static const ecdh_test_case ecccdh_SECP192R1_3_test_case = { 107 .name = "ECCCDH/SECP192R1 3", 108 .ecdh_type = ECCCDH, 109 .ec_str_p = &secp192r1_str_params, 110 .our_priv_key = ecccdh_SECP192R1_3_test_vector_our_priv_key, 111 .our_priv_key_len = sizeof(ecccdh_SECP192R1_3_test_vector_our_priv_key), 112 .peer_pub_key = ecccdh_SECP192R1_3_test_vector_peer_pub_key, 113 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_3_test_vector_peer_pub_key), 114 .exp_our_pub_key = ecccdh_SECP192R1_3_test_vector_our_pub_key, 115 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_3_test_vector_our_pub_key), 116 .exp_shared_secret = ecccdh_SECP192R1_3_test_vector_shared_secret, 117 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_3_test_vector_shared_secret), 118 }; 119 #endif /* WITH_CURVE_SECP192R1 */ 120 121 #ifdef WITH_CURVE_SECP192R1 122 #define ECCCDH_SECP192R1_SELF_TEST_4 123 /*** Tests for ECCCDH/SECP192R1 ***/ 124 static const u8 ecccdh_SECP192R1_4_test_vector_our_priv_key[] = { 125 0xbe, 0xab, 0xed, 0xd0, 0x15, 0x4a, 0x1a, 0xfc, 0xfc, 0x85, 0xd5, 0x21, 0x81, 0xc1, 0x0f, 0x5e, 0xb4, 0x7a, 0xdc, 0x51, 0xf6, 0x55, 0x04, 0x7d, 126 }; 127 static const u8 ecccdh_SECP192R1_4_test_vector_peer_pub_key[] = { 128 0x0d, 0x04, 0x5f, 0x30, 0x25, 0x4a, 0xdc, 0x1f, 0xce, 0xfa, 0x8a, 0x5b, 0x1f, 0x31, 0xbf, 0x4e, 0x73, 0x9d, 0xd3, 0x27, 0xcd, 0x18, 0xd5, 0x94, 0x54, 0x2c, 0x31, 0x4e, 0x41, 0x42, 0x7c, 0x08, 0x27, 0x8a, 0x08, 0xce, 0x8d, 0x73, 0x05, 0xf3, 0xb5, 0xb8, 0x49, 0xc7, 0x2d, 0x8a, 0xff, 0x73, 129 }; 130 static const u8 ecccdh_SECP192R1_4_test_vector_our_pub_key[] = { 131 0x1f, 0x65, 0xcf, 0x6e, 0x89, 0x78, 0xe1, 0xc1, 0xbc, 0x10, 0xbb, 0x61, 0xa7, 0xdb, 0x31, 0x1d, 0xe3, 0x10, 0x08, 0x8c, 0x8c, 0xf9, 0x76, 0x8b, 0xf7, 0xd4, 0x38, 0x16, 0x8e, 0x7f, 0x42, 0xab, 0x14, 0xb1, 0x6a, 0xf5, 0x3a, 0x7a, 0x2f, 0x64, 0x6f, 0xf4, 0x0b, 0x53, 0xd7, 0x4c, 0xbc, 0xc7, 132 }; 133 static const u8 ecccdh_SECP192R1_4_test_vector_shared_secret[] = { 134 0x71, 0x6e, 0x74, 0x3b, 0x1b, 0x37, 0xa2, 0xcd, 0x84, 0x79, 0xf0, 0xa3, 0xd5, 0xa7, 0x4c, 0x10, 0xba, 0x25, 0x99, 0xbe, 0x18, 0xd7, 0xe2, 0xf4, 135 }; 136 static const ecdh_test_case ecccdh_SECP192R1_4_test_case = { 137 .name = "ECCCDH/SECP192R1 4", 138 .ecdh_type = ECCCDH, 139 .ec_str_p = &secp192r1_str_params, 140 .our_priv_key = ecccdh_SECP192R1_4_test_vector_our_priv_key, 141 .our_priv_key_len = sizeof(ecccdh_SECP192R1_4_test_vector_our_priv_key), 142 .peer_pub_key = ecccdh_SECP192R1_4_test_vector_peer_pub_key, 143 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_4_test_vector_peer_pub_key), 144 .exp_our_pub_key = ecccdh_SECP192R1_4_test_vector_our_pub_key, 145 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_4_test_vector_our_pub_key), 146 .exp_shared_secret = ecccdh_SECP192R1_4_test_vector_shared_secret, 147 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_4_test_vector_shared_secret), 148 }; 149 #endif /* WITH_CURVE_SECP192R1 */ 150 151 #ifdef WITH_CURVE_SECP192R1 152 #define ECCCDH_SECP192R1_SELF_TEST_5 153 /*** Tests for ECCCDH/SECP192R1 ***/ 154 static const u8 ecccdh_SECP192R1_5_test_vector_our_priv_key[] = { 155 0xcf, 0x70, 0x35, 0x42, 0x26, 0x66, 0x73, 0x21, 0xd6, 0xe2, 0xba, 0xf4, 0x09, 0x99, 0xe2, 0xfd, 0x74, 0xc7, 0xa0, 0xf7, 0x93, 0xfa, 0x86, 0x99, 156 }; 157 static const u8 ecccdh_SECP192R1_5_test_vector_peer_pub_key[] = { 158 0xfb, 0x35, 0xca, 0x20, 0xd2, 0xe9, 0x66, 0x65, 0xc5, 0x1b, 0x98, 0xe8, 0xf6, 0xeb, 0x3d, 0x79, 0x11, 0x35, 0x08, 0xd8, 0xbc, 0xcd, 0x45, 0x16, 0x36, 0x8e, 0xec, 0x0d, 0x5b, 0xfb, 0x84, 0x77, 0x21, 0xdf, 0x6a, 0xaf, 0xf0, 0xe5, 0xd4, 0x8c, 0x44, 0x4f, 0x74, 0xbf, 0x9c, 0xd8, 0xa5, 0xa7, 159 }; 160 static const u8 ecccdh_SECP192R1_5_test_vector_our_pub_key[] = { 161 0x5f, 0x48, 0x44, 0xff, 0xcc, 0xe6, 0x10, 0x05, 0xd2, 0x4f, 0x73, 0x7d, 0xb9, 0x86, 0x75, 0xe9, 0x2f, 0x7b, 0x65, 0x43, 0xae, 0xb6, 0x10, 0x6c, 0x54, 0x24, 0xf5, 0x98, 0x13, 0x92, 0x15, 0xd3, 0x89, 0xb6, 0xb1, 0x2b, 0x86, 0xd5, 0x80, 0x14, 0x85, 0x7f, 0x2d, 0xda, 0xdb, 0x54, 0x0f, 0x51, 162 }; 163 static const u8 ecccdh_SECP192R1_5_test_vector_shared_secret[] = { 164 0xf6, 0x70, 0x53, 0xb9, 0x34, 0x45, 0x99, 0x85, 0xa3, 0x15, 0xcb, 0x01, 0x7b, 0xf0, 0x30, 0x28, 0x91, 0x79, 0x8d, 0x45, 0xd0, 0xe1, 0x95, 0x08, 165 }; 166 static const ecdh_test_case ecccdh_SECP192R1_5_test_case = { 167 .name = "ECCCDH/SECP192R1 5", 168 .ecdh_type = ECCCDH, 169 .ec_str_p = &secp192r1_str_params, 170 .our_priv_key = ecccdh_SECP192R1_5_test_vector_our_priv_key, 171 .our_priv_key_len = sizeof(ecccdh_SECP192R1_5_test_vector_our_priv_key), 172 .peer_pub_key = ecccdh_SECP192R1_5_test_vector_peer_pub_key, 173 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_5_test_vector_peer_pub_key), 174 .exp_our_pub_key = ecccdh_SECP192R1_5_test_vector_our_pub_key, 175 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_5_test_vector_our_pub_key), 176 .exp_shared_secret = ecccdh_SECP192R1_5_test_vector_shared_secret, 177 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_5_test_vector_shared_secret), 178 }; 179 #endif /* WITH_CURVE_SECP192R1 */ 180 181 #ifdef WITH_CURVE_SECP192R1 182 #define ECCCDH_SECP192R1_SELF_TEST_6 183 /*** Tests for ECCCDH/SECP192R1 ***/ 184 static const u8 ecccdh_SECP192R1_6_test_vector_our_priv_key[] = { 185 0xfe, 0x94, 0x25, 0x15, 0x23, 0x7f, 0xff, 0xdd, 0x7b, 0x4e, 0xb5, 0xc6, 0x49, 0x09, 0xee, 0xe4, 0x85, 0x6a, 0x07, 0x6c, 0xdf, 0x12, 0xba, 0xe2, 186 }; 187 static const u8 ecccdh_SECP192R1_6_test_vector_peer_pub_key[] = { 188 0x82, 0x47, 0x52, 0x96, 0x0c, 0x13, 0x07, 0xe5, 0xf1, 0x3a, 0x83, 0xda, 0x21, 0xc7, 0x99, 0x8c, 0xa8, 0xb5, 0xb0, 0x0b, 0x95, 0x49, 0xf6, 0xd0, 0xbc, 0x52, 0xd9, 0x1e, 0x23, 0x43, 0x63, 0xbc, 0x32, 0xee, 0x0b, 0x67, 0x78, 0xf2, 0x5c, 0xd8, 0xc1, 0x84, 0x75, 0x10, 0xf4, 0x34, 0x8b, 0x94, 189 }; 190 static const u8 ecccdh_SECP192R1_6_test_vector_our_pub_key[] = { 191 0xe6, 0x36, 0x9d, 0xf7, 0x9b, 0x20, 0x7b, 0x8b, 0x86, 0x79, 0xf7, 0xc8, 0x69, 0xcf, 0xc2, 0x64, 0x85, 0x9d, 0x1a, 0xb5, 0x5a, 0xa4, 0x01, 0xe8, 0x1f, 0x99, 0xc7, 0x1f, 0x80, 0x1a, 0x30, 0xb5, 0x2f, 0x74, 0xda, 0x6e, 0x5e, 0x6d, 0xbb, 0x62, 0xee, 0x4c, 0x5d, 0xa1, 0x09, 0x0c, 0xc0, 0x20, 192 }; 193 static const u8 ecccdh_SECP192R1_6_test_vector_shared_secret[] = { 194 0x75, 0x82, 0x29, 0x71, 0x19, 0x3e, 0xdd, 0x47, 0x2b, 0xf3, 0x01, 0x51, 0xa7, 0x82, 0x61, 0x9c, 0x55, 0xad, 0x0b, 0x27, 0x9c, 0x93, 0x03, 0xdd, 195 }; 196 static const ecdh_test_case ecccdh_SECP192R1_6_test_case = { 197 .name = "ECCCDH/SECP192R1 6", 198 .ecdh_type = ECCCDH, 199 .ec_str_p = &secp192r1_str_params, 200 .our_priv_key = ecccdh_SECP192R1_6_test_vector_our_priv_key, 201 .our_priv_key_len = sizeof(ecccdh_SECP192R1_6_test_vector_our_priv_key), 202 .peer_pub_key = ecccdh_SECP192R1_6_test_vector_peer_pub_key, 203 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_6_test_vector_peer_pub_key), 204 .exp_our_pub_key = ecccdh_SECP192R1_6_test_vector_our_pub_key, 205 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_6_test_vector_our_pub_key), 206 .exp_shared_secret = ecccdh_SECP192R1_6_test_vector_shared_secret, 207 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_6_test_vector_shared_secret), 208 }; 209 #endif /* WITH_CURVE_SECP192R1 */ 210 211 #ifdef WITH_CURVE_SECP192R1 212 #define ECCCDH_SECP192R1_SELF_TEST_7 213 /*** Tests for ECCCDH/SECP192R1 ***/ 214 static const u8 ecccdh_SECP192R1_7_test_vector_our_priv_key[] = { 215 0x33, 0xfe, 0xd1, 0x04, 0x92, 0xaf, 0xa5, 0xbe, 0xa0, 0x33, 0x3c, 0x0a, 0xf1, 0x2c, 0xac, 0x94, 0x0c, 0x4d, 0x22, 0x24, 0x55, 0xbc, 0xd0, 0xfe, 216 }; 217 static const u8 ecccdh_SECP192R1_7_test_vector_peer_pub_key[] = { 218 0x10, 0xbb, 0x57, 0x02, 0x02, 0x91, 0x14, 0x19, 0x81, 0xf8, 0x33, 0xb4, 0x74, 0x9e, 0x56, 0x11, 0x03, 0x4b, 0x30, 0x8e, 0x84, 0x01, 0x1d, 0x21, 0xe1, 0xca, 0xcd, 0x6b, 0x7b, 0xd1, 0x7e, 0xd8, 0xdd, 0xb5, 0x0b, 0x6a, 0xee, 0x06, 0x54, 0xc3, 0x5f, 0x2d, 0x0e, 0xdd, 0xc1, 0xcf, 0xfc, 0xf6, 219 }; 220 static const u8 ecccdh_SECP192R1_7_test_vector_our_pub_key[] = { 221 0xef, 0x0b, 0x28, 0xaf, 0xc4, 0x16, 0x37, 0xd7, 0x37, 0xf4, 0x2e, 0x4c, 0x8a, 0xac, 0xea, 0xdc, 0x84, 0xba, 0x2e, 0x0b, 0x84, 0x9c, 0xa1, 0x8c, 0x57, 0x79, 0x79, 0x42, 0xe5, 0x52, 0x17, 0x3b, 0xba, 0x17, 0xf7, 0x32, 0x78, 0xe0, 0x29, 0xf4, 0x23, 0x35, 0x06, 0x8b, 0xd7, 0x70, 0xdd, 0xf2, 222 }; 223 static const u8 ecccdh_SECP192R1_7_test_vector_shared_secret[] = { 224 0x67, 0xcb, 0xa2, 0xcb, 0xb6, 0x9e, 0xe7, 0x8b, 0xf1, 0xab, 0xaf, 0xb0, 0xe6, 0xfb, 0xe3, 0x3f, 0xa2, 0x09, 0x4c, 0x12, 0x8d, 0x59, 0x65, 0x2d, 225 }; 226 static const ecdh_test_case ecccdh_SECP192R1_7_test_case = { 227 .name = "ECCCDH/SECP192R1 7", 228 .ecdh_type = ECCCDH, 229 .ec_str_p = &secp192r1_str_params, 230 .our_priv_key = ecccdh_SECP192R1_7_test_vector_our_priv_key, 231 .our_priv_key_len = sizeof(ecccdh_SECP192R1_7_test_vector_our_priv_key), 232 .peer_pub_key = ecccdh_SECP192R1_7_test_vector_peer_pub_key, 233 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_7_test_vector_peer_pub_key), 234 .exp_our_pub_key = ecccdh_SECP192R1_7_test_vector_our_pub_key, 235 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_7_test_vector_our_pub_key), 236 .exp_shared_secret = ecccdh_SECP192R1_7_test_vector_shared_secret, 237 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_7_test_vector_shared_secret), 238 }; 239 #endif /* WITH_CURVE_SECP192R1 */ 240 241 #ifdef WITH_CURVE_SECP192R1 242 #define ECCCDH_SECP192R1_SELF_TEST_8 243 /*** Tests for ECCCDH/SECP192R1 ***/ 244 static const u8 ecccdh_SECP192R1_8_test_vector_our_priv_key[] = { 245 0xf3, 0x55, 0x7c, 0x5d, 0x70, 0xb4, 0xc7, 0x95, 0x49, 0x60, 0xc3, 0x35, 0x68, 0x77, 0x6a, 0xdb, 0xe8, 0xe4, 0x36, 0x19, 0xab, 0xe2, 0x6b, 0x13, 246 }; 247 static const u8 ecccdh_SECP192R1_8_test_vector_peer_pub_key[] = { 248 0x51, 0x92, 0xfc, 0xe4, 0x18, 0x5a, 0x77, 0x58, 0xea, 0x1b, 0xc5, 0x6e, 0x0e, 0x4f, 0x4e, 0x8b, 0x2d, 0xce, 0x32, 0x34, 0x8d, 0x0d, 0xce, 0xd1, 0x20, 0x98, 0x99, 0x81, 0xbe, 0xaa, 0xf0, 0x00, 0x6d, 0x88, 0xa9, 0x6e, 0x79, 0x71, 0xa2, 0xfa, 0x3a, 0x33, 0xba, 0x46, 0x04, 0x7f, 0xc7, 0xba, 249 }; 250 static const u8 ecccdh_SECP192R1_8_test_vector_our_pub_key[] = { 251 0xd7, 0x01, 0x12, 0xc5, 0xf0, 0xf0, 0x84, 0x43, 0x86, 0x49, 0x4a, 0xc1, 0xad, 0x99, 0xdc, 0xe2, 0x21, 0x41, 0x34, 0x17, 0x6e, 0xbf, 0xb9, 0xaf, 0xd3, 0xc1, 0x87, 0xa0, 0x38, 0x51, 0x0a, 0xb3, 0x1d, 0x45, 0x9e, 0x2b, 0x7a, 0xf1, 0xa3, 0x80, 0xdd, 0x75, 0x76, 0xaf, 0x06, 0x26, 0x75, 0x48, 252 }; 253 static const u8 ecccdh_SECP192R1_8_test_vector_shared_secret[] = { 254 0xcf, 0x99, 0xa2, 0x77, 0x0a, 0x38, 0x6c, 0xa0, 0x13, 0x7d, 0x1e, 0xca, 0x0a, 0x22, 0x6e, 0x48, 0x42, 0x97, 0xac, 0x3c, 0x51, 0x3f, 0x36, 0x31, 255 }; 256 static const ecdh_test_case ecccdh_SECP192R1_8_test_case = { 257 .name = "ECCCDH/SECP192R1 8", 258 .ecdh_type = ECCCDH, 259 .ec_str_p = &secp192r1_str_params, 260 .our_priv_key = ecccdh_SECP192R1_8_test_vector_our_priv_key, 261 .our_priv_key_len = sizeof(ecccdh_SECP192R1_8_test_vector_our_priv_key), 262 .peer_pub_key = ecccdh_SECP192R1_8_test_vector_peer_pub_key, 263 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_8_test_vector_peer_pub_key), 264 .exp_our_pub_key = ecccdh_SECP192R1_8_test_vector_our_pub_key, 265 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_8_test_vector_our_pub_key), 266 .exp_shared_secret = ecccdh_SECP192R1_8_test_vector_shared_secret, 267 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_8_test_vector_shared_secret), 268 }; 269 #endif /* WITH_CURVE_SECP192R1 */ 270 271 #ifdef WITH_CURVE_SECP192R1 272 #define ECCCDH_SECP192R1_SELF_TEST_9 273 /*** Tests for ECCCDH/SECP192R1 ***/ 274 static const u8 ecccdh_SECP192R1_9_test_vector_our_priv_key[] = { 275 0x58, 0x6c, 0xfb, 0xa1, 0xc6, 0xe8, 0x17, 0x66, 0xed, 0x52, 0x82, 0x8f, 0x17, 0x7b, 0x1b, 0xe1, 0x4e, 0xbb, 0xc5, 0xb8, 0x33, 0x48, 0xc3, 0x11, 276 }; 277 static const u8 ecccdh_SECP192R1_9_test_vector_peer_pub_key[] = { 278 0x26, 0xd0, 0x19, 0xdb, 0xe2, 0x79, 0xea, 0xd0, 0x1e, 0xed, 0x14, 0x3a, 0x91, 0x60, 0x1a, 0xda, 0x26, 0xe2, 0xf4, 0x22, 0x25, 0xb1, 0xc6, 0x2b, 0x6c, 0xa6, 0x53, 0xf0, 0x82, 0x72, 0xe0, 0x38, 0x6f, 0xc9, 0x42, 0x1f, 0xbd, 0x58, 0x00, 0x93, 0xd7, 0xae, 0x63, 0x01, 0xbc, 0xa9, 0x44, 0x76, 279 }; 280 static const u8 ecccdh_SECP192R1_9_test_vector_our_pub_key[] = { 281 0x58, 0xb3, 0xc6, 0x3e, 0x56, 0xbe, 0xc9, 0xd6, 0x96, 0xbf, 0x9a, 0x88, 0xdf, 0x28, 0x73, 0x73, 0x83, 0x91, 0xf7, 0x63, 0x68, 0xaa, 0x2b, 0x49, 0x57, 0x76, 0x77, 0x3b, 0x26, 0x1f, 0xaf, 0x7b, 0xa2, 0xfd, 0xc4, 0xfe, 0x43, 0xb9, 0x2c, 0x0b, 0x1c, 0x7a, 0x2f, 0xd0, 0x54, 0xa4, 0x36, 0x50, 282 }; 283 static const u8 ecccdh_SECP192R1_9_test_vector_shared_secret[] = { 284 0x57, 0x63, 0x31, 0xe2, 0xb4, 0xfb, 0x38, 0xa1, 0x12, 0x81, 0x0e, 0x15, 0x29, 0x83, 0x4d, 0xe8, 0x30, 0x7f, 0xb0, 0xa0, 0xd2, 0x75, 0x68, 0x77, 285 }; 286 static const ecdh_test_case ecccdh_SECP192R1_9_test_case = { 287 .name = "ECCCDH/SECP192R1 9", 288 .ecdh_type = ECCCDH, 289 .ec_str_p = &secp192r1_str_params, 290 .our_priv_key = ecccdh_SECP192R1_9_test_vector_our_priv_key, 291 .our_priv_key_len = sizeof(ecccdh_SECP192R1_9_test_vector_our_priv_key), 292 .peer_pub_key = ecccdh_SECP192R1_9_test_vector_peer_pub_key, 293 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_9_test_vector_peer_pub_key), 294 .exp_our_pub_key = ecccdh_SECP192R1_9_test_vector_our_pub_key, 295 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_9_test_vector_our_pub_key), 296 .exp_shared_secret = ecccdh_SECP192R1_9_test_vector_shared_secret, 297 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_9_test_vector_shared_secret), 298 }; 299 #endif /* WITH_CURVE_SECP192R1 */ 300 301 #ifdef WITH_CURVE_SECP192R1 302 #define ECCCDH_SECP192R1_SELF_TEST_10 303 /*** Tests for ECCCDH/SECP192R1 ***/ 304 static const u8 ecccdh_SECP192R1_10_test_vector_our_priv_key[] = { 305 0xca, 0xd8, 0x10, 0x06, 0x03, 0xa4, 0xf6, 0x5b, 0xe0, 0x8d, 0x8f, 0xc8, 0xa1, 0xb7, 0xe8, 0x84, 0xc5, 0xff, 0x65, 0xde, 0xb3, 0xc9, 0x6d, 0x99, 306 }; 307 static const u8 ecccdh_SECP192R1_10_test_vector_peer_pub_key[] = { 308 0x53, 0x9b, 0xc4, 0x0f, 0xe2, 0x0a, 0x0f, 0xb2, 0x67, 0x88, 0x8b, 0x64, 0x7b, 0x03, 0xea, 0xaf, 0x6e, 0xc2, 0x0c, 0x02, 0xa1, 0xe1, 0xf8, 0xc8, 0x69, 0x09, 0x5e, 0x5b, 0xb7, 0xb4, 0xd4, 0x4c, 0x32, 0x78, 0xa7, 0xee, 0x6b, 0xec, 0xa3, 0x97, 0xc4, 0x52, 0x46, 0xda, 0x9a, 0x34, 0xc8, 0xbe, 309 }; 310 static const u8 ecccdh_SECP192R1_10_test_vector_our_pub_key[] = { 311 0xb7, 0xfc, 0xc0, 0xf5, 0x2c, 0x7a, 0x41, 0x1e, 0xdb, 0xed, 0x39, 0xe1, 0x0b, 0xf0, 0x2b, 0x6a, 0xe0, 0xf2, 0x66, 0x14, 0xc6, 0xb3, 0x25, 0xa2, 0x47, 0x48, 0x3b, 0x26, 0xeb, 0x67, 0x77, 0x6d, 0xe2, 0xb9, 0x3a, 0xb7, 0x11, 0x9d, 0x54, 0x47, 0x57, 0x37, 0x39, 0xe3, 0xd5, 0x5e, 0x72, 0xfb, 312 }; 313 static const u8 ecccdh_SECP192R1_10_test_vector_shared_secret[] = { 314 0x90, 0x2f, 0x45, 0x01, 0x91, 0x6a, 0x0d, 0xd9, 0x45, 0x55, 0x4c, 0x3a, 0x37, 0xb3, 0xd7, 0x80, 0xd3, 0x75, 0xa6, 0xda, 0x71, 0x31, 0x97, 0xc4, 315 }; 316 static const ecdh_test_case ecccdh_SECP192R1_10_test_case = { 317 .name = "ECCCDH/SECP192R1 10", 318 .ecdh_type = ECCCDH, 319 .ec_str_p = &secp192r1_str_params, 320 .our_priv_key = ecccdh_SECP192R1_10_test_vector_our_priv_key, 321 .our_priv_key_len = sizeof(ecccdh_SECP192R1_10_test_vector_our_priv_key), 322 .peer_pub_key = ecccdh_SECP192R1_10_test_vector_peer_pub_key, 323 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_10_test_vector_peer_pub_key), 324 .exp_our_pub_key = ecccdh_SECP192R1_10_test_vector_our_pub_key, 325 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_10_test_vector_our_pub_key), 326 .exp_shared_secret = ecccdh_SECP192R1_10_test_vector_shared_secret, 327 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_10_test_vector_shared_secret), 328 }; 329 #endif /* WITH_CURVE_SECP192R1 */ 330 331 #ifdef WITH_CURVE_SECP192R1 332 #define ECCCDH_SECP192R1_SELF_TEST_11 333 /*** Tests for ECCCDH/SECP192R1 ***/ 334 static const u8 ecccdh_SECP192R1_11_test_vector_our_priv_key[] = { 335 0x1e, 0xdd, 0x87, 0x9c, 0xc5, 0xc7, 0x96, 0x19, 0xca, 0xe6, 0xc7, 0x3a, 0x69, 0x1b, 0xd5, 0xa0, 0x39, 0x5c, 0x0e, 0xf3, 0xb3, 0x56, 0xfc, 0xd2, 336 }; 337 static const u8 ecccdh_SECP192R1_11_test_vector_peer_pub_key[] = { 338 0x5d, 0x34, 0x3d, 0xdb, 0x96, 0x31, 0x8f, 0xb4, 0x79, 0x4d, 0x10, 0xf6, 0xc5, 0x73, 0xf9, 0x9f, 0xee, 0x5d, 0x0d, 0x57, 0xb9, 0x96, 0x25, 0x0f, 0x99, 0xfb, 0xdf, 0x9d, 0x97, 0xdd, 0x88, 0xad, 0x41, 0x02, 0x35, 0xda, 0xc3, 0x6e, 0x5b, 0x92, 0xce, 0x28, 0x24, 0xb8, 0xe5, 0x87, 0xa8, 0x2c, 339 }; 340 static const u8 ecccdh_SECP192R1_11_test_vector_our_pub_key[] = { 341 0x6c, 0xe6, 0xad, 0xb2, 0xc3, 0x08, 0x08, 0xf5, 0x90, 0x04, 0x8c, 0x33, 0xdf, 0xfa, 0xd4, 0x52, 0x4e, 0xbf, 0x7a, 0x5f, 0xd3, 0x9b, 0x74, 0x7b, 0x49, 0x66, 0xbd, 0x2f, 0x3d, 0x00, 0x56, 0x9b, 0x4d, 0x4c, 0x04, 0x09, 0xfb, 0xd7, 0xa2, 0xdb, 0x75, 0x2f, 0x6d, 0x09, 0xbc, 0xa8, 0xc2, 0x5f, 342 }; 343 static const u8 ecccdh_SECP192R1_11_test_vector_shared_secret[] = { 344 0x46, 0xe4, 0xde, 0x33, 0x50, 0x54, 0xd4, 0x29, 0x86, 0x32, 0x18, 0xae, 0x33, 0x63, 0x6f, 0xc9, 0xb8, 0x9c, 0x62, 0x8b, 0x64, 0xb5, 0x06, 0xc7, 345 }; 346 static const ecdh_test_case ecccdh_SECP192R1_11_test_case = { 347 .name = "ECCCDH/SECP192R1 11", 348 .ecdh_type = ECCCDH, 349 .ec_str_p = &secp192r1_str_params, 350 .our_priv_key = ecccdh_SECP192R1_11_test_vector_our_priv_key, 351 .our_priv_key_len = sizeof(ecccdh_SECP192R1_11_test_vector_our_priv_key), 352 .peer_pub_key = ecccdh_SECP192R1_11_test_vector_peer_pub_key, 353 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_11_test_vector_peer_pub_key), 354 .exp_our_pub_key = ecccdh_SECP192R1_11_test_vector_our_pub_key, 355 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_11_test_vector_our_pub_key), 356 .exp_shared_secret = ecccdh_SECP192R1_11_test_vector_shared_secret, 357 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_11_test_vector_shared_secret), 358 }; 359 #endif /* WITH_CURVE_SECP192R1 */ 360 361 #ifdef WITH_CURVE_SECP192R1 362 #define ECCCDH_SECP192R1_SELF_TEST_12 363 /*** Tests for ECCCDH/SECP192R1 ***/ 364 static const u8 ecccdh_SECP192R1_12_test_vector_our_priv_key[] = { 365 0x46, 0x0e, 0x45, 0x22, 0x73, 0xfe, 0x18, 0x27, 0x60, 0x21, 0x87, 0xad, 0x3b, 0xeb, 0xee, 0x65, 0xcb, 0x84, 0x42, 0x3b, 0xb4, 0xf4, 0x75, 0x37, 366 }; 367 static const u8 ecccdh_SECP192R1_12_test_vector_peer_pub_key[] = { 368 0x8d, 0x3d, 0xb9, 0xbd, 0xce, 0x13, 0x7f, 0xfb, 0xfb, 0x89, 0x13, 0x88, 0xc3, 0x7d, 0xf6, 0xc0, 0xcb, 0xc9, 0x0a, 0xa5, 0xe5, 0x37, 0x62, 0x20, 0x13, 0x5d, 0x30, 0xb5, 0xcb, 0x66, 0x0e, 0xef, 0x87, 0x64, 0xff, 0xc7, 0x44, 0xf1, 0x5c, 0x1b, 0x5d, 0x6d, 0xc0, 0x6b, 0xa4, 0x41, 0x6d, 0x37, 369 }; 370 static const u8 ecccdh_SECP192R1_12_test_vector_our_pub_key[] = { 371 0xd1, 0xbd, 0x3a, 0x3e, 0xfa, 0xbf, 0x47, 0x67, 0xfe, 0x63, 0x80, 0xbd, 0xf0, 0xdb, 0xf4, 0x9d, 0x52, 0xd4, 0xcf, 0x0c, 0xbb, 0x89, 0x40, 0x4c, 0xc1, 0x50, 0xc2, 0xb4, 0xc8, 0xb3, 0xaa, 0x35, 0xf7, 0x65, 0xf8, 0x47, 0xe4, 0xf7, 0xf8, 0xfd, 0x87, 0x04, 0xd2, 0x41, 0xa1, 0x81, 0xee, 0x99, 372 }; 373 static const u8 ecccdh_SECP192R1_12_test_vector_shared_secret[] = { 374 0x1b, 0xfe, 0x9e, 0x5a, 0x20, 0xac, 0x7a, 0x38, 0xd8, 0xf6, 0x05, 0xb4, 0x25, 0xbb, 0x90, 0x30, 0xbe, 0x31, 0xef, 0x97, 0xc1, 0x01, 0xc7, 0x6c, 375 }; 376 static const ecdh_test_case ecccdh_SECP192R1_12_test_case = { 377 .name = "ECCCDH/SECP192R1 12", 378 .ecdh_type = ECCCDH, 379 .ec_str_p = &secp192r1_str_params, 380 .our_priv_key = ecccdh_SECP192R1_12_test_vector_our_priv_key, 381 .our_priv_key_len = sizeof(ecccdh_SECP192R1_12_test_vector_our_priv_key), 382 .peer_pub_key = ecccdh_SECP192R1_12_test_vector_peer_pub_key, 383 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_12_test_vector_peer_pub_key), 384 .exp_our_pub_key = ecccdh_SECP192R1_12_test_vector_our_pub_key, 385 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_12_test_vector_our_pub_key), 386 .exp_shared_secret = ecccdh_SECP192R1_12_test_vector_shared_secret, 387 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_12_test_vector_shared_secret), 388 }; 389 #endif /* WITH_CURVE_SECP192R1 */ 390 391 #ifdef WITH_CURVE_SECP192R1 392 #define ECCCDH_SECP192R1_SELF_TEST_13 393 /*** Tests for ECCCDH/SECP192R1 ***/ 394 static const u8 ecccdh_SECP192R1_13_test_vector_our_priv_key[] = { 395 0xb9, 0x70, 0x36, 0x50, 0x08, 0x45, 0x6f, 0x87, 0x58, 0xec, 0xc5, 0xa3, 0xb3, 0x3c, 0xf3, 0xae, 0x6a, 0x8d, 0x56, 0x81, 0x07, 0xa5, 0x21, 0x67, 396 }; 397 static const u8 ecccdh_SECP192R1_13_test_vector_peer_pub_key[] = { 398 0x9e, 0x0a, 0x69, 0x49, 0x51, 0x9c, 0x7f, 0x5b, 0xe6, 0x8c, 0x04, 0x33, 0xc5, 0xfd, 0xf1, 0x30, 0x64, 0xaa, 0x13, 0xfb, 0x29, 0x48, 0x3d, 0xc3, 0xe1, 0xc8, 0xba, 0x63, 0xe1, 0xf4, 0x71, 0xdb, 0x23, 0x18, 0x5f, 0x50, 0xd9, 0xc8, 0x71, 0xed, 0xea, 0x21, 0x25, 0x5b, 0x3a, 0x63, 0xb4, 0xb7, 399 }; 400 static const u8 ecccdh_SECP192R1_13_test_vector_our_pub_key[] = { 401 0xc1, 0xb8, 0x61, 0x0c, 0x8c, 0x63, 0xf8, 0xd4, 0xab, 0xda, 0x09, 0x3b, 0x9a, 0x11, 0xa5, 0x66, 0x04, 0x4b, 0xf6, 0x5c, 0x6f, 0xaa, 0x89, 0x99, 0xa5, 0xbc, 0x4b, 0x3c, 0xa0, 0x95, 0x38, 0x2e, 0x97, 0x38, 0xae, 0xe9, 0x5f, 0xe9, 0x47, 0x9b, 0x17, 0x87, 0x9b, 0x3a, 0xd5, 0x29, 0x55, 0x59, 402 }; 403 static const u8 ecccdh_SECP192R1_13_test_vector_shared_secret[] = { 404 0x0e, 0x8c, 0x49, 0x3a, 0x4a, 0xdc, 0x44, 0x5d, 0xc9, 0x28, 0x8a, 0x3b, 0x9b, 0x27, 0x25, 0x99, 0x22, 0x40, 0x54, 0x59, 0x2d, 0x72, 0x65, 0xb3, 405 }; 406 static const ecdh_test_case ecccdh_SECP192R1_13_test_case = { 407 .name = "ECCCDH/SECP192R1 13", 408 .ecdh_type = ECCCDH, 409 .ec_str_p = &secp192r1_str_params, 410 .our_priv_key = ecccdh_SECP192R1_13_test_vector_our_priv_key, 411 .our_priv_key_len = sizeof(ecccdh_SECP192R1_13_test_vector_our_priv_key), 412 .peer_pub_key = ecccdh_SECP192R1_13_test_vector_peer_pub_key, 413 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_13_test_vector_peer_pub_key), 414 .exp_our_pub_key = ecccdh_SECP192R1_13_test_vector_our_pub_key, 415 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_13_test_vector_our_pub_key), 416 .exp_shared_secret = ecccdh_SECP192R1_13_test_vector_shared_secret, 417 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_13_test_vector_shared_secret), 418 }; 419 #endif /* WITH_CURVE_SECP192R1 */ 420 421 #ifdef WITH_CURVE_SECP192R1 422 #define ECCCDH_SECP192R1_SELF_TEST_14 423 /*** Tests for ECCCDH/SECP192R1 ***/ 424 static const u8 ecccdh_SECP192R1_14_test_vector_our_priv_key[] = { 425 0x59, 0xc1, 0x5b, 0x8a, 0x24, 0x64, 0xe4, 0x1d, 0xfe, 0x43, 0x71, 0xc7, 0xf7, 0xda, 0xdf, 0x47, 0x0a, 0xe4, 0x25, 0x54, 0x4f, 0x81, 0x13, 0xbd, 426 }; 427 static const u8 ecccdh_SECP192R1_14_test_vector_peer_pub_key[] = { 428 0xbe, 0x08, 0x82, 0x38, 0x90, 0x2e, 0x99, 0x39, 0xb3, 0xd0, 0x54, 0xee, 0xeb, 0x84, 0x92, 0xda, 0xf4, 0xbd, 0xcf, 0x09, 0xa2, 0xab, 0x77, 0xf1, 0x58, 0xd6, 0x74, 0x9a, 0x3a, 0x92, 0x3d, 0xc8, 0x04, 0x40, 0xf2, 0x66, 0x1f, 0xd3, 0x5b, 0x65, 0x16, 0x17, 0xe6, 0x52, 0x94, 0xb4, 0x63, 0x75, 429 }; 430 static const u8 ecccdh_SECP192R1_14_test_vector_our_pub_key[] = { 431 0x1f, 0xe7, 0x76, 0xf7, 0x35, 0x67, 0xb6, 0xac, 0x0b, 0x0d, 0x67, 0x64, 0x16, 0x4d, 0xe6, 0xc5, 0xbe, 0x75, 0x1b, 0xa8, 0xd1, 0xff, 0x45, 0x5e, 0x4c, 0x16, 0x0b, 0xf3, 0x8a, 0xfb, 0x2b, 0x71, 0xf6, 0x84, 0x26, 0x16, 0x64, 0x11, 0x5c, 0xe8, 0x74, 0x55, 0x3e, 0x8b, 0x05, 0x94, 0x32, 0xd2, 432 }; 433 static const u8 ecccdh_SECP192R1_14_test_vector_shared_secret[] = { 434 0x0f, 0x19, 0x91, 0x08, 0x6b, 0x45, 0x5d, 0xed, 0x6a, 0x1c, 0x41, 0x46, 0xf7, 0xbf, 0x59, 0xfe, 0x9b, 0x49, 0x5d, 0xe5, 0x66, 0xeb, 0xc6, 0xbf, 435 }; 436 static const ecdh_test_case ecccdh_SECP192R1_14_test_case = { 437 .name = "ECCCDH/SECP192R1 14", 438 .ecdh_type = ECCCDH, 439 .ec_str_p = &secp192r1_str_params, 440 .our_priv_key = ecccdh_SECP192R1_14_test_vector_our_priv_key, 441 .our_priv_key_len = sizeof(ecccdh_SECP192R1_14_test_vector_our_priv_key), 442 .peer_pub_key = ecccdh_SECP192R1_14_test_vector_peer_pub_key, 443 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_14_test_vector_peer_pub_key), 444 .exp_our_pub_key = ecccdh_SECP192R1_14_test_vector_our_pub_key, 445 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_14_test_vector_our_pub_key), 446 .exp_shared_secret = ecccdh_SECP192R1_14_test_vector_shared_secret, 447 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_14_test_vector_shared_secret), 448 }; 449 #endif /* WITH_CURVE_SECP192R1 */ 450 451 #ifdef WITH_CURVE_SECP192R1 452 #define ECCCDH_SECP192R1_SELF_TEST_15 453 /*** Tests for ECCCDH/SECP192R1 ***/ 454 static const u8 ecccdh_SECP192R1_15_test_vector_our_priv_key[] = { 455 0xa6, 0xe9, 0xb8, 0x85, 0xc6, 0x6b, 0x95, 0x9d, 0x1f, 0xc2, 0x70, 0x8d, 0x59, 0x1b, 0x6d, 0x32, 0x28, 0xe4, 0x9e, 0xb9, 0x8f, 0x72, 0x6d, 0x61, 456 }; 457 static const u8 ecccdh_SECP192R1_15_test_vector_peer_pub_key[] = { 458 0xbf, 0x5a, 0xe0, 0x50, 0x25, 0xe1, 0xbe, 0x61, 0x7e, 0x66, 0x6d, 0x87, 0xa4, 0x16, 0x83, 0x63, 0x87, 0x3d, 0x57, 0x61, 0xb3, 0x76, 0xb5, 0x03, 0xe1, 0xe6, 0xe3, 0x8b, 0x37, 0x2b, 0x6b, 0xee, 0x0f, 0xf5, 0xb3, 0x50, 0x2d, 0x83, 0x73, 0x5e, 0x3b, 0x2c, 0x26, 0x82, 0x5e, 0x4f, 0x0f, 0xcc, 459 }; 460 static const u8 ecccdh_SECP192R1_15_test_vector_our_pub_key[] = { 461 0x63, 0x2b, 0xb7, 0x65, 0x1d, 0xbf, 0x49, 0xdd, 0xe9, 0xdd, 0x12, 0x5d, 0x13, 0xfb, 0x23, 0x4e, 0x06, 0x61, 0x77, 0x23, 0xbe, 0xed, 0x3d, 0x1b, 0xf4, 0xad, 0x52, 0x09, 0x63, 0x84, 0x88, 0x39, 0x7c, 0x5f, 0x44, 0xf9, 0x94, 0xdd, 0x74, 0x79, 0x80, 0x7e, 0x79, 0xf4, 0x88, 0x7d, 0x2e, 0x71, 462 }; 463 static const u8 ecccdh_SECP192R1_15_test_vector_shared_secret[] = { 464 0xb3, 0x0f, 0x21, 0x27, 0xc3, 0x4d, 0xf3, 0x5a, 0xaa, 0x91, 0xdb, 0xf0, 0xbb, 0xe1, 0x57, 0x98, 0xe7, 0x99, 0xa0, 0x3e, 0xd1, 0x16, 0x98, 0xc1, 465 }; 466 static const ecdh_test_case ecccdh_SECP192R1_15_test_case = { 467 .name = "ECCCDH/SECP192R1 15", 468 .ecdh_type = ECCCDH, 469 .ec_str_p = &secp192r1_str_params, 470 .our_priv_key = ecccdh_SECP192R1_15_test_vector_our_priv_key, 471 .our_priv_key_len = sizeof(ecccdh_SECP192R1_15_test_vector_our_priv_key), 472 .peer_pub_key = ecccdh_SECP192R1_15_test_vector_peer_pub_key, 473 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_15_test_vector_peer_pub_key), 474 .exp_our_pub_key = ecccdh_SECP192R1_15_test_vector_our_pub_key, 475 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_15_test_vector_our_pub_key), 476 .exp_shared_secret = ecccdh_SECP192R1_15_test_vector_shared_secret, 477 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_15_test_vector_shared_secret), 478 }; 479 #endif /* WITH_CURVE_SECP192R1 */ 480 481 #ifdef WITH_CURVE_SECP192R1 482 #define ECCCDH_SECP192R1_SELF_TEST_16 483 /*** Tests for ECCCDH/SECP192R1 ***/ 484 static const u8 ecccdh_SECP192R1_16_test_vector_our_priv_key[] = { 485 0xbd, 0xb7, 0x54, 0x09, 0x6f, 0xfb, 0xfb, 0xd8, 0xb0, 0xf3, 0xcb, 0x04, 0x6c, 0xcb, 0x7c, 0xa1, 0x49, 0xc4, 0xe7, 0x19, 0x20, 0x67, 0xa3, 0xee, 486 }; 487 static const u8 ecccdh_SECP192R1_16_test_vector_peer_pub_key[] = { 488 0x6c, 0xc4, 0xfe, 0xed, 0x84, 0xc7, 0xab, 0x0d, 0x09, 0x00, 0x5d, 0x66, 0x0e, 0xd3, 0x4d, 0xe6, 0x95, 0x5a, 0x94, 0x61, 0xc4, 0x13, 0x8d, 0x11, 0x31, 0x22, 0x5f, 0x33, 0x86, 0x4e, 0xd4, 0x8d, 0xa0, 0x6f, 0xa4, 0x5a, 0x91, 0x3b, 0x46, 0xcf, 0x42, 0x55, 0x77, 0x42, 0xe3, 0x50, 0x85, 0xe6, 489 }; 490 static const u8 ecccdh_SECP192R1_16_test_vector_our_pub_key[] = { 491 0xd9, 0xc0, 0x98, 0xd4, 0x21, 0xd7, 0x41, 0xf6, 0xfa, 0xab, 0x11, 0x6f, 0x3e, 0x47, 0x31, 0xd2, 0x8c, 0x55, 0x58, 0xe1, 0x9f, 0xe1, 0x12, 0xa1, 0x38, 0xd4, 0xdc, 0x48, 0xcc, 0xdb, 0x1d, 0x3e, 0xd8, 0xd3, 0x1f, 0xd0, 0x67, 0x84, 0xa4, 0xf8, 0x7a, 0x68, 0xae, 0xc1, 0xcb, 0xd5, 0xb0, 0x8f, 492 }; 493 static const u8 ecccdh_SECP192R1_16_test_vector_shared_secret[] = { 494 0x64, 0xa5, 0xc2, 0x46, 0x59, 0x9d, 0x3e, 0x81, 0x77, 0xa2, 0x40, 0x2a, 0x11, 0x10, 0xeb, 0x81, 0xe6, 0xc4, 0x56, 0xab, 0x4e, 0xdb, 0x51, 0x27, 495 }; 496 static const ecdh_test_case ecccdh_SECP192R1_16_test_case = { 497 .name = "ECCCDH/SECP192R1 16", 498 .ecdh_type = ECCCDH, 499 .ec_str_p = &secp192r1_str_params, 500 .our_priv_key = ecccdh_SECP192R1_16_test_vector_our_priv_key, 501 .our_priv_key_len = sizeof(ecccdh_SECP192R1_16_test_vector_our_priv_key), 502 .peer_pub_key = ecccdh_SECP192R1_16_test_vector_peer_pub_key, 503 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_16_test_vector_peer_pub_key), 504 .exp_our_pub_key = ecccdh_SECP192R1_16_test_vector_our_pub_key, 505 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_16_test_vector_our_pub_key), 506 .exp_shared_secret = ecccdh_SECP192R1_16_test_vector_shared_secret, 507 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_16_test_vector_shared_secret), 508 }; 509 #endif /* WITH_CURVE_SECP192R1 */ 510 511 #ifdef WITH_CURVE_SECP192R1 512 #define ECCCDH_SECP192R1_SELF_TEST_17 513 /*** Tests for ECCCDH/SECP192R1 ***/ 514 static const u8 ecccdh_SECP192R1_17_test_vector_our_priv_key[] = { 515 0xd5, 0xbc, 0xf2, 0x53, 0x4d, 0xaf, 0xc3, 0xd9, 0x99, 0x64, 0xc7, 0xbd, 0x63, 0xab, 0x7b, 0xd1, 0x59, 0x99, 0xfe, 0x56, 0xdd, 0x96, 0x9c, 0x42, 516 }; 517 static const u8 ecccdh_SECP192R1_17_test_vector_peer_pub_key[] = { 518 0x36, 0x15, 0x73, 0x15, 0xbe, 0xe7, 0xaf, 0xed, 0xde, 0xd5, 0x8c, 0x4e, 0x8b, 0xa1, 0x4d, 0x34, 0x21, 0xc4, 0x01, 0xe5, 0x11, 0x35, 0xbc, 0xc9, 0x37, 0xc2, 0x97, 0xca, 0x70, 0x3f, 0x77, 0xc5, 0x2b, 0xb0, 0x62, 0xd8, 0xce, 0x97, 0x1d, 0xb8, 0x40, 0x97, 0xba, 0x0c, 0x75, 0x3a, 0x41, 0x8f, 519 }; 520 static const u8 ecccdh_SECP192R1_17_test_vector_our_pub_key[] = { 521 0xfd, 0xa1, 0xd5, 0xd2, 0x8d, 0x6f, 0xe0, 0xe7, 0x90, 0x9d, 0x6a, 0x8b, 0xaf, 0xa7, 0x82, 0x4d, 0xb5, 0x57, 0x2a, 0xb9, 0x2f, 0xfe, 0x7d, 0xe6, 0x13, 0x4a, 0x29, 0x7c, 0x1d, 0x9c, 0x8b, 0xba, 0xb2, 0x49, 0xab, 0xac, 0xd9, 0x51, 0xed, 0x11, 0xe5, 0xa9, 0x9f, 0x92, 0xe7, 0x99, 0x15, 0x72, 522 }; 523 static const u8 ecccdh_SECP192R1_17_test_vector_shared_secret[] = { 524 0x01, 0x7b, 0x8c, 0xa5, 0x3c, 0x82, 0xfa, 0xb1, 0x63, 0xda, 0x2a, 0xb7, 0x83, 0x96, 0x6a, 0x39, 0xe0, 0x61, 0xb3, 0x2c, 0x8c, 0xfa, 0x33, 0x4d, 525 }; 526 static const ecdh_test_case ecccdh_SECP192R1_17_test_case = { 527 .name = "ECCCDH/SECP192R1 17", 528 .ecdh_type = ECCCDH, 529 .ec_str_p = &secp192r1_str_params, 530 .our_priv_key = ecccdh_SECP192R1_17_test_vector_our_priv_key, 531 .our_priv_key_len = sizeof(ecccdh_SECP192R1_17_test_vector_our_priv_key), 532 .peer_pub_key = ecccdh_SECP192R1_17_test_vector_peer_pub_key, 533 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_17_test_vector_peer_pub_key), 534 .exp_our_pub_key = ecccdh_SECP192R1_17_test_vector_our_pub_key, 535 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_17_test_vector_our_pub_key), 536 .exp_shared_secret = ecccdh_SECP192R1_17_test_vector_shared_secret, 537 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_17_test_vector_shared_secret), 538 }; 539 #endif /* WITH_CURVE_SECP192R1 */ 540 541 #ifdef WITH_CURVE_SECP192R1 542 #define ECCCDH_SECP192R1_SELF_TEST_18 543 /*** Tests for ECCCDH/SECP192R1 ***/ 544 static const u8 ecccdh_SECP192R1_18_test_vector_our_priv_key[] = { 545 0x43, 0xd4, 0xb9, 0xdf, 0x10, 0x53, 0xbe, 0x5b, 0x42, 0x68, 0x10, 0x4c, 0x02, 0x24, 0x4d, 0x3b, 0xf9, 0x59, 0x4b, 0x01, 0x0b, 0x46, 0xa8, 0xb2, 546 }; 547 static const u8 ecccdh_SECP192R1_18_test_vector_peer_pub_key[] = { 548 0x98, 0x46, 0x4d, 0x47, 0xf0, 0x25, 0x6f, 0x82, 0x92, 0xe0, 0x27, 0xe8, 0xc9, 0x25, 0x82, 0xea, 0x77, 0xcf, 0x90, 0x51, 0xf5, 0xce, 0x8e, 0x5d, 0x44, 0x95, 0x52, 0xef, 0x75, 0x78, 0xbe, 0x96, 0x23, 0x6f, 0xe5, 0xed, 0x9d, 0x06, 0x43, 0xc0, 0xbb, 0x6c, 0x5a, 0x91, 0x34, 0xb0, 0x10, 0x8d, 549 }; 550 static const u8 ecccdh_SECP192R1_18_test_vector_our_pub_key[] = { 551 0xc3, 0x02, 0x0b, 0x70, 0x91, 0x46, 0x3d, 0x78, 0x8f, 0x1f, 0x1d, 0x76, 0xf7, 0xcf, 0xee, 0xc8, 0x2e, 0xcd, 0xb3, 0xb7, 0xd9, 0x9c, 0x34, 0x5c, 0x9a, 0x77, 0x10, 0xd5, 0x17, 0x95, 0x91, 0xd8, 0xf3, 0xdf, 0x0a, 0xa1, 0x22, 0x30, 0x17, 0x68, 0xae, 0x7d, 0xb7, 0xee, 0xe2, 0xd7, 0xf5, 0x83, 552 }; 553 static const u8 ecccdh_SECP192R1_18_test_vector_shared_secret[] = { 554 0x34, 0x0e, 0xf3, 0xdb, 0x3d, 0xbe, 0xbd, 0xd9, 0x1c, 0x62, 0xc3, 0xd4, 0xe1, 0xa3, 0xda, 0x2c, 0x7c, 0x52, 0xa3, 0x33, 0x8b, 0x86, 0x52, 0x59, 555 }; 556 static const ecdh_test_case ecccdh_SECP192R1_18_test_case = { 557 .name = "ECCCDH/SECP192R1 18", 558 .ecdh_type = ECCCDH, 559 .ec_str_p = &secp192r1_str_params, 560 .our_priv_key = ecccdh_SECP192R1_18_test_vector_our_priv_key, 561 .our_priv_key_len = sizeof(ecccdh_SECP192R1_18_test_vector_our_priv_key), 562 .peer_pub_key = ecccdh_SECP192R1_18_test_vector_peer_pub_key, 563 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_18_test_vector_peer_pub_key), 564 .exp_our_pub_key = ecccdh_SECP192R1_18_test_vector_our_pub_key, 565 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_18_test_vector_our_pub_key), 566 .exp_shared_secret = ecccdh_SECP192R1_18_test_vector_shared_secret, 567 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_18_test_vector_shared_secret), 568 }; 569 #endif /* WITH_CURVE_SECP192R1 */ 570 571 #ifdef WITH_CURVE_SECP192R1 572 #define ECCCDH_SECP192R1_SELF_TEST_19 573 /*** Tests for ECCCDH/SECP192R1 ***/ 574 static const u8 ecccdh_SECP192R1_19_test_vector_our_priv_key[] = { 575 0x94, 0xca, 0xc2, 0xc2, 0xca, 0x71, 0x47, 0x46, 0x40, 0x16, 0x70, 0xd9, 0x4e, 0xdb, 0xf3, 0xf6, 0x77, 0x86, 0x7b, 0x5a, 0x03, 0xbe, 0xe7, 0xad, 576 }; 577 static const u8 ecccdh_SECP192R1_19_test_vector_peer_pub_key[] = { 578 0x56, 0x3e, 0xb6, 0x6c, 0x33, 0x4c, 0xf6, 0xf1, 0x23, 0xbf, 0x04, 0xc7, 0x80, 0x3b, 0x48, 0xa3, 0x11, 0x02, 0x14, 0x23, 0x7e, 0x98, 0x3b, 0xf5, 0x0f, 0x35, 0x11, 0x04, 0x81, 0x91, 0x99, 0xef, 0x07, 0xc9, 0xa6, 0x05, 0x1d, 0x20, 0x75, 0x8f, 0x3a, 0xf7, 0x90, 0x27, 0xea, 0x66, 0xa5, 0x3f, 579 }; 580 static const u8 ecccdh_SECP192R1_19_test_vector_our_pub_key[] = { 581 0xb1, 0x85, 0x54, 0xa2, 0xe7, 0x43, 0xef, 0x0a, 0xa2, 0xf0, 0x40, 0x98, 0x7c, 0x4c, 0x45, 0x10, 0x04, 0xe0, 0x96, 0xdf, 0x3d, 0x80, 0xdd, 0xae, 0x6e, 0x3e, 0x2c, 0x61, 0x8f, 0x89, 0x6e, 0x36, 0xba, 0x62, 0x00, 0x77, 0x68, 0x4b, 0x70, 0xa0, 0x5f, 0xfb, 0x79, 0xbf, 0x5e, 0x6c, 0x76, 0x40, 582 }; 583 static const u8 ecccdh_SECP192R1_19_test_vector_shared_secret[] = { 584 0x21, 0x62, 0x14, 0x49, 0x21, 0xdf, 0x51, 0x03, 0xd0, 0xe6, 0xa6, 0x50, 0xfb, 0x13, 0xfd, 0x24, 0x6f, 0x47, 0x38, 0xd0, 0x89, 0x6c, 0xe9, 0x2f, 585 }; 586 static const ecdh_test_case ecccdh_SECP192R1_19_test_case = { 587 .name = "ECCCDH/SECP192R1 19", 588 .ecdh_type = ECCCDH, 589 .ec_str_p = &secp192r1_str_params, 590 .our_priv_key = ecccdh_SECP192R1_19_test_vector_our_priv_key, 591 .our_priv_key_len = sizeof(ecccdh_SECP192R1_19_test_vector_our_priv_key), 592 .peer_pub_key = ecccdh_SECP192R1_19_test_vector_peer_pub_key, 593 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_19_test_vector_peer_pub_key), 594 .exp_our_pub_key = ecccdh_SECP192R1_19_test_vector_our_pub_key, 595 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_19_test_vector_our_pub_key), 596 .exp_shared_secret = ecccdh_SECP192R1_19_test_vector_shared_secret, 597 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_19_test_vector_shared_secret), 598 }; 599 #endif /* WITH_CURVE_SECP192R1 */ 600 601 #ifdef WITH_CURVE_SECP192R1 602 #define ECCCDH_SECP192R1_SELF_TEST_20 603 /*** Tests for ECCCDH/SECP192R1 ***/ 604 static const u8 ecccdh_SECP192R1_20_test_vector_our_priv_key[] = { 605 0x2a, 0x3a, 0x9e, 0x33, 0xc8, 0xcc, 0x31, 0x07, 0xa9, 0xf9, 0x26, 0x5c, 0x3b, 0xde, 0xa1, 0x20, 0x65, 0x70, 0xe8, 0x6f, 0x92, 0xac, 0x70, 0x14, 606 }; 607 static const u8 ecccdh_SECP192R1_20_test_vector_peer_pub_key[] = { 608 0x86, 0x82, 0x8c, 0x4a, 0xc9, 0x2b, 0x55, 0x07, 0x61, 0x8a, 0xec, 0x78, 0x73, 0xa1, 0xd4, 0xfc, 0x65, 0x43, 0xc5, 0xbe, 0x33, 0xcf, 0x30, 0x78, 0xb2, 0x2c, 0xa7, 0x24, 0x37, 0x54, 0x5e, 0x10, 0xd6, 0xd4, 0xf0, 0x52, 0x42, 0x2e, 0xb8, 0x98, 0xb7, 0x37, 0xa4, 0xb8, 0x54, 0x3e, 0xe5, 0x50, 609 }; 610 static const u8 ecccdh_SECP192R1_20_test_vector_our_pub_key[] = { 611 0xa7, 0xba, 0x38, 0xbe, 0x1b, 0xc6, 0x69, 0xdd, 0x23, 0xcc, 0xfc, 0xee, 0x06, 0x45, 0xb1, 0xf0, 0xdb, 0x8c, 0xf9, 0x42, 0xde, 0xaf, 0xae, 0xb6, 0xb8, 0x2d, 0xb7, 0x9d, 0x80, 0xcd, 0x0e, 0x37, 0xf2, 0x8d, 0x41, 0x63, 0xad, 0xc3, 0x89, 0xde, 0xe8, 0xfc, 0x77, 0x97, 0xb5, 0xc9, 0x83, 0x1b, 612 }; 613 static const u8 ecccdh_SECP192R1_20_test_vector_shared_secret[] = { 614 0x4c, 0x69, 0xe7, 0xfe, 0xed, 0x4b, 0x11, 0x15, 0x9a, 0xdf, 0xc1, 0x6a, 0x60, 0x47, 0xa9, 0x25, 0x72, 0xea, 0x44, 0xe0, 0x74, 0x0b, 0x23, 0xaf, 615 }; 616 static const ecdh_test_case ecccdh_SECP192R1_20_test_case = { 617 .name = "ECCCDH/SECP192R1 20", 618 .ecdh_type = ECCCDH, 619 .ec_str_p = &secp192r1_str_params, 620 .our_priv_key = ecccdh_SECP192R1_20_test_vector_our_priv_key, 621 .our_priv_key_len = sizeof(ecccdh_SECP192R1_20_test_vector_our_priv_key), 622 .peer_pub_key = ecccdh_SECP192R1_20_test_vector_peer_pub_key, 623 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_20_test_vector_peer_pub_key), 624 .exp_our_pub_key = ecccdh_SECP192R1_20_test_vector_our_pub_key, 625 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_20_test_vector_our_pub_key), 626 .exp_shared_secret = ecccdh_SECP192R1_20_test_vector_shared_secret, 627 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_20_test_vector_shared_secret), 628 }; 629 #endif /* WITH_CURVE_SECP192R1 */ 630 631 #ifdef WITH_CURVE_SECP192R1 632 #define ECCCDH_SECP192R1_SELF_TEST_21 633 /*** Tests for ECCCDH/SECP192R1 ***/ 634 static const u8 ecccdh_SECP192R1_21_test_vector_our_priv_key[] = { 635 0x4a, 0x6b, 0x78, 0xa9, 0x8a, 0xc9, 0x8f, 0xa8, 0xe9, 0x9a, 0x8e, 0xce, 0x08, 0xec, 0x02, 0x51, 0x12, 0x5f, 0x85, 0xc6, 0xfd, 0x0e, 0x28, 0x9b, 636 }; 637 static const u8 ecccdh_SECP192R1_21_test_vector_peer_pub_key[] = { 638 0x67, 0x00, 0xa1, 0x02, 0x43, 0x77, 0x81, 0xa9, 0x58, 0x1d, 0xa2, 0xbc, 0x25, 0xce, 0xd5, 0xab, 0xf4, 0x19, 0xda, 0x91, 0xd3, 0xc8, 0x03, 0xdf, 0x71, 0x39, 0x6c, 0x9c, 0xf0, 0x8b, 0xcd, 0x91, 0x85, 0x4e, 0x3e, 0x6e, 0x42, 0xd8, 0xc6, 0x57, 0xce, 0x0f, 0x27, 0xab, 0x77, 0xa9, 0xdc, 0x4b, 639 }; 640 static const u8 ecccdh_SECP192R1_21_test_vector_our_pub_key[] = { 641 0xe7, 0x69, 0xdb, 0xbc, 0xd5, 0xce, 0x2d, 0x83, 0x51, 0x4b, 0x76, 0x8d, 0x3d, 0x2d, 0x5a, 0xa0, 0xbc, 0xd8, 0xf6, 0x6a, 0xf1, 0x5f, 0x55, 0x00, 0x2f, 0xc6, 0xd0, 0xb0, 0x39, 0xe0, 0xf2, 0x8f, 0x74, 0xfb, 0xef, 0xfe, 0x9e, 0x88, 0x3d, 0x4d, 0xd7, 0x22, 0x96, 0xe4, 0xe9, 0x5c, 0xae, 0x71, 642 }; 643 static const u8 ecccdh_SECP192R1_21_test_vector_shared_secret[] = { 644 0x46, 0x07, 0x2a, 0xce, 0xfd, 0x67, 0xbf, 0xf5, 0x0d, 0xe3, 0x55, 0xca, 0x7a, 0x31, 0xfa, 0x6b, 0xe5, 0x9f, 0x26, 0xe4, 0x67, 0x58, 0x72, 0x59, 645 }; 646 static const ecdh_test_case ecccdh_SECP192R1_21_test_case = { 647 .name = "ECCCDH/SECP192R1 21", 648 .ecdh_type = ECCCDH, 649 .ec_str_p = &secp192r1_str_params, 650 .our_priv_key = ecccdh_SECP192R1_21_test_vector_our_priv_key, 651 .our_priv_key_len = sizeof(ecccdh_SECP192R1_21_test_vector_our_priv_key), 652 .peer_pub_key = ecccdh_SECP192R1_21_test_vector_peer_pub_key, 653 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_21_test_vector_peer_pub_key), 654 .exp_our_pub_key = ecccdh_SECP192R1_21_test_vector_our_pub_key, 655 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_21_test_vector_our_pub_key), 656 .exp_shared_secret = ecccdh_SECP192R1_21_test_vector_shared_secret, 657 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_21_test_vector_shared_secret), 658 }; 659 #endif /* WITH_CURVE_SECP192R1 */ 660 661 #ifdef WITH_CURVE_SECP192R1 662 #define ECCCDH_SECP192R1_SELF_TEST_22 663 /*** Tests for ECCCDH/SECP192R1 ***/ 664 static const u8 ecccdh_SECP192R1_22_test_vector_our_priv_key[] = { 665 0xc5, 0xa6, 0x49, 0x1d, 0x78, 0x84, 0x4d, 0x66, 0x17, 0xef, 0x33, 0xbe, 0x6b, 0x8b, 0xd5, 0x4d, 0xa2, 0x21, 0x45, 0x08, 0x85, 0xd5, 0x95, 0x0f, 666 }; 667 static const u8 ecccdh_SECP192R1_22_test_vector_peer_pub_key[] = { 668 0xa8, 0x2f, 0x35, 0x4c, 0xf9, 0x7b, 0xee, 0x5d, 0x22, 0xdc, 0x6c, 0x07, 0x9f, 0x29, 0x02, 0xea, 0xd4, 0x4d, 0x96, 0xa8, 0xf6, 0x14, 0xf1, 0x78, 0xa6, 0x54, 0xa9, 0xaa, 0x8a, 0x1a, 0x08, 0x02, 0xf2, 0xce, 0x0e, 0xe8, 0xa0, 0xf4, 0xeb, 0xe9, 0x6d, 0xee, 0x1b, 0x37, 0x46, 0x4b, 0x1f, 0xf2, 669 }; 670 static const u8 ecccdh_SECP192R1_22_test_vector_our_pub_key[] = { 671 0xdb, 0x1b, 0x24, 0xf7, 0x46, 0x6b, 0xc1, 0x54, 0xe9, 0xd7, 0xd2, 0xc3, 0xca, 0x52, 0xdc, 0xfe, 0x0b, 0xfc, 0x95, 0x63, 0xc5, 0xfd, 0xb6, 0xf3, 0x1c, 0x74, 0xfb, 0xbf, 0x5b, 0xd9, 0x99, 0x21, 0xf1, 0xa9, 0xa7, 0x44, 0xf8, 0xe1, 0xcf, 0x77, 0x0b, 0xd6, 0xa7, 0x6a, 0x77, 0x2b, 0x30, 0x03, 672 }; 673 static const u8 ecccdh_SECP192R1_22_test_vector_shared_secret[] = { 674 0xec, 0x55, 0x80, 0xea, 0xbc, 0xa9, 0xf3, 0x38, 0x9d, 0x2b, 0x42, 0x7d, 0xdf, 0x6e, 0x49, 0xe2, 0x6d, 0x62, 0x9a, 0xfd, 0x03, 0xfa, 0x76, 0x6e, 675 }; 676 static const ecdh_test_case ecccdh_SECP192R1_22_test_case = { 677 .name = "ECCCDH/SECP192R1 22", 678 .ecdh_type = ECCCDH, 679 .ec_str_p = &secp192r1_str_params, 680 .our_priv_key = ecccdh_SECP192R1_22_test_vector_our_priv_key, 681 .our_priv_key_len = sizeof(ecccdh_SECP192R1_22_test_vector_our_priv_key), 682 .peer_pub_key = ecccdh_SECP192R1_22_test_vector_peer_pub_key, 683 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_22_test_vector_peer_pub_key), 684 .exp_our_pub_key = ecccdh_SECP192R1_22_test_vector_our_pub_key, 685 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_22_test_vector_our_pub_key), 686 .exp_shared_secret = ecccdh_SECP192R1_22_test_vector_shared_secret, 687 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_22_test_vector_shared_secret), 688 }; 689 #endif /* WITH_CURVE_SECP192R1 */ 690 691 #ifdef WITH_CURVE_SECP192R1 692 #define ECCCDH_SECP192R1_SELF_TEST_23 693 /*** Tests for ECCCDH/SECP192R1 ***/ 694 static const u8 ecccdh_SECP192R1_23_test_vector_our_priv_key[] = { 695 0x2b, 0xa2, 0x70, 0x3c, 0x5e, 0x23, 0xf6, 0x46, 0x3c, 0x5b, 0x88, 0xdc, 0x37, 0x29, 0x2f, 0xab, 0xd3, 0x39, 0x9b, 0x5e, 0x1f, 0xb6, 0x7c, 0x05, 696 }; 697 static const u8 ecccdh_SECP192R1_23_test_vector_peer_pub_key[] = { 698 0x3c, 0xec, 0x21, 0xb2, 0x86, 0x68, 0xa1, 0x2a, 0x2c, 0xf7, 0x8e, 0x1a, 0x8e, 0x55, 0xd0, 0xef, 0xe0, 0x65, 0x15, 0x2f, 0xff, 0xc3, 0x47, 0x18, 0x10, 0x29, 0x55, 0x7b, 0xeb, 0xa4, 0xff, 0x19, 0x92, 0xbd, 0x21, 0xc2, 0x3c, 0xb4, 0x82, 0x5f, 0x6d, 0xae, 0x70, 0xe3, 0x31, 0x8f, 0xd1, 0xca, 699 }; 700 static const u8 ecccdh_SECP192R1_23_test_vector_our_pub_key[] = { 701 0x75, 0x43, 0x14, 0x89, 0x06, 0xce, 0xf9, 0xb3, 0x7a, 0x71, 0xa7, 0xc0, 0x83, 0x63, 0xcd, 0xd3, 0xbb, 0xa5, 0x01, 0x42, 0xd6, 0x52, 0x41, 0xaa, 0x8b, 0x3a, 0x69, 0x73, 0xde, 0x8d, 0xc2, 0x71, 0xe2, 0x7c, 0x1e, 0xad, 0x1e, 0x96, 0x2f, 0xda, 0xae, 0x37, 0x10, 0xc7, 0x24, 0xda, 0xac, 0x38, 702 }; 703 static const u8 ecccdh_SECP192R1_23_test_vector_shared_secret[] = { 704 0x7f, 0x39, 0x29, 0xdd, 0x3c, 0xbf, 0x76, 0x73, 0xbc, 0x30, 0xd8, 0x59, 0xd9, 0x0b, 0x88, 0x03, 0x07, 0x47, 0x5f, 0x80, 0x06, 0x60, 0xea, 0x32, 705 }; 706 static const ecdh_test_case ecccdh_SECP192R1_23_test_case = { 707 .name = "ECCCDH/SECP192R1 23", 708 .ecdh_type = ECCCDH, 709 .ec_str_p = &secp192r1_str_params, 710 .our_priv_key = ecccdh_SECP192R1_23_test_vector_our_priv_key, 711 .our_priv_key_len = sizeof(ecccdh_SECP192R1_23_test_vector_our_priv_key), 712 .peer_pub_key = ecccdh_SECP192R1_23_test_vector_peer_pub_key, 713 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_23_test_vector_peer_pub_key), 714 .exp_our_pub_key = ecccdh_SECP192R1_23_test_vector_our_pub_key, 715 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_23_test_vector_our_pub_key), 716 .exp_shared_secret = ecccdh_SECP192R1_23_test_vector_shared_secret, 717 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_23_test_vector_shared_secret), 718 }; 719 #endif /* WITH_CURVE_SECP192R1 */ 720 721 #ifdef WITH_CURVE_SECP192R1 722 #define ECCCDH_SECP192R1_SELF_TEST_24 723 /*** Tests for ECCCDH/SECP192R1 ***/ 724 static const u8 ecccdh_SECP192R1_24_test_vector_our_priv_key[] = { 725 0x83, 0x61, 0x18, 0xc6, 0x24, 0x8f, 0x88, 0x2e, 0x91, 0x47, 0x97, 0x6f, 0x76, 0x48, 0x26, 0xc1, 0xa2, 0x87, 0x55, 0xa6, 0x10, 0x29, 0x77, 0xd5, 726 }; 727 static const u8 ecccdh_SECP192R1_24_test_vector_peer_pub_key[] = { 728 0x70, 0x82, 0x64, 0x47, 0x15, 0xb8, 0xb7, 0x31, 0xf8, 0x22, 0x8b, 0x51, 0x18, 0xe7, 0x27, 0x0d, 0x34, 0xd1, 0x81, 0xf3, 0x61, 0xa2, 0x21, 0xfc, 0x46, 0x46, 0x49, 0xd6, 0xc8, 0x8c, 0xa8, 0x96, 0x14, 0x48, 0x8a, 0x1c, 0xc7, 0xb8, 0x44, 0x2b, 0xb4, 0x2f, 0x9f, 0xb3, 0x02, 0x0a, 0x3d, 0x76, 729 }; 730 static const u8 ecccdh_SECP192R1_24_test_vector_our_pub_key[] = { 731 0xfc, 0xd3, 0x45, 0xa9, 0x76, 0xc7, 0x20, 0xca, 0xaa, 0x97, 0xde, 0x66, 0x97, 0x22, 0x68, 0x25, 0x61, 0x5e, 0x12, 0x87, 0xa9, 0xef, 0xf6, 0x7e, 0x58, 0xea, 0x42, 0xed, 0xbe, 0xea, 0xfc, 0xa9, 0xff, 0x44, 0xcf, 0xd7, 0xf2, 0x9a, 0xbd, 0x2c, 0xbd, 0xe7, 0x62, 0x6d, 0x79, 0xe4, 0x22, 0xc9, 732 }; 733 static const u8 ecccdh_SECP192R1_24_test_vector_shared_secret[] = { 734 0x72, 0xe8, 0x8f, 0x3e, 0xa6, 0x7d, 0x46, 0xd4, 0x6d, 0xbf, 0x83, 0x92, 0x6e, 0x7e, 0x2a, 0x6b, 0x85, 0xb5, 0x45, 0x36, 0x74, 0x1e, 0x6d, 0x2c, 735 }; 736 static const ecdh_test_case ecccdh_SECP192R1_24_test_case = { 737 .name = "ECCCDH/SECP192R1 24", 738 .ecdh_type = ECCCDH, 739 .ec_str_p = &secp192r1_str_params, 740 .our_priv_key = ecccdh_SECP192R1_24_test_vector_our_priv_key, 741 .our_priv_key_len = sizeof(ecccdh_SECP192R1_24_test_vector_our_priv_key), 742 .peer_pub_key = ecccdh_SECP192R1_24_test_vector_peer_pub_key, 743 .peer_pub_key_len = sizeof(ecccdh_SECP192R1_24_test_vector_peer_pub_key), 744 .exp_our_pub_key = ecccdh_SECP192R1_24_test_vector_our_pub_key, 745 .exp_our_pub_key_len = sizeof(ecccdh_SECP192R1_24_test_vector_our_pub_key), 746 .exp_shared_secret = ecccdh_SECP192R1_24_test_vector_shared_secret, 747 .exp_shared_secret_len = sizeof(ecccdh_SECP192R1_24_test_vector_shared_secret), 748 }; 749 #endif /* WITH_CURVE_SECP192R1 */ 750 751 #ifdef WITH_CURVE_SECP224R1 752 #define ECCCDH_SECP224R1_SELF_TEST_0 753 /*** Tests for ECCCDH/SECP224R1 ***/ 754 static const u8 ecccdh_SECP224R1_0_test_vector_our_priv_key[] = { 755 0x83, 0x46, 0xa6, 0x0f, 0xc6, 0xf2, 0x93, 0xca, 0x5a, 0x0d, 0x2a, 0xf6, 0x8b, 0xa7, 0x1d, 0x1d, 0xd3, 0x89, 0xe5, 0xe4, 0x08, 0x37, 0x94, 0x2d, 0xf3, 0xe4, 0x3c, 0xbd, 756 }; 757 static const u8 ecccdh_SECP224R1_0_test_vector_peer_pub_key[] = { 758 0xaf, 0x33, 0xcd, 0x06, 0x29, 0xbc, 0x7e, 0x99, 0x63, 0x20, 0xa3, 0xf4, 0x03, 0x68, 0xf7, 0x4d, 0xe8, 0x70, 0x4f, 0xa3, 0x7b, 0x8f, 0xab, 0x69, 0xab, 0xaa, 0xe2, 0x80, 0x88, 0x20, 0x92, 0xcc, 0xbb, 0xa7, 0x93, 0x0f, 0x41, 0x9a, 0x8a, 0x4f, 0x9b, 0xb1, 0x69, 0x78, 0xbb, 0xc3, 0x83, 0x87, 0x29, 0x99, 0x25, 0x59, 0xa6, 0xf2, 0xe2, 0xd7, 759 }; 760 static const u8 ecccdh_SECP224R1_0_test_vector_our_pub_key[] = { 761 0x8d, 0xe2, 0xe2, 0x6a, 0xdf, 0x72, 0xc5, 0x82, 0xd6, 0x56, 0x8e, 0xf6, 0x38, 0xc4, 0xfd, 0x59, 0xb1, 0x8d, 0xa1, 0x71, 0xbd, 0xf5, 0x01, 0xf1, 0xd9, 0x29, 0xe0, 0x48, 0x4a, 0x68, 0xa1, 0xc2, 0xb0, 0xfb, 0x22, 0x93, 0x0d, 0x12, 0x05, 0x55, 0xc1, 0xec, 0xe5, 0x0e, 0xa9, 0x8d, 0xea, 0x84, 0x07, 0xf7, 0x1b, 0xe3, 0x6e, 0xfa, 0xc0, 0xde, 762 }; 763 static const u8 ecccdh_SECP224R1_0_test_vector_shared_secret[] = { 764 0x7d, 0x96, 0xf9, 0xa3, 0xbd, 0x3c, 0x05, 0xcf, 0x5c, 0xc3, 0x7f, 0xeb, 0x8b, 0x9d, 0x52, 0x09, 0xd5, 0xc2, 0x59, 0x74, 0x64, 0xde, 0xc3, 0xe9, 0x98, 0x37, 0x43, 0xe8, 765 }; 766 static const ecdh_test_case ecccdh_SECP224R1_0_test_case = { 767 .name = "ECCCDH/SECP224R1 0", 768 .ecdh_type = ECCCDH, 769 .ec_str_p = &secp224r1_str_params, 770 .our_priv_key = ecccdh_SECP224R1_0_test_vector_our_priv_key, 771 .our_priv_key_len = sizeof(ecccdh_SECP224R1_0_test_vector_our_priv_key), 772 .peer_pub_key = ecccdh_SECP224R1_0_test_vector_peer_pub_key, 773 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_0_test_vector_peer_pub_key), 774 .exp_our_pub_key = ecccdh_SECP224R1_0_test_vector_our_pub_key, 775 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_0_test_vector_our_pub_key), 776 .exp_shared_secret = ecccdh_SECP224R1_0_test_vector_shared_secret, 777 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_0_test_vector_shared_secret), 778 }; 779 #endif /* WITH_CURVE_SECP224R1 */ 780 781 #ifdef WITH_CURVE_SECP224R1 782 #define ECCCDH_SECP224R1_SELF_TEST_1 783 /*** Tests for ECCCDH/SECP224R1 ***/ 784 static const u8 ecccdh_SECP224R1_1_test_vector_our_priv_key[] = { 785 0x04, 0x3c, 0xb2, 0x16, 0xf4, 0xb7, 0x2c, 0xdf, 0x76, 0x29, 0xd6, 0x37, 0x20, 0xa5, 0x4a, 0xee, 0x0c, 0x99, 0xeb, 0x32, 0xd7, 0x44, 0x77, 0xda, 0xc0, 0xc2, 0xf7, 0x3d, 786 }; 787 static const u8 ecccdh_SECP224R1_1_test_vector_peer_pub_key[] = { 788 0x13, 0xbf, 0xcd, 0x4f, 0x8e, 0x94, 0x42, 0x39, 0x3c, 0xab, 0x8f, 0xb4, 0x6b, 0x9f, 0x05, 0x66, 0xc2, 0x26, 0xb2, 0x2b, 0x37, 0x07, 0x69, 0x76, 0xf0, 0x61, 0x7a, 0x46, 0xee, 0xb2, 0x42, 0x75, 0x29, 0xb2, 0x88, 0xc6, 0x3c, 0x2f, 0x89, 0x63, 0xc1, 0xe4, 0x73, 0xdf, 0x2f, 0xca, 0x6c, 0xaa, 0x90, 0xd5, 0x2e, 0x2f, 0x8d, 0xb5, 0x6d, 0xd4, 789 }; 790 static const u8 ecccdh_SECP224R1_1_test_vector_our_pub_key[] = { 791 0x2f, 0x90, 0xf5, 0xc8, 0xea, 0xc9, 0xc7, 0xde, 0xcd, 0xbb, 0x97, 0xb6, 0xc2, 0xf7, 0x15, 0xab, 0x72, 0x5e, 0x4f, 0xe4, 0x0f, 0xe6, 0xd7, 0x46, 0xef, 0xbf, 0x4e, 0x1b, 0x66, 0x89, 0x73, 0x51, 0x45, 0x4f, 0x92, 0x7a, 0x30, 0x9b, 0x26, 0x9c, 0x5a, 0x6d, 0x31, 0x33, 0x8b, 0xe4, 0xc1, 0x9a, 0x5a, 0xcf, 0xc3, 0x2c, 0xf6, 0x56, 0xf4, 0x5c, 792 }; 793 static const u8 ecccdh_SECP224R1_1_test_vector_shared_secret[] = { 794 0xee, 0x93, 0xce, 0x06, 0xb8, 0x9f, 0xf7, 0x20, 0x09, 0xe8, 0x58, 0xc6, 0x8e, 0xb7, 0x08, 0xe7, 0xbc, 0x79, 0xee, 0x03, 0x00, 0xf7, 0x3b, 0xed, 0x69, 0xbb, 0xca, 0x09, 795 }; 796 static const ecdh_test_case ecccdh_SECP224R1_1_test_case = { 797 .name = "ECCCDH/SECP224R1 1", 798 .ecdh_type = ECCCDH, 799 .ec_str_p = &secp224r1_str_params, 800 .our_priv_key = ecccdh_SECP224R1_1_test_vector_our_priv_key, 801 .our_priv_key_len = sizeof(ecccdh_SECP224R1_1_test_vector_our_priv_key), 802 .peer_pub_key = ecccdh_SECP224R1_1_test_vector_peer_pub_key, 803 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_1_test_vector_peer_pub_key), 804 .exp_our_pub_key = ecccdh_SECP224R1_1_test_vector_our_pub_key, 805 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_1_test_vector_our_pub_key), 806 .exp_shared_secret = ecccdh_SECP224R1_1_test_vector_shared_secret, 807 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_1_test_vector_shared_secret), 808 }; 809 #endif /* WITH_CURVE_SECP224R1 */ 810 811 #ifdef WITH_CURVE_SECP224R1 812 #define ECCCDH_SECP224R1_SELF_TEST_2 813 /*** Tests for ECCCDH/SECP224R1 ***/ 814 static const u8 ecccdh_SECP224R1_2_test_vector_our_priv_key[] = { 815 0x5a, 0xd0, 0xdd, 0x6d, 0xba, 0xbb, 0x4f, 0x3c, 0x2e, 0xa5, 0xfe, 0x32, 0xe5, 0x61, 0xb2, 0xca, 0x55, 0x08, 0x14, 0x86, 0xdf, 0x2c, 0x7c, 0x15, 0xc9, 0x62, 0x2b, 0x08, 816 }; 817 static const u8 ecccdh_SECP224R1_2_test_vector_peer_pub_key[] = { 818 0x75, 0x6d, 0xd8, 0x06, 0xb9, 0xd9, 0xc3, 0x4d, 0x89, 0x96, 0x91, 0xec, 0xb4, 0x5b, 0x77, 0x1a, 0xf4, 0x68, 0xec, 0x00, 0x44, 0x86, 0xa0, 0xfd, 0xd2, 0x83, 0x41, 0x1e, 0x4d, 0x02, 0xc2, 0xca, 0x61, 0x7b, 0xb2, 0xc5, 0xd9, 0x61, 0x3f, 0x25, 0xdd, 0x72, 0x41, 0x3d, 0x22, 0x9f, 0xd2, 0x90, 0x15, 0x13, 0xaa, 0x29, 0x50, 0x4e, 0xee, 0xfb, 819 }; 820 static const u8 ecccdh_SECP224R1_2_test_vector_our_pub_key[] = { 821 0x00, 0x5b, 0xca, 0x45, 0xd7, 0x93, 0xe7, 0xfe, 0x99, 0xa8, 0x43, 0x70, 0x4e, 0xd8, 0x38, 0x31, 0x5a, 0xb1, 0x4a, 0x5f, 0x62, 0x77, 0x50, 0x7e, 0x9b, 0xc3, 0x75, 0x31, 0x43, 0xe9, 0xd4, 0x21, 0xe1, 0x48, 0x6a, 0xe5, 0x89, 0x3b, 0xfd, 0x23, 0xc2, 0x10, 0xe5, 0xc1, 0x40, 0xd7, 0xc6, 0xb1, 0xad, 0xa5, 0x9d, 0x84, 0x2c, 0x9a, 0x98, 0xde, 822 }; 823 static const u8 ecccdh_SECP224R1_2_test_vector_shared_secret[] = { 824 0x3f, 0xcc, 0x01, 0xe3, 0x4d, 0x44, 0x49, 0xda, 0x2a, 0x97, 0x4b, 0x23, 0xfc, 0x36, 0xf9, 0x56, 0x67, 0x54, 0x25, 0x9d, 0x39, 0x14, 0x97, 0x90, 0xcf, 0xa1, 0xeb, 0xd3, 825 }; 826 static const ecdh_test_case ecccdh_SECP224R1_2_test_case = { 827 .name = "ECCCDH/SECP224R1 2", 828 .ecdh_type = ECCCDH, 829 .ec_str_p = &secp224r1_str_params, 830 .our_priv_key = ecccdh_SECP224R1_2_test_vector_our_priv_key, 831 .our_priv_key_len = sizeof(ecccdh_SECP224R1_2_test_vector_our_priv_key), 832 .peer_pub_key = ecccdh_SECP224R1_2_test_vector_peer_pub_key, 833 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_2_test_vector_peer_pub_key), 834 .exp_our_pub_key = ecccdh_SECP224R1_2_test_vector_our_pub_key, 835 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_2_test_vector_our_pub_key), 836 .exp_shared_secret = ecccdh_SECP224R1_2_test_vector_shared_secret, 837 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_2_test_vector_shared_secret), 838 }; 839 #endif /* WITH_CURVE_SECP224R1 */ 840 841 #ifdef WITH_CURVE_SECP224R1 842 #define ECCCDH_SECP224R1_SELF_TEST_3 843 /*** Tests for ECCCDH/SECP224R1 ***/ 844 static const u8 ecccdh_SECP224R1_3_test_vector_our_priv_key[] = { 845 0x0a, 0xa6, 0xff, 0x55, 0xa5, 0xd8, 0x20, 0xef, 0xcb, 0x4e, 0x7d, 0x10, 0xb8, 0x45, 0xea, 0x3c, 0x9f, 0x9b, 0xc5, 0xdf, 0xf8, 0x61, 0x06, 0xdb, 0x85, 0x31, 0x8e, 0x22, 846 }; 847 static const u8 ecccdh_SECP224R1_3_test_vector_peer_pub_key[] = { 848 0x0f, 0x53, 0x7b, 0xf1, 0xc1, 0x12, 0x2c, 0x55, 0x65, 0x6d, 0x25, 0xe8, 0xaa, 0x84, 0x17, 0xe0, 0xb4, 0x4b, 0x15, 0x26, 0xae, 0x05, 0x23, 0x14, 0x4f, 0x99, 0x21, 0xc4, 0xf7, 0x9b, 0x26, 0xd3, 0x0e, 0x49, 0x1a, 0x77, 0x36, 0x96, 0xcc, 0x2c, 0x79, 0xb4, 0xf0, 0x59, 0x6b, 0xc5, 0xb9, 0xee, 0xba, 0xf3, 0x94, 0xd1, 0x62, 0xfb, 0x86, 0x84, 849 }; 850 static const u8 ecccdh_SECP224R1_3_test_vector_our_pub_key[] = { 851 0x2f, 0x96, 0x75, 0x41, 0x31, 0xe0, 0x96, 0x81, 0x98, 0xaa, 0x78, 0xfb, 0xe8, 0xc2, 0x01, 0xdc, 0x5f, 0x35, 0x81, 0xc7, 0x92, 0xde, 0x48, 0x73, 0x40, 0xd3, 0x24, 0x48, 0x61, 0xe8, 0xa5, 0xcd, 0x79, 0x61, 0x52, 0x03, 0xb6, 0xd8, 0x9e, 0x94, 0x96, 0xf9, 0xe2, 0x36, 0xfe, 0x3b, 0x6b, 0xe8, 0x73, 0x1e, 0x74, 0x3d, 0x61, 0x55, 0x19, 0xc6, 852 }; 853 static const u8 ecccdh_SECP224R1_3_test_vector_shared_secret[] = { 854 0x49, 0x12, 0x96, 0x28, 0xb2, 0x3a, 0xfc, 0xef, 0x48, 0x13, 0x9a, 0x3f, 0x6f, 0x59, 0xff, 0x5e, 0x98, 0x11, 0xaa, 0x74, 0x6a, 0xa4, 0xff, 0x33, 0xc2, 0x4b, 0xb9, 0x40, 855 }; 856 static const ecdh_test_case ecccdh_SECP224R1_3_test_case = { 857 .name = "ECCCDH/SECP224R1 3", 858 .ecdh_type = ECCCDH, 859 .ec_str_p = &secp224r1_str_params, 860 .our_priv_key = ecccdh_SECP224R1_3_test_vector_our_priv_key, 861 .our_priv_key_len = sizeof(ecccdh_SECP224R1_3_test_vector_our_priv_key), 862 .peer_pub_key = ecccdh_SECP224R1_3_test_vector_peer_pub_key, 863 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_3_test_vector_peer_pub_key), 864 .exp_our_pub_key = ecccdh_SECP224R1_3_test_vector_our_pub_key, 865 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_3_test_vector_our_pub_key), 866 .exp_shared_secret = ecccdh_SECP224R1_3_test_vector_shared_secret, 867 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_3_test_vector_shared_secret), 868 }; 869 #endif /* WITH_CURVE_SECP224R1 */ 870 871 #ifdef WITH_CURVE_SECP224R1 872 #define ECCCDH_SECP224R1_SELF_TEST_4 873 /*** Tests for ECCCDH/SECP224R1 ***/ 874 static const u8 ecccdh_SECP224R1_4_test_vector_our_priv_key[] = { 875 0xef, 0xe6, 0xe6, 0xe2, 0x5a, 0xff, 0xaf, 0x54, 0xc9, 0x8d, 0x00, 0x2a, 0xbb, 0xc6, 0x32, 0x8d, 0xa1, 0x59, 0x40, 0x5a, 0x1b, 0x75, 0x2e, 0x32, 0xdc, 0x23, 0x95, 0x0a, 876 }; 877 static const u8 ecccdh_SECP224R1_4_test_vector_peer_pub_key[] = { 878 0x2b, 0x36, 0x31, 0xd2, 0xb0, 0x61, 0x79, 0xb3, 0x17, 0x4a, 0x10, 0x0f, 0x7f, 0x57, 0x13, 0x1e, 0xee, 0xa8, 0x94, 0x7b, 0xe0, 0x78, 0x6c, 0x3d, 0xc6, 0x4b, 0x22, 0x39, 0x83, 0xde, 0x29, 0xae, 0x3d, 0xad, 0x31, 0xad, 0xc0, 0x23, 0x6c, 0x6d, 0xe7, 0xf1, 0x45, 0x61, 0xca, 0x2e, 0xa0, 0x83, 0xc5, 0x27, 0x0c, 0x78, 0xa2, 0xe6, 0xcb, 0xc0, 879 }; 880 static const u8 ecccdh_SECP224R1_4_test_vector_our_pub_key[] = { 881 0x35, 0x5e, 0x96, 0x29, 0x20, 0xbd, 0xe0, 0x43, 0x69, 0x5f, 0x6b, 0xff, 0xb4, 0xb3, 0x55, 0xc6, 0x3d, 0xa6, 0xf5, 0xde, 0x66, 0x5e, 0xd4, 0x6f, 0x2e, 0xc8, 0x17, 0xe2, 0x74, 0x8e, 0x09, 0x53, 0x68, 0xf6, 0x2e, 0x1d, 0x36, 0x4e, 0xdd, 0x46, 0x17, 0x19, 0x79, 0x3b, 0x40, 0x4a, 0xdb, 0xda, 0xac, 0xbc, 0xad, 0xd8, 0x89, 0x22, 0xff, 0x37, 882 }; 883 static const u8 ecccdh_SECP224R1_4_test_vector_shared_secret[] = { 884 0xfc, 0xdc, 0x69, 0xa4, 0x05, 0x01, 0xd3, 0x08, 0xa6, 0x83, 0x96, 0x53, 0xa8, 0xf0, 0x43, 0x09, 0xec, 0x00, 0x23, 0x39, 0x49, 0x52, 0x29, 0x02, 0xff, 0xa5, 0xea, 0xc6, 885 }; 886 static const ecdh_test_case ecccdh_SECP224R1_4_test_case = { 887 .name = "ECCCDH/SECP224R1 4", 888 .ecdh_type = ECCCDH, 889 .ec_str_p = &secp224r1_str_params, 890 .our_priv_key = ecccdh_SECP224R1_4_test_vector_our_priv_key, 891 .our_priv_key_len = sizeof(ecccdh_SECP224R1_4_test_vector_our_priv_key), 892 .peer_pub_key = ecccdh_SECP224R1_4_test_vector_peer_pub_key, 893 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_4_test_vector_peer_pub_key), 894 .exp_our_pub_key = ecccdh_SECP224R1_4_test_vector_our_pub_key, 895 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_4_test_vector_our_pub_key), 896 .exp_shared_secret = ecccdh_SECP224R1_4_test_vector_shared_secret, 897 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_4_test_vector_shared_secret), 898 }; 899 #endif /* WITH_CURVE_SECP224R1 */ 900 901 #ifdef WITH_CURVE_SECP224R1 902 #define ECCCDH_SECP224R1_SELF_TEST_5 903 /*** Tests for ECCCDH/SECP224R1 ***/ 904 static const u8 ecccdh_SECP224R1_5_test_vector_our_priv_key[] = { 905 0x61, 0xcb, 0x29, 0x32, 0x52, 0x40, 0x01, 0xe5, 0xe9, 0xee, 0xed, 0x6d, 0xf7, 0xd9, 0xc8, 0x93, 0x5e, 0xe3, 0x32, 0x20, 0x29, 0xed, 0xd7, 0xaa, 0x8a, 0xcb, 0xfd, 0x51, 906 }; 907 static const u8 ecccdh_SECP224R1_5_test_vector_peer_pub_key[] = { 908 0x45, 0x11, 0x40, 0x3d, 0xe2, 0x90, 0x59, 0xf6, 0x9a, 0x47, 0x5c, 0x5a, 0x6a, 0x5f, 0x6c, 0xab, 0xed, 0x5d, 0x9f, 0x01, 0x44, 0x36, 0xa8, 0xcb, 0x70, 0xa0, 0x23, 0x38, 0x7d, 0x2d, 0x1b, 0x62, 0xaa, 0x04, 0x6d, 0xf9, 0x34, 0x0f, 0x9c, 0x37, 0xa0, 0x87, 0xa0, 0x6b, 0x32, 0xcf, 0x7f, 0x08, 0xa2, 0x23, 0xf9, 0x92, 0x81, 0x2a, 0x82, 0x8b, 909 }; 910 static const u8 ecccdh_SECP224R1_5_test_vector_our_pub_key[] = { 911 0xd5, 0x0e, 0x4a, 0xda, 0xbf, 0xd9, 0x89, 0xd7, 0xdb, 0xc7, 0xcf, 0x40, 0x52, 0x54, 0x6c, 0xc7, 0xc4, 0x47, 0xa9, 0x76, 0x30, 0x43, 0x69, 0x97, 0xad, 0x4b, 0x95, 0x36, 0x5b, 0xea, 0x50, 0x34, 0x73, 0xc5, 0xea, 0xef, 0x95, 0x52, 0xd4, 0x2c, 0x40, 0xb1, 0xf2, 0xf7, 0xca, 0x29, 0x27, 0x33, 0xb2, 0x55, 0xb9, 0xbb, 0xe1, 0xb1, 0x23, 0x37, 912 }; 913 static const u8 ecccdh_SECP224R1_5_test_vector_shared_secret[] = { 914 0x82, 0x7e, 0x90, 0x25, 0xcb, 0x62, 0xe0, 0xe8, 0x37, 0xc5, 0x96, 0x06, 0x3f, 0x3b, 0x9b, 0x5a, 0x0f, 0x7a, 0xfd, 0x8d, 0x87, 0x83, 0x20, 0x00, 0x86, 0xd6, 0x1e, 0xc1, 915 }; 916 static const ecdh_test_case ecccdh_SECP224R1_5_test_case = { 917 .name = "ECCCDH/SECP224R1 5", 918 .ecdh_type = ECCCDH, 919 .ec_str_p = &secp224r1_str_params, 920 .our_priv_key = ecccdh_SECP224R1_5_test_vector_our_priv_key, 921 .our_priv_key_len = sizeof(ecccdh_SECP224R1_5_test_vector_our_priv_key), 922 .peer_pub_key = ecccdh_SECP224R1_5_test_vector_peer_pub_key, 923 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_5_test_vector_peer_pub_key), 924 .exp_our_pub_key = ecccdh_SECP224R1_5_test_vector_our_pub_key, 925 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_5_test_vector_our_pub_key), 926 .exp_shared_secret = ecccdh_SECP224R1_5_test_vector_shared_secret, 927 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_5_test_vector_shared_secret), 928 }; 929 #endif /* WITH_CURVE_SECP224R1 */ 930 931 #ifdef WITH_CURVE_SECP224R1 932 #define ECCCDH_SECP224R1_SELF_TEST_6 933 /*** Tests for ECCCDH/SECP224R1 ***/ 934 static const u8 ecccdh_SECP224R1_6_test_vector_our_priv_key[] = { 935 0x8c, 0x7a, 0xce, 0x34, 0x71, 0x71, 0xf9, 0x2d, 0xef, 0x98, 0xd8, 0x45, 0x47, 0x5f, 0xc8, 0x2e, 0x1d, 0x14, 0x96, 0xda, 0x81, 0xee, 0x58, 0xf5, 0x05, 0xb9, 0x85, 0xfa, 936 }; 937 static const u8 ecccdh_SECP224R1_6_test_vector_peer_pub_key[] = { 938 0x31, 0x4a, 0x0b, 0x26, 0xdd, 0x31, 0xc2, 0x48, 0x84, 0x5d, 0x7c, 0xc1, 0x7b, 0x61, 0xca, 0xd4, 0x60, 0x82, 0x59, 0xbe, 0xd8, 0x5a, 0x58, 0xd1, 0xf1, 0xff, 0xd3, 0x78, 0x66, 0xe4, 0xb3, 0x50, 0x35, 0x2e, 0x11, 0x9e, 0xec, 0xad, 0xa3, 0x82, 0x90, 0x7f, 0x36, 0x19, 0xfd, 0x74, 0x8e, 0xa7, 0x3a, 0xe4, 0x89, 0x9d, 0xfd, 0x49, 0x63, 0x02, 939 }; 940 static const u8 ecccdh_SECP224R1_6_test_vector_our_pub_key[] = { 941 0xb1, 0xa8, 0xdc, 0xac, 0x89, 0xac, 0xa2, 0x79, 0x93, 0x20, 0xb4, 0x51, 0xdf, 0x1c, 0x7f, 0xf4, 0xd9, 0x75, 0x67, 0xab, 0xb6, 0x81, 0x41, 0xc0, 0xd9, 0x5f, 0xc2, 0xaa, 0x35, 0x24, 0x95, 0x09, 0x02, 0xb1, 0x51, 0x0b, 0xdc, 0x98, 0x7d, 0x86, 0x0a, 0xfc, 0x27, 0xad, 0x87, 0x1c, 0xea, 0xea, 0x66, 0x93, 0x5a, 0xbd, 0x3c, 0x0a, 0x99, 0xa8, 942 }; 943 static const u8 ecccdh_SECP224R1_6_test_vector_shared_secret[] = { 944 0x33, 0x5b, 0xa5, 0x12, 0x28, 0xd9, 0x4a, 0xcb, 0xed, 0x85, 0x1c, 0xa7, 0x82, 0x1c, 0x80, 0x1d, 0x5c, 0xb1, 0xc7, 0x97, 0x5d, 0x7a, 0xa9, 0x0a, 0x71, 0x59, 0xf8, 0xfa, 945 }; 946 static const ecdh_test_case ecccdh_SECP224R1_6_test_case = { 947 .name = "ECCCDH/SECP224R1 6", 948 .ecdh_type = ECCCDH, 949 .ec_str_p = &secp224r1_str_params, 950 .our_priv_key = ecccdh_SECP224R1_6_test_vector_our_priv_key, 951 .our_priv_key_len = sizeof(ecccdh_SECP224R1_6_test_vector_our_priv_key), 952 .peer_pub_key = ecccdh_SECP224R1_6_test_vector_peer_pub_key, 953 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_6_test_vector_peer_pub_key), 954 .exp_our_pub_key = ecccdh_SECP224R1_6_test_vector_our_pub_key, 955 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_6_test_vector_our_pub_key), 956 .exp_shared_secret = ecccdh_SECP224R1_6_test_vector_shared_secret, 957 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_6_test_vector_shared_secret), 958 }; 959 #endif /* WITH_CURVE_SECP224R1 */ 960 961 #ifdef WITH_CURVE_SECP224R1 962 #define ECCCDH_SECP224R1_SELF_TEST_7 963 /*** Tests for ECCCDH/SECP224R1 ***/ 964 static const u8 ecccdh_SECP224R1_7_test_vector_our_priv_key[] = { 965 0x38, 0x2f, 0xeb, 0x9b, 0x9b, 0xa1, 0x0f, 0x18, 0x9d, 0x99, 0xe7, 0x1a, 0x89, 0xcd, 0xfe, 0x44, 0xcb, 0x55, 0x4c, 0xec, 0x13, 0xa2, 0x12, 0x84, 0x09, 0x77, 0xfb, 0x68, 966 }; 967 static const u8 ecccdh_SECP224R1_7_test_vector_peer_pub_key[] = { 968 0xab, 0xe6, 0x84, 0x3b, 0xee, 0xc2, 0xfd, 0x9e, 0x5f, 0xb6, 0x47, 0x30, 0xd0, 0xbe, 0x4d, 0x16, 0x54, 0x38, 0xce, 0x92, 0x2e, 0xd7, 0x5d, 0xd8, 0x0b, 0x46, 0x03, 0xe5, 0x6a, 0xfe, 0x86, 0x73, 0xa9, 0x6c, 0x4b, 0xa9, 0x90, 0x0a, 0xd8, 0x59, 0x95, 0xe6, 0x31, 0xe4, 0x36, 0xc6, 0xcc, 0x88, 0xa2, 0xc2, 0xb4, 0x7b, 0x7c, 0x48, 0x86, 0xb8, 969 }; 970 static const u8 ecccdh_SECP224R1_7_test_vector_our_pub_key[] = { 971 0xab, 0xb6, 0xf1, 0xe3, 0x77, 0x3f, 0xf8, 0xfc, 0x73, 0xae, 0xa2, 0xa0, 0xb1, 0x07, 0x80, 0x9c, 0xe7, 0x0a, 0xdc, 0xef, 0xed, 0x6e, 0x41, 0xfc, 0x5c, 0xb4, 0x30, 0x45, 0xa9, 0x63, 0x89, 0x7a, 0xe9, 0x06, 0xc1, 0x0a, 0x05, 0x5e, 0xea, 0xdb, 0x97, 0xff, 0xdd, 0x6f, 0x74, 0x8d, 0x3e, 0x56, 0x21, 0xe5, 0xff, 0xf3, 0x04, 0xe4, 0x8b, 0xa7, 972 }; 973 static const u8 ecccdh_SECP224R1_7_test_vector_shared_secret[] = { 974 0x8c, 0x2e, 0x62, 0x75, 0x94, 0x20, 0x6b, 0x34, 0xf7, 0x35, 0x6d, 0x34, 0x26, 0xeb, 0x3d, 0x79, 0xf5, 0x18, 0xef, 0x84, 0x3f, 0xbe, 0x94, 0x01, 0x4c, 0xce, 0xac, 0xe3, 975 }; 976 static const ecdh_test_case ecccdh_SECP224R1_7_test_case = { 977 .name = "ECCCDH/SECP224R1 7", 978 .ecdh_type = ECCCDH, 979 .ec_str_p = &secp224r1_str_params, 980 .our_priv_key = ecccdh_SECP224R1_7_test_vector_our_priv_key, 981 .our_priv_key_len = sizeof(ecccdh_SECP224R1_7_test_vector_our_priv_key), 982 .peer_pub_key = ecccdh_SECP224R1_7_test_vector_peer_pub_key, 983 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_7_test_vector_peer_pub_key), 984 .exp_our_pub_key = ecccdh_SECP224R1_7_test_vector_our_pub_key, 985 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_7_test_vector_our_pub_key), 986 .exp_shared_secret = ecccdh_SECP224R1_7_test_vector_shared_secret, 987 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_7_test_vector_shared_secret), 988 }; 989 #endif /* WITH_CURVE_SECP224R1 */ 990 991 #ifdef WITH_CURVE_SECP224R1 992 #define ECCCDH_SECP224R1_SELF_TEST_8 993 /*** Tests for ECCCDH/SECP224R1 ***/ 994 static const u8 ecccdh_SECP224R1_8_test_vector_our_priv_key[] = { 995 0xe0, 0xd6, 0x20, 0x35, 0x10, 0x1e, 0xf4, 0x87, 0xc4, 0x85, 0xc6, 0x0f, 0xb4, 0x50, 0x0e, 0xeb, 0xe6, 0xa3, 0x2e, 0xc6, 0x4d, 0xbe, 0x97, 0xdb, 0xe0, 0x23, 0x2c, 0x46, 996 }; 997 static const u8 ecccdh_SECP224R1_8_test_vector_peer_pub_key[] = { 998 0x13, 0xcf, 0x9d, 0x6d, 0x2c, 0x9a, 0xae, 0x82, 0x74, 0xc2, 0x7d, 0x44, 0x6a, 0xfd, 0x0c, 0x88, 0x8f, 0xfd, 0xd5, 0x2a, 0xe2, 0x99, 0xa3, 0x59, 0x84, 0xd4, 0xf5, 0x27, 0xdc, 0xbe, 0xe7, 0x5b, 0x51, 0x57, 0x51, 0xf8, 0xee, 0x2a, 0xe3, 0x55, 0xe8, 0xaf, 0xd5, 0xde, 0x21, 0xc6, 0x2a, 0x93, 0x9a, 0x65, 0x07, 0xb5, 0x38, 0xcb, 0xc4, 0xaf, 999 }; 1000 static const u8 ecccdh_SECP224R1_8_test_vector_our_pub_key[] = { 1001 0x88, 0x53, 0x77, 0x35, 0xe9, 0xb2, 0x3e, 0x3e, 0x0e, 0x07, 0x6f, 0x13, 0x5a, 0x82, 0xd3, 0x3f, 0x9b, 0xff, 0xb4, 0x65, 0xf3, 0xab, 0xce, 0x83, 0x22, 0xa6, 0x2a, 0x62, 0xb4, 0xc8, 0xc1, 0x23, 0x67, 0x31, 0x97, 0x87, 0x5c, 0x0b, 0xd1, 0x4e, 0xd0, 0x97, 0x60, 0x6d, 0x33, 0x0f, 0xba, 0x2b, 0x92, 0x00, 0xef, 0x65, 0xa4, 0x47, 0x64, 0xd3, 1002 }; 1003 static const u8 ecccdh_SECP224R1_8_test_vector_shared_secret[] = { 1004 0x63, 0x2a, 0xbb, 0x66, 0x27, 0x28, 0xdb, 0xc9, 0x94, 0x50, 0x88, 0x73, 0xd5, 0xc5, 0x27, 0xca, 0x5e, 0xf9, 0x23, 0xc0, 0xd3, 0x1f, 0xa6, 0xc4, 0x7e, 0xf4, 0xc8, 0x25, 1005 }; 1006 static const ecdh_test_case ecccdh_SECP224R1_8_test_case = { 1007 .name = "ECCCDH/SECP224R1 8", 1008 .ecdh_type = ECCCDH, 1009 .ec_str_p = &secp224r1_str_params, 1010 .our_priv_key = ecccdh_SECP224R1_8_test_vector_our_priv_key, 1011 .our_priv_key_len = sizeof(ecccdh_SECP224R1_8_test_vector_our_priv_key), 1012 .peer_pub_key = ecccdh_SECP224R1_8_test_vector_peer_pub_key, 1013 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_8_test_vector_peer_pub_key), 1014 .exp_our_pub_key = ecccdh_SECP224R1_8_test_vector_our_pub_key, 1015 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_8_test_vector_our_pub_key), 1016 .exp_shared_secret = ecccdh_SECP224R1_8_test_vector_shared_secret, 1017 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_8_test_vector_shared_secret), 1018 }; 1019 #endif /* WITH_CURVE_SECP224R1 */ 1020 1021 #ifdef WITH_CURVE_SECP224R1 1022 #define ECCCDH_SECP224R1_SELF_TEST_9 1023 /*** Tests for ECCCDH/SECP224R1 ***/ 1024 static const u8 ecccdh_SECP224R1_9_test_vector_our_priv_key[] = { 1025 0xb9, 0x6a, 0xde, 0x5b, 0x73, 0xba, 0x72, 0xaa, 0x8b, 0x6e, 0x4d, 0x74, 0xd7, 0xbf, 0x9c, 0x58, 0xe9, 0x62, 0xff, 0x78, 0xeb, 0x54, 0x22, 0x87, 0xc7, 0xb4, 0x4b, 0xa2, 1026 }; 1027 static const u8 ecccdh_SECP224R1_9_test_vector_peer_pub_key[] = { 1028 0x96, 0x5b, 0x63, 0x7c, 0x0d, 0xfb, 0xc0, 0xcf, 0x95, 0x40, 0x35, 0x68, 0x6d, 0x70, 0xf7, 0xec, 0x30, 0x92, 0x9e, 0x66, 0x4e, 0x52, 0x1d, 0xba, 0xa2, 0x28, 0x06, 0x59, 0x82, 0xa5, 0x8f, 0xf6, 0x1b, 0xc9, 0x00, 0x19, 0xbb, 0xcb, 0xb5, 0x87, 0x5d, 0x38, 0x63, 0xdb, 0x0b, 0xc2, 0xa1, 0xfa, 0x34, 0xb0, 0xad, 0x4d, 0xe1, 0xa8, 0x3f, 0x99, 1029 }; 1030 static const u8 ecccdh_SECP224R1_9_test_vector_our_pub_key[] = { 1031 0x37, 0x68, 0x29, 0x26, 0xa5, 0x4f, 0x70, 0xa4, 0xc1, 0x74, 0x8f, 0x54, 0xd5, 0x0d, 0x5b, 0x00, 0x13, 0x8a, 0x05, 0x5f, 0x92, 0x4f, 0x2c, 0x65, 0xe5, 0xb0, 0xbb, 0xe4, 0x59, 0x6a, 0xfe, 0xfc, 0xdd, 0x64, 0x0d, 0x29, 0x63, 0x50, 0x15, 0xb8, 0x9b, 0xdd, 0xdd, 0x1f, 0x8c, 0x27, 0x23, 0x68, 0x6d, 0x33, 0x2e, 0x7a, 0x06, 0xca, 0x87, 0x99, 1032 }; 1033 static const u8 ecccdh_SECP224R1_9_test_vector_shared_secret[] = { 1034 0x34, 0x64, 0x11, 0x41, 0xaa, 0xb0, 0x5e, 0xf5, 0x8b, 0xd3, 0x76, 0xd6, 0x09, 0x34, 0x59, 0x01, 0xfb, 0x8f, 0x63, 0x47, 0x7c, 0x6b, 0xe9, 0x09, 0x7f, 0x03, 0x7f, 0x1f, 1035 }; 1036 static const ecdh_test_case ecccdh_SECP224R1_9_test_case = { 1037 .name = "ECCCDH/SECP224R1 9", 1038 .ecdh_type = ECCCDH, 1039 .ec_str_p = &secp224r1_str_params, 1040 .our_priv_key = ecccdh_SECP224R1_9_test_vector_our_priv_key, 1041 .our_priv_key_len = sizeof(ecccdh_SECP224R1_9_test_vector_our_priv_key), 1042 .peer_pub_key = ecccdh_SECP224R1_9_test_vector_peer_pub_key, 1043 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_9_test_vector_peer_pub_key), 1044 .exp_our_pub_key = ecccdh_SECP224R1_9_test_vector_our_pub_key, 1045 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_9_test_vector_our_pub_key), 1046 .exp_shared_secret = ecccdh_SECP224R1_9_test_vector_shared_secret, 1047 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_9_test_vector_shared_secret), 1048 }; 1049 #endif /* WITH_CURVE_SECP224R1 */ 1050 1051 #ifdef WITH_CURVE_SECP224R1 1052 #define ECCCDH_SECP224R1_SELF_TEST_10 1053 /*** Tests for ECCCDH/SECP224R1 ***/ 1054 static const u8 ecccdh_SECP224R1_10_test_vector_our_priv_key[] = { 1055 0xa4, 0x0d, 0x7e, 0x12, 0x04, 0x9c, 0x71, 0xe6, 0x52, 0x2c, 0x7f, 0xf2, 0x38, 0x42, 0x24, 0x06, 0x1c, 0x3a, 0x45, 0x70, 0x58, 0xb3, 0x10, 0x55, 0x76, 0x55, 0xb8, 0x54, 1056 }; 1057 static const u8 ecccdh_SECP224R1_10_test_vector_peer_pub_key[] = { 1058 0x73, 0xcc, 0x64, 0x53, 0x72, 0xca, 0x2e, 0x71, 0x63, 0x7c, 0xda, 0x94, 0x3d, 0x81, 0x48, 0xf3, 0x38, 0x2a, 0xb6, 0xdd, 0x0f, 0x2e, 0x1a, 0x49, 0xda, 0x94, 0xe1, 0x34, 0xdf, 0x5c, 0x35, 0x5c, 0x23, 0xe6, 0xe2, 0x32, 0xeb, 0xc3, 0xbe, 0xe2, 0xab, 0x18, 0x73, 0xee, 0x0d, 0x83, 0xe3, 0x38, 0x2f, 0x8e, 0x6f, 0xe6, 0x13, 0xf6, 0x34, 0x3c, 1059 }; 1060 static const u8 ecccdh_SECP224R1_10_test_vector_our_pub_key[] = { 1061 0x39, 0x98, 0x01, 0x24, 0x3b, 0xfe, 0x0c, 0x2d, 0xa9, 0xb0, 0xa5, 0x3c, 0x8c, 0xa5, 0x7f, 0x2e, 0xee, 0x87, 0xaa, 0xa9, 0x4a, 0x8e, 0x4d, 0x5e, 0x02, 0x9f, 0x42, 0xca, 0xaa, 0x49, 0xe6, 0xd4, 0xb4, 0x7c, 0xee, 0x7a, 0x5c, 0x4a, 0xb7, 0x1d, 0x5a, 0x67, 0xda, 0x84, 0xe0, 0xb9, 0xb4, 0x25, 0xce, 0x3e, 0x70, 0xda, 0x68, 0xc8, 0x89, 0xe7, 1062 }; 1063 static const u8 ecccdh_SECP224R1_10_test_vector_shared_secret[] = { 1064 0x4f, 0x74, 0xac, 0x85, 0x07, 0x50, 0x1a, 0x32, 0xbf, 0xc5, 0xa7, 0x8d, 0x82, 0x71, 0xc2, 0x00, 0xe8, 0x35, 0x96, 0x6e, 0x18, 0x7e, 0x8d, 0x00, 0x01, 0x1a, 0x8c, 0x75, 1065 }; 1066 static const ecdh_test_case ecccdh_SECP224R1_10_test_case = { 1067 .name = "ECCCDH/SECP224R1 10", 1068 .ecdh_type = ECCCDH, 1069 .ec_str_p = &secp224r1_str_params, 1070 .our_priv_key = ecccdh_SECP224R1_10_test_vector_our_priv_key, 1071 .our_priv_key_len = sizeof(ecccdh_SECP224R1_10_test_vector_our_priv_key), 1072 .peer_pub_key = ecccdh_SECP224R1_10_test_vector_peer_pub_key, 1073 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_10_test_vector_peer_pub_key), 1074 .exp_our_pub_key = ecccdh_SECP224R1_10_test_vector_our_pub_key, 1075 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_10_test_vector_our_pub_key), 1076 .exp_shared_secret = ecccdh_SECP224R1_10_test_vector_shared_secret, 1077 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_10_test_vector_shared_secret), 1078 }; 1079 #endif /* WITH_CURVE_SECP224R1 */ 1080 1081 #ifdef WITH_CURVE_SECP224R1 1082 #define ECCCDH_SECP224R1_SELF_TEST_11 1083 /*** Tests for ECCCDH/SECP224R1 ***/ 1084 static const u8 ecccdh_SECP224R1_11_test_vector_our_priv_key[] = { 1085 0xad, 0x25, 0x19, 0xbc, 0x72, 0x4d, 0x48, 0x4e, 0x02, 0xa6, 0x9f, 0x05, 0x14, 0x9b, 0xb0, 0x47, 0x71, 0x4b, 0xf0, 0xf5, 0x98, 0x6f, 0xac, 0x2e, 0x22, 0x2c, 0xd9, 0x46, 1086 }; 1087 static const u8 ecccdh_SECP224R1_11_test_vector_peer_pub_key[] = { 1088 0x54, 0x65, 0x78, 0x21, 0x62, 0x50, 0x35, 0x4e, 0x44, 0x9e, 0x21, 0x54, 0x6d, 0xd1, 0x1c, 0xd1, 0xc5, 0x17, 0x42, 0x36, 0x73, 0x9a, 0xca, 0xd9, 0xce, 0x0f, 0x45, 0x12, 0xd2, 0xa2, 0x2f, 0xcd, 0x66, 0xd1, 0xab, 0xed, 0xc7, 0x67, 0x66, 0x83, 0x27, 0xc5, 0xcb, 0x9c, 0x59, 0x90, 0x43, 0x27, 0x62, 0x39, 0xcf, 0x3c, 0x85, 0x16, 0xaf, 0x24, 1089 }; 1090 static const u8 ecccdh_SECP224R1_11_test_vector_our_pub_key[] = { 1091 0xdf, 0x9c, 0x1e, 0x0e, 0xf1, 0x5e, 0x53, 0xb9, 0xf6, 0x26, 0xe2, 0xbe, 0x1c, 0xbe, 0x89, 0x36, 0x39, 0xc0, 0x6f, 0x3e, 0x04, 0x39, 0xee, 0x95, 0xd7, 0xd4, 0xb1, 0xe3, 0x7a, 0x52, 0xa7, 0x38, 0x6a, 0xdd, 0xa2, 0x43, 0xef, 0xdf, 0x89, 0x41, 0x08, 0x5c, 0x84, 0xe3, 0x12, 0x39, 0xca, 0xb9, 0x2b, 0x80, 0x17, 0x33, 0x67, 0x48, 0x96, 0x5e, 1092 }; 1093 static const u8 ecccdh_SECP224R1_11_test_vector_shared_secret[] = { 1094 0xad, 0x09, 0xc9, 0xae, 0x4d, 0x23, 0x24, 0xea, 0x81, 0xbb, 0x55, 0x5b, 0x20, 0x0d, 0x3c, 0x00, 0x3e, 0x22, 0xa6, 0x87, 0x0e, 0xe0, 0x3b, 0x52, 0xdf, 0x49, 0xe4, 0xde, 1095 }; 1096 static const ecdh_test_case ecccdh_SECP224R1_11_test_case = { 1097 .name = "ECCCDH/SECP224R1 11", 1098 .ecdh_type = ECCCDH, 1099 .ec_str_p = &secp224r1_str_params, 1100 .our_priv_key = ecccdh_SECP224R1_11_test_vector_our_priv_key, 1101 .our_priv_key_len = sizeof(ecccdh_SECP224R1_11_test_vector_our_priv_key), 1102 .peer_pub_key = ecccdh_SECP224R1_11_test_vector_peer_pub_key, 1103 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_11_test_vector_peer_pub_key), 1104 .exp_our_pub_key = ecccdh_SECP224R1_11_test_vector_our_pub_key, 1105 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_11_test_vector_our_pub_key), 1106 .exp_shared_secret = ecccdh_SECP224R1_11_test_vector_shared_secret, 1107 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_11_test_vector_shared_secret), 1108 }; 1109 #endif /* WITH_CURVE_SECP224R1 */ 1110 1111 #ifdef WITH_CURVE_SECP224R1 1112 #define ECCCDH_SECP224R1_SELF_TEST_12 1113 /*** Tests for ECCCDH/SECP224R1 ***/ 1114 static const u8 ecccdh_SECP224R1_12_test_vector_our_priv_key[] = { 1115 0x3d, 0x31, 0x2a, 0x9b, 0x9d, 0x8e, 0xd0, 0x91, 0x40, 0x90, 0x0b, 0xba, 0xc1, 0xe0, 0x95, 0x52, 0x7e, 0xbc, 0x9e, 0x3c, 0x64, 0x93, 0xbc, 0xf3, 0x66, 0x6e, 0x3a, 0x29, 1116 }; 1117 static const u8 ecccdh_SECP224R1_12_test_vector_peer_pub_key[] = { 1118 0x1d, 0x46, 0xb1, 0xdc, 0x3a, 0x28, 0x12, 0x3c, 0xb5, 0x13, 0x46, 0xe6, 0x7b, 0xae, 0xc5, 0x64, 0x04, 0x86, 0x86, 0x78, 0xfa, 0xf7, 0xd0, 0xe8, 0xb2, 0xaf, 0xa2, 0x2a, 0x0e, 0xc9, 0xe6, 0x5e, 0xc9, 0x7e, 0x21, 0x83, 0x73, 0xe7, 0xfc, 0x11, 0x5c, 0x22, 0x74, 0xd5, 0xb8, 0x29, 0xa6, 0x0d, 0x93, 0xf7, 0x1e, 0x01, 0xd5, 0x81, 0x36, 0xc3, 1119 }; 1120 static const u8 ecccdh_SECP224R1_12_test_vector_our_pub_key[] = { 1121 0xb4, 0xa0, 0x19, 0x8d, 0xc8, 0x81, 0x0e, 0x88, 0x44, 0x25, 0xb7, 0x50, 0x92, 0x8b, 0x0c, 0x96, 0x0c, 0x31, 0xf7, 0xa9, 0x96, 0x63, 0x40, 0x0b, 0x01, 0xa1, 0x79, 0xdf, 0x81, 0x2b, 0x60, 0x1b, 0xfc, 0x07, 0x38, 0x24, 0x2c, 0x6f, 0x86, 0xf8, 0x30, 0xf2, 0x7a, 0xcd, 0x63, 0x2c, 0xa6, 0x18, 0xa0, 0xb5, 0x28, 0x0c, 0x9d, 0x57, 0x69, 0xf7, 1122 }; 1123 static const u8 ecccdh_SECP224R1_12_test_vector_shared_secret[] = { 1124 0xef, 0x02, 0x9c, 0x28, 0xc6, 0x80, 0x64, 0xb8, 0xab, 0xd2, 0x96, 0x5a, 0x38, 0xc4, 0x04, 0xfb, 0x5e, 0x94, 0x4a, 0xce, 0x57, 0xe8, 0x63, 0x8d, 0xab, 0xa9, 0xd3, 0xcd, 1125 }; 1126 static const ecdh_test_case ecccdh_SECP224R1_12_test_case = { 1127 .name = "ECCCDH/SECP224R1 12", 1128 .ecdh_type = ECCCDH, 1129 .ec_str_p = &secp224r1_str_params, 1130 .our_priv_key = ecccdh_SECP224R1_12_test_vector_our_priv_key, 1131 .our_priv_key_len = sizeof(ecccdh_SECP224R1_12_test_vector_our_priv_key), 1132 .peer_pub_key = ecccdh_SECP224R1_12_test_vector_peer_pub_key, 1133 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_12_test_vector_peer_pub_key), 1134 .exp_our_pub_key = ecccdh_SECP224R1_12_test_vector_our_pub_key, 1135 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_12_test_vector_our_pub_key), 1136 .exp_shared_secret = ecccdh_SECP224R1_12_test_vector_shared_secret, 1137 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_12_test_vector_shared_secret), 1138 }; 1139 #endif /* WITH_CURVE_SECP224R1 */ 1140 1141 #ifdef WITH_CURVE_SECP224R1 1142 #define ECCCDH_SECP224R1_SELF_TEST_13 1143 /*** Tests for ECCCDH/SECP224R1 ***/ 1144 static const u8 ecccdh_SECP224R1_13_test_vector_our_priv_key[] = { 1145 0x8c, 0xe0, 0x82, 0x2d, 0xc2, 0x4c, 0x15, 0x39, 0x95, 0x75, 0x5a, 0xc3, 0x50, 0x73, 0x7e, 0xf5, 0x06, 0x64, 0x1c, 0x7d, 0x75, 0x2b, 0x4f, 0x93, 0x00, 0xc6, 0x12, 0xed, 1146 }; 1147 static const u8 ecccdh_SECP224R1_13_test_vector_peer_pub_key[] = { 1148 0x26, 0x6d, 0x03, 0x8c, 0xc7, 0xa4, 0xfe, 0x21, 0xf6, 0xc9, 0x76, 0x31, 0x8e, 0x82, 0x7b, 0x82, 0xbb, 0x5b, 0x8f, 0x74, 0x43, 0xa5, 0x52, 0x98, 0x13, 0x65, 0x06, 0xe0, 0xdf, 0x12, 0x3d, 0x98, 0xa7, 0xa2, 0x0b, 0xbd, 0xf3, 0x94, 0x3d, 0xf2, 0xe3, 0x56, 0x34, 0x22, 0xf8, 0xc0, 0xcf, 0x74, 0xd5, 0x3a, 0xaa, 0xbd, 0xd7, 0xc9, 0x73, 0xba, 1149 }; 1150 static const u8 ecccdh_SECP224R1_13_test_vector_our_pub_key[] = { 1151 0x00, 0xdf, 0xc7, 0xec, 0x13, 0x76, 0x90, 0xcd, 0x6d, 0x12, 0xfd, 0xb2, 0xfd, 0x0b, 0x8c, 0x53, 0x14, 0x58, 0x21, 0x08, 0x76, 0x9c, 0x2b, 0x72, 0x2f, 0xfb, 0x39, 0x58, 0x5e, 0xef, 0x3d, 0xa4, 0xba, 0x45, 0x81, 0x27, 0x34, 0x6b, 0xb6, 0x40, 0x23, 0x86, 0x8b, 0xdd, 0xb7, 0x55, 0x8a, 0x2e, 0xcf, 0xc8, 0x13, 0x64, 0x5f, 0x4c, 0xe9, 0xfe, 1152 }; 1153 static const u8 ecccdh_SECP224R1_13_test_vector_shared_secret[] = { 1154 0xf8, 0x3c, 0x16, 0x66, 0x1d, 0xfc, 0xba, 0xd0, 0x21, 0xcc, 0x3b, 0x5a, 0x5a, 0xf5, 0x1d, 0x9a, 0x18, 0xdb, 0x46, 0x53, 0x86, 0x6b, 0x3f, 0xf9, 0x07, 0x87, 0xce, 0x3e, 1155 }; 1156 static const ecdh_test_case ecccdh_SECP224R1_13_test_case = { 1157 .name = "ECCCDH/SECP224R1 13", 1158 .ecdh_type = ECCCDH, 1159 .ec_str_p = &secp224r1_str_params, 1160 .our_priv_key = ecccdh_SECP224R1_13_test_vector_our_priv_key, 1161 .our_priv_key_len = sizeof(ecccdh_SECP224R1_13_test_vector_our_priv_key), 1162 .peer_pub_key = ecccdh_SECP224R1_13_test_vector_peer_pub_key, 1163 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_13_test_vector_peer_pub_key), 1164 .exp_our_pub_key = ecccdh_SECP224R1_13_test_vector_our_pub_key, 1165 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_13_test_vector_our_pub_key), 1166 .exp_shared_secret = ecccdh_SECP224R1_13_test_vector_shared_secret, 1167 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_13_test_vector_shared_secret), 1168 }; 1169 #endif /* WITH_CURVE_SECP224R1 */ 1170 1171 #ifdef WITH_CURVE_SECP224R1 1172 #define ECCCDH_SECP224R1_SELF_TEST_14 1173 /*** Tests for ECCCDH/SECP224R1 ***/ 1174 static const u8 ecccdh_SECP224R1_14_test_vector_our_priv_key[] = { 1175 0x0f, 0xf9, 0xb4, 0x85, 0x32, 0x5a, 0xb7, 0x7f, 0x29, 0xe7, 0xbc, 0x37, 0x9f, 0xed, 0x74, 0xbf, 0xac, 0x85, 0x94, 0x82, 0xda, 0x0d, 0xee, 0x75, 0x28, 0xc1, 0x9d, 0xb2, 1176 }; 1177 static const u8 ecccdh_SECP224R1_14_test_vector_peer_pub_key[] = { 1178 0xeb, 0x0a, 0x09, 0xf7, 0xa1, 0xc2, 0x36, 0xa6, 0x1f, 0x59, 0x58, 0x09, 0xec, 0x56, 0x70, 0xef, 0xd9, 0x2e, 0x45, 0x98, 0xd5, 0xe6, 0x13, 0xe0, 0x92, 0xcd, 0xfd, 0xca, 0x50, 0x78, 0x7a, 0xe2, 0xf2, 0xf1, 0x5b, 0x88, 0xbc, 0x10, 0xf7, 0xb5, 0xf0, 0xae, 0xe1, 0x41, 0x83, 0x73, 0xf1, 0x61, 0x53, 0xae, 0xbd, 0x1f, 0xba, 0x54, 0x28, 0x8d, 1179 }; 1180 static const u8 ecccdh_SECP224R1_14_test_vector_our_pub_key[] = { 1181 0x7e, 0x60, 0x3e, 0x69, 0x76, 0xdb, 0x83, 0xc3, 0x60, 0x11, 0x50, 0x8f, 0xa6, 0x95, 0xd1, 0xb5, 0x15, 0x24, 0x9e, 0x2e, 0x54, 0xb4, 0x8f, 0xcb, 0xcf, 0xb9, 0x02, 0x47, 0x01, 0x79, 0xa6, 0x00, 0xce, 0x86, 0xad, 0xfc, 0xa9, 0xb1, 0xb9, 0x31, 0xfa, 0x51, 0x73, 0xd6, 0x18, 0xda, 0x09, 0xe8, 0x41, 0x80, 0x3d, 0x19, 0xb0, 0x26, 0x42, 0x86, 1182 }; 1183 static const u8 ecccdh_SECP224R1_14_test_vector_shared_secret[] = { 1184 0xf5, 0x12, 0x58, 0xc6, 0x3f, 0x23, 0x2e, 0x55, 0xa6, 0x6a, 0xa2, 0x5e, 0xbd, 0x59, 0x7b, 0x20, 0x18, 0xd1, 0x05, 0x2c, 0x02, 0xee, 0xb6, 0x38, 0x66, 0x75, 0x80, 0x05, 1185 }; 1186 static const ecdh_test_case ecccdh_SECP224R1_14_test_case = { 1187 .name = "ECCCDH/SECP224R1 14", 1188 .ecdh_type = ECCCDH, 1189 .ec_str_p = &secp224r1_str_params, 1190 .our_priv_key = ecccdh_SECP224R1_14_test_vector_our_priv_key, 1191 .our_priv_key_len = sizeof(ecccdh_SECP224R1_14_test_vector_our_priv_key), 1192 .peer_pub_key = ecccdh_SECP224R1_14_test_vector_peer_pub_key, 1193 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_14_test_vector_peer_pub_key), 1194 .exp_our_pub_key = ecccdh_SECP224R1_14_test_vector_our_pub_key, 1195 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_14_test_vector_our_pub_key), 1196 .exp_shared_secret = ecccdh_SECP224R1_14_test_vector_shared_secret, 1197 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_14_test_vector_shared_secret), 1198 }; 1199 #endif /* WITH_CURVE_SECP224R1 */ 1200 1201 #ifdef WITH_CURVE_SECP224R1 1202 #define ECCCDH_SECP224R1_SELF_TEST_15 1203 /*** Tests for ECCCDH/SECP224R1 ***/ 1204 static const u8 ecccdh_SECP224R1_15_test_vector_our_priv_key[] = { 1205 0x19, 0xcf, 0x5f, 0xf6, 0x30, 0x64, 0x67, 0xf2, 0x8b, 0x9f, 0xe0, 0x67, 0x5a, 0x43, 0xc0, 0x58, 0x25, 0x52, 0xc8, 0xc1, 0x2e, 0x59, 0xce, 0x7c, 0x38, 0xf2, 0x92, 0xb1, 1206 }; 1207 static const u8 ecccdh_SECP224R1_15_test_vector_peer_pub_key[] = { 1208 0x6b, 0x2f, 0x6b, 0x18, 0xa5, 0x87, 0xf5, 0x62, 0xff, 0xc6, 0x1b, 0xd9, 0xb0, 0x04, 0x73, 0x22, 0x28, 0x69, 0x86, 0xa7, 0x8f, 0x1f, 0xd1, 0x39, 0xb8, 0x4f, 0x7c, 0x24, 0x70, 0x96, 0x90, 0x8e, 0x46, 0x15, 0x26, 0x6b, 0xe5, 0x9a, 0x53, 0xcd, 0x65, 0x55, 0x15, 0x05, 0x6f, 0xf9, 0x23, 0x70, 0xa6, 0x27, 0x1a, 0x5d, 0x38, 0x23, 0xd7, 0x04, 1209 }; 1210 static const u8 ecccdh_SECP224R1_15_test_vector_our_pub_key[] = { 1211 0xfc, 0x20, 0xe9, 0x06, 0xe6, 0x09, 0xc1, 0x12, 0xcf, 0xc2, 0xe0, 0xfe, 0xa6, 0x30, 0x38, 0x82, 0xc5, 0xdb, 0x94, 0xe8, 0x7e, 0x02, 0x23, 0x73, 0xab, 0x2c, 0x08, 0x2a, 0xae, 0xcd, 0xf1, 0xda, 0xa7, 0x17, 0x82, 0xbc, 0x5a, 0x26, 0xbb, 0xbd, 0x8d, 0x7e, 0x8a, 0x76, 0x49, 0x0e, 0x26, 0xab, 0xc1, 0x7d, 0xff, 0xc7, 0x74, 0xbd, 0x73, 0x41, 1212 }; 1213 static const u8 ecccdh_SECP224R1_15_test_vector_shared_secret[] = { 1214 0x7f, 0xdc, 0x96, 0x9a, 0x18, 0x6f, 0xf1, 0x84, 0x29, 0xf2, 0xa2, 0x76, 0xda, 0xc4, 0x3b, 0xee, 0xa2, 0x11, 0x82, 0xd8, 0x2c, 0xe2, 0xe5, 0xa0, 0x87, 0x65, 0x52, 0xb1, 1215 }; 1216 static const ecdh_test_case ecccdh_SECP224R1_15_test_case = { 1217 .name = "ECCCDH/SECP224R1 15", 1218 .ecdh_type = ECCCDH, 1219 .ec_str_p = &secp224r1_str_params, 1220 .our_priv_key = ecccdh_SECP224R1_15_test_vector_our_priv_key, 1221 .our_priv_key_len = sizeof(ecccdh_SECP224R1_15_test_vector_our_priv_key), 1222 .peer_pub_key = ecccdh_SECP224R1_15_test_vector_peer_pub_key, 1223 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_15_test_vector_peer_pub_key), 1224 .exp_our_pub_key = ecccdh_SECP224R1_15_test_vector_our_pub_key, 1225 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_15_test_vector_our_pub_key), 1226 .exp_shared_secret = ecccdh_SECP224R1_15_test_vector_shared_secret, 1227 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_15_test_vector_shared_secret), 1228 }; 1229 #endif /* WITH_CURVE_SECP224R1 */ 1230 1231 #ifdef WITH_CURVE_SECP224R1 1232 #define ECCCDH_SECP224R1_SELF_TEST_16 1233 /*** Tests for ECCCDH/SECP224R1 ***/ 1234 static const u8 ecccdh_SECP224R1_16_test_vector_our_priv_key[] = { 1235 0x90, 0xa1, 0x53, 0x68, 0xe3, 0x53, 0x2c, 0x0b, 0x1e, 0x51, 0xe5, 0x5d, 0x13, 0x94, 0x47, 0xc2, 0xc8, 0x9b, 0xc1, 0x60, 0x71, 0x9d, 0x69, 0x72, 0x91, 0xea, 0x7c, 0x14, 1236 }; 1237 static const u8 ecccdh_SECP224R1_16_test_vector_peer_pub_key[] = { 1238 0x32, 0x81, 0x01, 0xba, 0x82, 0x6a, 0xcd, 0x75, 0xff, 0x9f, 0x34, 0xd5, 0x57, 0x4c, 0xe0, 0xdb, 0xc9, 0x2f, 0x70, 0x9b, 0xad, 0x8d, 0x7a, 0x33, 0xc4, 0x79, 0x40, 0xc1, 0xdf, 0x39, 0xf1, 0xea, 0x88, 0x48, 0x8c, 0x55, 0xd5, 0x53, 0x81, 0x60, 0x87, 0x8b, 0x9c, 0xed, 0x18, 0xa8, 0x87, 0xea, 0x26, 0x1d, 0xd7, 0x12, 0xd1, 0x40, 0x24, 0xff, 1239 }; 1240 static const u8 ecccdh_SECP224R1_16_test_vector_our_pub_key[] = { 1241 0xc6, 0x83, 0x7d, 0x50, 0x6e, 0x97, 0x6d, 0xa7, 0xdb, 0x3a, 0xd1, 0x26, 0x7c, 0x35, 0x9d, 0xff, 0x2e, 0xa6, 0xfb, 0x0b, 0x7f, 0x7f, 0x8e, 0x77, 0x02, 0x4c, 0x59, 0xe9, 0x67, 0xeb, 0x49, 0x1d, 0x2f, 0xc8, 0xa5, 0x30, 0xc4, 0x65, 0x25, 0xd2, 0xa8, 0xb2, 0xd7, 0xc1, 0xdf, 0x5f, 0xba, 0x1a, 0xe7, 0x40, 0xa4, 0x64, 0x9c, 0x68, 0x3e, 0xe6, 1242 }; 1243 static const u8 ecccdh_SECP224R1_16_test_vector_shared_secret[] = { 1244 0x3d, 0x60, 0xab, 0x6d, 0xb2, 0xb3, 0xff, 0xe2, 0xd2, 0x9c, 0xcf, 0xf4, 0x6d, 0x05, 0x6e, 0x54, 0x23, 0x0c, 0xf3, 0x49, 0x82, 0xe2, 0x41, 0x55, 0x6e, 0xd2, 0x92, 0x0c, 1245 }; 1246 static const ecdh_test_case ecccdh_SECP224R1_16_test_case = { 1247 .name = "ECCCDH/SECP224R1 16", 1248 .ecdh_type = ECCCDH, 1249 .ec_str_p = &secp224r1_str_params, 1250 .our_priv_key = ecccdh_SECP224R1_16_test_vector_our_priv_key, 1251 .our_priv_key_len = sizeof(ecccdh_SECP224R1_16_test_vector_our_priv_key), 1252 .peer_pub_key = ecccdh_SECP224R1_16_test_vector_peer_pub_key, 1253 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_16_test_vector_peer_pub_key), 1254 .exp_our_pub_key = ecccdh_SECP224R1_16_test_vector_our_pub_key, 1255 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_16_test_vector_our_pub_key), 1256 .exp_shared_secret = ecccdh_SECP224R1_16_test_vector_shared_secret, 1257 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_16_test_vector_shared_secret), 1258 }; 1259 #endif /* WITH_CURVE_SECP224R1 */ 1260 1261 #ifdef WITH_CURVE_SECP224R1 1262 #define ECCCDH_SECP224R1_SELF_TEST_17 1263 /*** Tests for ECCCDH/SECP224R1 ***/ 1264 static const u8 ecccdh_SECP224R1_17_test_vector_our_priv_key[] = { 1265 0x8e, 0x08, 0x38, 0xe0, 0x5e, 0x17, 0x21, 0x49, 0x10, 0x67, 0xe1, 0xca, 0xbc, 0x2e, 0x80, 0x51, 0xb2, 0x90, 0xe2, 0x61, 0x6e, 0xec, 0x42, 0x7b, 0x71, 0x21, 0x89, 0x7d, 1266 }; 1267 static const u8 ecccdh_SECP224R1_17_test_vector_peer_pub_key[] = { 1268 0x00, 0x81, 0xe3, 0x42, 0x70, 0x87, 0x1e, 0x2e, 0xbb, 0xd9, 0x41, 0x83, 0xf6, 0x17, 0xb4, 0xae, 0x15, 0xf0, 0x41, 0x6d, 0xd6, 0x34, 0xfe, 0x6e, 0x93, 0x4c, 0xf3, 0xc0, 0x3a, 0x1e, 0x9f, 0x38, 0xa7, 0xb9, 0x0b, 0x73, 0x17, 0xd2, 0x6b, 0x9f, 0x63, 0x11, 0x06, 0x3a, 0xb5, 0x8b, 0x26, 0x8c, 0xf4, 0x89, 0xb2, 0xe5, 0x03, 0x86, 0xd5, 0xd6, 1269 }; 1270 static const u8 ecccdh_SECP224R1_17_test_vector_our_pub_key[] = { 1271 0xe9, 0x15, 0x0f, 0x77, 0x00, 0x75, 0x62, 0x60, 0x19, 0xe1, 0x8f, 0x95, 0x47, 0x3b, 0x71, 0xe6, 0x82, 0x80, 0x41, 0x79, 0x1d, 0x3f, 0x08, 0xd3, 0xfa, 0xee, 0xaa, 0x2b, 0x47, 0x5f, 0x70, 0x73, 0x5e, 0xaa, 0xe5, 0x23, 0x08, 0xa3, 0xb7, 0x63, 0xdc, 0x88, 0xef, 0xe1, 0x8a, 0xb5, 0x90, 0xeb, 0xaf, 0xa0, 0x35, 0xf6, 0xe0, 0x8b, 0x00, 0x1c, 1272 }; 1273 static const u8 ecccdh_SECP224R1_17_test_vector_shared_secret[] = { 1274 0x91, 0x16, 0xd7, 0x27, 0x86, 0xf4, 0xdb, 0x5d, 0xf7, 0xa8, 0xb4, 0x30, 0x78, 0xc6, 0xab, 0x91, 0x60, 0xd4, 0x23, 0x51, 0x3d, 0x35, 0xea, 0x5e, 0x25, 0x59, 0x30, 0x6d, 1275 }; 1276 static const ecdh_test_case ecccdh_SECP224R1_17_test_case = { 1277 .name = "ECCCDH/SECP224R1 17", 1278 .ecdh_type = ECCCDH, 1279 .ec_str_p = &secp224r1_str_params, 1280 .our_priv_key = ecccdh_SECP224R1_17_test_vector_our_priv_key, 1281 .our_priv_key_len = sizeof(ecccdh_SECP224R1_17_test_vector_our_priv_key), 1282 .peer_pub_key = ecccdh_SECP224R1_17_test_vector_peer_pub_key, 1283 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_17_test_vector_peer_pub_key), 1284 .exp_our_pub_key = ecccdh_SECP224R1_17_test_vector_our_pub_key, 1285 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_17_test_vector_our_pub_key), 1286 .exp_shared_secret = ecccdh_SECP224R1_17_test_vector_shared_secret, 1287 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_17_test_vector_shared_secret), 1288 }; 1289 #endif /* WITH_CURVE_SECP224R1 */ 1290 1291 #ifdef WITH_CURVE_SECP224R1 1292 #define ECCCDH_SECP224R1_SELF_TEST_18 1293 /*** Tests for ECCCDH/SECP224R1 ***/ 1294 static const u8 ecccdh_SECP224R1_18_test_vector_our_priv_key[] = { 1295 0x38, 0x10, 0x6e, 0x93, 0xf1, 0x6a, 0x38, 0x1a, 0xdb, 0x1d, 0x72, 0xce, 0xe3, 0xda, 0x66, 0xae, 0x46, 0x2a, 0xd4, 0xbb, 0xfe, 0xa9, 0xec, 0xdf, 0x35, 0xd0, 0x81, 0x4e, 1296 }; 1297 static const u8 ecccdh_SECP224R1_18_test_vector_peer_pub_key[] = { 1298 0x26, 0x23, 0x63, 0x2f, 0xdf, 0x0b, 0xd8, 0x56, 0x80, 0x5a, 0x69, 0xaa, 0x18, 0x6d, 0x41, 0x33, 0xef, 0x59, 0x04, 0xe1, 0xf6, 0x55, 0xa9, 0x72, 0xd6, 0x6c, 0xce, 0x07, 0x2c, 0xef, 0x97, 0x28, 0xdd, 0x06, 0xfb, 0x8b, 0x50, 0x15, 0x0f, 0x52, 0x9b, 0x69, 0x50, 0x76, 0xd4, 0x50, 0x79, 0x83, 0x91, 0x25, 0x85, 0xc8, 0x9b, 0xd0, 0x68, 0x2e, 1299 }; 1300 static const u8 ecccdh_SECP224R1_18_test_vector_our_pub_key[] = { 1301 0x7b, 0xe6, 0xc4, 0xc9, 0x17, 0x82, 0x9a, 0xb6, 0x57, 0xdd, 0x79, 0xe8, 0x63, 0x7d, 0x7a, 0xef, 0xd2, 0xf8, 0x1f, 0x0d, 0xe7, 0x65, 0x4d, 0x95, 0x7e, 0x97, 0x65, 0x8d, 0x43, 0x0d, 0x22, 0xd9, 0xe8, 0x43, 0x83, 0x10, 0xf6, 0x1e, 0x0d, 0x43, 0xf2, 0x5f, 0xa3, 0xe3, 0x45, 0x85, 0xf4, 0x32, 0xba, 0xad, 0x27, 0xdb, 0x30, 0x21, 0xbf, 0x0d, 1302 }; 1303 static const u8 ecccdh_SECP224R1_18_test_vector_shared_secret[] = { 1304 0x20, 0x7c, 0x53, 0xdc, 0xef, 0xac, 0x78, 0x9a, 0xaa, 0x02, 0x76, 0xd9, 0x20, 0x0b, 0x3a, 0x94, 0x0c, 0xe5, 0xf2, 0x29, 0x6f, 0x4c, 0xb2, 0xe8, 0x1a, 0x18, 0x5d, 0x3d, 1305 }; 1306 static const ecdh_test_case ecccdh_SECP224R1_18_test_case = { 1307 .name = "ECCCDH/SECP224R1 18", 1308 .ecdh_type = ECCCDH, 1309 .ec_str_p = &secp224r1_str_params, 1310 .our_priv_key = ecccdh_SECP224R1_18_test_vector_our_priv_key, 1311 .our_priv_key_len = sizeof(ecccdh_SECP224R1_18_test_vector_our_priv_key), 1312 .peer_pub_key = ecccdh_SECP224R1_18_test_vector_peer_pub_key, 1313 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_18_test_vector_peer_pub_key), 1314 .exp_our_pub_key = ecccdh_SECP224R1_18_test_vector_our_pub_key, 1315 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_18_test_vector_our_pub_key), 1316 .exp_shared_secret = ecccdh_SECP224R1_18_test_vector_shared_secret, 1317 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_18_test_vector_shared_secret), 1318 }; 1319 #endif /* WITH_CURVE_SECP224R1 */ 1320 1321 #ifdef WITH_CURVE_SECP224R1 1322 #define ECCCDH_SECP224R1_SELF_TEST_19 1323 /*** Tests for ECCCDH/SECP224R1 ***/ 1324 static const u8 ecccdh_SECP224R1_19_test_vector_our_priv_key[] = { 1325 0xe5, 0xd1, 0x71, 0x84, 0x31, 0xcf, 0x50, 0xf6, 0xcb, 0xd1, 0xbc, 0x80, 0x19, 0xfa, 0x16, 0x76, 0x2d, 0xfa, 0x12, 0xc9, 0x89, 0xe5, 0x99, 0x99, 0x77, 0xfb, 0x4e, 0xa2, 1326 }; 1327 static const u8 ecccdh_SECP224R1_19_test_vector_peer_pub_key[] = { 1328 0x8e, 0xe4, 0xd1, 0xdc, 0xc3, 0x1d, 0xee, 0x4b, 0xf6, 0xfe, 0x21, 0xca, 0x8a, 0x58, 0x77, 0x21, 0xd9, 0x10, 0xac, 0xfb, 0x12, 0x2c, 0x16, 0xc2, 0xa7, 0x7a, 0x81, 0x52, 0x4e, 0xbf, 0x32, 0x3f, 0xff, 0x04, 0xeb, 0x47, 0x70, 0x69, 0xa0, 0xac, 0x68, 0xb3, 0x45, 0xf6, 0xb1, 0xae, 0x13, 0x4e, 0xfc, 0x31, 0x94, 0x0e, 0x51, 0x3c, 0xb9, 0x9f, 1329 }; 1330 static const u8 ecccdh_SECP224R1_19_test_vector_our_pub_key[] = { 1331 0x2e, 0xa4, 0x96, 0x6e, 0x7f, 0x92, 0xed, 0x7f, 0x5c, 0xc6, 0x1f, 0xde, 0x79, 0x20, 0x45, 0xf6, 0x3b, 0x73, 0x1d, 0x6e, 0x7d, 0x0d, 0xe2, 0x57, 0x7f, 0x2d, 0x8e, 0xce, 0x1c, 0x4a, 0x7b, 0x1e, 0xde, 0x6f, 0x83, 0x91, 0x62, 0x29, 0x2d, 0xf4, 0x24, 0xbe, 0x78, 0xe8, 0x17, 0x6f, 0xb6, 0xf9, 0x42, 0xa3, 0xc0, 0x23, 0x91, 0x70, 0x0f, 0x31, 1332 }; 1333 static const u8 ecccdh_SECP224R1_19_test_vector_shared_secret[] = { 1334 0x10, 0xe4, 0x67, 0xda, 0x34, 0xf4, 0x8a, 0xd7, 0x07, 0x20, 0x05, 0xbc, 0xcd, 0x6d, 0xa1, 0xb2, 0xba, 0x3f, 0x71, 0xea, 0xfa, 0x1c, 0x39, 0x38, 0x42, 0xf9, 0x1d, 0x74, 1335 }; 1336 static const ecdh_test_case ecccdh_SECP224R1_19_test_case = { 1337 .name = "ECCCDH/SECP224R1 19", 1338 .ecdh_type = ECCCDH, 1339 .ec_str_p = &secp224r1_str_params, 1340 .our_priv_key = ecccdh_SECP224R1_19_test_vector_our_priv_key, 1341 .our_priv_key_len = sizeof(ecccdh_SECP224R1_19_test_vector_our_priv_key), 1342 .peer_pub_key = ecccdh_SECP224R1_19_test_vector_peer_pub_key, 1343 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_19_test_vector_peer_pub_key), 1344 .exp_our_pub_key = ecccdh_SECP224R1_19_test_vector_our_pub_key, 1345 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_19_test_vector_our_pub_key), 1346 .exp_shared_secret = ecccdh_SECP224R1_19_test_vector_shared_secret, 1347 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_19_test_vector_shared_secret), 1348 }; 1349 #endif /* WITH_CURVE_SECP224R1 */ 1350 1351 #ifdef WITH_CURVE_SECP224R1 1352 #define ECCCDH_SECP224R1_SELF_TEST_20 1353 /*** Tests for ECCCDH/SECP224R1 ***/ 1354 static const u8 ecccdh_SECP224R1_20_test_vector_our_priv_key[] = { 1355 0x3d, 0x63, 0x56, 0x91, 0xb6, 0x2a, 0x9a, 0x92, 0x7c, 0x63, 0x39, 0x51, 0xc9, 0x36, 0x9c, 0x88, 0x62, 0xbd, 0x21, 0x19, 0xd3, 0x09, 0x70, 0xc2, 0x64, 0x47, 0x27, 0xd6, 1356 }; 1357 static const u8 ecccdh_SECP224R1_20_test_vector_peer_pub_key[] = { 1358 0x97, 0xdc, 0xbe, 0x6d, 0x28, 0x33, 0x58, 0x82, 0xa6, 0xd1, 0x93, 0xcc, 0x54, 0xa1, 0x06, 0x3d, 0xd0, 0x77, 0x5d, 0xc3, 0x28, 0x56, 0x53, 0x00, 0xbb, 0x99, 0xe6, 0x91, 0xda, 0xd1, 0x1d, 0xd5, 0xec, 0xe8, 0xcf, 0xd9, 0xf9, 0x7c, 0x9a, 0x52, 0x6e, 0x4a, 0x15, 0x06, 0xe6, 0x35, 0x59, 0x69, 0xee, 0x87, 0x82, 0x6f, 0xc3, 0x8b, 0xcd, 0x24, 1359 }; 1360 static const u8 ecccdh_SECP224R1_20_test_vector_our_pub_key[] = { 1361 0x43, 0x8b, 0xbb, 0x98, 0x05, 0x17, 0xaf, 0xb2, 0x0b, 0xe1, 0xd6, 0x74, 0xe3, 0xac, 0x2b, 0x31, 0xce, 0xf0, 0x7a, 0x9b, 0x23, 0xfb, 0x8f, 0x6e, 0x38, 0xe0, 0xd6, 0xc0, 0x0b, 0xe5, 0xf1, 0xc4, 0x7d, 0x58, 0xd2, 0x1b, 0x6e, 0xd2, 0x84, 0x23, 0xb3, 0x2f, 0x5a, 0x94, 0x75, 0x0d, 0xa4, 0x7e, 0xdc, 0xef, 0x33, 0xea, 0x79, 0x94, 0x2a, 0xfd, 1362 }; 1363 static const u8 ecccdh_SECP224R1_20_test_vector_shared_secret[] = { 1364 0x82, 0xfd, 0x2f, 0x9c, 0x60, 0xc4, 0xf9, 0x99, 0xac, 0x00, 0xbb, 0xe6, 0x4b, 0xfc, 0x11, 0xda, 0x8f, 0xf8, 0xcd, 0xa2, 0xe4, 0x99, 0xfc, 0xed, 0x65, 0x23, 0x0b, 0xb1, 1365 }; 1366 static const ecdh_test_case ecccdh_SECP224R1_20_test_case = { 1367 .name = "ECCCDH/SECP224R1 20", 1368 .ecdh_type = ECCCDH, 1369 .ec_str_p = &secp224r1_str_params, 1370 .our_priv_key = ecccdh_SECP224R1_20_test_vector_our_priv_key, 1371 .our_priv_key_len = sizeof(ecccdh_SECP224R1_20_test_vector_our_priv_key), 1372 .peer_pub_key = ecccdh_SECP224R1_20_test_vector_peer_pub_key, 1373 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_20_test_vector_peer_pub_key), 1374 .exp_our_pub_key = ecccdh_SECP224R1_20_test_vector_our_pub_key, 1375 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_20_test_vector_our_pub_key), 1376 .exp_shared_secret = ecccdh_SECP224R1_20_test_vector_shared_secret, 1377 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_20_test_vector_shared_secret), 1378 }; 1379 #endif /* WITH_CURVE_SECP224R1 */ 1380 1381 #ifdef WITH_CURVE_SECP224R1 1382 #define ECCCDH_SECP224R1_SELF_TEST_21 1383 /*** Tests for ECCCDH/SECP224R1 ***/ 1384 static const u8 ecccdh_SECP224R1_21_test_vector_our_priv_key[] = { 1385 0xac, 0xf3, 0xc8, 0x5b, 0xbd, 0xc3, 0x79, 0xf0, 0x2f, 0x5e, 0xa3, 0x6e, 0x7f, 0x0f, 0x53, 0x09, 0x5a, 0x9e, 0x70, 0x46, 0xa2, 0x86, 0x85, 0xa8, 0x65, 0x9b, 0xf7, 0x98, 1386 }; 1387 static const u8 ecccdh_SECP224R1_21_test_vector_peer_pub_key[] = { 1388 0xce, 0x91, 0x26, 0xdd, 0x53, 0x97, 0x2d, 0xea, 0x1d, 0xe1, 0xd1, 0x1e, 0xfe, 0xf9, 0x00, 0xde, 0x34, 0xb6, 0x61, 0x85, 0x9c, 0x46, 0x48, 0xc5, 0xc0, 0xe5, 0x34, 0xf7, 0xe1, 0x13, 0xb6, 0xf2, 0xc1, 0x65, 0x9d, 0x07, 0xf2, 0x71, 0x6e, 0x64, 0xa8, 0x3c, 0x18, 0xbb, 0xce, 0x34, 0x4d, 0xd2, 0x12, 0x1f, 0xe8, 0x51, 0x68, 0xea, 0xe0, 0x85, 1389 }; 1390 static const u8 ecccdh_SECP224R1_21_test_vector_our_pub_key[] = { 1391 0xff, 0x75, 0x11, 0x21, 0x5c, 0x71, 0xd7, 0x96, 0xbd, 0x64, 0x6e, 0x84, 0x74, 0xbe, 0x44, 0x16, 0xb9, 0x16, 0x84, 0xce, 0x0d, 0x26, 0x9e, 0xf6, 0xf4, 0x22, 0x01, 0x3b, 0xb7, 0xbf, 0x5e, 0x79, 0xb5, 0xa9, 0x39, 0x3b, 0xb9, 0xea, 0x42, 0xc0, 0xbd, 0xb2, 0xd3, 0xc2, 0xdc, 0x80, 0x6e, 0x1a, 0x73, 0x06, 0xaa, 0x58, 0xe4, 0xfd, 0xbe, 0xa5, 1392 }; 1393 static const u8 ecccdh_SECP224R1_21_test_vector_shared_secret[] = { 1394 0x53, 0x0f, 0x7e, 0x7f, 0xc9, 0x32, 0x61, 0x3b, 0x29, 0xc9, 0x81, 0xf2, 0x61, 0xcb, 0x03, 0x6c, 0xba, 0x3f, 0x1d, 0xf3, 0x86, 0x4e, 0x0e, 0x1c, 0xba, 0x26, 0x85, 0xa2, 1395 }; 1396 static const ecdh_test_case ecccdh_SECP224R1_21_test_case = { 1397 .name = "ECCCDH/SECP224R1 21", 1398 .ecdh_type = ECCCDH, 1399 .ec_str_p = &secp224r1_str_params, 1400 .our_priv_key = ecccdh_SECP224R1_21_test_vector_our_priv_key, 1401 .our_priv_key_len = sizeof(ecccdh_SECP224R1_21_test_vector_our_priv_key), 1402 .peer_pub_key = ecccdh_SECP224R1_21_test_vector_peer_pub_key, 1403 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_21_test_vector_peer_pub_key), 1404 .exp_our_pub_key = ecccdh_SECP224R1_21_test_vector_our_pub_key, 1405 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_21_test_vector_our_pub_key), 1406 .exp_shared_secret = ecccdh_SECP224R1_21_test_vector_shared_secret, 1407 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_21_test_vector_shared_secret), 1408 }; 1409 #endif /* WITH_CURVE_SECP224R1 */ 1410 1411 #ifdef WITH_CURVE_SECP224R1 1412 #define ECCCDH_SECP224R1_SELF_TEST_22 1413 /*** Tests for ECCCDH/SECP224R1 ***/ 1414 static const u8 ecccdh_SECP224R1_22_test_vector_our_priv_key[] = { 1415 0xcf, 0xfd, 0x62, 0xcb, 0x00, 0xa0, 0xe3, 0x16, 0x3f, 0xbf, 0x2c, 0x39, 0x7f, 0xad, 0xc9, 0x61, 0x82, 0x10, 0xf8, 0x6b, 0x4f, 0x54, 0xa6, 0x75, 0x28, 0x73, 0x05, 0xf0, 1416 }; 1417 static const u8 ecccdh_SECP224R1_22_test_vector_peer_pub_key[] = { 1418 0x84, 0x41, 0x99, 0x67, 0xd6, 0xcf, 0xad, 0x41, 0xe7, 0x5a, 0x02, 0xb6, 0xda, 0x60, 0x5a, 0x97, 0x94, 0x9a, 0x18, 0x3a, 0x97, 0xc3, 0x06, 0xc4, 0xb4, 0x6e, 0x66, 0xa5, 0x5c, 0xc9, 0xb2, 0x59, 0x71, 0x8b, 0x1b, 0xc8, 0xb1, 0x44, 0xfd, 0xe6, 0x33, 0xa8, 0x94, 0x61, 0x6f, 0xfd, 0x59, 0xa3, 0xa6, 0xd5, 0xd8, 0xe9, 0x42, 0xc7, 0xcb, 0xb7, 1419 }; 1420 static const u8 ecccdh_SECP224R1_22_test_vector_our_pub_key[] = { 1421 0x04, 0xbf, 0x4d, 0x94, 0x8f, 0x44, 0x30, 0xd1, 0x8b, 0x4e, 0xd6, 0xc9, 0x6d, 0xba, 0xf9, 0x81, 0xfa, 0x11, 0xa4, 0x03, 0xed, 0x16, 0x88, 0x7f, 0x06, 0x75, 0x49, 0x81, 0x7c, 0x13, 0x26, 0xa9, 0xce, 0xf5, 0x1f, 0x79, 0xd4, 0xe7, 0x83, 0x03, 0xd6, 0x06, 0x4b, 0x45, 0x9f, 0x61, 0x25, 0x84, 0xac, 0x2f, 0xdf, 0x59, 0x3d, 0x7d, 0x5d, 0x84, 1422 }; 1423 static const u8 ecccdh_SECP224R1_22_test_vector_shared_secret[] = { 1424 0x49, 0xf6, 0xfd, 0x01, 0x39, 0x24, 0x8e, 0xf4, 0xdf, 0x2d, 0xb0, 0x5d, 0x13, 0x19, 0xbd, 0x5b, 0x14, 0x89, 0xe2, 0x49, 0x82, 0x7a, 0x45, 0xa8, 0xa5, 0xf1, 0x24, 0x27, 1425 }; 1426 static const ecdh_test_case ecccdh_SECP224R1_22_test_case = { 1427 .name = "ECCCDH/SECP224R1 22", 1428 .ecdh_type = ECCCDH, 1429 .ec_str_p = &secp224r1_str_params, 1430 .our_priv_key = ecccdh_SECP224R1_22_test_vector_our_priv_key, 1431 .our_priv_key_len = sizeof(ecccdh_SECP224R1_22_test_vector_our_priv_key), 1432 .peer_pub_key = ecccdh_SECP224R1_22_test_vector_peer_pub_key, 1433 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_22_test_vector_peer_pub_key), 1434 .exp_our_pub_key = ecccdh_SECP224R1_22_test_vector_our_pub_key, 1435 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_22_test_vector_our_pub_key), 1436 .exp_shared_secret = ecccdh_SECP224R1_22_test_vector_shared_secret, 1437 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_22_test_vector_shared_secret), 1438 }; 1439 #endif /* WITH_CURVE_SECP224R1 */ 1440 1441 #ifdef WITH_CURVE_SECP224R1 1442 #define ECCCDH_SECP224R1_SELF_TEST_23 1443 /*** Tests for ECCCDH/SECP224R1 ***/ 1444 static const u8 ecccdh_SECP224R1_23_test_vector_our_priv_key[] = { 1445 0x85, 0xf9, 0x03, 0xe4, 0x39, 0x43, 0xd1, 0x3c, 0x68, 0x93, 0x2e, 0x71, 0x0e, 0x80, 0xde, 0x52, 0xcb, 0xc0, 0xb8, 0xf1, 0xa1, 0x41, 0x8e, 0xa4, 0xda, 0x07, 0x92, 0x99, 1446 }; 1447 static const u8 ecccdh_SECP224R1_23_test_vector_peer_pub_key[] = { 1448 0x7c, 0x9c, 0xac, 0x35, 0x76, 0x80, 0x63, 0xc2, 0x82, 0x7f, 0x60, 0xa7, 0xf5, 0x13, 0x88, 0xf2, 0xa8, 0xf4, 0xb7, 0xf8, 0xcd, 0x73, 0x6b, 0xd6, 0xbc, 0x33, 0x74, 0x77, 0x29, 0xee, 0x6b, 0x84, 0x9c, 0x60, 0x25, 0xd5, 0x77, 0xdb, 0xcc, 0x55, 0xfb, 0xd1, 0x70, 0x18, 0xf4, 0xed, 0xbc, 0x2e, 0xf1, 0x05, 0xb0, 0x04, 0xd6, 0x25, 0x7b, 0xcd, 1449 }; 1450 static const u8 ecccdh_SECP224R1_23_test_vector_our_pub_key[] = { 1451 0x97, 0x0a, 0x4a, 0x7e, 0x01, 0xd4, 0x18, 0x84, 0x97, 0xce, 0xb4, 0x69, 0x55, 0xeb, 0x1b, 0x84, 0x2d, 0x90, 0x85, 0x81, 0x9a, 0x9b, 0x92, 0x5c, 0x84, 0x52, 0x9d, 0x3d, 0xdf, 0xa2, 0x52, 0x64, 0x80, 0xf8, 0x33, 0xea, 0x0e, 0xdb, 0xd2, 0x04, 0xe4, 0xe3, 0x65, 0xfe, 0xf3, 0x47, 0x28, 0x88, 0xfe, 0x7d, 0x96, 0x91, 0xc3, 0xeb, 0xc0, 0x9f, 1452 }; 1453 static const u8 ecccdh_SECP224R1_23_test_vector_shared_secret[] = { 1454 0x8f, 0x7e, 0x34, 0xe5, 0x97, 0xae, 0x80, 0x93, 0xb9, 0x82, 0x70, 0xa7, 0x4a, 0x8d, 0xfc, 0xdb, 0xed, 0x45, 0x7f, 0x42, 0xf4, 0x3d, 0xf4, 0x87, 0xc5, 0x48, 0x71, 0x61, 1455 }; 1456 static const ecdh_test_case ecccdh_SECP224R1_23_test_case = { 1457 .name = "ECCCDH/SECP224R1 23", 1458 .ecdh_type = ECCCDH, 1459 .ec_str_p = &secp224r1_str_params, 1460 .our_priv_key = ecccdh_SECP224R1_23_test_vector_our_priv_key, 1461 .our_priv_key_len = sizeof(ecccdh_SECP224R1_23_test_vector_our_priv_key), 1462 .peer_pub_key = ecccdh_SECP224R1_23_test_vector_peer_pub_key, 1463 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_23_test_vector_peer_pub_key), 1464 .exp_our_pub_key = ecccdh_SECP224R1_23_test_vector_our_pub_key, 1465 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_23_test_vector_our_pub_key), 1466 .exp_shared_secret = ecccdh_SECP224R1_23_test_vector_shared_secret, 1467 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_23_test_vector_shared_secret), 1468 }; 1469 #endif /* WITH_CURVE_SECP224R1 */ 1470 1471 #ifdef WITH_CURVE_SECP224R1 1472 #define ECCCDH_SECP224R1_SELF_TEST_24 1473 /*** Tests for ECCCDH/SECP224R1 ***/ 1474 static const u8 ecccdh_SECP224R1_24_test_vector_our_priv_key[] = { 1475 0xcc, 0xe6, 0x48, 0x91, 0xa3, 0xd0, 0x12, 0x9f, 0xee, 0x0d, 0x4a, 0x96, 0xcf, 0xbe, 0x7a, 0xc4, 0x70, 0xb8, 0x5e, 0x96, 0x75, 0x29, 0x05, 0x7c, 0xfa, 0x31, 0xa1, 0xd9, 1476 }; 1477 static const u8 ecccdh_SECP224R1_24_test_vector_peer_pub_key[] = { 1478 0x08, 0x5a, 0x76, 0x42, 0xad, 0x8e, 0x59, 0xb1, 0xa3, 0xe8, 0x72, 0x6a, 0x75, 0x47, 0xaf, 0xbe, 0xcf, 0xfd, 0xac, 0x1d, 0xab, 0x7e, 0x57, 0x23, 0x0c, 0x6a, 0x9d, 0xf4, 0xf9, 0x1c, 0x36, 0xd8, 0x81, 0xfe, 0x9b, 0x80, 0x47, 0xa3, 0x53, 0x07, 0x13, 0x55, 0x4a, 0x1a, 0xf4, 0xc2, 0x5c, 0x5a, 0x8e, 0x65, 0x4d, 0xcd, 0xcf, 0x68, 0x9f, 0x2e, 1479 }; 1480 static const u8 ecccdh_SECP224R1_24_test_vector_our_pub_key[] = { 1481 0xa6, 0xb2, 0x96, 0x32, 0xdb, 0x94, 0xda, 0x21, 0x25, 0xdc, 0x1c, 0xf8, 0x0e, 0x03, 0x70, 0x26, 0x87, 0xb2, 0xac, 0xc1, 0x12, 0x20, 0x22, 0xfa, 0x21, 0x74, 0x76, 0x5a, 0x61, 0x72, 0x3e, 0xdd, 0x73, 0xe1, 0x0d, 0xae, 0xd7, 0x37, 0x75, 0x27, 0x8f, 0x19, 0x58, 0xba, 0x56, 0xf1, 0xfc, 0x9d, 0x08, 0x5e, 0xbc, 0x2b, 0x64, 0xc8, 0x4f, 0xe5, 1482 }; 1483 static const u8 ecccdh_SECP224R1_24_test_vector_shared_secret[] = { 1484 0x71, 0x95, 0x4e, 0x22, 0x61, 0xe8, 0x51, 0x0b, 0xe1, 0xa0, 0x60, 0x73, 0x36, 0x71, 0xd2, 0xe9, 0xd0, 0xa2, 0xd0, 0x12, 0xeb, 0x4e, 0x09, 0x55, 0x6d, 0x69, 0x7d, 0x2a, 1485 }; 1486 static const ecdh_test_case ecccdh_SECP224R1_24_test_case = { 1487 .name = "ECCCDH/SECP224R1 24", 1488 .ecdh_type = ECCCDH, 1489 .ec_str_p = &secp224r1_str_params, 1490 .our_priv_key = ecccdh_SECP224R1_24_test_vector_our_priv_key, 1491 .our_priv_key_len = sizeof(ecccdh_SECP224R1_24_test_vector_our_priv_key), 1492 .peer_pub_key = ecccdh_SECP224R1_24_test_vector_peer_pub_key, 1493 .peer_pub_key_len = sizeof(ecccdh_SECP224R1_24_test_vector_peer_pub_key), 1494 .exp_our_pub_key = ecccdh_SECP224R1_24_test_vector_our_pub_key, 1495 .exp_our_pub_key_len = sizeof(ecccdh_SECP224R1_24_test_vector_our_pub_key), 1496 .exp_shared_secret = ecccdh_SECP224R1_24_test_vector_shared_secret, 1497 .exp_shared_secret_len = sizeof(ecccdh_SECP224R1_24_test_vector_shared_secret), 1498 }; 1499 #endif /* WITH_CURVE_SECP224R1 */ 1500 1501 #ifdef WITH_CURVE_SECP256R1 1502 #define ECCCDH_SECP256R1_SELF_TEST_0 1503 /*** Tests for ECCCDH/SECP256R1 ***/ 1504 static const u8 ecccdh_SECP256R1_0_test_vector_our_priv_key[] = { 1505 0x7d, 0x7d, 0xc5, 0xf7, 0x1e, 0xb2, 0x9d, 0xda, 0xf8, 0x0d, 0x62, 0x14, 0x63, 0x2e, 0xea, 0xe0, 0x3d, 0x90, 0x58, 0xaf, 0x1f, 0xb6, 0xd2, 0x2e, 0xd8, 0x0b, 0xad, 0xb6, 0x2b, 0xc1, 0xa5, 0x34, 1506 }; 1507 static const u8 ecccdh_SECP256R1_0_test_vector_peer_pub_key[] = { 1508 0x70, 0x0c, 0x48, 0xf7, 0x7f, 0x56, 0x58, 0x4c, 0x5c, 0xc6, 0x32, 0xca, 0x65, 0x64, 0x0d, 0xb9, 0x1b, 0x6b, 0xac, 0xce, 0x3a, 0x4d, 0xf6, 0xb4, 0x2c, 0xe7, 0xcc, 0x83, 0x88, 0x33, 0xd2, 0x87, 0xdb, 0x71, 0xe5, 0x09, 0xe3, 0xfd, 0x9b, 0x06, 0x0d, 0xdb, 0x20, 0xba, 0x5c, 0x51, 0xdc, 0xc5, 0x94, 0x8d, 0x46, 0xfb, 0xf6, 0x40, 0xdf, 0xe0, 0x44, 0x17, 0x82, 0xca, 0xb8, 0x5f, 0xa4, 0xac, 1509 }; 1510 static const u8 ecccdh_SECP256R1_0_test_vector_our_pub_key[] = { 1511 0xea, 0xd2, 0x18, 0x59, 0x01, 0x19, 0xe8, 0x87, 0x6b, 0x29, 0x14, 0x6f, 0xf8, 0x9c, 0xa6, 0x17, 0x70, 0xc4, 0xed, 0xbb, 0xf9, 0x7d, 0x38, 0xce, 0x38, 0x5e, 0xd2, 0x81, 0xd8, 0xa6, 0xb2, 0x30, 0x28, 0xaf, 0x61, 0x28, 0x1f, 0xd3, 0x5e, 0x2f, 0xa7, 0x00, 0x25, 0x23, 0xac, 0xc8, 0x5a, 0x42, 0x9c, 0xb0, 0x6e, 0xe6, 0x64, 0x83, 0x25, 0x38, 0x9f, 0x59, 0xed, 0xfc, 0xe1, 0x40, 0x51, 0x41, 1512 }; 1513 static const u8 ecccdh_SECP256R1_0_test_vector_shared_secret[] = { 1514 0x46, 0xfc, 0x62, 0x10, 0x64, 0x20, 0xff, 0x01, 0x2e, 0x54, 0xa4, 0x34, 0xfb, 0xdd, 0x2d, 0x25, 0xcc, 0xc5, 0x85, 0x20, 0x60, 0x56, 0x1e, 0x68, 0x04, 0x0d, 0xd7, 0x77, 0x89, 0x97, 0xbd, 0x7b, 1515 }; 1516 static const ecdh_test_case ecccdh_SECP256R1_0_test_case = { 1517 .name = "ECCCDH/SECP256R1 0", 1518 .ecdh_type = ECCCDH, 1519 .ec_str_p = &secp256r1_str_params, 1520 .our_priv_key = ecccdh_SECP256R1_0_test_vector_our_priv_key, 1521 .our_priv_key_len = sizeof(ecccdh_SECP256R1_0_test_vector_our_priv_key), 1522 .peer_pub_key = ecccdh_SECP256R1_0_test_vector_peer_pub_key, 1523 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_0_test_vector_peer_pub_key), 1524 .exp_our_pub_key = ecccdh_SECP256R1_0_test_vector_our_pub_key, 1525 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_0_test_vector_our_pub_key), 1526 .exp_shared_secret = ecccdh_SECP256R1_0_test_vector_shared_secret, 1527 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_0_test_vector_shared_secret), 1528 }; 1529 #endif /* WITH_CURVE_SECP256R1 */ 1530 1531 #ifdef WITH_CURVE_SECP256R1 1532 #define ECCCDH_SECP256R1_SELF_TEST_1 1533 /*** Tests for ECCCDH/SECP256R1 ***/ 1534 static const u8 ecccdh_SECP256R1_1_test_vector_our_priv_key[] = { 1535 0x38, 0xf6, 0x5d, 0x6d, 0xce, 0x47, 0x67, 0x60, 0x44, 0xd5, 0x8c, 0xe5, 0x13, 0x95, 0x82, 0xd5, 0x68, 0xf6, 0x4b, 0xb1, 0x60, 0x98, 0xd1, 0x79, 0xdb, 0xab, 0x07, 0x74, 0x1d, 0xd5, 0xca, 0xf5, 1536 }; 1537 static const u8 ecccdh_SECP256R1_1_test_vector_peer_pub_key[] = { 1538 0x80, 0x9f, 0x04, 0x28, 0x9c, 0x64, 0x34, 0x8c, 0x01, 0x51, 0x5e, 0xb0, 0x3d, 0x5c, 0xe7, 0xac, 0x1a, 0x8c, 0xb9, 0x49, 0x8f, 0x5c, 0xaa, 0x50, 0x19, 0x7e, 0x58, 0xd4, 0x3a, 0x86, 0xa7, 0xae, 0xb2, 0x9d, 0x84, 0xe8, 0x11, 0x19, 0x7f, 0x25, 0xeb, 0xa8, 0xf5, 0x19, 0x40, 0x92, 0xcb, 0x6f, 0xf4, 0x40, 0xe2, 0x6d, 0x44, 0x21, 0x01, 0x13, 0x72, 0x46, 0x1f, 0x57, 0x92, 0x71, 0xcd, 0xa3, 1539 }; 1540 static const u8 ecccdh_SECP256R1_1_test_vector_our_pub_key[] = { 1541 0x11, 0x9f, 0x2f, 0x04, 0x79, 0x02, 0x78, 0x2a, 0xb0, 0xc9, 0xe2, 0x7a, 0x54, 0xaf, 0xf5, 0xeb, 0x9b, 0x96, 0x48, 0x29, 0xca, 0x99, 0xc0, 0x6b, 0x02, 0xdd, 0xba, 0x95, 0xb0, 0xa3, 0xf6, 0xd0, 0x8f, 0x52, 0xb7, 0x26, 0x66, 0x4c, 0xac, 0x36, 0x6f, 0xc9, 0x8a, 0xc7, 0xa0, 0x12, 0xb2, 0x68, 0x2c, 0xbd, 0x96, 0x2e, 0x5a, 0xcb, 0x54, 0x46, 0x71, 0xd4, 0x1b, 0x94, 0x45, 0x70, 0x4d, 0x1d, 1542 }; 1543 static const u8 ecccdh_SECP256R1_1_test_vector_shared_secret[] = { 1544 0x05, 0x7d, 0x63, 0x60, 0x96, 0xcb, 0x80, 0xb6, 0x7a, 0x8c, 0x03, 0x8c, 0x89, 0x0e, 0x88, 0x7d, 0x1a, 0xdf, 0xa4, 0x19, 0x5e, 0x9b, 0x3c, 0xe2, 0x41, 0xc8, 0xa7, 0x78, 0xc5, 0x9c, 0xda, 0x67, 1545 }; 1546 static const ecdh_test_case ecccdh_SECP256R1_1_test_case = { 1547 .name = "ECCCDH/SECP256R1 1", 1548 .ecdh_type = ECCCDH, 1549 .ec_str_p = &secp256r1_str_params, 1550 .our_priv_key = ecccdh_SECP256R1_1_test_vector_our_priv_key, 1551 .our_priv_key_len = sizeof(ecccdh_SECP256R1_1_test_vector_our_priv_key), 1552 .peer_pub_key = ecccdh_SECP256R1_1_test_vector_peer_pub_key, 1553 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_1_test_vector_peer_pub_key), 1554 .exp_our_pub_key = ecccdh_SECP256R1_1_test_vector_our_pub_key, 1555 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_1_test_vector_our_pub_key), 1556 .exp_shared_secret = ecccdh_SECP256R1_1_test_vector_shared_secret, 1557 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_1_test_vector_shared_secret), 1558 }; 1559 #endif /* WITH_CURVE_SECP256R1 */ 1560 1561 #ifdef WITH_CURVE_SECP256R1 1562 #define ECCCDH_SECP256R1_SELF_TEST_2 1563 /*** Tests for ECCCDH/SECP256R1 ***/ 1564 static const u8 ecccdh_SECP256R1_2_test_vector_our_priv_key[] = { 1565 0x1a, 0xcc, 0xfa, 0xf1, 0xb9, 0x77, 0x12, 0xb8, 0x5a, 0x6f, 0x54, 0xb1, 0x48, 0x98, 0x5a, 0x1b, 0xdc, 0x4c, 0x9b, 0xec, 0x0b, 0xd2, 0x58, 0xca, 0xd4, 0xb3, 0xd6, 0x03, 0xf4, 0x9f, 0x32, 0xc8, 1566 }; 1567 static const u8 ecccdh_SECP256R1_2_test_vector_peer_pub_key[] = { 1568 0xa2, 0x33, 0x9c, 0x12, 0xd4, 0xa0, 0x3c, 0x33, 0x54, 0x6d, 0xe5, 0x33, 0x26, 0x8b, 0x4a, 0xd6, 0x67, 0xde, 0xbf, 0x45, 0x8b, 0x46, 0x4d, 0x77, 0x44, 0x36, 0x36, 0x44, 0x0e, 0xe7, 0xfe, 0xc3, 0xef, 0x48, 0xa3, 0xab, 0x26, 0xe2, 0x02, 0x20, 0xbc, 0xda, 0x2c, 0x18, 0x51, 0x07, 0x68, 0x39, 0xda, 0xe8, 0x8e, 0xae, 0x96, 0x28, 0x69, 0xa4, 0x97, 0xbf, 0x73, 0xcb, 0x66, 0xfa, 0xf5, 0x36, 1569 }; 1570 static const u8 ecccdh_SECP256R1_2_test_vector_our_pub_key[] = { 1571 0xd9, 0xf2, 0xb7, 0x9c, 0x17, 0x28, 0x45, 0xbf, 0xdb, 0x56, 0x0b, 0xbb, 0x01, 0x44, 0x7c, 0xa5, 0xec, 0xc0, 0x47, 0x0a, 0x09, 0x51, 0x3b, 0x61, 0x26, 0x90, 0x2c, 0x6b, 0x4f, 0x8d, 0x10, 0x51, 0xf8, 0x15, 0xef, 0x5e, 0xc3, 0x21, 0x28, 0xd3, 0x48, 0x78, 0x34, 0x76, 0x46, 0x78, 0x70, 0x2e, 0x64, 0xe1, 0x64, 0xff, 0x73, 0x15, 0x18, 0x5e, 0x23, 0xaf, 0xf5, 0xfa, 0xcd, 0x96, 0xd7, 0xbc, 1572 }; 1573 static const u8 ecccdh_SECP256R1_2_test_vector_shared_secret[] = { 1574 0x2d, 0x45, 0x7b, 0x78, 0xb4, 0x61, 0x41, 0x32, 0x47, 0x76, 0x18, 0xa5, 0xb0, 0x77, 0x96, 0x5e, 0xc9, 0x07, 0x30, 0xa8, 0xc8, 0x1a, 0x1c, 0x75, 0xd6, 0xd4, 0xec, 0x68, 0x00, 0x5d, 0x67, 0xec, 1575 }; 1576 static const ecdh_test_case ecccdh_SECP256R1_2_test_case = { 1577 .name = "ECCCDH/SECP256R1 2", 1578 .ecdh_type = ECCCDH, 1579 .ec_str_p = &secp256r1_str_params, 1580 .our_priv_key = ecccdh_SECP256R1_2_test_vector_our_priv_key, 1581 .our_priv_key_len = sizeof(ecccdh_SECP256R1_2_test_vector_our_priv_key), 1582 .peer_pub_key = ecccdh_SECP256R1_2_test_vector_peer_pub_key, 1583 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_2_test_vector_peer_pub_key), 1584 .exp_our_pub_key = ecccdh_SECP256R1_2_test_vector_our_pub_key, 1585 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_2_test_vector_our_pub_key), 1586 .exp_shared_secret = ecccdh_SECP256R1_2_test_vector_shared_secret, 1587 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_2_test_vector_shared_secret), 1588 }; 1589 #endif /* WITH_CURVE_SECP256R1 */ 1590 1591 #ifdef WITH_CURVE_SECP256R1 1592 #define ECCCDH_SECP256R1_SELF_TEST_3 1593 /*** Tests for ECCCDH/SECP256R1 ***/ 1594 static const u8 ecccdh_SECP256R1_3_test_vector_our_priv_key[] = { 1595 0x20, 0x7c, 0x43, 0xa7, 0x9b, 0xfe, 0xe0, 0x3d, 0xb6, 0xf4, 0xb9, 0x44, 0xf5, 0x3d, 0x2f, 0xb7, 0x6c, 0xc4, 0x9e, 0xf1, 0xc9, 0xc4, 0xd3, 0x4d, 0x51, 0xb6, 0xc6, 0x5c, 0x4d, 0xb6, 0x93, 0x2d, 1596 }; 1597 static const u8 ecccdh_SECP256R1_3_test_vector_peer_pub_key[] = { 1598 0xdf, 0x39, 0x89, 0xb9, 0xfa, 0x55, 0x49, 0x57, 0x19, 0xb3, 0xcf, 0x46, 0xdc, 0xcd, 0x28, 0xb5, 0x15, 0x3f, 0x78, 0x08, 0x19, 0x1d, 0xd5, 0x18, 0xef, 0xf0, 0xc3, 0xcf, 0xf2, 0xb7, 0x05, 0xed, 0x42, 0x22, 0x94, 0xff, 0x46, 0x00, 0x34, 0x29, 0xd7, 0x39, 0xa3, 0x32, 0x06, 0xc8, 0x75, 0x25, 0x52, 0xc8, 0xba, 0x54, 0xa2, 0x70, 0xde, 0xfc, 0x06, 0xe2, 0x21, 0xe0, 0xfe, 0xaf, 0x6a, 0xc4, 1599 }; 1600 static const u8 ecccdh_SECP256R1_3_test_vector_our_pub_key[] = { 1601 0x24, 0x27, 0x7c, 0x33, 0xf4, 0x50, 0x46, 0x2d, 0xcb, 0x3d, 0x48, 0x01, 0xd5, 0x7b, 0x9c, 0xed, 0x05, 0x18, 0x8f, 0x16, 0xc2, 0x8e, 0xda, 0x87, 0x32, 0x58, 0x04, 0x8c, 0xd1, 0x60, 0x7e, 0x0d, 0xc4, 0x78, 0x97, 0x53, 0xe2, 0xb1, 0xf6, 0x3b, 0x32, 0xff, 0x01, 0x4e, 0xc4, 0x2c, 0xd6, 0xa6, 0x9f, 0xac, 0x81, 0xdf, 0xe6, 0xd0, 0xd6, 0xfd, 0x4a, 0xf3, 0x72, 0xae, 0x27, 0xc4, 0x6f, 0x88, 1602 }; 1603 static const u8 ecccdh_SECP256R1_3_test_vector_shared_secret[] = { 1604 0x96, 0x44, 0x12, 0x59, 0x53, 0x4b, 0x80, 0xf6, 0xae, 0xe3, 0xd2, 0x87, 0xa6, 0xbb, 0x17, 0xb5, 0x09, 0x4d, 0xd4, 0x27, 0x7d, 0x9e, 0x29, 0x4f, 0x8f, 0xe7, 0x3e, 0x48, 0xbf, 0x2a, 0x00, 0x24, 1605 }; 1606 static const ecdh_test_case ecccdh_SECP256R1_3_test_case = { 1607 .name = "ECCCDH/SECP256R1 3", 1608 .ecdh_type = ECCCDH, 1609 .ec_str_p = &secp256r1_str_params, 1610 .our_priv_key = ecccdh_SECP256R1_3_test_vector_our_priv_key, 1611 .our_priv_key_len = sizeof(ecccdh_SECP256R1_3_test_vector_our_priv_key), 1612 .peer_pub_key = ecccdh_SECP256R1_3_test_vector_peer_pub_key, 1613 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_3_test_vector_peer_pub_key), 1614 .exp_our_pub_key = ecccdh_SECP256R1_3_test_vector_our_pub_key, 1615 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_3_test_vector_our_pub_key), 1616 .exp_shared_secret = ecccdh_SECP256R1_3_test_vector_shared_secret, 1617 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_3_test_vector_shared_secret), 1618 }; 1619 #endif /* WITH_CURVE_SECP256R1 */ 1620 1621 #ifdef WITH_CURVE_SECP256R1 1622 #define ECCCDH_SECP256R1_SELF_TEST_4 1623 /*** Tests for ECCCDH/SECP256R1 ***/ 1624 static const u8 ecccdh_SECP256R1_4_test_vector_our_priv_key[] = { 1625 0x59, 0x13, 0x7e, 0x38, 0x15, 0x23, 0x50, 0xb1, 0x95, 0xc9, 0x71, 0x8d, 0x39, 0x67, 0x3d, 0x51, 0x98, 0x38, 0x05, 0x5a, 0xd9, 0x08, 0xdd, 0x47, 0x57, 0x15, 0x2f, 0xd8, 0x25, 0x5c, 0x09, 0xbf, 1626 }; 1627 static const u8 ecccdh_SECP256R1_4_test_vector_peer_pub_key[] = { 1628 0x41, 0x19, 0x2d, 0x28, 0x13, 0xe7, 0x95, 0x61, 0xe6, 0xa1, 0xd6, 0xf5, 0x3c, 0x8b, 0xc1, 0xa4, 0x33, 0xa1, 0x99, 0xc8, 0x35, 0xe1, 0x41, 0xb0, 0x5a, 0x74, 0xa9, 0x7b, 0x0f, 0xae, 0xb9, 0x22, 0x1a, 0xf9, 0x8c, 0xc4, 0x5e, 0x98, 0xa7, 0xe0, 0x41, 0xb0, 0x1c, 0xf3, 0x5f, 0x46, 0x2b, 0x75, 0x62, 0x28, 0x13, 0x51, 0xc8, 0xeb, 0xf3, 0xff, 0xa0, 0x2e, 0x33, 0xa0, 0x72, 0x2a, 0x13, 0x28, 1629 }; 1630 static const u8 ecccdh_SECP256R1_4_test_vector_our_pub_key[] = { 1631 0xa8, 0xc5, 0xfd, 0xce, 0x8b, 0x62, 0xc5, 0xad, 0xa5, 0x98, 0xf1, 0x41, 0xad, 0xb3, 0xb2, 0x6c, 0xf2, 0x54, 0xc2, 0x80, 0xb2, 0x85, 0x7a, 0x63, 0xd2, 0xad, 0x78, 0x3a, 0x73, 0x11, 0x5f, 0x6b, 0x80, 0x6e, 0x1a, 0xaf, 0xec, 0x4a, 0xf8, 0x0a, 0x0d, 0x78, 0x6b, 0x3d, 0xe4, 0x53, 0x75, 0xb5, 0x17, 0xa7, 0xe5, 0xb5, 0x1f, 0xfb, 0x2c, 0x35, 0x65, 0x37, 0xc9, 0xe6, 0xef, 0x22, 0x7d, 0x4a, 1632 }; 1633 static const u8 ecccdh_SECP256R1_4_test_vector_shared_secret[] = { 1634 0x19, 0xd4, 0x4c, 0x8d, 0x63, 0xe8, 0xe8, 0xdd, 0x12, 0xc2, 0x2a, 0x87, 0xb8, 0xcd, 0x4e, 0xce, 0x27, 0xac, 0xdd, 0xe0, 0x4d, 0xbf, 0x47, 0xf7, 0xf2, 0x75, 0x37, 0xa6, 0x99, 0x9a, 0x8e, 0x62, 1635 }; 1636 static const ecdh_test_case ecccdh_SECP256R1_4_test_case = { 1637 .name = "ECCCDH/SECP256R1 4", 1638 .ecdh_type = ECCCDH, 1639 .ec_str_p = &secp256r1_str_params, 1640 .our_priv_key = ecccdh_SECP256R1_4_test_vector_our_priv_key, 1641 .our_priv_key_len = sizeof(ecccdh_SECP256R1_4_test_vector_our_priv_key), 1642 .peer_pub_key = ecccdh_SECP256R1_4_test_vector_peer_pub_key, 1643 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_4_test_vector_peer_pub_key), 1644 .exp_our_pub_key = ecccdh_SECP256R1_4_test_vector_our_pub_key, 1645 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_4_test_vector_our_pub_key), 1646 .exp_shared_secret = ecccdh_SECP256R1_4_test_vector_shared_secret, 1647 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_4_test_vector_shared_secret), 1648 }; 1649 #endif /* WITH_CURVE_SECP256R1 */ 1650 1651 #ifdef WITH_CURVE_SECP256R1 1652 #define ECCCDH_SECP256R1_SELF_TEST_5 1653 /*** Tests for ECCCDH/SECP256R1 ***/ 1654 static const u8 ecccdh_SECP256R1_5_test_vector_our_priv_key[] = { 1655 0xf5, 0xf8, 0xe0, 0x17, 0x46, 0x10, 0xa6, 0x61, 0x27, 0x79, 0x79, 0xb5, 0x8c, 0xe5, 0xc9, 0x0f, 0xee, 0x6c, 0x9b, 0x3b, 0xb3, 0x46, 0xa9, 0x0a, 0x71, 0x96, 0x25, 0x5e, 0x40, 0xb1, 0x32, 0xef, 1656 }; 1657 static const u8 ecccdh_SECP256R1_5_test_vector_peer_pub_key[] = { 1658 0x33, 0xe8, 0x20, 0x92, 0xa0, 0xf1, 0xfb, 0x38, 0xf5, 0x64, 0x9d, 0x58, 0x67, 0xfb, 0xa2, 0x8b, 0x50, 0x31, 0x72, 0xb7, 0x03, 0x55, 0x74, 0xbf, 0x8e, 0x5b, 0x71, 0x00, 0xa3, 0x05, 0x27, 0x92, 0xf2, 0xcf, 0x6b, 0x60, 0x1e, 0x0a, 0x05, 0x94, 0x5e, 0x33, 0x55, 0x50, 0xbf, 0x64, 0x8d, 0x78, 0x2f, 0x46, 0x18, 0x6c, 0x77, 0x2c, 0x0f, 0x20, 0xd3, 0xcd, 0x0d, 0x6b, 0x8c, 0xa1, 0x4b, 0x2f, 1659 }; 1660 static const u8 ecccdh_SECP256R1_5_test_vector_our_pub_key[] = { 1661 0x7b, 0x86, 0x1d, 0xcd, 0x28, 0x44, 0xa5, 0xa8, 0x36, 0x3f, 0x6b, 0x8e, 0xf8, 0xd4, 0x93, 0x64, 0x0f, 0x55, 0x87, 0x92, 0x17, 0x18, 0x9d, 0x80, 0x32, 0x6a, 0xad, 0x94, 0x80, 0xdf, 0xc1, 0x49, 0xc4, 0x67, 0x5b, 0x45, 0xee, 0xb3, 0x06, 0x40, 0x5f, 0x6c, 0x33, 0xc3, 0x8b, 0xc6, 0x9e, 0xb2, 0xbd, 0xec, 0x9b, 0x75, 0xad, 0x5a, 0xf4, 0x70, 0x6a, 0xab, 0x84, 0x54, 0x3b, 0x9c, 0xc6, 0x3a, 1662 }; 1663 static const u8 ecccdh_SECP256R1_5_test_vector_shared_secret[] = { 1664 0x66, 0x4e, 0x45, 0xd5, 0xbb, 0xa4, 0xac, 0x93, 0x1c, 0xd6, 0x5d, 0x52, 0x01, 0x7e, 0x4b, 0xe9, 0xb1, 0x9a, 0x51, 0x5f, 0x66, 0x9b, 0xea, 0x47, 0x03, 0x54, 0x2a, 0x2c, 0x52, 0x5c, 0xd3, 0xd3, 1665 }; 1666 static const ecdh_test_case ecccdh_SECP256R1_5_test_case = { 1667 .name = "ECCCDH/SECP256R1 5", 1668 .ecdh_type = ECCCDH, 1669 .ec_str_p = &secp256r1_str_params, 1670 .our_priv_key = ecccdh_SECP256R1_5_test_vector_our_priv_key, 1671 .our_priv_key_len = sizeof(ecccdh_SECP256R1_5_test_vector_our_priv_key), 1672 .peer_pub_key = ecccdh_SECP256R1_5_test_vector_peer_pub_key, 1673 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_5_test_vector_peer_pub_key), 1674 .exp_our_pub_key = ecccdh_SECP256R1_5_test_vector_our_pub_key, 1675 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_5_test_vector_our_pub_key), 1676 .exp_shared_secret = ecccdh_SECP256R1_5_test_vector_shared_secret, 1677 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_5_test_vector_shared_secret), 1678 }; 1679 #endif /* WITH_CURVE_SECP256R1 */ 1680 1681 #ifdef WITH_CURVE_SECP256R1 1682 #define ECCCDH_SECP256R1_SELF_TEST_6 1683 /*** Tests for ECCCDH/SECP256R1 ***/ 1684 static const u8 ecccdh_SECP256R1_6_test_vector_our_priv_key[] = { 1685 0x3b, 0x58, 0x9a, 0xf7, 0xdb, 0x03, 0x45, 0x9c, 0x23, 0x06, 0x8b, 0x64, 0xf6, 0x3f, 0x28, 0xd3, 0xc3, 0xc6, 0xbc, 0x25, 0xb5, 0xbf, 0x76, 0xac, 0x05, 0xf3, 0x54, 0x82, 0x88, 0x8b, 0x51, 0x90, 1686 }; 1687 static const u8 ecccdh_SECP256R1_6_test_vector_peer_pub_key[] = { 1688 0x6a, 0x9e, 0x0c, 0x3f, 0x91, 0x6e, 0x4e, 0x31, 0x5c, 0x91, 0x14, 0x7b, 0xe5, 0x71, 0x68, 0x6d, 0x90, 0x46, 0x4e, 0x8b, 0xf9, 0x81, 0xd3, 0x4a, 0x90, 0xb6, 0x35, 0x3b, 0xca, 0x6e, 0xeb, 0xa7, 0x40, 0xf9, 0xbe, 0xad, 0x39, 0xc2, 0xf2, 0xbc, 0xc2, 0x60, 0x2f, 0x75, 0xb8, 0xa7, 0x3e, 0xc7, 0xbd, 0xff, 0xcb, 0xce, 0xad, 0x15, 0x9d, 0x01, 0x74, 0xc6, 0xc4, 0xd3, 0xc5, 0x35, 0x7f, 0x05, 1689 }; 1690 static const u8 ecccdh_SECP256R1_6_test_vector_our_pub_key[] = { 1691 0x9f, 0xb3, 0x8e, 0x2d, 0x58, 0xea, 0x1b, 0xaf, 0x76, 0x22, 0xe9, 0x67, 0x20, 0x10, 0x1c, 0xae, 0x3c, 0xde, 0x4b, 0xa6, 0xc1, 0xe9, 0xfa, 0x26, 0xd9, 0xb1, 0xde, 0x08, 0x99, 0x10, 0x28, 0x63, 0xd5, 0x56, 0x1b, 0x90, 0x04, 0x06, 0xed, 0xf5, 0x08, 0x02, 0xdd, 0x7d, 0x73, 0xe8, 0x93, 0x95, 0xf8, 0xae, 0xd7, 0x2f, 0xba, 0x0e, 0x1d, 0x1b, 0x61, 0xfe, 0x1d, 0x22, 0x30, 0x22, 0x60, 0xf0, 1692 }; 1693 static const u8 ecccdh_SECP256R1_6_test_vector_shared_secret[] = { 1694 0xca, 0x34, 0x2d, 0xaa, 0x50, 0xdc, 0x09, 0xd6, 0x1b, 0xe7, 0xc1, 0x96, 0xc8, 0x5e, 0x60, 0xa8, 0x0c, 0x5c, 0xb0, 0x49, 0x31, 0x74, 0x68, 0x20, 0xbe, 0x54, 0x8c, 0xdd, 0xe0, 0x55, 0x67, 0x9d, 1695 }; 1696 static const ecdh_test_case ecccdh_SECP256R1_6_test_case = { 1697 .name = "ECCCDH/SECP256R1 6", 1698 .ecdh_type = ECCCDH, 1699 .ec_str_p = &secp256r1_str_params, 1700 .our_priv_key = ecccdh_SECP256R1_6_test_vector_our_priv_key, 1701 .our_priv_key_len = sizeof(ecccdh_SECP256R1_6_test_vector_our_priv_key), 1702 .peer_pub_key = ecccdh_SECP256R1_6_test_vector_peer_pub_key, 1703 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_6_test_vector_peer_pub_key), 1704 .exp_our_pub_key = ecccdh_SECP256R1_6_test_vector_our_pub_key, 1705 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_6_test_vector_our_pub_key), 1706 .exp_shared_secret = ecccdh_SECP256R1_6_test_vector_shared_secret, 1707 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_6_test_vector_shared_secret), 1708 }; 1709 #endif /* WITH_CURVE_SECP256R1 */ 1710 1711 #ifdef WITH_CURVE_SECP256R1 1712 #define ECCCDH_SECP256R1_SELF_TEST_7 1713 /*** Tests for ECCCDH/SECP256R1 ***/ 1714 static const u8 ecccdh_SECP256R1_7_test_vector_our_priv_key[] = { 1715 0xd8, 0xbf, 0x92, 0x9a, 0x20, 0xea, 0x74, 0x36, 0xb2, 0x46, 0x1b, 0x54, 0x1a, 0x11, 0xc8, 0x0e, 0x61, 0xd8, 0x26, 0xc0, 0xa4, 0xc9, 0xd3, 0x22, 0xb3, 0x1d, 0xd5, 0x4e, 0x7f, 0x58, 0xb9, 0xc8, 1716 }; 1717 static const u8 ecccdh_SECP256R1_7_test_vector_peer_pub_key[] = { 1718 0xa9, 0xc0, 0xac, 0xad, 0xe5, 0x5c, 0x2a, 0x73, 0xea, 0xd1, 0xa8, 0x6f, 0xb0, 0xa9, 0x71, 0x32, 0x23, 0xc8, 0x24, 0x75, 0x79, 0x1c, 0xd0, 0xe2, 0x10, 0xb0, 0x46, 0x41, 0x2c, 0xe2, 0x24, 0xbb, 0xf6, 0xde, 0x0a, 0xfa, 0x20, 0xe9, 0x3e, 0x07, 0x84, 0x67, 0xc0, 0x53, 0xd2, 0x41, 0x90, 0x3e, 0xda, 0xd7, 0x34, 0xc6, 0xb4, 0x03, 0xba, 0x75, 0x8c, 0x2b, 0x5f, 0xf0, 0x4c, 0x9d, 0x42, 0x29, 1719 }; 1720 static const u8 ecccdh_SECP256R1_7_test_vector_our_pub_key[] = { 1721 0x20, 0xf0, 0x76, 0x31, 0xe4, 0xa6, 0x51, 0x2a, 0x89, 0xad, 0x48, 0x7c, 0x4e, 0x9d, 0x63, 0x03, 0x9e, 0x57, 0x9c, 0xb0, 0xd7, 0xa5, 0x56, 0xcb, 0x9e, 0x66, 0x1c, 0xd5, 0x9c, 0x1e, 0x7f, 0xa4, 0x6d, 0xe9, 0x18, 0x46, 0xb3, 0xee, 0xe8, 0xa5, 0xec, 0x09, 0xc2, 0xab, 0x1f, 0x41, 0xe2, 0x1b, 0xd8, 0x36, 0x20, 0xcc, 0xdd, 0x1b, 0xdc, 0xe3, 0xab, 0x7e, 0xa6, 0xe0, 0x2d, 0xd2, 0x74, 0xf5, 1722 }; 1723 static const u8 ecccdh_SECP256R1_7_test_vector_shared_secret[] = { 1724 0x35, 0xaa, 0x9b, 0x52, 0x53, 0x6a, 0x46, 0x1b, 0xfd, 0xe4, 0xe8, 0x5f, 0xc7, 0x56, 0xbe, 0x92, 0x8c, 0x7d, 0xe9, 0x79, 0x23, 0xf0, 0x41, 0x6c, 0x7a, 0x3a, 0xc8, 0xf8, 0x8b, 0x3d, 0x44, 0x89, 1725 }; 1726 static const ecdh_test_case ecccdh_SECP256R1_7_test_case = { 1727 .name = "ECCCDH/SECP256R1 7", 1728 .ecdh_type = ECCCDH, 1729 .ec_str_p = &secp256r1_str_params, 1730 .our_priv_key = ecccdh_SECP256R1_7_test_vector_our_priv_key, 1731 .our_priv_key_len = sizeof(ecccdh_SECP256R1_7_test_vector_our_priv_key), 1732 .peer_pub_key = ecccdh_SECP256R1_7_test_vector_peer_pub_key, 1733 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_7_test_vector_peer_pub_key), 1734 .exp_our_pub_key = ecccdh_SECP256R1_7_test_vector_our_pub_key, 1735 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_7_test_vector_our_pub_key), 1736 .exp_shared_secret = ecccdh_SECP256R1_7_test_vector_shared_secret, 1737 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_7_test_vector_shared_secret), 1738 }; 1739 #endif /* WITH_CURVE_SECP256R1 */ 1740 1741 #ifdef WITH_CURVE_SECP256R1 1742 #define ECCCDH_SECP256R1_SELF_TEST_8 1743 /*** Tests for ECCCDH/SECP256R1 ***/ 1744 static const u8 ecccdh_SECP256R1_8_test_vector_our_priv_key[] = { 1745 0x0f, 0x98, 0x83, 0xba, 0x0e, 0xf3, 0x2e, 0xe7, 0x5d, 0xed, 0x0d, 0x8b, 0xda, 0x39, 0xa5, 0x14, 0x6a, 0x29, 0xf1, 0xf2, 0x50, 0x7b, 0x3b, 0xd4, 0x58, 0xdb, 0xea, 0x0b, 0x2b, 0xb0, 0x5b, 0x4d, 1746 }; 1747 static const u8 ecccdh_SECP256R1_8_test_vector_peer_pub_key[] = { 1748 0x94, 0xe9, 0x4f, 0x16, 0xa9, 0x82, 0x55, 0xff, 0xf2, 0xb9, 0xac, 0x0c, 0x95, 0x98, 0xaa, 0xc3, 0x54, 0x87, 0xb3, 0x23, 0x2d, 0x32, 0x31, 0xbd, 0x93, 0xb7, 0xdb, 0x7d, 0xf3, 0x6f, 0x9e, 0xb9, 0xd8, 0x04, 0x9a, 0x43, 0x57, 0x9c, 0xfa, 0x90, 0xb8, 0x09, 0x3a, 0x94, 0x41, 0x6c, 0xbe, 0xfb, 0xf9, 0x33, 0x86, 0xf1, 0x5b, 0x3f, 0x6e, 0x19, 0x0b, 0x6e, 0x34, 0x55, 0xfe, 0xdf, 0xe6, 0x9a, 1749 }; 1750 static const u8 ecccdh_SECP256R1_8_test_vector_our_pub_key[] = { 1751 0xab, 0xb6, 0x1b, 0x42, 0x3b, 0xe5, 0xd6, 0xc2, 0x6e, 0x21, 0xc6, 0x05, 0x83, 0x2c, 0x91, 0x42, 0xdc, 0x1d, 0xfe, 0x5a, 0x5f, 0xff, 0x28, 0x72, 0x67, 0x37, 0x93, 0x6e, 0x6f, 0xbf, 0x51, 0x6d, 0x73, 0x3d, 0x25, 0x13, 0xef, 0x58, 0xbe, 0xab, 0x20, 0x20, 0x90, 0x58, 0x6f, 0xac, 0x91, 0xbf, 0x0f, 0xee, 0x31, 0xe8, 0x0a, 0xb3, 0x34, 0x73, 0xab, 0x23, 0xa2, 0xd8, 0x9e, 0x58, 0xfa, 0xd6, 1752 }; 1753 static const u8 ecccdh_SECP256R1_8_test_vector_shared_secret[] = { 1754 0x60, 0x5c, 0x16, 0x17, 0x8a, 0x9b, 0xc8, 0x75, 0xdc, 0xbf, 0xf5, 0x4d, 0x63, 0xfe, 0x00, 0xdf, 0x69, 0x9c, 0x03, 0xe8, 0xa8, 0x88, 0xe9, 0xe9, 0x4d, 0xfb, 0xab, 0x90, 0xb2, 0x5f, 0x39, 0xb4, 1755 }; 1756 static const ecdh_test_case ecccdh_SECP256R1_8_test_case = { 1757 .name = "ECCCDH/SECP256R1 8", 1758 .ecdh_type = ECCCDH, 1759 .ec_str_p = &secp256r1_str_params, 1760 .our_priv_key = ecccdh_SECP256R1_8_test_vector_our_priv_key, 1761 .our_priv_key_len = sizeof(ecccdh_SECP256R1_8_test_vector_our_priv_key), 1762 .peer_pub_key = ecccdh_SECP256R1_8_test_vector_peer_pub_key, 1763 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_8_test_vector_peer_pub_key), 1764 .exp_our_pub_key = ecccdh_SECP256R1_8_test_vector_our_pub_key, 1765 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_8_test_vector_our_pub_key), 1766 .exp_shared_secret = ecccdh_SECP256R1_8_test_vector_shared_secret, 1767 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_8_test_vector_shared_secret), 1768 }; 1769 #endif /* WITH_CURVE_SECP256R1 */ 1770 1771 #ifdef WITH_CURVE_SECP256R1 1772 #define ECCCDH_SECP256R1_SELF_TEST_9 1773 /*** Tests for ECCCDH/SECP256R1 ***/ 1774 static const u8 ecccdh_SECP256R1_9_test_vector_our_priv_key[] = { 1775 0x2b, 0xee, 0xdb, 0x04, 0xb0, 0x5c, 0x69, 0x88, 0xf6, 0xa6, 0x75, 0x00, 0xbb, 0x81, 0x3f, 0xaf, 0x2c, 0xae, 0x0d, 0x58, 0x0c, 0x92, 0x53, 0xb6, 0x33, 0x9e, 0x4a, 0x33, 0x37, 0xbb, 0x6c, 0x08, 1776 }; 1777 static const u8 ecccdh_SECP256R1_9_test_vector_peer_pub_key[] = { 1778 0xe0, 0x99, 0xbf, 0x2a, 0x4d, 0x55, 0x74, 0x60, 0xb5, 0x54, 0x44, 0x30, 0xbb, 0xf6, 0xda, 0x11, 0x00, 0x4d, 0x12, 0x7c, 0xb5, 0xd6, 0x7f, 0x64, 0xab, 0x07, 0xc9, 0x4f, 0xcd, 0xf5, 0x27, 0x4f, 0xd9, 0xc5, 0x0d, 0xbe, 0x70, 0xd7, 0x14, 0xed, 0xb5, 0xe2, 0x21, 0xf4, 0xe0, 0x20, 0x61, 0x0e, 0xeb, 0x62, 0x70, 0x51, 0x7e, 0x68, 0x8c, 0xa6, 0x4f, 0xb0, 0xe9, 0x8c, 0x7e, 0xf8, 0xc1, 0xc5, 1779 }; 1780 static const u8 ecccdh_SECP256R1_9_test_vector_our_pub_key[] = { 1781 0x3d, 0x63, 0xe4, 0x29, 0xcb, 0x5f, 0xa8, 0x95, 0xa9, 0x24, 0x71, 0x29, 0xbf, 0x4e, 0x48, 0xe8, 0x9f, 0x35, 0xd7, 0xb1, 0x1d, 0xe8, 0x15, 0x8e, 0xfe, 0xb3, 0xe1, 0x06, 0xa2, 0xa8, 0x73, 0x95, 0x0c, 0xae, 0x9e, 0x47, 0x7e, 0xf4, 0x1e, 0x7c, 0x8c, 0x10, 0x64, 0x37, 0x9b, 0xb7, 0xb5, 0x54, 0xdd, 0xcb, 0xca, 0xe7, 0x9f, 0x98, 0x14, 0x28, 0x1f, 0x1e, 0x50, 0xf0, 0x40, 0x3c, 0x61, 0xf3, 1782 }; 1783 static const u8 ecccdh_SECP256R1_9_test_vector_shared_secret[] = { 1784 0xf9, 0x6e, 0x40, 0xa1, 0xb7, 0x28, 0x40, 0x85, 0x4b, 0xb6, 0x2b, 0xc1, 0x3c, 0x40, 0xcc, 0x27, 0x95, 0xe3, 0x73, 0xd4, 0xe7, 0x15, 0x98, 0x0b, 0x26, 0x14, 0x76, 0x83, 0x5a, 0x09, 0x2e, 0x0b, 1785 }; 1786 static const ecdh_test_case ecccdh_SECP256R1_9_test_case = { 1787 .name = "ECCCDH/SECP256R1 9", 1788 .ecdh_type = ECCCDH, 1789 .ec_str_p = &secp256r1_str_params, 1790 .our_priv_key = ecccdh_SECP256R1_9_test_vector_our_priv_key, 1791 .our_priv_key_len = sizeof(ecccdh_SECP256R1_9_test_vector_our_priv_key), 1792 .peer_pub_key = ecccdh_SECP256R1_9_test_vector_peer_pub_key, 1793 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_9_test_vector_peer_pub_key), 1794 .exp_our_pub_key = ecccdh_SECP256R1_9_test_vector_our_pub_key, 1795 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_9_test_vector_our_pub_key), 1796 .exp_shared_secret = ecccdh_SECP256R1_9_test_vector_shared_secret, 1797 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_9_test_vector_shared_secret), 1798 }; 1799 #endif /* WITH_CURVE_SECP256R1 */ 1800 1801 #ifdef WITH_CURVE_SECP256R1 1802 #define ECCCDH_SECP256R1_SELF_TEST_10 1803 /*** Tests for ECCCDH/SECP256R1 ***/ 1804 static const u8 ecccdh_SECP256R1_10_test_vector_our_priv_key[] = { 1805 0x77, 0xc1, 0x5d, 0xcf, 0x44, 0x61, 0x0e, 0x41, 0x69, 0x6b, 0xab, 0x75, 0x89, 0x43, 0xef, 0xf1, 0x40, 0x93, 0x33, 0xe4, 0xd5, 0xa1, 0x1b, 0xbe, 0x72, 0xc8, 0xf6, 0xc3, 0x95, 0xe9, 0xf8, 0x48, 1806 }; 1807 static const u8 ecccdh_SECP256R1_10_test_vector_peer_pub_key[] = { 1808 0xf7, 0x5a, 0x5f, 0xe5, 0x6b, 0xda, 0x34, 0xf3, 0xc1, 0x39, 0x62, 0x96, 0x62, 0x6e, 0xf0, 0x12, 0xdc, 0x07, 0xe4, 0x82, 0x58, 0x38, 0x77, 0x8a, 0x64, 0x5c, 0x82, 0x48, 0xcf, 0xf0, 0x16, 0x58, 0x33, 0xbb, 0xdf, 0x1b, 0x17, 0x72, 0xd8, 0x05, 0x9d, 0xf5, 0x68, 0xb0, 0x61, 0xf3, 0xf1, 0x12, 0x2f, 0x28, 0xa8, 0xd8, 0x19, 0x16, 0x7c, 0x97, 0xbe, 0x44, 0x8e, 0x3d, 0xc3, 0xfb, 0x0c, 0x3c, 1809 }; 1810 static const u8 ecccdh_SECP256R1_10_test_vector_our_pub_key[] = { 1811 0xad, 0x5d, 0x13, 0xc3, 0xdb, 0x50, 0x8d, 0xdc, 0xd3, 0x84, 0x57, 0xe5, 0x99, 0x14, 0x34, 0xa2, 0x51, 0xbe, 0xd4, 0x9c, 0xf5, 0xdd, 0xcb, 0x59, 0xcd, 0xee, 0x73, 0x86, 0x5f, 0x13, 0x8c, 0x9f, 0x62, 0xce, 0xc1, 0xe7, 0x05, 0x88, 0xaa, 0x4f, 0xdf, 0xc7, 0xb9, 0xa0, 0x9d, 0xaa, 0x67, 0x80, 0x81, 0xc0, 0x4e, 0x12, 0x08, 0xb9, 0xd6, 0x62, 0xb8, 0xa2, 0x21, 0x4b, 0xf8, 0xe8, 0x1a, 0x21, 1812 }; 1813 static const u8 ecccdh_SECP256R1_10_test_vector_shared_secret[] = { 1814 0x83, 0x88, 0xfa, 0x79, 0xc4, 0xba, 0xbd, 0xca, 0x02, 0xa8, 0xe8, 0xa3, 0x4f, 0x9e, 0x43, 0x55, 0x49, 0x76, 0xe4, 0x20, 0xa4, 0xad, 0x27, 0x3c, 0x81, 0xb2, 0x6e, 0x42, 0x28, 0xe9, 0xd3, 0xa3, 1815 }; 1816 static const ecdh_test_case ecccdh_SECP256R1_10_test_case = { 1817 .name = "ECCCDH/SECP256R1 10", 1818 .ecdh_type = ECCCDH, 1819 .ec_str_p = &secp256r1_str_params, 1820 .our_priv_key = ecccdh_SECP256R1_10_test_vector_our_priv_key, 1821 .our_priv_key_len = sizeof(ecccdh_SECP256R1_10_test_vector_our_priv_key), 1822 .peer_pub_key = ecccdh_SECP256R1_10_test_vector_peer_pub_key, 1823 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_10_test_vector_peer_pub_key), 1824 .exp_our_pub_key = ecccdh_SECP256R1_10_test_vector_our_pub_key, 1825 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_10_test_vector_our_pub_key), 1826 .exp_shared_secret = ecccdh_SECP256R1_10_test_vector_shared_secret, 1827 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_10_test_vector_shared_secret), 1828 }; 1829 #endif /* WITH_CURVE_SECP256R1 */ 1830 1831 #ifdef WITH_CURVE_SECP256R1 1832 #define ECCCDH_SECP256R1_SELF_TEST_11 1833 /*** Tests for ECCCDH/SECP256R1 ***/ 1834 static const u8 ecccdh_SECP256R1_11_test_vector_our_priv_key[] = { 1835 0x42, 0xa8, 0x3b, 0x98, 0x50, 0x11, 0xd1, 0x23, 0x03, 0xdb, 0x1a, 0x80, 0x0f, 0x26, 0x10, 0xf7, 0x4a, 0xa7, 0x1c, 0xdf, 0x19, 0xc6, 0x7d, 0x54, 0xce, 0x6c, 0x9e, 0xd9, 0x51, 0xe9, 0x09, 0x3e, 1836 }; 1837 static const u8 ecccdh_SECP256R1_11_test_vector_peer_pub_key[] = { 1838 0x2d, 0xb4, 0x54, 0x0d, 0x50, 0x23, 0x07, 0x56, 0x15, 0x8a, 0xbf, 0x61, 0xd9, 0x83, 0x57, 0x12, 0xb6, 0x48, 0x6c, 0x74, 0x31, 0x21, 0x83, 0xcc, 0xef, 0xca, 0xef, 0x27, 0x97, 0xb7, 0x67, 0x4d, 0x62, 0xf5, 0x7f, 0x31, 0x4e, 0x3f, 0x34, 0x95, 0xdc, 0x4e, 0x09, 0x90, 0x12, 0xf5, 0xe0, 0xba, 0x71, 0x77, 0x0f, 0x96, 0x60, 0xa1, 0xea, 0xda, 0x54, 0x10, 0x4c, 0xdf, 0xde, 0x77, 0x24, 0x3e, 1839 }; 1840 static const u8 ecccdh_SECP256R1_11_test_vector_our_pub_key[] = { 1841 0xab, 0x48, 0xca, 0xa6, 0x1e, 0xa3, 0x5f, 0x13, 0xf8, 0xed, 0x07, 0xff, 0xa6, 0xa1, 0x3e, 0x8d, 0xb2, 0x24, 0xdf, 0xec, 0xfa, 0xe1, 0xa7, 0xdf, 0x8b, 0x1b, 0xb6, 0xeb, 0xaf, 0x0c, 0xb9, 0x7d, 0x12, 0x74, 0x53, 0x0c, 0xa2, 0xc3, 0x85, 0xa3, 0x21, 0x8b, 0xdd, 0xfb, 0xcb, 0xf0, 0xb4, 0x02, 0x4c, 0x9b, 0xad, 0xd5, 0x24, 0x3b, 0xff, 0x83, 0x4e, 0xbf, 0xf2, 0x4a, 0x86, 0x18, 0xdc, 0xcb, 1842 }; 1843 static const u8 ecccdh_SECP256R1_11_test_vector_shared_secret[] = { 1844 0x72, 0x87, 0x7c, 0xea, 0x33, 0xcc, 0xc4, 0x71, 0x50, 0x38, 0xd4, 0xbc, 0xbd, 0xfe, 0x0e, 0x43, 0xf4, 0x2a, 0x9e, 0x2c, 0x0c, 0x3b, 0x01, 0x7f, 0xc2, 0x37, 0x0f, 0x4b, 0x9a, 0xcb, 0xda, 0x4a, 1845 }; 1846 static const ecdh_test_case ecccdh_SECP256R1_11_test_case = { 1847 .name = "ECCCDH/SECP256R1 11", 1848 .ecdh_type = ECCCDH, 1849 .ec_str_p = &secp256r1_str_params, 1850 .our_priv_key = ecccdh_SECP256R1_11_test_vector_our_priv_key, 1851 .our_priv_key_len = sizeof(ecccdh_SECP256R1_11_test_vector_our_priv_key), 1852 .peer_pub_key = ecccdh_SECP256R1_11_test_vector_peer_pub_key, 1853 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_11_test_vector_peer_pub_key), 1854 .exp_our_pub_key = ecccdh_SECP256R1_11_test_vector_our_pub_key, 1855 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_11_test_vector_our_pub_key), 1856 .exp_shared_secret = ecccdh_SECP256R1_11_test_vector_shared_secret, 1857 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_11_test_vector_shared_secret), 1858 }; 1859 #endif /* WITH_CURVE_SECP256R1 */ 1860 1861 #ifdef WITH_CURVE_SECP256R1 1862 #define ECCCDH_SECP256R1_SELF_TEST_12 1863 /*** Tests for ECCCDH/SECP256R1 ***/ 1864 static const u8 ecccdh_SECP256R1_12_test_vector_our_priv_key[] = { 1865 0xce, 0xed, 0x35, 0x50, 0x7b, 0x5c, 0x93, 0xea, 0xd5, 0x98, 0x91, 0x19, 0xb9, 0xba, 0x34, 0x2c, 0xfe, 0x38, 0xe6, 0xe6, 0x38, 0xba, 0x6e, 0xea, 0x34, 0x3a, 0x55, 0x47, 0x5d, 0xe2, 0x80, 0x0b, 1866 }; 1867 static const u8 ecccdh_SECP256R1_12_test_vector_peer_pub_key[] = { 1868 0xcd, 0x94, 0xfc, 0x94, 0x97, 0xe8, 0x99, 0x07, 0x50, 0x30, 0x9e, 0x9a, 0x85, 0x34, 0xfd, 0x11, 0x4b, 0x0a, 0x6e, 0x54, 0xda, 0x89, 0xc4, 0x79, 0x61, 0x01, 0x89, 0x70, 0x41, 0xd1, 0x4e, 0xcb, 0xc3, 0xde, 0xf4, 0xb5, 0xfe, 0x04, 0xfa, 0xee, 0x0a, 0x11, 0x93, 0x22, 0x29, 0xff, 0xf5, 0x63, 0x63, 0x7b, 0xfd, 0xee, 0x0e, 0x79, 0xc6, 0xde, 0xea, 0xf4, 0x49, 0xf8, 0x54, 0x01, 0xc5, 0xc4, 1869 }; 1870 static const u8 ecccdh_SECP256R1_12_test_vector_our_pub_key[] = { 1871 0x9a, 0x8c, 0xd9, 0xbd, 0x72, 0xe7, 0x17, 0x52, 0xdf, 0x91, 0x44, 0x0f, 0x77, 0xc5, 0x47, 0x50, 0x9a, 0x84, 0xdf, 0x98, 0x11, 0x4e, 0x7d, 0xe4, 0xf2, 0x6c, 0xdb, 0x39, 0x23, 0x4a, 0x62, 0x5d, 0xd0, 0x7c, 0xfc, 0x84, 0xc8, 0xe1, 0x44, 0xfa, 0xb2, 0x83, 0x9f, 0x51, 0x89, 0xbb, 0x1d, 0x7c, 0x88, 0x63, 0x1d, 0x57, 0x9b, 0xbc, 0x58, 0x01, 0x2e, 0xd9, 0xa2, 0x32, 0x7d, 0xa5, 0x2f, 0x62, 1872 }; 1873 static const u8 ecccdh_SECP256R1_12_test_vector_shared_secret[] = { 1874 0xe4, 0xe7, 0x40, 0x8d, 0x85, 0xff, 0x0e, 0x0e, 0x9c, 0x83, 0x80, 0x03, 0xf2, 0x8c, 0xdb, 0xd5, 0x24, 0x7c, 0xdc, 0xe3, 0x1f, 0x32, 0xf6, 0x24, 0x94, 0xb7, 0x0e, 0x5f, 0x1b, 0xc3, 0x63, 0x07, 1875 }; 1876 static const ecdh_test_case ecccdh_SECP256R1_12_test_case = { 1877 .name = "ECCCDH/SECP256R1 12", 1878 .ecdh_type = ECCCDH, 1879 .ec_str_p = &secp256r1_str_params, 1880 .our_priv_key = ecccdh_SECP256R1_12_test_vector_our_priv_key, 1881 .our_priv_key_len = sizeof(ecccdh_SECP256R1_12_test_vector_our_priv_key), 1882 .peer_pub_key = ecccdh_SECP256R1_12_test_vector_peer_pub_key, 1883 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_12_test_vector_peer_pub_key), 1884 .exp_our_pub_key = ecccdh_SECP256R1_12_test_vector_our_pub_key, 1885 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_12_test_vector_our_pub_key), 1886 .exp_shared_secret = ecccdh_SECP256R1_12_test_vector_shared_secret, 1887 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_12_test_vector_shared_secret), 1888 }; 1889 #endif /* WITH_CURVE_SECP256R1 */ 1890 1891 #ifdef WITH_CURVE_SECP256R1 1892 #define ECCCDH_SECP256R1_SELF_TEST_13 1893 /*** Tests for ECCCDH/SECP256R1 ***/ 1894 static const u8 ecccdh_SECP256R1_13_test_vector_our_priv_key[] = { 1895 0x43, 0xe0, 0xe9, 0xd9, 0x5a, 0xf4, 0xdc, 0x36, 0x48, 0x3c, 0xdd, 0x19, 0x68, 0xd2, 0xb7, 0xee, 0xb8, 0x61, 0x1f, 0xcc, 0xe7, 0x7f, 0x3a, 0x4e, 0x7d, 0x05, 0x9a, 0xe4, 0x3e, 0x50, 0x96, 0x04, 1896 }; 1897 static const u8 ecccdh_SECP256R1_13_test_vector_peer_pub_key[] = { 1898 0x15, 0xb9, 0xe4, 0x67, 0xaf, 0x4d, 0x29, 0x0c, 0x41, 0x74, 0x02, 0xe0, 0x40, 0x42, 0x6f, 0xe4, 0xcf, 0x23, 0x6b, 0xae, 0x72, 0xba, 0xa3, 0x92, 0xed, 0x89, 0x78, 0x0d, 0xfc, 0xcd, 0xb4, 0x71, 0xcd, 0xf4, 0xe9, 0x17, 0x0f, 0xb9, 0x04, 0x30, 0x2b, 0x8f, 0xd9, 0x3a, 0x82, 0x0b, 0xa8, 0xcc, 0x7e, 0xd4, 0xef, 0xd3, 0xa6, 0xf2, 0xd6, 0xb0, 0x5b, 0x80, 0xb2, 0xff, 0x2a, 0xee, 0x4e, 0x77, 1899 }; 1900 static const u8 ecccdh_SECP256R1_13_test_vector_our_pub_key[] = { 1901 0xf9, 0x89, 0xcf, 0x8e, 0xe9, 0x56, 0xa8, 0x2e, 0x7e, 0xbd, 0x98, 0x81, 0xcd, 0xbf, 0xb2, 0xfd, 0x94, 0x61, 0x89, 0xb0, 0x8d, 0xb5, 0x35, 0x59, 0xbc, 0x8c, 0xfd, 0xd4, 0x80, 0x71, 0xeb, 0x14, 0x5e, 0xff, 0x28, 0xf1, 0xa1, 0x8a, 0x61, 0x6b, 0x04, 0xb7, 0xd3, 0x37, 0x86, 0x86, 0x79, 0xf6, 0xdd, 0x84, 0xf9, 0xa7, 0xb3, 0xd7, 0xb6, 0xf8, 0xaf, 0x27, 0x6c, 0x19, 0x61, 0x1a, 0x54, 0x1d, 1902 }; 1903 static const u8 ecccdh_SECP256R1_13_test_vector_shared_secret[] = { 1904 0xed, 0x56, 0xbc, 0xf6, 0x95, 0xb7, 0x34, 0x14, 0x2c, 0x24, 0xec, 0xb1, 0xfc, 0x1b, 0xb6, 0x4d, 0x08, 0xf1, 0x75, 0xeb, 0x24, 0x3a, 0x31, 0xf3, 0x7b, 0x3d, 0x9b, 0xb4, 0x40, 0x7f, 0x3b, 0x96, 1905 }; 1906 static const ecdh_test_case ecccdh_SECP256R1_13_test_case = { 1907 .name = "ECCCDH/SECP256R1 13", 1908 .ecdh_type = ECCCDH, 1909 .ec_str_p = &secp256r1_str_params, 1910 .our_priv_key = ecccdh_SECP256R1_13_test_vector_our_priv_key, 1911 .our_priv_key_len = sizeof(ecccdh_SECP256R1_13_test_vector_our_priv_key), 1912 .peer_pub_key = ecccdh_SECP256R1_13_test_vector_peer_pub_key, 1913 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_13_test_vector_peer_pub_key), 1914 .exp_our_pub_key = ecccdh_SECP256R1_13_test_vector_our_pub_key, 1915 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_13_test_vector_our_pub_key), 1916 .exp_shared_secret = ecccdh_SECP256R1_13_test_vector_shared_secret, 1917 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_13_test_vector_shared_secret), 1918 }; 1919 #endif /* WITH_CURVE_SECP256R1 */ 1920 1921 #ifdef WITH_CURVE_SECP256R1 1922 #define ECCCDH_SECP256R1_SELF_TEST_14 1923 /*** Tests for ECCCDH/SECP256R1 ***/ 1924 static const u8 ecccdh_SECP256R1_14_test_vector_our_priv_key[] = { 1925 0xb2, 0xf3, 0x60, 0x0d, 0xf3, 0x36, 0x8e, 0xf8, 0xa0, 0xbb, 0x85, 0xab, 0x22, 0xf4, 0x1f, 0xc0, 0xe5, 0xf4, 0xfd, 0xd5, 0x4b, 0xe8, 0x16, 0x7a, 0x5c, 0x3c, 0xd4, 0xb0, 0x8d, 0xb0, 0x49, 0x03, 1926 }; 1927 static const u8 ecccdh_SECP256R1_14_test_vector_peer_pub_key[] = { 1928 0x49, 0xc5, 0x03, 0xba, 0x6c, 0x4f, 0xa6, 0x05, 0x18, 0x2e, 0x18, 0x6b, 0x5e, 0x81, 0x11, 0x3f, 0x07, 0x5b, 0xc1, 0x1d, 0xcf, 0xd5, 0x1c, 0x93, 0x2f, 0xb2, 0x1e, 0x95, 0x1e, 0xee, 0x2f, 0xa1, 0x8a, 0xf7, 0x06, 0xff, 0x09, 0x22, 0xd8, 0x7b, 0x3f, 0x0c, 0x5e, 0x4e, 0x31, 0xd8, 0xb2, 0x59, 0xae, 0xb2, 0x60, 0xa9, 0x26, 0x96, 0x43, 0xed, 0x52, 0x0a, 0x13, 0xbb, 0x25, 0xda, 0x59, 0x24, 1929 }; 1930 static const u8 ecccdh_SECP256R1_14_test_vector_our_pub_key[] = { 1931 0x69, 0xc6, 0x27, 0x62, 0x5b, 0x36, 0xa4, 0x29, 0xc3, 0x98, 0xb4, 0x5c, 0x38, 0x67, 0x7c, 0xb3, 0x5d, 0x8b, 0xeb, 0x1c, 0xf7, 0x8a, 0x57, 0x1e, 0x40, 0xe9, 0x9f, 0xe4, 0xea, 0xc1, 0xcd, 0x4e, 0x81, 0x69, 0x01, 0x12, 0xb0, 0xa8, 0x8f, 0x20, 0xf7, 0x13, 0x6b, 0x28, 0xd7, 0xd4, 0x7e, 0x5f, 0xbc, 0x2a, 0xda, 0x3c, 0x8e, 0xdd, 0x87, 0x58, 0x9b, 0xc1, 0x9e, 0xc9, 0x59, 0x06, 0x37, 0xbd, 1932 }; 1933 static const u8 ecccdh_SECP256R1_14_test_vector_shared_secret[] = { 1934 0xbc, 0x5c, 0x70, 0x55, 0x08, 0x9f, 0xc9, 0xd6, 0xc8, 0x9f, 0x83, 0xc1, 0xea, 0x1a, 0xda, 0x87, 0x9d, 0x99, 0x34, 0xb2, 0xea, 0x28, 0xfc, 0xf4, 0xe4, 0xa7, 0xe9, 0x84, 0xb2, 0x8a, 0xd2, 0xcf, 1935 }; 1936 static const ecdh_test_case ecccdh_SECP256R1_14_test_case = { 1937 .name = "ECCCDH/SECP256R1 14", 1938 .ecdh_type = ECCCDH, 1939 .ec_str_p = &secp256r1_str_params, 1940 .our_priv_key = ecccdh_SECP256R1_14_test_vector_our_priv_key, 1941 .our_priv_key_len = sizeof(ecccdh_SECP256R1_14_test_vector_our_priv_key), 1942 .peer_pub_key = ecccdh_SECP256R1_14_test_vector_peer_pub_key, 1943 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_14_test_vector_peer_pub_key), 1944 .exp_our_pub_key = ecccdh_SECP256R1_14_test_vector_our_pub_key, 1945 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_14_test_vector_our_pub_key), 1946 .exp_shared_secret = ecccdh_SECP256R1_14_test_vector_shared_secret, 1947 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_14_test_vector_shared_secret), 1948 }; 1949 #endif /* WITH_CURVE_SECP256R1 */ 1950 1951 #ifdef WITH_CURVE_SECP256R1 1952 #define ECCCDH_SECP256R1_SELF_TEST_15 1953 /*** Tests for ECCCDH/SECP256R1 ***/ 1954 static const u8 ecccdh_SECP256R1_15_test_vector_our_priv_key[] = { 1955 0x40, 0x02, 0x53, 0x43, 0x07, 0xf8, 0xb6, 0x2a, 0x9b, 0xf6, 0x7f, 0xf6, 0x41, 0xdd, 0xc6, 0x0f, 0xef, 0x59, 0x3b, 0x17, 0xc3, 0x34, 0x12, 0x39, 0xe9, 0x5b, 0xdb, 0x3e, 0x57, 0x9b, 0xfd, 0xc8, 1956 }; 1957 static const u8 ecccdh_SECP256R1_15_test_vector_peer_pub_key[] = { 1958 0x19, 0xb3, 0x8d, 0xe3, 0x9f, 0xdd, 0x2f, 0x70, 0xf7, 0x09, 0x16, 0x31, 0xa4, 0xf7, 0x5d, 0x19, 0x93, 0x74, 0x0b, 0xa9, 0x42, 0x91, 0x62, 0xc2, 0xa4, 0x53, 0x12, 0x40, 0x16, 0x36, 0xb2, 0x9c, 0x09, 0xae, 0xd7, 0x23, 0x2b, 0x28, 0xe0, 0x60, 0x94, 0x17, 0x41, 0xb6, 0x82, 0x8b, 0xcd, 0xfa, 0x2b, 0xc4, 0x9c, 0xc8, 0x44, 0xf3, 0x77, 0x36, 0x11, 0x50, 0x4f, 0x82, 0xa3, 0x90, 0xa5, 0xae, 1959 }; 1960 static const u8 ecccdh_SECP256R1_15_test_vector_our_pub_key[] = { 1961 0x5f, 0xe9, 0x64, 0x67, 0x13, 0x15, 0xa1, 0x8a, 0xa6, 0x8a, 0x2a, 0x6e, 0x3d, 0xd1, 0xfd, 0xe7, 0xe2, 0x3b, 0x8c, 0xe7, 0x18, 0x14, 0x71, 0xcf, 0xac, 0x43, 0xc9, 0x9e, 0x1a, 0xe8, 0x02, 0x62, 0xd5, 0x82, 0x7b, 0xe2, 0x82, 0xe6, 0x2c, 0x84, 0xde, 0x53, 0x1b, 0x96, 0x38, 0x84, 0xba, 0x83, 0x2d, 0xb5, 0xd6, 0xb2, 0xc3, 0xa2, 0x56, 0xf0, 0xe6, 0x04, 0xfe, 0x7e, 0x6b, 0x8a, 0x7f, 0x72, 1962 }; 1963 static const u8 ecccdh_SECP256R1_15_test_vector_shared_secret[] = { 1964 0x9a, 0x4e, 0x8e, 0x65, 0x7f, 0x6b, 0x0e, 0x09, 0x7f, 0x47, 0x95, 0x4a, 0x63, 0xc7, 0x5d, 0x74, 0xfc, 0xba, 0x71, 0xa3, 0x0d, 0x83, 0x65, 0x1e, 0x3e, 0x5a, 0x91, 0xaa, 0x7c, 0xcd, 0x83, 0x43, 1965 }; 1966 static const ecdh_test_case ecccdh_SECP256R1_15_test_case = { 1967 .name = "ECCCDH/SECP256R1 15", 1968 .ecdh_type = ECCCDH, 1969 .ec_str_p = &secp256r1_str_params, 1970 .our_priv_key = ecccdh_SECP256R1_15_test_vector_our_priv_key, 1971 .our_priv_key_len = sizeof(ecccdh_SECP256R1_15_test_vector_our_priv_key), 1972 .peer_pub_key = ecccdh_SECP256R1_15_test_vector_peer_pub_key, 1973 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_15_test_vector_peer_pub_key), 1974 .exp_our_pub_key = ecccdh_SECP256R1_15_test_vector_our_pub_key, 1975 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_15_test_vector_our_pub_key), 1976 .exp_shared_secret = ecccdh_SECP256R1_15_test_vector_shared_secret, 1977 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_15_test_vector_shared_secret), 1978 }; 1979 #endif /* WITH_CURVE_SECP256R1 */ 1980 1981 #ifdef WITH_CURVE_SECP256R1 1982 #define ECCCDH_SECP256R1_SELF_TEST_16 1983 /*** Tests for ECCCDH/SECP256R1 ***/ 1984 static const u8 ecccdh_SECP256R1_16_test_vector_our_priv_key[] = { 1985 0x4d, 0xfa, 0x12, 0xde, 0xfc, 0x60, 0x31, 0x90, 0x21, 0xb6, 0x81, 0xb3, 0xff, 0x84, 0xa1, 0x0a, 0x51, 0x19, 0x58, 0xc8, 0x50, 0x93, 0x9e, 0xd4, 0x56, 0x35, 0x93, 0x4b, 0xa4, 0x97, 0x91, 0x47, 1986 }; 1987 static const u8 ecccdh_SECP256R1_16_test_vector_peer_pub_key[] = { 1988 0x2c, 0x91, 0xc6, 0x1f, 0x33, 0xad, 0xfe, 0x93, 0x11, 0xc9, 0x42, 0xfd, 0xbf, 0xf6, 0xba, 0x47, 0x02, 0x0f, 0xef, 0xf4, 0x16, 0xb7, 0xbb, 0x63, 0xce, 0xc1, 0x3f, 0xaf, 0x9b, 0x09, 0x99, 0x54, 0x6c, 0xab, 0x31, 0xb0, 0x64, 0x19, 0xe5, 0x22, 0x1f, 0xca, 0x01, 0x4f, 0xb8, 0x4e, 0xc8, 0x70, 0x62, 0x2a, 0x1b, 0x12, 0xba, 0xb5, 0xae, 0x43, 0x68, 0x2a, 0xa7, 0xea, 0x73, 0xea, 0x08, 0xd0, 1989 }; 1990 static const u8 ecccdh_SECP256R1_16_test_vector_our_pub_key[] = { 1991 0xc9, 0xb2, 0xb8, 0x49, 0x6f, 0x14, 0x40, 0xbd, 0x4a, 0x2d, 0x1e, 0x52, 0x75, 0x2f, 0xd3, 0x72, 0x83, 0x5b, 0x36, 0x48, 0x85, 0xe1, 0x54, 0xa7, 0xda, 0xc4, 0x92, 0x95, 0xf2, 0x81, 0xec, 0x7c, 0xfb, 0xe6, 0xb9, 0x26, 0xa8, 0xa4, 0xde, 0x26, 0xcc, 0xc8, 0x3b, 0x80, 0x2b, 0x12, 0x12, 0x40, 0x07, 0x54, 0xbe, 0x25, 0xd9, 0xf3, 0xee, 0xaf, 0x00, 0x8b, 0x09, 0x87, 0x0a, 0xe7, 0x63, 0x21, 1992 }; 1993 static const u8 ecccdh_SECP256R1_16_test_vector_shared_secret[] = { 1994 0x3c, 0xa1, 0xfc, 0x7a, 0xd8, 0x58, 0xfb, 0x1a, 0x6a, 0xba, 0x23, 0x25, 0x42, 0xf3, 0xe2, 0xa7, 0x49, 0xff, 0xc7, 0x20, 0x3a, 0x23, 0x74, 0xa3, 0xf3, 0xd3, 0x26, 0x7f, 0x1f, 0xc9, 0x7b, 0x78, 1995 }; 1996 static const ecdh_test_case ecccdh_SECP256R1_16_test_case = { 1997 .name = "ECCCDH/SECP256R1 16", 1998 .ecdh_type = ECCCDH, 1999 .ec_str_p = &secp256r1_str_params, 2000 .our_priv_key = ecccdh_SECP256R1_16_test_vector_our_priv_key, 2001 .our_priv_key_len = sizeof(ecccdh_SECP256R1_16_test_vector_our_priv_key), 2002 .peer_pub_key = ecccdh_SECP256R1_16_test_vector_peer_pub_key, 2003 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_16_test_vector_peer_pub_key), 2004 .exp_our_pub_key = ecccdh_SECP256R1_16_test_vector_our_pub_key, 2005 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_16_test_vector_our_pub_key), 2006 .exp_shared_secret = ecccdh_SECP256R1_16_test_vector_shared_secret, 2007 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_16_test_vector_shared_secret), 2008 }; 2009 #endif /* WITH_CURVE_SECP256R1 */ 2010 2011 #ifdef WITH_CURVE_SECP256R1 2012 #define ECCCDH_SECP256R1_SELF_TEST_17 2013 /*** Tests for ECCCDH/SECP256R1 ***/ 2014 static const u8 ecccdh_SECP256R1_17_test_vector_our_priv_key[] = { 2015 0x13, 0x31, 0xf6, 0xd8, 0x74, 0xa4, 0xed, 0x3b, 0xc4, 0xa2, 0xc6, 0xe9, 0xc7, 0x43, 0x31, 0xd3, 0x03, 0x97, 0x96, 0x31, 0x4b, 0xee, 0xe3, 0xb7, 0x15, 0x2f, 0xcd, 0xba, 0x55, 0x56, 0x30, 0x4e, 2016 }; 2017 static const u8 ecccdh_SECP256R1_17_test_vector_peer_pub_key[] = { 2018 0xa2, 0x8a, 0x2e, 0xdf, 0x58, 0x02, 0x56, 0x68, 0xf7, 0x24, 0xaa, 0xf8, 0x3a, 0x50, 0x95, 0x6b, 0x7a, 0xc1, 0xcf, 0xbb, 0xff, 0x79, 0xb0, 0x8c, 0x3b, 0xf8, 0x7d, 0xfd, 0x28, 0x28, 0xd7, 0x67, 0xdf, 0xa7, 0xbf, 0xff, 0xd4, 0xc7, 0x66, 0xb8, 0x6a, 0xbe, 0xaf, 0x5c, 0x99, 0xb6, 0xe5, 0x0c, 0xb9, 0xcc, 0xc9, 0xd9, 0xd0, 0x0b, 0x7f, 0xfc, 0x78, 0x04, 0xb0, 0x49, 0x1b, 0x67, 0xbc, 0x03, 2019 }; 2020 static const u8 ecccdh_SECP256R1_17_test_vector_our_pub_key[] = { 2021 0x59, 0xe1, 0xe1, 0x01, 0x52, 0x10, 0x46, 0xad, 0x9c, 0xf1, 0xd0, 0x82, 0xe9, 0xd2, 0xec, 0x7d, 0xd2, 0x25, 0x30, 0xcc, 0xe0, 0x64, 0x99, 0x1f, 0x1e, 0x55, 0xc5, 0xbc, 0xf5, 0xfc, 0xb5, 0x91, 0x48, 0x2f, 0x4f, 0x67, 0x31, 0x76, 0xc8, 0xfd, 0xaa, 0x0b, 0xb6, 0xe5, 0x9b, 0x15, 0xa3, 0xe4, 0x74, 0x54, 0xe3, 0xa0, 0x42, 0x97, 0xd3, 0x86, 0x3c, 0x93, 0x38, 0xd9, 0x8a, 0xdd, 0x1f, 0x37, 2022 }; 2023 static const u8 ecccdh_SECP256R1_17_test_vector_shared_secret[] = { 2024 0x1a, 0xaa, 0xbe, 0x7e, 0xe6, 0xe4, 0xa6, 0xfa, 0x73, 0x22, 0x91, 0x20, 0x24, 0x33, 0xa2, 0x37, 0xdf, 0x1b, 0x49, 0xbc, 0x53, 0x86, 0x6b, 0xfb, 0xe0, 0x0d, 0xb9, 0x6a, 0x0f, 0x58, 0x22, 0x4f, 2025 }; 2026 static const ecdh_test_case ecccdh_SECP256R1_17_test_case = { 2027 .name = "ECCCDH/SECP256R1 17", 2028 .ecdh_type = ECCCDH, 2029 .ec_str_p = &secp256r1_str_params, 2030 .our_priv_key = ecccdh_SECP256R1_17_test_vector_our_priv_key, 2031 .our_priv_key_len = sizeof(ecccdh_SECP256R1_17_test_vector_our_priv_key), 2032 .peer_pub_key = ecccdh_SECP256R1_17_test_vector_peer_pub_key, 2033 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_17_test_vector_peer_pub_key), 2034 .exp_our_pub_key = ecccdh_SECP256R1_17_test_vector_our_pub_key, 2035 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_17_test_vector_our_pub_key), 2036 .exp_shared_secret = ecccdh_SECP256R1_17_test_vector_shared_secret, 2037 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_17_test_vector_shared_secret), 2038 }; 2039 #endif /* WITH_CURVE_SECP256R1 */ 2040 2041 #ifdef WITH_CURVE_SECP256R1 2042 #define ECCCDH_SECP256R1_SELF_TEST_18 2043 /*** Tests for ECCCDH/SECP256R1 ***/ 2044 static const u8 ecccdh_SECP256R1_18_test_vector_our_priv_key[] = { 2045 0xdd, 0x5e, 0x9f, 0x70, 0xae, 0x74, 0x00, 0x73, 0xca, 0x02, 0x04, 0xdf, 0x60, 0x76, 0x3f, 0xb6, 0x03, 0x6c, 0x45, 0x70, 0x9b, 0xf4, 0xa7, 0xbb, 0x4e, 0x67, 0x14, 0x12, 0xfa, 0xd6, 0x5d, 0xa3, 2046 }; 2047 static const u8 ecccdh_SECP256R1_18_test_vector_peer_pub_key[] = { 2048 0xa2, 0xef, 0x85, 0x7a, 0x08, 0x1f, 0x9d, 0x6e, 0xb2, 0x06, 0xa8, 0x1c, 0x4c, 0xf7, 0x8a, 0x80, 0x2b, 0xdf, 0x59, 0x8a, 0xe3, 0x80, 0xc8, 0x88, 0x6e, 0xcd, 0x85, 0xfd, 0xc1, 0xed, 0x76, 0x44, 0x56, 0x3c, 0x4c, 0x20, 0x41, 0x9f, 0x07, 0xbc, 0x17, 0xd0, 0x53, 0x9f, 0xad, 0xe1, 0x85, 0x5e, 0x34, 0x83, 0x95, 0x15, 0xb8, 0x92, 0xc0, 0xf5, 0xd2, 0x65, 0x61, 0xf9, 0x7f, 0xa0, 0x4d, 0x1a, 2049 }; 2050 static const u8 ecccdh_SECP256R1_18_test_vector_our_pub_key[] = { 2051 0x30, 0xb9, 0xdb, 0x2e, 0x2e, 0x97, 0x7b, 0xcd, 0xc9, 0x8c, 0xb8, 0x7d, 0xd7, 0x36, 0xcb, 0xd8, 0xe7, 0x85, 0x52, 0x12, 0x19, 0x25, 0xcf, 0x16, 0xe1, 0x93, 0x36, 0x57, 0xc2, 0xfb, 0x23, 0x14, 0x6a, 0x45, 0x02, 0x88, 0x00, 0xb8, 0x12, 0x91, 0xbc, 0xe5, 0xc2, 0xe1, 0xfe, 0xd7, 0xde, 0xd6, 0x50, 0x62, 0x0e, 0xbb, 0xe6, 0x05, 0x0c, 0x6f, 0x3a, 0x7f, 0x0d, 0xfb, 0x46, 0x73, 0xab, 0x5c, 2052 }; 2053 static const u8 ecccdh_SECP256R1_18_test_vector_shared_secret[] = { 2054 0x43, 0x0e, 0x6a, 0x4f, 0xba, 0x44, 0x49, 0xd7, 0x00, 0xd2, 0x73, 0x3e, 0x55, 0x7f, 0x66, 0xa3, 0xbf, 0x3d, 0x50, 0x51, 0x7c, 0x12, 0x71, 0xb1, 0xdd, 0xae, 0x11, 0x61, 0xb7, 0xac, 0x79, 0x8c, 2055 }; 2056 static const ecdh_test_case ecccdh_SECP256R1_18_test_case = { 2057 .name = "ECCCDH/SECP256R1 18", 2058 .ecdh_type = ECCCDH, 2059 .ec_str_p = &secp256r1_str_params, 2060 .our_priv_key = ecccdh_SECP256R1_18_test_vector_our_priv_key, 2061 .our_priv_key_len = sizeof(ecccdh_SECP256R1_18_test_vector_our_priv_key), 2062 .peer_pub_key = ecccdh_SECP256R1_18_test_vector_peer_pub_key, 2063 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_18_test_vector_peer_pub_key), 2064 .exp_our_pub_key = ecccdh_SECP256R1_18_test_vector_our_pub_key, 2065 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_18_test_vector_our_pub_key), 2066 .exp_shared_secret = ecccdh_SECP256R1_18_test_vector_shared_secret, 2067 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_18_test_vector_shared_secret), 2068 }; 2069 #endif /* WITH_CURVE_SECP256R1 */ 2070 2071 #ifdef WITH_CURVE_SECP256R1 2072 #define ECCCDH_SECP256R1_SELF_TEST_19 2073 /*** Tests for ECCCDH/SECP256R1 ***/ 2074 static const u8 ecccdh_SECP256R1_19_test_vector_our_priv_key[] = { 2075 0x5a, 0xe0, 0x26, 0xcf, 0xc0, 0x60, 0xd5, 0x56, 0x00, 0x71, 0x7e, 0x55, 0xb8, 0xa1, 0x2e, 0x11, 0x6d, 0x1d, 0x0d, 0xf3, 0x4a, 0xf8, 0x31, 0x97, 0x90, 0x57, 0x60, 0x7c, 0x2d, 0x9c, 0x2f, 0x76, 2076 }; 2077 static const u8 ecccdh_SECP256R1_19_test_vector_peer_pub_key[] = { 2078 0xcc, 0xd8, 0xa2, 0xd8, 0x6b, 0xc9, 0x2f, 0x2e, 0x01, 0xbc, 0xe4, 0xd6, 0x92, 0x2c, 0xf7, 0xfe, 0x16, 0x26, 0xae, 0xd0, 0x44, 0x68, 0x5e, 0x95, 0xe2, 0xee, 0xbd, 0x46, 0x45, 0x05, 0xf0, 0x1f, 0xe9, 0xdd, 0xd5, 0x83, 0xa9, 0x63, 0x5a, 0x66, 0x77, 0x77, 0xd5, 0xb8, 0xa8, 0xf3, 0x1b, 0x0f, 0x79, 0xeb, 0xa1, 0x2c, 0x75, 0x02, 0x34, 0x10, 0xb5, 0x4b, 0x85, 0x67, 0xdd, 0xdc, 0x0f, 0x38, 2079 }; 2080 static const u8 ecccdh_SECP256R1_19_test_vector_our_pub_key[] = { 2081 0x46, 0xc9, 0xeb, 0xd1, 0xa4, 0xa3, 0xc8, 0xc0, 0xb6, 0xd5, 0x72, 0xb5, 0xdc, 0xfb, 0xa1, 0x24, 0x67, 0x60, 0x32, 0x08, 0xa9, 0xcb, 0x5d, 0x2a, 0xcf, 0xbb, 0x73, 0x3c, 0x40, 0xcf, 0x63, 0x91, 0x46, 0xc9, 0x13, 0xa2, 0x7d, 0x04, 0x41, 0x85, 0xd3, 0x8b, 0x46, 0x7a, 0xce, 0x01, 0x1e, 0x04, 0xd4, 0xd9, 0xbb, 0xbb, 0x8c, 0xb9, 0xae, 0x25, 0xfa, 0x92, 0xaa, 0xf1, 0x5a, 0x59, 0x5e, 0x86, 2082 }; 2083 static const u8 ecccdh_SECP256R1_19_test_vector_shared_secret[] = { 2084 0x1c, 0xe9, 0xe6, 0x74, 0x05, 0x29, 0x49, 0x9f, 0x98, 0xd1, 0xf1, 0xd7, 0x13, 0x29, 0x14, 0x7a, 0x33, 0xdf, 0x1d, 0x05, 0xe4, 0x76, 0x5b, 0x53, 0x9b, 0x11, 0xcf, 0x61, 0x5d, 0x69, 0x74, 0xd3, 2085 }; 2086 static const ecdh_test_case ecccdh_SECP256R1_19_test_case = { 2087 .name = "ECCCDH/SECP256R1 19", 2088 .ecdh_type = ECCCDH, 2089 .ec_str_p = &secp256r1_str_params, 2090 .our_priv_key = ecccdh_SECP256R1_19_test_vector_our_priv_key, 2091 .our_priv_key_len = sizeof(ecccdh_SECP256R1_19_test_vector_our_priv_key), 2092 .peer_pub_key = ecccdh_SECP256R1_19_test_vector_peer_pub_key, 2093 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_19_test_vector_peer_pub_key), 2094 .exp_our_pub_key = ecccdh_SECP256R1_19_test_vector_our_pub_key, 2095 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_19_test_vector_our_pub_key), 2096 .exp_shared_secret = ecccdh_SECP256R1_19_test_vector_shared_secret, 2097 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_19_test_vector_shared_secret), 2098 }; 2099 #endif /* WITH_CURVE_SECP256R1 */ 2100 2101 #ifdef WITH_CURVE_SECP256R1 2102 #define ECCCDH_SECP256R1_SELF_TEST_20 2103 /*** Tests for ECCCDH/SECP256R1 ***/ 2104 static const u8 ecccdh_SECP256R1_20_test_vector_our_priv_key[] = { 2105 0xb6, 0x01, 0xac, 0x42, 0x5d, 0x5d, 0xbf, 0x9e, 0x17, 0x35, 0xc5, 0xe2, 0xd5, 0xbd, 0xb7, 0x9c, 0xa9, 0x8b, 0x3d, 0x5b, 0xe4, 0xa2, 0xcf, 0xd6, 0xf2, 0x27, 0x3f, 0x15, 0x0e, 0x06, 0x4d, 0x9d, 2106 }; 2107 static const u8 ecccdh_SECP256R1_20_test_vector_peer_pub_key[] = { 2108 0xc1, 0x88, 0xff, 0xc8, 0x94, 0x7f, 0x73, 0x01, 0xfb, 0x7b, 0x53, 0xe3, 0x67, 0x46, 0x09, 0x7c, 0x21, 0x34, 0xbf, 0x9c, 0xc9, 0x81, 0xba, 0x74, 0xb4, 0xe9, 0xc4, 0x36, 0x1f, 0x59, 0x5e, 0x4e, 0xbf, 0x7d, 0x2f, 0x20, 0x56, 0xe7, 0x24, 0x21, 0xef, 0x39, 0x3f, 0x0c, 0x0f, 0x2b, 0x0e, 0x00, 0x13, 0x0e, 0x3c, 0xac, 0x4a, 0xbb, 0xcc, 0x00, 0x28, 0x61, 0x68, 0xe8, 0x5e, 0xc5, 0x50, 0x51, 2109 }; 2110 static const u8 ecccdh_SECP256R1_20_test_vector_our_pub_key[] = { 2111 0x7c, 0x9e, 0x95, 0x08, 0x41, 0xd2, 0x6c, 0x8d, 0xde, 0x89, 0x94, 0x39, 0x8b, 0x8f, 0x5d, 0x47, 0x5a, 0x02, 0x2b, 0xc6, 0x3d, 0xe7, 0x77, 0x3f, 0xcf, 0x8d, 0x55, 0x2e, 0x01, 0xf1, 0xba, 0x0a, 0xcc, 0x42, 0xb9, 0x88, 0x5c, 0x9b, 0x3b, 0xee, 0x0f, 0x8d, 0x8c, 0x57, 0xd3, 0xa8, 0xf6, 0x35, 0x50, 0x16, 0xc0, 0x19, 0xc4, 0x06, 0x2f, 0xa2, 0x2c, 0xff, 0x2f, 0x20, 0x9b, 0x5c, 0xc2, 0xe1, 2112 }; 2113 static const u8 ecccdh_SECP256R1_20_test_vector_shared_secret[] = { 2114 0x46, 0x90, 0xe3, 0x74, 0x3c, 0x07, 0xd6, 0x43, 0xf1, 0xbc, 0x18, 0x36, 0x36, 0xab, 0x2a, 0x9c, 0xb9, 0x36, 0xa6, 0x0a, 0x80, 0x21, 0x13, 0xc4, 0x9b, 0xb1, 0xb3, 0xf2, 0xd0, 0x66, 0x16, 0x60, 2115 }; 2116 static const ecdh_test_case ecccdh_SECP256R1_20_test_case = { 2117 .name = "ECCCDH/SECP256R1 20", 2118 .ecdh_type = ECCCDH, 2119 .ec_str_p = &secp256r1_str_params, 2120 .our_priv_key = ecccdh_SECP256R1_20_test_vector_our_priv_key, 2121 .our_priv_key_len = sizeof(ecccdh_SECP256R1_20_test_vector_our_priv_key), 2122 .peer_pub_key = ecccdh_SECP256R1_20_test_vector_peer_pub_key, 2123 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_20_test_vector_peer_pub_key), 2124 .exp_our_pub_key = ecccdh_SECP256R1_20_test_vector_our_pub_key, 2125 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_20_test_vector_our_pub_key), 2126 .exp_shared_secret = ecccdh_SECP256R1_20_test_vector_shared_secret, 2127 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_20_test_vector_shared_secret), 2128 }; 2129 #endif /* WITH_CURVE_SECP256R1 */ 2130 2131 #ifdef WITH_CURVE_SECP256R1 2132 #define ECCCDH_SECP256R1_SELF_TEST_21 2133 /*** Tests for ECCCDH/SECP256R1 ***/ 2134 static const u8 ecccdh_SECP256R1_21_test_vector_our_priv_key[] = { 2135 0xfe, 0xfb, 0x1d, 0xda, 0x18, 0x45, 0x31, 0x2b, 0x5f, 0xce, 0x6b, 0x81, 0xb2, 0xbe, 0x20, 0x5a, 0xf2, 0xf3, 0xa2, 0x74, 0xf5, 0xa2, 0x12, 0xf6, 0x6c, 0x0d, 0x9f, 0xc3, 0x3d, 0x7a, 0xe5, 0x35, 2136 }; 2137 static const u8 ecccdh_SECP256R1_21_test_vector_peer_pub_key[] = { 2138 0x31, 0x7e, 0x10, 0x20, 0xff, 0x53, 0xfc, 0xce, 0xf1, 0x8b, 0xf4, 0x7b, 0xb7, 0xf2, 0xdd, 0x77, 0x07, 0xfb, 0x7b, 0x7a, 0x75, 0x78, 0xe0, 0x4f, 0x35, 0xb3, 0xbe, 0xed, 0x22, 0x2a, 0x0e, 0xb6, 0x09, 0x42, 0x0c, 0xe5, 0xa1, 0x9d, 0x77, 0xc6, 0xfe, 0x1e, 0xe5, 0x87, 0xe6, 0xa4, 0x9f, 0xba, 0xf8, 0xf2, 0x80, 0xe8, 0xdf, 0x03, 0x3d, 0x75, 0x40, 0x33, 0x02, 0xe5, 0xa2, 0x7d, 0xb2, 0xae, 2139 }; 2140 static const u8 ecccdh_SECP256R1_21_test_vector_our_pub_key[] = { 2141 0x38, 0xb5, 0x4d, 0xb8, 0x55, 0x00, 0xcb, 0x20, 0xc6, 0x10, 0x56, 0xed, 0xd3, 0xd8, 0x8b, 0x6a, 0x9d, 0xc2, 0x67, 0x80, 0xa0, 0x47, 0xf2, 0x13, 0xa6, 0xe1, 0xb9, 0x00, 0xf7, 0x65, 0x96, 0xeb, 0x63, 0x87, 0xe4, 0xe5, 0x78, 0x15, 0x71, 0xe4, 0xeb, 0x8a, 0xe6, 0x29, 0x91, 0xa3, 0x3b, 0x5d, 0xc3, 0x33, 0x01, 0xc5, 0xbc, 0x7e, 0x12, 0x5d, 0x53, 0x79, 0x4a, 0x39, 0x16, 0x0d, 0x8f, 0xd0, 2142 }; 2143 static const u8 ecccdh_SECP256R1_21_test_vector_shared_secret[] = { 2144 0x30, 0xc2, 0x26, 0x1b, 0xd0, 0x00, 0x4e, 0x61, 0xfe, 0xda, 0x2c, 0x16, 0xaa, 0x5e, 0x21, 0xff, 0xa8, 0xd7, 0xe7, 0xf7, 0xdb, 0xf6, 0xec, 0x37, 0x9a, 0x43, 0xb4, 0x8e, 0x4b, 0x36, 0xae, 0xb0, 2145 }; 2146 static const ecdh_test_case ecccdh_SECP256R1_21_test_case = { 2147 .name = "ECCCDH/SECP256R1 21", 2148 .ecdh_type = ECCCDH, 2149 .ec_str_p = &secp256r1_str_params, 2150 .our_priv_key = ecccdh_SECP256R1_21_test_vector_our_priv_key, 2151 .our_priv_key_len = sizeof(ecccdh_SECP256R1_21_test_vector_our_priv_key), 2152 .peer_pub_key = ecccdh_SECP256R1_21_test_vector_peer_pub_key, 2153 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_21_test_vector_peer_pub_key), 2154 .exp_our_pub_key = ecccdh_SECP256R1_21_test_vector_our_pub_key, 2155 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_21_test_vector_our_pub_key), 2156 .exp_shared_secret = ecccdh_SECP256R1_21_test_vector_shared_secret, 2157 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_21_test_vector_shared_secret), 2158 }; 2159 #endif /* WITH_CURVE_SECP256R1 */ 2160 2161 #ifdef WITH_CURVE_SECP256R1 2162 #define ECCCDH_SECP256R1_SELF_TEST_22 2163 /*** Tests for ECCCDH/SECP256R1 ***/ 2164 static const u8 ecccdh_SECP256R1_22_test_vector_our_priv_key[] = { 2165 0x33, 0x4a, 0xe0, 0xc4, 0x69, 0x3d, 0x23, 0x93, 0x5a, 0x7e, 0x8e, 0x04, 0x3e, 0xbb, 0xde, 0x21, 0xe1, 0x68, 0xa7, 0xcb, 0xa3, 0xfa, 0x50, 0x7c, 0x9b, 0xe4, 0x1d, 0x76, 0x81, 0xe0, 0x49, 0xce, 2166 }; 2167 static const u8 ecccdh_SECP256R1_22_test_vector_peer_pub_key[] = { 2168 0x45, 0xfb, 0x02, 0xb2, 0xce, 0xb9, 0xd7, 0xc7, 0x9d, 0x9c, 0x2f, 0xa9, 0x3e, 0x9c, 0x79, 0x67, 0xc2, 0xfa, 0x4d, 0xf5, 0x78, 0x9f, 0x96, 0x40, 0xb2, 0x42, 0x64, 0xb1, 0xe5, 0x24, 0xfc, 0xb1, 0x5c, 0x6e, 0x8e, 0xcf, 0x1f, 0x7d, 0x30, 0x23, 0x89, 0x3b, 0x7b, 0x1c, 0xa1, 0xe4, 0xd1, 0x78, 0x97, 0x2e, 0xe2, 0xa2, 0x30, 0x75, 0x7d, 0xdc, 0x56, 0x4f, 0xfe, 0x37, 0xf5, 0xc5, 0xa3, 0x21, 2169 }; 2170 static const u8 ecccdh_SECP256R1_22_test_vector_our_pub_key[] = { 2171 0x3f, 0x2b, 0xf1, 0x58, 0x9a, 0xbf, 0x30, 0x47, 0xbf, 0x3e, 0x54, 0xac, 0x9a, 0x95, 0x37, 0x9b, 0xff, 0x95, 0xf8, 0xf5, 0x54, 0x05, 0xf6, 0x4e, 0xca, 0x36, 0xa7, 0xee, 0xbe, 0x8f, 0xfc, 0xa7, 0x52, 0x12, 0xa9, 0x4e, 0x66, 0xc5, 0xae, 0x9a, 0x89, 0x91, 0x87, 0x2f, 0x66, 0xa7, 0x27, 0x23, 0xd8, 0x0e, 0xc5, 0xb2, 0xe9, 0x25, 0x74, 0x5c, 0x45, 0x6f, 0x53, 0x71, 0x94, 0x3b, 0x3a, 0x06, 2172 }; 2173 static const u8 ecccdh_SECP256R1_22_test_vector_shared_secret[] = { 2174 0x2a, 0xda, 0xe4, 0xa1, 0x38, 0xa2, 0x39, 0xdc, 0xd9, 0x3c, 0x24, 0x3a, 0x38, 0x03, 0xc3, 0xe4, 0xcf, 0x96, 0xe3, 0x7f, 0xe1, 0x4e, 0x6a, 0x9b, 0x71, 0x7b, 0xe9, 0x59, 0x99, 0x59, 0xb1, 0x1c, 2175 }; 2176 static const ecdh_test_case ecccdh_SECP256R1_22_test_case = { 2177 .name = "ECCCDH/SECP256R1 22", 2178 .ecdh_type = ECCCDH, 2179 .ec_str_p = &secp256r1_str_params, 2180 .our_priv_key = ecccdh_SECP256R1_22_test_vector_our_priv_key, 2181 .our_priv_key_len = sizeof(ecccdh_SECP256R1_22_test_vector_our_priv_key), 2182 .peer_pub_key = ecccdh_SECP256R1_22_test_vector_peer_pub_key, 2183 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_22_test_vector_peer_pub_key), 2184 .exp_our_pub_key = ecccdh_SECP256R1_22_test_vector_our_pub_key, 2185 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_22_test_vector_our_pub_key), 2186 .exp_shared_secret = ecccdh_SECP256R1_22_test_vector_shared_secret, 2187 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_22_test_vector_shared_secret), 2188 }; 2189 #endif /* WITH_CURVE_SECP256R1 */ 2190 2191 #ifdef WITH_CURVE_SECP256R1 2192 #define ECCCDH_SECP256R1_SELF_TEST_23 2193 /*** Tests for ECCCDH/SECP256R1 ***/ 2194 static const u8 ecccdh_SECP256R1_23_test_vector_our_priv_key[] = { 2195 0x2c, 0x4b, 0xde, 0x40, 0x21, 0x4f, 0xcc, 0x3b, 0xfc, 0x47, 0xd4, 0xcf, 0x43, 0x4b, 0x62, 0x9a, 0xcb, 0xe9, 0x15, 0x7f, 0x8f, 0xd0, 0x28, 0x25, 0x40, 0x33, 0x1d, 0xe7, 0x94, 0x2c, 0xf0, 0x9d, 2196 }; 2197 static const u8 ecccdh_SECP256R1_23_test_vector_peer_pub_key[] = { 2198 0xa1, 0x9e, 0xf7, 0xbf, 0xf9, 0x8a, 0xda, 0x78, 0x18, 0x42, 0xfb, 0xfc, 0x51, 0xa4, 0x7a, 0xff, 0x39, 0xb5, 0x93, 0x5a, 0x1c, 0x7d, 0x96, 0x25, 0xc8, 0xd3, 0x23, 0xd5, 0x11, 0xc9, 0x2d, 0xe6, 0xe9, 0xc1, 0x84, 0xdf, 0x75, 0xc9, 0x55, 0xe0, 0x2e, 0x02, 0xe4, 0x00, 0xff, 0xe4, 0x5f, 0x78, 0xf3, 0x39, 0xe1, 0xaf, 0xe6, 0xd0, 0x56, 0xfb, 0x32, 0x45, 0xf4, 0x70, 0x0c, 0xe6, 0x06, 0xef, 2199 }; 2200 static const u8 ecccdh_SECP256R1_23_test_vector_our_pub_key[] = { 2201 0x29, 0xc0, 0x80, 0x7f, 0x10, 0xcb, 0xc4, 0x2f, 0xb4, 0x5c, 0x99, 0x89, 0xda, 0x50, 0x68, 0x1e, 0xea, 0xd7, 0x16, 0xda, 0xa7, 0xb9, 0xe9, 0x1f, 0xd3, 0x2e, 0x06, 0x2f, 0x5e, 0xb9, 0x2c, 0xa0, 0xff, 0x1d, 0x6d, 0x19, 0x55, 0xd7, 0x37, 0x6b, 0x2d, 0xa2, 0x4f, 0xe1, 0x16, 0x3a, 0x27, 0x16, 0x59, 0x13, 0x63, 0x41, 0xbc, 0x2e, 0xb1, 0x19, 0x5f, 0xc7, 0x06, 0xdc, 0x62, 0xe7, 0xf3, 0x4d, 2202 }; 2203 static const u8 ecccdh_SECP256R1_23_test_vector_shared_secret[] = { 2204 0x2e, 0x27, 0x7e, 0xc3, 0x0f, 0x5e, 0xa0, 0x7d, 0x6c, 0xe5, 0x13, 0x14, 0x9b, 0x94, 0x79, 0xb9, 0x6e, 0x07, 0xf4, 0xb6, 0x91, 0x3b, 0x1b, 0x5c, 0x11, 0x30, 0x5c, 0x14, 0x44, 0xa1, 0xbc, 0x0b, 2205 }; 2206 static const ecdh_test_case ecccdh_SECP256R1_23_test_case = { 2207 .name = "ECCCDH/SECP256R1 23", 2208 .ecdh_type = ECCCDH, 2209 .ec_str_p = &secp256r1_str_params, 2210 .our_priv_key = ecccdh_SECP256R1_23_test_vector_our_priv_key, 2211 .our_priv_key_len = sizeof(ecccdh_SECP256R1_23_test_vector_our_priv_key), 2212 .peer_pub_key = ecccdh_SECP256R1_23_test_vector_peer_pub_key, 2213 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_23_test_vector_peer_pub_key), 2214 .exp_our_pub_key = ecccdh_SECP256R1_23_test_vector_our_pub_key, 2215 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_23_test_vector_our_pub_key), 2216 .exp_shared_secret = ecccdh_SECP256R1_23_test_vector_shared_secret, 2217 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_23_test_vector_shared_secret), 2218 }; 2219 #endif /* WITH_CURVE_SECP256R1 */ 2220 2221 #ifdef WITH_CURVE_SECP256R1 2222 #define ECCCDH_SECP256R1_SELF_TEST_24 2223 /*** Tests for ECCCDH/SECP256R1 ***/ 2224 static const u8 ecccdh_SECP256R1_24_test_vector_our_priv_key[] = { 2225 0x85, 0xa2, 0x68, 0xf9, 0xd7, 0x77, 0x2f, 0x99, 0x0c, 0x36, 0xb4, 0x2b, 0x0a, 0x33, 0x1a, 0xdc, 0x92, 0xb5, 0x94, 0x1d, 0xe0, 0xb8, 0x62, 0xd5, 0xd8, 0x9a, 0x34, 0x7c, 0xbf, 0x8f, 0xaa, 0xb0, 2226 }; 2227 static const u8 ecccdh_SECP256R1_24_test_vector_peer_pub_key[] = { 2228 0x35, 0x6c, 0x5a, 0x44, 0x4c, 0x04, 0x9a, 0x52, 0xfe, 0xe0, 0xad, 0xeb, 0x7e, 0x5d, 0x82, 0xae, 0x5a, 0xa8, 0x30, 0x30, 0xbf, 0xff, 0x31, 0xbb, 0xf8, 0xce, 0x20, 0x96, 0xcf, 0x16, 0x1c, 0x4b, 0x57, 0xd1, 0x28, 0xde, 0x8b, 0x2a, 0x57, 0xa0, 0x94, 0xd1, 0xa0, 0x01, 0xe5, 0x72, 0x17, 0x3f, 0x96, 0xe8, 0x86, 0x6a, 0xe3, 0x52, 0xbf, 0x29, 0xcd, 0xda, 0xf9, 0x2f, 0xc8, 0x5b, 0x2f, 0x92, 2229 }; 2230 static const u8 ecccdh_SECP256R1_24_test_vector_our_pub_key[] = { 2231 0x9c, 0xf4, 0xb9, 0x85, 0x81, 0xca, 0x17, 0x79, 0x45, 0x3c, 0xc8, 0x16, 0xff, 0x28, 0xb4, 0x10, 0x0a, 0xf5, 0x6c, 0xf1, 0xbf, 0x2e, 0x5b, 0xc3, 0x12, 0xd8, 0x3b, 0x6b, 0x1b, 0x21, 0xd3, 0x33, 0x7a, 0x55, 0x04, 0xfc, 0xac, 0x52, 0x31, 0xa0, 0xd1, 0x2d, 0x65, 0x82, 0x18, 0x28, 0x48, 0x68, 0x22, 0x9c, 0x84, 0x4a, 0x04, 0xa3, 0x45, 0x0d, 0x6c, 0x73, 0x81, 0xab, 0xe0, 0x80, 0xbf, 0x3b, 2232 }; 2233 static const u8 ecccdh_SECP256R1_24_test_vector_shared_secret[] = { 2234 0x1e, 0x51, 0x37, 0x3b, 0xd2, 0xc6, 0x04, 0x4c, 0x12, 0x9c, 0x43, 0x6e, 0x74, 0x2a, 0x55, 0xbe, 0x2a, 0x66, 0x8a, 0x85, 0xae, 0x08, 0x44, 0x1b, 0x67, 0x56, 0x44, 0x5d, 0xf5, 0x49, 0x38, 0x57, 2235 }; 2236 static const ecdh_test_case ecccdh_SECP256R1_24_test_case = { 2237 .name = "ECCCDH/SECP256R1 24", 2238 .ecdh_type = ECCCDH, 2239 .ec_str_p = &secp256r1_str_params, 2240 .our_priv_key = ecccdh_SECP256R1_24_test_vector_our_priv_key, 2241 .our_priv_key_len = sizeof(ecccdh_SECP256R1_24_test_vector_our_priv_key), 2242 .peer_pub_key = ecccdh_SECP256R1_24_test_vector_peer_pub_key, 2243 .peer_pub_key_len = sizeof(ecccdh_SECP256R1_24_test_vector_peer_pub_key), 2244 .exp_our_pub_key = ecccdh_SECP256R1_24_test_vector_our_pub_key, 2245 .exp_our_pub_key_len = sizeof(ecccdh_SECP256R1_24_test_vector_our_pub_key), 2246 .exp_shared_secret = ecccdh_SECP256R1_24_test_vector_shared_secret, 2247 .exp_shared_secret_len = sizeof(ecccdh_SECP256R1_24_test_vector_shared_secret), 2248 }; 2249 #endif /* WITH_CURVE_SECP256R1 */ 2250 2251 #ifdef WITH_CURVE_SECP384R1 2252 #define ECCCDH_SECP384R1_SELF_TEST_0 2253 /*** Tests for ECCCDH/SECP384R1 ***/ 2254 static const u8 ecccdh_SECP384R1_0_test_vector_our_priv_key[] = { 2255 0x3c, 0xc3, 0x12, 0x2a, 0x68, 0xf0, 0xd9, 0x50, 0x27, 0xad, 0x38, 0xc0, 0x67, 0x91, 0x6b, 0xa0, 0xeb, 0x8c, 0x38, 0x89, 0x4d, 0x22, 0xe1, 0xb1, 0x56, 0x18, 0xb6, 0x81, 0x8a, 0x66, 0x17, 0x74, 0xad, 0x46, 0x3b, 0x20, 0x5d, 0xa8, 0x8c, 0xf6, 0x99, 0xab, 0x4d, 0x43, 0xc9, 0xcf, 0x98, 0xa1, 2256 }; 2257 static const u8 ecccdh_SECP384R1_0_test_vector_peer_pub_key[] = { 2258 0xa7, 0xc7, 0x6b, 0x97, 0x0c, 0x3b, 0x5f, 0xe8, 0xb0, 0x5d, 0x28, 0x38, 0xae, 0x04, 0xab, 0x47, 0x69, 0x7b, 0x9e, 0xaf, 0x52, 0xe7, 0x64, 0x59, 0x2e, 0xfd, 0xa2, 0x7f, 0xe7, 0x51, 0x32, 0x72, 0x73, 0x44, 0x66, 0xb4, 0x00, 0x09, 0x1a, 0xdb, 0xf2, 0xd6, 0x8c, 0x58, 0xe0, 0xc5, 0x00, 0x66, 0xac, 0x68, 0xf1, 0x9f, 0x2e, 0x1c, 0xb8, 0x79, 0xae, 0xd4, 0x3a, 0x99, 0x69, 0xb9, 0x1a, 0x08, 0x39, 0xc4, 0xc3, 0x8a, 0x49, 0x74, 0x9b, 0x66, 0x1e, 0xfe, 0xdf, 0x24, 0x34, 0x51, 0x91, 0x5e, 0xd0, 0x90, 0x5a, 0x32, 0xb0, 0x60, 0x99, 0x2b, 0x46, 0x8c, 0x64, 0x76, 0x6f, 0xc8, 0x43, 0x7a, 2259 }; 2260 static const u8 ecccdh_SECP384R1_0_test_vector_our_pub_key[] = { 2261 0x98, 0x03, 0x80, 0x7f, 0x2f, 0x6d, 0x2f, 0xd9, 0x66, 0xcd, 0xd0, 0x29, 0x0b, 0xd4, 0x10, 0xc0, 0x19, 0x03, 0x52, 0xfb, 0xec, 0x7f, 0xf6, 0x24, 0x7d, 0xe1, 0x30, 0x2d, 0xf8, 0x6f, 0x25, 0xd3, 0x4f, 0xe4, 0xa9, 0x7b, 0xef, 0x60, 0xcf, 0xf5, 0x48, 0x35, 0x5c, 0x01, 0x5d, 0xbb, 0x3e, 0x5f, 0xba, 0x26, 0xca, 0x69, 0xec, 0x2f, 0x5b, 0x5d, 0x9d, 0xad, 0x20, 0xcc, 0x9d, 0xa7, 0x11, 0x38, 0x3a, 0x9d, 0xbe, 0x34, 0xea, 0x3f, 0xa5, 0xa2, 0xaf, 0x75, 0xb4, 0x65, 0x02, 0x62, 0x9a, 0xd5, 0x4d, 0xd8, 0xb7, 0xd7, 0x3a, 0x8a, 0xbb, 0x06, 0xa3, 0xa3, 0xbe, 0x47, 0xd6, 0x50, 0xcc, 0x99, 2262 }; 2263 static const u8 ecccdh_SECP384R1_0_test_vector_shared_secret[] = { 2264 0x5f, 0x9d, 0x29, 0xdc, 0x5e, 0x31, 0xa1, 0x63, 0x06, 0x03, 0x56, 0x21, 0x36, 0x69, 0xc8, 0xce, 0x13, 0x2e, 0x22, 0xf5, 0x7c, 0x9a, 0x04, 0xf4, 0x0b, 0xa7, 0xfc, 0xea, 0xd4, 0x93, 0xb4, 0x57, 0xe5, 0x62, 0x1e, 0x76, 0x6c, 0x40, 0xa2, 0xe3, 0xd4, 0xd6, 0xa0, 0x4b, 0x25, 0xe5, 0x33, 0xf1, 2265 }; 2266 static const ecdh_test_case ecccdh_SECP384R1_0_test_case = { 2267 .name = "ECCCDH/SECP384R1 0", 2268 .ecdh_type = ECCCDH, 2269 .ec_str_p = &secp384r1_str_params, 2270 .our_priv_key = ecccdh_SECP384R1_0_test_vector_our_priv_key, 2271 .our_priv_key_len = sizeof(ecccdh_SECP384R1_0_test_vector_our_priv_key), 2272 .peer_pub_key = ecccdh_SECP384R1_0_test_vector_peer_pub_key, 2273 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_0_test_vector_peer_pub_key), 2274 .exp_our_pub_key = ecccdh_SECP384R1_0_test_vector_our_pub_key, 2275 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_0_test_vector_our_pub_key), 2276 .exp_shared_secret = ecccdh_SECP384R1_0_test_vector_shared_secret, 2277 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_0_test_vector_shared_secret), 2278 }; 2279 #endif /* WITH_CURVE_SECP384R1 */ 2280 2281 #ifdef WITH_CURVE_SECP384R1 2282 #define ECCCDH_SECP384R1_SELF_TEST_1 2283 /*** Tests for ECCCDH/SECP384R1 ***/ 2284 static const u8 ecccdh_SECP384R1_1_test_vector_our_priv_key[] = { 2285 0x92, 0x86, 0x0c, 0x21, 0xbd, 0xe0, 0x61, 0x65, 0xf8, 0xe9, 0x00, 0xc6, 0x87, 0xf8, 0xef, 0x0a, 0x05, 0xd1, 0x4f, 0x29, 0x0b, 0x3f, 0x07, 0xd8, 0xb3, 0xa8, 0xcc, 0x64, 0x04, 0x36, 0x6e, 0x5d, 0x51, 0x19, 0xcd, 0x6d, 0x03, 0xfb, 0x12, 0xdc, 0x58, 0xe8, 0x9f, 0x13, 0xdf, 0x9c, 0xd7, 0x83, 2286 }; 2287 static const u8 ecccdh_SECP384R1_1_test_vector_peer_pub_key[] = { 2288 0x30, 0xf4, 0x3f, 0xcf, 0x2b, 0x6b, 0x00, 0xde, 0x53, 0xf6, 0x24, 0xf1, 0x54, 0x30, 0x90, 0x68, 0x18, 0x39, 0x71, 0x7d, 0x53, 0xc7, 0xc9, 0x55, 0xd1, 0xd6, 0x9e, 0xfa, 0xf0, 0x34, 0x9b, 0x73, 0x63, 0xac, 0xb4, 0x47, 0x24, 0x01, 0x01, 0xcb, 0xb3, 0xaf, 0x66, 0x41, 0xce, 0x4b, 0x88, 0xe0, 0x25, 0xe4, 0x6c, 0x0c, 0x54, 0xf0, 0x16, 0x2a, 0x77, 0xef, 0xcc, 0x27, 0xb6, 0xea, 0x79, 0x20, 0x02, 0xae, 0x2b, 0xa8, 0x27, 0x14, 0x29, 0x9c, 0x86, 0x08, 0x57, 0xa6, 0x81, 0x53, 0xab, 0x62, 0xe5, 0x25, 0xec, 0x05, 0x30, 0xd8, 0x1b, 0x5a, 0xa1, 0x58, 0x97, 0x98, 0x1e, 0x85, 0x87, 0x57, 2289 }; 2290 static const u8 ecccdh_SECP384R1_1_test_vector_our_pub_key[] = { 2291 0xea, 0x40, 0x18, 0xf5, 0xa3, 0x07, 0xc3, 0x79, 0x18, 0x0b, 0xf6, 0xa6, 0x2f, 0xd2, 0xce, 0xce, 0xeb, 0xee, 0xb7, 0xd4, 0xdf, 0x06, 0x3a, 0x66, 0xfb, 0x83, 0x8a, 0xa3, 0x52, 0x43, 0x41, 0x97, 0x91, 0xf7, 0xe2, 0xc9, 0xd4, 0x80, 0x3c, 0x93, 0x19, 0xaa, 0x0e, 0xb0, 0x3c, 0x41, 0x6b, 0x66, 0x68, 0x83, 0x5a, 0x91, 0x48, 0x4f, 0x05, 0xef, 0x02, 0x82, 0x84, 0xdf, 0x64, 0x36, 0xfb, 0x88, 0xff, 0xeb, 0xab, 0xcd, 0xd6, 0x9a, 0xb0, 0x13, 0x3e, 0x67, 0x35, 0xa1, 0xbc, 0xfb, 0x37, 0x20, 0x3d, 0x10, 0xd3, 0x40, 0xa8, 0x32, 0x8a, 0x7b, 0x68, 0x77, 0x0c, 0xa7, 0x58, 0x78, 0xa1, 0xa6, 2292 }; 2293 static const u8 ecccdh_SECP384R1_1_test_vector_shared_secret[] = { 2294 0xa2, 0x37, 0x42, 0xa2, 0xc2, 0x67, 0xd7, 0x42, 0x5f, 0xda, 0x94, 0xb9, 0x3f, 0x93, 0xbb, 0xcc, 0x24, 0x79, 0x1a, 0xc5, 0x1c, 0xd8, 0xfd, 0x50, 0x1a, 0x23, 0x8d, 0x40, 0x81, 0x2f, 0x4c, 0xbf, 0xc5, 0x9a, 0xac, 0x95, 0x20, 0xd7, 0x58, 0xcf, 0x78, 0x9c, 0x76, 0x30, 0x0c, 0x69, 0xd2, 0xff, 2295 }; 2296 static const ecdh_test_case ecccdh_SECP384R1_1_test_case = { 2297 .name = "ECCCDH/SECP384R1 1", 2298 .ecdh_type = ECCCDH, 2299 .ec_str_p = &secp384r1_str_params, 2300 .our_priv_key = ecccdh_SECP384R1_1_test_vector_our_priv_key, 2301 .our_priv_key_len = sizeof(ecccdh_SECP384R1_1_test_vector_our_priv_key), 2302 .peer_pub_key = ecccdh_SECP384R1_1_test_vector_peer_pub_key, 2303 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_1_test_vector_peer_pub_key), 2304 .exp_our_pub_key = ecccdh_SECP384R1_1_test_vector_our_pub_key, 2305 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_1_test_vector_our_pub_key), 2306 .exp_shared_secret = ecccdh_SECP384R1_1_test_vector_shared_secret, 2307 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_1_test_vector_shared_secret), 2308 }; 2309 #endif /* WITH_CURVE_SECP384R1 */ 2310 2311 #ifdef WITH_CURVE_SECP384R1 2312 #define ECCCDH_SECP384R1_SELF_TEST_2 2313 /*** Tests for ECCCDH/SECP384R1 ***/ 2314 static const u8 ecccdh_SECP384R1_2_test_vector_our_priv_key[] = { 2315 0x12, 0xcf, 0x6a, 0x22, 0x3a, 0x72, 0x35, 0x25, 0x43, 0x83, 0x0f, 0x3f, 0x18, 0x53, 0x0d, 0x5c, 0xb3, 0x7f, 0x26, 0x88, 0x0a, 0x0b, 0x29, 0x44, 0x82, 0xc8, 0xa8, 0xef, 0x8a, 0xfa, 0xd0, 0x9a, 0xa7, 0x8b, 0x7d, 0xc2, 0xf2, 0x78, 0x9a, 0x78, 0xc6, 0x6a, 0xf5, 0xd1, 0xcc, 0x55, 0x38, 0x53, 2316 }; 2317 static const u8 ecccdh_SECP384R1_2_test_vector_peer_pub_key[] = { 2318 0x1a, 0xef, 0xbf, 0xa2, 0xc6, 0xc8, 0xc8, 0x55, 0xa1, 0xa2, 0x16, 0x77, 0x45, 0x50, 0xb7, 0x9a, 0x24, 0xcd, 0xa3, 0x76, 0x07, 0xbb, 0x1f, 0x7c, 0xc9, 0x06, 0x65, 0x0e, 0xe4, 0xb3, 0x81, 0x6d, 0x68, 0xf6, 0xa9, 0xc7, 0x5d, 0xa6, 0xe4, 0x24, 0x2c, 0xeb, 0xfb, 0x66, 0x52, 0xf6, 0x51, 0x80, 0x41, 0x9d, 0x28, 0xb7, 0x23, 0xeb, 0xad, 0xb7, 0x65, 0x8f, 0xce, 0xbb, 0x9a, 0xd9, 0xb7, 0xad, 0xea, 0x67, 0x4f, 0x1d, 0xa3, 0xdc, 0x6b, 0x63, 0x97, 0xb5, 0x5d, 0xa0, 0xf6, 0x1a, 0x3e, 0xdd, 0xac, 0xb4, 0xac, 0xdb, 0x14, 0x44, 0x1c, 0xb2, 0x14, 0xb0, 0x4a, 0x08, 0x44, 0xc0, 0x2f, 0xa3, 2319 }; 2320 static const u8 ecccdh_SECP384R1_2_test_vector_our_pub_key[] = { 2321 0xfc, 0xfc, 0xea, 0x08, 0x5e, 0x8c, 0xf7, 0x4d, 0x0d, 0xce, 0xd1, 0x62, 0x0b, 0xa8, 0x42, 0x36, 0x94, 0xf9, 0x03, 0xa2, 0x19, 0xbb, 0xf9, 0x01, 0xb0, 0xb5, 0x9d, 0x6a, 0xc8, 0x1b, 0xaa, 0xd3, 0x16, 0xa2, 0x42, 0xba, 0x32, 0xbd, 0xe8, 0x5c, 0xb2, 0x48, 0x11, 0x9b, 0x85, 0x2f, 0xab, 0x66, 0x97, 0x2e, 0x3c, 0x68, 0xc7, 0xab, 0x40, 0x2c, 0x58, 0x36, 0xf2, 0xa1, 0x6e, 0xd4, 0x51, 0xa3, 0x31, 0x20, 0xa7, 0x75, 0x0a, 0x60, 0x39, 0xf3, 0xff, 0x15, 0x38, 0x8e, 0xe6, 0x22, 0xb7, 0x06, 0x5f, 0x71, 0x22, 0xbf, 0x6d, 0x51, 0xae, 0xfb, 0xc2, 0x9b, 0x37, 0xb0, 0x34, 0x04, 0x58, 0x1b, 2322 }; 2323 static const u8 ecccdh_SECP384R1_2_test_vector_shared_secret[] = { 2324 0x3d, 0x2e, 0x64, 0x0f, 0x35, 0x08, 0x05, 0xee, 0xd1, 0xff, 0x43, 0xb4, 0x0a, 0x72, 0xb2, 0xab, 0xed, 0x0a, 0x51, 0x8b, 0xce, 0xbe, 0x8f, 0x2d, 0x15, 0xb1, 0x11, 0xb6, 0x77, 0x32, 0x23, 0xda, 0x3c, 0x34, 0x89, 0x12, 0x1d, 0xb1, 0x73, 0xd4, 0x14, 0xb5, 0xbd, 0x5a, 0xd7, 0x15, 0x34, 0x35, 2325 }; 2326 static const ecdh_test_case ecccdh_SECP384R1_2_test_case = { 2327 .name = "ECCCDH/SECP384R1 2", 2328 .ecdh_type = ECCCDH, 2329 .ec_str_p = &secp384r1_str_params, 2330 .our_priv_key = ecccdh_SECP384R1_2_test_vector_our_priv_key, 2331 .our_priv_key_len = sizeof(ecccdh_SECP384R1_2_test_vector_our_priv_key), 2332 .peer_pub_key = ecccdh_SECP384R1_2_test_vector_peer_pub_key, 2333 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_2_test_vector_peer_pub_key), 2334 .exp_our_pub_key = ecccdh_SECP384R1_2_test_vector_our_pub_key, 2335 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_2_test_vector_our_pub_key), 2336 .exp_shared_secret = ecccdh_SECP384R1_2_test_vector_shared_secret, 2337 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_2_test_vector_shared_secret), 2338 }; 2339 #endif /* WITH_CURVE_SECP384R1 */ 2340 2341 #ifdef WITH_CURVE_SECP384R1 2342 #define ECCCDH_SECP384R1_SELF_TEST_3 2343 /*** Tests for ECCCDH/SECP384R1 ***/ 2344 static const u8 ecccdh_SECP384R1_3_test_vector_our_priv_key[] = { 2345 0x8d, 0xd4, 0x80, 0x63, 0xa3, 0xa0, 0x58, 0xc3, 0x34, 0xb5, 0xcc, 0x7a, 0x4c, 0xe0, 0x7d, 0x02, 0xe5, 0xee, 0x6d, 0x8f, 0x1f, 0x3c, 0x51, 0xa1, 0x60, 0x09, 0x62, 0xcb, 0xab, 0x46, 0x26, 0x90, 0xae, 0x3c, 0xd9, 0x74, 0xfb, 0x39, 0xe4, 0x0b, 0x0e, 0x84, 0x3d, 0xaa, 0x0f, 0xd3, 0x2d, 0xe1, 2346 }; 2347 static const u8 ecccdh_SECP384R1_3_test_vector_peer_pub_key[] = { 2348 0x8b, 0xc0, 0x89, 0x32, 0x6e, 0xc5, 0x5b, 0x9c, 0xf5, 0x9b, 0x34, 0xf0, 0xeb, 0x75, 0x4d, 0x93, 0x59, 0x6c, 0xa2, 0x90, 0xfc, 0xb3, 0x44, 0x4c, 0x83, 0xd4, 0xde, 0x3a, 0x56, 0x07, 0x03, 0x7e, 0xc3, 0x97, 0x68, 0x3f, 0x8c, 0xef, 0x07, 0xea, 0xb2, 0xfe, 0x35, 0x7e, 0xae, 0x36, 0xc4, 0x49, 0xd9, 0xd1, 0x6c, 0xe8, 0xac, 0x85, 0xb3, 0xf1, 0xe9, 0x45, 0x68, 0x52, 0x1a, 0xae, 0x53, 0x4e, 0x67, 0x13, 0x9e, 0x31, 0x0e, 0xc7, 0x26, 0x93, 0x52, 0x6a, 0xa2, 0xe9, 0x27, 0xb5, 0xb3, 0x22, 0xc9, 0x5a, 0x1a, 0x03, 0x3c, 0x22, 0x9c, 0xb6, 0x77, 0x0c, 0x95, 0x7c, 0xd3, 0x14, 0x8d, 0xd7, 2349 }; 2350 static const u8 ecccdh_SECP384R1_3_test_vector_our_pub_key[] = { 2351 0xe3, 0x8c, 0x98, 0x46, 0x24, 0x81, 0x23, 0xc3, 0x42, 0x18, 0x61, 0xea, 0x4d, 0x32, 0x66, 0x9a, 0x7b, 0x5c, 0x3c, 0x08, 0x37, 0x6a, 0xd2, 0x81, 0x04, 0x39, 0x94, 0x94, 0xc8, 0x4f, 0xf5, 0xef, 0xa3, 0x89, 0x4a, 0xdb, 0x2c, 0x6c, 0xbe, 0x8c, 0x3c, 0x91, 0x3e, 0xf2, 0xee, 0xc5, 0xbd, 0x3c, 0x9f, 0xa8, 0x40, 0x24, 0xa1, 0x02, 0x87, 0x96, 0xdf, 0x84, 0x02, 0x1f, 0x7b, 0x6c, 0x9d, 0x02, 0xf0, 0xf4, 0xbd, 0x1a, 0x61, 0x2a, 0x03, 0xcb, 0xf7, 0x5a, 0x0b, 0xee, 0xa4, 0x3f, 0xef, 0x8a, 0xe8, 0x4b, 0x48, 0xc6, 0x01, 0x72, 0xaa, 0xdf, 0x09, 0xc1, 0xad, 0x01, 0x6d, 0x0b, 0xf3, 0xce, 2352 }; 2353 static const u8 ecccdh_SECP384R1_3_test_vector_shared_secret[] = { 2354 0x6a, 0x42, 0xcf, 0xc3, 0x92, 0xab, 0xa0, 0xbf, 0xd3, 0xd1, 0x7b, 0x7c, 0xcf, 0x06, 0x2b, 0x91, 0xfc, 0x09, 0xbb, 0xf3, 0x41, 0x76, 0x12, 0xd0, 0x2a, 0x90, 0xbd, 0xde, 0x62, 0xae, 0x40, 0xc5, 0x4b, 0xb2, 0xe5, 0x6e, 0x16, 0x7d, 0x6b, 0x70, 0xdb, 0x67, 0x00, 0x97, 0xeb, 0x8d, 0xb8, 0x54, 2355 }; 2356 static const ecdh_test_case ecccdh_SECP384R1_3_test_case = { 2357 .name = "ECCCDH/SECP384R1 3", 2358 .ecdh_type = ECCCDH, 2359 .ec_str_p = &secp384r1_str_params, 2360 .our_priv_key = ecccdh_SECP384R1_3_test_vector_our_priv_key, 2361 .our_priv_key_len = sizeof(ecccdh_SECP384R1_3_test_vector_our_priv_key), 2362 .peer_pub_key = ecccdh_SECP384R1_3_test_vector_peer_pub_key, 2363 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_3_test_vector_peer_pub_key), 2364 .exp_our_pub_key = ecccdh_SECP384R1_3_test_vector_our_pub_key, 2365 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_3_test_vector_our_pub_key), 2366 .exp_shared_secret = ecccdh_SECP384R1_3_test_vector_shared_secret, 2367 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_3_test_vector_shared_secret), 2368 }; 2369 #endif /* WITH_CURVE_SECP384R1 */ 2370 2371 #ifdef WITH_CURVE_SECP384R1 2372 #define ECCCDH_SECP384R1_SELF_TEST_4 2373 /*** Tests for ECCCDH/SECP384R1 ***/ 2374 static const u8 ecccdh_SECP384R1_4_test_vector_our_priv_key[] = { 2375 0x84, 0xec, 0xe6, 0xcc, 0x34, 0x29, 0x30, 0x9b, 0xd5, 0xb2, 0x3e, 0x95, 0x97, 0x93, 0xed, 0x2b, 0x11, 0x1e, 0xc5, 0xcb, 0x43, 0xb6, 0xc1, 0x80, 0x85, 0xfc, 0xae, 0xa9, 0xef, 0xa0, 0x68, 0x5d, 0x98, 0xa6, 0x26, 0x2e, 0xe0, 0xd3, 0x30, 0xee, 0x25, 0x0b, 0xc8, 0xa6, 0x7d, 0x0e, 0x73, 0x3f, 2376 }; 2377 static const u8 ecccdh_SECP384R1_4_test_vector_peer_pub_key[] = { 2378 0xeb, 0x95, 0x2e, 0x2d, 0x9a, 0xc0, 0xc2, 0x0c, 0x6c, 0xc4, 0x8f, 0xb2, 0x25, 0xc2, 0xad, 0x15, 0x4f, 0x53, 0xc8, 0x75, 0x0b, 0x00, 0x3f, 0xd3, 0xb4, 0xed, 0x8e, 0xd1, 0xdc, 0x0d, 0xef, 0xac, 0x61, 0xbc, 0xdd, 0xe0, 0x2a, 0x2b, 0xcf, 0xee, 0x70, 0x67, 0xd7, 0x5d, 0x34, 0x2e, 0xd2, 0xb0, 0xf1, 0x82, 0x82, 0x05, 0xba, 0xec, 0xe8, 0x2d, 0x1b, 0x26, 0x7d, 0x0d, 0x7f, 0xf2, 0xf9, 0xc9, 0xe1, 0x5b, 0x69, 0xa7, 0x2d, 0xf4, 0x70, 0x58, 0xa9, 0x7f, 0x38, 0x91, 0x00, 0x5d, 0x1f, 0xb3, 0x88, 0x58, 0xf5, 0x60, 0x3d, 0xe8, 0x40, 0xe5, 0x91, 0xdf, 0xa4, 0xf6, 0xe7, 0xd4, 0x89, 0xe1, 2379 }; 2380 static const u8 ecccdh_SECP384R1_4_test_vector_our_pub_key[] = { 2381 0x32, 0x22, 0x06, 0x3a, 0x29, 0x97, 0xb3, 0x02, 0xee, 0x60, 0xee, 0x19, 0x61, 0x10, 0x8f, 0xf4, 0xc7, 0xac, 0xf1, 0xc0, 0xef, 0x1d, 0x5f, 0xb0, 0xd1, 0x64, 0xb8, 0x4b, 0xce, 0x71, 0xc4, 0x31, 0x70, 0x5c, 0xb9, 0xae, 0xa9, 0xa4, 0x5f, 0x5d, 0x73, 0x80, 0x66, 0x55, 0xa0, 0x58, 0xbe, 0xe3, 0xe6, 0x1f, 0xa9, 0xe7, 0xfb, 0xe7, 0xcd, 0x43, 0xab, 0xf9, 0x95, 0x96, 0xa3, 0xd3, 0xa0, 0x39, 0xe9, 0x9f, 0xa9, 0xdc, 0x93, 0xb0, 0xbd, 0xd9, 0xca, 0xd8, 0x19, 0x66, 0xd1, 0x7e, 0xea, 0xf5, 0x57, 0x06, 0x8a, 0xfa, 0x7c, 0x78, 0x46, 0x6b, 0xb5, 0xb2, 0x20, 0x32, 0xd1, 0x10, 0x0f, 0xa6, 2382 }; 2383 static const u8 ecccdh_SECP384R1_4_test_vector_shared_secret[] = { 2384 0xce, 0x7b, 0xa4, 0x54, 0xd4, 0x41, 0x27, 0x29, 0xa3, 0x2b, 0xb8, 0x33, 0xa2, 0xd1, 0xfd, 0x2a, 0xe6, 0x12, 0xd4, 0x66, 0x7c, 0x3a, 0x90, 0x0e, 0x06, 0x92, 0x14, 0x81, 0x86, 0x13, 0x44, 0x7d, 0xf8, 0xc6, 0x11, 0xde, 0x66, 0xda, 0x20, 0x0d, 0xb7, 0xc3, 0x75, 0xcf, 0x91, 0x3e, 0x44, 0x05, 2385 }; 2386 static const ecdh_test_case ecccdh_SECP384R1_4_test_case = { 2387 .name = "ECCCDH/SECP384R1 4", 2388 .ecdh_type = ECCCDH, 2389 .ec_str_p = &secp384r1_str_params, 2390 .our_priv_key = ecccdh_SECP384R1_4_test_vector_our_priv_key, 2391 .our_priv_key_len = sizeof(ecccdh_SECP384R1_4_test_vector_our_priv_key), 2392 .peer_pub_key = ecccdh_SECP384R1_4_test_vector_peer_pub_key, 2393 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_4_test_vector_peer_pub_key), 2394 .exp_our_pub_key = ecccdh_SECP384R1_4_test_vector_our_pub_key, 2395 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_4_test_vector_our_pub_key), 2396 .exp_shared_secret = ecccdh_SECP384R1_4_test_vector_shared_secret, 2397 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_4_test_vector_shared_secret), 2398 }; 2399 #endif /* WITH_CURVE_SECP384R1 */ 2400 2401 #ifdef WITH_CURVE_SECP384R1 2402 #define ECCCDH_SECP384R1_SELF_TEST_5 2403 /*** Tests for ECCCDH/SECP384R1 ***/ 2404 static const u8 ecccdh_SECP384R1_5_test_vector_our_priv_key[] = { 2405 0x68, 0xfc, 0xe2, 0x12, 0x1d, 0xc3, 0xa1, 0xe3, 0x7b, 0x10, 0xf1, 0xdd, 0xe3, 0x09, 0xf9, 0xe2, 0xe1, 0x8f, 0xac, 0x47, 0xcd, 0x17, 0x70, 0x95, 0x14, 0x51, 0xc3, 0x48, 0x4c, 0xdb, 0x77, 0xcb, 0x13, 0x6d, 0x00, 0xe7, 0x31, 0x26, 0x05, 0x97, 0xcc, 0x28, 0x59, 0x60, 0x1c, 0x01, 0xa2, 0x5b, 2406 }; 2407 static const u8 ecccdh_SECP384R1_5_test_vector_peer_pub_key[] = { 2408 0x44, 0x1d, 0x02, 0x9e, 0x24, 0x4e, 0xb7, 0x16, 0x8d, 0x64, 0x7d, 0x4d, 0xf5, 0x0d, 0xb5, 0xf4, 0xe4, 0x97, 0x4a, 0xb3, 0xfd, 0xaf, 0x02, 0x2a, 0xff, 0x05, 0x8b, 0x36, 0x95, 0xd0, 0xb8, 0xc8, 0x14, 0xcc, 0x88, 0xda, 0x62, 0x85, 0xdc, 0x6d, 0xf1, 0xac, 0x55, 0xc5, 0x53, 0x88, 0x50, 0x03, 0xe8, 0x02, 0x5a, 0xc2, 0x3a, 0x41, 0xd4, 0xb1, 0xea, 0x2a, 0xa4, 0x6c, 0x50, 0xc6, 0xe4, 0x79, 0x94, 0x6b, 0x59, 0xb6, 0xd7, 0x64, 0x97, 0xcd, 0x92, 0x49, 0x97, 0x7e, 0x0b, 0xfe, 0x4a, 0x62, 0x62, 0x62, 0x2f, 0x13, 0xd4, 0x2a, 0x3c, 0x43, 0xd6, 0x6b, 0xdb, 0xb3, 0x04, 0x03, 0xc3, 0x45, 2409 }; 2410 static const u8 ecccdh_SECP384R1_5_test_vector_our_pub_key[] = { 2411 0x86, 0x8b, 0xe0, 0xe6, 0x94, 0x84, 0x18, 0x30, 0xe4, 0x24, 0xd9, 0x13, 0xd8, 0xe7, 0xd8, 0x6b, 0x84, 0xee, 0x10, 0x21, 0xd8, 0x2b, 0x0e, 0xcf, 0x52, 0x3f, 0x09, 0xfe, 0x89, 0xa7, 0x6c, 0x0c, 0x95, 0xc4, 0x9f, 0x2d, 0xfb, 0xcf, 0x82, 0x9c, 0x1e, 0x39, 0x70, 0x9d, 0x55, 0xef, 0xbb, 0x3b, 0x91, 0x95, 0xeb, 0x18, 0x36, 0x75, 0xb4, 0x0f, 0xd9, 0x2f, 0x51, 0xf3, 0x77, 0x13, 0x31, 0x7e, 0x4a, 0x9b, 0x4f, 0x71, 0x5c, 0x8a, 0xb2, 0x2e, 0x07, 0x73, 0xb1, 0xbc, 0x71, 0xd3, 0xa2, 0x19, 0xf0, 0x5b, 0x81, 0x16, 0x07, 0x46, 0x58, 0xee, 0x86, 0xb5, 0x2e, 0x36, 0xf3, 0x89, 0x71, 0x16, 2412 }; 2413 static const u8 ecccdh_SECP384R1_5_test_vector_shared_secret[] = { 2414 0xba, 0x69, 0xf0, 0xac, 0xdf, 0x3e, 0x1c, 0xa9, 0x5c, 0xaa, 0xac, 0x4e, 0xca, 0xf4, 0x75, 0xbb, 0xe5, 0x1b, 0x54, 0x77, 0x7e, 0xfc, 0xe0, 0x1c, 0xa3, 0x81, 0xf4, 0x53, 0x70, 0xe4, 0x86, 0xfe, 0x87, 0xf9, 0xf4, 0x19, 0xb1, 0x50, 0xc6, 0x1e, 0x32, 0x9a, 0x28, 0x6d, 0x1a, 0xa2, 0x65, 0xec, 2415 }; 2416 static const ecdh_test_case ecccdh_SECP384R1_5_test_case = { 2417 .name = "ECCCDH/SECP384R1 5", 2418 .ecdh_type = ECCCDH, 2419 .ec_str_p = &secp384r1_str_params, 2420 .our_priv_key = ecccdh_SECP384R1_5_test_vector_our_priv_key, 2421 .our_priv_key_len = sizeof(ecccdh_SECP384R1_5_test_vector_our_priv_key), 2422 .peer_pub_key = ecccdh_SECP384R1_5_test_vector_peer_pub_key, 2423 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_5_test_vector_peer_pub_key), 2424 .exp_our_pub_key = ecccdh_SECP384R1_5_test_vector_our_pub_key, 2425 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_5_test_vector_our_pub_key), 2426 .exp_shared_secret = ecccdh_SECP384R1_5_test_vector_shared_secret, 2427 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_5_test_vector_shared_secret), 2428 }; 2429 #endif /* WITH_CURVE_SECP384R1 */ 2430 2431 #ifdef WITH_CURVE_SECP384R1 2432 #define ECCCDH_SECP384R1_SELF_TEST_6 2433 /*** Tests for ECCCDH/SECP384R1 ***/ 2434 static const u8 ecccdh_SECP384R1_6_test_vector_our_priv_key[] = { 2435 0xb1, 0x76, 0x4c, 0x54, 0x89, 0x7e, 0x7a, 0xae, 0x6d, 0xe9, 0xe7, 0x75, 0x1f, 0x2f, 0x37, 0xde, 0x84, 0x92, 0x91, 0xf8, 0x8f, 0x0f, 0x91, 0x09, 0x31, 0x55, 0xb8, 0x58, 0xd1, 0xcc, 0x32, 0xa3, 0xa8, 0x79, 0x80, 0xf7, 0x06, 0xb8, 0x6c, 0xc8, 0x3f, 0x92, 0x7b, 0xdf, 0xdb, 0xea, 0xe0, 0xbd, 2436 }; 2437 static const u8 ecccdh_SECP384R1_6_test_vector_peer_pub_key[] = { 2438 0x3d, 0x4e, 0x6b, 0xf0, 0x8a, 0x73, 0x40, 0x4a, 0xcc, 0xc1, 0x62, 0x98, 0x73, 0x46, 0x8e, 0x42, 0x69, 0xe8, 0x2d, 0x90, 0xd8, 0x32, 0xe5, 0x8a, 0xd7, 0x21, 0x42, 0x63, 0x9b, 0x5a, 0x05, 0x6a, 0xd8, 0xd3, 0x5c, 0x66, 0xc6, 0x0e, 0x81, 0x49, 0xfa, 0xc0, 0xc7, 0x97, 0xbc, 0xeb, 0x7c, 0x2f, 0x9b, 0x03, 0x08, 0xdc, 0x7f, 0x0e, 0x6d, 0x29, 0xf8, 0xc2, 0x77, 0xac, 0xbc, 0x65, 0xa2, 0x1e, 0x5a, 0xdb, 0x83, 0xd1, 0x1e, 0x68, 0x73, 0xbc, 0x0a, 0x07, 0xfd, 0xa0, 0x99, 0x7f, 0x48, 0x25, 0x04, 0x60, 0x2f, 0x59, 0xe1, 0x0b, 0xc5, 0xcb, 0x47, 0x6b, 0x83, 0xd0, 0xa4, 0xf7, 0x5e, 0x71, 2439 }; 2440 static const u8 ecccdh_SECP384R1_6_test_vector_our_pub_key[] = { 2441 0xc3, 0x71, 0x22, 0x2f, 0xea, 0xa6, 0x77, 0x0c, 0x6f, 0x3e, 0xa3, 0xe0, 0xda, 0xc9, 0x74, 0x0d, 0xef, 0x4f, 0xcf, 0x82, 0x13, 0x78, 0xb7, 0xf9, 0x1f, 0xf9, 0x37, 0xc2, 0x1e, 0x04, 0x70, 0xf7, 0x0f, 0x3a, 0x31, 0xd5, 0xc6, 0xb2, 0x91, 0x21, 0x95, 0xf1, 0x09, 0x26, 0x94, 0x2b, 0x48, 0xae, 0x04, 0x7d, 0x6b, 0x4d, 0x76, 0x51, 0x23, 0x56, 0x3f, 0x81, 0x11, 0x6b, 0xc6, 0x65, 0xb7, 0xb8, 0xcc, 0x62, 0x07, 0x83, 0x0d, 0x80, 0x5f, 0xd8, 0x4d, 0xa7, 0xcb, 0x80, 0x5a, 0x65, 0xba, 0xa7, 0xc1, 0x2f, 0xd5, 0x92, 0xd1, 0xb5, 0xb5, 0xe3, 0xe6, 0x5d, 0x96, 0x72, 0xa9, 0xef, 0x76, 0x62, 2442 }; 2443 static const u8 ecccdh_SECP384R1_6_test_vector_shared_secret[] = { 2444 0x1a, 0x66, 0x88, 0xee, 0x1d, 0x6e, 0x59, 0x86, 0x5d, 0x8e, 0x3a, 0xda, 0x37, 0x78, 0x1d, 0x36, 0xbb, 0x0c, 0x27, 0x17, 0xee, 0xf9, 0x2e, 0x61, 0x96, 0x4d, 0x39, 0x27, 0xcb, 0x76, 0x5c, 0x29, 0x65, 0xea, 0x80, 0xf7, 0xf6, 0x3e, 0x58, 0xc3, 0x22, 0xba, 0x03, 0x97, 0xfa, 0xea, 0xf6, 0x2b, 2445 }; 2446 static const ecdh_test_case ecccdh_SECP384R1_6_test_case = { 2447 .name = "ECCCDH/SECP384R1 6", 2448 .ecdh_type = ECCCDH, 2449 .ec_str_p = &secp384r1_str_params, 2450 .our_priv_key = ecccdh_SECP384R1_6_test_vector_our_priv_key, 2451 .our_priv_key_len = sizeof(ecccdh_SECP384R1_6_test_vector_our_priv_key), 2452 .peer_pub_key = ecccdh_SECP384R1_6_test_vector_peer_pub_key, 2453 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_6_test_vector_peer_pub_key), 2454 .exp_our_pub_key = ecccdh_SECP384R1_6_test_vector_our_pub_key, 2455 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_6_test_vector_our_pub_key), 2456 .exp_shared_secret = ecccdh_SECP384R1_6_test_vector_shared_secret, 2457 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_6_test_vector_shared_secret), 2458 }; 2459 #endif /* WITH_CURVE_SECP384R1 */ 2460 2461 #ifdef WITH_CURVE_SECP384R1 2462 #define ECCCDH_SECP384R1_SELF_TEST_7 2463 /*** Tests for ECCCDH/SECP384R1 ***/ 2464 static const u8 ecccdh_SECP384R1_7_test_vector_our_priv_key[] = { 2465 0xf0, 0xf7, 0xa9, 0x6e, 0x70, 0xd9, 0x8f, 0xd5, 0xa3, 0x0a, 0xd6, 0x40, 0x6c, 0xf5, 0x6e, 0xb5, 0xb7, 0x2a, 0x51, 0x0e, 0x9f, 0x19, 0x2f, 0x50, 0xe1, 0xf8, 0x45, 0x24, 0xdb, 0xf3, 0xd2, 0x43, 0x9f, 0x72, 0x87, 0xbb, 0x36, 0xf5, 0xaa, 0x91, 0x2a, 0x79, 0xde, 0xaa, 0xb4, 0xad, 0xea, 0x82, 2466 }; 2467 static const u8 ecccdh_SECP384R1_7_test_vector_peer_pub_key[] = { 2468 0xf5, 0xf6, 0xbe, 0xf1, 0xd1, 0x10, 0xda, 0x03, 0xbe, 0x00, 0x17, 0xea, 0xc7, 0x60, 0xcc, 0x34, 0xb2, 0x4d, 0x09, 0x2f, 0x73, 0x6f, 0x23, 0x7b, 0xc7, 0x05, 0x4b, 0x38, 0x65, 0x31, 0x2a, 0x81, 0x3b, 0xcb, 0x62, 0xd2, 0x97, 0xfb, 0x10, 0xa4, 0xf7, 0xab, 0xf5, 0x47, 0x08, 0xfe, 0x2d, 0x3d, 0x06, 0xfd, 0xf8, 0xd7, 0xdc, 0x03, 0x2f, 0x4e, 0x10, 0x01, 0x0b, 0xf1, 0x9c, 0xbf, 0x61, 0x59, 0x32, 0x12, 0x52, 0xff, 0x41, 0x5f, 0xb9, 0x19, 0x20, 0xd4, 0x38, 0xf2, 0x4e, 0x67, 0xe6, 0x0c, 0x2e, 0xb0, 0x46, 0x32, 0x04, 0x67, 0x9f, 0xa3, 0x56, 0xaf, 0x44, 0xce, 0xa9, 0xc9, 0xeb, 0xf5, 2469 }; 2470 static const u8 ecccdh_SECP384R1_7_test_vector_our_pub_key[] = { 2471 0x99, 0xc8, 0xc4, 0x1c, 0xb1, 0xab, 0x5e, 0x08, 0x54, 0xa3, 0x46, 0xe4, 0xb0, 0x8a, 0x53, 0x7c, 0x17, 0x06, 0xa6, 0x15, 0x53, 0x38, 0x7c, 0x8d, 0x94, 0x94, 0x3a, 0xb1, 0x51, 0x96, 0xd4, 0x0d, 0xba, 0xa5, 0x5b, 0x82, 0x10, 0xa7, 0x7a, 0x5d, 0x00, 0x91, 0x5f, 0x2c, 0x4e, 0xa6, 0x9e, 0xab, 0x55, 0x31, 0x06, 0x5b, 0xdc, 0xf1, 0x7b, 0xfb, 0x3c, 0xb5, 0x5a, 0x02, 0xe4, 0x1a, 0x57, 0xc7, 0xf6, 0x94, 0xc3, 0x83, 0xad, 0x28, 0x9f, 0x90, 0x0f, 0xbd, 0x65, 0x6c, 0x22, 0x33, 0xa9, 0x3c, 0x92, 0xe9, 0x33, 0xe7, 0xa2, 0x6f, 0x54, 0xcb, 0xb5, 0x6f, 0x0a, 0xd8, 0x75, 0xc5, 0x1b, 0xb0, 2472 }; 2473 static const u8 ecccdh_SECP384R1_7_test_vector_shared_secret[] = { 2474 0xd0, 0x6a, 0x56, 0x8b, 0xf2, 0x33, 0x6b, 0x90, 0xcb, 0xac, 0x32, 0x51, 0x61, 0xbe, 0x76, 0x95, 0xea, 0xcb, 0x22, 0x95, 0xf5, 0x99, 0x50, 0x0d, 0x78, 0x7f, 0x07, 0x26, 0x12, 0xac, 0xa3, 0x13, 0xee, 0x5d, 0x87, 0x4f, 0x80, 0x7d, 0xde, 0xf6, 0xc1, 0xf0, 0x23, 0xfe, 0x2b, 0x6e, 0x7c, 0xd0, 2475 }; 2476 static const ecdh_test_case ecccdh_SECP384R1_7_test_case = { 2477 .name = "ECCCDH/SECP384R1 7", 2478 .ecdh_type = ECCCDH, 2479 .ec_str_p = &secp384r1_str_params, 2480 .our_priv_key = ecccdh_SECP384R1_7_test_vector_our_priv_key, 2481 .our_priv_key_len = sizeof(ecccdh_SECP384R1_7_test_vector_our_priv_key), 2482 .peer_pub_key = ecccdh_SECP384R1_7_test_vector_peer_pub_key, 2483 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_7_test_vector_peer_pub_key), 2484 .exp_our_pub_key = ecccdh_SECP384R1_7_test_vector_our_pub_key, 2485 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_7_test_vector_our_pub_key), 2486 .exp_shared_secret = ecccdh_SECP384R1_7_test_vector_shared_secret, 2487 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_7_test_vector_shared_secret), 2488 }; 2489 #endif /* WITH_CURVE_SECP384R1 */ 2490 2491 #ifdef WITH_CURVE_SECP384R1 2492 #define ECCCDH_SECP384R1_SELF_TEST_8 2493 /*** Tests for ECCCDH/SECP384R1 ***/ 2494 static const u8 ecccdh_SECP384R1_8_test_vector_our_priv_key[] = { 2495 0x9e, 0xfb, 0x87, 0xdd, 0xc6, 0x1d, 0x43, 0xc4, 0x82, 0xba, 0x66, 0xe1, 0xb1, 0x43, 0xae, 0xf6, 0x78, 0xfb, 0xd0, 0xd1, 0xbe, 0xbc, 0x20, 0x00, 0x94, 0x1f, 0xab, 0xe6, 0x77, 0xfe, 0x5b, 0x70, 0x6b, 0xf7, 0x8f, 0xce, 0x36, 0xd1, 0x00, 0xb1, 0x7c, 0xc7, 0x87, 0xea, 0xd7, 0x4b, 0xbc, 0xa2, 2496 }; 2497 static const u8 ecccdh_SECP384R1_8_test_vector_peer_pub_key[] = { 2498 0x7c, 0xde, 0xc7, 0x7e, 0x07, 0x37, 0xea, 0x37, 0xc6, 0x7b, 0x89, 0xb7, 0x13, 0x7f, 0xe3, 0x88, 0x18, 0x01, 0x0f, 0x44, 0x64, 0x43, 0x8e, 0xe4, 0xd1, 0xd3, 0x5a, 0x0c, 0x48, 0x8c, 0xad, 0x3f, 0xde, 0x2f, 0x37, 0xd0, 0x08, 0x85, 0xd3, 0x6d, 0x3b, 0x79, 0x5b, 0x9f, 0x93, 0xd2, 0x3a, 0x67, 0x28, 0xc4, 0x2e, 0xe8, 0xd6, 0x02, 0x7c, 0x56, 0xcf, 0x97, 0x9b, 0xa4, 0xc2, 0x29, 0xfd, 0xb0, 0x1d, 0x23, 0x49, 0x44, 0xf8, 0xac, 0x43, 0x36, 0x50, 0x11, 0x2c, 0x3c, 0xf0, 0xf0, 0x28, 0x44, 0xe8, 0x88, 0xa3, 0x56, 0x9d, 0xfe, 0xf7, 0x82, 0x8a, 0x8a, 0x88, 0x45, 0x89, 0xaa, 0x05, 0x5e, 2499 }; 2500 static const u8 ecccdh_SECP384R1_8_test_vector_our_pub_key[] = { 2501 0x4c, 0x34, 0xef, 0xee, 0x8f, 0x0c, 0x95, 0x56, 0x5d, 0x20, 0x65, 0xd1, 0xbb, 0xac, 0x2a, 0x2d, 0xd2, 0x5a, 0xe9, 0x64, 0x32, 0x0e, 0xb6, 0xbc, 0xce, 0xdc, 0x5f, 0x3a, 0x9b, 0x42, 0xa8, 0x81, 0xa1, 0xaf, 0xca, 0x1b, 0xb6, 0xb8, 0x80, 0x58, 0x4f, 0xa2, 0x7b, 0x01, 0xc1, 0x93, 0xcd, 0x92, 0xd8, 0xfb, 0x01, 0xdb, 0xf7, 0xcd, 0x0a, 0x38, 0x68, 0xc2, 0x6b, 0x95, 0x1f, 0x39, 0x3c, 0x3c, 0x56, 0xc2, 0x85, 0x8c, 0xee, 0x90, 0x1f, 0x77, 0x93, 0xff, 0x5d, 0x27, 0x19, 0x25, 0xd1, 0x3a, 0x41, 0xf8, 0xe5, 0x24, 0x09, 0xf4, 0xeb, 0xa1, 0x99, 0x0f, 0x33, 0xac, 0xb0, 0xba, 0xc6, 0x69, 2502 }; 2503 static const u8 ecccdh_SECP384R1_8_test_vector_shared_secret[] = { 2504 0xbb, 0x3b, 0x1e, 0xda, 0x9c, 0x65, 0x60, 0xd8, 0x2f, 0xf5, 0xbe, 0xe4, 0x03, 0x33, 0x9f, 0x1e, 0x80, 0x34, 0x23, 0x38, 0xa9, 0x91, 0x34, 0x48, 0x53, 0xb5, 0x6b, 0x24, 0xf1, 0x09, 0xa4, 0xd9, 0x4b, 0x92, 0xf6, 0x54, 0xf0, 0x42, 0x5e, 0xdd, 0x4c, 0x20, 0x59, 0x03, 0xd7, 0x58, 0x61, 0x04, 2505 }; 2506 static const ecdh_test_case ecccdh_SECP384R1_8_test_case = { 2507 .name = "ECCCDH/SECP384R1 8", 2508 .ecdh_type = ECCCDH, 2509 .ec_str_p = &secp384r1_str_params, 2510 .our_priv_key = ecccdh_SECP384R1_8_test_vector_our_priv_key, 2511 .our_priv_key_len = sizeof(ecccdh_SECP384R1_8_test_vector_our_priv_key), 2512 .peer_pub_key = ecccdh_SECP384R1_8_test_vector_peer_pub_key, 2513 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_8_test_vector_peer_pub_key), 2514 .exp_our_pub_key = ecccdh_SECP384R1_8_test_vector_our_pub_key, 2515 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_8_test_vector_our_pub_key), 2516 .exp_shared_secret = ecccdh_SECP384R1_8_test_vector_shared_secret, 2517 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_8_test_vector_shared_secret), 2518 }; 2519 #endif /* WITH_CURVE_SECP384R1 */ 2520 2521 #ifdef WITH_CURVE_SECP384R1 2522 #define ECCCDH_SECP384R1_SELF_TEST_9 2523 /*** Tests for ECCCDH/SECP384R1 ***/ 2524 static const u8 ecccdh_SECP384R1_9_test_vector_our_priv_key[] = { 2525 0xd7, 0x87, 0xa5, 0x7f, 0xde, 0x22, 0xec, 0x65, 0x6a, 0x0a, 0x52, 0x5c, 0xf3, 0xc7, 0x38, 0xb3, 0x0d, 0x73, 0xaf, 0x61, 0xe7, 0x43, 0xea, 0x90, 0x89, 0x3e, 0xcb, 0x2d, 0x7b, 0x62, 0x2a, 0xdd, 0x2f, 0x94, 0xee, 0x25, 0xc2, 0x17, 0x14, 0x67, 0xaf, 0xb0, 0x93, 0xf3, 0xf8, 0x4d, 0x00, 0x18, 2526 }; 2527 static const u8 ecccdh_SECP384R1_9_test_vector_peer_pub_key[] = { 2528 0x8e, 0xee, 0xa3, 0xa3, 0x19, 0xc8, 0xdf, 0x99, 0xfb, 0xc2, 0x9c, 0xb5, 0x5f, 0x24, 0x3a, 0x72, 0x0d, 0x95, 0x50, 0x95, 0x15, 0xee, 0x5c, 0xc5, 0x87, 0xa5, 0xc5, 0xae, 0x22, 0xfb, 0xbd, 0x00, 0x9e, 0x62, 0x6d, 0xb3, 0xe9, 0x11, 0xde, 0xf0, 0xb9, 0x9a, 0x4f, 0x7a, 0xe3, 0x04, 0xb1, 0xba, 0x73, 0x87, 0x7d, 0xc9, 0x4d, 0xb9, 0xad, 0xdd, 0xc0, 0xd9, 0xa4, 0xb2, 0x4e, 0x89, 0x76, 0xc2, 0x2d, 0x73, 0xc8, 0x44, 0x37, 0x0e, 0x1e, 0xe8, 0x57, 0xf8, 0xd1, 0xb1, 0x29, 0xa3, 0xbd, 0x5f, 0x63, 0xf4, 0x0c, 0xaf, 0x3b, 0xd0, 0x53, 0x3e, 0x38, 0xa5, 0xf5, 0x77, 0x70, 0x74, 0xff, 0x9e, 2529 }; 2530 static const u8 ecccdh_SECP384R1_9_test_vector_our_pub_key[] = { 2531 0x17, 0x15, 0x46, 0x92, 0x3b, 0x87, 0xb2, 0xcb, 0xba, 0xd6, 0x64, 0xf0, 0x1c, 0xe9, 0x32, 0xbf, 0x09, 0xd6, 0xa6, 0x11, 0x81, 0x68, 0x67, 0x84, 0x46, 0xbf, 0xa9, 0xf0, 0x93, 0x86, 0x08, 0xcb, 0x46, 0x67, 0xa9, 0x8f, 0x4e, 0xc8, 0xac, 0x14, 0x62, 0x28, 0x5c, 0x25, 0x08, 0xf7, 0x48, 0x62, 0xfa, 0x41, 0xcb, 0x4d, 0xb6, 0x8a, 0xe7, 0x1f, 0x1f, 0x8a, 0x3e, 0x89, 0x39, 0xdc, 0x52, 0xc2, 0xde, 0xc6, 0x1a, 0x83, 0xc9, 0x83, 0xbe, 0xb2, 0xa0, 0x2b, 0xaf, 0x29, 0xec, 0x49, 0x27, 0x80, 0x88, 0x88, 0x2e, 0xd0, 0xcf, 0x56, 0xc7, 0x4b, 0x5c, 0x17, 0x3b, 0x55, 0x2c, 0xcf, 0x63, 0xcf, 2532 }; 2533 static const u8 ecccdh_SECP384R1_9_test_vector_shared_secret[] = { 2534 0x1e, 0x97, 0xb6, 0x0a, 0xdd, 0x7c, 0xb3, 0x5c, 0x74, 0x03, 0xdd, 0x88, 0x4c, 0x0a, 0x75, 0x79, 0x5b, 0x76, 0x83, 0xff, 0xf8, 0xb4, 0x9f, 0x9d, 0x86, 0x72, 0xa8, 0x20, 0x6b, 0xfd, 0xcf, 0x0a, 0x10, 0x6b, 0x87, 0x68, 0xf9, 0x83, 0x25, 0x8c, 0x74, 0x16, 0x74, 0x22, 0xe4, 0x4e, 0x4d, 0x14, 2535 }; 2536 static const ecdh_test_case ecccdh_SECP384R1_9_test_case = { 2537 .name = "ECCCDH/SECP384R1 9", 2538 .ecdh_type = ECCCDH, 2539 .ec_str_p = &secp384r1_str_params, 2540 .our_priv_key = ecccdh_SECP384R1_9_test_vector_our_priv_key, 2541 .our_priv_key_len = sizeof(ecccdh_SECP384R1_9_test_vector_our_priv_key), 2542 .peer_pub_key = ecccdh_SECP384R1_9_test_vector_peer_pub_key, 2543 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_9_test_vector_peer_pub_key), 2544 .exp_our_pub_key = ecccdh_SECP384R1_9_test_vector_our_pub_key, 2545 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_9_test_vector_our_pub_key), 2546 .exp_shared_secret = ecccdh_SECP384R1_9_test_vector_shared_secret, 2547 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_9_test_vector_shared_secret), 2548 }; 2549 #endif /* WITH_CURVE_SECP384R1 */ 2550 2551 #ifdef WITH_CURVE_SECP384R1 2552 #define ECCCDH_SECP384R1_SELF_TEST_10 2553 /*** Tests for ECCCDH/SECP384R1 ***/ 2554 static const u8 ecccdh_SECP384R1_10_test_vector_our_priv_key[] = { 2555 0x83, 0xd7, 0x0f, 0x7b, 0x16, 0x4d, 0x9f, 0x4c, 0x22, 0x7c, 0x76, 0x70, 0x46, 0xb2, 0x0e, 0xb3, 0x4d, 0xfc, 0x77, 0x8f, 0x53, 0x87, 0xe3, 0x2e, 0x83, 0x4b, 0x1e, 0x6d, 0xae, 0xc2, 0x0e, 0xdb, 0x8c, 0xa5, 0xbb, 0x41, 0x92, 0x09, 0x3f, 0x54, 0x3b, 0x68, 0xe6, 0xae, 0xb7, 0xce, 0x78, 0x8b, 2556 }; 2557 static const u8 ecccdh_SECP384R1_10_test_vector_peer_pub_key[] = { 2558 0xa7, 0x21, 0xf6, 0xa2, 0xd4, 0x52, 0x74, 0x11, 0x83, 0x4b, 0x13, 0xd4, 0xd3, 0xa3, 0x3c, 0x29, 0xbe, 0xb8, 0x3a, 0xb7, 0x68, 0x24, 0x65, 0xc6, 0xcb, 0xaf, 0x66, 0x24, 0xac, 0xa6, 0xea, 0x58, 0xc3, 0x0e, 0xb0, 0xf2, 0x9d, 0xd8, 0x42, 0x88, 0x66, 0x95, 0x40, 0x0d, 0x72, 0x54, 0xf2, 0x0f, 0x14, 0xba, 0x6e, 0x26, 0x35, 0x51, 0x09, 0xad, 0x35, 0x12, 0x93, 0x66, 0xd5, 0xe3, 0xa6, 0x40, 0xae, 0x79, 0x85, 0x05, 0xa7, 0xfa, 0x55, 0xa9, 0x6a, 0x36, 0xb5, 0xda, 0xd3, 0x3d, 0xe0, 0x04, 0x74, 0xf6, 0x67, 0x0f, 0x52, 0x22, 0x14, 0xdd, 0x79, 0x52, 0x14, 0x0a, 0xb0, 0xa7, 0xeb, 0x68, 2559 }; 2560 static const u8 ecccdh_SECP384R1_10_test_vector_our_pub_key[] = { 2561 0x57, 0xcd, 0x77, 0x0f, 0x3b, 0xbc, 0xbe, 0x0c, 0x78, 0xc7, 0x70, 0xea, 0xb0, 0xb1, 0x69, 0xbc, 0x45, 0xe1, 0x39, 0xf8, 0x63, 0x78, 0xff, 0xae, 0x1c, 0x2b, 0x16, 0x96, 0x67, 0x27, 0xc2, 0xf2, 0xeb, 0x72, 0x45, 0x72, 0xb8, 0xf3, 0xeb, 0x22, 0x8d, 0x13, 0x0d, 0xb4, 0xff, 0x86, 0x2c, 0x63, 0x7e, 0xc5, 0xc8, 0x81, 0x3b, 0x68, 0x55, 0x58, 0xd8, 0x3e, 0x92, 0x4f, 0x14, 0xbc, 0x71, 0x9f, 0x6e, 0xb7, 0xae, 0x0c, 0xbb, 0x2c, 0x47, 0x42, 0x27, 0xc5, 0xbd, 0xa8, 0x86, 0x37, 0xa4, 0xf2, 0x6c, 0x64, 0x81, 0x79, 0x29, 0xaf, 0x99, 0x95, 0x92, 0xda, 0x6f, 0x78, 0x74, 0x90, 0x33, 0x2f, 2562 }; 2563 static const u8 ecccdh_SECP384R1_10_test_vector_shared_secret[] = { 2564 0x10, 0x23, 0x47, 0x88, 0x40, 0xe5, 0x47, 0x75, 0xbf, 0xc6, 0x92, 0x93, 0xa3, 0xcf, 0x97, 0xf5, 0xbc, 0x91, 0x47, 0x26, 0x45, 0x5c, 0x66, 0x53, 0x8e, 0xb5, 0x62, 0x3e, 0x21, 0x8f, 0xee, 0xf7, 0xdf, 0x4b, 0xef, 0xa2, 0x3e, 0x09, 0xd7, 0x71, 0x45, 0xad, 0x57, 0x7d, 0xb3, 0x2b, 0x41, 0xf9, 2565 }; 2566 static const ecdh_test_case ecccdh_SECP384R1_10_test_case = { 2567 .name = "ECCCDH/SECP384R1 10", 2568 .ecdh_type = ECCCDH, 2569 .ec_str_p = &secp384r1_str_params, 2570 .our_priv_key = ecccdh_SECP384R1_10_test_vector_our_priv_key, 2571 .our_priv_key_len = sizeof(ecccdh_SECP384R1_10_test_vector_our_priv_key), 2572 .peer_pub_key = ecccdh_SECP384R1_10_test_vector_peer_pub_key, 2573 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_10_test_vector_peer_pub_key), 2574 .exp_our_pub_key = ecccdh_SECP384R1_10_test_vector_our_pub_key, 2575 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_10_test_vector_our_pub_key), 2576 .exp_shared_secret = ecccdh_SECP384R1_10_test_vector_shared_secret, 2577 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_10_test_vector_shared_secret), 2578 }; 2579 #endif /* WITH_CURVE_SECP384R1 */ 2580 2581 #ifdef WITH_CURVE_SECP384R1 2582 #define ECCCDH_SECP384R1_SELF_TEST_11 2583 /*** Tests for ECCCDH/SECP384R1 ***/ 2584 static const u8 ecccdh_SECP384R1_11_test_vector_our_priv_key[] = { 2585 0x8f, 0x55, 0x8e, 0x05, 0x81, 0x8b, 0x88, 0xed, 0x38, 0x3d, 0x5f, 0xca, 0x96, 0x2e, 0x53, 0x41, 0x3d, 0xb1, 0xa0, 0xe4, 0x63, 0x7e, 0xda, 0x19, 0x4f, 0x76, 0x19, 0x44, 0xcb, 0xea, 0x11, 0x4a, 0xb9, 0xd5, 0xda, 0x17, 0x5a, 0x7d, 0x57, 0x88, 0x25, 0x50, 0xb0, 0xe4, 0x32, 0xf3, 0x95, 0xa9, 2586 }; 2587 static const u8 ecccdh_SECP384R1_11_test_vector_peer_pub_key[] = { 2588 0xd8, 0x82, 0xa8, 0x50, 0x5c, 0x2d, 0x5c, 0xb9, 0xb8, 0x85, 0x1f, 0xc6, 0x76, 0x67, 0x7b, 0xb0, 0x08, 0x76, 0x81, 0xad, 0x53, 0xfa, 0xce, 0xba, 0x17, 0x38, 0x28, 0x6b, 0x45, 0x82, 0x75, 0x61, 0xe7, 0xda, 0x37, 0xb8, 0x80, 0x27, 0x6c, 0x65, 0x6c, 0xfc, 0x38, 0xb3, 0x2a, 0xde, 0x84, 0x7e, 0x34, 0xb3, 0x14, 0xbd, 0xc1, 0x34, 0x57, 0x56, 0x54, 0x57, 0x3c, 0xff, 0xaf, 0x40, 0x44, 0x5d, 0xa2, 0xe6, 0xaa, 0xf9, 0x87, 0xf7, 0xe9, 0x13, 0xcd, 0x4c, 0x30, 0x91, 0x52, 0x30, 0x58, 0x98, 0x4a, 0x25, 0xd8, 0xf2, 0x1d, 0xa8, 0x32, 0x61, 0x92, 0x45, 0x6c, 0x6a, 0x0f, 0xa5, 0xf6, 0x0c, 2589 }; 2590 static const u8 ecccdh_SECP384R1_11_test_vector_our_pub_key[] = { 2591 0x9a, 0x2f, 0x57, 0xf4, 0x86, 0x7c, 0xe7, 0x53, 0xd7, 0x2b, 0x0d, 0x95, 0x19, 0x5d, 0xf6, 0xf9, 0x6c, 0x1f, 0xae, 0x93, 0x4f, 0x60, 0x2e, 0xfd, 0x7b, 0x6a, 0x54, 0x58, 0x2f, 0x55, 0x6c, 0xfa, 0x53, 0x9d, 0x89, 0x00, 0x5c, 0xa2, 0xed, 0xac, 0x08, 0xad, 0x9b, 0x72, 0xdd, 0x1f, 0x60, 0xba, 0xd9, 0xb9, 0x4e, 0xe8, 0x2d, 0xa9, 0xcc, 0x60, 0x1f, 0x34, 0x60, 0x44, 0x99, 0x8b, 0xa3, 0x87, 0xae, 0xe5, 0x64, 0x04, 0xdc, 0x6e, 0xcc, 0x8a, 0xb2, 0xb5, 0x90, 0x44, 0x33, 0x19, 0xd0, 0xb2, 0xb6, 0x17, 0x6f, 0x9d, 0x0e, 0xac, 0x2d, 0x44, 0x67, 0x8e, 0xd5, 0x61, 0x60, 0x7d, 0x09, 0xa9, 2592 }; 2593 static const u8 ecccdh_SECP384R1_11_test_vector_shared_secret[] = { 2594 0x6a, 0xd6, 0xb9, 0xdc, 0x8a, 0x6c, 0xf0, 0xd3, 0x69, 0x1c, 0x50, 0x1c, 0xbb, 0x96, 0x78, 0x67, 0xf6, 0xe4, 0xbb, 0xb7, 0x64, 0xb6, 0x0d, 0xbf, 0xf8, 0xfc, 0xff, 0x3e, 0xd4, 0x2d, 0xbb, 0xa3, 0x9d, 0x63, 0xcf, 0x32, 0x5b, 0x4b, 0x40, 0x78, 0x85, 0x84, 0x95, 0xdd, 0xee, 0x75, 0xf9, 0x54, 2595 }; 2596 static const ecdh_test_case ecccdh_SECP384R1_11_test_case = { 2597 .name = "ECCCDH/SECP384R1 11", 2598 .ecdh_type = ECCCDH, 2599 .ec_str_p = &secp384r1_str_params, 2600 .our_priv_key = ecccdh_SECP384R1_11_test_vector_our_priv_key, 2601 .our_priv_key_len = sizeof(ecccdh_SECP384R1_11_test_vector_our_priv_key), 2602 .peer_pub_key = ecccdh_SECP384R1_11_test_vector_peer_pub_key, 2603 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_11_test_vector_peer_pub_key), 2604 .exp_our_pub_key = ecccdh_SECP384R1_11_test_vector_our_pub_key, 2605 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_11_test_vector_our_pub_key), 2606 .exp_shared_secret = ecccdh_SECP384R1_11_test_vector_shared_secret, 2607 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_11_test_vector_shared_secret), 2608 }; 2609 #endif /* WITH_CURVE_SECP384R1 */ 2610 2611 #ifdef WITH_CURVE_SECP384R1 2612 #define ECCCDH_SECP384R1_SELF_TEST_12 2613 /*** Tests for ECCCDH/SECP384R1 ***/ 2614 static const u8 ecccdh_SECP384R1_12_test_vector_our_priv_key[] = { 2615 0x0f, 0x5d, 0xee, 0x0a, 0xff, 0xa7, 0xbb, 0xf2, 0x39, 0xd5, 0xdf, 0xf3, 0x29, 0x87, 0xeb, 0xb7, 0xcf, 0x84, 0xfc, 0xce, 0xed, 0x64, 0x3e, 0x1d, 0x3c, 0x62, 0xd0, 0xb3, 0x35, 0x2a, 0xec, 0x23, 0xb6, 0xe5, 0xac, 0x7f, 0xa4, 0x10, 0x5c, 0x8c, 0xb2, 0x61, 0x26, 0xad, 0x2d, 0x18, 0x92, 0xcb, 2616 }; 2617 static const u8 ecccdh_SECP384R1_12_test_vector_peer_pub_key[] = { 2618 0x81, 0x5c, 0x9d, 0x77, 0x3d, 0xbf, 0x5f, 0xb6, 0xa1, 0xb8, 0x67, 0x99, 0x96, 0x62, 0x47, 0xf4, 0x00, 0x6a, 0x23, 0xc9, 0x2e, 0x68, 0xc5, 0x5e, 0x9e, 0xaa, 0x99, 0x8b, 0x17, 0xd8, 0x83, 0x2d, 0xd4, 0xd8, 0x4d, 0x92, 0x7d, 0x83, 0x1d, 0x4f, 0x68, 0xda, 0xc6, 0x7c, 0x64, 0x88, 0x21, 0x9f, 0xe7, 0x92, 0x69, 0x94, 0x8b, 0x26, 0x11, 0x48, 0x45, 0x60, 0xfd, 0x49, 0x0f, 0xee, 0xc8, 0x87, 0xcb, 0x55, 0xef, 0x99, 0xa4, 0xb5, 0x24, 0x88, 0x0f, 0xa7, 0x49, 0x9d, 0x6a, 0x07, 0x28, 0x3a, 0xae, 0x2a, 0xfa, 0x33, 0xfe, 0xab, 0x97, 0xde, 0xca, 0x40, 0xbc, 0x60, 0x6c, 0x4d, 0x87, 0x64, 2619 }; 2620 static const u8 ecccdh_SECP384R1_12_test_vector_our_pub_key[] = { 2621 0x23, 0x34, 0x6b, 0xdf, 0xbc, 0x9d, 0x7c, 0x7c, 0x73, 0x6e, 0x02, 0xbd, 0xf6, 0x07, 0x67, 0x1f, 0xf6, 0x08, 0x2f, 0xdd, 0x27, 0x33, 0x4a, 0x8b, 0xc7, 0x5f, 0x3b, 0x23, 0x68, 0x1e, 0xbe, 0x61, 0x4d, 0x05, 0x97, 0xdd, 0x61, 0x4f, 0xae, 0x58, 0x67, 0x7c, 0x83, 0x5a, 0x9f, 0x0b, 0x27, 0x3b, 0x82, 0xba, 0x36, 0x29, 0x0d, 0x2f, 0x94, 0xdb, 0x41, 0x47, 0x9e, 0xb4, 0x5a, 0xb4, 0xea, 0xf6, 0x79, 0x28, 0xa2, 0x31, 0x51, 0x38, 0xd5, 0x9e, 0xec, 0xc9, 0xb5, 0x28, 0x5d, 0xfd, 0xdd, 0x67, 0x14, 0xf7, 0x75, 0x57, 0x21, 0x6e, 0xa4, 0x4c, 0xc6, 0xfc, 0x11, 0x9d, 0x82, 0x43, 0xef, 0xaf, 2622 }; 2623 static const u8 ecccdh_SECP384R1_12_test_vector_shared_secret[] = { 2624 0xcc, 0x9e, 0x06, 0x35, 0x66, 0xd4, 0x6b, 0x35, 0x7b, 0x3f, 0xca, 0xe2, 0x18, 0x27, 0x37, 0x73, 0x31, 0xe5, 0xe2, 0x90, 0xa3, 0x6e, 0x60, 0xcd, 0x7c, 0x39, 0x10, 0x2b, 0x82, 0x8a, 0xe0, 0xb9, 0x18, 0xdc, 0x5a, 0x02, 0x21, 0x6b, 0x07, 0xfe, 0x6f, 0x19, 0x58, 0xd8, 0x34, 0xe4, 0x24, 0x37, 2625 }; 2626 static const ecdh_test_case ecccdh_SECP384R1_12_test_case = { 2627 .name = "ECCCDH/SECP384R1 12", 2628 .ecdh_type = ECCCDH, 2629 .ec_str_p = &secp384r1_str_params, 2630 .our_priv_key = ecccdh_SECP384R1_12_test_vector_our_priv_key, 2631 .our_priv_key_len = sizeof(ecccdh_SECP384R1_12_test_vector_our_priv_key), 2632 .peer_pub_key = ecccdh_SECP384R1_12_test_vector_peer_pub_key, 2633 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_12_test_vector_peer_pub_key), 2634 .exp_our_pub_key = ecccdh_SECP384R1_12_test_vector_our_pub_key, 2635 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_12_test_vector_our_pub_key), 2636 .exp_shared_secret = ecccdh_SECP384R1_12_test_vector_shared_secret, 2637 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_12_test_vector_shared_secret), 2638 }; 2639 #endif /* WITH_CURVE_SECP384R1 */ 2640 2641 #ifdef WITH_CURVE_SECP384R1 2642 #define ECCCDH_SECP384R1_SELF_TEST_13 2643 /*** Tests for ECCCDH/SECP384R1 ***/ 2644 static const u8 ecccdh_SECP384R1_13_test_vector_our_priv_key[] = { 2645 0x03, 0x7b, 0x63, 0x3b, 0x5b, 0x8b, 0xa8, 0x57, 0xc0, 0xfc, 0x85, 0x65, 0x68, 0x68, 0x23, 0x2e, 0x2f, 0xeb, 0xf5, 0x95, 0x78, 0x71, 0x83, 0x91, 0xb8, 0x1d, 0xa8, 0x54, 0x1a, 0x00, 0xbf, 0xe5, 0x3c, 0x30, 0xae, 0x04, 0x15, 0x18, 0x47, 0xf2, 0x74, 0x99, 0xf8, 0xd7, 0xab, 0xad, 0x8c, 0xf4, 2646 }; 2647 static const u8 ecccdh_SECP384R1_13_test_vector_peer_pub_key[] = { 2648 0x1c, 0x0e, 0xed, 0xa7, 0xa2, 0xbe, 0x00, 0x0c, 0x5b, 0xdc, 0xda, 0x04, 0x78, 0xae, 0xd4, 0xdb, 0x73, 0x3d, 0x2a, 0x9e, 0x34, 0x12, 0x24, 0x37, 0x91, 0x23, 0xad, 0x84, 0x70, 0x30, 0xf2, 0x9e, 0x3b, 0x16, 0x8f, 0xa1, 0x8e, 0x89, 0xa3, 0xc0, 0xfb, 0xa2, 0xa6, 0xce, 0x1c, 0x28, 0xfc, 0x3b, 0xec, 0x8c, 0x1c, 0x83, 0xc1, 0x18, 0xc4, 0xdb, 0xea, 0x94, 0x27, 0x18, 0x69, 0xf2, 0xd8, 0x68, 0xeb, 0x65, 0xe8, 0xb4, 0x4e, 0x21, 0xe6, 0xf1, 0x4b, 0x0f, 0x4d, 0x9b, 0x38, 0xc0, 0x68, 0xda, 0xef, 0xa2, 0x71, 0x14, 0x25, 0x5b, 0x9a, 0x41, 0xd0, 0x84, 0xcc, 0x4a, 0x1a, 0xd8, 0x54, 0x56, 2649 }; 2650 static const u8 ecccdh_SECP384R1_13_test_vector_our_pub_key[] = { 2651 0x88, 0x78, 0xac, 0x8a, 0x94, 0x7f, 0x7d, 0x5c, 0xb2, 0xb4, 0x7a, 0xad, 0x24, 0xfb, 0xb8, 0x21, 0x0d, 0x86, 0x12, 0x65, 0x85, 0x39, 0x9a, 0x28, 0x71, 0xf8, 0x4a, 0xa9, 0xc5, 0xfd, 0xe3, 0x07, 0x4a, 0xe5, 0x40, 0xc6, 0xbf, 0x82, 0x27, 0x5c, 0xa8, 0x22, 0xd0, 0xfe, 0xb8, 0x62, 0xbc, 0x74, 0x63, 0x2f, 0x5c, 0xd2, 0xf9, 0x00, 0xc2, 0x71, 0x1c, 0x32, 0xf8, 0x93, 0x07, 0x28, 0xeb, 0x64, 0x7d, 0x31, 0xed, 0xd8, 0xd6, 0x50, 0xf9, 0x65, 0x4e, 0x7d, 0x33, 0xe5, 0xed, 0x1b, 0x47, 0x54, 0x89, 0xd0, 0x8d, 0xaa, 0x30, 0xd8, 0xcb, 0xcb, 0xa6, 0xbf, 0xc3, 0xb6, 0x0d, 0x9b, 0x5a, 0x37, 2652 }; 2653 static const u8 ecccdh_SECP384R1_13_test_vector_shared_secret[] = { 2654 0xde, 0xff, 0x7f, 0x03, 0xbd, 0x09, 0x86, 0x5b, 0xaf, 0x94, 0x5e, 0x73, 0xed, 0xff, 0x6d, 0x51, 0x22, 0xc0, 0x3f, 0xb5, 0x61, 0xdb, 0x87, 0xde, 0xc8, 0x66, 0x2e, 0x09, 0xbe, 0xd4, 0x34, 0x0b, 0x28, 0xa9, 0xef, 0xe1, 0x18, 0x33, 0x7b, 0xb7, 0xd3, 0xd4, 0xf7, 0xf5, 0x68, 0x63, 0x5f, 0xf9, 2655 }; 2656 static const ecdh_test_case ecccdh_SECP384R1_13_test_case = { 2657 .name = "ECCCDH/SECP384R1 13", 2658 .ecdh_type = ECCCDH, 2659 .ec_str_p = &secp384r1_str_params, 2660 .our_priv_key = ecccdh_SECP384R1_13_test_vector_our_priv_key, 2661 .our_priv_key_len = sizeof(ecccdh_SECP384R1_13_test_vector_our_priv_key), 2662 .peer_pub_key = ecccdh_SECP384R1_13_test_vector_peer_pub_key, 2663 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_13_test_vector_peer_pub_key), 2664 .exp_our_pub_key = ecccdh_SECP384R1_13_test_vector_our_pub_key, 2665 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_13_test_vector_our_pub_key), 2666 .exp_shared_secret = ecccdh_SECP384R1_13_test_vector_shared_secret, 2667 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_13_test_vector_shared_secret), 2668 }; 2669 #endif /* WITH_CURVE_SECP384R1 */ 2670 2671 #ifdef WITH_CURVE_SECP384R1 2672 #define ECCCDH_SECP384R1_SELF_TEST_14 2673 /*** Tests for ECCCDH/SECP384R1 ***/ 2674 static const u8 ecccdh_SECP384R1_14_test_vector_our_priv_key[] = { 2675 0xe3, 0xd0, 0x71, 0x06, 0xbe, 0xdc, 0xc0, 0x96, 0xe7, 0xd9, 0x16, 0x30, 0xff, 0xd3, 0x09, 0x4d, 0xf2, 0xc7, 0x85, 0x9d, 0xb8, 0xd7, 0xed, 0xbb, 0x2e, 0x37, 0xb4, 0xac, 0x47, 0xf4, 0x29, 0xa6, 0x37, 0xd0, 0x6a, 0x67, 0xd2, 0xfb, 0xa3, 0x38, 0x38, 0x76, 0x4e, 0xf2, 0x03, 0x46, 0x49, 0x91, 2676 }; 2677 static const u8 ecccdh_SECP384R1_14_test_vector_peer_pub_key[] = { 2678 0xc9, 0x5c, 0x18, 0x5e, 0x25, 0x6b, 0xf9, 0x97, 0xf3, 0x0b, 0x31, 0x15, 0x48, 0xae, 0x7f, 0x76, 0x8a, 0x38, 0xde, 0xe4, 0x3e, 0xee, 0xef, 0x43, 0x08, 0x3f, 0x30, 0x77, 0xbe, 0x70, 0xe2, 0xbf, 0x39, 0xac, 0x1d, 0x4d, 0xaf, 0x36, 0x0c, 0x51, 0x4c, 0x8c, 0x6b, 0xe6, 0x23, 0x44, 0x3d, 0x1a, 0x3e, 0x63, 0xa6, 0x63, 0xea, 0xf7, 0x5d, 0x8a, 0x76, 0x5a, 0xb2, 0xb9, 0xa3, 0x55, 0x13, 0xd7, 0x93, 0x3f, 0xa5, 0xe2, 0x64, 0x20, 0xa5, 0x24, 0x45, 0x50, 0xec, 0x6c, 0x3b, 0x6f, 0x03, 0x3b, 0x96, 0xdb, 0x2a, 0xca, 0x3d, 0x6a, 0xc6, 0xaa, 0xb0, 0x52, 0xce, 0x92, 0x95, 0x95, 0xae, 0xa5, 2679 }; 2680 static const u8 ecccdh_SECP384R1_14_test_vector_our_pub_key[] = { 2681 0xe7, 0x4a, 0x1a, 0x2b, 0x85, 0xf1, 0xcb, 0xf8, 0xdb, 0xbd, 0xf0, 0x50, 0xcf, 0x1a, 0xff, 0x8a, 0xcb, 0x02, 0xfd, 0xa2, 0xfb, 0x65, 0x91, 0xf9, 0xd3, 0xcf, 0xe4, 0xe7, 0x9d, 0x0a, 0xe9, 0x38, 0xa9, 0xc1, 0x48, 0x3e, 0x7b, 0x75, 0xf8, 0xdb, 0x24, 0x50, 0x5d, 0x65, 0x06, 0x5c, 0xdb, 0x18, 0x17, 0x73, 0xee, 0x59, 0x18, 0x22, 0xf7, 0xab, 0xaa, 0x85, 0x6a, 0x1a, 0x60, 0xbc, 0x0a, 0x52, 0x03, 0x54, 0x8d, 0xbd, 0x1c, 0xb5, 0x02, 0x54, 0x66, 0xef, 0xf8, 0x48, 0x1b, 0xd0, 0x76, 0x14, 0xea, 0xa0, 0x4a, 0x16, 0xc3, 0xdb, 0x76, 0x90, 0x59, 0x13, 0xe9, 0x72, 0xa5, 0xb6, 0xb5, 0x9d, 2682 }; 2683 static const u8 ecccdh_SECP384R1_14_test_vector_shared_secret[] = { 2684 0xc8, 0xb1, 0x03, 0x8f, 0x73, 0x5a, 0xd3, 0xbb, 0x3e, 0x46, 0x37, 0xc3, 0xe4, 0x7e, 0xab, 0x48, 0x76, 0x37, 0x91, 0x1a, 0x6b, 0x79, 0x50, 0xa4, 0xe4, 0x61, 0x94, 0x83, 0x29, 0xd3, 0x92, 0x3b, 0x96, 0x9e, 0x5d, 0xb6, 0x63, 0x67, 0x56, 0x23, 0x61, 0x1a, 0x45, 0x7f, 0xcd, 0xa3, 0x5a, 0x71, 2685 }; 2686 static const ecdh_test_case ecccdh_SECP384R1_14_test_case = { 2687 .name = "ECCCDH/SECP384R1 14", 2688 .ecdh_type = ECCCDH, 2689 .ec_str_p = &secp384r1_str_params, 2690 .our_priv_key = ecccdh_SECP384R1_14_test_vector_our_priv_key, 2691 .our_priv_key_len = sizeof(ecccdh_SECP384R1_14_test_vector_our_priv_key), 2692 .peer_pub_key = ecccdh_SECP384R1_14_test_vector_peer_pub_key, 2693 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_14_test_vector_peer_pub_key), 2694 .exp_our_pub_key = ecccdh_SECP384R1_14_test_vector_our_pub_key, 2695 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_14_test_vector_our_pub_key), 2696 .exp_shared_secret = ecccdh_SECP384R1_14_test_vector_shared_secret, 2697 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_14_test_vector_shared_secret), 2698 }; 2699 #endif /* WITH_CURVE_SECP384R1 */ 2700 2701 #ifdef WITH_CURVE_SECP384R1 2702 #define ECCCDH_SECP384R1_SELF_TEST_15 2703 /*** Tests for ECCCDH/SECP384R1 ***/ 2704 static const u8 ecccdh_SECP384R1_15_test_vector_our_priv_key[] = { 2705 0xf3, 0xf9, 0xb0, 0xc6, 0x5a, 0x49, 0xa5, 0x06, 0x63, 0x2c, 0x8a, 0x45, 0xb1, 0x0f, 0x66, 0xb5, 0x31, 0x6f, 0x9e, 0xeb, 0x06, 0xfa, 0xe2, 0x18, 0xf2, 0xda, 0x62, 0x33, 0x3f, 0x99, 0x90, 0x51, 0x17, 0xb1, 0x41, 0xc7, 0x60, 0xe8, 0x97, 0x4e, 0xfc, 0x4a, 0xf1, 0x05, 0x70, 0x63, 0x57, 0x91, 2706 }; 2707 static const u8 ecccdh_SECP384R1_15_test_vector_peer_pub_key[] = { 2708 0x34, 0x97, 0x23, 0x8a, 0x7e, 0x6a, 0xd1, 0x66, 0xdf, 0x2d, 0xac, 0x03, 0x9a, 0xa4, 0xda, 0xc8, 0xd1, 0x7a, 0xa9, 0x25, 0xe7, 0xc7, 0x63, 0x1e, 0xb3, 0xb5, 0x6e, 0x3a, 0xaa, 0x1c, 0x54, 0x5f, 0xcd, 0x54, 0xd2, 0xe5, 0x98, 0x58, 0x07, 0x91, 0x0f, 0xb2, 0x02, 0xb1, 0xfc, 0x19, 0x1d, 0x2a, 0xa4, 0x9e, 0x5c, 0x48, 0x7d, 0xcc, 0x7a, 0xa4, 0x0a, 0x8f, 0x23, 0x4c, 0x97, 0x94, 0x46, 0x04, 0x0d, 0x91, 0x74, 0xe3, 0xad, 0x35, 0x7d, 0x40, 0x4d, 0x77, 0x65, 0x18, 0x31, 0x95, 0xae, 0xd3, 0xf9, 0x13, 0x64, 0x1b, 0x90, 0xc8, 0x1a, 0x30, 0x6e, 0xbf, 0x0d, 0x89, 0x13, 0x86, 0x13, 0x16, 2709 }; 2710 static const u8 ecccdh_SECP384R1_15_test_vector_our_pub_key[] = { 2711 0xa4, 0xad, 0x77, 0xaa, 0x7d, 0x86, 0xe5, 0x36, 0x11, 0x18, 0xa6, 0xb9, 0x21, 0x71, 0x0c, 0x82, 0x07, 0x21, 0x21, 0x07, 0x12, 0xf4, 0xc3, 0x47, 0x98, 0x5f, 0xde, 0xe5, 0x8a, 0xa4, 0xef, 0xfa, 0x1e, 0x28, 0xbe, 0x80, 0xa1, 0x7b, 0x12, 0x0b, 0x13, 0x9f, 0x96, 0x30, 0x0f, 0x89, 0xb4, 0x9b, 0x1d, 0xdf, 0x22, 0xe0, 0x7e, 0x03, 0xf1, 0x56, 0x0d, 0x8f, 0x45, 0xa4, 0x80, 0x09, 0x45, 0x60, 0xdb, 0xa9, 0xfa, 0xe7, 0xf9, 0x53, 0x11, 0x30, 0xc1, 0xb5, 0x7e, 0xbb, 0x95, 0x98, 0x24, 0x96, 0x52, 0x4f, 0x31, 0xd3, 0x79, 0x77, 0x93, 0x39, 0x6f, 0xa8, 0x23, 0xf2, 0x2b, 0xdb, 0x43, 0x28, 2712 }; 2713 static const u8 ecccdh_SECP384R1_15_test_vector_shared_secret[] = { 2714 0xd3, 0x37, 0xea, 0xa3, 0x2b, 0x9f, 0x71, 0x6b, 0x87, 0x47, 0xb0, 0x05, 0xb9, 0x7a, 0x55, 0x3c, 0x59, 0xda, 0xb0, 0xc5, 0x1d, 0xf4, 0x1a, 0x2d, 0x49, 0x03, 0x9c, 0xda, 0xe7, 0x05, 0xaa, 0x75, 0xc7, 0xb9, 0xe7, 0xbc, 0x0b, 0x6a, 0x0e, 0x8c, 0x57, 0x8c, 0x90, 0x2b, 0xc4, 0xff, 0xf2, 0x3e, 2715 }; 2716 static const ecdh_test_case ecccdh_SECP384R1_15_test_case = { 2717 .name = "ECCCDH/SECP384R1 15", 2718 .ecdh_type = ECCCDH, 2719 .ec_str_p = &secp384r1_str_params, 2720 .our_priv_key = ecccdh_SECP384R1_15_test_vector_our_priv_key, 2721 .our_priv_key_len = sizeof(ecccdh_SECP384R1_15_test_vector_our_priv_key), 2722 .peer_pub_key = ecccdh_SECP384R1_15_test_vector_peer_pub_key, 2723 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_15_test_vector_peer_pub_key), 2724 .exp_our_pub_key = ecccdh_SECP384R1_15_test_vector_our_pub_key, 2725 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_15_test_vector_our_pub_key), 2726 .exp_shared_secret = ecccdh_SECP384R1_15_test_vector_shared_secret, 2727 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_15_test_vector_shared_secret), 2728 }; 2729 #endif /* WITH_CURVE_SECP384R1 */ 2730 2731 #ifdef WITH_CURVE_SECP384R1 2732 #define ECCCDH_SECP384R1_SELF_TEST_16 2733 /*** Tests for ECCCDH/SECP384R1 ***/ 2734 static const u8 ecccdh_SECP384R1_16_test_vector_our_priv_key[] = { 2735 0x59, 0xfc, 0xe7, 0xfa, 0xd7, 0xde, 0x28, 0xba, 0xc0, 0x23, 0x06, 0x90, 0xc9, 0x57, 0x10, 0xc7, 0x20, 0xe5, 0x28, 0xf9, 0xa4, 0xe5, 0x4d, 0x3a, 0x6a, 0x8c, 0xd5, 0xfc, 0x5c, 0x5f, 0x21, 0x63, 0x70, 0x31, 0xce, 0x1c, 0x5b, 0x4e, 0x3d, 0x39, 0x64, 0x7d, 0x8d, 0xcb, 0x9b, 0x79, 0x46, 0x64, 2736 }; 2737 static const u8 ecccdh_SECP384R1_16_test_vector_peer_pub_key[] = { 2738 0x90, 0xa3, 0x47, 0x37, 0xd4, 0x5b, 0x1a, 0xa6, 0x5f, 0x74, 0xe0, 0xbd, 0x06, 0x59, 0xbc, 0x11, 0x8f, 0x8e, 0x4b, 0x77, 0x4b, 0x76, 0x19, 0x44, 0xff, 0xa6, 0x57, 0x3c, 0x6d, 0xf4, 0xf4, 0x1d, 0xec, 0x0d, 0x11, 0xb6, 0x97, 0xab, 0xd9, 0x34, 0xd3, 0x90, 0x87, 0x1d, 0x4b, 0x45, 0x32, 0x40, 0x9b, 0x59, 0x07, 0x19, 0xbb, 0x33, 0x07, 0xc1, 0x49, 0xa7, 0x81, 0x7b, 0xe3, 0x55, 0xd6, 0x84, 0x89, 0x3a, 0x30, 0x77, 0x64, 0xb5, 0x12, 0xee, 0xff, 0xe0, 0x7c, 0xb6, 0x99, 0xed, 0xb5, 0xa6, 0xff, 0xbf, 0x8d, 0x60, 0x32, 0xe6, 0xc7, 0x9d, 0x5e, 0x93, 0xe9, 0x42, 0x12, 0xc2, 0xaa, 0x4e, 2739 }; 2740 static const u8 ecccdh_SECP384R1_16_test_vector_our_pub_key[] = { 2741 0x9c, 0x43, 0xbf, 0x97, 0x1e, 0xdf, 0x09, 0x40, 0x28, 0x76, 0xee, 0x74, 0x20, 0x95, 0x38, 0x1f, 0x78, 0xb1, 0xbd, 0x3a, 0xa3, 0x9b, 0x51, 0x32, 0xaf, 0x75, 0xdb, 0xfe, 0x7e, 0x98, 0xbd, 0x78, 0xbd, 0xe1, 0x0f, 0xe2, 0xe9, 0x03, 0xc2, 0xb6, 0x37, 0x9e, 0x1d, 0xee, 0xe1, 0x75, 0xa1, 0xb0, 0xa6, 0xc5, 0x8e, 0xce, 0xa5, 0xa4, 0x77, 0xbb, 0x01, 0xbd, 0x54, 0x3b, 0x33, 0x9f, 0x1c, 0xc4, 0x9f, 0x13, 0x71, 0xa2, 0xcd, 0xa4, 0xd4, 0x6e, 0xb4, 0xe5, 0x3e, 0x25, 0x05, 0x97, 0x94, 0x23, 0x51, 0xa9, 0x96, 0x65, 0xa1, 0x22, 0xff, 0xea, 0x9b, 0xde, 0x06, 0x36, 0xc3, 0x75, 0xda, 0xf2, 2742 }; 2743 static const u8 ecccdh_SECP384R1_16_test_vector_shared_secret[] = { 2744 0x32, 0xd2, 0x92, 0xb6, 0x95, 0xa4, 0x48, 0x8e, 0x42, 0xa7, 0xb7, 0x92, 0x2e, 0x1a, 0xe5, 0x37, 0xd7, 0x6a, 0x3d, 0x21, 0xa0, 0xb2, 0xe3, 0x68, 0x75, 0xf6, 0x0e, 0x9f, 0x6d, 0x3e, 0x87, 0x79, 0xc2, 0xaf, 0xb3, 0xa4, 0x13, 0xb9, 0xdd, 0x79, 0xae, 0x18, 0xe7, 0x0b, 0x47, 0xd3, 0x37, 0xc1, 2745 }; 2746 static const ecdh_test_case ecccdh_SECP384R1_16_test_case = { 2747 .name = "ECCCDH/SECP384R1 16", 2748 .ecdh_type = ECCCDH, 2749 .ec_str_p = &secp384r1_str_params, 2750 .our_priv_key = ecccdh_SECP384R1_16_test_vector_our_priv_key, 2751 .our_priv_key_len = sizeof(ecccdh_SECP384R1_16_test_vector_our_priv_key), 2752 .peer_pub_key = ecccdh_SECP384R1_16_test_vector_peer_pub_key, 2753 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_16_test_vector_peer_pub_key), 2754 .exp_our_pub_key = ecccdh_SECP384R1_16_test_vector_our_pub_key, 2755 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_16_test_vector_our_pub_key), 2756 .exp_shared_secret = ecccdh_SECP384R1_16_test_vector_shared_secret, 2757 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_16_test_vector_shared_secret), 2758 }; 2759 #endif /* WITH_CURVE_SECP384R1 */ 2760 2761 #ifdef WITH_CURVE_SECP384R1 2762 #define ECCCDH_SECP384R1_SELF_TEST_17 2763 /*** Tests for ECCCDH/SECP384R1 ***/ 2764 static const u8 ecccdh_SECP384R1_17_test_vector_our_priv_key[] = { 2765 0x3e, 0x49, 0xfb, 0xf9, 0x50, 0xa4, 0x24, 0xc5, 0xd8, 0x02, 0x28, 0xdc, 0x4b, 0xc3, 0x5e, 0x9f, 0x6c, 0x6c, 0x0c, 0x1d, 0x04, 0x44, 0x09, 0x98, 0xda, 0x0a, 0x60, 0x9a, 0x87, 0x75, 0x75, 0xdb, 0xe4, 0x37, 0xd6, 0xa5, 0xce, 0xda, 0xa2, 0xdd, 0xd2, 0xa1, 0xa1, 0x7f, 0xd1, 0x12, 0xad, 0xed, 2766 }; 2767 static const u8 ecccdh_SECP384R1_17_test_vector_peer_pub_key[] = { 2768 0xdd, 0xa5, 0x46, 0xac, 0xfc, 0x8f, 0x90, 0x3d, 0x11, 0xe2, 0xe3, 0x92, 0x06, 0x69, 0x63, 0x6d, 0x44, 0xb2, 0x06, 0x8a, 0xeb, 0x66, 0xff, 0x07, 0xaa, 0x26, 0x6f, 0x00, 0x30, 0xe1, 0x53, 0x5b, 0x0e, 0xd0, 0x20, 0x3c, 0xb8, 0xa4, 0x60, 0xac, 0x99, 0x0f, 0x13, 0x94, 0xfa, 0xf2, 0x2f, 0x1d, 0x15, 0xbb, 0xb2, 0x59, 0x79, 0x13, 0x03, 0x5f, 0xaa, 0xdf, 0x41, 0x34, 0x76, 0xf4, 0xc7, 0x0f, 0x72, 0x79, 0x76, 0x9a, 0x40, 0xc9, 0x86, 0xf4, 0x70, 0xc4, 0x27, 0xb4, 0xee, 0x49, 0x62, 0xab, 0xdf, 0x81, 0x73, 0xbb, 0xad, 0x81, 0x87, 0x47, 0x72, 0x92, 0x5f, 0xd3, 0x2f, 0x0b, 0x15, 0x9f, 2769 }; 2770 static const u8 ecccdh_SECP384R1_17_test_vector_our_pub_key[] = { 2771 0x5a, 0x94, 0x95, 0x94, 0x22, 0x8b, 0x1a, 0x3d, 0x6f, 0x59, 0x9e, 0xb3, 0xdb, 0x0d, 0x06, 0x07, 0x0f, 0xbc, 0x55, 0x1c, 0x65, 0x7b, 0x58, 0x23, 0x4b, 0xa1, 0x64, 0xce, 0x3f, 0xe4, 0x15, 0xfa, 0x5f, 0x3e, 0xb8, 0x23, 0xc0, 0x8d, 0xc2, 0x9b, 0x8c, 0x34, 0x12, 0x19, 0xc7, 0x7b, 0x6b, 0x3d, 0x2b, 0xaa, 0xd4, 0x47, 0xc8, 0xc2, 0x90, 0xcf, 0xed, 0x25, 0xed, 0xd9, 0x03, 0x1c, 0x41, 0xd0, 0xb7, 0x69, 0x21, 0x45, 0x73, 0x27, 0xf4, 0x2d, 0xb3, 0x11, 0x22, 0xb8, 0x1f, 0x33, 0x7b, 0xbf, 0x0b, 0x10, 0x39, 0xec, 0x83, 0x0c, 0xe9, 0x06, 0x1a, 0x37, 0x61, 0x95, 0x3c, 0x75, 0xe4, 0xa8, 2772 }; 2773 static const u8 ecccdh_SECP384R1_17_test_vector_shared_secret[] = { 2774 0x12, 0x20, 0xe7, 0xe6, 0xca, 0xd7, 0xb2, 0x5d, 0xf9, 0x8e, 0x5b, 0xbd, 0xcc, 0x6c, 0x0b, 0x65, 0xca, 0x6c, 0x2a, 0x50, 0xc5, 0xff, 0x6c, 0x41, 0xdc, 0xa7, 0x1e, 0x47, 0x56, 0x46, 0xfd, 0x48, 0x96, 0x15, 0x97, 0x9c, 0xa9, 0x2f, 0xb4, 0x38, 0x9a, 0xea, 0xde, 0xfd, 0xe7, 0x9a, 0x24, 0xf1, 2775 }; 2776 static const ecdh_test_case ecccdh_SECP384R1_17_test_case = { 2777 .name = "ECCCDH/SECP384R1 17", 2778 .ecdh_type = ECCCDH, 2779 .ec_str_p = &secp384r1_str_params, 2780 .our_priv_key = ecccdh_SECP384R1_17_test_vector_our_priv_key, 2781 .our_priv_key_len = sizeof(ecccdh_SECP384R1_17_test_vector_our_priv_key), 2782 .peer_pub_key = ecccdh_SECP384R1_17_test_vector_peer_pub_key, 2783 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_17_test_vector_peer_pub_key), 2784 .exp_our_pub_key = ecccdh_SECP384R1_17_test_vector_our_pub_key, 2785 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_17_test_vector_our_pub_key), 2786 .exp_shared_secret = ecccdh_SECP384R1_17_test_vector_shared_secret, 2787 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_17_test_vector_shared_secret), 2788 }; 2789 #endif /* WITH_CURVE_SECP384R1 */ 2790 2791 #ifdef WITH_CURVE_SECP384R1 2792 #define ECCCDH_SECP384R1_SELF_TEST_18 2793 /*** Tests for ECCCDH/SECP384R1 ***/ 2794 static const u8 ecccdh_SECP384R1_18_test_vector_our_priv_key[] = { 2795 0x50, 0xcc, 0xc1, 0xf7, 0x07, 0x6e, 0x92, 0xf4, 0x63, 0x8e, 0x85, 0xf2, 0xdb, 0x98, 0xe0, 0xb4, 0x83, 0xe6, 0xe2, 0x20, 0x4c, 0x92, 0xbd, 0xd4, 0x40, 0xa6, 0xde, 0xea, 0x04, 0xe3, 0x7a, 0x07, 0xc6, 0xe7, 0x27, 0x91, 0xc1, 0x90, 0xad, 0x4e, 0x4e, 0x86, 0xe0, 0x1e, 0xfb, 0xa8, 0x42, 0x69, 2796 }; 2797 static const u8 ecccdh_SECP384R1_18_test_vector_peer_pub_key[] = { 2798 0x78, 0x8b, 0xe2, 0x33, 0x6c, 0x52, 0xf4, 0x45, 0x4d, 0x63, 0xee, 0x94, 0x4b, 0x1e, 0x49, 0xbf, 0xb6, 0x19, 0xa0, 0x83, 0x71, 0x04, 0x8e, 0x6d, 0xa9, 0x2e, 0x58, 0x4e, 0xae, 0x70, 0xbd, 0xe1, 0xf1, 0x71, 0xc4, 0xdf, 0x37, 0x8b, 0xd1, 0xf3, 0xc0, 0xab, 0x03, 0x04, 0x8a, 0x23, 0x78, 0x02, 0x46, 0x73, 0xeb, 0xd8, 0xdb, 0x60, 0x4e, 0xaf, 0x41, 0x71, 0x17, 0x48, 0xba, 0xb2, 0x96, 0x8a, 0x23, 0xca, 0x44, 0x76, 0xce, 0x14, 0x4e, 0x72, 0x82, 0x47, 0xf0, 0x8a, 0xf7, 0x52, 0x92, 0x91, 0x57, 0xb5, 0x83, 0x0f, 0x1e, 0x26, 0x06, 0x74, 0x66, 0xbd, 0xfa, 0x8b, 0x65, 0x14, 0x5a, 0x33, 2799 }; 2800 static const u8 ecccdh_SECP384R1_18_test_vector_our_pub_key[] = { 2801 0x75, 0x6c, 0x07, 0xdf, 0x0c, 0xe3, 0x2c, 0x83, 0x9d, 0xac, 0x9f, 0xb4, 0x73, 0x3c, 0x9c, 0x28, 0xb7, 0x01, 0x13, 0xa6, 0x76, 0xa7, 0x05, 0x7c, 0x38, 0xd2, 0x23, 0xf2, 0x2a, 0x3a, 0x90, 0x95, 0xa8, 0xd5, 0x64, 0x65, 0x3a, 0xf5, 0x28, 0xe0, 0x4c, 0x7e, 0x18, 0x24, 0xbe, 0x4a, 0x65, 0x12, 0x17, 0xc2, 0xce, 0x69, 0x62, 0xcb, 0xd2, 0xa2, 0xe0, 0x66, 0x29, 0x7b, 0x39, 0xd5, 0x7d, 0xd9, 0xbb, 0x46, 0x80, 0xf0, 0x19, 0x1d, 0x39, 0x0f, 0x70, 0xb4, 0xe4, 0x61, 0x41, 0x9b, 0x29, 0x72, 0xce, 0x68, 0xad, 0x46, 0x12, 0x7f, 0xdd, 0xa6, 0xc3, 0x91, 0x95, 0x77, 0x4e, 0xa8, 0x6d, 0xf3, 2802 }; 2803 static const u8 ecccdh_SECP384R1_18_test_vector_shared_secret[] = { 2804 0x79, 0x3b, 0xb9, 0xcd, 0x22, 0xa9, 0x3c, 0xf4, 0x68, 0xfa, 0xf8, 0x04, 0xa3, 0x8d, 0x12, 0xb7, 0x8c, 0xb1, 0x21, 0x89, 0xec, 0x67, 0x9d, 0xdd, 0x2e, 0x9a, 0xa2, 0x1f, 0xa9, 0xa5, 0xa0, 0xb0, 0x49, 0xab, 0x16, 0xa2, 0x35, 0x74, 0xfe, 0x04, 0xc1, 0xc3, 0xc0, 0x23, 0x43, 0xb9, 0x1b, 0xeb, 2805 }; 2806 static const ecdh_test_case ecccdh_SECP384R1_18_test_case = { 2807 .name = "ECCCDH/SECP384R1 18", 2808 .ecdh_type = ECCCDH, 2809 .ec_str_p = &secp384r1_str_params, 2810 .our_priv_key = ecccdh_SECP384R1_18_test_vector_our_priv_key, 2811 .our_priv_key_len = sizeof(ecccdh_SECP384R1_18_test_vector_our_priv_key), 2812 .peer_pub_key = ecccdh_SECP384R1_18_test_vector_peer_pub_key, 2813 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_18_test_vector_peer_pub_key), 2814 .exp_our_pub_key = ecccdh_SECP384R1_18_test_vector_our_pub_key, 2815 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_18_test_vector_our_pub_key), 2816 .exp_shared_secret = ecccdh_SECP384R1_18_test_vector_shared_secret, 2817 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_18_test_vector_shared_secret), 2818 }; 2819 #endif /* WITH_CURVE_SECP384R1 */ 2820 2821 #ifdef WITH_CURVE_SECP384R1 2822 #define ECCCDH_SECP384R1_SELF_TEST_19 2823 /*** Tests for ECCCDH/SECP384R1 ***/ 2824 static const u8 ecccdh_SECP384R1_19_test_vector_our_priv_key[] = { 2825 0x06, 0xf1, 0x32, 0xb7, 0x1f, 0x74, 0xd8, 0x7b, 0xf9, 0x98, 0x57, 0xe1, 0xe4, 0x35, 0x0a, 0x59, 0x4e, 0x5f, 0xe3, 0x55, 0x33, 0xb8, 0x88, 0x55, 0x2c, 0xec, 0xcb, 0xc0, 0xd8, 0x92, 0x3c, 0x90, 0x2e, 0x36, 0x14, 0x1d, 0x76, 0x91, 0xe2, 0x86, 0x31, 0xb8, 0xbc, 0x9b, 0xaf, 0xe5, 0xe0, 0x64, 2826 }; 2827 static const u8 ecccdh_SECP384R1_19_test_vector_peer_pub_key[] = { 2828 0xd0, 0x9b, 0xb8, 0x22, 0xeb, 0x99, 0xe3, 0x80, 0x60, 0x95, 0x47, 0x47, 0xc8, 0x2b, 0xb3, 0x27, 0x8c, 0xf9, 0x6b, 0xbf, 0x36, 0xfe, 0xce, 0x34, 0x00, 0xf4, 0xc8, 0x73, 0x83, 0x8a, 0x40, 0xc1, 0x35, 0xeb, 0x3b, 0xab, 0xb9, 0x29, 0x3b, 0xd1, 0x00, 0x1b, 0xf3, 0xec, 0xde, 0xe7, 0xbf, 0x26, 0xd4, 0x16, 0xdb, 0x6e, 0x1b, 0x87, 0xbb, 0xb7, 0x42, 0x77, 0x88, 0xa3, 0xb6, 0xc7, 0xa7, 0xab, 0x2c, 0x16, 0x5b, 0x1e, 0x36, 0x6f, 0x96, 0x08, 0xdf, 0x51, 0x20, 0x37, 0x58, 0x4f, 0x21, 0x3a, 0x64, 0x8d, 0x47, 0xf1, 0x6a, 0xc3, 0x26, 0xe1, 0x9a, 0xae, 0x97, 0x2f, 0x63, 0xfd, 0x76, 0xc9, 2829 }; 2830 static const u8 ecccdh_SECP384R1_19_test_vector_our_pub_key[] = { 2831 0x2a, 0x3c, 0xc6, 0xb8, 0xff, 0x5c, 0xde, 0x92, 0x6e, 0x7e, 0x3a, 0x18, 0x9a, 0x1b, 0xd0, 0x29, 0xc9, 0xb5, 0x86, 0x35, 0x1a, 0xf8, 0x83, 0x8f, 0x4f, 0x20, 0x1c, 0xb8, 0xf4, 0xb7, 0x0e, 0xf3, 0xb0, 0xda, 0x06, 0xd3, 0x52, 0xc8, 0x0f, 0xc2, 0x6b, 0xaf, 0x8f, 0x42, 0xb7, 0x84, 0x45, 0x9e, 0xbf, 0x99, 0x85, 0x96, 0x01, 0x76, 0xda, 0x6d, 0x23, 0xc7, 0x45, 0x2a, 0x29, 0x54, 0xff, 0xcb, 0xbc, 0xb2, 0x42, 0x49, 0xb4, 0x30, 0x19, 0xa2, 0xa0, 0x23, 0xe0, 0xb3, 0xda, 0xbd, 0x46, 0x1f, 0x19, 0xad, 0x3e, 0x77, 0x5c, 0x36, 0x4f, 0x3f, 0x11, 0xad, 0x49, 0xf3, 0x09, 0x94, 0x00, 0xd3, 2832 }; 2833 static const u8 ecccdh_SECP384R1_19_test_vector_shared_secret[] = { 2834 0x01, 0x2d, 0x19, 0x1c, 0xf7, 0x40, 0x4a, 0x52, 0x36, 0x78, 0xc6, 0xfc, 0x07, 0x5d, 0xe8, 0x28, 0x5b, 0x24, 0x37, 0x20, 0xa9, 0x03, 0x04, 0x77, 0x08, 0xbb, 0x33, 0xe5, 0x01, 0xe0, 0xdb, 0xee, 0x5b, 0xcc, 0x40, 0xd7, 0xc3, 0xef, 0x6c, 0x6d, 0xa3, 0x9e, 0xa2, 0x4d, 0x83, 0x0d, 0xa1, 0xe8, 2835 }; 2836 static const ecdh_test_case ecccdh_SECP384R1_19_test_case = { 2837 .name = "ECCCDH/SECP384R1 19", 2838 .ecdh_type = ECCCDH, 2839 .ec_str_p = &secp384r1_str_params, 2840 .our_priv_key = ecccdh_SECP384R1_19_test_vector_our_priv_key, 2841 .our_priv_key_len = sizeof(ecccdh_SECP384R1_19_test_vector_our_priv_key), 2842 .peer_pub_key = ecccdh_SECP384R1_19_test_vector_peer_pub_key, 2843 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_19_test_vector_peer_pub_key), 2844 .exp_our_pub_key = ecccdh_SECP384R1_19_test_vector_our_pub_key, 2845 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_19_test_vector_our_pub_key), 2846 .exp_shared_secret = ecccdh_SECP384R1_19_test_vector_shared_secret, 2847 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_19_test_vector_shared_secret), 2848 }; 2849 #endif /* WITH_CURVE_SECP384R1 */ 2850 2851 #ifdef WITH_CURVE_SECP384R1 2852 #define ECCCDH_SECP384R1_SELF_TEST_20 2853 /*** Tests for ECCCDH/SECP384R1 ***/ 2854 static const u8 ecccdh_SECP384R1_20_test_vector_our_priv_key[] = { 2855 0x12, 0x04, 0x8e, 0xbb, 0x43, 0x31, 0xec, 0x19, 0xa1, 0xe2, 0x3f, 0x1a, 0x2c, 0x77, 0x3b, 0x66, 0x4c, 0xcf, 0xe9, 0x0a, 0x28, 0xbf, 0xb8, 0x46, 0xfc, 0x12, 0xf8, 0x1d, 0xff, 0x44, 0xb7, 0x44, 0x3c, 0x77, 0x64, 0x71, 0x64, 0xbf, 0x1e, 0x9e, 0x67, 0xfd, 0x2c, 0x07, 0xa6, 0x76, 0x62, 0x41, 2856 }; 2857 static const u8 ecccdh_SECP384R1_20_test_vector_peer_pub_key[] = { 2858 0x13, 0x74, 0x12, 0x62, 0xed, 0xe5, 0x86, 0x1d, 0xad, 0x71, 0x06, 0x3d, 0xfd, 0x20, 0x4b, 0x91, 0xea, 0x1d, 0x3b, 0x7c, 0x63, 0x1d, 0xf6, 0x8e, 0xb9, 0x49, 0x96, 0x95, 0x27, 0xd7, 0x9a, 0x1d, 0xc5, 0x92, 0x95, 0xef, 0x7d, 0x2b, 0xca, 0x67, 0x43, 0xe8, 0xcd, 0x77, 0xb0, 0x4d, 0x1b, 0x58, 0x0b, 0xaa, 0xea, 0xdc, 0x7e, 0x19, 0xd7, 0x4a, 0x8a, 0x04, 0x45, 0x1a, 0x13, 0x5f, 0x1b, 0xe1, 0xb0, 0x2f, 0xe2, 0x99, 0xf9, 0xdc, 0x00, 0xbf, 0xdf, 0x20, 0x1e, 0x83, 0xd9, 0x95, 0xc6, 0x95, 0x0b, 0xcc, 0x1c, 0xb8, 0x9d, 0x6f, 0x7b, 0x30, 0xbf, 0x54, 0x65, 0x6b, 0x9a, 0x4d, 0xa5, 0x86, 2859 }; 2860 static const u8 ecccdh_SECP384R1_20_test_vector_our_pub_key[] = { 2861 0xbc, 0x18, 0x83, 0x6b, 0xc7, 0xa9, 0xfd, 0xf5, 0x4b, 0x53, 0x52, 0xf3, 0x7d, 0x75, 0x28, 0xab, 0x8f, 0xa8, 0xec, 0x54, 0x4a, 0x8c, 0x61, 0x80, 0x51, 0x1c, 0xbf, 0xdd, 0x49, 0xcc, 0xe3, 0x77, 0xc3, 0x9e, 0x34, 0xc0, 0x31, 0xb5, 0x24, 0x0d, 0xc9, 0x98, 0x05, 0x03, 0xed, 0x2f, 0x26, 0x2c, 0x80, 0x86, 0xcb, 0xe3, 0x38, 0x19, 0x10, 0x80, 0xf0, 0xb7, 0xa1, 0x6c, 0x7a, 0xfc, 0x4c, 0x7b, 0x03, 0x26, 0xf9, 0xac, 0x66, 0xf5, 0x85, 0x52, 0xef, 0x4b, 0xb9, 0xd2, 0x4d, 0xe3, 0x42, 0x9e, 0xd5, 0xd3, 0x27, 0x7e, 0xd5, 0x8f, 0xcf, 0x48, 0xf2, 0xb5, 0xf6, 0x13, 0x26, 0xbe, 0xc6, 0xc6, 2862 }; 2863 static const u8 ecccdh_SECP384R1_20_test_vector_shared_secret[] = { 2864 0xad, 0x0f, 0xd3, 0xdd, 0xff, 0xe8, 0x88, 0x4b, 0x92, 0x63, 0xf3, 0xc1, 0x5f, 0xe1, 0xf0, 0x7f, 0x2a, 0x5a, 0x22, 0xff, 0xdc, 0x7e, 0x96, 0x70, 0x85, 0xee, 0xa4, 0x5f, 0x0c, 0xd9, 0x59, 0xf2, 0x0f, 0x18, 0xf5, 0x22, 0x76, 0x3e, 0x28, 0xbc, 0xc9, 0x25, 0xe4, 0x96, 0xa5, 0x2d, 0xda, 0x98, 2865 }; 2866 static const ecdh_test_case ecccdh_SECP384R1_20_test_case = { 2867 .name = "ECCCDH/SECP384R1 20", 2868 .ecdh_type = ECCCDH, 2869 .ec_str_p = &secp384r1_str_params, 2870 .our_priv_key = ecccdh_SECP384R1_20_test_vector_our_priv_key, 2871 .our_priv_key_len = sizeof(ecccdh_SECP384R1_20_test_vector_our_priv_key), 2872 .peer_pub_key = ecccdh_SECP384R1_20_test_vector_peer_pub_key, 2873 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_20_test_vector_peer_pub_key), 2874 .exp_our_pub_key = ecccdh_SECP384R1_20_test_vector_our_pub_key, 2875 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_20_test_vector_our_pub_key), 2876 .exp_shared_secret = ecccdh_SECP384R1_20_test_vector_shared_secret, 2877 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_20_test_vector_shared_secret), 2878 }; 2879 #endif /* WITH_CURVE_SECP384R1 */ 2880 2881 #ifdef WITH_CURVE_SECP384R1 2882 #define ECCCDH_SECP384R1_SELF_TEST_21 2883 /*** Tests for ECCCDH/SECP384R1 ***/ 2884 static const u8 ecccdh_SECP384R1_21_test_vector_our_priv_key[] = { 2885 0x34, 0xd6, 0x1a, 0x69, 0x9c, 0xa5, 0x76, 0x16, 0x9f, 0xcd, 0xc0, 0xcc, 0x7e, 0x44, 0xe4, 0xe1, 0x22, 0x1d, 0xb0, 0xfe, 0x63, 0xd1, 0x68, 0x50, 0xc8, 0x10, 0x40, 0x29, 0xf7, 0xd4, 0x84, 0x49, 0x71, 0x4b, 0x98, 0x84, 0x32, 0x8c, 0xae, 0x18, 0x99, 0x78, 0x75, 0x4a, 0xb4, 0x60, 0xb4, 0x86, 2886 }; 2887 static const u8 ecccdh_SECP384R1_21_test_vector_peer_pub_key[] = { 2888 0x9e, 0x22, 0xcb, 0xc1, 0x86, 0x57, 0xf5, 0x16, 0xa8, 0x64, 0xb3, 0x7b, 0x78, 0x33, 0x48, 0xb6, 0x6f, 0x1a, 0xa9, 0x62, 0x6c, 0xd6, 0x31, 0xf4, 0xfa, 0x1b, 0xd3, 0x2a, 0xd8, 0x8c, 0xf1, 0x1d, 0xb5, 0x20, 0x57, 0xc6, 0x60, 0x86, 0x0d, 0x39, 0xd1, 0x1f, 0xbf, 0x02, 0x4f, 0xab, 0xd4, 0x44, 0x6b, 0x0d, 0x53, 0xc7, 0x96, 0x81, 0xc2, 0x81, 0x16, 0xdf, 0x71, 0xe9, 0xce, 0xe7, 0x4f, 0xd5, 0x6c, 0x8b, 0x7f, 0x04, 0xb3, 0x9f, 0x11, 0x98, 0xcc, 0x72, 0x28, 0x4e, 0x98, 0xbe, 0x95, 0x62, 0xe3, 0x59, 0x26, 0xfb, 0x4f, 0x48, 0xa9, 0xfb, 0xec, 0xaf, 0xe7, 0x29, 0x30, 0x9e, 0x8b, 0x6f, 2889 }; 2890 static const u8 ecccdh_SECP384R1_21_test_vector_our_pub_key[] = { 2891 0x86, 0x7f, 0x81, 0x10, 0x4c, 0xcd, 0x6b, 0x16, 0x3a, 0x79, 0x02, 0xb6, 0x70, 0xef, 0x40, 0x60, 0x42, 0xcb, 0x0c, 0xce, 0x7d, 0xcd, 0xc6, 0x3d, 0x1d, 0xfc, 0x91, 0xb2, 0xc4, 0x0e, 0x3c, 0xdf, 0x75, 0x95, 0x83, 0x4b, 0xf9, 0xec, 0xeb, 0x79, 0x84, 0x9f, 0x16, 0x36, 0xfc, 0x84, 0x62, 0xfc, 0x9d, 0x4b, 0xde, 0x8e, 0x87, 0x5e, 0xc4, 0x96, 0x97, 0xd2, 0x58, 0xd1, 0xd5, 0x94, 0x65, 0xf8, 0x43, 0x1c, 0x6f, 0x55, 0x31, 0xe1, 0xc5, 0x9e, 0x9f, 0x9e, 0xbe, 0x3c, 0xf1, 0x64, 0xa8, 0xd9, 0xce, 0x10, 0xa1, 0x2f, 0x19, 0x79, 0x28, 0x3a, 0x95, 0x9b, 0xad, 0x24, 0x4d, 0xd8, 0x38, 0x63, 2892 }; 2893 static const u8 ecccdh_SECP384R1_21_test_vector_shared_secret[] = { 2894 0xdc, 0x4c, 0xa3, 0x92, 0xdc, 0x15, 0xe2, 0x01, 0x85, 0xf2, 0xc6, 0xa8, 0xea, 0x5e, 0xc3, 0x1d, 0xfc, 0x96, 0xf5, 0x61, 0x53, 0xa4, 0x73, 0x94, 0xb3, 0x07, 0x2b, 0x13, 0xd0, 0x01, 0x5f, 0x5d, 0x4a, 0xe1, 0x3b, 0xeb, 0x3b, 0xed, 0x54, 0xd6, 0x58, 0x48, 0xf9, 0xb8, 0x38, 0x3e, 0x6c, 0x95, 2895 }; 2896 static const ecdh_test_case ecccdh_SECP384R1_21_test_case = { 2897 .name = "ECCCDH/SECP384R1 21", 2898 .ecdh_type = ECCCDH, 2899 .ec_str_p = &secp384r1_str_params, 2900 .our_priv_key = ecccdh_SECP384R1_21_test_vector_our_priv_key, 2901 .our_priv_key_len = sizeof(ecccdh_SECP384R1_21_test_vector_our_priv_key), 2902 .peer_pub_key = ecccdh_SECP384R1_21_test_vector_peer_pub_key, 2903 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_21_test_vector_peer_pub_key), 2904 .exp_our_pub_key = ecccdh_SECP384R1_21_test_vector_our_pub_key, 2905 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_21_test_vector_our_pub_key), 2906 .exp_shared_secret = ecccdh_SECP384R1_21_test_vector_shared_secret, 2907 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_21_test_vector_shared_secret), 2908 }; 2909 #endif /* WITH_CURVE_SECP384R1 */ 2910 2911 #ifdef WITH_CURVE_SECP384R1 2912 #define ECCCDH_SECP384R1_SELF_TEST_22 2913 /*** Tests for ECCCDH/SECP384R1 ***/ 2914 static const u8 ecccdh_SECP384R1_22_test_vector_our_priv_key[] = { 2915 0xdc, 0x60, 0xfa, 0x87, 0x36, 0xd7, 0x02, 0x13, 0x5f, 0xf1, 0x6a, 0xab, 0x99, 0x2b, 0xb8, 0x8e, 0xac, 0x39, 0x7f, 0x59, 0x72, 0x45, 0x6c, 0x72, 0xec, 0x44, 0x73, 0x74, 0xd0, 0xd8, 0xce, 0x61, 0x15, 0x38, 0x31, 0xbf, 0xc8, 0x6a, 0xd5, 0xa6, 0xeb, 0x5b, 0x60, 0xbf, 0xb9, 0x6a, 0x86, 0x2c, 2916 }; 2917 static const u8 ecccdh_SECP384R1_22_test_vector_peer_pub_key[] = { 2918 0x2d, 0xb5, 0xda, 0x5f, 0x94, 0x0e, 0xaa, 0x88, 0x4f, 0x4d, 0xb5, 0xec, 0x21, 0x39, 0xb0, 0x46, 0x9f, 0x38, 0xe4, 0xe6, 0xfb, 0xbc, 0xc5, 0x2d, 0xf1, 0x5c, 0x0f, 0x7c, 0xf7, 0xfc, 0xb1, 0x80, 0x8c, 0x74, 0x97, 0x64, 0xb6, 0xbe, 0x85, 0xd2, 0xfd, 0xc5, 0xb1, 0x6f, 0x58, 0xad, 0x5d, 0xc0, 0x22, 0xe8, 0xb0, 0x2d, 0xcf, 0x33, 0xe1, 0xb5, 0xa0, 0x83, 0x84, 0x95, 0x45, 0xf8, 0x4a, 0xd5, 0xe4, 0x3f, 0x77, 0xcb, 0x71, 0x54, 0x6d, 0xbb, 0xac, 0x0d, 0x11, 0xbd, 0xb2, 0xee, 0x20, 0x2e, 0x9d, 0x38, 0x72, 0xe8, 0xd0, 0x28, 0xc0, 0x89, 0x90, 0x74, 0x6c, 0x5e, 0x1d, 0xde, 0x99, 0x89, 2919 }; 2920 static const u8 ecccdh_SECP384R1_22_test_vector_our_pub_key[] = { 2921 0xb6, 0x9b, 0xee, 0xde, 0x85, 0xd0, 0xf8, 0x29, 0xfe, 0xc1, 0xb8, 0x93, 0xcc, 0xb9, 0xc3, 0xe0, 0x52, 0xff, 0x69, 0x2e, 0x13, 0xb9, 0x74, 0x53, 0x7b, 0xc5, 0xb0, 0xf9, 0xfe, 0xaf, 0x7b, 0x22, 0xe8, 0x4f, 0x03, 0x23, 0x16, 0x29, 0xb2, 0x48, 0x66, 0xbd, 0xb4, 0xb8, 0xcf, 0x90, 0x89, 0x14, 0x66, 0xf8, 0x5e, 0x2b, 0xfc, 0xab, 0xa2, 0x84, 0x32, 0x85, 0xb0, 0xe1, 0x4e, 0xbc, 0x07, 0xef, 0x7d, 0xaf, 0xff, 0x8b, 0x42, 0x44, 0x16, 0xfe, 0xe6, 0x47, 0xb5, 0x98, 0x97, 0xb6, 0x19, 0xf2, 0x0e, 0xed, 0x95, 0xa6, 0x32, 0xe6, 0xa4, 0x20, 0x6b, 0xf7, 0xda, 0x42, 0x9c, 0x04, 0xc5, 0x60, 2922 }; 2923 static const u8 ecccdh_SECP384R1_22_test_vector_shared_secret[] = { 2924 0xd7, 0x65, 0xb2, 0x08, 0x11, 0x2d, 0x2b, 0x9e, 0xd5, 0xad, 0x10, 0xc4, 0x04, 0x6e, 0x2e, 0x3b, 0x0d, 0xbf, 0x57, 0xc4, 0x69, 0x32, 0x95, 0x19, 0xe2, 0x39, 0xac, 0x28, 0xb2, 0x5c, 0x7d, 0x85, 0x2b, 0xf7, 0x57, 0xd5, 0xde, 0x0e, 0xe2, 0x71, 0xca, 0xdd, 0x02, 0x1d, 0x86, 0xcf, 0xd3, 0x47, 2925 }; 2926 static const ecdh_test_case ecccdh_SECP384R1_22_test_case = { 2927 .name = "ECCCDH/SECP384R1 22", 2928 .ecdh_type = ECCCDH, 2929 .ec_str_p = &secp384r1_str_params, 2930 .our_priv_key = ecccdh_SECP384R1_22_test_vector_our_priv_key, 2931 .our_priv_key_len = sizeof(ecccdh_SECP384R1_22_test_vector_our_priv_key), 2932 .peer_pub_key = ecccdh_SECP384R1_22_test_vector_peer_pub_key, 2933 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_22_test_vector_peer_pub_key), 2934 .exp_our_pub_key = ecccdh_SECP384R1_22_test_vector_our_pub_key, 2935 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_22_test_vector_our_pub_key), 2936 .exp_shared_secret = ecccdh_SECP384R1_22_test_vector_shared_secret, 2937 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_22_test_vector_shared_secret), 2938 }; 2939 #endif /* WITH_CURVE_SECP384R1 */ 2940 2941 #ifdef WITH_CURVE_SECP384R1 2942 #define ECCCDH_SECP384R1_SELF_TEST_23 2943 /*** Tests for ECCCDH/SECP384R1 ***/ 2944 static const u8 ecccdh_SECP384R1_23_test_vector_our_priv_key[] = { 2945 0x6f, 0xa6, 0xa1, 0xc7, 0x04, 0x73, 0x09, 0x87, 0xaa, 0x63, 0x4b, 0x05, 0x16, 0xa8, 0x26, 0xab, 0xa8, 0xc6, 0xd6, 0x41, 0x1d, 0x3a, 0x4c, 0x89, 0x77, 0x2d, 0x7a, 0x62, 0x61, 0x02, 0x56, 0xa2, 0xe2, 0xf2, 0x89, 0xf5, 0xc3, 0x44, 0x0b, 0x0e, 0xc1, 0xe7, 0x0f, 0xa3, 0x39, 0xe2, 0x51, 0xce, 2946 }; 2947 static const u8 ecccdh_SECP384R1_23_test_vector_peer_pub_key[] = { 2948 0x32, 0x96, 0x47, 0xba, 0xa3, 0x54, 0x22, 0x4e, 0xb4, 0x41, 0x48, 0x29, 0xc5, 0x36, 0x8c, 0x82, 0xd7, 0x89, 0x3b, 0x39, 0x80, 0x4e, 0x08, 0xcb, 0xb2, 0x18, 0x0f, 0x45, 0x9b, 0xef, 0xc4, 0xb3, 0x47, 0xa3, 0x89, 0xa7, 0x0c, 0x91, 0xa2, 0x3b, 0xd9, 0xd3, 0x0c, 0x83, 0xbe, 0x52, 0x95, 0xd3, 0xcc, 0x8f, 0x61, 0x92, 0x3f, 0xad, 0x2a, 0xa8, 0xe5, 0x05, 0xd6, 0xcf, 0xa1, 0x26, 0xb9, 0xfa, 0xbd, 0x5a, 0xf9, 0xdc, 0xe2, 0x90, 0xb7, 0x56, 0x60, 0xef, 0x06, 0xd1, 0xca, 0xa7, 0x36, 0x81, 0xd0, 0x60, 0x89, 0xc3, 0x3b, 0xc4, 0x24, 0x6b, 0x3a, 0xa3, 0x0d, 0xbc, 0xd2, 0x43, 0x5b, 0x12, 2949 }; 2950 static const u8 ecccdh_SECP384R1_23_test_vector_our_pub_key[] = { 2951 0x53, 0xde, 0x1f, 0xc1, 0x32, 0x8e, 0x8d, 0xe1, 0x4a, 0xec, 0xab, 0x29, 0xad, 0x8a, 0x40, 0xd6, 0xb1, 0x37, 0x68, 0xf8, 0x6f, 0x7d, 0x29, 0x84, 0x33, 0xd2, 0x0f, 0xec, 0x79, 0x1f, 0x86, 0xf8, 0xbc, 0x73, 0xf3, 0x58, 0x09, 0x8b, 0x25, 0x6a, 0x29, 0x8b, 0xb4, 0x88, 0xde, 0x25, 0x7b, 0xf4, 0xac, 0x28, 0x94, 0x4f, 0xd2, 0x7f, 0x17, 0xb8, 0x29, 0x46, 0xc0, 0x4c, 0x66, 0xc4, 0x1f, 0x00, 0x53, 0xd3, 0x69, 0x2f, 0x27, 0x5d, 0xa5, 0x5c, 0xd8, 0x73, 0x9a, 0x95, 0xbd, 0x8c, 0xd3, 0xaf, 0x2f, 0x96, 0xe4, 0xde, 0x95, 0x9e, 0xa8, 0x34, 0x4d, 0x89, 0x45, 0x37, 0x59, 0x05, 0x85, 0x8b, 2952 }; 2953 static const u8 ecccdh_SECP384R1_23_test_vector_shared_secret[] = { 2954 0xd3, 0x77, 0x88, 0x50, 0xae, 0xb5, 0x88, 0x04, 0xfb, 0xe9, 0xdf, 0xe6, 0xf3, 0x8b, 0x9f, 0xa8, 0xe2, 0x0c, 0x2c, 0xa4, 0xe0, 0xde, 0xc3, 0x35, 0xaa, 0xfc, 0xec, 0xa0, 0x33, 0x3e, 0x3f, 0x24, 0x90, 0xb5, 0x3c, 0x0c, 0x1a, 0x14, 0xa8, 0x31, 0xba, 0x37, 0xc4, 0xb9, 0xd7, 0x4b, 0xe0, 0xf2, 2955 }; 2956 static const ecdh_test_case ecccdh_SECP384R1_23_test_case = { 2957 .name = "ECCCDH/SECP384R1 23", 2958 .ecdh_type = ECCCDH, 2959 .ec_str_p = &secp384r1_str_params, 2960 .our_priv_key = ecccdh_SECP384R1_23_test_vector_our_priv_key, 2961 .our_priv_key_len = sizeof(ecccdh_SECP384R1_23_test_vector_our_priv_key), 2962 .peer_pub_key = ecccdh_SECP384R1_23_test_vector_peer_pub_key, 2963 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_23_test_vector_peer_pub_key), 2964 .exp_our_pub_key = ecccdh_SECP384R1_23_test_vector_our_pub_key, 2965 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_23_test_vector_our_pub_key), 2966 .exp_shared_secret = ecccdh_SECP384R1_23_test_vector_shared_secret, 2967 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_23_test_vector_shared_secret), 2968 }; 2969 #endif /* WITH_CURVE_SECP384R1 */ 2970 2971 #ifdef WITH_CURVE_SECP384R1 2972 #define ECCCDH_SECP384R1_SELF_TEST_24 2973 /*** Tests for ECCCDH/SECP384R1 ***/ 2974 static const u8 ecccdh_SECP384R1_24_test_vector_our_priv_key[] = { 2975 0x74, 0xad, 0x83, 0x86, 0xc1, 0xcb, 0x2c, 0xa0, 0xfc, 0xde, 0xb3, 0x1e, 0x08, 0x69, 0xbb, 0x3f, 0x48, 0xc0, 0x36, 0xaf, 0xe2, 0xef, 0x11, 0x0c, 0xa3, 0x02, 0xbc, 0x8b, 0x91, 0x0f, 0x62, 0x1c, 0x9f, 0xcc, 0x54, 0xce, 0xc3, 0x2b, 0xb8, 0x9e, 0xc7, 0xca, 0xa8, 0x4c, 0x7b, 0x8e, 0x54, 0xa8, 2976 }; 2977 static const u8 ecccdh_SECP384R1_24_test_vector_peer_pub_key[] = { 2978 0x29, 0xd8, 0xa3, 0x6d, 0x22, 0x20, 0x0a, 0x75, 0xb7, 0xae, 0xa1, 0xbb, 0x47, 0xcd, 0xfc, 0xb1, 0xb7, 0xfd, 0x66, 0xde, 0x96, 0x70, 0x41, 0x43, 0x47, 0x28, 0xab, 0x5d, 0x53, 0x3a, 0x06, 0x0d, 0xf7, 0x32, 0x13, 0x06, 0x00, 0xfe, 0x6f, 0x75, 0x85, 0x2a, 0x87, 0x1f, 0xb2, 0x93, 0x8e, 0x39, 0xe1, 0x9b, 0x53, 0xdb, 0x52, 0x83, 0x95, 0xde, 0x89, 0x7a, 0x45, 0x10, 0x89, 0x67, 0x71, 0x5e, 0xb8, 0xcb, 0x55, 0xc3, 0xfc, 0xbf, 0x23, 0x37, 0x93, 0x72, 0xc0, 0x87, 0x3a, 0x05, 0x8d, 0x57, 0x54, 0x4b, 0x10, 0x2e, 0xcc, 0xe7, 0x22, 0xb2, 0xcc, 0xab, 0xb1, 0xa6, 0x03, 0x77, 0x4f, 0xd5, 2979 }; 2980 static const u8 ecccdh_SECP384R1_24_test_vector_our_pub_key[] = { 2981 0x27, 0xa3, 0xe8, 0x3c, 0xfb, 0x9d, 0x51, 0x22, 0xe7, 0x31, 0x29, 0xd8, 0x01, 0x61, 0x58, 0x57, 0xda, 0x7c, 0xc0, 0x89, 0xcc, 0xcc, 0x9c, 0x54, 0xab, 0x30, 0x32, 0xa1, 0x9e, 0x0a, 0x0a, 0x9f, 0x67, 0x73, 0x46, 0xe3, 0x7f, 0x08, 0xa0, 0xb3, 0xed, 0x8d, 0xa6, 0xe5, 0xdd, 0x69, 0x10, 0x63, 0x8d, 0x60, 0xe4, 0x4a, 0xa5, 0xe0, 0xfd, 0x30, 0xc9, 0x18, 0x45, 0x67, 0x96, 0xaf, 0x37, 0xf0, 0xe4, 0x19, 0x57, 0x90, 0x16, 0x45, 0xe5, 0xc5, 0x96, 0xc6, 0xd9, 0x89, 0xf5, 0x85, 0x9b, 0x03, 0xa0, 0xbd, 0x7d, 0x1f, 0x4e, 0x77, 0x93, 0x6f, 0xff, 0x3c, 0x74, 0xd2, 0x04, 0xe5, 0x38, 0x8e, 2982 }; 2983 static const u8 ecccdh_SECP384R1_24_test_vector_shared_secret[] = { 2984 0x81, 0xe1, 0xe7, 0x15, 0x75, 0xbb, 0x45, 0x05, 0x49, 0x8d, 0xe0, 0x97, 0x35, 0x01, 0x86, 0x43, 0x0a, 0x62, 0x42, 0xfa, 0x6c, 0x57, 0xb8, 0x5a, 0x5f, 0x98, 0x4a, 0x23, 0x37, 0x11, 0x23, 0xd2, 0xd1, 0x42, 0x4e, 0xef, 0xbf, 0x80, 0x42, 0x58, 0x39, 0x2b, 0xc7, 0x23, 0xe4, 0xef, 0x1e, 0x35, 2985 }; 2986 static const ecdh_test_case ecccdh_SECP384R1_24_test_case = { 2987 .name = "ECCCDH/SECP384R1 24", 2988 .ecdh_type = ECCCDH, 2989 .ec_str_p = &secp384r1_str_params, 2990 .our_priv_key = ecccdh_SECP384R1_24_test_vector_our_priv_key, 2991 .our_priv_key_len = sizeof(ecccdh_SECP384R1_24_test_vector_our_priv_key), 2992 .peer_pub_key = ecccdh_SECP384R1_24_test_vector_peer_pub_key, 2993 .peer_pub_key_len = sizeof(ecccdh_SECP384R1_24_test_vector_peer_pub_key), 2994 .exp_our_pub_key = ecccdh_SECP384R1_24_test_vector_our_pub_key, 2995 .exp_our_pub_key_len = sizeof(ecccdh_SECP384R1_24_test_vector_our_pub_key), 2996 .exp_shared_secret = ecccdh_SECP384R1_24_test_vector_shared_secret, 2997 .exp_shared_secret_len = sizeof(ecccdh_SECP384R1_24_test_vector_shared_secret), 2998 }; 2999 #endif /* WITH_CURVE_SECP384R1 */ 3000 3001 #ifdef WITH_CURVE_SECP521R1 3002 #define ECCCDH_SECP521R1_SELF_TEST_0 3003 /*** Tests for ECCCDH/SECP521R1 ***/ 3004 static const u8 ecccdh_SECP521R1_0_test_vector_our_priv_key[] = { 3005 0x00, 0x00, 0x01, 0x7e, 0xec, 0xc0, 0x7a, 0xb4, 0xb3, 0x29, 0x06, 0x8f, 0xba, 0x65, 0xe5, 0x6a, 0x1f, 0x88, 0x90, 0xaa, 0x93, 0x5e, 0x57, 0x13, 0x4a, 0xe0, 0xff, 0xcc, 0xe8, 0x02, 0x73, 0x51, 0x51, 0xf4, 0xea, 0xc6, 0x56, 0x4f, 0x6e, 0xe9, 0x97, 0x4c, 0x5e, 0x68, 0x87, 0xa1, 0xfe, 0xfe, 0xe5, 0x74, 0x3a, 0xe2, 0x24, 0x1b, 0xfe, 0xb9, 0x5d, 0x5c, 0xe3, 0x1d, 0xdc, 0xb6, 0xf9, 0xed, 0xb4, 0xd6, 0xfc, 0x47, 3006 }; 3007 static const u8 ecccdh_SECP521R1_0_test_vector_peer_pub_key[] = { 3008 0x00, 0x68, 0x5a, 0x48, 0xe8, 0x6c, 0x79, 0xf0, 0xf0, 0x87, 0x5f, 0x7b, 0xc1, 0x8d, 0x25, 0xeb, 0x5f, 0xc8, 0xc0, 0xb0, 0x7e, 0x5d, 0xa4, 0xf4, 0x37, 0x0f, 0x3a, 0x94, 0x90, 0x34, 0x08, 0x54, 0x33, 0x4b, 0x1e, 0x1b, 0x87, 0xfa, 0x39, 0x54, 0x64, 0xc6, 0x06, 0x26, 0x12, 0x4a, 0x4e, 0x70, 0xd0, 0xf7, 0x85, 0x60, 0x1d, 0x37, 0xc0, 0x98, 0x70, 0xeb, 0xf1, 0x76, 0x66, 0x68, 0x77, 0xa2, 0x04, 0x6d, 0x01, 0xba, 0x52, 0xc5, 0x6f, 0xc8, 0x77, 0x6d, 0x9e, 0x8f, 0x5d, 0xb4, 0xf0, 0xcc, 0x27, 0x63, 0x6d, 0x0b, 0x74, 0x1b, 0xbe, 0x05, 0x40, 0x06, 0x97, 0x94, 0x2e, 0x80, 0xb7, 0x39, 0x88, 0x4a, 0x83, 0xbd, 0xe9, 0x9e, 0x0f, 0x67, 0x16, 0x93, 0x9e, 0x63, 0x2b, 0xc8, 0x98, 0x6f, 0xa1, 0x8d, 0xcc, 0xd4, 0x43, 0xa3, 0x48, 0xb6, 0xc3, 0xe5, 0x22, 0x49, 0x79, 0x55, 0xa4, 0xf3, 0xc3, 0x02, 0xf6, 0x76, 3009 }; 3010 static const u8 ecccdh_SECP521R1_0_test_vector_our_pub_key[] = { 3011 0x00, 0x60, 0x2f, 0x9d, 0x0c, 0xf9, 0xe5, 0x26, 0xb2, 0x9e, 0x22, 0x38, 0x1c, 0x20, 0x3c, 0x48, 0xa8, 0x86, 0xc2, 0xb0, 0x67, 0x30, 0x33, 0x36, 0x63, 0x14, 0xf1, 0xff, 0xbc, 0xba, 0x24, 0x0b, 0xa4, 0x2f, 0x4e, 0xf3, 0x8a, 0x76, 0x17, 0x46, 0x35, 0xf9, 0x1e, 0x6b, 0x4e, 0xd3, 0x42, 0x75, 0xeb, 0x01, 0xc8, 0x46, 0x7d, 0x05, 0xca, 0x80, 0x31, 0x5b, 0xf1, 0xa7, 0xbb, 0xd9, 0x45, 0xf5, 0x50, 0xa5, 0x01, 0xb7, 0xc8, 0x5f, 0x26, 0xf5, 0xd4, 0xb2, 0xd7, 0x35, 0x5c, 0xf6, 0xb0, 0x21, 0x17, 0x65, 0x99, 0x43, 0x76, 0x2b, 0x6d, 0x1d, 0xb5, 0xab, 0x4f, 0x1d, 0xbc, 0x44, 0xce, 0x7b, 0x29, 0x46, 0xeb, 0x6c, 0x7d, 0xe3, 0x42, 0x96, 0x28, 0x93, 0xfd, 0x38, 0x7d, 0x1b, 0x73, 0xd7, 0xa8, 0x67, 0x2d, 0x1f, 0x23, 0x69, 0x61, 0x17, 0x0b, 0x7e, 0xb3, 0x57, 0x99, 0x53, 0xee, 0x5c, 0xdc, 0x88, 0xcd, 0x2d, 3012 }; 3013 static const u8 ecccdh_SECP521R1_0_test_vector_shared_secret[] = { 3014 0x00, 0x5f, 0xc7, 0x04, 0x77, 0xc3, 0xe6, 0x3b, 0xc3, 0x95, 0x4b, 0xd0, 0xdf, 0x3e, 0xa0, 0xd1, 0xf4, 0x1e, 0xe2, 0x17, 0x46, 0xed, 0x95, 0xfc, 0x5e, 0x1f, 0xdf, 0x90, 0x93, 0x0d, 0x5e, 0x13, 0x66, 0x72, 0xd7, 0x2c, 0xc7, 0x70, 0x74, 0x2d, 0x17, 0x11, 0xc3, 0xc3, 0xa4, 0xc3, 0x34, 0xa0, 0xad, 0x97, 0x59, 0x43, 0x6a, 0x4d, 0x3c, 0x5b, 0xf6, 0xe7, 0x4b, 0x95, 0x78, 0xfa, 0xc1, 0x48, 0xc8, 0x31, 3015 }; 3016 static const ecdh_test_case ecccdh_SECP521R1_0_test_case = { 3017 .name = "ECCCDH/SECP521R1 0", 3018 .ecdh_type = ECCCDH, 3019 .ec_str_p = &secp521r1_str_params, 3020 .our_priv_key = ecccdh_SECP521R1_0_test_vector_our_priv_key, 3021 .our_priv_key_len = sizeof(ecccdh_SECP521R1_0_test_vector_our_priv_key), 3022 .peer_pub_key = ecccdh_SECP521R1_0_test_vector_peer_pub_key, 3023 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_0_test_vector_peer_pub_key), 3024 .exp_our_pub_key = ecccdh_SECP521R1_0_test_vector_our_pub_key, 3025 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_0_test_vector_our_pub_key), 3026 .exp_shared_secret = ecccdh_SECP521R1_0_test_vector_shared_secret, 3027 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_0_test_vector_shared_secret), 3028 }; 3029 #endif /* WITH_CURVE_SECP521R1 */ 3030 3031 #ifdef WITH_CURVE_SECP521R1 3032 #define ECCCDH_SECP521R1_SELF_TEST_1 3033 /*** Tests for ECCCDH/SECP521R1 ***/ 3034 static const u8 ecccdh_SECP521R1_1_test_vector_our_priv_key[] = { 3035 0x00, 0x00, 0x00, 0x81, 0x6f, 0x19, 0xc1, 0xfb, 0x10, 0xef, 0x94, 0xd4, 0xa1, 0xd8, 0x1c, 0x15, 0x6e, 0xc3, 0xd1, 0xde, 0x08, 0xb6, 0x67, 0x61, 0xf0, 0x3f, 0x06, 0xee, 0x4b, 0xb9, 0xdc, 0xeb, 0xbb, 0xfe, 0x1e, 0xaa, 0x1e, 0xd4, 0x9a, 0x6a, 0x99, 0x08, 0x38, 0xd8, 0xed, 0x31, 0x8c, 0x14, 0xd7, 0x4c, 0xc8, 0x72, 0xf9, 0x5d, 0x05, 0xd0, 0x7a, 0xd5, 0x0f, 0x62, 0x1c, 0xeb, 0x62, 0x0c, 0xd9, 0x05, 0xcf, 0xb8, 3036 }; 3037 static const u8 ecccdh_SECP521R1_1_test_vector_peer_pub_key[] = { 3038 0x01, 0xdf, 0x27, 0x7c, 0x15, 0x21, 0x08, 0x34, 0x9b, 0xc3, 0x4d, 0x53, 0x9e, 0xe0, 0xcf, 0x06, 0xb2, 0x4f, 0x5d, 0x35, 0x00, 0x67, 0x7b, 0x44, 0x45, 0x45, 0x3c, 0xcc, 0x21, 0x40, 0x94, 0x53, 0xaa, 0xfb, 0x8a, 0x72, 0xa0, 0xbe, 0x9e, 0xbe, 0x54, 0xd1, 0x22, 0x70, 0xaa, 0x51, 0xb3, 0xab, 0x7f, 0x31, 0x6a, 0xa5, 0xe7, 0x4a, 0x95, 0x1c, 0x5e, 0x53, 0xf7, 0x4c, 0xd9, 0x5f, 0xc2, 0x9a, 0xee, 0x7a, 0x01, 0x3d, 0x52, 0xf3, 0x3a, 0x9f, 0x3c, 0x14, 0x38, 0x4d, 0x15, 0x87, 0xfa, 0x8a, 0xbe, 0x7a, 0xed, 0x74, 0xbc, 0x33, 0x74, 0x9a, 0xd9, 0xc5, 0x70, 0xb4, 0x71, 0x77, 0x64, 0x22, 0xc7, 0xd4, 0x50, 0x5d, 0x9b, 0x0a, 0x96, 0xb3, 0xbf, 0xac, 0x04, 0x1e, 0x4c, 0x6a, 0x69, 0x90, 0xae, 0x7f, 0x70, 0x0e, 0x5b, 0x4a, 0x66, 0x40, 0x22, 0x91, 0x12, 0xde, 0xaf, 0xa0, 0xcd, 0x8b, 0xb0, 0xd0, 0x89, 0xb0, 3039 }; 3040 static const u8 ecccdh_SECP521R1_1_test_vector_our_pub_key[] = { 3041 0x00, 0xd4, 0x56, 0x15, 0xed, 0x5d, 0x37, 0xfd, 0xe6, 0x99, 0x61, 0x0a, 0x62, 0xcd, 0x43, 0xba, 0x76, 0xbe, 0xdd, 0x8f, 0x85, 0xed, 0x31, 0x00, 0x5f, 0xe0, 0x0d, 0x64, 0x50, 0xfb, 0xbd, 0x10, 0x12, 0x91, 0xab, 0xd9, 0x6d, 0x49, 0x45, 0xa8, 0xb5, 0x7b, 0xc7, 0x3b, 0x3f, 0xe9, 0xf4, 0x67, 0x11, 0x05, 0x30, 0x9e, 0xc9, 0xb6, 0x87, 0x9d, 0x05, 0x51, 0xd9, 0x30, 0xda, 0xc8, 0xba, 0x45, 0xd2, 0x55, 0x01, 0x42, 0x53, 0x32, 0x84, 0x4e, 0x59, 0x2b, 0x44, 0x0c, 0x00, 0x27, 0x97, 0x2a, 0xd1, 0x52, 0x64, 0x31, 0xc0, 0x67, 0x32, 0xdf, 0x19, 0xcd, 0x46, 0xa2, 0x42, 0x17, 0x2d, 0x4d, 0xd6, 0x7c, 0x2c, 0x8c, 0x99, 0xdf, 0xc2, 0x2e, 0x49, 0x94, 0x9a, 0x56, 0xcf, 0x90, 0xc6, 0x47, 0x36, 0x35, 0xce, 0x82, 0xf2, 0x5b, 0x33, 0x68, 0x2f, 0xb1, 0x9b, 0xc3, 0x3b, 0xd9, 0x10, 0xed, 0x8c, 0xe3, 0xa7, 0xfa, 3042 }; 3043 static const u8 ecccdh_SECP521R1_1_test_vector_shared_secret[] = { 3044 0x00, 0x0b, 0x39, 0x20, 0xac, 0x83, 0x0a, 0xde, 0x81, 0x2c, 0x8f, 0x96, 0x80, 0x5d, 0xa2, 0x23, 0x6e, 0x00, 0x2a, 0xcb, 0xbf, 0x13, 0x59, 0x6a, 0x9a, 0xb2, 0x54, 0xd4, 0x4d, 0x0e, 0x91, 0xb6, 0x25, 0x5e, 0xbf, 0x12, 0x29, 0xf3, 0x66, 0xfb, 0x5a, 0x05, 0xc5, 0x88, 0x4e, 0xf4, 0x60, 0x32, 0xc2, 0x6d, 0x42, 0x18, 0x92, 0x73, 0xca, 0x4e, 0xfa, 0x4c, 0x3d, 0xb6, 0xbd, 0x12, 0xa6, 0x85, 0x37, 0x59, 3045 }; 3046 static const ecdh_test_case ecccdh_SECP521R1_1_test_case = { 3047 .name = "ECCCDH/SECP521R1 1", 3048 .ecdh_type = ECCCDH, 3049 .ec_str_p = &secp521r1_str_params, 3050 .our_priv_key = ecccdh_SECP521R1_1_test_vector_our_priv_key, 3051 .our_priv_key_len = sizeof(ecccdh_SECP521R1_1_test_vector_our_priv_key), 3052 .peer_pub_key = ecccdh_SECP521R1_1_test_vector_peer_pub_key, 3053 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_1_test_vector_peer_pub_key), 3054 .exp_our_pub_key = ecccdh_SECP521R1_1_test_vector_our_pub_key, 3055 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_1_test_vector_our_pub_key), 3056 .exp_shared_secret = ecccdh_SECP521R1_1_test_vector_shared_secret, 3057 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_1_test_vector_shared_secret), 3058 }; 3059 #endif /* WITH_CURVE_SECP521R1 */ 3060 3061 #ifdef WITH_CURVE_SECP521R1 3062 #define ECCCDH_SECP521R1_SELF_TEST_2 3063 /*** Tests for ECCCDH/SECP521R1 ***/ 3064 static const u8 ecccdh_SECP521R1_2_test_vector_our_priv_key[] = { 3065 0x00, 0x00, 0x01, 0x2f, 0x2e, 0x0c, 0x6d, 0x9e, 0x9d, 0x11, 0x7c, 0xeb, 0x97, 0x23, 0xbc, 0xed, 0x02, 0xeb, 0x3d, 0x4e, 0xeb, 0xf5, 0xfe, 0xea, 0xf8, 0xee, 0x01, 0x13, 0xcc, 0xd8, 0x05, 0x7b, 0x13, 0xdd, 0xd4, 0x16, 0xe0, 0xb7, 0x42, 0x80, 0xc2, 0xd0, 0xba, 0x8e, 0xd2, 0x91, 0xc4, 0x43, 0xbc, 0x1b, 0x14, 0x1c, 0xaf, 0x8a, 0xfb, 0x3a, 0x71, 0xf9, 0x7f, 0x57, 0xc2, 0x25, 0xc0, 0x3e, 0x1e, 0x4d, 0x42, 0xb0, 3066 }; 3067 static const u8 ecccdh_SECP521R1_2_test_vector_peer_pub_key[] = { 3068 0x00, 0x92, 0xdb, 0x31, 0x42, 0x56, 0x4d, 0x27, 0xa5, 0xf0, 0x00, 0x6f, 0x81, 0x99, 0x08, 0xfb, 0xa1, 0xb8, 0x50, 0x38, 0xa5, 0xbc, 0x25, 0x09, 0x90, 0x6a, 0x49, 0x7d, 0xaa, 0xc6, 0x7f, 0xd7, 0xae, 0xe0, 0xfc, 0x2d, 0xab, 0xa4, 0xe4, 0x33, 0x4e, 0xea, 0xef, 0x0e, 0x00, 0x19, 0x20, 0x4b, 0x47, 0x1c, 0xd8, 0x80, 0x24, 0xf8, 0x21, 0x15, 0xd8, 0x14, 0x9c, 0xc0, 0xcf, 0x4f, 0x7c, 0xe1, 0xa4, 0xd5, 0x01, 0x6b, 0xad, 0x06, 0x23, 0xf5, 0x17, 0xb1, 0x58, 0xd9, 0x88, 0x18, 0x41, 0xd2, 0x57, 0x1e, 0xfb, 0xad, 0x63, 0xf8, 0x5c, 0xbe, 0x2e, 0x58, 0x19, 0x60, 0xc5, 0xd6, 0x70, 0x60, 0x1a, 0x67, 0x60, 0x27, 0x26, 0x75, 0xa5, 0x48, 0x99, 0x62, 0x17, 0xe4, 0xab, 0x2b, 0x8e, 0xbc, 0xe3, 0x1d, 0x71, 0xfc, 0xa6, 0x3f, 0xcc, 0x3c, 0x08, 0xe9, 0x1c, 0x1d, 0x8e, 0xdd, 0x91, 0xcf, 0x6f, 0xe8, 0x45, 0xf8, 3069 }; 3070 static const u8 ecccdh_SECP521R1_2_test_vector_our_pub_key[] = { 3071 0x00, 0x71, 0x7f, 0xcb, 0x3d, 0x4a, 0x40, 0xd1, 0x03, 0x87, 0x1e, 0xde, 0x04, 0x4d, 0xc8, 0x03, 0xdb, 0x50, 0x8a, 0xaa, 0x4a, 0xe7, 0x4b, 0x70, 0xb9, 0xfb, 0x8d, 0x8d, 0xfd, 0x84, 0xbf, 0xec, 0xfa, 0xd1, 0x78, 0x71, 0x87, 0x96, 0x98, 0xc2, 0x92, 0xd2, 0xfd, 0x5e, 0x17, 0xb4, 0xf9, 0x34, 0x36, 0x36, 0xc5, 0x31, 0xa4, 0xfa, 0xc6, 0x8a, 0x35, 0xa9, 0x36, 0x65, 0x54, 0x6b, 0x9a, 0x87, 0x86, 0x79, 0x00, 0xf3, 0xd9, 0x6a, 0x86, 0x37, 0x03, 0x69, 0x93, 0xab, 0x5d, 0x24, 0x45, 0x00, 0xff, 0xf9, 0xd2, 0x77, 0x21, 0x12, 0x82, 0x6f, 0x64, 0x36, 0x60, 0x3d, 0x3e, 0xb2, 0x34, 0xa4, 0x4d, 0x5c, 0x4e, 0x5c, 0x57, 0x72, 0x34, 0x67, 0x9c, 0x4f, 0x9d, 0xf7, 0x25, 0xee, 0x5b, 0x91, 0x18, 0xf2, 0x3d, 0x8a, 0x58, 0xd0, 0xcc, 0x01, 0x09, 0x6d, 0xaf, 0x70, 0xe8, 0xdf, 0xec, 0x01, 0x28, 0xbd, 0xc2, 0xe8, 3072 }; 3073 static const u8 ecccdh_SECP521R1_2_test_vector_shared_secret[] = { 3074 0x00, 0x6b, 0x38, 0x0a, 0x6e, 0x95, 0x67, 0x92, 0x77, 0xcf, 0xee, 0x4e, 0x83, 0x53, 0xbf, 0x96, 0xef, 0x2a, 0x1e, 0xbd, 0xd0, 0x60, 0x74, 0x9f, 0x2f, 0x04, 0x6f, 0xe5, 0x71, 0x05, 0x37, 0x40, 0xbb, 0xcc, 0x9a, 0x0b, 0x55, 0x79, 0x0b, 0xc9, 0xab, 0x56, 0xc3, 0x20, 0x8a, 0xa0, 0x5d, 0xdf, 0x74, 0x6a, 0x10, 0xa3, 0xad, 0x69, 0x4d, 0xaa, 0xe0, 0x0d, 0x98, 0x0d, 0x94, 0x4a, 0xab, 0xc6, 0xa0, 0x8f, 3075 }; 3076 static const ecdh_test_case ecccdh_SECP521R1_2_test_case = { 3077 .name = "ECCCDH/SECP521R1 2", 3078 .ecdh_type = ECCCDH, 3079 .ec_str_p = &secp521r1_str_params, 3080 .our_priv_key = ecccdh_SECP521R1_2_test_vector_our_priv_key, 3081 .our_priv_key_len = sizeof(ecccdh_SECP521R1_2_test_vector_our_priv_key), 3082 .peer_pub_key = ecccdh_SECP521R1_2_test_vector_peer_pub_key, 3083 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_2_test_vector_peer_pub_key), 3084 .exp_our_pub_key = ecccdh_SECP521R1_2_test_vector_our_pub_key, 3085 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_2_test_vector_our_pub_key), 3086 .exp_shared_secret = ecccdh_SECP521R1_2_test_vector_shared_secret, 3087 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_2_test_vector_shared_secret), 3088 }; 3089 #endif /* WITH_CURVE_SECP521R1 */ 3090 3091 #ifdef WITH_CURVE_SECP521R1 3092 #define ECCCDH_SECP521R1_SELF_TEST_3 3093 /*** Tests for ECCCDH/SECP521R1 ***/ 3094 static const u8 ecccdh_SECP521R1_3_test_vector_our_priv_key[] = { 3095 0x00, 0x00, 0x00, 0xe5, 0x48, 0xa7, 0x9d, 0x8b, 0x05, 0xf9, 0x23, 0xb9, 0x82, 0x5d, 0x11, 0xb6, 0x56, 0xf2, 0x22, 0xe8, 0xcb, 0x98, 0xb0, 0xf8, 0x9d, 0xe1, 0xd3, 0x17, 0x18, 0x4d, 0xc5, 0xa6, 0x98, 0xf7, 0xc7, 0x11, 0x61, 0xee, 0x7d, 0xc1, 0x1c, 0xd3, 0x1f, 0x4f, 0x4f, 0x8a, 0xe3, 0xa9, 0x81, 0xe1, 0xa3, 0xe7, 0x8b, 0xde, 0xbb, 0x97, 0xd7, 0xc2, 0x04, 0xb9, 0x26, 0x1b, 0x4e, 0xf9, 0x2e, 0x09, 0x18, 0xe0, 3096 }; 3097 static const u8 ecccdh_SECP521R1_3_test_vector_peer_pub_key[] = { 3098 0x00, 0xfd, 0xd4, 0x0d, 0x9e, 0x9d, 0x97, 0x40, 0x27, 0xcb, 0x3b, 0xae, 0x68, 0x21, 0x62, 0xea, 0xc1, 0x32, 0x8a, 0xd6, 0x1b, 0xc4, 0x35, 0x3c, 0x45, 0xbf, 0x5a, 0xfe, 0x76, 0xbf, 0x60, 0x7d, 0x28, 0x94, 0xc8, 0xcc, 0xe2, 0x36, 0x95, 0xd9, 0x20, 0xf2, 0x46, 0x4f, 0xda, 0x47, 0x73, 0xd4, 0x69, 0x3b, 0xe4, 0xb3, 0x77, 0x35, 0x84, 0x69, 0x1b, 0xdb, 0x03, 0x29, 0xb7, 0xf4, 0xc8, 0x6c, 0xc2, 0x99, 0x00, 0x34, 0xce, 0xac, 0x6a, 0x3f, 0xef, 0x1c, 0x3e, 0x1c, 0x49, 0x4b, 0xfe, 0x8d, 0x87, 0x2b, 0x18, 0x38, 0x32, 0x21, 0x9a, 0x7e, 0x14, 0xda, 0x41, 0x4d, 0x4e, 0x34, 0x74, 0x57, 0x36, 0x71, 0xec, 0x19, 0xb0, 0x33, 0xbe, 0x83, 0x1b, 0x91, 0x54, 0x35, 0x90, 0x59, 0x25, 0xb4, 0x49, 0x47, 0xc5, 0x92, 0x95, 0x99, 0x45, 0xb4, 0xeb, 0x7c, 0x95, 0x1c, 0x3b, 0x9c, 0x8c, 0xf5, 0x25, 0x30, 0xba, 0x23, 3099 }; 3100 static const u8 ecccdh_SECP521R1_3_test_vector_our_pub_key[] = { 3101 0x00, 0x0c, 0xe8, 0x00, 0x21, 0x7e, 0xd2, 0x43, 0xdd, 0x10, 0xa7, 0x9a, 0xd7, 0x3d, 0xf5, 0x78, 0xaa, 0x8a, 0x3f, 0x91, 0x94, 0xaf, 0x52, 0x8c, 0xd1, 0x09, 0x4b, 0xbf, 0xee, 0x27, 0xa3, 0xb5, 0x48, 0x1a, 0xd5, 0x86, 0x2c, 0x88, 0x76, 0xc0, 0xc3, 0xf9, 0x12, 0x94, 0xc0, 0xab, 0x3a, 0xa8, 0x06, 0xd9, 0x02, 0x0c, 0xba, 0xa2, 0xed, 0x72, 0xb7, 0xfe, 0xcd, 0xc5, 0xa0, 0x9a, 0x6d, 0xad, 0x6f, 0x32, 0x01, 0x54, 0x3c, 0x9a, 0xb4, 0x5b, 0x12, 0x46, 0x92, 0x32, 0x91, 0x8e, 0x21, 0xd5, 0xa3, 0x51, 0xf9, 0xa4, 0xb9, 0xcb, 0xf9, 0xef, 0xb2, 0xaf, 0xcc, 0x40, 0x2f, 0xa9, 0xb3, 0x16, 0x50, 0xbe, 0xc2, 0xd6, 0x41, 0xa0, 0x5c, 0x44, 0x0d, 0x35, 0x33, 0x1c, 0x08, 0x93, 0xd1, 0x1f, 0xb1, 0x31, 0x51, 0x33, 0x59, 0x88, 0xb3, 0x03, 0x34, 0x13, 0x01, 0xa7, 0x3d, 0xc5, 0xf6, 0x1d, 0x57, 0x4e, 0x67, 0xd9, 3102 }; 3103 static const u8 ecccdh_SECP521R1_3_test_vector_shared_secret[] = { 3104 0x00, 0xfb, 0xbc, 0xd0, 0xb8, 0xd0, 0x53, 0x31, 0xfe, 0xf6, 0x08, 0x6f, 0x22, 0xa6, 0xcc, 0xe4, 0xd3, 0x57, 0x24, 0xab, 0x7a, 0x2f, 0x49, 0xdd, 0x84, 0x58, 0xd0, 0xbf, 0xd5, 0x7a, 0x0b, 0x8b, 0x70, 0xf2, 0x46, 0xc1, 0x7c, 0x44, 0x68, 0xc0, 0x76, 0x87, 0x4b, 0x0d, 0xff, 0x7a, 0x03, 0x36, 0x82, 0x3b, 0x19, 0xe9, 0x8b, 0xf1, 0xce, 0xc0, 0x5e, 0x4b, 0xef, 0xfb, 0x05, 0x91, 0xf9, 0x77, 0x13, 0xc6, 3105 }; 3106 static const ecdh_test_case ecccdh_SECP521R1_3_test_case = { 3107 .name = "ECCCDH/SECP521R1 3", 3108 .ecdh_type = ECCCDH, 3109 .ec_str_p = &secp521r1_str_params, 3110 .our_priv_key = ecccdh_SECP521R1_3_test_vector_our_priv_key, 3111 .our_priv_key_len = sizeof(ecccdh_SECP521R1_3_test_vector_our_priv_key), 3112 .peer_pub_key = ecccdh_SECP521R1_3_test_vector_peer_pub_key, 3113 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_3_test_vector_peer_pub_key), 3114 .exp_our_pub_key = ecccdh_SECP521R1_3_test_vector_our_pub_key, 3115 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_3_test_vector_our_pub_key), 3116 .exp_shared_secret = ecccdh_SECP521R1_3_test_vector_shared_secret, 3117 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_3_test_vector_shared_secret), 3118 }; 3119 #endif /* WITH_CURVE_SECP521R1 */ 3120 3121 #ifdef WITH_CURVE_SECP521R1 3122 #define ECCCDH_SECP521R1_SELF_TEST_4 3123 /*** Tests for ECCCDH/SECP521R1 ***/ 3124 static const u8 ecccdh_SECP521R1_4_test_vector_our_priv_key[] = { 3125 0x00, 0x00, 0x01, 0xc8, 0xaa, 0xe9, 0x4b, 0xb1, 0x0b, 0x8c, 0xa4, 0xf7, 0xbe, 0x57, 0x7b, 0x4f, 0xb3, 0x2b, 0xb2, 0x38, 0x10, 0x32, 0xc4, 0x94, 0x2c, 0x24, 0xfc, 0x2d, 0x75, 0x3e, 0x7c, 0xc5, 0xe4, 0x7b, 0x48, 0x33, 0x89, 0xd9, 0xf3, 0xb9, 0x56, 0xd2, 0x0e, 0xe9, 0x00, 0x1b, 0x1e, 0xef, 0x9f, 0x23, 0x54, 0x5f, 0x72, 0xc5, 0x60, 0x21, 0x40, 0x04, 0x68, 0x39, 0xe9, 0x63, 0x31, 0x3c, 0x3d, 0xec, 0xc8, 0x64, 3126 }; 3127 static const u8 ecccdh_SECP521R1_4_test_vector_peer_pub_key[] = { 3128 0x00, 0x98, 0xd9, 0x9d, 0xee, 0x08, 0x16, 0x55, 0x0e, 0x84, 0xdb, 0xfc, 0xed, 0x7e, 0x88, 0x13, 0x7f, 0xdd, 0xcf, 0x58, 0x1a, 0x72, 0x5a, 0x45, 0x50, 0x21, 0x11, 0x5f, 0xe4, 0x9f, 0x8d, 0xc3, 0xcf, 0x23, 0x3c, 0xd9, 0xea, 0x0e, 0x6f, 0x03, 0x9d, 0xc7, 0x91, 0x9d, 0xa9, 0x73, 0xcd, 0xce, 0xac, 0xa2, 0x05, 0xda, 0x39, 0xe0, 0xbd, 0x98, 0xc8, 0x06, 0x25, 0x36, 0xc4, 0x7f, 0x25, 0x8f, 0x44, 0xb5, 0x00, 0xcd, 0x22, 0x5c, 0x87, 0x97, 0x37, 0x1b, 0xe0, 0xc4, 0x29, 0x7d, 0x2b, 0x45, 0x77, 0x40, 0x10, 0x0c, 0x77, 0x41, 0x41, 0xd8, 0xf2, 0x14, 0xc2, 0x3b, 0x61, 0xaa, 0x2b, 0x6c, 0xd4, 0x80, 0x6b, 0x9b, 0x70, 0x72, 0x2a, 0xa4, 0x96, 0x5f, 0xb6, 0x22, 0xf4, 0x2b, 0x73, 0x91, 0xe2, 0x7e, 0x5e, 0xc2, 0x1c, 0x56, 0x79, 0xc5, 0xb0, 0x6b, 0x59, 0x12, 0x73, 0x72, 0x99, 0x7d, 0x42, 0x1a, 0xdc, 0x1e, 3129 }; 3130 static const u8 ecccdh_SECP521R1_4_test_vector_our_pub_key[] = { 3131 0x01, 0x06, 0xa1, 0x4e, 0x2e, 0xe8, 0xff, 0x97, 0x0a, 0xa8, 0xab, 0x0c, 0x79, 0xb9, 0x7a, 0x33, 0xbb, 0xa2, 0x95, 0x8e, 0x07, 0x0b, 0x75, 0xb9, 0x47, 0x36, 0xb7, 0x7b, 0xbe, 0x3f, 0x77, 0x73, 0x24, 0xfa, 0x52, 0x87, 0x27, 0x71, 0xaa, 0x88, 0xa6, 0x3a, 0x9e, 0x84, 0x90, 0xc3, 0x37, 0x8d, 0xf4, 0xdc, 0x76, 0x0c, 0xd1, 0x4d, 0x62, 0xbe, 0x70, 0x07, 0x79, 0xdd, 0x1a, 0x43, 0x77, 0x94, 0x36, 0x56, 0x00, 0x23, 0x66, 0xce, 0x39, 0x41, 0xe0, 0xb2, 0x84, 0xb1, 0xaa, 0x81, 0x21, 0x5d, 0x0d, 0x3b, 0x97, 0x78, 0xfc, 0xe2, 0x3c, 0x8c, 0xd1, 0xe4, 0xed, 0x6f, 0xa0, 0xab, 0xf6, 0x21, 0x56, 0xc9, 0x1d, 0x4b, 0x3e, 0xb5, 0x59, 0x99, 0xc3, 0x47, 0x1b, 0xed, 0x27, 0x5e, 0x9e, 0x60, 0xe5, 0xaa, 0x9d, 0x69, 0x0d, 0x31, 0x0b, 0xfb, 0x15, 0xc9, 0xc5, 0xbb, 0xd6, 0xf5, 0xe9, 0xeb, 0x39, 0x68, 0x2b, 0x74, 3132 }; 3133 static const u8 ecccdh_SECP521R1_4_test_vector_shared_secret[] = { 3134 0x01, 0x45, 0xcf, 0xa3, 0x8f, 0x25, 0x94, 0x35, 0x16, 0xc9, 0x6a, 0x5f, 0xd4, 0xbf, 0xeb, 0xb2, 0xf6, 0x45, 0xd1, 0x05, 0x20, 0x11, 0x7a, 0xa5, 0x19, 0x71, 0xef, 0xf4, 0x42, 0x80, 0x8a, 0x23, 0xb4, 0xe2, 0x3c, 0x18, 0x7e, 0x63, 0x9f, 0xf9, 0x28, 0xc3, 0x72, 0x5f, 0xbd, 0x1c, 0x0c, 0x2a, 0xd0, 0xd4, 0xae, 0xb2, 0x07, 0xbc, 0x1a, 0x6f, 0xb6, 0xcb, 0x6d, 0x46, 0x78, 0x88, 0xdc, 0x04, 0x4b, 0x3c, 3135 }; 3136 static const ecdh_test_case ecccdh_SECP521R1_4_test_case = { 3137 .name = "ECCCDH/SECP521R1 4", 3138 .ecdh_type = ECCCDH, 3139 .ec_str_p = &secp521r1_str_params, 3140 .our_priv_key = ecccdh_SECP521R1_4_test_vector_our_priv_key, 3141 .our_priv_key_len = sizeof(ecccdh_SECP521R1_4_test_vector_our_priv_key), 3142 .peer_pub_key = ecccdh_SECP521R1_4_test_vector_peer_pub_key, 3143 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_4_test_vector_peer_pub_key), 3144 .exp_our_pub_key = ecccdh_SECP521R1_4_test_vector_our_pub_key, 3145 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_4_test_vector_our_pub_key), 3146 .exp_shared_secret = ecccdh_SECP521R1_4_test_vector_shared_secret, 3147 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_4_test_vector_shared_secret), 3148 }; 3149 #endif /* WITH_CURVE_SECP521R1 */ 3150 3151 #ifdef WITH_CURVE_SECP521R1 3152 #define ECCCDH_SECP521R1_SELF_TEST_5 3153 /*** Tests for ECCCDH/SECP521R1 ***/ 3154 static const u8 ecccdh_SECP521R1_5_test_vector_our_priv_key[] = { 3155 0x00, 0x00, 0x00, 0x9b, 0x0a, 0xf1, 0x37, 0xc9, 0x69, 0x6c, 0x75, 0xb7, 0xe6, 0xdf, 0x7b, 0x73, 0x15, 0x6b, 0xb2, 0xd4, 0x5f, 0x48, 0x2e, 0x5a, 0x42, 0x17, 0x32, 0x4f, 0x47, 0x8b, 0x10, 0xce, 0xb7, 0x6a, 0xf0, 0x97, 0x24, 0xcf, 0x86, 0xaf, 0xa3, 0x16, 0xe7, 0xf8, 0x99, 0x18, 0xd3, 0x1d, 0x54, 0x82, 0x4a, 0x5c, 0x33, 0x10, 0x7a, 0x48, 0x3c, 0x15, 0xc1, 0x5b, 0x96, 0xed, 0xc6, 0x61, 0x34, 0x0b, 0x1c, 0x0e, 3156 }; 3157 static const u8 ecccdh_SECP521R1_5_test_vector_peer_pub_key[] = { 3158 0x00, 0x7a, 0xe1, 0x15, 0xad, 0xaa, 0xf0, 0x41, 0x69, 0x1a, 0xb6, 0xb7, 0xfb, 0x8c, 0x92, 0x1f, 0x99, 0xd8, 0xed, 0x32, 0xd2, 0x83, 0xd6, 0x70, 0x84, 0xe8, 0x0b, 0x9a, 0xd9, 0xc4, 0x0c, 0x56, 0xcd, 0x98, 0x38, 0x9f, 0xb0, 0xa8, 0x49, 0xd9, 0xec, 0xf7, 0x26, 0x8c, 0x29, 0x7b, 0x6f, 0x93, 0x40, 0x61, 0x19, 0xf4, 0x0e, 0x32, 0xb5, 0x77, 0x3e, 0xd2, 0x5a, 0x28, 0xa9, 0xa8, 0x5c, 0x4a, 0x75, 0x88, 0x01, 0xa2, 0x8e, 0x00, 0x4e, 0x37, 0xee, 0xae, 0xfe, 0x1f, 0x4d, 0xbb, 0x71, 0xf1, 0x87, 0x86, 0x96, 0x14, 0x1a, 0xf3, 0xa1, 0x0a, 0x96, 0x91, 0xc4, 0xed, 0x93, 0x48, 0x72, 0x14, 0x64, 0x3b, 0x76, 0x1f, 0xa4, 0xb0, 0xfb, 0xee, 0xb2, 0x47, 0xcf, 0x6d, 0x3f, 0xba, 0x7a, 0x60, 0x69, 0x75, 0x36, 0xad, 0x03, 0xf4, 0x9b, 0x80, 0xa9, 0xd1, 0xcb, 0x07, 0x96, 0x73, 0x65, 0x49, 0x77, 0xc5, 0xfa, 0x94, 3159 }; 3160 static const u8 ecccdh_SECP521R1_5_test_vector_our_pub_key[] = { 3161 0x00, 0x74, 0x8c, 0xdb, 0xb8, 0x75, 0xd3, 0x5f, 0x4b, 0xcc, 0xb6, 0x2a, 0xbe, 0x20, 0xe8, 0x2d, 0x32, 0xe4, 0xc1, 0x4d, 0xc2, 0xfe, 0xb5, 0xb8, 0x7d, 0xa2, 0xd0, 0xcc, 0xb1, 0x1c, 0x9b, 0x6d, 0x4b, 0x77, 0x37, 0xb6, 0xc4, 0x6f, 0x0d, 0xfb, 0x4d, 0x89, 0x6e, 0x2d, 0xb9, 0x2f, 0xcf, 0x53, 0xcd, 0xbb, 0xae, 0x2a, 0x40, 0x4c, 0x0b, 0xab, 0xd5, 0x64, 0xad, 0x7a, 0xde, 0xac, 0x62, 0x73, 0xef, 0xa3, 0x01, 0x98, 0x4a, 0xca, 0xb8, 0xd8, 0xf1, 0x73, 0x32, 0x3d, 0xe0, 0xbb, 0x60, 0x27, 0x4b, 0x22, 0x88, 0x71, 0x60, 0x93, 0x73, 0xbb, 0x22, 0xa1, 0x72, 0x87, 0xe9, 0xde, 0xc7, 0x49, 0x58, 0x73, 0xab, 0xc0, 0x9a, 0x89, 0x15, 0xb5, 0x4c, 0x84, 0x55, 0xc8, 0xe0, 0x2f, 0x65, 0x4f, 0x60, 0x2e, 0x23, 0xa2, 0xbb, 0xd7, 0xa9, 0xeb, 0xb7, 0x4f, 0x30, 0x09, 0xbd, 0x65, 0xec, 0xc6, 0x50, 0x81, 0x4c, 0xc0, 3162 }; 3163 static const u8 ecccdh_SECP521R1_5_test_vector_shared_secret[] = { 3164 0x00, 0x5c, 0x57, 0x21, 0xe9, 0x6c, 0x27, 0x33, 0x19, 0xfd, 0x60, 0xec, 0xc4, 0x6b, 0x59, 0x62, 0xf6, 0x98, 0xe9, 0x74, 0xb4, 0x29, 0xf2, 0x8f, 0xe6, 0x96, 0x2f, 0x4a, 0xc6, 0x56, 0xbe, 0x2e, 0xb8, 0x67, 0x4c, 0x4a, 0xaf, 0xc0, 0x37, 0xea, 0xb4, 0x8e, 0xce, 0x61, 0x29, 0x53, 0xb1, 0xe8, 0xd8, 0x61, 0x01, 0x6b, 0x6a, 0xd0, 0xc7, 0x98, 0x05, 0x78, 0x4c, 0x67, 0xf7, 0x3a, 0xda, 0x96, 0xf3, 0x51, 3165 }; 3166 static const ecdh_test_case ecccdh_SECP521R1_5_test_case = { 3167 .name = "ECCCDH/SECP521R1 5", 3168 .ecdh_type = ECCCDH, 3169 .ec_str_p = &secp521r1_str_params, 3170 .our_priv_key = ecccdh_SECP521R1_5_test_vector_our_priv_key, 3171 .our_priv_key_len = sizeof(ecccdh_SECP521R1_5_test_vector_our_priv_key), 3172 .peer_pub_key = ecccdh_SECP521R1_5_test_vector_peer_pub_key, 3173 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_5_test_vector_peer_pub_key), 3174 .exp_our_pub_key = ecccdh_SECP521R1_5_test_vector_our_pub_key, 3175 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_5_test_vector_our_pub_key), 3176 .exp_shared_secret = ecccdh_SECP521R1_5_test_vector_shared_secret, 3177 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_5_test_vector_shared_secret), 3178 }; 3179 #endif /* WITH_CURVE_SECP521R1 */ 3180 3181 #ifdef WITH_CURVE_SECP521R1 3182 #define ECCCDH_SECP521R1_SELF_TEST_6 3183 /*** Tests for ECCCDH/SECP521R1 ***/ 3184 static const u8 ecccdh_SECP521R1_6_test_vector_our_priv_key[] = { 3185 0x00, 0x00, 0x01, 0xe4, 0x8f, 0xaa, 0xce, 0xe6, 0xde, 0xc8, 0x3f, 0xfc, 0xde, 0x94, 0x4c, 0xf6, 0xbd, 0xf4, 0xce, 0x4b, 0xae, 0x72, 0x74, 0x78, 0x88, 0xeb, 0xaf, 0xee, 0x45, 0x5b, 0x1e, 0x91, 0x58, 0x49, 0x71, 0xef, 0xb4, 0x91, 0x27, 0x97, 0x6a, 0x52, 0xf4, 0x14, 0x29, 0x52, 0xf7, 0xc2, 0x07, 0xec, 0x02, 0x65, 0xf2, 0xb7, 0x18, 0xcf, 0x3e, 0xad, 0x96, 0xea, 0x4f, 0x62, 0xc7, 0x52, 0xe4, 0xf7, 0xac, 0xd3, 3186 }; 3187 static const u8 ecccdh_SECP521R1_6_test_vector_peer_pub_key[] = { 3188 0x01, 0x25, 0x88, 0x11, 0x5e, 0x6f, 0x7f, 0x7b, 0xdc, 0xfd, 0xf5, 0x7f, 0x03, 0xb1, 0x69, 0xb4, 0x79, 0x75, 0x8b, 0xaa, 0xfd, 0xaf, 0x56, 0x9d, 0x04, 0x13, 0x59, 0x87, 0xb2, 0xce, 0x61, 0x64, 0xc0, 0x2a, 0x57, 0x68, 0x5e, 0xb5, 0x27, 0x6b, 0x5d, 0xae, 0x62, 0x95, 0xd3, 0xfe, 0x90, 0x62, 0x0f, 0x38, 0xb5, 0x53, 0x5c, 0x6d, 0x22, 0x60, 0xc1, 0x73, 0xe6, 0x1e, 0xb8, 0x88, 0xca, 0x92, 0x02, 0x03, 0x01, 0x54, 0x2c, 0x16, 0x9c, 0xf9, 0x7c, 0x25, 0x96, 0xfe, 0x2d, 0xdd, 0x84, 0x8a, 0x22, 0x2e, 0x36, 0x7c, 0x5f, 0x7e, 0x62, 0x67, 0xeb, 0xc1, 0xbc, 0xd9, 0xab, 0x5d, 0xcf, 0x49, 0x15, 0x8f, 0x1a, 0x48, 0xe4, 0xaf, 0x29, 0xa8, 0x97, 0xb7, 0xe6, 0xa8, 0x20, 0x91, 0xc2, 0xdb, 0x87, 0x4d, 0x8e, 0x7a, 0xbf, 0x0f, 0x58, 0x06, 0x46, 0x91, 0x34, 0x41, 0x54, 0xf3, 0x96, 0xdb, 0xae, 0xd1, 0x88, 0xb6, 3189 }; 3190 static const u8 ecccdh_SECP521R1_6_test_vector_our_pub_key[] = { 3191 0x01, 0x0e, 0xb1, 0xb4, 0xd9, 0x17, 0x2b, 0xcc, 0x23, 0xf4, 0xf2, 0x0c, 0xc9, 0x56, 0x0f, 0xc5, 0x49, 0x28, 0xc3, 0xf3, 0x4e, 0xa6, 0x1c, 0x00, 0x39, 0x1d, 0xc7, 0x66, 0xc7, 0x6e, 0xd9, 0xfa, 0x60, 0x84, 0x49, 0x37, 0x7d, 0x1e, 0x4f, 0xad, 0xd1, 0x23, 0x60, 0x25, 0x41, 0x73, 0x30, 0xb4, 0xb9, 0x10, 0x86, 0x70, 0x4a, 0xce, 0x3e, 0x4e, 0x64, 0x84, 0xc6, 0x06, 0xe2, 0xa9, 0x43, 0x47, 0x8c, 0x86, 0x01, 0x49, 0x41, 0x38, 0x64, 0x06, 0x98, 0x25, 0xee, 0x1d, 0x08, 0x28, 0xda, 0x9f, 0x4a, 0x97, 0x71, 0x30, 0x05, 0xe9, 0xbd, 0x1a, 0xdb, 0xc3, 0xb3, 0x8c, 0x5b, 0x94, 0x69, 0x00, 0x72, 0x1a, 0x96, 0x0f, 0xe9, 0x6a, 0xd2, 0xc1, 0xb3, 0xa4, 0x4f, 0xe3, 0xde, 0x91, 0x56, 0x13, 0x6d, 0x44, 0xcb, 0x17, 0xcb, 0xc2, 0x41, 0x57, 0x29, 0xbb, 0x78, 0x2e, 0x16, 0xbf, 0xe2, 0xde, 0xb3, 0x06, 0x9e, 0x43, 3192 }; 3193 static const u8 ecccdh_SECP521R1_6_test_vector_shared_secret[] = { 3194 0x01, 0x73, 0x6d, 0x97, 0x17, 0x42, 0x9b, 0x4f, 0x41, 0x2e, 0x90, 0x3f, 0xeb, 0xe2, 0xf9, 0xe0, 0xff, 0xfd, 0x81, 0x35, 0x5d, 0x6c, 0xe2, 0xc0, 0x6f, 0xf3, 0xf6, 0x6a, 0x3b, 0xe1, 0x5c, 0xee, 0xc6, 0xe6, 0x5e, 0x30, 0x83, 0x47, 0x59, 0x3f, 0x00, 0xd7, 0xf3, 0x35, 0x91, 0xda, 0x40, 0x43, 0xc3, 0x07, 0x63, 0xd7, 0x27, 0x49, 0xf7, 0x2c, 0xdc, 0xee, 0xbe, 0x82, 0x5e, 0x4b, 0x34, 0xec, 0xd5, 0x70, 3195 }; 3196 static const ecdh_test_case ecccdh_SECP521R1_6_test_case = { 3197 .name = "ECCCDH/SECP521R1 6", 3198 .ecdh_type = ECCCDH, 3199 .ec_str_p = &secp521r1_str_params, 3200 .our_priv_key = ecccdh_SECP521R1_6_test_vector_our_priv_key, 3201 .our_priv_key_len = sizeof(ecccdh_SECP521R1_6_test_vector_our_priv_key), 3202 .peer_pub_key = ecccdh_SECP521R1_6_test_vector_peer_pub_key, 3203 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_6_test_vector_peer_pub_key), 3204 .exp_our_pub_key = ecccdh_SECP521R1_6_test_vector_our_pub_key, 3205 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_6_test_vector_our_pub_key), 3206 .exp_shared_secret = ecccdh_SECP521R1_6_test_vector_shared_secret, 3207 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_6_test_vector_shared_secret), 3208 }; 3209 #endif /* WITH_CURVE_SECP521R1 */ 3210 3211 #ifdef WITH_CURVE_SECP521R1 3212 #define ECCCDH_SECP521R1_SELF_TEST_7 3213 /*** Tests for ECCCDH/SECP521R1 ***/ 3214 static const u8 ecccdh_SECP521R1_7_test_vector_our_priv_key[] = { 3215 0x00, 0x00, 0x00, 0xc2, 0x9a, 0xa2, 0x23, 0xea, 0x8d, 0x64, 0xb4, 0xa1, 0xed, 0xa2, 0x7f, 0x39, 0xd3, 0xbc, 0x98, 0xea, 0x01, 0x48, 0xdd, 0x98, 0xc1, 0xcb, 0xe5, 0x95, 0xf8, 0xfd, 0x2b, 0xfb, 0xde, 0x11, 0x9c, 0x9e, 0x01, 0x7a, 0x50, 0xf5, 0xd1, 0xfc, 0x12, 0x1c, 0x08, 0xc1, 0xce, 0xf3, 0x1b, 0x75, 0x88, 0x59, 0x55, 0x6e, 0xb3, 0xe0, 0xe0, 0x42, 0xd8, 0xdd, 0x6a, 0xaa, 0xc5, 0x7a, 0x05, 0xca, 0x61, 0xe3, 3216 }; 3217 static const u8 ecccdh_SECP521R1_7_test_vector_peer_pub_key[] = { 3218 0x01, 0x69, 0x49, 0x1d, 0x55, 0xbd, 0x09, 0x04, 0x9f, 0xdf, 0x4c, 0x2a, 0x53, 0xa6, 0x60, 0x48, 0x0f, 0xee, 0x4c, 0x03, 0xa0, 0x53, 0x86, 0x75, 0xd1, 0xcd, 0x09, 0xb5, 0xbb, 0xa7, 0x8d, 0xac, 0x48, 0x54, 0x3e, 0xf1, 0x18, 0xa1, 0x17, 0x3b, 0x3f, 0xbf, 0x8b, 0x20, 0xe3, 0x9c, 0xe0, 0xe6, 0xb8, 0x90, 0xa1, 0x63, 0xc5, 0x0f, 0x96, 0x45, 0xb3, 0xd2, 0x1d, 0x1c, 0xbb, 0x3b, 0x60, 0xa6, 0xff, 0xf4, 0x00, 0x83, 0x49, 0x4b, 0x2e, 0xba, 0x76, 0x91, 0x0f, 0xed, 0x33, 0xc7, 0x61, 0x80, 0x45, 0x15, 0x01, 0x1f, 0xab, 0x50, 0xe3, 0xb3, 0x77, 0xab, 0xd8, 0xa8, 0xa0, 0x45, 0xd8, 0x86, 0xd2, 0x23, 0x8d, 0x2c, 0x26, 0x8a, 0xc1, 0xb6, 0xec, 0x88, 0xbd, 0x71, 0xb7, 0xba, 0x78, 0xe2, 0xc3, 0x3c, 0x15, 0x2e, 0x4b, 0xf7, 0xda, 0x5d, 0x56, 0x5e, 0x4a, 0xcb, 0xec, 0xf5, 0xe9, 0x2c, 0x7a, 0xd6, 0x62, 0xbb, 3219 }; 3220 static const u8 ecccdh_SECP521R1_7_test_vector_our_pub_key[] = { 3221 0x00, 0x15, 0x11, 0xc8, 0x48, 0xef, 0x60, 0xd5, 0x41, 0x9a, 0x98, 0xd1, 0x02, 0x04, 0xdb, 0x0f, 0xe5, 0x82, 0x24, 0x12, 0x43, 0x70, 0x06, 0x1b, 0xcf, 0xa4, 0xe9, 0x24, 0x9d, 0x50, 0x61, 0x8c, 0x56, 0xbf, 0x37, 0x22, 0x47, 0x1b, 0x25, 0x9f, 0x38, 0x26, 0x3b, 0xb7, 0xb2, 0x80, 0xd2, 0x3c, 0xaf, 0x2a, 0x1e, 0xe8, 0x73, 0x7f, 0x93, 0x71, 0xcd, 0xb2, 0x73, 0x2c, 0xdc, 0x95, 0x83, 0x69, 0x93, 0x0c, 0x01, 0xd4, 0x61, 0x68, 0x1a, 0xe6, 0xd8, 0xc4, 0x9b, 0x4c, 0x5f, 0x4d, 0x60, 0x16, 0x14, 0x3f, 0xb1, 0xbd, 0x74, 0x91, 0x57, 0x3e, 0x3e, 0xd0, 0xe6, 0xc4, 0x8b, 0x82, 0xe8, 0x21, 0x64, 0x4f, 0x87, 0xf8, 0x2f, 0x0e, 0x5f, 0x08, 0xfd, 0x16, 0xf1, 0xf9, 0x8f, 0xa1, 0x75, 0x86, 0x20, 0x0a, 0xb0, 0x2e, 0xd8, 0xc6, 0x27, 0xb3, 0x5c, 0x3f, 0x27, 0x61, 0x7e, 0xc5, 0xfd, 0x92, 0xf4, 0x56, 0x20, 0x3f, 3222 }; 3223 static const u8 ecccdh_SECP521R1_7_test_vector_shared_secret[] = { 3224 0x01, 0x8f, 0x2a, 0xe9, 0x47, 0x6c, 0x77, 0x17, 0x26, 0xa7, 0x77, 0x80, 0x20, 0x8d, 0xed, 0xfe, 0xfa, 0x20, 0x54, 0x88, 0x99, 0x6b, 0x18, 0xfe, 0xcc, 0x50, 0xbf, 0xd4, 0xc1, 0x32, 0x75, 0x3f, 0x57, 0x66, 0xb2, 0xcd, 0x74, 0x4a, 0xfa, 0x99, 0x18, 0x60, 0x6d, 0xe2, 0xe0, 0x16, 0xef, 0xfc, 0x63, 0x62, 0x2e, 0x90, 0x29, 0xe7, 0x6d, 0xc6, 0xe3, 0xf0, 0xc6, 0x9f, 0x7a, 0xec, 0xed, 0x56, 0x5c, 0x2c, 3225 }; 3226 static const ecdh_test_case ecccdh_SECP521R1_7_test_case = { 3227 .name = "ECCCDH/SECP521R1 7", 3228 .ecdh_type = ECCCDH, 3229 .ec_str_p = &secp521r1_str_params, 3230 .our_priv_key = ecccdh_SECP521R1_7_test_vector_our_priv_key, 3231 .our_priv_key_len = sizeof(ecccdh_SECP521R1_7_test_vector_our_priv_key), 3232 .peer_pub_key = ecccdh_SECP521R1_7_test_vector_peer_pub_key, 3233 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_7_test_vector_peer_pub_key), 3234 .exp_our_pub_key = ecccdh_SECP521R1_7_test_vector_our_pub_key, 3235 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_7_test_vector_our_pub_key), 3236 .exp_shared_secret = ecccdh_SECP521R1_7_test_vector_shared_secret, 3237 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_7_test_vector_shared_secret), 3238 }; 3239 #endif /* WITH_CURVE_SECP521R1 */ 3240 3241 #ifdef WITH_CURVE_SECP521R1 3242 #define ECCCDH_SECP521R1_SELF_TEST_8 3243 /*** Tests for ECCCDH/SECP521R1 ***/ 3244 static const u8 ecccdh_SECP521R1_8_test_vector_our_priv_key[] = { 3245 0x00, 0x00, 0x00, 0x28, 0x69, 0x2b, 0xe2, 0xbf, 0x5c, 0x4b, 0x48, 0x93, 0x98, 0x46, 0xfb, 0x3d, 0x5b, 0xce, 0x74, 0x65, 0x4b, 0xb2, 0x64, 0x6e, 0x15, 0xf8, 0x38, 0x9e, 0x23, 0x70, 0x8a, 0x1a, 0xfa, 0xdf, 0x56, 0x15, 0x11, 0xea, 0x0d, 0x99, 0x57, 0xd0, 0xb5, 0x34, 0x53, 0x81, 0x9d, 0x60, 0xfb, 0xa8, 0xf6, 0x5a, 0x18, 0xf7, 0xb2, 0x9d, 0xf0, 0x21, 0xb1, 0xbb, 0x01, 0xcd, 0x16, 0x32, 0x93, 0xac, 0xc3, 0xcc, 3246 }; 3247 static const u8 ecccdh_SECP521R1_8_test_vector_peer_pub_key[] = { 3248 0x00, 0x84, 0x15, 0xf5, 0xbb, 0xd0, 0xee, 0xe3, 0x87, 0xd6, 0xc0, 0x9d, 0x0e, 0xf8, 0xac, 0xaf, 0x29, 0xc6, 0x6d, 0xb4, 0x5d, 0x6b, 0xa1, 0x01, 0x86, 0x0a, 0xe4, 0x5d, 0x3c, 0x60, 0xe1, 0xe0, 0xe3, 0xf7, 0x24, 0x7a, 0x46, 0x26, 0xa6, 0x0f, 0xdd, 0x40, 0x49, 0x65, 0xc3, 0x56, 0x6c, 0x79, 0xf6, 0x44, 0x9e, 0x85, 0x6c, 0xe0, 0xbf, 0x94, 0x61, 0x9f, 0x97, 0xda, 0x8d, 0xa2, 0x4b, 0xd2, 0xcf, 0xb6, 0x00, 0xfd, 0xd7, 0xc5, 0x9c, 0x58, 0xc3, 0x61, 0xbc, 0x50, 0xa7, 0xa5, 0xd0, 0xd3, 0x6f, 0x72, 0x3b, 0x17, 0xc4, 0xf2, 0xad, 0x2b, 0x03, 0xc2, 0x4d, 0x42, 0xdc, 0x50, 0xf7, 0x4a, 0x8c, 0x46, 0x5a, 0x0a, 0xfc, 0x46, 0x83, 0xf1, 0x0f, 0xab, 0x84, 0x65, 0x2d, 0xfe, 0x9e, 0x92, 0x8c, 0x26, 0x26, 0xb5, 0x45, 0x64, 0x53, 0xe1, 0x57, 0x3f, 0xf6, 0x0b, 0xe1, 0x50, 0x74, 0x67, 0xd4, 0x31, 0xfb, 0xb2, 3249 }; 3250 static const u8 ecccdh_SECP521R1_8_test_vector_our_pub_key[] = { 3251 0x01, 0xcf, 0xdc, 0x10, 0xc7, 0x99, 0xf5, 0xc7, 0x9c, 0xb6, 0x93, 0x0a, 0x65, 0xfb, 0xa3, 0x51, 0x74, 0x8e, 0x07, 0x56, 0x79, 0x93, 0xe5, 0xe4, 0x10, 0xef, 0x4c, 0xac, 0xc4, 0xcd, 0x8a, 0x25, 0x78, 0x49, 0x91, 0xeb, 0x46, 0x74, 0xe4, 0x10, 0x50, 0xf9, 0x30, 0xc7, 0x19, 0x0a, 0xc8, 0x12, 0xb9, 0x24, 0x5f, 0x48, 0xa7, 0x97, 0x3b, 0x65, 0x8d, 0xaf, 0x40, 0x88, 0x22, 0xfe, 0x5b, 0x85, 0xf6, 0x68, 0x01, 0x80, 0xd9, 0xdd, 0xfc, 0x9a, 0xf7, 0x7b, 0x9c, 0x4a, 0x6f, 0x02, 0xa8, 0x34, 0xdb, 0x15, 0xe5, 0x35, 0xe0, 0xb3, 0x84, 0x5b, 0x2c, 0xce, 0x30, 0x38, 0x83, 0x01, 0xb5, 0x1c, 0xec, 0xbe, 0x32, 0x76, 0x30, 0x7e, 0xf4, 0x39, 0xb5, 0xc9, 0xe6, 0xa7, 0x2d, 0xc2, 0xd9, 0x4d, 0x87, 0x9b, 0xc3, 0x95, 0x05, 0x2d, 0xbb, 0x4a, 0x57, 0x87, 0xd0, 0x6e, 0xfb, 0x28, 0x02, 0x10, 0xfb, 0x8b, 0xe0, 0x37, 3252 }; 3253 static const u8 ecccdh_SECP521R1_8_test_vector_shared_secret[] = { 3254 0x01, 0x05, 0xa3, 0x46, 0x98, 0x8b, 0x92, 0xed, 0x8c, 0x7a, 0x25, 0xce, 0x4d, 0x79, 0xd2, 0x1b, 0xc8, 0x6c, 0xfc, 0xc7, 0xf9, 0x9c, 0x6c, 0xd1, 0x9d, 0xbb, 0x4a, 0x39, 0xf4, 0x8a, 0xb9, 0x43, 0xb7, 0x9e, 0x4f, 0x06, 0x47, 0x34, 0x8d, 0xa0, 0xb8, 0x0b, 0xd8, 0x64, 0xb8, 0x5c, 0x6b, 0x8d, 0x92, 0x53, 0x6d, 0x6a, 0xa5, 0x44, 0xdc, 0x75, 0x37, 0xa0, 0x0c, 0x85, 0x8f, 0x8b, 0x66, 0x31, 0x9e, 0x25, 3255 }; 3256 static const ecdh_test_case ecccdh_SECP521R1_8_test_case = { 3257 .name = "ECCCDH/SECP521R1 8", 3258 .ecdh_type = ECCCDH, 3259 .ec_str_p = &secp521r1_str_params, 3260 .our_priv_key = ecccdh_SECP521R1_8_test_vector_our_priv_key, 3261 .our_priv_key_len = sizeof(ecccdh_SECP521R1_8_test_vector_our_priv_key), 3262 .peer_pub_key = ecccdh_SECP521R1_8_test_vector_peer_pub_key, 3263 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_8_test_vector_peer_pub_key), 3264 .exp_our_pub_key = ecccdh_SECP521R1_8_test_vector_our_pub_key, 3265 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_8_test_vector_our_pub_key), 3266 .exp_shared_secret = ecccdh_SECP521R1_8_test_vector_shared_secret, 3267 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_8_test_vector_shared_secret), 3268 }; 3269 #endif /* WITH_CURVE_SECP521R1 */ 3270 3271 #ifdef WITH_CURVE_SECP521R1 3272 #define ECCCDH_SECP521R1_SELF_TEST_9 3273 /*** Tests for ECCCDH/SECP521R1 ***/ 3274 static const u8 ecccdh_SECP521R1_9_test_vector_our_priv_key[] = { 3275 0x00, 0x00, 0x01, 0x19, 0x4d, 0x1e, 0xe6, 0x13, 0xf5, 0x36, 0x6c, 0xbc, 0x44, 0xb5, 0x04, 0xd2, 0x1a, 0x0c, 0xf6, 0x71, 0x5e, 0x20, 0x9c, 0xd3, 0x58, 0xf2, 0xdd, 0x5f, 0x3e, 0x71, 0xcc, 0x0d, 0x67, 0xd0, 0xe9, 0x64, 0x16, 0x8c, 0x42, 0xa0, 0x84, 0xeb, 0xda, 0x74, 0x6f, 0x98, 0x63, 0xa8, 0x6b, 0xac, 0xff, 0xc8, 0x19, 0xf1, 0xed, 0xf1, 0xb8, 0xc7, 0x27, 0xcc, 0xfb, 0x30, 0x47, 0x24, 0x0a, 0x57, 0xc4, 0x35, 3276 }; 3277 static const u8 ecccdh_SECP521R1_9_test_vector_peer_pub_key[] = { 3278 0x01, 0xc7, 0x21, 0xee, 0xa8, 0x05, 0xa5, 0xcb, 0xa2, 0x9f, 0x34, 0xba, 0x57, 0x58, 0x77, 0x5b, 0xe0, 0xcf, 0x61, 0x60, 0xe6, 0xc0, 0x87, 0x23, 0xf5, 0xab, 0x17, 0xbf, 0x96, 0xa1, 0xff, 0x2b, 0xd9, 0x42, 0x79, 0x61, 0xa4, 0xf3, 0x4b, 0x07, 0xfc, 0x0b, 0x14, 0xca, 0x4b, 0x2b, 0xf6, 0x84, 0x5d, 0xeb, 0xd5, 0xa8, 0x69, 0xf1, 0x24, 0xeb, 0xfa, 0x7a, 0xa7, 0x2f, 0xe5, 0x65, 0x05, 0x0b, 0x7f, 0x18, 0x00, 0xb6, 0xe8, 0x9e, 0xb0, 0xe1, 0xdc, 0xf1, 0x81, 0x23, 0x6f, 0x7c, 0x54, 0x8f, 0xd1, 0xa8, 0xc1, 0x6b, 0x25, 0x8b, 0x52, 0xc1, 0xa9, 0xbf, 0xd3, 0xfe, 0x8f, 0x22, 0x84, 0x1b, 0x26, 0x76, 0x32, 0x65, 0xf0, 0x74, 0xc4, 0xcc, 0xf2, 0xd6, 0x34, 0xae, 0x97, 0xb7, 0x01, 0x95, 0x6f, 0x67, 0xa1, 0x10, 0x06, 0xc5, 0x2d, 0x97, 0x19, 0x7d, 0x92, 0xf5, 0x85, 0xf5, 0x74, 0x8b, 0xc2, 0x67, 0x2e, 0xeb, 3279 }; 3280 static const u8 ecccdh_SECP521R1_9_test_vector_our_pub_key[] = { 3281 0x01, 0x6b, 0xd1, 0x5c, 0x8a, 0x58, 0xd3, 0x66, 0xf7, 0xf2, 0xb2, 0xf2, 0x98, 0xcc, 0x87, 0xb7, 0x48, 0x5e, 0x9e, 0xe7, 0x0d, 0x11, 0xd1, 0x24, 0x48, 0xb8, 0x37, 0x7c, 0x0a, 0x82, 0xc7, 0x62, 0x6f, 0x67, 0xaf, 0xf7, 0xf9, 0x7b, 0xe7, 0xa3, 0x54, 0x6b, 0xf4, 0x17, 0xee, 0xed, 0xdf, 0x75, 0xa9, 0x3c, 0x13, 0x01, 0x91, 0xc8, 0x41, 0x08, 0x04, 0x2e, 0xa2, 0xfc, 0xa1, 0x7f, 0xd3, 0xf8, 0x0d, 0x14, 0x01, 0x56, 0x05, 0x02, 0xd0, 0x4b, 0x74, 0xfc, 0xe1, 0x74, 0x3a, 0xab, 0x47, 0x7a, 0x9d, 0x1e, 0xac, 0x93, 0xe5, 0x22, 0x69, 0x81, 0xfd, 0xb9, 0x7a, 0x74, 0x78, 0xce, 0x4c, 0xe5, 0x66, 0xff, 0x72, 0x43, 0x93, 0x12, 0x84, 0xfa, 0xd8, 0x50, 0xb0, 0xc2, 0xbc, 0xae, 0x0d, 0xdd, 0x2d, 0x97, 0x79, 0x01, 0x60, 0xc1, 0xa2, 0xe7, 0x7c, 0x3e, 0xd6, 0xc9, 0x5e, 0xcc, 0x44, 0xb8, 0x9e, 0x26, 0x37, 0xfc, 3282 }; 3283 static const u8 ecccdh_SECP521R1_9_test_vector_shared_secret[] = { 3284 0x00, 0x45, 0x31, 0xb3, 0xd2, 0xc6, 0xcd, 0x12, 0xf2, 0x16, 0x04, 0xc8, 0x61, 0x0e, 0x67, 0x23, 0xdb, 0xf4, 0xda, 0xf8, 0x0b, 0x5a, 0x45, 0x9d, 0x6b, 0xa5, 0x81, 0x43, 0x97, 0xd1, 0xc1, 0xf7, 0xa2, 0x1d, 0x7c, 0x11, 0x4b, 0xe9, 0x64, 0xe2, 0x73, 0x76, 0xaa, 0xeb, 0xe3, 0xa7, 0xbc, 0x3d, 0x6a, 0xf7, 0xa7, 0xf8, 0xc7, 0xbe, 0xfb, 0x61, 0x1a, 0xfe, 0x48, 0x7f, 0xf0, 0x32, 0x92, 0x1f, 0x75, 0x0f, 3285 }; 3286 static const ecdh_test_case ecccdh_SECP521R1_9_test_case = { 3287 .name = "ECCCDH/SECP521R1 9", 3288 .ecdh_type = ECCCDH, 3289 .ec_str_p = &secp521r1_str_params, 3290 .our_priv_key = ecccdh_SECP521R1_9_test_vector_our_priv_key, 3291 .our_priv_key_len = sizeof(ecccdh_SECP521R1_9_test_vector_our_priv_key), 3292 .peer_pub_key = ecccdh_SECP521R1_9_test_vector_peer_pub_key, 3293 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_9_test_vector_peer_pub_key), 3294 .exp_our_pub_key = ecccdh_SECP521R1_9_test_vector_our_pub_key, 3295 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_9_test_vector_our_pub_key), 3296 .exp_shared_secret = ecccdh_SECP521R1_9_test_vector_shared_secret, 3297 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_9_test_vector_shared_secret), 3298 }; 3299 #endif /* WITH_CURVE_SECP521R1 */ 3300 3301 #ifdef WITH_CURVE_SECP521R1 3302 #define ECCCDH_SECP521R1_SELF_TEST_10 3303 /*** Tests for ECCCDH/SECP521R1 ***/ 3304 static const u8 ecccdh_SECP521R1_10_test_vector_our_priv_key[] = { 3305 0x00, 0x00, 0x01, 0xfd, 0x90, 0xe3, 0xe4, 0x16, 0xe9, 0x8a, 0xa3, 0xf2, 0xb6, 0xaf, 0xa7, 0xf3, 0xbf, 0x36, 0x8e, 0x45, 0x1a, 0xd9, 0xca, 0x5b, 0xd5, 0x4b, 0x5b, 0x14, 0xae, 0xe2, 0xed, 0x67, 0x23, 0xdd, 0xe5, 0x18, 0x1f, 0x50, 0x85, 0xb6, 0x81, 0x69, 0xb0, 0x9f, 0xbe, 0xc7, 0x21, 0x37, 0x2c, 0xcf, 0x6b, 0x28, 0x47, 0x13, 0xf9, 0xa6, 0x35, 0x6b, 0x8d, 0x56, 0x0a, 0x8f, 0xf7, 0x8c, 0xa3, 0x73, 0x7c, 0x88, 3306 }; 3307 static const u8 ecccdh_SECP521R1_10_test_vector_peer_pub_key[] = { 3308 0x01, 0xc3, 0x58, 0x23, 0xe4, 0x40, 0xa9, 0x36, 0x3a, 0xb9, 0x8d, 0x9f, 0xc7, 0xa7, 0xbc, 0x0c, 0x05, 0x32, 0xdc, 0x79, 0x77, 0xa7, 0x91, 0x65, 0x59, 0x9b, 0xf1, 0xa9, 0xcc, 0x64, 0xc0, 0x0f, 0xb3, 0x87, 0xb4, 0x2c, 0xca, 0x36, 0x52, 0x86, 0xe8, 0x43, 0x03, 0x60, 0xbf, 0xad, 0x36, 0x43, 0xbc, 0x31, 0x35, 0x4e, 0xda, 0x50, 0xdc, 0x93, 0x6c, 0x32, 0x9e, 0xcd, 0xb6, 0x09, 0x05, 0xc4, 0x0f, 0xcb, 0x00, 0xd9, 0xe7, 0xf4, 0x33, 0x53, 0x1e, 0x44, 0xdf, 0x4f, 0x6d, 0x51, 0x42, 0x01, 0xcb, 0xaa, 0xbb, 0x06, 0xba, 0xdd, 0x67, 0x83, 0xe0, 0x11, 0x11, 0x72, 0x6d, 0x81, 0x55, 0x31, 0xd2, 0x33, 0xc5, 0xcd, 0xb7, 0x22, 0x89, 0x3f, 0xfb, 0xb2, 0x02, 0x72, 0x59, 0xd5, 0x94, 0xde, 0x77, 0x43, 0x88, 0x09, 0x73, 0x81, 0x20, 0xc6, 0xf7, 0x83, 0x93, 0x4f, 0x92, 0x6c, 0x3f, 0xb6, 0x9b, 0x40, 0xc4, 0x09, 3309 }; 3310 static const u8 ecccdh_SECP521R1_10_test_vector_our_pub_key[] = { 3311 0x01, 0xeb, 0xea, 0x1b, 0x10, 0xd3, 0xe3, 0xb9, 0x71, 0xb7, 0xef, 0xb6, 0x9f, 0xc8, 0x78, 0xde, 0x11, 0xc7, 0xf4, 0x72, 0xe4, 0xe4, 0xd3, 0x84, 0xc3, 0x1b, 0x8d, 0x62, 0x88, 0xd8, 0x07, 0x15, 0x17, 0xac, 0xad, 0xe9, 0xb3, 0x97, 0x96, 0xc7, 0xaf, 0x51, 0x63, 0xbc, 0xf7, 0x1a, 0xed, 0xa7, 0x77, 0x53, 0x3f, 0x38, 0x2c, 0x6c, 0xf0, 0xa4, 0xd9, 0xbb, 0xb9, 0x38, 0xc8, 0x5f, 0x44, 0xb7, 0x80, 0x37, 0x01, 0x6b, 0x0e, 0x3e, 0x19, 0xc2, 0x99, 0x6b, 0x2c, 0xbd, 0x1f, 0xf6, 0x47, 0x30, 0xe7, 0xca, 0x90, 0xed, 0xca, 0x19, 0x84, 0xf9, 0xb2, 0x95, 0x13, 0x33, 0x53, 0x5e, 0x57, 0x48, 0xba, 0xa3, 0x4a, 0x99, 0xf6, 0x1f, 0xf4, 0xd5, 0xf8, 0x12, 0x07, 0x9e, 0x0f, 0x01, 0xe8, 0x77, 0x89, 0xf3, 0x4e, 0xfd, 0xad, 0x80, 0x98, 0x01, 0x5e, 0xe7, 0x4a, 0x4f, 0x84, 0x6d, 0xd1, 0x90, 0xd1, 0x6d, 0xc6, 0xe1, 3312 }; 3313 static const u8 ecccdh_SECP521R1_10_test_vector_shared_secret[] = { 3314 0x01, 0x00, 0xc8, 0x93, 0x59, 0x69, 0x07, 0x7b, 0xae, 0x0b, 0xa8, 0x9e, 0xf0, 0xdf, 0x81, 0x61, 0xd9, 0x75, 0xec, 0x58, 0x70, 0xac, 0x81, 0x1a, 0xe7, 0xe6, 0x5c, 0xa5, 0x39, 0x4e, 0xfb, 0xa4, 0xf0, 0x63, 0x3d, 0x41, 0xbf, 0x79, 0xea, 0x5e, 0x5b, 0x94, 0x96, 0xbb, 0xd7, 0xaa, 0xe0, 0x00, 0xb0, 0x59, 0x4b, 0xaa, 0x82, 0xef, 0x8f, 0x24, 0x4e, 0x69, 0x84, 0xae, 0x87, 0xae, 0x1e, 0xd1, 0x24, 0xb7, 3315 }; 3316 static const ecdh_test_case ecccdh_SECP521R1_10_test_case = { 3317 .name = "ECCCDH/SECP521R1 10", 3318 .ecdh_type = ECCCDH, 3319 .ec_str_p = &secp521r1_str_params, 3320 .our_priv_key = ecccdh_SECP521R1_10_test_vector_our_priv_key, 3321 .our_priv_key_len = sizeof(ecccdh_SECP521R1_10_test_vector_our_priv_key), 3322 .peer_pub_key = ecccdh_SECP521R1_10_test_vector_peer_pub_key, 3323 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_10_test_vector_peer_pub_key), 3324 .exp_our_pub_key = ecccdh_SECP521R1_10_test_vector_our_pub_key, 3325 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_10_test_vector_our_pub_key), 3326 .exp_shared_secret = ecccdh_SECP521R1_10_test_vector_shared_secret, 3327 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_10_test_vector_shared_secret), 3328 }; 3329 #endif /* WITH_CURVE_SECP521R1 */ 3330 3331 #ifdef WITH_CURVE_SECP521R1 3332 #define ECCCDH_SECP521R1_SELF_TEST_11 3333 /*** Tests for ECCCDH/SECP521R1 ***/ 3334 static const u8 ecccdh_SECP521R1_11_test_vector_our_priv_key[] = { 3335 0x00, 0x00, 0x00, 0x90, 0x12, 0xec, 0xfd, 0xad, 0xc8, 0x5c, 0xed, 0x63, 0x0a, 0xfe, 0xa5, 0x34, 0xcd, 0xc8, 0xe9, 0xd1, 0xab, 0x8b, 0xe5, 0xf3, 0x75, 0x3d, 0xcf, 0x5f, 0x2b, 0x09, 0xb4, 0x0e, 0xda, 0x66, 0xfc, 0x68, 0x58, 0x54, 0x9b, 0xc3, 0x6e, 0x6f, 0x8d, 0xf5, 0x59, 0x98, 0xcf, 0xa9, 0xa0, 0x70, 0x3a, 0xec, 0xf6, 0xc4, 0x27, 0x99, 0xc2, 0x45, 0x01, 0x10, 0x64, 0xf5, 0x30, 0xc0, 0x9d, 0xb9, 0x83, 0x69, 3336 }; 3337 static const u8 ecccdh_SECP521R1_11_test_vector_peer_pub_key[] = { 3338 0x00, 0x09, 0x30, 0x57, 0xfb, 0x86, 0x2f, 0x2a, 0xd2, 0xe8, 0x2e, 0x58, 0x1b, 0xae, 0xb3, 0x32, 0x4e, 0x7b, 0x32, 0x94, 0x6f, 0x2b, 0xa8, 0x45, 0xa9, 0xbe, 0xee, 0xd8, 0x7d, 0x69, 0x95, 0xf5, 0x49, 0x18, 0xec, 0x66, 0x19, 0xb9, 0x93, 0x19, 0x55, 0xd5, 0xa8, 0x9d, 0x4d, 0x74, 0xad, 0xf1, 0x04, 0x6b, 0xb3, 0x62, 0x19, 0x2f, 0x2e, 0xf6, 0xbd, 0x3e, 0x3d, 0x2d, 0x04, 0xdd, 0x1f, 0x87, 0x05, 0x4a, 0x00, 0xaa, 0x3f, 0xb2, 0x44, 0x83, 0x35, 0xf6, 0x94, 0xe3, 0xcd, 0xa4, 0xae, 0x0c, 0xc7, 0x1b, 0x1b, 0x2f, 0x2a, 0x20, 0x6f, 0xa8, 0x02, 0xd7, 0x26, 0x2f, 0x19, 0x98, 0x3c, 0x44, 0x67, 0x4f, 0xe1, 0x53, 0x27, 0xac, 0xaa, 0xc1, 0xfa, 0x40, 0x42, 0x4c, 0x39, 0x5a, 0x65, 0x56, 0xcb, 0x81, 0x67, 0x31, 0x25, 0x27, 0xfa, 0xe5, 0x86, 0x5e, 0xcf, 0xfc, 0x14, 0xbb, 0xdc, 0x17, 0xda, 0x78, 0xcd, 0xcf, 3339 }; 3340 static const u8 ecccdh_SECP521R1_11_test_vector_our_pub_key[] = { 3341 0x00, 0x23, 0x4e, 0x32, 0xbe, 0x0a, 0x90, 0x71, 0x31, 0xd2, 0xd1, 0x28, 0xa6, 0x47, 0x7e, 0x0c, 0xac, 0xeb, 0x86, 0xf0, 0x24, 0x79, 0x74, 0x5e, 0x0f, 0xe2, 0x45, 0xcb, 0x33, 0x2d, 0xe6, 0x31, 0xc0, 0x78, 0x87, 0x11, 0x60, 0x48, 0x2e, 0xee, 0xf5, 0x84, 0xe2, 0x74, 0xdf, 0x7f, 0xa4, 0x12, 0xce, 0xa3, 0xe1, 0xe9, 0x1f, 0x71, 0xec, 0xba, 0x87, 0x81, 0xd9, 0x20, 0x5d, 0x48, 0x38, 0x63, 0x41, 0xad, 0x01, 0xcf, 0x86, 0x45, 0x5b, 0x09, 0xb1, 0xc0, 0x05, 0xcf, 0xfb, 0xa8, 0xd7, 0x62, 0x89, 0xa3, 0x75, 0x96, 0x28, 0xc8, 0x74, 0xbe, 0xea, 0x46, 0x2f, 0x51, 0xf3, 0x0b, 0xd5, 0x81, 0xe3, 0x80, 0x31, 0x34, 0x30, 0x7d, 0xed, 0xbb, 0x77, 0x1b, 0x33, 0x34, 0xee, 0x15, 0xbe, 0x2e, 0x24, 0x2c, 0xd7, 0x9c, 0x34, 0x07, 0xd2, 0xf5, 0x89, 0x35, 0x45, 0x6c, 0x69, 0x41, 0xdd, 0x9b, 0x6d, 0x15, 0x5a, 0x46, 3342 }; 3343 static const u8 ecccdh_SECP521R1_11_test_vector_shared_secret[] = { 3344 0x01, 0x7f, 0x36, 0xaf, 0x19, 0x30, 0x38, 0x41, 0xd1, 0x3a, 0x38, 0x9d, 0x95, 0xec, 0x0b, 0x80, 0x1c, 0x7f, 0x9a, 0x67, 0x9a, 0x82, 0x31, 0x46, 0xc7, 0x5c, 0x17, 0xbc, 0x44, 0x25, 0x6e, 0x9a, 0xd4, 0x22, 0xa4, 0xf8, 0xb3, 0x1f, 0x14, 0x64, 0x7b, 0x2c, 0x7d, 0x31, 0x7b, 0x93, 0x3f, 0x7c, 0x29, 0x46, 0xc4, 0xb8, 0xab, 0xd1, 0xd5, 0x6d, 0x62, 0x0f, 0xab, 0x1b, 0x5f, 0xf1, 0xa3, 0xad, 0xc7, 0x1f, 3345 }; 3346 static const ecdh_test_case ecccdh_SECP521R1_11_test_case = { 3347 .name = "ECCCDH/SECP521R1 11", 3348 .ecdh_type = ECCCDH, 3349 .ec_str_p = &secp521r1_str_params, 3350 .our_priv_key = ecccdh_SECP521R1_11_test_vector_our_priv_key, 3351 .our_priv_key_len = sizeof(ecccdh_SECP521R1_11_test_vector_our_priv_key), 3352 .peer_pub_key = ecccdh_SECP521R1_11_test_vector_peer_pub_key, 3353 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_11_test_vector_peer_pub_key), 3354 .exp_our_pub_key = ecccdh_SECP521R1_11_test_vector_our_pub_key, 3355 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_11_test_vector_our_pub_key), 3356 .exp_shared_secret = ecccdh_SECP521R1_11_test_vector_shared_secret, 3357 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_11_test_vector_shared_secret), 3358 }; 3359 #endif /* WITH_CURVE_SECP521R1 */ 3360 3361 #ifdef WITH_CURVE_SECP521R1 3362 #define ECCCDH_SECP521R1_SELF_TEST_12 3363 /*** Tests for ECCCDH/SECP521R1 ***/ 3364 static const u8 ecccdh_SECP521R1_12_test_vector_our_priv_key[] = { 3365 0x00, 0x00, 0x01, 0xb5, 0xff, 0x84, 0x7f, 0x8e, 0xff, 0x20, 0xb8, 0x8c, 0xfa, 0xd4, 0x2c, 0x06, 0xe5, 0x8c, 0x37, 0x42, 0xf2, 0xf8, 0xf1, 0xfd, 0xfd, 0x64, 0xb5, 0x39, 0xba, 0x48, 0xc2, 0x59, 0x26, 0x92, 0x6b, 0xd5, 0xe3, 0x32, 0xb4, 0x56, 0x49, 0xc0, 0xb1, 0x84, 0xf7, 0x72, 0x55, 0xe9, 0xd5, 0x8f, 0xe8, 0xaf, 0xa1, 0xa6, 0xd9, 0x68, 0xe2, 0xcb, 0x1d, 0x46, 0x37, 0x77, 0x71, 0x20, 0xc7, 0x65, 0xc1, 0x28, 3366 }; 3367 static const u8 ecccdh_SECP521R1_12_test_vector_peer_pub_key[] = { 3368 0x00, 0x83, 0x19, 0x2e, 0xd0, 0xb1, 0xcb, 0x31, 0xf7, 0x58, 0x17, 0x79, 0x49, 0x37, 0xf6, 0x6a, 0xd9, 0x1c, 0xf7, 0x45, 0x52, 0xcd, 0x51, 0x0c, 0xed, 0xb9, 0xfd, 0x64, 0x13, 0x10, 0x42, 0x2a, 0xf5, 0xd0, 0x9f, 0x22, 0x1c, 0xad, 0x24, 0x9e, 0xe8, 0x14, 0xd1, 0x6d, 0xd7, 0xac, 0x84, 0xde, 0xd9, 0xea, 0xcd, 0xc2, 0x83, 0x40, 0xfc, 0xfc, 0x9c, 0x0c, 0x06, 0xab, 0xe3, 0x0a, 0x2f, 0xc2, 0x8c, 0xd8, 0x00, 0x22, 0x12, 0xed, 0x86, 0x8c, 0x9b, 0xa0, 0xfb, 0x2c, 0x91, 0xe2, 0xc3, 0x9b, 0xa9, 0x39, 0x96, 0xa3, 0xe4, 0xeb, 0xf4, 0x5f, 0x28, 0x52, 0xd0, 0x92, 0x8c, 0x48, 0x93, 0x0e, 0x87, 0x5c, 0xc7, 0xb4, 0x28, 0xd0, 0xe7, 0xf3, 0xf4, 0xd5, 0x03, 0xe5, 0xd6, 0x0c, 0x68, 0xcb, 0x49, 0xb1, 0x3c, 0x24, 0x80, 0xcd, 0x48, 0x6b, 0xed, 0x92, 0x00, 0xca, 0xdd, 0xad, 0xdf, 0xe4, 0xff, 0x8e, 0x35, 0x62, 3369 }; 3370 static const u8 ecccdh_SECP521R1_12_test_vector_our_pub_key[] = { 3371 0x01, 0xde, 0x3d, 0xc9, 0x26, 0x3b, 0xc8, 0xc4, 0x96, 0x9d, 0xc6, 0x84, 0xbe, 0x0e, 0xec, 0x54, 0xbe, 0xfd, 0x9a, 0x9f, 0x3d, 0xba, 0x19, 0x4d, 0x86, 0x58, 0xa7, 0x89, 0x34, 0x1b, 0xf0, 0xd7, 0x8d, 0x84, 0xda, 0x67, 0x35, 0x22, 0x7c, 0xaf, 0xaf, 0x09, 0x35, 0x19, 0x51, 0x69, 0x11, 0x97, 0x57, 0x3c, 0x8c, 0x36, 0x0a, 0x11, 0xe5, 0x28, 0x57, 0x12, 0xb8, 0xbb, 0xdf, 0x5a, 0xc9, 0x1b, 0x97, 0x7c, 0x00, 0x81, 0x2d, 0xe5, 0x8c, 0xd0, 0x95, 0xec, 0x2e, 0x5a, 0x9b, 0x24, 0x7e, 0xb3, 0xed, 0x41, 0xd8, 0xbe, 0xf6, 0xae, 0xac, 0xe1, 0x94, 0xa7, 0xa0, 0x5b, 0x65, 0xaa, 0x5d, 0x28, 0x9f, 0xbc, 0x9b, 0x17, 0x70, 0xec, 0x84, 0xbb, 0x6b, 0xe0, 0xc2, 0xc6, 0x4c, 0xc3, 0x7c, 0x1d, 0x54, 0xa7, 0xf5, 0xd7, 0x13, 0x77, 0xa9, 0xad, 0xbe, 0x20, 0xf2, 0x6f, 0x6f, 0x2b, 0x54, 0x4a, 0x82, 0x1e, 0xa8, 0x31, 3372 }; 3373 static const u8 ecccdh_SECP521R1_12_test_vector_shared_secret[] = { 3374 0x00, 0x06, 0x2f, 0x9f, 0xc2, 0x9a, 0xe1, 0xa6, 0x8b, 0x2e, 0xe0, 0xdc, 0xf9, 0x56, 0xcb, 0xd3, 0x8c, 0x88, 0xae, 0x5f, 0x64, 0x5e, 0xaa, 0x54, 0x6b, 0x00, 0xeb, 0xe8, 0x7a, 0x72, 0x60, 0xbf, 0x72, 0x4b, 0xe2, 0x0d, 0x34, 0xb9, 0xd0, 0x20, 0x76, 0x65, 0x5c, 0x93, 0x3d, 0x05, 0x6b, 0x21, 0xe3, 0x04, 0xc2, 0x4d, 0xdb, 0x1d, 0xed, 0xf1, 0xdd, 0x76, 0xde, 0x61, 0x1f, 0xc4, 0xa2, 0x34, 0x03, 0x36, 3375 }; 3376 static const ecdh_test_case ecccdh_SECP521R1_12_test_case = { 3377 .name = "ECCCDH/SECP521R1 12", 3378 .ecdh_type = ECCCDH, 3379 .ec_str_p = &secp521r1_str_params, 3380 .our_priv_key = ecccdh_SECP521R1_12_test_vector_our_priv_key, 3381 .our_priv_key_len = sizeof(ecccdh_SECP521R1_12_test_vector_our_priv_key), 3382 .peer_pub_key = ecccdh_SECP521R1_12_test_vector_peer_pub_key, 3383 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_12_test_vector_peer_pub_key), 3384 .exp_our_pub_key = ecccdh_SECP521R1_12_test_vector_our_pub_key, 3385 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_12_test_vector_our_pub_key), 3386 .exp_shared_secret = ecccdh_SECP521R1_12_test_vector_shared_secret, 3387 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_12_test_vector_shared_secret), 3388 }; 3389 #endif /* WITH_CURVE_SECP521R1 */ 3390 3391 #ifdef WITH_CURVE_SECP521R1 3392 #define ECCCDH_SECP521R1_SELF_TEST_13 3393 /*** Tests for ECCCDH/SECP521R1 ***/ 3394 static const u8 ecccdh_SECP521R1_13_test_vector_our_priv_key[] = { 3395 0x00, 0x00, 0x01, 0x1a, 0x63, 0x47, 0xd4, 0xe8, 0x01, 0xc9, 0x19, 0x23, 0x48, 0x83, 0x54, 0xcc, 0x53, 0x3e, 0x7e, 0x35, 0xfd, 0xdf, 0x81, 0xff, 0x0f, 0xb7, 0xf5, 0x6b, 0xb0, 0x72, 0x6e, 0x0c, 0x29, 0xee, 0x5d, 0xcd, 0xc5, 0xf3, 0x94, 0xba, 0x54, 0xcf, 0x57, 0x26, 0x90, 0x48, 0xaa, 0xb6, 0xe0, 0x55, 0x89, 0x5c, 0x8d, 0xa2, 0x4b, 0x8b, 0x06, 0x39, 0xa7, 0x42, 0x31, 0x43, 0x90, 0xcc, 0x04, 0x19, 0x0e, 0xd6, 3396 }; 3397 static const u8 ecccdh_SECP521R1_13_test_vector_peer_pub_key[] = { 3398 0x01, 0xa8, 0x9b, 0x63, 0x6a, 0x93, 0xe5, 0xd2, 0xba, 0x6c, 0x22, 0x92, 0xbf, 0x23, 0x03, 0x3a, 0x84, 0xf0, 0x6a, 0x3a, 0xc1, 0x22, 0x0e, 0xa7, 0x1e, 0x80, 0x6a, 0xfb, 0xe0, 0x97, 0xa8, 0x04, 0xcc, 0x67, 0xe9, 0xba, 0xa5, 0x14, 0xcf, 0xb6, 0xc1, 0x2c, 0x91, 0x94, 0xbe, 0x30, 0x21, 0x2b, 0xf7, 0xaa, 0xe7, 0xfd, 0xf6, 0xd3, 0x76, 0xc2, 0x12, 0xf0, 0x55, 0x4e, 0x65, 0x64, 0x63, 0xff, 0xab, 0x7e, 0x01, 0x82, 0xef, 0xca, 0xf7, 0x0f, 0xc4, 0x12, 0xd3, 0x36, 0x60, 0x2e, 0x01, 0x4d, 0xa4, 0x72, 0x56, 0xa0, 0xb6, 0x06, 0xf2, 0xad, 0xdc, 0xce, 0x80, 0x53, 0xbf, 0x81, 0x7a, 0xc8, 0x65, 0x6b, 0xb4, 0xe4, 0x2f, 0x14, 0xc8, 0xcb, 0xf2, 0xa6, 0x8f, 0x48, 0x8a, 0xb3, 0x5d, 0xcd, 0xf6, 0x40, 0x56, 0x27, 0x1d, 0xee, 0x1f, 0x60, 0x6a, 0x44, 0x0b, 0xa4, 0xbd, 0x4e, 0x5a, 0x11, 0xb8, 0xb8, 0xe5, 0x4f, 3399 }; 3400 static const u8 ecccdh_SECP521R1_13_test_vector_our_pub_key[] = { 3401 0x00, 0xfe, 0x30, 0x26, 0x7f, 0x33, 0xba, 0x5c, 0xde, 0xfc, 0x25, 0xcb, 0xb3, 0xc9, 0x32, 0x0d, 0xad, 0x9c, 0xcb, 0x1d, 0x7d, 0x37, 0x66, 0x44, 0x62, 0x0c, 0xa4, 0xfa, 0xde, 0xe5, 0x62, 0x6a, 0x3c, 0xed, 0xe2, 0x5a, 0xd2, 0x54, 0x62, 0x4d, 0xef, 0x72, 0x7a, 0x70, 0x48, 0xf7, 0x14, 0x5f, 0x76, 0x16, 0x2a, 0xa9, 0x80, 0x42, 0xf9, 0xb1, 0x23, 0xb2, 0x07, 0x6f, 0x8e, 0x8c, 0xf5, 0x9b, 0x3f, 0xdf, 0x00, 0x11, 0x45, 0xdc, 0x66, 0x31, 0x95, 0x3b, 0x6e, 0x29, 0x45, 0xe9, 0x43, 0x01, 0xd6, 0xcb, 0xb0, 0x98, 0xfe, 0x4b, 0x04, 0xf7, 0xee, 0x9b, 0x09, 0x41, 0x1d, 0xf1, 0x04, 0xdc, 0x82, 0xd7, 0xd7, 0x9e, 0xc4, 0x6a, 0x01, 0xed, 0x0f, 0x2d, 0x3e, 0x7d, 0xb6, 0xeb, 0x68, 0x06, 0x94, 0xbd, 0xeb, 0x10, 0x7c, 0x10, 0x78, 0xae, 0xc6, 0xca, 0xbd, 0x9e, 0xbe, 0xe3, 0xd3, 0x42, 0xfe, 0x7e, 0x54, 0xdf, 3402 }; 3403 static const u8 ecccdh_SECP521R1_13_test_vector_shared_secret[] = { 3404 0x01, 0x28, 0xab, 0x09, 0xbf, 0xec, 0x54, 0x06, 0x79, 0x9e, 0x61, 0x0f, 0x77, 0x2b, 0xa1, 0x7e, 0x89, 0x22, 0x49, 0xfa, 0x8e, 0x0e, 0x7b, 0x18, 0xa0, 0x4b, 0x91, 0x97, 0x03, 0x4b, 0x25, 0x0b, 0x48, 0x29, 0x4f, 0x18, 0x67, 0xfb, 0x96, 0x41, 0x51, 0x8f, 0x92, 0x76, 0x60, 0x66, 0xa0, 0x7a, 0x8b, 0x91, 0x7b, 0x0e, 0x76, 0x87, 0x9e, 0x10, 0x11, 0xe5, 0x1c, 0xcb, 0xd9, 0xf5, 0x40, 0xc5, 0x4d, 0x4f, 3405 }; 3406 static const ecdh_test_case ecccdh_SECP521R1_13_test_case = { 3407 .name = "ECCCDH/SECP521R1 13", 3408 .ecdh_type = ECCCDH, 3409 .ec_str_p = &secp521r1_str_params, 3410 .our_priv_key = ecccdh_SECP521R1_13_test_vector_our_priv_key, 3411 .our_priv_key_len = sizeof(ecccdh_SECP521R1_13_test_vector_our_priv_key), 3412 .peer_pub_key = ecccdh_SECP521R1_13_test_vector_peer_pub_key, 3413 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_13_test_vector_peer_pub_key), 3414 .exp_our_pub_key = ecccdh_SECP521R1_13_test_vector_our_pub_key, 3415 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_13_test_vector_our_pub_key), 3416 .exp_shared_secret = ecccdh_SECP521R1_13_test_vector_shared_secret, 3417 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_13_test_vector_shared_secret), 3418 }; 3419 #endif /* WITH_CURVE_SECP521R1 */ 3420 3421 #ifdef WITH_CURVE_SECP521R1 3422 #define ECCCDH_SECP521R1_SELF_TEST_14 3423 /*** Tests for ECCCDH/SECP521R1 ***/ 3424 static const u8 ecccdh_SECP521R1_14_test_vector_our_priv_key[] = { 3425 0x00, 0x00, 0x00, 0x22, 0xb6, 0xd2, 0xa2, 0x2d, 0x71, 0xdf, 0xaa, 0x81, 0x1d, 0x2d, 0x9f, 0x9f, 0x31, 0xfb, 0xed, 0x27, 0xf2, 0xe1, 0xf3, 0xd2, 0x39, 0x53, 0x8d, 0xdf, 0x3e, 0x4c, 0xc8, 0xc3, 0x9a, 0x33, 0x02, 0x66, 0xdb, 0x25, 0xb7, 0xbc, 0x0a, 0x97, 0x04, 0xf1, 0x7b, 0xde, 0x7f, 0x35, 0x92, 0xbf, 0x5f, 0x1f, 0x2d, 0x4b, 0x56, 0x01, 0x3a, 0xac, 0xc3, 0xd8, 0xd1, 0xbc, 0x02, 0xf0, 0x0d, 0x31, 0x46, 0xcc, 3426 }; 3427 static const u8 ecccdh_SECP521R1_14_test_vector_peer_pub_key[] = { 3428 0x01, 0x72, 0x00, 0xb3, 0xf1, 0x6a, 0x68, 0xcb, 0xae, 0xd2, 0xbf, 0x78, 0xba, 0x8c, 0xdd, 0xfb, 0x6c, 0xff, 0xac, 0x26, 0x2b, 0xba, 0x00, 0xfb, 0xc2, 0x5f, 0x9d, 0xc7, 0x2a, 0x07, 0xce, 0x59, 0x37, 0x29, 0x04, 0x89, 0x9f, 0x36, 0x4c, 0x44, 0xcb, 0x26, 0x4c, 0x09, 0x7b, 0x64, 0x7d, 0x44, 0x12, 0xbe, 0xe3, 0xe5, 0x19, 0x89, 0x2d, 0x53, 0x4d, 0x91, 0x29, 0xf8, 0xa2, 0x8f, 0x75, 0x00, 0xfe, 0xe7, 0x00, 0xba, 0xba, 0x8d, 0x67, 0x2a, 0x4f, 0x4a, 0x3b, 0x63, 0xde, 0x48, 0xb9, 0x6f, 0x56, 0xe1, 0x8d, 0xf5, 0xd6, 0x8f, 0x7d, 0x70, 0xd5, 0x10, 0x98, 0x33, 0xf4, 0x37, 0x70, 0xd6, 0x73, 0x2e, 0x06, 0xb3, 0x9a, 0xd6, 0x0d, 0x93, 0xe5, 0xb4, 0x3d, 0xb8, 0x78, 0x9f, 0x1e, 0xc0, 0xab, 0xa4, 0x72, 0x86, 0xa3, 0x9e, 0xa5, 0x84, 0x23, 0x5a, 0xce, 0xa7, 0x57, 0xdb, 0xf1, 0x3d, 0x53, 0xb5, 0x83, 0x64, 3429 }; 3430 static const u8 ecccdh_SECP521R1_14_test_vector_our_pub_key[] = { 3431 0x00, 0xba, 0x38, 0xcf, 0xbf, 0x9f, 0xd2, 0x51, 0x8a, 0x3f, 0x61, 0xd4, 0x35, 0x49, 0xe7, 0xa6, 0xa6, 0xd2, 0x8b, 0x2b, 0xe5, 0x7f, 0xfd, 0x3e, 0x0f, 0xac, 0xeb, 0x63, 0x6b, 0x34, 0xed, 0x17, 0xe0, 0x44, 0xa9, 0xf2, 0x49, 0xda, 0xe8, 0xfc, 0x13, 0x2e, 0x93, 0x7e, 0x2d, 0x93, 0x49, 0xcd, 0x2e, 0xd7, 0x7b, 0xb1, 0x04, 0x9c, 0xeb, 0x69, 0x2a, 0x2e, 0xc5, 0xb1, 0x7a, 0xd6, 0x15, 0x02, 0xa6, 0x4c, 0x00, 0x1e, 0xc9, 0x1d, 0x30, 0x58, 0x57, 0x3f, 0xa6, 0xc0, 0x56, 0x4a, 0x02, 0xa1, 0xa0, 0x10, 0x16, 0x0c, 0x31, 0x3b, 0xc7, 0xc7, 0x35, 0x10, 0xdc, 0x98, 0x3e, 0x54, 0x61, 0x68, 0x2b, 0x5b, 0xe0, 0x0d, 0xbc, 0xe7, 0xe2, 0xc6, 0x82, 0xad, 0x73, 0xf2, 0x9c, 0xa8, 0x22, 0xcd, 0xc1, 0x11, 0xf6, 0x8f, 0xab, 0xe3, 0x3a, 0x7b, 0x38, 0x4a, 0x64, 0x83, 0x42, 0xc3, 0xcd, 0xb9, 0xf0, 0x50, 0xbc, 0xdb, 3432 }; 3433 static const u8 ecccdh_SECP521R1_14_test_vector_shared_secret[] = { 3434 0x01, 0x01, 0xe4, 0x62, 0xe9, 0xd9, 0x15, 0x99, 0x68, 0xf6, 0x44, 0x0e, 0x95, 0x6f, 0x11, 0xdc, 0xf2, 0x22, 0x7a, 0xe4, 0xae, 0xa8, 0x16, 0x67, 0x12, 0x2b, 0x6a, 0xf9, 0x23, 0x9a, 0x29, 0x1e, 0xb5, 0xd6, 0xcf, 0x5a, 0x40, 0x87, 0xf3, 0x58, 0x52, 0x5f, 0xca, 0xcf, 0xa4, 0x6b, 0xb2, 0xdb, 0x01, 0xa7, 0x5a, 0xf1, 0xba, 0x51, 0x9b, 0x2d, 0x31, 0xda, 0x33, 0xed, 0xa8, 0x7a, 0x9d, 0x56, 0x57, 0x48, 3435 }; 3436 static const ecdh_test_case ecccdh_SECP521R1_14_test_case = { 3437 .name = "ECCCDH/SECP521R1 14", 3438 .ecdh_type = ECCCDH, 3439 .ec_str_p = &secp521r1_str_params, 3440 .our_priv_key = ecccdh_SECP521R1_14_test_vector_our_priv_key, 3441 .our_priv_key_len = sizeof(ecccdh_SECP521R1_14_test_vector_our_priv_key), 3442 .peer_pub_key = ecccdh_SECP521R1_14_test_vector_peer_pub_key, 3443 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_14_test_vector_peer_pub_key), 3444 .exp_our_pub_key = ecccdh_SECP521R1_14_test_vector_our_pub_key, 3445 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_14_test_vector_our_pub_key), 3446 .exp_shared_secret = ecccdh_SECP521R1_14_test_vector_shared_secret, 3447 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_14_test_vector_shared_secret), 3448 }; 3449 #endif /* WITH_CURVE_SECP521R1 */ 3450 3451 #ifdef WITH_CURVE_SECP521R1 3452 #define ECCCDH_SECP521R1_SELF_TEST_15 3453 /*** Tests for ECCCDH/SECP521R1 ***/ 3454 static const u8 ecccdh_SECP521R1_15_test_vector_our_priv_key[] = { 3455 0x00, 0x00, 0x00, 0x5b, 0xac, 0xff, 0xf2, 0x68, 0xac, 0xf6, 0x55, 0x3c, 0x3c, 0x58, 0x3b, 0x46, 0x4e, 0xa3, 0x6a, 0x1d, 0x35, 0xe2, 0xb2, 0x57, 0xa5, 0xd4, 0x9e, 0xb3, 0x41, 0x9d, 0x5a, 0x09, 0x50, 0x87, 0xc2, 0xfb, 0x4d, 0x15, 0xcf, 0x5b, 0xf5, 0xaf, 0x81, 0x6d, 0x0f, 0x3f, 0xf7, 0x58, 0x64, 0x90, 0xcc, 0xd3, 0xdd, 0xc1, 0xa9, 0x8b, 0x39, 0xce, 0x63, 0x74, 0x9c, 0x62, 0x88, 0xce, 0x0d, 0xbd, 0xac, 0x7d, 3456 }; 3457 static const u8 ecccdh_SECP521R1_15_test_vector_peer_pub_key[] = { 3458 0x00, 0x4e, 0xfd, 0x5d, 0xbd, 0x2f, 0x97, 0x9e, 0x38, 0x31, 0xce, 0x98, 0xf8, 0x23, 0x55, 0xd6, 0xca, 0x14, 0xa5, 0x75, 0x78, 0x42, 0x87, 0x58, 0x82, 0x99, 0x0a, 0xb8, 0x5a, 0xb9, 0xb7, 0x35, 0x2d, 0xd6, 0xb9, 0xb2, 0xf4, 0xea, 0x9a, 0x1e, 0x95, 0xc3, 0x88, 0x0d, 0x65, 0xd1, 0xf3, 0x60, 0x2f, 0x9c, 0xa6, 0x53, 0xdc, 0x34, 0x6f, 0xac, 0x85, 0x86, 0x58, 0xd7, 0x56, 0x26, 0xf4, 0xd4, 0xfb, 0x08, 0x00, 0x61, 0xcf, 0x15, 0xdb, 0xda, 0xa7, 0xf3, 0x15, 0x89, 0xc9, 0x84, 0x00, 0x37, 0x3d, 0xa2, 0x84, 0x50, 0x6d, 0x70, 0xc8, 0x9f, 0x07, 0x4e, 0xd2, 0x62, 0xa9, 0xe2, 0x81, 0x40, 0x79, 0x6b, 0x72, 0x36, 0xc2, 0xee, 0xf9, 0x90, 0x16, 0x08, 0x5e, 0x71, 0x55, 0x2f, 0xf4, 0x88, 0xc7, 0x2b, 0x73, 0x39, 0xfe, 0xfb, 0x79, 0x15, 0xc3, 0x84, 0x59, 0xcb, 0x20, 0xab, 0x85, 0xae, 0xc4, 0xe4, 0x50, 0x52, 3459 }; 3460 static const u8 ecccdh_SECP521R1_15_test_vector_our_pub_key[] = { 3461 0x00, 0x36, 0xe4, 0x88, 0xda, 0x75, 0x81, 0x47, 0x2a, 0x9d, 0x8e, 0x62, 0x8c, 0x58, 0xd6, 0xad, 0x72, 0x73, 0x11, 0xb7, 0xe6, 0xa3, 0xf6, 0xae, 0x33, 0xa8, 0x54, 0x4f, 0x34, 0xb0, 0x92, 0x80, 0x24, 0x90, 0x20, 0xbe, 0x71, 0x96, 0x91, 0x6f, 0xaf, 0xd9, 0x0e, 0x2e, 0xc5, 0x4b, 0x66, 0xb5, 0x46, 0x8d, 0x23, 0x61, 0xb9, 0x9b, 0x56, 0xfa, 0x00, 0xd7, 0xac, 0x37, 0xab, 0xb8, 0xc6, 0xf1, 0x66, 0x53, 0x01, 0x1e, 0xdb, 0x9f, 0xb8, 0xad, 0xb6, 0xa4, 0x3f, 0x4f, 0x5f, 0x5f, 0xdc, 0x14, 0x21, 0xc9, 0xfe, 0x04, 0xfc, 0x8b, 0xa4, 0x6c, 0x9b, 0x66, 0x33, 0x4e, 0x3a, 0xf9, 0x27, 0xc8, 0xbe, 0xfb, 0x43, 0x07, 0x10, 0x4f, 0x29, 0x9a, 0xce, 0xc4, 0xe3, 0x0f, 0x81, 0x2d, 0x93, 0x45, 0xc9, 0x72, 0x0d, 0x19, 0x86, 0x9d, 0xbf, 0xff, 0xd4, 0xca, 0x3e, 0x7d, 0x27, 0x13, 0xeb, 0x5f, 0xc3, 0xf4, 0x26, 0x15, 3462 }; 3463 static const u8 ecccdh_SECP521R1_15_test_vector_shared_secret[] = { 3464 0x01, 0x41, 0xd6, 0xa4, 0xb7, 0x19, 0xab, 0x67, 0xea, 0xf0, 0x4a, 0x92, 0xc0, 0xa4, 0x1e, 0x2d, 0xda, 0x78, 0xf4, 0x35, 0x4f, 0xb9, 0x0b, 0xdc, 0x35, 0x20, 0x2c, 0xc7, 0x69, 0x9b, 0x9b, 0x04, 0xd4, 0x96, 0x16, 0xf8, 0x22, 0x55, 0xde, 0xbf, 0x7b, 0xbe, 0xc0, 0x45, 0xae, 0x58, 0xf9, 0x82, 0xa6, 0x69, 0x05, 0xfc, 0xfa, 0xe6, 0x9d, 0x68, 0x97, 0x85, 0xe3, 0x8c, 0x86, 0x8e, 0xb4, 0xa2, 0x7e, 0x7b, 3465 }; 3466 static const ecdh_test_case ecccdh_SECP521R1_15_test_case = { 3467 .name = "ECCCDH/SECP521R1 15", 3468 .ecdh_type = ECCCDH, 3469 .ec_str_p = &secp521r1_str_params, 3470 .our_priv_key = ecccdh_SECP521R1_15_test_vector_our_priv_key, 3471 .our_priv_key_len = sizeof(ecccdh_SECP521R1_15_test_vector_our_priv_key), 3472 .peer_pub_key = ecccdh_SECP521R1_15_test_vector_peer_pub_key, 3473 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_15_test_vector_peer_pub_key), 3474 .exp_our_pub_key = ecccdh_SECP521R1_15_test_vector_our_pub_key, 3475 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_15_test_vector_our_pub_key), 3476 .exp_shared_secret = ecccdh_SECP521R1_15_test_vector_shared_secret, 3477 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_15_test_vector_shared_secret), 3478 }; 3479 #endif /* WITH_CURVE_SECP521R1 */ 3480 3481 #ifdef WITH_CURVE_SECP521R1 3482 #define ECCCDH_SECP521R1_SELF_TEST_16 3483 /*** Tests for ECCCDH/SECP521R1 ***/ 3484 static const u8 ecccdh_SECP521R1_16_test_vector_our_priv_key[] = { 3485 0x00, 0x00, 0x00, 0x8e, 0x2c, 0x93, 0xc5, 0x42, 0x38, 0x76, 0x22, 0x3a, 0x63, 0x7c, 0xad, 0x36, 0x7c, 0x85, 0x89, 0xda, 0x69, 0xa2, 0xd0, 0xfc, 0x68, 0x61, 0x2f, 0x31, 0x92, 0x3a, 0xe5, 0x02, 0x19, 0xdf, 0x24, 0x52, 0xe7, 0xcc, 0x92, 0x61, 0x5b, 0x67, 0xf1, 0x7b, 0x57, 0xff, 0xd2, 0xf5, 0x2b, 0x19, 0x15, 0x4b, 0xb4, 0x0d, 0x77, 0x15, 0x33, 0x64, 0x20, 0xfd, 0xe2, 0xe8, 0x9f, 0xee, 0x24, 0x4f, 0x59, 0xdc, 3486 }; 3487 static const u8 ecccdh_SECP521R1_16_test_vector_peer_pub_key[] = { 3488 0x01, 0x29, 0x89, 0x1d, 0xe0, 0xcf, 0x3c, 0xf8, 0x2e, 0x8c, 0x2c, 0xf1, 0xbf, 0x90, 0xbb, 0x29, 0x6f, 0xe0, 0x0a, 0xb0, 0x8c, 0xa4, 0x5b, 0xb7, 0x89, 0x2e, 0x0e, 0x22, 0x7a, 0x50, 0x4f, 0xdd, 0x05, 0xd2, 0x38, 0x1a, 0x44, 0x48, 0xb6, 0x8a, 0xdf, 0xf9, 0xc4, 0x15, 0x3c, 0x87, 0xea, 0xcb, 0x78, 0x33, 0x0d, 0x8b, 0xd5, 0x25, 0x15, 0xf9, 0xf9, 0xa0, 0xb5, 0x8e, 0x85, 0xf4, 0x46, 0xbb, 0x4e, 0x10, 0x00, 0x9e, 0xdd, 0x67, 0x96, 0x96, 0xd3, 0xd1, 0xd0, 0xef, 0x32, 0x7f, 0x20, 0x03, 0x83, 0x25, 0x3f, 0x64, 0x13, 0x68, 0x3d, 0x9e, 0x4f, 0xcc, 0x87, 0xbb, 0x35, 0xf1, 0x12, 0xc2, 0xf1, 0x10, 0x09, 0x8d, 0x15, 0xe5, 0x70, 0x1d, 0x7c, 0xee, 0xe4, 0x16, 0x29, 0x1f, 0xf5, 0xfe, 0xd8, 0x5e, 0x68, 0x7f, 0x72, 0x73, 0x88, 0xb9, 0xaf, 0xe2, 0x6a, 0x4f, 0x6f, 0xee, 0xd5, 0x60, 0xb2, 0x18, 0xe6, 0xbb, 3489 }; 3490 static const u8 ecccdh_SECP521R1_16_test_vector_our_pub_key[] = { 3491 0x00, 0xfa, 0x3b, 0x35, 0x11, 0x8d, 0x6c, 0x42, 0x25, 0x70, 0xf7, 0x24, 0xa2, 0x6f, 0x90, 0xb2, 0x83, 0x3b, 0x19, 0x23, 0x91, 0x74, 0xce, 0xa0, 0x81, 0xc5, 0x31, 0x33, 0xf6, 0x4d, 0xb6, 0x0d, 0x69, 0x40, 0xea, 0x12, 0x61, 0x29, 0x9c, 0x04, 0xc1, 0xf4, 0x58, 0x7c, 0xdb, 0x0c, 0x4c, 0x39, 0x61, 0x64, 0x79, 0xc1, 0xbb, 0x0c, 0x14, 0x67, 0x99, 0xa1, 0x18, 0x03, 0x2d, 0xcf, 0x98, 0xf8, 0x99, 0xc0, 0x00, 0x69, 0xf0, 0x40, 0x22, 0x90, 0x06, 0x15, 0x1f, 0xa3, 0x2b, 0x51, 0xf6, 0x79, 0xc8, 0x81, 0x6f, 0x7c, 0x17, 0x50, 0x6b, 0x40, 0x38, 0x09, 0xdc, 0x77, 0xcd, 0x58, 0xa2, 0xae, 0xc4, 0x30, 0xd9, 0x4d, 0x13, 0xb6, 0xc9, 0x16, 0xde, 0x99, 0xf3, 0x55, 0xaa, 0x45, 0xfc, 0xfb, 0xc6, 0x85, 0x3d, 0x68, 0x6c, 0x71, 0xbe, 0x49, 0x6a, 0x06, 0x7d, 0x24, 0xbf, 0xae, 0xa4, 0x81, 0x8f, 0xc5, 0x1f, 0x75, 3492 }; 3493 static const u8 ecccdh_SECP521R1_16_test_vector_shared_secret[] = { 3494 0x00, 0x34, 0x5e, 0x26, 0xe0, 0xab, 0xb1, 0xaa, 0xc1, 0x2b, 0x75, 0xf3, 0xa9, 0xcf, 0x41, 0xef, 0xe1, 0xc3, 0x36, 0x39, 0x6d, 0xff, 0xa4, 0xa0, 0x67, 0xa4, 0xc2, 0xcf, 0xeb, 0x87, 0x8c, 0x68, 0xb2, 0xb0, 0x45, 0xfa, 0xa4, 0xe5, 0xb4, 0xe6, 0xfa, 0x46, 0x78, 0xf5, 0xb6, 0x03, 0xc3, 0x51, 0x90, 0x3b, 0x14, 0xbf, 0x9a, 0x6a, 0x70, 0xc4, 0x39, 0x25, 0x71, 0x99, 0xa6, 0x40, 0x89, 0x0b, 0x61, 0xd1, 3495 }; 3496 static const ecdh_test_case ecccdh_SECP521R1_16_test_case = { 3497 .name = "ECCCDH/SECP521R1 16", 3498 .ecdh_type = ECCCDH, 3499 .ec_str_p = &secp521r1_str_params, 3500 .our_priv_key = ecccdh_SECP521R1_16_test_vector_our_priv_key, 3501 .our_priv_key_len = sizeof(ecccdh_SECP521R1_16_test_vector_our_priv_key), 3502 .peer_pub_key = ecccdh_SECP521R1_16_test_vector_peer_pub_key, 3503 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_16_test_vector_peer_pub_key), 3504 .exp_our_pub_key = ecccdh_SECP521R1_16_test_vector_our_pub_key, 3505 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_16_test_vector_our_pub_key), 3506 .exp_shared_secret = ecccdh_SECP521R1_16_test_vector_shared_secret, 3507 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_16_test_vector_shared_secret), 3508 }; 3509 #endif /* WITH_CURVE_SECP521R1 */ 3510 3511 #ifdef WITH_CURVE_SECP521R1 3512 #define ECCCDH_SECP521R1_SELF_TEST_17 3513 /*** Tests for ECCCDH/SECP521R1 ***/ 3514 static const u8 ecccdh_SECP521R1_17_test_vector_our_priv_key[] = { 3515 0x00, 0x00, 0x00, 0x04, 0xd4, 0x9d, 0x39, 0xd4, 0x0d, 0x81, 0x11, 0xbf, 0x16, 0xd2, 0x8c, 0x59, 0x36, 0x55, 0x43, 0x26, 0xb1, 0x97, 0x35, 0x3e, 0xeb, 0xbc, 0xf4, 0x75, 0x45, 0x39, 0x3b, 0xc8, 0xd3, 0xaa, 0xf9, 0x8f, 0x14, 0xf5, 0xbe, 0x70, 0x74, 0xbf, 0xb3, 0x8e, 0x6c, 0xc9, 0x7b, 0x98, 0x97, 0x54, 0x07, 0x4d, 0xad, 0xdb, 0x30, 0x45, 0xf4, 0xe4, 0xce, 0x74, 0x56, 0x69, 0xfd, 0xb3, 0xec, 0x0d, 0x5f, 0xa8, 3516 }; 3517 static const u8 ecccdh_SECP521R1_17_test_vector_peer_pub_key[] = { 3518 0x01, 0xa3, 0xc2, 0x02, 0x40, 0xe5, 0x9f, 0x5b, 0x7a, 0x3e, 0x17, 0xc2, 0x75, 0xd2, 0x31, 0x4b, 0xa1, 0x74, 0x12, 0x10, 0xad, 0x58, 0xb7, 0x10, 0x36, 0xf8, 0xc8, 0x3c, 0xc1, 0xf6, 0xb0, 0xf4, 0x09, 0xdf, 0xdd, 0x91, 0x13, 0xe9, 0x4b, 0x67, 0xec, 0x39, 0xc3, 0x29, 0x14, 0x26, 0xc2, 0x3f, 0xfc, 0xc4, 0x47, 0x05, 0x46, 0x70, 0xd2, 0x90, 0x8f, 0xf8, 0xfe, 0x67, 0xdc, 0x23, 0x06, 0x03, 0x4c, 0x5c, 0x01, 0xd2, 0x82, 0x5b, 0xfd, 0x3a, 0xf8, 0xb1, 0xe1, 0x32, 0x05, 0x78, 0x0c, 0x13, 0x7f, 0xe9, 0x38, 0xf8, 0x4f, 0xde, 0x40, 0x18, 0x8e, 0x61, 0xea, 0x02, 0xce, 0xad, 0x81, 0xba, 0xdf, 0xdb, 0x42, 0x5c, 0x29, 0xf7, 0xd7, 0xfb, 0x03, 0x24, 0xde, 0xba, 0xdc, 0x10, 0xbb, 0xb9, 0x3d, 0xe6, 0x8f, 0x62, 0xc3, 0x50, 0x69, 0x26, 0x82, 0x83, 0xf5, 0x26, 0x58, 0x65, 0xdb, 0x57, 0xa7, 0x9f, 0x7b, 0xf7, 3519 }; 3520 static const u8 ecccdh_SECP521R1_17_test_vector_our_pub_key[] = { 3521 0x01, 0x2e, 0xc2, 0x26, 0xd0, 0x50, 0xce, 0x07, 0xc7, 0x9b, 0x3d, 0xf4, 0xd0, 0xf0, 0x89, 0x1f, 0x9f, 0x7a, 0xdf, 0x46, 0x2e, 0x8c, 0x98, 0xdb, 0xc1, 0xa2, 0xa1, 0x4f, 0x5e, 0x53, 0xa3, 0xf5, 0xad, 0x89, 0x44, 0x33, 0x58, 0x7c, 0xc4, 0x29, 0xa8, 0xbe, 0x9e, 0xa1, 0xd8, 0x4f, 0xa3, 0x3b, 0x18, 0x03, 0x69, 0x0d, 0xae, 0x04, 0xda, 0x72, 0x18, 0xd3, 0x00, 0x26, 0x15, 0x7f, 0xc9, 0x95, 0xcf, 0x52, 0x00, 0x48, 0x37, 0xdf, 0xbf, 0x34, 0x26, 0xf5, 0x7b, 0x5c, 0x79, 0x32, 0x69, 0x13, 0x0a, 0xbb, 0x9a, 0x38, 0xf6, 0x18, 0x53, 0x22, 0x11, 0x93, 0x11, 0x54, 0xdb, 0x4e, 0xeb, 0x9a, 0xed, 0xe8, 0x8e, 0x57, 0x29, 0x0f, 0x84, 0x2e, 0xa0, 0xf2, 0xea, 0x9a, 0x5f, 0x74, 0xc6, 0x20, 0x3a, 0x39, 0x20, 0xfe, 0x4e, 0x30, 0x5f, 0x61, 0x18, 0xf6, 0x76, 0xb1, 0x54, 0xe1, 0xd7, 0x5b, 0x9c, 0xb5, 0xeb, 0x88, 3522 }; 3523 static const u8 ecccdh_SECP521R1_17_test_vector_shared_secret[] = { 3524 0x00, 0x6f, 0xe9, 0xde, 0x6f, 0xb8, 0xe6, 0x72, 0xe7, 0xfd, 0x15, 0x0f, 0xdc, 0x5e, 0x61, 0x7f, 0xab, 0xb0, 0xd4, 0x39, 0x06, 0x35, 0x4c, 0xcf, 0xd2, 0x24, 0x75, 0x7c, 0x72, 0x76, 0xf7, 0xa1, 0x01, 0x00, 0x91, 0xb1, 0x7e, 0xd0, 0x72, 0x07, 0x4f, 0x8d, 0x10, 0xa5, 0xec, 0x97, 0x1e, 0xb3, 0x5a, 0x5c, 0xb7, 0x07, 0x66, 0x03, 0xb7, 0xbc, 0x38, 0xd4, 0x32, 0xcb, 0xc0, 0x59, 0xf8, 0x0f, 0x94, 0x88, 3525 }; 3526 static const ecdh_test_case ecccdh_SECP521R1_17_test_case = { 3527 .name = "ECCCDH/SECP521R1 17", 3528 .ecdh_type = ECCCDH, 3529 .ec_str_p = &secp521r1_str_params, 3530 .our_priv_key = ecccdh_SECP521R1_17_test_vector_our_priv_key, 3531 .our_priv_key_len = sizeof(ecccdh_SECP521R1_17_test_vector_our_priv_key), 3532 .peer_pub_key = ecccdh_SECP521R1_17_test_vector_peer_pub_key, 3533 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_17_test_vector_peer_pub_key), 3534 .exp_our_pub_key = ecccdh_SECP521R1_17_test_vector_our_pub_key, 3535 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_17_test_vector_our_pub_key), 3536 .exp_shared_secret = ecccdh_SECP521R1_17_test_vector_shared_secret, 3537 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_17_test_vector_shared_secret), 3538 }; 3539 #endif /* WITH_CURVE_SECP521R1 */ 3540 3541 #ifdef WITH_CURVE_SECP521R1 3542 #define ECCCDH_SECP521R1_SELF_TEST_18 3543 /*** Tests for ECCCDH/SECP521R1 ***/ 3544 static const u8 ecccdh_SECP521R1_18_test_vector_our_priv_key[] = { 3545 0x00, 0x00, 0x01, 0x1a, 0x5d, 0x1c, 0xc7, 0x9c, 0xd2, 0xbf, 0x73, 0xea, 0x10, 0x6f, 0x0e, 0x60, 0xa5, 0xac, 0xe2, 0x20, 0x81, 0x3b, 0x53, 0xe2, 0x7b, 0x73, 0x98, 0x64, 0x33, 0x4a, 0x07, 0xc0, 0x33, 0x67, 0xef, 0xda, 0x7a, 0x46, 0x19, 0xfa, 0x6e, 0xef, 0x3a, 0x97, 0x46, 0x49, 0x22, 0x83, 0xb3, 0xc4, 0x45, 0x61, 0x0a, 0x02, 0x3a, 0x9c, 0xc4, 0x9b, 0xf4, 0x59, 0x11, 0x40, 0x38, 0x4f, 0xca, 0x5c, 0x8b, 0xb5, 3546 }; 3547 static const u8 ecccdh_SECP521R1_18_test_vector_peer_pub_key[] = { 3548 0x00, 0x7e, 0x2d, 0x13, 0x8f, 0x28, 0x32, 0xe3, 0x45, 0xae, 0x8f, 0xf6, 0x59, 0x57, 0xe4, 0x0e, 0x5e, 0xc7, 0x16, 0x3f, 0x01, 0x6b, 0xdf, 0x6d, 0x24, 0xa2, 0x24, 0x3d, 0xaa, 0x63, 0x1d, 0x87, 0x8a, 0x4a, 0x16, 0x78, 0x39, 0x90, 0xc7, 0x22, 0x38, 0x21, 0x30, 0xf9, 0xe5, 0x1f, 0x0c, 0x1b, 0xd6, 0xff, 0x5a, 0xc9, 0x67, 0x80, 0xe4, 0x8b, 0x68, 0xf5, 0xde, 0xc9, 0x5f, 0x42, 0xe6, 0x14, 0x4b, 0xb5, 0x00, 0xb0, 0xde, 0x5c, 0x89, 0x67, 0x91, 0xf5, 0x28, 0x86, 0xb0, 0xf0, 0x99, 0x13, 0xe2, 0x6e, 0x78, 0xdd, 0x0b, 0x69, 0x79, 0x8f, 0xc4, 0xdf, 0x6d, 0x95, 0xe3, 0xca, 0x70, 0x8e, 0xcb, 0xcb, 0xcc, 0xe1, 0xc1, 0x89, 0x5f, 0x55, 0x61, 0xbb, 0xab, 0xaa, 0xe3, 0x72, 0xe9, 0xe6, 0x7e, 0x6e, 0x1a, 0x3b, 0xe6, 0x0e, 0x19, 0xb4, 0x70, 0xcd, 0xf6, 0x73, 0xec, 0x1f, 0xc3, 0x93, 0xd3, 0x42, 0x6e, 0x20, 3549 }; 3550 static const u8 ecccdh_SECP521R1_18_test_vector_our_pub_key[] = { 3551 0x00, 0xeb, 0x07, 0xc7, 0x33, 0x2e, 0xed, 0xb7, 0xd3, 0x03, 0x60, 0x59, 0xd3, 0x5f, 0x7d, 0x22, 0x88, 0xd4, 0x37, 0x7d, 0x5f, 0x42, 0x33, 0x7a, 0xd3, 0x96, 0x40, 0x79, 0xfb, 0x12, 0x0c, 0xcd, 0x4c, 0x8b, 0xd3, 0x84, 0xb5, 0x85, 0x62, 0x10, 0x55, 0x21, 0x70, 0x23, 0xac, 0xd9, 0xa9, 0x4f, 0xcb, 0x3b, 0x96, 0x5b, 0xfb, 0x39, 0x46, 0x75, 0xe7, 0x88, 0xad, 0xe4, 0x1a, 0x1d, 0xe7, 0x3e, 0x62, 0x0c, 0x00, 0x49, 0x1a, 0x83, 0x5d, 0xe2, 0xe6, 0xe7, 0xde, 0xb7, 0xe0, 0x90, 0xf4, 0xa1, 0x1f, 0x2c, 0x46, 0x0c, 0x0b, 0x1f, 0x3d, 0x5e, 0x94, 0xee, 0x8d, 0x75, 0x10, 0x14, 0xdc, 0x72, 0x07, 0x84, 0xfd, 0x3b, 0x54, 0x50, 0x0c, 0x86, 0xeb, 0xae, 0xf1, 0x84, 0x29, 0xf0, 0x9e, 0x8e, 0x87, 0x6d, 0x5d, 0x15, 0x38, 0x96, 0x8a, 0x03, 0x0d, 0x77, 0x15, 0xdd, 0xe9, 0x9f, 0x0d, 0x8f, 0x06, 0xe2, 0x9d, 0x59, 3552 }; 3553 static const u8 ecccdh_SECP521R1_18_test_vector_shared_secret[] = { 3554 0x01, 0xe4, 0xe7, 0x59, 0xec, 0xed, 0xce, 0x10, 0x13, 0xba, 0xf7, 0x3e, 0x6f, 0xcc, 0x0b, 0x92, 0x45, 0x1d, 0x03, 0xbd, 0xd5, 0x04, 0x89, 0xb7, 0x88, 0x71, 0xc3, 0x33, 0x11, 0x49, 0x90, 0xc9, 0xba, 0x6a, 0x9b, 0x2f, 0xc7, 0xb1, 0xa2, 0xd9, 0xa1, 0x79, 0x4c, 0x1b, 0x60, 0xd9, 0x27, 0x9a, 0xf6, 0xf1, 0x46, 0xf0, 0xbb, 0xfb, 0x06, 0x83, 0x14, 0x04, 0x03, 0xbf, 0xa4, 0xcc, 0xdb, 0x52, 0x4a, 0x29, 3555 }; 3556 static const ecdh_test_case ecccdh_SECP521R1_18_test_case = { 3557 .name = "ECCCDH/SECP521R1 18", 3558 .ecdh_type = ECCCDH, 3559 .ec_str_p = &secp521r1_str_params, 3560 .our_priv_key = ecccdh_SECP521R1_18_test_vector_our_priv_key, 3561 .our_priv_key_len = sizeof(ecccdh_SECP521R1_18_test_vector_our_priv_key), 3562 .peer_pub_key = ecccdh_SECP521R1_18_test_vector_peer_pub_key, 3563 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_18_test_vector_peer_pub_key), 3564 .exp_our_pub_key = ecccdh_SECP521R1_18_test_vector_our_pub_key, 3565 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_18_test_vector_our_pub_key), 3566 .exp_shared_secret = ecccdh_SECP521R1_18_test_vector_shared_secret, 3567 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_18_test_vector_shared_secret), 3568 }; 3569 #endif /* WITH_CURVE_SECP521R1 */ 3570 3571 #ifdef WITH_CURVE_SECP521R1 3572 #define ECCCDH_SECP521R1_SELF_TEST_19 3573 /*** Tests for ECCCDH/SECP521R1 ***/ 3574 static const u8 ecccdh_SECP521R1_19_test_vector_our_priv_key[] = { 3575 0x00, 0x00, 0x01, 0x0c, 0x90, 0x8c, 0xaf, 0x1b, 0xe7, 0x4c, 0x61, 0x6b, 0x62, 0x5f, 0xc8, 0xc1, 0xf5, 0x14, 0x44, 0x6a, 0x6a, 0xec, 0x83, 0xb5, 0x93, 0x71, 0x41, 0xd6, 0xaf, 0xbb, 0x0a, 0x8c, 0x76, 0x66, 0xa7, 0x74, 0x6f, 0xa1, 0xf7, 0xa6, 0x66, 0x4a, 0x21, 0x23, 0xe8, 0xcd, 0xf6, 0xcd, 0x8b, 0xf8, 0x36, 0xc5, 0x6d, 0x3c, 0x0e, 0xbd, 0xcc, 0x98, 0x0e, 0x43, 0xa1, 0x86, 0xf9, 0x38, 0xf3, 0xa7, 0x8a, 0xe7, 3576 }; 3577 static const u8 ecccdh_SECP521R1_19_test_vector_peer_pub_key[] = { 3578 0x00, 0x11, 0x8c, 0x36, 0x02, 0x22, 0x09, 0xb1, 0xaf, 0x8e, 0xba, 0xd1, 0xa1, 0x2b, 0x56, 0x6f, 0xc4, 0x87, 0x44, 0x57, 0x6e, 0x11, 0x99, 0xfe, 0x80, 0xde, 0x1c, 0xdf, 0x85, 0x1c, 0xdf, 0x03, 0xe5, 0xb9, 0x09, 0x1a, 0x8f, 0x7e, 0x07, 0x9e, 0x83, 0xb7, 0xf8, 0x27, 0x25, 0x9b, 0x69, 0x1d, 0x0c, 0x22, 0xee, 0x29, 0xd6, 0xbd, 0xf7, 0x3e, 0xc7, 0xbb, 0xfd, 0x74, 0x6f, 0x2c, 0xd9, 0x7a, 0x35, 0x7d, 0x00, 0xda, 0x5f, 0xf4, 0x90, 0x45, 0x48, 0xa3, 0x42, 0xe2, 0xe7, 0xba, 0x6a, 0x1f, 0x4e, 0xe5, 0xf8, 0x40, 0x41, 0x1a, 0x96, 0xcf, 0x63, 0xe6, 0xfe, 0x62, 0x2f, 0x22, 0xc1, 0x3e, 0x61, 0x4e, 0x0a, 0x84, 0x7c, 0x11, 0xa1, 0xab, 0x3f, 0x1d, 0x12, 0xcc, 0x85, 0x0c, 0x32, 0xe0, 0x95, 0x61, 0x4c, 0xa8, 0xf7, 0xe2, 0x72, 0x14, 0x77, 0xb4, 0x86, 0xe9, 0xff, 0x40, 0x37, 0x29, 0x77, 0xc3, 0xf6, 0x5c, 3579 }; 3580 static const u8 ecccdh_SECP521R1_19_test_vector_our_pub_key[] = { 3581 0x00, 0x31, 0x89, 0x0f, 0x4c, 0x7a, 0xbe, 0xc3, 0xf7, 0x23, 0x36, 0x22, 0x85, 0xd7, 0x7d, 0x26, 0x36, 0xf8, 0x76, 0x81, 0x7d, 0xb3, 0xbb, 0xc8, 0x8b, 0x01, 0xe7, 0x73, 0x59, 0x7b, 0x96, 0x9f, 0xf6, 0xf0, 0x13, 0xea, 0x47, 0x0c, 0x85, 0x4a, 0xb4, 0xa7, 0x73, 0x90, 0x04, 0xeb, 0x8c, 0xbe, 0xa6, 0x9b, 0x82, 0xdd, 0xf3, 0x6a, 0xca, 0xdd, 0x40, 0x68, 0x71, 0x79, 0x8e, 0xcb, 0x2a, 0xc3, 0xaa, 0x7f, 0x00, 0xd8, 0xb4, 0x29, 0xae, 0x32, 0x50, 0x26, 0x6b, 0x96, 0x43, 0xc0, 0xc7, 0x65, 0xa6, 0x0d, 0xc1, 0x01, 0x55, 0xbc, 0x25, 0x31, 0xcf, 0x86, 0x27, 0x29, 0x6f, 0x49, 0x78, 0xb6, 0x64, 0x0a, 0x9e, 0x60, 0x0e, 0x19, 0xd0, 0x03, 0x7d, 0x58, 0x50, 0x3f, 0xa8, 0x07, 0x99, 0x54, 0x6a, 0x81, 0x4d, 0x74, 0x78, 0xa5, 0x50, 0xaa, 0x90, 0xe5, 0xeb, 0xeb, 0x05, 0x25, 0x27, 0xfa, 0xae, 0xae, 0x5d, 0x08, 3582 }; 3583 static const u8 ecccdh_SECP521R1_19_test_vector_shared_secret[] = { 3584 0x01, 0x63, 0xc9, 0x19, 0x1d, 0x65, 0x10, 0x39, 0xa5, 0xfe, 0x98, 0x5a, 0x0e, 0xea, 0x1e, 0xba, 0x01, 0x8a, 0x40, 0xab, 0x19, 0x37, 0xfc, 0xd2, 0xb6, 0x12, 0x20, 0x82, 0x0e, 0xe8, 0xf2, 0x30, 0x2e, 0x97, 0x99, 0xf6, 0xed, 0xfc, 0x3f, 0x51, 0x74, 0xf3, 0x69, 0xd6, 0x72, 0xd3, 0x77, 0xea, 0x89, 0x54, 0xa8, 0xd0, 0xc8, 0xb8, 0x51, 0xe8, 0x1a, 0x56, 0xfd, 0xa9, 0x52, 0x12, 0xa6, 0x57, 0x8f, 0x0e, 3585 }; 3586 static const ecdh_test_case ecccdh_SECP521R1_19_test_case = { 3587 .name = "ECCCDH/SECP521R1 19", 3588 .ecdh_type = ECCCDH, 3589 .ec_str_p = &secp521r1_str_params, 3590 .our_priv_key = ecccdh_SECP521R1_19_test_vector_our_priv_key, 3591 .our_priv_key_len = sizeof(ecccdh_SECP521R1_19_test_vector_our_priv_key), 3592 .peer_pub_key = ecccdh_SECP521R1_19_test_vector_peer_pub_key, 3593 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_19_test_vector_peer_pub_key), 3594 .exp_our_pub_key = ecccdh_SECP521R1_19_test_vector_our_pub_key, 3595 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_19_test_vector_our_pub_key), 3596 .exp_shared_secret = ecccdh_SECP521R1_19_test_vector_shared_secret, 3597 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_19_test_vector_shared_secret), 3598 }; 3599 #endif /* WITH_CURVE_SECP521R1 */ 3600 3601 #ifdef WITH_CURVE_SECP521R1 3602 #define ECCCDH_SECP521R1_SELF_TEST_20 3603 /*** Tests for ECCCDH/SECP521R1 ***/ 3604 static const u8 ecccdh_SECP521R1_20_test_vector_our_priv_key[] = { 3605 0x00, 0x00, 0x01, 0xb3, 0x7d, 0x6b, 0x72, 0x88, 0xde, 0x67, 0x13, 0x60, 0x42, 0x5d, 0x3e, 0x5a, 0xc1, 0xcc, 0xb2, 0x18, 0x15, 0x07, 0x9d, 0x8d, 0x73, 0x43, 0x1e, 0x9b, 0x74, 0xa6, 0xf0, 0xe7, 0xae, 0x00, 0x4a, 0x35, 0x75, 0x75, 0xb1, 0x1a, 0xd6, 0x66, 0x42, 0xce, 0x8b, 0x77, 0x55, 0x93, 0xeb, 0xa9, 0xd9, 0x8b, 0xf2, 0x5c, 0x75, 0xef, 0x0b, 0x4d, 0x3a, 0x20, 0x98, 0xbb, 0xc6, 0x41, 0xf5, 0x9a, 0x2b, 0x77, 3606 }; 3607 static const u8 ecccdh_SECP521R1_20_test_vector_peer_pub_key[] = { 3608 0x01, 0x78, 0x0e, 0xdf, 0xf1, 0xca, 0x1c, 0x03, 0xcf, 0xbe, 0x59, 0x3e, 0xdc, 0x6c, 0x04, 0x9b, 0xcb, 0x28, 0x60, 0x29, 0x4a, 0x92, 0xc3, 0x55, 0x48, 0x9d, 0x9a, 0xfb, 0x2e, 0x70, 0x20, 0x75, 0xad, 0xe1, 0xc9, 0x53, 0x89, 0x5a, 0x45, 0x62, 0x30, 0xa0, 0xcd, 0xe9, 0x05, 0xde, 0x4a, 0x3f, 0x38, 0x57, 0x3d, 0xbf, 0xcc, 0xcd, 0x67, 0xad, 0x6e, 0x7e, 0x93, 0xf0, 0xb5, 0x58, 0x1e, 0x92, 0x6a, 0x5d, 0x00, 0xa5, 0x48, 0x19, 0x62, 0xc9, 0x16, 0x29, 0x62, 0xe7, 0xf0, 0xeb, 0xde, 0xc9, 0x36, 0x93, 0x5d, 0x0e, 0xaa, 0x81, 0x3e, 0x82, 0x26, 0xd4, 0x0d, 0x7f, 0x61, 0x19, 0xbf, 0xd9, 0x40, 0x60, 0x23, 0x80, 0xc8, 0x67, 0x21, 0xe6, 0x1d, 0xb1, 0x83, 0x0f, 0x51, 0xe1, 0x39, 0xf2, 0x10, 0x00, 0x0b, 0xce, 0xc0, 0xd8, 0xed, 0xd3, 0x9e, 0x54, 0xd7, 0x3a, 0x9a, 0x12, 0x9f, 0x95, 0xcd, 0x5f, 0xa9, 0x79, 3609 }; 3610 static const u8 ecccdh_SECP521R1_20_test_vector_our_pub_key[] = { 3611 0x00, 0x18, 0x9a, 0x5e, 0xe3, 0x4d, 0xe7, 0xe3, 0x5a, 0xef, 0xea, 0xee, 0xf9, 0x22, 0x0c, 0x18, 0x07, 0x1b, 0x4c, 0x29, 0xa4, 0xc3, 0xbd, 0x9d, 0x95, 0x44, 0x58, 0xbd, 0x3e, 0x82, 0xa7, 0xa3, 0x4d, 0xa3, 0x4c, 0xff, 0x55, 0x79, 0xb8, 0x10, 0x1c, 0x06, 0x5b, 0x1f, 0x2f, 0x52, 0x7c, 0xf4, 0x58, 0x15, 0x01, 0xe2, 0x8e, 0xf5, 0x67, 0x18, 0x73, 0xe6, 0x52, 0x67, 0x73, 0x3d, 0x00, 0x35, 0x20, 0xaf, 0x01, 0xeb, 0x4b, 0xc5, 0x0a, 0x7b, 0x4d, 0x45, 0x99, 0xd7, 0xe3, 0xfa, 0x77, 0x3d, 0xdb, 0x9e, 0xb2, 0x52, 0xc9, 0xb3, 0x42, 0x28, 0x72, 0xe5, 0x44, 0xbd, 0xf7, 0x5c, 0x7b, 0xf6, 0x0f, 0x51, 0x66, 0xdd, 0xc1, 0x1e, 0xb0, 0x8f, 0xa7, 0xc3, 0x08, 0x22, 0xda, 0xba, 0xee, 0x37, 0x3a, 0xb4, 0x68, 0xeb, 0x2d, 0x92, 0x2e, 0x48, 0x4e, 0x2a, 0x52, 0x7f, 0xff, 0x2e, 0xbb, 0x80, 0x4b, 0x7d, 0x9a, 0x37, 3612 }; 3613 static const u8 ecccdh_SECP521R1_20_test_vector_shared_secret[] = { 3614 0x01, 0x5d, 0x61, 0x3e, 0x26, 0x7a, 0x36, 0x34, 0x2e, 0x0d, 0x12, 0x5c, 0xda, 0xd6, 0x43, 0xd8, 0x0d, 0x97, 0xed, 0x06, 0x00, 0xaf, 0xb9, 0xe6, 0xb9, 0x54, 0x5c, 0x9e, 0x64, 0xa9, 0x8c, 0xc6, 0xda, 0x7c, 0x5a, 0xaa, 0x3a, 0x8d, 0xa0, 0xbd, 0xd9, 0xdd, 0x3b, 0x97, 0xe9, 0x78, 0x82, 0x18, 0xa8, 0x0a, 0xba, 0xfc, 0x10, 0x6e, 0xf0, 0x65, 0xc8, 0xf1, 0xc4, 0xe1, 0x11, 0x9e, 0xf5, 0x8d, 0x29, 0x8b, 3615 }; 3616 static const ecdh_test_case ecccdh_SECP521R1_20_test_case = { 3617 .name = "ECCCDH/SECP521R1 20", 3618 .ecdh_type = ECCCDH, 3619 .ec_str_p = &secp521r1_str_params, 3620 .our_priv_key = ecccdh_SECP521R1_20_test_vector_our_priv_key, 3621 .our_priv_key_len = sizeof(ecccdh_SECP521R1_20_test_vector_our_priv_key), 3622 .peer_pub_key = ecccdh_SECP521R1_20_test_vector_peer_pub_key, 3623 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_20_test_vector_peer_pub_key), 3624 .exp_our_pub_key = ecccdh_SECP521R1_20_test_vector_our_pub_key, 3625 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_20_test_vector_our_pub_key), 3626 .exp_shared_secret = ecccdh_SECP521R1_20_test_vector_shared_secret, 3627 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_20_test_vector_shared_secret), 3628 }; 3629 #endif /* WITH_CURVE_SECP521R1 */ 3630 3631 #ifdef WITH_CURVE_SECP521R1 3632 #define ECCCDH_SECP521R1_SELF_TEST_21 3633 /*** Tests for ECCCDH/SECP521R1 ***/ 3634 static const u8 ecccdh_SECP521R1_21_test_vector_our_priv_key[] = { 3635 0x00, 0x00, 0x00, 0xf2, 0x66, 0x1a, 0xc7, 0x62, 0xf6, 0x0c, 0x5f, 0xff, 0x23, 0xbe, 0x5d, 0x96, 0x9c, 0xcd, 0x4e, 0xc6, 0xf9, 0x8e, 0x4e, 0x72, 0x61, 0x8d, 0x12, 0xbd, 0xcd, 0xb9, 0xb4, 0x10, 0x21, 0x62, 0x33, 0x37, 0x88, 0xc0, 0xba, 0xe5, 0x9f, 0x91, 0xcd, 0xfc, 0x17, 0x2c, 0x7a, 0x16, 0x81, 0xee, 0x44, 0xd9, 0x6a, 0xb2, 0x13, 0x5a, 0x6e, 0x5f, 0x34, 0x15, 0xeb, 0xbc, 0xd5, 0x51, 0x65, 0xb1, 0xaf, 0xb0, 3636 }; 3637 static const u8 ecccdh_SECP521R1_21_test_vector_peer_pub_key[] = { 3638 0x01, 0x6d, 0xac, 0xff, 0xa1, 0x83, 0xe5, 0x30, 0x30, 0x83, 0xa3, 0x34, 0xf7, 0x65, 0xde, 0x72, 0x4e, 0xc5, 0xec, 0x94, 0x02, 0x02, 0x6d, 0x47, 0x97, 0x88, 0x4a, 0x98, 0x28, 0xa0, 0xd3, 0x21, 0xa8, 0xcf, 0xac, 0x74, 0xab, 0x73, 0x7f, 0xe2, 0x0a, 0x7d, 0x6b, 0xef, 0xcf, 0xc7, 0x3b, 0x6a, 0x35, 0xc1, 0xc7, 0xb0, 0x1d, 0x37, 0x3e, 0x31, 0xab, 0xc1, 0x92, 0xd4, 0x8a, 0x42, 0x41, 0xa3, 0x58, 0x03, 0x01, 0x1e, 0x53, 0x27, 0xca, 0xc2, 0x2d, 0x30, 0x5e, 0x71, 0x56, 0xe5, 0x59, 0x17, 0x6e, 0x19, 0xbe, 0xe7, 0xe4, 0xf2, 0xf5, 0x9e, 0x86, 0xf1, 0xa9, 0xd0, 0xb6, 0x60, 0x3b, 0x6a, 0x7d, 0xf1, 0x06, 0x9b, 0xde, 0x63, 0x87, 0xfe, 0xb7, 0x15, 0x87, 0xb8, 0xff, 0xce, 0x5b, 0x26, 0x6e, 0x1b, 0xae, 0x86, 0xde, 0x29, 0x37, 0x8a, 0x34, 0xe5, 0xc7, 0x4b, 0x67, 0x24, 0xc4, 0xd4, 0x0a, 0x71, 0x99, 0x23, 3639 }; 3640 static const u8 ecccdh_SECP521R1_21_test_vector_our_pub_key[] = { 3641 0x00, 0xa8, 0xe2, 0x5a, 0x69, 0x02, 0xd6, 0x87, 0xb4, 0x78, 0x7c, 0xdc, 0x94, 0xc3, 0x64, 0xac, 0x7c, 0xec, 0xc5, 0xc4, 0x95, 0x48, 0x3e, 0xd3, 0x63, 0xdc, 0x0a, 0xa9, 0x5e, 0xe2, 0xbd, 0x73, 0x9c, 0x4c, 0x4d, 0x46, 0xb1, 0x70, 0x06, 0xc7, 0x28, 0xb0, 0x76, 0x35, 0x0d, 0x7d, 0x7e, 0x54, 0xc6, 0x82, 0x2f, 0x52, 0xf4, 0x71, 0x62, 0xa2, 0x51, 0x09, 0xaa, 0xab, 0xa6, 0x90, 0xca, 0xb6, 0x96, 0xec, 0x01, 0x68, 0xd2, 0xf0, 0x8f, 0xe1, 0x9e, 0x4d, 0xc9, 0xee, 0x7a, 0x19, 0x5b, 0x03, 0xc9, 0xf7, 0xfe, 0x66, 0x76, 0xf9, 0xf5, 0x20, 0xb6, 0x27, 0x05, 0x57, 0x50, 0x4e, 0x72, 0xca, 0x43, 0x94, 0xa2, 0xc6, 0x91, 0x86, 0x25, 0xe1, 0x5a, 0xc0, 0xc5, 0x1b, 0x8f, 0x95, 0xcd, 0x56, 0x01, 0x23, 0x65, 0x3f, 0xb8, 0xe8, 0xee, 0x6d, 0xb9, 0x61, 0xe2, 0xc4, 0xc6, 0x2c, 0xc5, 0x4e, 0x92, 0xe2, 0xa2, 0xa9, 3642 }; 3643 static const u8 ecccdh_SECP521R1_21_test_vector_shared_secret[] = { 3644 0x01, 0x4d, 0x60, 0x82, 0xa3, 0xb5, 0xce, 0xd1, 0xab, 0x8c, 0xa2, 0x65, 0xa8, 0x10, 0x6f, 0x30, 0x21, 0x46, 0xc4, 0xac, 0xb8, 0xc3, 0x0b, 0xb1, 0x4a, 0x4c, 0x99, 0x1e, 0x3c, 0x82, 0xa9, 0x73, 0x12, 0x88, 0xbd, 0xb9, 0x1e, 0x0e, 0x85, 0xbd, 0xa3, 0x13, 0x91, 0x2d, 0x06, 0x38, 0x4f, 0xc4, 0x4f, 0x21, 0x53, 0xfb, 0x13, 0x50, 0x6f, 0xa9, 0xcf, 0x43, 0xc9, 0xaa, 0xb5, 0x75, 0x09, 0x88, 0xc9, 0x43, 3645 }; 3646 static const ecdh_test_case ecccdh_SECP521R1_21_test_case = { 3647 .name = "ECCCDH/SECP521R1 21", 3648 .ecdh_type = ECCCDH, 3649 .ec_str_p = &secp521r1_str_params, 3650 .our_priv_key = ecccdh_SECP521R1_21_test_vector_our_priv_key, 3651 .our_priv_key_len = sizeof(ecccdh_SECP521R1_21_test_vector_our_priv_key), 3652 .peer_pub_key = ecccdh_SECP521R1_21_test_vector_peer_pub_key, 3653 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_21_test_vector_peer_pub_key), 3654 .exp_our_pub_key = ecccdh_SECP521R1_21_test_vector_our_pub_key, 3655 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_21_test_vector_our_pub_key), 3656 .exp_shared_secret = ecccdh_SECP521R1_21_test_vector_shared_secret, 3657 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_21_test_vector_shared_secret), 3658 }; 3659 #endif /* WITH_CURVE_SECP521R1 */ 3660 3661 #ifdef WITH_CURVE_SECP521R1 3662 #define ECCCDH_SECP521R1_SELF_TEST_22 3663 /*** Tests for ECCCDH/SECP521R1 ***/ 3664 static const u8 ecccdh_SECP521R1_22_test_vector_our_priv_key[] = { 3665 0x00, 0x00, 0x00, 0xf4, 0x30, 0xca, 0x12, 0x61, 0xf0, 0x96, 0x81, 0xa9, 0x28, 0x2e, 0x9e, 0x97, 0x0a, 0x92, 0x34, 0x22, 0x7b, 0x1d, 0x5e, 0x58, 0xd5, 0x58, 0xc3, 0xcc, 0x6e, 0xff, 0x44, 0xd1, 0xbd, 0xf5, 0x3d, 0xe1, 0x6a, 0xd5, 0xee, 0x2b, 0x18, 0xb9, 0x2d, 0x62, 0xfc, 0x79, 0x58, 0x61, 0x16, 0xb0, 0xef, 0xc1, 0x5f, 0x79, 0x34, 0x0f, 0xb7, 0xea, 0xf5, 0xce, 0x6c, 0x44, 0x34, 0x1d, 0xcf, 0x8d, 0xde, 0x27, 3666 }; 3667 static const u8 ecccdh_SECP521R1_22_test_vector_peer_pub_key[] = { 3668 0x00, 0xa0, 0x91, 0x42, 0x1d, 0x37, 0x03, 0xe3, 0xb3, 0x41, 0xe9, 0xf1, 0xe7, 0xd5, 0x8f, 0x8c, 0xf7, 0xbd, 0xbd, 0x17, 0x98, 0xd0, 0x01, 0x96, 0x7b, 0x80, 0x1d, 0x1c, 0xec, 0x27, 0xe6, 0x05, 0xc5, 0x80, 0xb2, 0x38, 0x7c, 0x1c, 0xb4, 0x64, 0xf5, 0x5c, 0xe7, 0xac, 0x80, 0x33, 0x41, 0x02, 0xab, 0x03, 0xcf, 0xb8, 0x6d, 0x88, 0xaf, 0x76, 0xc9, 0xf4, 0x12, 0x9c, 0x01, 0xbe, 0xdd, 0x3b, 0xbf, 0xc4, 0x00, 0x8c, 0x9c, 0x57, 0x7a, 0x8e, 0x6f, 0xc4, 0x46, 0x81, 0x5e, 0x9d, 0x40, 0xba, 0xa6, 0x60, 0x25, 0xf1, 0x5d, 0xae, 0x28, 0x5f, 0x19, 0xeb, 0x66, 0x8e, 0xe6, 0x0a, 0xe9, 0xc9, 0x8e, 0x7e, 0xcd, 0xbf, 0x2b, 0x2a, 0x68, 0xe2, 0x29, 0x28, 0x05, 0x9f, 0x67, 0xdb, 0x18, 0x80, 0x07, 0x16, 0x1d, 0x3e, 0xcf, 0x39, 0x7e, 0x08, 0x83, 0xf0, 0xc4, 0xeb, 0x7e, 0xaf, 0x78, 0x27, 0xa6, 0x22, 0x05, 0xcc, 3669 }; 3670 static const u8 ecccdh_SECP521R1_22_test_vector_our_pub_key[] = { 3671 0x00, 0x6c, 0x1d, 0x9b, 0x5e, 0xca, 0x87, 0xde, 0x1f, 0xb8, 0x71, 0xa0, 0xa3, 0x2f, 0x80, 0x7c, 0x72, 0x5a, 0xdc, 0xcd, 0xe9, 0xb3, 0x96, 0x74, 0x53, 0xa7, 0x13, 0x47, 0xd6, 0x08, 0xf0, 0xc0, 0x30, 0xcd, 0x09, 0xe3, 0x38, 0xcd, 0xec, 0xbf, 0x4a, 0x02, 0x01, 0x5b, 0xc8, 0xa6, 0xe8, 0xd3, 0xe2, 0x59, 0x5f, 0xe7, 0x73, 0xff, 0xc2, 0xfc, 0x4e, 0x4a, 0x55, 0xd0, 0xb1, 0xa2, 0xcc, 0x00, 0x32, 0x3b, 0x01, 0x14, 0x1b, 0x21, 0x09, 0xe7, 0xf4, 0x98, 0x1c, 0x95, 0x2a, 0xa8, 0x18, 0xa2, 0xb9, 0xf6, 0xf5, 0xc4, 0x1f, 0xec, 0xcd, 0xb7, 0xa7, 0xa4, 0x5b, 0x9b, 0x4b, 0x67, 0x29, 0x37, 0x77, 0x1b, 0x00, 0x8c, 0xae, 0x5f, 0x93, 0x4d, 0xfe, 0x3f, 0xed, 0x10, 0xd3, 0x83, 0xab, 0x1f, 0x38, 0x76, 0x9c, 0x92, 0xce, 0x88, 0xd9, 0xbe, 0x54, 0x14, 0x81, 0x7e, 0xcb, 0x07, 0x3a, 0x31, 0xab, 0x36, 0x8c, 0xcb, 3672 }; 3673 static const u8 ecccdh_SECP521R1_22_test_vector_shared_secret[] = { 3674 0x00, 0x20, 0xc0, 0x07, 0x47, 0xcb, 0x8d, 0x49, 0x2f, 0xd4, 0x97, 0xe0, 0xfe, 0xc5, 0x46, 0x44, 0xbf, 0x02, 0x7d, 0x41, 0x8a, 0xb6, 0x86, 0x38, 0x1f, 0x10, 0x97, 0x12, 0xa9, 0x9c, 0xab, 0xe3, 0x28, 0xb9, 0x74, 0x3d, 0x22, 0x25, 0x83, 0x6f, 0x9a, 0xd6, 0x6e, 0x5d, 0x7f, 0xed, 0x1d, 0xe2, 0x47, 0xe0, 0xda, 0x92, 0xf6, 0x0d, 0x5b, 0x31, 0xf9, 0xe4, 0x76, 0x72, 0xe5, 0x7f, 0x71, 0x05, 0x98, 0xf4, 3675 }; 3676 static const ecdh_test_case ecccdh_SECP521R1_22_test_case = { 3677 .name = "ECCCDH/SECP521R1 22", 3678 .ecdh_type = ECCCDH, 3679 .ec_str_p = &secp521r1_str_params, 3680 .our_priv_key = ecccdh_SECP521R1_22_test_vector_our_priv_key, 3681 .our_priv_key_len = sizeof(ecccdh_SECP521R1_22_test_vector_our_priv_key), 3682 .peer_pub_key = ecccdh_SECP521R1_22_test_vector_peer_pub_key, 3683 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_22_test_vector_peer_pub_key), 3684 .exp_our_pub_key = ecccdh_SECP521R1_22_test_vector_our_pub_key, 3685 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_22_test_vector_our_pub_key), 3686 .exp_shared_secret = ecccdh_SECP521R1_22_test_vector_shared_secret, 3687 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_22_test_vector_shared_secret), 3688 }; 3689 #endif /* WITH_CURVE_SECP521R1 */ 3690 3691 #ifdef WITH_CURVE_SECP521R1 3692 #define ECCCDH_SECP521R1_SELF_TEST_23 3693 /*** Tests for ECCCDH/SECP521R1 ***/ 3694 static const u8 ecccdh_SECP521R1_23_test_vector_our_priv_key[] = { 3695 0x00, 0x00, 0x00, 0x5d, 0xc3, 0x3a, 0xed, 0xa0, 0x3c, 0x2e, 0xb2, 0x33, 0x01, 0x4e, 0xe4, 0x68, 0xdf, 0xf7, 0x53, 0xb7, 0x2f, 0x73, 0xb0, 0x09, 0x91, 0x04, 0x3e, 0xa3, 0x53, 0x82, 0x8a, 0xe6, 0x9d, 0x4c, 0xd0, 0xfa, 0xde, 0xda, 0x7b, 0xb2, 0x78, 0xb5, 0x35, 0xd7, 0xc5, 0x74, 0x06, 0xff, 0x2e, 0x6e, 0x47, 0x3a, 0x5a, 0x4f, 0xf9, 0x8e, 0x90, 0xf9, 0x0d, 0x6d, 0xad, 0xd2, 0x51, 0x00, 0xe8, 0xd8, 0x56, 0x66, 3696 }; 3697 static const u8 ecccdh_SECP521R1_23_test_vector_peer_pub_key[] = { 3698 0x00, 0x4f, 0x38, 0x81, 0x66, 0x81, 0x77, 0x12, 0x89, 0xce, 0x0c, 0xb8, 0x3a, 0x5e, 0x29, 0xa1, 0xab, 0x06, 0xfc, 0x91, 0xf7, 0x86, 0x99, 0x4b, 0x23, 0x70, 0x8f, 0xf0, 0x8a, 0x08, 0xa0, 0xf6, 0x75, 0xb8, 0x09, 0xae, 0x99, 0xe9, 0xf9, 0x96, 0x7e, 0xb1, 0xa4, 0x9f, 0x19, 0x60, 0x57, 0xd6, 0x9e, 0x50, 0xd6, 0xde, 0xdb, 0x4d, 0xd2, 0xd9, 0xa8, 0x1c, 0x02, 0xbd, 0xcc, 0x8f, 0x7f, 0x51, 0x84, 0x60, 0x00, 0x9e, 0xfb, 0x24, 0x4c, 0x8b, 0x91, 0x08, 0x7d, 0xe1, 0xee, 0xd7, 0x66, 0x50, 0x0f, 0x0e, 0x81, 0x53, 0x07, 0x52, 0xd4, 0x69, 0x25, 0x6e, 0xf7, 0x9f, 0x6b, 0x96, 0x5d, 0x8a, 0x22, 0x32, 0xa0, 0xc2, 0xdb, 0xc4, 0xe8, 0xe1, 0xd0, 0x92, 0x14, 0xba, 0xb3, 0x84, 0x85, 0xbe, 0x6e, 0x35, 0x7c, 0x42, 0x00, 0xd0, 0x73, 0xb5, 0x2f, 0x04, 0xe4, 0xa1, 0x6f, 0xc6, 0xf5, 0x24, 0x71, 0x87, 0xae, 0xcb, 3699 }; 3700 static const u8 ecccdh_SECP521R1_23_test_vector_our_pub_key[] = { 3701 0x00, 0xc8, 0x25, 0xba, 0x30, 0x73, 0x73, 0xce, 0xc8, 0xdd, 0x24, 0x98, 0xee, 0xf8, 0x2e, 0x21, 0xfd, 0x98, 0x62, 0x16, 0x8d, 0xbf, 0xeb, 0x83, 0x59, 0x39, 0x80, 0xca, 0x9f, 0x82, 0x87, 0x53, 0x33, 0x89, 0x9f, 0xe9, 0x4f, 0x13, 0x7d, 0xaf, 0x1c, 0x41, 0x89, 0xeb, 0x50, 0x29, 0x37, 0xc3, 0xa3, 0x67, 0xea, 0x79, 0x51, 0xed, 0x8b, 0x0f, 0x33, 0x77, 0xfc, 0xdf, 0x29, 0x22, 0x02, 0x1d, 0x46, 0xa5, 0x01, 0x6b, 0x8a, 0x25, 0x40, 0xd5, 0xe6, 0x54, 0x93, 0x88, 0x8b, 0xc3, 0x37, 0x24, 0x9e, 0x67, 0xc0, 0xa6, 0x87, 0x74, 0xf3, 0xe8, 0xd8, 0x1e, 0x3b, 0x45, 0x74, 0xa0, 0x12, 0x51, 0x65, 0xf0, 0xbd, 0x58, 0xb8, 0xaf, 0x9d, 0xe7, 0x4b, 0x35, 0x83, 0x25, 0x39, 0xf9, 0x5c, 0x3c, 0xd9, 0xf1, 0xb7, 0x59, 0x40, 0x85, 0x60, 0xaa, 0x68, 0x51, 0xae, 0x3a, 0xc7, 0x55, 0x53, 0x47, 0xb0, 0xd3, 0xb1, 0x3b, 3702 }; 3703 static const u8 ecccdh_SECP521R1_23_test_vector_shared_secret[] = { 3704 0x00, 0xc2, 0xbf, 0xaf, 0xcd, 0x7f, 0xbd, 0x3e, 0x2f, 0xd1, 0xc7, 0x50, 0xfd, 0xea, 0x61, 0xe7, 0x0b, 0xd4, 0x78, 0x7a, 0x7e, 0x68, 0x46, 0x8c, 0x57, 0x4e, 0xe9, 0x9e, 0xbc, 0x47, 0xee, 0xde, 0xf0, 0x64, 0xe8, 0x94, 0x4a, 0x73, 0xbc, 0xb7, 0x91, 0x3d, 0xba, 0xb5, 0xd9, 0x3d, 0xca, 0x66, 0x0d, 0x21, 0x6c, 0x55, 0x36, 0x22, 0x36, 0x27, 0x94, 0xf7, 0xa2, 0xac, 0xc7, 0x10, 0x22, 0xbd, 0xb1, 0x6f, 3705 }; 3706 static const ecdh_test_case ecccdh_SECP521R1_23_test_case = { 3707 .name = "ECCCDH/SECP521R1 23", 3708 .ecdh_type = ECCCDH, 3709 .ec_str_p = &secp521r1_str_params, 3710 .our_priv_key = ecccdh_SECP521R1_23_test_vector_our_priv_key, 3711 .our_priv_key_len = sizeof(ecccdh_SECP521R1_23_test_vector_our_priv_key), 3712 .peer_pub_key = ecccdh_SECP521R1_23_test_vector_peer_pub_key, 3713 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_23_test_vector_peer_pub_key), 3714 .exp_our_pub_key = ecccdh_SECP521R1_23_test_vector_our_pub_key, 3715 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_23_test_vector_our_pub_key), 3716 .exp_shared_secret = ecccdh_SECP521R1_23_test_vector_shared_secret, 3717 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_23_test_vector_shared_secret), 3718 }; 3719 #endif /* WITH_CURVE_SECP521R1 */ 3720 3721 #ifdef WITH_CURVE_SECP521R1 3722 #define ECCCDH_SECP521R1_SELF_TEST_24 3723 /*** Tests for ECCCDH/SECP521R1 ***/ 3724 static const u8 ecccdh_SECP521R1_24_test_vector_our_priv_key[] = { 3725 0x00, 0x00, 0x00, 0xdf, 0x14, 0xb1, 0xf1, 0x43, 0x2a, 0x7b, 0x0f, 0xb0, 0x53, 0x96, 0x5f, 0xd8, 0x64, 0x3a, 0xfe, 0xe2, 0x6b, 0x24, 0x51, 0xec, 0xb6, 0xa8, 0xa5, 0x3a, 0x65, 0x5d, 0x5f, 0xbe, 0x16, 0xe4, 0xc6, 0x4c, 0xe8, 0x64, 0x72, 0x25, 0xeb, 0x11, 0xe7, 0xfd, 0xcb, 0x23, 0x62, 0x74, 0x71, 0xdf, 0xfc, 0x5c, 0x25, 0x23, 0xbd, 0x2a, 0xe8, 0x99, 0x57, 0xcb, 0xa3, 0xa5, 0x7a, 0x23, 0x93, 0x3e, 0x5a, 0x78, 3726 }; 3727 static const u8 ecccdh_SECP521R1_24_test_vector_peer_pub_key[] = { 3728 0x01, 0xa3, 0x20, 0x99, 0xb0, 0x2c, 0x0b, 0xd8, 0x53, 0x71, 0xf6, 0x0b, 0x0d, 0xd2, 0x08, 0x90, 0xe6, 0xc7, 0xaf, 0x04, 0x8c, 0x81, 0x79, 0x89, 0x0f, 0xda, 0x30, 0x8b, 0x35, 0x9d, 0xbb, 0xc2, 0xb7, 0xa8, 0x32, 0xbb, 0x8c, 0x65, 0x26, 0xc4, 0xaf, 0x99, 0xa7, 0xea, 0x3f, 0x0b, 0x3c, 0xb9, 0x6a, 0xe1, 0xeb, 0x76, 0x84, 0x13, 0x27, 0x95, 0xc4, 0x78, 0xad, 0x6f, 0x96, 0x2e, 0x4a, 0x6f, 0x44, 0x6d, 0x01, 0x76, 0x27, 0x35, 0x7b, 0x39, 0xe9, 0xd7, 0x63, 0x2a, 0x13, 0x70, 0xb3, 0xe9, 0x3c, 0x1a, 0xfb, 0x5c, 0x85, 0x1b, 0x91, 0x0e, 0xb4, 0xea, 0xd0, 0xc9, 0xd3, 0x87, 0xdf, 0x67, 0xcd, 0xe8, 0x50, 0x03, 0xe0, 0xe4, 0x27, 0x55, 0x2f, 0x1c, 0xd0, 0x90, 0x59, 0xaa, 0xd0, 0x26, 0x2e, 0x23, 0x5c, 0xce, 0x5f, 0xba, 0x8c, 0xed, 0xc4, 0xfd, 0xc1, 0x46, 0x3d, 0xa7, 0x6d, 0xcd, 0x4b, 0x6d, 0x1a, 0x46, 3729 }; 3730 static const u8 ecccdh_SECP521R1_24_test_vector_our_pub_key[] = { 3731 0x00, 0x4e, 0x85, 0x83, 0xbb, 0xbb, 0x2e, 0xcd, 0x93, 0xf0, 0x71, 0x4c, 0x33, 0x2d, 0xff, 0x5a, 0xb3, 0xbc, 0x63, 0x96, 0xe6, 0x2f, 0x3c, 0x56, 0x02, 0x29, 0x66, 0x43, 0x29, 0xba, 0xa5, 0x13, 0x8c, 0x3b, 0xb1, 0xc3, 0x64, 0x28, 0xab, 0xd4, 0xe2, 0x3d, 0x17, 0xfc, 0xb7, 0xa2, 0xcf, 0xcc, 0x22, 0x4b, 0x2e, 0x73, 0x4c, 0x89, 0x41, 0xf6, 0xf1, 0x21, 0x72, 0x2d, 0x7b, 0x6b, 0x94, 0x15, 0x45, 0x76, 0x01, 0xcf, 0x08, 0x74, 0xf2, 0x04, 0xb0, 0x36, 0x3f, 0x02, 0x08, 0x64, 0x67, 0x2f, 0xad, 0xbf, 0x87, 0xc8, 0x81, 0x1e, 0xb1, 0x47, 0x75, 0x8b, 0x25, 0x4b, 0x74, 0xb1, 0x4f, 0xae, 0x74, 0x21, 0x59, 0xf0, 0xf6, 0x71, 0xa0, 0x18, 0x21, 0x2b, 0xbf, 0x25, 0xb8, 0x51, 0x9e, 0x12, 0x6d, 0x4c, 0xad, 0x77, 0x8c, 0xff, 0xf5, 0x0d, 0x28, 0x8f, 0xd3, 0x9c, 0xeb, 0x0c, 0xac, 0x63, 0x5b, 0x17, 0x5e, 0xc0, 3732 }; 3733 static const u8 ecccdh_SECP521R1_24_test_vector_shared_secret[] = { 3734 0x01, 0xaa, 0xf2, 0x4e, 0x5d, 0x47, 0xe4, 0x08, 0x0c, 0x18, 0xc5, 0x5e, 0xa3, 0x55, 0x81, 0xcd, 0x8d, 0xa3, 0x0f, 0x1a, 0x07, 0x95, 0x65, 0x04, 0x5d, 0x20, 0x08, 0xd5, 0x1b, 0x12, 0xd0, 0xab, 0xb4, 0x41, 0x1c, 0xda, 0x7a, 0x07, 0x85, 0xb1, 0x5d, 0x14, 0x9e, 0xd3, 0x01, 0xa3, 0x69, 0x70, 0x62, 0xf4, 0x2d, 0xa2, 0x37, 0xaa, 0x7f, 0x07, 0xe0, 0xaf, 0x3f, 0xd0, 0x0e, 0xb1, 0x80, 0x0d, 0x9c, 0x41, 3735 }; 3736 static const ecdh_test_case ecccdh_SECP521R1_24_test_case = { 3737 .name = "ECCCDH/SECP521R1 24", 3738 .ecdh_type = ECCCDH, 3739 .ec_str_p = &secp521r1_str_params, 3740 .our_priv_key = ecccdh_SECP521R1_24_test_vector_our_priv_key, 3741 .our_priv_key_len = sizeof(ecccdh_SECP521R1_24_test_vector_our_priv_key), 3742 .peer_pub_key = ecccdh_SECP521R1_24_test_vector_peer_pub_key, 3743 .peer_pub_key_len = sizeof(ecccdh_SECP521R1_24_test_vector_peer_pub_key), 3744 .exp_our_pub_key = ecccdh_SECP521R1_24_test_vector_our_pub_key, 3745 .exp_our_pub_key_len = sizeof(ecccdh_SECP521R1_24_test_vector_our_pub_key), 3746 .exp_shared_secret = ecccdh_SECP521R1_24_test_vector_shared_secret, 3747 .exp_shared_secret_len = sizeof(ecccdh_SECP521R1_24_test_vector_shared_secret), 3748 }; 3749 #endif /* WITH_CURVE_SECP521R1 */ 3750 3751