21 #include <gtest/gtest.h>
33 #include "../../ec_extra/internal.h"
34 #include "../../test/file_test.h"
35 #include "../../test/test_util.h"
36 #include "../bn/internal.h"
43 0x30, 0x31, 0x02, 0x01, 0x01, 0x04, 0x20, 0xc6, 0xc1, 0xaa, 0xda, 0x15, 0xb0,
44 0x76, 0x61, 0xf8, 0x14, 0x2c, 0x6c, 0xaf, 0x0f, 0xdb, 0x24, 0x1a, 0xff, 0x2e,
45 0xfe, 0x46, 0xc0, 0x93, 0x8b, 0x74, 0xf2, 0xbc, 0xc5, 0x30, 0x52, 0xb0, 0x77,
46 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,
52 0x30, 0x82, 0x01, 0x22, 0x02, 0x01, 0x01, 0x04, 0x20, 0xc6, 0xc1, 0xaa,
53 0xda, 0x15, 0xb0, 0x76, 0x61, 0xf8, 0x14, 0x2c, 0x6c, 0xaf, 0x0f, 0xdb,
54 0x24, 0x1a, 0xff, 0x2e, 0xfe, 0x46, 0xc0, 0x93, 0x8b, 0x74, 0xf2, 0xbc,
55 0xc5, 0x30, 0x52, 0xb0, 0x77, 0xa0, 0x81, 0xfa, 0x30, 0x81, 0xf7, 0x02,
56 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01,
57 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01,
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
60 0x30, 0x5b, 0x04, 0x20, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01,
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
63 0x04, 0x20, 0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7, 0xb3, 0xeb,
64 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc, 0x65, 0x1d, 0x06, 0xb0, 0xcc, 0x53,
65 0xb0, 0xf6, 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2, 0x60, 0x4b, 0x03, 0x15,
66 0x00, 0xc4, 0x9d, 0x36, 0x08, 0x86, 0xe7, 0x04, 0x93, 0x6a, 0x66, 0x78,
67 0xe1, 0x13, 0x9d, 0x26, 0xb7, 0x81, 0x9f, 0x7e, 0x90, 0x04, 0x41, 0x04,
68 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc, 0xe6, 0xe5,
69 0x63, 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81, 0x2d, 0xeb, 0x33, 0xa0,
70 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, 0xc2, 0x96, 0x4f, 0xe3, 0x42, 0xe2,
71 0xfe, 0x1a, 0x7f, 0x9b, 0x8e, 0xe7, 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16,
72 0x2b, 0xce, 0x33, 0x57, 0x6b, 0x31, 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68,
73 0x37, 0xbf, 0x51, 0xf5, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00,
74 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbc,
75 0xe6, 0xfa, 0xad, 0xa7, 0x17, 0x9e, 0x84, 0xf3, 0xb9, 0xca, 0xc2, 0xfc,
76 0x63, 0x25, 0x51, 0x02, 0x01, 0x01,
83 0x30, 0x58, 0x02, 0x01, 0x01, 0x04, 0x01, 0x01, 0xa0, 0x0a, 0x06, 0x08, 0x2a,
84 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04,
85 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc, 0xe6, 0xe5, 0x63,
86 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81, 0x2d, 0xeb, 0x33, 0xa0, 0xf4, 0xa1,
87 0x39, 0x45, 0xd8, 0x98, 0xc2, 0x96, 0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f,
88 0x9b, 0x8e, 0xe7, 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16, 0x2b, 0xce, 0x33, 0x57,
89 0x6b, 0x31, 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, 0x51, 0xf5,
96 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
99 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0xa1,
100 0x44, 0x03, 0x42, 0x00, 0x04, 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47,
101 0xf8, 0xbc, 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81, 0x2d,
102 0xeb, 0x33, 0xa0, 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, 0xc2, 0x96, 0x4f, 0xe3,
103 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, 0x8e, 0xe7, 0xeb, 0x4a, 0x7c, 0x0f, 0x9e,
104 0x16, 0x2b, 0xce, 0x33, 0x57, 0x6b, 0x31, 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68,
105 0x37, 0xbf, 0x51, 0xf5,
132 out->assign(der, der + der_len);
154 bssl::UniquePtr<EC_KEY>
key =
159 std::vector<uint8_t>
out;
166 bssl::UniquePtr<BIGNUM>
x(
BN_new());
167 bssl::UniquePtr<BIGNUM>
y(
BN_new());
172 bssl::UniquePtr<char> x_hex(
BN_bn2hex(
x.get()));
173 bssl::UniquePtr<char> y_hex(
BN_bn2hex(
y.get()));
178 "c81561ecf2e54edefe6617db1c7a34a70744ddb261f269b83dacfcd2ade5a681",
181 "e0e2afa3f9b6abe4c698ef6495f1be49a3196c5056acb3763fe4507eec596e88",
187 bssl::UniquePtr<EC_KEY>
key =
190 std::vector<uint8_t>
out;
203 bssl::UniquePtr<EC_KEY>
key =
212 std::vector<uint8_t>
out;
225 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
227 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
230 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
231 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
232 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
235 0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7, 0xb3, 0xeb, 0xbd,
236 0x55, 0x76, 0x98, 0x86, 0xbc, 0x65, 0x1d, 0x06, 0xb0, 0xcc, 0x53,
237 0xb0, 0xf6, 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2, 0x60, 0x4b,
240 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, 0xf8, 0xbc, 0xe6,
241 0xe5, 0x63, 0xa4, 0x40, 0xf2, 0x77, 0x03, 0x7d, 0x81, 0x2d, 0xeb,
242 0x33, 0xa0, 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, 0xc2, 0x96,
245 0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, 0x8e, 0xe7, 0xeb,
246 0x4a, 0x7c, 0x0f, 0x9e, 0x16, 0x2b, 0xce, 0x33, 0x57, 0x6b, 0x31,
247 0x5e, 0xce, 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, 0x51, 0xf5,
250 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
251 0xff, 0xff, 0xff, 0xff, 0xff, 0xbc, 0xe6, 0xfa, 0xad, 0xa7, 0x17,
252 0x9e, 0x84, 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, 0x25, 0x51,
256 bssl::UniquePtr<BIGNUM>
p(
BN_bin2bn(kP,
sizeof(kP),
nullptr));
258 bssl::UniquePtr<BIGNUM>
a(
BN_bin2bn(kA,
sizeof(kA),
nullptr));
260 bssl::UniquePtr<BIGNUM>
b(
BN_bin2bn(kB,
sizeof(kB),
nullptr));
262 bssl::UniquePtr<BIGNUM> gx(
BN_bin2bn(kX,
sizeof(kX),
nullptr));
264 bssl::UniquePtr<BIGNUM> gy(
BN_bin2bn(kY,
sizeof(kY),
nullptr));
269 bssl::UniquePtr<EC_GROUP>
group(
275 group.get(), generator.get(), gx.get(), gy.get(),
ctx.get()));
296 x.get(),
y.get(),
nullptr));
303 bssl::UniquePtr<EC_GROUP> group2(
306 bssl::UniquePtr<EC_POINT> generator2(
EC_POINT_new(group2.get()));
309 group2.get(), generator2.get(), gx.get(), gy.get(),
ctx.get()));
317 bssl::UniquePtr<EC_GROUP> group3(
320 bssl::UniquePtr<EC_POINT> generator3(
EC_POINT_new(group3.get()));
323 group3.get(), generator3.get(),
x.get(),
y.get(),
ctx.get()));
329 #if !defined(BORINGSSL_SHARED_LIBRARY)
339 bssl::UniquePtr<EC_GROUP> group4(
342 bssl::UniquePtr<EC_POINT> generator4(
EC_POINT_new(group4.get()));
345 group4.get(), generator4.get(), gx.get(), gy.get(),
ctx.get()));
356 bssl::UniquePtr<EC_GROUP> group5(
359 bssl::UniquePtr<EC_POINT> generator5(
EC_POINT_new(group5.get()));
362 group5.get(), generator5.get(), gx.get(), gy.get(),
ctx.get()));
370 TEST(ECTest, SetKeyWithoutGroup) {
378 bssl::UniquePtr<EC_GROUP>
group(
402 bssl::UniquePtr<EC_GROUP> p256(
425 return bssl::UniquePtr<BIGNUM>(bn);
430 TEST(ECTest, BrainpoolP256r1) {
431 static const char kP[] =
432 "a9fb57dba1eea9bc3e660a909d838d726e3bf623d52620282013481d1f6e5377";
433 static const char kA[] =
434 "7d5a0975fc2c3057eef67530417affe7fb8055c126dc5c6ce94a4b44f330b5d9";
435 static const char kB[] =
436 "26dc5c6ce94a4b44f330b5d9bbd77cbf958416295cf7e1ce6bccdc18ff8c07b6";
437 static const char kX[] =
438 "8bd2aeb9cb7e57cb2c4b482ffc81b7afb9de27e1e3bd23c23a4453bd9ace3262";
439 static const char kY[] =
440 "547ef835c3dac4fd97f8461a14611dc9c27745132ded8e545c1d54c72f046997";
441 static const char kN[] =
442 "a9fb57dba1eea9bc3e660a909d838d718c397aa3b561a6f7901e0e82974856a7";
443 static const char kD[] =
444 "0da21d76fed40dd82ac3314cce91abb585b5c4246e902b238a839609ea1e7ce1";
445 static const char kQX[] =
446 "3a55e0341cab50452fe27b8a87e4775dec7a9daca94b0d84ad1e9f85b53ea513";
447 static const char kQY[] =
448 "40088146b33bbbe81b092b41146774b35dd478cf056437cfb35ef0df2d269339";
457 bssl::UniquePtr<EC_GROUP>
group(
497 bssl::UniquePtr<BIGNUM>
x(
BN_new());
499 bssl::UniquePtr<BIGNUM>
y(
BN_new());
501 bssl::UniquePtr<BIGNUM>
p(
BN_new());
521 x.get(),
y.get(),
nullptr));
528 x.get(),
y.get(),
nullptr));
573 std::vector<uint8_t> serialized;
579 serialized.size(),
nullptr));
650 bssl::UniquePtr<BIGNUM> zero(
BN_new());
657 <<
"g * 0 did not return point at infinity.";
666 zero.get(),
nullptr));
669 <<
"p * 0 did not return point at infinity.";
682 nullptr,
nullptr,
nullptr));
685 <<
"g * order did not return point at infinity.";
688 bssl::UniquePtr<BIGNUM> forty_two(
BN_new());
697 <<
"p * order did not return point at infinity.";
707 bssl::UniquePtr<BIGNUM> minus_one(
BN_new());
712 bssl::UniquePtr<BIGNUM> seven(
BN_new());
716 bssl::UniquePtr<BIGNUM> ten_n_plus_seven(
732 <<
"-1 * G and (n-1) * G did not give the same result";
737 nullptr,
nullptr,
nullptr));
739 <<
"7 * G and (10n + 7) * G did not give the same result";
748 bssl::UniquePtr<BIGNUM>
n(
BN_new());
766 bssl::UniquePtr<BIGNUM> forty_two(
BN_new());
791 bssl::UniquePtr<BIGNUM> bn(
BN_new());
795 <<
"Unexpectedly set a key of -1";
801 <<
"Unexpectedly set a key of the group order.";
806 bssl::UniquePtr<BIGNUM> forty_two(
BN_new());
817 std::vector<uint8_t> serialized;
822 serialized[serialized.size() - 1]++;
825 serialized.size(),
nullptr));
896 std::vector<EC_builtin_curve> curves(num_curves);
912 if (!t->GetAttribute(&curve_name,
key)) {
916 if (curve_name ==
"P-224") {
919 if (curve_name ==
"P-256") {
923 if (curve_name ==
"P-384") {
926 if (curve_name ==
"P-521") {
930 t->PrintLine(
"Unknown curve '%s'", curve_name.c_str());
935 std::vector<uint8_t>
bytes;
940 return bssl::UniquePtr<BIGNUM>(
944 TEST(ECTest, ScalarBaseMultVectors) {
948 FileTestGTest(
"crypto/fipsmodule/ec/ec_scalar_base_mult_tests.txt",
952 bssl::UniquePtr<BIGNUM>
n =
GetBIGNUM(t,
"N");
954 bssl::UniquePtr<BIGNUM>
x =
GetBIGNUM(t,
"X");
956 bssl::UniquePtr<BIGNUM>
y =
GetBIGNUM(t,
"Y");
960 bssl::UniquePtr<BIGNUM> px(
BN_new());
962 bssl::UniquePtr<BIGNUM> py(
BN_new());
964 auto check_point = [&](
const EC_POINT *
p) {
969 group.get(),
p, px.get(), py.get(),
ctx.get()));
981 check_point(
p.get());
985 check_point(
p.get());
991 TEST(ECTest, DISABLED_ScalarBaseMultVectorsTwoPoint) {
995 FileTestGTest(
"crypto/fipsmodule/ec/ec_scalar_base_mult_tests.txt",
999 bssl::UniquePtr<BIGNUM>
n =
GetBIGNUM(t,
"N");
1001 bssl::UniquePtr<BIGNUM>
x =
GetBIGNUM(t,
"X");
1003 bssl::UniquePtr<BIGNUM>
y =
GetBIGNUM(t,
"Y");
1007 bssl::UniquePtr<BIGNUM> px(
BN_new());
1009 bssl::UniquePtr<BIGNUM> py(
BN_new());
1011 auto check_point = [&](
const EC_POINT *
p) {
1016 group.get(),
p, px.get(), py.get(),
ctx.get()));
1026 for (
int i = -64;
i < 64;
i++) {
1041 check_point(
p.get());
1047 &
g->raw, &b_scalar));
1048 check_point(
p.get());
1054 std::vector<uint8_t>
ret;
1064 std::vector<uint8_t> secret;
1065 std::vector<uint8_t> expected_priv;
1066 std::vector<uint8_t> expected_pub;
1068 const DeriveTest kDeriveTests[] = {
1071 "b98a86a71efb51ebdac4759937b977e9b0c05224675bb2b6a58ba306e237f4b8"),
1073 "04fbe6cab439918e00231a2ff073cdc25823998864a9eb36f809095a1a919ece875"
1074 "a145803fbe89a6cde53936e3c6d9c253ed3d38f5f58cae455c27e95645ceda9")},
1077 "44a72bc62087b88e5ab7126766177ed0d8f1ed09ad066cd746527fc201105a7e"),
1079 "04ec0555cd76e991fef7f5504343937d0f38696db3360a4854052cb0d84a377a5a0"
1080 "ff64c352755c28692b4ae085c2b817db9a1eddbd22e9cf39c12751e0870791b")},
1083 "7ca1e2c83e6a5f2c1b3e7d58180226f269930c4b9fbe2a275096079630b7c57d"),
1085 "0442ef70c8fc0fbe383ed0a0da36f39f9a590f3feebc07863cc858c9a8ef0465731"
1086 "0408c249bd4d61929c54b71ffe056e6b4fa1eb537039b43d1c175f0ceab0f89")},
1089 "de9c9b35543aaa0fba039e34e8ca9695da3225c7161c9e3a8c70356cac28c780"),
1091 "659f5abf3b62b9931c29d6ed0722efd2349fa56f54e708cf3272f620f1bc44d0"),
1093 "046741f806b593bf3a3d4a9d76bdcb9b0d7874633cbea8f42c05e78561f7e8ec362"
1094 "b9b6f1913ded796fbdafe7f210cea897ac22a4e580c06a60f2659fd09f1830f")},
1096 HexToBytes(
"95cd90d548997de090c7622708eccb7edc1b1bd78d2422235ad97406dada"
1097 "076555309da200096f6e4b36c46002beee89"),
1099 "04007b2d026aa7636fa912c3f970d62bb6c10fa81c8f3290ed90b2d701696d1c6b9"
1100 "5af88ce13e962996a7ac37e16527cb5d69bd081b8641d07634cf84b438600ec9434"
1101 "15ac6bd7a0236f7ab0ea31ece67df03fa11646ea2b75e73d1b5e45b75c18")},
1104 for (
const auto &
test : kDeriveTests) {
1120 bssl::UniquePtr<uint8_t> free_pub(pub);
1127 struct HashToCurveTest {
1137 static const HashToCurveTest
kTests[] = {
1140 "P384_XMD:SHA-512_SSWU_RO_TESTGEN",
"",
1141 "2fc0b9efdd63a8e43b4db88dc12f03c798f6fd91bccac0c9096185"
1142 "4386e58fdc54fc2a01f0f358759054ce1f9b762025",
1143 "949b936fabb72cdb02cd7980b86cb6a3adf286658e81301648851d"
1144 "b8a49d9bec00ccb57698d559fc5960fa5030a8e54b"},
1146 "P384_XMD:SHA-512_SSWU_RO_TESTGEN",
"abc",
1147 "4f3338035391e8ce8ce40c974136f0edc97f392ffd44a643338741"
1148 "8ed1b8c2603487e1688ec151f048fbc6b2c138c92f",
1149 "152b90aef6558be328a3168855fb1906452e7167b0f7c8a56ff9d4"
1150 "fa87d6fb522cdf8e409db54418b2c764fd26260757"},
1152 "P384_XMD:SHA-512_SSWU_RO_TESTGEN",
"abcdef0123456789",
1153 "e9e5d7ac397e123d060ad44301cbc8eb972f6e64ebcff29dcc9b9a"
1154 "10357902aace2240c580fec85e5b427d98b4e80703",
1155 "916cb8963521ad75105be43cc4148e5a5bbb4fcf107f1577e4f7fa"
1156 "3ca58cd786aa76890c8e687d2353393bc16c78ec4d"},
1158 "P384_XMD:SHA-512_SSWU_RO_TESTGEN",
1159 "a512_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1160 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1161 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1162 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1163 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1164 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1165 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1166 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1167 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1168 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
1169 "41941db59a7b8b633bd5bfa462f1e29a9f18e5a341445d90fc6eb9"
1170 "37f2913224287b9dfb64742851f760eb14ca115ff9",
1171 "1510e764f1be968d661b7aaecb26a6d38c98e5205ca150f0ae426d"
1172 "2c3983c68e3a9ffb283c6ae4891d891b5705500475"},
1188 std::vector<uint8_t>
buf;
1191 size_t field_len = (
buf.size() - 1) / 2;
1195 1 + field_len, field_len)));
1202 static const uint8_t kDST[] = {0, 1, 2, 3};
1203 static const uint8_t kMessage[] = {4, 5, 6, 7};
1205 p224.get(), &
p, kDST,
sizeof(kDST), kMessage,
sizeof(kMessage)));
1209 struct HashToScalarTest {
1216 const char *result_hex;
1218 static const HashToScalarTest
kTests[] = {
1220 "P384_XMD:SHA-512_SCALAR_TEST",
"",
1221 "9687acc2de56c3cf94c0e05b6811a21aa480092254ec0532bdce63"
1222 "140ecd340f09dc2d45d77e21fb0aa76f7707b8a676"},
1224 "P384_XMD:SHA-512_SCALAR_TEST",
"abcdef0123456789",
1225 "8f8076022a68233cbcecaceae68c2068f132724f001caa78619eff"
1226 "1ffc58fa871db73fe9034fc9cf853c384ed34b5666"},
1228 "P384_XMD:SHA-512_SCALAR_TEST",
1229 "a512_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1230 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1231 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1232 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1233 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1234 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1235 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1236 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1237 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1238 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
1239 "750f2fae7d2b2f41ac737d180c1d4363d85a1504798b4976d40921"
1240 "1ddb3651c13a5b4daba9975cdfce18336791131915"},
1264 static const uint8_t kDST[] = {0, 1, 2, 3};
1265 static const uint8_t kMessage[] = {4, 5, 6, 7};
1267 p224.get(), &
scalar, kDST,
sizeof(kDST), kMessage,
sizeof(kMessage)));