Normal operation?

2002-10-09 Thread nishi
We're operating the network by using the function of OpenSSL. 
If taskmanager of Windows is seen during the network communication, 
the amount of the memory used will increase gradually. 
Is this normal workings?
In addition, it checked that the increase in the memory is not a memory leak by using 
"Purify".

The environment of operation is as follows:
Openssl Version:Openssl-0.9.6g
Operation System   :Windows2000 sp3

Please give me a reply.



The results of an investigation of memory necessary quantity and sample program are 
indicated below.

++--+
|  Windows   |DES:@STRENGHTH|
|  2000  ++++
||   Before   |   After| Difference |
+++++
| 100  times |1032|2444|1412|
+++++
| 1000 times |1028|2780|1752|
+++++
| 2000 times |1032|3044|2012|
+++++
| 3000 times |1028|3096|2068|
+++++


#include stdio.h
#include memory.h
#include string.h

#ifdef WIN32
#include winsock2.h 
#include io.h
#else
#include unistd.h
#include sys/socket.h
#include arpa/inet.h
#endif

#include openssl/ssl.h
#include openssl/err.h
#include openssl/rand.h


#define CIPHER_LIST_STR "ALL:@STRENGTH"
*/
#define CIPHER_LIST_STR "DES:@STRENGTH"

#define SERVER_IP   "255.255.255.255"
#define _SERVER_PORT5963
#define HELLO_MESSAGE   "Hello, World!"
#define QUIT_REQUEST"Shut you down."

#define SEND_FILE_1000KB"./SKDDL.cpp"   // about 100kb

