home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mlddc320.zip / secure.c < prev    next >
C/C++ Source or Header  |  1997-12-16  |  619b  |  38 lines

  1. /*  Copyright 1997 Artur Skawina <skawina@usa.net>
  2.  *  All Rights Reserved.
  3.  */
  4.         
  5. #include "netio.h"
  6.  
  7. #include "secure.h"
  8.    
  9.    
  10. static   SSL_CTX  *ctx;
  11.    
  12.    
  13. void ssl_init( void )
  14. {
  15.    SSL_load_error_strings();
  16.    SSLeay_add_ssl_algorithms();
  17.      
  18.    ctx=SSL_CTX_new( SSLv23_client_method() );      /* setup a context */
  19. }
  20.  
  21. SSL *ssl_connect( const char *hostname, const int port )
  22. {
  23.    int      fd;
  24.    SSL      *ssl;
  25.     
  26.       /* create a new SSL structure */
  27.       
  28.    ssl = SSL_new( ctx );
  29.  
  30.    fd = Connect( hostname, port );
  31.    
  32.    SSL_set_fd( ssl, fd );
  33.    
  34.    SSL_connect( ssl );
  35.    
  36.    return ssl;
  37. }
  38.