Changeset 94082 in vbox for trunk/src/libs/openssl-3.0.1/crypto/bio/bio_cb.c
- Timestamp:
- Mar 3, 2022 7:17:34 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 150325
- 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 12 12 /vendor/openssl/1.1.1c:131722-131725 13 13 /vendor/openssl/1.1.1k:145841-145843 14 /vendor/openssl/3.0.1:150323-150324 15 /vendor/openssl/current:147554-150322
-
- Property svn:mergeinfo
-
trunk/src/libs/openssl-3.0.1/crypto/bio/bio_cb.c
r91772 r94082 1 1 /* 2 * Copyright 1995-20 17The OpenSSL Project Authors. All Rights Reserved.2 * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. 3 3 * 4 * Licensed under the OpenSSL license(the "License"). You may not use4 * Licensed under the Apache License 2.0 (the "License"). You may not use 5 5 * this file except in compliance with the License. You can obtain a copy 6 6 * in the file LICENSE in the source distribution or at 7 7 * https://www.openssl.org/source/license.html 8 8 */ 9 10 #define OPENSSL_SUPPRESS_DEPRECATED 9 11 10 12 #include <stdio.h> … … 15 17 #include <openssl/err.h> 16 18 17 long BIO_debug_callback (BIO *bio, int cmd, const char *argp,18 int argi, long argl, long ret)19 long BIO_debug_callback_ex(BIO *bio, int cmd, const char *argp, size_t len, 20 int argi, long argl, int ret, size_t *processed) 19 21 { 20 22 BIO *b; 21 23 char buf[256]; 22 24 char *p; 23 long r = 1;24 int len, left;25 int left; 26 size_t l = 0; 25 27 26 if ( BIO_CB_RETURN & cmd)27 r = ret;28 if (processed != NULL) 29 l = *processed; 28 30 29 le n= BIO_snprintf(buf, sizeof(buf), "BIO[%p]: ", (void *)bio);31 left = BIO_snprintf(buf, sizeof(buf), "BIO[%p]: ", (void *)bio); 30 32 31 33 /* Ignore errors and continue printing the other information. */ 32 if (le n< 0)33 le n= 0;34 p = buf + le n;35 left = sizeof(buf) - le n;34 if (left < 0) 35 left = 0; 36 p = buf + left; 37 left = sizeof(buf) - left; 36 38 37 39 switch (cmd) { … … 41 43 case BIO_CB_READ: 42 44 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, 45 47 bio->method->name, bio->num); 46 48 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); 49 51 break; 50 52 case BIO_CB_WRITE: 51 53 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, 54 56 bio->method->name, bio->num); 55 57 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); 58 60 break; 59 61 case BIO_CB_PUTS: … … 61 63 break; 62 64 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, 64 66 bio->method->name); 65 67 break; 66 68 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, 68 70 bio->method->name); 69 71 break; 70 72 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); 72 74 break; 73 75 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); 75 77 break; 76 78 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); 78 80 break; 79 81 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); 81 83 break; 82 84 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); 84 86 break; 85 87 default: … … 95 97 fputs(buf, stderr); 96 98 #endif 97 return r ;99 return ret; 98 100 } 101 102 #ifndef OPENSSL_NO_DEPRECATED_3_0 103 long 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.