1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
-
+
-
+
-
-
+
+
|
/*
* Copyright (C) 1997-2000 Matt Newman <[email protected]>
*
* $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tlsBIO.c,v 1.5 2000/08/18 19:17:36 hobbs Exp $
* $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tlsBIO.c,v 1.6 2002/02/04 22:46:31 hobbs Exp $
*
* Provides BIO layer to interface openssl to Tcl.
*/
#include "tlsInt.h"
/*
* Forward declarations
*/
static int BioWrite _ANSI_ARGS_ ((BIO *h, char *buf, int num));
static int BioWrite _ANSI_ARGS_ ((BIO *h, CONST char *buf, int num));
static int BioRead _ANSI_ARGS_ ((BIO *h, char *buf, int num));
static int BioPuts _ANSI_ARGS_ ((BIO *h, char *str));
static long BioCtrl _ANSI_ARGS_ ((BIO *h, int cmd, long arg1, char *ptr));
static int BioPuts _ANSI_ARGS_ ((BIO *h, CONST char *str));
static long BioCtrl _ANSI_ARGS_ ((BIO *h, int cmd, long arg1, CONST char *ptr));
static int BioNew _ANSI_ARGS_ ((BIO *h));
static int BioFree _ANSI_ARGS_ ((BIO *h));
static BIO_METHOD BioMethods = {
BIO_TYPE_TCL, "tcl",
BioWrite,
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
-
+
|
{
return &BioMethods;
}
static int
BioWrite (bio, buf, bufLen)
BIO *bio;
char *buf;
CONST char *buf;
int bufLen;
{
Tcl_Channel chan = Tls_GetParent((State*)(bio->ptr));
int ret;
dprintf(stderr,"\nBioWrite(0x%x, <buf>, %d) [0x%x]",
(unsigned int) bio, bufLen, (unsigned int) chan);
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
-
+
-
+
|
}
return ret;
}
static int
BioPuts (bio, str)
BIO *bio;
char *str;
CONST char *str;
{
return BioWrite(bio, str, strlen(str));
}
static long
BioCtrl (bio, cmd, num, ptr)
BIO *bio;
int cmd;
long num;
char *ptr;
CONST char *ptr;
{
Tcl_Channel chan = Tls_GetParent((State*)bio->ptr);
long ret = 1;
int *ip;
dprintf(stderr,"\nBioCtrl(0x%x, 0x%x, 0x%x, 0x%x)",
(unsigned int) bio, (unsigned int) cmd, (unsigned int) num,
|