Hi Kurt,

I think I have a C problem.

I do not understand how the compiler enable to use the pointer ctx.
ctx is not declared in the routine parameters nor in the routine body.

What is the purpose of:
int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(SSL *ssl, SSL_SESSION *sess)
   {
    return ctx->new_session_cb;
    }

Is it part of the ssl infrastructure or for external user who links with ssl library ?

Best reagrds,
Zvika

-----Original Message----- From: Kurt Roeckx
Sent: Sunday, June 07, 2015 12:51 AM
To: [email protected]
Subject: Re: [openssl-dev] ssl_sess.c : compilation error

On Sun, Jun 07, 2015 at 12:17:06AM +0300, Zvi Vered wrote:
Dear Members,

In the file openssl-1.0.1g\ssl\ssl_sess.c contains the following code:

int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(SSL *ssl, SSL_SESSION *sess)
    {
    return ctx->new_session_cb;
    }

The return value of this routine is a "pointer to function".
But the code :

ctx->new_session_cb

uses a parameter of the return value. How this is possible ?

The function without return type is:
SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)

The return value is a function that looks like:
int new_session_cb(struct ssl_st *ssl, SSL_SESSION *sess)

I hope that explains it.

I'm trying to compile this code using diab compiler for vxworks6.3 and
I have a syntax error.

Using this compiler for vxWorks 6.9 (newer compiler) gives no syntax
error.

Is there another way to write this code ?

You can make typedefs that might make it easier for you to
understand it, but I would hope that makes no differences for a
compiler.

You could also try to just remove that function in case you don't
need it in your application.


Kurt

_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

Reply via email to