VirtualBox

Ignore:
Timestamp:
Sep 4, 2024 11:32:47 AM (8 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164679
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
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/openssl-3.1.7

    • Property svn:mergeinfo
      •  

        old new  
        2525/vendor/openssl/3.0.3:151497-151729
        2626/vendor/openssl/3.0.7:154371
         27/vendor/openssl/3.1.7:164675-164677
  • trunk/src/libs/openssl-3.1.7/test/crltest.c

    r104078 r105945  
    11/*
    2  * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    44 * Licensed under the Apache License 2.0 (the "License").  You may not use
     
    102102};
    103103
     104static const char *kInvalidCRL[] = {
     105    "-----BEGIN X509 CRL-----\n",
     106    "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n",
     107    "-----END X509 CRL-----\n",
     108    NULL
     109};
     110
    104111static const char *kBadIssuerCRL[] = {
    105112    "-----BEGIN X509 CRL-----\n",
     
    372379}
    373380
    374 static int test_reuse_crl(void)
    375 {
    376     X509_CRL *reused_crl = CRL_from_strings(kBasicCRL);
    377     char *p;
    378     BIO *b = glue2bio(kRevokedCRL, &p);
    379 
    380     if (b == NULL) {
    381         OPENSSL_free(p);
    382         X509_CRL_free(reused_crl);
    383         return 0;
     381static 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;
    384396    }
    385397
    386     reused_crl = PEM_read_bio_X509_CRL(b, &reused_crl, NULL, NULL);
    387 
     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:
    388428    OPENSSL_free(p);
    389429    BIO_free(b);
    390430    X509_CRL_free(reused_crl);
    391     return 1;
     431    X509_CRL_free(addref_crl);
     432    return r;
    392433}
    393434
     
    403444    ADD_TEST(test_known_critical_crl);
    404445    ADD_ALL_TESTS(test_unknown_critical_crl, OSSL_NELEM(unknown_critical_crls));
    405     ADD_TEST(test_reuse_crl);
     446    ADD_ALL_TESTS(test_reuse_crl, 6);
    406447    return 1;
    407448}
Note: See TracChangeset for help on using the changeset viewer.

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