Topic: Connecting to Gmail with CyaSSL?

[Migrated from SourceForge forums]

josh12
(2009-06-12 02:19:40 UTC)

I use openSSL, it works well, but the code is too large, I had to change the lib, so CyaSSL.  When SSL_connrc(), return error is there any problem?  I have alredy used SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);

josh12
(2009-06-12 02:23:41 UTC)

here is my code:

method  = SSLv3_client_method();
ctx     = SSL_CTX_new(method);

printf("connect tcp\r\n");
tcp_connect(&sockfd, SMTP_IP, SMTP_PORT);

printf("connected tcp\r\n");
SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);

ssl = SSL_new(ctx);
SSL_set_fd(ssl, sockfd);

if (SSL_connect(ssl) != SSL_SUCCESS) // see note at top of README /
       err_sys("SSL_connect failed");// if you're getting an error here  /
else
{
    printf("SSL connect OK!\r\n");
}


touska
(2009-06-12 02:39:40 UTC)

CyaSSL embedded SSL library can connect with gmail.  From the examples/client directory enter:

./client gmail.google.com 443

to see that it can.

Are you sure you're using the right IP address and port?  Are you using the right SSL version?  You should be using TLS unless you have a good reason not to.  Why are you using SMTP, that's not inherently SSL/TLS?  You what error are you getting from SSL_get_error()?

With these answers we should be able to figure out the problem.


josh12
(2009-06-12 07:53:22 UTC)

It works well now,Thanks for your help