apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r597895 - in /apr/apr-util/trunk/ssl: apr_ssl.c apr_ssl_openssl.c apr_ssl_winsock.c
Date Sat, 24 Nov 2007 17:29:37 GMT
Author: minfrin
Date: Sat Nov 24 09:29:36 2007
New Revision: 597895

URL: http://svn.apache.org/viewvc?rev=597895&view=rev
Log:
Correct style. No functional change.

Modified:
    apr/apr-util/trunk/ssl/apr_ssl.c
    apr/apr-util/trunk/ssl/apr_ssl_openssl.c
    apr/apr-util/trunk/ssl/apr_ssl_winsock.c

Modified: apr/apr-util/trunk/ssl/apr_ssl.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/ssl/apr_ssl.c?rev=597895&r1=597894&r2=597895&view=diff
==============================================================================
--- apr/apr-util/trunk/ssl/apr_ssl.c (original)
+++ apr/apr-util/trunk/ssl/apr_ssl.c Sat Nov 24 09:29:36 2007
@@ -35,13 +35,12 @@
 
 static int sslInit = 0;
 
-APU_DECLARE(apr_status_t) apr_ssl_factory_create(apr_ssl_factory_t **fact,
+APU_DECLARE(apr_status_t) apr_ssl_factory_create(apr_ssl_factory_t ** fact,
                                                  const char *privateKeyFn,
                                                  const char *certFn,
                                                  const char *digestType,
                                                  apr_ssl_factory_type_e why,
-                                                 apr_pool_t *p)
-
+                                                 apr_pool_t * p)
 {
     apr_ssl_factory_t *asf;
     apr_status_t rv;
@@ -53,16 +52,16 @@
     if (!asf)
         return ENOMEM;
 
-    if (! sslInit) {
+    if (!sslInit) {
         if (apu_ssl_init() != APR_SUCCESS)
-            return APR_EGENERAL; /* ?? error code ?? */
+            return APR_EGENERAL;/* ?? error code ?? */
         sslInit = 1;
     }
 
     *fact = NULL;
     asf->pool = p;
     asf->purpose = why;
-    if ((rv = apu_ssl_factory_create(asf, privateKeyFn, certFn, 
+    if ((rv = apu_ssl_factory_create(asf, privateKeyFn, certFn,
                                      digestType)) != APR_SUCCESS)
         return rv;
 
@@ -76,15 +75,14 @@
     return APU_SSL_LIBRARY;
 }
 
-#else /* ! APU_HAVE_SSL */
+#else                                /* ! APU_HAVE_SSL */
 
-APU_DECLARE(apr_status_t) apr_ssl_factory_create(apr_ssl_factory_t **fact,
+APU_DECLARE(apr_status_t) apr_ssl_factory_create(apr_ssl_factory_t ** fact,
                                                  const char *privateKeyFn,
                                                  const char *certFn,
                                                  const char *digestType,
                                                  apr_ssl_factory_type_e why,
-                                                 apr_pool_t *p)
-
+                                                 apr_pool_t * p)
 {
     return APR_ENOTIMPL;
 }
@@ -94,4 +92,4 @@
     return NULL;
 }
 
-#endif /* APU_HAVE_SSL */
+#endif                                /* APU_HAVE_SSL */

Modified: apr/apr-util/trunk/ssl/apr_ssl_openssl.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/ssl/apr_ssl_openssl.c?rev=597895&r1=597894&r2=597895&view=diff
==============================================================================
--- apr/apr-util/trunk/ssl/apr_ssl_openssl.c (original)
+++ apr/apr-util/trunk/ssl/apr_ssl_openssl.c Sat Nov 24 09:29:36 2007
@@ -52,7 +52,7 @@
  * TODO - this should be expanded to generate the correct APR_ errors
  *        when we have created the mappings :-)
  */
-static void openssl_get_error(apr_ssl_socket_t *sock, int fncode)
+static void openssl_get_error(apr_ssl_socket_t * sock, int fncode)
 {
     sock->sslData->err = fncode;
     sock->sslData->sslErr = SSL_get_error(sock->sslData->ssl, fncode);
@@ -61,10 +61,10 @@
 /* The apr_ssl_factory_t structure will have the pool and purpose
  * fields set only.
  */
-APU_DECLARE(apr_status_t) apu_ssl_factory_create(apr_ssl_factory_t *asf,
-                                 const char *privateKeyFn,
-                                 const char *certFn,
-                                 const char *digestType)
+APU_DECLARE(apr_status_t) apu_ssl_factory_create(apr_ssl_factory_t * asf,
+                                                 const char *privateKeyFn,
+                                                 const char *certFn,
+                                                 const char *digestType)
 {
     apu_ssl_data_t *sslData = apr_pcalloc(asf->pool, sizeof(*sslData));
     if (!sslData) {
@@ -76,16 +76,17 @@
         if (sslData->ctx) {
             if (!SSL_CTX_use_PrivateKey_file(sslData->ctx, privateKeyFn,
                                              SSL_FILETYPE_PEM) ||
-                !SSL_CTX_use_certificate_file(sslData->ctx, certFn, 
+                !SSL_CTX_use_certificate_file(sslData->ctx, certFn,
                                               SSL_FILETYPE_PEM) ||
                 !SSL_CTX_check_private_key(sslData->ctx)) {
                 SSL_CTX_free(sslData->ctx);
-                return APR_ENOENT; /* what code should we return? */
+                return APR_ENOENT;        /* what code should we return? */
             }
         }
-    } else {
+    }
+    else {
         sslData->ctx = SSL_CTX_new(SSLv23_client_method());
-    }   
+    }
 
     if (digestType) {
         sslData->md = EVP_get_digestbyname(digestType);
@@ -93,17 +94,17 @@
     }
 
     if (!sslData->ctx)
-        return APR_EGENERAL; /* what error code? */
+        return APR_EGENERAL;        /* what error code? */
 
     asf->sslData = sslData;
 
     return APR_SUCCESS;
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_socket_create(apr_ssl_socket_t *sslSock, 
-                                   apr_ssl_factory_t *asf)
+APU_DECLARE(apr_status_t) apu_ssl_socket_create(apr_ssl_socket_t * sslSock,
+                                                apr_ssl_factory_t * asf)
 {
-    apu_ssl_socket_data_t *sslData = apr_pcalloc(sslSock->pool, 
+    apu_ssl_socket_data_t *sslData = apr_pcalloc(sslSock->pool,
                                                  sizeof(*sslData));
     apr_os_sock_t fd;
 
@@ -115,12 +116,13 @@
     }
     sslData->ssl = SSL_new(asf->sslData->ctx);
     if (!sslData->ssl) {
-        return APR_EINVALSOCK; /* Hmm, better error code? */
+        return APR_EINVALSOCK;        /* Hmm, better error code? */
     }
 
-    /* Joe Orton points out this is actually wrong and assumes that
-     * that we're on an "fd" system. We need some better way of handling
-     * this for systems that don't use fd's for sockets. Will?
+    /*
+     * Joe Orton points out this is actually wrong and assumes that that
+     * we're on an "fd" system. We need some better way of handling this for
+     * systems that don't use fd's for sockets. Will?
      */
     if (apr_os_sock_get(&fd, sslSock->plain) != APR_SUCCESS)
         return APR_EINVALSOCK;
@@ -130,7 +132,7 @@
     return APR_SUCCESS;
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_socket_close(apr_ssl_socket_t *sock)
+APU_DECLARE(apr_status_t) apu_ssl_socket_close(apr_ssl_socket_t * sock)
 {
     int sslRv;
 
@@ -141,14 +143,14 @@
         if ((sslRv = SSL_shutdown(sock->sslData->ssl)) == 0)
             sslRv = SSL_shutdown(sock->sslData->ssl);
         if (sslRv == -1)
-            return APR_EINVALSOCK; /* Better error code to return? */
+            return APR_EINVALSOCK;        /* Better error code to return? */
     }
     SSL_free(sock->sslData->ssl);
     sock->sslData->ssl = NULL;
     return APR_SUCCESS;
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_connect(apr_ssl_socket_t *sock)
+APU_DECLARE(apr_status_t) apu_ssl_connect(apr_ssl_socket_t * sock)
 {
     int sslOp;
 
@@ -163,8 +165,8 @@
     return APR_EGENERAL;
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_send(apr_ssl_socket_t *sock, const char *buf, 
-                                       apr_size_t *len)
+APU_DECLARE(apr_status_t) apu_ssl_send(apr_ssl_socket_t * sock, const char *buf,
+                                       apr_size_t * len)
 {
     int sslOp;
 
@@ -174,11 +176,11 @@
         return APR_SUCCESS;
     }
     openssl_get_error(sock, sslOp);
-    return APR_EGENERAL; /* SSL error? */
+    return APR_EGENERAL;        /* SSL error? */
 }
 
 APU_DECLARE(apr_status_t) apu_ssl_recv(apr_ssl_socket_t * sock,
-                                       char *buf, apr_size_t *len)
+                                       char *buf, apr_size_t * len)
 {
     int sslOp;
 
@@ -191,11 +193,12 @@
         return APR_SUCCESS;
     }
     openssl_get_error(sock, sslOp);
-    return APR_EGENERAL; /* SSL error ? */
+    return APR_EGENERAL;        /* SSL error ? */
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_accept(apr_ssl_socket_t *newSock, 
-                                         apr_ssl_socket_t *oldSock, apr_pool_t *pool)
+APU_DECLARE(apr_status_t) apu_ssl_accept(apr_ssl_socket_t * newSock,
+                                         apr_ssl_socket_t * oldSock,
+                                         apr_pool_t * pool)
 {
     apu_ssl_socket_data_t *sslData = apr_pcalloc(pool, sizeof(*sslData));
     apr_os_sock_t fd;
@@ -230,7 +233,7 @@
     return APR_SUCCESS;
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_raw_error(apr_ssl_socket_t *sock)
+APU_DECLARE(apr_status_t) apu_ssl_raw_error(apr_ssl_socket_t * sock)
 {
     if (!sock->sslData)
         return APR_EINVAL;
@@ -241,7 +244,7 @@
     return APR_SUCCESS;
 }
 
-APU_DECLARE(apr_status_t) apr_evp_crypt_cleanup(apr_evp_crypt_t *e)
+APU_DECLARE(apr_status_t) apr_evp_crypt_cleanup(apr_evp_crypt_t * e)
 {
 
 #if HAVE_DECL_EVP_PKEY_CTX_NEW
@@ -261,11 +264,11 @@
 
 apr_status_t apr_evp_crypt_cleanup_helper(void *data)
 {
-    apr_evp_crypt_t *f = (apr_evp_crypt_t *)data;
+    apr_evp_crypt_t *f = (apr_evp_crypt_t *) data;
     return apr_evp_crypt_cleanup(f);
 }
 
-APU_DECLARE(apr_status_t) apr_evp_factory_cleanup(apr_evp_factory_t *f)
+APU_DECLARE(apr_status_t) apr_evp_factory_cleanup(apr_evp_factory_t * f)
 {
     apu_evp_data_t *evpData = f->evpData;
     int i;
@@ -289,7 +292,7 @@
 
 apr_status_t apr_evp_factory_cleanup_helper(void *data)
 {
-    apr_evp_factory_t *f = (apr_evp_factory_t *)data;
+    apr_evp_factory_t *f = (apr_evp_factory_t *) data;
     return apr_evp_factory_cleanup(f);
 }
 
@@ -298,15 +301,15 @@
     return apr_ssl_init();
 }
 
-APU_DECLARE(apr_status_t) apr_evp_factory_create(apr_evp_factory_t **newFactory,
-                                                 const char *privateKeyFn, 
-                                                 const char *certFn, 
+APU_DECLARE(apr_status_t) apr_evp_factory_create(apr_evp_factory_t ** newFactory,
+                                                 const char *privateKeyFn,
+                                                 const char *certFn,
                                                  const char *cipherName,
                                                  const char *passphrase,
                                                  const char *engine,
                                                  const char *digest,
                                                  apr_evp_factory_type_e purpose,
-                                                 apr_pool_t *pool)
+                                                 apr_pool_t * pool)
 {
     apr_evp_factory_t *f = apr_pcalloc(pool, sizeof(apr_evp_factory_t));
     apu_evp_data_t *data;
@@ -327,14 +330,14 @@
                               apr_pool_cleanup_null);
 
     switch (purpose) {
-        case APR_EVP_FACTORY_ASYM: {
+    case APR_EVP_FACTORY_ASYM:{
 #if HAVE_DECL_EVP_PKEY_CTX_NEW
             /* load certs */
             data->sslCtx = SSL_CTX_new(SSLv23_server_method());
             if (data->sslCtx) {
                 if (!SSL_CTX_use_PrivateKey_file(data->sslCtx, privateKeyFn,
                                                  SSL_FILETYPE_PEM) ||
-                    !SSL_CTX_use_certificate_file(data->sslCtx, certFn, 
+                    !SSL_CTX_use_certificate_file(data->sslCtx, certFn,
                                                   SSL_FILETYPE_PEM) ||
                     !SSL_CTX_check_private_key(data->sslCtx)) {
                     SSL_CTX_free(data->sslCtx);
@@ -354,7 +357,7 @@
             return APR_ENOTIMPL;
 #endif
         }
-        case APR_EVP_FACTORY_SYM: {
+    case APR_EVP_FACTORY_SYM:{
             data->cipher = EVP_get_cipherbyname(cipherName);
             if (!data->cipher) {
                 return APR_ENOCIPHER;
@@ -365,7 +368,7 @@
             }
             EVP_BytesToKey(data->cipher, data->md,
                            data->salt,
-                           (const unsigned char *)passphrase, strlen(passphrase), 1,
+                  (const unsigned char *) passphrase, strlen(passphrase), 1,
                            data->key, data->iv);
         }
     }
@@ -374,11 +377,11 @@
 
 }
 
-APU_DECLARE(apr_status_t) apr_evp_crypt_init(apr_evp_factory_t *f,
-                                             apr_evp_crypt_t **e,
+APU_DECLARE(apr_status_t) apr_evp_crypt_init(apr_evp_factory_t * f,
+                                             apr_evp_crypt_t ** e,
                                              apr_evp_crypt_type_e type,
                                              apr_evp_crypt_key_e key,
-                                             apr_pool_t *p)
+                                             apr_pool_t * p)
 {
     apu_evp_data_t *data = f->evpData;
 
@@ -394,7 +397,7 @@
     (*e)->key = key;
 
     switch (f->purpose) {
-        case APR_EVP_FACTORY_ASYM: {
+    case APR_EVP_FACTORY_ASYM:{
 #if HAVE_DECL_EVP_PKEY_CTX_NEW
 
             /* todo: add ENGINE support */
@@ -424,7 +427,7 @@
             return APR_ENOTIMPL;
 #endif
         }
-        case APR_EVP_FACTORY_SYM: {
+    case APR_EVP_FACTORY_SYM:{
             if (!(*e)->cipherCtx) {
                 (*e)->cipherCtx = apr_pcalloc(p, sizeof(EVP_CIPHER_CTX));
                 if (!(*e)->cipherCtx) {
@@ -441,16 +444,16 @@
 
 }
 
-APU_DECLARE(apr_status_t) apr_evp_crypt(apr_evp_crypt_t *e,
+APU_DECLARE(apr_status_t) apr_evp_crypt(apr_evp_crypt_t * e,
                                         unsigned char **out,
-                                        apr_size_t *outlen,
+                                        apr_size_t * outlen,
                                         const unsigned char *in,
                                         apr_size_t inlen)
 {
     unsigned char *buffer;
 
     switch (e->purpose) {
-        case APR_EVP_FACTORY_ASYM: {
+    case APR_EVP_FACTORY_ASYM:{
 #if HAVE_DECL_EVP_PKEY_CTX_NEW
             if (!out || !*out) {
                 if (APR_EVP_ENCRYPT == e->type &&
@@ -490,8 +493,8 @@
             return APR_ENOTIMPL;
 #endif
         }
-        case APR_EVP_FACTORY_SYM: {
-            int len = (int)*outlen;
+    case APR_EVP_FACTORY_SYM:{
+            int len = (int) *outlen;
             if (!out) {
                 *outlen = inlen + EVP_MAX_BLOCK_LENGTH;
                 return APR_SUCCESS;
@@ -503,10 +506,10 @@
                 }
                 *out = buffer;
             }
-            if(!EVP_CipherUpdate(e->cipherCtx, *out, &len, in, inlen)) {
+            if (!EVP_CipherUpdate(e->cipherCtx, *out, &len, in, inlen)) {
                 return APR_EGENERAL;
             }
-            *outlen = (apr_size_t)len;
+            *outlen = (apr_size_t) len;
             return APR_SUCCESS;
         }
     }
@@ -515,22 +518,22 @@
 
 }
 
-APU_DECLARE(apr_status_t) apr_evp_crypt_finish(apr_evp_crypt_t *e,
+APU_DECLARE(apr_status_t) apr_evp_crypt_finish(apr_evp_crypt_t * e,
                                                unsigned char *out,
-                                               apr_size_t *outlen)
+                                               apr_size_t * outlen)
 {
 
     switch (e->purpose) {
-        case APR_EVP_FACTORY_ASYM: {
+    case APR_EVP_FACTORY_ASYM:{
 #if HAVE_DECL_EVP_PKEY_CTX_NEW
             break;
 #else
             return APR_ENOTIMPL;
 #endif
         }
-        case APR_EVP_FACTORY_SYM: {
+    case APR_EVP_FACTORY_SYM:{
             int tlen;
-            if(!EVP_CipherFinal_ex(e->cipherCtx, out, &tlen)) {
+            if (!EVP_CipherFinal_ex(e->cipherCtx, out, &tlen)) {
                 return APR_EGENERAL;
             }
             *outlen = tlen;
@@ -544,4 +547,3 @@
 }
 
 #endif
-

Modified: apr/apr-util/trunk/ssl/apr_ssl_winsock.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/ssl/apr_ssl_winsock.c?rev=597895&r1=597894&r2=597895&view=diff
==============================================================================
--- apr/apr-util/trunk/ssl/apr_ssl_winsock.c (original)
+++ apr/apr-util/trunk/ssl/apr_ssl_winsock.c Sat Nov 24 09:29:36 2007
@@ -48,56 +48,55 @@
  * TODO - this should be expanded to generate the correct APR_ errors
  *        when we have created the mappings :-)
  */
-//static void openssl_get_error(apr_ssl_socket_t *sock, int fncode)
+//static void openssl_get_error(apr_ssl_socket_t * sock, int fncode)
 //{
-//    sock->sslData->err = fncode;
-//    sock->sslData->sslErr = SSL_get_error(sock->sslData->ssl, fncode);
+    //sock->sslData->err = fncode;
+    //sock->sslData->sslErr = SSL_get_error(sock->sslData->ssl, fncode);
 //}
 
-APU_DECLARE(apr_status_t) apu_ssl_factory_create(apr_ssl_factory_t *asf,
-                                 const char *privateKeyFn,
-                                 const char *certFn,
-                                 const char *digestType)
+APU_DECLARE(apr_status_t) apu_ssl_factory_create(apr_ssl_factory_t * asf,
+                                                 const char *privateKeyFn,
+                                                 const char *certFn,
+                                                 const char *digestType)
 {
     apu_ssl_data_t *sslData = apr_pcalloc(asf->pool, sizeof(*sslData));
     if (!sslData) {
         return -1;
     }
 
-//    if (privateKeyFn && certFn) {
-//        sslData->ctx = SSL_CTX_new(SSLv23_server_method());
-//        if (sslData->ctx) {
-//            if (!SSL_CTX_use_PrivateKey_file(sslData->ctx, privateKeyFn,
-//                                             SSL_FILETYPE_PEM) ||
-//                !SSL_CTX_use_certificate_file(sslData->ctx, certFn, 
-//                                              SSL_FILETYPE_PEM) ||
-//                !SSL_CTX_check_private_key(sslData->ctx)) {
-//                SSL_CTX_free(sslData->ctx);
-//                return APR_ENOENT; /* what code shoudl we return? */
-//            }
-//        }
-//    } else {
-//        sslData->ctx = SSL_CTX_new(SSLv23_client_method());
-//    }
-//
-//    if (digestType) {
-//        sslData->md = EVP_get_digestbyname(digestType);
-//        /* we don't care if this fails... */
-//    }
-//
-//    if (!sslData->ctx)
-//        return APR_EGENERAL; /* what error code? */
-
+    //if (privateKeyFn && certFn) {
+    //sslData->ctx = SSL_CTX_new(SSLv23_server_method());
+    //if (sslData->ctx) {
+        //if (!SSL_CTX_use_PrivateKey_file(sslData->ctx, privateKeyFn,
+                                           //SSL_FILETYPE_PEM) ||
+              //!SSL_CTX_use_certificate_file(sslData->ctx, certFn,
+                                              //SSL_FILETYPE_PEM) ||
+              //!SSL_CTX_check_private_key(sslData->ctx)) {
+            //SSL_CTX_free(sslData->ctx);
+            //return APR_ENOENT;        /* what code shoudl we return? */
+            // }
+        // }
+    // } else {
+        //sslData->ctx = SSL_CTX_new(SSLv23_client_method());
+    // }
+
+    //if (digestType) {
+        //sslData->md = EVP_get_digestbyname(digestType);
+        //                        /* we don't care if this fails... */
+    // }
+    //
+    //if (!sslData->ctx)
+        //return APR_EGENERAL;        /* what error code? */
 
     asf->sslData = sslData;
 
     return APR_SUCCESS;
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_socket_create(apr_ssl_socket_t *sslSock, 
-                                                apr_ssl_factory_t *asf)
+APU_DECLARE(apr_status_t) apu_ssl_socket_create(apr_ssl_socket_t * sslSock,
+                                                apr_ssl_factory_t * asf)
 {
-    apu_ssl_socket_data_t *sslData = apr_pcalloc(sslSock->pool, 
+    apu_ssl_socket_data_t *sslData = apr_pcalloc(sslSock->pool,
                                                  sizeof(*sslData));
     apr_os_sock_t fd;
     struct tlsclientopts sWS2Opts;
@@ -109,53 +108,55 @@
 
     if (!sslData || !asf->sslData)
         return -1;
-//    sslData->ssl = SSL_new(asf->sslData->ctx);
-//    if (!sslData->ssl)
-//        return -1;
-//
-//    if (apr_os_sock_get(&fd, sslSock->plain) != APR_SUCCESS)
-//        return -1;
-//
-//    SSL_set_fd(sslData->ssl, fd);
- 
+    //sslData->ssl = SSL_new(asf->sslData->ctx);
+    //if (!sslData->ssl)
+        //return -1;
+
+    //if (apr_os_sock_get(&fd, sslSock->plain) != APR_SUCCESS)
+        //return -1;
+
+    //SSL_set_fd(sslData->ssl, fd);
+
     apr_os_sock_get(&fd, sslSock->plain);
 
     /* zero out buffers */
-    memset((char *)&sWS2Opts, 0, sizeof(struct tlsclientopts));
-    memset((char *)&sNWTLSOpts, 0, sizeof(struct nwtlsopts));
+    memset((char *) &sWS2Opts, 0, sizeof(struct tlsclientopts));
+    memset((char *) &sNWTLSOpts, 0, sizeof(struct nwtlsopts));
 
     /* turn on ssl for the socket */
-//    ulFlags = (numcerts ? SO_TLS_ENABLE : SO_TLS_ENABLE | SO_TLS_BLIND_ACCEPT);
+    //ulFlags = (numcerts ? SO_TLS_ENABLE : SO_TLS_ENABLE | SO_TLS_BLIND_ACCEPT);
     ulFlags = SO_TLS_ENABLE | SO_TLS_BLIND_ACCEPT;
     rcode = WSAIoctl(fd, SO_TLS_SET_FLAGS, &ulFlags, sizeof(unsigned long),
-                 NULL, 0, NULL, NULL, NULL);
-    if (SOCKET_ERROR == rcode)
-    {
+                     NULL, 0, NULL, NULL, NULL);
+    if (SOCKET_ERROR == rcode) {
         return rcode;
     }
 
     ulFlags = SO_TLS_UNCLEAN_SHUTDOWN;
     WSAIoctl(fd, SO_TLS_SET_FLAGS, &ulFlags, sizeof(unsigned long),
-                 NULL, 0, NULL, NULL, NULL);
+             NULL, 0, NULL, NULL, NULL);
 
     /* setup the socket for SSL */
-    memset (&sWS2Opts, 0, sizeof(sWS2Opts));
-    memset (&sNWTLSOpts, 0, sizeof(sNWTLSOpts));
+    memset(&sWS2Opts, 0, sizeof(sWS2Opts));
+    memset(&sNWTLSOpts, 0, sizeof(sNWTLSOpts));
     sWS2Opts.options = &sNWTLSOpts;
 
-//    if (numcerts) {
-//        sNWTLSOpts.walletProvider = WAL_PROV_DER;   //the wallet provider defined in wdefs.h
-//        sNWTLSOpts.TrustedRootList = certarray;     //array of certs in UNICODE format
-//        sNWTLSOpts.numElementsInTRList = numcerts;  //number of certs in TRList
-//    }
-//    else {
+    //if (numcerts) {
+        //sNWTLSOpts.walletProvider = WAL_PROV_DER;
+        //the wallet provider defined in wdefs.h
+        // sNWTLSOpts.TrustedRootList = certarray;
+        //array of certs in UNICODE format
+        // sNWTLSOpts.numElementsInTRList = numcerts;
+        //number of certs in TRList
+    // } else {
         /* setup the socket for SSL */
-        unicpy(keyFileName, L"SSL CertificateIP");
-        sWS2Opts.wallet = keyFileName;    /* no client certificate */
+        unicpy(keyFileName, L "SSL CertificateIP");
+        sWS2Opts.wallet = keyFileName;        /* no client certificate */
         sWS2Opts.walletlen = unilen(keyFileName);
 
-        sNWTLSOpts.walletProvider = WAL_PROV_KMO;  //the wallet provider defined in wdefs.h
-//    }
+        sNWTLSOpts.walletProvider = WAL_PROV_KMO;
+        //the wallet provider defined in wdefs.h
+    // }
 
     /* make the IOCTL call */
     rcode = WSAIoctl(fd, SO_TLS_SET_CLIENT, &sWS2Opts,
@@ -163,64 +164,63 @@
                      NULL, NULL);
 
     /* make sure that it was successfull */
-    if(SOCKET_ERROR == rcode ) {
+    if (SOCKET_ERROR == rcode) {
         return rcode;
     }
- 
+
     sslSock->sslData = sslData;
 
     return APR_SUCCESS;
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_socket_close(apr_ssl_socket_t *sock)
+APU_DECLARE(apr_status_t) apu_ssl_socket_close(apr_ssl_socket_t * sock)
 {
-//    int sslRv;
-//    apr_status_t rv;
-//
-//    if (!sock->sslData->ssl)
-//        return APR_SUCCESS;
-//    if (sock->connected) {
-//        if ((sslRv = SSL_shutdown(sock->sslData->ssl)) == 0)
-//            sslRv = SSL_shutdown(sock->sslData->ssl);
-//        if (sslRv == -1)
-//            return -1;
-//    }
-//    SSL_free(sock->sslData->ssl);
-//    sock->sslData->ssl = NULL;
+    //int sslRv;
+    //apr_status_t rv;
+
+    //if (!sock->sslData->ssl)
+        //return APR_SUCCESS;
+    //if (sock->connected) {
+        //if ((sslRv = SSL_shutdown(sock->sslData->ssl)) == 0)
+            //sslRv = SSL_shutdown(sock->sslData->ssl);
+        //if (sslRv == -1)
+            //return -1;
+    // }
+    //SSL_free(sock->sslData->ssl);
+    //sock->sslData->ssl = NULL;
     return APR_SUCCESS;
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_connect(apr_ssl_socket_t *sock)
+APU_DECLARE(apr_status_t) apu_ssl_connect(apr_ssl_socket_t * sock)
 {
-//    int sslOp;
-//
-//    if (!sock->sslData->ssl)
-//        return APR_EINVAL;
-//
-//    if ((sslOp = SSL_connect(sock->sslData->ssl)) == 1) {
-//        sock->connected = 1;
-//        return APR_SUCCESS;
-//    }
-//    openssl_get_error(sock, sslOp);
+    //int sslOp;
+
+    //if (!sock->sslData->ssl)
+        //return APR_EINVAL;
+    //if ((sslOp = SSL_connect(sock->sslData->ssl)) == 1) {
+        //sock->connected = 1;
+        //return APR_SUCCESS;
+    // }
+    //openssl_get_error(sock, sslOp);
     return -1;
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_send(apr_ssl_socket_t *sock,
-                                       const char *buf, 
-                                       apr_size_t *len)
+APU_DECLARE(apr_status_t) apu_ssl_send(apr_ssl_socket_t * sock,
+                                       const char *buf,
+                                       apr_size_t * len)
 {
     return apr_socket_send(sock->plain, buf, len);
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_recv(apr_ssl_socket_t *sock,
-                                       char *buf, apr_size_t *len)
+APU_DECLARE(apr_status_t) apu_ssl_recv(apr_ssl_socket_t * sock,
+                                       char *buf, apr_size_t * len)
 {
     return apr_socket_recv(sock->plain, buf, len);
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_accept(apr_ssl_socket_t *newSock, 
-                                         apr_ssl_socket_t *oldSock,
-                                         apr_pool_t *pool)
+APU_DECLARE(apr_status_t) apu_ssl_accept(apr_ssl_socket_t * newSock,
+                                         apr_ssl_socket_t * oldSock,
+                                         apr_pool_t * pool)
 {
     apu_ssl_socket_data_t *sslData = apr_pcalloc(pool, sizeof(*sslData));
     apr_status_t ret;
@@ -236,7 +236,7 @@
     return ret;
 }
 
-APU_DECLARE(apr_status_t) apu_ssl_raw_error(apr_ssl_socket_t *sock)
+APU_DECLARE(apr_status_t) apu_ssl_raw_error(apr_ssl_socket_t * sock)
 {
     if (!sock->sslData)
         return APR_EINVAL;
@@ -247,12 +247,12 @@
     return APR_SUCCESS;
 }
 
-APU_DECLARE(apr_status_t) apr_evp_crypt_cleanup(apr_evp_crypt_t *e)
+APU_DECLARE(apr_status_t) apr_evp_crypt_cleanup(apr_evp_crypt_t * e)
 {
     return APR_ENOTIMPL;
 }
 
-APU_DECLARE(apr_status_t) apr_evp_factory_cleanup(apr_evp_factory_t *f)
+APU_DECLARE(apr_status_t) apr_evp_factory_cleanup(apr_evp_factory_t * f)
 {
     return APR_ENOTIMPL;
 }
@@ -262,43 +262,43 @@
     return APR_ENOTIMPL;
 }
 
-APU_DECLARE(apr_status_t) apr_evp_factory_create(apr_evp_factory_t **newFactory,
-                                                 const char *privateKeyFn, 
-                                                 const char *certFn, 
+APU_DECLARE(apr_status_t) apr_evp_factory_create(apr_evp_factory_t ** newFactory,
+                                                 const char *privateKeyFn,
+                                                 const char *certFn,
                                                  const char *cipherName,
                                                  const char *passphrase,
                                                  const char *engine,
                                                  const char *digest,
                                                  apr_evp_factory_type_e purpose,
-                                                 apr_pool_t *pool)
+                                                 apr_pool_t * pool)
 {
     return APR_ENOTIMPL;
 }
 
-APU_DECLARE(apr_status_t) apr_status_t apr_evp_crypt_init(apr_evp_factory_t *f,
-                                                          apr_evp_crypt_t **e,
-                                                          apr_evp_crypt_type_e type,
-                                                          apr_evp_crypt_key_e key,
-                                                          apr_pool_t *p)
+APU_DECLARE(apr_status_t)
+    apr_status_t apr_evp_crypt_init(apr_evp_factory_t * f,
+                                                 apr_evp_crypt_t ** e,
+                                                 apr_evp_crypt_type_e type,
+                                                 apr_evp_crypt_key_e key,
+                                                 apr_pool_t * p)
 {
     return APR_ENOTIMPL;
 }
 
 APU_DECLARE(apr_status_t) apr_evp_crypt(apr_evp_crypt_t *,
                                         unsigned char **out,
-                                        apr_size_t *outlen,
+                                        apr_size_t * outlen,
                                         const unsigned char *in,
                                         apr_size_t inlen)
 {
     return APR_ENOTIMPL;
 }
 
-APU_DECLARE(apr_status_t) apr_evp_crypt_finish(apr_evp_crypt_t *e,
+APU_DECLARE(apr_status_t) apr_evp_crypt_finish(apr_evp_crypt_t * e,
                                                unsigned char *out,
-                                               apr_size_t *outlen);
+                                               apr_size_t * outlen);
 {
     return APR_ENOTIMPL;
 }
 
 #endif
-



Mime
View raw message