summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bio_cb.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/bio/bio_cb.c78
1 files changed, 41 insertions, 37 deletions
diff --git a/src/lib/libcrypto/bio/bio_cb.c b/src/lib/libcrypto/bio/bio_cb.c
index 78c8974ab4..3e110f3751 100644
--- a/src/lib/libcrypto/bio/bio_cb.c
+++ b/src/lib/libcrypto/bio/bio_cb.c
@@ -63,81 +63,85 @@
63#include <openssl/bio.h> 63#include <openssl/bio.h>
64#include <openssl/err.h> 64#include <openssl/err.h>
65 65
66long BIO_debug_callback(BIO *bio, int cmd, const char *argp, 66long
67 int argi, long argl, long ret) 67BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl,
68 { 68 long ret)
69{
69 BIO *b; 70 BIO *b;
70 char buf[256]; 71 char buf[256];
71 char *p; 72 char *p;
72 long r=1; 73 long r = 1;
73 size_t p_maxlen; 74 size_t p_maxlen;
74 75
75 if (BIO_CB_RETURN & cmd) 76 if (BIO_CB_RETURN & cmd)
76 r=ret; 77 r = ret;
77 78
78 (void) snprintf(buf,sizeof buf,"BIO[%08lX]:",(unsigned long)bio); 79 (void) snprintf(buf, sizeof buf, "BIO[%08lX]:", (unsigned long)bio);
79 p= &(buf[14]); 80 p = &(buf[14]);
80 p_maxlen = sizeof buf - 14; 81 p_maxlen = sizeof buf - 14;
81 switch (cmd) 82 switch (cmd) {
82 {
83 case BIO_CB_FREE: 83 case BIO_CB_FREE:
84 (void) snprintf(p,p_maxlen,"Free - %s\n",bio->method->name); 84 (void) snprintf(p, p_maxlen, "Free - %s\n", bio->method->name);
85 break; 85 break;
86 case BIO_CB_READ: 86 case BIO_CB_READ:
87 if (bio->method->type & BIO_TYPE_DESCRIPTOR) 87 if (bio->method->type & BIO_TYPE_DESCRIPTOR)
88 (void) snprintf(p,p_maxlen,"read(%d,%lu) - %s fd=%d\n", 88 (void) snprintf(p, p_maxlen,
89 bio->num,(unsigned long)argi, 89 "read(%d,%lu) - %s fd=%d\n",
90 bio->method->name,bio->num); 90 bio->num,(unsigned long)argi,
91 bio->method->name, bio->num);
91 else 92 else
92 (void) snprintf(p,p_maxlen,"read(%d,%lu) - %s\n", 93 (void) snprintf(p, p_maxlen, "read(%d,%lu) - %s\n",
93 bio->num,(unsigned long)argi, 94 bio->num, (unsigned long)argi, bio->method->name);
94 bio->method->name);
95 break; 95 break;
96 case BIO_CB_WRITE: 96 case BIO_CB_WRITE:
97 if (bio->method->type & BIO_TYPE_DESCRIPTOR) 97 if (bio->method->type & BIO_TYPE_DESCRIPTOR)
98 (void) snprintf(p,p_maxlen,"write(%d,%lu) - %s fd=%d\n", 98 (void) snprintf(p, p_maxlen,
99 bio->num,(unsigned long)argi, 99 "write(%d,%lu) - %s fd=%d\n",
100 bio->method->name,bio->num); 100 bio->num, (unsigned long)argi,
101 bio->method->name, bio->num);
101 else 102 else
102 (void) snprintf(p,p_maxlen,"write(%d,%lu) - %s\n", 103 (void) snprintf(p, p_maxlen, "write(%d,%lu) - %s\n",
103 bio->num,(unsigned long)argi, 104 bio->num, (unsigned long)argi, bio->method->name);
104 bio->method->name);
105 break; 105 break;
106 case BIO_CB_PUTS: 106 case BIO_CB_PUTS:
107 (void) snprintf(p,p_maxlen,"puts() - %s\n",bio->method->name); 107 (void) snprintf(p, p_maxlen,
108 "puts() - %s\n", bio->method->name);
108 break; 109 break;
109 case BIO_CB_GETS: 110 case BIO_CB_GETS:
110 (void) snprintf(p,p_maxlen,"gets(%lu) - %s\n",(unsigned long)argi,bio->method->name); 111 (void) snprintf(p, p_maxlen, "gets(%lu) - %s\n",
112 (unsigned long)argi, bio->method->name);
111 break; 113 break;
112 case BIO_CB_CTRL: 114 case BIO_CB_CTRL:
113 (void) snprintf(p,p_maxlen,"ctrl(%lu) - %s\n",(unsigned long)argi,bio->method->name); 115 (void) snprintf(p, p_maxlen, "ctrl(%lu) - %s\n",
116 (unsigned long)argi, bio->method->name);
114 break; 117 break;
115 case BIO_CB_RETURN|BIO_CB_READ: 118 case BIO_CB_RETURN|BIO_CB_READ:
116 (void) snprintf(p,p_maxlen,"read return %ld\n",ret); 119 (void) snprintf(p, p_maxlen, "read return %ld\n", ret);
117 break; 120 break;
118 case BIO_CB_RETURN|BIO_CB_WRITE: 121 case BIO_CB_RETURN|BIO_CB_WRITE:
119 (void) snprintf(p,p_maxlen,"write return %ld\n",ret); 122 (void) snprintf(p, p_maxlen, "write return %ld\n", ret);
120 break; 123 break;
121 case BIO_CB_RETURN|BIO_CB_GETS: 124 case BIO_CB_RETURN|BIO_CB_GETS:
122 (void) snprintf(p,p_maxlen,"gets return %ld\n",ret); 125 (void) snprintf(p, p_maxlen, "gets return %ld\n", ret);
123 break; 126 break;
124 case BIO_CB_RETURN|BIO_CB_PUTS: 127 case BIO_CB_RETURN|BIO_CB_PUTS:
125 (void) snprintf(p,p_maxlen,"puts return %ld\n",ret); 128 (void) snprintf(p, p_maxlen, "puts return %ld\n", ret);
126 break; 129 break;
127 case BIO_CB_RETURN|BIO_CB_CTRL: 130 case BIO_CB_RETURN|BIO_CB_CTRL:
128 (void) snprintf(p,p_maxlen,"ctrl return %ld\n",ret); 131 (void) snprintf(p, p_maxlen, "ctrl return %ld\n", ret);
129 break; 132 break;
130 default: 133 default:
131 (void) snprintf(p,p_maxlen,"bio callback - unknown type (%d)\n",cmd); 134 (void) snprintf(p, p_maxlen,
135 "bio callback - unknown type (%d)\n", cmd);
132 break; 136 break;
133 } 137 }
134 138
135 b=(BIO *)bio->cb_arg; 139 b = (BIO *)bio->cb_arg;
136 if (b != NULL) 140 if (b != NULL)
137 BIO_write(b,buf,strlen(buf)); 141 BIO_write(b, buf, strlen(buf));
138#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) 142#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16)
139 else 143 else
140 fputs(buf,stderr); 144 fputs(buf, stderr);
141#endif 145#endif
142 return(r); 146 return (r);
143 } 147}