diff options
Diffstat (limited to '')
-rw-r--r-- | src/regress/lib/libcrypto/ec/ec_asn1_test.c | 122 | ||||
-rw-r--r-- | src/regress/lib/libcrypto/mlkem/mlkem_tests.c | 3 | ||||
-rw-r--r-- | src/regress/lib/libcrypto/mlkem/mlkem_unittest.c | 16 |
3 files changed, 14 insertions, 127 deletions
diff --git a/src/regress/lib/libcrypto/ec/ec_asn1_test.c b/src/regress/lib/libcrypto/ec/ec_asn1_test.c index 03358e69ca..d9501922de 100644 --- a/src/regress/lib/libcrypto/ec/ec_asn1_test.c +++ b/src/regress/lib/libcrypto/ec/ec_asn1_test.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_asn1_test.c,v 1.32 2025/03/08 20:09:35 tb Exp $ */ | 1 | /* $OpenBSD: ec_asn1_test.c,v 1.33 2025/05/04 05:00:03 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
@@ -1281,126 +1281,6 @@ static const struct ec_private_key { | |||
1281 | }, | 1281 | }, |
1282 | }, | 1282 | }, |
1283 | { | 1283 | { |
1284 | .name = "prime239v1", | ||
1285 | .der_len = 115, | ||
1286 | .der = { | ||
1287 | 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x6e, | ||
1288 | 0x26, 0x5e, 0xde, 0x5b, 0x67, 0xd6, 0x38, 0x52, | ||
1289 | 0xe7, 0x1e, 0x8d, 0x44, 0xb1, 0xfb, 0xf8, 0xaf, | ||
1290 | 0xf9, 0x94, 0x2c, 0xe2, 0x0d, 0xa8, 0x5f, 0x03, | ||
1291 | 0x67, 0x53, 0x7b, 0x8b, 0x2e, 0xa0, 0x0a, 0x06, | ||
1292 | 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, | ||
1293 | 0x04, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x33, | ||
1294 | 0xc6, 0xe5, 0x8a, 0xc1, 0x8b, 0x7c, 0x96, 0x19, | ||
1295 | 0xc9, 0xe1, 0x54, 0x7f, 0x81, 0x9e, 0x59, 0x62, | ||
1296 | 0xec, 0xc0, 0x1e, 0xe5, 0x53, 0xd5, 0xae, 0x6b, | ||
1297 | 0xd3, 0xe0, 0x09, 0x07, 0xc5, 0x27, 0x81, 0xa6, | ||
1298 | 0x8d, 0x39, 0x8e, 0xfe, 0x01, 0xc2, 0x1d, 0xda, | ||
1299 | 0xde, 0x7b, 0xdc, 0x76, 0x27, 0x17, 0xf9, 0x6f, | ||
1300 | 0xe3, 0x04, 0xef, 0x5d, 0x65, 0x75, 0x98, 0x7f, | ||
1301 | 0x2d, 0xd0, 0x68, | ||
1302 | }, | ||
1303 | .hex = "0433C6E58AC18B7C" | ||
1304 | "9619C9E1547F819E" | ||
1305 | "5962ECC01EE553D5" | ||
1306 | "AE6BD3E00907C527" | ||
1307 | "81A68D398EFE01C2" | ||
1308 | "1DDADE7BDC762717" | ||
1309 | "F96FE304EF5D6575" | ||
1310 | "987F2DD068", | ||
1311 | .oct_len = 61, | ||
1312 | .oct = { | ||
1313 | 0x04, 0x33, 0xc6, 0xe5, 0x8a, 0xc1, 0x8b, 0x7c, | ||
1314 | 0x96, 0x19, 0xc9, 0xe1, 0x54, 0x7f, 0x81, 0x9e, | ||
1315 | 0x59, 0x62, 0xec, 0xc0, 0x1e, 0xe5, 0x53, 0xd5, | ||
1316 | 0xae, 0x6b, 0xd3, 0xe0, 0x09, 0x07, 0xc5, 0x27, | ||
1317 | 0x81, 0xa6, 0x8d, 0x39, 0x8e, 0xfe, 0x01, 0xc2, | ||
1318 | 0x1d, 0xda, 0xde, 0x7b, 0xdc, 0x76, 0x27, 0x17, | ||
1319 | 0xf9, 0x6f, 0xe3, 0x04, 0xef, 0x5d, 0x65, 0x75, | ||
1320 | 0x98, 0x7f, 0x2d, 0xd0, 0x68, | ||
1321 | }, | ||
1322 | }, | ||
1323 | { | ||
1324 | .name = "prime239v2", | ||
1325 | .der_len = 115, | ||
1326 | .der = { | ||
1327 | 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x30, | ||
1328 | 0x2f, 0x01, 0x10, 0xe9, 0x09, 0x15, 0xdd, 0xe3, | ||
1329 | 0xdd, 0xae, 0xcb, 0x9d, 0x3a, 0x58, 0x92, 0x02, | ||
1330 | 0x1e, 0x6e, 0x02, 0x57, 0xa8, 0x36, 0x0b, 0x20, | ||
1331 | 0x0b, 0x7e, 0xf4, 0xad, 0x0b, 0xa0, 0x0a, 0x06, | ||
1332 | 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, | ||
1333 | 0x05, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x3c, | ||
1334 | 0x10, 0x27, 0x7b, 0xac, 0xdf, 0x86, 0xc9, 0x4f, | ||
1335 | 0xf8, 0x39, 0x87, 0x02, 0x39, 0xaf, 0x41, 0xbc, | ||
1336 | 0x4b, 0x67, 0xd8, 0x5e, 0x04, 0x96, 0x84, 0xb5, | ||
1337 | 0x60, 0x50, 0x48, 0x6a, 0x20, 0x1d, 0x2b, 0x7e, | ||
1338 | 0x9f, 0xaf, 0xf8, 0x8e, 0x7e, 0xa4, 0xcd, 0x00, | ||
1339 | 0xad, 0xb1, 0xad, 0x22, 0x69, 0x32, 0x10, 0x6c, | ||
1340 | 0xe0, 0xcc, 0xdd, 0x45, 0xd8, 0xa6, 0x29, 0x2f, | ||
1341 | 0xad, 0x6b, 0xf9, | ||
1342 | }, | ||
1343 | .hex = "043C10277BACDF86" | ||
1344 | "C94FF839870239AF" | ||
1345 | "41BC4B67D85E0496" | ||
1346 | "84B56050486A201D" | ||
1347 | "2B7E9FAFF88E7EA4" | ||
1348 | "CD00ADB1AD226932" | ||
1349 | "106CE0CCDD45D8A6" | ||
1350 | "292FAD6BF9", | ||
1351 | .oct_len = 61, | ||
1352 | .oct = { | ||
1353 | 0x04, 0x3c, 0x10, 0x27, 0x7b, 0xac, 0xdf, 0x86, | ||
1354 | 0xc9, 0x4f, 0xf8, 0x39, 0x87, 0x02, 0x39, 0xaf, | ||
1355 | 0x41, 0xbc, 0x4b, 0x67, 0xd8, 0x5e, 0x04, 0x96, | ||
1356 | 0x84, 0xb5, 0x60, 0x50, 0x48, 0x6a, 0x20, 0x1d, | ||
1357 | 0x2b, 0x7e, 0x9f, 0xaf, 0xf8, 0x8e, 0x7e, 0xa4, | ||
1358 | 0xcd, 0x00, 0xad, 0xb1, 0xad, 0x22, 0x69, 0x32, | ||
1359 | 0x10, 0x6c, 0xe0, 0xcc, 0xdd, 0x45, 0xd8, 0xa6, | ||
1360 | 0x29, 0x2f, 0xad, 0x6b, 0xf9, | ||
1361 | }, | ||
1362 | }, | ||
1363 | { | ||
1364 | .name = "prime239v3", | ||
1365 | .der_len = 115, | ||
1366 | .der = { | ||
1367 | 0x30, 0x71, 0x02, 0x01, 0x01, 0x04, 0x1e, 0x26, | ||
1368 | 0x3f, 0x23, 0x4c, 0xe7, 0xbd, 0xa8, 0xe4, 0xfe, | ||
1369 | 0x7c, 0xf6, 0x18, 0x6a, 0xb2, 0xa6, 0x39, 0x15, | ||
1370 | 0x6d, 0x72, 0xe8, 0x9e, 0x3f, 0x0f, 0x10, 0x1e, | ||
1371 | 0xe5, 0xdf, 0xac, 0xe8, 0x2f, 0xa0, 0x0a, 0x06, | ||
1372 | 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, | ||
1373 | 0x06, 0xa1, 0x40, 0x03, 0x3e, 0x00, 0x04, 0x37, | ||
1374 | 0xba, 0x07, 0x7f, 0xd9, 0x46, 0x5a, 0x33, 0x03, | ||
1375 | 0x31, 0x77, 0x38, 0xef, 0xee, 0xcc, 0x3d, 0xe1, | ||
1376 | 0xaa, 0x57, 0xe3, 0x8d, 0xb7, 0xcd, 0xe3, 0x01, | ||
1377 | 0xf4, 0xd6, 0x75, 0x49, 0x72, 0x61, 0x4c, 0xbf, | ||
1378 | 0xc0, 0x1f, 0x8b, 0x5f, 0x98, 0x9b, 0xa7, 0xe5, | ||
1379 | 0x6a, 0xb7, 0xfe, 0x63, 0xdb, 0xb0, 0x40, 0xcb, | ||
1380 | 0x26, 0x81, 0x2a, 0x91, 0x14, 0x0f, 0xc7, 0x31, | ||
1381 | 0x13, 0x78, 0x16, | ||
1382 | }, | ||
1383 | .hex = "0437BA077FD9465A" | ||
1384 | "3303317738EFEECC" | ||
1385 | "3DE1AA57E38DB7CD" | ||
1386 | "E301F4D675497261" | ||
1387 | "4CBFC01F8B5F989B" | ||
1388 | "A7E56AB7FE63DBB0" | ||
1389 | "40CB26812A91140F" | ||
1390 | "C731137816", | ||
1391 | .oct_len = 61, | ||
1392 | .oct = { | ||
1393 | 0x04, 0x37, 0xba, 0x07, 0x7f, 0xd9, 0x46, 0x5a, | ||
1394 | 0x33, 0x03, 0x31, 0x77, 0x38, 0xef, 0xee, 0xcc, | ||
1395 | 0x3d, 0xe1, 0xaa, 0x57, 0xe3, 0x8d, 0xb7, 0xcd, | ||
1396 | 0xe3, 0x01, 0xf4, 0xd6, 0x75, 0x49, 0x72, 0x61, | ||
1397 | 0x4c, 0xbf, 0xc0, 0x1f, 0x8b, 0x5f, 0x98, 0x9b, | ||
1398 | 0xa7, 0xe5, 0x6a, 0xb7, 0xfe, 0x63, 0xdb, 0xb0, | ||
1399 | 0x40, 0xcb, 0x26, 0x81, 0x2a, 0x91, 0x14, 0x0f, | ||
1400 | 0xc7, 0x31, 0x13, 0x78, 0x16, | ||
1401 | }, | ||
1402 | }, | ||
1403 | { | ||
1404 | .name = "prime256v1", | 1284 | .name = "prime256v1", |
1405 | .der_len = 121, | 1285 | .der_len = 121, |
1406 | .der = { | 1286 | .der = { |
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests.c b/src/regress/lib/libcrypto/mlkem/mlkem_tests.c index 2801a58890..e9ae417887 100644 --- a/src/regress/lib/libcrypto/mlkem/mlkem_tests.c +++ b/src/regress/lib/libcrypto/mlkem/mlkem_tests.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: mlkem_tests.c,v 1.2 2024/12/26 00:10:19 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_tests.c,v 1.3 2025/05/03 08:34:07 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2024 Google Inc. | 3 | * Copyright (c) 2024 Google Inc. |
4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
@@ -655,6 +655,7 @@ mlkem_keygen_tests(const char *fn, size_t size, enum test_type test_type) | |||
655 | .encoded_public_key_len = sizeof(encoded_public_key768), | 655 | .encoded_public_key_len = sizeof(encoded_public_key768), |
656 | .private_key_len = MLKEM768_PRIVATE_KEY_BYTES, | 656 | .private_key_len = MLKEM768_PRIVATE_KEY_BYTES, |
657 | .public_key_len = MLKEM768_PUBLIC_KEY_BYTES, | 657 | .public_key_len = MLKEM768_PUBLIC_KEY_BYTES, |
658 | |||
658 | .generate_key_external_entropy = | 659 | .generate_key_external_entropy = |
659 | mlkem768_generate_key_external_entropy, | 660 | mlkem768_generate_key_external_entropy, |
660 | .encode_private_key = | 661 | .encode_private_key = |
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c b/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c index 23b3d8b261..597297b8cc 100644 --- a/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c +++ b/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: mlkem_unittest.c,v 1.6 2024/12/26 12:35:25 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_unittest.c,v 1.7 2025/05/03 08:34:55 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2024 Google Inc. | 3 | * Copyright (c) 2024 Google Inc. |
4 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> | 4 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> |
@@ -161,16 +161,22 @@ MlKemUnitTest(struct unittest_ctx *ctx) | |||
161 | tmp_buf = NULL; | 161 | tmp_buf = NULL; |
162 | 162 | ||
163 | ctx->encap(ctx->ciphertext, shared_secret1, ctx->pub); | 163 | ctx->encap(ctx->ciphertext, shared_secret1, ctx->pub); |
164 | ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, | 164 | if (!ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, |
165 | ctx->priv); | 165 | ctx->priv)) { |
166 | warnx("decap() failed using priv"); | ||
167 | failed |= 1; | ||
168 | } | ||
166 | if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, | 169 | if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, |
167 | "shared secrets with priv") != 0) { | 170 | "shared secrets with priv") != 0) { |
168 | warnx("compare_data"); | 171 | warnx("compare_data"); |
169 | failed |= 1; | 172 | failed |= 1; |
170 | } | 173 | } |
171 | 174 | ||
172 | ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, | 175 | if (!ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, |
173 | ctx->priv2); | 176 | ctx->priv2)) { |
177 | warnx("decap() failed using priv2"); | ||
178 | failed |= 1; | ||
179 | } | ||
174 | if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, | 180 | if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, |
175 | "shared secrets with priv2") != 0) { | 181 | "shared secrets with priv2") != 0) { |
176 | warnx("compare_data"); | 182 | warnx("compare_data"); |