Scheltema, R.A. wrote:
> 
> Hi all,
> 
> I'm currently working on an implementation of a program using openssl. In
> this program it would be extremely usefull if I could pass data to the
> callback-functions in the way, for example, the thread call-back method is
> done (or x-event-methods, ...). The password method would look like:
> 
> struct myData {
>    // ...
> };
> 
> static int __supply_passwd(char *buf, int len, int WhatIsThis, void *data) {
>    struct myData *md = (myData *) data;
>    // ...
> }
> 
> int main() {
>    myData *d = new myData;
>    SSL_CTX_set_default_passwd_cb(m_ctx, &__supply_passwd, (void *) d);
>    // ...
>    return 0;
> }
> 
> With the current situation it is, according to me, impossible to do this. Or
> am I wrong? If not is it an option for future releases ??
> 

I think the best you can currently do is either have one callback for
each piece of data or some yucky global variable version with thread
specific data and appropriate locks.

Adding an extra parameter to the password callbacks is a much cleaner
way of handling things. Unfortunately lots of functions use them (e.g.
PEM stuff) and it will break quite a lot of code (but all they will need
is an extra parameter set to NULL) and its rather a large change.

It is IMHO well worth doing so it may well appear in a future release.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to