VirtualBox

Ignore:
Timestamp:
Sep 4, 2024 12:53:14 PM (6 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164683
Message:

openssl-3.1.7: Applied and adjusted our OpenSSL changes to 3.1.7. bugref:10757

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  
    11/*
    2  * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    505505            || !TEST_true(SSL_set_session(con, sess)))
    506506        goto end;
     507    SSL_SESSION_free(sess);
    507508
    508509    rbio = BIO_new(BIO_s_mem());
     
    592593
    593594 end:
    594     SSL_SESSION_free(sess);
    595595    BIO_free(rbio);
    596596    BIO_free(wbio);
  • trunk/src/libs/openssl-3.1.7/test/build.info

    r105945 r105949  
    4141          evp_pkey_provided_test evp_test evp_extra_test evp_extra_test2 \
    4242          evp_fetch_prov_test evp_libctx_test ossl_store_test \
    43           v3nametest v3ext punycode_test evp_byname_test \
     43          v3nametest v3ext punycode_test \
    4444          crltest danetest bad_dtls_test lhash_test sparse_array_test \
    4545          conf_include_test params_api_test params_conversion_test \
     
    306306  DEPEND[punycode_test]=../libcrypto.a libtestutil.a
    307307
    308   SOURCE[evp_byname_test]=evp_byname_test.c
    309   INCLUDE[evp_byname_test]=../include ../apps/include
    310   DEPEND[evp_byname_test]=../libcrypto libtestutil.a
    311 
    312308  SOURCE[stack_test]=stack_test.c
    313309  INCLUDE[stack_test]=../include ../apps/include
     
    879875  IF[{- $disabled{module} || !$target{dso_scheme} -}]
    880876    DEFINE[provider_test]=NO_PROVIDER_MODULE
    881     DEFINE[prov_config_test]=NO_PROVIDER_MODULE
    882877    DEFINE[provider_internal_test]=NO_PROVIDER_MODULE
    883878  ENDIF
  • trunk/src/libs/openssl-3.1.7/test/cmp_hdr_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2007-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.
    33 * Copyright Nokia 2007-2019
    44 * Copyright Siemens AG 2015-2019
     
    7272static int execute_HDR_get0_senderNonce_test(CMP_HDR_TEST_FIXTURE *fixture)
    7373{
    74     int res = 0;
    7574    X509_NAME *sender = X509_NAME_new();
    7675    ASN1_OCTET_STRING *sn;
    7776
    7877    if (!TEST_ptr(sender))
    79         goto err;
     78        return 0;
    8079
    8180    X509_NAME_ADD(sender, "CN", "A common sender name");
    8281    if (!TEST_int_eq(OSSL_CMP_CTX_set1_subjectName(fixture->cmp_ctx, sender),
    8382                     1))
    84         goto err;
     83        return 0;
    8584    if (!TEST_int_eq(ossl_cmp_hdr_init(fixture->cmp_ctx, fixture->hdr),
    8685                     1))
    87         goto err;
     86        return 0;
    8887    sn = ossl_cmp_hdr_get0_senderNonce(fixture->hdr);
    8988    if (!TEST_int_eq(ASN1_OCTET_STRING_cmp(fixture->cmp_ctx->senderNonce, sn),
    9089                     0))
    91         goto err;
    92 
    93     res = 1;
    94 err:
     90        return 0;
    9591    X509_NAME_free(sender);
    96 
    97     return res;
     92    return 1;
    9893}
    9994
     
    108103static int execute_HDR_set1_sender_test(CMP_HDR_TEST_FIXTURE *fixture)
    109104{
    110     int res = 0;
    111105    X509_NAME *x509name = X509_NAME_new();
    112106
    113107    if (!TEST_ptr(x509name))
    114         goto err;
     108        return 0;
    115109
    116110    X509_NAME_ADD(x509name, "CN", "A common sender name");
    117111    if (!TEST_int_eq(ossl_cmp_hdr_set1_sender(fixture->hdr, x509name), 1))
    118         goto err;
    119 
     112        return 0;
    120113    if (!TEST_int_eq(fixture->hdr->sender->type, GEN_DIRNAME))
    121         goto err;
     114        return 0;
    122115
    123116    if (!TEST_int_eq(X509_NAME_cmp(fixture->hdr->sender->d.directoryName,
    124117                                   x509name), 0))
    125         goto err;
    126 
    127     res = 1;
    128 err:
     118        return 0;
     119
    129120    X509_NAME_free(x509name);
    130 
    131     return res;
     121    return 1;
    132122}
    133123
     
    142132static int execute_HDR_set1_recipient_test(CMP_HDR_TEST_FIXTURE *fixture)
    143133{
    144     int res = 0;
    145134    X509_NAME *x509name = X509_NAME_new();
    146135
    147136    if (!TEST_ptr(x509name))
    148         goto err;
     137        return 0;
    149138
    150139    X509_NAME_ADD(x509name, "CN", "A common recipient name");
    151140    if (!TEST_int_eq(ossl_cmp_hdr_set1_recipient(fixture->hdr, x509name), 1))
    152         goto err;
     141        return 0;
    153142
    154143    if (!TEST_int_eq(fixture->hdr->recipient->type, GEN_DIRNAME))
    155         goto err;
     144        return 0;
    156145
    157146    if (!TEST_int_eq(X509_NAME_cmp(fixture->hdr->recipient->d.directoryName,
    158147                                   x509name), 0))
    159         goto err;
    160 
    161     res = 1;
    162 err:
     148        return 0;
     149
    163150    X509_NAME_free(x509name);
    164 
    165     return res;
     151    return 1;
    166152}
    167153
     
    218204
    219205    if (!TEST_ptr(senderKID))
    220         goto err;
     206        return 0;
    221207
    222208    if (!TEST_int_eq(ASN1_OCTET_STRING_set(senderKID, rand_data,
     
    280266
    281267    if (!TEST_ptr(text))
    282         goto err;
     268        return 0;
    283269
    284270    if (!ASN1_STRING_set(text, "A free text", -1))
     
    295281 err:
    296282    ASN1_UTF8STRING_free(text);
    297 
    298283    return res;
    299284}
  • trunk/src/libs/openssl-3.1.7/test/crltest.c

    r105945 r105949  
    11/*
    2  * Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    102102};
    103103
    104 static const char *kInvalidCRL[] = {
    105     "-----BEGIN X509 CRL-----\n",
    106     "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n",
    107     "-----END X509 CRL-----\n",
    108     NULL
    109 };
    110 
    111104static const char *kBadIssuerCRL[] = {
    112105    "-----BEGIN X509 CRL-----\n",
     
    379372}
    380373
    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;
     374static 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;
    396384    }
    397385
    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
    428388    OPENSSL_free(p);
    429389    BIO_free(b);
    430390    X509_CRL_free(reused_crl);
    431     X509_CRL_free(addref_crl);
    432     return r;
     391    return 1;
    433392}
    434393
     
    444403    ADD_TEST(test_known_critical_crl);
    445404    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);
    447406    return 1;
    448407}
  • trunk/src/libs/openssl-3.1.7/test/ct_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    451451    fixture->sct_list = sk_SCT_new_null();
    452452    if (fixture->sct_list == NULL)
    453     {
    454         tear_down(fixture);
    455         return 0;
    456     }
     453            return 0;
    457454
    458455    if (!TEST_ptr(sct = SCT_new_from_base64(SCT_VERSION_V1, log_id,
    459456                                            CT_LOG_ENTRY_TYPE_X509, timestamp,
    460457                                            extensions, signature)))
    461     {
    462         tear_down(fixture);
     458
    463459        return 0;
    464     }
    465460
    466461    sk_SCT_push(fixture->sct_list, sct);
  • trunk/src/libs/openssl-3.1.7/test/dsatest.c

    r105945 r105949  
    11/*
    2  * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    333333    BIGNUM *badq = NULL, *badpriv = NULL;
    334334    const unsigned char msg[] = { 0x00 };
    335     unsigned int signature_len0;
    336335    unsigned int signature_len;
    337336    unsigned char signature[64];
     
    377376
    378377    /* 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)))
    386382        goto err;
    387383
  • trunk/src/libs/openssl-3.1.7/test/ecdsatest.c

    r105945 r105949  
    11/*
    2  * Copyright 2002-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.
    33 * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
    44 *
     
    351351{
    352352    int ret;
    353     unsigned int siglen0;
    354353    unsigned int siglen;
    355354    unsigned char dgst[128] = { 0 };
    356355    EC_KEY *eckey = NULL;
    357     unsigned char *sig = NULL;
    358     BIGNUM *kinv = NULL, *rp = NULL;
    359356
    360357    ret = TEST_ptr(eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1))
    361358          && 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);
    382361    EC_KEY_free(eckey);
    383     OPENSSL_free(sig);
    384     BN_free(kinv);
    385     BN_free(rp);
    386362    return ret;
    387363}
  • trunk/src/libs/openssl-3.1.7/test/ecstresstest.c

    r105945 r105949  
    11/*
    2  * Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License");
     
    8080                                              group))
    8181            || !TEST_ptr(result = walk_curve(group, point, num_repeats)))
    82         goto err;
     82        return 0;
    8383
    8484    if (print_mode) {
  • trunk/src/libs/openssl-3.1.7/test/endecode_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    10331033IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitTri2G, "EC")
    10341034# endif
    1035 # ifndef OPENSSL_NO_SM2
    1036 KEYS(SM2);
    1037 IMPLEMENT_TEST_SUITE(SM2, "SM2", 0)
    1038 # endif
    10391035KEYS(ED25519);
    10401036IMPLEMENT_TEST_SUITE(ED25519, "ED25519", 1)
     
    13421338
    13431339    /* 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;
    13451343
    13461344#ifdef STATIC_LEGACY
     
    14001398    MAKE_DOMAIN_KEYS(ECExplicitTri2G, "EC", ec_explicit_tri_params_explicit);
    14011399# endif
    1402 # ifndef OPENSSL_NO_SM2
    1403     MAKE_KEYS(SM2, "SM2", NULL);
    1404 # endif
    14051400    MAKE_KEYS(ED25519, "ED25519", NULL);
    14061401    MAKE_KEYS(ED448, "ED448", NULL);
     
    14491444        ADD_TEST_SUITE_LEGACY(ECExplicitTri2G);
    14501445# endif
    1451 # ifndef OPENSSL_NO_SM2
    1452         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 # endif
    14571446        ADD_TEST_SUITE(ED25519);
    14581447        ADD_TEST_SUITE(ED448);
     
    15121501    FREE_DOMAIN_KEYS(ECExplicitTri2G);
    15131502# endif
    1514 # ifndef OPENSSL_NO_SM2
    1515     FREE_KEYS(SM2);
    1516 # endif
    15171503    FREE_KEYS(ED25519);
    15181504    FREE_KEYS(ED448);
  • trunk/src/libs/openssl-3.1.7/test/evp_extra_test.c

    r105945 r105949  
    11011101    eckey = NULL;
    11021102
    1103     for (;;) {
     1103    while (dup_pk == NULL) {
    11041104        ret = 0;
    11051105        ctx = EVP_MD_CTX_new();
     
    11171117        ctx = NULL;
    11181118
    1119         if (dup_pk != NULL)
    1120             break;
    1121 
    11221119        if (!TEST_ptr(dup_pk = EVP_PKEY_dup(pkey)))
    11231120            goto err;
     
    11291126            goto err;
    11301127    }
    1131     ret = 1;
    11321128
    11331129 err:
     
    25592555        0x68, 0x81, 0xa5, 0x3e, 0x5b, 0x9c, 0x7b, 0x6f, 0x2e, 0xec, 0xc8, 0x47,
    25602556        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,
    26022557    };
    26032558    size_t expectedlen = sizeof(expected);
     
    47214676static int test_custom_md_meth(void)
    47224677{
    4723     ASN1_OBJECT *o = NULL;
    47244678    EVP_MD_CTX *mdctx = NULL;
    47254679    EVP_MD *tmp = NULL;
     
    47674721        goto err;
    47684722
    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 
    47814723    testresult = 1;
    47824724 err:
    4783     ASN1_OBJECT_free(o);
    47844725    EVP_MD_CTX_free(mdctx);
    47854726    EVP_MD_meth_free(tmp);
     
    53665307#endif
    53675308
    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     else
    5380         ret = 1;
    5381 
    5382     EVP_MD_CTX_free(mdctx);
    5383 
    5384     return ret;
    5385 }
    5386 
    53875309int setup_tests(void)
    53885310{
     
    54625384    ADD_TEST(test_HKDF);
    54635385    ADD_TEST(test_emptyikm_HKDF);
    5464     ADD_TEST(test_empty_salt_info_HKDF);
    54655386#ifndef OPENSSL_NO_EC
    54665387    ADD_TEST(test_X509_PUBKEY_inplace);
     
    55505471#endif
    55515472
    5552     ADD_TEST(test_invalid_ctx_for_digest);
    5553 
    55545473    return 1;
    55555474}
  • trunk/src/libs/openssl-3.1.7/test/evp_kdf_test.c

    r105945 r105949  
    18591859}
    18601860
    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, 0x83
    1874     };
    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, 0x5a
    1884     };
    1885     static const unsigned char output[] = {
    1886         0x6c, 0x03, 0x76, 0x52, 0x99, 0x06, 0x74, 0xa0,
    1887         0x78, 0x44, 0x73, 0x2d, 0x0a, 0xd9, 0x85, 0xf9
    1888     };
    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 
    19191861int setup_tests(void)
    19201862{
     
    19781920#endif
    19791921    ADD_TEST(test_kdf_krb5kdf);
    1980     ADD_TEST(test_kbkdf_mac_change);
    19811922    return 1;
    19821923}
  • trunk/src/libs/openssl-3.1.7/test/evp_pkey_provided_test.c

    r105945 r105949  
    390390        goto err;
    391391
    392     for (;;) {
     392    while (dup_pk == NULL) {
    393393        ret = 0;
    394394        if (!TEST_int_eq(EVP_PKEY_get_bits(pk), 32)
     
    418418              && test_print_key_using_encoder("RSA", pk);
    419419
    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)))
    424421            goto err;
    425422        ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1);
     
    606603        goto err;
    607604
    608     for (;;) {
     605    while (dup_pk == NULL) {
    609606        ret = 0;
    610607        if (!TEST_int_eq(EVP_PKEY_get_bits(pk), 2048)
     
    686683              && test_print_key_using_encoder("DH", pk);
    687684
    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)))
    692686            goto err;
    693687        ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1);
     
    790784        goto err;
    791785
    792     for (;;) {
     786    while (dup_pk == NULL) {
    793787        ret = 0;
    794788        if (!TEST_int_eq(EVP_PKEY_get_bits(pk), 2048)
     
    864858              && test_print_key_using_encoder("DH", pk);
    865859
    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)))
    870861            goto err;
    871862        ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1);
     
    11001091        goto err;
    11011092
    1102     for (;;) {
     1093    while (dup_pk == NULL) {
    11031094        ret = 0;
    11041095        if (!TEST_int_eq(EVP_PKEY_get_bits(pk), bits)
     
    11551146                  && test_print_key_using_encoder(alg, pk);
    11561147
    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)))
    11611149            goto err;
    11621150        ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1);
     
    12751263        goto err;
    12761264
    1277     for (;;) {
     1265    while (dup_pk == NULL) {
    12781266        ret = 0;
    12791267        if (!TEST_int_eq(EVP_PKEY_get_bits(pk), 256)
     
    13131301            || !TEST_BN_eq(group_b, b))
    13141302            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;
    13241303
    13251304        if (!EVP_PKEY_get_utf8_string_param(pk, OSSL_PKEY_PARAM_GROUP_NAME,
     
    13511330              && test_print_key_using_encoder(alg, pk);
    13521331
    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)))
    13571333            goto err;
    13581334        ret = ret && TEST_int_eq(EVP_PKEY_eq(pk, dup_pk), 1);
     
    16001576        goto err;
    16011577
    1602     for (;;) {
     1578    while (dup_pk == NULL) {
    16031579        ret = 0;
    16041580        if (!TEST_int_eq(EVP_PKEY_get_bits(pk), 2048)
     
    16491625            || !TEST_int_eq(pcounter, pcounter_out))
    16501626            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;
    16571633        BN_free(j_out);
    16581634        j_out = NULL;
     
    16821658              && test_print_key_using_encoder("DSA", pk);
    16831659
    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)))
    16881661            goto err;
    16891662        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  
    27912791        return 0;
    27922792    p = strchr(name, ':');
    2793     if (p == NULL)
    2794         p = "";
    2795     else
     2793    if (p != NULL)
    27962794        *p++ = '\0';
    27972795
     
    28042802
    28052803    rv = OSSL_PARAM_allocate_from_text(kdata->p, defs, name, p,
    2806                                        strlen(p), NULL);
     2804                                       p != NULL ? strlen(p) : 0, NULL);
    28072805    *++kdata->p = OSSL_PARAM_construct_end();
    28082806    if (!rv) {
     
    28112809        return 0;
    28122810    }
    2813     if (strcmp(name, "digest") == 0) {
     2811    if (p != NULL && strcmp(name, "digest") == 0) {
    28142812        if (is_digest_disabled(p)) {
    28152813            TEST_info("skipping, '%s' is disabled", p);
     
    28182816        goto end;
    28192817    }
    2820 
    2821     if ((strcmp(name, "cipher") == 0
    2822         || strcmp(name, "cekalg") == 0)
     2818    if (p != NULL
     2819        && (strcmp(name, "cipher") == 0
     2820            || strcmp(name, "cekalg") == 0)
    28232821        && is_cipher_disabled(p)) {
    28242822        TEST_info("skipping, '%s' is disabled", p);
     
    28262824        goto end;
    28272825    }
    2828     if ((strcmp(name, "mac") == 0)
     2826    if (p != NULL
     2827        && (strcmp(name, "mac") == 0)
    28292828        && is_mac_disabled(p)) {
    28302829        TEST_info("skipping, '%s' is disabled", p);
  • trunk/src/libs/openssl-3.1.7/test/helpers/handshake.c

    r105945 r105949  
    11/*
    2  * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    348348
    349349    len = strlen(protos);
    350 
    351     if (len == 0) {
    352         *out = NULL;
    353         *outlen = 0;
    354         return 1;
    355     }
    356350
    357351    /* Should never have reuse. */
  • trunk/src/libs/openssl-3.1.7/test/helpers/ssltestlib.c

    r105945 r105949  
    11/*
    2  * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    88 */
    99
    10 /*
    11  * We need access to the deprecated low level ENGINE APIs for legacy purposes
    12  * when the deprecated calls are not hidden
    13  */
    14 #ifndef OPENSSL_NO_DEPRECATED_3_0
    15 # define OPENSSL_SUPPRESS_DEPRECATED
    16 #endif
    17 
    1810#include <string.h>
    1911
    20 #include <openssl/engine.h>
    2112#include "internal/nelem.h"
    2213#include "ssltestlib.h"
     
    11921183    SSL_free(clientssl);
    11931184}
    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 #else
    1215     return NULL;
    1216 #endif
    1217 }
  • trunk/src/libs/openssl-3.1.7/test/helpers/ssltestlib.h

    r105945 r105949  
    11/*
    2  * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    6060DEFINE_STACK_OF(MEMPACKET)
    6161
    62 ENGINE *load_dasync(void);
    6362#endif /* OSSL_TEST_SSLTESTLIB_H */
  • trunk/src/libs/openssl-3.1.7/test/hexstr_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License");
     
    121121    return TEST_true(OPENSSL_hexstr2buf_ex(buf, sizeof(buf), &len, test->in, ':'))
    122122           && TEST_mem_eq(buf, len, test->expected, test->expected_len)
    123            && TEST_false(OPENSSL_buf2hexstr_ex(out, 3 * len - 1, NULL, buf, len,
    124                                                ':'))
    125123           && 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);
    131126}
    132127
  • trunk/src/libs/openssl-3.1.7/test/keymgmt_internal_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    225225        goto err;
    226226
    227     for (;;) {
     227    while (dup_pk == NULL) {
    228228        ret = 0;
    229229        km = km3;
     
    256256
    257257        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)))
    263259            goto err;
    264260
  • trunk/src/libs/openssl-3.1.7/test/pkey_meth_kdf_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    1717#include "testutil.h"
    1818
    19 static int test_kdf_tls1_prf(int index)
     19static int test_kdf_tls1_prf(void)
    2020{
    2121    int ret = 0;
     
    4141        goto err;
    4242    }
    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;
    6047    }
    6148    if (EVP_PKEY_derive(pctx, out, &outlen) <= 0) {
     
    7966}
    8067
    81 static int test_kdf_hkdf(int index)
     68static int test_kdf_hkdf(void)
    8269{
    8370    int ret = 0;
     
    10895        goto err;
    10996    }
    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)
    11298            <= 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;
    127101    }
    128102    if (EVP_PKEY_derive(pctx, out, &outlen) <= 0) {
     
    222196int setup_tests(void)
    223197{
    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);
    231200#ifndef OPENSSL_NO_SCRYPT
    232201    ADD_TEST(test_kdf_scrypt);
  • trunk/src/libs/openssl-3.1.7/test/prov_config_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    88 */
    99
    10 #include <sys/stat.h>
    1110#include <openssl/evp.h>
    1211#include <openssl/conf.h>
     
    1514static char *configfile = NULL;
    1615static char *recurseconfigfile = NULL;
    17 static char *pathedconfig = NULL;
    1816
    1917/*
     
    2725    EVP_MD *sha256 = NULL;
    2826
     27    if (!TEST_ptr(configfile))
     28        return 0;
    2929    if (!TEST_ptr(ctx))
    3030        return 0;
    3131
    3232    if (!TEST_true(OSSL_LIB_CTX_load_config(ctx, configfile)))
    33         goto err;
     33        return 0;
    3434    if (!TEST_true(OSSL_LIB_CTX_load_config(ctx, configfile)))
    35         goto err;
     35        return 0;
    3636
    3737    /* Check we can actually fetch something */
     
    5353    unsigned long err;
    5454
     55    if (!TEST_ptr(recurseconfigfile))
     56        goto err;
     57
    5558    if (!TEST_ptr(ctx))
    5659        goto err;
     
    6366    if (ERR_GET_REASON(err) == CONF_R_RECURSIVE_SECTION_REFERENCE)
    6467        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;
    11368 err:
    11469    OSSL_LIB_CTX_free(ctx);
     
    13186        return 0;
    13287
    133     if (!TEST_ptr(pathedconfig = test_get_argument(2)))
    134         return 0;
    135 
    13688    ADD_TEST(test_recursive_config);
    13789    ADD_TEST(test_double_config);
    138     ADD_TEST(test_path_config);
    13990    return 1;
    14091}
  • trunk/src/libs/openssl-3.1.7/test/provider_fallback_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    4040
    4141    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));
    5145
    5246    OSSL_LIB_CTX_free(ctx);
  • trunk/src/libs/openssl-3.1.7/test/provider_internal_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    2323static int test_provider(OSSL_PROVIDER *prov, const char *expected_greeting)
    2424{
    25     const char *greeting = "no greeting received";
     25    const char *greeting = NULL;
    2626    int ret = 0;
    2727
  • trunk/src/libs/openssl-3.1.7/test/provider_status_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    1515#include <openssl/self_test.h>
    1616#include <openssl/evp.h>
    17 #include <openssl/rsa.h>
    1817#include "testutil.h"
    1918
     
    149148    OSSL_PARAM params[2];
    150149    EVP_MD *fetch = NULL;
    151     EVP_PKEY_CTX *pctx = NULL;
    152     EVP_PKEY *pkey = NULL;
    153150
    154151    if (!TEST_ptr(prov = OSSL_PROVIDER_load(libctx, provider_name)))
     
    167164    EVP_MD_free(fetch);
    168165    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;
    179166
    180167    /* Test that the provider self test is ok */
  • trunk/src/libs/openssl-3.1.7/test/provider_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    198198    if (!TEST_true(OSSL_PROVIDER_add_builtin(libctx, name,
    199199                                             PROVIDER_INIT_FUNCTION_NAME))) {
    200         OSSL_PROVIDER_unload(legacy);
    201200        OSSL_LIB_CTX_free(libctx);
    202201        return 0;
  • trunk/src/libs/openssl-3.1.7/test/recipes/03-test_fipsinstall.t

    r105945 r105949  
    11#! /usr/bin/env perl
    2 # Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    207207            '-provider_name', 'fips', '-mac_name', 'HMAC',
    208208            '-macopt', 'digest:SHA256', '-macopt', "hexkey:$fipskey",
    209             '-section_name', 'fips_sect', '-corrupt_desc', 'SHA2'])),
     209            '-section_name', 'fips_sect', '-corrupt_desc', 'SHA1'])),
    210210   "fipsinstall fails when the digest result is corrupted");
    211211
  • trunk/src/libs/openssl-3.1.7/test/recipes/04-test_conf.t

    r105945 r105949  
    11#! /usr/bin/env perl
    2 # Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    1919    'dollarid_on.cnf'  => 'dollarid_on.txt',
    2020    'dollarid_off.cnf' => 'dollarid_off.txt',
    21     'oversized_line.cnf' => 'oversized_line.txt',
    2221);
    2322
  • trunk/src/libs/openssl-3.1.7/test/recipes/25-test_eai_data.t

    r105945 r105949  
    11#! /usr/bin/env perl
    2 # Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    2222#./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
    2323
    24 plan tests => 16;
     24plan tests => 12;
    2525
    2626require_ok(srctop_file('test','recipes','tconversion.pl'));
     
    2929my $ascii_pem = srctop_file($folder, "ascii_leaf.pem");
    3030my $utf8_pem  = srctop_file($folder, "utf8_leaf.pem");
    31 my $kdc_pem   = srctop_file($folder, "kdc-cert.pem");
    3231
    3332my $ascii_chain_pem = srctop_file($folder, "ascii_chain.pem");
    3433my $utf8_chain_pem  = srctop_file($folder, "utf8_chain.pem");
    35 my $kdc_chain_pem  = srctop_file($folder, "kdc-root-cert.pem");
    3634
    3735my $out;
     
    5957ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $ascii_chain_pem, $ascii_pem])));
    6058ok(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])));
    6259
    6360ok(!run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $ascii_chain_pem, $utf8_pem])));
    6461ok(!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])));
    7262
    7363#Check that we get the expected failure return code
  • trunk/src/libs/openssl-3.1.7/test/recipes/25-test_req.t

    r105945 r105949  
    1616setup("test_req");
    1717
    18 plan tests => 50;
     18plan tests => 49;
    1919
    2020require_ok(srctop_file('test', 'recipes', 'tconversion.pl'));
     
    5454ok(!run(app([@addext_args, "-addext", $val2, "-addext", $val3])));
    5555ok(run(app([@addext_args, "-addext", "SXNetID=1:one, 2:two, 3:three"])));
    56 ok(run(app([@addext_args, "-addext", "subjectAltName=dirName:dirname_sec"])));
    5756
    5857# 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  
    11#
    2 # Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    271271# Test sign with a 2048 bit key with N == 160 is not allowed in fips mode
    272272Availablein = fips
    273 FIPSversion = <3.4.0
    274273DigestSign = SHA256
    275274Key = DSA-2048-160
     
    326325# Test sign with a 1024 bit key is not allowed in fips mode
    327326Availablein = fips
    328 FIPSversion = <3.4.0
    329327DigestSign = SHA256
    330328Securitycheck = 1
     
    343341# Test sign with a 3072 bit key with N == 224 is not allowed in fips mode
    344342Availablein = fips
    345 FIPSversion = <3.4.0
    346343DigestSign = SHA256
    347344Securitycheck = 1
     
    352349# Test sign with a 4096 bit key is not allowed in fips mode
    353350Availablein = fips
    354 FIPSversion = <3.4.0
    355351DigestSign = SHA256
    356352Securitycheck = 1
  • trunk/src/libs/openssl-3.1.7/test/recipes/30-test_evp_data/evppkey_ecdsa.txt

    r105945 r105949  
    11#
    2 # Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    217217# Test that SHA1 is not allowed in fips mode for signing
    218218Availablein = fips
    219 FIPSversion = <3.4.0
    220219Sign = P-256
    221220Securitycheck = 1
  • trunk/src/libs/openssl-3.1.7/test/recipes/30-test_evp_data/evppkey_rsa_common.txt

    r105945 r105949  
    11#
    2 # Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    13451345# Signing with SHA1 is not allowed in fips mode
    13461346Availablein = fips
    1347 FIPSversion = <3.4.0
    13481347DigestSign = SHA1
    13491348Securitycheck = 1
  • trunk/src/libs/openssl-3.1.7/test/recipes/30-test_prov_config.t

    r105945 r105949  
    11#! /usr/bin/env perl
    2 # Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    2424
    2525ok(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")])),
    2827    "running prov_config_test default.cnf");
    2928
     
    3231
    3332    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")])),
    3634       "running prov_config_test fips.cnf");
    3735}
  • trunk/src/libs/openssl-3.1.7/test/recipes/80-test_pkcs12.t

    r105945 r105949  
    5555$ENV{OPENSSL_WIN32_UTF8}=1;
    5656
    57 plan tests => 20;
     57plan tests => 17;
    5858
    5959# Test different PKCS#12 formats
     
    163163           "test bad pkcs12 file 1 (nomacver)");
    164164
    165         ok(run(app(["openssl", "pkcs12", "-in", $bad1, "-password", "pass:",
    166                     "-info"])),
    167            "test bad pkcs12 file 1 (info)");
    168 
    169165        ok(run(app(["openssl", "pkcs12", "-in", $bad2, "-password", "pass:"])),
    170166           "test bad pkcs12 file 2");
    171167
    172         ok(run(app(["openssl", "pkcs12", "-in", $bad2, "-password", "pass:",
    173                     "-info"])),
    174            "test bad pkcs12 file 2 (info)");
    175 
    176168        ok(run(app(["openssl", "pkcs12", "-in", $bad3, "-password", "pass:"])),
    177169           "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)");
    182170     });
    183171
  • trunk/src/libs/openssl-3.1.7/test/recipes/90-test_shlibload.t

    r105945 r105949  
    11#! /usr/bin/env perl
    2 # Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    2424plan skip_all => "Test only supported in a dso build" if disabled("dso");
    2525plan 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");
    2726
    2827plan tests => 10;
  • trunk/src/libs/openssl-3.1.7/test/recipes/90-test_sslapi.t

    r105945 r105949  
    11#! /usr/bin/env perl
    2 # Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    88
    99use OpenSSL::Test::Utils;
    10 use OpenSSL::Test qw/:DEFAULT srctop_file srctop_dir bldtop_dir bldtop_file result_dir result_file/;
     10use OpenSSL::Test qw/:DEFAULT srctop_file srctop_dir bldtop_dir bldtop_file/;
    1111use File::Temp qw(tempfile);
    1212
     
    1414setup("test_sslapi");
    1515}
     16
     17use lib srctop_dir('Configurations');
     18use lib bldtop_dir('.');
    1619
    1720my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
     
    2326# A modified copy of "fipsmodule.cnf"
    2427my $fipsmodcfgnew_filename = "fipsmodule_mod.cnf";
    25 my $fipsmodcfgnew = result_file($fipsmodcfgnew_filename);
     28my $fipsmodcfgnew = bldtop_file("test", $fipsmodcfgnew_filename);
    2629
    2730# A modified copy of "fips-and-base.cnf"
    28 my $provconfnew = result_file("fips-and-base-temp.cnf");
     31my $provconfnew = bldtop_file("test", "temp.cnf");
    2932
    3033plan skip_all => "No TLS/SSL protocols are supported by this OpenSSL build"
     
    4952        if $no_fips;
    5053
    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 connection
    53     # fails if ems is not used and the fips check is enabled.
    5454    ok(run(test(["sslapitest", srctop_dir("test", "certs"),
    5555                 srctop_file("test", "recipes", "90-test_sslapi_data",
     
    6060                             "90-test_sslapi_data",
    6161                             "dhparams.pem")])),
    62                  "running sslapitest with default fips config");
     62                 "running sslapitest");
    6363
    6464    run(test(["fips_version_test", "-config", $provconf, ">=3.1.0"]),
     
    7171    # value in $repl and output to a new file $outfile.
    7272    sub replace_line_file_internal {
    73 
     73   
    7474        my ($infile, $srch, $repl, $outfile) = @_;
    7575        my $msg;
     
    8686        return 1;
    8787    }
    88 
     88   
    8989    # Read in the text input file $infile
    9090    # and replace a single Key = Value line with a new value in $value.
     
    103103        return replace_line_file_internal($infile, $srch, $rep, $outfile);
    104104    }
    105 
     105   
    106106    # Read in the text $input file
    107107    # and search for the $key and replace with $newkey
     
    115115    }
    116116
    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
    119118    # copy the existing fipsmodule.cnf and modify it.
    120119    # 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.
    122122    ok(replace_kv_file($fipsmodcfg,
    123                        'tls1-prf-ems-check', '0',
     123                       'tls1-prf-ems-check', '1',
    124124                       $fipsmodcfgnew)
    125125       && replace_line_file($provconf,
     
    135135                                "90-test_sslapi_data",
    136136                                "dhparams.pem")])),
    137        "running sslapitest with modified fips config");
     137       "running sslapitest");
     138
     139    unlink $fipsmodcfgnew;
     140    unlink $provconfnew;
    138141}
    139142
  • trunk/src/libs/openssl-3.1.7/test/sm2_internal_test.c

    r105945 r105949  
    11/*
    2  * Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    306306                         const char *k_hex,
    307307                         const char *r_hex,
    308                          const char *s_hex,
    309                          int omit_pubkey)
     308                         const char *s_hex)
    310309{
    311310    const size_t msg_len = strlen(message);
     
    329328        goto done;
    330329
    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;
    338335
    339336    start_fake_rand(k_hex);
     
    396393                        "007c47811054c6f99613a578eb8453706ccb96384fe7df5c171671e760bfa8be3a",
    397394                        "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")))
    417396        goto done;
    418397
  • trunk/src/libs/openssl-3.1.7/test/ssl-tests/08-npn.cnf

    r105945 r105949  
    11# Generated with generate_ssl_tests.pl
    22
    3 num_tests = 22
     3num_tests = 20
    44
    55test-0 = 0-npn-simple
     
    99test-4 = 4-npn-no-server-support
    1010test-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
     11test-6 = 6-npn-with-sni-no-context-switch
     12test-7 = 7-npn-with-sni-context-switch
     13test-8 = 8-npn-selected-sni-server-supports-npn
     14test-9 = 9-npn-selected-sni-server-does-not-support-npn
     15test-10 = 10-alpn-preferred-over-npn
     16test-11 = 11-sni-npn-preferred-over-alpn
     17test-12 = 12-npn-simple-resumption
     18test-13 = 13-npn-server-switch-resumption
     19test-14 = 14-npn-client-switch-resumption
     20test-15 = 15-npn-client-first-pref-on-mismatch-resumption
     21test-16 = 16-npn-no-server-support-resumption
     22test-17 = 17-npn-no-client-support-resumption
     23test-18 = 18-alpn-preferred-over-npn-resumption
     24test-19 = 19-npn-used-if-alpn-not-supported-resumption
    2725# ===========================================================
    2826
     
    209207# ===========================================================
    210208
    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]
     210ssl_conf = 6-npn-with-sni-no-context-switch-ssl
     211
     212[6-npn-with-sni-no-context-switch-ssl]
     213server = 6-npn-with-sni-no-context-switch-server
     214client = 6-npn-with-sni-no-context-switch-client
     215server2 = 6-npn-with-sni-no-context-switch-server2
     216
     217[6-npn-with-sni-no-context-switch-server]
     218Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     219CipherString = DEFAULT
     220PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     221
     222[6-npn-with-sni-no-context-switch-server2]
     223Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     224CipherString = DEFAULT
     225PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     226
     227[6-npn-with-sni-no-context-switch-client]
    224228CipherString = DEFAULT
    225229MaxProtocol = TLSv1.2
     
    228232
    229233[test-6]
    230 ExpectedClientAlert = HandshakeFailure
    231 ExpectedResult = ClientFail
    232 server = 6-npn-empty-client-list-server-extra
    233 client = 6-npn-empty-client-list-client-extra
    234 
    235 [6-npn-empty-client-list-server-extra]
    236 NPNProtocols = foo
    237 
    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-ssl
    246 
    247 [7-npn-empty-server-list-ssl]
    248 server = 7-npn-empty-server-list-server
    249 client = 7-npn-empty-server-list-client
    250 
    251 [7-npn-empty-server-list-server]
    252 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
    253 CipherString = DEFAULT
    254 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
    255 
    256 [7-npn-empty-server-list-client]
    257 CipherString = DEFAULT
    258 MaxProtocol = TLSv1.2
    259 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
    260 VerifyMode = Peer
    261 
    262 [test-7]
    263 ExpectedNPNProtocol = foo
    264 server = 7-npn-empty-server-list-server-extra
    265 client = 7-npn-empty-server-list-client-extra
    266 
    267 [7-npn-empty-server-list-server-extra]
    268 NPNProtocols =
    269 
    270 [7-npn-empty-server-list-client-extra]
    271 NPNProtocols = foo
    272 
    273 
    274 # ===========================================================
    275 
    276 [8-npn-with-sni-no-context-switch]
    277 ssl_conf = 8-npn-with-sni-no-context-switch-ssl
    278 
    279 [8-npn-with-sni-no-context-switch-ssl]
    280 server = 8-npn-with-sni-no-context-switch-server
    281 client = 8-npn-with-sni-no-context-switch-client
    282 server2 = 8-npn-with-sni-no-context-switch-server2
    283 
    284 [8-npn-with-sni-no-context-switch-server]
    285 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
    286 CipherString = DEFAULT
    287 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
    288 
    289 [8-npn-with-sni-no-context-switch-server2]
    290 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
    291 CipherString = DEFAULT
    292 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
    293 
    294 [8-npn-with-sni-no-context-switch-client]
    295 CipherString = DEFAULT
    296 MaxProtocol = TLSv1.2
    297 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
    298 VerifyMode = Peer
    299 
    300 [test-8]
    301234ExpectedNPNProtocol = foo
    302235ExpectedServerName = server1
    303 server = 8-npn-with-sni-no-context-switch-server-extra
    304 server2 = 8-npn-with-sni-no-context-switch-server2-extra
    305 client = 8-npn-with-sni-no-context-switch-client-extra
    306 
    307 [8-npn-with-sni-no-context-switch-server-extra]
     236server = 6-npn-with-sni-no-context-switch-server-extra
     237server2 = 6-npn-with-sni-no-context-switch-server2-extra
     238client = 6-npn-with-sni-no-context-switch-client-extra
     239
     240[6-npn-with-sni-no-context-switch-server-extra]
    308241NPNProtocols = foo
    309242ServerNameCallback = IgnoreMismatch
    310243
    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]
     245NPNProtocols = bar
     246
     247[6-npn-with-sni-no-context-switch-client-extra]
    315248NPNProtocols = foo,bar
    316249ServerName = server1
     
    319252# ===========================================================
    320253
    321 [9-npn-with-sni-context-switch]
    322 ssl_conf = 9-npn-with-sni-context-switch-ssl
    323 
    324 [9-npn-with-sni-context-switch-ssl]
    325 server = 9-npn-with-sni-context-switch-server
    326 client = 9-npn-with-sni-context-switch-client
    327 server2 = 9-npn-with-sni-context-switch-server2
    328 
    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]
     255ssl_conf = 7-npn-with-sni-context-switch-ssl
     256
     257[7-npn-with-sni-context-switch-ssl]
     258server = 7-npn-with-sni-context-switch-server
     259client = 7-npn-with-sni-context-switch-client
     260server2 = 7-npn-with-sni-context-switch-server2
     261
     262[7-npn-with-sni-context-switch-server]
     263Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     264CipherString = DEFAULT
     265PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     266
     267[7-npn-with-sni-context-switch-server2]
     268Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     269CipherString = DEFAULT
     270PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     271
     272[7-npn-with-sni-context-switch-client]
     273CipherString = DEFAULT
     274MaxProtocol = TLSv1.2
     275VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     276VerifyMode = Peer
     277
     278[test-7]
    346279ExpectedNPNProtocol = bar
    347280ExpectedServerName = server2
    348 server = 9-npn-with-sni-context-switch-server-extra
    349 server2 = 9-npn-with-sni-context-switch-server2-extra
    350 client = 9-npn-with-sni-context-switch-client-extra
    351 
    352 [9-npn-with-sni-context-switch-server-extra]
     281server = 7-npn-with-sni-context-switch-server-extra
     282server2 = 7-npn-with-sni-context-switch-server2-extra
     283client = 7-npn-with-sni-context-switch-client-extra
     284
     285[7-npn-with-sni-context-switch-server-extra]
    353286NPNProtocols = foo
    354287ServerNameCallback = IgnoreMismatch
    355288
    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]
     290NPNProtocols = bar
     291
     292[7-npn-with-sni-context-switch-client-extra]
    360293NPNProtocols = foo,bar
    361294ServerName = server2
     
    364297# ===========================================================
    365298
    366 [10-npn-selected-sni-server-supports-npn]
    367 ssl_conf = 10-npn-selected-sni-server-supports-npn-ssl
    368 
    369 [10-npn-selected-sni-server-supports-npn-ssl]
    370 server = 10-npn-selected-sni-server-supports-npn-server
    371 client = 10-npn-selected-sni-server-supports-npn-client
    372 server2 = 10-npn-selected-sni-server-supports-npn-server2
    373 
    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]
     300ssl_conf = 8-npn-selected-sni-server-supports-npn-ssl
     301
     302[8-npn-selected-sni-server-supports-npn-ssl]
     303server = 8-npn-selected-sni-server-supports-npn-server
     304client = 8-npn-selected-sni-server-supports-npn-client
     305server2 = 8-npn-selected-sni-server-supports-npn-server2
     306
     307[8-npn-selected-sni-server-supports-npn-server]
     308Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     309CipherString = DEFAULT
     310PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     311
     312[8-npn-selected-sni-server-supports-npn-server2]
     313Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     314CipherString = DEFAULT
     315PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     316
     317[8-npn-selected-sni-server-supports-npn-client]
     318CipherString = DEFAULT
     319MaxProtocol = TLSv1.2
     320VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     321VerifyMode = Peer
     322
     323[test-8]
    391324ExpectedNPNProtocol = bar
    392325ExpectedServerName = server2
    393 server = 10-npn-selected-sni-server-supports-npn-server-extra
    394 server2 = 10-npn-selected-sni-server-supports-npn-server2-extra
    395 client = 10-npn-selected-sni-server-supports-npn-client-extra
    396 
    397 [10-npn-selected-sni-server-supports-npn-server-extra]
     326server = 8-npn-selected-sni-server-supports-npn-server-extra
     327server2 = 8-npn-selected-sni-server-supports-npn-server2-extra
     328client = 8-npn-selected-sni-server-supports-npn-client-extra
     329
     330[8-npn-selected-sni-server-supports-npn-server-extra]
    398331ServerNameCallback = IgnoreMismatch
    399332
    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]
     334NPNProtocols = bar
     335
     336[8-npn-selected-sni-server-supports-npn-client-extra]
    404337NPNProtocols = foo,bar
    405338ServerName = server2
     
    408341# ===========================================================
    409342
    410 [11-npn-selected-sni-server-does-not-support-npn]
    411 ssl_conf = 11-npn-selected-sni-server-does-not-support-npn-ssl
    412 
    413 [11-npn-selected-sni-server-does-not-support-npn-ssl]
    414 server = 11-npn-selected-sni-server-does-not-support-npn-server
    415 client = 11-npn-selected-sni-server-does-not-support-npn-client
    416 server2 = 11-npn-selected-sni-server-does-not-support-npn-server2
    417 
    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]
     344ssl_conf = 9-npn-selected-sni-server-does-not-support-npn-ssl
     345
     346[9-npn-selected-sni-server-does-not-support-npn-ssl]
     347server = 9-npn-selected-sni-server-does-not-support-npn-server
     348client = 9-npn-selected-sni-server-does-not-support-npn-client
     349server2 = 9-npn-selected-sni-server-does-not-support-npn-server2
     350
     351[9-npn-selected-sni-server-does-not-support-npn-server]
     352Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     353CipherString = DEFAULT
     354PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     355
     356[9-npn-selected-sni-server-does-not-support-npn-server2]
     357Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     358CipherString = DEFAULT
     359PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     360
     361[9-npn-selected-sni-server-does-not-support-npn-client]
     362CipherString = DEFAULT
     363MaxProtocol = TLSv1.2
     364VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     365VerifyMode = Peer
     366
     367[test-9]
    435368ExpectedServerName = server2
    436 server = 11-npn-selected-sni-server-does-not-support-npn-server-extra
    437 client = 11-npn-selected-sni-server-does-not-support-npn-client-extra
    438 
    439 [11-npn-selected-sni-server-does-not-support-npn-server-extra]
     369server = 9-npn-selected-sni-server-does-not-support-npn-server-extra
     370client = 9-npn-selected-sni-server-does-not-support-npn-client-extra
     371
     372[9-npn-selected-sni-server-does-not-support-npn-server-extra]
    440373NPNProtocols = bar
    441374ServerNameCallback = IgnoreMismatch
    442375
    443 [11-npn-selected-sni-server-does-not-support-npn-client-extra]
     376[9-npn-selected-sni-server-does-not-support-npn-client-extra]
    444377NPNProtocols = foo,bar
    445378ServerName = server2
     
    448381# ===========================================================
    449382
    450 [12-alpn-preferred-over-npn]
    451 ssl_conf = 12-alpn-preferred-over-npn-ssl
    452 
    453 [12-alpn-preferred-over-npn-ssl]
    454 server = 12-alpn-preferred-over-npn-server
    455 client = 12-alpn-preferred-over-npn-client
    456 
    457 [12-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 [12-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-12]
     383[10-alpn-preferred-over-npn]
     384ssl_conf = 10-alpn-preferred-over-npn-ssl
     385
     386[10-alpn-preferred-over-npn-ssl]
     387server = 10-alpn-preferred-over-npn-server
     388client = 10-alpn-preferred-over-npn-client
     389
     390[10-alpn-preferred-over-npn-server]
     391Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     392CipherString = DEFAULT
     393PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     394
     395[10-alpn-preferred-over-npn-client]
     396CipherString = DEFAULT
     397MaxProtocol = TLSv1.2
     398VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     399VerifyMode = Peer
     400
     401[test-10]
    469402ExpectedALPNProtocol = foo
    470 server = 12-alpn-preferred-over-npn-server-extra
    471 client = 12-alpn-preferred-over-npn-client-extra
    472 
    473 [12-alpn-preferred-over-npn-server-extra]
     403server = 10-alpn-preferred-over-npn-server-extra
     404client = 10-alpn-preferred-over-npn-client-extra
     405
     406[10-alpn-preferred-over-npn-server-extra]
    474407ALPNProtocols = foo
    475408NPNProtocols = bar
    476409
    477 [12-alpn-preferred-over-npn-client-extra]
     410[10-alpn-preferred-over-npn-client-extra]
    478411ALPNProtocols = foo
    479412NPNProtocols = bar
     
    482415# ===========================================================
    483416
    484 [13-sni-npn-preferred-over-alpn]
    485 ssl_conf = 13-sni-npn-preferred-over-alpn-ssl
    486 
    487 [13-sni-npn-preferred-over-alpn-ssl]
    488 server = 13-sni-npn-preferred-over-alpn-server
    489 client = 13-sni-npn-preferred-over-alpn-client
    490 server2 = 13-sni-npn-preferred-over-alpn-server2
    491 
    492 [13-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 [13-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 [13-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-13]
     417[11-sni-npn-preferred-over-alpn]
     418ssl_conf = 11-sni-npn-preferred-over-alpn-ssl
     419
     420[11-sni-npn-preferred-over-alpn-ssl]
     421server = 11-sni-npn-preferred-over-alpn-server
     422client = 11-sni-npn-preferred-over-alpn-client
     423server2 = 11-sni-npn-preferred-over-alpn-server2
     424
     425[11-sni-npn-preferred-over-alpn-server]
     426Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     427CipherString = DEFAULT
     428PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     429
     430[11-sni-npn-preferred-over-alpn-server2]
     431Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     432CipherString = DEFAULT
     433PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     434
     435[11-sni-npn-preferred-over-alpn-client]
     436CipherString = DEFAULT
     437MaxProtocol = TLSv1.2
     438VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     439VerifyMode = Peer
     440
     441[test-11]
    509442ExpectedNPNProtocol = bar
    510443ExpectedServerName = server2
    511 server = 13-sni-npn-preferred-over-alpn-server-extra
    512 server2 = 13-sni-npn-preferred-over-alpn-server2-extra
    513 client = 13-sni-npn-preferred-over-alpn-client-extra
    514 
    515 [13-sni-npn-preferred-over-alpn-server-extra]
     444server = 11-sni-npn-preferred-over-alpn-server-extra
     445server2 = 11-sni-npn-preferred-over-alpn-server2-extra
     446client = 11-sni-npn-preferred-over-alpn-client-extra
     447
     448[11-sni-npn-preferred-over-alpn-server-extra]
    516449ALPNProtocols = foo
    517450ServerNameCallback = IgnoreMismatch
    518451
    519 [13-sni-npn-preferred-over-alpn-server2-extra]
    520 NPNProtocols = bar
    521 
    522 [13-sni-npn-preferred-over-alpn-client-extra]
     452[11-sni-npn-preferred-over-alpn-server2-extra]
     453NPNProtocols = bar
     454
     455[11-sni-npn-preferred-over-alpn-client-extra]
    523456ALPNProtocols = foo
    524457NPNProtocols = bar
     
    528461# ===========================================================
    529462
    530 [14-npn-simple-resumption]
    531 ssl_conf = 14-npn-simple-resumption-ssl
    532 
    533 [14-npn-simple-resumption-ssl]
    534 server = 14-npn-simple-resumption-server
    535 client = 14-npn-simple-resumption-client
    536 resume-server = 14-npn-simple-resumption-server
    537 resume-client = 14-npn-simple-resumption-client
    538 
    539 [14-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 [14-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-14]
     463[12-npn-simple-resumption]
     464ssl_conf = 12-npn-simple-resumption-ssl
     465
     466[12-npn-simple-resumption-ssl]
     467server = 12-npn-simple-resumption-server
     468client = 12-npn-simple-resumption-client
     469resume-server = 12-npn-simple-resumption-server
     470resume-client = 12-npn-simple-resumption-client
     471
     472[12-npn-simple-resumption-server]
     473Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     474CipherString = DEFAULT
     475PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     476
     477[12-npn-simple-resumption-client]
     478CipherString = DEFAULT
     479MaxProtocol = TLSv1.2
     480VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     481VerifyMode = Peer
     482
     483[test-12]
    551484ExpectedNPNProtocol = foo
    552485HandshakeMode = Resume
    553486ResumptionExpected = Yes
    554 server = 14-npn-simple-resumption-server-extra
    555 resume-server = 14-npn-simple-resumption-server-extra
    556 client = 14-npn-simple-resumption-client-extra
    557 resume-client = 14-npn-simple-resumption-client-extra
    558 
    559 [14-npn-simple-resumption-server-extra]
    560 NPNProtocols = foo
    561 
    562 [14-npn-simple-resumption-client-extra]
    563 NPNProtocols = foo
    564 
    565 
    566 # ===========================================================
    567 
    568 [15-npn-server-switch-resumption]
    569 ssl_conf = 15-npn-server-switch-resumption-ssl
    570 
    571 [15-npn-server-switch-resumption-ssl]
    572 server = 15-npn-server-switch-resumption-server
    573 client = 15-npn-server-switch-resumption-client
    574 resume-server = 15-npn-server-switch-resumption-resume-server
    575 resume-client = 15-npn-server-switch-resumption-client
    576 
    577 [15-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 [15-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 [15-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-15]
     487server = 12-npn-simple-resumption-server-extra
     488resume-server = 12-npn-simple-resumption-server-extra
     489client = 12-npn-simple-resumption-client-extra
     490resume-client = 12-npn-simple-resumption-client-extra
     491
     492[12-npn-simple-resumption-server-extra]
     493NPNProtocols = foo
     494
     495[12-npn-simple-resumption-client-extra]
     496NPNProtocols = foo
     497
     498
     499# ===========================================================
     500
     501[13-npn-server-switch-resumption]
     502ssl_conf = 13-npn-server-switch-resumption-ssl
     503
     504[13-npn-server-switch-resumption-ssl]
     505server = 13-npn-server-switch-resumption-server
     506client = 13-npn-server-switch-resumption-client
     507resume-server = 13-npn-server-switch-resumption-resume-server
     508resume-client = 13-npn-server-switch-resumption-client
     509
     510[13-npn-server-switch-resumption-server]
     511Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     512CipherString = DEFAULT
     513PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     514
     515[13-npn-server-switch-resumption-resume-server]
     516Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     517CipherString = DEFAULT
     518PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     519
     520[13-npn-server-switch-resumption-client]
     521CipherString = DEFAULT
     522MaxProtocol = TLSv1.2
     523VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     524VerifyMode = Peer
     525
     526[test-13]
    594527ExpectedNPNProtocol = baz
    595528HandshakeMode = Resume
    596529ResumptionExpected = Yes
    597 server = 15-npn-server-switch-resumption-server-extra
    598 resume-server = 15-npn-server-switch-resumption-resume-server-extra
    599 client = 15-npn-server-switch-resumption-client-extra
    600 resume-client = 15-npn-server-switch-resumption-client-extra
    601 
    602 [15-npn-server-switch-resumption-server-extra]
     530server = 13-npn-server-switch-resumption-server-extra
     531resume-server = 13-npn-server-switch-resumption-resume-server-extra
     532client = 13-npn-server-switch-resumption-client-extra
     533resume-client = 13-npn-server-switch-resumption-client-extra
     534
     535[13-npn-server-switch-resumption-server-extra]
    603536NPNProtocols = bar,foo
    604537
    605 [15-npn-server-switch-resumption-resume-server-extra]
     538[13-npn-server-switch-resumption-resume-server-extra]
    606539NPNProtocols = baz,foo
    607540
    608 [15-npn-server-switch-resumption-client-extra]
     541[13-npn-server-switch-resumption-client-extra]
    609542NPNProtocols = foo,bar,baz
    610543
     
    612545# ===========================================================
    613546
    614 [16-npn-client-switch-resumption]
    615 ssl_conf = 16-npn-client-switch-resumption-ssl
    616 
    617 [16-npn-client-switch-resumption-ssl]
    618 server = 16-npn-client-switch-resumption-server
    619 client = 16-npn-client-switch-resumption-client
    620 resume-server = 16-npn-client-switch-resumption-server
    621 resume-client = 16-npn-client-switch-resumption-resume-client
    622 
    623 [16-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 [16-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 [16-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-16]
     547[14-npn-client-switch-resumption]
     548ssl_conf = 14-npn-client-switch-resumption-ssl
     549
     550[14-npn-client-switch-resumption-ssl]
     551server = 14-npn-client-switch-resumption-server
     552client = 14-npn-client-switch-resumption-client
     553resume-server = 14-npn-client-switch-resumption-server
     554resume-client = 14-npn-client-switch-resumption-resume-client
     555
     556[14-npn-client-switch-resumption-server]
     557Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     558CipherString = DEFAULT
     559PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     560
     561[14-npn-client-switch-resumption-client]
     562CipherString = DEFAULT
     563MaxProtocol = TLSv1.2
     564VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     565VerifyMode = Peer
     566
     567[14-npn-client-switch-resumption-resume-client]
     568CipherString = DEFAULT
     569MaxProtocol = TLSv1.2
     570VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     571VerifyMode = Peer
     572
     573[test-14]
    641574ExpectedNPNProtocol = bar
    642575HandshakeMode = Resume
    643576ResumptionExpected = Yes
    644 server = 16-npn-client-switch-resumption-server-extra
    645 resume-server = 16-npn-client-switch-resumption-server-extra
    646 client = 16-npn-client-switch-resumption-client-extra
    647 resume-client = 16-npn-client-switch-resumption-resume-client-extra
    648 
    649 [16-npn-client-switch-resumption-server-extra]
     577server = 14-npn-client-switch-resumption-server-extra
     578resume-server = 14-npn-client-switch-resumption-server-extra
     579client = 14-npn-client-switch-resumption-client-extra
     580resume-client = 14-npn-client-switch-resumption-resume-client-extra
     581
     582[14-npn-client-switch-resumption-server-extra]
    650583NPNProtocols = foo,bar,baz
    651584
    652 [16-npn-client-switch-resumption-client-extra]
     585[14-npn-client-switch-resumption-client-extra]
    653586NPNProtocols = foo,baz
    654587
    655 [16-npn-client-switch-resumption-resume-client-extra]
     588[14-npn-client-switch-resumption-resume-client-extra]
    656589NPNProtocols = bar,baz
    657590
     
    659592# ===========================================================
    660593
    661 [17-npn-client-first-pref-on-mismatch-resumption]
    662 ssl_conf = 17-npn-client-first-pref-on-mismatch-resumption-ssl
    663 
    664 [17-npn-client-first-pref-on-mismatch-resumption-ssl]
    665 server = 17-npn-client-first-pref-on-mismatch-resumption-server
    666 client = 17-npn-client-first-pref-on-mismatch-resumption-client
    667 resume-server = 17-npn-client-first-pref-on-mismatch-resumption-resume-server
    668 resume-client = 17-npn-client-first-pref-on-mismatch-resumption-client
    669 
    670 [17-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 [17-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 [17-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-17]
     594[15-npn-client-first-pref-on-mismatch-resumption]
     595ssl_conf = 15-npn-client-first-pref-on-mismatch-resumption-ssl
     596
     597[15-npn-client-first-pref-on-mismatch-resumption-ssl]
     598server = 15-npn-client-first-pref-on-mismatch-resumption-server
     599client = 15-npn-client-first-pref-on-mismatch-resumption-client
     600resume-server = 15-npn-client-first-pref-on-mismatch-resumption-resume-server
     601resume-client = 15-npn-client-first-pref-on-mismatch-resumption-client
     602
     603[15-npn-client-first-pref-on-mismatch-resumption-server]
     604Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     605CipherString = DEFAULT
     606PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     607
     608[15-npn-client-first-pref-on-mismatch-resumption-resume-server]
     609Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     610CipherString = DEFAULT
     611PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     612
     613[15-npn-client-first-pref-on-mismatch-resumption-client]
     614CipherString = DEFAULT
     615MaxProtocol = TLSv1.2
     616VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     617VerifyMode = Peer
     618
     619[test-15]
    687620ExpectedNPNProtocol = foo
    688621HandshakeMode = Resume
    689622ResumptionExpected = Yes
    690 server = 17-npn-client-first-pref-on-mismatch-resumption-server-extra
    691 resume-server = 17-npn-client-first-pref-on-mismatch-resumption-resume-server-extra
    692 client = 17-npn-client-first-pref-on-mismatch-resumption-client-extra
    693 resume-client = 17-npn-client-first-pref-on-mismatch-resumption-client-extra
    694 
    695 [17-npn-client-first-pref-on-mismatch-resumption-server-extra]
    696 NPNProtocols = bar
    697 
    698 [17-npn-client-first-pref-on-mismatch-resumption-resume-server-extra]
     623server = 15-npn-client-first-pref-on-mismatch-resumption-server-extra
     624resume-server = 15-npn-client-first-pref-on-mismatch-resumption-resume-server-extra
     625client = 15-npn-client-first-pref-on-mismatch-resumption-client-extra
     626resume-client = 15-npn-client-first-pref-on-mismatch-resumption-client-extra
     627
     628[15-npn-client-first-pref-on-mismatch-resumption-server-extra]
     629NPNProtocols = bar
     630
     631[15-npn-client-first-pref-on-mismatch-resumption-resume-server-extra]
    699632NPNProtocols = baz
    700633
    701 [17-npn-client-first-pref-on-mismatch-resumption-client-extra]
     634[15-npn-client-first-pref-on-mismatch-resumption-client-extra]
    702635NPNProtocols = foo,bar
    703636
     
    705638# ===========================================================
    706639
    707 [18-npn-no-server-support-resumption]
    708 ssl_conf = 18-npn-no-server-support-resumption-ssl
    709 
    710 [18-npn-no-server-support-resumption-ssl]
    711 server = 18-npn-no-server-support-resumption-server
    712 client = 18-npn-no-server-support-resumption-client
    713 resume-server = 18-npn-no-server-support-resumption-resume-server
    714 resume-client = 18-npn-no-server-support-resumption-client
    715 
    716 [18-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 [18-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 [18-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-18]
     640[16-npn-no-server-support-resumption]
     641ssl_conf = 16-npn-no-server-support-resumption-ssl
     642
     643[16-npn-no-server-support-resumption-ssl]
     644server = 16-npn-no-server-support-resumption-server
     645client = 16-npn-no-server-support-resumption-client
     646resume-server = 16-npn-no-server-support-resumption-resume-server
     647resume-client = 16-npn-no-server-support-resumption-client
     648
     649[16-npn-no-server-support-resumption-server]
     650Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     651CipherString = DEFAULT
     652PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     653
     654[16-npn-no-server-support-resumption-resume-server]
     655Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     656CipherString = DEFAULT
     657PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     658
     659[16-npn-no-server-support-resumption-client]
     660CipherString = DEFAULT
     661MaxProtocol = TLSv1.2
     662VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     663VerifyMode = Peer
     664
     665[test-16]
    733666HandshakeMode = Resume
    734667ResumptionExpected = Yes
    735 server = 18-npn-no-server-support-resumption-server-extra
    736 client = 18-npn-no-server-support-resumption-client-extra
    737 resume-client = 18-npn-no-server-support-resumption-client-extra
    738 
    739 [18-npn-no-server-support-resumption-server-extra]
    740 NPNProtocols = foo
    741 
    742 [18-npn-no-server-support-resumption-client-extra]
    743 NPNProtocols = foo
    744 
    745 
    746 # ===========================================================
    747 
    748 [19-npn-no-client-support-resumption]
    749 ssl_conf = 19-npn-no-client-support-resumption-ssl
    750 
    751 [19-npn-no-client-support-resumption-ssl]
    752 server = 19-npn-no-client-support-resumption-server
    753 client = 19-npn-no-client-support-resumption-client
    754 resume-server = 19-npn-no-client-support-resumption-server
    755 resume-client = 19-npn-no-client-support-resumption-resume-client
    756 
    757 [19-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 [19-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 [19-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-19]
     668server = 16-npn-no-server-support-resumption-server-extra
     669client = 16-npn-no-server-support-resumption-client-extra
     670resume-client = 16-npn-no-server-support-resumption-client-extra
     671
     672[16-npn-no-server-support-resumption-server-extra]
     673NPNProtocols = foo
     674
     675[16-npn-no-server-support-resumption-client-extra]
     676NPNProtocols = foo
     677
     678
     679# ===========================================================
     680
     681[17-npn-no-client-support-resumption]
     682ssl_conf = 17-npn-no-client-support-resumption-ssl
     683
     684[17-npn-no-client-support-resumption-ssl]
     685server = 17-npn-no-client-support-resumption-server
     686client = 17-npn-no-client-support-resumption-client
     687resume-server = 17-npn-no-client-support-resumption-server
     688resume-client = 17-npn-no-client-support-resumption-resume-client
     689
     690[17-npn-no-client-support-resumption-server]
     691Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     692CipherString = DEFAULT
     693PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     694
     695[17-npn-no-client-support-resumption-client]
     696CipherString = DEFAULT
     697MaxProtocol = TLSv1.2
     698VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     699VerifyMode = Peer
     700
     701[17-npn-no-client-support-resumption-resume-client]
     702CipherString = DEFAULT
     703MaxProtocol = TLSv1.2
     704VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     705VerifyMode = Peer
     706
     707[test-17]
    775708HandshakeMode = Resume
    776709ResumptionExpected = Yes
    777 server = 19-npn-no-client-support-resumption-server-extra
    778 resume-server = 19-npn-no-client-support-resumption-server-extra
    779 client = 19-npn-no-client-support-resumption-client-extra
    780 
    781 [19-npn-no-client-support-resumption-server-extra]
    782 NPNProtocols = foo
    783 
    784 [19-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-ssl
    792 
    793 [20-alpn-preferred-over-npn-resumption-ssl]
    794 server = 20-alpn-preferred-over-npn-resumption-server
    795 client = 20-alpn-preferred-over-npn-resumption-client
    796 resume-server = 20-alpn-preferred-over-npn-resumption-resume-server
    797 resume-client = 20-alpn-preferred-over-npn-resumption-client
    798 
    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]
     710server = 17-npn-no-client-support-resumption-server-extra
     711resume-server = 17-npn-no-client-support-resumption-server-extra
     712client = 17-npn-no-client-support-resumption-client-extra
     713
     714[17-npn-no-client-support-resumption-server-extra]
     715NPNProtocols = foo
     716
     717[17-npn-no-client-support-resumption-client-extra]
     718NPNProtocols = foo
     719
     720
     721# ===========================================================
     722
     723[18-alpn-preferred-over-npn-resumption]
     724ssl_conf = 18-alpn-preferred-over-npn-resumption-ssl
     725
     726[18-alpn-preferred-over-npn-resumption-ssl]
     727server = 18-alpn-preferred-over-npn-resumption-server
     728client = 18-alpn-preferred-over-npn-resumption-client
     729resume-server = 18-alpn-preferred-over-npn-resumption-resume-server
     730resume-client = 18-alpn-preferred-over-npn-resumption-client
     731
     732[18-alpn-preferred-over-npn-resumption-server]
     733Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     734CipherString = DEFAULT
     735PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     736
     737[18-alpn-preferred-over-npn-resumption-resume-server]
     738Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     739CipherString = DEFAULT
     740PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     741
     742[18-alpn-preferred-over-npn-resumption-client]
     743CipherString = DEFAULT
     744MaxProtocol = TLSv1.2
     745VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     746VerifyMode = Peer
     747
     748[test-18]
    816749ExpectedALPNProtocol = foo
    817750HandshakeMode = Resume
    818751ResumptionExpected = Yes
    819 server = 20-alpn-preferred-over-npn-resumption-server-extra
    820 resume-server = 20-alpn-preferred-over-npn-resumption-resume-server-extra
    821 client = 20-alpn-preferred-over-npn-resumption-client-extra
    822 resume-client = 20-alpn-preferred-over-npn-resumption-client-extra
    823 
    824 [20-alpn-preferred-over-npn-resumption-server-extra]
    825 NPNProtocols = bar
    826 
    827 [20-alpn-preferred-over-npn-resumption-resume-server-extra]
     752server = 18-alpn-preferred-over-npn-resumption-server-extra
     753resume-server = 18-alpn-preferred-over-npn-resumption-resume-server-extra
     754client = 18-alpn-preferred-over-npn-resumption-client-extra
     755resume-client = 18-alpn-preferred-over-npn-resumption-client-extra
     756
     757[18-alpn-preferred-over-npn-resumption-server-extra]
     758NPNProtocols = bar
     759
     760[18-alpn-preferred-over-npn-resumption-resume-server-extra]
    828761ALPNProtocols = foo
    829762NPNProtocols = baz
    830763
    831 [20-alpn-preferred-over-npn-resumption-client-extra]
     764[18-alpn-preferred-over-npn-resumption-client-extra]
    832765ALPNProtocols = foo
    833766NPNProtocols = bar,baz
     
    836769# ===========================================================
    837770
    838 [21-npn-used-if-alpn-not-supported-resumption]
    839 ssl_conf = 21-npn-used-if-alpn-not-supported-resumption-ssl
    840 
    841 [21-npn-used-if-alpn-not-supported-resumption-ssl]
    842 server = 21-npn-used-if-alpn-not-supported-resumption-server
    843 client = 21-npn-used-if-alpn-not-supported-resumption-client
    844 resume-server = 21-npn-used-if-alpn-not-supported-resumption-resume-server
    845 resume-client = 21-npn-used-if-alpn-not-supported-resumption-client
    846 
    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]
     772ssl_conf = 19-npn-used-if-alpn-not-supported-resumption-ssl
     773
     774[19-npn-used-if-alpn-not-supported-resumption-ssl]
     775server = 19-npn-used-if-alpn-not-supported-resumption-server
     776client = 19-npn-used-if-alpn-not-supported-resumption-client
     777resume-server = 19-npn-used-if-alpn-not-supported-resumption-resume-server
     778resume-client = 19-npn-used-if-alpn-not-supported-resumption-client
     779
     780[19-npn-used-if-alpn-not-supported-resumption-server]
     781Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     782CipherString = DEFAULT
     783PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     784
     785[19-npn-used-if-alpn-not-supported-resumption-resume-server]
     786Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     787CipherString = DEFAULT
     788PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     789
     790[19-npn-used-if-alpn-not-supported-resumption-client]
     791CipherString = DEFAULT
     792MaxProtocol = TLSv1.2
     793VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     794VerifyMode = Peer
     795
     796[test-19]
    864797ExpectedNPNProtocol = baz
    865798HandshakeMode = Resume
    866799ResumptionExpected = Yes
    867 server = 21-npn-used-if-alpn-not-supported-resumption-server-extra
    868 resume-server = 21-npn-used-if-alpn-not-supported-resumption-resume-server-extra
    869 client = 21-npn-used-if-alpn-not-supported-resumption-client-extra
    870 resume-client = 21-npn-used-if-alpn-not-supported-resumption-client-extra
    871 
    872 [21-npn-used-if-alpn-not-supported-resumption-server-extra]
     800server = 19-npn-used-if-alpn-not-supported-resumption-server-extra
     801resume-server = 19-npn-used-if-alpn-not-supported-resumption-resume-server-extra
     802client = 19-npn-used-if-alpn-not-supported-resumption-client-extra
     803resume-client = 19-npn-used-if-alpn-not-supported-resumption-client-extra
     804
     805[19-npn-used-if-alpn-not-supported-resumption-server-extra]
    873806ALPNProtocols = foo
    874807NPNProtocols = bar
    875808
    876 [21-npn-used-if-alpn-not-supported-resumption-resume-server-extra]
     809[19-npn-used-if-alpn-not-supported-resumption-resume-server-extra]
    877810NPNProtocols = baz
    878811
    879 [21-npn-used-if-alpn-not-supported-resumption-client-extra]
     812[19-npn-used-if-alpn-not-supported-resumption-client-extra]
    880813ALPNProtocols = foo
    881814NPNProtocols = bar,baz
  • trunk/src/libs/openssl-3.1.7/test/ssl-tests/08-npn.cnf.in

    r105945 r105949  
    11# -*- mode: perl; -*-
    2 # Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    112112    },
    113113    {
    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     {
    149114        name => "npn-with-sni-no-context-switch",
    150115        server => {
  • trunk/src/libs/openssl-3.1.7/test/ssl-tests/09-alpn.cnf

    r105945 r105949  
    11# Generated with generate_ssl_tests.pl
    22
    3 num_tests = 18
     3num_tests = 16
    44
    55test-0 = 0-alpn-simple
     
    1919test-14 = 14-alpn-no-server-support-resumption
    2020test-15 = 15-alpn-no-client-support-resumption
    21 test-16 = 16-alpn-empty-client-list
    22 test-17 = 17-alpn-empty-server-list
    2321# ===========================================================
    2422
     
    620618
    621619
    622 # ===========================================================
    623 
    624 [16-alpn-empty-client-list]
    625 ssl_conf = 16-alpn-empty-client-list-ssl
    626 
    627 [16-alpn-empty-client-list-ssl]
    628 server = 16-alpn-empty-client-list-server
    629 client = 16-alpn-empty-client-list-client
    630 
    631 [16-alpn-empty-client-list-server]
    632 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
    633 CipherString = DEFAULT
    634 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
    635 
    636 [16-alpn-empty-client-list-client]
    637 CipherString = DEFAULT
    638 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
    639 VerifyMode = Peer
    640 
    641 [test-16]
    642 server = 16-alpn-empty-client-list-server-extra
    643 client = 16-alpn-empty-client-list-client-extra
    644 
    645 [16-alpn-empty-client-list-server-extra]
    646 ALPNProtocols = foo
    647 
    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-ssl
    656 
    657 [17-alpn-empty-server-list-ssl]
    658 server = 17-alpn-empty-server-list-server
    659 client = 17-alpn-empty-server-list-client
    660 
    661 [17-alpn-empty-server-list-server]
    662 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
    663 CipherString = DEFAULT
    664 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
    665 
    666 [17-alpn-empty-server-list-client]
    667 CipherString = DEFAULT
    668 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
    669 VerifyMode = Peer
    670 
    671 [test-17]
    672 ExpectedResult = ServerFail
    673 ExpectedServerAlert = NoApplicationProtocol
    674 server = 17-alpn-empty-server-list-server-extra
    675 client = 17-alpn-empty-server-list-client-extra
    676 
    677 [17-alpn-empty-server-list-server-extra]
    678 ALPNProtocols =
    679 
    680 [17-alpn-empty-server-list-client-extra]
    681 ALPNProtocols = foo
    682 
    683 
  • trunk/src/libs/openssl-3.1.7/test/ssl-tests/09-alpn.cnf.in

    r105945 r105949  
    11# -*- mode: perl; -*-
    2 # Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    323323        },
    324324    },
    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     },
    358325);
  • trunk/src/libs/openssl-3.1.7/test/ssl-tests/14-curves.cnf.in

    r105945 r105949  
    1313our $fips_mode;
    1414
    15 my @curves = ("prime256v1", "secp384r1", "secp521r1");
    16 
    17 my @curves_no_fips = ("X25519", "X448");
    18 
    19 push @curves, @curves_no_fips if !$fips_mode;
     15my @curves = ("prime256v1", "secp384r1", "secp521r1", "X25519",
     16              "X448");
    2017
    2118#Curves *only* suitable for use in TLSv1.3
  • trunk/src/libs/openssl-3.1.7/test/ssl-tests/20-cert-select.cnf

    r105945 r105949  
    2020test-15 = 15-Ed25519 CipherString and Signature Algorithm Selection
    2121test-16 = 16-Ed448 CipherString and Signature Algorithm Selection
    22 test-17 = 17-TLS 1.2 Ed25519 Client Auth
    23 test-18 = 18-TLS 1.2 Ed448 Client Auth
    24 test-19 = 19-ECDSA Signature Algorithm Selection SHA1
    25 test-20 = 20-ECDSA with brainpool
    26 test-21 = 21-Ed25519 CipherString and Curves Selection
    27 test-22 = 22-Ed448 CipherString and Curves Selection
     22test-17 = 17-Ed25519 CipherString and Curves Selection
     23test-18 = 18-Ed448 CipherString and Curves Selection
     24test-19 = 19-TLS 1.2 Ed25519 Client Auth
     25test-20 = 20-TLS 1.2 Ed448 Client Auth
     26test-21 = 21-ECDSA Signature Algorithm Selection SHA1
     27test-22 = 22-ECDSA with brainpool
    2828test-23 = 23-RSA-PSS Certificate CipherString Selection
    2929test-24 = 24-RSA-PSS Certificate Legacy Signature Algorithm Selection
     
    603603# ===========================================================
    604604
    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]
     606ssl_conf = 17-Ed25519 CipherString and Curves Selection-ssl
     607
     608[17-Ed25519 CipherString and Curves Selection-ssl]
     609server = 17-Ed25519 CipherString and Curves Selection-server
     610client = 17-Ed25519 CipherString and Curves Selection-client
     611
     612[17-Ed25519 CipherString and Curves Selection-server]
     613Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     614CipherString = DEFAULT
     615ECDSA.Certificate = ${ENV::TEST_CERTS_DIR}/server-ecdsa-cert.pem
     616ECDSA.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ecdsa-key.pem
     617Ed25519.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed25519-cert.pem
     618Ed25519.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed25519-key.pem
     619Ed448.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed448-cert.pem
     620Ed448.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed448-key.pem
     621MaxProtocol = TLSv1.2
     622PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     623
     624[17-Ed25519 CipherString and Curves Selection-client]
     625CipherString = aECDSA
     626Curves = X25519
     627MaxProtocol = TLSv1.2
     628SignatureAlgorithms = ECDSA+SHA256:ed25519
     629VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
     630VerifyMode = Peer
     631
     632[test-17]
     633ExpectedResult = Success
     634ExpectedServerCertType = Ed25519
     635ExpectedServerSignType = Ed25519
     636
     637
     638# ===========================================================
     639
     640[18-Ed448 CipherString and Curves Selection]
     641ssl_conf = 18-Ed448 CipherString and Curves Selection-ssl
     642
     643[18-Ed448 CipherString and Curves Selection-ssl]
     644server = 18-Ed448 CipherString and Curves Selection-server
     645client = 18-Ed448 CipherString and Curves Selection-client
     646
     647[18-Ed448 CipherString and Curves Selection-server]
     648Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
     649CipherString = DEFAULT
     650ECDSA.Certificate = ${ENV::TEST_CERTS_DIR}/server-ecdsa-cert.pem
     651ECDSA.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ecdsa-key.pem
     652Ed25519.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed25519-cert.pem
     653Ed25519.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed25519-key.pem
     654Ed448.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed448-cert.pem
     655Ed448.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed448-key.pem
     656MaxProtocol = TLSv1.2
     657PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
     658
     659[18-Ed448 CipherString and Curves Selection-client]
     660CipherString = aECDSA
     661Curves = X448
     662MaxProtocol = TLSv1.2
     663SignatureAlgorithms = ECDSA+SHA256:ed448
     664VerifyCAFile = ${ENV::TEST_CERTS_DIR}/root-ed448-cert.pem
     665VerifyMode = Peer
     666
     667[test-18]
     668ExpectedResult = Success
     669ExpectedServerCertType = Ed448
     670ExpectedServerSignType = Ed448
     671
     672
     673# ===========================================================
     674
     675[19-TLS 1.2 Ed25519 Client Auth]
     676ssl_conf = 19-TLS 1.2 Ed25519 Client Auth-ssl
     677
     678[19-TLS 1.2 Ed25519 Client Auth-ssl]
     679server = 19-TLS 1.2 Ed25519 Client Auth-server
     680client = 19-TLS 1.2 Ed25519 Client Auth-client
     681
     682[19-TLS 1.2 Ed25519 Client Auth-server]
    613683Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
    614684CipherString = DEFAULT
     
    617687VerifyMode = Require
    618688
    619 [17-TLS 1.2 Ed25519 Client Auth-client]
     689[19-TLS 1.2 Ed25519 Client Auth-client]
    620690CipherString = DEFAULT
    621691Ed25519.Certificate = ${ENV::TEST_CERTS_DIR}/client-ed25519-cert.pem
     
    626696VerifyMode = Peer
    627697
    628 [test-17]
     698[test-19]
    629699ExpectedClientCertType = Ed25519
    630700ExpectedClientSignType = Ed25519
     
    634704# ===========================================================
    635705
    636 [18-TLS 1.2 Ed448 Client Auth]
    637 ssl_conf = 18-TLS 1.2 Ed448 Client Auth-ssl
    638 
    639 [18-TLS 1.2 Ed448 Client Auth-ssl]
    640 server = 18-TLS 1.2 Ed448 Client Auth-server
    641 client = 18-TLS 1.2 Ed448 Client Auth-client
    642 
    643 [18-TLS 1.2 Ed448 Client Auth-server]
     706[20-TLS 1.2 Ed448 Client Auth]
     707ssl_conf = 20-TLS 1.2 Ed448 Client Auth-ssl
     708
     709[20-TLS 1.2 Ed448 Client Auth-ssl]
     710server = 20-TLS 1.2 Ed448 Client Auth-server
     711client = 20-TLS 1.2 Ed448 Client Auth-client
     712
     713[20-TLS 1.2 Ed448 Client Auth-server]
    644714Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
    645715CipherString = DEFAULT
     
    648718VerifyMode = Require
    649719
    650 [18-TLS 1.2 Ed448 Client Auth-client]
     720[20-TLS 1.2 Ed448 Client Auth-client]
    651721CipherString = DEFAULT
    652722Ed448.Certificate = ${ENV::TEST_CERTS_DIR}/client-ed448-cert.pem
     
    657727VerifyMode = Peer
    658728
    659 [test-18]
     729[test-20]
    660730ExpectedClientCertType = Ed448
    661731ExpectedClientSignType = Ed448
     
    665735# ===========================================================
    666736
    667 [19-ECDSA Signature Algorithm Selection SHA1]
    668 ssl_conf = 19-ECDSA Signature Algorithm Selection SHA1-ssl
    669 
    670 [19-ECDSA Signature Algorithm Selection SHA1-ssl]
    671 server = 19-ECDSA Signature Algorithm Selection SHA1-server
    672 client = 19-ECDSA Signature Algorithm Selection SHA1-client
    673 
    674 [19-ECDSA Signature Algorithm Selection SHA1-server]
     737[21-ECDSA Signature Algorithm Selection SHA1]
     738ssl_conf = 21-ECDSA Signature Algorithm Selection SHA1-ssl
     739
     740[21-ECDSA Signature Algorithm Selection SHA1-ssl]
     741server = 21-ECDSA Signature Algorithm Selection SHA1-server
     742client = 21-ECDSA Signature Algorithm Selection SHA1-client
     743
     744[21-ECDSA Signature Algorithm Selection SHA1-server]
    675745Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
    676746CipherString = DEFAULT:@SECLEVEL=0
     
    684754PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
    685755
    686 [19-ECDSA Signature Algorithm Selection SHA1-client]
     756[21-ECDSA Signature Algorithm Selection SHA1-client]
    687757CipherString = DEFAULT:@SECLEVEL=0
    688758SignatureAlgorithms = ECDSA+SHA1
     
    690760VerifyMode = Peer
    691761
    692 [test-19]
     762[test-21]
    693763ExpectedResult = Success
    694764ExpectedServerCertType = P-256
     
    699769# ===========================================================
    700770
    701 [20-ECDSA with brainpool]
    702 ssl_conf = 20-ECDSA with brainpool-ssl
    703 
    704 [20-ECDSA with brainpool-ssl]
    705 server = 20-ECDSA with brainpool-server
    706 client = 20-ECDSA with brainpool-client
    707 
    708 [20-ECDSA with brainpool-server]
     771[22-ECDSA with brainpool]
     772ssl_conf = 22-ECDSA with brainpool-ssl
     773
     774[22-ECDSA with brainpool-ssl]
     775server = 22-ECDSA with brainpool-server
     776client = 22-ECDSA with brainpool-client
     777
     778[22-ECDSA with brainpool-server]
    709779Certificate = ${ENV::TEST_CERTS_DIR}/server-ecdsa-brainpoolP256r1-cert.pem
    710780CipherString = DEFAULT
     
    712782PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ecdsa-brainpoolP256r1-key.pem
    713783
    714 [20-ECDSA with brainpool-client]
     784[22-ECDSA with brainpool-client]
    715785CipherString = aECDSA
    716786Groups = brainpoolP256r1
     
    720790VerifyMode = Peer
    721791
    722 [test-20]
     792[test-22]
    723793ExpectedResult = Success
    724794ExpectedServerCANames = empty
    725795ExpectedServerCertType = brainpoolP256r1
    726796ExpectedServerSignType = EC
    727 
    728 
    729 # ===========================================================
    730 
    731 [21-Ed25519 CipherString and Curves Selection]
    732 ssl_conf = 21-Ed25519 CipherString and Curves Selection-ssl
    733 
    734 [21-Ed25519 CipherString and Curves Selection-ssl]
    735 server = 21-Ed25519 CipherString and Curves Selection-server
    736 client = 21-Ed25519 CipherString and Curves Selection-client
    737 
    738 [21-Ed25519 CipherString and Curves Selection-server]
    739 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
    740 CipherString = DEFAULT
    741 ECDSA.Certificate = ${ENV::TEST_CERTS_DIR}/server-ecdsa-cert.pem
    742 ECDSA.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ecdsa-key.pem
    743 Ed25519.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed25519-cert.pem
    744 Ed25519.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed25519-key.pem
    745 Ed448.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed448-cert.pem
    746 Ed448.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed448-key.pem
    747 MaxProtocol = TLSv1.2
    748 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
    749 
    750 [21-Ed25519 CipherString and Curves Selection-client]
    751 CipherString = aECDSA
    752 Curves = X25519
    753 MaxProtocol = TLSv1.2
    754 SignatureAlgorithms = ECDSA+SHA256:ed25519
    755 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
    756 VerifyMode = Peer
    757 
    758 [test-21]
    759 ExpectedResult = Success
    760 ExpectedServerCertType = Ed25519
    761 ExpectedServerSignType = Ed25519
    762 
    763 
    764 # ===========================================================
    765 
    766 [22-Ed448 CipherString and Curves Selection]
    767 ssl_conf = 22-Ed448 CipherString and Curves Selection-ssl
    768 
    769 [22-Ed448 CipherString and Curves Selection-ssl]
    770 server = 22-Ed448 CipherString and Curves Selection-server
    771 client = 22-Ed448 CipherString and Curves Selection-client
    772 
    773 [22-Ed448 CipherString and Curves Selection-server]
    774 Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
    775 CipherString = DEFAULT
    776 ECDSA.Certificate = ${ENV::TEST_CERTS_DIR}/server-ecdsa-cert.pem
    777 ECDSA.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ecdsa-key.pem
    778 Ed25519.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed25519-cert.pem
    779 Ed25519.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed25519-key.pem
    780 Ed448.Certificate = ${ENV::TEST_CERTS_DIR}/server-ed448-cert.pem
    781 Ed448.PrivateKey = ${ENV::TEST_CERTS_DIR}/server-ed448-key.pem
    782 MaxProtocol = TLSv1.2
    783 PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem
    784 
    785 [22-Ed448 CipherString and Curves Selection-client]
    786 CipherString = aECDSA
    787 Curves = X448
    788 MaxProtocol = TLSv1.2
    789 SignatureAlgorithms = ECDSA+SHA256:ed448
    790 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/root-ed448-cert.pem
    791 VerifyMode = Peer
    792 
    793 [test-22]
    794 ExpectedResult = Success
    795 ExpectedServerCertType = Ed448
    796 ExpectedServerSignType = Ed448
    797797
    798798
  • trunk/src/libs/openssl-3.1.7/test/ssl-tests/20-cert-select.cnf.in

    r105945 r105949  
    330330    },
    331331    {
     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    {
    332367        name => "TLS 1.2 Ed25519 Client Auth",
    333368        server => {
     
    409444            # Note: certificate_authorities not sent for TLS < 1.3
    410445            "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 server
    422             # certificate should be Ed25519 and not P-256
    423             "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 server
    440             # certificate should be Ed25519 and not P-256
    441             "Curves" => "X448"
    442         },
    443         test   => {
    444             "ExpectedServerCertType" =>, "Ed448",
    445             "ExpectedServerSignType" =>, "Ed448",
    446446            "ExpectedResult" => "Success"
    447447        },
  • trunk/src/libs/openssl-3.1.7/test/ssl-tests/28-seclevel.cnf.in

    r105945 r105949  
    11# -*- mode: perl; -*-
    2 # Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2# Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
    33#
    44# Licensed under the Apache License 2.0 (the "License").  You may not use
     
    5757                    "VerifyCAFile" => test_pem("root-ed448-cert.pem") },
    5858        test   => { "ExpectedResult" => "ServerFail" },
    59     }
    60 );
    61 
    62 our @tests_ec_non_fips = (
     59    },
    6360    {
    6461        name => "SECLEVEL 3 with P-384 key, X25519 ECDHE",
     
    8582);
    8683
    87 push @tests_ec, @tests_ec_non_fips unless $fips_mode;
    8884push @tests, @tests_ec unless disabled("ec");
    8985push @tests, @tests_tls1_2 unless disabled("tls1_2") || disabled("ec");
  • trunk/src/libs/openssl-3.1.7/test/sslapitest.c

    r105945 r105949  
    11/*
    2  * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    24102410}
    24112411
     2412
    24122413#ifndef OSSL_NO_USABLE_TLS1_3
    24132414static SSL_SESSION *sesscache[6];
     
    34973498}
    34983499
    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 allowance
    3505      * between writing the early data and reading it. If we exceed that time
    3506      * then this test will fail. This can sometimes (rarely) occur in normal CI
    3507      * operation. We can try and detect this and just ignore the result of this
    3508      * test if it has taken too long. We assume anything over 7 seconds is too
    3509      * long
    3510      */
    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 
    35183500static int test_early_data_read_write(int idx)
    35193501{
     
    35253507    size_t readbytes, written, eoedlen, rawread, rawwritten;
    35263508    BIO *rbio;
    3527     time_t timer;
    35283509
    35293510    if (!TEST_true(setupearly_data_test(&cctx, &sctx, &clientssl,
     
    35333514
    35343515    /* Write and read some early data */
    3535     timer = time(NULL);
    35363516    if (!TEST_true(SSL_write_early_data(clientssl, MSG1, strlen(MSG1),
    35373517                                        &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))
    35493523            || !TEST_int_eq(SSL_get_early_data_status(serverssl),
    35503524                            SSL_EARLY_DATA_ACCEPTED))
     
    37633737    size_t readbytes, written;
    37643738    unsigned char buf[20];
    3765     time_t timer;
    37663739
    37673740    allow_ed_cb_called = 0;
     
    38183791
    38193792    /* Write and read some early data */
    3820     timer = time(NULL);
    38213793    if (!TEST_true(SSL_write_early_data(clientssl, MSG1, strlen(MSG1),
    38223794                                        &written))
     
    38393811        if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf),
    38403812                                             &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)
    38463815                   /*
    38473816                    * Server will have sent its flight so client can now send
     
    39463915            goto end;
    39473916#else
    3948         if (!TEST_true(SSL_set1_groups_list(serverssl, "P-384")))
     3917        if (!TEST_true(SSL_set1_groups_list(serverssl, "P-256")))
    39493918            goto end;
    39503919#endif
     
    43604329            goto end;
    43614330    } else {
    4362         time_t timer = time(NULL);
    4363 
    43644331        if (!TEST_true(SSL_write_early_data(clientssl, MSG1, strlen(MSG1),
    43654332                                            &written)))
     
    43674334
    43684335        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
    43754338                    && !TEST_mem_eq(buf, readbytes, MSG1, strlen(MSG1)))
    43764339                || !TEST_int_eq(SSL_get_early_data_status(serverssl), edstatus)
     
    44104373    size_t readbytes, written;
    44114374    const SSL_CIPHER *cipher;
    4412     time_t timer;
    44134375    const char *cipher_str[] = {
    44144376        TLS1_3_RFC_AES_128_GCM_SHA256,
     
    44624424
    44634425    SSL_set_connect_state(clientssl);
    4464     timer = time(NULL);
    44654426    if (!TEST_true(SSL_write_early_data(clientssl, MSG1, strlen(MSG1),
    44664427                                        &written)))
     
    44694430    if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf),
    44704431                                         &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))
    44774434            || !TEST_int_eq(SSL_get_early_data_status(serverssl),
    44784435                                                      SSL_EARLY_DATA_ACCEPTED)
     
    49154872            break;
    49164873        case 4:
    4917             if (is_fips)
    4918                 return TEST_skip("X25519 might not be supported by fips provider.");
    49194874            kexch_alg = NID_X25519;
    49204875            kexch_name0 = "x25519";
    49214876            break;
    49224877        case 5:
    4923             if (is_fips)
    4924                 return TEST_skip("X448 might not be supported by fips provider.");
    49254878            kexch_alg = NID_X448;
    49264879            kexch_name0 = "x448";
     
    51375090        expectednid = kexch_alg;
    51385091
    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 
    51425092    if (!istls13)
    51435093        max_version = TLS1_2_VERSION;
     
    55615511        goto end;
    55625512#else
    5563     if (!TEST_true(SSL_set1_groups_list(serverssl, "P-384")))
     5513    if (!TEST_true(SSL_set1_groups_list(serverssl, "P-256")))
    55645514        goto end;
    55655515#endif
     
    75257475        size_t written, readbytes;
    75267476        unsigned char buf[80];
    7527         time_t timer;
    75287477
    75297478        /* early_data tests */
     
    75407489
    75417490        /* Write and read some early data and then complete the connection */
    7542         timer = time(NULL);
    75437491        if (!TEST_true(SSL_write_early_data(clientssl, MSG1, strlen(MSG1),
    75447492                                            &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))
    75567498                || !TEST_int_eq(SSL_get_early_data_status(serverssl),
    75577499                                SSL_EARLY_DATA_ACCEPTED)
     
    90218963
    90228964/*
    9023  * Test that a session cache overflow works as expected
    9024  * Test 0: TLSv1.3, timeout on new session later than old session
    9025  * Test 1: TLSv1.2, timeout on new session later than old session
    9026  * Test 2: TLSv1.3, timeout on new session earlier than old session
    9027  * Test 3: TLSv1.2, timeout on new session earlier than old session
    9028  */
    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_3
    9038     /* 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 #endif
    9042 #ifdef OPENSSL_NO_TLS1_2
    9043     /* 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 #endif
    9047 
    9048     if (!TEST_true(create_ssl_ctx_pair(libctx, TLS_server_method(),
    9049                                        TLS_client_method(), TLS1_VERSION,
    9050                                        (idx % 2 == 0) ? TLS1_3_VERSION
    9051                                                       : 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 to
    9075          * 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 session
    9092      * 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 the
    9104      * 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 /*
    91438965 * Test 0: Client sets servername and server acknowledges it (TLSv1.2)
    91448966 * Test 1: Client sets servername and server does not acknowledge it (TLSv1.2)
     
    94559277    /* Check that we are not impacted by a provider without any groups */
    94569278    OSSL_PROVIDER *legacyprov = OSSL_PROVIDER_load(libctx, "legacy");
    9457     const char *group_name = idx == 0 ? "xorkemgroup" : "xorgroup";
     9279    const char *group_name = idx == 0 ? "xorgroup" : "xorkemgroup";
    94589280
    94599281    if (!TEST_ptr(tlsprov))
    94609282        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    }
    94619292
    94629293    if (!TEST_true(create_ssl_ctx_pair(libctx, TLS_server_method(),
     
    94699300        goto end;
    94709301
    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))
    94749303            || !TEST_true(SSL_set1_groups_list(clientssl, group_name)))
    94759304        goto end;
     
    1049410323
    1049510324#if !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_DYNAMIC_ENGINE)
     10325
     10326static 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
    1049610346/*
    1049710347 * Test TLSv1.2 with a pipeline capable cipher. TLSv1.3 and DTLS do not
     
    1078510635    BIO_free(tmp);
    1078610636    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 using
    10800  * the same session - and mark the session as not_resuamble at the end
    10801  */
    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 will
    10824      * 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 handling
    10842  * 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.2
    10847  */
    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 #else
    10861     if (idx == 4)
    10862         max_version = TLS1_2_VERSION;
    10863 #endif
    10864 #if defined(OSSL_NO_USABLE_TLS1_3)
    10865     if (idx != 4)
    10866         return TEST_skip("No usable TLSv1.3 in this build");
    10867 #endif
    10868 
    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 for
    10877      * replay protection), or if SSL_OP_NO_TICKET is in use
    10878      */
    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 through
    10904          * the handshake by (mis)using the servername_cb. The pause occurs after
    10905          * session resumption has already occurred, but before any session
    10906          * tickets have been issued. While paused we run another complete
    10907          * 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 value
    10916          * 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 callbacks
    11152  * Test 0: advert = foo, select = foo
    11153  * Test 1: advert = <empty>, select = foo
    11154  * Test 2: no advert
    11155  * Test 3: advert = foo, select = bar
    11156  * 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 callbacks
    11251  * Test 0: client = foo, select = foo
    11252  * Test 1: client = <empty>, select = none
    11253  * 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 
    1132010637    return testresult;
    1132110638}
     
    1160610923    ADD_TEST(test_set_verify_cert_store_ssl);
    1160710924    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 #endif
    1161110925    ADD_TEST(test_load_dhfile);
    1161210926#ifndef OSSL_NO_USABLE_TLS1_3
     
    1162110935#endif
    1162210936    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 #endif
    11628     ADD_ALL_TESTS(test_alpn, 4);
    1162910937    return 1;
    1163010938
  • trunk/src/libs/openssl-3.1.7/test/sslbuffertest.c

    r105945 r105949  
    11/*
    2  * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License");
     
    99 */
    1010
    11 /*
    12  * We need access to the deprecated low level Engine APIs for legacy purposes
    13  * when the deprecated calls are not hidden
    14  */
    15 #ifndef OPENSSL_NO_DEPRECATED_3_0
    16 # define OPENSSL_SUPPRESS_DEPRECATED
    17 #endif
    18 
    1911#include <string.h>
    2012#include <openssl/ssl.h>
    2113#include <openssl/bio.h>
    2214#include <openssl/err.h>
    23 #include <openssl/engine.h>
    2415
    2516#include "internal/packet.h"
     
    160151}
    161152
    162 /*
    163  * Test that attempting to free the buffers at points where they cannot be freed
    164  * works as expected
    165  * Test 0: Attempt to free buffers after a full record has been processed, but
    166  *         the application has only performed a partial read
    167  * Test 1: Attempt to free buffers after only a partial record header has been
    168  *         received
    169  * Test 2: Attempt to free buffers after a full record header but no record body
    170  * Test 3: Attempt to free buffers after a full record hedaer and partial record
    171  *         body
    172  * Test 4-7: We repeat tests 0-3 but including data from a second pipelined
    173  *           record
    174  */
    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 write
    210      * 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 are
    223          * still buffered. In the pipelining case we read as far as the first
    224          * 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 should
    267              * 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 in
    275          * 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 the
    283              * first record. Only a partial record is available for the second
    284              * 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 is
    293             * 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 are
    303      * still in use
    304      */
    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_ENGINE
    313     if (e != NULL) {
    314         ENGINE_unregister_ciphers(e);
    315         ENGINE_finish(e);
    316         ENGINE_free(e);
    317     }
    318 #endif
    319     return result;
    320 }
    321 
    322153OPT_TEST_DECLARE_USAGE("certfile privkeyfile\n")
    323154
     
    343174
    344175    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 #else
    348     ADD_ALL_TESTS(test_free_buffers, 4);
    349 #endif
    350176    return 1;
    351177}
  • trunk/src/libs/openssl-3.1.7/test/test.cnf

    r105945 r105949  
    7373emailAddress                    = email field
    7474emailAddress_value              = [email protected]
    75 
    76 [ dirname_sec ]
    77 C  = UK
    78 O  = My Organization
    79 OU = My Unit
    80 CN = My Name
  • trunk/src/libs/openssl-3.1.7/test/tls-provider.c

    r105945 r105949  
    11/*
    2  * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    186186
    187187    /* Register our 2 groups */
    188     OPENSSL_assert(xor_group.group_id >= 65024
    189                    && xor_group.group_id < 65279 - NUM_DUMMY_GROUPS);
    190188    ret = cb(xor_group_params, arg);
    191189    ret &= cb(xor_kemgroup_params, arg);
     
    199197    for (i = 0; i < NUM_DUMMY_GROUPS; i++) {
    200198        OSSL_PARAM dummygroup[OSSL_NELEM(xor_group_params)];
    201         unsigned int dummygroup_id;
    202199
    203200        memcpy(dummygroup, xor_group_params, sizeof(xor_group_params));
     
    214211        dummygroup[0].data = dummy_group_names[i];
    215212        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;
    219213        ret &= cb(dummygroup, arg);
    220214    }
     
    824818    /*
    825819     * 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)
    828821     */
    829     group_id %= 65279 - NUM_DUMMY_GROUPS - 65024;
     822    group_id %= 65279 - 65024;
    830823    group_id += 65024;
    831824
  • trunk/src/libs/openssl-3.1.7/test/v3ext.c

    r105945 r105949  
    11/*
    2  * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    270270    if (!ASN1_OCTET_STRING_set(f1->addressFamily, key, keylen))
    271271        goto end;
    272 
    273     /* Push and transfer memory ownership to stack */
    274272    if (!sk_IPAddressFamily_push(addr, f1))
    275273        goto end;
    276     f1 = NULL;
    277274
    278275    /* Shouldn't be able to canonize this as the len is > 3*/
     
    280277        goto end;
    281278
    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
    286283    key[0] = (afi >> 8) & 0xFF;
    287284    key[1] = afi & 0xFF;
     
    301298    /* Mark this as inheritance so we skip some of the is_canonize checks */
    302299    f1->ipAddressChoice->type = IPAddressChoice_inherit;
    303 
    304     /* Push and transfer memory ownership to stack */
    305300    if (!sk_IPAddressFamily_push(addr, f1))
    306301        goto end;
    307     f1 = NULL;
    308302
    309303    /* Should be able to canonize now */
     
    313307    testresult = 1;
    314308  end:
    315     /* Free stack and any memory owned by detached element */
    316     IPAddressFamily_free(f1);
    317309    sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free);
    318 
    319310    ASN1_OCTET_STRING_free(ip1);
    320311    ASN1_OCTET_STRING_free(ip2);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette