1 /* 2 * Copyright (C) 2021 - This file is part of libecc project 3 * 4 * Authors: 5 * Ryad BENADJILA <ryadbenadjila@gmail.com> 6 * Arnaud EBALARD <arnaud.ebalard@ssi.gouv.fr> 7 * 8 * This software is licensed under a dual BSD and GPL v2 license. 9 * See LICENSE file at the root folder of the project. 10 */ 11 #ifdef WITH_HASH_SHA224 12 #ifdef WITH_CURVE_SECP192R1 13 #define DECDSA_SHA224_SECP192R1_SELF_TEST_0 14 /*** Tests for DECDSA-SHA224/SECP192R1 ***/ 15 static const u8 decdsa_rfc6979_SECP192R1_SHA224_0_test_vector_expected_sig[] = { 16 0xa1, 0xf0, 0x0d, 0xad, 0x97, 0xae, 0xec, 0x91, 17 0xc9, 0x55, 0x85, 0xf3, 0x62, 0x00, 0xc6, 0x5f, 18 0x3c, 0x01, 0x81, 0x2a, 0xa6, 0x03, 0x78, 0xf5, 19 0xe0, 0x7e, 0xc1, 0x30, 0x4c, 0x7c, 0x6c, 0x9d, 20 0xeb, 0xbe, 0x98, 0x0b, 0x96, 0x92, 0x66, 0x8f, 21 0x81, 0xd4, 0xde, 0x79, 0x22, 0xa0, 0xf9, 0x7a 22 }; 23 static const u8 decdsa_rfc6979_SECP192R1_SHA224_0_test_vector_priv_key[] = { 24 0x6f, 0xab, 0x03, 0x49, 0x34, 0xe4, 0xc0, 0xfc, 25 0x9a, 0xe6, 0x7f, 0x5b, 0x56, 0x59, 0xa9, 0xd7, 26 0xd1, 0xfe, 0xfd, 0x18, 0x7e, 0xe0, 0x9f, 0xd4 27 }; 28 static const ec_test_case decdsa_rfc6979_SECP192R1_SHA224_0_test_case = { 29 .name="DECDSA-SHA224/SECP192R1 0", 30 .ec_str_p = &secp192r1_str_params, 31 .priv_key = decdsa_rfc6979_SECP192R1_SHA224_0_test_vector_priv_key, 32 .priv_key_len = sizeof(decdsa_rfc6979_SECP192R1_SHA224_0_test_vector_priv_key), 33 .nn_random = NULL, 34 .hash_type = SHA224, 35 .msg = "sample", 36 .msglen = 6, 37 .sig_type = DECDSA, 38 .exp_sig = decdsa_rfc6979_SECP192R1_SHA224_0_test_vector_expected_sig, 39 .exp_siglen = sizeof(decdsa_rfc6979_SECP192R1_SHA224_0_test_vector_expected_sig), 40 .adata = NULL, 41 .adata_len = 0 42 }; 43 #endif /* WITH_CURVE_SECP192R1 */ 44 #endif /* WITH_HASH_SHA224 */ 45 46 #ifdef WITH_HASH_SHA256 47 #ifdef WITH_CURVE_SECP192R1 48 #define DECDSA_SHA256_SECP192R1_SELF_TEST_0 49 /*** Tests for DECDSA-SHA256/SECP192R1 ***/ 50 static const u8 decdsa_rfc6979_SECP192R1_SHA256_0_test_vector_expected_sig[] = { 51 0x4b, 0x0b, 0x8c, 0xe9, 0x8a, 0x92, 0x86, 0x6a, 52 0x28, 0x20, 0xe2, 0x0a, 0xa6, 0xb7, 0x5b, 0x56, 53 0x38, 0x2e, 0x0f, 0x9b, 0xfd, 0x5e, 0xcb, 0x55, 54 0xcc, 0xdb, 0x00, 0x69, 0x26, 0xea, 0x95, 0x65, 55 0xcb, 0xad, 0xc8, 0x40, 0x82, 0x9d, 0x8c, 0x38, 56 0x4e, 0x06, 0xde, 0x1f, 0x1e, 0x38, 0x1b, 0x85 57 }; 58 static const u8 decdsa_rfc6979_SECP192R1_SHA256_0_test_vector_priv_key[] = { 59 0x6f, 0xab, 0x03, 0x49, 0x34, 0xe4, 0xc0, 0xfc, 60 0x9a, 0xe6, 0x7f, 0x5b, 0x56, 0x59, 0xa9, 0xd7, 61 0xd1, 0xfe, 0xfd, 0x18, 0x7e, 0xe0, 0x9f, 0xd4 62 }; 63 static const ec_test_case decdsa_rfc6979_SECP192R1_SHA256_0_test_case = { 64 .name="DECDSA-SHA256/SECP192R1 0", 65 .ec_str_p = &secp192r1_str_params, 66 .priv_key = decdsa_rfc6979_SECP192R1_SHA256_0_test_vector_priv_key, 67 .priv_key_len = sizeof(decdsa_rfc6979_SECP192R1_SHA256_0_test_vector_priv_key), 68 .nn_random = NULL, 69 .hash_type = SHA256, 70 .msg = "sample", 71 .msglen = 6, 72 .sig_type = DECDSA, 73 .exp_sig = decdsa_rfc6979_SECP192R1_SHA256_0_test_vector_expected_sig, 74 .exp_siglen = sizeof(decdsa_rfc6979_SECP192R1_SHA256_0_test_vector_expected_sig), 75 .adata = NULL, 76 .adata_len = 0 77 }; 78 #endif /* WITH_CURVE_SECP192R1 */ 79 #endif /* WITH_HASH_SHA256 */ 80 81 #ifdef WITH_HASH_SHA384 82 #ifdef WITH_CURVE_SECP192R1 83 #define DECDSA_SHA384_SECP192R1_SELF_TEST_0 84 /*** Tests for DECDSA-SHA384/SECP192R1 ***/ 85 static const u8 decdsa_rfc6979_SECP192R1_SHA384_0_test_vector_expected_sig[] = { 86 0xda, 0x63, 0xbf, 0x0b, 0x9a, 0xbc, 0xf9, 0x48, 87 0xfb, 0xb1, 0xe9, 0x16, 0x7f, 0x13, 0x61, 0x45, 88 0xf7, 0xa2, 0x04, 0x26, 0xdc, 0xc2, 0x87, 0xd5, 89 0xc3, 0xaa, 0x2c, 0x96, 0x09, 0x72, 0xbd, 0x7a, 90 0x20, 0x03, 0xa5, 0x7e, 0x1c, 0x4c, 0x77, 0xf0, 91 0x57, 0x8f, 0x8a, 0xe9, 0x5e, 0x31, 0xec, 0x5e 92 }; 93 static const u8 decdsa_rfc6979_SECP192R1_SHA384_0_test_vector_priv_key[] = { 94 0x6f, 0xab, 0x03, 0x49, 0x34, 0xe4, 0xc0, 0xfc, 95 0x9a, 0xe6, 0x7f, 0x5b, 0x56, 0x59, 0xa9, 0xd7, 96 0xd1, 0xfe, 0xfd, 0x18, 0x7e, 0xe0, 0x9f, 0xd4 97 }; 98 static const ec_test_case decdsa_rfc6979_SECP192R1_SHA384_0_test_case = { 99 .name="DECDSA-SHA384/SECP192R1 0", 100 .ec_str_p = &secp192r1_str_params, 101 .priv_key = decdsa_rfc6979_SECP192R1_SHA384_0_test_vector_priv_key, 102 .priv_key_len = sizeof(decdsa_rfc6979_SECP192R1_SHA384_0_test_vector_priv_key), 103 .nn_random = NULL, 104 .hash_type = SHA384, 105 .msg = "sample", 106 .msglen = 6, 107 .sig_type = DECDSA, 108 .exp_sig = decdsa_rfc6979_SECP192R1_SHA384_0_test_vector_expected_sig, 109 .exp_siglen = sizeof(decdsa_rfc6979_SECP192R1_SHA384_0_test_vector_expected_sig), 110 .adata = NULL, 111 .adata_len = 0 112 }; 113 #endif /* WITH_CURVE_SECP192R1 */ 114 #endif /* WITH_HASH_SHA384 */ 115 116 #ifdef WITH_HASH_SHA512 117 #ifdef WITH_CURVE_SECP192R1 118 #define DECDSA_SHA512_SECP192R1_SELF_TEST_0 119 /*** Tests for DECDSA-SHA512/SECP192R1 ***/ 120 static const u8 decdsa_rfc6979_SECP192R1_SHA512_0_test_vector_expected_sig[] = { 121 0x4d, 0x60, 0xc5, 0xab, 0x19, 0x96, 0xbd, 0x84, 122 0x83, 0x43, 0xb3, 0x1c, 0x00, 0x85, 0x02, 0x05, 123 0xe2, 0xea, 0x69, 0x22, 0xda, 0xc2, 0xe4, 0xb8, 124 0x3f, 0x6e, 0x83, 0x74, 0x48, 0xf0, 0x27, 0xa1, 125 0xbf, 0x4b, 0x34, 0xe7, 0x96, 0xe3, 0x2a, 0x81, 126 0x1c, 0xbb, 0x40, 0x50, 0x90, 0x8d, 0x8f, 0x67 127 }; 128 static const u8 decdsa_rfc6979_SECP192R1_SHA512_0_test_vector_priv_key[] = { 129 0x6f, 0xab, 0x03, 0x49, 0x34, 0xe4, 0xc0, 0xfc, 130 0x9a, 0xe6, 0x7f, 0x5b, 0x56, 0x59, 0xa9, 0xd7, 131 0xd1, 0xfe, 0xfd, 0x18, 0x7e, 0xe0, 0x9f, 0xd4 132 }; 133 static const ec_test_case decdsa_rfc6979_SECP192R1_SHA512_0_test_case = { 134 .name="DECDSA-SHA512/SECP192R1 0", 135 .ec_str_p = &secp192r1_str_params, 136 .priv_key = decdsa_rfc6979_SECP192R1_SHA512_0_test_vector_priv_key, 137 .priv_key_len = sizeof(decdsa_rfc6979_SECP192R1_SHA512_0_test_vector_priv_key), 138 .nn_random = NULL, 139 .hash_type = SHA512, 140 .msg = "sample", 141 .msglen = 6, 142 .sig_type = DECDSA, 143 .exp_sig = decdsa_rfc6979_SECP192R1_SHA512_0_test_vector_expected_sig, 144 .exp_siglen = sizeof(decdsa_rfc6979_SECP192R1_SHA512_0_test_vector_expected_sig), 145 .adata = NULL, 146 .adata_len = 0 147 }; 148 #endif /* WITH_CURVE_SECP192R1 */ 149 #endif /* WITH_HASH_SHA512 */ 150 151 #ifdef WITH_HASH_SHA224 152 #ifdef WITH_CURVE_SECP192R1 153 #define DECDSA_SHA224_SECP192R1_SELF_TEST_1 154 /*** Tests for DECDSA-SHA224/SECP192R1 ***/ 155 static const u8 decdsa_rfc6979_SECP192R1_SHA224_1_test_vector_expected_sig[] = { 156 0x69, 0x45, 0xa1, 0xc1, 0xd1, 0xb2, 0x20, 0x6b, 157 0x81, 0x45, 0x54, 0x8f, 0x63, 0x3b, 0xb6, 0x1c, 158 0xef, 0x04, 0x89, 0x1b, 0xaf, 0x26, 0xed, 0x34, 159 0xb7, 0xfb, 0x7f, 0xdf, 0xc3, 0x39, 0xc0, 0xb9, 160 0xbd, 0x61, 0xa9, 0xf5, 0xa8, 0xea, 0xf9, 0xbe, 161 0x58, 0xfc, 0x5c, 0xba, 0x2c, 0xb1, 0x52, 0x93 162 }; 163 static const u8 decdsa_rfc6979_SECP192R1_SHA224_1_test_vector_priv_key[] = { 164 0x6f, 0xab, 0x03, 0x49, 0x34, 0xe4, 0xc0, 0xfc, 165 0x9a, 0xe6, 0x7f, 0x5b, 0x56, 0x59, 0xa9, 0xd7, 166 0xd1, 0xfe, 0xfd, 0x18, 0x7e, 0xe0, 0x9f, 0xd4 167 }; 168 static const ec_test_case decdsa_rfc6979_SECP192R1_SHA224_1_test_case = { 169 .name="DECDSA-SHA224/SECP192R1 1", 170 .ec_str_p = &secp192r1_str_params, 171 .priv_key = decdsa_rfc6979_SECP192R1_SHA224_1_test_vector_priv_key, 172 .priv_key_len = sizeof(decdsa_rfc6979_SECP192R1_SHA224_1_test_vector_priv_key), 173 .nn_random = NULL, 174 .hash_type = SHA224, 175 .msg = "test", 176 .msglen = 4, 177 .sig_type = DECDSA, 178 .exp_sig = decdsa_rfc6979_SECP192R1_SHA224_1_test_vector_expected_sig, 179 .exp_siglen = sizeof(decdsa_rfc6979_SECP192R1_SHA224_1_test_vector_expected_sig), 180 .adata = NULL, 181 .adata_len = 0 182 }; 183 #endif /* WITH_CURVE_SECP192R1 */ 184 #endif /* WITH_HASH_SHA224 */ 185 186 #ifdef WITH_HASH_SHA256 187 #ifdef WITH_CURVE_SECP192R1 188 #define DECDSA_SHA256_SECP192R1_SELF_TEST_1 189 /*** Tests for DECDSA-SHA256/SECP192R1 ***/ 190 static const u8 decdsa_rfc6979_SECP192R1_SHA256_1_test_vector_expected_sig[] = { 191 0x3a, 0x71, 0x8b, 0xd8, 0xb4, 0x92, 0x6c, 0x3b, 192 0x52, 0xee, 0x6b, 0xbe, 0x67, 0xef, 0x79, 0xb1, 193 0x8c, 0xb6, 0xeb, 0x62, 0xb1, 0xad, 0x97, 0xae, 194 0x56, 0x62, 0xe6, 0x84, 0x8a, 0x4a, 0x19, 0xb1, 195 0xf1, 0xae, 0x2f, 0x72, 0xac, 0xd4, 0xb8, 0xbb, 196 0xe5, 0x0f, 0x1e, 0xac, 0x65, 0xd9, 0x12, 0x4f 197 }; 198 static const u8 decdsa_rfc6979_SECP192R1_SHA256_1_test_vector_priv_key[] = { 199 0x6f, 0xab, 0x03, 0x49, 0x34, 0xe4, 0xc0, 0xfc, 200 0x9a, 0xe6, 0x7f, 0x5b, 0x56, 0x59, 0xa9, 0xd7, 201 0xd1, 0xfe, 0xfd, 0x18, 0x7e, 0xe0, 0x9f, 0xd4 202 }; 203 static const ec_test_case decdsa_rfc6979_SECP192R1_SHA256_1_test_case = { 204 .name="DECDSA-SHA256/SECP192R1 1", 205 .ec_str_p = &secp192r1_str_params, 206 .priv_key = decdsa_rfc6979_SECP192R1_SHA256_1_test_vector_priv_key, 207 .priv_key_len = sizeof(decdsa_rfc6979_SECP192R1_SHA256_1_test_vector_priv_key), 208 .nn_random = NULL, 209 .hash_type = SHA256, 210 .msg = "test", 211 .msglen = 4, 212 .sig_type = DECDSA, 213 .exp_sig = decdsa_rfc6979_SECP192R1_SHA256_1_test_vector_expected_sig, 214 .exp_siglen = sizeof(decdsa_rfc6979_SECP192R1_SHA256_1_test_vector_expected_sig), 215 .adata = NULL, 216 .adata_len = 0 217 }; 218 #endif /* WITH_CURVE_SECP192R1 */ 219 #endif /* WITH_HASH_SHA256 */ 220 221 #ifdef WITH_HASH_SHA384 222 #ifdef WITH_CURVE_SECP192R1 223 #define DECDSA_SHA384_SECP192R1_SELF_TEST_1 224 /*** Tests for DECDSA-SHA384/SECP192R1 ***/ 225 static const u8 decdsa_rfc6979_SECP192R1_SHA384_1_test_vector_expected_sig[] = { 226 0xb2, 0x34, 0xb6, 0x0b, 0x4d, 0xb7, 0x5a, 0x73, 227 0x3e, 0x19, 0x28, 0x0a, 0x7a, 0x60, 0x34, 0xbd, 228 0x6b, 0x1e, 0xe8, 0x8a, 0xf5, 0x33, 0x23, 0x67, 229 0x79, 0x94, 0x09, 0x0b, 0x2d, 0x59, 0xbb, 0x78, 230 0x2b, 0xe5, 0x7e, 0x74, 0xa4, 0x4c, 0x9a, 0x1c, 231 0x70, 0x04, 0x13, 0xf8, 0xab, 0xef, 0xe7, 0x7a 232 }; 233 static const u8 decdsa_rfc6979_SECP192R1_SHA384_1_test_vector_priv_key[] = { 234 0x6f, 0xab, 0x03, 0x49, 0x34, 0xe4, 0xc0, 0xfc, 235 0x9a, 0xe6, 0x7f, 0x5b, 0x56, 0x59, 0xa9, 0xd7, 236 0xd1, 0xfe, 0xfd, 0x18, 0x7e, 0xe0, 0x9f, 0xd4 237 }; 238 static const ec_test_case decdsa_rfc6979_SECP192R1_SHA384_1_test_case = { 239 .name="DECDSA-SHA384/SECP192R1 1", 240 .ec_str_p = &secp192r1_str_params, 241 .priv_key = decdsa_rfc6979_SECP192R1_SHA384_1_test_vector_priv_key, 242 .priv_key_len = sizeof(decdsa_rfc6979_SECP192R1_SHA384_1_test_vector_priv_key), 243 .nn_random = NULL, 244 .hash_type = SHA384, 245 .msg = "test", 246 .msglen = 4, 247 .sig_type = DECDSA, 248 .exp_sig = decdsa_rfc6979_SECP192R1_SHA384_1_test_vector_expected_sig, 249 .exp_siglen = sizeof(decdsa_rfc6979_SECP192R1_SHA384_1_test_vector_expected_sig), 250 .adata = NULL, 251 .adata_len = 0 252 }; 253 #endif /* WITH_CURVE_SECP192R1 */ 254 #endif /* WITH_HASH_SHA384 */ 255 256 #ifdef WITH_HASH_SHA512 257 #ifdef WITH_CURVE_SECP192R1 258 #define DECDSA_SHA512_SECP192R1_SELF_TEST_1 259 /*** Tests for DECDSA-SHA512/SECP192R1 ***/ 260 static const u8 decdsa_rfc6979_SECP192R1_SHA512_1_test_vector_expected_sig[] = { 261 0xfe, 0x4f, 0x4a, 0xe8, 0x6a, 0x58, 0xb6, 0x50, 262 0x79, 0x46, 0x71, 0x59, 0x34, 0xfe, 0x2d, 0x8f, 263 0xf9, 0xd9, 0x5b, 0x6b, 0x09, 0x8f, 0xe7, 0x39, 264 0x74, 0xcf, 0x56, 0x05, 0xc9, 0x8f, 0xba, 0x0e, 265 0x1e, 0xf3, 0x4d, 0x4b, 0x5a, 0x15, 0x77, 0xa7, 266 0xdc, 0xf5, 0x94, 0x57, 0xca, 0xe5, 0x22, 0x90 267 }; 268 static const u8 decdsa_rfc6979_SECP192R1_SHA512_1_test_vector_priv_key[] = { 269 0x6f, 0xab, 0x03, 0x49, 0x34, 0xe4, 0xc0, 0xfc, 270 0x9a, 0xe6, 0x7f, 0x5b, 0x56, 0x59, 0xa9, 0xd7, 271 0xd1, 0xfe, 0xfd, 0x18, 0x7e, 0xe0, 0x9f, 0xd4 272 }; 273 static const ec_test_case decdsa_rfc6979_SECP192R1_SHA512_1_test_case = { 274 .name="DECDSA-SHA512/SECP192R1 1", 275 .ec_str_p = &secp192r1_str_params, 276 .priv_key = decdsa_rfc6979_SECP192R1_SHA512_1_test_vector_priv_key, 277 .priv_key_len = sizeof(decdsa_rfc6979_SECP192R1_SHA512_1_test_vector_priv_key), 278 .nn_random = NULL, 279 .hash_type = SHA512, 280 .msg = "test", 281 .msglen = 4, 282 .sig_type = DECDSA, 283 .exp_sig = decdsa_rfc6979_SECP192R1_SHA512_1_test_vector_expected_sig, 284 .exp_siglen = sizeof(decdsa_rfc6979_SECP192R1_SHA512_1_test_vector_expected_sig), 285 .adata = NULL, 286 .adata_len = 0 287 }; 288 #endif /* WITH_CURVE_SECP192R1 */ 289 #endif /* WITH_HASH_SHA512 */ 290 291 #ifdef WITH_HASH_SHA224 292 #ifdef WITH_CURVE_SECP256R1 293 #define DECDSA_SHA224_SECP256R1_SELF_TEST_0 294 /*** Tests for DECDSA-SHA224/SECP256R1 ***/ 295 static const u8 decdsa_rfc6979_SECP256R1_SHA224_0_test_vector_expected_sig[] = { 296 0x53, 0xb2, 0xff, 0xf5, 0xd1, 0x75, 0x2b, 0x2c, 297 0x68, 0x9d, 0xf2, 0x57, 0xc0, 0x4c, 0x40, 0xa5, 298 0x87, 0xfa, 0xba, 0xbb, 0x3f, 0x6f, 0xc2, 0x70, 299 0x2f, 0x13, 0x43, 0xaf, 0x7c, 0xa9, 0xaa, 0x3f, 300 0xb9, 0xaf, 0xb6, 0x4f, 0xdc, 0x03, 0xdc, 0x1a, 301 0x13, 0x1c, 0x7d, 0x23, 0x86, 0xd1, 0x1e, 0x34, 302 0x9f, 0x07, 0x0a, 0xa4, 0x32, 0xa4, 0xac, 0xc9, 303 0x18, 0xbe, 0xa9, 0x88, 0xbf, 0x75, 0xc7, 0x4c 304 }; 305 static const u8 decdsa_rfc6979_SECP256R1_SHA224_0_test_vector_priv_key[] = { 306 0xc9, 0xaf, 0xa9, 0xd8, 0x45, 0xba, 0x75, 0x16, 307 0x6b, 0x5c, 0x21, 0x57, 0x67, 0xb1, 0xd6, 0x93, 308 0x4e, 0x50, 0xc3, 0xdb, 0x36, 0xe8, 0x9b, 0x12, 309 0x7b, 0x8a, 0x62, 0x2b, 0x12, 0x0f, 0x67, 0x21 310 }; 311 static const ec_test_case decdsa_rfc6979_SECP256R1_SHA224_0_test_case = { 312 .name="DECDSA-SHA224/SECP256R1 0", 313 .ec_str_p = &secp256r1_str_params, 314 .priv_key = decdsa_rfc6979_SECP256R1_SHA224_0_test_vector_priv_key, 315 .priv_key_len = sizeof(decdsa_rfc6979_SECP256R1_SHA224_0_test_vector_priv_key), 316 .nn_random = NULL, 317 .hash_type = SHA224, 318 .msg = "sample", 319 .msglen = 6, 320 .sig_type = DECDSA, 321 .exp_sig = decdsa_rfc6979_SECP256R1_SHA224_0_test_vector_expected_sig, 322 .exp_siglen = sizeof(decdsa_rfc6979_SECP256R1_SHA224_0_test_vector_expected_sig), 323 .adata = NULL, 324 .adata_len = 0 325 }; 326 #endif /* WITH_CURVE_SECP256R1 */ 327 #endif /* WITH_HASH_SHA224 */ 328 329 #ifdef WITH_HASH_SHA256 330 #ifdef WITH_CURVE_SECP256R1 331 #define DECDSA_SHA256_SECP256R1_SELF_TEST_0 332 /*** Tests for DECDSA-SHA256/SECP256R1 ***/ 333 static const u8 decdsa_rfc6979_SECP256R1_SHA256_0_test_vector_expected_sig[] = { 334 0xef, 0xd4, 0x8b, 0x2a, 0xac, 0xb6, 0xa8, 0xfd, 335 0x11, 0x40, 0xdd, 0x9c, 0xd4, 0x5e, 0x81, 0xd6, 336 0x9d, 0x2c, 0x87, 0x7b, 0x56, 0xaa, 0xf9, 0x91, 337 0xc3, 0x4d, 0x0e, 0xa8, 0x4e, 0xaf, 0x37, 0x16, 338 0xf7, 0xcb, 0x1c, 0x94, 0x2d, 0x65, 0x7c, 0x41, 339 0xd4, 0x36, 0xc7, 0xa1, 0xb6, 0xe2, 0x9f, 0x65, 340 0xf3, 0xe9, 0x00, 0xdb, 0xb9, 0xaf, 0xf4, 0x06, 341 0x4d, 0xc4, 0xab, 0x2f, 0x84, 0x3a, 0xcd, 0xa8 342 }; 343 static const u8 decdsa_rfc6979_SECP256R1_SHA256_0_test_vector_priv_key[] = { 344 0xc9, 0xaf, 0xa9, 0xd8, 0x45, 0xba, 0x75, 0x16, 345 0x6b, 0x5c, 0x21, 0x57, 0x67, 0xb1, 0xd6, 0x93, 346 0x4e, 0x50, 0xc3, 0xdb, 0x36, 0xe8, 0x9b, 0x12, 347 0x7b, 0x8a, 0x62, 0x2b, 0x12, 0x0f, 0x67, 0x21 348 }; 349 static const ec_test_case decdsa_rfc6979_SECP256R1_SHA256_0_test_case = { 350 .name="DECDSA-SHA256/SECP256R1 0", 351 .ec_str_p = &secp256r1_str_params, 352 .priv_key = decdsa_rfc6979_SECP256R1_SHA256_0_test_vector_priv_key, 353 .priv_key_len = sizeof(decdsa_rfc6979_SECP256R1_SHA256_0_test_vector_priv_key), 354 .nn_random = NULL, 355 .hash_type = SHA256, 356 .msg = "sample", 357 .msglen = 6, 358 .sig_type = DECDSA, 359 .exp_sig = decdsa_rfc6979_SECP256R1_SHA256_0_test_vector_expected_sig, 360 .exp_siglen = sizeof(decdsa_rfc6979_SECP256R1_SHA256_0_test_vector_expected_sig), 361 .adata = NULL, 362 .adata_len = 0 363 }; 364 #endif /* WITH_CURVE_SECP256R1 */ 365 #endif /* WITH_HASH_SHA256 */ 366 367 #ifdef WITH_HASH_SHA384 368 #ifdef WITH_CURVE_SECP256R1 369 #define DECDSA_SHA384_SECP256R1_SELF_TEST_0 370 /*** Tests for DECDSA-SHA384/SECP256R1 ***/ 371 static const u8 decdsa_rfc6979_SECP256R1_SHA384_0_test_vector_expected_sig[] = { 372 0x0e, 0xaf, 0xea, 0x03, 0x9b, 0x20, 0xe9, 0xb4, 373 0x23, 0x09, 0xfb, 0x1d, 0x89, 0xe2, 0x13, 0x05, 374 0x7c, 0xbf, 0x97, 0x3d, 0xc0, 0xcf, 0xc8, 0xf1, 375 0x29, 0xed, 0xdd, 0xc8, 0x00, 0xef, 0x77, 0x19, 376 0x48, 0x61, 0xf0, 0x49, 0x1e, 0x69, 0x98, 0xb9, 377 0x45, 0x51, 0x93, 0xe3, 0x4e, 0x7b, 0x0d, 0x28, 378 0x4d, 0xdd, 0x71, 0x49, 0xa7, 0x4b, 0x95, 0xb9, 379 0x26, 0x1f, 0x13, 0xab, 0xde, 0x94, 0x09, 0x54 380 }; 381 static const u8 decdsa_rfc6979_SECP256R1_SHA384_0_test_vector_priv_key[] = { 382 0xc9, 0xaf, 0xa9, 0xd8, 0x45, 0xba, 0x75, 0x16, 383 0x6b, 0x5c, 0x21, 0x57, 0x67, 0xb1, 0xd6, 0x93, 384 0x4e, 0x50, 0xc3, 0xdb, 0x36, 0xe8, 0x9b, 0x12, 385 0x7b, 0x8a, 0x62, 0x2b, 0x12, 0x0f, 0x67, 0x21 386 }; 387 static const ec_test_case decdsa_rfc6979_SECP256R1_SHA384_0_test_case = { 388 .name="DECDSA-SHA384/SECP256R1 0", 389 .ec_str_p = &secp256r1_str_params, 390 .priv_key = decdsa_rfc6979_SECP256R1_SHA384_0_test_vector_priv_key, 391 .priv_key_len = sizeof(decdsa_rfc6979_SECP256R1_SHA384_0_test_vector_priv_key), 392 .nn_random = NULL, 393 .hash_type = SHA384, 394 .msg = "sample", 395 .msglen = 6, 396 .sig_type = DECDSA, 397 .exp_sig = decdsa_rfc6979_SECP256R1_SHA384_0_test_vector_expected_sig, 398 .exp_siglen = sizeof(decdsa_rfc6979_SECP256R1_SHA384_0_test_vector_expected_sig), 399 .adata = NULL, 400 .adata_len = 0 401 }; 402 #endif /* WITH_CURVE_SECP256R1 */ 403 #endif /* WITH_HASH_SHA384 */ 404 405 #ifdef WITH_HASH_SHA512 406 #ifdef WITH_CURVE_SECP256R1 407 #define DECDSA_SHA512_SECP256R1_SELF_TEST_0 408 /*** Tests for DECDSA-SHA512/SECP256R1 ***/ 409 static const u8 decdsa_rfc6979_SECP256R1_SHA512_0_test_vector_expected_sig[] = { 410 0x84, 0x96, 0xa6, 0x0b, 0x5e, 0x9b, 0x47, 0xc8, 411 0x25, 0x48, 0x88, 0x27, 0xe0, 0x49, 0x5b, 0x0e, 412 0x3f, 0xa1, 0x09, 0xec, 0x45, 0x68, 0xfd, 0x3f, 413 0x8d, 0x10, 0x97, 0x67, 0x8e, 0xb9, 0x7f, 0x00, 414 0x23, 0x62, 0xab, 0x1a, 0xdb, 0xe2, 0xb8, 0xad, 415 0xf9, 0xcb, 0x9e, 0xda, 0xb7, 0x40, 0xea, 0x60, 416 0x49, 0xc0, 0x28, 0x11, 0x4f, 0x24, 0x60, 0xf9, 417 0x65, 0x54, 0xf6, 0x1f, 0xae, 0x33, 0x02, 0xfe 418 }; 419 static const u8 decdsa_rfc6979_SECP256R1_SHA512_0_test_vector_priv_key[] = { 420 0xc9, 0xaf, 0xa9, 0xd8, 0x45, 0xba, 0x75, 0x16, 421 0x6b, 0x5c, 0x21, 0x57, 0x67, 0xb1, 0xd6, 0x93, 422 0x4e, 0x50, 0xc3, 0xdb, 0x36, 0xe8, 0x9b, 0x12, 423 0x7b, 0x8a, 0x62, 0x2b, 0x12, 0x0f, 0x67, 0x21 424 }; 425 static const ec_test_case decdsa_rfc6979_SECP256R1_SHA512_0_test_case = { 426 .name="DECDSA-SHA512/SECP256R1 0", 427 .ec_str_p = &secp256r1_str_params, 428 .priv_key = decdsa_rfc6979_SECP256R1_SHA512_0_test_vector_priv_key, 429 .priv_key_len = sizeof(decdsa_rfc6979_SECP256R1_SHA512_0_test_vector_priv_key), 430 .nn_random = NULL, 431 .hash_type = SHA512, 432 .msg = "sample", 433 .msglen = 6, 434 .sig_type = DECDSA, 435 .exp_sig = decdsa_rfc6979_SECP256R1_SHA512_0_test_vector_expected_sig, 436 .exp_siglen = sizeof(decdsa_rfc6979_SECP256R1_SHA512_0_test_vector_expected_sig), 437 .adata = NULL, 438 .adata_len = 0 439 }; 440 #endif /* WITH_CURVE_SECP256R1 */ 441 #endif /* WITH_HASH_SHA512 */ 442 443 #ifdef WITH_HASH_SHA224 444 #ifdef WITH_CURVE_SECP256R1 445 #define DECDSA_SHA224_SECP256R1_SELF_TEST_1 446 /*** Tests for DECDSA-SHA224/SECP256R1 ***/ 447 static const u8 decdsa_rfc6979_SECP256R1_SHA224_1_test_vector_expected_sig[] = { 448 0xc3, 0x7e, 0xdb, 0x6f, 0x0a, 0xe7, 0x9d, 0x47, 449 0xc3, 0xc2, 0x7e, 0x96, 0x2f, 0xa2, 0x69, 0xbb, 450 0x4f, 0x44, 0x17, 0x70, 0x35, 0x7e, 0x11, 0x4e, 451 0xe5, 0x11, 0xf6, 0x62, 0xec, 0x34, 0xa6, 0x92, 452 0xc8, 0x20, 0x05, 0x3a, 0x05, 0x79, 0x1e, 0x52, 453 0x1f, 0xca, 0xad, 0x60, 0x42, 0xd4, 0x0a, 0xea, 454 0x1d, 0x6b, 0x1a, 0x54, 0x01, 0x38, 0x55, 0x8f, 455 0x47, 0xd0, 0x71, 0x98, 0x00, 0xe1, 0x8f, 0x2d 456 }; 457 static const u8 decdsa_rfc6979_SECP256R1_SHA224_1_test_vector_priv_key[] = { 458 0xc9, 0xaf, 0xa9, 0xd8, 0x45, 0xba, 0x75, 0x16, 459 0x6b, 0x5c, 0x21, 0x57, 0x67, 0xb1, 0xd6, 0x93, 460 0x4e, 0x50, 0xc3, 0xdb, 0x36, 0xe8, 0x9b, 0x12, 461 0x7b, 0x8a, 0x62, 0x2b, 0x12, 0x0f, 0x67, 0x21 462 }; 463 static const ec_test_case decdsa_rfc6979_SECP256R1_SHA224_1_test_case = { 464 .name="DECDSA-SHA224/SECP256R1 1", 465 .ec_str_p = &secp256r1_str_params, 466 .priv_key = decdsa_rfc6979_SECP256R1_SHA224_1_test_vector_priv_key, 467 .priv_key_len = sizeof(decdsa_rfc6979_SECP256R1_SHA224_1_test_vector_priv_key), 468 .nn_random = NULL, 469 .hash_type = SHA224, 470 .msg = "test", 471 .msglen = 4, 472 .sig_type = DECDSA, 473 .exp_sig = decdsa_rfc6979_SECP256R1_SHA224_1_test_vector_expected_sig, 474 .exp_siglen = sizeof(decdsa_rfc6979_SECP256R1_SHA224_1_test_vector_expected_sig), 475 .adata = NULL, 476 .adata_len = 0 477 }; 478 #endif /* WITH_CURVE_SECP256R1 */ 479 #endif /* WITH_HASH_SHA224 */ 480 481 #ifdef WITH_HASH_SHA256 482 #ifdef WITH_CURVE_SECP256R1 483 #define DECDSA_SHA256_SECP256R1_SELF_TEST_1 484 /*** Tests for DECDSA-SHA256/SECP256R1 ***/ 485 static const u8 decdsa_rfc6979_SECP256R1_SHA256_1_test_vector_expected_sig[] = { 486 0xf1, 0xab, 0xb0, 0x23, 0x51, 0x83, 0x51, 0xcd, 487 0x71, 0xd8, 0x81, 0x56, 0x7b, 0x1e, 0xa6, 0x63, 488 0xed, 0x3e, 0xfc, 0xf6, 0xc5, 0x13, 0x2b, 0x35, 489 0x4f, 0x28, 0xd3, 0xb0, 0xb7, 0xd3, 0x83, 0x67, 490 0x01, 0x9f, 0x41, 0x13, 0x74, 0x2a, 0x2b, 0x14, 491 0xbd, 0x25, 0x92, 0x6b, 0x49, 0xc6, 0x49, 0x15, 492 0x5f, 0x26, 0x7e, 0x60, 0xd3, 0x81, 0x4b, 0x4c, 493 0x0c, 0xc8, 0x42, 0x50, 0xe4, 0x6f, 0x00, 0x83 494 }; 495 static const u8 decdsa_rfc6979_SECP256R1_SHA256_1_test_vector_priv_key[] = { 496 0xc9, 0xaf, 0xa9, 0xd8, 0x45, 0xba, 0x75, 0x16, 497 0x6b, 0x5c, 0x21, 0x57, 0x67, 0xb1, 0xd6, 0x93, 498 0x4e, 0x50, 0xc3, 0xdb, 0x36, 0xe8, 0x9b, 0x12, 499 0x7b, 0x8a, 0x62, 0x2b, 0x12, 0x0f, 0x67, 0x21 500 }; 501 static const ec_test_case decdsa_rfc6979_SECP256R1_SHA256_1_test_case = { 502 .name="DECDSA-SHA256/SECP256R1 1", 503 .ec_str_p = &secp256r1_str_params, 504 .priv_key = decdsa_rfc6979_SECP256R1_SHA256_1_test_vector_priv_key, 505 .priv_key_len = sizeof(decdsa_rfc6979_SECP256R1_SHA256_1_test_vector_priv_key), 506 .nn_random = NULL, 507 .hash_type = SHA256, 508 .msg = "test", 509 .msglen = 4, 510 .sig_type = DECDSA, 511 .exp_sig = decdsa_rfc6979_SECP256R1_SHA256_1_test_vector_expected_sig, 512 .exp_siglen = sizeof(decdsa_rfc6979_SECP256R1_SHA256_1_test_vector_expected_sig), 513 .adata = NULL, 514 .adata_len = 0 515 }; 516 #endif /* WITH_CURVE_SECP256R1 */ 517 #endif /* WITH_HASH_SHA256 */ 518 519 #ifdef WITH_HASH_SHA384 520 #ifdef WITH_CURVE_SECP256R1 521 #define DECDSA_SHA384_SECP256R1_SELF_TEST_1 522 /*** Tests for DECDSA-SHA384/SECP256R1 ***/ 523 static const u8 decdsa_rfc6979_SECP256R1_SHA384_1_test_vector_expected_sig[] = { 524 0x83, 0x91, 0x0e, 0x8b, 0x48, 0xbb, 0x0c, 0x74, 525 0x24, 0x4e, 0xbd, 0xf7, 0xf0, 0x7a, 0x1c, 0x54, 526 0x13, 0xd6, 0x14, 0x72, 0xbd, 0x94, 0x1e, 0xf3, 527 0x92, 0x0e, 0x62, 0x3f, 0xbc, 0xce, 0xbe, 0xb6, 528 0x8d, 0xdb, 0xec, 0x54, 0xcf, 0x8c, 0xd5, 0x87, 529 0x48, 0x83, 0x84, 0x1d, 0x71, 0x21, 0x42, 0xa5, 530 0x6a, 0x8d, 0x0f, 0x21, 0x8f, 0x50, 0x03, 0xcb, 531 0x02, 0x96, 0xb6, 0xb5, 0x09, 0x61, 0x9f, 0x2c 532 }; 533 static const u8 decdsa_rfc6979_SECP256R1_SHA384_1_test_vector_priv_key[] = { 534 0xc9, 0xaf, 0xa9, 0xd8, 0x45, 0xba, 0x75, 0x16, 535 0x6b, 0x5c, 0x21, 0x57, 0x67, 0xb1, 0xd6, 0x93, 536 0x4e, 0x50, 0xc3, 0xdb, 0x36, 0xe8, 0x9b, 0x12, 537 0x7b, 0x8a, 0x62, 0x2b, 0x12, 0x0f, 0x67, 0x21 538 }; 539 static const ec_test_case decdsa_rfc6979_SECP256R1_SHA384_1_test_case = { 540 .name="DECDSA-SHA384/SECP256R1 1", 541 .ec_str_p = &secp256r1_str_params, 542 .priv_key = decdsa_rfc6979_SECP256R1_SHA384_1_test_vector_priv_key, 543 .priv_key_len = sizeof(decdsa_rfc6979_SECP256R1_SHA384_1_test_vector_priv_key), 544 .nn_random = NULL, 545 .hash_type = SHA384, 546 .msg = "test", 547 .msglen = 4, 548 .sig_type = DECDSA, 549 .exp_sig = decdsa_rfc6979_SECP256R1_SHA384_1_test_vector_expected_sig, 550 .exp_siglen = sizeof(decdsa_rfc6979_SECP256R1_SHA384_1_test_vector_expected_sig), 551 .adata = NULL, 552 .adata_len = 0 553 }; 554 #endif /* WITH_CURVE_SECP256R1 */ 555 #endif /* WITH_HASH_SHA384 */ 556 557 #ifdef WITH_HASH_SHA512 558 #ifdef WITH_CURVE_SECP256R1 559 #define DECDSA_SHA512_SECP256R1_SELF_TEST_1 560 /*** Tests for DECDSA-SHA512/SECP256R1 ***/ 561 static const u8 decdsa_rfc6979_SECP256R1_SHA512_1_test_vector_expected_sig[] = { 562 0x46, 0x1d, 0x93, 0xf3, 0x1b, 0x65, 0x40, 0x89, 563 0x47, 0x88, 0xfd, 0x20, 0x6c, 0x07, 0xcf, 0xa0, 564 0xcc, 0x35, 0xf4, 0x6f, 0xa3, 0xc9, 0x18, 0x16, 565 0xff, 0xf1, 0x04, 0x0a, 0xd1, 0x58, 0x1a, 0x04, 566 0x39, 0xaf, 0x9f, 0x15, 0xde, 0x0d, 0xb8, 0xd9, 567 0x7e, 0x72, 0x71, 0x9c, 0x74, 0x82, 0x0d, 0x30, 568 0x4c, 0xe5, 0x22, 0x6e, 0x32, 0xde, 0xda, 0xe6, 569 0x75, 0x19, 0xe8, 0x40, 0xd1, 0x19, 0x4e, 0x55 570 }; 571 static const u8 decdsa_rfc6979_SECP256R1_SHA512_1_test_vector_priv_key[] = { 572 0xc9, 0xaf, 0xa9, 0xd8, 0x45, 0xba, 0x75, 0x16, 573 0x6b, 0x5c, 0x21, 0x57, 0x67, 0xb1, 0xd6, 0x93, 574 0x4e, 0x50, 0xc3, 0xdb, 0x36, 0xe8, 0x9b, 0x12, 575 0x7b, 0x8a, 0x62, 0x2b, 0x12, 0x0f, 0x67, 0x21 576 }; 577 static const ec_test_case decdsa_rfc6979_SECP256R1_SHA512_1_test_case = { 578 .name="DECDSA-SHA512/SECP256R1 1", 579 .ec_str_p = &secp256r1_str_params, 580 .priv_key = decdsa_rfc6979_SECP256R1_SHA512_1_test_vector_priv_key, 581 .priv_key_len = sizeof(decdsa_rfc6979_SECP256R1_SHA512_1_test_vector_priv_key), 582 .nn_random = NULL, 583 .hash_type = SHA512, 584 .msg = "test", 585 .msglen = 4, 586 .sig_type = DECDSA, 587 .exp_sig = decdsa_rfc6979_SECP256R1_SHA512_1_test_vector_expected_sig, 588 .exp_siglen = sizeof(decdsa_rfc6979_SECP256R1_SHA512_1_test_vector_expected_sig), 589 .adata = NULL, 590 .adata_len = 0 591 }; 592 #endif /* WITH_CURVE_SECP256R1 */ 593 #endif /* WITH_HASH_SHA512 */ 594 595 #ifdef WITH_HASH_SHA224 596 #ifdef WITH_CURVE_SECP384R1 597 #define DECDSA_SHA224_SECP384R1_SELF_TEST_0 598 /*** Tests for DECDSA-SHA224/SECP384R1 ***/ 599 static const u8 decdsa_rfc6979_SECP384R1_SHA224_0_test_vector_expected_sig[] = { 600 0x42, 0x35, 0x6e, 0x76, 0xb5, 0x5a, 0x6d, 0x9b, 601 0x46, 0x31, 0xc8, 0x65, 0x44, 0x5d, 0xbe, 0x54, 602 0xe0, 0x56, 0xd3, 0xb3, 0x43, 0x17, 0x66, 0xd0, 603 0x50, 0x92, 0x44, 0x79, 0x3c, 0x3f, 0x93, 0x66, 604 0x45, 0x0f, 0x76, 0xee, 0x3d, 0xe4, 0x3f, 0x5a, 605 0x12, 0x53, 0x33, 0xa6, 0xbe, 0x06, 0x01, 0x22, 606 0x9d, 0xa0, 0xc8, 0x17, 0x87, 0x06, 0x40, 0x21, 607 0xe7, 0x8d, 0xf6, 0x58, 0xf2, 0xfb, 0xb0, 0xb0, 608 0x42, 0xbf, 0x30, 0x46, 0x65, 0xdb, 0x72, 0x1f, 609 0x07, 0x7a, 0x42, 0x98, 0xb0, 0x95, 0xe4, 0x83, 610 0x4c, 0x08, 0x2c, 0x03, 0xd8, 0x30, 0x28, 0xef, 611 0xbf, 0x93, 0xa3, 0xc2, 0x39, 0x40, 0xca, 0x8d 612 }; 613 static const u8 decdsa_rfc6979_SECP384R1_SHA224_0_test_vector_priv_key[] = { 614 0x6b, 0x9d, 0x3d, 0xad, 0x2e, 0x1b, 0x8c, 0x1c, 615 0x05, 0xb1, 0x98, 0x75, 0xb6, 0x65, 0x9f, 0x4d, 616 0xe2, 0x3c, 0x3b, 0x66, 0x7b, 0xf2, 0x97, 0xba, 617 0x9a, 0xa4, 0x77, 0x40, 0x78, 0x71, 0x37, 0xd8, 618 0x96, 0xd5, 0x72, 0x4e, 0x4c, 0x70, 0xa8, 0x25, 619 0xf8, 0x72, 0xc9, 0xea, 0x60, 0xd2, 0xed, 0xf5 620 }; 621 static const ec_test_case decdsa_rfc6979_SECP384R1_SHA224_0_test_case = { 622 .name="DECDSA-SHA224/SECP384R1 0", 623 .ec_str_p = &secp384r1_str_params, 624 .priv_key = decdsa_rfc6979_SECP384R1_SHA224_0_test_vector_priv_key, 625 .priv_key_len = sizeof(decdsa_rfc6979_SECP384R1_SHA224_0_test_vector_priv_key), 626 .nn_random = NULL, 627 .hash_type = SHA224, 628 .msg = "sample", 629 .msglen = 6, 630 .sig_type = DECDSA, 631 .exp_sig = decdsa_rfc6979_SECP384R1_SHA224_0_test_vector_expected_sig, 632 .exp_siglen = sizeof(decdsa_rfc6979_SECP384R1_SHA224_0_test_vector_expected_sig), 633 .adata = NULL, 634 .adata_len = 0 635 }; 636 #endif /* WITH_CURVE_SECP384R1 */ 637 #endif /* WITH_HASH_SHA224 */ 638 639 #ifdef WITH_HASH_SHA256 640 #ifdef WITH_CURVE_SECP384R1 641 #define DECDSA_SHA256_SECP384R1_SELF_TEST_0 642 /*** Tests for DECDSA-SHA256/SECP384R1 ***/ 643 static const u8 decdsa_rfc6979_SECP384R1_SHA256_0_test_vector_expected_sig[] = { 644 0x21, 0xb1, 0x3d, 0x1e, 0x01, 0x3c, 0x7f, 0xa1, 645 0x39, 0x2d, 0x03, 0xc5, 0xf9, 0x9a, 0xf8, 0xb3, 646 0x0c, 0x57, 0x0c, 0x6f, 0x98, 0xd4, 0xea, 0x8e, 647 0x35, 0x4b, 0x63, 0xa2, 0x1d, 0x3d, 0xaa, 0x33, 648 0xbd, 0xe1, 0xe8, 0x88, 0xe6, 0x33, 0x55, 0xd9, 649 0x2f, 0xa2, 0xb3, 0xc3, 0x6d, 0x8f, 0xb2, 0xcd, 650 0xf3, 0xaa, 0x44, 0x3f, 0xb1, 0x07, 0x74, 0x5b, 651 0xf4, 0xbd, 0x77, 0xcb, 0x38, 0x91, 0x67, 0x46, 652 0x32, 0x06, 0x8a, 0x10, 0xca, 0x67, 0xe3, 0xd4, 653 0x5d, 0xb2, 0x26, 0x6f, 0xa7, 0xd1, 0xfe, 0xeb, 654 0xef, 0xdc, 0x63, 0xec, 0xcd, 0x1a, 0xc4, 0x2e, 655 0xc0, 0xcb, 0x86, 0x68, 0xa4, 0xfa, 0x0a, 0xb0 656 }; 657 static const u8 decdsa_rfc6979_SECP384R1_SHA256_0_test_vector_priv_key[] = { 658 0x6b, 0x9d, 0x3d, 0xad, 0x2e, 0x1b, 0x8c, 0x1c, 659 0x05, 0xb1, 0x98, 0x75, 0xb6, 0x65, 0x9f, 0x4d, 660 0xe2, 0x3c, 0x3b, 0x66, 0x7b, 0xf2, 0x97, 0xba, 661 0x9a, 0xa4, 0x77, 0x40, 0x78, 0x71, 0x37, 0xd8, 662 0x96, 0xd5, 0x72, 0x4e, 0x4c, 0x70, 0xa8, 0x25, 663 0xf8, 0x72, 0xc9, 0xea, 0x60, 0xd2, 0xed, 0xf5 664 }; 665 static const ec_test_case decdsa_rfc6979_SECP384R1_SHA256_0_test_case = { 666 .name="DECDSA-SHA256/SECP384R1 0", 667 .ec_str_p = &secp384r1_str_params, 668 .priv_key = decdsa_rfc6979_SECP384R1_SHA256_0_test_vector_priv_key, 669 .priv_key_len = sizeof(decdsa_rfc6979_SECP384R1_SHA256_0_test_vector_priv_key), 670 .nn_random = NULL, 671 .hash_type = SHA256, 672 .msg = "sample", 673 .msglen = 6, 674 .sig_type = DECDSA, 675 .exp_sig = decdsa_rfc6979_SECP384R1_SHA256_0_test_vector_expected_sig, 676 .exp_siglen = sizeof(decdsa_rfc6979_SECP384R1_SHA256_0_test_vector_expected_sig), 677 .adata = NULL, 678 .adata_len = 0 679 }; 680 #endif /* WITH_CURVE_SECP384R1 */ 681 #endif /* WITH_HASH_SHA256 */ 682 683 #ifdef WITH_HASH_SHA384 684 #ifdef WITH_CURVE_SECP384R1 685 #define DECDSA_SHA384_SECP384R1_SELF_TEST_0 686 /*** Tests for DECDSA-SHA384/SECP384R1 ***/ 687 static const u8 decdsa_rfc6979_SECP384R1_SHA384_0_test_vector_expected_sig[] = { 688 0x94, 0xed, 0xbb, 0x92, 0xa5, 0xec, 0xb8, 0xaa, 689 0xd4, 0x73, 0x6e, 0x56, 0xc6, 0x91, 0x91, 0x6b, 690 0x3f, 0x88, 0x14, 0x06, 0x66, 0xce, 0x9f, 0xa7, 691 0x3d, 0x64, 0xc4, 0xea, 0x95, 0xad, 0x13, 0x3c, 692 0x81, 0xa6, 0x48, 0x15, 0x2e, 0x44, 0xac, 0xf9, 693 0x6e, 0x36, 0xdd, 0x1e, 0x80, 0xfa, 0xbe, 0x46, 694 0x99, 0xef, 0x4a, 0xeb, 0x15, 0xf1, 0x78, 0xce, 695 0xa1, 0xfe, 0x40, 0xdb, 0x26, 0x03, 0x13, 0x8f, 696 0x13, 0x0e, 0x74, 0x0a, 0x19, 0x62, 0x45, 0x26, 697 0x20, 0x3b, 0x63, 0x51, 0xd0, 0xa3, 0xa9, 0x4f, 698 0xa3, 0x29, 0xc1, 0x45, 0x78, 0x6e, 0x67, 0x9e, 699 0x7b, 0x82, 0xc7, 0x1a, 0x38, 0x62, 0x8a, 0xc8 700 }; 701 static const u8 decdsa_rfc6979_SECP384R1_SHA384_0_test_vector_priv_key[] = { 702 0x6b, 0x9d, 0x3d, 0xad, 0x2e, 0x1b, 0x8c, 0x1c, 703 0x05, 0xb1, 0x98, 0x75, 0xb6, 0x65, 0x9f, 0x4d, 704 0xe2, 0x3c, 0x3b, 0x66, 0x7b, 0xf2, 0x97, 0xba, 705 0x9a, 0xa4, 0x77, 0x40, 0x78, 0x71, 0x37, 0xd8, 706 0x96, 0xd5, 0x72, 0x4e, 0x4c, 0x70, 0xa8, 0x25, 707 0xf8, 0x72, 0xc9, 0xea, 0x60, 0xd2, 0xed, 0xf5 708 }; 709 static const ec_test_case decdsa_rfc6979_SECP384R1_SHA384_0_test_case = { 710 .name="DECDSA-SHA384/SECP384R1 0", 711 .ec_str_p = &secp384r1_str_params, 712 .priv_key = decdsa_rfc6979_SECP384R1_SHA384_0_test_vector_priv_key, 713 .priv_key_len = sizeof(decdsa_rfc6979_SECP384R1_SHA384_0_test_vector_priv_key), 714 .nn_random = NULL, 715 .hash_type = SHA384, 716 .msg = "sample", 717 .msglen = 6, 718 .sig_type = DECDSA, 719 .exp_sig = decdsa_rfc6979_SECP384R1_SHA384_0_test_vector_expected_sig, 720 .exp_siglen = sizeof(decdsa_rfc6979_SECP384R1_SHA384_0_test_vector_expected_sig), 721 .adata = NULL, 722 .adata_len = 0 723 }; 724 #endif /* WITH_CURVE_SECP384R1 */ 725 #endif /* WITH_HASH_SHA384 */ 726 727 #ifdef WITH_HASH_SHA512 728 #ifdef WITH_CURVE_SECP384R1 729 #define DECDSA_SHA512_SECP384R1_SELF_TEST_0 730 /*** Tests for DECDSA-SHA512/SECP384R1 ***/ 731 static const u8 decdsa_rfc6979_SECP384R1_SHA512_0_test_vector_expected_sig[] = { 732 0xed, 0x09, 0x59, 0xd5, 0x88, 0x0a, 0xb2, 0xd8, 733 0x69, 0xae, 0x7f, 0x6c, 0x29, 0x15, 0xc6, 0xd6, 734 0x0f, 0x96, 0x50, 0x7f, 0x9c, 0xb3, 0xe0, 0x47, 735 0xc0, 0x04, 0x68, 0x61, 0xda, 0x4a, 0x79, 0x9c, 736 0xfe, 0x30, 0xf3, 0x5c, 0xc9, 0x00, 0x05, 0x6d, 737 0x7c, 0x99, 0xcd, 0x78, 0x82, 0x43, 0x37, 0x09, 738 0x51, 0x2c, 0x8c, 0xce, 0xee, 0x38, 0x90, 0xa8, 739 0x40, 0x58, 0xce, 0x1e, 0x22, 0xdb, 0xc2, 0x19, 740 0x8f, 0x42, 0x32, 0x3c, 0xe8, 0xac, 0xa9, 0x13, 741 0x53, 0x29, 0xf0, 0x3c, 0x06, 0x8e, 0x51, 0x12, 742 0xdc, 0x7c, 0xc3, 0xef, 0x34, 0x46, 0xde, 0xfc, 743 0xeb, 0x01, 0xa4, 0x5c, 0x26, 0x67, 0xfd, 0xd5 744 }; 745 static const u8 decdsa_rfc6979_SECP384R1_SHA512_0_test_vector_priv_key[] = { 746 0x6b, 0x9d, 0x3d, 0xad, 0x2e, 0x1b, 0x8c, 0x1c, 747 0x05, 0xb1, 0x98, 0x75, 0xb6, 0x65, 0x9f, 0x4d, 748 0xe2, 0x3c, 0x3b, 0x66, 0x7b, 0xf2, 0x97, 0xba, 749 0x9a, 0xa4, 0x77, 0x40, 0x78, 0x71, 0x37, 0xd8, 750 0x96, 0xd5, 0x72, 0x4e, 0x4c, 0x70, 0xa8, 0x25, 751 0xf8, 0x72, 0xc9, 0xea, 0x60, 0xd2, 0xed, 0xf5 752 }; 753 static const ec_test_case decdsa_rfc6979_SECP384R1_SHA512_0_test_case = { 754 .name="DECDSA-SHA512/SECP384R1 0", 755 .ec_str_p = &secp384r1_str_params, 756 .priv_key = decdsa_rfc6979_SECP384R1_SHA512_0_test_vector_priv_key, 757 .priv_key_len = sizeof(decdsa_rfc6979_SECP384R1_SHA512_0_test_vector_priv_key), 758 .nn_random = NULL, 759 .hash_type = SHA512, 760 .msg = "sample", 761 .msglen = 6, 762 .sig_type = DECDSA, 763 .exp_sig = decdsa_rfc6979_SECP384R1_SHA512_0_test_vector_expected_sig, 764 .exp_siglen = sizeof(decdsa_rfc6979_SECP384R1_SHA512_0_test_vector_expected_sig), 765 .adata = NULL, 766 .adata_len = 0 767 }; 768 #endif /* WITH_CURVE_SECP384R1 */ 769 #endif /* WITH_HASH_SHA512 */ 770 771 #ifdef WITH_HASH_SHA224 772 #ifdef WITH_CURVE_SECP384R1 773 #define DECDSA_SHA224_SECP384R1_SELF_TEST_1 774 /*** Tests for DECDSA-SHA224/SECP384R1 ***/ 775 static const u8 decdsa_rfc6979_SECP384R1_SHA224_1_test_vector_expected_sig[] = { 776 0xe8, 0xc9, 0xd0, 0xb6, 0xea, 0x72, 0xa0, 0xe7, 777 0x83, 0x7f, 0xea, 0x1d, 0x14, 0xa1, 0xa9, 0x55, 778 0x7f, 0x29, 0xfa, 0xa4, 0x5d, 0x3e, 0x7e, 0xe8, 779 0x88, 0xfc, 0x5b, 0xf9, 0x54, 0xb5, 0xe6, 0x24, 780 0x64, 0xa9, 0xa8, 0x17, 0xc4, 0x7f, 0xf7, 0x8b, 781 0x8c, 0x11, 0x06, 0x6b, 0x24, 0x08, 0x0e, 0x72, 782 0x07, 0x04, 0x1d, 0x4a, 0x7a, 0x03, 0x79, 0xac, 783 0x72, 0x32, 0xff, 0x72, 0xe6, 0xf7, 0x7b, 0x6d, 784 0xdb, 0x8f, 0x09, 0xb1, 0x6c, 0xce, 0x0e, 0xc3, 785 0x28, 0x6b, 0x2b, 0xd4, 0x3f, 0xa8, 0xc6, 0x14, 786 0x1c, 0x53, 0xea, 0x5a, 0xbe, 0xf0, 0xd8, 0x23, 787 0x10, 0x77, 0xa0, 0x45, 0x40, 0xa9, 0x6b, 0x66 788 }; 789 static const u8 decdsa_rfc6979_SECP384R1_SHA224_1_test_vector_priv_key[] = { 790 0x6b, 0x9d, 0x3d, 0xad, 0x2e, 0x1b, 0x8c, 0x1c, 791 0x05, 0xb1, 0x98, 0x75, 0xb6, 0x65, 0x9f, 0x4d, 792 0xe2, 0x3c, 0x3b, 0x66, 0x7b, 0xf2, 0x97, 0xba, 793 0x9a, 0xa4, 0x77, 0x40, 0x78, 0x71, 0x37, 0xd8, 794 0x96, 0xd5, 0x72, 0x4e, 0x4c, 0x70, 0xa8, 0x25, 795 0xf8, 0x72, 0xc9, 0xea, 0x60, 0xd2, 0xed, 0xf5 796 }; 797 static const ec_test_case decdsa_rfc6979_SECP384R1_SHA224_1_test_case = { 798 .name="DECDSA-SHA224/SECP384R1 1", 799 .ec_str_p = &secp384r1_str_params, 800 .priv_key = decdsa_rfc6979_SECP384R1_SHA224_1_test_vector_priv_key, 801 .priv_key_len = sizeof(decdsa_rfc6979_SECP384R1_SHA224_1_test_vector_priv_key), 802 .nn_random = NULL, 803 .hash_type = SHA224, 804 .msg = "test", 805 .msglen = 4, 806 .sig_type = DECDSA, 807 .exp_sig = decdsa_rfc6979_SECP384R1_SHA224_1_test_vector_expected_sig, 808 .exp_siglen = sizeof(decdsa_rfc6979_SECP384R1_SHA224_1_test_vector_expected_sig), 809 .adata = NULL, 810 .adata_len = 0 811 }; 812 #endif /* WITH_CURVE_SECP384R1 */ 813 #endif /* WITH_HASH_SHA224 */ 814 815 #ifdef WITH_HASH_SHA256 816 #ifdef WITH_CURVE_SECP384R1 817 #define DECDSA_SHA256_SECP384R1_SELF_TEST_1 818 /*** Tests for DECDSA-SHA256/SECP384R1 ***/ 819 static const u8 decdsa_rfc6979_SECP384R1_SHA256_1_test_vector_expected_sig[] = { 820 0x6d, 0x6d, 0xef, 0xac, 0x9a, 0xb6, 0x4d, 0xab, 821 0xaf, 0xe3, 0x6c, 0x6b, 0xf5, 0x10, 0x35, 0x2a, 822 0x4c, 0xc2, 0x70, 0x01, 0x26, 0x36, 0x38, 0xe5, 823 0xb1, 0x6d, 0x9b, 0xb5, 0x1d, 0x45, 0x15, 0x59, 824 0xf9, 0x18, 0xee, 0xda, 0xf2, 0x29, 0x3b, 0xe5, 825 0xb4, 0x75, 0xcc, 0x8f, 0x01, 0x88, 0x63, 0x6b, 826 0x2d, 0x46, 0xf3, 0xbe, 0xcb, 0xcc, 0x52, 0x3d, 827 0x5f, 0x1a, 0x12, 0x56, 0xbf, 0x0c, 0x9b, 0x02, 828 0x4d, 0x87, 0x9b, 0xa9, 0xe8, 0x38, 0x14, 0x4c, 829 0x8b, 0xa6, 0xba, 0xeb, 0x4b, 0x53, 0xb4, 0x7d, 830 0x51, 0xab, 0x37, 0x3f, 0x98, 0x45, 0xc0, 0x51, 831 0x4e, 0xef, 0xb1, 0x40, 0x24, 0x78, 0x72, 0x65 832 }; 833 static const u8 decdsa_rfc6979_SECP384R1_SHA256_1_test_vector_priv_key[] = { 834 0x6b, 0x9d, 0x3d, 0xad, 0x2e, 0x1b, 0x8c, 0x1c, 835 0x05, 0xb1, 0x98, 0x75, 0xb6, 0x65, 0x9f, 0x4d, 836 0xe2, 0x3c, 0x3b, 0x66, 0x7b, 0xf2, 0x97, 0xba, 837 0x9a, 0xa4, 0x77, 0x40, 0x78, 0x71, 0x37, 0xd8, 838 0x96, 0xd5, 0x72, 0x4e, 0x4c, 0x70, 0xa8, 0x25, 839 0xf8, 0x72, 0xc9, 0xea, 0x60, 0xd2, 0xed, 0xf5 840 }; 841 static const ec_test_case decdsa_rfc6979_SECP384R1_SHA256_1_test_case = { 842 .name="DECDSA-SHA256/SECP384R1 1", 843 .ec_str_p = &secp384r1_str_params, 844 .priv_key = decdsa_rfc6979_SECP384R1_SHA256_1_test_vector_priv_key, 845 .priv_key_len = sizeof(decdsa_rfc6979_SECP384R1_SHA256_1_test_vector_priv_key), 846 .nn_random = NULL, 847 .hash_type = SHA256, 848 .msg = "test", 849 .msglen = 4, 850 .sig_type = DECDSA, 851 .exp_sig = decdsa_rfc6979_SECP384R1_SHA256_1_test_vector_expected_sig, 852 .exp_siglen = sizeof(decdsa_rfc6979_SECP384R1_SHA256_1_test_vector_expected_sig), 853 .adata = NULL, 854 .adata_len = 0 855 }; 856 #endif /* WITH_CURVE_SECP384R1 */ 857 #endif /* WITH_HASH_SHA256 */ 858 859 #ifdef WITH_HASH_SHA384 860 #ifdef WITH_CURVE_SECP384R1 861 #define DECDSA_SHA384_SECP384R1_SELF_TEST_1 862 /*** Tests for DECDSA-SHA384/SECP384R1 ***/ 863 static const u8 decdsa_rfc6979_SECP384R1_SHA384_1_test_vector_expected_sig[] = { 864 0x82, 0x03, 0xb6, 0x3d, 0x3c, 0x85, 0x3e, 0x8d, 865 0x77, 0x22, 0x7f, 0xb3, 0x77, 0xbc, 0xf7, 0xb7, 866 0xb7, 0x72, 0xe9, 0x78, 0x92, 0xa8, 0x0f, 0x36, 867 0xab, 0x77, 0x5d, 0x50, 0x9d, 0x7a, 0x5f, 0xeb, 868 0x05, 0x42, 0xa7, 0xf0, 0x81, 0x29, 0x98, 0xda, 869 0x8f, 0x1d, 0xd3, 0xca, 0x3c, 0xf0, 0x23, 0xdb, 870 0xdd, 0xd0, 0x76, 0x04, 0x48, 0xd4, 0x2d, 0x8a, 871 0x43, 0xaf, 0x45, 0xaf, 0x83, 0x6f, 0xce, 0x4d, 872 0xe8, 0xbe, 0x06, 0xb4, 0x85, 0xe9, 0xb6, 0x1b, 873 0x82, 0x7c, 0x2f, 0x13, 0x17, 0x39, 0x23, 0xe0, 874 0x6a, 0x73, 0x9f, 0x04, 0x06, 0x49, 0xa6, 0x67, 875 0xbf, 0x3b, 0x82, 0x82, 0x46, 0xba, 0xa5, 0xa5 876 }; 877 static const u8 decdsa_rfc6979_SECP384R1_SHA384_1_test_vector_priv_key[] = { 878 0x6b, 0x9d, 0x3d, 0xad, 0x2e, 0x1b, 0x8c, 0x1c, 879 0x05, 0xb1, 0x98, 0x75, 0xb6, 0x65, 0x9f, 0x4d, 880 0xe2, 0x3c, 0x3b, 0x66, 0x7b, 0xf2, 0x97, 0xba, 881 0x9a, 0xa4, 0x77, 0x40, 0x78, 0x71, 0x37, 0xd8, 882 0x96, 0xd5, 0x72, 0x4e, 0x4c, 0x70, 0xa8, 0x25, 883 0xf8, 0x72, 0xc9, 0xea, 0x60, 0xd2, 0xed, 0xf5 884 }; 885 static const ec_test_case decdsa_rfc6979_SECP384R1_SHA384_1_test_case = { 886 .name="DECDSA-SHA384/SECP384R1 1", 887 .ec_str_p = &secp384r1_str_params, 888 .priv_key = decdsa_rfc6979_SECP384R1_SHA384_1_test_vector_priv_key, 889 .priv_key_len = sizeof(decdsa_rfc6979_SECP384R1_SHA384_1_test_vector_priv_key), 890 .nn_random = NULL, 891 .hash_type = SHA384, 892 .msg = "test", 893 .msglen = 4, 894 .sig_type = DECDSA, 895 .exp_sig = decdsa_rfc6979_SECP384R1_SHA384_1_test_vector_expected_sig, 896 .exp_siglen = sizeof(decdsa_rfc6979_SECP384R1_SHA384_1_test_vector_expected_sig), 897 .adata = NULL, 898 .adata_len = 0 899 }; 900 #endif /* WITH_CURVE_SECP384R1 */ 901 #endif /* WITH_HASH_SHA384 */ 902 903 #ifdef WITH_HASH_SHA512 904 #ifdef WITH_CURVE_SECP384R1 905 #define DECDSA_SHA512_SECP384R1_SELF_TEST_1 906 /*** Tests for DECDSA-SHA512/SECP384R1 ***/ 907 static const u8 decdsa_rfc6979_SECP384R1_SHA512_1_test_vector_expected_sig[] = { 908 0xa0, 0xd5, 0xd0, 0x90, 0xc9, 0x98, 0x0f, 0xaf, 909 0x3c, 0x2c, 0xe5, 0x7b, 0x7a, 0xe9, 0x51, 0xd3, 910 0x19, 0x77, 0xdd, 0x11, 0xc7, 0x75, 0xd3, 0x14, 911 0xaf, 0x55, 0xf7, 0x6c, 0x67, 0x64, 0x47, 0xd0, 912 0x6f, 0xb6, 0x49, 0x5c, 0xd2, 0x1b, 0x4b, 0x6e, 913 0x34, 0x0f, 0xc2, 0x36, 0x58, 0x4f, 0xb2, 0x77, 914 0x97, 0x69, 0x84, 0xe5, 0x9b, 0x4c, 0x77, 0xb0, 915 0xe8, 0xe4, 0x46, 0x0d, 0xca, 0x3d, 0x9f, 0x20, 916 0xe0, 0x7b, 0x9b, 0xb1, 0xf6, 0x3b, 0xee, 0xfa, 917 0xf5, 0x76, 0xf6, 0xb2, 0xe8, 0xb2, 0x24, 0x63, 918 0x4a, 0x20, 0x92, 0xcd, 0x37, 0x92, 0xe0, 0x15, 919 0x9a, 0xd9, 0xce, 0xe3, 0x76, 0x59, 0xc7, 0x36 920 }; 921 static const u8 decdsa_rfc6979_SECP384R1_SHA512_1_test_vector_priv_key[] = { 922 0x6b, 0x9d, 0x3d, 0xad, 0x2e, 0x1b, 0x8c, 0x1c, 923 0x05, 0xb1, 0x98, 0x75, 0xb6, 0x65, 0x9f, 0x4d, 924 0xe2, 0x3c, 0x3b, 0x66, 0x7b, 0xf2, 0x97, 0xba, 925 0x9a, 0xa4, 0x77, 0x40, 0x78, 0x71, 0x37, 0xd8, 926 0x96, 0xd5, 0x72, 0x4e, 0x4c, 0x70, 0xa8, 0x25, 927 0xf8, 0x72, 0xc9, 0xea, 0x60, 0xd2, 0xed, 0xf5 928 }; 929 static const ec_test_case decdsa_rfc6979_SECP384R1_SHA512_1_test_case = { 930 .name="DECDSA-SHA512/SECP384R1 1", 931 .ec_str_p = &secp384r1_str_params, 932 .priv_key = decdsa_rfc6979_SECP384R1_SHA512_1_test_vector_priv_key, 933 .priv_key_len = sizeof(decdsa_rfc6979_SECP384R1_SHA512_1_test_vector_priv_key), 934 .nn_random = NULL, 935 .hash_type = SHA512, 936 .msg = "test", 937 .msglen = 4, 938 .sig_type = DECDSA, 939 .exp_sig = decdsa_rfc6979_SECP384R1_SHA512_1_test_vector_expected_sig, 940 .exp_siglen = sizeof(decdsa_rfc6979_SECP384R1_SHA512_1_test_vector_expected_sig), 941 .adata = NULL, 942 .adata_len = 0 943 }; 944 #endif /* WITH_CURVE_SECP384R1 */ 945 #endif /* WITH_HASH_SHA512 */ 946 947 #ifdef WITH_HASH_SHA224 948 #ifdef WITH_CURVE_SECP521R1 949 #define DECDSA_SHA224_SECP521R1_SELF_TEST_0 950 /*** Tests for DECDSA-SHA224/SECP521R1 ***/ 951 static const u8 decdsa_rfc6979_SECP521R1_SHA224_0_test_vector_expected_sig[] = { 952 0x01, 0x77, 0x63, 0x31, 0xcf, 0xcd, 0xf9, 0x27, 953 0xd6, 0x66, 0xe0, 0x32, 0xe0, 0x0c, 0xf7, 0x76, 954 0x18, 0x7b, 0xc9, 0xfd, 0xd8, 0xe6, 0x9d, 0x0d, 955 0xab, 0xb4, 0x10, 0x9f, 0xfe, 0x1b, 0x5e, 0x2a, 956 0x30, 0x71, 0x5f, 0x4c, 0xc9, 0x23, 0xa4, 0xa5, 957 0xe9, 0x4d, 0x25, 0x03, 0xe9, 0xac, 0xfe, 0xd9, 958 0x28, 0x57, 0xb7, 0xf3, 0x1d, 0x71, 0x52, 0xe0, 959 0xf8, 0xc0, 0x0c, 0x15, 0xff, 0x3d, 0x87, 0xe2, 960 0xed, 0x2e, 0x00, 0x50, 0xcb, 0x52, 0x65, 0x41, 961 0x7f, 0xe2, 0x32, 0x0b, 0xbb, 0x5a, 0x12, 0x2b, 962 0x8e, 0x1a, 0x32, 0xbd, 0x69, 0x90, 0x89, 0x85, 963 0x11, 0x28, 0xe3, 0x60, 0xe6, 0x20, 0xa3, 0x0c, 964 0x7e, 0x17, 0xba, 0x41, 0xa6, 0x66, 0xaf, 0x12, 965 0x6c, 0xe1, 0x00, 0xe5, 0x79, 0x9b, 0x15, 0x3b, 966 0x60, 0x52, 0x8d, 0x53, 0x00, 0xd0, 0x84, 0x89, 967 0xca, 0x91, 0x78, 0xfb, 0x61, 0x0a, 0x20, 0x06, 968 0xc2, 0x54, 0xb4, 0x1f 969 }; 970 static const u8 decdsa_rfc6979_SECP521R1_SHA224_0_test_vector_priv_key[] = { 971 0x00, 0xfa, 0xd0, 0x6d, 0xaa, 0x62, 0xba, 0x3b, 972 0x25, 0xd2, 0xfb, 0x40, 0x13, 0x3d, 0xa7, 0x57, 973 0x20, 0x5d, 0xe6, 0x7f, 0x5b, 0xb0, 0x01, 0x8f, 974 0xee, 0x8c, 0x86, 0xe1, 0xb6, 0x8c, 0x7e, 0x75, 975 0xca, 0xa8, 0x96, 0xeb, 0x32, 0xf1, 0xf4, 0x7c, 976 0x70, 0x85, 0x58, 0x36, 0xa6, 0xd1, 0x6f, 0xcc, 977 0x14, 0x66, 0xf6, 0xd8, 0xfb, 0xec, 0x67, 0xdb, 978 0x89, 0xec, 0x0c, 0x08, 0xb0, 0xe9, 0x96, 0xb8, 979 0x35, 0x38 980 }; 981 static const ec_test_case decdsa_rfc6979_SECP521R1_SHA224_0_test_case = { 982 .name="DECDSA-SHA224/SECP521R1 0", 983 .ec_str_p = &secp521r1_str_params, 984 .priv_key = decdsa_rfc6979_SECP521R1_SHA224_0_test_vector_priv_key, 985 .priv_key_len = sizeof(decdsa_rfc6979_SECP521R1_SHA224_0_test_vector_priv_key), 986 .nn_random = NULL, 987 .hash_type = SHA224, 988 .msg = "sample", 989 .msglen = 6, 990 .sig_type = DECDSA, 991 .exp_sig = decdsa_rfc6979_SECP521R1_SHA224_0_test_vector_expected_sig, 992 .exp_siglen = sizeof(decdsa_rfc6979_SECP521R1_SHA224_0_test_vector_expected_sig), 993 .adata = NULL, 994 .adata_len = 0 995 }; 996 #endif /* WITH_CURVE_SECP521R1 */ 997 #endif /* WITH_HASH_SHA224 */ 998 999 #ifdef WITH_HASH_SHA256 1000 #ifdef WITH_CURVE_SECP521R1 1001 #define DECDSA_SHA256_SECP521R1_SELF_TEST_0 1002 /*** Tests for DECDSA-SHA256/SECP521R1 ***/ 1003 static const u8 decdsa_rfc6979_SECP521R1_SHA256_0_test_vector_expected_sig[] = { 1004 0x01, 0x51, 0x1b, 0xb4, 0xd6, 0x75, 0x11, 0x4f, 1005 0xe2, 0x66, 0xfc, 0x43, 0x72, 0xb8, 0x76, 0x82, 1006 0xba, 0xec, 0xc0, 0x1d, 0x3c, 0xc6, 0x2c, 0xf2, 1007 0x30, 0x3c, 0x92, 0xb3, 0x52, 0x60, 0x12, 0x65, 1008 0x9d, 0x16, 0x87, 0x6e, 0x25, 0xc7, 0xc1, 0xe5, 1009 0x76, 0x48, 0xf2, 0x3b, 0x73, 0x56, 0x4d, 0x67, 1010 0xf6, 0x1c, 0x6f, 0x14, 0xd5, 0x27, 0xd5, 0x49, 1011 0x72, 0x81, 0x04, 0x21, 0xe7, 0xd8, 0x75, 0x89, 1012 0xe1, 0xa7, 0x00, 0x4a, 0x17, 0x11, 0x43, 0xa8, 1013 0x31, 0x63, 0xd6, 0xdf, 0x46, 0x0a, 0xaf, 0x61, 1014 0x52, 0x26, 0x95, 0xf2, 0x07, 0xa5, 0x8b, 0x95, 1015 0xc0, 0x64, 0x4d, 0x87, 0xe5, 0x2a, 0xa1, 0xa3, 1016 0x47, 0x91, 0x6e, 0x4f, 0x7a, 0x72, 0x93, 0x0b, 1017 0x1b, 0xc0, 0x6d, 0xbe, 0x22, 0xce, 0x3f, 0x58, 1018 0x26, 0x4a, 0xfd, 0x23, 0x70, 0x4c, 0xbb, 0x63, 1019 0xb2, 0x9b, 0x93, 0x1f, 0x7d, 0xe6, 0xc9, 0xd9, 1020 0x49, 0xa7, 0xec, 0xfc 1021 }; 1022 static const u8 decdsa_rfc6979_SECP521R1_SHA256_0_test_vector_priv_key[] = { 1023 0x00, 0xfa, 0xd0, 0x6d, 0xaa, 0x62, 0xba, 0x3b, 1024 0x25, 0xd2, 0xfb, 0x40, 0x13, 0x3d, 0xa7, 0x57, 1025 0x20, 0x5d, 0xe6, 0x7f, 0x5b, 0xb0, 0x01, 0x8f, 1026 0xee, 0x8c, 0x86, 0xe1, 0xb6, 0x8c, 0x7e, 0x75, 1027 0xca, 0xa8, 0x96, 0xeb, 0x32, 0xf1, 0xf4, 0x7c, 1028 0x70, 0x85, 0x58, 0x36, 0xa6, 0xd1, 0x6f, 0xcc, 1029 0x14, 0x66, 0xf6, 0xd8, 0xfb, 0xec, 0x67, 0xdb, 1030 0x89, 0xec, 0x0c, 0x08, 0xb0, 0xe9, 0x96, 0xb8, 1031 0x35, 0x38 1032 }; 1033 static const ec_test_case decdsa_rfc6979_SECP521R1_SHA256_0_test_case = { 1034 .name="DECDSA-SHA256/SECP521R1 0", 1035 .ec_str_p = &secp521r1_str_params, 1036 .priv_key = decdsa_rfc6979_SECP521R1_SHA256_0_test_vector_priv_key, 1037 .priv_key_len = sizeof(decdsa_rfc6979_SECP521R1_SHA256_0_test_vector_priv_key), 1038 .nn_random = NULL, 1039 .hash_type = SHA256, 1040 .msg = "sample", 1041 .msglen = 6, 1042 .sig_type = DECDSA, 1043 .exp_sig = decdsa_rfc6979_SECP521R1_SHA256_0_test_vector_expected_sig, 1044 .exp_siglen = sizeof(decdsa_rfc6979_SECP521R1_SHA256_0_test_vector_expected_sig), 1045 .adata = NULL, 1046 .adata_len = 0 1047 }; 1048 #endif /* WITH_CURVE_SECP521R1 */ 1049 #endif /* WITH_HASH_SHA256 */ 1050 1051 #ifdef WITH_HASH_SHA384 1052 #ifdef WITH_CURVE_SECP521R1 1053 #define DECDSA_SHA384_SECP521R1_SELF_TEST_0 1054 /*** Tests for DECDSA-SHA384/SECP521R1 ***/ 1055 static const u8 decdsa_rfc6979_SECP521R1_SHA384_0_test_vector_expected_sig[] = { 1056 0x01, 0xea, 0x84, 0x2a, 0x0e, 0x17, 0xd2, 0xde, 1057 0x4f, 0x92, 0xc1, 0x53, 0x15, 0xc6, 0x3d, 0xdf, 1058 0x72, 0x68, 0x5c, 0x18, 0x19, 0x5c, 0x2b, 0xb9, 1059 0x5e, 0x57, 0x2b, 0x9c, 0x51, 0x36, 0xca, 0x4b, 1060 0x4b, 0x57, 0x6a, 0xd7, 0x12, 0xa5, 0x2b, 0xe9, 1061 0x73, 0x06, 0x27, 0xd1, 0x60, 0x54, 0xba, 0x40, 1062 0xcc, 0x0b, 0x8d, 0x3f, 0xf0, 0x35, 0xb1, 0x2a, 1063 0xe7, 0x51, 0x68, 0x39, 0x7f, 0x5d, 0x50, 0xc6, 1064 0x74, 0x51, 0x01, 0xf2, 0x1a, 0x3c, 0xee, 0x06, 1065 0x6e, 0x19, 0x61, 0x02, 0x5f, 0xb0, 0x48, 0xbd, 1066 0x5f, 0xe2, 0xb7, 0x92, 0x4d, 0x0c, 0xd7, 0x97, 1067 0xba, 0xbe, 0x0a, 0x83, 0xb6, 0x6f, 0x1e, 0x35, 1068 0xee, 0xaf, 0x5f, 0xde, 0x14, 0x3f, 0xa8, 0x5d, 1069 0xc3, 0x94, 0xa7, 0xde, 0xe7, 0x66, 0x52, 0x33, 1070 0x93, 0x78, 0x44, 0x84, 0xbd, 0xf3, 0xe0, 0x01, 1071 0x14, 0xa1, 0xc8, 0x57, 0xcd, 0xe1, 0xaa, 0x20, 1072 0x3d, 0xb6, 0x5d, 0x61 1073 }; 1074 static const u8 decdsa_rfc6979_SECP521R1_SHA384_0_test_vector_priv_key[] = { 1075 0x00, 0xfa, 0xd0, 0x6d, 0xaa, 0x62, 0xba, 0x3b, 1076 0x25, 0xd2, 0xfb, 0x40, 0x13, 0x3d, 0xa7, 0x57, 1077 0x20, 0x5d, 0xe6, 0x7f, 0x5b, 0xb0, 0x01, 0x8f, 1078 0xee, 0x8c, 0x86, 0xe1, 0xb6, 0x8c, 0x7e, 0x75, 1079 0xca, 0xa8, 0x96, 0xeb, 0x32, 0xf1, 0xf4, 0x7c, 1080 0x70, 0x85, 0x58, 0x36, 0xa6, 0xd1, 0x6f, 0xcc, 1081 0x14, 0x66, 0xf6, 0xd8, 0xfb, 0xec, 0x67, 0xdb, 1082 0x89, 0xec, 0x0c, 0x08, 0xb0, 0xe9, 0x96, 0xb8, 1083 0x35, 0x38 1084 }; 1085 static const ec_test_case decdsa_rfc6979_SECP521R1_SHA384_0_test_case = { 1086 .name="DECDSA-SHA384/SECP521R1 0", 1087 .ec_str_p = &secp521r1_str_params, 1088 .priv_key = decdsa_rfc6979_SECP521R1_SHA384_0_test_vector_priv_key, 1089 .priv_key_len = sizeof(decdsa_rfc6979_SECP521R1_SHA384_0_test_vector_priv_key), 1090 .nn_random = NULL, 1091 .hash_type = SHA384, 1092 .msg = "sample", 1093 .msglen = 6, 1094 .sig_type = DECDSA, 1095 .exp_sig = decdsa_rfc6979_SECP521R1_SHA384_0_test_vector_expected_sig, 1096 .exp_siglen = sizeof(decdsa_rfc6979_SECP521R1_SHA384_0_test_vector_expected_sig), 1097 .adata = NULL, 1098 .adata_len = 0 1099 }; 1100 #endif /* WITH_CURVE_SECP521R1 */ 1101 #endif /* WITH_HASH_SHA384 */ 1102 1103 #ifdef WITH_HASH_SHA512 1104 #ifdef WITH_CURVE_SECP521R1 1105 #define DECDSA_SHA512_SECP521R1_SELF_TEST_0 1106 /*** Tests for DECDSA-SHA512/SECP521R1 ***/ 1107 static const u8 decdsa_rfc6979_SECP521R1_SHA512_0_test_vector_expected_sig[] = { 1108 0x00, 0xc3, 0x28, 0xfa, 0xfc, 0xbd, 0x79, 0xdd, 1109 0x77, 0x85, 0x03, 0x70, 0xc4, 0x63, 0x25, 0xd9, 1110 0x87, 0xcb, 0x52, 0x55, 0x69, 0xfb, 0x63, 0xc5, 1111 0xd3, 0xbc, 0x53, 0x95, 0x0e, 0x6d, 0x4c, 0x5f, 1112 0x17, 0x4e, 0x25, 0xa1, 0xee, 0x90, 0x17, 0xb5, 1113 0xd4, 0x50, 0x60, 0x6a, 0xdd, 0x15, 0x2b, 0x53, 1114 0x49, 0x31, 0xd7, 0xd4, 0xe8, 0x45, 0x5c, 0xc9, 1115 0x1f, 0x9b, 0x15, 0xbf, 0x05, 0xec, 0x36, 0xe3, 1116 0x77, 0xfa, 0x00, 0x61, 0x7c, 0xce, 0x7c, 0xf5, 1117 0x06, 0x48, 0x06, 0xc4, 0x67, 0xf6, 0x78, 0xd3, 1118 0xb4, 0x08, 0x0d, 0x6f, 0x1c, 0xc5, 0x0a, 0xf2, 1119 0x6c, 0xa2, 0x09, 0x41, 0x73, 0x08, 0x28, 0x1b, 1120 0x68, 0xaf, 0x28, 0x26, 0x23, 0xea, 0xa6, 0x3e, 1121 0x5b, 0x5c, 0x07, 0x23, 0xd8, 0xb8, 0xc3, 0x7f, 1122 0xf0, 0x77, 0x7b, 0x1a, 0x20, 0xf8, 0xcc, 0xb1, 1123 0xdc, 0xcc, 0x43, 0x99, 0x7f, 0x1e, 0xe0, 0xe4, 1124 0x4d, 0xa4, 0xa6, 0x7a 1125 }; 1126 static const u8 decdsa_rfc6979_SECP521R1_SHA512_0_test_vector_priv_key[] = { 1127 0x00, 0xfa, 0xd0, 0x6d, 0xaa, 0x62, 0xba, 0x3b, 1128 0x25, 0xd2, 0xfb, 0x40, 0x13, 0x3d, 0xa7, 0x57, 1129 0x20, 0x5d, 0xe6, 0x7f, 0x5b, 0xb0, 0x01, 0x8f, 1130 0xee, 0x8c, 0x86, 0xe1, 0xb6, 0x8c, 0x7e, 0x75, 1131 0xca, 0xa8, 0x96, 0xeb, 0x32, 0xf1, 0xf4, 0x7c, 1132 0x70, 0x85, 0x58, 0x36, 0xa6, 0xd1, 0x6f, 0xcc, 1133 0x14, 0x66, 0xf6, 0xd8, 0xfb, 0xec, 0x67, 0xdb, 1134 0x89, 0xec, 0x0c, 0x08, 0xb0, 0xe9, 0x96, 0xb8, 1135 0x35, 0x38 1136 }; 1137 static const ec_test_case decdsa_rfc6979_SECP521R1_SHA512_0_test_case = { 1138 .name="DECDSA-SHA512/SECP521R1 0", 1139 .ec_str_p = &secp521r1_str_params, 1140 .priv_key = decdsa_rfc6979_SECP521R1_SHA512_0_test_vector_priv_key, 1141 .priv_key_len = sizeof(decdsa_rfc6979_SECP521R1_SHA512_0_test_vector_priv_key), 1142 .nn_random = NULL, 1143 .hash_type = SHA512, 1144 .msg = "sample", 1145 .msglen = 6, 1146 .sig_type = DECDSA, 1147 .exp_sig = decdsa_rfc6979_SECP521R1_SHA512_0_test_vector_expected_sig, 1148 .exp_siglen = sizeof(decdsa_rfc6979_SECP521R1_SHA512_0_test_vector_expected_sig), 1149 .adata = NULL, 1150 .adata_len = 0 1151 }; 1152 #endif /* WITH_CURVE_SECP521R1 */ 1153 #endif /* WITH_HASH_SHA512 */ 1154 1155 #ifdef WITH_HASH_SHA224 1156 #ifdef WITH_CURVE_SECP521R1 1157 #define DECDSA_SHA224_SECP521R1_SELF_TEST_1 1158 /*** Tests for DECDSA-SHA224/SECP521R1 ***/ 1159 static const u8 decdsa_rfc6979_SECP521R1_SHA224_1_test_vector_expected_sig[] = { 1160 0x01, 0xc7, 0xed, 0x90, 0x2e, 0x12, 0x3e, 0x68, 1161 0x15, 0x54, 0x60, 0x65, 0xa2, 0xc4, 0xaf, 0x97, 1162 0x7b, 0x22, 0xaa, 0x8e, 0xad, 0xdb, 0x68, 0xb2, 1163 0xc1, 0x11, 0x0e, 0x7e, 0xa4, 0x4d, 0x42, 0x08, 1164 0x6b, 0xfe, 0x4a, 0x34, 0xb6, 0x7d, 0xdc, 0x0e, 1165 0x17, 0xe9, 0x65, 0x36, 0xe3, 0x58, 0x21, 0x9b, 1166 0x23, 0xa7, 0x06, 0xc6, 0xa6, 0xe1, 0x6b, 0xa7, 1167 0x7b, 0x65, 0xe1, 0xc5, 0x95, 0xd4, 0x3c, 0xae, 1168 0x17, 0xfb, 0x01, 0x77, 0x33, 0x66, 0x76, 0x30, 1169 0x4f, 0xcb, 0x34, 0x3c, 0xe0, 0x28, 0xb3, 0x8e, 1170 0x7b, 0x4f, 0xba, 0x76, 0xc1, 0xc1, 0xb2, 0x77, 1171 0xda, 0x18, 0xca, 0xd2, 0xa8, 0x47, 0x8b, 0x2a, 1172 0x9a, 0x9f, 0x5b, 0xec, 0x0f, 0x3b, 0xa0, 0x4f, 1173 0x35, 0xdb, 0x3e, 0x42, 0x63, 0x56, 0x9e, 0xc6, 1174 0xaa, 0xde, 0x8c, 0x92, 0x74, 0x6e, 0x4c, 0x82, 1175 0xf8, 0x29, 0x9a, 0xe1, 0xb8, 0xf1, 0x73, 0x9f, 1176 0x8f, 0xd5, 0x19, 0xa4 1177 }; 1178 static const u8 decdsa_rfc6979_SECP521R1_SHA224_1_test_vector_priv_key[] = { 1179 0x00, 0xfa, 0xd0, 0x6d, 0xaa, 0x62, 0xba, 0x3b, 1180 0x25, 0xd2, 0xfb, 0x40, 0x13, 0x3d, 0xa7, 0x57, 1181 0x20, 0x5d, 0xe6, 0x7f, 0x5b, 0xb0, 0x01, 0x8f, 1182 0xee, 0x8c, 0x86, 0xe1, 0xb6, 0x8c, 0x7e, 0x75, 1183 0xca, 0xa8, 0x96, 0xeb, 0x32, 0xf1, 0xf4, 0x7c, 1184 0x70, 0x85, 0x58, 0x36, 0xa6, 0xd1, 0x6f, 0xcc, 1185 0x14, 0x66, 0xf6, 0xd8, 0xfb, 0xec, 0x67, 0xdb, 1186 0x89, 0xec, 0x0c, 0x08, 0xb0, 0xe9, 0x96, 0xb8, 1187 0x35, 0x38 1188 }; 1189 static const ec_test_case decdsa_rfc6979_SECP521R1_SHA224_1_test_case = { 1190 .name="DECDSA-SHA224/SECP521R1 1", 1191 .ec_str_p = &secp521r1_str_params, 1192 .priv_key = decdsa_rfc6979_SECP521R1_SHA224_1_test_vector_priv_key, 1193 .priv_key_len = sizeof(decdsa_rfc6979_SECP521R1_SHA224_1_test_vector_priv_key), 1194 .nn_random = NULL, 1195 .hash_type = SHA224, 1196 .msg = "test", 1197 .msglen = 4, 1198 .sig_type = DECDSA, 1199 .exp_sig = decdsa_rfc6979_SECP521R1_SHA224_1_test_vector_expected_sig, 1200 .exp_siglen = sizeof(decdsa_rfc6979_SECP521R1_SHA224_1_test_vector_expected_sig), 1201 .adata = NULL, 1202 .adata_len = 0 1203 }; 1204 #endif /* WITH_CURVE_SECP521R1 */ 1205 #endif /* WITH_HASH_SHA224 */ 1206 1207 #ifdef WITH_HASH_SHA256 1208 #ifdef WITH_CURVE_SECP521R1 1209 #define DECDSA_SHA256_SECP521R1_SELF_TEST_1 1210 /*** Tests for DECDSA-SHA256/SECP521R1 ***/ 1211 static const u8 decdsa_rfc6979_SECP521R1_SHA256_1_test_vector_expected_sig[] = { 1212 0x00, 0x0e, 0x87, 0x1c, 0x4a, 0x14, 0xf9, 0x93, 1213 0xc6, 0xc7, 0x36, 0x95, 0x01, 0x90, 0x0c, 0x4b, 1214 0xc1, 0xe9, 0xc7, 0xb0, 0xb4, 0xba, 0x44, 0xe0, 1215 0x48, 0x68, 0xb3, 0x0b, 0x41, 0xd8, 0x07, 0x10, 1216 0x42, 0xeb, 0x28, 0xc4, 0xc2, 0x50, 0x41, 0x1d, 1217 0x0c, 0xe0, 0x8c, 0xd1, 0x97, 0xe4, 0x18, 0x8e, 1218 0xa4, 0x87, 0x6f, 0x27, 0x9f, 0x90, 0xb3, 0xd8, 1219 0xd7, 0x4a, 0x3c, 0x76, 0xe6, 0xf1, 0xe4, 0x65, 1220 0x6a, 0xa8, 0x00, 0xcd, 0x52, 0xdb, 0xaa, 0x33, 1221 0xb0, 0x63, 0xc3, 0xa6, 0xcd, 0x80, 0x58, 0xa1, 1222 0xfb, 0x0a, 0x46, 0xa4, 0x75, 0x4b, 0x03, 0x4f, 1223 0xcc, 0x64, 0x47, 0x66, 0xca, 0x14, 0xda, 0x8c, 1224 0xa5, 0xca, 0x9f, 0xde, 0x00, 0xe8, 0x8c, 0x1a, 1225 0xd6, 0x0c, 0xcb, 0xa7, 0x59, 0x02, 0x52, 0x99, 1226 0x07, 0x9d, 0x7a, 0x42, 0x7e, 0xc3, 0xcc, 0x5b, 1227 0x61, 0x9b, 0xfb, 0xc8, 0x28, 0xe7, 0x76, 0x9b, 1228 0xcd, 0x69, 0x4e, 0x86 1229 }; 1230 static const u8 decdsa_rfc6979_SECP521R1_SHA256_1_test_vector_priv_key[] = { 1231 0x00, 0xfa, 0xd0, 0x6d, 0xaa, 0x62, 0xba, 0x3b, 1232 0x25, 0xd2, 0xfb, 0x40, 0x13, 0x3d, 0xa7, 0x57, 1233 0x20, 0x5d, 0xe6, 0x7f, 0x5b, 0xb0, 0x01, 0x8f, 1234 0xee, 0x8c, 0x86, 0xe1, 0xb6, 0x8c, 0x7e, 0x75, 1235 0xca, 0xa8, 0x96, 0xeb, 0x32, 0xf1, 0xf4, 0x7c, 1236 0x70, 0x85, 0x58, 0x36, 0xa6, 0xd1, 0x6f, 0xcc, 1237 0x14, 0x66, 0xf6, 0xd8, 0xfb, 0xec, 0x67, 0xdb, 1238 0x89, 0xec, 0x0c, 0x08, 0xb0, 0xe9, 0x96, 0xb8, 1239 0x35, 0x38 1240 }; 1241 static const ec_test_case decdsa_rfc6979_SECP521R1_SHA256_1_test_case = { 1242 .name="DECDSA-SHA256/SECP521R1 1", 1243 .ec_str_p = &secp521r1_str_params, 1244 .priv_key = decdsa_rfc6979_SECP521R1_SHA256_1_test_vector_priv_key, 1245 .priv_key_len = sizeof(decdsa_rfc6979_SECP521R1_SHA256_1_test_vector_priv_key), 1246 .nn_random = NULL, 1247 .hash_type = SHA256, 1248 .msg = "test", 1249 .msglen = 4, 1250 .sig_type = DECDSA, 1251 .exp_sig = decdsa_rfc6979_SECP521R1_SHA256_1_test_vector_expected_sig, 1252 .exp_siglen = sizeof(decdsa_rfc6979_SECP521R1_SHA256_1_test_vector_expected_sig), 1253 .adata = NULL, 1254 .adata_len = 0 1255 }; 1256 #endif /* WITH_CURVE_SECP521R1 */ 1257 #endif /* WITH_HASH_SHA256 */ 1258 1259 #ifdef WITH_HASH_SHA384 1260 #ifdef WITH_CURVE_SECP521R1 1261 #define DECDSA_SHA384_SECP521R1_SELF_TEST_1 1262 /*** Tests for DECDSA-SHA384/SECP521R1 ***/ 1263 static const u8 decdsa_rfc6979_SECP521R1_SHA384_1_test_vector_expected_sig[] = { 1264 0x01, 0x4b, 0xee, 0x21, 0xa1, 0x8b, 0x6d, 0x8b, 1265 0x3c, 0x93, 0xfa, 0xb0, 0x8d, 0x43, 0xe7, 0x39, 1266 0x70, 0x79, 0x53, 0x24, 0x4f, 0xdb, 0xe9, 0x24, 1267 0xfa, 0x92, 0x6d, 0x76, 0x66, 0x9e, 0x7a, 0xc8, 1268 0xc8, 0x9d, 0xf6, 0x2e, 0xd8, 0x97, 0x5c, 0x2d, 1269 0x83, 0x97, 0xa6, 0x5a, 0x49, 0xdc, 0xc0, 0x9f, 1270 0x6b, 0x0a, 0xc6, 0x22, 0x72, 0x74, 0x19, 0x24, 1271 0xd4, 0x79, 0x35, 0x4d, 0x74, 0xff, 0x60, 0x75, 1272 0x57, 0x8c, 0x01, 0x33, 0x33, 0x08, 0x65, 0xc0, 1273 0x67, 0xa0, 0xea, 0xf7, 0x23, 0x62, 0xa6, 0x5e, 1274 0x2d, 0x7b, 0xc4, 0xe4, 0x61, 0xe8, 0xc8, 0x99, 1275 0x5c, 0x3b, 0x62, 0x26, 0xa2, 0x1b, 0xd1, 0xaa, 1276 0x78, 0xf0, 0xed, 0x94, 0xfe, 0x53, 0x6a, 0x0d, 1277 0xca, 0x35, 0x53, 0x4f, 0x0c, 0xd1, 0x51, 0x0c, 1278 0x41, 0x52, 0x5d, 0x16, 0x3f, 0xe9, 0xd7, 0x4d, 1279 0x13, 0x48, 0x81, 0xe3, 0x51, 0x41, 0xed, 0x5e, 1280 0x8e, 0x95, 0xb9, 0x79 1281 }; 1282 static const u8 decdsa_rfc6979_SECP521R1_SHA384_1_test_vector_priv_key[] = { 1283 0x00, 0xfa, 0xd0, 0x6d, 0xaa, 0x62, 0xba, 0x3b, 1284 0x25, 0xd2, 0xfb, 0x40, 0x13, 0x3d, 0xa7, 0x57, 1285 0x20, 0x5d, 0xe6, 0x7f, 0x5b, 0xb0, 0x01, 0x8f, 1286 0xee, 0x8c, 0x86, 0xe1, 0xb6, 0x8c, 0x7e, 0x75, 1287 0xca, 0xa8, 0x96, 0xeb, 0x32, 0xf1, 0xf4, 0x7c, 1288 0x70, 0x85, 0x58, 0x36, 0xa6, 0xd1, 0x6f, 0xcc, 1289 0x14, 0x66, 0xf6, 0xd8, 0xfb, 0xec, 0x67, 0xdb, 1290 0x89, 0xec, 0x0c, 0x08, 0xb0, 0xe9, 0x96, 0xb8, 1291 0x35, 0x38 1292 }; 1293 static const ec_test_case decdsa_rfc6979_SECP521R1_SHA384_1_test_case = { 1294 .name="DECDSA-SHA384/SECP521R1 1", 1295 .ec_str_p = &secp521r1_str_params, 1296 .priv_key = decdsa_rfc6979_SECP521R1_SHA384_1_test_vector_priv_key, 1297 .priv_key_len = sizeof(decdsa_rfc6979_SECP521R1_SHA384_1_test_vector_priv_key), 1298 .nn_random = NULL, 1299 .hash_type = SHA384, 1300 .msg = "test", 1301 .msglen = 4, 1302 .sig_type = DECDSA, 1303 .exp_sig = decdsa_rfc6979_SECP521R1_SHA384_1_test_vector_expected_sig, 1304 .exp_siglen = sizeof(decdsa_rfc6979_SECP521R1_SHA384_1_test_vector_expected_sig), 1305 .adata = NULL, 1306 .adata_len = 0 1307 }; 1308 #endif /* WITH_CURVE_SECP521R1 */ 1309 #endif /* WITH_HASH_SHA384 */ 1310 1311 #ifdef WITH_HASH_SHA512 1312 #ifdef WITH_CURVE_SECP521R1 1313 #define DECDSA_SHA512_SECP521R1_SELF_TEST_1 1314 /*** Tests for DECDSA-SHA512/SECP521R1 ***/ 1315 static const u8 decdsa_rfc6979_SECP521R1_SHA512_1_test_vector_expected_sig[] = { 1316 0x01, 0x3e, 0x99, 0x02, 0x0a, 0xbf, 0x5c, 0xee, 1317 0x75, 0x25, 0xd1, 0x6b, 0x69, 0xb2, 0x29, 0x65, 1318 0x2a, 0xb6, 0xbd, 0xf2, 0xaf, 0xfc, 0xae, 0xf3, 1319 0x87, 0x73, 0xb4, 0xb7, 0xd0, 0x87, 0x25, 0xf1, 1320 0x0c, 0xdb, 0x93, 0x48, 0x2f, 0xdc, 0xc5, 0x4e, 1321 0xdc, 0xee, 0x91, 0xec, 0xa4, 0x16, 0x6b, 0x2a, 1322 0x7c, 0x62, 0x65, 0xef, 0x0c, 0xe2, 0xbd, 0x70, 1323 0x51, 0xb7, 0xce, 0xf9, 0x45, 0xba, 0xbd, 0x47, 1324 0xee, 0x6d, 0x01, 0xfb, 0xd0, 0x01, 0x3c, 0x67, 1325 0x4a, 0xa7, 0x9c, 0xb3, 0x98, 0x49, 0x52, 0x79, 1326 0x16, 0xce, 0x30, 0x1c, 0x66, 0xea, 0x7c, 0xe8, 1327 0xb8, 0x06, 0x82, 0x78, 0x6a, 0xd6, 0x0f, 0x98, 1328 0xf7, 0xe7, 0x8a, 0x19, 0xca, 0x69, 0xef, 0xf5, 1329 0xc5, 0x74, 0x00, 0xe3, 0xb3, 0xa0, 0xad, 0x66, 1330 0xce, 0x09, 0x78, 0x21, 0x4d, 0x13, 0xba, 0xf4, 1331 0xe9, 0xac, 0x60, 0x75, 0x2f, 0x7b, 0x15, 0x5e, 1332 0x2d, 0xe4, 0xdc, 0xe3 1333 }; 1334 static const u8 decdsa_rfc6979_SECP521R1_SHA512_1_test_vector_priv_key[] = { 1335 0x00, 0xfa, 0xd0, 0x6d, 0xaa, 0x62, 0xba, 0x3b, 1336 0x25, 0xd2, 0xfb, 0x40, 0x13, 0x3d, 0xa7, 0x57, 1337 0x20, 0x5d, 0xe6, 0x7f, 0x5b, 0xb0, 0x01, 0x8f, 1338 0xee, 0x8c, 0x86, 0xe1, 0xb6, 0x8c, 0x7e, 0x75, 1339 0xca, 0xa8, 0x96, 0xeb, 0x32, 0xf1, 0xf4, 0x7c, 1340 0x70, 0x85, 0x58, 0x36, 0xa6, 0xd1, 0x6f, 0xcc, 1341 0x14, 0x66, 0xf6, 0xd8, 0xfb, 0xec, 0x67, 0xdb, 1342 0x89, 0xec, 0x0c, 0x08, 0xb0, 0xe9, 0x96, 0xb8, 1343 0x35, 0x38 1344 }; 1345 static const ec_test_case decdsa_rfc6979_SECP521R1_SHA512_1_test_case = { 1346 .name="DECDSA-SHA512/SECP521R1 1", 1347 .ec_str_p = &secp521r1_str_params, 1348 .priv_key = decdsa_rfc6979_SECP521R1_SHA512_1_test_vector_priv_key, 1349 .priv_key_len = sizeof(decdsa_rfc6979_SECP521R1_SHA512_1_test_vector_priv_key), 1350 .nn_random = NULL, 1351 .hash_type = SHA512, 1352 .msg = "test", 1353 .msglen = 4, 1354 .sig_type = DECDSA, 1355 .exp_sig = decdsa_rfc6979_SECP521R1_SHA512_1_test_vector_expected_sig, 1356 .exp_siglen = sizeof(decdsa_rfc6979_SECP521R1_SHA512_1_test_vector_expected_sig), 1357 .adata = NULL, 1358 .adata_len = 0 1359 }; 1360 #endif /* WITH_CURVE_SECP521R1 */ 1361 #endif /* WITH_HASH_SHA512 */ 1362 1363