Kaydet (Commit) 97c810f6 authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Openssl 1.1 compilation problem `my_bio_method` fixed.

Maked changes under the guidance of https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
üst 482e4ba6
......@@ -24,10 +24,9 @@ static int init_done;
static int
my_bio_create (BIO *b)
{
b->init = 1;
b->num = 0;
b->ptr = NULL;
b->flags = 0 ;
BIO_set_init(b, 1); //b->init = 1;
BIO_set_data(b, NULL); // b->ptr = NULL;
BIO_set_flags(b, 0); //b->flags = 0 ;
return 1;
}
......@@ -35,17 +34,17 @@ static int
my_bio_destroy (BIO *b)
{
if (b == 0) return 0;
BIO_set_init(b, 0); //b->init = 0;
BIO_set_data(b, NULL); // b->ptr = NULL;
BIO_set_flags(b, 0); //b->flags = 0 ;
b->ptr = NULL;
b->init = 0;
b->flags = 0;
return 1;
}
static int
my_bio_read (BIO *b, char *buf, int len)
{
struct ikstls_data *data = (struct ikstls_data *) b->ptr;
struct ikstls_data *data = (struct ikstls_data *) BIO_get_data(b);
int ret;
if (buf == NULL || len <= 0 || data == NULL) return 0;
......@@ -58,7 +57,7 @@ my_bio_read (BIO *b, char *buf, int len)
static int
my_bio_write (BIO *b, const char *buf, int len)
{
struct ikstls_data *data = (struct ikstls_data *) b->ptr;
struct ikstls_data *data = (struct ikstls_data *) BIO_get_data(b);
int ret;
if (buf == NULL || len <= 0 || data == NULL) return 0;
......@@ -96,17 +95,27 @@ my_bio_puts (BIO *b, const char *str)
return my_bio_write (b, str, strlen(str));
}
static BIO_METHOD my_bio_method = {
( 100 | 0x400 ),
"iksemel transport",
my_bio_write,
my_bio_read,
my_bio_puts,
my_bio_gets,
my_bio_ctrl,
my_bio_create,
my_bio_destroy
};
static BIO_METHOD *my_bio_method;
/* Return the method table for the iksemel transport BIO */
static BIO_METHOD *
BIO_s_iksemel_tbio(void)
{
if (my_bio_method == NULL) {
my_bio_method = BIO_meth_new(( 100 | 0x400 ),
"iksemel transport");
if (my_bio_method == NULL)
return NULL;
BIO_meth_set_write(my_bio_method, my_bio_write);
BIO_meth_set_read(my_bio_method, my_bio_read);
BIO_meth_set_puts(my_bio_method, my_bio_puts);
BIO_meth_set_gets(my_bio_method, my_bio_gets);
BIO_meth_set_ctrl(my_bio_method, my_bio_ctrl);
BIO_meth_set_create(my_bio_method, my_bio_create);
BIO_meth_set_destroy(my_bio_method, my_bio_destroy);
}
return my_bio_method;
}
static int
tls_handshake (struct ikstls_data **datap, ikstransport *trans, void *sock)
......@@ -144,8 +153,8 @@ tls_handshake (struct ikstls_data **datap, ikstransport *trans, void *sock)
return IKS_NOMEM;
}
bio = BIO_new (&my_bio_method);
bio->ptr = (void *) data;
bio = BIO_new (BIO_s_iksemel_tbio());
BIO_set_data(bio, (void *) data);
SSL_set_bio (data->ssl, bio, bio);
if (SSL_connect (data->ssl) < 0) {
SSL_free (data->ssl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment