VirtualBox

Ignore:
Timestamp:
Mar 3, 2022 7:17:34 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
150325
Message:

libs/openssl-3.0.1: started applying and adjusting our OpenSSL changes to 3.0.1. bugref:10128

Location:
trunk/src/libs/openssl-3.0.1
Files:
2 edited

Legend:

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

    • Property svn:mergeinfo
      •  

        old new  
        1212/vendor/openssl/1.1.1c:131722-131725
        1313/vendor/openssl/1.1.1k:145841-145843
         14/vendor/openssl/3.0.1:150323-150324
         15/vendor/openssl/current:147554-150322
  • trunk/src/libs/openssl-3.0.1/crypto/bio/bio_cb.c

    r91772 r94082  
    11/*
    2  * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
     2 * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
    33 *
    4  * Licensed under the OpenSSL license (the "License").  You may not use
     4 * Licensed under the Apache License 2.0 (the "License").  You may not use
    55 * this file except in compliance with the License.  You can obtain a copy
    66 * in the file LICENSE in the source distribution or at
    77 * https://www.openssl.org/source/license.html
    88 */
     9
     10#define OPENSSL_SUPPRESS_DEPRECATED
    911
    1012#include <stdio.h>
     
    1517#include <openssl/err.h>
    1618
    17 long BIO_debug_callback(BIO *bio, int cmd, const char *argp,
    18                         int argi, long argl, long ret)
     19long BIO_debug_callback_ex(BIO *bio, int cmd, const char *argp, size_t len,
     20                           int argi, long argl, int ret, size_t *processed)
    1921{
    2022    BIO *b;
    2123    char buf[256];
    2224    char *p;
    23     long r = 1;
    24     int len, left;
     25    int left;
     26    size_t l = 0;
    2527
    26     if (BIO_CB_RETURN & cmd)
    27         r = ret;
     28    if (processed != NULL)
     29        l = *processed;
    2830
    29     len = BIO_snprintf(buf, sizeof(buf), "BIO[%p]: ", (void *)bio);
     31    left = BIO_snprintf(buf, sizeof(buf), "BIO[%p]: ", (void *)bio);
    3032
    3133    /* Ignore errors and continue printing the other information. */
    32     if (len < 0)
    33         len = 0;
    34     p = buf + len;
    35     left = sizeof(buf) - len;
     34    if (left < 0)
     35        left = 0;
     36    p = buf + left;
     37    left = sizeof(buf) - left;
    3638
    3739    switch (cmd) {
     
    4143    case BIO_CB_READ:
    4244        if (bio->method->type & BIO_TYPE_DESCRIPTOR)
    43             BIO_snprintf(p, left, "read(%d,%lu) - %s fd=%d\n",
    44                          bio->num, (unsigned long)argi,
     45            BIO_snprintf(p, left, "read(%d,%zu) - %s fd=%d\n",
     46                         bio->num, len,
    4547                         bio->method->name, bio->num);
    4648        else
    47             BIO_snprintf(p, left, "read(%d,%lu) - %s\n",
    48                     bio->num, (unsigned long)argi, bio->method->name);
     49            BIO_snprintf(p, left, "read(%d,%zu) - %s\n",
     50                    bio->num, len, bio->method->name);
    4951        break;
    5052    case BIO_CB_WRITE:
    5153        if (bio->method->type & BIO_TYPE_DESCRIPTOR)
    52             BIO_snprintf(p, left, "write(%d,%lu) - %s fd=%d\n",
    53                          bio->num, (unsigned long)argi,
     54            BIO_snprintf(p, left, "write(%d,%zu) - %s fd=%d\n",
     55                         bio->num, len,
    5456                         bio->method->name, bio->num);
    5557        else
    56             BIO_snprintf(p, left, "write(%d,%lu) - %s\n",
    57                          bio->num, (unsigned long)argi, bio->method->name);
     58            BIO_snprintf(p, left, "write(%d,%zu) - %s\n",
     59                         bio->num, len, bio->method->name);
    5860        break;
    5961    case BIO_CB_PUTS:
     
    6163        break;
    6264    case BIO_CB_GETS:
    63         BIO_snprintf(p, left, "gets(%lu) - %s\n", (unsigned long)argi,
     65        BIO_snprintf(p, left, "gets(%zu) - %s\n", len,
    6466                     bio->method->name);
    6567        break;
    6668    case BIO_CB_CTRL:
    67         BIO_snprintf(p, left, "ctrl(%lu) - %s\n", (unsigned long)argi,
     69        BIO_snprintf(p, left, "ctrl(%d) - %s\n", argi,
    6870                     bio->method->name);
    6971        break;
    7072    case BIO_CB_RETURN | BIO_CB_READ:
    71         BIO_snprintf(p, left, "read return %ld\n", ret);
     73        BIO_snprintf(p, left, "read return %d processed: %zu\n", ret, l);
    7274        break;
    7375    case BIO_CB_RETURN | BIO_CB_WRITE:
    74         BIO_snprintf(p, left, "write return %ld\n", ret);
     76        BIO_snprintf(p, left, "write return %d processed: %zu\n", ret, l);
    7577        break;
    7678    case BIO_CB_RETURN | BIO_CB_GETS:
    77         BIO_snprintf(p, left, "gets return %ld\n", ret);
     79        BIO_snprintf(p, left, "gets return %d processed: %zu\n", ret, l);
    7880        break;
    7981    case BIO_CB_RETURN | BIO_CB_PUTS:
    80         BIO_snprintf(p, left, "puts return %ld\n", ret);
     82        BIO_snprintf(p, left, "puts return %d processed: %zu\n", ret, l);
    8183        break;
    8284    case BIO_CB_RETURN | BIO_CB_CTRL:
    83         BIO_snprintf(p, left, "ctrl return %ld\n", ret);
     85        BIO_snprintf(p, left, "ctrl return %d\n", ret);
    8486        break;
    8587    default:
     
    9597        fputs(buf, stderr);
    9698#endif
    97     return r;
     99    return ret;
    98100}
     101
     102#ifndef OPENSSL_NO_DEPRECATED_3_0
     103long BIO_debug_callback(BIO *bio, int cmd, const char *argp,
     104                        int argi, long argl, long ret)
     105{
     106    size_t processed = 0;
     107
     108    if (ret > 0)
     109        processed = (size_t)ret;
     110    BIO_debug_callback_ex(bio, cmd, argp, (size_t)argi,
     111                          argi, argl, ret > 0 ? 1 : (int)ret, &processed);
     112    return ret;
     113}
     114#endif
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