Revert "Missing perldoc markup around < literal"
[openssl.git] / demos / ssl / cli.cpp
index b3d726961f5dee18fda170c1bf4b34fc10f7e379..3459f0f93ac1010b0419b2a02f2170b29fb2d297 100644 (file)
@@ -14,7 +14,6 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 
-#include "rsa.h"       /* SSLeay stuff */
 #include <openssl/crypto.h>
 #include <openssl/x509.h>
 #include <openssl/pem.h>
@@ -39,18 +38,16 @@ void main ()
   SSL_METHOD *meth;
 
   SSLeay_add_ssl_algorithms();
-  meth = SSLv2_client_method();
+  meth = TLS_client_method();
   SSL_load_error_strings();
   ctx = SSL_CTX_new (meth);                        CHK_NULL(ctx);
 
-  CHK_SSL(err);
-  
   /* ----------------------------------------------- */
   /* Create a socket and connect to server using normal socket calls. */
   
   sd = socket (AF_INET, SOCK_STREAM, 0);       CHK_ERR(sd, "socket");
  
-  memset (&sa, '\0', sizeof(sa));
+  memset(&sa, 0, sizeof(sa));
   sa.sin_family      = AF_INET;
   sa.sin_addr.s_addr = inet_addr ("127.0.0.1");   /* Server IP */
   sa.sin_port        = htons     (1111);          /* Server Port number */
@@ -80,12 +77,12 @@ void main ()
   str = X509_NAME_oneline (X509_get_subject_name (server_cert),0,0);
   CHK_NULL(str);
   printf ("\t subject: %s\n", str);
-  Free (str);
+  OPENSSL_free (str);
 
   str = X509_NAME_oneline (X509_get_issuer_name  (server_cert),0,0);
   CHK_NULL(str);
   printf ("\t issuer: %s\n", str);
-  Free (str);
+  OPENSSL_free (str);
 
   /* We could do all sorts of certificate verification stuff here before
      deallocating the certificate. */