After I do the SSL initialization, I do the following in my server code.
   while(1){
      if((s=accept(sock,0,0))<0)
        err_exit("Problem accepting");

      sbio=BIO_new_socket(s,BIO_NOCLOSE);
      ssl=SSL_new(ctx);
      SSL_set_bio(ssl,sbio,sbio);

      SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, verify_callback);
      if((r=SSL_accept(ssl)<=0))
        err_exit("SSL accept error");

      peer = SSL_get_peer_certificate(ssl);
      if (peer == NULL) {
         printf("Null presented by peer \n");
      }

The first time the client connects and does the SSL handhshake, when the
server makes a request for a client certificate, it gets a NULL. But on
subsequent calls from the client, the server is able to get the client
certificate. 
What could be going wrong the first time this happens?
If I make it SSL_set_verify() instead of SSL_CTX_set_verify(), the server
gets the peer certificate but the callback function is not called.
I am confused as to why this is happening and would appreciate any ideas to
solving this problem.

Thanks

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

Reply via email to