Changeset 105949 in vbox for trunk/src/libs/openssl-3.1.7/test
- Timestamp:
- Sep 4, 2024 12:53:14 PM (6 months ago)
- svn:sync-xref-src-repo-rev:
- 164683
- Location:
- trunk/src/libs/openssl-3.1.7/test
- Files:
-
- 49 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/openssl-3.1.7/test/bad_dtls_test.c
r105945 r105949 1 1 /* 2 * Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 505 505 || !TEST_true(SSL_set_session(con, sess))) 506 506 goto end; 507 SSL_SESSION_free(sess); 507 508 508 509 rbio = BIO_new(BIO_s_mem()); … … 592 593 593 594 end: 594 SSL_SESSION_free(sess);595 595 BIO_free(rbio); 596 596 BIO_free(wbio); -
trunk/src/libs/openssl-3.1.7/test/build.info
r105945 r105949 41 41 evp_pkey_provided_test evp_test evp_extra_test evp_extra_test2 \ 42 42 evp_fetch_prov_test evp_libctx_test ossl_store_test \ 43 v3nametest v3ext punycode_test evp_byname_test\43 v3nametest v3ext punycode_test \ 44 44 crltest danetest bad_dtls_test lhash_test sparse_array_test \ 45 45 conf_include_test params_api_test params_conversion_test \ … … 306 306 DEPEND[punycode_test]=../libcrypto.a libtestutil.a 307 307 308 SOURCE[evp_byname_test]=evp_byname_test.c309 INCLUDE[evp_byname_test]=../include ../apps/include310 DEPEND[evp_byname_test]=../libcrypto libtestutil.a311 312 308 SOURCE[stack_test]=stack_test.c 313 309 INCLUDE[stack_test]=../include ../apps/include … … 879 875 IF[{- $disabled{module} || !$target{dso_scheme} -}] 880 876 DEFINE[provider_test]=NO_PROVIDER_MODULE 881 DEFINE[prov_config_test]=NO_PROVIDER_MODULE882 877 DEFINE[provider_internal_test]=NO_PROVIDER_MODULE 883 878 ENDIF -
trunk/src/libs/openssl-3.1.7/test/cmp_hdr_test.c
r105945 r105949 1 1 /* 2 * Copyright 2007-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 * Copyright Nokia 2007-2019 4 4 * Copyright Siemens AG 2015-2019 … … 72 72 static int execute_HDR_get0_senderNonce_test(CMP_HDR_TEST_FIXTURE *fixture) 73 73 { 74 int res = 0;75 74 X509_NAME *sender = X509_NAME_new(); 76 75 ASN1_OCTET_STRING *sn; 77 76 78 77 if (!TEST_ptr(sender)) 79 goto err;78 return 0; 80 79 81 80 X509_NAME_ADD(sender, "CN", "A common sender name"); 82 81 if (!TEST_int_eq(OSSL_CMP_CTX_set1_subjectName(fixture->cmp_ctx, sender), 83 82 1)) 84 goto err;83 return 0; 85 84 if (!TEST_int_eq(ossl_cmp_hdr_init(fixture->cmp_ctx, fixture->hdr), 86 85 1)) 87 goto err;86 return 0; 88 87 sn = ossl_cmp_hdr_get0_senderNonce(fixture->hdr); 89 88 if (!TEST_int_eq(ASN1_OCTET_STRING_cmp(fixture->cmp_ctx->senderNonce, sn), 90 89 0)) 91 goto err; 92 93 res = 1; 94 err: 90 return 0; 95 91 X509_NAME_free(sender); 96 97 return res; 92 return 1; 98 93 } 99 94 … … 108 103 static int execute_HDR_set1_sender_test(CMP_HDR_TEST_FIXTURE *fixture) 109 104 { 110 int res = 0;111 105 X509_NAME *x509name = X509_NAME_new(); 112 106 113 107 if (!TEST_ptr(x509name)) 114 goto err;108 return 0; 115 109 116 110 X509_NAME_ADD(x509name, "CN", "A common sender name"); 117 111 if (!TEST_int_eq(ossl_cmp_hdr_set1_sender(fixture->hdr, x509name), 1)) 118 goto err; 119 112 return 0; 120 113 if (!TEST_int_eq(fixture->hdr->sender->type, GEN_DIRNAME)) 121 goto err;114 return 0; 122 115 123 116 if (!TEST_int_eq(X509_NAME_cmp(fixture->hdr->sender->d.directoryName, 124 117 x509name), 0)) 125 goto err; 126 127 res = 1; 128 err: 118 return 0; 119 129 120 X509_NAME_free(x509name); 130 131 return res; 121 return 1; 132 122 } 133 123 … … 142 132 static int execute_HDR_set1_recipient_test(CMP_HDR_TEST_FIXTURE *fixture) 143 133 { 144 int res = 0;145 134 X509_NAME *x509name = X509_NAME_new(); 146 135 147 136 if (!TEST_ptr(x509name)) 148 goto err;137 return 0; 149 138 150 139 X509_NAME_ADD(x509name, "CN", "A common recipient name"); 151 140 if (!TEST_int_eq(ossl_cmp_hdr_set1_recipient(fixture->hdr, x509name), 1)) 152 goto err;141 return 0; 153 142 154 143 if (!TEST_int_eq(fixture->hdr->recipient->type, GEN_DIRNAME)) 155 goto err;144 return 0; 156 145 157 146 if (!TEST_int_eq(X509_NAME_cmp(fixture->hdr->recipient->d.directoryName, 158 147 x509name), 0)) 159 goto err; 160 161 res = 1; 162 err: 148 return 0; 149 163 150 X509_NAME_free(x509name); 164 165 return res; 151 return 1; 166 152 } 167 153 … … 218 204 219 205 if (!TEST_ptr(senderKID)) 220 goto err;206 return 0; 221 207 222 208 if (!TEST_int_eq(ASN1_OCTET_STRING_set(senderKID, rand_data, … … 280 266 281 267 if (!TEST_ptr(text)) 282 goto err;268 return 0; 283 269 284 270 if (!ASN1_STRING_set(text, "A free text", -1)) … … 295 281 err: 296 282 ASN1_UTF8STRING_free(text); 297 298 283 return res; 299 284 } -
trunk/src/libs/openssl-3.1.7/test/crltest.c
r105945 r105949 1 1 /* 2 * Copyright 2015-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 102 102 }; 103 103 104 static const char *kInvalidCRL[] = {105 "-----BEGIN X509 CRL-----\n",106 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n",107 "-----END X509 CRL-----\n",108 NULL109 };110 111 104 static const char *kBadIssuerCRL[] = { 112 105 "-----BEGIN X509 CRL-----\n", … … 379 372 } 380 373 381 static int test_reuse_crl(int idx) 382 { 383 X509_CRL *result, *reused_crl = CRL_from_strings(kBasicCRL); 384 X509_CRL *addref_crl = NULL; 385 char *p = NULL; 386 BIO *b = NULL; 387 int r = 0; 388 389 if (!TEST_ptr(reused_crl)) 390 goto err; 391 392 if (idx & 1) { 393 if (!TEST_true(X509_CRL_up_ref(reused_crl))) 394 goto err; 395 addref_crl = reused_crl; 374 static int test_reuse_crl(void) 375 { 376 X509_CRL *reused_crl = CRL_from_strings(kBasicCRL); 377 char *p; 378 BIO *b = glue2bio(kRevokedCRL, &p); 379 380 if (b == NULL) { 381 OPENSSL_free(p); 382 X509_CRL_free(reused_crl); 383 return 0; 396 384 } 397 385 398 idx >>= 1; 399 b = glue2bio(idx == 2 ? kRevokedCRL : kInvalidCRL + idx, &p); 400 401 if (!TEST_ptr(b)) 402 goto err; 403 404 result = PEM_read_bio_X509_CRL(b, &reused_crl, NULL, NULL); 405 406 switch (idx) { 407 case 0: /* valid PEM + invalid DER */ 408 if (!TEST_ptr_null(result) 409 || !TEST_ptr_null(reused_crl)) 410 goto err; 411 break; 412 case 1: /* invalid PEM */ 413 if (!TEST_ptr_null(result) 414 || !TEST_ptr(reused_crl)) 415 goto err; 416 break; 417 case 2: 418 if (!TEST_ptr(result) 419 || !TEST_ptr(reused_crl) 420 || !TEST_ptr_eq(result, reused_crl)) 421 goto err; 422 break; 423 } 424 425 r = 1; 426 427 err: 386 reused_crl = PEM_read_bio_X509_CRL(b, &reused_crl, NULL, NULL); 387 428 388 OPENSSL_free(p); 429 389 BIO_free(b); 430 390 X509_CRL_free(reused_crl); 431 X509_CRL_free(addref_crl); 432 return r; 391 return 1; 433 392 } 434 393 … … 444 403 ADD_TEST(test_known_critical_crl); 445 404 ADD_ALL_TESTS(test_unknown_critical_crl, OSSL_NELEM(unknown_critical_crls)); 446 ADD_ ALL_TESTS(test_reuse_crl, 6);405 ADD_TEST(test_reuse_crl); 447 406 return 1; 448 407 } -
trunk/src/libs/openssl-3.1.7/test/ct_test.c
r105945 r105949 1 1 /* 2 * Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 451 451 fixture->sct_list = sk_SCT_new_null(); 452 452 if (fixture->sct_list == NULL) 453 { 454 tear_down(fixture); 455 return 0; 456 } 453 return 0; 457 454 458 455 if (!TEST_ptr(sct = SCT_new_from_base64(SCT_VERSION_V1, log_id, 459 456 CT_LOG_ENTRY_TYPE_X509, timestamp, 460 457 extensions, signature))) 461 { 462 tear_down(fixture); 458 463 459 return 0; 464 }465 460 466 461 sk_SCT_push(fixture->sct_list, sct); -
trunk/src/libs/openssl-3.1.7/test/dsatest.c
r105945 r105949 1 1 /* 2 * Copyright 1995-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 333 333 BIGNUM *badq = NULL, *badpriv = NULL; 334 334 const unsigned char msg[] = { 0x00 }; 335 unsigned int signature_len0;336 335 unsigned int signature_len; 337 336 unsigned char signature[64]; … … 377 376 378 377 /* Test passing signature as NULL */ 379 if (!TEST_true(DSA_sign(0, msg, sizeof(msg), NULL, &signature_len0, dsa)) 380 || !TEST_int_gt(signature_len0, 0)) 381 goto err; 382 383 if (!TEST_true(DSA_sign(0, msg, sizeof(msg), signature, &signature_len, dsa)) 384 || !TEST_int_gt(signature_len, 0) 385 || !TEST_int_le(signature_len, signature_len0)) 378 if (!TEST_true(DSA_sign(0, msg, sizeof(msg), NULL, &signature_len, dsa))) 379 goto err; 380 381 if (!TEST_true(DSA_sign(0, msg, sizeof(msg), signature, &signature_len, dsa))) 386 382 goto err; 387 383 -
trunk/src/libs/openssl-3.1.7/test/ecdsatest.c
r105945 r105949 1 1 /* 2 * Copyright 2002-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved 4 4 * … … 351 351 { 352 352 int ret; 353 unsigned int siglen0;354 353 unsigned int siglen; 355 354 unsigned char dgst[128] = { 0 }; 356 355 EC_KEY *eckey = NULL; 357 unsigned char *sig = NULL;358 BIGNUM *kinv = NULL, *rp = NULL;359 356 360 357 ret = TEST_ptr(eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1)) 361 358 && TEST_int_eq(EC_KEY_generate_key(eckey), 1) 362 && TEST_int_eq(ECDSA_sign(0, dgst, sizeof(dgst), NULL, &siglen0, 363 eckey), 1) 364 && TEST_int_gt(siglen0, 0) 365 && TEST_ptr(sig = OPENSSL_malloc(siglen0)) 366 && TEST_int_eq(ECDSA_sign(0, dgst, sizeof(dgst), sig, &siglen, 367 eckey), 1) 368 && TEST_int_gt(siglen, 0) 369 && TEST_int_le(siglen, siglen0) 370 && TEST_int_eq(ECDSA_verify(0, dgst, sizeof(dgst), sig, siglen, 371 eckey), 1) 372 && TEST_int_eq(ECDSA_sign_setup(eckey, NULL, &kinv, &rp), 1) 373 && TEST_int_eq(ECDSA_sign_ex(0, dgst, sizeof(dgst), NULL, &siglen, 374 kinv, rp, eckey), 1) 375 && TEST_int_gt(siglen, 0) 376 && TEST_int_le(siglen, siglen0) 377 && TEST_int_eq(ECDSA_sign_ex(0, dgst, sizeof(dgst), sig, &siglen0, 378 kinv, rp, eckey), 1) 379 && TEST_int_eq(siglen, siglen0) 380 && TEST_int_eq(ECDSA_verify(0, dgst, sizeof(dgst), sig, siglen, 381 eckey), 1); 359 && TEST_int_eq(ECDSA_sign(0, dgst, sizeof(dgst), NULL, &siglen, eckey), 1) 360 && TEST_int_gt(siglen, 0); 382 361 EC_KEY_free(eckey); 383 OPENSSL_free(sig);384 BN_free(kinv);385 BN_free(rp);386 362 return ret; 387 363 } -
trunk/src/libs/openssl-3.1.7/test/ecstresstest.c
r105945 r105949 1 1 /* 2 * Copyright 2017-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"); … … 80 80 group)) 81 81 || !TEST_ptr(result = walk_curve(group, point, num_repeats))) 82 goto err;82 return 0; 83 83 84 84 if (print_mode) { -
trunk/src/libs/openssl-3.1.7/test/endecode_test.c
r105945 r105949 1 1 /* 2 * Copyright 2020-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 1033 1033 IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitTri2G, "EC") 1034 1034 # endif 1035 # ifndef OPENSSL_NO_SM21036 KEYS(SM2);1037 IMPLEMENT_TEST_SUITE(SM2, "SM2", 0)1038 # endif1039 1035 KEYS(ED25519); 1040 1036 IMPLEMENT_TEST_SUITE(ED25519, "ED25519", 1) … … 1342 1338 1343 1339 /* FIPS(3.0.0): provider imports explicit params but they won't work #17998 */ 1344 is_fips_3_0_0 = is_fips && fips_provider_version_eq(testctx, 3, 0, 0); 1340 is_fips_3_0_0 = fips_provider_version_eq(testctx, 3, 0, 0); 1341 if (is_fips_3_0_0 < 0) 1342 return 0; 1345 1343 1346 1344 #ifdef STATIC_LEGACY … … 1400 1398 MAKE_DOMAIN_KEYS(ECExplicitTri2G, "EC", ec_explicit_tri_params_explicit); 1401 1399 # endif 1402 # ifndef OPENSSL_NO_SM21403 MAKE_KEYS(SM2, "SM2", NULL);1404 # endif1405 1400 MAKE_KEYS(ED25519, "ED25519", NULL); 1406 1401 MAKE_KEYS(ED448, "ED448", NULL); … … 1449 1444 ADD_TEST_SUITE_LEGACY(ECExplicitTri2G); 1450 1445 # endif 1451 # ifndef OPENSSL_NO_SM21452 if (!is_fips_3_0_0) {1453 /* 3.0.0 FIPS provider imports explicit EC params and then fails. */1454 ADD_TEST_SUITE(SM2);1455 }1456 # endif1457 1446 ADD_TEST_SUITE(ED25519); 1458 1447 ADD_TEST_SUITE(ED448); … … 1512 1501 FREE_DOMAIN_KEYS(ECExplicitTri2G); 1513 1502 # endif 1514 # ifndef OPENSSL_NO_SM21515 FREE_KEYS(SM2);1516 # endif1517 1503 FREE_KEYS(ED25519); 1518 1504 FREE_KEYS(ED448); -
trunk/src/libs/openssl-3.1.7/test/evp_extra_test.c
r105945 r105949 1101 1101 eckey = NULL; 1102 1102 1103 for (;;) {1103 while (dup_pk == NULL) { 1104 1104 ret = 0; 1105 1105 ctx = EVP_MD_CTX_new(); … … 1117 1117 ctx = NULL; 1118 1118 1119 if (dup_pk != NULL)1120 break;1121 1122 1119 if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pkey))) 1123 1120 goto err; … … 1129 1126 goto err; 1130 1127 } 1131 ret = 1;1132 1128 1133 1129 err: … … 2559 2555 0x68, 0x81, 0xa5, 0x3e, 0x5b, 0x9c, 0x7b, 0x6f, 0x2e, 0xec, 0xc8, 0x47, 2560 2556 0x7c, 0xfa, 0x47, 0x35, 0x66, 0x82, 0x15, 0x30 2561 };2562 size_t expectedlen = sizeof(expected);2563 2564 if (!TEST_ptr(pctx = EVP_PKEY_CTX_new_from_name(testctx, "HKDF", testpropq)))2565 goto done;2566 2567 outlen = sizeof(out);2568 memset(out, 0, outlen);2569 2570 if (!TEST_int_gt(EVP_PKEY_derive_init(pctx), 0)2571 || !TEST_int_gt(EVP_PKEY_CTX_set_hkdf_md(pctx, EVP_sha256()), 0)2572 || !TEST_int_gt(EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt,2573 sizeof(salt) - 1), 0)2574 || !TEST_int_gt(EVP_PKEY_CTX_set1_hkdf_key(pctx, key,2575 sizeof(key) - 1), 0)2576 || !TEST_int_gt(EVP_PKEY_CTX_add1_hkdf_info(pctx, info,2577 sizeof(info) - 1), 0)2578 || !TEST_int_gt(EVP_PKEY_derive(pctx, out, &outlen), 0)2579 || !TEST_mem_eq(out, outlen, expected, expectedlen))2580 goto done;2581 2582 ret = 1;2583 2584 done:2585 EVP_PKEY_CTX_free(pctx);2586 2587 return ret;2588 }2589 2590 static int test_empty_salt_info_HKDF(void)2591 {2592 EVP_PKEY_CTX *pctx;2593 unsigned char out[20];2594 size_t outlen;2595 int ret = 0;2596 unsigned char salt[] = "";2597 unsigned char key[] = "012345678901234567890123456789";2598 unsigned char info[] = "";2599 const unsigned char expected[] = {2600 0x67, 0x12, 0xf9, 0x27, 0x8a, 0x8a, 0x3a, 0x8f, 0x7d, 0x2c, 0xa3, 0x6a,2601 0xaa, 0xe9, 0xb3, 0xb9, 0x52, 0x5f, 0xe0, 0x06,2602 2557 }; 2603 2558 size_t expectedlen = sizeof(expected); … … 4721 4676 static int test_custom_md_meth(void) 4722 4677 { 4723 ASN1_OBJECT *o = NULL;4724 4678 EVP_MD_CTX *mdctx = NULL; 4725 4679 EVP_MD *tmp = NULL; … … 4767 4721 goto err; 4768 4722 4769 if (!TEST_int_eq(OBJ_create("1.3.6.1.4.1.16604.998866.1",4770 "custom-md", "custom-md"), NID_undef)4771 || !TEST_int_eq(ERR_GET_LIB(ERR_peek_error()), ERR_LIB_OBJ)4772 || !TEST_int_eq(ERR_GET_REASON(ERR_get_error()), OBJ_R_OID_EXISTS))4773 goto err;4774 4775 o = ASN1_OBJECT_create(nid, (unsigned char *)4776 "\53\6\1\4\1\201\201\134\274\373\122\1", 12,4777 "custom-md", "custom-md");4778 if (!TEST_int_eq(OBJ_add_object(o), nid))4779 goto err;4780 4781 4723 testresult = 1; 4782 4724 err: 4783 ASN1_OBJECT_free(o);4784 4725 EVP_MD_CTX_free(mdctx); 4785 4726 EVP_MD_meth_free(tmp); … … 5366 5307 #endif 5367 5308 5368 static int test_invalid_ctx_for_digest(void)5369 {5370 int ret;5371 EVP_MD_CTX *mdctx;5372 5373 mdctx = EVP_MD_CTX_new();5374 if (!TEST_ptr(mdctx))5375 return 0;5376 5377 if (!TEST_int_eq(EVP_DigestUpdate(mdctx, "test", sizeof("test") - 1), 0))5378 ret = 0;5379 else5380 ret = 1;5381 5382 EVP_MD_CTX_free(mdctx);5383 5384 return ret;5385 }5386 5387 5309 int setup_tests(void) 5388 5310 { … … 5462 5384 ADD_TEST(test_HKDF); 5463 5385 ADD_TEST(test_emptyikm_HKDF); 5464 ADD_TEST(test_empty_salt_info_HKDF);5465 5386 #ifndef OPENSSL_NO_EC 5466 5387 ADD_TEST(test_X509_PUBKEY_inplace); … … 5550 5471 #endif 5551 5472 5552 ADD_TEST(test_invalid_ctx_for_digest);5553 5554 5473 return 1; 5555 5474 } -
trunk/src/libs/openssl-3.1.7/test/evp_kdf_test.c
r105945 r105949 1859 1859 } 1860 1860 1861 /* Test that changing the KBKDF algorithm from KMAC to HMAC works correctly */1862 static int test_kbkdf_mac_change(void)1863 {1864 int ret = 0;1865 EVP_KDF_CTX *kctx = NULL;1866 OSSL_PARAM params[9], *p = params;1867 /* Test data taken from the evptest corpus */1868 int l = 0, sep = 0, r = 8;1869 static /* const */ unsigned char key[] = {1870 0x3e, 0xdc, 0x6b, 0x5b, 0x8f, 0x7a, 0xad, 0xbd,1871 0x71, 0x37, 0x32, 0xb4, 0x82, 0xb8, 0xf9, 0x79,1872 0x28, 0x6e, 0x1e, 0xa3, 0xb8, 0xf8, 0xf9, 0x9c,1873 0x30, 0xc8, 0x84, 0xcf, 0xe3, 0x34, 0x9b, 0x831874 };1875 static /* const */ unsigned char info[] = {1876 0x98, 0xe9, 0x98, 0x8b, 0xb4, 0xcc, 0x8b, 0x34,1877 0xd7, 0x92, 0x2e, 0x1c, 0x68, 0xad, 0x69, 0x2b,1878 0xa2, 0xa1, 0xd9, 0xae, 0x15, 0x14, 0x95, 0x71,1879 0x67, 0x5f, 0x17, 0xa7, 0x7a, 0xd4, 0x9e, 0x80,1880 0xc8, 0xd2, 0xa8, 0x5e, 0x83, 0x1a, 0x26, 0x44,1881 0x5b, 0x1f, 0x0f, 0xf4, 0x4d, 0x70, 0x84, 0xa1,1882 0x72, 0x06, 0xb4, 0x89, 0x6c, 0x81, 0x12, 0xda,1883 0xad, 0x18, 0x60, 0x5a1884 };1885 static const unsigned char output[] = {1886 0x6c, 0x03, 0x76, 0x52, 0x99, 0x06, 0x74, 0xa0,1887 0x78, 0x44, 0x73, 0x2d, 0x0a, 0xd9, 0x85, 0xf91888 };1889 unsigned char out[sizeof(output)];1890 1891 params[0] = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC,1892 OSSL_MAC_NAME_KMAC128, 0);1893 params[1] = OSSL_PARAM_construct_end();1894 if (!TEST_ptr(kctx = get_kdfbyname(OSSL_KDF_NAME_KBKDF))1895 || !TEST_true(EVP_KDF_CTX_set_params(kctx, params)))1896 goto err;1897 1898 *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MODE, "COUNTER", 0);1899 *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC, "HMAC", 0);1900 *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, "SHA256", 0);1901 *p++ = OSSL_PARAM_construct_int(OSSL_KDF_PARAM_KBKDF_USE_L, &l);1902 *p++ = OSSL_PARAM_construct_int(OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR, &sep);1903 *p++ = OSSL_PARAM_construct_int(OSSL_KDF_PARAM_KBKDF_R, &r);1904 *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,1905 key, sizeof(key));1906 *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,1907 info, sizeof(info));1908 *p = OSSL_PARAM_construct_end();1909 if (!TEST_true(EVP_KDF_derive(kctx, out, sizeof(out), params))1910 || !TEST_mem_eq(out, sizeof(out), output, sizeof(output)))1911 goto err;1912 1913 ret = 1;1914 err:1915 EVP_KDF_CTX_free(kctx);1916 return ret;1917 }1918 1919 1861 int setup_tests(void) 1920 1862 { … … 1978 1920 #endif 1979 1921 ADD_TEST(test_kdf_krb5kdf); 1980 ADD_TEST(test_kbkdf_mac_change);1981 1922 return 1; 1982 1923 } -
trunk/src/libs/openssl-3.1.7/test/evp_pkey_provided_test.c
r105945 r105949 390 390 goto err; 391 391 392 for (;;) {392 while (dup_pk == NULL) { 393 393 ret = 0; 394 394 if (!TEST_int_eq(EVP_PKEY_get_bits(pk), 32) … … 418 418 && test_print_key_using_encoder("RSA", pk); 419 419 420 if (!ret || dup_pk != NULL) 421 break; 422 423 if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 420 if (!ret || !TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 424 421 goto err; 425 422 ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1); … … 606 603 goto err; 607 604 608 for (;;) {605 while (dup_pk == NULL) { 609 606 ret = 0; 610 607 if (!TEST_int_eq(EVP_PKEY_get_bits(pk), 2048) … … 686 683 && test_print_key_using_encoder("DH", pk); 687 684 688 if (!ret || dup_pk != NULL) 689 break; 690 691 if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 685 if (!ret || !TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 692 686 goto err; 693 687 ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1); … … 790 784 goto err; 791 785 792 for (;;) {786 while (dup_pk == NULL) { 793 787 ret = 0; 794 788 if (!TEST_int_eq(EVP_PKEY_get_bits(pk), 2048) … … 864 858 && test_print_key_using_encoder("DH", pk); 865 859 866 if (!ret || dup_pk != NULL) 867 break; 868 869 if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 860 if (!ret || !TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 870 861 goto err; 871 862 ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1); … … 1100 1091 goto err; 1101 1092 1102 for (;;) {1093 while (dup_pk == NULL) { 1103 1094 ret = 0; 1104 1095 if (!TEST_int_eq(EVP_PKEY_get_bits(pk), bits) … … 1155 1146 && test_print_key_using_encoder(alg, pk); 1156 1147 1157 if (!ret || dup_pk != NULL) 1158 break; 1159 1160 if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 1148 if (!ret || !TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 1161 1149 goto err; 1162 1150 ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1); … … 1275 1263 goto err; 1276 1264 1277 for (;;) {1265 while (dup_pk == NULL) { 1278 1266 ret = 0; 1279 1267 if (!TEST_int_eq(EVP_PKEY_get_bits(pk), 256) … … 1313 1301 || !TEST_BN_eq(group_b, b)) 1314 1302 goto err; 1315 1316 EC_GROUP_free(group);1317 group = NULL;1318 BN_free(group_p);1319 group_p = NULL;1320 BN_free(group_a);1321 group_a = NULL;1322 BN_free(group_b);1323 group_b = NULL;1324 1303 1325 1304 if (!EVP_PKEY_get_utf8_string_param(pk, OSSL_PKEY_PARAM_GROUP_NAME, … … 1351 1330 && test_print_key_using_encoder(alg, pk); 1352 1331 1353 if (!ret || dup_pk != NULL) 1354 break; 1355 1356 if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 1332 if (!ret || !TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 1357 1333 goto err; 1358 1334 ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1); … … 1600 1576 goto err; 1601 1577 1602 for (;;) {1578 while (dup_pk == NULL) { 1603 1579 ret = 0; 1604 1580 if (!TEST_int_eq(EVP_PKEY_get_bits(pk), 2048) … … 1649 1625 || !TEST_int_eq(pcounter, pcounter_out)) 1650 1626 goto err; 1651 BN_free(p _out);1652 p _out= NULL;1653 BN_free(q _out);1654 q _out= NULL;1655 BN_free(g _out);1656 g _out= NULL;1627 BN_free(p); 1628 p = NULL; 1629 BN_free(q); 1630 q = NULL; 1631 BN_free(g); 1632 g = NULL; 1657 1633 BN_free(j_out); 1658 1634 j_out = NULL; … … 1682 1658 && test_print_key_using_encoder("DSA", pk); 1683 1659 1684 if (!ret || dup_pk != NULL) 1685 break; 1686 1687 if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 1660 if (!ret || !TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 1688 1661 goto err; 1689 1662 ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1); -
trunk/src/libs/openssl-3.1.7/test/evp_test.c
r105945 r105949 2791 2791 return 0; 2792 2792 p = strchr(name, ':'); 2793 if (p == NULL) 2794 p = ""; 2795 else 2793 if (p != NULL) 2796 2794 *p++ = '\0'; 2797 2795 … … 2804 2802 2805 2803 rv = OSSL_PARAM_allocate_from_text(kdata->p, defs, name, p, 2806 strlen(p), NULL);2804 p != NULL ? strlen(p) : 0, NULL); 2807 2805 *++kdata->p = OSSL_PARAM_construct_end(); 2808 2806 if (!rv) { … … 2811 2809 return 0; 2812 2810 } 2813 if ( strcmp(name, "digest") == 0) {2811 if (p != NULL && strcmp(name, "digest") == 0) { 2814 2812 if (is_digest_disabled(p)) { 2815 2813 TEST_info("skipping, '%s' is disabled", p); … … 2818 2816 goto end; 2819 2817 } 2820 2821 if ((strcmp(name, "cipher") == 02822 || strcmp(name, "cekalg") == 0)2818 if (p != NULL 2819 && (strcmp(name, "cipher") == 0 2820 || strcmp(name, "cekalg") == 0) 2823 2821 && is_cipher_disabled(p)) { 2824 2822 TEST_info("skipping, '%s' is disabled", p); … … 2826 2824 goto end; 2827 2825 } 2828 if ((strcmp(name, "mac") == 0) 2826 if (p != NULL 2827 && (strcmp(name, "mac") == 0) 2829 2828 && is_mac_disabled(p)) { 2830 2829 TEST_info("skipping, '%s' is disabled", p); -
trunk/src/libs/openssl-3.1.7/test/helpers/handshake.c
r105945 r105949 1 1 /* 2 * Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 348 348 349 349 len = strlen(protos); 350 351 if (len == 0) {352 *out = NULL;353 *outlen = 0;354 return 1;355 }356 350 357 351 /* Should never have reuse. */ -
trunk/src/libs/openssl-3.1.7/test/helpers/ssltestlib.c
r105945 r105949 1 1 /* 2 * Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 8 8 */ 9 9 10 /*11 * We need access to the deprecated low level ENGINE APIs for legacy purposes12 * when the deprecated calls are not hidden13 */14 #ifndef OPENSSL_NO_DEPRECATED_3_015 # define OPENSSL_SUPPRESS_DEPRECATED16 #endif17 18 10 #include <string.h> 19 11 20 #include <openssl/engine.h>21 12 #include "internal/nelem.h" 22 13 #include "ssltestlib.h" … … 1192 1183 SSL_free(clientssl); 1193 1184 } 1194 1195 ENGINE *load_dasync(void)1196 {1197 #if !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_DYNAMIC_ENGINE)1198 ENGINE *e;1199 1200 if (!TEST_ptr(e = ENGINE_by_id("dasync")))1201 return NULL;1202 1203 if (!TEST_true(ENGINE_init(e))) {1204 ENGINE_free(e);1205 return NULL;1206 }1207 1208 if (!TEST_true(ENGINE_register_ciphers(e))) {1209 ENGINE_free(e);1210 return NULL;1211 }1212 1213 return e;1214 #else1215 return NULL;1216 #endif1217 } -
trunk/src/libs/openssl-3.1.7/test/helpers/ssltestlib.h
r105945 r105949 1 1 /* 2 * Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 60 60 DEFINE_STACK_OF(MEMPACKET) 61 61 62 ENGINE *load_dasync(void);63 62 #endif /* OSSL_TEST_SSLTESTLIB_H */ -
trunk/src/libs/openssl-3.1.7/test/hexstr_test.c
r105945 r105949 1 1 /* 2 * Copyright 2020-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"); … … 121 121 return TEST_true(OPENSSL_hexstr2buf_ex(buf, sizeof(buf), &len, test->in, ':')) 122 122 && TEST_mem_eq(buf, len, test->expected, test->expected_len) 123 && TEST_false(OPENSSL_buf2hexstr_ex(out, 3 * len - 1, NULL, buf, len,124 ':'))125 123 && TEST_true(OPENSSL_buf2hexstr_ex(out, sizeof(out), NULL, buf, len, 126 ':')) 127 && TEST_str_eq(out, test->in) 128 && TEST_true(OPENSSL_buf2hexstr_ex(out, sizeof(out), NULL, buf, 0, 129 ':')) 130 && TEST_size_t_eq(strlen(out), 0); 124 ':')) 125 && TEST_str_eq(out, test->in); 131 126 } 132 127 -
trunk/src/libs/openssl-3.1.7/test/keymgmt_internal_test.c
r105945 r105949 1 1 /* 2 * Copyright 2019-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 225 225 goto err; 226 226 227 for (;;) {227 while (dup_pk == NULL) { 228 228 ret = 0; 229 229 km = km3; … … 256 256 257 257 ret = (ret == OSSL_NELEM(expected)); 258 259 if (!ret || dup_pk != NULL) 260 break; 261 262 if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 258 if (!ret || !TEST_ptr(dup_pk = EVP_PKEY_dup(pk))) 263 259 goto err; 264 260 -
trunk/src/libs/openssl-3.1.7/test/pkey_meth_kdf_test.c
r105945 r105949 1 1 /* 2 * Copyright 2017-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 17 17 #include "testutil.h" 18 18 19 static int test_kdf_tls1_prf( int index)19 static int test_kdf_tls1_prf(void) 20 20 { 21 21 int ret = 0; … … 41 41 goto err; 42 42 } 43 if (index == 0) { 44 if (EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, 45 (unsigned char *)"seed", 4) <= 0) { 46 TEST_error("EVP_PKEY_CTX_add1_tls1_prf_seed"); 47 goto err; 48 } 49 } else { 50 if (EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, 51 (unsigned char *)"se", 2) <= 0) { 52 TEST_error("EVP_PKEY_CTX_add1_tls1_prf_seed"); 53 goto err; 54 } 55 if (EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, 56 (unsigned char *)"ed", 2) <= 0) { 57 TEST_error("EVP_PKEY_CTX_add1_tls1_prf_seed"); 58 goto err; 59 } 43 if (EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, 44 (unsigned char *)"seed", 4) <= 0) { 45 TEST_error("EVP_PKEY_CTX_add1_tls1_prf_seed"); 46 goto err; 60 47 } 61 48 if (EVP_PKEY_derive(pctx, out, &outlen) <= 0) { … … 79 66 } 80 67 81 static int test_kdf_hkdf( int index)68 static int test_kdf_hkdf(void) 82 69 { 83 70 int ret = 0; … … 108 95 goto err; 109 96 } 110 if (index == 0) { 111 if (EVP_PKEY_CTX_add1_hkdf_info(pctx, (const unsigned char *)"label", 5) 97 if (EVP_PKEY_CTX_add1_hkdf_info(pctx, (const unsigned char *)"label", 5) 112 98 <= 0) { 113 TEST_error("EVP_PKEY_CTX_add1_hkdf_info"); 114 goto err; 115 } 116 } else { 117 if (EVP_PKEY_CTX_add1_hkdf_info(pctx, (const unsigned char *)"lab", 3) 118 <= 0) { 119 TEST_error("EVP_PKEY_CTX_add1_hkdf_info"); 120 goto err; 121 } 122 if (EVP_PKEY_CTX_add1_hkdf_info(pctx, (const unsigned char *)"el", 2) 123 <= 0) { 124 TEST_error("EVP_PKEY_CTX_add1_hkdf_info"); 125 goto err; 126 } 99 TEST_error("EVP_PKEY_CTX_set1_hkdf_info"); 100 goto err; 127 101 } 128 102 if (EVP_PKEY_derive(pctx, out, &outlen) <= 0) { … … 222 196 int setup_tests(void) 223 197 { 224 int tests = 1; 225 226 if (fips_provider_version_ge(NULL, 3, 3, 1)) 227 tests = 2; 228 229 ADD_ALL_TESTS(test_kdf_tls1_prf, tests); 230 ADD_ALL_TESTS(test_kdf_hkdf, tests); 198 ADD_TEST(test_kdf_tls1_prf); 199 ADD_TEST(test_kdf_hkdf); 231 200 #ifndef OPENSSL_NO_SCRYPT 232 201 ADD_TEST(test_kdf_scrypt); -
trunk/src/libs/openssl-3.1.7/test/prov_config_test.c
r105945 r105949 1 1 /* 2 * Copyright 2021 -2024The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 8 8 */ 9 9 10 #include <sys/stat.h>11 10 #include <openssl/evp.h> 12 11 #include <openssl/conf.h> … … 15 14 static char *configfile = NULL; 16 15 static char *recurseconfigfile = NULL; 17 static char *pathedconfig = NULL;18 16 19 17 /* … … 27 25 EVP_MD *sha256 = NULL; 28 26 27 if (!TEST_ptr(configfile)) 28 return 0; 29 29 if (!TEST_ptr(ctx)) 30 30 return 0; 31 31 32 32 if (!TEST_true(OSSL_LIB_CTX_load_config(ctx, configfile))) 33 goto err;33 return 0; 34 34 if (!TEST_true(OSSL_LIB_CTX_load_config(ctx, configfile))) 35 goto err;35 return 0; 36 36 37 37 /* Check we can actually fetch something */ … … 53 53 unsigned long err; 54 54 55 if (!TEST_ptr(recurseconfigfile)) 56 goto err; 57 55 58 if (!TEST_ptr(ctx)) 56 59 goto err; … … 63 66 if (ERR_GET_REASON(err) == CONF_R_RECURSIVE_SECTION_REFERENCE) 64 67 testresult = 1; 65 err:66 OSSL_LIB_CTX_free(ctx);67 return testresult;68 }69 70 #define P_TEST_PATH "/../test/p_test.so"71 static int test_path_config(void)72 {73 OSSL_LIB_CTX *ctx = NULL;74 OSSL_PROVIDER *prov;75 int testresult = 0;76 struct stat sbuf;77 char *module_path = getenv("OPENSSL_MODULES");78 char *full_path = NULL;79 int rc;80 81 if (!TEST_ptr(module_path))82 return 0;83 84 full_path = OPENSSL_zalloc(strlen(module_path) + strlen(P_TEST_PATH) + 1);85 if (!TEST_ptr(full_path))86 return 0;87 88 strcpy(full_path, module_path);89 full_path = strcat(full_path, P_TEST_PATH);90 TEST_info("full path is %s", full_path);91 rc = stat(full_path, &sbuf);92 OPENSSL_free(full_path);93 if (rc == -1)94 return TEST_skip("Skipping modulepath test as provider not present");95 96 if (!TEST_ptr(pathedconfig))97 return 0;98 99 ctx = OSSL_LIB_CTX_new();100 if (!TEST_ptr(ctx))101 return 0;102 103 if (!TEST_true(OSSL_LIB_CTX_load_config(ctx, pathedconfig)))104 goto err;105 106 /* attempt to manually load the test provider */107 if (!TEST_ptr(prov = OSSL_PROVIDER_load(ctx, "test")))108 goto err;109 110 OSSL_PROVIDER_unload(prov);111 112 testresult = 1;113 68 err: 114 69 OSSL_LIB_CTX_free(ctx); … … 131 86 return 0; 132 87 133 if (!TEST_ptr(pathedconfig = test_get_argument(2)))134 return 0;135 136 88 ADD_TEST(test_recursive_config); 137 89 ADD_TEST(test_double_config); 138 ADD_TEST(test_path_config);139 90 return 1; 140 91 } -
trunk/src/libs/openssl-3.1.7/test/provider_fallback_test.c
r105945 r105949 1 1 /* 2 * Copyright 2020-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 40 40 41 41 ok = TEST_ptr(ctx = OSSL_LIB_CTX_new()) 42 && TEST_ptr(prov = OSSL_PROVIDER_load(ctx, "default")); 43 44 if (ok) { 45 ok = test_provider(ctx); 46 if (ok) 47 ok = TEST_true(OSSL_PROVIDER_unload(prov)); 48 else 49 OSSL_PROVIDER_unload(prov); 50 } 42 && TEST_ptr(prov = OSSL_PROVIDER_load(ctx, "default")) 43 && test_provider(ctx) 44 && TEST_true(OSSL_PROVIDER_unload(prov)); 51 45 52 46 OSSL_LIB_CTX_free(ctx); -
trunk/src/libs/openssl-3.1.7/test/provider_internal_test.c
r105945 r105949 1 1 /* 2 * Copyright 2019-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 23 23 static int test_provider(OSSL_PROVIDER *prov, const char *expected_greeting) 24 24 { 25 const char *greeting = "no greeting received";25 const char *greeting = NULL; 26 26 int ret = 0; 27 27 -
trunk/src/libs/openssl-3.1.7/test/provider_status_test.c
r105945 r105949 1 1 /* 2 * Copyright 2020-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 15 15 #include <openssl/self_test.h> 16 16 #include <openssl/evp.h> 17 #include <openssl/rsa.h>18 17 #include "testutil.h" 19 18 … … 149 148 OSSL_PARAM params[2]; 150 149 EVP_MD *fetch = NULL; 151 EVP_PKEY_CTX *pctx = NULL;152 EVP_PKEY *pkey = NULL;153 150 154 151 if (!TEST_ptr(prov = OSSL_PROVIDER_load(libctx, provider_name))) … … 167 164 EVP_MD_free(fetch); 168 165 fetch = NULL; 169 /* Use RNG before triggering on-demand self tests */170 if (!TEST_ptr((pctx = EVP_PKEY_CTX_new_from_name(libctx, "RSA", NULL)))171 || !TEST_int_gt(EVP_PKEY_keygen_init(pctx), 0)172 || !TEST_int_gt(EVP_PKEY_CTX_set_rsa_keygen_bits(pctx, 2048), 0)173 || !TEST_int_gt(EVP_PKEY_keygen(pctx, &pkey), 0))174 goto err;175 EVP_PKEY_free(pkey);176 EVP_PKEY_CTX_free(pctx);177 pkey = NULL;178 pctx = NULL;179 166 180 167 /* Test that the provider self test is ok */ -
trunk/src/libs/openssl-3.1.7/test/provider_test.c
r105945 r105949 1 1 /* 2 * Copyright 2019-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 198 198 if (!TEST_true(OSSL_PROVIDER_add_builtin(libctx, name, 199 199 PROVIDER_INIT_FUNCTION_NAME))) { 200 OSSL_PROVIDER_unload(legacy);201 200 OSSL_LIB_CTX_free(libctx); 202 201 return 0; -
trunk/src/libs/openssl-3.1.7/test/recipes/03-test_fipsinstall.t
r105945 r105949 1 1 #! /usr/bin/env perl 2 # Copyright 2019-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 207 207 '-provider_name', 'fips', '-mac_name', 'HMAC', 208 208 '-macopt', 'digest:SHA256', '-macopt', "hexkey:$fipskey", 209 '-section_name', 'fips_sect', '-corrupt_desc', 'SHA 2'])),209 '-section_name', 'fips_sect', '-corrupt_desc', 'SHA1'])), 210 210 "fipsinstall fails when the digest result is corrupted"); 211 211 -
trunk/src/libs/openssl-3.1.7/test/recipes/04-test_conf.t
r105945 r105949 1 1 #! /usr/bin/env perl 2 # Copyright 2017-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 19 19 'dollarid_on.cnf' => 'dollarid_on.txt', 20 20 'dollarid_off.cnf' => 'dollarid_off.txt', 21 'oversized_line.cnf' => 'oversized_line.txt',22 21 ); 23 22 -
trunk/src/libs/openssl-3.1.7/test/recipes/25-test_eai_data.t
r105945 r105949 1 1 #! /usr/bin/env perl 2 # Copyright 2019-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 22 22 #./util/wrap.pl apps/openssl verify -nameopt utf8 -no_check_time -CAfile test/recipes/25-test_eai_data/ascii_chain.pem test/recipes/25-test_eai_data/utf8_leaf.pem 23 23 24 plan tests => 1 6;24 plan tests => 12; 25 25 26 26 require_ok(srctop_file('test','recipes','tconversion.pl')); … … 29 29 my $ascii_pem = srctop_file($folder, "ascii_leaf.pem"); 30 30 my $utf8_pem = srctop_file($folder, "utf8_leaf.pem"); 31 my $kdc_pem = srctop_file($folder, "kdc-cert.pem");32 31 33 32 my $ascii_chain_pem = srctop_file($folder, "ascii_chain.pem"); 34 33 my $utf8_chain_pem = srctop_file($folder, "utf8_chain.pem"); 35 my $kdc_chain_pem = srctop_file($folder, "kdc-root-cert.pem");36 34 37 35 my $out; … … 59 57 ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $ascii_chain_pem, $ascii_pem]))); 60 58 ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $utf8_chain_pem, $utf8_pem]))); 61 ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $kdc_chain_pem, $kdc_pem])));62 59 63 60 ok(!run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $ascii_chain_pem, $utf8_pem]))); 64 61 ok(!run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $utf8_chain_pem, $ascii_pem]))); 65 66 # Check an otherName does not get misparsed as an DNS name, (should trigger ASAN errors if violated).67 ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-verify_hostname", 'mx1.example.com', "-CAfile", $kdc_chain_pem, $kdc_pem])));68 # Check an otherName does not get misparsed as an email address, (should trigger ASAN errors if violated).69 ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-verify_email", '[email protected]', "-CAfile", $kdc_chain_pem, $kdc_pem])));70 # We expect SmtpUTF8Mailbox to be a UTF8 String, not an IA5String.71 ok(!run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-verify_email", '[email protected]', "-CAfile", $kdc_chain_pem, $kdc_pem])));72 62 73 63 #Check that we get the expected failure return code -
trunk/src/libs/openssl-3.1.7/test/recipes/25-test_req.t
r105945 r105949 16 16 setup("test_req"); 17 17 18 plan tests => 50;18 plan tests => 49; 19 19 20 20 require_ok(srctop_file('test', 'recipes', 'tconversion.pl')); … … 54 54 ok(!run(app([@addext_args, "-addext", $val2, "-addext", $val3]))); 55 55 ok(run(app([@addext_args, "-addext", "SXNetID=1:one, 2:two, 3:three"]))); 56 ok(run(app([@addext_args, "-addext", "subjectAltName=dirName:dirname_sec"])));57 56 58 57 # If a CSR is provided with neither of -key or -CA/-CAkey, this should fail. -
trunk/src/libs/openssl-3.1.7/test/recipes/30-test_evp_data/evppkey_dsa.txt
r105945 r105949 1 1 # 2 # Copyright 2001-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 271 271 # Test sign with a 2048 bit key with N == 160 is not allowed in fips mode 272 272 Availablein = fips 273 FIPSversion = <3.4.0274 273 DigestSign = SHA256 275 274 Key = DSA-2048-160 … … 326 325 # Test sign with a 1024 bit key is not allowed in fips mode 327 326 Availablein = fips 328 FIPSversion = <3.4.0329 327 DigestSign = SHA256 330 328 Securitycheck = 1 … … 343 341 # Test sign with a 3072 bit key with N == 224 is not allowed in fips mode 344 342 Availablein = fips 345 FIPSversion = <3.4.0346 343 DigestSign = SHA256 347 344 Securitycheck = 1 … … 352 349 # Test sign with a 4096 bit key is not allowed in fips mode 353 350 Availablein = fips 354 FIPSversion = <3.4.0355 351 DigestSign = SHA256 356 352 Securitycheck = 1 -
trunk/src/libs/openssl-3.1.7/test/recipes/30-test_evp_data/evppkey_ecdsa.txt
r105945 r105949 1 1 # 2 # Copyright 2001-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 217 217 # Test that SHA1 is not allowed in fips mode for signing 218 218 Availablein = fips 219 FIPSversion = <3.4.0220 219 Sign = P-256 221 220 Securitycheck = 1 -
trunk/src/libs/openssl-3.1.7/test/recipes/30-test_evp_data/evppkey_rsa_common.txt
r105945 r105949 1 1 # 2 # Copyright 2001-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 1345 1345 # Signing with SHA1 is not allowed in fips mode 1346 1346 Availablein = fips 1347 FIPSversion = <3.4.01348 1347 DigestSign = SHA1 1349 1348 Securitycheck = 1 -
trunk/src/libs/openssl-3.1.7/test/recipes/30-test_prov_config.t
r105945 r105949 1 1 #! /usr/bin/env perl 2 # Copyright 2021 -2024The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 24 24 25 25 ok(run(test(["prov_config_test", srctop_file("test", "default.cnf"), 26 srctop_file("test", "recursive.cnf"), 27 srctop_file("test", "pathed.cnf")])), 26 srctop_file("test", "recursive.cnf")])), 28 27 "running prov_config_test default.cnf"); 29 28 … … 32 31 33 32 ok(run(test(["prov_config_test", srctop_file("test", "fips.cnf"), 34 srctop_file("test", "recursive.cnf"), 35 srctop_file("test", "pathed.cnf")])), 33 srctop_file("test", "recursive.cnf")])), 36 34 "running prov_config_test fips.cnf"); 37 35 } -
trunk/src/libs/openssl-3.1.7/test/recipes/80-test_pkcs12.t
r105945 r105949 55 55 $ENV{OPENSSL_WIN32_UTF8}=1; 56 56 57 plan tests => 20;57 plan tests => 17; 58 58 59 59 # Test different PKCS#12 formats … … 163 163 "test bad pkcs12 file 1 (nomacver)"); 164 164 165 ok(run(app(["openssl", "pkcs12", "-in", $bad1, "-password", "pass:",166 "-info"])),167 "test bad pkcs12 file 1 (info)");168 169 165 ok(run(app(["openssl", "pkcs12", "-in", $bad2, "-password", "pass:"])), 170 166 "test bad pkcs12 file 2"); 171 167 172 ok(run(app(["openssl", "pkcs12", "-in", $bad2, "-password", "pass:",173 "-info"])),174 "test bad pkcs12 file 2 (info)");175 176 168 ok(run(app(["openssl", "pkcs12", "-in", $bad3, "-password", "pass:"])), 177 169 "test bad pkcs12 file 3"); 178 179 ok(run(app(["openssl", "pkcs12", "-in", $bad3, "-password", "pass:",180 "-info"])),181 "test bad pkcs12 file 3 (info)");182 170 }); 183 171 -
trunk/src/libs/openssl-3.1.7/test/recipes/90-test_shlibload.t
r105945 r105949 1 1 #! /usr/bin/env perl 2 # Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 24 24 plan skip_all => "Test only supported in a dso build" if disabled("dso"); 25 25 plan skip_all => "Test is disabled in an address sanitizer build" unless disabled("asan"); 26 plan skip_all => "Test is disabled in no-atexit build" if disabled("atexit");27 26 28 27 plan tests => 10; -
trunk/src/libs/openssl-3.1.7/test/recipes/90-test_sslapi.t
r105945 r105949 1 1 #! /usr/bin/env perl 2 # Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 8 8 9 9 use OpenSSL::Test::Utils; 10 use OpenSSL::Test qw/:DEFAULT srctop_file srctop_dir bldtop_dir bldtop_file result_dir result_file/;10 use OpenSSL::Test qw/:DEFAULT srctop_file srctop_dir bldtop_dir bldtop_file/; 11 11 use File::Temp qw(tempfile); 12 12 … … 14 14 setup("test_sslapi"); 15 15 } 16 17 use lib srctop_dir('Configurations'); 18 use lib bldtop_dir('.'); 16 19 17 20 my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0); … … 23 26 # A modified copy of "fipsmodule.cnf" 24 27 my $fipsmodcfgnew_filename = "fipsmodule_mod.cnf"; 25 my $fipsmodcfgnew = result_file($fipsmodcfgnew_filename);28 my $fipsmodcfgnew = bldtop_file("test", $fipsmodcfgnew_filename); 26 29 27 30 # A modified copy of "fips-and-base.cnf" 28 my $provconfnew = result_file("fips-and-base-temp.cnf");31 my $provconfnew = bldtop_file("test", "temp.cnf"); 29 32 30 33 plan skip_all => "No TLS/SSL protocols are supported by this OpenSSL build" … … 49 52 if $no_fips; 50 53 51 # NOTE that because by default we setup fips provider in pedantic mode,52 # with >= 3.1.0 this just runs test_no_ems() to check that the connection53 # fails if ems is not used and the fips check is enabled.54 54 ok(run(test(["sslapitest", srctop_dir("test", "certs"), 55 55 srctop_file("test", "recipes", "90-test_sslapi_data", … … 60 60 "90-test_sslapi_data", 61 61 "dhparams.pem")])), 62 "running sslapitest with default fips config");62 "running sslapitest"); 63 63 64 64 run(test(["fips_version_test", "-config", $provconf, ">=3.1.0"]), … … 71 71 # value in $repl and output to a new file $outfile. 72 72 sub replace_line_file_internal { 73 73 74 74 my ($infile, $srch, $repl, $outfile) = @_; 75 75 my $msg; … … 86 86 return 1; 87 87 } 88 88 89 89 # Read in the text input file $infile 90 90 # and replace a single Key = Value line with a new value in $value. … … 103 103 return replace_line_file_internal($infile, $srch, $rep, $outfile); 104 104 } 105 105 106 106 # Read in the text $input file 107 107 # and search for the $key and replace with $newkey … … 115 115 } 116 116 117 # The default fipsmodule.cnf in tests is set with -pedantic. 118 # In order to enable the tls1-prf-ems-check=0 in a fips config file 117 # In order to enable the tls1-prf-ems-check=1 in a fips config file 119 118 # copy the existing fipsmodule.cnf and modify it. 120 119 # Then copy fips-and-base.cfg to make a file that includes the changed file 121 $ENV{OPENSSL_CONF_INCLUDE} = result_dir(); 120 # NOTE that this just runs test_no_ems() to check that the connection 121 # fails if ems is not used and the fips check is enabled. 122 122 ok(replace_kv_file($fipsmodcfg, 123 'tls1-prf-ems-check', ' 0',123 'tls1-prf-ems-check', '1', 124 124 $fipsmodcfgnew) 125 125 && replace_line_file($provconf, … … 135 135 "90-test_sslapi_data", 136 136 "dhparams.pem")])), 137 "running sslapitest with modified fips config"); 137 "running sslapitest"); 138 139 unlink $fipsmodcfgnew; 140 unlink $provconfnew; 138 141 } 139 142 -
trunk/src/libs/openssl-3.1.7/test/sm2_internal_test.c
r105945 r105949 1 1 /* 2 * Copyright 2017-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 306 306 const char *k_hex, 307 307 const char *r_hex, 308 const char *s_hex, 309 int omit_pubkey) 308 const char *s_hex) 310 309 { 311 310 const size_t msg_len = strlen(message); … … 329 328 goto done; 330 329 331 if (omit_pubkey == 0) { 332 pt = EC_POINT_new(group); 333 if (!TEST_ptr(pt) 334 || !TEST_true(EC_POINT_mul(group, pt, priv, NULL, NULL, NULL)) 335 || !TEST_true(EC_KEY_set_public_key(key, pt))) 336 goto done; 337 } 330 pt = EC_POINT_new(group); 331 if (!TEST_ptr(pt) 332 || !TEST_true(EC_POINT_mul(group, pt, priv, NULL, NULL, NULL)) 333 || !TEST_true(EC_KEY_set_public_key(key, pt))) 334 goto done; 338 335 339 336 start_fake_rand(k_hex); … … 396 393 "007c47811054c6f99613a578eb8453706ccb96384fe7df5c171671e760bfa8be3a", 397 394 "40F1EC59F793D9F49E09DCEF49130D4194F79FB1EED2CAA55BACDB49C4E755D1", 398 "6FC6DAC32C5D5CF10C77DFB20F7C2EB667A457872FB09EC56327A67EC7DEEBE7", 0))) 399 goto done; 400 401 /* Make sure we fail if we omit the public portion of the key */ 402 if (!TEST_false(test_sm2_sign( 403 test_group, 404 /* the default ID specified in GM/T 0009-2012 (Sec. 10).*/ 405 SM2_DEFAULT_USERID, 406 /* privkey */ 407 "3945208F7B2144B13F36E38AC6D39F95889393692860B51A42FB81EF4DF7C5B8", 408 /* plaintext message */ 409 "message digest", 410 /* ephemeral nonce k */ 411 "59276E27D506861A16680F3AD9C02DCCEF3CC1FA3CDBE4CE6D54B80DEAC1BC21", 412 /* expected signature, */ 413 /* signature R, 0x20 bytes */ 414 "F5A03B0648D2C4630EEAC513E1BB81A15944DA3827D5B74143AC7EACEEE720B3", 415 /* signature S, 0x20 bytes */ 416 "B1B6AA29DF212FD8763182BC0D421CA1BB9038FD1F7F42D4840B69C485BBC1AA", 1))) 395 "6FC6DAC32C5D5CF10C77DFB20F7C2EB667A457872FB09EC56327A67EC7DEEBE7"))) 417 396 goto done; 418 397 -
trunk/src/libs/openssl-3.1.7/test/ssl-tests/08-npn.cnf
r105945 r105949 1 1 # Generated with generate_ssl_tests.pl 2 2 3 num_tests = 2 23 num_tests = 20 4 4 5 5 test-0 = 0-npn-simple … … 9 9 test-4 = 4-npn-no-server-support 10 10 test-5 = 5-npn-no-client-support 11 test-6 = 6-npn-empty-client-list 12 test-7 = 7-npn-empty-server-list 13 test-8 = 8-npn-with-sni-no-context-switch 14 test-9 = 9-npn-with-sni-context-switch 15 test-10 = 10-npn-selected-sni-server-supports-npn 16 test-11 = 11-npn-selected-sni-server-does-not-support-npn 17 test-12 = 12-alpn-preferred-over-npn 18 test-13 = 13-sni-npn-preferred-over-alpn 19 test-14 = 14-npn-simple-resumption 20 test-15 = 15-npn-server-switch-resumption 21 test-16 = 16-npn-client-switch-resumption 22 test-17 = 17-npn-client-first-pref-on-mismatch-resumption 23 test-18 = 18-npn-no-server-support-resumption 24 test-19 = 19-npn-no-client-support-resumption 25 test-20 = 20-alpn-preferred-over-npn-resumption 26 test-21 = 21-npn-used-if-alpn-not-supported-resumption 11 test-6 = 6-npn-with-sni-no-context-switch 12 test-7 = 7-npn-with-sni-context-switch 13 test-8 = 8-npn-selected-sni-server-supports-npn 14 test-9 = 9-npn-selected-sni-server-does-not-support-npn 15 test-10 = 10-alpn-preferred-over-npn 16 test-11 = 11-sni-npn-preferred-over-alpn 17 test-12 = 12-npn-simple-resumption 18 test-13 = 13-npn-server-switch-resumption 19 test-14 = 14-npn-client-switch-resumption 20 test-15 = 15-npn-client-first-pref-on-mismatch-resumption 21 test-16 = 16-npn-no-server-support-resumption 22 test-17 = 17-npn-no-client-support-resumption 23 test-18 = 18-alpn-preferred-over-npn-resumption 24 test-19 = 19-npn-used-if-alpn-not-supported-resumption 27 25 # =========================================================== 28 26 … … 209 207 # =========================================================== 210 208 211 [6-npn-empty-client-list] 212 ssl_conf = 6-npn-empty-client-list-ssl 213 214 [6-npn-empty-client-list-ssl] 215 server = 6-npn-empty-client-list-server 216 client = 6-npn-empty-client-list-client 217 218 [6-npn-empty-client-list-server] 219 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 220 CipherString = DEFAULT 221 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 222 223 [6-npn-empty-client-list-client] 209 [6-npn-with-sni-no-context-switch] 210 ssl_conf = 6-npn-with-sni-no-context-switch-ssl 211 212 [6-npn-with-sni-no-context-switch-ssl] 213 server = 6-npn-with-sni-no-context-switch-server 214 client = 6-npn-with-sni-no-context-switch-client 215 server2 = 6-npn-with-sni-no-context-switch-server2 216 217 [6-npn-with-sni-no-context-switch-server] 218 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 219 CipherString = DEFAULT 220 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 221 222 [6-npn-with-sni-no-context-switch-server2] 223 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 224 CipherString = DEFAULT 225 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 226 227 [6-npn-with-sni-no-context-switch-client] 224 228 CipherString = DEFAULT 225 229 MaxProtocol = TLSv1.2 … … 228 232 229 233 [test-6] 230 ExpectedClientAlert = HandshakeFailure231 ExpectedResult = ClientFail232 server = 6-npn-empty-client-list-server-extra233 client = 6-npn-empty-client-list-client-extra234 235 [6-npn-empty-client-list-server-extra]236 NPNProtocols = foo237 238 [6-npn-empty-client-list-client-extra]239 NPNProtocols =240 241 242 # ===========================================================243 244 [7-npn-empty-server-list]245 ssl_conf = 7-npn-empty-server-list-ssl246 247 [7-npn-empty-server-list-ssl]248 server = 7-npn-empty-server-list-server249 client = 7-npn-empty-server-list-client250 251 [7-npn-empty-server-list-server]252 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem253 CipherString = DEFAULT254 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem255 256 [7-npn-empty-server-list-client]257 CipherString = DEFAULT258 MaxProtocol = TLSv1.2259 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem260 VerifyMode = Peer261 262 [test-7]263 ExpectedNPNProtocol = foo264 server = 7-npn-empty-server-list-server-extra265 client = 7-npn-empty-server-list-client-extra266 267 [7-npn-empty-server-list-server-extra]268 NPNProtocols =269 270 [7-npn-empty-server-list-client-extra]271 NPNProtocols = foo272 273 274 # ===========================================================275 276 [8-npn-with-sni-no-context-switch]277 ssl_conf = 8-npn-with-sni-no-context-switch-ssl278 279 [8-npn-with-sni-no-context-switch-ssl]280 server = 8-npn-with-sni-no-context-switch-server281 client = 8-npn-with-sni-no-context-switch-client282 server2 = 8-npn-with-sni-no-context-switch-server2283 284 [8-npn-with-sni-no-context-switch-server]285 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem286 CipherString = DEFAULT287 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem288 289 [8-npn-with-sni-no-context-switch-server2]290 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem291 CipherString = DEFAULT292 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem293 294 [8-npn-with-sni-no-context-switch-client]295 CipherString = DEFAULT296 MaxProtocol = TLSv1.2297 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem298 VerifyMode = Peer299 300 [test-8]301 234 ExpectedNPNProtocol = foo 302 235 ExpectedServerName = server1 303 server = 8-npn-with-sni-no-context-switch-server-extra304 server2 = 8-npn-with-sni-no-context-switch-server2-extra305 client = 8-npn-with-sni-no-context-switch-client-extra306 307 [ 8-npn-with-sni-no-context-switch-server-extra]236 server = 6-npn-with-sni-no-context-switch-server-extra 237 server2 = 6-npn-with-sni-no-context-switch-server2-extra 238 client = 6-npn-with-sni-no-context-switch-client-extra 239 240 [6-npn-with-sni-no-context-switch-server-extra] 308 241 NPNProtocols = foo 309 242 ServerNameCallback = IgnoreMismatch 310 243 311 [ 8-npn-with-sni-no-context-switch-server2-extra]312 NPNProtocols = bar 313 314 [ 8-npn-with-sni-no-context-switch-client-extra]244 [6-npn-with-sni-no-context-switch-server2-extra] 245 NPNProtocols = bar 246 247 [6-npn-with-sni-no-context-switch-client-extra] 315 248 NPNProtocols = foo,bar 316 249 ServerName = server1 … … 319 252 # =========================================================== 320 253 321 [ 9-npn-with-sni-context-switch]322 ssl_conf = 9-npn-with-sni-context-switch-ssl323 324 [ 9-npn-with-sni-context-switch-ssl]325 server = 9-npn-with-sni-context-switch-server326 client = 9-npn-with-sni-context-switch-client327 server2 = 9-npn-with-sni-context-switch-server2328 329 [ 9-npn-with-sni-context-switch-server]330 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 331 CipherString = DEFAULT 332 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 333 334 [ 9-npn-with-sni-context-switch-server2]335 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 336 CipherString = DEFAULT 337 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 338 339 [ 9-npn-with-sni-context-switch-client]340 CipherString = DEFAULT 341 MaxProtocol = TLSv1.2 342 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 343 VerifyMode = Peer 344 345 [test- 9]254 [7-npn-with-sni-context-switch] 255 ssl_conf = 7-npn-with-sni-context-switch-ssl 256 257 [7-npn-with-sni-context-switch-ssl] 258 server = 7-npn-with-sni-context-switch-server 259 client = 7-npn-with-sni-context-switch-client 260 server2 = 7-npn-with-sni-context-switch-server2 261 262 [7-npn-with-sni-context-switch-server] 263 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 264 CipherString = DEFAULT 265 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 266 267 [7-npn-with-sni-context-switch-server2] 268 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 269 CipherString = DEFAULT 270 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 271 272 [7-npn-with-sni-context-switch-client] 273 CipherString = DEFAULT 274 MaxProtocol = TLSv1.2 275 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 276 VerifyMode = Peer 277 278 [test-7] 346 279 ExpectedNPNProtocol = bar 347 280 ExpectedServerName = server2 348 server = 9-npn-with-sni-context-switch-server-extra349 server2 = 9-npn-with-sni-context-switch-server2-extra350 client = 9-npn-with-sni-context-switch-client-extra351 352 [ 9-npn-with-sni-context-switch-server-extra]281 server = 7-npn-with-sni-context-switch-server-extra 282 server2 = 7-npn-with-sni-context-switch-server2-extra 283 client = 7-npn-with-sni-context-switch-client-extra 284 285 [7-npn-with-sni-context-switch-server-extra] 353 286 NPNProtocols = foo 354 287 ServerNameCallback = IgnoreMismatch 355 288 356 [ 9-npn-with-sni-context-switch-server2-extra]357 NPNProtocols = bar 358 359 [ 9-npn-with-sni-context-switch-client-extra]289 [7-npn-with-sni-context-switch-server2-extra] 290 NPNProtocols = bar 291 292 [7-npn-with-sni-context-switch-client-extra] 360 293 NPNProtocols = foo,bar 361 294 ServerName = server2 … … 364 297 # =========================================================== 365 298 366 [ 10-npn-selected-sni-server-supports-npn]367 ssl_conf = 10-npn-selected-sni-server-supports-npn-ssl368 369 [ 10-npn-selected-sni-server-supports-npn-ssl]370 server = 10-npn-selected-sni-server-supports-npn-server371 client = 10-npn-selected-sni-server-supports-npn-client372 server2 = 10-npn-selected-sni-server-supports-npn-server2373 374 [ 10-npn-selected-sni-server-supports-npn-server]375 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 376 CipherString = DEFAULT 377 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 378 379 [ 10-npn-selected-sni-server-supports-npn-server2]380 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 381 CipherString = DEFAULT 382 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 383 384 [ 10-npn-selected-sni-server-supports-npn-client]385 CipherString = DEFAULT 386 MaxProtocol = TLSv1.2 387 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 388 VerifyMode = Peer 389 390 [test- 10]299 [8-npn-selected-sni-server-supports-npn] 300 ssl_conf = 8-npn-selected-sni-server-supports-npn-ssl 301 302 [8-npn-selected-sni-server-supports-npn-ssl] 303 server = 8-npn-selected-sni-server-supports-npn-server 304 client = 8-npn-selected-sni-server-supports-npn-client 305 server2 = 8-npn-selected-sni-server-supports-npn-server2 306 307 [8-npn-selected-sni-server-supports-npn-server] 308 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 309 CipherString = DEFAULT 310 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 311 312 [8-npn-selected-sni-server-supports-npn-server2] 313 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 314 CipherString = DEFAULT 315 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 316 317 [8-npn-selected-sni-server-supports-npn-client] 318 CipherString = DEFAULT 319 MaxProtocol = TLSv1.2 320 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 321 VerifyMode = Peer 322 323 [test-8] 391 324 ExpectedNPNProtocol = bar 392 325 ExpectedServerName = server2 393 server = 10-npn-selected-sni-server-supports-npn-server-extra394 server2 = 10-npn-selected-sni-server-supports-npn-server2-extra395 client = 10-npn-selected-sni-server-supports-npn-client-extra396 397 [ 10-npn-selected-sni-server-supports-npn-server-extra]326 server = 8-npn-selected-sni-server-supports-npn-server-extra 327 server2 = 8-npn-selected-sni-server-supports-npn-server2-extra 328 client = 8-npn-selected-sni-server-supports-npn-client-extra 329 330 [8-npn-selected-sni-server-supports-npn-server-extra] 398 331 ServerNameCallback = IgnoreMismatch 399 332 400 [ 10-npn-selected-sni-server-supports-npn-server2-extra]401 NPNProtocols = bar 402 403 [ 10-npn-selected-sni-server-supports-npn-client-extra]333 [8-npn-selected-sni-server-supports-npn-server2-extra] 334 NPNProtocols = bar 335 336 [8-npn-selected-sni-server-supports-npn-client-extra] 404 337 NPNProtocols = foo,bar 405 338 ServerName = server2 … … 408 341 # =========================================================== 409 342 410 [ 11-npn-selected-sni-server-does-not-support-npn]411 ssl_conf = 11-npn-selected-sni-server-does-not-support-npn-ssl412 413 [ 11-npn-selected-sni-server-does-not-support-npn-ssl]414 server = 11-npn-selected-sni-server-does-not-support-npn-server415 client = 11-npn-selected-sni-server-does-not-support-npn-client416 server2 = 11-npn-selected-sni-server-does-not-support-npn-server2417 418 [ 11-npn-selected-sni-server-does-not-support-npn-server]419 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 420 CipherString = DEFAULT 421 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 422 423 [ 11-npn-selected-sni-server-does-not-support-npn-server2]424 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 425 CipherString = DEFAULT 426 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 427 428 [ 11-npn-selected-sni-server-does-not-support-npn-client]429 CipherString = DEFAULT 430 MaxProtocol = TLSv1.2 431 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 432 VerifyMode = Peer 433 434 [test- 11]343 [9-npn-selected-sni-server-does-not-support-npn] 344 ssl_conf = 9-npn-selected-sni-server-does-not-support-npn-ssl 345 346 [9-npn-selected-sni-server-does-not-support-npn-ssl] 347 server = 9-npn-selected-sni-server-does-not-support-npn-server 348 client = 9-npn-selected-sni-server-does-not-support-npn-client 349 server2 = 9-npn-selected-sni-server-does-not-support-npn-server2 350 351 [9-npn-selected-sni-server-does-not-support-npn-server] 352 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 353 CipherString = DEFAULT 354 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 355 356 [9-npn-selected-sni-server-does-not-support-npn-server2] 357 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 358 CipherString = DEFAULT 359 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 360 361 [9-npn-selected-sni-server-does-not-support-npn-client] 362 CipherString = DEFAULT 363 MaxProtocol = TLSv1.2 364 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 365 VerifyMode = Peer 366 367 [test-9] 435 368 ExpectedServerName = server2 436 server = 11-npn-selected-sni-server-does-not-support-npn-server-extra437 client = 11-npn-selected-sni-server-does-not-support-npn-client-extra438 439 [ 11-npn-selected-sni-server-does-not-support-npn-server-extra]369 server = 9-npn-selected-sni-server-does-not-support-npn-server-extra 370 client = 9-npn-selected-sni-server-does-not-support-npn-client-extra 371 372 [9-npn-selected-sni-server-does-not-support-npn-server-extra] 440 373 NPNProtocols = bar 441 374 ServerNameCallback = IgnoreMismatch 442 375 443 [ 11-npn-selected-sni-server-does-not-support-npn-client-extra]376 [9-npn-selected-sni-server-does-not-support-npn-client-extra] 444 377 NPNProtocols = foo,bar 445 378 ServerName = server2 … … 448 381 # =========================================================== 449 382 450 [1 2-alpn-preferred-over-npn]451 ssl_conf = 1 2-alpn-preferred-over-npn-ssl452 453 [1 2-alpn-preferred-over-npn-ssl]454 server = 1 2-alpn-preferred-over-npn-server455 client = 1 2-alpn-preferred-over-npn-client456 457 [1 2-alpn-preferred-over-npn-server]458 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 459 CipherString = DEFAULT 460 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 461 462 [1 2-alpn-preferred-over-npn-client]463 CipherString = DEFAULT 464 MaxProtocol = TLSv1.2 465 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 466 VerifyMode = Peer 467 468 [test-1 2]383 [10-alpn-preferred-over-npn] 384 ssl_conf = 10-alpn-preferred-over-npn-ssl 385 386 [10-alpn-preferred-over-npn-ssl] 387 server = 10-alpn-preferred-over-npn-server 388 client = 10-alpn-preferred-over-npn-client 389 390 [10-alpn-preferred-over-npn-server] 391 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 392 CipherString = DEFAULT 393 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 394 395 [10-alpn-preferred-over-npn-client] 396 CipherString = DEFAULT 397 MaxProtocol = TLSv1.2 398 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 399 VerifyMode = Peer 400 401 [test-10] 469 402 ExpectedALPNProtocol = foo 470 server = 1 2-alpn-preferred-over-npn-server-extra471 client = 1 2-alpn-preferred-over-npn-client-extra472 473 [1 2-alpn-preferred-over-npn-server-extra]403 server = 10-alpn-preferred-over-npn-server-extra 404 client = 10-alpn-preferred-over-npn-client-extra 405 406 [10-alpn-preferred-over-npn-server-extra] 474 407 ALPNProtocols = foo 475 408 NPNProtocols = bar 476 409 477 [1 2-alpn-preferred-over-npn-client-extra]410 [10-alpn-preferred-over-npn-client-extra] 478 411 ALPNProtocols = foo 479 412 NPNProtocols = bar … … 482 415 # =========================================================== 483 416 484 [1 3-sni-npn-preferred-over-alpn]485 ssl_conf = 1 3-sni-npn-preferred-over-alpn-ssl486 487 [1 3-sni-npn-preferred-over-alpn-ssl]488 server = 1 3-sni-npn-preferred-over-alpn-server489 client = 1 3-sni-npn-preferred-over-alpn-client490 server2 = 1 3-sni-npn-preferred-over-alpn-server2491 492 [1 3-sni-npn-preferred-over-alpn-server]493 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 494 CipherString = DEFAULT 495 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 496 497 [1 3-sni-npn-preferred-over-alpn-server2]498 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 499 CipherString = DEFAULT 500 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 501 502 [1 3-sni-npn-preferred-over-alpn-client]503 CipherString = DEFAULT 504 MaxProtocol = TLSv1.2 505 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 506 VerifyMode = Peer 507 508 [test-1 3]417 [11-sni-npn-preferred-over-alpn] 418 ssl_conf = 11-sni-npn-preferred-over-alpn-ssl 419 420 [11-sni-npn-preferred-over-alpn-ssl] 421 server = 11-sni-npn-preferred-over-alpn-server 422 client = 11-sni-npn-preferred-over-alpn-client 423 server2 = 11-sni-npn-preferred-over-alpn-server2 424 425 [11-sni-npn-preferred-over-alpn-server] 426 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 427 CipherString = DEFAULT 428 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 429 430 [11-sni-npn-preferred-over-alpn-server2] 431 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 432 CipherString = DEFAULT 433 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 434 435 [11-sni-npn-preferred-over-alpn-client] 436 CipherString = DEFAULT 437 MaxProtocol = TLSv1.2 438 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 439 VerifyMode = Peer 440 441 [test-11] 509 442 ExpectedNPNProtocol = bar 510 443 ExpectedServerName = server2 511 server = 1 3-sni-npn-preferred-over-alpn-server-extra512 server2 = 1 3-sni-npn-preferred-over-alpn-server2-extra513 client = 1 3-sni-npn-preferred-over-alpn-client-extra514 515 [1 3-sni-npn-preferred-over-alpn-server-extra]444 server = 11-sni-npn-preferred-over-alpn-server-extra 445 server2 = 11-sni-npn-preferred-over-alpn-server2-extra 446 client = 11-sni-npn-preferred-over-alpn-client-extra 447 448 [11-sni-npn-preferred-over-alpn-server-extra] 516 449 ALPNProtocols = foo 517 450 ServerNameCallback = IgnoreMismatch 518 451 519 [1 3-sni-npn-preferred-over-alpn-server2-extra]520 NPNProtocols = bar 521 522 [1 3-sni-npn-preferred-over-alpn-client-extra]452 [11-sni-npn-preferred-over-alpn-server2-extra] 453 NPNProtocols = bar 454 455 [11-sni-npn-preferred-over-alpn-client-extra] 523 456 ALPNProtocols = foo 524 457 NPNProtocols = bar … … 528 461 # =========================================================== 529 462 530 [1 4-npn-simple-resumption]531 ssl_conf = 1 4-npn-simple-resumption-ssl532 533 [1 4-npn-simple-resumption-ssl]534 server = 1 4-npn-simple-resumption-server535 client = 1 4-npn-simple-resumption-client536 resume-server = 1 4-npn-simple-resumption-server537 resume-client = 1 4-npn-simple-resumption-client538 539 [1 4-npn-simple-resumption-server]540 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 541 CipherString = DEFAULT 542 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 543 544 [1 4-npn-simple-resumption-client]545 CipherString = DEFAULT 546 MaxProtocol = TLSv1.2 547 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 548 VerifyMode = Peer 549 550 [test-1 4]463 [12-npn-simple-resumption] 464 ssl_conf = 12-npn-simple-resumption-ssl 465 466 [12-npn-simple-resumption-ssl] 467 server = 12-npn-simple-resumption-server 468 client = 12-npn-simple-resumption-client 469 resume-server = 12-npn-simple-resumption-server 470 resume-client = 12-npn-simple-resumption-client 471 472 [12-npn-simple-resumption-server] 473 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 474 CipherString = DEFAULT 475 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 476 477 [12-npn-simple-resumption-client] 478 CipherString = DEFAULT 479 MaxProtocol = TLSv1.2 480 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 481 VerifyMode = Peer 482 483 [test-12] 551 484 ExpectedNPNProtocol = foo 552 485 HandshakeMode = Resume 553 486 ResumptionExpected = Yes 554 server = 1 4-npn-simple-resumption-server-extra555 resume-server = 1 4-npn-simple-resumption-server-extra556 client = 1 4-npn-simple-resumption-client-extra557 resume-client = 1 4-npn-simple-resumption-client-extra558 559 [1 4-npn-simple-resumption-server-extra]560 NPNProtocols = foo 561 562 [1 4-npn-simple-resumption-client-extra]563 NPNProtocols = foo 564 565 566 # =========================================================== 567 568 [1 5-npn-server-switch-resumption]569 ssl_conf = 1 5-npn-server-switch-resumption-ssl570 571 [1 5-npn-server-switch-resumption-ssl]572 server = 1 5-npn-server-switch-resumption-server573 client = 1 5-npn-server-switch-resumption-client574 resume-server = 1 5-npn-server-switch-resumption-resume-server575 resume-client = 1 5-npn-server-switch-resumption-client576 577 [1 5-npn-server-switch-resumption-server]578 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 579 CipherString = DEFAULT 580 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 581 582 [1 5-npn-server-switch-resumption-resume-server]583 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 584 CipherString = DEFAULT 585 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 586 587 [1 5-npn-server-switch-resumption-client]588 CipherString = DEFAULT 589 MaxProtocol = TLSv1.2 590 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 591 VerifyMode = Peer 592 593 [test-1 5]487 server = 12-npn-simple-resumption-server-extra 488 resume-server = 12-npn-simple-resumption-server-extra 489 client = 12-npn-simple-resumption-client-extra 490 resume-client = 12-npn-simple-resumption-client-extra 491 492 [12-npn-simple-resumption-server-extra] 493 NPNProtocols = foo 494 495 [12-npn-simple-resumption-client-extra] 496 NPNProtocols = foo 497 498 499 # =========================================================== 500 501 [13-npn-server-switch-resumption] 502 ssl_conf = 13-npn-server-switch-resumption-ssl 503 504 [13-npn-server-switch-resumption-ssl] 505 server = 13-npn-server-switch-resumption-server 506 client = 13-npn-server-switch-resumption-client 507 resume-server = 13-npn-server-switch-resumption-resume-server 508 resume-client = 13-npn-server-switch-resumption-client 509 510 [13-npn-server-switch-resumption-server] 511 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 512 CipherString = DEFAULT 513 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 514 515 [13-npn-server-switch-resumption-resume-server] 516 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 517 CipherString = DEFAULT 518 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 519 520 [13-npn-server-switch-resumption-client] 521 CipherString = DEFAULT 522 MaxProtocol = TLSv1.2 523 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 524 VerifyMode = Peer 525 526 [test-13] 594 527 ExpectedNPNProtocol = baz 595 528 HandshakeMode = Resume 596 529 ResumptionExpected = Yes 597 server = 1 5-npn-server-switch-resumption-server-extra598 resume-server = 1 5-npn-server-switch-resumption-resume-server-extra599 client = 1 5-npn-server-switch-resumption-client-extra600 resume-client = 1 5-npn-server-switch-resumption-client-extra601 602 [1 5-npn-server-switch-resumption-server-extra]530 server = 13-npn-server-switch-resumption-server-extra 531 resume-server = 13-npn-server-switch-resumption-resume-server-extra 532 client = 13-npn-server-switch-resumption-client-extra 533 resume-client = 13-npn-server-switch-resumption-client-extra 534 535 [13-npn-server-switch-resumption-server-extra] 603 536 NPNProtocols = bar,foo 604 537 605 [1 5-npn-server-switch-resumption-resume-server-extra]538 [13-npn-server-switch-resumption-resume-server-extra] 606 539 NPNProtocols = baz,foo 607 540 608 [1 5-npn-server-switch-resumption-client-extra]541 [13-npn-server-switch-resumption-client-extra] 609 542 NPNProtocols = foo,bar,baz 610 543 … … 612 545 # =========================================================== 613 546 614 [1 6-npn-client-switch-resumption]615 ssl_conf = 1 6-npn-client-switch-resumption-ssl616 617 [1 6-npn-client-switch-resumption-ssl]618 server = 1 6-npn-client-switch-resumption-server619 client = 1 6-npn-client-switch-resumption-client620 resume-server = 1 6-npn-client-switch-resumption-server621 resume-client = 1 6-npn-client-switch-resumption-resume-client622 623 [1 6-npn-client-switch-resumption-server]624 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 625 CipherString = DEFAULT 626 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 627 628 [1 6-npn-client-switch-resumption-client]629 CipherString = DEFAULT 630 MaxProtocol = TLSv1.2 631 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 632 VerifyMode = Peer 633 634 [1 6-npn-client-switch-resumption-resume-client]635 CipherString = DEFAULT 636 MaxProtocol = TLSv1.2 637 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 638 VerifyMode = Peer 639 640 [test-1 6]547 [14-npn-client-switch-resumption] 548 ssl_conf = 14-npn-client-switch-resumption-ssl 549 550 [14-npn-client-switch-resumption-ssl] 551 server = 14-npn-client-switch-resumption-server 552 client = 14-npn-client-switch-resumption-client 553 resume-server = 14-npn-client-switch-resumption-server 554 resume-client = 14-npn-client-switch-resumption-resume-client 555 556 [14-npn-client-switch-resumption-server] 557 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 558 CipherString = DEFAULT 559 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 560 561 [14-npn-client-switch-resumption-client] 562 CipherString = DEFAULT 563 MaxProtocol = TLSv1.2 564 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 565 VerifyMode = Peer 566 567 [14-npn-client-switch-resumption-resume-client] 568 CipherString = DEFAULT 569 MaxProtocol = TLSv1.2 570 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 571 VerifyMode = Peer 572 573 [test-14] 641 574 ExpectedNPNProtocol = bar 642 575 HandshakeMode = Resume 643 576 ResumptionExpected = Yes 644 server = 1 6-npn-client-switch-resumption-server-extra645 resume-server = 1 6-npn-client-switch-resumption-server-extra646 client = 1 6-npn-client-switch-resumption-client-extra647 resume-client = 1 6-npn-client-switch-resumption-resume-client-extra648 649 [1 6-npn-client-switch-resumption-server-extra]577 server = 14-npn-client-switch-resumption-server-extra 578 resume-server = 14-npn-client-switch-resumption-server-extra 579 client = 14-npn-client-switch-resumption-client-extra 580 resume-client = 14-npn-client-switch-resumption-resume-client-extra 581 582 [14-npn-client-switch-resumption-server-extra] 650 583 NPNProtocols = foo,bar,baz 651 584 652 [1 6-npn-client-switch-resumption-client-extra]585 [14-npn-client-switch-resumption-client-extra] 653 586 NPNProtocols = foo,baz 654 587 655 [1 6-npn-client-switch-resumption-resume-client-extra]588 [14-npn-client-switch-resumption-resume-client-extra] 656 589 NPNProtocols = bar,baz 657 590 … … 659 592 # =========================================================== 660 593 661 [1 7-npn-client-first-pref-on-mismatch-resumption]662 ssl_conf = 1 7-npn-client-first-pref-on-mismatch-resumption-ssl663 664 [1 7-npn-client-first-pref-on-mismatch-resumption-ssl]665 server = 1 7-npn-client-first-pref-on-mismatch-resumption-server666 client = 1 7-npn-client-first-pref-on-mismatch-resumption-client667 resume-server = 1 7-npn-client-first-pref-on-mismatch-resumption-resume-server668 resume-client = 1 7-npn-client-first-pref-on-mismatch-resumption-client669 670 [1 7-npn-client-first-pref-on-mismatch-resumption-server]671 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 672 CipherString = DEFAULT 673 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 674 675 [1 7-npn-client-first-pref-on-mismatch-resumption-resume-server]676 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 677 CipherString = DEFAULT 678 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 679 680 [1 7-npn-client-first-pref-on-mismatch-resumption-client]681 CipherString = DEFAULT 682 MaxProtocol = TLSv1.2 683 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 684 VerifyMode = Peer 685 686 [test-1 7]594 [15-npn-client-first-pref-on-mismatch-resumption] 595 ssl_conf = 15-npn-client-first-pref-on-mismatch-resumption-ssl 596 597 [15-npn-client-first-pref-on-mismatch-resumption-ssl] 598 server = 15-npn-client-first-pref-on-mismatch-resumption-server 599 client = 15-npn-client-first-pref-on-mismatch-resumption-client 600 resume-server = 15-npn-client-first-pref-on-mismatch-resumption-resume-server 601 resume-client = 15-npn-client-first-pref-on-mismatch-resumption-client 602 603 [15-npn-client-first-pref-on-mismatch-resumption-server] 604 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 605 CipherString = DEFAULT 606 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 607 608 [15-npn-client-first-pref-on-mismatch-resumption-resume-server] 609 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 610 CipherString = DEFAULT 611 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 612 613 [15-npn-client-first-pref-on-mismatch-resumption-client] 614 CipherString = DEFAULT 615 MaxProtocol = TLSv1.2 616 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 617 VerifyMode = Peer 618 619 [test-15] 687 620 ExpectedNPNProtocol = foo 688 621 HandshakeMode = Resume 689 622 ResumptionExpected = Yes 690 server = 1 7-npn-client-first-pref-on-mismatch-resumption-server-extra691 resume-server = 1 7-npn-client-first-pref-on-mismatch-resumption-resume-server-extra692 client = 1 7-npn-client-first-pref-on-mismatch-resumption-client-extra693 resume-client = 1 7-npn-client-first-pref-on-mismatch-resumption-client-extra694 695 [1 7-npn-client-first-pref-on-mismatch-resumption-server-extra]696 NPNProtocols = bar 697 698 [1 7-npn-client-first-pref-on-mismatch-resumption-resume-server-extra]623 server = 15-npn-client-first-pref-on-mismatch-resumption-server-extra 624 resume-server = 15-npn-client-first-pref-on-mismatch-resumption-resume-server-extra 625 client = 15-npn-client-first-pref-on-mismatch-resumption-client-extra 626 resume-client = 15-npn-client-first-pref-on-mismatch-resumption-client-extra 627 628 [15-npn-client-first-pref-on-mismatch-resumption-server-extra] 629 NPNProtocols = bar 630 631 [15-npn-client-first-pref-on-mismatch-resumption-resume-server-extra] 699 632 NPNProtocols = baz 700 633 701 [1 7-npn-client-first-pref-on-mismatch-resumption-client-extra]634 [15-npn-client-first-pref-on-mismatch-resumption-client-extra] 702 635 NPNProtocols = foo,bar 703 636 … … 705 638 # =========================================================== 706 639 707 [1 8-npn-no-server-support-resumption]708 ssl_conf = 1 8-npn-no-server-support-resumption-ssl709 710 [1 8-npn-no-server-support-resumption-ssl]711 server = 1 8-npn-no-server-support-resumption-server712 client = 1 8-npn-no-server-support-resumption-client713 resume-server = 1 8-npn-no-server-support-resumption-resume-server714 resume-client = 1 8-npn-no-server-support-resumption-client715 716 [1 8-npn-no-server-support-resumption-server]717 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 718 CipherString = DEFAULT 719 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 720 721 [1 8-npn-no-server-support-resumption-resume-server]722 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 723 CipherString = DEFAULT 724 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 725 726 [1 8-npn-no-server-support-resumption-client]727 CipherString = DEFAULT 728 MaxProtocol = TLSv1.2 729 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 730 VerifyMode = Peer 731 732 [test-1 8]640 [16-npn-no-server-support-resumption] 641 ssl_conf = 16-npn-no-server-support-resumption-ssl 642 643 [16-npn-no-server-support-resumption-ssl] 644 server = 16-npn-no-server-support-resumption-server 645 client = 16-npn-no-server-support-resumption-client 646 resume-server = 16-npn-no-server-support-resumption-resume-server 647 resume-client = 16-npn-no-server-support-resumption-client 648 649 [16-npn-no-server-support-resumption-server] 650 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 651 CipherString = DEFAULT 652 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 653 654 [16-npn-no-server-support-resumption-resume-server] 655 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 656 CipherString = DEFAULT 657 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 658 659 [16-npn-no-server-support-resumption-client] 660 CipherString = DEFAULT 661 MaxProtocol = TLSv1.2 662 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 663 VerifyMode = Peer 664 665 [test-16] 733 666 HandshakeMode = Resume 734 667 ResumptionExpected = Yes 735 server = 1 8-npn-no-server-support-resumption-server-extra736 client = 1 8-npn-no-server-support-resumption-client-extra737 resume-client = 1 8-npn-no-server-support-resumption-client-extra738 739 [1 8-npn-no-server-support-resumption-server-extra]740 NPNProtocols = foo 741 742 [1 8-npn-no-server-support-resumption-client-extra]743 NPNProtocols = foo 744 745 746 # =========================================================== 747 748 [1 9-npn-no-client-support-resumption]749 ssl_conf = 1 9-npn-no-client-support-resumption-ssl750 751 [1 9-npn-no-client-support-resumption-ssl]752 server = 1 9-npn-no-client-support-resumption-server753 client = 1 9-npn-no-client-support-resumption-client754 resume-server = 1 9-npn-no-client-support-resumption-server755 resume-client = 1 9-npn-no-client-support-resumption-resume-client756 757 [1 9-npn-no-client-support-resumption-server]758 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 759 CipherString = DEFAULT 760 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 761 762 [1 9-npn-no-client-support-resumption-client]763 CipherString = DEFAULT 764 MaxProtocol = TLSv1.2 765 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 766 VerifyMode = Peer 767 768 [1 9-npn-no-client-support-resumption-resume-client]769 CipherString = DEFAULT 770 MaxProtocol = TLSv1.2 771 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 772 VerifyMode = Peer 773 774 [test-1 9]668 server = 16-npn-no-server-support-resumption-server-extra 669 client = 16-npn-no-server-support-resumption-client-extra 670 resume-client = 16-npn-no-server-support-resumption-client-extra 671 672 [16-npn-no-server-support-resumption-server-extra] 673 NPNProtocols = foo 674 675 [16-npn-no-server-support-resumption-client-extra] 676 NPNProtocols = foo 677 678 679 # =========================================================== 680 681 [17-npn-no-client-support-resumption] 682 ssl_conf = 17-npn-no-client-support-resumption-ssl 683 684 [17-npn-no-client-support-resumption-ssl] 685 server = 17-npn-no-client-support-resumption-server 686 client = 17-npn-no-client-support-resumption-client 687 resume-server = 17-npn-no-client-support-resumption-server 688 resume-client = 17-npn-no-client-support-resumption-resume-client 689 690 [17-npn-no-client-support-resumption-server] 691 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 692 CipherString = DEFAULT 693 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 694 695 [17-npn-no-client-support-resumption-client] 696 CipherString = DEFAULT 697 MaxProtocol = TLSv1.2 698 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 699 VerifyMode = Peer 700 701 [17-npn-no-client-support-resumption-resume-client] 702 CipherString = DEFAULT 703 MaxProtocol = TLSv1.2 704 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 705 VerifyMode = Peer 706 707 [test-17] 775 708 HandshakeMode = Resume 776 709 ResumptionExpected = Yes 777 server = 1 9-npn-no-client-support-resumption-server-extra778 resume-server = 1 9-npn-no-client-support-resumption-server-extra779 client = 1 9-npn-no-client-support-resumption-client-extra780 781 [1 9-npn-no-client-support-resumption-server-extra]782 NPNProtocols = foo 783 784 [1 9-npn-no-client-support-resumption-client-extra]785 NPNProtocols = foo 786 787 788 # =========================================================== 789 790 [ 20-alpn-preferred-over-npn-resumption]791 ssl_conf = 20-alpn-preferred-over-npn-resumption-ssl792 793 [ 20-alpn-preferred-over-npn-resumption-ssl]794 server = 20-alpn-preferred-over-npn-resumption-server795 client = 20-alpn-preferred-over-npn-resumption-client796 resume-server = 20-alpn-preferred-over-npn-resumption-resume-server797 resume-client = 20-alpn-preferred-over-npn-resumption-client798 799 [ 20-alpn-preferred-over-npn-resumption-server]800 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 801 CipherString = DEFAULT 802 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 803 804 [ 20-alpn-preferred-over-npn-resumption-resume-server]805 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 806 CipherString = DEFAULT 807 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 808 809 [ 20-alpn-preferred-over-npn-resumption-client]810 CipherString = DEFAULT 811 MaxProtocol = TLSv1.2 812 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 813 VerifyMode = Peer 814 815 [test- 20]710 server = 17-npn-no-client-support-resumption-server-extra 711 resume-server = 17-npn-no-client-support-resumption-server-extra 712 client = 17-npn-no-client-support-resumption-client-extra 713 714 [17-npn-no-client-support-resumption-server-extra] 715 NPNProtocols = foo 716 717 [17-npn-no-client-support-resumption-client-extra] 718 NPNProtocols = foo 719 720 721 # =========================================================== 722 723 [18-alpn-preferred-over-npn-resumption] 724 ssl_conf = 18-alpn-preferred-over-npn-resumption-ssl 725 726 [18-alpn-preferred-over-npn-resumption-ssl] 727 server = 18-alpn-preferred-over-npn-resumption-server 728 client = 18-alpn-preferred-over-npn-resumption-client 729 resume-server = 18-alpn-preferred-over-npn-resumption-resume-server 730 resume-client = 18-alpn-preferred-over-npn-resumption-client 731 732 [18-alpn-preferred-over-npn-resumption-server] 733 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 734 CipherString = DEFAULT 735 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 736 737 [18-alpn-preferred-over-npn-resumption-resume-server] 738 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 739 CipherString = DEFAULT 740 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 741 742 [18-alpn-preferred-over-npn-resumption-client] 743 CipherString = DEFAULT 744 MaxProtocol = TLSv1.2 745 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 746 VerifyMode = Peer 747 748 [test-18] 816 749 ExpectedALPNProtocol = foo 817 750 HandshakeMode = Resume 818 751 ResumptionExpected = Yes 819 server = 20-alpn-preferred-over-npn-resumption-server-extra820 resume-server = 20-alpn-preferred-over-npn-resumption-resume-server-extra821 client = 20-alpn-preferred-over-npn-resumption-client-extra822 resume-client = 20-alpn-preferred-over-npn-resumption-client-extra823 824 [ 20-alpn-preferred-over-npn-resumption-server-extra]825 NPNProtocols = bar 826 827 [ 20-alpn-preferred-over-npn-resumption-resume-server-extra]752 server = 18-alpn-preferred-over-npn-resumption-server-extra 753 resume-server = 18-alpn-preferred-over-npn-resumption-resume-server-extra 754 client = 18-alpn-preferred-over-npn-resumption-client-extra 755 resume-client = 18-alpn-preferred-over-npn-resumption-client-extra 756 757 [18-alpn-preferred-over-npn-resumption-server-extra] 758 NPNProtocols = bar 759 760 [18-alpn-preferred-over-npn-resumption-resume-server-extra] 828 761 ALPNProtocols = foo 829 762 NPNProtocols = baz 830 763 831 [ 20-alpn-preferred-over-npn-resumption-client-extra]764 [18-alpn-preferred-over-npn-resumption-client-extra] 832 765 ALPNProtocols = foo 833 766 NPNProtocols = bar,baz … … 836 769 # =========================================================== 837 770 838 [ 21-npn-used-if-alpn-not-supported-resumption]839 ssl_conf = 21-npn-used-if-alpn-not-supported-resumption-ssl840 841 [ 21-npn-used-if-alpn-not-supported-resumption-ssl]842 server = 21-npn-used-if-alpn-not-supported-resumption-server843 client = 21-npn-used-if-alpn-not-supported-resumption-client844 resume-server = 21-npn-used-if-alpn-not-supported-resumption-resume-server845 resume-client = 21-npn-used-if-alpn-not-supported-resumption-client846 847 [ 21-npn-used-if-alpn-not-supported-resumption-server]848 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 849 CipherString = DEFAULT 850 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 851 852 [ 21-npn-used-if-alpn-not-supported-resumption-resume-server]853 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 854 CipherString = DEFAULT 855 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 856 857 [ 21-npn-used-if-alpn-not-supported-resumption-client]858 CipherString = DEFAULT 859 MaxProtocol = TLSv1.2 860 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 861 VerifyMode = Peer 862 863 [test- 21]771 [19-npn-used-if-alpn-not-supported-resumption] 772 ssl_conf = 19-npn-used-if-alpn-not-supported-resumption-ssl 773 774 [19-npn-used-if-alpn-not-supported-resumption-ssl] 775 server = 19-npn-used-if-alpn-not-supported-resumption-server 776 client = 19-npn-used-if-alpn-not-supported-resumption-client 777 resume-server = 19-npn-used-if-alpn-not-supported-resumption-resume-server 778 resume-client = 19-npn-used-if-alpn-not-supported-resumption-client 779 780 [19-npn-used-if-alpn-not-supported-resumption-server] 781 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 782 CipherString = DEFAULT 783 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 784 785 [19-npn-used-if-alpn-not-supported-resumption-resume-server] 786 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 787 CipherString = DEFAULT 788 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 789 790 [19-npn-used-if-alpn-not-supported-resumption-client] 791 CipherString = DEFAULT 792 MaxProtocol = TLSv1.2 793 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 794 VerifyMode = Peer 795 796 [test-19] 864 797 ExpectedNPNProtocol = baz 865 798 HandshakeMode = Resume 866 799 ResumptionExpected = Yes 867 server = 21-npn-used-if-alpn-not-supported-resumption-server-extra868 resume-server = 21-npn-used-if-alpn-not-supported-resumption-resume-server-extra869 client = 21-npn-used-if-alpn-not-supported-resumption-client-extra870 resume-client = 21-npn-used-if-alpn-not-supported-resumption-client-extra871 872 [ 21-npn-used-if-alpn-not-supported-resumption-server-extra]800 server = 19-npn-used-if-alpn-not-supported-resumption-server-extra 801 resume-server = 19-npn-used-if-alpn-not-supported-resumption-resume-server-extra 802 client = 19-npn-used-if-alpn-not-supported-resumption-client-extra 803 resume-client = 19-npn-used-if-alpn-not-supported-resumption-client-extra 804 805 [19-npn-used-if-alpn-not-supported-resumption-server-extra] 873 806 ALPNProtocols = foo 874 807 NPNProtocols = bar 875 808 876 [ 21-npn-used-if-alpn-not-supported-resumption-resume-server-extra]809 [19-npn-used-if-alpn-not-supported-resumption-resume-server-extra] 877 810 NPNProtocols = baz 878 811 879 [ 21-npn-used-if-alpn-not-supported-resumption-client-extra]812 [19-npn-used-if-alpn-not-supported-resumption-client-extra] 880 813 ALPNProtocols = foo 881 814 NPNProtocols = bar,baz -
trunk/src/libs/openssl-3.1.7/test/ssl-tests/08-npn.cnf.in
r105945 r105949 1 1 # -*- mode: perl; -*- 2 # Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 112 112 }, 113 113 { 114 name => "npn-empty-client-list",115 server => {116 extra => {117 "NPNProtocols" => "foo",118 },119 },120 client => {121 extra => {122 "NPNProtocols" => "",123 },124 "MaxProtocol" => "TLSv1.2"125 },126 test => {127 "ExpectedResult" => "ClientFail",128 "ExpectedClientAlert" => "HandshakeFailure"129 },130 },131 {132 name => "npn-empty-server-list",133 server => {134 extra => {135 "NPNProtocols" => "",136 },137 },138 client => {139 extra => {140 "NPNProtocols" => "foo",141 },142 "MaxProtocol" => "TLSv1.2"143 },144 test => {145 "ExpectedNPNProtocol" => "foo"146 },147 },148 {149 114 name => "npn-with-sni-no-context-switch", 150 115 server => { -
trunk/src/libs/openssl-3.1.7/test/ssl-tests/09-alpn.cnf
r105945 r105949 1 1 # Generated with generate_ssl_tests.pl 2 2 3 num_tests = 1 83 num_tests = 16 4 4 5 5 test-0 = 0-alpn-simple … … 19 19 test-14 = 14-alpn-no-server-support-resumption 20 20 test-15 = 15-alpn-no-client-support-resumption 21 test-16 = 16-alpn-empty-client-list22 test-17 = 17-alpn-empty-server-list23 21 # =========================================================== 24 22 … … 620 618 621 619 622 # ===========================================================623 624 [16-alpn-empty-client-list]625 ssl_conf = 16-alpn-empty-client-list-ssl626 627 [16-alpn-empty-client-list-ssl]628 server = 16-alpn-empty-client-list-server629 client = 16-alpn-empty-client-list-client630 631 [16-alpn-empty-client-list-server]632 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem633 CipherString = DEFAULT634 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem635 636 [16-alpn-empty-client-list-client]637 CipherString = DEFAULT638 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem639 VerifyMode = Peer640 641 [test-16]642 server = 16-alpn-empty-client-list-server-extra643 client = 16-alpn-empty-client-list-client-extra644 645 [16-alpn-empty-client-list-server-extra]646 ALPNProtocols = foo647 648 [16-alpn-empty-client-list-client-extra]649 ALPNProtocols =650 651 652 # ===========================================================653 654 [17-alpn-empty-server-list]655 ssl_conf = 17-alpn-empty-server-list-ssl656 657 [17-alpn-empty-server-list-ssl]658 server = 17-alpn-empty-server-list-server659 client = 17-alpn-empty-server-list-client660 661 [17-alpn-empty-server-list-server]662 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem663 CipherString = DEFAULT664 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem665 666 [17-alpn-empty-server-list-client]667 CipherString = DEFAULT668 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem669 VerifyMode = Peer670 671 [test-17]672 ExpectedResult = ServerFail673 ExpectedServerAlert = NoApplicationProtocol674 server = 17-alpn-empty-server-list-server-extra675 client = 17-alpn-empty-server-list-client-extra676 677 [17-alpn-empty-server-list-server-extra]678 ALPNProtocols =679 680 [17-alpn-empty-server-list-client-extra]681 ALPNProtocols = foo682 683 -
trunk/src/libs/openssl-3.1.7/test/ssl-tests/09-alpn.cnf.in
r105945 r105949 1 1 # -*- mode: perl; -*- 2 # Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 323 323 }, 324 324 }, 325 {326 name => "alpn-empty-client-list",327 server => {328 extra => {329 "ALPNProtocols" => "foo",330 },331 },332 client => {333 extra => {334 "ALPNProtocols" => "",335 },336 },337 test => {338 "ExpectedALPNProtocol" => undef,339 },340 },341 {342 name => "alpn-empty-server-list",343 server => {344 extra => {345 "ALPNProtocols" => "",346 },347 },348 client => {349 extra => {350 "ALPNProtocols" => "foo",351 },352 },353 test => {354 "ExpectedResult" => "ServerFail",355 "ExpectedServerAlert" => "NoApplicationProtocol",356 },357 },358 325 ); -
trunk/src/libs/openssl-3.1.7/test/ssl-tests/14-curves.cnf.in
r105945 r105949 13 13 our $fips_mode; 14 14 15 my @curves = ("prime256v1", "secp384r1", "secp521r1"); 16 17 my @curves_no_fips = ("X25519", "X448"); 18 19 push @curves, @curves_no_fips if !$fips_mode; 15 my @curves = ("prime256v1", "secp384r1", "secp521r1", "X25519", 16 "X448"); 20 17 21 18 #Curves *only* suitable for use in TLSv1.3 -
trunk/src/libs/openssl-3.1.7/test/ssl-tests/20-cert-select.cnf
r105945 r105949 20 20 test-15 = 15-Ed25519 CipherString and Signature Algorithm Selection 21 21 test-16 = 16-Ed448 CipherString and Signature Algorithm Selection 22 test-17 = 17- TLS 1.2 Ed25519 Client Auth23 test-18 = 18- TLS 1.2 Ed448 Client Auth24 test-19 = 19- ECDSA Signature Algorithm Selection SHA125 test-20 = 20- ECDSA with brainpool26 test-21 = 21-E d25519 CipherString and Curves Selection27 test-22 = 22-E d448 CipherString and Curves Selection22 test-17 = 17-Ed25519 CipherString and Curves Selection 23 test-18 = 18-Ed448 CipherString and Curves Selection 24 test-19 = 19-TLS 1.2 Ed25519 Client Auth 25 test-20 = 20-TLS 1.2 Ed448 Client Auth 26 test-21 = 21-ECDSA Signature Algorithm Selection SHA1 27 test-22 = 22-ECDSA with brainpool 28 28 test-23 = 23-RSA-PSS Certificate CipherString Selection 29 29 test-24 = 24-RSA-PSS Certificate Legacy Signature Algorithm Selection … … 603 603 # =========================================================== 604 604 605 [17-TLS 1.2 Ed25519 Client Auth] 606 ssl_conf = 17-TLS 1.2 Ed25519 Client Auth-ssl 607 608 [17-TLS 1.2 Ed25519 Client Auth-ssl] 609 server = 17-TLS 1.2 Ed25519 Client Auth-server 610 client = 17-TLS 1.2 Ed25519 Client Auth-client 611 612 [17-TLS 1.2 Ed25519 Client Auth-server] 605 [17-Ed25519 CipherString and Curves Selection] 606 ssl_conf = 17-Ed25519 CipherString and Curves Selection-ssl 607 608 [17-Ed25519 CipherString and Curves Selection-ssl] 609 server = 17-Ed25519 CipherString and Curves Selection-server 610 client = 17-Ed25519 CipherString and Curves Selection-client 611 612 [17-Ed25519 CipherString and Curves Selection-server] 613 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 614 CipherString = DEFAULT 615 ECDSA.Certificate = ${ENV::TEST_CERTS_DIR}/server-ecdsa-cert.pem 616 ECDSA.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ecdsa-key.pem 617 Ed25519.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed25519-cert.pem 618 Ed25519.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed25519-key.pem 619 Ed448.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed448-cert.pem 620 Ed448.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed448-key.pem 621 MaxProtocol = TLSv1.2 622 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 623 624 [17-Ed25519 CipherString and Curves Selection-client] 625 CipherString = aECDSA 626 Curves = X25519 627 MaxProtocol = TLSv1.2 628 SignatureAlgorithms = ECDSA+SHA256:ed25519 629 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem 630 VerifyMode = Peer 631 632 [test-17] 633 ExpectedResult = Success 634 ExpectedServerCertType = Ed25519 635 ExpectedServerSignType = Ed25519 636 637 638 # =========================================================== 639 640 [18-Ed448 CipherString and Curves Selection] 641 ssl_conf = 18-Ed448 CipherString and Curves Selection-ssl 642 643 [18-Ed448 CipherString and Curves Selection-ssl] 644 server = 18-Ed448 CipherString and Curves Selection-server 645 client = 18-Ed448 CipherString and Curves Selection-client 646 647 [18-Ed448 CipherString and Curves Selection-server] 648 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 649 CipherString = DEFAULT 650 ECDSA.Certificate = ${ENV::TEST_CERTS_DIR}/server-ecdsa-cert.pem 651 ECDSA.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ecdsa-key.pem 652 Ed25519.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed25519-cert.pem 653 Ed25519.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed25519-key.pem 654 Ed448.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed448-cert.pem 655 Ed448.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed448-key.pem 656 MaxProtocol = TLSv1.2 657 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 658 659 [18-Ed448 CipherString and Curves Selection-client] 660 CipherString = aECDSA 661 Curves = X448 662 MaxProtocol = TLSv1.2 663 SignatureAlgorithms = ECDSA+SHA256:ed448 664 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/root-ed448-cert.pem 665 VerifyMode = Peer 666 667 [test-18] 668 ExpectedResult = Success 669 ExpectedServerCertType = Ed448 670 ExpectedServerSignType = Ed448 671 672 673 # =========================================================== 674 675 [19-TLS 1.2 Ed25519 Client Auth] 676 ssl_conf = 19-TLS 1.2 Ed25519 Client Auth-ssl 677 678 [19-TLS 1.2 Ed25519 Client Auth-ssl] 679 server = 19-TLS 1.2 Ed25519 Client Auth-server 680 client = 19-TLS 1.2 Ed25519 Client Auth-client 681 682 [19-TLS 1.2 Ed25519 Client Auth-server] 613 683 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 614 684 CipherString = DEFAULT … … 617 687 VerifyMode = Require 618 688 619 [1 7-TLS 1.2 Ed25519 Client Auth-client]689 [19-TLS 1.2 Ed25519 Client Auth-client] 620 690 CipherString = DEFAULT 621 691 Ed25519.Certificate = ${ENV::TEST_CERTS_DIR}/client-ed25519-cert.pem … … 626 696 VerifyMode = Peer 627 697 628 [test-1 7]698 [test-19] 629 699 ExpectedClientCertType = Ed25519 630 700 ExpectedClientSignType = Ed25519 … … 634 704 # =========================================================== 635 705 636 [ 18-TLS 1.2 Ed448 Client Auth]637 ssl_conf = 18-TLS 1.2 Ed448 Client Auth-ssl638 639 [ 18-TLS 1.2 Ed448 Client Auth-ssl]640 server = 18-TLS 1.2 Ed448 Client Auth-server641 client = 18-TLS 1.2 Ed448 Client Auth-client642 643 [ 18-TLS 1.2 Ed448 Client Auth-server]706 [20-TLS 1.2 Ed448 Client Auth] 707 ssl_conf = 20-TLS 1.2 Ed448 Client Auth-ssl 708 709 [20-TLS 1.2 Ed448 Client Auth-ssl] 710 server = 20-TLS 1.2 Ed448 Client Auth-server 711 client = 20-TLS 1.2 Ed448 Client Auth-client 712 713 [20-TLS 1.2 Ed448 Client Auth-server] 644 714 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 645 715 CipherString = DEFAULT … … 648 718 VerifyMode = Require 649 719 650 [ 18-TLS 1.2 Ed448 Client Auth-client]720 [20-TLS 1.2 Ed448 Client Auth-client] 651 721 CipherString = DEFAULT 652 722 Ed448.Certificate = ${ENV::TEST_CERTS_DIR}/client-ed448-cert.pem … … 657 727 VerifyMode = Peer 658 728 659 [test- 18]729 [test-20] 660 730 ExpectedClientCertType = Ed448 661 731 ExpectedClientSignType = Ed448 … … 665 735 # =========================================================== 666 736 667 [ 19-ECDSA Signature Algorithm Selection SHA1]668 ssl_conf = 19-ECDSA Signature Algorithm Selection SHA1-ssl669 670 [ 19-ECDSA Signature Algorithm Selection SHA1-ssl]671 server = 19-ECDSA Signature Algorithm Selection SHA1-server672 client = 19-ECDSA Signature Algorithm Selection SHA1-client673 674 [ 19-ECDSA Signature Algorithm Selection SHA1-server]737 [21-ECDSA Signature Algorithm Selection SHA1] 738 ssl_conf = 21-ECDSA Signature Algorithm Selection SHA1-ssl 739 740 [21-ECDSA Signature Algorithm Selection SHA1-ssl] 741 server = 21-ECDSA Signature Algorithm Selection SHA1-server 742 client = 21-ECDSA Signature Algorithm Selection SHA1-client 743 744 [21-ECDSA Signature Algorithm Selection SHA1-server] 675 745 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem 676 746 CipherString = DEFAULT:@SECLEVEL=0 … … 684 754 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem 685 755 686 [ 19-ECDSA Signature Algorithm Selection SHA1-client]756 [21-ECDSA Signature Algorithm Selection SHA1-client] 687 757 CipherString = DEFAULT:@SECLEVEL=0 688 758 SignatureAlgorithms = ECDSA+SHA1 … … 690 760 VerifyMode = Peer 691 761 692 [test- 19]762 [test-21] 693 763 ExpectedResult = Success 694 764 ExpectedServerCertType = P-256 … … 699 769 # =========================================================== 700 770 701 [2 0-ECDSA with brainpool]702 ssl_conf = 2 0-ECDSA with brainpool-ssl703 704 [2 0-ECDSA with brainpool-ssl]705 server = 2 0-ECDSA with brainpool-server706 client = 2 0-ECDSA with brainpool-client707 708 [2 0-ECDSA with brainpool-server]771 [22-ECDSA with brainpool] 772 ssl_conf = 22-ECDSA with brainpool-ssl 773 774 [22-ECDSA with brainpool-ssl] 775 server = 22-ECDSA with brainpool-server 776 client = 22-ECDSA with brainpool-client 777 778 [22-ECDSA with brainpool-server] 709 779 Certificate = ${ENV::TEST_CERTS_DIR}/server-ecdsa-brainpoolP256r1-cert.pem 710 780 CipherString = DEFAULT … … 712 782 PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ecdsa-brainpoolP256r1-key.pem 713 783 714 [2 0-ECDSA with brainpool-client]784 [22-ECDSA with brainpool-client] 715 785 CipherString = aECDSA 716 786 Groups = brainpoolP256r1 … … 720 790 VerifyMode = Peer 721 791 722 [test-2 0]792 [test-22] 723 793 ExpectedResult = Success 724 794 ExpectedServerCANames = empty 725 795 ExpectedServerCertType = brainpoolP256r1 726 796 ExpectedServerSignType = EC 727 728 729 # ===========================================================730 731 [21-Ed25519 CipherString and Curves Selection]732 ssl_conf = 21-Ed25519 CipherString and Curves Selection-ssl733 734 [21-Ed25519 CipherString and Curves Selection-ssl]735 server = 21-Ed25519 CipherString and Curves Selection-server736 client = 21-Ed25519 CipherString and Curves Selection-client737 738 [21-Ed25519 CipherString and Curves Selection-server]739 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem740 CipherString = DEFAULT741 ECDSA.Certificate = ${ENV::TEST_CERTS_DIR}/server-ecdsa-cert.pem742 ECDSA.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ecdsa-key.pem743 Ed25519.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed25519-cert.pem744 Ed25519.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed25519-key.pem745 Ed448.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed448-cert.pem746 Ed448.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed448-key.pem747 MaxProtocol = TLSv1.2748 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem749 750 [21-Ed25519 CipherString and Curves Selection-client]751 CipherString = aECDSA752 Curves = X25519753 MaxProtocol = TLSv1.2754 SignatureAlgorithms = ECDSA+SHA256:ed25519755 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem756 VerifyMode = Peer757 758 [test-21]759 ExpectedResult = Success760 ExpectedServerCertType = Ed25519761 ExpectedServerSignType = Ed25519762 763 764 # ===========================================================765 766 [22-Ed448 CipherString and Curves Selection]767 ssl_conf = 22-Ed448 CipherString and Curves Selection-ssl768 769 [22-Ed448 CipherString and Curves Selection-ssl]770 server = 22-Ed448 CipherString and Curves Selection-server771 client = 22-Ed448 CipherString and Curves Selection-client772 773 [22-Ed448 CipherString and Curves Selection-server]774 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem775 CipherString = DEFAULT776 ECDSA.Certificate = ${ENV::TEST_CERTS_DIR}/server-ecdsa-cert.pem777 ECDSA.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ecdsa-key.pem778 Ed25519.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed25519-cert.pem779 Ed25519.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed25519-key.pem780 Ed448.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed448-cert.pem781 Ed448.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed448-key.pem782 MaxProtocol = TLSv1.2783 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem784 785 [22-Ed448 CipherString and Curves Selection-client]786 CipherString = aECDSA787 Curves = X448788 MaxProtocol = TLSv1.2789 SignatureAlgorithms = ECDSA+SHA256:ed448790 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/root-ed448-cert.pem791 VerifyMode = Peer792 793 [test-22]794 ExpectedResult = Success795 ExpectedServerCertType = Ed448796 ExpectedServerSignType = Ed448797 797 798 798 -
trunk/src/libs/openssl-3.1.7/test/ssl-tests/20-cert-select.cnf.in
r105945 r105949 330 330 }, 331 331 { 332 name => "Ed25519 CipherString and Curves Selection", 333 server => $server, 334 client => { 335 "CipherString" => "aECDSA", 336 "MaxProtocol" => "TLSv1.2", 337 "SignatureAlgorithms" => "ECDSA+SHA256:ed25519", 338 # Excluding P-256 from the supported curves list means server 339 # certificate should be Ed25519 and not P-256 340 "Curves" => "X25519" 341 }, 342 test => { 343 "ExpectedServerCertType" =>, "Ed25519", 344 "ExpectedServerSignType" =>, "Ed25519", 345 "ExpectedResult" => "Success" 346 }, 347 }, 348 { 349 name => "Ed448 CipherString and Curves Selection", 350 server => $server, 351 client => { 352 "CipherString" => "aECDSA", 353 "MaxProtocol" => "TLSv1.2", 354 "SignatureAlgorithms" => "ECDSA+SHA256:ed448", 355 "VerifyCAFile" => test_pem("root-ed448-cert.pem"), 356 # Excluding P-256 from the supported curves list means server 357 # certificate should be Ed25519 and not P-256 358 "Curves" => "X448" 359 }, 360 test => { 361 "ExpectedServerCertType" =>, "Ed448", 362 "ExpectedServerSignType" =>, "Ed448", 363 "ExpectedResult" => "Success" 364 }, 365 }, 366 { 332 367 name => "TLS 1.2 Ed25519 Client Auth", 333 368 server => { … … 409 444 # Note: certificate_authorities not sent for TLS < 1.3 410 445 "ExpectedServerCANames" =>, "empty", 411 "ExpectedResult" => "Success"412 },413 },414 {415 name => "Ed25519 CipherString and Curves Selection",416 server => $server,417 client => {418 "CipherString" => "aECDSA",419 "MaxProtocol" => "TLSv1.2",420 "SignatureAlgorithms" => "ECDSA+SHA256:ed25519",421 # Excluding P-256 from the supported curves list means server422 # certificate should be Ed25519 and not P-256423 "Curves" => "X25519"424 },425 test => {426 "ExpectedServerCertType" =>, "Ed25519",427 "ExpectedServerSignType" =>, "Ed25519",428 "ExpectedResult" => "Success"429 },430 },431 {432 name => "Ed448 CipherString and Curves Selection",433 server => $server,434 client => {435 "CipherString" => "aECDSA",436 "MaxProtocol" => "TLSv1.2",437 "SignatureAlgorithms" => "ECDSA+SHA256:ed448",438 "VerifyCAFile" => test_pem("root-ed448-cert.pem"),439 # Excluding P-256 from the supported curves list means server440 # certificate should be Ed25519 and not P-256441 "Curves" => "X448"442 },443 test => {444 "ExpectedServerCertType" =>, "Ed448",445 "ExpectedServerSignType" =>, "Ed448",446 446 "ExpectedResult" => "Success" 447 447 }, -
trunk/src/libs/openssl-3.1.7/test/ssl-tests/28-seclevel.cnf.in
r105945 r105949 1 1 # -*- mode: perl; -*- 2 # Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 # Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 # 4 4 # Licensed under the Apache License 2.0 (the "License"). You may not use … … 57 57 "VerifyCAFile" => test_pem("root-ed448-cert.pem") }, 58 58 test => { "ExpectedResult" => "ServerFail" }, 59 } 60 ); 61 62 our @tests_ec_non_fips = ( 59 }, 63 60 { 64 61 name => "SECLEVEL 3 with P-384 key, X25519 ECDHE", … … 85 82 ); 86 83 87 push @tests_ec, @tests_ec_non_fips unless $fips_mode;88 84 push @tests, @tests_ec unless disabled("ec"); 89 85 push @tests, @tests_tls1_2 unless disabled("tls1_2") || disabled("ec"); -
trunk/src/libs/openssl-3.1.7/test/sslapitest.c
r105945 r105949 1 1 /* 2 * Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 2410 2410 } 2411 2411 2412 2412 2413 #ifndef OSSL_NO_USABLE_TLS1_3 2413 2414 static SSL_SESSION *sesscache[6]; … … 3497 3498 } 3498 3499 3499 static int check_early_data_timeout(time_t timer)3500 {3501 int res = 0;3502 3503 /*3504 * Early data is time sensitive. We have an approx 8 second allowance3505 * between writing the early data and reading it. If we exceed that time3506 * then this test will fail. This can sometimes (rarely) occur in normal CI3507 * operation. We can try and detect this and just ignore the result of this3508 * test if it has taken too long. We assume anything over 7 seconds is too3509 * long3510 */3511 timer = time(NULL) - timer;3512 if (timer >= 7)3513 res = TEST_skip("Test took too long, ignoring result");3514 3515 return res;3516 }3517 3518 3500 static int test_early_data_read_write(int idx) 3519 3501 { … … 3525 3507 size_t readbytes, written, eoedlen, rawread, rawwritten; 3526 3508 BIO *rbio; 3527 time_t timer;3528 3509 3529 3510 if (!TEST_true(setupearly_data_test(&cctx, &sctx, &clientssl, … … 3533 3514 3534 3515 /* Write and read some early data */ 3535 timer = time(NULL);3536 3516 if (!TEST_true(SSL_write_early_data(clientssl, MSG1, strlen(MSG1), 3537 3517 &written)) 3538 || !TEST_size_t_eq(written, strlen(MSG1))) 3539 goto end; 3540 3541 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), 3542 &readbytes), 3543 SSL_READ_EARLY_DATA_SUCCESS)) { 3544 testresult = check_early_data_timeout(timer); 3545 goto end; 3546 } 3547 3548 if (!TEST_mem_eq(MSG1, readbytes, buf, strlen(MSG1)) 3518 || !TEST_size_t_eq(written, strlen(MSG1)) 3519 || !TEST_int_eq(SSL_read_early_data(serverssl, buf, 3520 sizeof(buf), &readbytes), 3521 SSL_READ_EARLY_DATA_SUCCESS) 3522 || !TEST_mem_eq(MSG1, readbytes, buf, strlen(MSG1)) 3549 3523 || !TEST_int_eq(SSL_get_early_data_status(serverssl), 3550 3524 SSL_EARLY_DATA_ACCEPTED)) … … 3763 3737 size_t readbytes, written; 3764 3738 unsigned char buf[20]; 3765 time_t timer;3766 3739 3767 3740 allow_ed_cb_called = 0; … … 3818 3791 3819 3792 /* Write and read some early data */ 3820 timer = time(NULL);3821 3793 if (!TEST_true(SSL_write_early_data(clientssl, MSG1, strlen(MSG1), 3822 3794 &written)) … … 3839 3811 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), 3840 3812 &readbytes), 3841 SSL_READ_EARLY_DATA_SUCCESS)) { 3842 testresult = check_early_data_timeout(timer); 3843 goto end; 3844 } 3845 if (!TEST_mem_eq(MSG1, strlen(MSG1), buf, readbytes) 3813 SSL_READ_EARLY_DATA_SUCCESS) 3814 || !TEST_mem_eq(MSG1, strlen(MSG1), buf, readbytes) 3846 3815 /* 3847 3816 * Server will have sent its flight so client can now send … … 3946 3915 goto end; 3947 3916 #else 3948 if (!TEST_true(SSL_set1_groups_list(serverssl, "P- 384")))3917 if (!TEST_true(SSL_set1_groups_list(serverssl, "P-256"))) 3949 3918 goto end; 3950 3919 #endif … … 4360 4329 goto end; 4361 4330 } else { 4362 time_t timer = time(NULL);4363 4364 4331 if (!TEST_true(SSL_write_early_data(clientssl, MSG1, strlen(MSG1), 4365 4332 &written))) … … 4367 4334 4368 4335 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), 4369 &readbytes), readearlyres)) { 4370 testresult = check_early_data_timeout(timer); 4371 goto end; 4372 } 4373 4374 if ((readearlyres == SSL_READ_EARLY_DATA_SUCCESS 4336 &readbytes), readearlyres) 4337 || (readearlyres == SSL_READ_EARLY_DATA_SUCCESS 4375 4338 && !TEST_mem_eq(buf, readbytes, MSG1, strlen(MSG1))) 4376 4339 || !TEST_int_eq(SSL_get_early_data_status(serverssl), edstatus) … … 4410 4373 size_t readbytes, written; 4411 4374 const SSL_CIPHER *cipher; 4412 time_t timer;4413 4375 const char *cipher_str[] = { 4414 4376 TLS1_3_RFC_AES_128_GCM_SHA256, … … 4462 4424 4463 4425 SSL_set_connect_state(clientssl); 4464 timer = time(NULL);4465 4426 if (!TEST_true(SSL_write_early_data(clientssl, MSG1, strlen(MSG1), 4466 4427 &written))) … … 4469 4430 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), 4470 4431 &readbytes), 4471 SSL_READ_EARLY_DATA_SUCCESS)) { 4472 testresult = check_early_data_timeout(timer); 4473 goto end; 4474 } 4475 4476 if (!TEST_mem_eq(buf, readbytes, MSG1, strlen(MSG1)) 4432 SSL_READ_EARLY_DATA_SUCCESS) 4433 || !TEST_mem_eq(buf, readbytes, MSG1, strlen(MSG1)) 4477 4434 || !TEST_int_eq(SSL_get_early_data_status(serverssl), 4478 4435 SSL_EARLY_DATA_ACCEPTED) … … 4915 4872 break; 4916 4873 case 4: 4917 if (is_fips)4918 return TEST_skip("X25519 might not be supported by fips provider.");4919 4874 kexch_alg = NID_X25519; 4920 4875 kexch_name0 = "x25519"; 4921 4876 break; 4922 4877 case 5: 4923 if (is_fips)4924 return TEST_skip("X448 might not be supported by fips provider.");4925 4878 kexch_alg = NID_X448; 4926 4879 kexch_name0 = "x448"; … … 5137 5090 expectednid = kexch_alg; 5138 5091 5139 if (is_fips && (kexch_alg == NID_X25519 || kexch_alg == NID_X448))5140 return TEST_skip("X25519 and X448 might not be available in fips provider.");5141 5142 5092 if (!istls13) 5143 5093 max_version = TLS1_2_VERSION; … … 5561 5511 goto end; 5562 5512 #else 5563 if (!TEST_true(SSL_set1_groups_list(serverssl, "P- 384")))5513 if (!TEST_true(SSL_set1_groups_list(serverssl, "P-256"))) 5564 5514 goto end; 5565 5515 #endif … … 7525 7475 size_t written, readbytes; 7526 7476 unsigned char buf[80]; 7527 time_t timer;7528 7477 7529 7478 /* early_data tests */ … … 7540 7489 7541 7490 /* Write and read some early data and then complete the connection */ 7542 timer = time(NULL);7543 7491 if (!TEST_true(SSL_write_early_data(clientssl, MSG1, strlen(MSG1), 7544 7492 &written)) 7545 || !TEST_size_t_eq(written, strlen(MSG1))) 7546 goto end; 7547 7548 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, 7549 sizeof(buf), &readbytes), 7550 SSL_READ_EARLY_DATA_SUCCESS)) { 7551 testresult = check_early_data_timeout(timer); 7552 goto end; 7553 } 7554 7555 if (!TEST_mem_eq(MSG1, readbytes, buf, strlen(MSG1)) 7493 || !TEST_size_t_eq(written, strlen(MSG1)) 7494 || !TEST_int_eq(SSL_read_early_data(serverssl, buf, 7495 sizeof(buf), &readbytes), 7496 SSL_READ_EARLY_DATA_SUCCESS) 7497 || !TEST_mem_eq(MSG1, readbytes, buf, strlen(MSG1)) 7556 7498 || !TEST_int_eq(SSL_get_early_data_status(serverssl), 7557 7499 SSL_EARLY_DATA_ACCEPTED) … … 9021 8963 9022 8964 /* 9023 * Test that a session cache overflow works as expected9024 * Test 0: TLSv1.3, timeout on new session later than old session9025 * Test 1: TLSv1.2, timeout on new session later than old session9026 * Test 2: TLSv1.3, timeout on new session earlier than old session9027 * Test 3: TLSv1.2, timeout on new session earlier than old session9028 */9029 #if !defined(OSSL_NO_USABLE_TLS1_3) || !defined(OPENSSL_NO_TLS1_2)9030 static int test_session_cache_overflow(int idx)9031 {9032 SSL_CTX *sctx = NULL, *cctx = NULL;9033 SSL *serverssl = NULL, *clientssl = NULL;9034 int testresult = 0;9035 SSL_SESSION *sess = NULL;9036 9037 #ifdef OSSL_NO_USABLE_TLS1_39038 /* If no TLSv1.3 available then do nothing in this case */9039 if (idx % 2 == 0)9040 return TEST_skip("No TLSv1.3 available");9041 #endif9042 #ifdef OPENSSL_NO_TLS1_29043 /* If no TLSv1.2 available then do nothing in this case */9044 if (idx % 2 == 1)9045 return TEST_skip("No TLSv1.2 available");9046 #endif9047 9048 if (!TEST_true(create_ssl_ctx_pair(libctx, TLS_server_method(),9049 TLS_client_method(), TLS1_VERSION,9050 (idx % 2 == 0) ? TLS1_3_VERSION9051 : TLS1_2_VERSION,9052 &sctx, &cctx, cert, privkey))9053 || !TEST_true(SSL_CTX_set_options(sctx, SSL_OP_NO_TICKET)))9054 goto end;9055 9056 SSL_CTX_sess_set_get_cb(sctx, get_session_cb);9057 get_sess_val = NULL;9058 9059 SSL_CTX_sess_set_cache_size(sctx, 1);9060 9061 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl,9062 NULL, NULL)))9063 goto end;9064 9065 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)))9066 goto end;9067 9068 if (idx > 1) {9069 sess = SSL_get_session(serverssl);9070 if (!TEST_ptr(sess))9071 goto end;9072 9073 /*9074 * Cause this session to have a longer timeout than the next session to9075 * be added.9076 */9077 if (!TEST_true(SSL_SESSION_set_timeout(sess, LONG_MAX / 2))) {9078 sess = NULL;9079 goto end;9080 }9081 sess = NULL;9082 }9083 9084 SSL_shutdown(serverssl);9085 SSL_shutdown(clientssl);9086 SSL_free(serverssl);9087 SSL_free(clientssl);9088 serverssl = clientssl = NULL;9089 9090 /*9091 * Session cache size is 1 and we already populated the cache with a session9092 * so the next connection should cause an overflow.9093 */9094 9095 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl,9096 NULL, NULL)))9097 goto end;9098 9099 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)))9100 goto end;9101 9102 /*9103 * The session we just negotiated may have been already removed from the9104 * internal cache - but we will return it anyway from our external cache.9105 */9106 get_sess_val = SSL_get_session(serverssl);9107 if (!TEST_ptr(get_sess_val))9108 goto end;9109 sess = SSL_get1_session(clientssl);9110 if (!TEST_ptr(sess))9111 goto end;9112 9113 SSL_shutdown(serverssl);9114 SSL_shutdown(clientssl);9115 SSL_free(serverssl);9116 SSL_free(clientssl);9117 serverssl = clientssl = NULL;9118 9119 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl,9120 NULL, NULL)))9121 goto end;9122 9123 if (!TEST_true(SSL_set_session(clientssl, sess)))9124 goto end;9125 9126 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)))9127 goto end;9128 9129 testresult = 1;9130 9131 end:9132 SSL_free(serverssl);9133 SSL_free(clientssl);9134 SSL_CTX_free(sctx);9135 SSL_CTX_free(cctx);9136 SSL_SESSION_free(sess);9137 9138 return testresult;9139 }9140 #endif /* !defined(OSSL_NO_USABLE_TLS1_3) || !defined(OPENSSL_NO_TLS1_2) */9141 9142 /*9143 8965 * Test 0: Client sets servername and server acknowledges it (TLSv1.2) 9144 8966 * Test 1: Client sets servername and server does not acknowledge it (TLSv1.2) … … 9455 9277 /* Check that we are not impacted by a provider without any groups */ 9456 9278 OSSL_PROVIDER *legacyprov = OSSL_PROVIDER_load(libctx, "legacy"); 9457 const char *group_name = idx == 0 ? "xor kemgroup" : "xorgroup";9279 const char *group_name = idx == 0 ? "xorgroup" : "xorkemgroup"; 9458 9280 9459 9281 if (!TEST_ptr(tlsprov)) 9460 9282 goto end; 9283 9284 if (legacyprov == NULL) { 9285 /* 9286 * In this case we assume we've been built with "no-legacy" and skip 9287 * this test (there is no OPENSSL_NO_LEGACY) 9288 */ 9289 testresult = 1; 9290 goto end; 9291 } 9461 9292 9462 9293 if (!TEST_true(create_ssl_ctx_pair(libctx, TLS_server_method(), … … 9469 9300 goto end; 9470 9301 9471 /* ensure GROUPLIST_INCREMENT (=40) logic triggers: */ 9472 if (!TEST_true(SSL_set1_groups_list(serverssl, "xorgroup:xorkemgroup:dummy1:dummy2:dummy3:dummy4:dummy5:dummy6:dummy7:dummy8:dummy9:dummy10:dummy11:dummy12:dummy13:dummy14:dummy15:dummy16:dummy17:dummy18:dummy19:dummy20:dummy21:dummy22:dummy23:dummy24:dummy25:dummy26:dummy27:dummy28:dummy29:dummy30:dummy31:dummy32:dummy33:dummy34:dummy35:dummy36:dummy37:dummy38:dummy39:dummy40:dummy41:dummy42:dummy43")) 9473 /* removing a single algorithm from the list makes the test pass */ 9302 if (!TEST_true(SSL_set1_groups_list(serverssl, group_name)) 9474 9303 || !TEST_true(SSL_set1_groups_list(clientssl, group_name))) 9475 9304 goto end; … … 10494 10323 10495 10324 #if !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_DYNAMIC_ENGINE) 10325 10326 static ENGINE *load_dasync(void) 10327 { 10328 ENGINE *e; 10329 10330 if (!TEST_ptr(e = ENGINE_by_id("dasync"))) 10331 return NULL; 10332 10333 if (!TEST_true(ENGINE_init(e))) { 10334 ENGINE_free(e); 10335 return NULL; 10336 } 10337 10338 if (!TEST_true(ENGINE_register_ciphers(e))) { 10339 ENGINE_free(e); 10340 return NULL; 10341 } 10342 10343 return e; 10344 } 10345 10496 10346 /* 10497 10347 * Test TLSv1.2 with a pipeline capable cipher. TLSv1.3 and DTLS do not … … 10785 10635 BIO_free(tmp); 10786 10636 set_always_retry_err_val(-1); 10787 return testresult;10788 }10789 10790 struct resume_servername_cb_data {10791 int i;10792 SSL_CTX *cctx;10793 SSL_CTX *sctx;10794 SSL_SESSION *sess;10795 int recurse;10796 };10797 10798 /*10799 * Servername callback. We use it here to run another complete handshake using10800 * the same session - and mark the session as not_resuamble at the end10801 */10802 static int resume_servername_cb(SSL *s, int *ad, void *arg)10803 {10804 struct resume_servername_cb_data *cbdata = arg;10805 SSL *serverssl = NULL, *clientssl = NULL;10806 int ret = SSL_TLSEXT_ERR_ALERT_FATAL;10807 10808 if (cbdata->recurse)10809 return SSL_TLSEXT_ERR_ALERT_FATAL;10810 10811 if ((cbdata->i % 3) != 1)10812 return SSL_TLSEXT_ERR_OK;10813 10814 cbdata->recurse = 1;10815 10816 if (!TEST_true(create_ssl_objects(cbdata->sctx, cbdata->cctx, &serverssl,10817 &clientssl, NULL, NULL))10818 || !TEST_true(SSL_set_session(clientssl, cbdata->sess)))10819 goto end;10820 10821 ERR_set_mark();10822 /*10823 * We expect this to fail - because the servername cb will fail. This will10824 * mark the session as not_resumable.10825 */10826 if (!TEST_false(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) {10827 ERR_clear_last_mark();10828 goto end;10829 }10830 ERR_pop_to_mark();10831 10832 ret = SSL_TLSEXT_ERR_OK;10833 end:10834 SSL_free(serverssl);10835 SSL_free(clientssl);10836 cbdata->recurse = 0;10837 return ret;10838 }10839 10840 /*10841 * Test multiple resumptions and cache size handling10842 * Test 0: TLSv1.3 (max_early_data set)10843 * Test 1: TLSv1.3 (SSL_OP_NO_TICKET set)10844 * Test 2: TLSv1.3 (max_early_data and SSL_OP_NO_TICKET set)10845 * Test 3: TLSv1.3 (SSL_OP_NO_TICKET, simultaneous resumes)10846 * Test 4: TLSv1.210847 */10848 static int test_multi_resume(int idx)10849 {10850 SSL_CTX *sctx = NULL, *cctx = NULL;10851 SSL *serverssl = NULL, *clientssl = NULL;10852 SSL_SESSION *sess = NULL;10853 int max_version = TLS1_3_VERSION;10854 int i, testresult = 0;10855 struct resume_servername_cb_data cbdata;10856 10857 #if defined(OPENSSL_NO_TLS1_2)10858 if (idx == 4)10859 return TEST_skip("TLSv1.2 is disabled in this build");10860 #else10861 if (idx == 4)10862 max_version = TLS1_2_VERSION;10863 #endif10864 #if defined(OSSL_NO_USABLE_TLS1_3)10865 if (idx != 4)10866 return TEST_skip("No usable TLSv1.3 in this build");10867 #endif10868 10869 if (!TEST_true(create_ssl_ctx_pair(libctx, TLS_server_method(),10870 TLS_client_method(), TLS1_VERSION,10871 max_version, &sctx, &cctx, cert,10872 privkey)))10873 goto end;10874 10875 /*10876 * TLSv1.3 only uses a session cache if either max_early_data > 0 (used for10877 * replay protection), or if SSL_OP_NO_TICKET is in use10878 */10879 if (idx == 0 || idx == 2) {10880 if (!TEST_true(SSL_CTX_set_max_early_data(sctx, 1024)))10881 goto end;10882 }10883 if (idx == 1 || idx == 2 || idx == 3)10884 SSL_CTX_set_options(sctx, SSL_OP_NO_TICKET);10885 10886 SSL_CTX_sess_set_cache_size(sctx, 5);10887 10888 if (idx == 3) {10889 SSL_CTX_set_tlsext_servername_callback(sctx, resume_servername_cb);10890 SSL_CTX_set_tlsext_servername_arg(sctx, &cbdata);10891 cbdata.cctx = cctx;10892 cbdata.sctx = sctx;10893 cbdata.recurse = 0;10894 }10895 10896 for (i = 0; i < 30; i++) {10897 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl,10898 NULL, NULL))10899 || !TEST_true(SSL_set_session(clientssl, sess)))10900 goto end;10901 10902 /*10903 * Check simultaneous resumes. We pause the connection part way through10904 * the handshake by (mis)using the servername_cb. The pause occurs after10905 * session resumption has already occurred, but before any session10906 * tickets have been issued. While paused we run another complete10907 * handshake resuming the same session.10908 */10909 if (idx == 3) {10910 cbdata.i = i;10911 cbdata.sess = sess;10912 }10913 10914 /*10915 * Recreate a bug where dynamically changing the max_early_data value10916 * can cause sessions in the session cache which cannot be deleted.10917 */10918 if ((idx == 0 || idx == 2) && (i % 3) == 2)10919 SSL_set_max_early_data(serverssl, 0);10920 10921 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)))10922 goto end;10923 10924 if (sess == NULL || (idx == 0 && (i % 3) == 2)) {10925 if (!TEST_false(SSL_session_reused(clientssl)))10926 goto end;10927 } else {10928 if (!TEST_true(SSL_session_reused(clientssl)))10929 goto end;10930 }10931 SSL_SESSION_free(sess);10932 10933 /* Do a full handshake, followed by two resumptions */10934 if ((i % 3) == 2) {10935 sess = NULL;10936 } else {10937 if (!TEST_ptr((sess = SSL_get1_session(clientssl))))10938 goto end;10939 }10940 10941 SSL_shutdown(clientssl);10942 SSL_shutdown(serverssl);10943 SSL_free(serverssl);10944 SSL_free(clientssl);10945 serverssl = clientssl = NULL;10946 }10947 10948 /* We should never exceed the session cache size limit */10949 if (!TEST_long_le(SSL_CTX_sess_number(sctx), 5))10950 goto end;10951 10952 testresult = 1;10953 end:10954 SSL_free(serverssl);10955 SSL_free(clientssl);10956 SSL_CTX_free(sctx);10957 SSL_CTX_free(cctx);10958 SSL_SESSION_free(sess);10959 return testresult;10960 }10961 10962 static struct next_proto_st {10963 int serverlen;10964 unsigned char server[40];10965 int clientlen;10966 unsigned char client[40];10967 int expected_ret;10968 size_t selectedlen;10969 unsigned char selected[40];10970 } next_proto_tests[] = {10971 {10972 4, { 3, 'a', 'b', 'c' },10973 4, { 3, 'a', 'b', 'c' },10974 OPENSSL_NPN_NEGOTIATED,10975 3, { 'a', 'b', 'c' }10976 },10977 {10978 7, { 3, 'a', 'b', 'c', 2, 'a', 'b' },10979 4, { 3, 'a', 'b', 'c' },10980 OPENSSL_NPN_NEGOTIATED,10981 3, { 'a', 'b', 'c' }10982 },10983 {10984 7, { 2, 'a', 'b', 3, 'a', 'b', 'c', },10985 4, { 3, 'a', 'b', 'c' },10986 OPENSSL_NPN_NEGOTIATED,10987 3, { 'a', 'b', 'c' }10988 },10989 {10990 4, { 3, 'a', 'b', 'c' },10991 7, { 3, 'a', 'b', 'c', 2, 'a', 'b', },10992 OPENSSL_NPN_NEGOTIATED,10993 3, { 'a', 'b', 'c' }10994 },10995 {10996 4, { 3, 'a', 'b', 'c' },10997 7, { 2, 'a', 'b', 3, 'a', 'b', 'c'},10998 OPENSSL_NPN_NEGOTIATED,10999 3, { 'a', 'b', 'c' }11000 },11001 {11002 7, { 2, 'b', 'c', 3, 'a', 'b', 'c' },11003 7, { 2, 'a', 'b', 3, 'a', 'b', 'c'},11004 OPENSSL_NPN_NEGOTIATED,11005 3, { 'a', 'b', 'c' }11006 },11007 {11008 10, { 2, 'b', 'c', 3, 'a', 'b', 'c', 2, 'a', 'b' },11009 7, { 2, 'a', 'b', 3, 'a', 'b', 'c'},11010 OPENSSL_NPN_NEGOTIATED,11011 3, { 'a', 'b', 'c' }11012 },11013 {11014 4, { 3, 'b', 'c', 'd' },11015 4, { 3, 'a', 'b', 'c' },11016 OPENSSL_NPN_NO_OVERLAP,11017 3, { 'a', 'b', 'c' }11018 },11019 {11020 0, { 0 },11021 4, { 3, 'a', 'b', 'c' },11022 OPENSSL_NPN_NO_OVERLAP,11023 3, { 'a', 'b', 'c' }11024 },11025 {11026 -1, { 0 },11027 4, { 3, 'a', 'b', 'c' },11028 OPENSSL_NPN_NO_OVERLAP,11029 3, { 'a', 'b', 'c' }11030 },11031 {11032 4, { 3, 'a', 'b', 'c' },11033 0, { 0 },11034 OPENSSL_NPN_NO_OVERLAP,11035 0, { 0 }11036 },11037 {11038 4, { 3, 'a', 'b', 'c' },11039 -1, { 0 },11040 OPENSSL_NPN_NO_OVERLAP,11041 0, { 0 }11042 },11043 {11044 3, { 3, 'a', 'b', 'c' },11045 4, { 3, 'a', 'b', 'c' },11046 OPENSSL_NPN_NO_OVERLAP,11047 3, { 'a', 'b', 'c' }11048 },11049 {11050 4, { 3, 'a', 'b', 'c' },11051 3, { 3, 'a', 'b', 'c' },11052 OPENSSL_NPN_NO_OVERLAP,11053 0, { 0 }11054 }11055 };11056 11057 static int test_select_next_proto(int idx)11058 {11059 struct next_proto_st *np = &next_proto_tests[idx];11060 int ret = 0;11061 unsigned char *out, *client, *server;11062 unsigned char outlen;11063 unsigned int clientlen, serverlen;11064 11065 if (np->clientlen == -1) {11066 client = NULL;11067 clientlen = 0;11068 } else {11069 client = np->client;11070 clientlen = (unsigned int)np->clientlen;11071 }11072 if (np->serverlen == -1) {11073 server = NULL;11074 serverlen = 0;11075 } else {11076 server = np->server;11077 serverlen = (unsigned int)np->serverlen;11078 }11079 11080 if (!TEST_int_eq(SSL_select_next_proto(&out, &outlen, server, serverlen,11081 client, clientlen),11082 np->expected_ret))11083 goto err;11084 11085 if (np->selectedlen == 0) {11086 if (!TEST_ptr_null(out) || !TEST_uchar_eq(outlen, 0))11087 goto err;11088 } else {11089 if (!TEST_mem_eq(out, outlen, np->selected, np->selectedlen))11090 goto err;11091 }11092 11093 ret = 1;11094 err:11095 return ret;11096 }11097 11098 static const unsigned char fooprot[] = {3, 'f', 'o', 'o' };11099 static const unsigned char barprot[] = {3, 'b', 'a', 'r' };11100 11101 #if !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_NEXTPROTONEG)11102 static int npn_advert_cb(SSL *ssl, const unsigned char **out,11103 unsigned int *outlen, void *arg)11104 {11105 int *idx = (int *)arg;11106 11107 switch (*idx) {11108 default:11109 case 0:11110 *out = fooprot;11111 *outlen = sizeof(fooprot);11112 return SSL_TLSEXT_ERR_OK;11113 11114 case 1:11115 *outlen = 0;11116 return SSL_TLSEXT_ERR_OK;11117 11118 case 2:11119 return SSL_TLSEXT_ERR_NOACK;11120 }11121 }11122 11123 static int npn_select_cb(SSL *s, unsigned char **out, unsigned char *outlen,11124 const unsigned char *in, unsigned int inlen, void *arg)11125 {11126 int *idx = (int *)arg;11127 11128 switch (*idx) {11129 case 0:11130 case 1:11131 *out = (unsigned char *)(fooprot + 1);11132 *outlen = *fooprot;11133 return SSL_TLSEXT_ERR_OK;11134 11135 case 3:11136 *out = (unsigned char *)(barprot + 1);11137 *outlen = *barprot;11138 return SSL_TLSEXT_ERR_OK;11139 11140 case 4:11141 *outlen = 0;11142 return SSL_TLSEXT_ERR_OK;11143 11144 default:11145 case 2:11146 return SSL_TLSEXT_ERR_ALERT_FATAL;11147 }11148 }11149 11150 /*11151 * Test the NPN callbacks11152 * Test 0: advert = foo, select = foo11153 * Test 1: advert = <empty>, select = foo11154 * Test 2: no advert11155 * Test 3: advert = foo, select = bar11156 * Test 4: advert = foo, select = <empty> (should fail)11157 */11158 static int test_npn(int idx)11159 {11160 SSL_CTX *sctx = NULL, *cctx = NULL;11161 SSL *serverssl = NULL, *clientssl = NULL;11162 int testresult = 0;11163 11164 if (!TEST_true(create_ssl_ctx_pair(libctx, TLS_server_method(),11165 TLS_client_method(), 0, TLS1_2_VERSION,11166 &sctx, &cctx, cert, privkey)))11167 goto end;11168 11169 SSL_CTX_set_next_protos_advertised_cb(sctx, npn_advert_cb, &idx);11170 SSL_CTX_set_next_proto_select_cb(cctx, npn_select_cb, &idx);11171 11172 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,11173 NULL)))11174 goto end;11175 11176 if (idx == 4) {11177 /* We don't allow empty selection of NPN, so this should fail */11178 if (!TEST_false(create_ssl_connection(serverssl, clientssl,11179 SSL_ERROR_NONE)))11180 goto end;11181 } else {11182 const unsigned char *prot;11183 unsigned int protlen;11184 11185 if (!TEST_true(create_ssl_connection(serverssl, clientssl,11186 SSL_ERROR_NONE)))11187 goto end;11188 11189 SSL_get0_next_proto_negotiated(serverssl, &prot, &protlen);11190 switch (idx) {11191 case 0:11192 case 1:11193 if (!TEST_mem_eq(prot, protlen, fooprot + 1, *fooprot))11194 goto end;11195 break;11196 case 2:11197 if (!TEST_uint_eq(protlen, 0))11198 goto end;11199 break;11200 case 3:11201 if (!TEST_mem_eq(prot, protlen, barprot + 1, *barprot))11202 goto end;11203 break;11204 default:11205 TEST_error("Should not get here");11206 goto end;11207 }11208 }11209 11210 testresult = 1;11211 end:11212 SSL_free(serverssl);11213 SSL_free(clientssl);11214 SSL_CTX_free(sctx);11215 SSL_CTX_free(cctx);11216 11217 return testresult;11218 }11219 #endif /* !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_NEXTPROTONEG) */11220 11221 static int alpn_select_cb2(SSL *ssl, const unsigned char **out,11222 unsigned char *outlen, const unsigned char *in,11223 unsigned int inlen, void *arg)11224 {11225 int *idx = (int *)arg;11226 11227 switch (*idx) {11228 case 0:11229 *out = (unsigned char *)(fooprot + 1);11230 *outlen = *fooprot;11231 return SSL_TLSEXT_ERR_OK;11232 11233 case 2:11234 *out = (unsigned char *)(barprot + 1);11235 *outlen = *barprot;11236 return SSL_TLSEXT_ERR_OK;11237 11238 case 3:11239 *outlen = 0;11240 return SSL_TLSEXT_ERR_OK;11241 11242 default:11243 case 1:11244 return SSL_TLSEXT_ERR_ALERT_FATAL;11245 }11246 return 0;11247 }11248 11249 /*11250 * Test the ALPN callbacks11251 * Test 0: client = foo, select = foo11252 * Test 1: client = <empty>, select = none11253 * Test 2: client = foo, select = bar (should fail)11254 * Test 3: client = foo, select = <empty> (should fail)11255 */11256 static int test_alpn(int idx)11257 {11258 SSL_CTX *sctx = NULL, *cctx = NULL;11259 SSL *serverssl = NULL, *clientssl = NULL;11260 int testresult = 0;11261 const unsigned char *prots = fooprot;11262 unsigned int protslen = sizeof(fooprot);11263 11264 if (!TEST_true(create_ssl_ctx_pair(libctx, TLS_server_method(),11265 TLS_client_method(), 0, 0,11266 &sctx, &cctx, cert, privkey)))11267 goto end;11268 11269 SSL_CTX_set_alpn_select_cb(sctx, alpn_select_cb2, &idx);11270 11271 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,11272 NULL)))11273 goto end;11274 11275 if (idx == 1) {11276 prots = NULL;11277 protslen = 0;11278 }11279 11280 /* SSL_set_alpn_protos returns 0 for success! */11281 if (!TEST_false(SSL_set_alpn_protos(clientssl, prots, protslen)))11282 goto end;11283 11284 if (idx == 2 || idx == 3) {11285 /* We don't allow empty selection of NPN, so this should fail */11286 if (!TEST_false(create_ssl_connection(serverssl, clientssl,11287 SSL_ERROR_NONE)))11288 goto end;11289 } else {11290 const unsigned char *prot;11291 unsigned int protlen;11292 11293 if (!TEST_true(create_ssl_connection(serverssl, clientssl,11294 SSL_ERROR_NONE)))11295 goto end;11296 11297 SSL_get0_alpn_selected(clientssl, &prot, &protlen);11298 switch (idx) {11299 case 0:11300 if (!TEST_mem_eq(prot, protlen, fooprot + 1, *fooprot))11301 goto end;11302 break;11303 case 1:11304 if (!TEST_uint_eq(protlen, 0))11305 goto end;11306 break;11307 default:11308 TEST_error("Should not get here");11309 goto end;11310 }11311 }11312 11313 testresult = 1;11314 end:11315 SSL_free(serverssl);11316 SSL_free(clientssl);11317 SSL_CTX_free(sctx);11318 SSL_CTX_free(cctx);11319 11320 10637 return testresult; 11321 10638 } … … 11606 10923 ADD_TEST(test_set_verify_cert_store_ssl); 11607 10924 ADD_ALL_TESTS(test_session_timeout, 1); 11608 #if !defined(OSSL_NO_USABLE_TLS1_3) || !defined(OPENSSL_NO_TLS1_2)11609 ADD_ALL_TESTS(test_session_cache_overflow, 4);11610 #endif11611 10925 ADD_TEST(test_load_dhfile); 11612 10926 #ifndef OSSL_NO_USABLE_TLS1_3 … … 11621 10935 #endif 11622 10936 ADD_ALL_TESTS(test_handshake_retry, 16); 11623 ADD_ALL_TESTS(test_multi_resume, 5);11624 ADD_ALL_TESTS(test_select_next_proto, OSSL_NELEM(next_proto_tests));11625 #if !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_NEXTPROTONEG)11626 ADD_ALL_TESTS(test_npn, 5);11627 #endif11628 ADD_ALL_TESTS(test_alpn, 4);11629 10937 return 1; 11630 10938 -
trunk/src/libs/openssl-3.1.7/test/sslbuffertest.c
r105945 r105949 1 1 /* 2 * Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"); … … 9 9 */ 10 10 11 /*12 * We need access to the deprecated low level Engine APIs for legacy purposes13 * when the deprecated calls are not hidden14 */15 #ifndef OPENSSL_NO_DEPRECATED_3_016 # define OPENSSL_SUPPRESS_DEPRECATED17 #endif18 19 11 #include <string.h> 20 12 #include <openssl/ssl.h> 21 13 #include <openssl/bio.h> 22 14 #include <openssl/err.h> 23 #include <openssl/engine.h>24 15 25 16 #include "internal/packet.h" … … 160 151 } 161 152 162 /*163 * Test that attempting to free the buffers at points where they cannot be freed164 * works as expected165 * Test 0: Attempt to free buffers after a full record has been processed, but166 * the application has only performed a partial read167 * Test 1: Attempt to free buffers after only a partial record header has been168 * received169 * Test 2: Attempt to free buffers after a full record header but no record body170 * Test 3: Attempt to free buffers after a full record hedaer and partial record171 * body172 * Test 4-7: We repeat tests 0-3 but including data from a second pipelined173 * record174 */175 static int test_free_buffers(int test)176 {177 int result = 0;178 SSL *serverssl = NULL, *clientssl = NULL;179 const char testdata[] = "Test data";180 char buf[120];181 size_t written, readbytes;182 int i, pipeline = test > 3;183 ENGINE *e = NULL;184 185 if (pipeline) {186 e = load_dasync();187 if (e == NULL)188 goto end;189 test -= 4;190 }191 192 if (!TEST_true(create_ssl_objects(serverctx, clientctx, &serverssl,193 &clientssl, NULL, NULL)))194 goto end;195 196 if (pipeline) {197 if (!TEST_true(SSL_set_cipher_list(serverssl, "AES128-SHA"))198 || !TEST_true(SSL_set_max_proto_version(serverssl,199 TLS1_2_VERSION))200 || !TEST_true(SSL_set_max_pipelines(serverssl, 2)))201 goto end;202 }203 204 if (!TEST_true(create_ssl_connection(serverssl, clientssl,205 SSL_ERROR_NONE)))206 goto end;207 208 /*209 * For the non-pipeline case we write one record. For pipelining we write210 * two records.211 */212 for (i = 0; i <= pipeline; i++) {213 if (!TEST_true(SSL_write_ex(clientssl, testdata, strlen(testdata),214 &written)))215 goto end;216 }217 218 if (test == 0) {219 size_t readlen = 1;220 221 /*222 * Deliberately only read the first byte - so the remaining bytes are223 * still buffered. In the pipelining case we read as far as the first224 * byte from the second record.225 */226 if (pipeline)227 readlen += strlen(testdata);228 229 if (!TEST_true(SSL_read_ex(serverssl, buf, readlen, &readbytes))230 || !TEST_size_t_eq(readlen, readbytes))231 goto end;232 } else {233 BIO *tmp;234 size_t partial_len;235 236 /* Remove all the data that is pending for read by the server */237 tmp = SSL_get_rbio(serverssl);238 if (!TEST_true(BIO_read_ex(tmp, buf, sizeof(buf), &readbytes))239 || !TEST_size_t_lt(readbytes, sizeof(buf))240 || !TEST_size_t_gt(readbytes, SSL3_RT_HEADER_LENGTH))241 goto end;242 243 switch(test) {244 case 1:245 partial_len = SSL3_RT_HEADER_LENGTH - 1;246 break;247 case 2:248 partial_len = SSL3_RT_HEADER_LENGTH;249 break;250 case 3:251 partial_len = readbytes - 1;252 break;253 default:254 TEST_error("Invalid test index");255 goto end;256 }257 258 if (pipeline) {259 /* We happen to know the first record is 57 bytes long */260 const size_t first_rec_len = 57;261 262 if (test != 3)263 partial_len += first_rec_len;264 265 /*266 * Sanity check. If we got the record len right then this should267 * never fail.268 */269 if (!TEST_int_eq(buf[first_rec_len], SSL3_RT_APPLICATION_DATA))270 goto end;271 }272 273 /*274 * Put back just the partial record (plus the whole initial record in275 * the pipelining case)276 */277 if (!TEST_true(BIO_write_ex(tmp, buf, partial_len, &written)))278 goto end;279 280 if (pipeline) {281 /*282 * Attempt a read. This should pass but only return data from the283 * first record. Only a partial record is available for the second284 * record.285 */286 if (!TEST_true(SSL_read_ex(serverssl, buf, sizeof(buf),287 &readbytes))288 || !TEST_size_t_eq(readbytes, strlen(testdata)))289 goto end;290 } else {291 /*292 * Attempt a read. This should fail because only a partial record is293 * available.294 */295 if (!TEST_false(SSL_read_ex(serverssl, buf, sizeof(buf),296 &readbytes)))297 goto end;298 }299 }300 301 /*302 * Attempting to free the buffers at this point should fail because they are303 * still in use304 */305 if (!TEST_false(SSL_free_buffers(serverssl)))306 goto end;307 308 result = 1;309 end:310 SSL_free(clientssl);311 SSL_free(serverssl);312 #ifndef OPENSSL_NO_DYNAMIC_ENGINE313 if (e != NULL) {314 ENGINE_unregister_ciphers(e);315 ENGINE_finish(e);316 ENGINE_free(e);317 }318 #endif319 return result;320 }321 322 153 OPT_TEST_DECLARE_USAGE("certfile privkeyfile\n") 323 154 … … 343 174 344 175 ADD_ALL_TESTS(test_func, 9); 345 #if !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_DYNAMIC_ENGINE)346 ADD_ALL_TESTS(test_free_buffers, 8);347 #else348 ADD_ALL_TESTS(test_free_buffers, 4);349 #endif350 176 return 1; 351 177 } -
trunk/src/libs/openssl-3.1.7/test/test.cnf
r105945 r105949 73 73 emailAddress = email field 74 74 emailAddress_value = [email protected] 75 76 [ dirname_sec ]77 C = UK78 O = My Organization79 OU = My Unit80 CN = My Name -
trunk/src/libs/openssl-3.1.7/test/tls-provider.c
r105945 r105949 1 1 /* 2 * Copyright 2019-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 186 186 187 187 /* Register our 2 groups */ 188 OPENSSL_assert(xor_group.group_id >= 65024189 && xor_group.group_id < 65279 - NUM_DUMMY_GROUPS);190 188 ret = cb(xor_group_params, arg); 191 189 ret &= cb(xor_kemgroup_params, arg); … … 199 197 for (i = 0; i < NUM_DUMMY_GROUPS; i++) { 200 198 OSSL_PARAM dummygroup[OSSL_NELEM(xor_group_params)]; 201 unsigned int dummygroup_id;202 199 203 200 memcpy(dummygroup, xor_group_params, sizeof(xor_group_params)); … … 214 211 dummygroup[0].data = dummy_group_names[i]; 215 212 dummygroup[0].data_size = strlen(dummy_group_names[i]) + 1; 216 /* assign unique group IDs also to dummy groups for registration */217 dummygroup_id = 65279 - NUM_DUMMY_GROUPS + i;218 dummygroup[3].data = (unsigned char*)&dummygroup_id;219 213 ret &= cb(dummygroup, arg); 220 214 } … … 824 818 /* 825 819 * Ensure group_id is within the IANA Reserved for private use range 826 * (65024-65279). 827 * Carve out NUM_DUMMY_GROUPS ids for properly registering those. 820 * (65024-65279) 828 821 */ 829 group_id %= 65279 - NUM_DUMMY_GROUPS -65024;822 group_id %= 65279 - 65024; 830 823 group_id += 65024; 831 824 -
trunk/src/libs/openssl-3.1.7/test/v3ext.c
r105945 r105949 1 1 /* 2 * Copyright 2016-202 4The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 4 * Licensed under the Apache License 2.0 (the "License"). You may not use … … 270 270 if (!ASN1_OCTET_STRING_set(f1->addressFamily, key, keylen)) 271 271 goto end; 272 273 /* Push and transfer memory ownership to stack */274 272 if (!sk_IPAddressFamily_push(addr, f1)) 275 273 goto end; 276 f1 = NULL;277 274 278 275 /* Shouldn't be able to canonize this as the len is > 3*/ … … 280 277 goto end; 281 278 282 /* Pop and free the new stack element*/283 IPAddressFamily_free(sk_IPAddressFamily_pop(addr));284 285 /* Create a well-formed IPAddressFamily */ 279 /* Create a well formed IPAddressFamily */ 280 f1 = sk_IPAddressFamily_pop(addr); 281 IPAddressFamily_free(f1); 282 286 283 key[0] = (afi >> 8) & 0xFF; 287 284 key[1] = afi & 0xFF; … … 301 298 /* Mark this as inheritance so we skip some of the is_canonize checks */ 302 299 f1->ipAddressChoice->type = IPAddressChoice_inherit; 303 304 /* Push and transfer memory ownership to stack */305 300 if (!sk_IPAddressFamily_push(addr, f1)) 306 301 goto end; 307 f1 = NULL;308 302 309 303 /* Should be able to canonize now */ … … 313 307 testresult = 1; 314 308 end: 315 /* Free stack and any memory owned by detached element */316 IPAddressFamily_free(f1);317 309 sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free); 318 319 310 ASN1_OCTET_STRING_free(ip1); 320 311 ASN1_OCTET_STRING_free(ip2);
Note:
See TracChangeset
for help on using the changeset viewer.