int main(int argc, char **argv)
{
SSL_CTX *ctx = NULL;
SSL *ssl = NULL;
SSL_SESSION *session = NULL;
struct sockaddr_in sa;
int sd = -1;
int ret;
int err;
int len;
char buf[4096];

int exit_count = 1;

FILE *fp = NULL;

char *server_ip = SERVER_IP;
int server_port = _SERVER_PORT;

if (argc  1) {
server_ip = *(argv + 1);

if (argc  2) {
sscanf(*(argv + 2), "%d", server_port);
}
}

fprintf(stdout,"Ready...\n");

getchar();/* 0 */

//
SSL_library_init();

fprintf(stdout,"SSL_library_init\n");

//
SSL_load_error_strings();

fprintf(stdout,"SSL_load_error_strings\n");

//
while (RAND_status() == 0) {
int rnd = rand();
RAND_seed(rnd, sizeof(rnd));
}

fprintf(stdout,"RAND_status\n");

//
ctx = SSL_CTX_new(TLSv1_client_method());

fprintf(stdout,"SSL_CTX_new");

if (ctx == NULL) {
fprintf(stderr, "SSL_CTX_new() failed\n");
goto cleanup;
}

//
SSL_CTX_set_cipher_list(ctx, CIPHER_LIST_STR);

fprintf(stdout,"SSL_CTX_set_cipher_list");

//
ssl = SSL_new(ctx); 

fprintf(stdout,"SSL_new");

if (ssl == NULL) {
fprintf(stderr, "SSL_new() failed\n");
goto cleanup;
}

#ifdef WIN32
//
WORD wVersionRequested;
WSADATA wsaData;

wVersionRequested = MAKEWORD(2, 2);

if (WSAStartup(wVersionRequested, wsaData) != 0) {
fprintf(stderr,"WSAStartup failed\n");
goto cleanup;
}
#endif

fprintf(stdout,"WSAStartup");

start_connect:

fprintf(stdout,"\n** %d **\n", exit_count);

//
if (sd != -1) {
close(sd);
}

fprintf(stdout,"close\n");

sd = socket(AF_INET, SOCK_STREAM, 0);

if (sd == -1) {
//  fprintf(stderr, "socket() failed\n");
goto cleanup;
}

fprintf(stdout,"socket\n");

//
memset (sa, 0, sizeof(sa));
sa.sin_family   = AF_INET;
sa.sin_addr.s_addr  = inet_addr(server_ip);
sa.sin_port = htons(server_port);

ret = connect(sd, (struct sockaddr*)sa, sizeof(sa));

fprintf(stdout,"connect\n");

if (ret != 0) {
//  fprintf(stderr, "connect() failed\n");
goto cleanup;
}

//
SSL_set_fd(ssl, sd);

fprintf(stdout,"SSL_set_fd\n");

//
ret = SSL_connect(ssl);

fprintf(stdout,"SSL_connect\n");

if (ret != 1) {
err = SSL_get_error(ssl, ret);
ERR_error_string(err, buf);
fprintf(stderr, "SSL_connect() failed: %s\n", buf);
goto cleanup;
}

//  printf("SSL connection established.\n");

//
if(session != NULL){

Normal operation?

2002-10-07 Thread nishi
Hello.

We're operating the network by using the function of OpenSSL. 
If taskmanager of Windows is seen during the network communication, 
the amount of the memory used will increase gradually. 
Is this normal workings?
In addition, it checked that the increase in the memory is not a memory leak by using 
"Purify".

The environment of operation is as follows:
Openssl Version:Openssl-0.9.6g
Operation System   :Windows2000 sp3

Please give me a reply.



The results of an investigation of memory necessary quantity and sample program are 
indicated below.

++--+
|  Windows   |DES:@STRENGHTH|
|  2000  ++++
||   Before   |   After| Difference |
+++++
| 100  times |1032|2444|1412|
+++++
| 1000 times |1028|2780|1752|
+++++
| 2000 times |1032|3044|2012|
+++++
| 3000 times |1028|3096|2068|
+++++


#include stdio.h
#include memory.h
#include string.h

#ifdef WIN32
#include winsock2.h 
#include io.h
#else
#include unistd.h
#include sys/socket.h
#include arpa/inet.h
#endif

#include openssl/ssl.h
#include openssl/err.h
#include openssl/rand.h


#define CIPHER_LIST_STR "ALL:@STRENGTH"
*/
#define CIPHER_LIST_STR "DES:@STRENGTH"

#define SERVER_IP   "255.255.255.255"
#define _SERVER_PORT5963
#define HELLO_MESSAGE   "Hello, World!"
#define QUIT_REQUEST"Shut you down."

#define SEND_FILE_1000KB"./SKDDL.cpp"   // about 100kb

int main(int argc, char **argv)
{
SSL_CTX *ctx = NULL;
SSL *ssl = NULL;
SSL_SESSION *session = NULL;
struct sockaddr_in sa;
int sd = -1;
int ret;
int err;
int len;
char buf[4096];

int exit_count = 1;

FILE *fp = NULL;

char *server_ip = SERVER_IP;
int server_port = _SERVER_PORT;

if (argc  1) {
server_ip = *(argv + 1);

if (argc  2) {
sscanf(*(argv + 2), "%d", server_port);
}
}

fprintf(stdout,"Ready...\n");

getchar();/* 0 */

//
SSL_library_init();

fprintf(stdout,"SSL_library_init\n");

//
SSL_load_error_strings();

fprintf(stdout,"SSL_load_error_strings\n");

//
while (RAND_status() == 0) {
int rnd = rand();
RAND_seed(rnd, sizeof(rnd));
}

fprintf(stdout,"RAND_status\n");

//
ctx = SSL_CTX_new(TLSv1_client_method());

fprintf(stdout,"SSL_CTX_new");

if (ctx == NULL) {
fprintf(stderr, "SSL_CTX_new() failed\n");
goto cleanup;
}

//
SSL_CTX_set_cipher_list(ctx, CIPHER_LIST_STR);

fprintf(stdout,"SSL_CTX_set_cipher_list");

//
ssl = SSL_new(ctx); 

fprintf(stdout,"SSL_new");

if (ssl == NULL) {
fprintf(stderr, "SSL_new() failed\n");
goto cleanup;
}

#ifdef WIN32
//
WORD wVersionRequested;
WSADATA wsaData;

wVersionRequested = MAKEWORD(2, 2);

if (WSAStartup(wVersionRequested, wsaData) != 0) {
fprintf(stderr,"WSAStartup failed\n");
goto cleanup;
}
#endif

fprintf(stdout,"WSAStartup");

start_connect:

fprintf(stdout,"\n** %d **\n", exit_count);

//
if (sd != -1) {
close(sd);
}

fprintf(stdout,"close\n");

sd = socket(AF_INET, SOCK_STREAM, 0);

if (sd == -1) {
//  fprintf(stderr, "socket() failed\n");
goto cleanup;
}

fprintf(stdout,"socket\n");

//
memset (sa, 0, sizeof(sa));
sa.sin_family   = AF_INET;
sa.sin_addr.s_addr  = inet_addr(server_ip);
sa.sin_port = htons(server_port);

ret = connect(sd, (struct sockaddr*)sa, sizeof(sa));

fprintf(stdout,"connect\n");

if (ret != 0) {
//  fprintf(stderr, "connect() failed\n");
goto cleanup;
}

//
SSL_set_fd(ssl, sd);

fprintf(stdout,"SSL_set_fd\n");

//
ret = SSL_connect(ssl);

fprintf(stdout,"SSL_connect\n");

if (ret != 1) {
err = SSL_get_error(ssl, ret);
ERR_error_string(err, buf);
fprintf(stderr, "SSL_connect() failed: %s\n", buf);
goto cleanup;
}

//  printf("SSL connection established.\n");

//
if(session != NULL){