>All endianness problems should be handled by ntoh... and
>hton... macros/functions.  I have never checked whether everything is
>really done right, but if handled correctly, things like that don't
>cause problems.

Is OpenSSL running on any big-endian machines?  (Uh oh-- I always get 
that wrong.  I believe that x86 CPU's are little-endian, and PPC's are 
big-endian.  Please correct me if wrong.  At the very least, I'm sure 
they're opposite in terms of endian-ness.)


>If it works -- why not.  Also note that as a generic interface you
>could use a BIO pair (not in 0.9.3a, but in the snapshots -- see
>ftp://ftp.openssl.org/snapshot), where one end is given to the SSL
>library and the other end is handled by the application (it reads
>data written by the library and writes and to whatever I/O medium it
>wants to use, and similarly it relays data from the network to the
>library).  This approach leads to more copying of bytes than is
>strictly necessary, but it means that the library need not
>necessarily know about the real I/O interface.

That's what I was hoping to be able to do-- just add my own funky 
Macintosh BIO.  Throughput is not important in this case, so extra byte 
copying matters not.


The thing that stinks right now is that I've got a sample source file 
that works nicely when run on my x86 Linux box, but it doesn't work 
correctly on my Mac.  I connect to the https IP/port, ssl claims that the 
connection is RC4-MD5, then I get an error while writing data to the 
connection via SSL_write() (error = -1).  As I say, this works correctly 
on my Linux box though.

I suppose another good question would be:  What does a simple sample of 
code to read an https response look like?  I'm doing something like this:


        SSL_load_error_strings();
        
        SSLeay_add_ssl_algorithms();
        
        
< open socket connection to a secure port on a web server; check errors, 
of course >
        

        ssl_ctx = SSL_CTX_new(SSLv23_client_method());
        
        ssl = SSL_new(ssl_ctx);
        
        SSL_set_fd(ssl,theSocket);
        
        if (SSL_connect(ssl) < 0)
        {
                perror("SSL_connect failed");
        }
        
        printf("SSL connection using %s\n",SSL_get_cipher(ssl));



        strcpy(tempString,"GET / HTTP/1.0\n\r\n\r");

        bytesWritten = SSL_write(ssl,tempString,strlen(tempString));
        
        shutdown(theSocket,1);


        for (;;)
        {
        int             bytesRead;
                
                bytesRead = SSL_read(ssl,tempString,sizeof(tempString) - 1);
                
                if (bytesRead < 0)
                {
                        perror("Error reading socket, read()");
                        
                        break;
                }
                
                if (bytesRead == 0)
                {
                        break;
                }
                
                
                tempString[bytesRead] = '\0';
                
                printf(tempString);
        }
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to